diff --git a/.gitignore b/.gitignore index 33d77522..f0abb9b0 100644 --- a/.gitignore +++ b/.gitignore @@ -3,6 +3,7 @@ lib dist .tsbuildinfo dist +examples/apollo-watch-fragments/public/bundle.js # This is purely pre-cautionary; when linting becomes slow, delete this eslintcache entry .eslintcache diff --git a/examples/apollo-watch-fragments/public/bundle.js b/examples/apollo-watch-fragments/public/bundle.js deleted file mode 100644 index 254dbb34..00000000 --- a/examples/apollo-watch-fragments/public/bundle.js +++ /dev/null @@ -1,82109 +0,0 @@ -/******/ (function() { // webpackBootstrap -/******/ var __webpack_modules__ = ({ - -/***/ "../../node_modules/@apollo/client/cache/core/cache.js": -/*!*************************************************************!*\ - !*** ../../node_modules/@apollo/client/cache/core/cache.js ***! - \*************************************************************/ -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "ApolloCache": function() { return /* binding */ ApolloCache; } -/* harmony export */ }); -/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! tslib */ "../../node_modules/tslib/tslib.es6.js"); -/* harmony import */ var optimism__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! optimism */ "../../node_modules/optimism/lib/bundle.esm.js"); -/* harmony import */ var _utilities_index_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../utilities/index.js */ "../../node_modules/@apollo/client/utilities/graphql/fragments.js"); - - - -var ApolloCache = (function () { - function ApolloCache() { - this.getFragmentDoc = (0,optimism__WEBPACK_IMPORTED_MODULE_0__.wrap)(_utilities_index_js__WEBPACK_IMPORTED_MODULE_1__.getFragmentQueryDocument); - } - ApolloCache.prototype.batch = function (options) { - var optimisticId = typeof options.optimistic === "string" ? options.optimistic : - options.optimistic === false ? null : void 0; - this.performTransaction(options.update, optimisticId); - }; - ApolloCache.prototype.recordOptimisticTransaction = function (transaction, optimisticId) { - this.performTransaction(transaction, optimisticId); - }; - ApolloCache.prototype.transformDocument = function (document) { - return document; - }; - ApolloCache.prototype.identify = function (object) { - return; - }; - ApolloCache.prototype.gc = function () { - return []; - }; - ApolloCache.prototype.modify = function (options) { - return false; - }; - ApolloCache.prototype.transformForLink = function (document) { - return document; - }; - ApolloCache.prototype.readQuery = function (options, optimistic) { - if (optimistic === void 0) { optimistic = !!options.optimistic; } - return this.read((0,tslib__WEBPACK_IMPORTED_MODULE_2__.__assign)((0,tslib__WEBPACK_IMPORTED_MODULE_2__.__assign)({}, options), { rootId: options.id || 'ROOT_QUERY', optimistic: optimistic })); - }; - ApolloCache.prototype.readFragment = function (options, optimistic) { - if (optimistic === void 0) { optimistic = !!options.optimistic; } - return this.read((0,tslib__WEBPACK_IMPORTED_MODULE_2__.__assign)((0,tslib__WEBPACK_IMPORTED_MODULE_2__.__assign)({}, options), { query: this.getFragmentDoc(options.fragment, options.fragmentName), rootId: options.id, optimistic: optimistic })); - }; - ApolloCache.prototype.writeQuery = function (_a) { - var id = _a.id, data = _a.data, options = (0,tslib__WEBPACK_IMPORTED_MODULE_2__.__rest)(_a, ["id", "data"]); - return this.write(Object.assign(options, { - dataId: id || 'ROOT_QUERY', - result: data, - })); - }; - ApolloCache.prototype.writeFragment = function (_a) { - var id = _a.id, data = _a.data, fragment = _a.fragment, fragmentName = _a.fragmentName, options = (0,tslib__WEBPACK_IMPORTED_MODULE_2__.__rest)(_a, ["id", "data", "fragment", "fragmentName"]); - return this.write(Object.assign(options, { - query: this.getFragmentDoc(fragment, fragmentName), - dataId: id, - result: data, - })); - }; - return ApolloCache; -}()); - -//# sourceMappingURL=cache.js.map - -/***/ }), - -/***/ "../../node_modules/@apollo/client/cache/core/types/common.js": -/*!********************************************************************!*\ - !*** ../../node_modules/@apollo/client/cache/core/types/common.js ***! - \********************************************************************/ -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "MissingFieldError": function() { return /* binding */ MissingFieldError; } -/* harmony export */ }); -/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ "../../node_modules/tslib/tslib.es6.js"); - -var MissingFieldError = (function (_super) { - (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__extends)(MissingFieldError, _super); - function MissingFieldError(message, path, query, variables) { - var _this = _super.call(this, message) || this; - _this.message = message; - _this.path = path; - _this.query = query; - _this.variables = variables; - _this.__proto__ = MissingFieldError.prototype; - return _this; - } - return MissingFieldError; -}(Error)); - -//# sourceMappingURL=common.js.map - -/***/ }), - -/***/ "../../node_modules/@apollo/client/cache/inmemory/entityStore.js": -/*!***********************************************************************!*\ - !*** ../../node_modules/@apollo/client/cache/inmemory/entityStore.js ***! - \***********************************************************************/ -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "EntityStore": function() { return /* binding */ EntityStore; }, -/* harmony export */ "maybeDependOnExistenceOfEntity": function() { return /* binding */ maybeDependOnExistenceOfEntity; }, -/* harmony export */ "supportsResultCaching": function() { return /* binding */ supportsResultCaching; } -/* harmony export */ }); -/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! tslib */ "../../node_modules/tslib/tslib.es6.js"); -/* harmony import */ var _utilities_globals_index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../utilities/globals/index.js */ "../../node_modules/@apollo/client/utilities/globals/index.js"); -/* harmony import */ var optimism__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! optimism */ "../../node_modules/optimism/lib/bundle.esm.js"); -/* harmony import */ var _wry_equality__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @wry/equality */ "../../node_modules/@wry/equality/lib/equality.esm.js"); -/* harmony import */ var _wry_trie__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @wry/trie */ "../../node_modules/@wry/trie/lib/trie.esm.js"); -/* harmony import */ var _utilities_index_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../utilities/index.js */ "../../node_modules/@apollo/client/utilities/common/maybeDeepFreeze.js"); -/* harmony import */ var _utilities_index_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../utilities/index.js */ "../../node_modules/@apollo/client/utilities/graphql/storeUtils.js"); -/* harmony import */ var _utilities_index_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../../utilities/index.js */ "../../node_modules/@apollo/client/utilities/common/mergeDeep.js"); -/* harmony import */ var _utilities_index_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../../utilities/index.js */ "../../node_modules/@apollo/client/utilities/common/objects.js"); -/* harmony import */ var _utilities_index_js__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../../utilities/index.js */ "../../node_modules/@apollo/client/utilities/common/canUse.js"); -/* harmony import */ var _helpers_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./helpers.js */ "../../node_modules/@apollo/client/cache/inmemory/helpers.js"); - - - - - - - -var DELETE = Object.create(null); -var delModifier = function () { return DELETE; }; -var INVALIDATE = Object.create(null); -var EntityStore = (function () { - function EntityStore(policies, group) { - var _this = this; - this.policies = policies; - this.group = group; - this.data = Object.create(null); - this.rootIds = Object.create(null); - this.refs = Object.create(null); - this.getFieldValue = function (objectOrReference, storeFieldName) { return (0,_utilities_index_js__WEBPACK_IMPORTED_MODULE_4__.maybeDeepFreeze)((0,_utilities_index_js__WEBPACK_IMPORTED_MODULE_5__.isReference)(objectOrReference) - ? _this.get(objectOrReference.__ref, storeFieldName) - : objectOrReference && objectOrReference[storeFieldName]); }; - this.canRead = function (objOrRef) { - return (0,_utilities_index_js__WEBPACK_IMPORTED_MODULE_5__.isReference)(objOrRef) - ? _this.has(objOrRef.__ref) - : typeof objOrRef === "object"; - }; - this.toReference = function (objOrIdOrRef, mergeIntoStore) { - if (typeof objOrIdOrRef === "string") { - return (0,_utilities_index_js__WEBPACK_IMPORTED_MODULE_5__.makeReference)(objOrIdOrRef); - } - if ((0,_utilities_index_js__WEBPACK_IMPORTED_MODULE_5__.isReference)(objOrIdOrRef)) { - return objOrIdOrRef; - } - var id = _this.policies.identify(objOrIdOrRef)[0]; - if (id) { - var ref = (0,_utilities_index_js__WEBPACK_IMPORTED_MODULE_5__.makeReference)(id); - if (mergeIntoStore) { - _this.merge(id, objOrIdOrRef); - } - return ref; - } - }; - } - EntityStore.prototype.toObject = function () { - return (0,tslib__WEBPACK_IMPORTED_MODULE_6__.__assign)({}, this.data); - }; - EntityStore.prototype.has = function (dataId) { - return this.lookup(dataId, true) !== void 0; - }; - EntityStore.prototype.get = function (dataId, fieldName) { - this.group.depend(dataId, fieldName); - if (_helpers_js__WEBPACK_IMPORTED_MODULE_7__.hasOwn.call(this.data, dataId)) { - var storeObject = this.data[dataId]; - if (storeObject && _helpers_js__WEBPACK_IMPORTED_MODULE_7__.hasOwn.call(storeObject, fieldName)) { - return storeObject[fieldName]; - } - } - if (fieldName === "__typename" && - _helpers_js__WEBPACK_IMPORTED_MODULE_7__.hasOwn.call(this.policies.rootTypenamesById, dataId)) { - return this.policies.rootTypenamesById[dataId]; - } - if (this instanceof Layer) { - return this.parent.get(dataId, fieldName); - } - }; - EntityStore.prototype.lookup = function (dataId, dependOnExistence) { - if (dependOnExistence) - this.group.depend(dataId, "__exists"); - if (_helpers_js__WEBPACK_IMPORTED_MODULE_7__.hasOwn.call(this.data, dataId)) { - return this.data[dataId]; - } - if (this instanceof Layer) { - return this.parent.lookup(dataId, dependOnExistence); - } - if (this.policies.rootTypenamesById[dataId]) { - return Object.create(null); - } - }; - EntityStore.prototype.merge = function (older, newer) { - var _this = this; - var dataId; - if ((0,_utilities_index_js__WEBPACK_IMPORTED_MODULE_5__.isReference)(older)) - older = older.__ref; - if ((0,_utilities_index_js__WEBPACK_IMPORTED_MODULE_5__.isReference)(newer)) - newer = newer.__ref; - var existing = typeof older === "string" - ? this.lookup(dataId = older) - : older; - var incoming = typeof newer === "string" - ? this.lookup(dataId = newer) - : newer; - if (!incoming) - return; - __DEV__ ? (0,_utilities_globals_index_js__WEBPACK_IMPORTED_MODULE_0__.invariant)(typeof dataId === "string", "store.merge expects a string ID") : (0,_utilities_globals_index_js__WEBPACK_IMPORTED_MODULE_0__.invariant)(typeof dataId === "string", 1); - var merged = new _utilities_index_js__WEBPACK_IMPORTED_MODULE_8__.DeepMerger(storeObjectReconciler).merge(existing, incoming); - this.data[dataId] = merged; - if (merged !== existing) { - delete this.refs[dataId]; - if (this.group.caching) { - var fieldsToDirty_1 = Object.create(null); - if (!existing) - fieldsToDirty_1.__exists = 1; - Object.keys(incoming).forEach(function (storeFieldName) { - if (!existing || existing[storeFieldName] !== merged[storeFieldName]) { - fieldsToDirty_1[storeFieldName] = 1; - var fieldName = (0,_helpers_js__WEBPACK_IMPORTED_MODULE_7__.fieldNameFromStoreName)(storeFieldName); - if (fieldName !== storeFieldName && - !_this.policies.hasKeyArgs(merged.__typename, fieldName)) { - fieldsToDirty_1[fieldName] = 1; - } - if (merged[storeFieldName] === void 0 && !(_this instanceof Layer)) { - delete merged[storeFieldName]; - } - } - }); - if (fieldsToDirty_1.__typename && - !(existing && existing.__typename) && - this.policies.rootTypenamesById[dataId] === merged.__typename) { - delete fieldsToDirty_1.__typename; - } - Object.keys(fieldsToDirty_1).forEach(function (fieldName) { return _this.group.dirty(dataId, fieldName); }); - } - } - }; - EntityStore.prototype.modify = function (dataId, fields) { - var _this = this; - var storeObject = this.lookup(dataId); - if (storeObject) { - var changedFields_1 = Object.create(null); - var needToMerge_1 = false; - var allDeleted_1 = true; - var sharedDetails_1 = { - DELETE: DELETE, - INVALIDATE: INVALIDATE, - isReference: _utilities_index_js__WEBPACK_IMPORTED_MODULE_5__.isReference, - toReference: this.toReference, - canRead: this.canRead, - readField: function (fieldNameOrOptions, from) { return _this.policies.readField(typeof fieldNameOrOptions === "string" ? { - fieldName: fieldNameOrOptions, - from: from || (0,_utilities_index_js__WEBPACK_IMPORTED_MODULE_5__.makeReference)(dataId), - } : fieldNameOrOptions, { store: _this }); }, - }; - Object.keys(storeObject).forEach(function (storeFieldName) { - var fieldName = (0,_helpers_js__WEBPACK_IMPORTED_MODULE_7__.fieldNameFromStoreName)(storeFieldName); - var fieldValue = storeObject[storeFieldName]; - if (fieldValue === void 0) - return; - var modify = typeof fields === "function" - ? fields - : fields[storeFieldName] || fields[fieldName]; - if (modify) { - var newValue = modify === delModifier ? DELETE : - modify((0,_utilities_index_js__WEBPACK_IMPORTED_MODULE_4__.maybeDeepFreeze)(fieldValue), (0,tslib__WEBPACK_IMPORTED_MODULE_6__.__assign)((0,tslib__WEBPACK_IMPORTED_MODULE_6__.__assign)({}, sharedDetails_1), { fieldName: fieldName, storeFieldName: storeFieldName, storage: _this.getStorage(dataId, storeFieldName) })); - if (newValue === INVALIDATE) { - _this.group.dirty(dataId, storeFieldName); - } - else { - if (newValue === DELETE) - newValue = void 0; - if (newValue !== fieldValue) { - changedFields_1[storeFieldName] = newValue; - needToMerge_1 = true; - fieldValue = newValue; - } - } - } - if (fieldValue !== void 0) { - allDeleted_1 = false; - } - }); - if (needToMerge_1) { - this.merge(dataId, changedFields_1); - if (allDeleted_1) { - if (this instanceof Layer) { - this.data[dataId] = void 0; - } - else { - delete this.data[dataId]; - } - this.group.dirty(dataId, "__exists"); - } - return true; - } - } - return false; - }; - EntityStore.prototype.delete = function (dataId, fieldName, args) { - var _a; - var storeObject = this.lookup(dataId); - if (storeObject) { - var typename = this.getFieldValue(storeObject, "__typename"); - var storeFieldName = fieldName && args - ? this.policies.getStoreFieldName({ typename: typename, fieldName: fieldName, args: args }) - : fieldName; - return this.modify(dataId, storeFieldName ? (_a = {}, - _a[storeFieldName] = delModifier, - _a) : delModifier); - } - return false; - }; - EntityStore.prototype.evict = function (options) { - var evicted = false; - if (options.id) { - if (_helpers_js__WEBPACK_IMPORTED_MODULE_7__.hasOwn.call(this.data, options.id)) { - evicted = this.delete(options.id, options.fieldName, options.args); - } - if (this instanceof Layer) { - evicted = this.parent.evict(options) || evicted; - } - if (options.fieldName || evicted) { - this.group.dirty(options.id, options.fieldName || "__exists"); - } - } - return evicted; - }; - EntityStore.prototype.clear = function () { - this.replace(null); - }; - EntityStore.prototype.extract = function () { - var _this = this; - var obj = this.toObject(); - var extraRootIds = []; - this.getRootIdSet().forEach(function (id) { - if (!_helpers_js__WEBPACK_IMPORTED_MODULE_7__.hasOwn.call(_this.policies.rootTypenamesById, id)) { - extraRootIds.push(id); - } - }); - if (extraRootIds.length) { - obj.__META = { extraRootIds: extraRootIds.sort() }; - } - return obj; - }; - EntityStore.prototype.replace = function (newData) { - var _this = this; - Object.keys(this.data).forEach(function (dataId) { - if (!(newData && _helpers_js__WEBPACK_IMPORTED_MODULE_7__.hasOwn.call(newData, dataId))) { - _this.delete(dataId); - } - }); - if (newData) { - var __META = newData.__META, rest_1 = (0,tslib__WEBPACK_IMPORTED_MODULE_6__.__rest)(newData, ["__META"]); - Object.keys(rest_1).forEach(function (dataId) { - _this.merge(dataId, rest_1[dataId]); - }); - if (__META) { - __META.extraRootIds.forEach(this.retain, this); - } - } - }; - EntityStore.prototype.retain = function (rootId) { - return this.rootIds[rootId] = (this.rootIds[rootId] || 0) + 1; - }; - EntityStore.prototype.release = function (rootId) { - if (this.rootIds[rootId] > 0) { - var count = --this.rootIds[rootId]; - if (!count) - delete this.rootIds[rootId]; - return count; - } - return 0; - }; - EntityStore.prototype.getRootIdSet = function (ids) { - if (ids === void 0) { ids = new Set(); } - Object.keys(this.rootIds).forEach(ids.add, ids); - if (this instanceof Layer) { - this.parent.getRootIdSet(ids); - } - else { - Object.keys(this.policies.rootTypenamesById).forEach(ids.add, ids); - } - return ids; - }; - EntityStore.prototype.gc = function () { - var _this = this; - var ids = this.getRootIdSet(); - var snapshot = this.toObject(); - ids.forEach(function (id) { - if (_helpers_js__WEBPACK_IMPORTED_MODULE_7__.hasOwn.call(snapshot, id)) { - Object.keys(_this.findChildRefIds(id)).forEach(ids.add, ids); - delete snapshot[id]; - } - }); - var idsToRemove = Object.keys(snapshot); - if (idsToRemove.length) { - var root_1 = this; - while (root_1 instanceof Layer) - root_1 = root_1.parent; - idsToRemove.forEach(function (id) { return root_1.delete(id); }); - } - return idsToRemove; - }; - EntityStore.prototype.findChildRefIds = function (dataId) { - if (!_helpers_js__WEBPACK_IMPORTED_MODULE_7__.hasOwn.call(this.refs, dataId)) { - var found_1 = this.refs[dataId] = Object.create(null); - var root = this.data[dataId]; - if (!root) - return found_1; - var workSet_1 = new Set([root]); - workSet_1.forEach(function (obj) { - if ((0,_utilities_index_js__WEBPACK_IMPORTED_MODULE_5__.isReference)(obj)) { - found_1[obj.__ref] = true; - } - if ((0,_utilities_index_js__WEBPACK_IMPORTED_MODULE_9__.isNonNullObject)(obj)) { - Object.keys(obj).forEach(function (key) { - var child = obj[key]; - if ((0,_utilities_index_js__WEBPACK_IMPORTED_MODULE_9__.isNonNullObject)(child)) { - workSet_1.add(child); - } - }); - } - }); - } - return this.refs[dataId]; - }; - EntityStore.prototype.makeCacheKey = function () { - return this.group.keyMaker.lookupArray(arguments); - }; - return EntityStore; -}()); - -var CacheGroup = (function () { - function CacheGroup(caching, parent) { - if (parent === void 0) { parent = null; } - this.caching = caching; - this.parent = parent; - this.d = null; - this.resetCaching(); - } - CacheGroup.prototype.resetCaching = function () { - this.d = this.caching ? (0,optimism__WEBPACK_IMPORTED_MODULE_1__.dep)() : null; - this.keyMaker = new _wry_trie__WEBPACK_IMPORTED_MODULE_3__.Trie(_utilities_index_js__WEBPACK_IMPORTED_MODULE_10__.canUseWeakMap); - }; - CacheGroup.prototype.depend = function (dataId, storeFieldName) { - if (this.d) { - this.d(makeDepKey(dataId, storeFieldName)); - var fieldName = (0,_helpers_js__WEBPACK_IMPORTED_MODULE_7__.fieldNameFromStoreName)(storeFieldName); - if (fieldName !== storeFieldName) { - this.d(makeDepKey(dataId, fieldName)); - } - if (this.parent) { - this.parent.depend(dataId, storeFieldName); - } - } - }; - CacheGroup.prototype.dirty = function (dataId, storeFieldName) { - if (this.d) { - this.d.dirty(makeDepKey(dataId, storeFieldName), storeFieldName === "__exists" ? "forget" : "setDirty"); - } - }; - return CacheGroup; -}()); -function makeDepKey(dataId, storeFieldName) { - return storeFieldName + '#' + dataId; -} -function maybeDependOnExistenceOfEntity(store, entityId) { - if (supportsResultCaching(store)) { - store.group.depend(entityId, "__exists"); - } -} -(function (EntityStore) { - var Root = (function (_super) { - (0,tslib__WEBPACK_IMPORTED_MODULE_6__.__extends)(Root, _super); - function Root(_a) { - var policies = _a.policies, _b = _a.resultCaching, resultCaching = _b === void 0 ? true : _b, seed = _a.seed; - var _this = _super.call(this, policies, new CacheGroup(resultCaching)) || this; - _this.stump = new Stump(_this); - _this.storageTrie = new _wry_trie__WEBPACK_IMPORTED_MODULE_3__.Trie(_utilities_index_js__WEBPACK_IMPORTED_MODULE_10__.canUseWeakMap); - if (seed) - _this.replace(seed); - return _this; - } - Root.prototype.addLayer = function (layerId, replay) { - return this.stump.addLayer(layerId, replay); - }; - Root.prototype.removeLayer = function () { - return this; - }; - Root.prototype.getStorage = function () { - return this.storageTrie.lookupArray(arguments); - }; - return Root; - }(EntityStore)); - EntityStore.Root = Root; -})(EntityStore || (EntityStore = {})); -var Layer = (function (_super) { - (0,tslib__WEBPACK_IMPORTED_MODULE_6__.__extends)(Layer, _super); - function Layer(id, parent, replay, group) { - var _this = _super.call(this, parent.policies, group) || this; - _this.id = id; - _this.parent = parent; - _this.replay = replay; - _this.group = group; - replay(_this); - return _this; - } - Layer.prototype.addLayer = function (layerId, replay) { - return new Layer(layerId, this, replay, this.group); - }; - Layer.prototype.removeLayer = function (layerId) { - var _this = this; - var parent = this.parent.removeLayer(layerId); - if (layerId === this.id) { - if (this.group.caching) { - Object.keys(this.data).forEach(function (dataId) { - var ownStoreObject = _this.data[dataId]; - var parentStoreObject = parent["lookup"](dataId); - if (!parentStoreObject) { - _this.delete(dataId); - } - else if (!ownStoreObject) { - _this.group.dirty(dataId, "__exists"); - Object.keys(parentStoreObject).forEach(function (storeFieldName) { - _this.group.dirty(dataId, storeFieldName); - }); - } - else if (ownStoreObject !== parentStoreObject) { - Object.keys(ownStoreObject).forEach(function (storeFieldName) { - if (!(0,_wry_equality__WEBPACK_IMPORTED_MODULE_2__.equal)(ownStoreObject[storeFieldName], parentStoreObject[storeFieldName])) { - _this.group.dirty(dataId, storeFieldName); - } - }); - } - }); - } - return parent; - } - if (parent === this.parent) - return this; - return parent.addLayer(this.id, this.replay); - }; - Layer.prototype.toObject = function () { - return (0,tslib__WEBPACK_IMPORTED_MODULE_6__.__assign)((0,tslib__WEBPACK_IMPORTED_MODULE_6__.__assign)({}, this.parent.toObject()), this.data); - }; - Layer.prototype.findChildRefIds = function (dataId) { - var fromParent = this.parent.findChildRefIds(dataId); - return _helpers_js__WEBPACK_IMPORTED_MODULE_7__.hasOwn.call(this.data, dataId) ? (0,tslib__WEBPACK_IMPORTED_MODULE_6__.__assign)((0,tslib__WEBPACK_IMPORTED_MODULE_6__.__assign)({}, fromParent), _super.prototype.findChildRefIds.call(this, dataId)) : fromParent; - }; - Layer.prototype.getStorage = function () { - var p = this.parent; - while (p.parent) - p = p.parent; - return p.getStorage.apply(p, arguments); - }; - return Layer; -}(EntityStore)); -var Stump = (function (_super) { - (0,tslib__WEBPACK_IMPORTED_MODULE_6__.__extends)(Stump, _super); - function Stump(root) { - return _super.call(this, "EntityStore.Stump", root, function () { }, new CacheGroup(root.group.caching, root.group)) || this; - } - Stump.prototype.removeLayer = function () { - return this; - }; - Stump.prototype.merge = function () { - return this.parent.merge.apply(this.parent, arguments); - }; - return Stump; -}(Layer)); -function storeObjectReconciler(existingObject, incomingObject, property) { - var existingValue = existingObject[property]; - var incomingValue = incomingObject[property]; - return (0,_wry_equality__WEBPACK_IMPORTED_MODULE_2__.equal)(existingValue, incomingValue) ? existingValue : incomingValue; -} -function supportsResultCaching(store) { - return !!(store instanceof EntityStore && store.group.caching); -} -//# sourceMappingURL=entityStore.js.map - -/***/ }), - -/***/ "../../node_modules/@apollo/client/cache/inmemory/helpers.js": -/*!*******************************************************************!*\ - !*** ../../node_modules/@apollo/client/cache/inmemory/helpers.js ***! - \*******************************************************************/ -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "hasOwn": function() { return /* binding */ hasOwn; }, -/* harmony export */ "getTypenameFromStoreObject": function() { return /* binding */ getTypenameFromStoreObject; }, -/* harmony export */ "TypeOrFieldNameRegExp": function() { return /* binding */ TypeOrFieldNameRegExp; }, -/* harmony export */ "fieldNameFromStoreName": function() { return /* binding */ fieldNameFromStoreName; }, -/* harmony export */ "selectionSetMatchesResult": function() { return /* binding */ selectionSetMatchesResult; }, -/* harmony export */ "storeValueIsStoreObject": function() { return /* binding */ storeValueIsStoreObject; }, -/* harmony export */ "makeProcessedFieldsMerger": function() { return /* binding */ makeProcessedFieldsMerger; } -/* harmony export */ }); -/* harmony import */ var _utilities_index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../utilities/index.js */ "../../node_modules/@apollo/client/utilities/graphql/storeUtils.js"); -/* harmony import */ var _utilities_index_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../utilities/index.js */ "../../node_modules/@apollo/client/utilities/common/objects.js"); -/* harmony import */ var _utilities_index_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../utilities/index.js */ "../../node_modules/@apollo/client/utilities/graphql/directives.js"); -/* harmony import */ var _utilities_index_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../utilities/index.js */ "../../node_modules/@apollo/client/utilities/common/mergeDeep.js"); - -var hasOwn = Object.prototype.hasOwnProperty; -function getTypenameFromStoreObject(store, objectOrReference) { - return (0,_utilities_index_js__WEBPACK_IMPORTED_MODULE_0__.isReference)(objectOrReference) - ? store.get(objectOrReference.__ref, "__typename") - : objectOrReference && objectOrReference.__typename; -} -var TypeOrFieldNameRegExp = /^[_a-z][_0-9a-z]*/i; -function fieldNameFromStoreName(storeFieldName) { - var match = storeFieldName.match(TypeOrFieldNameRegExp); - return match ? match[0] : storeFieldName; -} -function selectionSetMatchesResult(selectionSet, result, variables) { - if ((0,_utilities_index_js__WEBPACK_IMPORTED_MODULE_1__.isNonNullObject)(result)) { - return Array.isArray(result) - ? result.every(function (item) { return selectionSetMatchesResult(selectionSet, item, variables); }) - : selectionSet.selections.every(function (field) { - if ((0,_utilities_index_js__WEBPACK_IMPORTED_MODULE_0__.isField)(field) && (0,_utilities_index_js__WEBPACK_IMPORTED_MODULE_2__.shouldInclude)(field, variables)) { - var key = (0,_utilities_index_js__WEBPACK_IMPORTED_MODULE_0__.resultKeyNameFromField)(field); - return hasOwn.call(result, key) && - (!field.selectionSet || - selectionSetMatchesResult(field.selectionSet, result[key], variables)); - } - return true; - }); - } - return false; -} -function storeValueIsStoreObject(value) { - return (0,_utilities_index_js__WEBPACK_IMPORTED_MODULE_1__.isNonNullObject)(value) && - !(0,_utilities_index_js__WEBPACK_IMPORTED_MODULE_0__.isReference)(value) && - !Array.isArray(value); -} -function makeProcessedFieldsMerger() { - return new _utilities_index_js__WEBPACK_IMPORTED_MODULE_3__.DeepMerger; -} -//# sourceMappingURL=helpers.js.map - -/***/ }), - -/***/ "../../node_modules/@apollo/client/cache/inmemory/inMemoryCache.js": -/*!*************************************************************************!*\ - !*** ../../node_modules/@apollo/client/cache/inmemory/inMemoryCache.js ***! - \*************************************************************************/ -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "InMemoryCache": function() { return /* binding */ InMemoryCache; } -/* harmony export */ }); -/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! tslib */ "../../node_modules/tslib/tslib.es6.js"); -/* harmony import */ var optimism__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! optimism */ "../../node_modules/optimism/lib/bundle.esm.js"); -/* harmony import */ var _wry_equality__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @wry/equality */ "../../node_modules/@wry/equality/lib/equality.esm.js"); -/* harmony import */ var _core_cache_js__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ../core/cache.js */ "../../node_modules/@apollo/client/cache/core/cache.js"); -/* harmony import */ var _core_types_common_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../core/types/common.js */ "../../node_modules/@apollo/client/cache/core/types/common.js"); -/* harmony import */ var _utilities_index_js__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ../../utilities/index.js */ "../../node_modules/@apollo/client/utilities/graphql/storeUtils.js"); -/* harmony import */ var _utilities_index_js__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ../../utilities/index.js */ "../../node_modules/@apollo/client/utilities/graphql/transform.js"); -/* harmony import */ var _readFromStore_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./readFromStore.js */ "../../node_modules/@apollo/client/cache/inmemory/readFromStore.js"); -/* harmony import */ var _writeToStore_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./writeToStore.js */ "../../node_modules/@apollo/client/cache/inmemory/writeToStore.js"); -/* harmony import */ var _entityStore_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./entityStore.js */ "../../node_modules/@apollo/client/cache/inmemory/entityStore.js"); -/* harmony import */ var _reactiveVars_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./reactiveVars.js */ "../../node_modules/@apollo/client/cache/inmemory/reactiveVars.js"); -/* harmony import */ var _policies_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./policies.js */ "../../node_modules/@apollo/client/cache/inmemory/policies.js"); -/* harmony import */ var _helpers_js__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./helpers.js */ "../../node_modules/@apollo/client/cache/inmemory/helpers.js"); -/* harmony import */ var _object_canon_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./object-canon.js */ "../../node_modules/@apollo/client/cache/inmemory/object-canon.js"); - - - - - - - - - - - - - - -var defaultConfig = { - dataIdFromObject: _policies_js__WEBPACK_IMPORTED_MODULE_2__.defaultDataIdFromObject, - addTypename: true, - resultCaching: true, - typePolicies: {}, -}; -var InMemoryCache = (function (_super) { - (0,tslib__WEBPACK_IMPORTED_MODULE_3__.__extends)(InMemoryCache, _super); - function InMemoryCache(config) { - if (config === void 0) { config = {}; } - var _this = _super.call(this) || this; - _this.watches = new Set(); - _this.typenameDocumentCache = new Map(); - _this.makeVar = _reactiveVars_js__WEBPACK_IMPORTED_MODULE_4__.makeVar; - _this.txCount = 0; - _this.config = (0,tslib__WEBPACK_IMPORTED_MODULE_3__.__assign)((0,tslib__WEBPACK_IMPORTED_MODULE_3__.__assign)({}, defaultConfig), config); - _this.addTypename = !!_this.config.addTypename; - _this.policies = new _policies_js__WEBPACK_IMPORTED_MODULE_2__.Policies({ - cache: _this, - dataIdFromObject: _this.config.dataIdFromObject, - possibleTypes: _this.config.possibleTypes, - typePolicies: _this.config.typePolicies, - }); - _this.init(); - return _this; - } - InMemoryCache.prototype.init = function () { - var rootStore = this.data = new _entityStore_js__WEBPACK_IMPORTED_MODULE_5__.EntityStore.Root({ - policies: this.policies, - resultCaching: this.config.resultCaching, - }); - this.optimisticData = rootStore.stump; - this.resetResultCache(); - }; - InMemoryCache.prototype.resetResultCache = function (resetResultIdentities) { - var _this = this; - var previousReader = this.storeReader; - this.storeWriter = new _writeToStore_js__WEBPACK_IMPORTED_MODULE_6__.StoreWriter(this, this.storeReader = new _readFromStore_js__WEBPACK_IMPORTED_MODULE_7__.StoreReader({ - cache: this, - addTypename: this.addTypename, - resultCacheMaxSize: this.config.resultCacheMaxSize, - canon: resetResultIdentities - ? void 0 - : previousReader && previousReader.canon, - })); - this.maybeBroadcastWatch = (0,optimism__WEBPACK_IMPORTED_MODULE_0__.wrap)(function (c, options) { - return _this.broadcastWatch(c, options); - }, { - max: this.config.resultCacheMaxSize, - makeCacheKey: function (c) { - var store = c.optimistic ? _this.optimisticData : _this.data; - if ((0,_entityStore_js__WEBPACK_IMPORTED_MODULE_5__.supportsResultCaching)(store)) { - var optimistic = c.optimistic, rootId = c.rootId, variables = c.variables; - return store.makeCacheKey(c.query, c.callback, (0,_object_canon_js__WEBPACK_IMPORTED_MODULE_8__.canonicalStringify)({ optimistic: optimistic, rootId: rootId, variables: variables })); - } - } - }); - new Set([ - this.data.group, - this.optimisticData.group, - ]).forEach(function (group) { return group.resetCaching(); }); - }; - InMemoryCache.prototype.restore = function (data) { - this.init(); - if (data) - this.data.replace(data); - return this; - }; - InMemoryCache.prototype.extract = function (optimistic) { - if (optimistic === void 0) { optimistic = false; } - return (optimistic ? this.optimisticData : this.data).extract(); - }; - InMemoryCache.prototype.read = function (options) { - var _a = options.returnPartialData, returnPartialData = _a === void 0 ? false : _a; - try { - return this.storeReader.diffQueryAgainstStore((0,tslib__WEBPACK_IMPORTED_MODULE_3__.__assign)((0,tslib__WEBPACK_IMPORTED_MODULE_3__.__assign)({}, options), { store: options.optimistic ? this.optimisticData : this.data, config: this.config, returnPartialData: returnPartialData })).result || null; - } - catch (e) { - if (e instanceof _core_types_common_js__WEBPACK_IMPORTED_MODULE_9__.MissingFieldError) { - return null; - } - throw e; - } - }; - InMemoryCache.prototype.write = function (options) { - try { - ++this.txCount; - return this.storeWriter.writeToStore(this.data, options); - } - finally { - if (!--this.txCount && options.broadcast !== false) { - this.broadcastWatches(); - } - } - }; - InMemoryCache.prototype.modify = function (options) { - if (_helpers_js__WEBPACK_IMPORTED_MODULE_10__.hasOwn.call(options, "id") && !options.id) { - return false; - } - var store = options.optimistic - ? this.optimisticData - : this.data; - try { - ++this.txCount; - return store.modify(options.id || "ROOT_QUERY", options.fields); - } - finally { - if (!--this.txCount && options.broadcast !== false) { - this.broadcastWatches(); - } - } - }; - InMemoryCache.prototype.diff = function (options) { - return this.storeReader.diffQueryAgainstStore((0,tslib__WEBPACK_IMPORTED_MODULE_3__.__assign)((0,tslib__WEBPACK_IMPORTED_MODULE_3__.__assign)({}, options), { store: options.optimistic ? this.optimisticData : this.data, rootId: options.id || "ROOT_QUERY", config: this.config })); - }; - InMemoryCache.prototype.watch = function (watch) { - var _this = this; - if (!this.watches.size) { - (0,_reactiveVars_js__WEBPACK_IMPORTED_MODULE_4__.recallCache)(this); - } - this.watches.add(watch); - if (watch.immediate) { - this.maybeBroadcastWatch(watch); - } - return function () { - if (_this.watches.delete(watch) && !_this.watches.size) { - (0,_reactiveVars_js__WEBPACK_IMPORTED_MODULE_4__.forgetCache)(_this); - } - _this.maybeBroadcastWatch.forget(watch); - }; - }; - InMemoryCache.prototype.gc = function (options) { - _object_canon_js__WEBPACK_IMPORTED_MODULE_8__.canonicalStringify.reset(); - var ids = this.optimisticData.gc(); - if (options && !this.txCount) { - if (options.resetResultCache) { - this.resetResultCache(options.resetResultIdentities); - } - else if (options.resetResultIdentities) { - this.storeReader.resetCanon(); - } - } - return ids; - }; - InMemoryCache.prototype.retain = function (rootId, optimistic) { - return (optimistic ? this.optimisticData : this.data).retain(rootId); - }; - InMemoryCache.prototype.release = function (rootId, optimistic) { - return (optimistic ? this.optimisticData : this.data).release(rootId); - }; - InMemoryCache.prototype.identify = function (object) { - return (0,_utilities_index_js__WEBPACK_IMPORTED_MODULE_11__.isReference)(object) ? object.__ref : - this.policies.identify(object)[0]; - }; - InMemoryCache.prototype.evict = function (options) { - if (!options.id) { - if (_helpers_js__WEBPACK_IMPORTED_MODULE_10__.hasOwn.call(options, "id")) { - return false; - } - options = (0,tslib__WEBPACK_IMPORTED_MODULE_3__.__assign)((0,tslib__WEBPACK_IMPORTED_MODULE_3__.__assign)({}, options), { id: "ROOT_QUERY" }); - } - try { - ++this.txCount; - return this.optimisticData.evict(options); - } - finally { - if (!--this.txCount && options.broadcast !== false) { - this.broadcastWatches(); - } - } - }; - InMemoryCache.prototype.reset = function () { - this.init(); - this.broadcastWatches(); - _object_canon_js__WEBPACK_IMPORTED_MODULE_8__.canonicalStringify.reset(); - return Promise.resolve(); - }; - InMemoryCache.prototype.removeOptimistic = function (idToRemove) { - var newOptimisticData = this.optimisticData.removeLayer(idToRemove); - if (newOptimisticData !== this.optimisticData) { - this.optimisticData = newOptimisticData; - this.broadcastWatches(); - } - }; - InMemoryCache.prototype.batch = function (options) { - var _this = this; - var update = options.update, _a = options.optimistic, optimistic = _a === void 0 ? true : _a, removeOptimistic = options.removeOptimistic, onWatchUpdated = options.onWatchUpdated; - var perform = function (layer) { - var _a = _this, data = _a.data, optimisticData = _a.optimisticData; - ++_this.txCount; - if (layer) { - _this.data = _this.optimisticData = layer; - } - try { - update(_this); - } - finally { - --_this.txCount; - _this.data = data; - _this.optimisticData = optimisticData; - } - }; - var alreadyDirty = new Set(); - if (onWatchUpdated && !this.txCount) { - this.broadcastWatches((0,tslib__WEBPACK_IMPORTED_MODULE_3__.__assign)((0,tslib__WEBPACK_IMPORTED_MODULE_3__.__assign)({}, options), { onWatchUpdated: function (watch) { - alreadyDirty.add(watch); - return false; - } })); - } - if (typeof optimistic === 'string') { - this.optimisticData = this.optimisticData.addLayer(optimistic, perform); - } - else if (optimistic === false) { - perform(this.data); - } - else { - perform(); - } - if (typeof removeOptimistic === "string") { - this.optimisticData = this.optimisticData.removeLayer(removeOptimistic); - } - if (onWatchUpdated && alreadyDirty.size) { - this.broadcastWatches((0,tslib__WEBPACK_IMPORTED_MODULE_3__.__assign)((0,tslib__WEBPACK_IMPORTED_MODULE_3__.__assign)({}, options), { onWatchUpdated: function (watch, diff) { - var result = onWatchUpdated.call(this, watch, diff); - if (result !== false) { - alreadyDirty.delete(watch); - } - return result; - } })); - if (alreadyDirty.size) { - alreadyDirty.forEach(function (watch) { return _this.maybeBroadcastWatch.dirty(watch); }); - } - } - else { - this.broadcastWatches(options); - } - }; - InMemoryCache.prototype.performTransaction = function (update, optimisticId) { - return this.batch({ - update: update, - optimistic: optimisticId || (optimisticId !== null), - }); - }; - InMemoryCache.prototype.transformDocument = function (document) { - if (this.addTypename) { - var result = this.typenameDocumentCache.get(document); - if (!result) { - result = (0,_utilities_index_js__WEBPACK_IMPORTED_MODULE_12__.addTypenameToDocument)(document); - this.typenameDocumentCache.set(document, result); - this.typenameDocumentCache.set(result, result); - } - return result; - } - return document; - }; - InMemoryCache.prototype.broadcastWatches = function (options) { - var _this = this; - if (!this.txCount) { - this.watches.forEach(function (c) { return _this.maybeBroadcastWatch(c, options); }); - } - }; - InMemoryCache.prototype.broadcastWatch = function (c, options) { - var lastDiff = c.lastDiff; - var diff = this.diff({ - query: c.query, - variables: c.variables, - optimistic: c.optimistic, - }); - if (options) { - if (c.optimistic && - typeof options.optimistic === "string") { - diff.fromOptimisticTransaction = true; - } - if (options.onWatchUpdated && - options.onWatchUpdated.call(this, c, diff, lastDiff) === false) { - return; - } - } - if (!lastDiff || !(0,_wry_equality__WEBPACK_IMPORTED_MODULE_1__.equal)(lastDiff.result, diff.result)) { - c.callback(c.lastDiff = diff, lastDiff); - } - }; - return InMemoryCache; -}(_core_cache_js__WEBPACK_IMPORTED_MODULE_13__.ApolloCache)); - -//# sourceMappingURL=inMemoryCache.js.map - -/***/ }), - -/***/ "../../node_modules/@apollo/client/cache/inmemory/object-canon.js": -/*!************************************************************************!*\ - !*** ../../node_modules/@apollo/client/cache/inmemory/object-canon.js ***! - \************************************************************************/ -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "ObjectCanon": function() { return /* binding */ ObjectCanon; }, -/* harmony export */ "canonicalStringify": function() { return /* binding */ canonicalStringify; } -/* harmony export */ }); -/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! tslib */ "../../node_modules/tslib/tslib.es6.js"); -/* harmony import */ var _utilities_globals_index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../utilities/globals/index.js */ "../../node_modules/@apollo/client/utilities/globals/index.js"); -/* harmony import */ var _wry_trie__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @wry/trie */ "../../node_modules/@wry/trie/lib/trie.esm.js"); -/* harmony import */ var _utilities_index_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../utilities/index.js */ "../../node_modules/@apollo/client/utilities/common/objects.js"); -/* harmony import */ var _utilities_index_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../utilities/index.js */ "../../node_modules/@apollo/client/utilities/common/canUse.js"); - - - - -function shallowCopy(value) { - if ((0,_utilities_index_js__WEBPACK_IMPORTED_MODULE_2__.isNonNullObject)(value)) { - return Array.isArray(value) - ? value.slice(0) - : (0,tslib__WEBPACK_IMPORTED_MODULE_3__.__assign)({ __proto__: Object.getPrototypeOf(value) }, value); - } - return value; -} -var ObjectCanon = (function () { - function ObjectCanon() { - this.known = new (_utilities_index_js__WEBPACK_IMPORTED_MODULE_4__.canUseWeakSet ? WeakSet : Set)(); - this.pool = new _wry_trie__WEBPACK_IMPORTED_MODULE_1__.Trie(_utilities_index_js__WEBPACK_IMPORTED_MODULE_4__.canUseWeakMap); - this.passes = new WeakMap(); - this.keysByJSON = new Map(); - this.empty = this.admit({}); - } - ObjectCanon.prototype.isKnown = function (value) { - return (0,_utilities_index_js__WEBPACK_IMPORTED_MODULE_2__.isNonNullObject)(value) && this.known.has(value); - }; - ObjectCanon.prototype.pass = function (value) { - if ((0,_utilities_index_js__WEBPACK_IMPORTED_MODULE_2__.isNonNullObject)(value)) { - var copy = shallowCopy(value); - this.passes.set(copy, value); - return copy; - } - return value; - }; - ObjectCanon.prototype.admit = function (value) { - var _this = this; - if ((0,_utilities_index_js__WEBPACK_IMPORTED_MODULE_2__.isNonNullObject)(value)) { - var original = this.passes.get(value); - if (original) - return original; - var proto = Object.getPrototypeOf(value); - switch (proto) { - case Array.prototype: { - if (this.known.has(value)) - return value; - var array = value.map(this.admit, this); - var node = this.pool.lookupArray(array); - if (!node.array) { - this.known.add(node.array = array); - if (__DEV__) { - Object.freeze(array); - } - } - return node.array; - } - case null: - case Object.prototype: { - if (this.known.has(value)) - return value; - var proto_1 = Object.getPrototypeOf(value); - var array_1 = [proto_1]; - var keys = this.sortedKeys(value); - array_1.push(keys.json); - var firstValueIndex_1 = array_1.length; - keys.sorted.forEach(function (key) { - array_1.push(_this.admit(value[key])); - }); - var node = this.pool.lookupArray(array_1); - if (!node.object) { - var obj_1 = node.object = Object.create(proto_1); - this.known.add(obj_1); - keys.sorted.forEach(function (key, i) { - obj_1[key] = array_1[firstValueIndex_1 + i]; - }); - if (__DEV__) { - Object.freeze(obj_1); - } - } - return node.object; - } - } - } - return value; - }; - ObjectCanon.prototype.sortedKeys = function (obj) { - var keys = Object.keys(obj); - var node = this.pool.lookupArray(keys); - if (!node.keys) { - keys.sort(); - var json = JSON.stringify(keys); - if (!(node.keys = this.keysByJSON.get(json))) { - this.keysByJSON.set(json, node.keys = { sorted: keys, json: json }); - } - } - return node.keys; - }; - return ObjectCanon; -}()); - -var canonicalStringify = Object.assign(function (value) { - if ((0,_utilities_index_js__WEBPACK_IMPORTED_MODULE_2__.isNonNullObject)(value)) { - if (stringifyCanon === void 0) { - resetCanonicalStringify(); - } - var canonical = stringifyCanon.admit(value); - var json = stringifyCache.get(canonical); - if (json === void 0) { - stringifyCache.set(canonical, json = JSON.stringify(canonical)); - } - return json; - } - return JSON.stringify(value); -}, { - reset: resetCanonicalStringify, -}); -var stringifyCanon; -var stringifyCache; -function resetCanonicalStringify() { - stringifyCanon = new ObjectCanon; - stringifyCache = new (_utilities_index_js__WEBPACK_IMPORTED_MODULE_4__.canUseWeakMap ? WeakMap : Map)(); -} -//# sourceMappingURL=object-canon.js.map - -/***/ }), - -/***/ "../../node_modules/@apollo/client/cache/inmemory/policies.js": -/*!********************************************************************!*\ - !*** ../../node_modules/@apollo/client/cache/inmemory/policies.js ***! - \********************************************************************/ -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "defaultDataIdFromObject": function() { return /* binding */ defaultDataIdFromObject; }, -/* harmony export */ "Policies": function() { return /* binding */ Policies; } -/* harmony export */ }); -/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! tslib */ "../../node_modules/tslib/tslib.es6.js"); -/* harmony import */ var _utilities_globals_index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../utilities/globals/index.js */ "../../node_modules/@apollo/client/utilities/globals/index.js"); -/* harmony import */ var _wry_trie__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @wry/trie */ "../../node_modules/@wry/trie/lib/trie.esm.js"); -/* harmony import */ var _utilities_index_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../utilities/index.js */ "../../node_modules/@apollo/client/utilities/graphql/storeUtils.js"); -/* harmony import */ var _utilities_index_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../../utilities/index.js */ "../../node_modules/@apollo/client/utilities/common/objects.js"); -/* harmony import */ var _utilities_index_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../../utilities/index.js */ "../../node_modules/@apollo/client/utilities/common/stringifyForDisplay.js"); -/* harmony import */ var _utilities_index_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../../utilities/index.js */ "../../node_modules/@apollo/client/utilities/common/canUse.js"); -/* harmony import */ var _utilities_index_js__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../../utilities/index.js */ "../../node_modules/@apollo/client/utilities/graphql/fragments.js"); -/* harmony import */ var _helpers_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./helpers.js */ "../../node_modules/@apollo/client/cache/inmemory/helpers.js"); -/* harmony import */ var _reactiveVars_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./reactiveVars.js */ "../../node_modules/@apollo/client/cache/inmemory/reactiveVars.js"); -/* harmony import */ var _object_canon_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./object-canon.js */ "../../node_modules/@apollo/client/cache/inmemory/object-canon.js"); - - - - - - - -_utilities_index_js__WEBPACK_IMPORTED_MODULE_2__.getStoreKeyName.setStringify(_object_canon_js__WEBPACK_IMPORTED_MODULE_3__.canonicalStringify); -function argsFromFieldSpecifier(spec) { - return spec.args !== void 0 ? spec.args : - spec.field ? (0,_utilities_index_js__WEBPACK_IMPORTED_MODULE_2__.argumentsObjectFromField)(spec.field, spec.variables) : null; -} -var defaultDataIdFromObject = function (_a, context) { - var __typename = _a.__typename, id = _a.id, _id = _a._id; - if (typeof __typename === "string") { - if (context) { - context.keyObject = - id !== void 0 ? { id: id } : - _id !== void 0 ? { _id: _id } : - void 0; - } - if (id === void 0) - id = _id; - if (id !== void 0) { - return __typename + ":" + ((typeof id === "number" || - typeof id === "string") ? id : JSON.stringify(id)); - } - } -}; -var nullKeyFieldsFn = function () { return void 0; }; -var simpleKeyArgsFn = function (_args, context) { return context.fieldName; }; -var mergeTrueFn = function (existing, incoming, _a) { - var mergeObjects = _a.mergeObjects; - return mergeObjects(existing, incoming); -}; -var mergeFalseFn = function (_, incoming) { return incoming; }; -var Policies = (function () { - function Policies(config) { - this.config = config; - this.typePolicies = Object.create(null); - this.toBeAdded = Object.create(null); - this.supertypeMap = new Map(); - this.fuzzySubtypes = new Map(); - this.rootIdsByTypename = Object.create(null); - this.rootTypenamesById = Object.create(null); - this.usingPossibleTypes = false; - this.config = (0,tslib__WEBPACK_IMPORTED_MODULE_4__.__assign)({ dataIdFromObject: defaultDataIdFromObject }, config); - this.cache = this.config.cache; - this.setRootTypename("Query"); - this.setRootTypename("Mutation"); - this.setRootTypename("Subscription"); - if (config.possibleTypes) { - this.addPossibleTypes(config.possibleTypes); - } - if (config.typePolicies) { - this.addTypePolicies(config.typePolicies); - } - } - Policies.prototype.identify = function (object, selectionSet, fragmentMap) { - var typename = selectionSet && fragmentMap - ? (0,_utilities_index_js__WEBPACK_IMPORTED_MODULE_2__.getTypenameFromResult)(object, selectionSet, fragmentMap) - : object.__typename; - if (typename === this.rootTypenamesById.ROOT_QUERY) { - return ["ROOT_QUERY"]; - } - var context = { - typename: typename, - selectionSet: selectionSet, - fragmentMap: fragmentMap, - }; - var id; - var policy = typename && this.getTypePolicy(typename); - var keyFn = policy && policy.keyFn || this.config.dataIdFromObject; - while (keyFn) { - var specifierOrId = keyFn(object, context); - if (Array.isArray(specifierOrId)) { - keyFn = keyFieldsFnFromSpecifier(specifierOrId); - } - else { - id = specifierOrId; - break; - } - } - id = id ? String(id) : void 0; - return context.keyObject ? [id, context.keyObject] : [id]; - }; - Policies.prototype.addTypePolicies = function (typePolicies) { - var _this = this; - Object.keys(typePolicies).forEach(function (typename) { - var _a = typePolicies[typename], queryType = _a.queryType, mutationType = _a.mutationType, subscriptionType = _a.subscriptionType, incoming = (0,tslib__WEBPACK_IMPORTED_MODULE_4__.__rest)(_a, ["queryType", "mutationType", "subscriptionType"]); - if (queryType) - _this.setRootTypename("Query", typename); - if (mutationType) - _this.setRootTypename("Mutation", typename); - if (subscriptionType) - _this.setRootTypename("Subscription", typename); - if (_helpers_js__WEBPACK_IMPORTED_MODULE_5__.hasOwn.call(_this.toBeAdded, typename)) { - _this.toBeAdded[typename].push(incoming); - } - else { - _this.toBeAdded[typename] = [incoming]; - } - }); - }; - Policies.prototype.updateTypePolicy = function (typename, incoming) { - var _this = this; - var existing = this.getTypePolicy(typename); - var keyFields = incoming.keyFields, fields = incoming.fields; - function setMerge(existing, merge) { - existing.merge = - typeof merge === "function" ? merge : - merge === true ? mergeTrueFn : - merge === false ? mergeFalseFn : - existing.merge; - } - setMerge(existing, incoming.merge); - existing.keyFn = - keyFields === false ? nullKeyFieldsFn : - Array.isArray(keyFields) ? keyFieldsFnFromSpecifier(keyFields) : - typeof keyFields === "function" ? keyFields : - existing.keyFn; - if (fields) { - Object.keys(fields).forEach(function (fieldName) { - var existing = _this.getFieldPolicy(typename, fieldName, true); - var incoming = fields[fieldName]; - if (typeof incoming === "function") { - existing.read = incoming; - } - else { - var keyArgs = incoming.keyArgs, read = incoming.read, merge = incoming.merge; - existing.keyFn = - keyArgs === false ? simpleKeyArgsFn : - Array.isArray(keyArgs) ? keyArgsFnFromSpecifier(keyArgs) : - typeof keyArgs === "function" ? keyArgs : - existing.keyFn; - if (typeof read === "function") { - existing.read = read; - } - setMerge(existing, merge); - } - if (existing.read && existing.merge) { - existing.keyFn = existing.keyFn || simpleKeyArgsFn; - } - }); - } - }; - Policies.prototype.setRootTypename = function (which, typename) { - if (typename === void 0) { typename = which; } - var rootId = "ROOT_" + which.toUpperCase(); - var old = this.rootTypenamesById[rootId]; - if (typename !== old) { - __DEV__ ? (0,_utilities_globals_index_js__WEBPACK_IMPORTED_MODULE_0__.invariant)(!old || old === which, "Cannot change root " + which + " __typename more than once") : (0,_utilities_globals_index_js__WEBPACK_IMPORTED_MODULE_0__.invariant)(!old || old === which, 2); - if (old) - delete this.rootIdsByTypename[old]; - this.rootIdsByTypename[typename] = rootId; - this.rootTypenamesById[rootId] = typename; - } - }; - Policies.prototype.addPossibleTypes = function (possibleTypes) { - var _this = this; - this.usingPossibleTypes = true; - Object.keys(possibleTypes).forEach(function (supertype) { - _this.getSupertypeSet(supertype, true); - possibleTypes[supertype].forEach(function (subtype) { - _this.getSupertypeSet(subtype, true).add(supertype); - var match = subtype.match(_helpers_js__WEBPACK_IMPORTED_MODULE_5__.TypeOrFieldNameRegExp); - if (!match || match[0] !== subtype) { - _this.fuzzySubtypes.set(subtype, new RegExp(subtype)); - } - }); - }); - }; - Policies.prototype.getTypePolicy = function (typename) { - var _this = this; - if (!_helpers_js__WEBPACK_IMPORTED_MODULE_5__.hasOwn.call(this.typePolicies, typename)) { - var policy_1 = this.typePolicies[typename] = Object.create(null); - policy_1.fields = Object.create(null); - var supertypes = this.supertypeMap.get(typename); - if (supertypes && supertypes.size) { - supertypes.forEach(function (supertype) { - var _a = _this.getTypePolicy(supertype), fields = _a.fields, rest = (0,tslib__WEBPACK_IMPORTED_MODULE_4__.__rest)(_a, ["fields"]); - Object.assign(policy_1, rest); - Object.assign(policy_1.fields, fields); - }); - } - } - var inbox = this.toBeAdded[typename]; - if (inbox && inbox.length) { - inbox.splice(0).forEach(function (policy) { - _this.updateTypePolicy(typename, policy); - }); - } - return this.typePolicies[typename]; - }; - Policies.prototype.getFieldPolicy = function (typename, fieldName, createIfMissing) { - if (typename) { - var fieldPolicies = this.getTypePolicy(typename).fields; - return fieldPolicies[fieldName] || (createIfMissing && (fieldPolicies[fieldName] = Object.create(null))); - } - }; - Policies.prototype.getSupertypeSet = function (subtype, createIfMissing) { - var supertypeSet = this.supertypeMap.get(subtype); - if (!supertypeSet && createIfMissing) { - this.supertypeMap.set(subtype, supertypeSet = new Set()); - } - return supertypeSet; - }; - Policies.prototype.fragmentMatches = function (fragment, typename, result, variables) { - var _this = this; - if (!fragment.typeCondition) - return true; - if (!typename) - return false; - var supertype = fragment.typeCondition.name.value; - if (typename === supertype) - return true; - if (this.usingPossibleTypes && - this.supertypeMap.has(supertype)) { - var typenameSupertypeSet = this.getSupertypeSet(typename, true); - var workQueue_1 = [typenameSupertypeSet]; - var maybeEnqueue_1 = function (subtype) { - var supertypeSet = _this.getSupertypeSet(subtype, false); - if (supertypeSet && - supertypeSet.size && - workQueue_1.indexOf(supertypeSet) < 0) { - workQueue_1.push(supertypeSet); - } - }; - var needToCheckFuzzySubtypes = !!(result && this.fuzzySubtypes.size); - var checkingFuzzySubtypes = false; - for (var i = 0; i < workQueue_1.length; ++i) { - var supertypeSet = workQueue_1[i]; - if (supertypeSet.has(supertype)) { - if (!typenameSupertypeSet.has(supertype)) { - if (checkingFuzzySubtypes) { - __DEV__ && _utilities_globals_index_js__WEBPACK_IMPORTED_MODULE_0__.invariant.warn("Inferring subtype " + typename + " of supertype " + supertype); - } - typenameSupertypeSet.add(supertype); - } - return true; - } - supertypeSet.forEach(maybeEnqueue_1); - if (needToCheckFuzzySubtypes && - i === workQueue_1.length - 1 && - (0,_helpers_js__WEBPACK_IMPORTED_MODULE_5__.selectionSetMatchesResult)(fragment.selectionSet, result, variables)) { - needToCheckFuzzySubtypes = false; - checkingFuzzySubtypes = true; - this.fuzzySubtypes.forEach(function (regExp, fuzzyString) { - var match = typename.match(regExp); - if (match && match[0] === typename) { - maybeEnqueue_1(fuzzyString); - } - }); - } - } - } - return false; - }; - Policies.prototype.hasKeyArgs = function (typename, fieldName) { - var policy = this.getFieldPolicy(typename, fieldName, false); - return !!(policy && policy.keyFn); - }; - Policies.prototype.getStoreFieldName = function (fieldSpec) { - var typename = fieldSpec.typename, fieldName = fieldSpec.fieldName; - var policy = this.getFieldPolicy(typename, fieldName, false); - var storeFieldName; - var keyFn = policy && policy.keyFn; - if (keyFn && typename) { - var context = { - typename: typename, - fieldName: fieldName, - field: fieldSpec.field || null, - variables: fieldSpec.variables, - }; - var args = argsFromFieldSpecifier(fieldSpec); - while (keyFn) { - var specifierOrString = keyFn(args, context); - if (Array.isArray(specifierOrString)) { - keyFn = keyArgsFnFromSpecifier(specifierOrString); - } - else { - storeFieldName = specifierOrString || fieldName; - break; - } - } - } - if (storeFieldName === void 0) { - storeFieldName = fieldSpec.field - ? (0,_utilities_index_js__WEBPACK_IMPORTED_MODULE_2__.storeKeyNameFromField)(fieldSpec.field, fieldSpec.variables) - : (0,_utilities_index_js__WEBPACK_IMPORTED_MODULE_2__.getStoreKeyName)(fieldName, argsFromFieldSpecifier(fieldSpec)); - } - if (storeFieldName === false) { - return fieldName; - } - return fieldName === (0,_helpers_js__WEBPACK_IMPORTED_MODULE_5__.fieldNameFromStoreName)(storeFieldName) - ? storeFieldName - : fieldName + ":" + storeFieldName; - }; - Policies.prototype.readField = function (options, context) { - var objectOrReference = options.from; - if (!objectOrReference) - return; - var nameOrField = options.field || options.fieldName; - if (!nameOrField) - return; - if (options.typename === void 0) { - var typename = context.store.getFieldValue(objectOrReference, "__typename"); - if (typename) - options.typename = typename; - } - var storeFieldName = this.getStoreFieldName(options); - var fieldName = (0,_helpers_js__WEBPACK_IMPORTED_MODULE_5__.fieldNameFromStoreName)(storeFieldName); - var existing = context.store.getFieldValue(objectOrReference, storeFieldName); - var policy = this.getFieldPolicy(options.typename, fieldName, false); - var read = policy && policy.read; - if (read) { - var readOptions = makeFieldFunctionOptions(this, objectOrReference, options, context, context.store.getStorage((0,_utilities_index_js__WEBPACK_IMPORTED_MODULE_2__.isReference)(objectOrReference) - ? objectOrReference.__ref - : objectOrReference, storeFieldName)); - return _reactiveVars_js__WEBPACK_IMPORTED_MODULE_6__.cacheSlot.withValue(this.cache, read, [existing, readOptions]); - } - return existing; - }; - Policies.prototype.getMergeFunction = function (parentTypename, fieldName, childTypename) { - var policy = this.getFieldPolicy(parentTypename, fieldName, false); - var merge = policy && policy.merge; - if (!merge && childTypename) { - policy = this.getTypePolicy(childTypename); - merge = policy && policy.merge; - } - return merge; - }; - Policies.prototype.runMergeFunction = function (existing, incoming, _a, context, storage) { - var field = _a.field, typename = _a.typename, merge = _a.merge; - if (merge === mergeTrueFn) { - return makeMergeObjectsFunction(context.store)(existing, incoming); - } - if (merge === mergeFalseFn) { - return incoming; - } - if (context.overwrite) { - existing = void 0; - } - return merge(existing, incoming, makeFieldFunctionOptions(this, void 0, { typename: typename, fieldName: field.name.value, field: field, variables: context.variables }, context, storage || Object.create(null))); - }; - return Policies; -}()); - -function makeFieldFunctionOptions(policies, objectOrReference, fieldSpec, context, storage) { - var storeFieldName = policies.getStoreFieldName(fieldSpec); - var fieldName = (0,_helpers_js__WEBPACK_IMPORTED_MODULE_5__.fieldNameFromStoreName)(storeFieldName); - var variables = fieldSpec.variables || context.variables; - var _a = context.store, toReference = _a.toReference, canRead = _a.canRead; - return { - args: argsFromFieldSpecifier(fieldSpec), - field: fieldSpec.field || null, - query: context.query, - fieldName: fieldName, - storeFieldName: storeFieldName, - variables: variables, - isReference: _utilities_index_js__WEBPACK_IMPORTED_MODULE_2__.isReference, - toReference: toReference, - storage: storage, - cache: policies.cache, - canRead: canRead, - readField: function (fieldNameOrOptions, from) { - var options; - if (typeof fieldNameOrOptions === "string") { - options = { - fieldName: fieldNameOrOptions, - from: arguments.length > 1 ? from : objectOrReference, - }; - } - else if ((0,_utilities_index_js__WEBPACK_IMPORTED_MODULE_7__.isNonNullObject)(fieldNameOrOptions)) { - options = (0,tslib__WEBPACK_IMPORTED_MODULE_4__.__assign)({}, fieldNameOrOptions); - if (!_helpers_js__WEBPACK_IMPORTED_MODULE_5__.hasOwn.call(fieldNameOrOptions, "from")) { - options.from = objectOrReference; - } - } - else { - __DEV__ && _utilities_globals_index_js__WEBPACK_IMPORTED_MODULE_0__.invariant.warn("Unexpected readField arguments: " + (0,_utilities_index_js__WEBPACK_IMPORTED_MODULE_8__.stringifyForDisplay)(Array.from(arguments))); - return; - } - if (__DEV__ && options.from === void 0) { - __DEV__ && _utilities_globals_index_js__WEBPACK_IMPORTED_MODULE_0__.invariant.warn("Undefined 'from' passed to readField with arguments " + (0,_utilities_index_js__WEBPACK_IMPORTED_MODULE_8__.stringifyForDisplay)(Array.from(arguments))); - } - if (void 0 === options.variables) { - options.variables = variables; - } - return policies.readField(options, context); - }, - mergeObjects: makeMergeObjectsFunction(context.store), - }; -} -function makeMergeObjectsFunction(store) { - return function mergeObjects(existing, incoming) { - if (Array.isArray(existing) || Array.isArray(incoming)) { - throw __DEV__ ? new _utilities_globals_index_js__WEBPACK_IMPORTED_MODULE_0__.InvariantError("Cannot automatically merge arrays") : new _utilities_globals_index_js__WEBPACK_IMPORTED_MODULE_0__.InvariantError(3); - } - if ((0,_utilities_index_js__WEBPACK_IMPORTED_MODULE_7__.isNonNullObject)(existing) && - (0,_utilities_index_js__WEBPACK_IMPORTED_MODULE_7__.isNonNullObject)(incoming)) { - var eType = store.getFieldValue(existing, "__typename"); - var iType = store.getFieldValue(incoming, "__typename"); - var typesDiffer = eType && iType && eType !== iType; - if (typesDiffer) { - return incoming; - } - if ((0,_utilities_index_js__WEBPACK_IMPORTED_MODULE_2__.isReference)(existing) && - (0,_helpers_js__WEBPACK_IMPORTED_MODULE_5__.storeValueIsStoreObject)(incoming)) { - store.merge(existing.__ref, incoming); - return existing; - } - if ((0,_helpers_js__WEBPACK_IMPORTED_MODULE_5__.storeValueIsStoreObject)(existing) && - (0,_utilities_index_js__WEBPACK_IMPORTED_MODULE_2__.isReference)(incoming)) { - store.merge(existing, incoming.__ref); - return incoming; - } - if ((0,_helpers_js__WEBPACK_IMPORTED_MODULE_5__.storeValueIsStoreObject)(existing) && - (0,_helpers_js__WEBPACK_IMPORTED_MODULE_5__.storeValueIsStoreObject)(incoming)) { - return (0,tslib__WEBPACK_IMPORTED_MODULE_4__.__assign)((0,tslib__WEBPACK_IMPORTED_MODULE_4__.__assign)({}, existing), incoming); - } - } - return incoming; - }; -} -function keyArgsFnFromSpecifier(specifier) { - return function (args, context) { - return args ? context.fieldName + ":" + JSON.stringify(computeKeyObject(args, specifier, false)) : context.fieldName; - }; -} -function keyFieldsFnFromSpecifier(specifier) { - var trie = new _wry_trie__WEBPACK_IMPORTED_MODULE_1__.Trie(_utilities_index_js__WEBPACK_IMPORTED_MODULE_9__.canUseWeakMap); - return function (object, context) { - var aliasMap; - if (context.selectionSet && context.fragmentMap) { - var info = trie.lookupArray([ - context.selectionSet, - context.fragmentMap, - ]); - aliasMap = info.aliasMap || (info.aliasMap = makeAliasMap(context.selectionSet, context.fragmentMap)); - } - var keyObject = context.keyObject = - computeKeyObject(object, specifier, true, aliasMap); - return context.typename + ":" + JSON.stringify(keyObject); - }; -} -function makeAliasMap(selectionSet, fragmentMap) { - var map = Object.create(null); - var workQueue = new Set([selectionSet]); - workQueue.forEach(function (selectionSet) { - selectionSet.selections.forEach(function (selection) { - if ((0,_utilities_index_js__WEBPACK_IMPORTED_MODULE_2__.isField)(selection)) { - if (selection.alias) { - var responseKey = selection.alias.value; - var storeKey = selection.name.value; - if (storeKey !== responseKey) { - var aliases = map.aliases || (map.aliases = Object.create(null)); - aliases[storeKey] = responseKey; - } - } - if (selection.selectionSet) { - var subsets = map.subsets || (map.subsets = Object.create(null)); - subsets[selection.name.value] = - makeAliasMap(selection.selectionSet, fragmentMap); - } - } - else { - var fragment = (0,_utilities_index_js__WEBPACK_IMPORTED_MODULE_10__.getFragmentFromSelection)(selection, fragmentMap); - if (fragment) { - workQueue.add(fragment.selectionSet); - } - } - }); - }); - return map; -} -function computeKeyObject(response, specifier, strict, aliasMap) { - var keyObj = Object.create(null); - var lastResponseKey; - var lastActualKey; - specifier.forEach(function (s) { - if (Array.isArray(s)) { - if (typeof lastActualKey === "string" && - typeof lastResponseKey === "string") { - var subsets = aliasMap && aliasMap.subsets; - var subset = subsets && subsets[lastActualKey]; - keyObj[lastActualKey] = - computeKeyObject(response[lastResponseKey], s, strict, subset); - } - } - else { - var aliases = aliasMap && aliasMap.aliases; - var responseName = aliases && aliases[s] || s; - if (_helpers_js__WEBPACK_IMPORTED_MODULE_5__.hasOwn.call(response, responseName)) { - keyObj[lastActualKey = s] = response[lastResponseKey = responseName]; - } - else { - __DEV__ ? (0,_utilities_globals_index_js__WEBPACK_IMPORTED_MODULE_0__.invariant)(!strict, "Missing field '" + responseName + "' while computing key fields") : (0,_utilities_globals_index_js__WEBPACK_IMPORTED_MODULE_0__.invariant)(!strict, 4); - lastResponseKey = lastActualKey = void 0; - } - } - }); - return keyObj; -} -//# sourceMappingURL=policies.js.map - -/***/ }), - -/***/ "../../node_modules/@apollo/client/cache/inmemory/reactiveVars.js": -/*!************************************************************************!*\ - !*** ../../node_modules/@apollo/client/cache/inmemory/reactiveVars.js ***! - \************************************************************************/ -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "cacheSlot": function() { return /* binding */ cacheSlot; }, -/* harmony export */ "forgetCache": function() { return /* binding */ forgetCache; }, -/* harmony export */ "recallCache": function() { return /* binding */ recallCache; }, -/* harmony export */ "makeVar": function() { return /* binding */ makeVar; } -/* harmony export */ }); -/* harmony import */ var optimism__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! optimism */ "../../node_modules/optimism/lib/bundle.esm.js"); -/* harmony import */ var _wry_context__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @wry/context */ "../../node_modules/@wry/context/lib/context.esm.js"); - - -var cacheSlot = new _wry_context__WEBPACK_IMPORTED_MODULE_1__.Slot(); -var cacheInfoMap = new WeakMap(); -function getCacheInfo(cache) { - var info = cacheInfoMap.get(cache); - if (!info) { - cacheInfoMap.set(cache, info = { - vars: new Set, - dep: (0,optimism__WEBPACK_IMPORTED_MODULE_0__.dep)(), - }); - } - return info; -} -function forgetCache(cache) { - getCacheInfo(cache).vars.forEach(function (rv) { return rv.forgetCache(cache); }); -} -function recallCache(cache) { - getCacheInfo(cache).vars.forEach(function (rv) { return rv.attachCache(cache); }); -} -function makeVar(value) { - var caches = new Set(); - var listeners = new Set(); - var rv = function (newValue) { - if (arguments.length > 0) { - if (value !== newValue) { - value = newValue; - caches.forEach(function (cache) { - getCacheInfo(cache).dep.dirty(rv); - broadcast(cache); - }); - var oldListeners = Array.from(listeners); - listeners.clear(); - oldListeners.forEach(function (listener) { return listener(value); }); - } - } - else { - var cache = cacheSlot.getValue(); - if (cache) { - attach(cache); - getCacheInfo(cache).dep(rv); - } - } - return value; - }; - rv.onNextChange = function (listener) { - listeners.add(listener); - return function () { - listeners.delete(listener); - }; - }; - var attach = rv.attachCache = function (cache) { - caches.add(cache); - getCacheInfo(cache).vars.add(rv); - return rv; - }; - rv.forgetCache = function (cache) { return caches.delete(cache); }; - return rv; -} -function broadcast(cache) { - if (cache.broadcastWatches) { - cache.broadcastWatches(); - } -} -//# sourceMappingURL=reactiveVars.js.map - -/***/ }), - -/***/ "../../node_modules/@apollo/client/cache/inmemory/readFromStore.js": -/*!*************************************************************************!*\ - !*** ../../node_modules/@apollo/client/cache/inmemory/readFromStore.js ***! - \*************************************************************************/ -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "StoreReader": function() { return /* binding */ StoreReader; } -/* harmony export */ }); -/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! tslib */ "../../node_modules/tslib/tslib.es6.js"); -/* harmony import */ var _utilities_globals_index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../utilities/globals/index.js */ "../../node_modules/@apollo/client/utilities/globals/index.js"); -/* harmony import */ var optimism__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! optimism */ "../../node_modules/optimism/lib/bundle.esm.js"); -/* harmony import */ var _utilities_index_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../utilities/index.js */ "../../node_modules/@apollo/client/utilities/common/canUse.js"); -/* harmony import */ var _utilities_index_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../../utilities/index.js */ "../../node_modules/@apollo/client/utilities/graphql/storeUtils.js"); -/* harmony import */ var _utilities_index_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../../utilities/index.js */ "../../node_modules/@apollo/client/utilities/graphql/getFromAST.js"); -/* harmony import */ var _utilities_index_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../../utilities/index.js */ "../../node_modules/@apollo/client/utilities/graphql/fragments.js"); -/* harmony import */ var _utilities_index_js__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../../utilities/index.js */ "../../node_modules/@apollo/client/utilities/graphql/directives.js"); -/* harmony import */ var _utilities_index_js__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ../../utilities/index.js */ "../../node_modules/@apollo/client/utilities/graphql/transform.js"); -/* harmony import */ var _utilities_index_js__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ../../utilities/index.js */ "../../node_modules/@apollo/client/utilities/common/mergeDeep.js"); -/* harmony import */ var _utilities_index_js__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ../../utilities/index.js */ "../../node_modules/@apollo/client/utilities/common/maybeDeepFreeze.js"); -/* harmony import */ var _utilities_index_js__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ../../utilities/index.js */ "../../node_modules/@apollo/client/utilities/common/objects.js"); -/* harmony import */ var _entityStore_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./entityStore.js */ "../../node_modules/@apollo/client/cache/inmemory/entityStore.js"); -/* harmony import */ var _helpers_js__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ./helpers.js */ "../../node_modules/@apollo/client/cache/inmemory/helpers.js"); -/* harmony import */ var _core_types_common_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../core/types/common.js */ "../../node_modules/@apollo/client/cache/core/types/common.js"); -/* harmony import */ var _object_canon_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./object-canon.js */ "../../node_modules/@apollo/client/cache/inmemory/object-canon.js"); - - - - - - - - -; -function missingFromInvariant(err, context) { - return new _core_types_common_js__WEBPACK_IMPORTED_MODULE_2__.MissingFieldError(err.message, context.path.slice(), context.query, context.variables); -} -function execSelectionSetKeyArgs(options) { - return [ - options.selectionSet, - options.objectOrReference, - options.context, - options.context.canonizeResults, - ]; -} -var StoreReader = (function () { - function StoreReader(config) { - var _this = this; - this.knownResults = new (_utilities_index_js__WEBPACK_IMPORTED_MODULE_3__.canUseWeakMap ? WeakMap : Map)(); - this.config = (0,tslib__WEBPACK_IMPORTED_MODULE_4__.__assign)((0,tslib__WEBPACK_IMPORTED_MODULE_4__.__assign)({}, config), { addTypename: config.addTypename !== false }); - this.canon = config.canon || new _object_canon_js__WEBPACK_IMPORTED_MODULE_5__.ObjectCanon; - this.executeSelectionSet = (0,optimism__WEBPACK_IMPORTED_MODULE_1__.wrap)(function (options) { - var _a; - var canonizeResults = options.context.canonizeResults; - var peekArgs = execSelectionSetKeyArgs(options); - peekArgs[3] = !canonizeResults; - var other = (_a = _this.executeSelectionSet).peek.apply(_a, peekArgs); - if (other) { - if (canonizeResults) { - return (0,tslib__WEBPACK_IMPORTED_MODULE_4__.__assign)((0,tslib__WEBPACK_IMPORTED_MODULE_4__.__assign)({}, other), { result: _this.canon.admit(other.result) }); - } - return other; - } - (0,_entityStore_js__WEBPACK_IMPORTED_MODULE_6__.maybeDependOnExistenceOfEntity)(options.context.store, options.enclosingRef.__ref); - return _this.execSelectionSetImpl(options); - }, { - max: this.config.resultCacheMaxSize, - keyArgs: execSelectionSetKeyArgs, - makeCacheKey: function (selectionSet, parent, context, canonizeResults) { - if ((0,_entityStore_js__WEBPACK_IMPORTED_MODULE_6__.supportsResultCaching)(context.store)) { - return context.store.makeCacheKey(selectionSet, (0,_utilities_index_js__WEBPACK_IMPORTED_MODULE_7__.isReference)(parent) ? parent.__ref : parent, context.varString, canonizeResults); - } - } - }); - this.executeSubSelectedArray = (0,optimism__WEBPACK_IMPORTED_MODULE_1__.wrap)(function (options) { - (0,_entityStore_js__WEBPACK_IMPORTED_MODULE_6__.maybeDependOnExistenceOfEntity)(options.context.store, options.enclosingRef.__ref); - return _this.execSubSelectedArrayImpl(options); - }, { - max: this.config.resultCacheMaxSize, - makeCacheKey: function (_a) { - var field = _a.field, array = _a.array, context = _a.context; - if ((0,_entityStore_js__WEBPACK_IMPORTED_MODULE_6__.supportsResultCaching)(context.store)) { - return context.store.makeCacheKey(field, array, context.varString); - } - } - }); - } - StoreReader.prototype.resetCanon = function () { - this.canon = new _object_canon_js__WEBPACK_IMPORTED_MODULE_5__.ObjectCanon; - }; - StoreReader.prototype.diffQueryAgainstStore = function (_a) { - var store = _a.store, query = _a.query, _b = _a.rootId, rootId = _b === void 0 ? 'ROOT_QUERY' : _b, variables = _a.variables, _c = _a.returnPartialData, returnPartialData = _c === void 0 ? true : _c, _d = _a.canonizeResults, canonizeResults = _d === void 0 ? true : _d; - var policies = this.config.cache.policies; - variables = (0,tslib__WEBPACK_IMPORTED_MODULE_4__.__assign)((0,tslib__WEBPACK_IMPORTED_MODULE_4__.__assign)({}, (0,_utilities_index_js__WEBPACK_IMPORTED_MODULE_8__.getDefaultValues)((0,_utilities_index_js__WEBPACK_IMPORTED_MODULE_8__.getQueryDefinition)(query))), variables); - var rootRef = (0,_utilities_index_js__WEBPACK_IMPORTED_MODULE_7__.makeReference)(rootId); - var execResult = this.executeSelectionSet({ - selectionSet: (0,_utilities_index_js__WEBPACK_IMPORTED_MODULE_8__.getMainDefinition)(query).selectionSet, - objectOrReference: rootRef, - enclosingRef: rootRef, - context: { - store: store, - query: query, - policies: policies, - variables: variables, - varString: (0,_object_canon_js__WEBPACK_IMPORTED_MODULE_5__.canonicalStringify)(variables), - canonizeResults: canonizeResults, - fragmentMap: (0,_utilities_index_js__WEBPACK_IMPORTED_MODULE_9__.createFragmentMap)((0,_utilities_index_js__WEBPACK_IMPORTED_MODULE_8__.getFragmentDefinitions)(query)), - path: [], - }, - }); - var hasMissingFields = execResult.missing && execResult.missing.length > 0; - if (hasMissingFields && !returnPartialData) { - throw execResult.missing[0]; - } - return { - result: execResult.result, - missing: execResult.missing, - complete: !hasMissingFields, - }; - }; - StoreReader.prototype.isFresh = function (result, parent, selectionSet, context) { - if ((0,_entityStore_js__WEBPACK_IMPORTED_MODULE_6__.supportsResultCaching)(context.store) && - this.knownResults.get(result) === selectionSet) { - var latest = this.executeSelectionSet.peek(selectionSet, parent, context, this.canon.isKnown(result)); - if (latest && result === latest.result) { - return true; - } - } - return false; - }; - StoreReader.prototype.execSelectionSetImpl = function (_a) { - var _this = this; - var selectionSet = _a.selectionSet, objectOrReference = _a.objectOrReference, enclosingRef = _a.enclosingRef, context = _a.context; - if ((0,_utilities_index_js__WEBPACK_IMPORTED_MODULE_7__.isReference)(objectOrReference) && - !context.policies.rootTypenamesById[objectOrReference.__ref] && - !context.store.has(objectOrReference.__ref)) { - return { - result: this.canon.empty, - missing: [missingFromInvariant(__DEV__ ? new _utilities_globals_index_js__WEBPACK_IMPORTED_MODULE_0__.InvariantError("Dangling reference to missing " + objectOrReference.__ref + " object") : new _utilities_globals_index_js__WEBPACK_IMPORTED_MODULE_0__.InvariantError(5), context)], - }; - } - var variables = context.variables, policies = context.policies, store = context.store; - var objectsToMerge = []; - var finalResult = { result: null }; - var typename = store.getFieldValue(objectOrReference, "__typename"); - if (this.config.addTypename && - typeof typename === "string" && - !policies.rootIdsByTypename[typename]) { - objectsToMerge.push({ __typename: typename }); - } - function getMissing() { - return finalResult.missing || (finalResult.missing = []); - } - function handleMissing(result) { - var _a; - if (result.missing) - (_a = getMissing()).push.apply(_a, result.missing); - return result.result; - } - var workSet = new Set(selectionSet.selections); - workSet.forEach(function (selection) { - var _a; - if (!(0,_utilities_index_js__WEBPACK_IMPORTED_MODULE_10__.shouldInclude)(selection, variables)) - return; - if ((0,_utilities_index_js__WEBPACK_IMPORTED_MODULE_7__.isField)(selection)) { - var fieldValue = policies.readField({ - fieldName: selection.name.value, - field: selection, - variables: context.variables, - from: objectOrReference, - }, context); - var resultName = (0,_utilities_index_js__WEBPACK_IMPORTED_MODULE_7__.resultKeyNameFromField)(selection); - context.path.push(resultName); - if (fieldValue === void 0) { - if (!_utilities_index_js__WEBPACK_IMPORTED_MODULE_11__.addTypenameToDocument.added(selection)) { - getMissing().push(missingFromInvariant(__DEV__ ? new _utilities_globals_index_js__WEBPACK_IMPORTED_MODULE_0__.InvariantError("Can't find field '" + selection.name.value + "' on " + ((0,_utilities_index_js__WEBPACK_IMPORTED_MODULE_7__.isReference)(objectOrReference) - ? objectOrReference.__ref + " object" - : "object " + JSON.stringify(objectOrReference, null, 2))) : new _utilities_globals_index_js__WEBPACK_IMPORTED_MODULE_0__.InvariantError(6), context)); - } - } - else if (Array.isArray(fieldValue)) { - fieldValue = handleMissing(_this.executeSubSelectedArray({ - field: selection, - array: fieldValue, - enclosingRef: enclosingRef, - context: context, - })); - } - else if (!selection.selectionSet) { - if (context.canonizeResults) { - fieldValue = _this.canon.pass(fieldValue); - } - } - else if (fieldValue != null) { - fieldValue = handleMissing(_this.executeSelectionSet({ - selectionSet: selection.selectionSet, - objectOrReference: fieldValue, - enclosingRef: (0,_utilities_index_js__WEBPACK_IMPORTED_MODULE_7__.isReference)(fieldValue) ? fieldValue : enclosingRef, - context: context, - })); - } - if (fieldValue !== void 0) { - objectsToMerge.push((_a = {}, _a[resultName] = fieldValue, _a)); - } - (0,_utilities_globals_index_js__WEBPACK_IMPORTED_MODULE_0__.invariant)(context.path.pop() === resultName); - } - else { - var fragment = (0,_utilities_index_js__WEBPACK_IMPORTED_MODULE_9__.getFragmentFromSelection)(selection, context.fragmentMap); - if (fragment && policies.fragmentMatches(fragment, typename)) { - fragment.selectionSet.selections.forEach(workSet.add, workSet); - } - } - }); - var merged = (0,_utilities_index_js__WEBPACK_IMPORTED_MODULE_12__.mergeDeepArray)(objectsToMerge); - finalResult.result = context.canonizeResults - ? this.canon.admit(merged) - : (0,_utilities_index_js__WEBPACK_IMPORTED_MODULE_13__.maybeDeepFreeze)(merged); - this.knownResults.set(finalResult.result, selectionSet); - return finalResult; - }; - StoreReader.prototype.execSubSelectedArrayImpl = function (_a) { - var _this = this; - var field = _a.field, array = _a.array, enclosingRef = _a.enclosingRef, context = _a.context; - var missing; - function handleMissing(childResult, i) { - if (childResult.missing) { - missing = missing || []; - missing.push.apply(missing, childResult.missing); - } - (0,_utilities_globals_index_js__WEBPACK_IMPORTED_MODULE_0__.invariant)(context.path.pop() === i); - return childResult.result; - } - if (field.selectionSet) { - array = array.filter(context.store.canRead); - } - array = array.map(function (item, i) { - if (item === null) { - return null; - } - context.path.push(i); - if (Array.isArray(item)) { - return handleMissing(_this.executeSubSelectedArray({ - field: field, - array: item, - enclosingRef: enclosingRef, - context: context, - }), i); - } - if (field.selectionSet) { - return handleMissing(_this.executeSelectionSet({ - selectionSet: field.selectionSet, - objectOrReference: item, - enclosingRef: (0,_utilities_index_js__WEBPACK_IMPORTED_MODULE_7__.isReference)(item) ? item : enclosingRef, - context: context, - }), i); - } - if (__DEV__) { - assertSelectionSetForIdValue(context.store, field, item); - } - (0,_utilities_globals_index_js__WEBPACK_IMPORTED_MODULE_0__.invariant)(context.path.pop() === i); - return item; - }); - return { - result: context.canonizeResults ? this.canon.admit(array) : array, - missing: missing, - }; - }; - return StoreReader; -}()); - -function assertSelectionSetForIdValue(store, field, fieldValue) { - if (!field.selectionSet) { - var workSet_1 = new Set([fieldValue]); - workSet_1.forEach(function (value) { - if ((0,_utilities_index_js__WEBPACK_IMPORTED_MODULE_14__.isNonNullObject)(value)) { - __DEV__ ? (0,_utilities_globals_index_js__WEBPACK_IMPORTED_MODULE_0__.invariant)(!(0,_utilities_index_js__WEBPACK_IMPORTED_MODULE_7__.isReference)(value), "Missing selection set for object of type " + (0,_helpers_js__WEBPACK_IMPORTED_MODULE_15__.getTypenameFromStoreObject)(store, value) + " returned for query field " + field.name.value) : (0,_utilities_globals_index_js__WEBPACK_IMPORTED_MODULE_0__.invariant)(!(0,_utilities_index_js__WEBPACK_IMPORTED_MODULE_7__.isReference)(value), 7); - Object.values(value).forEach(workSet_1.add, workSet_1); - } - }); - } -} -//# sourceMappingURL=readFromStore.js.map - -/***/ }), - -/***/ "../../node_modules/@apollo/client/cache/inmemory/writeToStore.js": -/*!************************************************************************!*\ - !*** ../../node_modules/@apollo/client/cache/inmemory/writeToStore.js ***! - \************************************************************************/ -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "StoreWriter": function() { return /* binding */ StoreWriter; } -/* harmony export */ }); -/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! tslib */ "../../node_modules/tslib/tslib.es6.js"); -/* harmony import */ var _utilities_globals_index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../utilities/globals/index.js */ "../../node_modules/@apollo/client/utilities/globals/index.js"); -/* harmony import */ var _wry_equality__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @wry/equality */ "../../node_modules/@wry/equality/lib/equality.esm.js"); -/* harmony import */ var _utilities_index_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../utilities/index.js */ "../../node_modules/@apollo/client/utilities/graphql/getFromAST.js"); -/* harmony import */ var _utilities_index_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../../utilities/index.js */ "../../node_modules/@apollo/client/utilities/graphql/fragments.js"); -/* harmony import */ var _utilities_index_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../../utilities/index.js */ "../../node_modules/@apollo/client/utilities/graphql/storeUtils.js"); -/* harmony import */ var _utilities_index_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../../utilities/index.js */ "../../node_modules/@apollo/client/utilities/graphql/directives.js"); -/* harmony import */ var _utilities_index_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../../utilities/index.js */ "../../node_modules/@apollo/client/utilities/graphql/transform.js"); -/* harmony import */ var _utilities_index_js__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../../utilities/index.js */ "../../node_modules/@apollo/client/utilities/common/cloneDeep.js"); -/* harmony import */ var _helpers_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./helpers.js */ "../../node_modules/@apollo/client/cache/inmemory/helpers.js"); -/* harmony import */ var _object_canon_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./object-canon.js */ "../../node_modules/@apollo/client/cache/inmemory/object-canon.js"); - - - - - - -; -var StoreWriter = (function () { - function StoreWriter(cache, reader) { - this.cache = cache; - this.reader = reader; - } - StoreWriter.prototype.writeToStore = function (store, _a) { - var _this = this; - var query = _a.query, result = _a.result, dataId = _a.dataId, variables = _a.variables, overwrite = _a.overwrite; - var operationDefinition = (0,_utilities_index_js__WEBPACK_IMPORTED_MODULE_2__.getOperationDefinition)(query); - var merger = (0,_helpers_js__WEBPACK_IMPORTED_MODULE_3__.makeProcessedFieldsMerger)(); - variables = (0,tslib__WEBPACK_IMPORTED_MODULE_4__.__assign)((0,tslib__WEBPACK_IMPORTED_MODULE_4__.__assign)({}, (0,_utilities_index_js__WEBPACK_IMPORTED_MODULE_2__.getDefaultValues)(operationDefinition)), variables); - var context = { - store: store, - written: Object.create(null), - merge: function (existing, incoming) { - return merger.merge(existing, incoming); - }, - variables: variables, - varString: (0,_object_canon_js__WEBPACK_IMPORTED_MODULE_5__.canonicalStringify)(variables), - fragmentMap: (0,_utilities_index_js__WEBPACK_IMPORTED_MODULE_6__.createFragmentMap)((0,_utilities_index_js__WEBPACK_IMPORTED_MODULE_2__.getFragmentDefinitions)(query)), - overwrite: !!overwrite, - incomingById: new Map, - clientOnly: false, - }; - var ref = this.processSelectionSet({ - result: result || Object.create(null), - dataId: dataId, - selectionSet: operationDefinition.selectionSet, - mergeTree: { map: new Map }, - context: context, - }); - if (!(0,_utilities_index_js__WEBPACK_IMPORTED_MODULE_7__.isReference)(ref)) { - throw __DEV__ ? new _utilities_globals_index_js__WEBPACK_IMPORTED_MODULE_0__.InvariantError("Could not identify object " + JSON.stringify(result)) : new _utilities_globals_index_js__WEBPACK_IMPORTED_MODULE_0__.InvariantError(8); - } - context.incomingById.forEach(function (_a, dataId) { - var fields = _a.fields, mergeTree = _a.mergeTree, selections = _a.selections; - var entityRef = (0,_utilities_index_js__WEBPACK_IMPORTED_MODULE_7__.makeReference)(dataId); - if (mergeTree && mergeTree.map.size) { - var applied = _this.applyMerges(mergeTree, entityRef, fields, context); - if ((0,_utilities_index_js__WEBPACK_IMPORTED_MODULE_7__.isReference)(applied)) { - return; - } - fields = applied; - } - if (__DEV__ && !context.overwrite) { - var hasSelectionSet_1 = function (storeFieldName) { - return fieldsWithSelectionSets_1.has((0,_helpers_js__WEBPACK_IMPORTED_MODULE_3__.fieldNameFromStoreName)(storeFieldName)); - }; - var fieldsWithSelectionSets_1 = new Set(); - selections.forEach(function (selection) { - if ((0,_utilities_index_js__WEBPACK_IMPORTED_MODULE_7__.isField)(selection) && selection.selectionSet) { - fieldsWithSelectionSets_1.add(selection.name.value); - } - }); - var hasMergeFunction_1 = function (storeFieldName) { - var childTree = mergeTree && mergeTree.map.get(storeFieldName); - return Boolean(childTree && childTree.info && childTree.info.merge); - }; - Object.keys(fields).forEach(function (storeFieldName) { - if (hasSelectionSet_1(storeFieldName) && - !hasMergeFunction_1(storeFieldName)) { - warnAboutDataLoss(entityRef, fields, storeFieldName, context.store); - } - }); - } - store.merge(dataId, fields); - }); - store.retain(ref.__ref); - return ref; - }; - StoreWriter.prototype.processSelectionSet = function (_a) { - var _this = this; - var dataId = _a.dataId, result = _a.result, selectionSet = _a.selectionSet, context = _a.context, mergeTree = _a.mergeTree; - var policies = this.cache.policies; - var _b = policies.identify(result, selectionSet, context.fragmentMap), id = _b[0], keyObject = _b[1]; - dataId = dataId || id; - if ("string" === typeof dataId) { - var sets = context.written[dataId] || (context.written[dataId] = []); - var ref = (0,_utilities_index_js__WEBPACK_IMPORTED_MODULE_7__.makeReference)(dataId); - if (sets.indexOf(selectionSet) >= 0) - return ref; - sets.push(selectionSet); - if (this.reader && this.reader.isFresh(result, ref, selectionSet, context)) { - return ref; - } - } - var incomingFields = Object.create(null); - if (keyObject) { - incomingFields = context.merge(incomingFields, keyObject); - } - var typename = (dataId && policies.rootTypenamesById[dataId]) || - (0,_utilities_index_js__WEBPACK_IMPORTED_MODULE_7__.getTypenameFromResult)(result, selectionSet, context.fragmentMap) || - (dataId && context.store.get(dataId, "__typename")); - if ("string" === typeof typename) { - incomingFields.__typename = typename; - } - var selections = new Set(selectionSet.selections); - selections.forEach(function (selection) { - var _a; - if (!(0,_utilities_index_js__WEBPACK_IMPORTED_MODULE_8__.shouldInclude)(selection, context.variables)) - return; - if ((0,_utilities_index_js__WEBPACK_IMPORTED_MODULE_7__.isField)(selection)) { - var resultFieldKey = (0,_utilities_index_js__WEBPACK_IMPORTED_MODULE_7__.resultKeyNameFromField)(selection); - var value = result[resultFieldKey]; - var wasClientOnly = context.clientOnly; - context.clientOnly = wasClientOnly || !!(selection.directives && - selection.directives.some(function (d) { return d.name.value === "client"; })); - if (value !== void 0) { - var storeFieldName = policies.getStoreFieldName({ - typename: typename, - fieldName: selection.name.value, - field: selection, - variables: context.variables, - }); - var childTree = getChildMergeTree(mergeTree, storeFieldName); - var incomingValue = _this.processFieldValue(value, selection, context, childTree); - var childTypename = void 0; - if (selection.selectionSet) { - childTypename = context.store.getFieldValue(incomingValue, "__typename"); - if (!childTypename && (0,_utilities_index_js__WEBPACK_IMPORTED_MODULE_7__.isReference)(incomingValue)) { - var info = context.incomingById.get(incomingValue.__ref); - childTypename = info && info.fields.__typename; - } - } - var merge = policies.getMergeFunction(typename, selection.name.value, childTypename); - if (merge) { - childTree.info = { - field: selection, - typename: typename, - merge: merge, - }; - } - else { - maybeRecycleChildMergeTree(mergeTree, storeFieldName); - } - incomingFields = context.merge(incomingFields, (_a = {}, - _a[storeFieldName] = incomingValue, - _a)); - } - else if (!context.clientOnly && - !_utilities_index_js__WEBPACK_IMPORTED_MODULE_9__.addTypenameToDocument.added(selection)) { - __DEV__ && _utilities_globals_index_js__WEBPACK_IMPORTED_MODULE_0__.invariant.error(("Missing field '" + (0,_utilities_index_js__WEBPACK_IMPORTED_MODULE_7__.resultKeyNameFromField)(selection) + "' while writing result " + JSON.stringify(result, null, 2)).substring(0, 1000)); - } - context.clientOnly = wasClientOnly; - } - else { - var fragment = (0,_utilities_index_js__WEBPACK_IMPORTED_MODULE_6__.getFragmentFromSelection)(selection, context.fragmentMap); - if (fragment && - policies.fragmentMatches(fragment, typename, result, context.variables)) { - fragment.selectionSet.selections.forEach(selections.add, selections); - } - } - }); - if ("string" === typeof dataId) { - var previous = context.incomingById.get(dataId); - if (previous) { - previous.fields = context.merge(previous.fields, incomingFields); - previous.mergeTree = mergeMergeTrees(previous.mergeTree, mergeTree); - previous.selections.forEach(selections.add, selections); - previous.selections = selections; - } - else { - context.incomingById.set(dataId, { - fields: incomingFields, - mergeTree: mergeTreeIsEmpty(mergeTree) ? void 0 : mergeTree, - selections: selections, - }); - } - return (0,_utilities_index_js__WEBPACK_IMPORTED_MODULE_7__.makeReference)(dataId); - } - return incomingFields; - }; - StoreWriter.prototype.processFieldValue = function (value, field, context, mergeTree) { - var _this = this; - if (!field.selectionSet || value === null) { - return __DEV__ ? (0,_utilities_index_js__WEBPACK_IMPORTED_MODULE_10__.cloneDeep)(value) : value; - } - if (Array.isArray(value)) { - return value.map(function (item, i) { - var value = _this.processFieldValue(item, field, context, getChildMergeTree(mergeTree, i)); - maybeRecycleChildMergeTree(mergeTree, i); - return value; - }); - } - return this.processSelectionSet({ - result: value, - selectionSet: field.selectionSet, - context: context, - mergeTree: mergeTree, - }); - }; - StoreWriter.prototype.applyMerges = function (mergeTree, existing, incoming, context, getStorageArgs) { - var _a; - var _this = this; - if (mergeTree.map.size && !(0,_utilities_index_js__WEBPACK_IMPORTED_MODULE_7__.isReference)(incoming)) { - var e_1 = (!Array.isArray(incoming) && - ((0,_utilities_index_js__WEBPACK_IMPORTED_MODULE_7__.isReference)(existing) || (0,_helpers_js__WEBPACK_IMPORTED_MODULE_3__.storeValueIsStoreObject)(existing))) ? existing : void 0; - var i_1 = incoming; - if (e_1 && !getStorageArgs) { - getStorageArgs = [(0,_utilities_index_js__WEBPACK_IMPORTED_MODULE_7__.isReference)(e_1) ? e_1.__ref : e_1]; - } - var changedFields_1; - var getValue_1 = function (from, name) { - return Array.isArray(from) - ? (typeof name === "number" ? from[name] : void 0) - : context.store.getFieldValue(from, String(name)); - }; - mergeTree.map.forEach(function (childTree, storeFieldName) { - var eVal = getValue_1(e_1, storeFieldName); - var iVal = getValue_1(i_1, storeFieldName); - if (void 0 === iVal) - return; - if (getStorageArgs) { - getStorageArgs.push(storeFieldName); - } - var aVal = _this.applyMerges(childTree, eVal, iVal, context, getStorageArgs); - if (aVal !== iVal) { - changedFields_1 = changedFields_1 || new Map; - changedFields_1.set(storeFieldName, aVal); - } - if (getStorageArgs) { - (0,_utilities_globals_index_js__WEBPACK_IMPORTED_MODULE_0__.invariant)(getStorageArgs.pop() === storeFieldName); - } - }); - if (changedFields_1) { - incoming = (Array.isArray(i_1) ? i_1.slice(0) : (0,tslib__WEBPACK_IMPORTED_MODULE_4__.__assign)({}, i_1)); - changedFields_1.forEach(function (value, name) { - incoming[name] = value; - }); - } - } - if (mergeTree.info) { - return this.cache.policies.runMergeFunction(existing, incoming, mergeTree.info, context, getStorageArgs && (_a = context.store).getStorage.apply(_a, getStorageArgs)); - } - return incoming; - }; - return StoreWriter; -}()); - -var emptyMergeTreePool = []; -function getChildMergeTree(_a, name) { - var map = _a.map; - if (!map.has(name)) { - map.set(name, emptyMergeTreePool.pop() || { map: new Map }); - } - return map.get(name); -} -function mergeMergeTrees(left, right) { - if (left === right || !right || mergeTreeIsEmpty(right)) - return left; - if (!left || mergeTreeIsEmpty(left)) - return right; - var info = left.info && right.info ? (0,tslib__WEBPACK_IMPORTED_MODULE_4__.__assign)((0,tslib__WEBPACK_IMPORTED_MODULE_4__.__assign)({}, left.info), right.info) : left.info || right.info; - var needToMergeMaps = left.map.size && right.map.size; - var map = needToMergeMaps ? new Map : - left.map.size ? left.map : right.map; - var merged = { info: info, map: map }; - if (needToMergeMaps) { - var remainingRightKeys_1 = new Set(right.map.keys()); - left.map.forEach(function (leftTree, key) { - merged.map.set(key, mergeMergeTrees(leftTree, right.map.get(key))); - remainingRightKeys_1.delete(key); - }); - remainingRightKeys_1.forEach(function (key) { - merged.map.set(key, mergeMergeTrees(right.map.get(key), left.map.get(key))); - }); - } - return merged; -} -function mergeTreeIsEmpty(tree) { - return !tree || !(tree.info || tree.map.size); -} -function maybeRecycleChildMergeTree(_a, name) { - var map = _a.map; - var childTree = map.get(name); - if (childTree && mergeTreeIsEmpty(childTree)) { - emptyMergeTreePool.push(childTree); - map.delete(name); - } -} -var warnings = new Set(); -function warnAboutDataLoss(existingRef, incomingObj, storeFieldName, store) { - var getChild = function (objOrRef) { - var child = store.getFieldValue(objOrRef, storeFieldName); - return typeof child === "object" && child; - }; - var existing = getChild(existingRef); - if (!existing) - return; - var incoming = getChild(incomingObj); - if (!incoming) - return; - if ((0,_utilities_index_js__WEBPACK_IMPORTED_MODULE_7__.isReference)(existing)) - return; - if ((0,_wry_equality__WEBPACK_IMPORTED_MODULE_1__.equal)(existing, incoming)) - return; - if (Object.keys(existing).every(function (key) { return store.getFieldValue(incoming, key) !== void 0; })) { - return; - } - var parentType = store.getFieldValue(existingRef, "__typename") || - store.getFieldValue(incomingObj, "__typename"); - var fieldName = (0,_helpers_js__WEBPACK_IMPORTED_MODULE_3__.fieldNameFromStoreName)(storeFieldName); - var typeDotName = parentType + "." + fieldName; - if (warnings.has(typeDotName)) - return; - warnings.add(typeDotName); - var childTypenames = []; - if (!Array.isArray(existing) && - !Array.isArray(incoming)) { - [existing, incoming].forEach(function (child) { - var typename = store.getFieldValue(child, "__typename"); - if (typeof typename === "string" && - !childTypenames.includes(typename)) { - childTypenames.push(typename); - } - }); - } - __DEV__ && _utilities_globals_index_js__WEBPACK_IMPORTED_MODULE_0__.invariant.warn("Cache data may be lost when replacing the " + fieldName + " field of a " + parentType + " object.\n\nTo address this problem (which is not a bug in Apollo Client), " + (childTypenames.length - ? "either ensure all objects of type " + - childTypenames.join(" and ") + " have an ID or a custom merge function, or " - : "") + "define a custom merge function for the " + typeDotName + " field, so InMemoryCache can safely merge these objects:\n\n existing: " + JSON.stringify(existing).slice(0, 1000) + "\n incoming: " + JSON.stringify(incoming).slice(0, 1000) + "\n\nFor more information about these options, please refer to the documentation:\n\n * Ensuring entity objects have IDs: https://go.apollo.dev/c/generating-unique-identifiers\n * Defining custom merge functions: https://go.apollo.dev/c/merging-non-normalized-objects\n"); -} -//# sourceMappingURL=writeToStore.js.map - -/***/ }), - -/***/ "../../node_modules/@apollo/client/core/ApolloClient.js": -/*!**************************************************************!*\ - !*** ../../node_modules/@apollo/client/core/ApolloClient.js ***! - \**************************************************************/ -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "mergeOptions": function() { return /* binding */ mergeOptions; }, -/* harmony export */ "ApolloClient": function() { return /* binding */ ApolloClient; } -/* harmony export */ }); -/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! tslib */ "../../node_modules/tslib/tslib.es6.js"); -/* harmony import */ var _utilities_globals_index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../utilities/globals/index.js */ "../../node_modules/@apollo/client/utilities/globals/index.js"); -/* harmony import */ var _link_core_index_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../link/core/index.js */ "../../node_modules/@apollo/client/link/core/ApolloLink.js"); -/* harmony import */ var _link_core_index_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../link/core/index.js */ "../../node_modules/@apollo/client/link/core/execute.js"); -/* harmony import */ var _utilities_index_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../utilities/index.js */ "../../node_modules/@apollo/client/utilities/common/compact.js"); -/* harmony import */ var _version_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../version.js */ "../../node_modules/@apollo/client/version.js"); -/* harmony import */ var _link_http_index_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../link/http/index.js */ "../../node_modules/@apollo/client/link/http/HttpLink.js"); -/* harmony import */ var _QueryManager_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./QueryManager.js */ "../../node_modules/@apollo/client/core/QueryManager.js"); -/* harmony import */ var _LocalState_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./LocalState.js */ "../../node_modules/@apollo/client/core/LocalState.js"); - - - - - - - - -var hasSuggestedDevtools = false; -function mergeOptions(defaults, options) { - return (0,_utilities_index_js__WEBPACK_IMPORTED_MODULE_1__.compact)(defaults, options, options.variables && { - variables: (0,tslib__WEBPACK_IMPORTED_MODULE_2__.__assign)((0,tslib__WEBPACK_IMPORTED_MODULE_2__.__assign)({}, defaults.variables), options.variables), - }); -} -var ApolloClient = (function () { - function ApolloClient(options) { - var _this = this; - this.defaultOptions = {}; - this.resetStoreCallbacks = []; - this.clearStoreCallbacks = []; - var uri = options.uri, credentials = options.credentials, headers = options.headers, cache = options.cache, _a = options.ssrMode, ssrMode = _a === void 0 ? false : _a, _b = options.ssrForceFetchDelay, ssrForceFetchDelay = _b === void 0 ? 0 : _b, _c = options.connectToDevTools, connectToDevTools = _c === void 0 ? typeof window === 'object' && - !window.__APOLLO_CLIENT__ && - __DEV__ : _c, _d = options.queryDeduplication, queryDeduplication = _d === void 0 ? true : _d, defaultOptions = options.defaultOptions, _e = options.assumeImmutableResults, assumeImmutableResults = _e === void 0 ? false : _e, resolvers = options.resolvers, typeDefs = options.typeDefs, fragmentMatcher = options.fragmentMatcher, clientAwarenessName = options.name, clientAwarenessVersion = options.version; - var link = options.link; - if (!link) { - link = uri - ? new _link_http_index_js__WEBPACK_IMPORTED_MODULE_3__.HttpLink({ uri: uri, credentials: credentials, headers: headers }) - : _link_core_index_js__WEBPACK_IMPORTED_MODULE_4__.ApolloLink.empty(); - } - if (!cache) { - throw __DEV__ ? new _utilities_globals_index_js__WEBPACK_IMPORTED_MODULE_0__.InvariantError("To initialize Apollo Client, you must specify a 'cache' property " + - "in the options object. \n" + - "For more information, please visit: https://go.apollo.dev/c/docs") : new _utilities_globals_index_js__WEBPACK_IMPORTED_MODULE_0__.InvariantError(9); - } - this.link = link; - this.cache = cache; - this.disableNetworkFetches = ssrMode || ssrForceFetchDelay > 0; - this.queryDeduplication = queryDeduplication; - this.defaultOptions = defaultOptions || {}; - this.typeDefs = typeDefs; - if (ssrForceFetchDelay) { - setTimeout(function () { return (_this.disableNetworkFetches = false); }, ssrForceFetchDelay); - } - this.watchQuery = this.watchQuery.bind(this); - this.query = this.query.bind(this); - this.mutate = this.mutate.bind(this); - this.resetStore = this.resetStore.bind(this); - this.reFetchObservableQueries = this.reFetchObservableQueries.bind(this); - if (connectToDevTools && typeof window === 'object') { - window.__APOLLO_CLIENT__ = this; - } - if (!hasSuggestedDevtools && __DEV__) { - hasSuggestedDevtools = true; - if (typeof window !== 'undefined' && - window.document && - window.top === window.self && - !window.__APOLLO_DEVTOOLS_GLOBAL_HOOK__) { - var nav = window.navigator; - var ua = nav && nav.userAgent; - var url = void 0; - if (typeof ua === "string") { - if (ua.indexOf("Chrome/") > -1) { - url = "https://chrome.google.com/webstore/detail/" + - "apollo-client-developer-t/jdkknkkbebbapilgoeccciglkfbmbnfm"; - } - else if (ua.indexOf("Firefox/") > -1) { - url = "https://addons.mozilla.org/en-US/firefox/addon/apollo-developer-tools/"; - } - } - if (url) { - __DEV__ && _utilities_globals_index_js__WEBPACK_IMPORTED_MODULE_0__.invariant.log("Download the Apollo DevTools for a better development " + - "experience: " + url); - } - } - } - this.version = _version_js__WEBPACK_IMPORTED_MODULE_5__.version; - this.localState = new _LocalState_js__WEBPACK_IMPORTED_MODULE_6__.LocalState({ - cache: cache, - client: this, - resolvers: resolvers, - fragmentMatcher: fragmentMatcher, - }); - this.queryManager = new _QueryManager_js__WEBPACK_IMPORTED_MODULE_7__.QueryManager({ - cache: this.cache, - link: this.link, - queryDeduplication: queryDeduplication, - ssrMode: ssrMode, - clientAwareness: { - name: clientAwarenessName, - version: clientAwarenessVersion, - }, - localState: this.localState, - assumeImmutableResults: assumeImmutableResults, - onBroadcast: connectToDevTools ? function () { - if (_this.devToolsHookCb) { - _this.devToolsHookCb({ - action: {}, - state: { - queries: _this.queryManager.getQueryStore(), - mutations: _this.queryManager.mutationStore || {}, - }, - dataWithOptimisticResults: _this.cache.extract(true), - }); - } - } : void 0, - }); - } - ApolloClient.prototype.stop = function () { - this.queryManager.stop(); - }; - ApolloClient.prototype.watchQuery = function (options) { - if (this.defaultOptions.watchQuery) { - options = mergeOptions(this.defaultOptions.watchQuery, options); - } - if (this.disableNetworkFetches && - (options.fetchPolicy === 'network-only' || - options.fetchPolicy === 'cache-and-network')) { - options = (0,tslib__WEBPACK_IMPORTED_MODULE_2__.__assign)((0,tslib__WEBPACK_IMPORTED_MODULE_2__.__assign)({}, options), { fetchPolicy: 'cache-first' }); - } - return this.queryManager.watchQuery(options); - }; - ApolloClient.prototype.query = function (options) { - if (this.defaultOptions.query) { - options = mergeOptions(this.defaultOptions.query, options); - } - __DEV__ ? (0,_utilities_globals_index_js__WEBPACK_IMPORTED_MODULE_0__.invariant)(options.fetchPolicy !== 'cache-and-network', 'The cache-and-network fetchPolicy does not work with client.query, because ' + - 'client.query can only return a single result. Please use client.watchQuery ' + - 'to receive multiple results from the cache and the network, or consider ' + - 'using a different fetchPolicy, such as cache-first or network-only.') : (0,_utilities_globals_index_js__WEBPACK_IMPORTED_MODULE_0__.invariant)(options.fetchPolicy !== 'cache-and-network', 10); - if (this.disableNetworkFetches && options.fetchPolicy === 'network-only') { - options = (0,tslib__WEBPACK_IMPORTED_MODULE_2__.__assign)((0,tslib__WEBPACK_IMPORTED_MODULE_2__.__assign)({}, options), { fetchPolicy: 'cache-first' }); - } - return this.queryManager.query(options); - }; - ApolloClient.prototype.mutate = function (options) { - if (this.defaultOptions.mutate) { - options = mergeOptions(this.defaultOptions.mutate, options); - } - return this.queryManager.mutate(options); - }; - ApolloClient.prototype.subscribe = function (options) { - return this.queryManager.startGraphQLSubscription(options); - }; - ApolloClient.prototype.readQuery = function (options, optimistic) { - if (optimistic === void 0) { optimistic = false; } - return this.cache.readQuery(options, optimistic); - }; - ApolloClient.prototype.readFragment = function (options, optimistic) { - if (optimistic === void 0) { optimistic = false; } - return this.cache.readFragment(options, optimistic); - }; - ApolloClient.prototype.writeQuery = function (options) { - this.cache.writeQuery(options); - this.queryManager.broadcastQueries(); - }; - ApolloClient.prototype.writeFragment = function (options) { - this.cache.writeFragment(options); - this.queryManager.broadcastQueries(); - }; - ApolloClient.prototype.__actionHookForDevTools = function (cb) { - this.devToolsHookCb = cb; - }; - ApolloClient.prototype.__requestRaw = function (payload) { - return (0,_link_core_index_js__WEBPACK_IMPORTED_MODULE_8__.execute)(this.link, payload); - }; - ApolloClient.prototype.resetStore = function () { - var _this = this; - return Promise.resolve() - .then(function () { return _this.queryManager.clearStore(); }) - .then(function () { return Promise.all(_this.resetStoreCallbacks.map(function (fn) { return fn(); })); }) - .then(function () { return _this.reFetchObservableQueries(); }); - }; - ApolloClient.prototype.clearStore = function () { - var _this = this; - return Promise.resolve() - .then(function () { return _this.queryManager.clearStore(); }) - .then(function () { return Promise.all(_this.clearStoreCallbacks.map(function (fn) { return fn(); })); }); - }; - ApolloClient.prototype.onResetStore = function (cb) { - var _this = this; - this.resetStoreCallbacks.push(cb); - return function () { - _this.resetStoreCallbacks = _this.resetStoreCallbacks.filter(function (c) { return c !== cb; }); - }; - }; - ApolloClient.prototype.onClearStore = function (cb) { - var _this = this; - this.clearStoreCallbacks.push(cb); - return function () { - _this.clearStoreCallbacks = _this.clearStoreCallbacks.filter(function (c) { return c !== cb; }); - }; - }; - ApolloClient.prototype.reFetchObservableQueries = function (includeStandby) { - return this.queryManager.reFetchObservableQueries(includeStandby); - }; - ApolloClient.prototype.refetchQueries = function (options) { - var map = this.queryManager.refetchQueries(options); - var queries = []; - var results = []; - map.forEach(function (result, obsQuery) { - queries.push(obsQuery); - results.push(result); - }); - var result = Promise.all(results); - result.queries = queries; - result.results = results; - result.catch(function (error) { - __DEV__ && _utilities_globals_index_js__WEBPACK_IMPORTED_MODULE_0__.invariant.debug("In client.refetchQueries, Promise.all promise rejected with error " + error); - }); - return result; - }; - ApolloClient.prototype.getObservableQueries = function (include) { - if (include === void 0) { include = "active"; } - return this.queryManager.getObservableQueries(include); - }; - ApolloClient.prototype.extract = function (optimistic) { - return this.cache.extract(optimistic); - }; - ApolloClient.prototype.restore = function (serializedState) { - return this.cache.restore(serializedState); - }; - ApolloClient.prototype.addResolvers = function (resolvers) { - this.localState.addResolvers(resolvers); - }; - ApolloClient.prototype.setResolvers = function (resolvers) { - this.localState.setResolvers(resolvers); - }; - ApolloClient.prototype.getResolvers = function () { - return this.localState.getResolvers(); - }; - ApolloClient.prototype.setLocalStateFragmentMatcher = function (fragmentMatcher) { - this.localState.setFragmentMatcher(fragmentMatcher); - }; - ApolloClient.prototype.setLink = function (newLink) { - this.link = this.queryManager.link = newLink; - }; - return ApolloClient; -}()); - -//# sourceMappingURL=ApolloClient.js.map - -/***/ }), - -/***/ "../../node_modules/@apollo/client/core/LocalState.js": -/*!************************************************************!*\ - !*** ../../node_modules/@apollo/client/core/LocalState.js ***! - \************************************************************/ -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "LocalState": function() { return /* binding */ LocalState; } -/* harmony export */ }); -/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! tslib */ "../../node_modules/tslib/tslib.es6.js"); -/* harmony import */ var _utilities_globals_index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../utilities/globals/index.js */ "../../node_modules/@apollo/client/utilities/globals/index.js"); -/* harmony import */ var graphql__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! graphql */ "../../node_modules/graphql/language/visitor.mjs"); -/* harmony import */ var _utilities_index_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../utilities/index.js */ "../../node_modules/@apollo/client/utilities/common/mergeDeep.js"); -/* harmony import */ var _utilities_index_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../utilities/index.js */ "../../node_modules/@apollo/client/utilities/graphql/directives.js"); -/* harmony import */ var _utilities_index_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../utilities/index.js */ "../../node_modules/@apollo/client/utilities/graphql/transform.js"); -/* harmony import */ var _utilities_index_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../utilities/index.js */ "../../node_modules/@apollo/client/utilities/graphql/getFromAST.js"); -/* harmony import */ var _utilities_index_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../utilities/index.js */ "../../node_modules/@apollo/client/utilities/graphql/fragments.js"); -/* harmony import */ var _utilities_index_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../utilities/index.js */ "../../node_modules/@apollo/client/utilities/graphql/storeUtils.js"); -/* harmony import */ var _cache_index_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../cache/index.js */ "../../node_modules/@apollo/client/cache/inmemory/reactiveVars.js"); - - - - - -var LocalState = (function () { - function LocalState(_a) { - var cache = _a.cache, client = _a.client, resolvers = _a.resolvers, fragmentMatcher = _a.fragmentMatcher; - this.cache = cache; - if (client) { - this.client = client; - } - if (resolvers) { - this.addResolvers(resolvers); - } - if (fragmentMatcher) { - this.setFragmentMatcher(fragmentMatcher); - } - } - LocalState.prototype.addResolvers = function (resolvers) { - var _this = this; - this.resolvers = this.resolvers || {}; - if (Array.isArray(resolvers)) { - resolvers.forEach(function (resolverGroup) { - _this.resolvers = (0,_utilities_index_js__WEBPACK_IMPORTED_MODULE_1__.mergeDeep)(_this.resolvers, resolverGroup); - }); - } - else { - this.resolvers = (0,_utilities_index_js__WEBPACK_IMPORTED_MODULE_1__.mergeDeep)(this.resolvers, resolvers); - } - }; - LocalState.prototype.setResolvers = function (resolvers) { - this.resolvers = {}; - this.addResolvers(resolvers); - }; - LocalState.prototype.getResolvers = function () { - return this.resolvers || {}; - }; - LocalState.prototype.runResolvers = function (_a) { - var document = _a.document, remoteResult = _a.remoteResult, context = _a.context, variables = _a.variables, _b = _a.onlyRunForcedResolvers, onlyRunForcedResolvers = _b === void 0 ? false : _b; - return (0,tslib__WEBPACK_IMPORTED_MODULE_2__.__awaiter)(this, void 0, void 0, function () { - return (0,tslib__WEBPACK_IMPORTED_MODULE_2__.__generator)(this, function (_c) { - if (document) { - return [2, this.resolveDocument(document, remoteResult.data, context, variables, this.fragmentMatcher, onlyRunForcedResolvers).then(function (localResult) { return ((0,tslib__WEBPACK_IMPORTED_MODULE_2__.__assign)((0,tslib__WEBPACK_IMPORTED_MODULE_2__.__assign)({}, remoteResult), { data: localResult.result })); })]; - } - return [2, remoteResult]; - }); - }); - }; - LocalState.prototype.setFragmentMatcher = function (fragmentMatcher) { - this.fragmentMatcher = fragmentMatcher; - }; - LocalState.prototype.getFragmentMatcher = function () { - return this.fragmentMatcher; - }; - LocalState.prototype.clientQuery = function (document) { - if ((0,_utilities_index_js__WEBPACK_IMPORTED_MODULE_3__.hasDirectives)(['client'], document)) { - if (this.resolvers) { - return document; - } - } - return null; - }; - LocalState.prototype.serverQuery = function (document) { - return (0,_utilities_index_js__WEBPACK_IMPORTED_MODULE_4__.removeClientSetsFromDocument)(document); - }; - LocalState.prototype.prepareContext = function (context) { - var cache = this.cache; - return (0,tslib__WEBPACK_IMPORTED_MODULE_2__.__assign)((0,tslib__WEBPACK_IMPORTED_MODULE_2__.__assign)({}, context), { cache: cache, getCacheKey: function (obj) { - return cache.identify(obj); - } }); - }; - LocalState.prototype.addExportedVariables = function (document, variables, context) { - if (variables === void 0) { variables = {}; } - if (context === void 0) { context = {}; } - return (0,tslib__WEBPACK_IMPORTED_MODULE_2__.__awaiter)(this, void 0, void 0, function () { - return (0,tslib__WEBPACK_IMPORTED_MODULE_2__.__generator)(this, function (_a) { - if (document) { - return [2, this.resolveDocument(document, this.buildRootValueFromCache(document, variables) || {}, this.prepareContext(context), variables).then(function (data) { return ((0,tslib__WEBPACK_IMPORTED_MODULE_2__.__assign)((0,tslib__WEBPACK_IMPORTED_MODULE_2__.__assign)({}, variables), data.exportedVariables)); })]; - } - return [2, (0,tslib__WEBPACK_IMPORTED_MODULE_2__.__assign)({}, variables)]; - }); - }); - }; - LocalState.prototype.shouldForceResolvers = function (document) { - var forceResolvers = false; - (0,graphql__WEBPACK_IMPORTED_MODULE_5__.visit)(document, { - Directive: { - enter: function (node) { - if (node.name.value === 'client' && node.arguments) { - forceResolvers = node.arguments.some(function (arg) { - return arg.name.value === 'always' && - arg.value.kind === 'BooleanValue' && - arg.value.value === true; - }); - if (forceResolvers) { - return graphql__WEBPACK_IMPORTED_MODULE_5__.BREAK; - } - } - }, - }, - }); - return forceResolvers; - }; - LocalState.prototype.buildRootValueFromCache = function (document, variables) { - return this.cache.diff({ - query: (0,_utilities_index_js__WEBPACK_IMPORTED_MODULE_4__.buildQueryFromSelectionSet)(document), - variables: variables, - returnPartialData: true, - optimistic: false, - }).result; - }; - LocalState.prototype.resolveDocument = function (document, rootValue, context, variables, fragmentMatcher, onlyRunForcedResolvers) { - if (context === void 0) { context = {}; } - if (variables === void 0) { variables = {}; } - if (fragmentMatcher === void 0) { fragmentMatcher = function () { return true; }; } - if (onlyRunForcedResolvers === void 0) { onlyRunForcedResolvers = false; } - return (0,tslib__WEBPACK_IMPORTED_MODULE_2__.__awaiter)(this, void 0, void 0, function () { - var mainDefinition, fragments, fragmentMap, definitionOperation, defaultOperationType, _a, cache, client, execContext; - return (0,tslib__WEBPACK_IMPORTED_MODULE_2__.__generator)(this, function (_b) { - mainDefinition = (0,_utilities_index_js__WEBPACK_IMPORTED_MODULE_6__.getMainDefinition)(document); - fragments = (0,_utilities_index_js__WEBPACK_IMPORTED_MODULE_6__.getFragmentDefinitions)(document); - fragmentMap = (0,_utilities_index_js__WEBPACK_IMPORTED_MODULE_7__.createFragmentMap)(fragments); - definitionOperation = mainDefinition - .operation; - defaultOperationType = definitionOperation - ? definitionOperation.charAt(0).toUpperCase() + - definitionOperation.slice(1) - : 'Query'; - _a = this, cache = _a.cache, client = _a.client; - execContext = { - fragmentMap: fragmentMap, - context: (0,tslib__WEBPACK_IMPORTED_MODULE_2__.__assign)((0,tslib__WEBPACK_IMPORTED_MODULE_2__.__assign)({}, context), { cache: cache, client: client }), - variables: variables, - fragmentMatcher: fragmentMatcher, - defaultOperationType: defaultOperationType, - exportedVariables: {}, - onlyRunForcedResolvers: onlyRunForcedResolvers, - }; - return [2, this.resolveSelectionSet(mainDefinition.selectionSet, rootValue, execContext).then(function (result) { return ({ - result: result, - exportedVariables: execContext.exportedVariables, - }); })]; - }); - }); - }; - LocalState.prototype.resolveSelectionSet = function (selectionSet, rootValue, execContext) { - return (0,tslib__WEBPACK_IMPORTED_MODULE_2__.__awaiter)(this, void 0, void 0, function () { - var fragmentMap, context, variables, resultsToMerge, execute; - var _this = this; - return (0,tslib__WEBPACK_IMPORTED_MODULE_2__.__generator)(this, function (_a) { - fragmentMap = execContext.fragmentMap, context = execContext.context, variables = execContext.variables; - resultsToMerge = [rootValue]; - execute = function (selection) { return (0,tslib__WEBPACK_IMPORTED_MODULE_2__.__awaiter)(_this, void 0, void 0, function () { - var fragment, typeCondition; - return (0,tslib__WEBPACK_IMPORTED_MODULE_2__.__generator)(this, function (_a) { - if (!(0,_utilities_index_js__WEBPACK_IMPORTED_MODULE_3__.shouldInclude)(selection, variables)) { - return [2]; - } - if ((0,_utilities_index_js__WEBPACK_IMPORTED_MODULE_8__.isField)(selection)) { - return [2, this.resolveField(selection, rootValue, execContext).then(function (fieldResult) { - var _a; - if (typeof fieldResult !== 'undefined') { - resultsToMerge.push((_a = {}, - _a[(0,_utilities_index_js__WEBPACK_IMPORTED_MODULE_8__.resultKeyNameFromField)(selection)] = fieldResult, - _a)); - } - })]; - } - if ((0,_utilities_index_js__WEBPACK_IMPORTED_MODULE_8__.isInlineFragment)(selection)) { - fragment = selection; - } - else { - fragment = fragmentMap[selection.name.value]; - __DEV__ ? (0,_utilities_globals_index_js__WEBPACK_IMPORTED_MODULE_0__.invariant)(fragment, "No fragment named " + selection.name.value) : (0,_utilities_globals_index_js__WEBPACK_IMPORTED_MODULE_0__.invariant)(fragment, 11); - } - if (fragment && fragment.typeCondition) { - typeCondition = fragment.typeCondition.name.value; - if (execContext.fragmentMatcher(rootValue, typeCondition, context)) { - return [2, this.resolveSelectionSet(fragment.selectionSet, rootValue, execContext).then(function (fragmentResult) { - resultsToMerge.push(fragmentResult); - })]; - } - } - return [2]; - }); - }); }; - return [2, Promise.all(selectionSet.selections.map(execute)).then(function () { - return (0,_utilities_index_js__WEBPACK_IMPORTED_MODULE_1__.mergeDeepArray)(resultsToMerge); - })]; - }); - }); - }; - LocalState.prototype.resolveField = function (field, rootValue, execContext) { - return (0,tslib__WEBPACK_IMPORTED_MODULE_2__.__awaiter)(this, void 0, void 0, function () { - var variables, fieldName, aliasedFieldName, aliasUsed, defaultResult, resultPromise, resolverType, resolverMap, resolve; - var _this = this; - return (0,tslib__WEBPACK_IMPORTED_MODULE_2__.__generator)(this, function (_a) { - variables = execContext.variables; - fieldName = field.name.value; - aliasedFieldName = (0,_utilities_index_js__WEBPACK_IMPORTED_MODULE_8__.resultKeyNameFromField)(field); - aliasUsed = fieldName !== aliasedFieldName; - defaultResult = rootValue[aliasedFieldName] || rootValue[fieldName]; - resultPromise = Promise.resolve(defaultResult); - if (!execContext.onlyRunForcedResolvers || - this.shouldForceResolvers(field)) { - resolverType = rootValue.__typename || execContext.defaultOperationType; - resolverMap = this.resolvers && this.resolvers[resolverType]; - if (resolverMap) { - resolve = resolverMap[aliasUsed ? fieldName : aliasedFieldName]; - if (resolve) { - resultPromise = Promise.resolve(_cache_index_js__WEBPACK_IMPORTED_MODULE_9__.cacheSlot.withValue(this.cache, resolve, [ - rootValue, - (0,_utilities_index_js__WEBPACK_IMPORTED_MODULE_8__.argumentsObjectFromField)(field, variables), - execContext.context, - { field: field, fragmentMap: execContext.fragmentMap }, - ])); - } - } - } - return [2, resultPromise.then(function (result) { - if (result === void 0) { result = defaultResult; } - if (field.directives) { - field.directives.forEach(function (directive) { - if (directive.name.value === 'export' && directive.arguments) { - directive.arguments.forEach(function (arg) { - if (arg.name.value === 'as' && arg.value.kind === 'StringValue') { - execContext.exportedVariables[arg.value.value] = result; - } - }); - } - }); - } - if (!field.selectionSet) { - return result; - } - if (result == null) { - return result; - } - if (Array.isArray(result)) { - return _this.resolveSubSelectedArray(field, result, execContext); - } - if (field.selectionSet) { - return _this.resolveSelectionSet(field.selectionSet, result, execContext); - } - })]; - }); - }); - }; - LocalState.prototype.resolveSubSelectedArray = function (field, result, execContext) { - var _this = this; - return Promise.all(result.map(function (item) { - if (item === null) { - return null; - } - if (Array.isArray(item)) { - return _this.resolveSubSelectedArray(field, item, execContext); - } - if (field.selectionSet) { - return _this.resolveSelectionSet(field.selectionSet, item, execContext); - } - })); - }; - return LocalState; -}()); - -//# sourceMappingURL=LocalState.js.map - -/***/ }), - -/***/ "../../node_modules/@apollo/client/core/ObservableQuery.js": -/*!*****************************************************************!*\ - !*** ../../node_modules/@apollo/client/core/ObservableQuery.js ***! - \*****************************************************************/ -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "ObservableQuery": function() { return /* binding */ ObservableQuery; }, -/* harmony export */ "logMissingFieldErrors": function() { return /* binding */ logMissingFieldErrors; }, -/* harmony export */ "applyNextFetchPolicy": function() { return /* binding */ applyNextFetchPolicy; } -/* harmony export */ }); -/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! tslib */ "../../node_modules/tslib/tslib.es6.js"); -/* harmony import */ var _utilities_globals_index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../utilities/globals/index.js */ "../../node_modules/@apollo/client/utilities/globals/index.js"); -/* harmony import */ var _wry_equality__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @wry/equality */ "../../node_modules/@wry/equality/lib/equality.esm.js"); -/* harmony import */ var _networkStatus_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./networkStatus.js */ "../../node_modules/@apollo/client/core/networkStatus.js"); -/* harmony import */ var _utilities_index_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../utilities/index.js */ "../../node_modules/@apollo/client/utilities/graphql/getFromAST.js"); -/* harmony import */ var _utilities_index_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../utilities/index.js */ "../../node_modules/@apollo/client/utilities/common/cloneDeep.js"); -/* harmony import */ var _utilities_index_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../utilities/index.js */ "../../node_modules/@apollo/client/utilities/common/arrays.js"); -/* harmony import */ var _utilities_index_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../utilities/index.js */ "../../node_modules/@apollo/client/utilities/common/compact.js"); -/* harmony import */ var _utilities_index_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../utilities/index.js */ "../../node_modules/@apollo/client/utilities/observables/iteration.js"); -/* harmony import */ var _utilities_index_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../utilities/index.js */ "../../node_modules/zen-observable-ts/module.js"); -/* harmony import */ var _utilities_index_js__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../utilities/index.js */ "../../node_modules/@apollo/client/utilities/observables/subclassing.js"); - - - - - -var assign = Object.assign, hasOwnProperty = Object.hasOwnProperty; -var warnedAboutUpdateQuery = false; -var ObservableQuery = (function (_super) { - (0,tslib__WEBPACK_IMPORTED_MODULE_2__.__extends)(ObservableQuery, _super); - function ObservableQuery(_a) { - var queryManager = _a.queryManager, queryInfo = _a.queryInfo, options = _a.options; - var _this = _super.call(this, function (observer) { - try { - var subObserver = observer._subscription._observer; - if (subObserver && !subObserver.error) { - subObserver.error = defaultSubscriptionObserverErrorCallback; - } - } - catch (_a) { } - var first = !_this.observers.size; - _this.observers.add(observer); - var last = _this.last; - if (last && last.error) { - observer.error && observer.error(last.error); - } - else if (last && last.result) { - observer.next && observer.next(last.result); - } - if (first) { - _this.reobserve().catch(function () { }); - } - return function () { - if (_this.observers.delete(observer) && !_this.observers.size) { - _this.tearDownQuery(); - } - }; - }) || this; - _this.observers = new Set(); - _this.subscriptions = new Set(); - _this.isTornDown = false; - _this.options = options; - _this.queryId = queryInfo.queryId || queryManager.generateQueryId(); - var opDef = (0,_utilities_index_js__WEBPACK_IMPORTED_MODULE_3__.getOperationDefinition)(options.query); - _this.queryName = opDef && opDef.name && opDef.name.value; - _this.initialFetchPolicy = options.fetchPolicy || "cache-first"; - _this.queryManager = queryManager; - _this.queryInfo = queryInfo; - return _this; - } - Object.defineProperty(ObservableQuery.prototype, "variables", { - get: function () { - return this.options.variables; - }, - enumerable: false, - configurable: true - }); - ObservableQuery.prototype.result = function () { - var _this = this; - return new Promise(function (resolve, reject) { - var observer = { - next: function (result) { - resolve(result); - _this.observers.delete(observer); - if (!_this.observers.size) { - _this.queryManager.removeQuery(_this.queryId); - } - setTimeout(function () { - subscription.unsubscribe(); - }, 0); - }, - error: reject, - }; - var subscription = _this.subscribe(observer); - }); - }; - ObservableQuery.prototype.getCurrentResult = function (saveAsLastResult) { - if (saveAsLastResult === void 0) { saveAsLastResult = true; } - var lastResult = this.getLastResult(true); - var networkStatus = this.queryInfo.networkStatus || - (lastResult && lastResult.networkStatus) || - _networkStatus_js__WEBPACK_IMPORTED_MODULE_4__.NetworkStatus.ready; - var result = (0,tslib__WEBPACK_IMPORTED_MODULE_2__.__assign)((0,tslib__WEBPACK_IMPORTED_MODULE_2__.__assign)({}, lastResult), { loading: (0,_networkStatus_js__WEBPACK_IMPORTED_MODULE_4__.isNetworkRequestInFlight)(networkStatus), networkStatus: networkStatus }); - var _a = this.options.fetchPolicy, fetchPolicy = _a === void 0 ? "cache-first" : _a; - var shouldReturnCachedData = lastResult || (fetchPolicy !== 'network-only' && - fetchPolicy !== 'no-cache' && - fetchPolicy !== 'standby'); - if (shouldReturnCachedData && - !this.queryManager.transform(this.options.query).hasForcedResolvers) { - var diff = this.queryInfo.getDiff(); - if (diff.complete || this.options.returnPartialData) { - result.data = diff.result; - } - if ((0,_wry_equality__WEBPACK_IMPORTED_MODULE_1__.equal)(result.data, {})) { - result.data = void 0; - } - if (diff.complete) { - if (result.networkStatus === _networkStatus_js__WEBPACK_IMPORTED_MODULE_4__.NetworkStatus.loading && - (fetchPolicy === 'cache-first' || - fetchPolicy === 'cache-only')) { - result.networkStatus = _networkStatus_js__WEBPACK_IMPORTED_MODULE_4__.NetworkStatus.ready; - result.loading = false; - } - delete result.partial; - } - else if (fetchPolicy !== "no-cache") { - result.partial = true; - } - if (__DEV__ && - !diff.complete && - !this.options.partialRefetch && - !result.loading && - !result.data && - !result.error) { - logMissingFieldErrors(diff.missing); - } - } - if (saveAsLastResult) { - this.updateLastResult(result); - } - return result; - }; - ObservableQuery.prototype.isDifferentFromLastResult = function (newResult) { - return !this.last || !(0,_wry_equality__WEBPACK_IMPORTED_MODULE_1__.equal)(this.last.result, newResult); - }; - ObservableQuery.prototype.getLast = function (key, variablesMustMatch) { - var last = this.last; - if (last && - last[key] && - (!variablesMustMatch || (0,_wry_equality__WEBPACK_IMPORTED_MODULE_1__.equal)(last.variables, this.variables))) { - return last[key]; - } - }; - ObservableQuery.prototype.getLastResult = function (variablesMustMatch) { - return this.getLast("result", variablesMustMatch); - }; - ObservableQuery.prototype.getLastError = function (variablesMustMatch) { - return this.getLast("error", variablesMustMatch); - }; - ObservableQuery.prototype.resetLastResults = function () { - delete this.last; - this.isTornDown = false; - }; - ObservableQuery.prototype.resetQueryStoreErrors = function () { - this.queryManager.resetErrors(this.queryId); - }; - ObservableQuery.prototype.refetch = function (variables) { - var _a; - var reobserveOptions = { - pollInterval: 0, - }; - var fetchPolicy = this.options.fetchPolicy; - if (fetchPolicy === 'no-cache') { - reobserveOptions.fetchPolicy = 'no-cache'; - } - else if (fetchPolicy !== 'cache-and-network') { - reobserveOptions.fetchPolicy = 'network-only'; - } - if (__DEV__ && variables && hasOwnProperty.call(variables, "variables")) { - var queryDef = (0,_utilities_index_js__WEBPACK_IMPORTED_MODULE_3__.getQueryDefinition)(this.options.query); - var vars = queryDef.variableDefinitions; - if (!vars || !vars.some(function (v) { return v.variable.name.value === "variables"; })) { - __DEV__ && _utilities_globals_index_js__WEBPACK_IMPORTED_MODULE_0__.invariant.warn("Called refetch(" + JSON.stringify(variables) + ") for query " + (((_a = queryDef.name) === null || _a === void 0 ? void 0 : _a.value) || JSON.stringify(queryDef)) + ", which does not declare a $variables variable.\nDid you mean to call refetch(variables) instead of refetch({ variables })?"); - } - } - if (variables && !(0,_wry_equality__WEBPACK_IMPORTED_MODULE_1__.equal)(this.options.variables, variables)) { - reobserveOptions.variables = this.options.variables = (0,tslib__WEBPACK_IMPORTED_MODULE_2__.__assign)((0,tslib__WEBPACK_IMPORTED_MODULE_2__.__assign)({}, this.options.variables), variables); - } - this.queryInfo.resetLastWrite(); - return this.reobserve(reobserveOptions, _networkStatus_js__WEBPACK_IMPORTED_MODULE_4__.NetworkStatus.refetch); - }; - ObservableQuery.prototype.fetchMore = function (fetchMoreOptions) { - var _this = this; - var combinedOptions = (0,tslib__WEBPACK_IMPORTED_MODULE_2__.__assign)((0,tslib__WEBPACK_IMPORTED_MODULE_2__.__assign)({}, (fetchMoreOptions.query ? fetchMoreOptions : (0,tslib__WEBPACK_IMPORTED_MODULE_2__.__assign)((0,tslib__WEBPACK_IMPORTED_MODULE_2__.__assign)((0,tslib__WEBPACK_IMPORTED_MODULE_2__.__assign)({}, this.options), fetchMoreOptions), { variables: (0,tslib__WEBPACK_IMPORTED_MODULE_2__.__assign)((0,tslib__WEBPACK_IMPORTED_MODULE_2__.__assign)({}, this.options.variables), fetchMoreOptions.variables) }))), { fetchPolicy: "no-cache" }); - var qid = this.queryManager.generateQueryId(); - if (combinedOptions.notifyOnNetworkStatusChange) { - this.queryInfo.networkStatus = _networkStatus_js__WEBPACK_IMPORTED_MODULE_4__.NetworkStatus.fetchMore; - this.observe(); - } - return this.queryManager.fetchQuery(qid, combinedOptions, _networkStatus_js__WEBPACK_IMPORTED_MODULE_4__.NetworkStatus.fetchMore).then(function (fetchMoreResult) { - var data = fetchMoreResult.data; - var updateQuery = fetchMoreOptions.updateQuery; - if (updateQuery) { - if (__DEV__ && - !warnedAboutUpdateQuery) { - __DEV__ && _utilities_globals_index_js__WEBPACK_IMPORTED_MODULE_0__.invariant.warn("The updateQuery callback for fetchMore is deprecated, and will be removed\nin the next major version of Apollo Client.\n\nPlease convert updateQuery functions to field policies with appropriate\nread and merge functions, or use/adapt a helper function (such as\nconcatPagination, offsetLimitPagination, or relayStylePagination) from\n@apollo/client/utilities.\n\nThe field policy system handles pagination more effectively than a\nhand-written updateQuery function, and you only need to define the policy\nonce, rather than every time you call fetchMore."); - warnedAboutUpdateQuery = true; - } - _this.updateQuery(function (previous) { return updateQuery(previous, { - fetchMoreResult: data, - variables: combinedOptions.variables, - }); }); - } - else { - _this.queryManager.cache.writeQuery({ - query: combinedOptions.query, - variables: combinedOptions.variables, - data: data, - }); - } - return fetchMoreResult; - }).finally(function () { - _this.queryManager.stopQuery(qid); - _this.reobserve(); - }); - }; - ObservableQuery.prototype.subscribeToMore = function (options) { - var _this = this; - var subscription = this.queryManager - .startGraphQLSubscription({ - query: options.document, - variables: options.variables, - context: options.context, - }) - .subscribe({ - next: function (subscriptionData) { - var updateQuery = options.updateQuery; - if (updateQuery) { - _this.updateQuery(function (previous, _a) { - var variables = _a.variables; - return updateQuery(previous, { - subscriptionData: subscriptionData, - variables: variables, - }); - }); - } - }, - error: function (err) { - if (options.onError) { - options.onError(err); - return; - } - __DEV__ && _utilities_globals_index_js__WEBPACK_IMPORTED_MODULE_0__.invariant.error('Unhandled GraphQL subscription error', err); - }, - }); - this.subscriptions.add(subscription); - return function () { - if (_this.subscriptions.delete(subscription)) { - subscription.unsubscribe(); - } - }; - }; - ObservableQuery.prototype.setOptions = function (newOptions) { - return this.reobserve(newOptions); - }; - ObservableQuery.prototype.setVariables = function (variables) { - if ((0,_wry_equality__WEBPACK_IMPORTED_MODULE_1__.equal)(this.variables, variables)) { - return this.observers.size - ? this.result() - : Promise.resolve(); - } - this.options.variables = variables; - if (!this.observers.size) { - return Promise.resolve(); - } - return this.reobserve({ - fetchPolicy: this.initialFetchPolicy, - variables: variables, - }, _networkStatus_js__WEBPACK_IMPORTED_MODULE_4__.NetworkStatus.setVariables); - }; - ObservableQuery.prototype.updateQuery = function (mapFn) { - var queryManager = this.queryManager; - var result = queryManager.cache.diff({ - query: this.options.query, - variables: this.variables, - returnPartialData: true, - optimistic: false, - }).result; - var newResult = mapFn(result, { - variables: this.variables, - }); - if (newResult) { - queryManager.cache.writeQuery({ - query: this.options.query, - data: newResult, - variables: this.variables, - }); - queryManager.broadcastQueries(); - } - }; - ObservableQuery.prototype.startPolling = function (pollInterval) { - this.options.pollInterval = pollInterval; - this.updatePolling(); - }; - ObservableQuery.prototype.stopPolling = function () { - this.options.pollInterval = 0; - this.updatePolling(); - }; - ObservableQuery.prototype.fetch = function (options, newNetworkStatus) { - this.queryManager.setObservableQuery(this); - return this.queryManager.fetchQueryObservable(this.queryId, options, newNetworkStatus); - }; - ObservableQuery.prototype.updatePolling = function () { - var _this = this; - if (this.queryManager.ssrMode) { - return; - } - var _a = this, pollingInfo = _a.pollingInfo, pollInterval = _a.options.pollInterval; - if (!pollInterval) { - if (pollingInfo) { - clearTimeout(pollingInfo.timeout); - delete this.pollingInfo; - } - return; - } - if (pollingInfo && - pollingInfo.interval === pollInterval) { - return; - } - __DEV__ ? (0,_utilities_globals_index_js__WEBPACK_IMPORTED_MODULE_0__.invariant)(pollInterval, 'Attempted to start a polling query without a polling interval.') : (0,_utilities_globals_index_js__WEBPACK_IMPORTED_MODULE_0__.invariant)(pollInterval, 12); - var info = pollingInfo || (this.pollingInfo = {}); - info.interval = pollInterval; - var maybeFetch = function () { - if (_this.pollingInfo) { - if (!(0,_networkStatus_js__WEBPACK_IMPORTED_MODULE_4__.isNetworkRequestInFlight)(_this.queryInfo.networkStatus)) { - _this.reobserve({ - fetchPolicy: "network-only", - }, _networkStatus_js__WEBPACK_IMPORTED_MODULE_4__.NetworkStatus.poll).then(poll, poll); - } - else { - poll(); - } - } - ; - }; - var poll = function () { - var info = _this.pollingInfo; - if (info) { - clearTimeout(info.timeout); - info.timeout = setTimeout(maybeFetch, info.interval); - } - }; - poll(); - }; - ObservableQuery.prototype.updateLastResult = function (newResult, variables) { - if (variables === void 0) { variables = this.variables; } - this.last = (0,tslib__WEBPACK_IMPORTED_MODULE_2__.__assign)((0,tslib__WEBPACK_IMPORTED_MODULE_2__.__assign)({}, this.last), { result: this.queryManager.assumeImmutableResults - ? newResult - : (0,_utilities_index_js__WEBPACK_IMPORTED_MODULE_5__.cloneDeep)(newResult), variables: variables }); - if (!(0,_utilities_index_js__WEBPACK_IMPORTED_MODULE_6__.isNonEmptyArray)(newResult.errors)) { - delete this.last.error; - } - return this.last; - }; - ObservableQuery.prototype.reobserve = function (newOptions, newNetworkStatus) { - var _this = this; - this.isTornDown = false; - var useDisposableConcast = newNetworkStatus === _networkStatus_js__WEBPACK_IMPORTED_MODULE_4__.NetworkStatus.refetch || - newNetworkStatus === _networkStatus_js__WEBPACK_IMPORTED_MODULE_4__.NetworkStatus.fetchMore || - newNetworkStatus === _networkStatus_js__WEBPACK_IMPORTED_MODULE_4__.NetworkStatus.poll; - var oldVariables = this.options.variables; - var options = useDisposableConcast - ? (0,_utilities_index_js__WEBPACK_IMPORTED_MODULE_7__.compact)(this.options, newOptions) - : assign(this.options, (0,_utilities_index_js__WEBPACK_IMPORTED_MODULE_7__.compact)(newOptions)); - if (!useDisposableConcast) { - this.updatePolling(); - if (newOptions && - newOptions.variables && - !newOptions.fetchPolicy && - !(0,_wry_equality__WEBPACK_IMPORTED_MODULE_1__.equal)(newOptions.variables, oldVariables)) { - options.fetchPolicy = this.initialFetchPolicy; - if (newNetworkStatus === void 0) { - newNetworkStatus = _networkStatus_js__WEBPACK_IMPORTED_MODULE_4__.NetworkStatus.setVariables; - } - } - } - var variables = options.variables && (0,tslib__WEBPACK_IMPORTED_MODULE_2__.__assign)({}, options.variables); - var concast = this.fetch(options, newNetworkStatus); - var observer = { - next: function (result) { - _this.reportResult(result, variables); - }, - error: function (error) { - _this.reportError(error, variables); - }, - }; - if (!useDisposableConcast) { - if (this.concast && this.observer) { - this.concast.removeObserver(this.observer, true); - } - this.concast = concast; - this.observer = observer; - } - concast.addObserver(observer); - return concast.promise; - }; - ObservableQuery.prototype.observe = function () { - this.reportResult(this.getCurrentResult(false), this.variables); - }; - ObservableQuery.prototype.reportResult = function (result, variables) { - if (this.getLastError() || this.isDifferentFromLastResult(result)) { - this.updateLastResult(result, variables); - (0,_utilities_index_js__WEBPACK_IMPORTED_MODULE_8__.iterateObserversSafely)(this.observers, 'next', result); - } - }; - ObservableQuery.prototype.reportError = function (error, variables) { - var errorResult = (0,tslib__WEBPACK_IMPORTED_MODULE_2__.__assign)((0,tslib__WEBPACK_IMPORTED_MODULE_2__.__assign)({}, this.getLastResult()), { error: error, errors: error.graphQLErrors, networkStatus: _networkStatus_js__WEBPACK_IMPORTED_MODULE_4__.NetworkStatus.error, loading: false }); - this.updateLastResult(errorResult, variables); - (0,_utilities_index_js__WEBPACK_IMPORTED_MODULE_8__.iterateObserversSafely)(this.observers, 'error', this.last.error = error); - }; - ObservableQuery.prototype.hasObservers = function () { - return this.observers.size > 0; - }; - ObservableQuery.prototype.tearDownQuery = function () { - if (this.isTornDown) - return; - if (this.concast && this.observer) { - this.concast.removeObserver(this.observer); - delete this.concast; - delete this.observer; - } - this.stopPolling(); - this.subscriptions.forEach(function (sub) { return sub.unsubscribe(); }); - this.subscriptions.clear(); - this.queryManager.stopQuery(this.queryId); - this.observers.clear(); - this.isTornDown = true; - }; - return ObservableQuery; -}(_utilities_index_js__WEBPACK_IMPORTED_MODULE_9__.Observable)); - -(0,_utilities_index_js__WEBPACK_IMPORTED_MODULE_10__.fixObservableSubclass)(ObservableQuery); -function defaultSubscriptionObserverErrorCallback(error) { - __DEV__ && _utilities_globals_index_js__WEBPACK_IMPORTED_MODULE_0__.invariant.error('Unhandled error', error.message, error.stack); -} -function logMissingFieldErrors(missing) { - if (__DEV__ && (0,_utilities_index_js__WEBPACK_IMPORTED_MODULE_6__.isNonEmptyArray)(missing)) { - __DEV__ && _utilities_globals_index_js__WEBPACK_IMPORTED_MODULE_0__.invariant.debug("Missing cache result fields: " + missing.map(function (m) { return m.path.join('.'); }).join(', '), missing); - } -} -function applyNextFetchPolicy(options) { - var _a = options.fetchPolicy, fetchPolicy = _a === void 0 ? "cache-first" : _a, nextFetchPolicy = options.nextFetchPolicy; - if (nextFetchPolicy) { - options.fetchPolicy = typeof nextFetchPolicy === "function" - ? nextFetchPolicy.call(options, fetchPolicy) - : nextFetchPolicy; - } -} -//# sourceMappingURL=ObservableQuery.js.map - -/***/ }), - -/***/ "../../node_modules/@apollo/client/core/QueryInfo.js": -/*!***********************************************************!*\ - !*** ../../node_modules/@apollo/client/core/QueryInfo.js ***! - \***********************************************************/ -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "QueryInfo": function() { return /* binding */ QueryInfo; }, -/* harmony export */ "shouldWriteResult": function() { return /* binding */ shouldWriteResult; } -/* harmony export */ }); -/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! tslib */ "../../node_modules/tslib/tslib.es6.js"); -/* harmony import */ var _wry_equality__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @wry/equality */ "../../node_modules/@wry/equality/lib/equality.esm.js"); -/* harmony import */ var _utilities_index_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../utilities/index.js */ "../../node_modules/@apollo/client/utilities/common/canUse.js"); -/* harmony import */ var _utilities_index_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../utilities/index.js */ "../../node_modules/@apollo/client/utilities/common/arrays.js"); -/* harmony import */ var _utilities_index_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../utilities/index.js */ "../../node_modules/@apollo/client/utilities/common/errorHandling.js"); -/* harmony import */ var _networkStatus_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./networkStatus.js */ "../../node_modules/@apollo/client/core/networkStatus.js"); - - - - -; -var destructiveMethodCounts = new (_utilities_index_js__WEBPACK_IMPORTED_MODULE_1__.canUseWeakMap ? WeakMap : Map)(); -function wrapDestructiveCacheMethod(cache, methodName) { - var original = cache[methodName]; - if (typeof original === "function") { - cache[methodName] = function () { - destructiveMethodCounts.set(cache, (destructiveMethodCounts.get(cache) + 1) % 1e15); - return original.apply(this, arguments); - }; - } -} -function cancelNotifyTimeout(info) { - if (info["notifyTimeout"]) { - clearTimeout(info["notifyTimeout"]); - info["notifyTimeout"] = void 0; - } -} -var QueryInfo = (function () { - function QueryInfo(queryManager, queryId) { - if (queryId === void 0) { queryId = queryManager.generateQueryId(); } - this.queryId = queryId; - this.listeners = new Set(); - this.document = null; - this.lastRequestId = 1; - this.subscriptions = new Set(); - this.stopped = false; - this.dirty = false; - this.observableQuery = null; - var cache = this.cache = queryManager.cache; - if (!destructiveMethodCounts.has(cache)) { - destructiveMethodCounts.set(cache, 0); - wrapDestructiveCacheMethod(cache, "evict"); - wrapDestructiveCacheMethod(cache, "modify"); - wrapDestructiveCacheMethod(cache, "reset"); - } - } - QueryInfo.prototype.init = function (query) { - var networkStatus = query.networkStatus || _networkStatus_js__WEBPACK_IMPORTED_MODULE_2__.NetworkStatus.loading; - if (this.variables && - this.networkStatus !== _networkStatus_js__WEBPACK_IMPORTED_MODULE_2__.NetworkStatus.loading && - !(0,_wry_equality__WEBPACK_IMPORTED_MODULE_0__.equal)(this.variables, query.variables)) { - networkStatus = _networkStatus_js__WEBPACK_IMPORTED_MODULE_2__.NetworkStatus.setVariables; - } - if (!(0,_wry_equality__WEBPACK_IMPORTED_MODULE_0__.equal)(query.variables, this.variables)) { - this.lastDiff = void 0; - } - Object.assign(this, { - document: query.document, - variables: query.variables, - networkError: null, - graphQLErrors: this.graphQLErrors || [], - networkStatus: networkStatus, - }); - if (query.observableQuery) { - this.setObservableQuery(query.observableQuery); - } - if (query.lastRequestId) { - this.lastRequestId = query.lastRequestId; - } - return this; - }; - QueryInfo.prototype.reset = function () { - cancelNotifyTimeout(this); - this.lastDiff = void 0; - this.dirty = false; - }; - QueryInfo.prototype.getDiff = function (variables) { - if (variables === void 0) { variables = this.variables; } - var options = this.getDiffOptions(variables); - if (this.lastDiff && (0,_wry_equality__WEBPACK_IMPORTED_MODULE_0__.equal)(options, this.lastDiff.options)) { - return this.lastDiff.diff; - } - this.updateWatch(this.variables = variables); - var oq = this.observableQuery; - if (oq && oq.options.fetchPolicy === "no-cache") { - return { complete: false }; - } - var diff = this.cache.diff(options); - this.updateLastDiff(diff, options); - return diff; - }; - QueryInfo.prototype.updateLastDiff = function (diff, options) { - this.lastDiff = diff ? { - diff: diff, - options: options || this.getDiffOptions(), - } : void 0; - }; - QueryInfo.prototype.getDiffOptions = function (variables) { - if (variables === void 0) { variables = this.variables; } - var oq = this.observableQuery; - return { - query: this.document, - variables: variables, - returnPartialData: true, - optimistic: true, - canonizeResults: !oq || oq.options.canonizeResults !== false, - }; - }; - QueryInfo.prototype.setDiff = function (diff) { - var _this = this; - var oldDiff = this.lastDiff && this.lastDiff.diff; - this.updateLastDiff(diff); - if (!this.dirty && - !(0,_wry_equality__WEBPACK_IMPORTED_MODULE_0__.equal)(oldDiff && oldDiff.result, diff && diff.result)) { - this.dirty = true; - if (!this.notifyTimeout) { - this.notifyTimeout = setTimeout(function () { return _this.notify(); }, 0); - } - } - }; - QueryInfo.prototype.setObservableQuery = function (oq) { - var _this = this; - if (oq === this.observableQuery) - return; - if (this.oqListener) { - this.listeners.delete(this.oqListener); - } - this.observableQuery = oq; - if (oq) { - oq["queryInfo"] = this; - this.listeners.add(this.oqListener = function () { - if (_this.getDiff().fromOptimisticTransaction) { - oq["observe"](); - } - else { - oq.reobserve(); - } - }); - } - else { - delete this.oqListener; - } - }; - QueryInfo.prototype.notify = function () { - var _this = this; - cancelNotifyTimeout(this); - if (this.shouldNotify()) { - this.listeners.forEach(function (listener) { return listener(_this); }); - } - this.dirty = false; - }; - QueryInfo.prototype.shouldNotify = function () { - if (!this.dirty || !this.listeners.size) { - return false; - } - if ((0,_networkStatus_js__WEBPACK_IMPORTED_MODULE_2__.isNetworkRequestInFlight)(this.networkStatus) && - this.observableQuery) { - var fetchPolicy = this.observableQuery.options.fetchPolicy; - if (fetchPolicy !== "cache-only" && - fetchPolicy !== "cache-and-network") { - return false; - } - } - return true; - }; - QueryInfo.prototype.stop = function () { - if (!this.stopped) { - this.stopped = true; - this.reset(); - this.cancel(); - this.cancel = QueryInfo.prototype.cancel; - this.subscriptions.forEach(function (sub) { return sub.unsubscribe(); }); - var oq = this.observableQuery; - if (oq) - oq.stopPolling(); - } - }; - QueryInfo.prototype.cancel = function () { }; - QueryInfo.prototype.updateWatch = function (variables) { - var _this = this; - if (variables === void 0) { variables = this.variables; } - var oq = this.observableQuery; - if (oq && oq.options.fetchPolicy === "no-cache") { - return; - } - var watchOptions = (0,tslib__WEBPACK_IMPORTED_MODULE_3__.__assign)((0,tslib__WEBPACK_IMPORTED_MODULE_3__.__assign)({}, this.getDiffOptions(variables)), { watcher: this, callback: function (diff) { return _this.setDiff(diff); } }); - if (!this.lastWatch || - !(0,_wry_equality__WEBPACK_IMPORTED_MODULE_0__.equal)(watchOptions, this.lastWatch)) { - this.cancel(); - this.cancel = this.cache.watch(this.lastWatch = watchOptions); - } - }; - QueryInfo.prototype.resetLastWrite = function () { - this.lastWrite = void 0; - }; - QueryInfo.prototype.shouldWrite = function (result, variables) { - var lastWrite = this.lastWrite; - return !(lastWrite && - lastWrite.dmCount === destructiveMethodCounts.get(this.cache) && - (0,_wry_equality__WEBPACK_IMPORTED_MODULE_0__.equal)(variables, lastWrite.variables) && - (0,_wry_equality__WEBPACK_IMPORTED_MODULE_0__.equal)(result.data, lastWrite.result.data)); - }; - QueryInfo.prototype.markResult = function (result, options, cacheWriteBehavior) { - var _this = this; - this.graphQLErrors = (0,_utilities_index_js__WEBPACK_IMPORTED_MODULE_4__.isNonEmptyArray)(result.errors) ? result.errors : []; - this.reset(); - if (options.fetchPolicy === 'no-cache') { - this.updateLastDiff({ result: result.data, complete: true }, this.getDiffOptions(options.variables)); - } - else if (cacheWriteBehavior !== 0) { - if (shouldWriteResult(result, options.errorPolicy)) { - this.cache.performTransaction(function (cache) { - if (_this.shouldWrite(result, options.variables)) { - cache.writeQuery({ - query: _this.document, - data: result.data, - variables: options.variables, - overwrite: cacheWriteBehavior === 1, - }); - _this.lastWrite = { - result: result, - variables: options.variables, - dmCount: destructiveMethodCounts.get(_this.cache), - }; - } - else { - if (_this.lastDiff && - _this.lastDiff.diff.complete) { - result.data = _this.lastDiff.diff.result; - return; - } - } - var diffOptions = _this.getDiffOptions(options.variables); - var diff = cache.diff(diffOptions); - if (!_this.stopped) { - _this.updateWatch(options.variables); - } - _this.updateLastDiff(diff, diffOptions); - if (diff.complete) { - result.data = diff.result; - } - }); - } - else { - this.lastWrite = void 0; - } - } - }; - QueryInfo.prototype.markReady = function () { - this.networkError = null; - return this.networkStatus = _networkStatus_js__WEBPACK_IMPORTED_MODULE_2__.NetworkStatus.ready; - }; - QueryInfo.prototype.markError = function (error) { - this.networkStatus = _networkStatus_js__WEBPACK_IMPORTED_MODULE_2__.NetworkStatus.error; - this.lastWrite = void 0; - this.reset(); - if (error.graphQLErrors) { - this.graphQLErrors = error.graphQLErrors; - } - if (error.networkError) { - this.networkError = error.networkError; - } - return error; - }; - return QueryInfo; -}()); - -function shouldWriteResult(result, errorPolicy) { - if (errorPolicy === void 0) { errorPolicy = "none"; } - var ignoreErrors = errorPolicy === "ignore" || - errorPolicy === "all"; - var writeWithErrors = !(0,_utilities_index_js__WEBPACK_IMPORTED_MODULE_5__.graphQLResultHasError)(result); - if (!writeWithErrors && ignoreErrors && result.data) { - writeWithErrors = true; - } - return writeWithErrors; -} -//# sourceMappingURL=QueryInfo.js.map - -/***/ }), - -/***/ "../../node_modules/@apollo/client/core/QueryManager.js": -/*!**************************************************************!*\ - !*** ../../node_modules/@apollo/client/core/QueryManager.js ***! - \**************************************************************/ -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "QueryManager": function() { return /* binding */ QueryManager; } -/* harmony export */ }); -/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! tslib */ "../../node_modules/tslib/tslib.es6.js"); -/* harmony import */ var _utilities_globals_index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../utilities/globals/index.js */ "../../node_modules/@apollo/client/utilities/globals/index.js"); -/* harmony import */ var _wry_equality__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @wry/equality */ "../../node_modules/@wry/equality/lib/equality.esm.js"); -/* harmony import */ var _link_core_index_js__WEBPACK_IMPORTED_MODULE_20__ = __webpack_require__(/*! ../link/core/index.js */ "../../node_modules/@apollo/client/link/core/execute.js"); -/* harmony import */ var _cache_index_js__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! ../cache/index.js */ "../../node_modules/@apollo/client/cache/inmemory/object-canon.js"); -/* harmony import */ var _utilities_index_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../utilities/index.js */ "../../node_modules/@apollo/client/utilities/common/canUse.js"); -/* harmony import */ var _utilities_index_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../utilities/index.js */ "../../node_modules/@apollo/client/utilities/observables/asyncMap.js"); -/* harmony import */ var _utilities_index_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../utilities/index.js */ "../../node_modules/@apollo/client/utilities/common/errorHandling.js"); -/* harmony import */ var _utilities_index_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../utilities/index.js */ "../../node_modules/@apollo/client/utilities/graphql/getFromAST.js"); -/* harmony import */ var _utilities_index_js__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../utilities/index.js */ "../../node_modules/@apollo/client/utilities/graphql/transform.js"); -/* harmony import */ var _utilities_index_js__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ../utilities/index.js */ "../../node_modules/@apollo/client/utilities/graphql/directives.js"); -/* harmony import */ var _utilities_index_js__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ../utilities/index.js */ "../../node_modules/@apollo/client/utilities/graphql/storeUtils.js"); -/* harmony import */ var _utilities_index_js__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ../utilities/index.js */ "../../node_modules/@apollo/client/utilities/common/objects.js"); -/* harmony import */ var _utilities_index_js__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ../utilities/index.js */ "../../node_modules/@apollo/client/utilities/common/makeUniqueId.js"); -/* harmony import */ var _utilities_index_js__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! ../utilities/index.js */ "../../node_modules/zen-observable-ts/module.js"); -/* harmony import */ var _utilities_index_js__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(/*! ../utilities/index.js */ "../../node_modules/@apollo/client/utilities/observables/Concast.js"); -/* harmony import */ var _utilities_index_js__WEBPACK_IMPORTED_MODULE_21__ = __webpack_require__(/*! ../utilities/index.js */ "../../node_modules/@apollo/client/utilities/common/arrays.js"); -/* harmony import */ var _errors_index_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../errors/index.js */ "../../node_modules/@apollo/client/errors/index.js"); -/* harmony import */ var _ObservableQuery_js__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./ObservableQuery.js */ "../../node_modules/@apollo/client/core/ObservableQuery.js"); -/* harmony import */ var _networkStatus_js__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./networkStatus.js */ "../../node_modules/@apollo/client/core/networkStatus.js"); -/* harmony import */ var _LocalState_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./LocalState.js */ "../../node_modules/@apollo/client/core/LocalState.js"); -/* harmony import */ var _QueryInfo_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./QueryInfo.js */ "../../node_modules/@apollo/client/core/QueryInfo.js"); - - - - - - - - - - - -var hasOwnProperty = Object.prototype.hasOwnProperty; -var QueryManager = (function () { - function QueryManager(_a) { - var cache = _a.cache, link = _a.link, _b = _a.queryDeduplication, queryDeduplication = _b === void 0 ? false : _b, onBroadcast = _a.onBroadcast, _c = _a.ssrMode, ssrMode = _c === void 0 ? false : _c, _d = _a.clientAwareness, clientAwareness = _d === void 0 ? {} : _d, localState = _a.localState, assumeImmutableResults = _a.assumeImmutableResults; - this.clientAwareness = {}; - this.queries = new Map(); - this.fetchCancelFns = new Map(); - this.transformCache = new (_utilities_index_js__WEBPACK_IMPORTED_MODULE_2__.canUseWeakMap ? WeakMap : Map)(); - this.queryIdCounter = 1; - this.requestIdCounter = 1; - this.mutationIdCounter = 1; - this.inFlightLinkObservables = new Map(); - this.cache = cache; - this.link = link; - this.queryDeduplication = queryDeduplication; - this.clientAwareness = clientAwareness; - this.localState = localState || new _LocalState_js__WEBPACK_IMPORTED_MODULE_3__.LocalState({ cache: cache }); - this.ssrMode = ssrMode; - this.assumeImmutableResults = !!assumeImmutableResults; - if ((this.onBroadcast = onBroadcast)) { - this.mutationStore = Object.create(null); - } - } - QueryManager.prototype.stop = function () { - var _this = this; - this.queries.forEach(function (_info, queryId) { - _this.stopQueryNoBroadcast(queryId); - }); - this.cancelPendingFetches(__DEV__ ? new _utilities_globals_index_js__WEBPACK_IMPORTED_MODULE_0__.InvariantError('QueryManager stopped while query was in flight') : new _utilities_globals_index_js__WEBPACK_IMPORTED_MODULE_0__.InvariantError(13)); - }; - QueryManager.prototype.cancelPendingFetches = function (error) { - this.fetchCancelFns.forEach(function (cancel) { return cancel(error); }); - this.fetchCancelFns.clear(); - }; - QueryManager.prototype.mutate = function (_a) { - var mutation = _a.mutation, variables = _a.variables, optimisticResponse = _a.optimisticResponse, updateQueries = _a.updateQueries, _b = _a.refetchQueries, refetchQueries = _b === void 0 ? [] : _b, _c = _a.awaitRefetchQueries, awaitRefetchQueries = _c === void 0 ? false : _c, updateWithProxyFn = _a.update, onQueryUpdated = _a.onQueryUpdated, _d = _a.errorPolicy, errorPolicy = _d === void 0 ? 'none' : _d, _e = _a.fetchPolicy, fetchPolicy = _e === void 0 ? 'network-only' : _e, keepRootFields = _a.keepRootFields, context = _a.context; - return (0,tslib__WEBPACK_IMPORTED_MODULE_4__.__awaiter)(this, void 0, void 0, function () { - var mutationId, mutationStoreValue, self; - return (0,tslib__WEBPACK_IMPORTED_MODULE_4__.__generator)(this, function (_f) { - switch (_f.label) { - case 0: - __DEV__ ? (0,_utilities_globals_index_js__WEBPACK_IMPORTED_MODULE_0__.invariant)(mutation, 'mutation option is required. You must specify your GraphQL document in the mutation option.') : (0,_utilities_globals_index_js__WEBPACK_IMPORTED_MODULE_0__.invariant)(mutation, 14); - __DEV__ ? (0,_utilities_globals_index_js__WEBPACK_IMPORTED_MODULE_0__.invariant)(fetchPolicy === 'network-only' || - fetchPolicy === 'no-cache', "Mutations support only 'network-only' or 'no-cache' fetchPolicy strings. The default `network-only` behavior automatically writes mutation results to the cache. Passing `no-cache` skips the cache write.") : (0,_utilities_globals_index_js__WEBPACK_IMPORTED_MODULE_0__.invariant)(fetchPolicy === 'network-only' || - fetchPolicy === 'no-cache', 15); - mutationId = this.generateMutationId(); - mutation = this.transform(mutation).document; - variables = this.getVariables(mutation, variables); - if (!this.transform(mutation).hasClientExports) return [3, 2]; - return [4, this.localState.addExportedVariables(mutation, variables, context)]; - case 1: - variables = (_f.sent()); - _f.label = 2; - case 2: - mutationStoreValue = this.mutationStore && - (this.mutationStore[mutationId] = { - mutation: mutation, - variables: variables, - loading: true, - error: null, - }); - if (optimisticResponse) { - this.markMutationOptimistic(optimisticResponse, { - mutationId: mutationId, - document: mutation, - variables: variables, - fetchPolicy: fetchPolicy, - errorPolicy: errorPolicy, - context: context, - updateQueries: updateQueries, - update: updateWithProxyFn, - keepRootFields: keepRootFields, - }); - } - this.broadcastQueries(); - self = this; - return [2, new Promise(function (resolve, reject) { - return (0,_utilities_index_js__WEBPACK_IMPORTED_MODULE_5__.asyncMap)(self.getObservableFromLink(mutation, (0,tslib__WEBPACK_IMPORTED_MODULE_4__.__assign)((0,tslib__WEBPACK_IMPORTED_MODULE_4__.__assign)({}, context), { optimisticResponse: optimisticResponse }), variables, false), function (result) { - if ((0,_utilities_index_js__WEBPACK_IMPORTED_MODULE_6__.graphQLResultHasError)(result) && errorPolicy === 'none') { - throw new _errors_index_js__WEBPACK_IMPORTED_MODULE_7__.ApolloError({ - graphQLErrors: result.errors, - }); - } - if (mutationStoreValue) { - mutationStoreValue.loading = false; - mutationStoreValue.error = null; - } - var storeResult = (0,tslib__WEBPACK_IMPORTED_MODULE_4__.__assign)({}, result); - if (typeof refetchQueries === "function") { - refetchQueries = refetchQueries(storeResult); - } - if (errorPolicy === 'ignore' && - (0,_utilities_index_js__WEBPACK_IMPORTED_MODULE_6__.graphQLResultHasError)(storeResult)) { - delete storeResult.errors; - } - return self.markMutationResult({ - mutationId: mutationId, - result: storeResult, - document: mutation, - variables: variables, - fetchPolicy: fetchPolicy, - errorPolicy: errorPolicy, - context: context, - update: updateWithProxyFn, - updateQueries: updateQueries, - awaitRefetchQueries: awaitRefetchQueries, - refetchQueries: refetchQueries, - removeOptimistic: optimisticResponse ? mutationId : void 0, - onQueryUpdated: onQueryUpdated, - keepRootFields: keepRootFields, - }); - }).subscribe({ - next: function (storeResult) { - self.broadcastQueries(); - resolve(storeResult); - }, - error: function (err) { - if (mutationStoreValue) { - mutationStoreValue.loading = false; - mutationStoreValue.error = err; - } - if (optimisticResponse) { - self.cache.removeOptimistic(mutationId); - } - self.broadcastQueries(); - reject(err instanceof _errors_index_js__WEBPACK_IMPORTED_MODULE_7__.ApolloError ? err : new _errors_index_js__WEBPACK_IMPORTED_MODULE_7__.ApolloError({ - networkError: err, - })); - }, - }); - })]; - } - }); - }); - }; - QueryManager.prototype.markMutationResult = function (mutation, cache) { - var _this = this; - if (cache === void 0) { cache = this.cache; } - var result = mutation.result; - var cacheWrites = []; - var skipCache = mutation.fetchPolicy === "no-cache"; - if (!skipCache && (0,_QueryInfo_js__WEBPACK_IMPORTED_MODULE_8__.shouldWriteResult)(result, mutation.errorPolicy)) { - cacheWrites.push({ - result: result.data, - dataId: 'ROOT_MUTATION', - query: mutation.document, - variables: mutation.variables, - }); - var updateQueries_1 = mutation.updateQueries; - if (updateQueries_1) { - this.queries.forEach(function (_a, queryId) { - var observableQuery = _a.observableQuery; - var queryName = observableQuery && observableQuery.queryName; - if (!queryName || !hasOwnProperty.call(updateQueries_1, queryName)) { - return; - } - var updater = updateQueries_1[queryName]; - var _b = _this.queries.get(queryId), document = _b.document, variables = _b.variables; - var _c = cache.diff({ - query: document, - variables: variables, - returnPartialData: true, - optimistic: false, - }), currentQueryResult = _c.result, complete = _c.complete; - if (complete && currentQueryResult) { - var nextQueryResult = updater(currentQueryResult, { - mutationResult: result, - queryName: document && (0,_utilities_index_js__WEBPACK_IMPORTED_MODULE_9__.getOperationName)(document) || void 0, - queryVariables: variables, - }); - if (nextQueryResult) { - cacheWrites.push({ - result: nextQueryResult, - dataId: 'ROOT_QUERY', - query: document, - variables: variables, - }); - } - } - }); - } - } - if (cacheWrites.length > 0 || - mutation.refetchQueries || - mutation.update || - mutation.onQueryUpdated || - mutation.removeOptimistic) { - var results_1 = []; - this.refetchQueries({ - updateCache: function (cache) { - if (!skipCache) { - cacheWrites.forEach(function (write) { return cache.write(write); }); - } - var update = mutation.update; - if (update) { - if (!skipCache) { - var diff = cache.diff({ - id: "ROOT_MUTATION", - query: _this.transform(mutation.document).asQuery, - variables: mutation.variables, - optimistic: false, - returnPartialData: true, - }); - if (diff.complete) { - result = (0,tslib__WEBPACK_IMPORTED_MODULE_4__.__assign)((0,tslib__WEBPACK_IMPORTED_MODULE_4__.__assign)({}, result), { data: diff.result }); - } - } - update(cache, result, { - context: mutation.context, - variables: mutation.variables, - }); - } - if (!skipCache && !mutation.keepRootFields) { - cache.modify({ - id: 'ROOT_MUTATION', - fields: function (value, _a) { - var fieldName = _a.fieldName, DELETE = _a.DELETE; - return fieldName === "__typename" ? value : DELETE; - }, - }); - } - }, - include: mutation.refetchQueries, - optimistic: false, - removeOptimistic: mutation.removeOptimistic, - onQueryUpdated: mutation.onQueryUpdated || null, - }).forEach(function (result) { return results_1.push(result); }); - if (mutation.awaitRefetchQueries || mutation.onQueryUpdated) { - return Promise.all(results_1).then(function () { return result; }); - } - } - return Promise.resolve(result); - }; - QueryManager.prototype.markMutationOptimistic = function (optimisticResponse, mutation) { - var _this = this; - var data = typeof optimisticResponse === "function" - ? optimisticResponse(mutation.variables) - : optimisticResponse; - return this.cache.recordOptimisticTransaction(function (cache) { - try { - _this.markMutationResult((0,tslib__WEBPACK_IMPORTED_MODULE_4__.__assign)((0,tslib__WEBPACK_IMPORTED_MODULE_4__.__assign)({}, mutation), { result: { data: data } }), cache); - } - catch (error) { - __DEV__ && _utilities_globals_index_js__WEBPACK_IMPORTED_MODULE_0__.invariant.error(error); - } - }, mutation.mutationId); - }; - QueryManager.prototype.fetchQuery = function (queryId, options, networkStatus) { - return this.fetchQueryObservable(queryId, options, networkStatus).promise; - }; - QueryManager.prototype.getQueryStore = function () { - var store = Object.create(null); - this.queries.forEach(function (info, queryId) { - store[queryId] = { - variables: info.variables, - networkStatus: info.networkStatus, - networkError: info.networkError, - graphQLErrors: info.graphQLErrors, - }; - }); - return store; - }; - QueryManager.prototype.resetErrors = function (queryId) { - var queryInfo = this.queries.get(queryId); - if (queryInfo) { - queryInfo.networkError = undefined; - queryInfo.graphQLErrors = []; - } - }; - QueryManager.prototype.transform = function (document) { - var transformCache = this.transformCache; - if (!transformCache.has(document)) { - var transformed = this.cache.transformDocument(document); - var forLink = (0,_utilities_index_js__WEBPACK_IMPORTED_MODULE_10__.removeConnectionDirectiveFromDocument)(this.cache.transformForLink(transformed)); - var clientQuery = this.localState.clientQuery(transformed); - var serverQuery = forLink && this.localState.serverQuery(forLink); - var cacheEntry_1 = { - document: transformed, - hasClientExports: (0,_utilities_index_js__WEBPACK_IMPORTED_MODULE_11__.hasClientExports)(transformed), - hasForcedResolvers: this.localState.shouldForceResolvers(transformed), - clientQuery: clientQuery, - serverQuery: serverQuery, - defaultVars: (0,_utilities_index_js__WEBPACK_IMPORTED_MODULE_9__.getDefaultValues)((0,_utilities_index_js__WEBPACK_IMPORTED_MODULE_9__.getOperationDefinition)(transformed)), - asQuery: (0,tslib__WEBPACK_IMPORTED_MODULE_4__.__assign)((0,tslib__WEBPACK_IMPORTED_MODULE_4__.__assign)({}, transformed), { definitions: transformed.definitions.map(function (def) { - if (def.kind === "OperationDefinition" && - def.operation !== "query") { - return (0,tslib__WEBPACK_IMPORTED_MODULE_4__.__assign)((0,tslib__WEBPACK_IMPORTED_MODULE_4__.__assign)({}, def), { operation: "query" }); - } - return def; - }) }) - }; - var add = function (doc) { - if (doc && !transformCache.has(doc)) { - transformCache.set(doc, cacheEntry_1); - } - }; - add(document); - add(transformed); - add(clientQuery); - add(serverQuery); - } - return transformCache.get(document); - }; - QueryManager.prototype.getVariables = function (document, variables) { - return (0,tslib__WEBPACK_IMPORTED_MODULE_4__.__assign)((0,tslib__WEBPACK_IMPORTED_MODULE_4__.__assign)({}, this.transform(document).defaultVars), variables); - }; - QueryManager.prototype.watchQuery = function (options) { - options = (0,tslib__WEBPACK_IMPORTED_MODULE_4__.__assign)((0,tslib__WEBPACK_IMPORTED_MODULE_4__.__assign)({}, options), { variables: this.getVariables(options.query, options.variables) }); - if (typeof options.notifyOnNetworkStatusChange === 'undefined') { - options.notifyOnNetworkStatusChange = false; - } - var queryInfo = new _QueryInfo_js__WEBPACK_IMPORTED_MODULE_8__.QueryInfo(this); - var observable = new _ObservableQuery_js__WEBPACK_IMPORTED_MODULE_12__.ObservableQuery({ - queryManager: this, - queryInfo: queryInfo, - options: options, - }); - this.queries.set(observable.queryId, queryInfo); - queryInfo.init({ - document: options.query, - observableQuery: observable, - variables: options.variables, - }); - return observable; - }; - QueryManager.prototype.query = function (options, queryId) { - var _this = this; - if (queryId === void 0) { queryId = this.generateQueryId(); } - __DEV__ ? (0,_utilities_globals_index_js__WEBPACK_IMPORTED_MODULE_0__.invariant)(options.query, 'query option is required. You must specify your GraphQL document ' + - 'in the query option.') : (0,_utilities_globals_index_js__WEBPACK_IMPORTED_MODULE_0__.invariant)(options.query, 16); - __DEV__ ? (0,_utilities_globals_index_js__WEBPACK_IMPORTED_MODULE_0__.invariant)(options.query.kind === 'Document', 'You must wrap the query string in a "gql" tag.') : (0,_utilities_globals_index_js__WEBPACK_IMPORTED_MODULE_0__.invariant)(options.query.kind === 'Document', 17); - __DEV__ ? (0,_utilities_globals_index_js__WEBPACK_IMPORTED_MODULE_0__.invariant)(!options.returnPartialData, 'returnPartialData option only supported on watchQuery.') : (0,_utilities_globals_index_js__WEBPACK_IMPORTED_MODULE_0__.invariant)(!options.returnPartialData, 18); - __DEV__ ? (0,_utilities_globals_index_js__WEBPACK_IMPORTED_MODULE_0__.invariant)(!options.pollInterval, 'pollInterval option only supported on watchQuery.') : (0,_utilities_globals_index_js__WEBPACK_IMPORTED_MODULE_0__.invariant)(!options.pollInterval, 19); - return this.fetchQuery(queryId, options).finally(function () { return _this.stopQuery(queryId); }); - }; - QueryManager.prototype.generateQueryId = function () { - return String(this.queryIdCounter++); - }; - QueryManager.prototype.generateRequestId = function () { - return this.requestIdCounter++; - }; - QueryManager.prototype.generateMutationId = function () { - return String(this.mutationIdCounter++); - }; - QueryManager.prototype.stopQueryInStore = function (queryId) { - this.stopQueryInStoreNoBroadcast(queryId); - this.broadcastQueries(); - }; - QueryManager.prototype.stopQueryInStoreNoBroadcast = function (queryId) { - var queryInfo = this.queries.get(queryId); - if (queryInfo) - queryInfo.stop(); - }; - QueryManager.prototype.clearStore = function () { - this.cancelPendingFetches(__DEV__ ? new _utilities_globals_index_js__WEBPACK_IMPORTED_MODULE_0__.InvariantError('Store reset while query was in flight (not completed in link chain)') : new _utilities_globals_index_js__WEBPACK_IMPORTED_MODULE_0__.InvariantError(20)); - this.queries.forEach(function (queryInfo) { - if (queryInfo.observableQuery) { - queryInfo.networkStatus = _networkStatus_js__WEBPACK_IMPORTED_MODULE_13__.NetworkStatus.loading; - } - else { - queryInfo.stop(); - } - }); - if (this.mutationStore) { - this.mutationStore = Object.create(null); - } - return this.cache.reset(); - }; - QueryManager.prototype.resetStore = function () { - var _this = this; - return this.clearStore().then(function () { - return _this.reFetchObservableQueries(); - }); - }; - QueryManager.prototype.getObservableQueries = function (include) { - var _this = this; - if (include === void 0) { include = "active"; } - var queries = new Map(); - var queryNamesAndDocs = new Map(); - var legacyQueryOptions = new Set(); - if (Array.isArray(include)) { - include.forEach(function (desc) { - if (typeof desc === "string") { - queryNamesAndDocs.set(desc, false); - } - else if ((0,_utilities_index_js__WEBPACK_IMPORTED_MODULE_14__.isDocumentNode)(desc)) { - queryNamesAndDocs.set(_this.transform(desc).document, false); - } - else if ((0,_utilities_index_js__WEBPACK_IMPORTED_MODULE_15__.isNonNullObject)(desc) && desc.query) { - legacyQueryOptions.add(desc); - } - }); - } - this.queries.forEach(function (_a, queryId) { - var oq = _a.observableQuery, document = _a.document; - if (oq) { - if (include === "all") { - queries.set(queryId, oq); - return; - } - var queryName = oq.queryName, fetchPolicy = oq.options.fetchPolicy; - if (fetchPolicy === "standby" || !oq.hasObservers()) { - return; - } - if (include === "active" || - (queryName && queryNamesAndDocs.has(queryName)) || - (document && queryNamesAndDocs.has(document))) { - queries.set(queryId, oq); - if (queryName) - queryNamesAndDocs.set(queryName, true); - if (document) - queryNamesAndDocs.set(document, true); - } - } - }); - if (legacyQueryOptions.size) { - legacyQueryOptions.forEach(function (options) { - var queryId = (0,_utilities_index_js__WEBPACK_IMPORTED_MODULE_16__.makeUniqueId)("legacyOneTimeQuery"); - var queryInfo = _this.getQuery(queryId).init({ - document: options.query, - variables: options.variables, - }); - var oq = new _ObservableQuery_js__WEBPACK_IMPORTED_MODULE_12__.ObservableQuery({ - queryManager: _this, - queryInfo: queryInfo, - options: (0,tslib__WEBPACK_IMPORTED_MODULE_4__.__assign)((0,tslib__WEBPACK_IMPORTED_MODULE_4__.__assign)({}, options), { fetchPolicy: "network-only" }), - }); - (0,_utilities_globals_index_js__WEBPACK_IMPORTED_MODULE_0__.invariant)(oq.queryId === queryId); - queryInfo.setObservableQuery(oq); - queries.set(queryId, oq); - }); - } - if (__DEV__ && queryNamesAndDocs.size) { - queryNamesAndDocs.forEach(function (included, nameOrDoc) { - if (!included) { - __DEV__ && _utilities_globals_index_js__WEBPACK_IMPORTED_MODULE_0__.invariant.warn("Unknown query " + (typeof nameOrDoc === "string" ? "named " : "") + JSON.stringify(nameOrDoc, null, 2) + " requested in refetchQueries options.include array"); - } - }); - } - return queries; - }; - QueryManager.prototype.reFetchObservableQueries = function (includeStandby) { - var _this = this; - if (includeStandby === void 0) { includeStandby = false; } - var observableQueryPromises = []; - this.getObservableQueries(includeStandby ? "all" : "active").forEach(function (observableQuery, queryId) { - var fetchPolicy = observableQuery.options.fetchPolicy; - observableQuery.resetLastResults(); - if (includeStandby || - (fetchPolicy !== "standby" && - fetchPolicy !== "cache-only")) { - observableQueryPromises.push(observableQuery.refetch()); - } - _this.getQuery(queryId).setDiff(null); - }); - this.broadcastQueries(); - return Promise.all(observableQueryPromises); - }; - QueryManager.prototype.setObservableQuery = function (observableQuery) { - this.getQuery(observableQuery.queryId).setObservableQuery(observableQuery); - }; - QueryManager.prototype.startGraphQLSubscription = function (_a) { - var _this = this; - var query = _a.query, fetchPolicy = _a.fetchPolicy, errorPolicy = _a.errorPolicy, variables = _a.variables, _b = _a.context, context = _b === void 0 ? {} : _b; - query = this.transform(query).document; - variables = this.getVariables(query, variables); - var makeObservable = function (variables) { - return _this.getObservableFromLink(query, context, variables).map(function (result) { - if (fetchPolicy !== 'no-cache') { - if ((0,_QueryInfo_js__WEBPACK_IMPORTED_MODULE_8__.shouldWriteResult)(result, errorPolicy)) { - _this.cache.write({ - query: query, - result: result.data, - dataId: 'ROOT_SUBSCRIPTION', - variables: variables, - }); - } - _this.broadcastQueries(); - } - if ((0,_utilities_index_js__WEBPACK_IMPORTED_MODULE_6__.graphQLResultHasError)(result)) { - throw new _errors_index_js__WEBPACK_IMPORTED_MODULE_7__.ApolloError({ - graphQLErrors: result.errors, - }); - } - return result; - }); - }; - if (this.transform(query).hasClientExports) { - var observablePromise_1 = this.localState.addExportedVariables(query, variables, context).then(makeObservable); - return new _utilities_index_js__WEBPACK_IMPORTED_MODULE_17__.Observable(function (observer) { - var sub = null; - observablePromise_1.then(function (observable) { return sub = observable.subscribe(observer); }, observer.error); - return function () { return sub && sub.unsubscribe(); }; - }); - } - return makeObservable(variables); - }; - QueryManager.prototype.stopQuery = function (queryId) { - this.stopQueryNoBroadcast(queryId); - this.broadcastQueries(); - }; - QueryManager.prototype.stopQueryNoBroadcast = function (queryId) { - this.stopQueryInStoreNoBroadcast(queryId); - this.removeQuery(queryId); - }; - QueryManager.prototype.removeQuery = function (queryId) { - this.fetchCancelFns.delete(queryId); - this.getQuery(queryId).stop(); - this.queries.delete(queryId); - }; - QueryManager.prototype.broadcastQueries = function () { - if (this.onBroadcast) - this.onBroadcast(); - this.queries.forEach(function (info) { return info.notify(); }); - }; - QueryManager.prototype.getLocalState = function () { - return this.localState; - }; - QueryManager.prototype.getObservableFromLink = function (query, context, variables, deduplication) { - var _this = this; - var _a; - if (deduplication === void 0) { deduplication = (_a = context === null || context === void 0 ? void 0 : context.queryDeduplication) !== null && _a !== void 0 ? _a : this.queryDeduplication; } - var observable; - var serverQuery = this.transform(query).serverQuery; - if (serverQuery) { - var _b = this, inFlightLinkObservables_1 = _b.inFlightLinkObservables, link = _b.link; - var operation = { - query: serverQuery, - variables: variables, - operationName: (0,_utilities_index_js__WEBPACK_IMPORTED_MODULE_9__.getOperationName)(serverQuery) || void 0, - context: this.prepareContext((0,tslib__WEBPACK_IMPORTED_MODULE_4__.__assign)((0,tslib__WEBPACK_IMPORTED_MODULE_4__.__assign)({}, context), { forceFetch: !deduplication })), - }; - context = operation.context; - if (deduplication) { - var byVariables_1 = inFlightLinkObservables_1.get(serverQuery) || new Map(); - inFlightLinkObservables_1.set(serverQuery, byVariables_1); - var varJson_1 = (0,_cache_index_js__WEBPACK_IMPORTED_MODULE_18__.canonicalStringify)(variables); - observable = byVariables_1.get(varJson_1); - if (!observable) { - var concast = new _utilities_index_js__WEBPACK_IMPORTED_MODULE_19__.Concast([ - (0,_link_core_index_js__WEBPACK_IMPORTED_MODULE_20__.execute)(link, operation) - ]); - byVariables_1.set(varJson_1, observable = concast); - concast.cleanup(function () { - if (byVariables_1.delete(varJson_1) && - byVariables_1.size < 1) { - inFlightLinkObservables_1.delete(serverQuery); - } - }); - } - } - else { - observable = new _utilities_index_js__WEBPACK_IMPORTED_MODULE_19__.Concast([ - (0,_link_core_index_js__WEBPACK_IMPORTED_MODULE_20__.execute)(link, operation) - ]); - } - } - else { - observable = new _utilities_index_js__WEBPACK_IMPORTED_MODULE_19__.Concast([ - _utilities_index_js__WEBPACK_IMPORTED_MODULE_17__.Observable.of({ data: {} }) - ]); - context = this.prepareContext(context); - } - var clientQuery = this.transform(query).clientQuery; - if (clientQuery) { - observable = (0,_utilities_index_js__WEBPACK_IMPORTED_MODULE_5__.asyncMap)(observable, function (result) { - return _this.localState.runResolvers({ - document: clientQuery, - remoteResult: result, - context: context, - variables: variables, - }); - }); - } - return observable; - }; - QueryManager.prototype.getResultsFromLink = function (queryInfo, cacheWriteBehavior, options) { - var requestId = queryInfo.lastRequestId = this.generateRequestId(); - return (0,_utilities_index_js__WEBPACK_IMPORTED_MODULE_5__.asyncMap)(this.getObservableFromLink(queryInfo.document, options.context, options.variables), function (result) { - var hasErrors = (0,_utilities_index_js__WEBPACK_IMPORTED_MODULE_21__.isNonEmptyArray)(result.errors); - if (requestId >= queryInfo.lastRequestId) { - if (hasErrors && options.errorPolicy === "none") { - throw queryInfo.markError(new _errors_index_js__WEBPACK_IMPORTED_MODULE_7__.ApolloError({ - graphQLErrors: result.errors, - })); - } - queryInfo.markResult(result, options, cacheWriteBehavior); - queryInfo.markReady(); - } - var aqr = { - data: result.data, - loading: false, - networkStatus: queryInfo.networkStatus || _networkStatus_js__WEBPACK_IMPORTED_MODULE_13__.NetworkStatus.ready, - }; - if (hasErrors && options.errorPolicy !== "ignore") { - aqr.errors = result.errors; - } - return aqr; - }, function (networkError) { - var error = (0,_errors_index_js__WEBPACK_IMPORTED_MODULE_7__.isApolloError)(networkError) - ? networkError - : new _errors_index_js__WEBPACK_IMPORTED_MODULE_7__.ApolloError({ networkError: networkError }); - if (requestId >= queryInfo.lastRequestId) { - queryInfo.markError(error); - } - throw error; - }); - }; - QueryManager.prototype.fetchQueryObservable = function (queryId, options, networkStatus) { - var _this = this; - if (networkStatus === void 0) { networkStatus = _networkStatus_js__WEBPACK_IMPORTED_MODULE_13__.NetworkStatus.loading; } - var query = this.transform(options.query).document; - var variables = this.getVariables(query, options.variables); - var queryInfo = this.getQuery(queryId); - var _a = options.fetchPolicy, fetchPolicy = _a === void 0 ? "cache-first" : _a, _b = options.errorPolicy, errorPolicy = _b === void 0 ? "none" : _b, _c = options.returnPartialData, returnPartialData = _c === void 0 ? false : _c, _d = options.notifyOnNetworkStatusChange, notifyOnNetworkStatusChange = _d === void 0 ? false : _d, _e = options.context, context = _e === void 0 ? {} : _e; - var normalized = Object.assign({}, options, { - query: query, - variables: variables, - fetchPolicy: fetchPolicy, - errorPolicy: errorPolicy, - returnPartialData: returnPartialData, - notifyOnNetworkStatusChange: notifyOnNetworkStatusChange, - context: context, - }); - var fromVariables = function (variables) { - normalized.variables = variables; - return _this.fetchQueryByPolicy(queryInfo, normalized, networkStatus); - }; - this.fetchCancelFns.set(queryId, function (reason) { - setTimeout(function () { return concast.cancel(reason); }); - }); - var concast = new _utilities_index_js__WEBPACK_IMPORTED_MODULE_19__.Concast(this.transform(normalized.query).hasClientExports - ? this.localState.addExportedVariables(normalized.query, normalized.variables, normalized.context).then(fromVariables) - : fromVariables(normalized.variables)); - concast.cleanup(function () { - _this.fetchCancelFns.delete(queryId); - (0,_ObservableQuery_js__WEBPACK_IMPORTED_MODULE_12__.applyNextFetchPolicy)(options); - }); - return concast; - }; - QueryManager.prototype.refetchQueries = function (_a) { - var _this = this; - var updateCache = _a.updateCache, include = _a.include, _b = _a.optimistic, optimistic = _b === void 0 ? false : _b, _c = _a.removeOptimistic, removeOptimistic = _c === void 0 ? optimistic ? (0,_utilities_index_js__WEBPACK_IMPORTED_MODULE_16__.makeUniqueId)("refetchQueries") : void 0 : _c, onQueryUpdated = _a.onQueryUpdated; - var includedQueriesById = new Map(); - if (include) { - this.getObservableQueries(include).forEach(function (oq, queryId) { - includedQueriesById.set(queryId, { - oq: oq, - lastDiff: _this.getQuery(queryId).getDiff(), - }); - }); - } - var results = new Map; - if (updateCache) { - this.cache.batch({ - update: updateCache, - optimistic: optimistic && removeOptimistic || false, - removeOptimistic: removeOptimistic, - onWatchUpdated: function (watch, diff, lastDiff) { - var oq = watch.watcher instanceof _QueryInfo_js__WEBPACK_IMPORTED_MODULE_8__.QueryInfo && - watch.watcher.observableQuery; - if (oq) { - if (onQueryUpdated) { - includedQueriesById.delete(oq.queryId); - var result = onQueryUpdated(oq, diff, lastDiff); - if (result === true) { - result = oq.refetch(); - } - if (result !== false) { - results.set(oq, result); - } - return false; - } - if (onQueryUpdated !== null) { - includedQueriesById.set(oq.queryId, { oq: oq, lastDiff: lastDiff, diff: diff }); - } - } - }, - }); - } - if (includedQueriesById.size) { - includedQueriesById.forEach(function (_a, queryId) { - var oq = _a.oq, lastDiff = _a.lastDiff, diff = _a.diff; - var result; - if (onQueryUpdated) { - if (!diff) { - var info = oq["queryInfo"]; - info.reset(); - diff = info.getDiff(); - } - result = onQueryUpdated(oq, diff, lastDiff); - } - if (!onQueryUpdated || result === true) { - result = oq.refetch(); - } - if (result !== false) { - results.set(oq, result); - } - if (queryId.indexOf("legacyOneTimeQuery") >= 0) { - _this.stopQueryNoBroadcast(queryId); - } - }); - } - if (removeOptimistic) { - this.cache.removeOptimistic(removeOptimistic); - } - return results; - }; - QueryManager.prototype.fetchQueryByPolicy = function (queryInfo, _a, networkStatus) { - var _this = this; - var query = _a.query, variables = _a.variables, fetchPolicy = _a.fetchPolicy, refetchWritePolicy = _a.refetchWritePolicy, errorPolicy = _a.errorPolicy, returnPartialData = _a.returnPartialData, context = _a.context, notifyOnNetworkStatusChange = _a.notifyOnNetworkStatusChange; - var oldNetworkStatus = queryInfo.networkStatus; - queryInfo.init({ - document: query, - variables: variables, - networkStatus: networkStatus, - }); - var readCache = function () { return queryInfo.getDiff(variables); }; - var resultsFromCache = function (diff, networkStatus) { - if (networkStatus === void 0) { networkStatus = queryInfo.networkStatus || _networkStatus_js__WEBPACK_IMPORTED_MODULE_13__.NetworkStatus.loading; } - var data = diff.result; - if (__DEV__ && - !returnPartialData && - !(0,_wry_equality__WEBPACK_IMPORTED_MODULE_1__.equal)(data, {})) { - (0,_ObservableQuery_js__WEBPACK_IMPORTED_MODULE_12__.logMissingFieldErrors)(diff.missing); - } - var fromData = function (data) { return _utilities_index_js__WEBPACK_IMPORTED_MODULE_17__.Observable.of((0,tslib__WEBPACK_IMPORTED_MODULE_4__.__assign)({ data: data, loading: (0,_networkStatus_js__WEBPACK_IMPORTED_MODULE_13__.isNetworkRequestInFlight)(networkStatus), networkStatus: networkStatus }, (diff.complete ? null : { partial: true }))); }; - if (data && _this.transform(query).hasForcedResolvers) { - return _this.localState.runResolvers({ - document: query, - remoteResult: { data: data }, - context: context, - variables: variables, - onlyRunForcedResolvers: true, - }).then(function (resolved) { return fromData(resolved.data || void 0); }); - } - return fromData(data); - }; - var cacheWriteBehavior = fetchPolicy === "no-cache" ? 0 : - (networkStatus === _networkStatus_js__WEBPACK_IMPORTED_MODULE_13__.NetworkStatus.refetch && - refetchWritePolicy !== "merge") ? 1 - : 2; - var resultsFromLink = function () { - return _this.getResultsFromLink(queryInfo, cacheWriteBehavior, { - variables: variables, - context: context, - fetchPolicy: fetchPolicy, - errorPolicy: errorPolicy, - }); - }; - var shouldNotify = notifyOnNetworkStatusChange && - typeof oldNetworkStatus === "number" && - oldNetworkStatus !== networkStatus && - (0,_networkStatus_js__WEBPACK_IMPORTED_MODULE_13__.isNetworkRequestInFlight)(networkStatus); - switch (fetchPolicy) { - default: - case "cache-first": { - var diff = readCache(); - if (diff.complete) { - return [ - resultsFromCache(diff, queryInfo.markReady()), - ]; - } - if (returnPartialData || shouldNotify) { - return [ - resultsFromCache(diff), - resultsFromLink(), - ]; - } - return [ - resultsFromLink(), - ]; - } - case "cache-and-network": { - var diff = readCache(); - if (diff.complete || returnPartialData || shouldNotify) { - return [ - resultsFromCache(diff), - resultsFromLink(), - ]; - } - return [ - resultsFromLink(), - ]; - } - case "cache-only": - return [ - resultsFromCache(readCache(), queryInfo.markReady()), - ]; - case "network-only": - if (shouldNotify) { - return [ - resultsFromCache(readCache()), - resultsFromLink(), - ]; - } - return [resultsFromLink()]; - case "no-cache": - if (shouldNotify) { - return [ - resultsFromCache(queryInfo.getDiff()), - resultsFromLink(), - ]; - } - return [resultsFromLink()]; - case "standby": - return []; - } - }; - QueryManager.prototype.getQuery = function (queryId) { - if (queryId && !this.queries.has(queryId)) { - this.queries.set(queryId, new _QueryInfo_js__WEBPACK_IMPORTED_MODULE_8__.QueryInfo(this, queryId)); - } - return this.queries.get(queryId); - }; - QueryManager.prototype.prepareContext = function (context) { - if (context === void 0) { context = {}; } - var newContext = this.localState.prepareContext(context); - return (0,tslib__WEBPACK_IMPORTED_MODULE_4__.__assign)((0,tslib__WEBPACK_IMPORTED_MODULE_4__.__assign)({}, newContext), { clientAwareness: this.clientAwareness }); - }; - return QueryManager; -}()); - -//# sourceMappingURL=QueryManager.js.map - -/***/ }), - -/***/ "../../node_modules/@apollo/client/core/networkStatus.js": -/*!***************************************************************!*\ - !*** ../../node_modules/@apollo/client/core/networkStatus.js ***! - \***************************************************************/ -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "NetworkStatus": function() { return /* binding */ NetworkStatus; }, -/* harmony export */ "isNetworkRequestInFlight": function() { return /* binding */ isNetworkRequestInFlight; } -/* harmony export */ }); -var NetworkStatus; -(function (NetworkStatus) { - NetworkStatus[NetworkStatus["loading"] = 1] = "loading"; - NetworkStatus[NetworkStatus["setVariables"] = 2] = "setVariables"; - NetworkStatus[NetworkStatus["fetchMore"] = 3] = "fetchMore"; - NetworkStatus[NetworkStatus["refetch"] = 4] = "refetch"; - NetworkStatus[NetworkStatus["poll"] = 6] = "poll"; - NetworkStatus[NetworkStatus["ready"] = 7] = "ready"; - NetworkStatus[NetworkStatus["error"] = 8] = "error"; -})(NetworkStatus || (NetworkStatus = {})); -function isNetworkRequestInFlight(networkStatus) { - return networkStatus ? networkStatus < 7 : false; -} -//# sourceMappingURL=networkStatus.js.map - -/***/ }), - -/***/ "../../node_modules/@apollo/client/errors/index.js": -/*!*********************************************************!*\ - !*** ../../node_modules/@apollo/client/errors/index.js ***! - \*********************************************************/ -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "isApolloError": function() { return /* binding */ isApolloError; }, -/* harmony export */ "ApolloError": function() { return /* binding */ ApolloError; } -/* harmony export */ }); -/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! tslib */ "../../node_modules/tslib/tslib.es6.js"); -/* harmony import */ var _utilities_globals_index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../utilities/globals/index.js */ "../../node_modules/@apollo/client/utilities/globals/index.js"); -/* harmony import */ var _utilities_index_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../utilities/index.js */ "../../node_modules/@apollo/client/utilities/common/arrays.js"); - - - -function isApolloError(err) { - return err.hasOwnProperty('graphQLErrors'); -} -var generateErrorMessage = function (err) { - var message = ''; - if ((0,_utilities_index_js__WEBPACK_IMPORTED_MODULE_1__.isNonEmptyArray)(err.graphQLErrors) || (0,_utilities_index_js__WEBPACK_IMPORTED_MODULE_1__.isNonEmptyArray)(err.clientErrors)) { - var errors = (err.graphQLErrors || []) - .concat(err.clientErrors || []); - errors.forEach(function (error) { - var errorMessage = error - ? error.message - : 'Error message not found.'; - message += errorMessage + "\n"; - }); - } - if (err.networkError) { - message += err.networkError.message + "\n"; - } - message = message.replace(/\n$/, ''); - return message; -}; -var ApolloError = (function (_super) { - (0,tslib__WEBPACK_IMPORTED_MODULE_2__.__extends)(ApolloError, _super); - function ApolloError(_a) { - var graphQLErrors = _a.graphQLErrors, clientErrors = _a.clientErrors, networkError = _a.networkError, errorMessage = _a.errorMessage, extraInfo = _a.extraInfo; - var _this = _super.call(this, errorMessage) || this; - _this.graphQLErrors = graphQLErrors || []; - _this.clientErrors = clientErrors || []; - _this.networkError = networkError || null; - _this.message = errorMessage || generateErrorMessage(_this); - _this.extraInfo = extraInfo; - _this.__proto__ = ApolloError.prototype; - return _this; - } - return ApolloError; -}(Error)); - -//# sourceMappingURL=index.js.map - -/***/ }), - -/***/ "../../node_modules/@apollo/client/link/core/ApolloLink.js": -/*!*****************************************************************!*\ - !*** ../../node_modules/@apollo/client/link/core/ApolloLink.js ***! - \*****************************************************************/ -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "ApolloLink": function() { return /* binding */ ApolloLink; } -/* harmony export */ }); -/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! tslib */ "../../node_modules/tslib/tslib.es6.js"); -/* harmony import */ var _utilities_globals_index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../utilities/globals/index.js */ "../../node_modules/@apollo/client/utilities/globals/index.js"); -/* harmony import */ var _utilities_index_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../utilities/index.js */ "../../node_modules/zen-observable-ts/module.js"); -/* harmony import */ var _utils_index_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../utils/index.js */ "../../node_modules/@apollo/client/link/utils/createOperation.js"); -/* harmony import */ var _utils_index_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../utils/index.js */ "../../node_modules/@apollo/client/link/utils/transformOperation.js"); -/* harmony import */ var _utils_index_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../utils/index.js */ "../../node_modules/@apollo/client/link/utils/validateOperation.js"); - - - - -function passthrough(op, forward) { - return (forward ? forward(op) : _utilities_index_js__WEBPACK_IMPORTED_MODULE_1__.Observable.of()); -} -function toLink(handler) { - return typeof handler === 'function' ? new ApolloLink(handler) : handler; -} -function isTerminating(link) { - return link.request.length <= 1; -} -var LinkError = (function (_super) { - (0,tslib__WEBPACK_IMPORTED_MODULE_2__.__extends)(LinkError, _super); - function LinkError(message, link) { - var _this = _super.call(this, message) || this; - _this.link = link; - return _this; - } - return LinkError; -}(Error)); -var ApolloLink = (function () { - function ApolloLink(request) { - if (request) - this.request = request; - } - ApolloLink.empty = function () { - return new ApolloLink(function () { return _utilities_index_js__WEBPACK_IMPORTED_MODULE_1__.Observable.of(); }); - }; - ApolloLink.from = function (links) { - if (links.length === 0) - return ApolloLink.empty(); - return links.map(toLink).reduce(function (x, y) { return x.concat(y); }); - }; - ApolloLink.split = function (test, left, right) { - var leftLink = toLink(left); - var rightLink = toLink(right || new ApolloLink(passthrough)); - if (isTerminating(leftLink) && isTerminating(rightLink)) { - return new ApolloLink(function (operation) { - return test(operation) - ? leftLink.request(operation) || _utilities_index_js__WEBPACK_IMPORTED_MODULE_1__.Observable.of() - : rightLink.request(operation) || _utilities_index_js__WEBPACK_IMPORTED_MODULE_1__.Observable.of(); - }); - } - else { - return new ApolloLink(function (operation, forward) { - return test(operation) - ? leftLink.request(operation, forward) || _utilities_index_js__WEBPACK_IMPORTED_MODULE_1__.Observable.of() - : rightLink.request(operation, forward) || _utilities_index_js__WEBPACK_IMPORTED_MODULE_1__.Observable.of(); - }); - } - }; - ApolloLink.execute = function (link, operation) { - return (link.request((0,_utils_index_js__WEBPACK_IMPORTED_MODULE_3__.createOperation)(operation.context, (0,_utils_index_js__WEBPACK_IMPORTED_MODULE_4__.transformOperation)((0,_utils_index_js__WEBPACK_IMPORTED_MODULE_5__.validateOperation)(operation)))) || _utilities_index_js__WEBPACK_IMPORTED_MODULE_1__.Observable.of()); - }; - ApolloLink.concat = function (first, second) { - var firstLink = toLink(first); - if (isTerminating(firstLink)) { - __DEV__ && _utilities_globals_index_js__WEBPACK_IMPORTED_MODULE_0__.invariant.warn(new LinkError("You are calling concat on a terminating link, which will have no effect", firstLink)); - return firstLink; - } - var nextLink = toLink(second); - if (isTerminating(nextLink)) { - return new ApolloLink(function (operation) { - return firstLink.request(operation, function (op) { return nextLink.request(op) || _utilities_index_js__WEBPACK_IMPORTED_MODULE_1__.Observable.of(); }) || _utilities_index_js__WEBPACK_IMPORTED_MODULE_1__.Observable.of(); - }); - } - else { - return new ApolloLink(function (operation, forward) { - return (firstLink.request(operation, function (op) { - return nextLink.request(op, forward) || _utilities_index_js__WEBPACK_IMPORTED_MODULE_1__.Observable.of(); - }) || _utilities_index_js__WEBPACK_IMPORTED_MODULE_1__.Observable.of()); - }); - } - }; - ApolloLink.prototype.split = function (test, left, right) { - return this.concat(ApolloLink.split(test, left, right || new ApolloLink(passthrough))); - }; - ApolloLink.prototype.concat = function (next) { - return ApolloLink.concat(this, next); - }; - ApolloLink.prototype.request = function (operation, forward) { - throw __DEV__ ? new _utilities_globals_index_js__WEBPACK_IMPORTED_MODULE_0__.InvariantError('request is not implemented') : new _utilities_globals_index_js__WEBPACK_IMPORTED_MODULE_0__.InvariantError(21); - }; - ApolloLink.prototype.onError = function (error, observer) { - if (observer && observer.error) { - observer.error(error); - return false; - } - throw error; - }; - ApolloLink.prototype.setOnError = function (fn) { - this.onError = fn; - return this; - }; - return ApolloLink; -}()); - -//# sourceMappingURL=ApolloLink.js.map - -/***/ }), - -/***/ "../../node_modules/@apollo/client/link/core/execute.js": -/*!**************************************************************!*\ - !*** ../../node_modules/@apollo/client/link/core/execute.js ***! - \**************************************************************/ -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "execute": function() { return /* binding */ execute; } -/* harmony export */ }); -/* harmony import */ var _ApolloLink_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./ApolloLink.js */ "../../node_modules/@apollo/client/link/core/ApolloLink.js"); - -var execute = _ApolloLink_js__WEBPACK_IMPORTED_MODULE_0__.ApolloLink.execute; -//# sourceMappingURL=execute.js.map - -/***/ }), - -/***/ "../../node_modules/@apollo/client/link/http/HttpLink.js": -/*!***************************************************************!*\ - !*** ../../node_modules/@apollo/client/link/http/HttpLink.js ***! - \***************************************************************/ -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "HttpLink": function() { return /* binding */ HttpLink; } -/* harmony export */ }); -/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ "../../node_modules/tslib/tslib.es6.js"); -/* harmony import */ var _core_index_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../core/index.js */ "../../node_modules/@apollo/client/link/core/ApolloLink.js"); -/* harmony import */ var _createHttpLink_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./createHttpLink.js */ "../../node_modules/@apollo/client/link/http/createHttpLink.js"); - - - -var HttpLink = (function (_super) { - (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__extends)(HttpLink, _super); - function HttpLink(options) { - if (options === void 0) { options = {}; } - var _this = _super.call(this, (0,_createHttpLink_js__WEBPACK_IMPORTED_MODULE_1__.createHttpLink)(options).request) || this; - _this.options = options; - return _this; - } - return HttpLink; -}(_core_index_js__WEBPACK_IMPORTED_MODULE_2__.ApolloLink)); - -//# sourceMappingURL=HttpLink.js.map - -/***/ }), - -/***/ "../../node_modules/@apollo/client/link/http/checkFetcher.js": -/*!*******************************************************************!*\ - !*** ../../node_modules/@apollo/client/link/http/checkFetcher.js ***! - \*******************************************************************/ -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "checkFetcher": function() { return /* binding */ checkFetcher; } -/* harmony export */ }); -/* harmony import */ var _utilities_globals_index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../utilities/globals/index.js */ "../../node_modules/@apollo/client/utilities/globals/index.js"); - -var checkFetcher = function (fetcher) { - if (!fetcher && typeof fetch === 'undefined') { - throw __DEV__ ? new _utilities_globals_index_js__WEBPACK_IMPORTED_MODULE_0__.InvariantError("\n\"fetch\" has not been found globally and no fetcher has been configured. To fix this, install a fetch package (like https://www.npmjs.com/package/cross-fetch), instantiate the fetcher, and pass it into your HttpLink constructor. For example:\n\nimport fetch from 'cross-fetch';\nimport { ApolloClient, HttpLink } from '@apollo/client';\nconst client = new ApolloClient({\n link: new HttpLink({ uri: '/graphql', fetch })\n});\n ") : new _utilities_globals_index_js__WEBPACK_IMPORTED_MODULE_0__.InvariantError(22); - } -}; -//# sourceMappingURL=checkFetcher.js.map - -/***/ }), - -/***/ "../../node_modules/@apollo/client/link/http/createHttpLink.js": -/*!*********************************************************************!*\ - !*** ../../node_modules/@apollo/client/link/http/createHttpLink.js ***! - \*********************************************************************/ -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "createHttpLink": function() { return /* binding */ createHttpLink; } -/* harmony export */ }); -/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! tslib */ "../../node_modules/tslib/tslib.es6.js"); -/* harmony import */ var _utilities_globals_index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../utilities/index.js */ "../../node_modules/@apollo/client/utilities/globals/index.js"); -/* harmony import */ var graphql__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! graphql */ "../../node_modules/graphql/language/visitor.mjs"); -/* harmony import */ var _core_index_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../core/index.js */ "../../node_modules/@apollo/client/link/core/ApolloLink.js"); -/* harmony import */ var _utilities_index_js__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ../../utilities/index.js */ "../../node_modules/zen-observable-ts/module.js"); -/* harmony import */ var _serializeFetchParameter_js__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./serializeFetchParameter.js */ "../../node_modules/@apollo/client/link/http/serializeFetchParameter.js"); -/* harmony import */ var _selectURI_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./selectURI.js */ "../../node_modules/@apollo/client/link/http/selectURI.js"); -/* harmony import */ var _parseAndCheckHttpResponse_js__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./parseAndCheckHttpResponse.js */ "../../node_modules/@apollo/client/link/http/parseAndCheckHttpResponse.js"); -/* harmony import */ var _checkFetcher_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./checkFetcher.js */ "../../node_modules/@apollo/client/link/http/checkFetcher.js"); -/* harmony import */ var _selectHttpOptionsAndBody_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./selectHttpOptionsAndBody.js */ "../../node_modules/@apollo/client/link/http/selectHttpOptionsAndBody.js"); -/* harmony import */ var _createSignalIfSupported_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./createSignalIfSupported.js */ "../../node_modules/@apollo/client/link/http/createSignalIfSupported.js"); -/* harmony import */ var _rewriteURIForGET_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./rewriteURIForGET.js */ "../../node_modules/@apollo/client/link/http/rewriteURIForGET.js"); -/* harmony import */ var _utils_index_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../utils/index.js */ "../../node_modules/@apollo/client/link/utils/fromError.js"); - - - - - - - - - - - - - - -var backupFetch = (0,_utilities_globals_index_js__WEBPACK_IMPORTED_MODULE_0__.maybe)(function () { return fetch; }); -var createHttpLink = function (linkOptions) { - if (linkOptions === void 0) { linkOptions = {}; } - var _a = linkOptions.uri, uri = _a === void 0 ? '/graphql' : _a, preferredFetch = linkOptions.fetch, includeExtensions = linkOptions.includeExtensions, useGETForQueries = linkOptions.useGETForQueries, _b = linkOptions.includeUnusedVariables, includeUnusedVariables = _b === void 0 ? false : _b, requestOptions = (0,tslib__WEBPACK_IMPORTED_MODULE_1__.__rest)(linkOptions, ["uri", "fetch", "includeExtensions", "useGETForQueries", "includeUnusedVariables"]); - if (__DEV__) { - (0,_checkFetcher_js__WEBPACK_IMPORTED_MODULE_2__.checkFetcher)(preferredFetch || backupFetch); - } - var linkConfig = { - http: { includeExtensions: includeExtensions }, - options: requestOptions.fetchOptions, - credentials: requestOptions.credentials, - headers: requestOptions.headers, - }; - return new _core_index_js__WEBPACK_IMPORTED_MODULE_3__.ApolloLink(function (operation) { - var chosenURI = (0,_selectURI_js__WEBPACK_IMPORTED_MODULE_4__.selectURI)(operation, uri); - var context = operation.getContext(); - var clientAwarenessHeaders = {}; - if (context.clientAwareness) { - var _a = context.clientAwareness, name_1 = _a.name, version = _a.version; - if (name_1) { - clientAwarenessHeaders['apollographql-client-name'] = name_1; - } - if (version) { - clientAwarenessHeaders['apollographql-client-version'] = version; - } - } - var contextHeaders = (0,tslib__WEBPACK_IMPORTED_MODULE_1__.__assign)((0,tslib__WEBPACK_IMPORTED_MODULE_1__.__assign)({}, clientAwarenessHeaders), context.headers); - var contextConfig = { - http: context.http, - options: context.fetchOptions, - credentials: context.credentials, - headers: contextHeaders, - }; - var _b = (0,_selectHttpOptionsAndBody_js__WEBPACK_IMPORTED_MODULE_5__.selectHttpOptionsAndBody)(operation, _selectHttpOptionsAndBody_js__WEBPACK_IMPORTED_MODULE_5__.fallbackHttpConfig, linkConfig, contextConfig), options = _b.options, body = _b.body; - if (body.variables && !includeUnusedVariables) { - var unusedNames_1 = new Set(Object.keys(body.variables)); - (0,graphql__WEBPACK_IMPORTED_MODULE_6__.visit)(operation.query, { - Variable: function (node, _key, parent) { - if (parent && parent.kind !== 'VariableDefinition') { - unusedNames_1.delete(node.name.value); - } - }, - }); - if (unusedNames_1.size) { - body.variables = (0,tslib__WEBPACK_IMPORTED_MODULE_1__.__assign)({}, body.variables); - unusedNames_1.forEach(function (name) { - delete body.variables[name]; - }); - } - } - var controller; - if (!options.signal) { - var _c = (0,_createSignalIfSupported_js__WEBPACK_IMPORTED_MODULE_7__.createSignalIfSupported)(), _controller = _c.controller, signal = _c.signal; - controller = _controller; - if (controller) - options.signal = signal; - } - var definitionIsMutation = function (d) { - return d.kind === 'OperationDefinition' && d.operation === 'mutation'; - }; - if (useGETForQueries && - !operation.query.definitions.some(definitionIsMutation)) { - options.method = 'GET'; - } - if (options.method === 'GET') { - var _d = (0,_rewriteURIForGET_js__WEBPACK_IMPORTED_MODULE_8__.rewriteURIForGET)(chosenURI, body), newURI = _d.newURI, parseError = _d.parseError; - if (parseError) { - return (0,_utils_index_js__WEBPACK_IMPORTED_MODULE_9__.fromError)(parseError); - } - chosenURI = newURI; - } - else { - try { - options.body = (0,_serializeFetchParameter_js__WEBPACK_IMPORTED_MODULE_10__.serializeFetchParameter)(body, 'Payload'); - } - catch (parseError) { - return (0,_utils_index_js__WEBPACK_IMPORTED_MODULE_9__.fromError)(parseError); - } - } - return new _utilities_index_js__WEBPACK_IMPORTED_MODULE_11__.Observable(function (observer) { - var currentFetch = preferredFetch || (0,_utilities_globals_index_js__WEBPACK_IMPORTED_MODULE_0__.maybe)(function () { return fetch; }) || backupFetch; - currentFetch(chosenURI, options) - .then(function (response) { - operation.setContext({ response: response }); - return response; - }) - .then((0,_parseAndCheckHttpResponse_js__WEBPACK_IMPORTED_MODULE_12__.parseAndCheckHttpResponse)(operation)) - .then(function (result) { - observer.next(result); - observer.complete(); - return result; - }) - .catch(function (err) { - if (err.name === 'AbortError') - return; - if (err.result && err.result.errors && err.result.data) { - observer.next(err.result); - } - observer.error(err); - }); - return function () { - if (controller) - controller.abort(); - }; - }); - }); -}; -//# sourceMappingURL=createHttpLink.js.map - -/***/ }), - -/***/ "../../node_modules/@apollo/client/link/http/createSignalIfSupported.js": -/*!******************************************************************************!*\ - !*** ../../node_modules/@apollo/client/link/http/createSignalIfSupported.js ***! - \******************************************************************************/ -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "createSignalIfSupported": function() { return /* binding */ createSignalIfSupported; } -/* harmony export */ }); -var createSignalIfSupported = function () { - if (typeof AbortController === 'undefined') - return { controller: false, signal: false }; - var controller = new AbortController(); - var signal = controller.signal; - return { controller: controller, signal: signal }; -}; -//# sourceMappingURL=createSignalIfSupported.js.map - -/***/ }), - -/***/ "../../node_modules/@apollo/client/link/http/parseAndCheckHttpResponse.js": -/*!********************************************************************************!*\ - !*** ../../node_modules/@apollo/client/link/http/parseAndCheckHttpResponse.js ***! - \********************************************************************************/ -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "parseAndCheckHttpResponse": function() { return /* binding */ parseAndCheckHttpResponse; } -/* harmony export */ }); -/* harmony import */ var _utils_index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../utils/index.js */ "../../node_modules/@apollo/client/link/utils/throwServerError.js"); - -var hasOwnProperty = Object.prototype.hasOwnProperty; -function parseAndCheckHttpResponse(operations) { - return function (response) { return response - .text() - .then(function (bodyText) { - try { - return JSON.parse(bodyText); - } - catch (err) { - var parseError = err; - parseError.name = 'ServerParseError'; - parseError.response = response; - parseError.statusCode = response.status; - parseError.bodyText = bodyText; - throw parseError; - } - }) - .then(function (result) { - if (response.status >= 300) { - (0,_utils_index_js__WEBPACK_IMPORTED_MODULE_0__.throwServerError)(response, result, "Response not successful: Received status code " + response.status); - } - if (!Array.isArray(result) && - !hasOwnProperty.call(result, 'data') && - !hasOwnProperty.call(result, 'errors')) { - (0,_utils_index_js__WEBPACK_IMPORTED_MODULE_0__.throwServerError)(response, result, "Server response was missing for query '" + (Array.isArray(operations) - ? operations.map(function (op) { return op.operationName; }) - : operations.operationName) + "'."); - } - return result; - }); }; -} -//# sourceMappingURL=parseAndCheckHttpResponse.js.map - -/***/ }), - -/***/ "../../node_modules/@apollo/client/link/http/rewriteURIForGET.js": -/*!***********************************************************************!*\ - !*** ../../node_modules/@apollo/client/link/http/rewriteURIForGET.js ***! - \***********************************************************************/ -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "rewriteURIForGET": function() { return /* binding */ rewriteURIForGET; } -/* harmony export */ }); -/* harmony import */ var _serializeFetchParameter_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./serializeFetchParameter.js */ "../../node_modules/@apollo/client/link/http/serializeFetchParameter.js"); - -function rewriteURIForGET(chosenURI, body) { - var queryParams = []; - var addQueryParam = function (key, value) { - queryParams.push(key + "=" + encodeURIComponent(value)); - }; - if ('query' in body) { - addQueryParam('query', body.query); - } - if (body.operationName) { - addQueryParam('operationName', body.operationName); - } - if (body.variables) { - var serializedVariables = void 0; - try { - serializedVariables = (0,_serializeFetchParameter_js__WEBPACK_IMPORTED_MODULE_0__.serializeFetchParameter)(body.variables, 'Variables map'); - } - catch (parseError) { - return { parseError: parseError }; - } - addQueryParam('variables', serializedVariables); - } - if (body.extensions) { - var serializedExtensions = void 0; - try { - serializedExtensions = (0,_serializeFetchParameter_js__WEBPACK_IMPORTED_MODULE_0__.serializeFetchParameter)(body.extensions, 'Extensions map'); - } - catch (parseError) { - return { parseError: parseError }; - } - addQueryParam('extensions', serializedExtensions); - } - var fragment = '', preFragment = chosenURI; - var fragmentStart = chosenURI.indexOf('#'); - if (fragmentStart !== -1) { - fragment = chosenURI.substr(fragmentStart); - preFragment = chosenURI.substr(0, fragmentStart); - } - var queryParamsPrefix = preFragment.indexOf('?') === -1 ? '?' : '&'; - var newURI = preFragment + queryParamsPrefix + queryParams.join('&') + fragment; - return { newURI: newURI }; -} -//# sourceMappingURL=rewriteURIForGET.js.map - -/***/ }), - -/***/ "../../node_modules/@apollo/client/link/http/selectHttpOptionsAndBody.js": -/*!*******************************************************************************!*\ - !*** ../../node_modules/@apollo/client/link/http/selectHttpOptionsAndBody.js ***! - \*******************************************************************************/ -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "fallbackHttpConfig": function() { return /* binding */ fallbackHttpConfig; }, -/* harmony export */ "selectHttpOptionsAndBody": function() { return /* binding */ selectHttpOptionsAndBody; } -/* harmony export */ }); -/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ "../../node_modules/tslib/tslib.es6.js"); -/* harmony import */ var graphql__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! graphql */ "../../node_modules/graphql/language/printer.mjs"); - - -var defaultHttpOptions = { - includeQuery: true, - includeExtensions: false, -}; -var defaultHeaders = { - accept: '*/*', - 'content-type': 'application/json', -}; -var defaultOptions = { - method: 'POST', -}; -var fallbackHttpConfig = { - http: defaultHttpOptions, - headers: defaultHeaders, - options: defaultOptions, -}; -var selectHttpOptionsAndBody = function (operation, fallbackConfig) { - var configs = []; - for (var _i = 2; _i < arguments.length; _i++) { - configs[_i - 2] = arguments[_i]; - } - var options = (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__assign)((0,tslib__WEBPACK_IMPORTED_MODULE_0__.__assign)({}, fallbackConfig.options), { headers: fallbackConfig.headers, credentials: fallbackConfig.credentials }); - var http = fallbackConfig.http || {}; - configs.forEach(function (config) { - options = (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__assign)((0,tslib__WEBPACK_IMPORTED_MODULE_0__.__assign)((0,tslib__WEBPACK_IMPORTED_MODULE_0__.__assign)({}, options), config.options), { headers: (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__assign)((0,tslib__WEBPACK_IMPORTED_MODULE_0__.__assign)({}, options.headers), headersToLowerCase(config.headers)) }); - if (config.credentials) - options.credentials = config.credentials; - http = (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__assign)((0,tslib__WEBPACK_IMPORTED_MODULE_0__.__assign)({}, http), config.http); - }); - var operationName = operation.operationName, extensions = operation.extensions, variables = operation.variables, query = operation.query; - var body = { operationName: operationName, variables: variables }; - if (http.includeExtensions) - body.extensions = extensions; - if (http.includeQuery) - body.query = (0,graphql__WEBPACK_IMPORTED_MODULE_1__.print)(query); - return { - options: options, - body: body, - }; -}; -function headersToLowerCase(headers) { - if (headers) { - var normalized_1 = Object.create(null); - Object.keys(Object(headers)).forEach(function (name) { - normalized_1[name.toLowerCase()] = headers[name]; - }); - return normalized_1; - } - return headers; -} -//# sourceMappingURL=selectHttpOptionsAndBody.js.map - -/***/ }), - -/***/ "../../node_modules/@apollo/client/link/http/selectURI.js": -/*!****************************************************************!*\ - !*** ../../node_modules/@apollo/client/link/http/selectURI.js ***! - \****************************************************************/ -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "selectURI": function() { return /* binding */ selectURI; } -/* harmony export */ }); -var selectURI = function (operation, fallbackURI) { - var context = operation.getContext(); - var contextURI = context.uri; - if (contextURI) { - return contextURI; - } - else if (typeof fallbackURI === 'function') { - return fallbackURI(operation); - } - else { - return fallbackURI || '/graphql'; - } -}; -//# sourceMappingURL=selectURI.js.map - -/***/ }), - -/***/ "../../node_modules/@apollo/client/link/http/serializeFetchParameter.js": -/*!******************************************************************************!*\ - !*** ../../node_modules/@apollo/client/link/http/serializeFetchParameter.js ***! - \******************************************************************************/ -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "serializeFetchParameter": function() { return /* binding */ serializeFetchParameter; } -/* harmony export */ }); -/* harmony import */ var _utilities_globals_index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../utilities/globals/index.js */ "../../node_modules/@apollo/client/utilities/globals/index.js"); - -var serializeFetchParameter = function (p, label) { - var serialized; - try { - serialized = JSON.stringify(p); - } - catch (e) { - var parseError = __DEV__ ? new _utilities_globals_index_js__WEBPACK_IMPORTED_MODULE_0__.InvariantError("Network request failed. " + label + " is not serializable: " + e.message) : new _utilities_globals_index_js__WEBPACK_IMPORTED_MODULE_0__.InvariantError(23); - parseError.parseError = e; - throw parseError; - } - return serialized; -}; -//# sourceMappingURL=serializeFetchParameter.js.map - -/***/ }), - -/***/ "../../node_modules/@apollo/client/link/schema/index.js": -/*!**************************************************************!*\ - !*** ../../node_modules/@apollo/client/link/schema/index.js ***! - \**************************************************************/ -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "SchemaLink": function() { return /* binding */ SchemaLink; } -/* harmony export */ }); -/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ "../../node_modules/tslib/tslib.es6.js"); -/* harmony import */ var graphql__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! graphql */ "../../node_modules/graphql/validation/validate.mjs"); -/* harmony import */ var graphql__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! graphql */ "../../node_modules/graphql/execution/execute.mjs"); -/* harmony import */ var _core_index_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../core/index.js */ "../../node_modules/@apollo/client/link/core/ApolloLink.js"); -/* harmony import */ var _utilities_index_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../utilities/index.js */ "../../node_modules/zen-observable-ts/module.js"); - - - - -var SchemaLink = (function (_super) { - (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__extends)(SchemaLink, _super); - function SchemaLink(options) { - var _this = _super.call(this) || this; - _this.schema = options.schema; - _this.rootValue = options.rootValue; - _this.context = options.context; - _this.validate = !!options.validate; - return _this; - } - SchemaLink.prototype.request = function (operation) { - var _this = this; - return new _utilities_index_js__WEBPACK_IMPORTED_MODULE_1__.Observable(function (observer) { - new Promise(function (resolve) { return resolve(typeof _this.context === 'function' - ? _this.context(operation) - : _this.context); }).then(function (context) { - if (_this.validate) { - var validationErrors = (0,graphql__WEBPACK_IMPORTED_MODULE_2__.validate)(_this.schema, operation.query); - if (validationErrors.length > 0) { - return { errors: validationErrors }; - } - } - return (0,graphql__WEBPACK_IMPORTED_MODULE_3__.execute)(_this.schema, operation.query, _this.rootValue, context, operation.variables, operation.operationName); - }).then(function (data) { - if (!observer.closed) { - observer.next(data); - observer.complete(); - } - }).catch(function (error) { - if (!observer.closed) { - observer.error(error); - } - }); - }); - }; - return SchemaLink; -}(_core_index_js__WEBPACK_IMPORTED_MODULE_4__.ApolloLink)); - -//# sourceMappingURL=index.js.map - -/***/ }), - -/***/ "../../node_modules/@apollo/client/link/utils/createOperation.js": -/*!***********************************************************************!*\ - !*** ../../node_modules/@apollo/client/link/utils/createOperation.js ***! - \***********************************************************************/ -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "createOperation": function() { return /* binding */ createOperation; } -/* harmony export */ }); -/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ "../../node_modules/tslib/tslib.es6.js"); - -function createOperation(starting, operation) { - var context = (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__assign)({}, starting); - var setContext = function (next) { - if (typeof next === 'function') { - context = (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__assign)((0,tslib__WEBPACK_IMPORTED_MODULE_0__.__assign)({}, context), next(context)); - } - else { - context = (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__assign)((0,tslib__WEBPACK_IMPORTED_MODULE_0__.__assign)({}, context), next); - } - }; - var getContext = function () { return ((0,tslib__WEBPACK_IMPORTED_MODULE_0__.__assign)({}, context)); }; - Object.defineProperty(operation, 'setContext', { - enumerable: false, - value: setContext, - }); - Object.defineProperty(operation, 'getContext', { - enumerable: false, - value: getContext, - }); - return operation; -} -//# sourceMappingURL=createOperation.js.map - -/***/ }), - -/***/ "../../node_modules/@apollo/client/link/utils/fromError.js": -/*!*****************************************************************!*\ - !*** ../../node_modules/@apollo/client/link/utils/fromError.js ***! - \*****************************************************************/ -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "fromError": function() { return /* binding */ fromError; } -/* harmony export */ }); -/* harmony import */ var _utilities_index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../utilities/index.js */ "../../node_modules/zen-observable-ts/module.js"); - -function fromError(errorValue) { - return new _utilities_index_js__WEBPACK_IMPORTED_MODULE_0__.Observable(function (observer) { - observer.error(errorValue); - }); -} -//# sourceMappingURL=fromError.js.map - -/***/ }), - -/***/ "../../node_modules/@apollo/client/link/utils/throwServerError.js": -/*!************************************************************************!*\ - !*** ../../node_modules/@apollo/client/link/utils/throwServerError.js ***! - \************************************************************************/ -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "throwServerError": function() { return /* binding */ throwServerError; } -/* harmony export */ }); -var throwServerError = function (response, result, message) { - var error = new Error(message); - error.name = 'ServerError'; - error.response = response; - error.statusCode = response.status; - error.result = result; - throw error; -}; -//# sourceMappingURL=throwServerError.js.map - -/***/ }), - -/***/ "../../node_modules/@apollo/client/link/utils/transformOperation.js": -/*!**************************************************************************!*\ - !*** ../../node_modules/@apollo/client/link/utils/transformOperation.js ***! - \**************************************************************************/ -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "transformOperation": function() { return /* binding */ transformOperation; } -/* harmony export */ }); -/* harmony import */ var _utilities_index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../utilities/index.js */ "../../node_modules/@apollo/client/utilities/graphql/getFromAST.js"); - -function transformOperation(operation) { - var transformedOperation = { - variables: operation.variables || {}, - extensions: operation.extensions || {}, - operationName: operation.operationName, - query: operation.query, - }; - if (!transformedOperation.operationName) { - transformedOperation.operationName = - typeof transformedOperation.query !== 'string' - ? (0,_utilities_index_js__WEBPACK_IMPORTED_MODULE_0__.getOperationName)(transformedOperation.query) || undefined - : ''; - } - return transformedOperation; -} -//# sourceMappingURL=transformOperation.js.map - -/***/ }), - -/***/ "../../node_modules/@apollo/client/link/utils/validateOperation.js": -/*!*************************************************************************!*\ - !*** ../../node_modules/@apollo/client/link/utils/validateOperation.js ***! - \*************************************************************************/ -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "validateOperation": function() { return /* binding */ validateOperation; } -/* harmony export */ }); -/* harmony import */ var _utilities_globals_index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../utilities/globals/index.js */ "../../node_modules/@apollo/client/utilities/globals/index.js"); - -function validateOperation(operation) { - var OPERATION_FIELDS = [ - 'query', - 'operationName', - 'variables', - 'extensions', - 'context', - ]; - for (var _i = 0, _a = Object.keys(operation); _i < _a.length; _i++) { - var key = _a[_i]; - if (OPERATION_FIELDS.indexOf(key) < 0) { - throw __DEV__ ? new _utilities_globals_index_js__WEBPACK_IMPORTED_MODULE_0__.InvariantError("illegal argument: " + key) : new _utilities_globals_index_js__WEBPACK_IMPORTED_MODULE_0__.InvariantError(26); - } - } - return operation; -} -//# sourceMappingURL=validateOperation.js.map - -/***/ }), - -/***/ "../../node_modules/@apollo/client/react/context/ApolloContext.js": -/*!************************************************************************!*\ - !*** ../../node_modules/@apollo/client/react/context/ApolloContext.js ***! - \************************************************************************/ -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "getApolloContext": function() { return /* binding */ getApolloContext; }, -/* harmony export */ "resetApolloContext": function() { return /* binding */ getApolloContext; } -/* harmony export */ }); -/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "../../node_modules/react/index.js"); -/* harmony import */ var _utilities_index_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../utilities/index.js */ "../../node_modules/@apollo/client/utilities/common/canUse.js"); - - -var contextKey = _utilities_index_js__WEBPACK_IMPORTED_MODULE_1__.canUseSymbol - ? Symbol.for('__APOLLO_CONTEXT__') - : '__APOLLO_CONTEXT__'; -function getApolloContext() { - var context = react__WEBPACK_IMPORTED_MODULE_0__.createContext[contextKey]; - if (!context) { - Object.defineProperty(react__WEBPACK_IMPORTED_MODULE_0__.createContext, contextKey, { - value: context = react__WEBPACK_IMPORTED_MODULE_0__.createContext({}), - enumerable: false, - writable: false, - configurable: true, - }); - context.displayName = 'ApolloContext'; - } - return context; -} - -//# sourceMappingURL=ApolloContext.js.map - -/***/ }), - -/***/ "../../node_modules/@apollo/client/react/context/ApolloProvider.js": -/*!*************************************************************************!*\ - !*** ../../node_modules/@apollo/client/react/context/ApolloProvider.js ***! - \*************************************************************************/ -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "ApolloProvider": function() { return /* binding */ ApolloProvider; } -/* harmony export */ }); -/* harmony import */ var _utilities_globals_index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../utilities/globals/index.js */ "../../node_modules/@apollo/client/utilities/globals/index.js"); -/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! react */ "../../node_modules/react/index.js"); -/* harmony import */ var _ApolloContext_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./ApolloContext.js */ "../../node_modules/@apollo/client/react/context/ApolloContext.js"); - - - -var ApolloProvider = function (_a) { - var client = _a.client, children = _a.children; - var ApolloContext = (0,_ApolloContext_js__WEBPACK_IMPORTED_MODULE_2__.getApolloContext)(); - return react__WEBPACK_IMPORTED_MODULE_1__.createElement(ApolloContext.Consumer, null, function (context) { - if (context === void 0) { context = {}; } - if (client && context.client !== client) { - context = Object.assign({}, context, { client: client }); - } - __DEV__ ? (0,_utilities_globals_index_js__WEBPACK_IMPORTED_MODULE_0__.invariant)(context.client, 'ApolloProvider was not passed a client instance. Make ' + - 'sure you pass in your client via the "client" prop.') : (0,_utilities_globals_index_js__WEBPACK_IMPORTED_MODULE_0__.invariant)(context.client, 28); - return (react__WEBPACK_IMPORTED_MODULE_1__.createElement(ApolloContext.Provider, { value: context }, children)); - }); -}; -//# sourceMappingURL=ApolloProvider.js.map - -/***/ }), - -/***/ "../../node_modules/@apollo/client/react/data/MutationData.js": -/*!********************************************************************!*\ - !*** ../../node_modules/@apollo/client/react/data/MutationData.js ***! - \********************************************************************/ -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "MutationData": function() { return /* binding */ MutationData; } -/* harmony export */ }); -/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! tslib */ "../../node_modules/tslib/tslib.es6.js"); -/* harmony import */ var _wry_equality__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @wry/equality */ "../../node_modules/@wry/equality/lib/equality.esm.js"); -/* harmony import */ var _parser_index_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../parser/index.js */ "../../node_modules/@apollo/client/react/parser/index.js"); -/* harmony import */ var _errors_index_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../errors/index.js */ "../../node_modules/@apollo/client/errors/index.js"); -/* harmony import */ var _OperationData_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./OperationData.js */ "../../node_modules/@apollo/client/react/data/OperationData.js"); -/* harmony import */ var _core_index_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../core/index.js */ "../../node_modules/@apollo/client/core/ApolloClient.js"); - - - - - - -var MutationData = (function (_super) { - (0,tslib__WEBPACK_IMPORTED_MODULE_1__.__extends)(MutationData, _super); - function MutationData(_a) { - var options = _a.options, context = _a.context, result = _a.result, setResult = _a.setResult; - var _this = _super.call(this, options, context) || this; - _this.runMutation = function (mutationFunctionOptions) { - if (mutationFunctionOptions === void 0) { mutationFunctionOptions = {}; } - _this.onMutationStart(); - var mutationId = _this.generateNewMutationId(); - return _this.mutate(mutationFunctionOptions) - .then(function (response) { - _this.onMutationCompleted(response, mutationId); - return response; - }) - .catch(function (error) { - var onError = _this.getOptions().onError; - _this.onMutationError(error, mutationId); - if (onError) { - onError(error); - return { - data: undefined, - errors: error, - }; - } - else { - throw error; - } - }); - }; - _this.verifyDocumentType(options.mutation, _parser_index_js__WEBPACK_IMPORTED_MODULE_2__.DocumentType.Mutation); - _this.result = result; - _this.setResult = setResult; - _this.mostRecentMutationId = 0; - return _this; - } - MutationData.prototype.execute = function (result) { - this.isMounted = true; - this.verifyDocumentType(this.getOptions().mutation, _parser_index_js__WEBPACK_IMPORTED_MODULE_2__.DocumentType.Mutation); - return [ - this.runMutation, - (0,tslib__WEBPACK_IMPORTED_MODULE_1__.__assign)((0,tslib__WEBPACK_IMPORTED_MODULE_1__.__assign)({}, result), { client: this.refreshClient().client }) - ]; - }; - MutationData.prototype.afterExecute = function () { - this.isMounted = true; - return this.unmount.bind(this); - }; - MutationData.prototype.cleanup = function () { - }; - MutationData.prototype.mutate = function (options) { - return this.refreshClient().client.mutate((0,_core_index_js__WEBPACK_IMPORTED_MODULE_3__.mergeOptions)(this.getOptions(), options)); - }; - MutationData.prototype.onMutationStart = function () { - if (!this.result.loading && !this.getOptions().ignoreResults) { - this.updateResult({ - loading: true, - error: undefined, - data: undefined, - called: true - }); - } - }; - MutationData.prototype.onMutationCompleted = function (response, mutationId) { - var _a = this.getOptions(), onCompleted = _a.onCompleted, ignoreResults = _a.ignoreResults; - var data = response.data, errors = response.errors; - var error = errors && errors.length > 0 - ? new _errors_index_js__WEBPACK_IMPORTED_MODULE_4__.ApolloError({ graphQLErrors: errors }) - : undefined; - var callOncomplete = function () { - return onCompleted ? onCompleted(data) : null; - }; - if (this.isMostRecentMutation(mutationId) && !ignoreResults) { - this.updateResult({ - called: true, - loading: false, - data: data, - error: error - }); - } - callOncomplete(); - }; - MutationData.prototype.onMutationError = function (error, mutationId) { - if (this.isMostRecentMutation(mutationId)) { - this.updateResult({ - loading: false, - error: error, - data: undefined, - called: true - }); - } - }; - MutationData.prototype.generateNewMutationId = function () { - return ++this.mostRecentMutationId; - }; - MutationData.prototype.isMostRecentMutation = function (mutationId) { - return this.mostRecentMutationId === mutationId; - }; - MutationData.prototype.updateResult = function (result) { - if (this.isMounted && - (!this.previousResult || !(0,_wry_equality__WEBPACK_IMPORTED_MODULE_0__.equal)(this.previousResult, result))) { - this.setResult(result); - this.previousResult = result; - return result; - } - }; - return MutationData; -}(_OperationData_js__WEBPACK_IMPORTED_MODULE_5__.OperationData)); - -//# sourceMappingURL=MutationData.js.map - -/***/ }), - -/***/ "../../node_modules/@apollo/client/react/data/OperationData.js": -/*!*********************************************************************!*\ - !*** ../../node_modules/@apollo/client/react/data/OperationData.js ***! - \*********************************************************************/ -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "OperationData": function() { return /* binding */ OperationData; } -/* harmony export */ }); -/* harmony import */ var _utilities_globals_index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../utilities/globals/index.js */ "../../node_modules/@apollo/client/utilities/globals/index.js"); -/* harmony import */ var _wry_equality__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @wry/equality */ "../../node_modules/@wry/equality/lib/equality.esm.js"); -/* harmony import */ var _parser_index_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../parser/index.js */ "../../node_modules/@apollo/client/react/parser/index.js"); - - - -var OperationData = (function () { - function OperationData(options, context) { - this.isMounted = false; - this.previousOptions = {}; - this.context = {}; - this.options = {}; - this.options = options || {}; - this.context = context || {}; - } - OperationData.prototype.getOptions = function () { - return this.options; - }; - OperationData.prototype.setOptions = function (newOptions, storePrevious) { - if (storePrevious === void 0) { storePrevious = false; } - if (storePrevious && !(0,_wry_equality__WEBPACK_IMPORTED_MODULE_1__.equal)(this.options, newOptions)) { - this.previousOptions = this.options; - } - this.options = newOptions; - }; - OperationData.prototype.unmount = function () { - this.isMounted = false; - }; - OperationData.prototype.refreshClient = function () { - var client = (this.options && this.options.client) || - (this.context && this.context.client); - __DEV__ ? (0,_utilities_globals_index_js__WEBPACK_IMPORTED_MODULE_0__.invariant)(!!client, 'Could not find "client" in the context or passed in as an option. ' + - 'Wrap the root component in an , or pass an ' + - 'ApolloClient instance in via options.') : (0,_utilities_globals_index_js__WEBPACK_IMPORTED_MODULE_0__.invariant)(!!client, 29); - var isNew = false; - if (client !== this.client) { - isNew = true; - this.client = client; - this.cleanup(); - } - return { - client: this.client, - isNew: isNew - }; - }; - OperationData.prototype.verifyDocumentType = function (document, type) { - var operation = (0,_parser_index_js__WEBPACK_IMPORTED_MODULE_2__.parser)(document); - var requiredOperationName = (0,_parser_index_js__WEBPACK_IMPORTED_MODULE_2__.operationName)(type); - var usedOperationName = (0,_parser_index_js__WEBPACK_IMPORTED_MODULE_2__.operationName)(operation.type); - __DEV__ ? (0,_utilities_globals_index_js__WEBPACK_IMPORTED_MODULE_0__.invariant)(operation.type === type, "Running a " + requiredOperationName + " requires a graphql " + - (requiredOperationName + ", but a " + usedOperationName + " was used instead.")) : (0,_utilities_globals_index_js__WEBPACK_IMPORTED_MODULE_0__.invariant)(operation.type === type, 30); - }; - return OperationData; -}()); - -//# sourceMappingURL=OperationData.js.map - -/***/ }), - -/***/ "../../node_modules/@apollo/client/react/data/QueryData.js": -/*!*****************************************************************!*\ - !*** ../../node_modules/@apollo/client/react/data/QueryData.js ***! - \*****************************************************************/ -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "QueryData": function() { return /* binding */ QueryData; } -/* harmony export */ }); -/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! tslib */ "../../node_modules/tslib/tslib.es6.js"); -/* harmony import */ var _wry_equality__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @wry/equality */ "../../node_modules/@wry/equality/lib/equality.esm.js"); -/* harmony import */ var _errors_index_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../errors/index.js */ "../../node_modules/@apollo/client/errors/index.js"); -/* harmony import */ var _core_index_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../core/index.js */ "../../node_modules/@apollo/client/core/networkStatus.js"); -/* harmony import */ var _parser_index_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../parser/index.js */ "../../node_modules/@apollo/client/react/parser/index.js"); -/* harmony import */ var _OperationData_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./OperationData.js */ "../../node_modules/@apollo/client/react/data/OperationData.js"); - - - - - - -var QueryData = (function (_super) { - (0,tslib__WEBPACK_IMPORTED_MODULE_1__.__extends)(QueryData, _super); - function QueryData(_a) { - var options = _a.options, context = _a.context, onNewData = _a.onNewData; - var _this = _super.call(this, options, context) || this; - _this.runLazy = false; - _this.previous = Object.create(null); - _this.runLazyQuery = function (options) { - _this.cleanup(); - _this.runLazy = true; - _this.lazyOptions = options; - _this.onNewData(); - }; - _this.obsRefetch = function (variables) { var _a; return (_a = _this.currentObservable) === null || _a === void 0 ? void 0 : _a.refetch(variables); }; - _this.obsFetchMore = function (fetchMoreOptions) { var _a; return (_a = _this.currentObservable) === null || _a === void 0 ? void 0 : _a.fetchMore(fetchMoreOptions); }; - _this.obsUpdateQuery = function (mapFn) { var _a; return (_a = _this.currentObservable) === null || _a === void 0 ? void 0 : _a.updateQuery(mapFn); }; - _this.obsStartPolling = function (pollInterval) { - var _a; - (_a = _this.currentObservable) === null || _a === void 0 ? void 0 : _a.startPolling(pollInterval); - }; - _this.obsStopPolling = function () { - var _a; - (_a = _this.currentObservable) === null || _a === void 0 ? void 0 : _a.stopPolling(); - }; - _this.obsSubscribeToMore = function (options) { var _a; return (_a = _this.currentObservable) === null || _a === void 0 ? void 0 : _a.subscribeToMore(options); }; - _this.onNewData = onNewData; - return _this; - } - QueryData.prototype.execute = function () { - this.refreshClient(); - var _a = this.getOptions(), skip = _a.skip, query = _a.query; - if (skip || query !== this.previous.query) { - this.removeQuerySubscription(); - this.removeObservable(!skip); - this.previous.query = query; - } - this.updateObservableQuery(); - return this.getExecuteSsrResult() || this.getExecuteResult(); - }; - QueryData.prototype.executeLazy = function () { - return !this.runLazy - ? [ - this.runLazyQuery, - { - loading: false, - networkStatus: _core_index_js__WEBPACK_IMPORTED_MODULE_2__.NetworkStatus.ready, - called: false, - data: undefined - } - ] - : [this.runLazyQuery, this.execute()]; - }; - QueryData.prototype.fetchData = function () { - var _this = this; - var options = this.getOptions(); - if (options.skip || options.ssr === false) - return false; - return new Promise(function (resolve) { return _this.startQuerySubscription(resolve); }); - }; - QueryData.prototype.afterExecute = function (_a) { - var _b = _a === void 0 ? {} : _a, _c = _b.lazy, lazy = _c === void 0 ? false : _c; - this.isMounted = true; - var options = this.getOptions(); - if (this.currentObservable && !this.ssrInitiated()) { - this.startQuerySubscription(); - } - if (!lazy || this.runLazy) { - this.handleErrorOrCompleted(); - } - this.previousOptions = options; - return this.unmount.bind(this); - }; - QueryData.prototype.cleanup = function () { - this.removeQuerySubscription(); - this.removeObservable(true); - delete this.previous.result; - }; - QueryData.prototype.getOptions = function () { - var options = _super.prototype.getOptions.call(this); - if (this.lazyOptions) { - options.variables = (0,tslib__WEBPACK_IMPORTED_MODULE_1__.__assign)((0,tslib__WEBPACK_IMPORTED_MODULE_1__.__assign)({}, options.variables), this.lazyOptions.variables); - options.context = (0,tslib__WEBPACK_IMPORTED_MODULE_1__.__assign)((0,tslib__WEBPACK_IMPORTED_MODULE_1__.__assign)({}, options.context), this.lazyOptions.context); - } - if (this.runLazy) { - delete options.skip; - } - return options; - }; - QueryData.prototype.ssrInitiated = function () { - return this.context && this.context.renderPromises; - }; - QueryData.prototype.getExecuteSsrResult = function () { - var _a = this.getOptions(), ssr = _a.ssr, skip = _a.skip; - var ssrDisabled = ssr === false; - var fetchDisabled = this.refreshClient().client.disableNetworkFetches; - var ssrLoading = (0,tslib__WEBPACK_IMPORTED_MODULE_1__.__assign)({ loading: true, networkStatus: _core_index_js__WEBPACK_IMPORTED_MODULE_2__.NetworkStatus.loading, called: true, data: undefined, stale: false, client: this.client }, this.observableQueryFields()); - if (ssrDisabled && (this.ssrInitiated() || fetchDisabled)) { - this.previous.result = ssrLoading; - return ssrLoading; - } - if (this.ssrInitiated()) { - var result = this.getExecuteResult() || ssrLoading; - if (result.loading && !skip) { - this.context.renderPromises.addQueryPromise(this, function () { return null; }); - } - return result; - } - }; - QueryData.prototype.prepareObservableQueryOptions = function () { - var options = this.getOptions(); - this.verifyDocumentType(options.query, _parser_index_js__WEBPACK_IMPORTED_MODULE_3__.DocumentType.Query); - var displayName = options.displayName || 'Query'; - if (this.ssrInitiated() && - (options.fetchPolicy === 'network-only' || - options.fetchPolicy === 'cache-and-network')) { - options.fetchPolicy = 'cache-first'; - } - return (0,tslib__WEBPACK_IMPORTED_MODULE_1__.__assign)((0,tslib__WEBPACK_IMPORTED_MODULE_1__.__assign)({}, options), { displayName: displayName, context: options.context }); - }; - QueryData.prototype.initializeObservableQuery = function () { - if (this.ssrInitiated()) { - this.currentObservable = this.context.renderPromises.getSSRObservable(this.getOptions()); - } - if (!this.currentObservable) { - var observableQueryOptions = this.prepareObservableQueryOptions(); - this.previous.observableQueryOptions = (0,tslib__WEBPACK_IMPORTED_MODULE_1__.__assign)((0,tslib__WEBPACK_IMPORTED_MODULE_1__.__assign)({}, observableQueryOptions), { children: void 0 }); - this.currentObservable = this.refreshClient().client.watchQuery((0,tslib__WEBPACK_IMPORTED_MODULE_1__.__assign)({}, observableQueryOptions)); - if (this.ssrInitiated()) { - this.context.renderPromises.registerSSRObservable(this.currentObservable, observableQueryOptions); - } - } - }; - QueryData.prototype.updateObservableQuery = function () { - if (!this.currentObservable) { - this.initializeObservableQuery(); - return; - } - var newObservableQueryOptions = (0,tslib__WEBPACK_IMPORTED_MODULE_1__.__assign)((0,tslib__WEBPACK_IMPORTED_MODULE_1__.__assign)({}, this.prepareObservableQueryOptions()), { children: void 0 }); - if (this.getOptions().skip) { - this.previous.observableQueryOptions = newObservableQueryOptions; - return; - } - if (!(0,_wry_equality__WEBPACK_IMPORTED_MODULE_0__.equal)(newObservableQueryOptions, this.previous.observableQueryOptions)) { - this.previous.observableQueryOptions = newObservableQueryOptions; - this.currentObservable - .setOptions(newObservableQueryOptions) - .catch(function () { }); - } - }; - QueryData.prototype.startQuerySubscription = function (onNewData) { - var _this = this; - if (onNewData === void 0) { onNewData = this.onNewData; } - if (this.currentSubscription || this.getOptions().skip) - return; - this.currentSubscription = this.currentObservable.subscribe({ - next: function (_a) { - var loading = _a.loading, networkStatus = _a.networkStatus, data = _a.data; - var previousResult = _this.previous.result; - if (previousResult && - previousResult.loading === loading && - previousResult.networkStatus === networkStatus && - (0,_wry_equality__WEBPACK_IMPORTED_MODULE_0__.equal)(previousResult.data, data)) { - return; - } - onNewData(); - }, - error: function (error) { - _this.resubscribeToQuery(); - if (!error.hasOwnProperty('graphQLErrors')) - throw error; - var previousResult = _this.previous.result; - if ((previousResult && previousResult.loading) || - !(0,_wry_equality__WEBPACK_IMPORTED_MODULE_0__.equal)(error, _this.previous.error)) { - _this.previous.error = error; - onNewData(); - } - } - }); - }; - QueryData.prototype.resubscribeToQuery = function () { - this.removeQuerySubscription(); - var currentObservable = this.currentObservable; - if (currentObservable) { - var last = currentObservable["last"]; - try { - currentObservable.resetLastResults(); - this.startQuerySubscription(); - } - finally { - currentObservable["last"] = last; - } - } - }; - QueryData.prototype.getExecuteResult = function () { - var result = this.observableQueryFields(); - var options = this.getOptions(); - if (options.skip) { - result = (0,tslib__WEBPACK_IMPORTED_MODULE_1__.__assign)((0,tslib__WEBPACK_IMPORTED_MODULE_1__.__assign)({}, result), { data: undefined, error: undefined, loading: false, networkStatus: _core_index_js__WEBPACK_IMPORTED_MODULE_2__.NetworkStatus.ready, called: true }); - } - else if (this.currentObservable) { - var currentResult = this.currentObservable.getCurrentResult(); - var data = currentResult.data, loading = currentResult.loading, partial = currentResult.partial, networkStatus = currentResult.networkStatus, errors = currentResult.errors; - var error = currentResult.error; - if (errors && errors.length > 0) { - error = new _errors_index_js__WEBPACK_IMPORTED_MODULE_4__.ApolloError({ graphQLErrors: errors }); - } - result = (0,tslib__WEBPACK_IMPORTED_MODULE_1__.__assign)((0,tslib__WEBPACK_IMPORTED_MODULE_1__.__assign)({}, result), { data: data, loading: loading, networkStatus: networkStatus, error: error, called: true }); - if (loading) { - } - else if (error) { - Object.assign(result, { - data: (this.currentObservable.getLastResult() || {}) - .data - }); - } - else { - var fetchPolicy = this.currentObservable.options.fetchPolicy; - var partialRefetch = options.partialRefetch; - if (partialRefetch && - partial && - (!data || Object.keys(data).length === 0) && - fetchPolicy !== 'cache-only') { - Object.assign(result, { - loading: true, - networkStatus: _core_index_js__WEBPACK_IMPORTED_MODULE_2__.NetworkStatus.loading - }); - result.refetch(); - return result; - } - } - } - result.client = this.client; - this.setOptions(options, true); - var previousResult = this.previous.result; - this.previous.loading = - previousResult && previousResult.loading || false; - result.previousData = previousResult && - (previousResult.data || previousResult.previousData); - this.previous.result = result; - this.currentObservable && this.currentObservable.resetQueryStoreErrors(); - return result; - }; - QueryData.prototype.handleErrorOrCompleted = function () { - if (!this.currentObservable || !this.previous.result) - return; - var _a = this.previous.result, data = _a.data, loading = _a.loading, error = _a.error; - if (!loading) { - var _b = this.getOptions(), query = _b.query, variables = _b.variables, onCompleted = _b.onCompleted, onError = _b.onError, skip = _b.skip; - if (this.previousOptions && - !this.previous.loading && - (0,_wry_equality__WEBPACK_IMPORTED_MODULE_0__.equal)(this.previousOptions.query, query) && - (0,_wry_equality__WEBPACK_IMPORTED_MODULE_0__.equal)(this.previousOptions.variables, variables)) { - return; - } - if (onCompleted && !error && !skip) { - onCompleted(data); - } - else if (onError && error) { - onError(error); - } - } - }; - QueryData.prototype.removeQuerySubscription = function () { - if (this.currentSubscription) { - this.currentSubscription.unsubscribe(); - delete this.currentSubscription; - } - }; - QueryData.prototype.removeObservable = function (andDelete) { - if (this.currentObservable) { - this.currentObservable["tearDownQuery"](); - if (andDelete) { - delete this.currentObservable; - } - } - }; - QueryData.prototype.observableQueryFields = function () { - var _a; - return { - variables: (_a = this.currentObservable) === null || _a === void 0 ? void 0 : _a.variables, - refetch: this.obsRefetch, - fetchMore: this.obsFetchMore, - updateQuery: this.obsUpdateQuery, - startPolling: this.obsStartPolling, - stopPolling: this.obsStopPolling, - subscribeToMore: this.obsSubscribeToMore - }; - }; - return QueryData; -}(_OperationData_js__WEBPACK_IMPORTED_MODULE_5__.OperationData)); - -//# sourceMappingURL=QueryData.js.map - -/***/ }), - -/***/ "../../node_modules/@apollo/client/react/data/SubscriptionData.js": -/*!************************************************************************!*\ - !*** ../../node_modules/@apollo/client/react/data/SubscriptionData.js ***! - \************************************************************************/ -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "SubscriptionData": function() { return /* binding */ SubscriptionData; } -/* harmony export */ }); -/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! tslib */ "../../node_modules/tslib/tslib.es6.js"); -/* harmony import */ var _wry_equality__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @wry/equality */ "../../node_modules/@wry/equality/lib/equality.esm.js"); -/* harmony import */ var _OperationData_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./OperationData.js */ "../../node_modules/@apollo/client/react/data/OperationData.js"); - - - -var SubscriptionData = (function (_super) { - (0,tslib__WEBPACK_IMPORTED_MODULE_1__.__extends)(SubscriptionData, _super); - function SubscriptionData(_a) { - var options = _a.options, context = _a.context, setResult = _a.setResult; - var _this = _super.call(this, options, context) || this; - _this.currentObservable = {}; - _this.setResult = setResult; - _this.initialize(options); - return _this; - } - SubscriptionData.prototype.execute = function (result) { - if (this.getOptions().skip === true) { - this.cleanup(); - return { - loading: false, - error: undefined, - data: undefined, - variables: this.getOptions().variables - }; - } - var currentResult = result; - if (this.refreshClient().isNew) { - currentResult = this.getLoadingResult(); - } - var shouldResubscribe = this.getOptions().shouldResubscribe; - if (typeof shouldResubscribe === 'function') { - shouldResubscribe = !!shouldResubscribe(this.getOptions()); - } - if (shouldResubscribe !== false && - this.previousOptions && - Object.keys(this.previousOptions).length > 0 && - (this.previousOptions.subscription !== this.getOptions().subscription || - !(0,_wry_equality__WEBPACK_IMPORTED_MODULE_0__.equal)(this.previousOptions.variables, this.getOptions().variables) || - this.previousOptions.skip !== this.getOptions().skip)) { - this.cleanup(); - currentResult = this.getLoadingResult(); - } - this.initialize(this.getOptions()); - this.startSubscription(); - this.previousOptions = this.getOptions(); - return (0,tslib__WEBPACK_IMPORTED_MODULE_1__.__assign)((0,tslib__WEBPACK_IMPORTED_MODULE_1__.__assign)({}, currentResult), { variables: this.getOptions().variables }); - }; - SubscriptionData.prototype.afterExecute = function () { - this.isMounted = true; - }; - SubscriptionData.prototype.cleanup = function () { - this.endSubscription(); - delete this.currentObservable.query; - }; - SubscriptionData.prototype.initialize = function (options) { - if (this.currentObservable.query || this.getOptions().skip === true) - return; - this.currentObservable.query = this.refreshClient().client.subscribe({ - query: options.subscription, - variables: options.variables, - fetchPolicy: options.fetchPolicy, - context: options.context, - }); - }; - SubscriptionData.prototype.startSubscription = function () { - if (this.currentObservable.subscription) - return; - this.currentObservable.subscription = this.currentObservable.query.subscribe({ - next: this.updateCurrentData.bind(this), - error: this.updateError.bind(this), - complete: this.completeSubscription.bind(this) - }); - }; - SubscriptionData.prototype.getLoadingResult = function () { - return { - loading: true, - error: undefined, - data: undefined - }; - }; - SubscriptionData.prototype.updateResult = function (result) { - if (this.isMounted) { - this.setResult(result); - } - }; - SubscriptionData.prototype.updateCurrentData = function (result) { - var onSubscriptionData = this.getOptions().onSubscriptionData; - this.updateResult({ - data: result.data, - loading: false, - error: undefined - }); - if (onSubscriptionData) { - onSubscriptionData({ - client: this.refreshClient().client, - subscriptionData: result - }); - } - }; - SubscriptionData.prototype.updateError = function (error) { - this.updateResult({ - error: error, - loading: false - }); - }; - SubscriptionData.prototype.completeSubscription = function () { - var _this = this; - Promise.resolve().then(function () { - var onSubscriptionComplete = _this.getOptions().onSubscriptionComplete; - if (onSubscriptionComplete) - onSubscriptionComplete(); - _this.endSubscription(); - }); - }; - SubscriptionData.prototype.endSubscription = function () { - if (this.currentObservable.subscription) { - this.currentObservable.subscription.unsubscribe(); - delete this.currentObservable.subscription; - } - }; - return SubscriptionData; -}(_OperationData_js__WEBPACK_IMPORTED_MODULE_2__.OperationData)); - -//# sourceMappingURL=SubscriptionData.js.map - -/***/ }), - -/***/ "../../node_modules/@apollo/client/react/hooks/useApolloClient.js": -/*!************************************************************************!*\ - !*** ../../node_modules/@apollo/client/react/hooks/useApolloClient.js ***! - \************************************************************************/ -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "useApolloClient": function() { return /* binding */ useApolloClient; } -/* harmony export */ }); -/* harmony import */ var _utilities_globals_index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../utilities/globals/index.js */ "../../node_modules/@apollo/client/utilities/globals/index.js"); -/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! react */ "../../node_modules/react/index.js"); -/* harmony import */ var _context_index_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../context/index.js */ "../../node_modules/@apollo/client/react/context/ApolloContext.js"); - - - -function useApolloClient() { - var client = react__WEBPACK_IMPORTED_MODULE_1__.useContext((0,_context_index_js__WEBPACK_IMPORTED_MODULE_2__.getApolloContext)()).client; - __DEV__ ? (0,_utilities_globals_index_js__WEBPACK_IMPORTED_MODULE_0__.invariant)(client, 'No Apollo Client instance can be found. Please ensure that you ' + - 'have called `ApolloProvider` higher up in your tree.') : (0,_utilities_globals_index_js__WEBPACK_IMPORTED_MODULE_0__.invariant)(client, 33); - return client; -} -//# sourceMappingURL=useApolloClient.js.map - -/***/ }), - -/***/ "../../node_modules/@apollo/client/react/hooks/useMutation.js": -/*!********************************************************************!*\ - !*** ../../node_modules/@apollo/client/react/hooks/useMutation.js ***! - \********************************************************************/ -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "useMutation": function() { return /* binding */ useMutation; } -/* harmony export */ }); -/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! tslib */ "../../node_modules/tslib/tslib.es6.js"); -/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "../../node_modules/react/index.js"); -/* harmony import */ var _data_index_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../data/index.js */ "../../node_modules/@apollo/client/react/data/MutationData.js"); -/* harmony import */ var _context_index_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../context/index.js */ "../../node_modules/@apollo/client/react/context/ApolloContext.js"); - - - - -function useMutation(mutation, options) { - var context = (0,react__WEBPACK_IMPORTED_MODULE_0__.useContext)((0,_context_index_js__WEBPACK_IMPORTED_MODULE_1__.getApolloContext)()); - var _a = (0,react__WEBPACK_IMPORTED_MODULE_0__.useState)({ called: false, loading: false }), result = _a[0], setResult = _a[1]; - var updatedOptions = options ? (0,tslib__WEBPACK_IMPORTED_MODULE_2__.__assign)((0,tslib__WEBPACK_IMPORTED_MODULE_2__.__assign)({}, options), { mutation: mutation }) : { mutation: mutation }; - var mutationDataRef = (0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)(); - function getMutationDataRef() { - if (!mutationDataRef.current) { - mutationDataRef.current = new _data_index_js__WEBPACK_IMPORTED_MODULE_3__.MutationData({ - options: updatedOptions, - context: context, - result: result, - setResult: setResult - }); - } - return mutationDataRef.current; - } - var mutationData = getMutationDataRef(); - mutationData.setOptions(updatedOptions); - mutationData.context = context; - (0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)(function () { return mutationData.afterExecute(); }); - return mutationData.execute(result); -} -//# sourceMappingURL=useMutation.js.map - -/***/ }), - -/***/ "../../node_modules/@apollo/client/react/hooks/useQuery.js": -/*!*****************************************************************!*\ - !*** ../../node_modules/@apollo/client/react/hooks/useQuery.js ***! - \*****************************************************************/ -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "useQuery": function() { return /* binding */ useQuery; } -/* harmony export */ }); -/* harmony import */ var _utils_useBaseQuery_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./utils/useBaseQuery.js */ "../../node_modules/@apollo/client/react/hooks/utils/useBaseQuery.js"); - -function useQuery(query, options) { - return (0,_utils_useBaseQuery_js__WEBPACK_IMPORTED_MODULE_0__.useBaseQuery)(query, options, false); -} -//# sourceMappingURL=useQuery.js.map - -/***/ }), - -/***/ "../../node_modules/@apollo/client/react/hooks/useSubscription.js": -/*!************************************************************************!*\ - !*** ../../node_modules/@apollo/client/react/hooks/useSubscription.js ***! - \************************************************************************/ -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "useSubscription": function() { return /* binding */ useSubscription; } -/* harmony export */ }); -/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! tslib */ "../../node_modules/tslib/tslib.es6.js"); -/* harmony import */ var _utilities_globals_index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../utilities/globals/index.js */ "../../node_modules/@apollo/client/utilities/globals/index.js"); -/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! react */ "../../node_modules/react/index.js"); -/* harmony import */ var _data_index_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../data/index.js */ "../../node_modules/@apollo/client/react/data/SubscriptionData.js"); -/* harmony import */ var _context_index_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../context/index.js */ "../../node_modules/@apollo/client/react/context/ApolloContext.js"); -/* harmony import */ var _utils_useAfterFastRefresh_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./utils/useAfterFastRefresh.js */ "../../node_modules/@apollo/client/react/hooks/utils/useAfterFastRefresh.js"); - - - - - - -function useSubscription(subscription, options) { - var _a = (0,react__WEBPACK_IMPORTED_MODULE_1__.useReducer)(function (x) { return x + 1; }, 0), forceUpdate = _a[1]; - var context = (0,react__WEBPACK_IMPORTED_MODULE_1__.useContext)((0,_context_index_js__WEBPACK_IMPORTED_MODULE_2__.getApolloContext)()); - var updatedOptions = options - ? (0,tslib__WEBPACK_IMPORTED_MODULE_3__.__assign)((0,tslib__WEBPACK_IMPORTED_MODULE_3__.__assign)({}, options), { subscription: subscription }) : { subscription: subscription }; - var _b = (0,react__WEBPACK_IMPORTED_MODULE_1__.useState)({ - loading: !updatedOptions.skip, - error: void 0, - data: void 0, - }), result = _b[0], setResult = _b[1]; - var subscriptionDataRef = (0,react__WEBPACK_IMPORTED_MODULE_1__.useRef)(); - function getSubscriptionDataRef() { - if (!subscriptionDataRef.current) { - subscriptionDataRef.current = new _data_index_js__WEBPACK_IMPORTED_MODULE_4__.SubscriptionData({ - options: updatedOptions, - context: context, - setResult: setResult - }); - } - return subscriptionDataRef.current; - } - var subscriptionData = getSubscriptionDataRef(); - subscriptionData.setOptions(updatedOptions, true); - subscriptionData.context = context; - if (__DEV__) { - (0,_utils_useAfterFastRefresh_js__WEBPACK_IMPORTED_MODULE_5__.useAfterFastRefresh)(forceUpdate); - } - (0,react__WEBPACK_IMPORTED_MODULE_1__.useEffect)(function () { return subscriptionData.afterExecute(); }); - (0,react__WEBPACK_IMPORTED_MODULE_1__.useEffect)(function () { - return function () { - subscriptionData.cleanup(); - subscriptionDataRef.current = void 0; - }; - }, []); - return subscriptionData.execute(result); -} -//# sourceMappingURL=useSubscription.js.map - -/***/ }), - -/***/ "../../node_modules/@apollo/client/react/hooks/utils/useAfterFastRefresh.js": -/*!**********************************************************************************!*\ - !*** ../../node_modules/@apollo/client/react/hooks/utils/useAfterFastRefresh.js ***! - \**********************************************************************************/ -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "useAfterFastRefresh": function() { return /* binding */ useAfterFastRefresh; } -/* harmony export */ }); -/* harmony import */ var _utilities_globals_index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../../utilities/globals/index.js */ "../../node_modules/@apollo/client/utilities/globals/index.js"); -/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! react */ "../../node_modules/react/index.js"); - - -function useAfterFastRefresh(effectFn) { - if (__DEV__) { - var didRefresh_1 = (0,react__WEBPACK_IMPORTED_MODULE_1__.useRef)(false); - (0,react__WEBPACK_IMPORTED_MODULE_1__.useEffect)(function () { - return function () { - didRefresh_1.current = true; - }; - }, []); - (0,react__WEBPACK_IMPORTED_MODULE_1__.useEffect)(function () { - if (didRefresh_1.current === true) { - didRefresh_1.current = false; - effectFn(); - } - }, []); - } -} -//# sourceMappingURL=useAfterFastRefresh.js.map - -/***/ }), - -/***/ "../../node_modules/@apollo/client/react/hooks/utils/useBaseQuery.js": -/*!***************************************************************************!*\ - !*** ../../node_modules/@apollo/client/react/hooks/utils/useBaseQuery.js ***! - \***************************************************************************/ -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "useBaseQuery": function() { return /* binding */ useBaseQuery; } -/* harmony export */ }); -/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! tslib */ "../../node_modules/tslib/tslib.es6.js"); -/* harmony import */ var _utilities_globals_index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../../utilities/globals/index.js */ "../../node_modules/@apollo/client/utilities/globals/index.js"); -/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! react */ "../../node_modules/react/index.js"); -/* harmony import */ var _data_index_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../data/index.js */ "../../node_modules/@apollo/client/react/data/QueryData.js"); -/* harmony import */ var _useDeepMemo_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./useDeepMemo.js */ "../../node_modules/@apollo/client/react/hooks/utils/useDeepMemo.js"); -/* harmony import */ var _context_index_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../context/index.js */ "../../node_modules/@apollo/client/react/context/ApolloContext.js"); -/* harmony import */ var _useAfterFastRefresh_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./useAfterFastRefresh.js */ "../../node_modules/@apollo/client/react/hooks/utils/useAfterFastRefresh.js"); - - - - - - - -function useBaseQuery(query, options, lazy) { - if (lazy === void 0) { lazy = false; } - var context = (0,react__WEBPACK_IMPORTED_MODULE_1__.useContext)((0,_context_index_js__WEBPACK_IMPORTED_MODULE_2__.getApolloContext)()); - var _a = (0,react__WEBPACK_IMPORTED_MODULE_1__.useReducer)(function (x) { return x + 1; }, 0), tick = _a[0], forceUpdate = _a[1]; - var updatedOptions = options ? (0,tslib__WEBPACK_IMPORTED_MODULE_3__.__assign)((0,tslib__WEBPACK_IMPORTED_MODULE_3__.__assign)({}, options), { query: query }) : { query: query }; - var queryDataRef = (0,react__WEBPACK_IMPORTED_MODULE_1__.useRef)(); - var queryData = queryDataRef.current || (queryDataRef.current = new _data_index_js__WEBPACK_IMPORTED_MODULE_4__.QueryData({ - options: updatedOptions, - context: context, - onNewData: function () { - if (!queryData.ssrInitiated()) { - Promise.resolve().then(function () { return queryDataRef.current && queryDataRef.current.isMounted && forceUpdate(); }); - } - else { - forceUpdate(); - } - } - })); - queryData.setOptions(updatedOptions); - queryData.context = context; - var memo = { - options: (0,tslib__WEBPACK_IMPORTED_MODULE_3__.__assign)((0,tslib__WEBPACK_IMPORTED_MODULE_3__.__assign)({}, updatedOptions), { onError: void 0, onCompleted: void 0 }), - context: context, - tick: tick - }; - var result = (0,_useDeepMemo_js__WEBPACK_IMPORTED_MODULE_5__.useDeepMemo)(function () { return (lazy ? queryData.executeLazy() : queryData.execute()); }, memo); - var queryResult = lazy - ? result[1] - : result; - if (__DEV__) { - (0,_useAfterFastRefresh_js__WEBPACK_IMPORTED_MODULE_6__.useAfterFastRefresh)(forceUpdate); - } - (0,react__WEBPACK_IMPORTED_MODULE_1__.useEffect)(function () { - return function () { - queryData.cleanup(); - queryDataRef.current = void 0; - }; - }, []); - (0,react__WEBPACK_IMPORTED_MODULE_1__.useEffect)(function () { return queryData.afterExecute({ lazy: lazy }); }, [ - queryResult.loading, - queryResult.networkStatus, - queryResult.error, - queryResult.data, - queryData.currentObservable, - ]); - return result; -} -//# sourceMappingURL=useBaseQuery.js.map - -/***/ }), - -/***/ "../../node_modules/@apollo/client/react/hooks/utils/useDeepMemo.js": -/*!**************************************************************************!*\ - !*** ../../node_modules/@apollo/client/react/hooks/utils/useDeepMemo.js ***! - \**************************************************************************/ -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "useDeepMemo": function() { return /* binding */ useDeepMemo; } -/* harmony export */ }); -/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "../../node_modules/react/index.js"); -/* harmony import */ var _wry_equality__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @wry/equality */ "../../node_modules/@wry/equality/lib/equality.esm.js"); - - -function useDeepMemo(memoFn, key) { - var ref = (0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)(); - if (!ref.current || !(0,_wry_equality__WEBPACK_IMPORTED_MODULE_1__.equal)(key, ref.current.key)) { - ref.current = { key: key, value: memoFn() }; - } - return ref.current.value; -} -//# sourceMappingURL=useDeepMemo.js.map - -/***/ }), - -/***/ "../../node_modules/@apollo/client/react/parser/index.js": -/*!***************************************************************!*\ - !*** ../../node_modules/@apollo/client/react/parser/index.js ***! - \***************************************************************/ -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "DocumentType": function() { return /* binding */ DocumentType; }, -/* harmony export */ "operationName": function() { return /* binding */ operationName; }, -/* harmony export */ "parser": function() { return /* binding */ parser; } -/* harmony export */ }); -/* harmony import */ var _utilities_globals_index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../utilities/globals/index.js */ "../../node_modules/@apollo/client/utilities/globals/index.js"); - -var DocumentType; -(function (DocumentType) { - DocumentType[DocumentType["Query"] = 0] = "Query"; - DocumentType[DocumentType["Mutation"] = 1] = "Mutation"; - DocumentType[DocumentType["Subscription"] = 2] = "Subscription"; -})(DocumentType || (DocumentType = {})); -var cache = new Map(); -function operationName(type) { - var name; - switch (type) { - case DocumentType.Query: - name = 'Query'; - break; - case DocumentType.Mutation: - name = 'Mutation'; - break; - case DocumentType.Subscription: - name = 'Subscription'; - break; - } - return name; -} -function parser(document) { - var cached = cache.get(document); - if (cached) - return cached; - var variables, type, name; - __DEV__ ? (0,_utilities_globals_index_js__WEBPACK_IMPORTED_MODULE_0__.invariant)(!!document && !!document.kind, "Argument of " + document + " passed to parser was not a valid GraphQL " + - "DocumentNode. You may need to use 'graphql-tag' or another method " + - "to convert your operation into a document") : (0,_utilities_globals_index_js__WEBPACK_IMPORTED_MODULE_0__.invariant)(!!document && !!document.kind, 34); - var fragments = document.definitions.filter(function (x) { return x.kind === 'FragmentDefinition'; }); - var queries = document.definitions.filter(function (x) { - return x.kind === 'OperationDefinition' && x.operation === 'query'; - }); - var mutations = document.definitions.filter(function (x) { - return x.kind === 'OperationDefinition' && x.operation === 'mutation'; - }); - var subscriptions = document.definitions.filter(function (x) { - return x.kind === 'OperationDefinition' && x.operation === 'subscription'; - }); - __DEV__ ? (0,_utilities_globals_index_js__WEBPACK_IMPORTED_MODULE_0__.invariant)(!fragments.length || - (queries.length || mutations.length || subscriptions.length), "Passing only a fragment to 'graphql' is not yet supported. " + - "You must include a query, subscription or mutation as well") : (0,_utilities_globals_index_js__WEBPACK_IMPORTED_MODULE_0__.invariant)(!fragments.length || - (queries.length || mutations.length || subscriptions.length), 35); - __DEV__ ? (0,_utilities_globals_index_js__WEBPACK_IMPORTED_MODULE_0__.invariant)(queries.length + mutations.length + subscriptions.length <= 1, "react-apollo only supports a query, subscription, or a mutation per HOC. " + - (document + " had " + queries.length + " queries, " + subscriptions.length + " ") + - ("subscriptions and " + mutations.length + " mutations. ") + - "You can use 'compose' to join multiple operation types to a component") : (0,_utilities_globals_index_js__WEBPACK_IMPORTED_MODULE_0__.invariant)(queries.length + mutations.length + subscriptions.length <= 1, 36); - type = queries.length ? DocumentType.Query : DocumentType.Mutation; - if (!queries.length && !mutations.length) - type = DocumentType.Subscription; - var definitions = queries.length - ? queries - : mutations.length - ? mutations - : subscriptions; - __DEV__ ? (0,_utilities_globals_index_js__WEBPACK_IMPORTED_MODULE_0__.invariant)(definitions.length === 1, "react-apollo only supports one definition per HOC. " + document + " had " + - (definitions.length + " definitions. ") + - "You can use 'compose' to join multiple operation types to a component") : (0,_utilities_globals_index_js__WEBPACK_IMPORTED_MODULE_0__.invariant)(definitions.length === 1, 37); - var definition = definitions[0]; - variables = definition.variableDefinitions || []; - if (definition.name && definition.name.kind === 'Name') { - name = definition.name.value; - } - else { - name = 'data'; - } - var payload = { name: name, type: type, variables: variables }; - cache.set(document, payload); - return payload; -} -//# sourceMappingURL=index.js.map - -/***/ }), - -/***/ "../../node_modules/@apollo/client/utilities/common/arrays.js": -/*!********************************************************************!*\ - !*** ../../node_modules/@apollo/client/utilities/common/arrays.js ***! - \********************************************************************/ -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "isNonEmptyArray": function() { return /* binding */ isNonEmptyArray; } -/* harmony export */ }); -function isNonEmptyArray(value) { - return Array.isArray(value) && value.length > 0; -} -//# sourceMappingURL=arrays.js.map - -/***/ }), - -/***/ "../../node_modules/@apollo/client/utilities/common/canUse.js": -/*!********************************************************************!*\ - !*** ../../node_modules/@apollo/client/utilities/common/canUse.js ***! - \********************************************************************/ -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "canUseWeakMap": function() { return /* binding */ canUseWeakMap; }, -/* harmony export */ "canUseWeakSet": function() { return /* binding */ canUseWeakSet; }, -/* harmony export */ "canUseSymbol": function() { return /* binding */ canUseSymbol; } -/* harmony export */ }); -var canUseWeakMap = typeof WeakMap === 'function' && !(typeof navigator === 'object' && - navigator.product === 'ReactNative'); -var canUseWeakSet = typeof WeakSet === 'function'; -var canUseSymbol = typeof Symbol === 'function' && - typeof Symbol.for === 'function'; -//# sourceMappingURL=canUse.js.map - -/***/ }), - -/***/ "../../node_modules/@apollo/client/utilities/common/cloneDeep.js": -/*!***********************************************************************!*\ - !*** ../../node_modules/@apollo/client/utilities/common/cloneDeep.js ***! - \***********************************************************************/ -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "cloneDeep": function() { return /* binding */ cloneDeep; } -/* harmony export */ }); -var toString = Object.prototype.toString; -function cloneDeep(value) { - return cloneDeepHelper(value); -} -function cloneDeepHelper(val, seen) { - switch (toString.call(val)) { - case "[object Array]": { - seen = seen || new Map; - if (seen.has(val)) - return seen.get(val); - var copy_1 = val.slice(0); - seen.set(val, copy_1); - copy_1.forEach(function (child, i) { - copy_1[i] = cloneDeepHelper(child, seen); - }); - return copy_1; - } - case "[object Object]": { - seen = seen || new Map; - if (seen.has(val)) - return seen.get(val); - var copy_2 = Object.create(Object.getPrototypeOf(val)); - seen.set(val, copy_2); - Object.keys(val).forEach(function (key) { - copy_2[key] = cloneDeepHelper(val[key], seen); - }); - return copy_2; - } - default: - return val; - } -} -//# sourceMappingURL=cloneDeep.js.map - -/***/ }), - -/***/ "../../node_modules/@apollo/client/utilities/common/compact.js": -/*!*********************************************************************!*\ - !*** ../../node_modules/@apollo/client/utilities/common/compact.js ***! - \*********************************************************************/ -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "compact": function() { return /* binding */ compact; } -/* harmony export */ }); -function compact() { - var objects = []; - for (var _i = 0; _i < arguments.length; _i++) { - objects[_i] = arguments[_i]; - } - var result = Object.create(null); - objects.forEach(function (obj) { - if (!obj) - return; - Object.keys(obj).forEach(function (key) { - var value = obj[key]; - if (value !== void 0) { - result[key] = value; - } - }); - }); - return result; -} -//# sourceMappingURL=compact.js.map - -/***/ }), - -/***/ "../../node_modules/@apollo/client/utilities/common/errorHandling.js": -/*!***************************************************************************!*\ - !*** ../../node_modules/@apollo/client/utilities/common/errorHandling.js ***! - \***************************************************************************/ -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "graphQLResultHasError": function() { return /* binding */ graphQLResultHasError; } -/* harmony export */ }); -function graphQLResultHasError(result) { - return (result.errors && result.errors.length > 0) || false; -} -//# sourceMappingURL=errorHandling.js.map - -/***/ }), - -/***/ "../../node_modules/@apollo/client/utilities/common/filterInPlace.js": -/*!***************************************************************************!*\ - !*** ../../node_modules/@apollo/client/utilities/common/filterInPlace.js ***! - \***************************************************************************/ -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "filterInPlace": function() { return /* binding */ filterInPlace; } -/* harmony export */ }); -function filterInPlace(array, test, context) { - var target = 0; - array.forEach(function (elem, i) { - if (test.call(this, elem, i, array)) { - array[target++] = elem; - } - }, context); - array.length = target; - return array; -} -//# sourceMappingURL=filterInPlace.js.map - -/***/ }), - -/***/ "../../node_modules/@apollo/client/utilities/common/makeUniqueId.js": -/*!**************************************************************************!*\ - !*** ../../node_modules/@apollo/client/utilities/common/makeUniqueId.js ***! - \**************************************************************************/ -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "makeUniqueId": function() { return /* binding */ makeUniqueId; } -/* harmony export */ }); -var prefixCounts = new Map(); -function makeUniqueId(prefix) { - var count = prefixCounts.get(prefix) || 1; - prefixCounts.set(prefix, count + 1); - return prefix + ":" + count + ":" + Math.random().toString(36).slice(2); -} -//# sourceMappingURL=makeUniqueId.js.map - -/***/ }), - -/***/ "../../node_modules/@apollo/client/utilities/common/maybeDeepFreeze.js": -/*!*****************************************************************************!*\ - !*** ../../node_modules/@apollo/client/utilities/common/maybeDeepFreeze.js ***! - \*****************************************************************************/ -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "maybeDeepFreeze": function() { return /* binding */ maybeDeepFreeze; } -/* harmony export */ }); -/* harmony import */ var _globals_index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../globals/index.js */ "../../node_modules/@apollo/client/utilities/globals/index.js"); -/* harmony import */ var _objects_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./objects.js */ "../../node_modules/@apollo/client/utilities/common/objects.js"); - - -function deepFreeze(value) { - var workSet = new Set([value]); - workSet.forEach(function (obj) { - if ((0,_objects_js__WEBPACK_IMPORTED_MODULE_1__.isNonNullObject)(obj) && shallowFreeze(obj) === obj) { - Object.getOwnPropertyNames(obj).forEach(function (name) { - if ((0,_objects_js__WEBPACK_IMPORTED_MODULE_1__.isNonNullObject)(obj[name])) - workSet.add(obj[name]); - }); - } - }); - return value; -} -function shallowFreeze(obj) { - if (__DEV__ && !Object.isFrozen(obj)) { - try { - Object.freeze(obj); - } - catch (e) { - if (e instanceof TypeError) - return null; - throw e; - } - } - return obj; -} -function maybeDeepFreeze(obj) { - if (__DEV__) { - deepFreeze(obj); - } - return obj; -} -//# sourceMappingURL=maybeDeepFreeze.js.map - -/***/ }), - -/***/ "../../node_modules/@apollo/client/utilities/common/mergeDeep.js": -/*!***********************************************************************!*\ - !*** ../../node_modules/@apollo/client/utilities/common/mergeDeep.js ***! - \***********************************************************************/ -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "mergeDeep": function() { return /* binding */ mergeDeep; }, -/* harmony export */ "mergeDeepArray": function() { return /* binding */ mergeDeepArray; }, -/* harmony export */ "DeepMerger": function() { return /* binding */ DeepMerger; } -/* harmony export */ }); -/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! tslib */ "../../node_modules/tslib/tslib.es6.js"); -/* harmony import */ var _objects_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./objects.js */ "../../node_modules/@apollo/client/utilities/common/objects.js"); - - -var hasOwnProperty = Object.prototype.hasOwnProperty; -function mergeDeep() { - var sources = []; - for (var _i = 0; _i < arguments.length; _i++) { - sources[_i] = arguments[_i]; - } - return mergeDeepArray(sources); -} -function mergeDeepArray(sources) { - var target = sources[0] || {}; - var count = sources.length; - if (count > 1) { - var merger = new DeepMerger(); - for (var i = 1; i < count; ++i) { - target = merger.merge(target, sources[i]); - } - } - return target; -} -var defaultReconciler = function (target, source, property) { - return this.merge(target[property], source[property]); -}; -var DeepMerger = (function () { - function DeepMerger(reconciler) { - if (reconciler === void 0) { reconciler = defaultReconciler; } - this.reconciler = reconciler; - this.isObject = _objects_js__WEBPACK_IMPORTED_MODULE_0__.isNonNullObject; - this.pastCopies = new Set(); - } - DeepMerger.prototype.merge = function (target, source) { - var _this = this; - var context = []; - for (var _i = 2; _i < arguments.length; _i++) { - context[_i - 2] = arguments[_i]; - } - if ((0,_objects_js__WEBPACK_IMPORTED_MODULE_0__.isNonNullObject)(source) && (0,_objects_js__WEBPACK_IMPORTED_MODULE_0__.isNonNullObject)(target)) { - Object.keys(source).forEach(function (sourceKey) { - if (hasOwnProperty.call(target, sourceKey)) { - var targetValue = target[sourceKey]; - if (source[sourceKey] !== targetValue) { - var result = _this.reconciler.apply(_this, (0,tslib__WEBPACK_IMPORTED_MODULE_1__.__spreadArray)([target, source, sourceKey], context, false)); - if (result !== targetValue) { - target = _this.shallowCopyForMerge(target); - target[sourceKey] = result; - } - } - } - else { - target = _this.shallowCopyForMerge(target); - target[sourceKey] = source[sourceKey]; - } - }); - return target; - } - return source; - }; - DeepMerger.prototype.shallowCopyForMerge = function (value) { - if ((0,_objects_js__WEBPACK_IMPORTED_MODULE_0__.isNonNullObject)(value) && !this.pastCopies.has(value)) { - if (Array.isArray(value)) { - value = value.slice(0); - } - else { - value = (0,tslib__WEBPACK_IMPORTED_MODULE_1__.__assign)({ __proto__: Object.getPrototypeOf(value) }, value); - } - this.pastCopies.add(value); - } - return value; - }; - return DeepMerger; -}()); - -//# sourceMappingURL=mergeDeep.js.map - -/***/ }), - -/***/ "../../node_modules/@apollo/client/utilities/common/objects.js": -/*!*********************************************************************!*\ - !*** ../../node_modules/@apollo/client/utilities/common/objects.js ***! - \*********************************************************************/ -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "isNonNullObject": function() { return /* binding */ isNonNullObject; } -/* harmony export */ }); -function isNonNullObject(obj) { - return obj !== null && typeof obj === 'object'; -} -//# sourceMappingURL=objects.js.map - -/***/ }), - -/***/ "../../node_modules/@apollo/client/utilities/common/stringifyForDisplay.js": -/*!*********************************************************************************!*\ - !*** ../../node_modules/@apollo/client/utilities/common/stringifyForDisplay.js ***! - \*********************************************************************************/ -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "stringifyForDisplay": function() { return /* binding */ stringifyForDisplay; } -/* harmony export */ }); -/* harmony import */ var _makeUniqueId_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./makeUniqueId.js */ "../../node_modules/@apollo/client/utilities/common/makeUniqueId.js"); - -function stringifyForDisplay(value) { - var undefId = (0,_makeUniqueId_js__WEBPACK_IMPORTED_MODULE_0__.makeUniqueId)("stringifyForDisplay"); - return JSON.stringify(value, function (key, value) { - return value === void 0 ? undefId : value; - }).split(JSON.stringify(undefId)).join(""); -} -//# sourceMappingURL=stringifyForDisplay.js.map - -/***/ }), - -/***/ "../../node_modules/@apollo/client/utilities/globals/DEV.js": -/*!******************************************************************!*\ - !*** ../../node_modules/@apollo/client/utilities/globals/DEV.js ***! - \******************************************************************/ -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony import */ var _global_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./global.js */ "../../node_modules/@apollo/client/utilities/globals/global.js"); -/* harmony import */ var _maybe_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./maybe.js */ "../../node_modules/@apollo/client/utilities/globals/maybe.js"); - - -var __ = "__"; -var GLOBAL_KEY = [__, __].join("DEV"); -function getDEV() { - try { - return Boolean(__DEV__); - } - catch (_a) { - Object.defineProperty(_global_js__WEBPACK_IMPORTED_MODULE_0__["default"], GLOBAL_KEY, { - value: (0,_maybe_js__WEBPACK_IMPORTED_MODULE_1__.maybe)(function () { return "development"; }) !== "production", - enumerable: false, - configurable: true, - writable: true, - }); - return _global_js__WEBPACK_IMPORTED_MODULE_0__["default"][GLOBAL_KEY]; - } -} -/* harmony default export */ __webpack_exports__["default"] = (getDEV()); -//# sourceMappingURL=DEV.js.map - -/***/ }), - -/***/ "../../node_modules/@apollo/client/utilities/globals/global.js": -/*!*********************************************************************!*\ - !*** ../../node_modules/@apollo/client/utilities/globals/global.js ***! - \*********************************************************************/ -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony import */ var _maybe_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./maybe.js */ "../../node_modules/@apollo/client/utilities/globals/maybe.js"); - -/* harmony default export */ __webpack_exports__["default"] = ((0,_maybe_js__WEBPACK_IMPORTED_MODULE_0__.maybe)(function () { return globalThis; }) || - (0,_maybe_js__WEBPACK_IMPORTED_MODULE_0__.maybe)(function () { return window; }) || - (0,_maybe_js__WEBPACK_IMPORTED_MODULE_0__.maybe)(function () { return self; }) || - (0,_maybe_js__WEBPACK_IMPORTED_MODULE_0__.maybe)(function () { return __webpack_require__.g; }) || - (0,_maybe_js__WEBPACK_IMPORTED_MODULE_0__.maybe)(function () { return Function("return this")(); })); -//# sourceMappingURL=global.js.map - -/***/ }), - -/***/ "../../node_modules/@apollo/client/utilities/globals/graphql.js": -/*!**********************************************************************!*\ - !*** ../../node_modules/@apollo/client/utilities/globals/graphql.js ***! - \**********************************************************************/ -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "removeTemporaryGlobals": function() { return /* binding */ removeTemporaryGlobals; } -/* harmony export */ }); -/* harmony import */ var ts_invariant_process__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ts-invariant/process */ "../../node_modules/ts-invariant/process/index.js"); -/* harmony import */ var graphql__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! graphql */ "../../node_modules/graphql/type/definition.mjs"); - - -function removeTemporaryGlobals() { - (0,graphql__WEBPACK_IMPORTED_MODULE_1__.isType)(null); - return (0,ts_invariant_process__WEBPACK_IMPORTED_MODULE_0__.remove)(); -} -//# sourceMappingURL=graphql.js.map - -/***/ }), - -/***/ "../../node_modules/@apollo/client/utilities/globals/index.js": -/*!********************************************************************!*\ - !*** ../../node_modules/@apollo/client/utilities/globals/index.js ***! - \********************************************************************/ -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "DEV": function() { return /* reexport safe */ _DEV_js__WEBPACK_IMPORTED_MODULE_1__["default"]; }, -/* harmony export */ "checkDEV": function() { return /* binding */ checkDEV; }, -/* harmony export */ "maybe": function() { return /* reexport safe */ _maybe_js__WEBPACK_IMPORTED_MODULE_3__.maybe; }, -/* harmony export */ "global": function() { return /* reexport safe */ _global_js__WEBPACK_IMPORTED_MODULE_4__["default"]; }, -/* harmony export */ "invariant": function() { return /* reexport safe */ ts_invariant__WEBPACK_IMPORTED_MODULE_0__.invariant; }, -/* harmony export */ "InvariantError": function() { return /* reexport safe */ ts_invariant__WEBPACK_IMPORTED_MODULE_0__.InvariantError; } -/* harmony export */ }); -/* harmony import */ var ts_invariant__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ts-invariant */ "../../node_modules/ts-invariant/lib/invariant.esm.js"); -/* harmony import */ var _DEV_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./DEV.js */ "../../node_modules/@apollo/client/utilities/globals/DEV.js"); -/* harmony import */ var _graphql_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./graphql.js */ "../../node_modules/@apollo/client/utilities/globals/graphql.js"); -/* harmony import */ var _maybe_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./maybe.js */ "../../node_modules/@apollo/client/utilities/globals/maybe.js"); -/* harmony import */ var _global_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./global.js */ "../../node_modules/@apollo/client/utilities/globals/global.js"); - - - -function checkDEV() { - __DEV__ ? (0,ts_invariant__WEBPACK_IMPORTED_MODULE_0__.invariant)("boolean" === typeof _DEV_js__WEBPACK_IMPORTED_MODULE_1__["default"], _DEV_js__WEBPACK_IMPORTED_MODULE_1__["default"]) : (0,ts_invariant__WEBPACK_IMPORTED_MODULE_0__.invariant)("boolean" === typeof _DEV_js__WEBPACK_IMPORTED_MODULE_1__["default"], 38); -} - -(0,_graphql_js__WEBPACK_IMPORTED_MODULE_2__.removeTemporaryGlobals)(); - - - -checkDEV(); -//# sourceMappingURL=index.js.map - -/***/ }), - -/***/ "../../node_modules/@apollo/client/utilities/globals/maybe.js": -/*!********************************************************************!*\ - !*** ../../node_modules/@apollo/client/utilities/globals/maybe.js ***! - \********************************************************************/ -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "maybe": function() { return /* binding */ maybe; } -/* harmony export */ }); -function maybe(thunk) { - try { - return thunk(); - } - catch (_a) { } -} -//# sourceMappingURL=maybe.js.map - -/***/ }), - -/***/ "../../node_modules/@apollo/client/utilities/graphql/directives.js": -/*!*************************************************************************!*\ - !*** ../../node_modules/@apollo/client/utilities/graphql/directives.js ***! - \*************************************************************************/ -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "shouldInclude": function() { return /* binding */ shouldInclude; }, -/* harmony export */ "getDirectiveNames": function() { return /* binding */ getDirectiveNames; }, -/* harmony export */ "hasDirectives": function() { return /* binding */ hasDirectives; }, -/* harmony export */ "hasClientExports": function() { return /* binding */ hasClientExports; }, -/* harmony export */ "getInclusionDirectives": function() { return /* binding */ getInclusionDirectives; } -/* harmony export */ }); -/* harmony import */ var _globals_index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../globals/index.js */ "../../node_modules/@apollo/client/utilities/globals/index.js"); -/* harmony import */ var graphql__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! graphql */ "../../node_modules/graphql/language/visitor.mjs"); - - -function shouldInclude(_a, variables) { - var directives = _a.directives; - if (!directives || !directives.length) { - return true; - } - return getInclusionDirectives(directives).every(function (_a) { - var directive = _a.directive, ifArgument = _a.ifArgument; - var evaledValue = false; - if (ifArgument.value.kind === 'Variable') { - evaledValue = variables && variables[ifArgument.value.name.value]; - __DEV__ ? (0,_globals_index_js__WEBPACK_IMPORTED_MODULE_0__.invariant)(evaledValue !== void 0, "Invalid variable referenced in @" + directive.name.value + " directive.") : (0,_globals_index_js__WEBPACK_IMPORTED_MODULE_0__.invariant)(evaledValue !== void 0, 39); - } - else { - evaledValue = ifArgument.value.value; - } - return directive.name.value === 'skip' ? !evaledValue : evaledValue; - }); -} -function getDirectiveNames(root) { - var names = []; - (0,graphql__WEBPACK_IMPORTED_MODULE_1__.visit)(root, { - Directive: function (node) { - names.push(node.name.value); - }, - }); - return names; -} -function hasDirectives(names, root) { - return getDirectiveNames(root).some(function (name) { return names.indexOf(name) > -1; }); -} -function hasClientExports(document) { - return (document && - hasDirectives(['client'], document) && - hasDirectives(['export'], document)); -} -function isInclusionDirective(_a) { - var value = _a.name.value; - return value === 'skip' || value === 'include'; -} -function getInclusionDirectives(directives) { - var result = []; - if (directives && directives.length) { - directives.forEach(function (directive) { - if (!isInclusionDirective(directive)) - return; - var directiveArguments = directive.arguments; - var directiveName = directive.name.value; - __DEV__ ? (0,_globals_index_js__WEBPACK_IMPORTED_MODULE_0__.invariant)(directiveArguments && directiveArguments.length === 1, "Incorrect number of arguments for the @" + directiveName + " directive.") : (0,_globals_index_js__WEBPACK_IMPORTED_MODULE_0__.invariant)(directiveArguments && directiveArguments.length === 1, 40); - var ifArgument = directiveArguments[0]; - __DEV__ ? (0,_globals_index_js__WEBPACK_IMPORTED_MODULE_0__.invariant)(ifArgument.name && ifArgument.name.value === 'if', "Invalid argument for the @" + directiveName + " directive.") : (0,_globals_index_js__WEBPACK_IMPORTED_MODULE_0__.invariant)(ifArgument.name && ifArgument.name.value === 'if', 41); - var ifValue = ifArgument.value; - __DEV__ ? (0,_globals_index_js__WEBPACK_IMPORTED_MODULE_0__.invariant)(ifValue && - (ifValue.kind === 'Variable' || ifValue.kind === 'BooleanValue'), "Argument for the @" + directiveName + " directive must be a variable or a boolean value.") : (0,_globals_index_js__WEBPACK_IMPORTED_MODULE_0__.invariant)(ifValue && - (ifValue.kind === 'Variable' || ifValue.kind === 'BooleanValue'), 42); - result.push({ directive: directive, ifArgument: ifArgument }); - }); - } - return result; -} -//# sourceMappingURL=directives.js.map - -/***/ }), - -/***/ "../../node_modules/@apollo/client/utilities/graphql/fragments.js": -/*!************************************************************************!*\ - !*** ../../node_modules/@apollo/client/utilities/graphql/fragments.js ***! - \************************************************************************/ -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "getFragmentQueryDocument": function() { return /* binding */ getFragmentQueryDocument; }, -/* harmony export */ "createFragmentMap": function() { return /* binding */ createFragmentMap; }, -/* harmony export */ "getFragmentFromSelection": function() { return /* binding */ getFragmentFromSelection; } -/* harmony export */ }); -/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! tslib */ "../../node_modules/tslib/tslib.es6.js"); -/* harmony import */ var _globals_index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../globals/index.js */ "../../node_modules/@apollo/client/utilities/globals/index.js"); - - -function getFragmentQueryDocument(document, fragmentName) { - var actualFragmentName = fragmentName; - var fragments = []; - document.definitions.forEach(function (definition) { - if (definition.kind === 'OperationDefinition') { - throw __DEV__ ? new _globals_index_js__WEBPACK_IMPORTED_MODULE_0__.InvariantError("Found a " + definition.operation + " operation" + (definition.name ? " named '" + definition.name.value + "'" : '') + ". " + - 'No operations are allowed when using a fragment as a query. Only fragments are allowed.') : new _globals_index_js__WEBPACK_IMPORTED_MODULE_0__.InvariantError(43); - } - if (definition.kind === 'FragmentDefinition') { - fragments.push(definition); - } - }); - if (typeof actualFragmentName === 'undefined') { - __DEV__ ? (0,_globals_index_js__WEBPACK_IMPORTED_MODULE_0__.invariant)(fragments.length === 1, "Found " + fragments.length + " fragments. `fragmentName` must be provided when there is not exactly 1 fragment.") : (0,_globals_index_js__WEBPACK_IMPORTED_MODULE_0__.invariant)(fragments.length === 1, 44); - actualFragmentName = fragments[0].name.value; - } - var query = (0,tslib__WEBPACK_IMPORTED_MODULE_1__.__assign)((0,tslib__WEBPACK_IMPORTED_MODULE_1__.__assign)({}, document), { definitions: (0,tslib__WEBPACK_IMPORTED_MODULE_1__.__spreadArray)([ - { - kind: 'OperationDefinition', - operation: 'query', - selectionSet: { - kind: 'SelectionSet', - selections: [ - { - kind: 'FragmentSpread', - name: { - kind: 'Name', - value: actualFragmentName, - }, - }, - ], - }, - } - ], document.definitions, true) }); - return query; -} -function createFragmentMap(fragments) { - if (fragments === void 0) { fragments = []; } - var symTable = {}; - fragments.forEach(function (fragment) { - symTable[fragment.name.value] = fragment; - }); - return symTable; -} -function getFragmentFromSelection(selection, fragmentMap) { - switch (selection.kind) { - case 'InlineFragment': - return selection; - case 'FragmentSpread': { - var fragment = fragmentMap && fragmentMap[selection.name.value]; - __DEV__ ? (0,_globals_index_js__WEBPACK_IMPORTED_MODULE_0__.invariant)(fragment, "No fragment named " + selection.name.value + ".") : (0,_globals_index_js__WEBPACK_IMPORTED_MODULE_0__.invariant)(fragment, 45); - return fragment; - } - default: - return null; - } -} -//# sourceMappingURL=fragments.js.map - -/***/ }), - -/***/ "../../node_modules/@apollo/client/utilities/graphql/getFromAST.js": -/*!*************************************************************************!*\ - !*** ../../node_modules/@apollo/client/utilities/graphql/getFromAST.js ***! - \*************************************************************************/ -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "checkDocument": function() { return /* binding */ checkDocument; }, -/* harmony export */ "getOperationDefinition": function() { return /* binding */ getOperationDefinition; }, -/* harmony export */ "getOperationName": function() { return /* binding */ getOperationName; }, -/* harmony export */ "getFragmentDefinitions": function() { return /* binding */ getFragmentDefinitions; }, -/* harmony export */ "getQueryDefinition": function() { return /* binding */ getQueryDefinition; }, -/* harmony export */ "getFragmentDefinition": function() { return /* binding */ getFragmentDefinition; }, -/* harmony export */ "getMainDefinition": function() { return /* binding */ getMainDefinition; }, -/* harmony export */ "getDefaultValues": function() { return /* binding */ getDefaultValues; } -/* harmony export */ }); -/* harmony import */ var _globals_index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../globals/index.js */ "../../node_modules/@apollo/client/utilities/globals/index.js"); -/* harmony import */ var _storeUtils_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./storeUtils.js */ "../../node_modules/@apollo/client/utilities/graphql/storeUtils.js"); - - -function checkDocument(doc) { - __DEV__ ? (0,_globals_index_js__WEBPACK_IMPORTED_MODULE_0__.invariant)(doc && doc.kind === 'Document', "Expecting a parsed GraphQL document. Perhaps you need to wrap the query string in a \"gql\" tag? http://docs.apollostack.com/apollo-client/core.html#gql") : (0,_globals_index_js__WEBPACK_IMPORTED_MODULE_0__.invariant)(doc && doc.kind === 'Document', 46); - var operations = doc.definitions - .filter(function (d) { return d.kind !== 'FragmentDefinition'; }) - .map(function (definition) { - if (definition.kind !== 'OperationDefinition') { - throw __DEV__ ? new _globals_index_js__WEBPACK_IMPORTED_MODULE_0__.InvariantError("Schema type definitions not allowed in queries. Found: \"" + definition.kind + "\"") : new _globals_index_js__WEBPACK_IMPORTED_MODULE_0__.InvariantError(47); - } - return definition; - }); - __DEV__ ? (0,_globals_index_js__WEBPACK_IMPORTED_MODULE_0__.invariant)(operations.length <= 1, "Ambiguous GraphQL document: contains " + operations.length + " operations") : (0,_globals_index_js__WEBPACK_IMPORTED_MODULE_0__.invariant)(operations.length <= 1, 48); - return doc; -} -function getOperationDefinition(doc) { - checkDocument(doc); - return doc.definitions.filter(function (definition) { return definition.kind === 'OperationDefinition'; })[0]; -} -function getOperationName(doc) { - return (doc.definitions - .filter(function (definition) { - return definition.kind === 'OperationDefinition' && definition.name; - }) - .map(function (x) { return x.name.value; })[0] || null); -} -function getFragmentDefinitions(doc) { - return doc.definitions.filter(function (definition) { return definition.kind === 'FragmentDefinition'; }); -} -function getQueryDefinition(doc) { - var queryDef = getOperationDefinition(doc); - __DEV__ ? (0,_globals_index_js__WEBPACK_IMPORTED_MODULE_0__.invariant)(queryDef && queryDef.operation === 'query', 'Must contain a query definition.') : (0,_globals_index_js__WEBPACK_IMPORTED_MODULE_0__.invariant)(queryDef && queryDef.operation === 'query', 49); - return queryDef; -} -function getFragmentDefinition(doc) { - __DEV__ ? (0,_globals_index_js__WEBPACK_IMPORTED_MODULE_0__.invariant)(doc.kind === 'Document', "Expecting a parsed GraphQL document. Perhaps you need to wrap the query string in a \"gql\" tag? http://docs.apollostack.com/apollo-client/core.html#gql") : (0,_globals_index_js__WEBPACK_IMPORTED_MODULE_0__.invariant)(doc.kind === 'Document', 50); - __DEV__ ? (0,_globals_index_js__WEBPACK_IMPORTED_MODULE_0__.invariant)(doc.definitions.length <= 1, 'Fragment must have exactly one definition.') : (0,_globals_index_js__WEBPACK_IMPORTED_MODULE_0__.invariant)(doc.definitions.length <= 1, 51); - var fragmentDef = doc.definitions[0]; - __DEV__ ? (0,_globals_index_js__WEBPACK_IMPORTED_MODULE_0__.invariant)(fragmentDef.kind === 'FragmentDefinition', 'Must be a fragment definition.') : (0,_globals_index_js__WEBPACK_IMPORTED_MODULE_0__.invariant)(fragmentDef.kind === 'FragmentDefinition', 52); - return fragmentDef; -} -function getMainDefinition(queryDoc) { - checkDocument(queryDoc); - var fragmentDefinition; - for (var _i = 0, _a = queryDoc.definitions; _i < _a.length; _i++) { - var definition = _a[_i]; - if (definition.kind === 'OperationDefinition') { - var operation = definition.operation; - if (operation === 'query' || - operation === 'mutation' || - operation === 'subscription') { - return definition; - } - } - if (definition.kind === 'FragmentDefinition' && !fragmentDefinition) { - fragmentDefinition = definition; - } - } - if (fragmentDefinition) { - return fragmentDefinition; - } - throw __DEV__ ? new _globals_index_js__WEBPACK_IMPORTED_MODULE_0__.InvariantError('Expected a parsed GraphQL query with a query, mutation, subscription, or a fragment.') : new _globals_index_js__WEBPACK_IMPORTED_MODULE_0__.InvariantError(53); -} -function getDefaultValues(definition) { - var defaultValues = Object.create(null); - var defs = definition && definition.variableDefinitions; - if (defs && defs.length) { - defs.forEach(function (def) { - if (def.defaultValue) { - (0,_storeUtils_js__WEBPACK_IMPORTED_MODULE_1__.valueToObjectRepresentation)(defaultValues, def.variable.name, def.defaultValue); - } - }); - } - return defaultValues; -} -//# sourceMappingURL=getFromAST.js.map - -/***/ }), - -/***/ "../../node_modules/@apollo/client/utilities/graphql/storeUtils.js": -/*!*************************************************************************!*\ - !*** ../../node_modules/@apollo/client/utilities/graphql/storeUtils.js ***! - \*************************************************************************/ -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "makeReference": function() { return /* binding */ makeReference; }, -/* harmony export */ "isReference": function() { return /* binding */ isReference; }, -/* harmony export */ "isDocumentNode": function() { return /* binding */ isDocumentNode; }, -/* harmony export */ "valueToObjectRepresentation": function() { return /* binding */ valueToObjectRepresentation; }, -/* harmony export */ "storeKeyNameFromField": function() { return /* binding */ storeKeyNameFromField; }, -/* harmony export */ "getStoreKeyName": function() { return /* binding */ getStoreKeyName; }, -/* harmony export */ "argumentsObjectFromField": function() { return /* binding */ argumentsObjectFromField; }, -/* harmony export */ "resultKeyNameFromField": function() { return /* binding */ resultKeyNameFromField; }, -/* harmony export */ "getTypenameFromResult": function() { return /* binding */ getTypenameFromResult; }, -/* harmony export */ "isField": function() { return /* binding */ isField; }, -/* harmony export */ "isInlineFragment": function() { return /* binding */ isInlineFragment; } -/* harmony export */ }); -/* harmony import */ var _globals_index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../globals/index.js */ "../../node_modules/@apollo/client/utilities/globals/index.js"); -/* harmony import */ var _common_objects_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../common/objects.js */ "../../node_modules/@apollo/client/utilities/common/objects.js"); -/* harmony import */ var _fragments_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./fragments.js */ "../../node_modules/@apollo/client/utilities/graphql/fragments.js"); - - - -function makeReference(id) { - return { __ref: String(id) }; -} -function isReference(obj) { - return Boolean(obj && typeof obj === 'object' && typeof obj.__ref === 'string'); -} -function isDocumentNode(value) { - return ((0,_common_objects_js__WEBPACK_IMPORTED_MODULE_1__.isNonNullObject)(value) && - value.kind === "Document" && - Array.isArray(value.definitions)); -} -function isStringValue(value) { - return value.kind === 'StringValue'; -} -function isBooleanValue(value) { - return value.kind === 'BooleanValue'; -} -function isIntValue(value) { - return value.kind === 'IntValue'; -} -function isFloatValue(value) { - return value.kind === 'FloatValue'; -} -function isVariable(value) { - return value.kind === 'Variable'; -} -function isObjectValue(value) { - return value.kind === 'ObjectValue'; -} -function isListValue(value) { - return value.kind === 'ListValue'; -} -function isEnumValue(value) { - return value.kind === 'EnumValue'; -} -function isNullValue(value) { - return value.kind === 'NullValue'; -} -function valueToObjectRepresentation(argObj, name, value, variables) { - if (isIntValue(value) || isFloatValue(value)) { - argObj[name.value] = Number(value.value); - } - else if (isBooleanValue(value) || isStringValue(value)) { - argObj[name.value] = value.value; - } - else if (isObjectValue(value)) { - var nestedArgObj_1 = {}; - value.fields.map(function (obj) { - return valueToObjectRepresentation(nestedArgObj_1, obj.name, obj.value, variables); - }); - argObj[name.value] = nestedArgObj_1; - } - else if (isVariable(value)) { - var variableValue = (variables || {})[value.name.value]; - argObj[name.value] = variableValue; - } - else if (isListValue(value)) { - argObj[name.value] = value.values.map(function (listValue) { - var nestedArgArrayObj = {}; - valueToObjectRepresentation(nestedArgArrayObj, name, listValue, variables); - return nestedArgArrayObj[name.value]; - }); - } - else if (isEnumValue(value)) { - argObj[name.value] = value.value; - } - else if (isNullValue(value)) { - argObj[name.value] = null; - } - else { - throw __DEV__ ? new _globals_index_js__WEBPACK_IMPORTED_MODULE_0__.InvariantError("The inline argument \"" + name.value + "\" of kind \"" + value.kind + "\"" + - 'is not supported. Use variables instead of inline arguments to ' + - 'overcome this limitation.') : new _globals_index_js__WEBPACK_IMPORTED_MODULE_0__.InvariantError(54); - } -} -function storeKeyNameFromField(field, variables) { - var directivesObj = null; - if (field.directives) { - directivesObj = {}; - field.directives.forEach(function (directive) { - directivesObj[directive.name.value] = {}; - if (directive.arguments) { - directive.arguments.forEach(function (_a) { - var name = _a.name, value = _a.value; - return valueToObjectRepresentation(directivesObj[directive.name.value], name, value, variables); - }); - } - }); - } - var argObj = null; - if (field.arguments && field.arguments.length) { - argObj = {}; - field.arguments.forEach(function (_a) { - var name = _a.name, value = _a.value; - return valueToObjectRepresentation(argObj, name, value, variables); - }); - } - return getStoreKeyName(field.name.value, argObj, directivesObj); -} -var KNOWN_DIRECTIVES = [ - 'connection', - 'include', - 'skip', - 'client', - 'rest', - 'export', -]; -var getStoreKeyName = Object.assign(function (fieldName, args, directives) { - if (args && - directives && - directives['connection'] && - directives['connection']['key']) { - if (directives['connection']['filter'] && - directives['connection']['filter'].length > 0) { - var filterKeys = directives['connection']['filter'] - ? directives['connection']['filter'] - : []; - filterKeys.sort(); - var filteredArgs_1 = {}; - filterKeys.forEach(function (key) { - filteredArgs_1[key] = args[key]; - }); - return directives['connection']['key'] + "(" + stringify(filteredArgs_1) + ")"; - } - else { - return directives['connection']['key']; - } - } - var completeFieldName = fieldName; - if (args) { - var stringifiedArgs = stringify(args); - completeFieldName += "(" + stringifiedArgs + ")"; - } - if (directives) { - Object.keys(directives).forEach(function (key) { - if (KNOWN_DIRECTIVES.indexOf(key) !== -1) - return; - if (directives[key] && Object.keys(directives[key]).length) { - completeFieldName += "@" + key + "(" + stringify(directives[key]) + ")"; - } - else { - completeFieldName += "@" + key; - } - }); - } - return completeFieldName; -}, { - setStringify: function (s) { - var previous = stringify; - stringify = s; - return previous; - }, -}); -var stringify = function defaultStringify(value) { - return JSON.stringify(value, stringifyReplacer); -}; -function stringifyReplacer(_key, value) { - if ((0,_common_objects_js__WEBPACK_IMPORTED_MODULE_1__.isNonNullObject)(value) && !Array.isArray(value)) { - value = Object.keys(value).sort().reduce(function (copy, key) { - copy[key] = value[key]; - return copy; - }, {}); - } - return value; -} -function argumentsObjectFromField(field, variables) { - if (field.arguments && field.arguments.length) { - var argObj_1 = {}; - field.arguments.forEach(function (_a) { - var name = _a.name, value = _a.value; - return valueToObjectRepresentation(argObj_1, name, value, variables); - }); - return argObj_1; - } - return null; -} -function resultKeyNameFromField(field) { - return field.alias ? field.alias.value : field.name.value; -} -function getTypenameFromResult(result, selectionSet, fragmentMap) { - if (typeof result.__typename === 'string') { - return result.__typename; - } - for (var _i = 0, _a = selectionSet.selections; _i < _a.length; _i++) { - var selection = _a[_i]; - if (isField(selection)) { - if (selection.name.value === '__typename') { - return result[resultKeyNameFromField(selection)]; - } - } - else { - var typename = getTypenameFromResult(result, (0,_fragments_js__WEBPACK_IMPORTED_MODULE_2__.getFragmentFromSelection)(selection, fragmentMap).selectionSet, fragmentMap); - if (typeof typename === 'string') { - return typename; - } - } - } -} -function isField(selection) { - return selection.kind === 'Field'; -} -function isInlineFragment(selection) { - return selection.kind === 'InlineFragment'; -} -//# sourceMappingURL=storeUtils.js.map - -/***/ }), - -/***/ "../../node_modules/@apollo/client/utilities/graphql/transform.js": -/*!************************************************************************!*\ - !*** ../../node_modules/@apollo/client/utilities/graphql/transform.js ***! - \************************************************************************/ -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "removeDirectivesFromDocument": function() { return /* binding */ removeDirectivesFromDocument; }, -/* harmony export */ "addTypenameToDocument": function() { return /* binding */ addTypenameToDocument; }, -/* harmony export */ "removeConnectionDirectiveFromDocument": function() { return /* binding */ removeConnectionDirectiveFromDocument; }, -/* harmony export */ "removeArgumentsFromDocument": function() { return /* binding */ removeArgumentsFromDocument; }, -/* harmony export */ "removeFragmentSpreadFromDocument": function() { return /* binding */ removeFragmentSpreadFromDocument; }, -/* harmony export */ "buildQueryFromSelectionSet": function() { return /* binding */ buildQueryFromSelectionSet; }, -/* harmony export */ "removeClientSetsFromDocument": function() { return /* binding */ removeClientSetsFromDocument; } -/* harmony export */ }); -/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! tslib */ "../../node_modules/tslib/tslib.es6.js"); -/* harmony import */ var _globals_index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../globals/index.js */ "../../node_modules/@apollo/client/utilities/globals/index.js"); -/* harmony import */ var graphql__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! graphql */ "../../node_modules/graphql/language/visitor.mjs"); -/* harmony import */ var _getFromAST_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./getFromAST.js */ "../../node_modules/@apollo/client/utilities/graphql/getFromAST.js"); -/* harmony import */ var _common_filterInPlace_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../common/filterInPlace.js */ "../../node_modules/@apollo/client/utilities/common/filterInPlace.js"); -/* harmony import */ var _storeUtils_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./storeUtils.js */ "../../node_modules/@apollo/client/utilities/graphql/storeUtils.js"); -/* harmony import */ var _fragments_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./fragments.js */ "../../node_modules/@apollo/client/utilities/graphql/fragments.js"); - - - - - - - -var TYPENAME_FIELD = { - kind: 'Field', - name: { - kind: 'Name', - value: '__typename', - }, -}; -function isEmpty(op, fragments) { - return op.selectionSet.selections.every(function (selection) { - return selection.kind === 'FragmentSpread' && - isEmpty(fragments[selection.name.value], fragments); - }); -} -function nullIfDocIsEmpty(doc) { - return isEmpty((0,_getFromAST_js__WEBPACK_IMPORTED_MODULE_1__.getOperationDefinition)(doc) || (0,_getFromAST_js__WEBPACK_IMPORTED_MODULE_1__.getFragmentDefinition)(doc), (0,_fragments_js__WEBPACK_IMPORTED_MODULE_2__.createFragmentMap)((0,_getFromAST_js__WEBPACK_IMPORTED_MODULE_1__.getFragmentDefinitions)(doc))) - ? null - : doc; -} -function getDirectiveMatcher(directives) { - return function directiveMatcher(directive) { - return directives.some(function (dir) { - return (dir.name && dir.name === directive.name.value) || - (dir.test && dir.test(directive)); - }); - }; -} -function removeDirectivesFromDocument(directives, doc) { - var variablesInUse = Object.create(null); - var variablesToRemove = []; - var fragmentSpreadsInUse = Object.create(null); - var fragmentSpreadsToRemove = []; - var modifiedDoc = nullIfDocIsEmpty((0,graphql__WEBPACK_IMPORTED_MODULE_3__.visit)(doc, { - Variable: { - enter: function (node, _key, parent) { - if (parent.kind !== 'VariableDefinition') { - variablesInUse[node.name.value] = true; - } - }, - }, - Field: { - enter: function (node) { - if (directives && node.directives) { - var shouldRemoveField = directives.some(function (directive) { return directive.remove; }); - if (shouldRemoveField && - node.directives && - node.directives.some(getDirectiveMatcher(directives))) { - if (node.arguments) { - node.arguments.forEach(function (arg) { - if (arg.value.kind === 'Variable') { - variablesToRemove.push({ - name: arg.value.name.value, - }); - } - }); - } - if (node.selectionSet) { - getAllFragmentSpreadsFromSelectionSet(node.selectionSet).forEach(function (frag) { - fragmentSpreadsToRemove.push({ - name: frag.name.value, - }); - }); - } - return null; - } - } - }, - }, - FragmentSpread: { - enter: function (node) { - fragmentSpreadsInUse[node.name.value] = true; - }, - }, - Directive: { - enter: function (node) { - if (getDirectiveMatcher(directives)(node)) { - return null; - } - }, - }, - })); - if (modifiedDoc && - (0,_common_filterInPlace_js__WEBPACK_IMPORTED_MODULE_4__.filterInPlace)(variablesToRemove, function (v) { return !!v.name && !variablesInUse[v.name]; }).length) { - modifiedDoc = removeArgumentsFromDocument(variablesToRemove, modifiedDoc); - } - if (modifiedDoc && - (0,_common_filterInPlace_js__WEBPACK_IMPORTED_MODULE_4__.filterInPlace)(fragmentSpreadsToRemove, function (fs) { return !!fs.name && !fragmentSpreadsInUse[fs.name]; }) - .length) { - modifiedDoc = removeFragmentSpreadFromDocument(fragmentSpreadsToRemove, modifiedDoc); - } - return modifiedDoc; -} -var addTypenameToDocument = Object.assign(function (doc) { - return (0,graphql__WEBPACK_IMPORTED_MODULE_3__.visit)((0,_getFromAST_js__WEBPACK_IMPORTED_MODULE_1__.checkDocument)(doc), { - SelectionSet: { - enter: function (node, _key, parent) { - if (parent && - parent.kind === 'OperationDefinition') { - return; - } - var selections = node.selections; - if (!selections) { - return; - } - var skip = selections.some(function (selection) { - return ((0,_storeUtils_js__WEBPACK_IMPORTED_MODULE_5__.isField)(selection) && - (selection.name.value === '__typename' || - selection.name.value.lastIndexOf('__', 0) === 0)); - }); - if (skip) { - return; - } - var field = parent; - if ((0,_storeUtils_js__WEBPACK_IMPORTED_MODULE_5__.isField)(field) && - field.directives && - field.directives.some(function (d) { return d.name.value === 'export'; })) { - return; - } - return (0,tslib__WEBPACK_IMPORTED_MODULE_6__.__assign)((0,tslib__WEBPACK_IMPORTED_MODULE_6__.__assign)({}, node), { selections: (0,tslib__WEBPACK_IMPORTED_MODULE_6__.__spreadArray)((0,tslib__WEBPACK_IMPORTED_MODULE_6__.__spreadArray)([], selections, true), [TYPENAME_FIELD], false) }); - }, - }, - }); -}, { - added: function (field) { - return field === TYPENAME_FIELD; - }, -}); -var connectionRemoveConfig = { - test: function (directive) { - var willRemove = directive.name.value === 'connection'; - if (willRemove) { - if (!directive.arguments || - !directive.arguments.some(function (arg) { return arg.name.value === 'key'; })) { - __DEV__ && _globals_index_js__WEBPACK_IMPORTED_MODULE_0__.invariant.warn('Removing an @connection directive even though it does not have a key. ' + - 'You may want to use the key parameter to specify a store key.'); - } - } - return willRemove; - }, -}; -function removeConnectionDirectiveFromDocument(doc) { - return removeDirectivesFromDocument([connectionRemoveConfig], (0,_getFromAST_js__WEBPACK_IMPORTED_MODULE_1__.checkDocument)(doc)); -} -function hasDirectivesInSelectionSet(directives, selectionSet, nestedCheck) { - if (nestedCheck === void 0) { nestedCheck = true; } - return (!!selectionSet && - selectionSet.selections && - selectionSet.selections.some(function (selection) { - return hasDirectivesInSelection(directives, selection, nestedCheck); - })); -} -function hasDirectivesInSelection(directives, selection, nestedCheck) { - if (nestedCheck === void 0) { nestedCheck = true; } - if (!(0,_storeUtils_js__WEBPACK_IMPORTED_MODULE_5__.isField)(selection)) { - return true; - } - if (!selection.directives) { - return false; - } - return (selection.directives.some(getDirectiveMatcher(directives)) || - (nestedCheck && - hasDirectivesInSelectionSet(directives, selection.selectionSet, nestedCheck))); -} -function getArgumentMatcher(config) { - return function argumentMatcher(argument) { - return config.some(function (aConfig) { - return argument.value && - argument.value.kind === 'Variable' && - argument.value.name && - (aConfig.name === argument.value.name.value || - (aConfig.test && aConfig.test(argument))); - }); - }; -} -function removeArgumentsFromDocument(config, doc) { - var argMatcher = getArgumentMatcher(config); - return nullIfDocIsEmpty((0,graphql__WEBPACK_IMPORTED_MODULE_3__.visit)(doc, { - OperationDefinition: { - enter: function (node) { - return (0,tslib__WEBPACK_IMPORTED_MODULE_6__.__assign)((0,tslib__WEBPACK_IMPORTED_MODULE_6__.__assign)({}, node), { variableDefinitions: node.variableDefinitions ? node.variableDefinitions.filter(function (varDef) { - return !config.some(function (arg) { return arg.name === varDef.variable.name.value; }); - }) : [] }); - }, - }, - Field: { - enter: function (node) { - var shouldRemoveField = config.some(function (argConfig) { return argConfig.remove; }); - if (shouldRemoveField) { - var argMatchCount_1 = 0; - if (node.arguments) { - node.arguments.forEach(function (arg) { - if (argMatcher(arg)) { - argMatchCount_1 += 1; - } - }); - } - if (argMatchCount_1 === 1) { - return null; - } - } - }, - }, - Argument: { - enter: function (node) { - if (argMatcher(node)) { - return null; - } - }, - }, - })); -} -function removeFragmentSpreadFromDocument(config, doc) { - function enter(node) { - if (config.some(function (def) { return def.name === node.name.value; })) { - return null; - } - } - return nullIfDocIsEmpty((0,graphql__WEBPACK_IMPORTED_MODULE_3__.visit)(doc, { - FragmentSpread: { enter: enter }, - FragmentDefinition: { enter: enter }, - })); -} -function getAllFragmentSpreadsFromSelectionSet(selectionSet) { - var allFragments = []; - selectionSet.selections.forEach(function (selection) { - if (((0,_storeUtils_js__WEBPACK_IMPORTED_MODULE_5__.isField)(selection) || (0,_storeUtils_js__WEBPACK_IMPORTED_MODULE_5__.isInlineFragment)(selection)) && - selection.selectionSet) { - getAllFragmentSpreadsFromSelectionSet(selection.selectionSet).forEach(function (frag) { return allFragments.push(frag); }); - } - else if (selection.kind === 'FragmentSpread') { - allFragments.push(selection); - } - }); - return allFragments; -} -function buildQueryFromSelectionSet(document) { - var definition = (0,_getFromAST_js__WEBPACK_IMPORTED_MODULE_1__.getMainDefinition)(document); - var definitionOperation = definition.operation; - if (definitionOperation === 'query') { - return document; - } - var modifiedDoc = (0,graphql__WEBPACK_IMPORTED_MODULE_3__.visit)(document, { - OperationDefinition: { - enter: function (node) { - return (0,tslib__WEBPACK_IMPORTED_MODULE_6__.__assign)((0,tslib__WEBPACK_IMPORTED_MODULE_6__.__assign)({}, node), { operation: 'query' }); - }, - }, - }); - return modifiedDoc; -} -function removeClientSetsFromDocument(document) { - (0,_getFromAST_js__WEBPACK_IMPORTED_MODULE_1__.checkDocument)(document); - var modifiedDoc = removeDirectivesFromDocument([ - { - test: function (directive) { return directive.name.value === 'client'; }, - remove: true, - }, - ], document); - if (modifiedDoc) { - modifiedDoc = (0,graphql__WEBPACK_IMPORTED_MODULE_3__.visit)(modifiedDoc, { - FragmentDefinition: { - enter: function (node) { - if (node.selectionSet) { - var isTypenameOnly = node.selectionSet.selections.every(function (selection) { - return (0,_storeUtils_js__WEBPACK_IMPORTED_MODULE_5__.isField)(selection) && selection.name.value === '__typename'; - }); - if (isTypenameOnly) { - return null; - } - } - }, - }, - }); - } - return modifiedDoc; -} -//# sourceMappingURL=transform.js.map - -/***/ }), - -/***/ "../../node_modules/@apollo/client/utilities/observables/Concast.js": -/*!**************************************************************************!*\ - !*** ../../node_modules/@apollo/client/utilities/observables/Concast.js ***! - \**************************************************************************/ -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "Concast": function() { return /* binding */ Concast; } -/* harmony export */ }); -/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ "../../node_modules/tslib/tslib.es6.js"); -/* harmony import */ var _Observable_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./Observable.js */ "../../node_modules/zen-observable-ts/module.js"); -/* harmony import */ var _iteration_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./iteration.js */ "../../node_modules/@apollo/client/utilities/observables/iteration.js"); -/* harmony import */ var _subclassing_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./subclassing.js */ "../../node_modules/@apollo/client/utilities/observables/subclassing.js"); - - - - -function isPromiseLike(value) { - return value && typeof value.then === "function"; -} -var Concast = (function (_super) { - (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__extends)(Concast, _super); - function Concast(sources) { - var _this = _super.call(this, function (observer) { - _this.addObserver(observer); - return function () { return _this.removeObserver(observer); }; - }) || this; - _this.observers = new Set(); - _this.addCount = 0; - _this.promise = new Promise(function (resolve, reject) { - _this.resolve = resolve; - _this.reject = reject; - }); - _this.handlers = { - next: function (result) { - if (_this.sub !== null) { - _this.latest = ["next", result]; - (0,_iteration_js__WEBPACK_IMPORTED_MODULE_1__.iterateObserversSafely)(_this.observers, "next", result); - } - }, - error: function (error) { - var sub = _this.sub; - if (sub !== null) { - if (sub) - setTimeout(function () { return sub.unsubscribe(); }); - _this.sub = null; - _this.latest = ["error", error]; - _this.reject(error); - (0,_iteration_js__WEBPACK_IMPORTED_MODULE_1__.iterateObserversSafely)(_this.observers, "error", error); - } - }, - complete: function () { - if (_this.sub !== null) { - var value = _this.sources.shift(); - if (!value) { - _this.sub = null; - if (_this.latest && - _this.latest[0] === "next") { - _this.resolve(_this.latest[1]); - } - else { - _this.resolve(); - } - (0,_iteration_js__WEBPACK_IMPORTED_MODULE_1__.iterateObserversSafely)(_this.observers, "complete"); - } - else if (isPromiseLike(value)) { - value.then(function (obs) { return _this.sub = obs.subscribe(_this.handlers); }); - } - else { - _this.sub = value.subscribe(_this.handlers); - } - } - }, - }; - _this.cancel = function (reason) { - _this.reject(reason); - _this.sources = []; - _this.handlers.complete(); - }; - _this.promise.catch(function (_) { }); - if (typeof sources === "function") { - sources = [new _Observable_js__WEBPACK_IMPORTED_MODULE_2__.Observable(sources)]; - } - if (isPromiseLike(sources)) { - sources.then(function (iterable) { return _this.start(iterable); }, _this.handlers.error); - } - else { - _this.start(sources); - } - return _this; - } - Concast.prototype.start = function (sources) { - if (this.sub !== void 0) - return; - this.sources = Array.from(sources); - this.handlers.complete(); - }; - Concast.prototype.deliverLastMessage = function (observer) { - if (this.latest) { - var nextOrError = this.latest[0]; - var method = observer[nextOrError]; - if (method) { - method.call(observer, this.latest[1]); - } - if (this.sub === null && - nextOrError === "next" && - observer.complete) { - observer.complete(); - } - } - }; - Concast.prototype.addObserver = function (observer) { - if (!this.observers.has(observer)) { - this.deliverLastMessage(observer); - this.observers.add(observer); - ++this.addCount; - } - }; - Concast.prototype.removeObserver = function (observer, quietly) { - if (this.observers.delete(observer) && - --this.addCount < 1 && - !quietly) { - this.handlers.error(new Error("Observable cancelled prematurely")); - } - }; - Concast.prototype.cleanup = function (callback) { - var _this = this; - var called = false; - var once = function () { - if (!called) { - called = true; - _this.observers.delete(observer); - callback(); - } - }; - var observer = { - next: once, - error: once, - complete: once, - }; - var count = this.addCount; - this.addObserver(observer); - this.addCount = count; - }; - return Concast; -}(_Observable_js__WEBPACK_IMPORTED_MODULE_2__.Observable)); - -(0,_subclassing_js__WEBPACK_IMPORTED_MODULE_3__.fixObservableSubclass)(Concast); -//# sourceMappingURL=Concast.js.map - -/***/ }), - -/***/ "../../node_modules/@apollo/client/utilities/observables/asyncMap.js": -/*!***************************************************************************!*\ - !*** ../../node_modules/@apollo/client/utilities/observables/asyncMap.js ***! - \***************************************************************************/ -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "asyncMap": function() { return /* binding */ asyncMap; } -/* harmony export */ }); -/* harmony import */ var _Observable_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Observable.js */ "../../node_modules/zen-observable-ts/module.js"); - -function asyncMap(observable, mapFn, catchFn) { - return new _Observable_js__WEBPACK_IMPORTED_MODULE_0__.Observable(function (observer) { - var next = observer.next, error = observer.error, complete = observer.complete; - var activeCallbackCount = 0; - var completed = false; - var promiseQueue = { - then: function (callback) { - return new Promise(function (resolve) { return resolve(callback()); }); - }, - }; - function makeCallback(examiner, delegate) { - if (examiner) { - return function (arg) { - ++activeCallbackCount; - var both = function () { return examiner(arg); }; - promiseQueue = promiseQueue.then(both, both).then(function (result) { - --activeCallbackCount; - next && next.call(observer, result); - if (completed) { - handler.complete(); - } - }, function (error) { - --activeCallbackCount; - throw error; - }).catch(function (caught) { - error && error.call(observer, caught); - }); - }; - } - else { - return function (arg) { return delegate && delegate.call(observer, arg); }; - } - } - var handler = { - next: makeCallback(mapFn, next), - error: makeCallback(catchFn, error), - complete: function () { - completed = true; - if (!activeCallbackCount) { - complete && complete.call(observer); - } - }, - }; - var sub = observable.subscribe(handler); - return function () { return sub.unsubscribe(); }; - }); -} -//# sourceMappingURL=asyncMap.js.map - -/***/ }), - -/***/ "../../node_modules/@apollo/client/utilities/observables/iteration.js": -/*!****************************************************************************!*\ - !*** ../../node_modules/@apollo/client/utilities/observables/iteration.js ***! - \****************************************************************************/ -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "iterateObserversSafely": function() { return /* binding */ iterateObserversSafely; } -/* harmony export */ }); -function iterateObserversSafely(observers, method, argument) { - var observersWithMethod = []; - observers.forEach(function (obs) { return obs[method] && observersWithMethod.push(obs); }); - observersWithMethod.forEach(function (obs) { return obs[method](argument); }); -} -//# sourceMappingURL=iteration.js.map - -/***/ }), - -/***/ "../../node_modules/@apollo/client/utilities/observables/subclassing.js": -/*!******************************************************************************!*\ - !*** ../../node_modules/@apollo/client/utilities/observables/subclassing.js ***! - \******************************************************************************/ -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "fixObservableSubclass": function() { return /* binding */ fixObservableSubclass; } -/* harmony export */ }); -/* harmony import */ var _Observable_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Observable.js */ "../../node_modules/zen-observable-ts/module.js"); -/* harmony import */ var _common_canUse_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../common/canUse.js */ "../../node_modules/@apollo/client/utilities/common/canUse.js"); - - -function fixObservableSubclass(subclass) { - function set(key) { - Object.defineProperty(subclass, key, { value: _Observable_js__WEBPACK_IMPORTED_MODULE_0__.Observable }); - } - if (_common_canUse_js__WEBPACK_IMPORTED_MODULE_1__.canUseSymbol && Symbol.species) { - set(Symbol.species); - } - set("@@species"); - return subclass; -} -//# sourceMappingURL=subclassing.js.map - -/***/ }), - -/***/ "../../node_modules/@apollo/client/version.js": -/*!****************************************************!*\ - !*** ../../node_modules/@apollo/client/version.js ***! - \****************************************************/ -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "version": function() { return /* binding */ version; } -/* harmony export */ }); -var version = '3.4.13'; -//# sourceMappingURL=version.js.map - -/***/ }), - -/***/ "../../node_modules/@welldone-software/why-did-you-render/dist/whyDidYouRender.js": -/*!****************************************************************************************!*\ - !*** ../../node_modules/@welldone-software/why-did-you-render/dist/whyDidYouRender.js ***! - \****************************************************************************************/ -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -/** - * @welldone-software/why-did-you-render 6.2.1 - * MIT Licensed - * Generated by Vitali Zaidman (https://github.com/vzaidman) - * Generated at 2021-08-22 - */ - -(function (global, factory) { - true ? module.exports = factory(__webpack_require__(/*! react */ "../../node_modules/react/index.js"), __webpack_require__(/*! lodash */ "../../node_modules/lodash/lodash.js")) : - 0; -}(this, (function (React, lodash) { 'use strict'; - - function _interopNamespace(e) { - if (e && e.__esModule) return e; - var n = Object.create(null); - if (e) { - Object.keys(e).forEach(function (k) { - if (k !== 'default') { - var d = Object.getOwnPropertyDescriptor(e, k); - Object.defineProperty(n, k, d.get ? d : { - enumerable: true, - get: function () { - return e[k]; - } - }); - } - }); - } - n['default'] = e; - return Object.freeze(n); - } - - var React__namespace = /*#__PURE__*/_interopNamespace(React); - - var wdyrStore = { - /* The React object we patch */ - React: undefined, - - /* Processed user options for WDYR */ - options: undefined, - - /* The original React.createElement function */ - origCreateElement: undefined, - - /* The original React.createFactory function */ - origCreateFactory: undefined, - - /* The original React.cloneElement function */ - origCloneElement: undefined, - - /* A weak map of all React elements to their WDYR patched react elements */ - componentsMap: new WeakMap(), - - /* A weak map of props to the owner element that passed them */ - ownerDataMap: new WeakMap(), - - /* An array of hooks tracked during one render */ - hooksPerRender: [] - }; - - function ownKeys(object, enumerableOnly) { - var keys = Object.keys(object); - - if (Object.getOwnPropertySymbols) { - var symbols = Object.getOwnPropertySymbols(object); - - if (enumerableOnly) { - symbols = symbols.filter(function (sym) { - return Object.getOwnPropertyDescriptor(object, sym).enumerable; - }); - } - - keys.push.apply(keys, symbols); - } - - return keys; - } - - function _objectSpread2(target) { - for (var i = 1; i < arguments.length; i++) { - var source = arguments[i] != null ? arguments[i] : {}; - - if (i % 2) { - ownKeys(Object(source), true).forEach(function (key) { - _defineProperty(target, key, source[key]); - }); - } else if (Object.getOwnPropertyDescriptors) { - Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); - } else { - ownKeys(Object(source)).forEach(function (key) { - Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); - }); - } - } - - return target; - } - - function _typeof(obj) { - "@babel/helpers - typeof"; - - if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { - _typeof = function (obj) { - return typeof obj; - }; - } else { - _typeof = function (obj) { - return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; - }; - } - - return _typeof(obj); - } - - function _classCallCheck(instance, Constructor) { - if (!(instance instanceof Constructor)) { - throw new TypeError("Cannot call a class as a function"); - } - } - - function _defineProperties(target, props) { - for (var i = 0; i < props.length; i++) { - var descriptor = props[i]; - descriptor.enumerable = descriptor.enumerable || false; - descriptor.configurable = true; - if ("value" in descriptor) descriptor.writable = true; - Object.defineProperty(target, descriptor.key, descriptor); - } - } - - function _createClass(Constructor, protoProps, staticProps) { - if (protoProps) _defineProperties(Constructor.prototype, protoProps); - if (staticProps) _defineProperties(Constructor, staticProps); - return Constructor; - } - - function _defineProperty(obj, key, value) { - if (key in obj) { - Object.defineProperty(obj, key, { - value: value, - enumerable: true, - configurable: true, - writable: true - }); - } else { - obj[key] = value; - } - - return obj; - } - - function _inherits(subClass, superClass) { - if (typeof superClass !== "function" && superClass !== null) { - throw new TypeError("Super expression must either be null or a function"); - } - - subClass.prototype = Object.create(superClass && superClass.prototype, { - constructor: { - value: subClass, - writable: true, - configurable: true - } - }); - if (superClass) _setPrototypeOf(subClass, superClass); - } - - function _getPrototypeOf(o) { - _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { - return o.__proto__ || Object.getPrototypeOf(o); - }; - return _getPrototypeOf(o); - } - - function _setPrototypeOf(o, p) { - _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { - o.__proto__ = p; - return o; - }; - - return _setPrototypeOf(o, p); - } - - function _isNativeReflectConstruct() { - if (typeof Reflect === "undefined" || !Reflect.construct) return false; - if (Reflect.construct.sham) return false; - if (typeof Proxy === "function") return true; - - try { - Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); - return true; - } catch (e) { - return false; - } - } - - function _assertThisInitialized(self) { - if (self === void 0) { - throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); - } - - return self; - } - - function _possibleConstructorReturn(self, call) { - if (call && (typeof call === "object" || typeof call === "function")) { - return call; - } else if (call !== void 0) { - throw new TypeError("Derived constructors may only return object or undefined"); - } - - return _assertThisInitialized(self); - } - - function _createSuper(Derived) { - var hasNativeReflectConstruct = _isNativeReflectConstruct(); - - return function _createSuperInternal() { - var Super = _getPrototypeOf(Derived), - result; - - if (hasNativeReflectConstruct) { - var NewTarget = _getPrototypeOf(this).constructor; - - result = Reflect.construct(Super, arguments, NewTarget); - } else { - result = Super.apply(this, arguments); - } - - return _possibleConstructorReturn(this, result); - }; - } - - function _superPropBase(object, property) { - while (!Object.prototype.hasOwnProperty.call(object, property)) { - object = _getPrototypeOf(object); - if (object === null) break; - } - - return object; - } - - function _get(target, property, receiver) { - if (typeof Reflect !== "undefined" && Reflect.get) { - _get = Reflect.get; - } else { - _get = function _get(target, property, receiver) { - var base = _superPropBase(target, property); - - if (!base) return; - var desc = Object.getOwnPropertyDescriptor(base, property); - - if (desc.get) { - return desc.get.call(receiver); - } - - return desc.value; - }; - } - - return _get(target, property, receiver || target); - } - - function _slicedToArray(arr, i) { - return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); - } - - function _toConsumableArray(arr) { - return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); - } - - function _arrayWithoutHoles(arr) { - if (Array.isArray(arr)) return _arrayLikeToArray(arr); - } - - function _arrayWithHoles(arr) { - if (Array.isArray(arr)) return arr; - } - - function _iterableToArray(iter) { - if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); - } - - function _iterableToArrayLimit(arr, i) { - var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; - - if (_i == null) return; - var _arr = []; - var _n = true; - var _d = false; - - var _s, _e; - - try { - for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { - _arr.push(_s.value); - - if (i && _arr.length === i) break; - } - } catch (err) { - _d = true; - _e = err; - } finally { - try { - if (!_n && _i["return"] != null) _i["return"](); - } finally { - if (_d) throw _e; - } - } - - return _arr; - } - - function _unsupportedIterableToArray(o, minLen) { - if (!o) return; - if (typeof o === "string") return _arrayLikeToArray(o, minLen); - var n = Object.prototype.toString.call(o).slice(8, -1); - if (n === "Object" && o.constructor) n = o.constructor.name; - if (n === "Map" || n === "Set") return Array.from(o); - if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); - } - - function _arrayLikeToArray(arr, len) { - if (len == null || len > arr.length) len = arr.length; - - for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; - - return arr2; - } - - function _nonIterableSpread() { - throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); - } - - function _nonIterableRest() { - throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); - } - - function _createForOfIteratorHelper(o, allowArrayLike) { - var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; - - if (!it) { - if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { - if (it) o = it; - var i = 0; - - var F = function () {}; - - return { - s: F, - n: function () { - if (i >= o.length) return { - done: true - }; - return { - done: false, - value: o[i++] - }; - }, - e: function (e) { - throw e; - }, - f: F - }; - } - - throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); - } - - var normalCompletion = true, - didErr = false, - err; - return { - s: function () { - it = it.call(o); - }, - n: function () { - var step = it.next(); - normalCompletion = step.done; - return step; - }, - e: function (e) { - didErr = true; - err = e; - }, - f: function () { - try { - if (!normalCompletion && it.return != null) it.return(); - } finally { - if (didErr) throw err; - } - } - }; - } - - var _diffTypesDescription; - - var diffTypes = { - 'different': 'different', - 'deepEquals': 'deepEquals', - 'date': 'date', - 'regex': 'regex', - 'reactElement': 'reactElement', - 'function': 'function', - 'same': 'same' - }; - var diffTypesDescriptions = (_diffTypesDescription = {}, _defineProperty(_diffTypesDescription, diffTypes.different, 'different objects'), _defineProperty(_diffTypesDescription, diffTypes.deepEquals, 'different objects that are equal by value'), _defineProperty(_diffTypesDescription, diffTypes.date, 'different date objects with the same value'), _defineProperty(_diffTypesDescription, diffTypes.regex, 'different regular expressions with the same value'), _defineProperty(_diffTypesDescription, diffTypes.reactElement, 'different React elements (remember that the syntax always produces a *NEW* immutable React element so a component that receives as props always re-renders)'), _defineProperty(_diffTypesDescription, diffTypes["function"], 'different functions with the same name'), _defineProperty(_diffTypesDescription, diffTypes.same, 'same objects by ref (===)'), _diffTypesDescription); // copied from packages/shared/ReactSymbols.js in https://github.com/facebook/react - - var hasSymbol$1 = typeof Symbol === 'function' && Symbol["for"]; - var REACT_MEMO_TYPE = hasSymbol$1 ? Symbol["for"]('react.memo') : 0xead3; - var REACT_FORWARD_REF_TYPE = hasSymbol$1 ? Symbol["for"]('react.forward_ref') : 0xead0; - - var hasElementType = typeof Element !== 'undefined'; // copied from https://github.com/facebook/react/packages/shared/ReactSymbols.js - - var hasSymbol = typeof Symbol === 'function' && Symbol["for"]; - var REACT_ELEMENT_TYPE = hasSymbol ? Symbol["for"]('react.element') : 0xeac7; - - var isReactElement = function isReactElement(object) { - return object.$$typeof === REACT_ELEMENT_TYPE; - }; // end - - - function trackDiff(a, b, diffsAccumulator, pathString, diffType) { - diffsAccumulator.push({ - diffType: diffType, - pathString: pathString, - prevValue: a, - nextValue: b - }); - return diffType !== diffTypes.different; - } - - function isGetter(obj, prop) { - return !!Object.getOwnPropertyDescriptor(obj, prop)['get']; - } - - var dependenciesMap = new WeakMap(); - - function accumulateDeepEqualDiffs(a, b, diffsAccumulator) { - var pathString = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : ''; - - var _ref = arguments.length > 4 ? arguments[4] : undefined, - detailed = _ref.detailed; - - if (a === b) { - if (detailed) { - trackDiff(a, b, diffsAccumulator, pathString, diffTypes.same); - } - - return true; - } - - if (!a || !b) { - return trackDiff(a, b, diffsAccumulator, pathString, diffTypes.different); - } - - if (lodash.isArray(a) && lodash.isArray(b)) { - var arrayLength = a.length; - - if (arrayLength !== b.length) { - return trackDiff(_toConsumableArray(a), _toConsumableArray(b), diffsAccumulator, pathString, diffTypes.different); - } - - var arrayItemDiffs = []; - var numberOfDeepEqualsItems = 0; - - for (var i = arrayLength; i--; i > 0) { - var diffEquals = accumulateDeepEqualDiffs(a[i], b[i], arrayItemDiffs, "".concat(pathString, "[").concat(i, "]"), { - detailed: detailed - }); - - if (diffEquals) { - numberOfDeepEqualsItems++; - } - } - - if (detailed || numberOfDeepEqualsItems !== arrayLength) { - diffsAccumulator.push.apply(diffsAccumulator, arrayItemDiffs); - } - - if (numberOfDeepEqualsItems === arrayLength) { - return trackDiff(_toConsumableArray(a), _toConsumableArray(b), diffsAccumulator, pathString, diffTypes.deepEquals); - } - - return trackDiff(_toConsumableArray(a), _toConsumableArray(b), diffsAccumulator, pathString, diffTypes.different); - } - - if (lodash.isSet(a) && lodash.isSet(b)) { - if (a.size !== b.size) { - return trackDiff(new Set(a), new Set(b), diffsAccumulator, pathString, diffTypes.different); - } - - var _iterator = _createForOfIteratorHelper(a), - _step; - - try { - for (_iterator.s(); !(_step = _iterator.n()).done;) { - var valA = _step.value; - - if (!b.has(valA)) { - return trackDiff(new Set(a), new Set(b), diffsAccumulator, pathString, diffTypes.different); - } - } - } catch (err) { - _iterator.e(err); - } finally { - _iterator.f(); - } - - return trackDiff(new Set(a), new Set(b), diffsAccumulator, pathString, diffTypes.deepEquals); - } - - if (lodash.isDate(a) && lodash.isDate(b)) { - return a.getTime() === b.getTime() ? trackDiff(new Date(a), new Date(b), diffsAccumulator, pathString, diffTypes.date) : trackDiff(new Date(a), new Date(b), diffsAccumulator, pathString, diffTypes.different); - } - - if (lodash.isRegExp(a) && lodash.isRegExp(b)) { - return a.toString() === b.toString() ? trackDiff(a, b, diffsAccumulator, pathString, diffTypes.regex) : trackDiff(a, b, diffsAccumulator, pathString, diffTypes.different); - } - - if (hasElementType && a instanceof Element && b instanceof Element) { - return trackDiff(a, b, diffsAccumulator, pathString, diffTypes.different); - } - - if (isReactElement(a) && isReactElement(b)) { - if (a.type !== b.type) { - return trackDiff(a, b, diffsAccumulator, pathString, diffTypes.different); - } - - var reactElementPropsAreDeepEqual = accumulateDeepEqualDiffs(a.props, b.props, [], "".concat(pathString, ".props"), { - detailed: detailed - }); - return reactElementPropsAreDeepEqual ? trackDiff(a, b, diffsAccumulator, pathString, diffTypes.reactElement) : trackDiff(a, b, diffsAccumulator, pathString, diffTypes.different); - } - - if (lodash.isFunction(a) && lodash.isFunction(b)) { - if (a.name !== b.name) { - return trackDiff(a, b, diffsAccumulator, pathString, diffTypes.different); - } - - var aDependenciesObj = dependenciesMap.get(a); - var bDependenciesObj = dependenciesMap.get(b); - - if (aDependenciesObj && bDependenciesObj) { - var dependenciesAreDeepEqual = accumulateDeepEqualDiffs(aDependenciesObj.deps, bDependenciesObj.deps, diffsAccumulator, "".concat(pathString, ":parent-hook-").concat(aDependenciesObj.hookName, "-deps"), { - detailed: detailed - }); - return dependenciesAreDeepEqual ? trackDiff(a, b, diffsAccumulator, pathString, diffTypes["function"]) : trackDiff(a, b, diffsAccumulator, pathString, diffTypes.different); - } - - return trackDiff(a, b, diffsAccumulator, pathString, diffTypes["function"]); - } - - if (_typeof(a) === 'object' && _typeof(b) === 'object' && Object.getPrototypeOf(a) === Object.getPrototypeOf(b)) { - var aKeys = Object.getOwnPropertyNames(a); - var bKeys = Object.getOwnPropertyNames(b); - var allKeys = lodash.uniq([].concat(_toConsumableArray(aKeys), _toConsumableArray(bKeys))); - var clonedA = lodash.isPlainObject(a) ? _objectSpread2({}, a) : a; - var clonedB = lodash.isPlainObject(b) ? _objectSpread2({}, b) : b; - - if (allKeys.length !== aKeys.length || allKeys.length !== bKeys.length) { - return trackDiff(clonedA, clonedB, diffsAccumulator, pathString, diffTypes.different); - } - - var relevantKeys = allKeys.filter(function (key) { - // do not compare the stack as it differ even though the errors are identical. - if (key === 'stack' && lodash.isError(a)) { - return false; - } // getters checking is causing too much problems because of how it's used in js. - // not only getters can throw errors, they also cause side effects in many cases. - - - if (isGetter(a, key)) { - return false; - } - - return true; - }); - var keysLength = relevantKeys.length; - - for (var _i = keysLength; _i--; _i > 0) { - if (!lodash.has(b, relevantKeys[_i])) { - return trackDiff(clonedA, clonedB, diffsAccumulator, pathString, diffTypes.different); - } - } - - var objectValuesDiffs = []; - var numberOfDeepEqualsObjectValues = 0; - - for (var _i2 = keysLength; _i2--; _i2 > 0) { - var key = relevantKeys[_i2]; - var deepEquals = accumulateDeepEqualDiffs(a[key], b[key], objectValuesDiffs, "".concat(pathString, ".").concat(key), { - detailed: detailed - }); - - if (deepEquals) { - numberOfDeepEqualsObjectValues++; - } - } - - if (detailed || numberOfDeepEqualsObjectValues !== keysLength) { - diffsAccumulator.push.apply(diffsAccumulator, objectValuesDiffs); - } - - if (numberOfDeepEqualsObjectValues === keysLength) { - return trackDiff(clonedA, clonedB, diffsAccumulator, pathString, diffTypes.deepEquals); - } - - return trackDiff(clonedA, clonedB, diffsAccumulator, pathString, diffTypes.different); - } - - return trackDiff(a, b, diffsAccumulator, pathString, diffTypes.different); - } - - function calculateDeepEqualDiffs(a, b, initialPathString) { - var _ref2 = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {}, - _ref2$detailed = _ref2.detailed, - detailed = _ref2$detailed === void 0 ? false : _ref2$detailed; - - try { - var diffs = []; - accumulateDeepEqualDiffs(a, b, diffs, initialPathString, { - detailed: detailed - }); - return diffs; - } catch (error) { - if (error.message && error.message.match(/stack|recursion/i) || error.number === -2146828260) { - // warn on circular references, don't crash. - // browsers throw different errors name and messages: - // chrome/safari: "RangeError", "Maximum call stack size exceeded" - // firefox: "InternalError", too much recursion" - // edge: "Error", "Out of stack space" - // eslint-disable-next-line no-console - console.warn('Warning: why-did-you-render couldn\'t handle circular references in props.', error.name, error.message); - return false; - } - - throw error; - } - } - - function printDiff(value1, value2, _ref) { - var pathString = _ref.pathString, - consoleLog = _ref.consoleLog; - var diffs = calculateDeepEqualDiffs(value1, value2, pathString, { - detailed: true - }); - var keysLength = Math.max.apply(Math, _toConsumableArray(diffs.map(function (diff) { - return diff.pathString.length; - }))) + 2; - Object.entries(lodash.groupBy(lodash.sortBy(diffs, 'pathString'), 'diffType')).forEach(function (_ref2) { - var _ref3 = _slicedToArray(_ref2, 2), - diffType = _ref3[0], - diffs = _ref3[1]; - - consoleLog("%c".concat(diffTypesDescriptions[diffType], ":"), 'text-decoration: underline; color: blue;'); - diffs.forEach(function (diff) { - consoleLog("".concat(diff.pathString, ":").padEnd(keysLength, ' '), diff.prevValue); - }); - }); - } - - var moreInfoUrl = 'http://bit.ly/wdyr02'; - var moreInfoHooksUrl = 'http://bit.ly/wdyr3'; - var inHotReload = false; - - function shouldLog(reason, Component) { - if (inHotReload) { - return false; - } - - if (wdyrStore.options.logOnDifferentValues) { - return true; - } - - if (Component.whyDidYouRender && Component.whyDidYouRender.logOnDifferentValues) { - return true; - } - - var hasDifferentValues = reason.propsDifferences && reason.propsDifferences.some(function (diff) { - return diff.diffType === diffTypes.different; - }) || reason.stateDifferences && reason.stateDifferences.some(function (diff) { - return diff.diffType === diffTypes.different; - }) || reason.hookDifferences && reason.hookDifferences.some(function (diff) { - return diff.diffType === diffTypes.different; - }); - return !hasDifferentValues; - } - - function logDifference(_ref) { - var Component = _ref.Component, - displayName = _ref.displayName, - hookName = _ref.hookName, - prefixMessage = _ref.prefixMessage, - diffObjType = _ref.diffObjType, - differences = _ref.differences, - values = _ref.values; - - if (differences && differences.length > 0) { - wdyrStore.options.consoleLog(_defineProperty({}, displayName, Component), "".concat(prefixMessage, " of ").concat(diffObjType, " changes:")); - differences.forEach(function (_ref2) { - var pathString = _ref2.pathString, - diffType = _ref2.diffType, - prevValue = _ref2.prevValue, - nextValue = _ref2.nextValue; - - function diffFn() { - printDiff(prevValue, nextValue, { - pathString: pathString, - consoleLog: wdyrStore.options.consoleLog - }); - } - - wdyrStore.options.consoleGroup("%c".concat(diffObjType === 'hook' ? "[hook ".concat(hookName, " result]") : "".concat(diffObjType, "."), "%c").concat(pathString, "%c"), "color:".concat(wdyrStore.options.diffNameColor, ";"), "color:".concat(wdyrStore.options.diffPathColor, ";"), 'color:default;'); - wdyrStore.options.consoleLog("".concat(diffTypesDescriptions[diffType], ". (more info at ").concat(hookName ? moreInfoHooksUrl : moreInfoUrl, ")")); - wdyrStore.options.consoleLog(_defineProperty({}, "prev ".concat(pathString), prevValue), '!==', _defineProperty({}, "next ".concat(pathString), nextValue)); - - if (diffType === diffTypes.deepEquals) { - wdyrStore.options.consoleLog({ - 'For detailed diff, right click the following fn, save as global, and run: ': diffFn - }); - } - - wdyrStore.options.consoleGroupEnd(); - }); - } else if (differences) { - wdyrStore.options.consoleLog(_defineProperty({}, displayName, Component), "".concat(prefixMessage, " the ").concat(diffObjType, " object itself changed but its values are all equal."), diffObjType === 'props' ? 'This could have been avoided by making the component pure, or by preventing its father from re-rendering.' : 'This usually means this component called setState when no changes in its state actually occurred.', "More info at ".concat(moreInfoUrl)); - wdyrStore.options.consoleLog("prev ".concat(diffObjType, ":"), values.prev, ' !== ', values.next, ":next ".concat(diffObjType)); - } - } - - function defaultNotifier(updateInfo) { - var Component = updateInfo.Component, - displayName = updateInfo.displayName, - hookName = updateInfo.hookName, - prevProps = updateInfo.prevProps, - prevState = updateInfo.prevState, - prevHook = updateInfo.prevHook, - nextProps = updateInfo.nextProps, - nextState = updateInfo.nextState, - nextHook = updateInfo.nextHook, - reason = updateInfo.reason; - - if (!shouldLog(reason, Component, wdyrStore.options)) { - return; - } - - wdyrStore.options.consoleGroup("%c".concat(displayName), "color: ".concat(wdyrStore.options.titleColor, ";")); - var prefixMessage = 'Re-rendered because'; - - if (reason.propsDifferences) { - logDifference({ - Component: Component, - displayName: displayName, - prefixMessage: prefixMessage, - diffObjType: 'props', - differences: reason.propsDifferences, - values: { - prev: prevProps, - next: nextProps - } - }); - prefixMessage = 'And because'; - } - - if (reason.stateDifferences) { - logDifference({ - Component: Component, - displayName: displayName, - prefixMessage: prefixMessage, - diffObjType: 'state', - differences: reason.stateDifferences, - values: { - prev: prevState, - next: nextState - } - }); - } - - if (reason.hookDifferences) { - logDifference({ - Component: Component, - displayName: displayName, - prefixMessage: prefixMessage, - diffObjType: 'hook', - differences: reason.hookDifferences, - values: { - prev: prevHook, - next: nextHook - }, - hookName: hookName - }); - } - - if (reason.propsDifferences && reason.ownerDifferences) { - var prevOwnerData = wdyrStore.ownerDataMap.get(prevProps); - var nextOwnerData = wdyrStore.ownerDataMap.get(nextProps); - wdyrStore.options.consoleGroup("Rendered by ".concat(nextOwnerData.displayName)); - var _prefixMessage = 'Re-rendered because'; - - if (reason.ownerDifferences.propsDifferences) { - logDifference({ - Component: nextOwnerData.Component, - displayName: nextOwnerData.displayName, - prefixMessage: _prefixMessage, - diffObjType: 'props', - differences: reason.ownerDifferences.propsDifferences, - values: { - prev: prevOwnerData.props, - next: nextOwnerData.props - } - }); - _prefixMessage = 'And because'; - } - - if (reason.ownerDifferences.stateDifferences) { - logDifference({ - Component: nextOwnerData.Component, - displayName: nextOwnerData.displayName, - prefixMessage: _prefixMessage, - diffObjType: 'state', - differences: reason.ownerDifferences.stateDifferences, - values: { - prev: prevOwnerData.state, - next: nextOwnerData.state - } - }); - } - - if (reason.ownerDifferences.hookDifferences) { - reason.ownerDifferences.hookDifferences.forEach(function (_ref3, i) { - var hookName = _ref3.hookName, - differences = _ref3.differences; - return logDifference({ - Component: nextOwnerData.Component, - displayName: nextOwnerData.displayName, - prefixMessage: _prefixMessage, - diffObjType: 'hook', - differences: differences, - values: { - prev: prevOwnerData.hooks[i].result, - next: nextOwnerData.hooks[i].result - }, - hookName: hookName - }); - }); - } - - wdyrStore.options.consoleGroupEnd(); - } - - if (!reason.propsDifferences && !reason.stateDifferences && !reason.hookDifferences) { - wdyrStore.options.consoleLog(_defineProperty({}, displayName, Component), 'Re-rendered although props and state objects are the same.', 'This usually means there was a call to this.forceUpdate() inside the component.', "more info at ".concat(moreInfoUrl)); - } - - wdyrStore.options.consoleGroupEnd(); - } - function createDefaultNotifier(hotReloadBufferMs) { - if (hotReloadBufferMs) { - if (false) {} - } - - return defaultNotifier; - } - - var emptyFn = function emptyFn() {}; - - function normalizeOptions() { - var userOptions = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; - var consoleGroup = console.group; - var consoleGroupEnd = console.groupEnd; - - if (userOptions.collapseGroups) { - consoleGroup = console.groupCollapsed; - } else if (userOptions.onlyLogs) { - consoleGroup = console.log; - consoleGroupEnd = emptyFn; - } - - var notifier = userOptions.notifier || createDefaultNotifier('hotReloadBufferMs' in userOptions ? userOptions.hotReloadBufferMs : 500); - return _objectSpread2({ - include: null, - exclude: null, - notifier: notifier, - onlyLogs: false, - consoleLog: console.log, - consoleGroup: consoleGroup, - consoleGroupEnd: consoleGroupEnd, - logOnDifferentValues: false, - logOwnerReasons: true, - trackHooks: true, - titleColor: '#058', - diffNameColor: 'blue', - diffPathColor: 'red', - trackExtraHooks: [], - trackAllPureComponents: false - }, userOptions); - } - - function getDisplayName(type) { - return type.displayName || type.name || type.type && getDisplayName(type.type) || type.render && getDisplayName(type.render) || (lodash.isString(type) ? type : 'Unknown'); - } - - function getDefaultProps(type) { - return type.defaultProps || type.type && getDefaultProps(type.type) || type.render && getDefaultProps(type.render) || {}; - } - - var emptyObject = {}; - function findObjectsDifferences(userPrevObj, userNextObj) { - var _ref = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}, - _ref$shallow = _ref.shallow, - shallow = _ref$shallow === void 0 ? true : _ref$shallow; - - if (userPrevObj === userNextObj) { - return false; - } - - if (!shallow) { - return calculateDeepEqualDiffs(userPrevObj, userNextObj); - } - - var prevObj = userPrevObj || emptyObject; - var nextObj = userNextObj || emptyObject; - var keysOfBothObjects = Object.keys(_objectSpread2(_objectSpread2({}, prevObj), nextObj)); - return lodash.reduce(keysOfBothObjects, function (result, key) { - var deepEqualDiffs = calculateDeepEqualDiffs(prevObj[key], nextObj[key], key); - - if (deepEqualDiffs) { - result = [].concat(_toConsumableArray(result), _toConsumableArray(deepEqualDiffs)); - } - - return result; - }, []); - } - - function getOwnerDifferences(_ref) { - var prevOwnerData = _ref.prevOwnerData, - nextOwnerData = _ref.nextOwnerData; - - if (!prevOwnerData || !nextOwnerData) { - return false; - } // in strict mode prevOwnerData might be twice as lengthy because of double renders - - - var prevOwnerDataHooks = prevOwnerData.hooks.length === nextOwnerData.hooks.length * 2 ? prevOwnerData.hooks.slice(prevOwnerData.hooks.length / 2) : prevOwnerData.hooks; - var hookDifferences = prevOwnerDataHooks.map(function (_ref2, i) { - var hookName = _ref2.hookName, - result = _ref2.result; - return { - hookName: hookName, - differences: findObjectsDifferences(result, nextOwnerData.hooks[i].result, { - shallow: false - }) - }; - }); - return { - propsDifferences: findObjectsDifferences(prevOwnerData.props, nextOwnerData.props), - stateDifferences: findObjectsDifferences(prevOwnerData.state, nextOwnerData.state), - hookDifferences: hookDifferences.length > 0 ? hookDifferences : false - }; - } - - function getUpdateReason(prevProps, prevState, prevHook, nextProps, nextState, nextHook) { - var prevOwnerData = wdyrStore.ownerDataMap.get(prevProps); - var nextOwnerData = wdyrStore.ownerDataMap.get(nextProps); - return { - propsDifferences: findObjectsDifferences(prevProps, nextProps), - stateDifferences: findObjectsDifferences(prevState, nextState), - hookDifferences: findObjectsDifferences(prevHook, nextHook, { - shallow: false - }), - ownerDifferences: getOwnerDifferences({ - prevOwnerData: prevOwnerData, - nextOwnerData: nextOwnerData - }) - }; - } - - function getUpdateInfo(_ref3) { - var Component = _ref3.Component, - displayName = _ref3.displayName, - hookName = _ref3.hookName, - prevProps = _ref3.prevProps, - prevState = _ref3.prevState, - prevHook = _ref3.prevHook, - nextProps = _ref3.nextProps, - nextState = _ref3.nextState, - nextHook = _ref3.nextHook; - return { - Component: Component, - displayName: displayName, - hookName: hookName, - prevProps: prevProps, - prevState: prevState, - prevHook: prevHook, - nextProps: nextProps, - nextState: nextState, - nextHook: nextHook, - reason: getUpdateReason(prevProps, prevState, prevHook, nextProps, nextState, nextHook) - }; - } - - // copied from https://github.com/facebook/react/blob/master/packages/react-reconciler/src/ReactTypeOfMode.js - var StrictMode = 1; // based on "findStrictRoot" from https://github.com/facebook/react/blob/master/packages/react-reconciler/src/ReactStrictModeWarnings.js - // notice: this is only used for class components. functional components doesn't render twice inside strict mode - - function checkIfInsideAStrictModeTree(reactComponentInstance) { - var reactInternalFiber = reactComponentInstance && (reactComponentInstance._reactInternalFiber || reactComponentInstance._reactInternals); - - while (reactInternalFiber) { - if (reactInternalFiber.mode & StrictMode) { - return true; - } - - reactInternalFiber = reactInternalFiber["return"]; - } - - return false; - } - function isReactClassComponent(Component) { - return Component.prototype && !!Component.prototype.isReactComponent; - } - function isMemoComponent(Component) { - return Component.$$typeof === REACT_MEMO_TYPE; - } - function isForwardRefComponent(Component) { - return Component.$$typeof === REACT_FORWARD_REF_TYPE; - } - - function shouldInclude(displayName) { - return wdyrStore.options.include && wdyrStore.options.include.length > 0 && wdyrStore.options.include.some(function (regex) { - return regex.test(displayName); - }); - } - - function shouldExclude(displayName) { - return wdyrStore.options.exclude && wdyrStore.options.exclude.length > 0 && wdyrStore.options.exclude.some(function (regex) { - return regex.test(displayName); - }); - } - - function shouldTrack(Component, _ref) { - var isHookChange = _ref.isHookChange; - var displayName = getDisplayName(Component); - - if (shouldExclude(displayName)) { - return false; - } - - if (Component.whyDidYouRender === false) { - return false; - } - - if (isHookChange && Component.whyDidYouRender && Component.whyDidYouRender.trackHooks === false) { - return false; - } - - return !!(Component.whyDidYouRender || wdyrStore.options.trackAllPureComponents && (Component && Component.prototype instanceof wdyrStore.React.PureComponent || isMemoComponent(Component)) || shouldInclude(displayName)); - } - - function patchClassComponent(ClassComponent, _ref) { - var displayName = _ref.displayName, - defaultProps = _ref.defaultProps; - - var WDYRPatchedClassComponent = /*#__PURE__*/function (_ClassComponent) { - _inherits(WDYRPatchedClassComponent, _ClassComponent); - - var _super = _createSuper(WDYRPatchedClassComponent); - - function WDYRPatchedClassComponent(props, context) { - var _thisSuper, _this; - - _classCallCheck(this, WDYRPatchedClassComponent); - - _this = _super.call(this, props, context); - _this._WDYR = { - renderNumber: 0 - }; - - var origRender = _get((_thisSuper = _assertThisInitialized(_this), _getPrototypeOf(WDYRPatchedClassComponent.prototype)), "render", _thisSuper) || _this.render; // this probably means that render is an arrow function or this.render.bind(this) was called on the original class - - - var renderIsABindedFunction = origRender !== ClassComponent.prototype.render; - - if (renderIsABindedFunction) { - _this.render = function () { - WDYRPatchedClassComponent.prototype.render.apply(_assertThisInitialized(_this)); - return origRender(); - }; - } - - return _this; - } - - _createClass(WDYRPatchedClassComponent, [{ - key: "render", - value: function render() { - this._WDYR.renderNumber++; - - if (!('isStrictMode' in this._WDYR)) { - this._WDYR.isStrictMode = checkIfInsideAStrictModeTree(this); - } // in strict mode- ignore every other render - - - if (!(this._WDYR.isStrictMode && this._WDYR.renderNumber % 2 === 1)) { - if (this._WDYR.prevProps) { - var updateInfo = getUpdateInfo({ - Component: ClassComponent, - displayName: displayName, - prevProps: this._WDYR.prevProps, - prevState: this._WDYR.prevState, - nextProps: this.props, - nextState: this.state - }); - wdyrStore.options.notifier(updateInfo); - } - - this._WDYR.prevProps = this.props; - this._WDYR.prevState = this.state; - } - - return _get(_getPrototypeOf(WDYRPatchedClassComponent.prototype), "render", this) ? _get(_getPrototypeOf(WDYRPatchedClassComponent.prototype), "render", this).call(this) : null; - } - }]); - - return WDYRPatchedClassComponent; - }(ClassComponent); - - try { - WDYRPatchedClassComponent.displayName = displayName; - } catch (e) {// not crucial if displayName couldn't be set - } - - WDYRPatchedClassComponent.defaultProps = defaultProps; - lodash.defaults(WDYRPatchedClassComponent, ClassComponent); - return WDYRPatchedClassComponent; - } - - var getFunctionalComponentFromStringComponent = function getFunctionalComponentFromStringComponent(componentTypeStr) { - return function (props) { - return wdyrStore.React.createElement(componentTypeStr, props); - }; - }; - - function patchFunctionalOrStrComponent(FunctionalOrStringComponent, _ref) { - var isPure = _ref.isPure, - displayName = _ref.displayName, - defaultProps = _ref.defaultProps; - var FunctionalComponent = typeof FunctionalOrStringComponent === 'string' ? getFunctionalComponentFromStringComponent(FunctionalOrStringComponent) : FunctionalOrStringComponent; - - function WDYRFunctionalComponent() { - var nextProps = arguments[0]; - var ref = wdyrStore.React.useRef(); - var prevProps = ref.current; - ref.current = nextProps; - - if (prevProps) { - var updateInfo = getUpdateInfo({ - Component: FunctionalComponent, - displayName: displayName, - prevProps: prevProps, - nextProps: nextProps - }); - var notifiedByHooks = !updateInfo.reason.propsDifferences || isPure && updateInfo.reason.propsDifferences.length === 0; - - if (!notifiedByHooks) { - wdyrStore.options.notifier(updateInfo); - } - } - - return FunctionalComponent.apply(void 0, arguments); - } - - try { - WDYRFunctionalComponent.displayName = displayName; - } catch (e) {// not crucial if displayName couldn't be set - } - - WDYRFunctionalComponent.defaultProps = defaultProps; - WDYRFunctionalComponent.ComponentForHooksTracking = FunctionalComponent; - lodash.defaults(WDYRFunctionalComponent, FunctionalComponent); - return WDYRFunctionalComponent; - } - - function patchMemoComponent(MemoComponent, _ref) { - var displayName = _ref.displayName, - defaultProps = _ref.defaultProps; - var InnerMemoComponent = MemoComponent.type; - var isInnerMemoComponentAClassComponent = isReactClassComponent(InnerMemoComponent); - var isInnerMemoComponentForwardRefs = isForwardRefComponent(InnerMemoComponent); - var isInnerMemoComponentAnotherMemoComponent = isMemoComponent(InnerMemoComponent); - var WrappedFunctionalComponent = isInnerMemoComponentForwardRefs ? InnerMemoComponent.render : InnerMemoComponent; - var PatchedInnerComponent = isInnerMemoComponentAClassComponent ? patchClassComponent(WrappedFunctionalComponent, { - displayName: displayName, - defaultProps: defaultProps - }) : isInnerMemoComponentAnotherMemoComponent ? patchMemoComponent(WrappedFunctionalComponent, { - displayName: displayName, - defaultProps: defaultProps - }) : patchFunctionalOrStrComponent(WrappedFunctionalComponent, { - displayName: displayName, - isPure: true - }); - - try { - PatchedInnerComponent.displayName = getDisplayName(WrappedFunctionalComponent); - } catch (e) {// not crucial if displayName couldn't be set - } - - PatchedInnerComponent.ComponentForHooksTracking = MemoComponent; - lodash.defaults(PatchedInnerComponent, WrappedFunctionalComponent); - var WDYRMemoizedFunctionalComponent = wdyrStore.React.memo(isInnerMemoComponentForwardRefs ? wdyrStore.React.forwardRef(PatchedInnerComponent) : PatchedInnerComponent, MemoComponent.compare); - - try { - WDYRMemoizedFunctionalComponent.displayName = displayName; - } catch (e) {// not crucial if displayName couldn't be set - } - - WDYRMemoizedFunctionalComponent.defaultProps = defaultProps; - lodash.defaults(WDYRMemoizedFunctionalComponent, MemoComponent); - return WDYRMemoizedFunctionalComponent; - } - - function patchForwardRefComponent(ForwardRefComponent, _ref) { - var displayName = _ref.displayName, - defaultProps = _ref.defaultProps; - var InnerForwardRefComponent = ForwardRefComponent.render; - var isInnerComponentMemoized = isMemoComponent(InnerForwardRefComponent); - var WrappedFunctionalComponent = isInnerComponentMemoized ? InnerForwardRefComponent.type : InnerForwardRefComponent; - var WDYRWrappedByReactForwardRefFunctionalComponent = patchFunctionalOrStrComponent(WrappedFunctionalComponent, { - isPure: isInnerComponentMemoized, - displayName: displayName - }); - WDYRWrappedByReactForwardRefFunctionalComponent.displayName = getDisplayName(WrappedFunctionalComponent); - WDYRWrappedByReactForwardRefFunctionalComponent.ComponentForHooksTracking = WrappedFunctionalComponent; - lodash.defaults(WDYRWrappedByReactForwardRefFunctionalComponent, WrappedFunctionalComponent); - var WDYRForwardRefFunctionalComponent = wdyrStore.React.forwardRef(isInnerComponentMemoized ? wdyrStore.React.memo(WDYRWrappedByReactForwardRefFunctionalComponent, InnerForwardRefComponent.compare) : WDYRWrappedByReactForwardRefFunctionalComponent); - - try { - WDYRForwardRefFunctionalComponent.displayName = displayName; - } catch (e) {// not crucial if displayName couldn't be set - } - - WDYRForwardRefFunctionalComponent.defaultProps = defaultProps; - lodash.defaults(WDYRForwardRefFunctionalComponent, ForwardRefComponent); - return WDYRForwardRefFunctionalComponent; - } - - var initialHookValue = Symbol('initial-hook-value'); - - function trackHookChanges(hookName, _ref, hookResult) { - var hookPath = _ref.path; - var nextHook = hookPath ? lodash.get(hookResult, hookPath) : hookResult; - var renderNumberForTheHook = wdyrStore.React.useRef(true); // TODO: improve - - var isSecondCycleOfRenders = wdyrStore.hooksPerRender[0] && wdyrStore.hooksPerRender[0].renderNumberForTheHook !== renderNumberForTheHook.current; - - if (isSecondCycleOfRenders) { - wdyrStore.hooksPerRender = []; - } - - wdyrStore.hooksPerRender.push({ - hookName: hookName, - result: nextHook, - renderNumberForTheHook: renderNumberForTheHook.current - }); - renderNumberForTheHook.current++; - var ComponentHookDispatchedFromInstance = wdyrStore.React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED && wdyrStore.React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner.current; - var prevHookRef = wdyrStore.React.useRef(initialHookValue); - - if (!ComponentHookDispatchedFromInstance) { - return hookResult; - } - - var Component = ComponentHookDispatchedFromInstance.type.ComponentForHooksTracking || ComponentHookDispatchedFromInstance.type; - var displayName = getDisplayName(Component); - var isShouldTrack = shouldTrack(Component, { - isHookChange: true - }); - - if (!isShouldTrack) { - return hookResult; - } - - var newPrevHookRef = prevHookRef.current; - prevHookRef.current = hookResult; - - if (newPrevHookRef !== initialHookValue) { - var notification = getUpdateInfo({ - Component: Component, - displayName: displayName, - hookName: hookName, - prevHook: hookPath ? lodash.get(newPrevHookRef, hookPath) : newPrevHookRef, - nextHook: nextHook - }); - - if (notification.reason.hookDifferences) { - wdyrStore.options.notifier(notification); - } - } - - return hookResult; - } - - function createPatchedComponent(Component, _ref2) { - var displayName = _ref2.displayName, - defaultProps = _ref2.defaultProps; - - if (isMemoComponent(Component)) { - return patchMemoComponent(Component, { - displayName: displayName, - defaultProps: defaultProps - }); - } - - if (isForwardRefComponent(Component)) { - return patchForwardRefComponent(Component, { - displayName: displayName, - defaultProps: defaultProps - }); - } - - if (isReactClassComponent(Component)) { - return patchClassComponent(Component, { - displayName: displayName, - defaultProps: defaultProps - }); - } - - return patchFunctionalOrStrComponent(Component, { - displayName: displayName, - defaultProps: defaultProps, - isPure: false - }); - } - - function getPatchedComponent(Component, _ref3) { - var displayName = _ref3.displayName, - defaultProps = _ref3.defaultProps; - - if (wdyrStore.componentsMap.has(Component)) { - return wdyrStore.componentsMap.get(Component); - } - - var WDYRPatchedComponent = createPatchedComponent(Component, { - displayName: displayName, - defaultProps: defaultProps - }); - wdyrStore.componentsMap.set(Component, WDYRPatchedComponent); - return WDYRPatchedComponent; - } - - function getIsSupportedComponentType(Comp) { - if (!Comp) { - return false; - } - - if (isMemoComponent(Comp)) { - return getIsSupportedComponentType(Comp.type); - } - - if (isForwardRefComponent(Comp)) { - return getIsSupportedComponentType(Comp.render); - } - - if (typeof Comp === 'function') { - return true; - } - } - - var hooksConfig = { - useState: { - path: '0' - }, - useReducer: { - path: '0' - }, - useContext: undefined, - useMemo: { - dependenciesPath: '1', - dontReport: true - }, - useCallback: { - dependenciesPath: '1', - dontReport: true - } - }; - function storeOwnerData(element) { - var OwnerInstance = wdyrStore.React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner.current; - - if (OwnerInstance) { - var Component = OwnerInstance.type.ComponentForHooksTracking || OwnerInstance.type; - var displayName = getDisplayName(Component); - var additionalOwnerData = {}; - - if (wdyrStore.options.getAdditionalOwnerData) { - additionalOwnerData = wdyrStore.options.getAdditionalOwnerData(element); - } - - wdyrStore.ownerDataMap.set(element.props, { - Component: Component, - displayName: displayName, - props: OwnerInstance.pendingProps, - state: OwnerInstance.stateNode ? OwnerInstance.stateNode.state : null, - hooks: wdyrStore.hooksPerRender, - additionalOwnerData: additionalOwnerData - }); - } - } - - function resetHooksPerRenderIfNeeded() { - // Intercept assignments to ReactCurrentOwner.current to reset hooksPerRender - var currentOwner = null; - - if (wdyrStore.React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED) { - Object.defineProperty(wdyrStore.React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, 'current', { - get: function get() { - return currentOwner; - }, - set: function set(value) { - currentOwner = value; - wdyrStore.hooksPerRender = []; - } - }); - } - } - - function trackHooksIfNeeded() { - var hooksSupported = !!wdyrStore.React.useState; - - if (wdyrStore.options.trackHooks && hooksSupported) { - var nativeHooks = Object.entries(hooksConfig).map(function (_ref4) { - var _ref5 = _slicedToArray(_ref4, 2), - hookName = _ref5[0], - hookTrackingConfig = _ref5[1]; - - return [wdyrStore.React, hookName, hookTrackingConfig]; - }); - var hooksToTrack = [].concat(_toConsumableArray(nativeHooks), _toConsumableArray(wdyrStore.options.trackExtraHooks)); - hooksToTrack.forEach(function (_ref6) { - var _ref7 = _slicedToArray(_ref6, 3), - hookParent = _ref7[0], - hookName = _ref7[1], - _ref7$ = _ref7[2], - hookTrackingConfig = _ref7$ === void 0 ? {} : _ref7$; - - var originalHook = hookParent[hookName]; - var newHookName = hookName[0].toUpperCase() + hookName.slice(1); - - var newHook = function newHook() { - for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { - args[_key] = arguments[_key]; - } - - var hookResult = originalHook.call.apply(originalHook, [this].concat(args)); - var dependenciesPath = hookTrackingConfig.dependenciesPath, - dontReport = hookTrackingConfig.dontReport; - - if (dependenciesPath && lodash.isFunction(hookResult)) { - dependenciesMap.set(hookResult, { - hookName: hookName, - deps: lodash.get(args, dependenciesPath) - }); - } - - if (!dontReport) { - trackHookChanges(hookName, hookTrackingConfig, hookResult); - } - - return hookResult; - }; - - Object.defineProperty(newHook, 'name', { - value: newHookName, - writable: false - }); - Object.assign(newHook, { - originalHook: originalHook - }); - hookParent[hookName] = newHook; - }); - } - } - - function getWDYRType(origType) { - var isShouldTrack = getIsSupportedComponentType(origType) && shouldTrack(origType, { - isHookChange: false - }); - - if (!isShouldTrack) { - return null; - } - - var displayName = origType && origType.whyDidYouRender && origType.whyDidYouRender.customName || getDisplayName(origType); - var defaultProps = getDefaultProps(origType); - var WDYRPatchedComponent = getPatchedComponent(origType, { - displayName: displayName, - defaultProps: defaultProps - }); - return WDYRPatchedComponent; - } - function whyDidYouRender(React, userOptions) { - if (React.isWDYR) { - return; - } - - Object.assign(wdyrStore, { - React: React, - options: normalizeOptions(userOptions), - origCreateElement: React.createElement, - origCreateFactory: React.createFactory, - origCloneElement: React.cloneElement, - componentsMap: new WeakMap() - }); - resetHooksPerRenderIfNeeded(); - - React.createElement = function (origType) { - var WDYRType = getWDYRType(origType); - - for (var _len2 = arguments.length, rest = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) { - rest[_key2 - 1] = arguments[_key2]; - } - - if (WDYRType) { - try { - var element = wdyrStore.origCreateElement.apply(React, [WDYRType].concat(rest)); - - if (wdyrStore.options.logOwnerReasons) { - storeOwnerData(element); - } - - return element; - } catch (e) { - wdyrStore.options.consoleLog('whyDidYouRender error. Please file a bug at https://github.com/welldone-software/why-did-you-render/issues.', { - errorInfo: { - error: e, - componentNameOrComponent: origType, - rest: rest, - options: wdyrStore.options - } - }); - } - } - - return wdyrStore.origCreateElement.apply(React, [origType].concat(rest)); - }; - - Object.assign(React.createElement, wdyrStore.origCreateElement); - - React.createFactory = function (type) { - var factory = React.createElement.bind(null, type); - factory.type = type; - return factory; - }; - - Object.assign(React.createFactory, wdyrStore.origCreateFactory); - - React.cloneElement = function () { - for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) { - args[_key3] = arguments[_key3]; - } - - var element = wdyrStore.origCloneElement.apply(React, args); - - if (wdyrStore.options.logOwnerReasons) { - storeOwnerData(element); - } - - return element; - }; - - Object.assign(React.cloneElement, wdyrStore.origCloneElement); - trackHooksIfNeeded(); - React.isWDYR = true; - - React.__REVERT_WHY_DID_YOU_RENDER__ = function () { - Object.assign(React, { - createElement: wdyrStore.origCreateElement, - createFactory: wdyrStore.origCreateFactory, - cloneElement: wdyrStore.origCloneElement - }); - wdyrStore.componentsMap = null; - var hooksToRevert = [].concat(_toConsumableArray(Object.keys(hooksConfig).map(function (hookName) { - return [React, hookName]; - })), _toConsumableArray(wdyrStore.options.trackExtraHooks)); - hooksToRevert.forEach(function (_ref8) { - var _ref9 = _slicedToArray(_ref8, 2), - hookParent = _ref9[0], - hookName = _ref9[1]; - - if (hookParent[hookName].originalHook) { - hookParent[hookName] = hookParent[hookName].originalHook; - } - }); - delete React.__REVERT_WHY_DID_YOU_RENDER__; - delete React.isWDYR; - }; - - return React; - } - - whyDidYouRender.defaultNotifier = defaultNotifier; - whyDidYouRender.wdyrStore = wdyrStore; - whyDidYouRender.storeOwnerData = storeOwnerData; - whyDidYouRender.getWDYRType = getWDYRType; - Object.assign(whyDidYouRender, React__namespace); - - return whyDidYouRender; - -}))); -//# sourceMappingURL=whyDidYouRender.js.map - - -/***/ }), - -/***/ "../../node_modules/@wry/context/lib/context.esm.js": -/*!**********************************************************!*\ - !*** ../../node_modules/@wry/context/lib/context.esm.js ***! - \**********************************************************/ -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "Slot": function() { return /* binding */ Slot; }, -/* harmony export */ "asyncFromGen": function() { return /* binding */ asyncFromGen; }, -/* harmony export */ "bind": function() { return /* binding */ bind; }, -/* harmony export */ "noContext": function() { return /* binding */ noContext; }, -/* harmony export */ "setTimeout": function() { return /* binding */ setTimeoutWithContext; }, -/* harmony export */ "wrapYieldingFiberMethods": function() { return /* binding */ wrapYieldingFiberMethods; } -/* harmony export */ }); -// This currentContext variable will only be used if the makeSlotClass -// function is called, which happens only if this is the first copy of the -// @wry/context package to be imported. -var currentContext = null; -// This unique internal object is used to denote the absence of a value -// for a given Slot, and is never exposed to outside code. -var MISSING_VALUE = {}; -var idCounter = 1; -// Although we can't do anything about the cost of duplicated code from -// accidentally bundling multiple copies of the @wry/context package, we can -// avoid creating the Slot class more than once using makeSlotClass. -var makeSlotClass = function () { return /** @class */ (function () { - function Slot() { - // If you have a Slot object, you can find out its slot.id, but you cannot - // guess the slot.id of a Slot you don't have access to, thanks to the - // randomized suffix. - this.id = [ - "slot", - idCounter++, - Date.now(), - Math.random().toString(36).slice(2), - ].join(":"); - } - Slot.prototype.hasValue = function () { - for (var context_1 = currentContext; context_1; context_1 = context_1.parent) { - // We use the Slot object iself as a key to its value, which means the - // value cannot be obtained without a reference to the Slot object. - if (this.id in context_1.slots) { - var value = context_1.slots[this.id]; - if (value === MISSING_VALUE) - break; - if (context_1 !== currentContext) { - // Cache the value in currentContext.slots so the next lookup will - // be faster. This caching is safe because the tree of contexts and - // the values of the slots are logically immutable. - currentContext.slots[this.id] = value; - } - return true; - } - } - if (currentContext) { - // If a value was not found for this Slot, it's never going to be found - // no matter how many times we look it up, so we might as well cache - // the absence of the value, too. - currentContext.slots[this.id] = MISSING_VALUE; - } - return false; - }; - Slot.prototype.getValue = function () { - if (this.hasValue()) { - return currentContext.slots[this.id]; - } - }; - Slot.prototype.withValue = function (value, callback, - // Given the prevalence of arrow functions, specifying arguments is likely - // to be much more common than specifying `this`, hence this ordering: - args, thisArg) { - var _a; - var slots = (_a = { - __proto__: null - }, - _a[this.id] = value, - _a); - var parent = currentContext; - currentContext = { parent: parent, slots: slots }; - try { - // Function.prototype.apply allows the arguments array argument to be - // omitted or undefined, so args! is fine here. - return callback.apply(thisArg, args); - } - finally { - currentContext = parent; - } - }; - // Capture the current context and wrap a callback function so that it - // reestablishes the captured context when called. - Slot.bind = function (callback) { - var context = currentContext; - return function () { - var saved = currentContext; - try { - currentContext = context; - return callback.apply(this, arguments); - } - finally { - currentContext = saved; - } - }; - }; - // Immediately run a callback function without any captured context. - Slot.noContext = function (callback, - // Given the prevalence of arrow functions, specifying arguments is likely - // to be much more common than specifying `this`, hence this ordering: - args, thisArg) { - if (currentContext) { - var saved = currentContext; - try { - currentContext = null; - // Function.prototype.apply allows the arguments array argument to be - // omitted or undefined, so args! is fine here. - return callback.apply(thisArg, args); - } - finally { - currentContext = saved; - } - } - else { - return callback.apply(thisArg, args); - } - }; - return Slot; -}()); }; -// We store a single global implementation of the Slot class as a permanent -// non-enumerable symbol property of the Array constructor. This obfuscation -// does nothing to prevent access to the Slot class, but at least it ensures -// the implementation (i.e. currentContext) cannot be tampered with, and all -// copies of the @wry/context package (hopefully just one) will share the -// same Slot implementation. Since the first copy of the @wry/context package -// to be imported wins, this technique imposes a very high cost for any -// future breaking changes to the Slot class. -var globalKey = "@wry/context:Slot"; -var host = Array; -var Slot = host[globalKey] || function () { - var Slot = makeSlotClass(); - try { - Object.defineProperty(host, globalKey, { - value: host[globalKey] = Slot, - enumerable: false, - writable: false, - configurable: false, - }); - } - finally { - return Slot; - } -}(); - -var bind = Slot.bind, noContext = Slot.noContext; -function setTimeoutWithContext(callback, delay) { - return setTimeout(bind(callback), delay); -} -// Turn any generator function into an async function (using yield instead -// of await), with context automatically preserved across yields. -function asyncFromGen(genFn) { - return function () { - var gen = genFn.apply(this, arguments); - var boundNext = bind(gen.next); - var boundThrow = bind(gen.throw); - return new Promise(function (resolve, reject) { - function invoke(method, argument) { - try { - var result = method.call(gen, argument); - } - catch (error) { - return reject(error); - } - var next = result.done ? resolve : invokeNext; - if (isPromiseLike(result.value)) { - result.value.then(next, result.done ? reject : invokeThrow); - } - else { - next(result.value); - } - } - var invokeNext = function (value) { return invoke(boundNext, value); }; - var invokeThrow = function (error) { return invoke(boundThrow, error); }; - invokeNext(); - }); - }; -} -function isPromiseLike(value) { - return value && typeof value.then === "function"; -} -// If you use the fibers npm package to implement coroutines in Node.js, -// you should call this function at least once to ensure context management -// remains coherent across any yields. -var wrappedFibers = []; -function wrapYieldingFiberMethods(Fiber) { - // There can be only one implementation of Fiber per process, so this array - // should never grow longer than one element. - if (wrappedFibers.indexOf(Fiber) < 0) { - var wrap = function (obj, method) { - var fn = obj[method]; - obj[method] = function () { - return noContext(fn, arguments, this); - }; - }; - // These methods can yield, according to - // https://github.com/laverdet/node-fibers/blob/ddebed9b8ae3883e57f822e2108e6943e5c8d2a8/fibers.js#L97-L100 - wrap(Fiber, "yield"); - wrap(Fiber.prototype, "run"); - wrap(Fiber.prototype, "throwInto"); - wrappedFibers.push(Fiber); - } - return Fiber; -} - - -//# sourceMappingURL=context.esm.js.map - - -/***/ }), - -/***/ "../../node_modules/@wry/equality/lib/equality.esm.js": -/*!************************************************************!*\ - !*** ../../node_modules/@wry/equality/lib/equality.esm.js ***! - \************************************************************/ -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "default": function() { return /* binding */ equal; }, -/* harmony export */ "equal": function() { return /* binding */ equal; } -/* harmony export */ }); -var _a = Object.prototype, toString = _a.toString, hasOwnProperty = _a.hasOwnProperty; -var fnToStr = Function.prototype.toString; -var previousComparisons = new Map(); -/** - * Performs a deep equality check on two JavaScript values, tolerating cycles. - */ -function equal(a, b) { - try { - return check(a, b); - } - finally { - previousComparisons.clear(); - } -} -function check(a, b) { - // If the two values are strictly equal, our job is easy. - if (a === b) { - return true; - } - // Object.prototype.toString returns a representation of the runtime type of - // the given value that is considerably more precise than typeof. - var aTag = toString.call(a); - var bTag = toString.call(b); - // If the runtime types of a and b are different, they could maybe be equal - // under some interpretation of equality, but for simplicity and performance - // we just return false instead. - if (aTag !== bTag) { - return false; - } - switch (aTag) { - case '[object Array]': - // Arrays are a lot like other objects, but we can cheaply compare their - // lengths as a short-cut before comparing their elements. - if (a.length !== b.length) - return false; - // Fall through to object case... - case '[object Object]': { - if (previouslyCompared(a, b)) - return true; - var aKeys = definedKeys(a); - var bKeys = definedKeys(b); - // If `a` and `b` have a different number of enumerable keys, they - // must be different. - var keyCount = aKeys.length; - if (keyCount !== bKeys.length) - return false; - // Now make sure they have the same keys. - for (var k = 0; k < keyCount; ++k) { - if (!hasOwnProperty.call(b, aKeys[k])) { - return false; - } - } - // Finally, check deep equality of all child properties. - for (var k = 0; k < keyCount; ++k) { - var key = aKeys[k]; - if (!check(a[key], b[key])) { - return false; - } - } - return true; - } - case '[object Error]': - return a.name === b.name && a.message === b.message; - case '[object Number]': - // Handle NaN, which is !== itself. - if (a !== a) - return b !== b; - // Fall through to shared +a === +b case... - case '[object Boolean]': - case '[object Date]': - return +a === +b; - case '[object RegExp]': - case '[object String]': - return a == "" + b; - case '[object Map]': - case '[object Set]': { - if (a.size !== b.size) - return false; - if (previouslyCompared(a, b)) - return true; - var aIterator = a.entries(); - var isMap = aTag === '[object Map]'; - while (true) { - var info = aIterator.next(); - if (info.done) - break; - // If a instanceof Set, aValue === aKey. - var _a = info.value, aKey = _a[0], aValue = _a[1]; - // So this works the same way for both Set and Map. - if (!b.has(aKey)) { - return false; - } - // However, we care about deep equality of values only when dealing - // with Map structures. - if (isMap && !check(aValue, b.get(aKey))) { - return false; - } - } - return true; - } - case '[object Uint16Array]': - case '[object Uint8Array]': // Buffer, in Node.js. - case '[object Uint32Array]': - case '[object Int32Array]': - case '[object Int8Array]': - case '[object Int16Array]': - case '[object ArrayBuffer]': - // DataView doesn't need these conversions, but the equality check is - // otherwise the same. - a = new Uint8Array(a); - b = new Uint8Array(b); - // Fall through... - case '[object DataView]': { - var len = a.byteLength; - if (len === b.byteLength) { - while (len-- && a[len] === b[len]) { - // Keep looping as long as the bytes are equal. - } - } - return len === -1; - } - case '[object AsyncFunction]': - case '[object GeneratorFunction]': - case '[object AsyncGeneratorFunction]': - case '[object Function]': { - var aCode = fnToStr.call(a); - if (aCode !== fnToStr.call(b)) { - return false; - } - // We consider non-native functions equal if they have the same code - // (native functions require === because their code is censored). - // Note that this behavior is not entirely sound, since !== function - // objects with the same code can behave differently depending on - // their closure scope. However, any function can behave differently - // depending on the values of its input arguments (including this) - // and its calling context (including its closure scope), even - // though the function object is === to itself; and it is entirely - // possible for functions that are not === to behave exactly the - // same under all conceivable circumstances. Because none of these - // factors are statically decidable in JavaScript, JS function - // equality is not well-defined. This ambiguity allows us to - // consider the best possible heuristic among various imperfect - // options, and equating non-native functions that have the same - // code has enormous practical benefits, such as when comparing - // functions that are repeatedly passed as fresh function - // expressions within objects that are otherwise deeply equal. Since - // any function created from the same syntactic expression (in the - // same code location) will always stringify to the same code - // according to fnToStr.call, we can reasonably expect these - // repeatedly passed function expressions to have the same code, and - // thus behave "the same" (with all the caveats mentioned above), - // even though the runtime function objects are !== to one another. - return !endsWith(aCode, nativeCodeSuffix); - } - } - // Otherwise the values are not equal. - return false; -} -function definedKeys(obj) { - // Remember that the second argument to Array.prototype.filter will be - // used as `this` within the callback function. - return Object.keys(obj).filter(isDefinedKey, obj); -} -function isDefinedKey(key) { - return this[key] !== void 0; -} -var nativeCodeSuffix = "{ [native code] }"; -function endsWith(full, suffix) { - var fromIndex = full.length - suffix.length; - return fromIndex >= 0 && - full.indexOf(suffix, fromIndex) === fromIndex; -} -function previouslyCompared(a, b) { - // Though cyclic references can make an object graph appear infinite from the - // perspective of a depth-first traversal, the graph still contains a finite - // number of distinct object references. We use the previousComparisons cache - // to avoid comparing the same pair of object references more than once, which - // guarantees termination (even if we end up comparing every object in one - // graph to every object in the other graph, which is extremely unlikely), - // while still allowing weird isomorphic structures (like rings with different - // lengths) a chance to pass the equality test. - var bSet = previousComparisons.get(a); - if (bSet) { - // Return true here because we can be sure false will be returned somewhere - // else if the objects are not equivalent. - if (bSet.has(b)) - return true; - } - else { - previousComparisons.set(a, bSet = new Set); - } - bSet.add(b); - return false; -} - - -//# sourceMappingURL=equality.esm.js.map - - -/***/ }), - -/***/ "../../node_modules/@wry/trie/lib/trie.esm.js": -/*!****************************************************!*\ - !*** ../../node_modules/@wry/trie/lib/trie.esm.js ***! - \****************************************************/ -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "Trie": function() { return /* binding */ Trie; } -/* harmony export */ }); -// A [trie](https://en.wikipedia.org/wiki/Trie) data structure that holds -// object keys weakly, yet can also hold non-object keys, unlike the -// native `WeakMap`. -// If no makeData function is supplied, the looked-up data will be an empty, -// null-prototype Object. -var defaultMakeData = function () { return Object.create(null); }; -// Useful for processing arguments objects as well as arrays. -var _a = Array.prototype, forEach = _a.forEach, slice = _a.slice; -var Trie = /** @class */ (function () { - function Trie(weakness, makeData) { - if (weakness === void 0) { weakness = true; } - if (makeData === void 0) { makeData = defaultMakeData; } - this.weakness = weakness; - this.makeData = makeData; - } - Trie.prototype.lookup = function () { - var array = []; - for (var _i = 0; _i < arguments.length; _i++) { - array[_i] = arguments[_i]; - } - return this.lookupArray(array); - }; - Trie.prototype.lookupArray = function (array) { - var node = this; - forEach.call(array, function (key) { return node = node.getChildTrie(key); }); - return node.data || (node.data = this.makeData(slice.call(array))); - }; - Trie.prototype.getChildTrie = function (key) { - var map = this.weakness && isObjRef(key) - ? this.weak || (this.weak = new WeakMap()) - : this.strong || (this.strong = new Map()); - var child = map.get(key); - if (!child) - map.set(key, child = new Trie(this.weakness, this.makeData)); - return child; - }; - return Trie; -}()); -function isObjRef(value) { - switch (typeof value) { - case "object": - if (value === null) - break; - // Fall through to return true... - case "function": - return true; - } - return false; -} - - -//# sourceMappingURL=trie.esm.js.map - - -/***/ }), - -/***/ "../../node_modules/invariant/browser.js": -/*!***********************************************!*\ - !*** ../../node_modules/invariant/browser.js ***! - \***********************************************/ -/***/ (function(module) { - -"use strict"; -/** - * Copyright (c) 2013-present, Facebook, Inc. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - - - -/** - * Use invariant() to assert state which your program assumes to be true. - * - * Provide sprintf-style format (only %s is supported) and arguments - * to provide information about what broke and what you were - * expecting. - * - * The invariant message will be stripped in production, but the invariant - * will remain to ensure logic does not differ in production. - */ - -var invariant = function(condition, format, a, b, c, d, e, f) { - if (true) { - if (format === undefined) { - throw new Error('invariant requires an error message argument'); - } - } - - if (!condition) { - var error; - if (format === undefined) { - error = new Error( - 'Minified exception occurred; use the non-minified dev environment ' + - 'for the full error message and additional helpful warnings.' - ); - } else { - var args = [a, b, c, d, e, f]; - var argIndex = 0; - error = new Error( - format.replace(/%s/g, function() { return args[argIndex++]; }) - ); - error.name = 'Invariant Violation'; - } - - error.framesToPop = 1; // we don't care about invariant's own frame - throw error; - } -}; - -module.exports = invariant; - - -/***/ }), - -/***/ "../../node_modules/lodash/lodash.js": -/*!*******************************************!*\ - !*** ../../node_modules/lodash/lodash.js ***! - \*******************************************/ -/***/ (function(module, exports, __webpack_require__) { - -/* module decorator */ module = __webpack_require__.nmd(module); -var __WEBPACK_AMD_DEFINE_RESULT__;/** - * @license - * Lodash - * Copyright OpenJS Foundation and other contributors - * Released under MIT license - * Based on Underscore.js 1.8.3 - * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors - */ -;(function() { - - /** Used as a safe reference for `undefined` in pre-ES5 environments. */ - var undefined; - - /** Used as the semantic version number. */ - var VERSION = '4.17.21'; - - /** Used as the size to enable large array optimizations. */ - var LARGE_ARRAY_SIZE = 200; - - /** Error message constants. */ - var CORE_ERROR_TEXT = 'Unsupported core-js use. Try https://npms.io/search?q=ponyfill.', - FUNC_ERROR_TEXT = 'Expected a function', - INVALID_TEMPL_VAR_ERROR_TEXT = 'Invalid `variable` option passed into `_.template`'; - - /** Used to stand-in for `undefined` hash values. */ - var HASH_UNDEFINED = '__lodash_hash_undefined__'; - - /** Used as the maximum memoize cache size. */ - var MAX_MEMOIZE_SIZE = 500; - - /** Used as the internal argument placeholder. */ - var PLACEHOLDER = '__lodash_placeholder__'; - - /** Used to compose bitmasks for cloning. */ - var CLONE_DEEP_FLAG = 1, - CLONE_FLAT_FLAG = 2, - CLONE_SYMBOLS_FLAG = 4; - - /** Used to compose bitmasks for value comparisons. */ - var COMPARE_PARTIAL_FLAG = 1, - COMPARE_UNORDERED_FLAG = 2; - - /** Used to compose bitmasks for function metadata. */ - var WRAP_BIND_FLAG = 1, - WRAP_BIND_KEY_FLAG = 2, - WRAP_CURRY_BOUND_FLAG = 4, - WRAP_CURRY_FLAG = 8, - WRAP_CURRY_RIGHT_FLAG = 16, - WRAP_PARTIAL_FLAG = 32, - WRAP_PARTIAL_RIGHT_FLAG = 64, - WRAP_ARY_FLAG = 128, - WRAP_REARG_FLAG = 256, - WRAP_FLIP_FLAG = 512; - - /** Used as default options for `_.truncate`. */ - var DEFAULT_TRUNC_LENGTH = 30, - DEFAULT_TRUNC_OMISSION = '...'; - - /** Used to detect hot functions by number of calls within a span of milliseconds. */ - var HOT_COUNT = 800, - HOT_SPAN = 16; - - /** Used to indicate the type of lazy iteratees. */ - var LAZY_FILTER_FLAG = 1, - LAZY_MAP_FLAG = 2, - LAZY_WHILE_FLAG = 3; - - /** Used as references for various `Number` constants. */ - var INFINITY = 1 / 0, - MAX_SAFE_INTEGER = 9007199254740991, - MAX_INTEGER = 1.7976931348623157e+308, - NAN = 0 / 0; - - /** Used as references for the maximum length and index of an array. */ - var MAX_ARRAY_LENGTH = 4294967295, - MAX_ARRAY_INDEX = MAX_ARRAY_LENGTH - 1, - HALF_MAX_ARRAY_LENGTH = MAX_ARRAY_LENGTH >>> 1; - - /** Used to associate wrap methods with their bit flags. */ - var wrapFlags = [ - ['ary', WRAP_ARY_FLAG], - ['bind', WRAP_BIND_FLAG], - ['bindKey', WRAP_BIND_KEY_FLAG], - ['curry', WRAP_CURRY_FLAG], - ['curryRight', WRAP_CURRY_RIGHT_FLAG], - ['flip', WRAP_FLIP_FLAG], - ['partial', WRAP_PARTIAL_FLAG], - ['partialRight', WRAP_PARTIAL_RIGHT_FLAG], - ['rearg', WRAP_REARG_FLAG] - ]; - - /** `Object#toString` result references. */ - var argsTag = '[object Arguments]', - arrayTag = '[object Array]', - asyncTag = '[object AsyncFunction]', - boolTag = '[object Boolean]', - dateTag = '[object Date]', - domExcTag = '[object DOMException]', - errorTag = '[object Error]', - funcTag = '[object Function]', - genTag = '[object GeneratorFunction]', - mapTag = '[object Map]', - numberTag = '[object Number]', - nullTag = '[object Null]', - objectTag = '[object Object]', - promiseTag = '[object Promise]', - proxyTag = '[object Proxy]', - regexpTag = '[object RegExp]', - setTag = '[object Set]', - stringTag = '[object String]', - symbolTag = '[object Symbol]', - undefinedTag = '[object Undefined]', - weakMapTag = '[object WeakMap]', - weakSetTag = '[object WeakSet]'; - - var arrayBufferTag = '[object ArrayBuffer]', - dataViewTag = '[object DataView]', - float32Tag = '[object Float32Array]', - float64Tag = '[object Float64Array]', - int8Tag = '[object Int8Array]', - int16Tag = '[object Int16Array]', - int32Tag = '[object Int32Array]', - uint8Tag = '[object Uint8Array]', - uint8ClampedTag = '[object Uint8ClampedArray]', - uint16Tag = '[object Uint16Array]', - uint32Tag = '[object Uint32Array]'; - - /** Used to match empty string literals in compiled template source. */ - var reEmptyStringLeading = /\b__p \+= '';/g, - reEmptyStringMiddle = /\b(__p \+=) '' \+/g, - reEmptyStringTrailing = /(__e\(.*?\)|\b__t\)) \+\n'';/g; - - /** Used to match HTML entities and HTML characters. */ - var reEscapedHtml = /&(?:amp|lt|gt|quot|#39);/g, - reUnescapedHtml = /[&<>"']/g, - reHasEscapedHtml = RegExp(reEscapedHtml.source), - reHasUnescapedHtml = RegExp(reUnescapedHtml.source); - - /** Used to match template delimiters. */ - var reEscape = /<%-([\s\S]+?)%>/g, - reEvaluate = /<%([\s\S]+?)%>/g, - reInterpolate = /<%=([\s\S]+?)%>/g; - - /** Used to match property names within property paths. */ - var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, - reIsPlainProp = /^\w*$/, - rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g; - - /** - * Used to match `RegExp` - * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns). - */ - var reRegExpChar = /[\\^$.*+?()[\]{}|]/g, - reHasRegExpChar = RegExp(reRegExpChar.source); - - /** Used to match leading whitespace. */ - var reTrimStart = /^\s+/; - - /** Used to match a single whitespace character. */ - var reWhitespace = /\s/; - - /** Used to match wrap detail comments. */ - var reWrapComment = /\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/, - reWrapDetails = /\{\n\/\* \[wrapped with (.+)\] \*/, - reSplitDetails = /,? & /; - - /** Used to match words composed of alphanumeric characters. */ - var reAsciiWord = /[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g; - - /** - * Used to validate the `validate` option in `_.template` variable. - * - * Forbids characters which could potentially change the meaning of the function argument definition: - * - "()," (modification of function parameters) - * - "=" (default value) - * - "[]{}" (destructuring of function parameters) - * - "/" (beginning of a comment) - * - whitespace - */ - var reForbiddenIdentifierChars = /[()=,{}\[\]\/\s]/; - - /** Used to match backslashes in property paths. */ - var reEscapeChar = /\\(\\)?/g; - - /** - * Used to match - * [ES template delimiters](http://ecma-international.org/ecma-262/7.0/#sec-template-literal-lexical-components). - */ - var reEsTemplate = /\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g; - - /** Used to match `RegExp` flags from their coerced string values. */ - var reFlags = /\w*$/; - - /** Used to detect bad signed hexadecimal string values. */ - var reIsBadHex = /^[-+]0x[0-9a-f]+$/i; - - /** Used to detect binary string values. */ - var reIsBinary = /^0b[01]+$/i; - - /** Used to detect host constructors (Safari). */ - var reIsHostCtor = /^\[object .+?Constructor\]$/; - - /** Used to detect octal string values. */ - var reIsOctal = /^0o[0-7]+$/i; - - /** Used to detect unsigned integer values. */ - var reIsUint = /^(?:0|[1-9]\d*)$/; - - /** Used to match Latin Unicode letters (excluding mathematical operators). */ - var reLatin = /[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g; - - /** Used to ensure capturing order of template delimiters. */ - var reNoMatch = /($^)/; - - /** Used to match unescaped characters in compiled string literals. */ - var reUnescapedString = /['\n\r\u2028\u2029\\]/g; - - /** Used to compose unicode character classes. */ - var rsAstralRange = '\\ud800-\\udfff', - rsComboMarksRange = '\\u0300-\\u036f', - reComboHalfMarksRange = '\\ufe20-\\ufe2f', - rsComboSymbolsRange = '\\u20d0-\\u20ff', - rsComboRange = rsComboMarksRange + reComboHalfMarksRange + rsComboSymbolsRange, - rsDingbatRange = '\\u2700-\\u27bf', - rsLowerRange = 'a-z\\xdf-\\xf6\\xf8-\\xff', - rsMathOpRange = '\\xac\\xb1\\xd7\\xf7', - rsNonCharRange = '\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf', - rsPunctuationRange = '\\u2000-\\u206f', - rsSpaceRange = ' \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000', - rsUpperRange = 'A-Z\\xc0-\\xd6\\xd8-\\xde', - rsVarRange = '\\ufe0e\\ufe0f', - rsBreakRange = rsMathOpRange + rsNonCharRange + rsPunctuationRange + rsSpaceRange; - - /** Used to compose unicode capture groups. */ - var rsApos = "['\u2019]", - rsAstral = '[' + rsAstralRange + ']', - rsBreak = '[' + rsBreakRange + ']', - rsCombo = '[' + rsComboRange + ']', - rsDigits = '\\d+', - rsDingbat = '[' + rsDingbatRange + ']', - rsLower = '[' + rsLowerRange + ']', - rsMisc = '[^' + rsAstralRange + rsBreakRange + rsDigits + rsDingbatRange + rsLowerRange + rsUpperRange + ']', - rsFitz = '\\ud83c[\\udffb-\\udfff]', - rsModifier = '(?:' + rsCombo + '|' + rsFitz + ')', - rsNonAstral = '[^' + rsAstralRange + ']', - rsRegional = '(?:\\ud83c[\\udde6-\\uddff]){2}', - rsSurrPair = '[\\ud800-\\udbff][\\udc00-\\udfff]', - rsUpper = '[' + rsUpperRange + ']', - rsZWJ = '\\u200d'; - - /** Used to compose unicode regexes. */ - var rsMiscLower = '(?:' + rsLower + '|' + rsMisc + ')', - rsMiscUpper = '(?:' + rsUpper + '|' + rsMisc + ')', - rsOptContrLower = '(?:' + rsApos + '(?:d|ll|m|re|s|t|ve))?', - rsOptContrUpper = '(?:' + rsApos + '(?:D|LL|M|RE|S|T|VE))?', - reOptMod = rsModifier + '?', - rsOptVar = '[' + rsVarRange + ']?', - rsOptJoin = '(?:' + rsZWJ + '(?:' + [rsNonAstral, rsRegional, rsSurrPair].join('|') + ')' + rsOptVar + reOptMod + ')*', - rsOrdLower = '\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])', - rsOrdUpper = '\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])', - rsSeq = rsOptVar + reOptMod + rsOptJoin, - rsEmoji = '(?:' + [rsDingbat, rsRegional, rsSurrPair].join('|') + ')' + rsSeq, - rsSymbol = '(?:' + [rsNonAstral + rsCombo + '?', rsCombo, rsRegional, rsSurrPair, rsAstral].join('|') + ')'; - - /** Used to match apostrophes. */ - var reApos = RegExp(rsApos, 'g'); - - /** - * Used to match [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks) and - * [combining diacritical marks for symbols](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks_for_Symbols). - */ - var reComboMark = RegExp(rsCombo, 'g'); - - /** Used to match [string symbols](https://mathiasbynens.be/notes/javascript-unicode). */ - var reUnicode = RegExp(rsFitz + '(?=' + rsFitz + ')|' + rsSymbol + rsSeq, 'g'); - - /** Used to match complex or compound words. */ - var reUnicodeWord = RegExp([ - rsUpper + '?' + rsLower + '+' + rsOptContrLower + '(?=' + [rsBreak, rsUpper, '$'].join('|') + ')', - rsMiscUpper + '+' + rsOptContrUpper + '(?=' + [rsBreak, rsUpper + rsMiscLower, '$'].join('|') + ')', - rsUpper + '?' + rsMiscLower + '+' + rsOptContrLower, - rsUpper + '+' + rsOptContrUpper, - rsOrdUpper, - rsOrdLower, - rsDigits, - rsEmoji - ].join('|'), 'g'); - - /** Used to detect strings with [zero-width joiners or code points from the astral planes](http://eev.ee/blog/2015/09/12/dark-corners-of-unicode/). */ - var reHasUnicode = RegExp('[' + rsZWJ + rsAstralRange + rsComboRange + rsVarRange + ']'); - - /** Used to detect strings that need a more robust regexp to match words. */ - var reHasUnicodeWord = /[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/; - - /** Used to assign default `context` object properties. */ - var contextProps = [ - 'Array', 'Buffer', 'DataView', 'Date', 'Error', 'Float32Array', 'Float64Array', - 'Function', 'Int8Array', 'Int16Array', 'Int32Array', 'Map', 'Math', 'Object', - 'Promise', 'RegExp', 'Set', 'String', 'Symbol', 'TypeError', 'Uint8Array', - 'Uint8ClampedArray', 'Uint16Array', 'Uint32Array', 'WeakMap', - '_', 'clearTimeout', 'isFinite', 'parseInt', 'setTimeout' - ]; - - /** Used to make template sourceURLs easier to identify. */ - var templateCounter = -1; - - /** Used to identify `toStringTag` values of typed arrays. */ - var typedArrayTags = {}; - typedArrayTags[float32Tag] = typedArrayTags[float64Tag] = - typedArrayTags[int8Tag] = typedArrayTags[int16Tag] = - typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] = - typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] = - typedArrayTags[uint32Tag] = true; - typedArrayTags[argsTag] = typedArrayTags[arrayTag] = - typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] = - typedArrayTags[dataViewTag] = typedArrayTags[dateTag] = - typedArrayTags[errorTag] = typedArrayTags[funcTag] = - typedArrayTags[mapTag] = typedArrayTags[numberTag] = - typedArrayTags[objectTag] = typedArrayTags[regexpTag] = - typedArrayTags[setTag] = typedArrayTags[stringTag] = - typedArrayTags[weakMapTag] = false; - - /** Used to identify `toStringTag` values supported by `_.clone`. */ - var cloneableTags = {}; - cloneableTags[argsTag] = cloneableTags[arrayTag] = - cloneableTags[arrayBufferTag] = cloneableTags[dataViewTag] = - cloneableTags[boolTag] = cloneableTags[dateTag] = - cloneableTags[float32Tag] = cloneableTags[float64Tag] = - cloneableTags[int8Tag] = cloneableTags[int16Tag] = - cloneableTags[int32Tag] = cloneableTags[mapTag] = - cloneableTags[numberTag] = cloneableTags[objectTag] = - cloneableTags[regexpTag] = cloneableTags[setTag] = - cloneableTags[stringTag] = cloneableTags[symbolTag] = - cloneableTags[uint8Tag] = cloneableTags[uint8ClampedTag] = - cloneableTags[uint16Tag] = cloneableTags[uint32Tag] = true; - cloneableTags[errorTag] = cloneableTags[funcTag] = - cloneableTags[weakMapTag] = false; - - /** Used to map Latin Unicode letters to basic Latin letters. */ - var deburredLetters = { - // Latin-1 Supplement block. - '\xc0': 'A', '\xc1': 'A', '\xc2': 'A', '\xc3': 'A', '\xc4': 'A', '\xc5': 'A', - '\xe0': 'a', '\xe1': 'a', '\xe2': 'a', '\xe3': 'a', '\xe4': 'a', '\xe5': 'a', - '\xc7': 'C', '\xe7': 'c', - '\xd0': 'D', '\xf0': 'd', - '\xc8': 'E', '\xc9': 'E', '\xca': 'E', '\xcb': 'E', - '\xe8': 'e', '\xe9': 'e', '\xea': 'e', '\xeb': 'e', - '\xcc': 'I', '\xcd': 'I', '\xce': 'I', '\xcf': 'I', - '\xec': 'i', '\xed': 'i', '\xee': 'i', '\xef': 'i', - '\xd1': 'N', '\xf1': 'n', - '\xd2': 'O', '\xd3': 'O', '\xd4': 'O', '\xd5': 'O', '\xd6': 'O', '\xd8': 'O', - '\xf2': 'o', '\xf3': 'o', '\xf4': 'o', '\xf5': 'o', '\xf6': 'o', '\xf8': 'o', - '\xd9': 'U', '\xda': 'U', '\xdb': 'U', '\xdc': 'U', - '\xf9': 'u', '\xfa': 'u', '\xfb': 'u', '\xfc': 'u', - '\xdd': 'Y', '\xfd': 'y', '\xff': 'y', - '\xc6': 'Ae', '\xe6': 'ae', - '\xde': 'Th', '\xfe': 'th', - '\xdf': 'ss', - // Latin Extended-A block. - '\u0100': 'A', '\u0102': 'A', '\u0104': 'A', - '\u0101': 'a', '\u0103': 'a', '\u0105': 'a', - '\u0106': 'C', '\u0108': 'C', '\u010a': 'C', '\u010c': 'C', - '\u0107': 'c', '\u0109': 'c', '\u010b': 'c', '\u010d': 'c', - '\u010e': 'D', '\u0110': 'D', '\u010f': 'd', '\u0111': 'd', - '\u0112': 'E', '\u0114': 'E', '\u0116': 'E', '\u0118': 'E', '\u011a': 'E', - '\u0113': 'e', '\u0115': 'e', '\u0117': 'e', '\u0119': 'e', '\u011b': 'e', - '\u011c': 'G', '\u011e': 'G', '\u0120': 'G', '\u0122': 'G', - '\u011d': 'g', '\u011f': 'g', '\u0121': 'g', '\u0123': 'g', - '\u0124': 'H', '\u0126': 'H', '\u0125': 'h', '\u0127': 'h', - '\u0128': 'I', '\u012a': 'I', '\u012c': 'I', '\u012e': 'I', '\u0130': 'I', - '\u0129': 'i', '\u012b': 'i', '\u012d': 'i', '\u012f': 'i', '\u0131': 'i', - '\u0134': 'J', '\u0135': 'j', - '\u0136': 'K', '\u0137': 'k', '\u0138': 'k', - '\u0139': 'L', '\u013b': 'L', '\u013d': 'L', '\u013f': 'L', '\u0141': 'L', - '\u013a': 'l', '\u013c': 'l', '\u013e': 'l', '\u0140': 'l', '\u0142': 'l', - '\u0143': 'N', '\u0145': 'N', '\u0147': 'N', '\u014a': 'N', - '\u0144': 'n', '\u0146': 'n', '\u0148': 'n', '\u014b': 'n', - '\u014c': 'O', '\u014e': 'O', '\u0150': 'O', - '\u014d': 'o', '\u014f': 'o', '\u0151': 'o', - '\u0154': 'R', '\u0156': 'R', '\u0158': 'R', - '\u0155': 'r', '\u0157': 'r', '\u0159': 'r', - '\u015a': 'S', '\u015c': 'S', '\u015e': 'S', '\u0160': 'S', - '\u015b': 's', '\u015d': 's', '\u015f': 's', '\u0161': 's', - '\u0162': 'T', '\u0164': 'T', '\u0166': 'T', - '\u0163': 't', '\u0165': 't', '\u0167': 't', - '\u0168': 'U', '\u016a': 'U', '\u016c': 'U', '\u016e': 'U', '\u0170': 'U', '\u0172': 'U', - '\u0169': 'u', '\u016b': 'u', '\u016d': 'u', '\u016f': 'u', '\u0171': 'u', '\u0173': 'u', - '\u0174': 'W', '\u0175': 'w', - '\u0176': 'Y', '\u0177': 'y', '\u0178': 'Y', - '\u0179': 'Z', '\u017b': 'Z', '\u017d': 'Z', - '\u017a': 'z', '\u017c': 'z', '\u017e': 'z', - '\u0132': 'IJ', '\u0133': 'ij', - '\u0152': 'Oe', '\u0153': 'oe', - '\u0149': "'n", '\u017f': 's' - }; - - /** Used to map characters to HTML entities. */ - var htmlEscapes = { - '&': '&', - '<': '<', - '>': '>', - '"': '"', - "'": ''' - }; - - /** Used to map HTML entities to characters. */ - var htmlUnescapes = { - '&': '&', - '<': '<', - '>': '>', - '"': '"', - ''': "'" - }; - - /** Used to escape characters for inclusion in compiled string literals. */ - var stringEscapes = { - '\\': '\\', - "'": "'", - '\n': 'n', - '\r': 'r', - '\u2028': 'u2028', - '\u2029': 'u2029' - }; - - /** Built-in method references without a dependency on `root`. */ - var freeParseFloat = parseFloat, - freeParseInt = parseInt; - - /** Detect free variable `global` from Node.js. */ - var freeGlobal = typeof __webpack_require__.g == 'object' && __webpack_require__.g && __webpack_require__.g.Object === Object && __webpack_require__.g; - - /** Detect free variable `self`. */ - var freeSelf = typeof self == 'object' && self && self.Object === Object && self; - - /** Used as a reference to the global object. */ - var root = freeGlobal || freeSelf || Function('return this')(); - - /** Detect free variable `exports`. */ - var freeExports = true && exports && !exports.nodeType && exports; - - /** Detect free variable `module`. */ - var freeModule = freeExports && "object" == 'object' && module && !module.nodeType && module; - - /** Detect the popular CommonJS extension `module.exports`. */ - var moduleExports = freeModule && freeModule.exports === freeExports; - - /** Detect free variable `process` from Node.js. */ - var freeProcess = moduleExports && freeGlobal.process; - - /** Used to access faster Node.js helpers. */ - var nodeUtil = (function() { - try { - // Use `util.types` for Node.js 10+. - var types = freeModule && freeModule.require && freeModule.require('util').types; - - if (types) { - return types; - } - - // Legacy `process.binding('util')` for Node.js < 10. - return freeProcess && freeProcess.binding && freeProcess.binding('util'); - } catch (e) {} - }()); - - /* Node.js helper references. */ - var nodeIsArrayBuffer = nodeUtil && nodeUtil.isArrayBuffer, - nodeIsDate = nodeUtil && nodeUtil.isDate, - nodeIsMap = nodeUtil && nodeUtil.isMap, - nodeIsRegExp = nodeUtil && nodeUtil.isRegExp, - nodeIsSet = nodeUtil && nodeUtil.isSet, - nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray; - - /*--------------------------------------------------------------------------*/ - - /** - * A faster alternative to `Function#apply`, this function invokes `func` - * with the `this` binding of `thisArg` and the arguments of `args`. - * - * @private - * @param {Function} func The function to invoke. - * @param {*} thisArg The `this` binding of `func`. - * @param {Array} args The arguments to invoke `func` with. - * @returns {*} Returns the result of `func`. - */ - function apply(func, thisArg, args) { - switch (args.length) { - case 0: return func.call(thisArg); - case 1: return func.call(thisArg, args[0]); - case 2: return func.call(thisArg, args[0], args[1]); - case 3: return func.call(thisArg, args[0], args[1], args[2]); - } - return func.apply(thisArg, args); - } - - /** - * A specialized version of `baseAggregator` for arrays. - * - * @private - * @param {Array} [array] The array to iterate over. - * @param {Function} setter The function to set `accumulator` values. - * @param {Function} iteratee The iteratee to transform keys. - * @param {Object} accumulator The initial aggregated object. - * @returns {Function} Returns `accumulator`. - */ - function arrayAggregator(array, setter, iteratee, accumulator) { - var index = -1, - length = array == null ? 0 : array.length; - - while (++index < length) { - var value = array[index]; - setter(accumulator, value, iteratee(value), array); - } - return accumulator; - } - - /** - * A specialized version of `_.forEach` for arrays without support for - * iteratee shorthands. - * - * @private - * @param {Array} [array] The array to iterate over. - * @param {Function} iteratee The function invoked per iteration. - * @returns {Array} Returns `array`. - */ - function arrayEach(array, iteratee) { - var index = -1, - length = array == null ? 0 : array.length; - - while (++index < length) { - if (iteratee(array[index], index, array) === false) { - break; - } - } - return array; - } - - /** - * A specialized version of `_.forEachRight` for arrays without support for - * iteratee shorthands. - * - * @private - * @param {Array} [array] The array to iterate over. - * @param {Function} iteratee The function invoked per iteration. - * @returns {Array} Returns `array`. - */ - function arrayEachRight(array, iteratee) { - var length = array == null ? 0 : array.length; - - while (length--) { - if (iteratee(array[length], length, array) === false) { - break; - } - } - return array; - } - - /** - * A specialized version of `_.every` for arrays without support for - * iteratee shorthands. - * - * @private - * @param {Array} [array] The array to iterate over. - * @param {Function} predicate The function invoked per iteration. - * @returns {boolean} Returns `true` if all elements pass the predicate check, - * else `false`. - */ - function arrayEvery(array, predicate) { - var index = -1, - length = array == null ? 0 : array.length; - - while (++index < length) { - if (!predicate(array[index], index, array)) { - return false; - } - } - return true; - } - - /** - * A specialized version of `_.filter` for arrays without support for - * iteratee shorthands. - * - * @private - * @param {Array} [array] The array to iterate over. - * @param {Function} predicate The function invoked per iteration. - * @returns {Array} Returns the new filtered array. - */ - function arrayFilter(array, predicate) { - var index = -1, - length = array == null ? 0 : array.length, - resIndex = 0, - result = []; - - while (++index < length) { - var value = array[index]; - if (predicate(value, index, array)) { - result[resIndex++] = value; - } - } - return result; - } - - /** - * A specialized version of `_.includes` for arrays without support for - * specifying an index to search from. - * - * @private - * @param {Array} [array] The array to inspect. - * @param {*} target The value to search for. - * @returns {boolean} Returns `true` if `target` is found, else `false`. - */ - function arrayIncludes(array, value) { - var length = array == null ? 0 : array.length; - return !!length && baseIndexOf(array, value, 0) > -1; - } - - /** - * This function is like `arrayIncludes` except that it accepts a comparator. - * - * @private - * @param {Array} [array] The array to inspect. - * @param {*} target The value to search for. - * @param {Function} comparator The comparator invoked per element. - * @returns {boolean} Returns `true` if `target` is found, else `false`. - */ - function arrayIncludesWith(array, value, comparator) { - var index = -1, - length = array == null ? 0 : array.length; - - while (++index < length) { - if (comparator(value, array[index])) { - return true; - } - } - return false; - } - - /** - * A specialized version of `_.map` for arrays without support for iteratee - * shorthands. - * - * @private - * @param {Array} [array] The array to iterate over. - * @param {Function} iteratee The function invoked per iteration. - * @returns {Array} Returns the new mapped array. - */ - function arrayMap(array, iteratee) { - var index = -1, - length = array == null ? 0 : array.length, - result = Array(length); - - while (++index < length) { - result[index] = iteratee(array[index], index, array); - } - return result; - } - - /** - * Appends the elements of `values` to `array`. - * - * @private - * @param {Array} array The array to modify. - * @param {Array} values The values to append. - * @returns {Array} Returns `array`. - */ - function arrayPush(array, values) { - var index = -1, - length = values.length, - offset = array.length; - - while (++index < length) { - array[offset + index] = values[index]; - } - return array; - } - - /** - * A specialized version of `_.reduce` for arrays without support for - * iteratee shorthands. - * - * @private - * @param {Array} [array] The array to iterate over. - * @param {Function} iteratee The function invoked per iteration. - * @param {*} [accumulator] The initial value. - * @param {boolean} [initAccum] Specify using the first element of `array` as - * the initial value. - * @returns {*} Returns the accumulated value. - */ - function arrayReduce(array, iteratee, accumulator, initAccum) { - var index = -1, - length = array == null ? 0 : array.length; - - if (initAccum && length) { - accumulator = array[++index]; - } - while (++index < length) { - accumulator = iteratee(accumulator, array[index], index, array); - } - return accumulator; - } - - /** - * A specialized version of `_.reduceRight` for arrays without support for - * iteratee shorthands. - * - * @private - * @param {Array} [array] The array to iterate over. - * @param {Function} iteratee The function invoked per iteration. - * @param {*} [accumulator] The initial value. - * @param {boolean} [initAccum] Specify using the last element of `array` as - * the initial value. - * @returns {*} Returns the accumulated value. - */ - function arrayReduceRight(array, iteratee, accumulator, initAccum) { - var length = array == null ? 0 : array.length; - if (initAccum && length) { - accumulator = array[--length]; - } - while (length--) { - accumulator = iteratee(accumulator, array[length], length, array); - } - return accumulator; - } - - /** - * A specialized version of `_.some` for arrays without support for iteratee - * shorthands. - * - * @private - * @param {Array} [array] The array to iterate over. - * @param {Function} predicate The function invoked per iteration. - * @returns {boolean} Returns `true` if any element passes the predicate check, - * else `false`. - */ - function arraySome(array, predicate) { - var index = -1, - length = array == null ? 0 : array.length; - - while (++index < length) { - if (predicate(array[index], index, array)) { - return true; - } - } - return false; - } - - /** - * Gets the size of an ASCII `string`. - * - * @private - * @param {string} string The string inspect. - * @returns {number} Returns the string size. - */ - var asciiSize = baseProperty('length'); - - /** - * Converts an ASCII `string` to an array. - * - * @private - * @param {string} string The string to convert. - * @returns {Array} Returns the converted array. - */ - function asciiToArray(string) { - return string.split(''); - } - - /** - * Splits an ASCII `string` into an array of its words. - * - * @private - * @param {string} The string to inspect. - * @returns {Array} Returns the words of `string`. - */ - function asciiWords(string) { - return string.match(reAsciiWord) || []; - } - - /** - * The base implementation of methods like `_.findKey` and `_.findLastKey`, - * without support for iteratee shorthands, which iterates over `collection` - * using `eachFunc`. - * - * @private - * @param {Array|Object} collection The collection to inspect. - * @param {Function} predicate The function invoked per iteration. - * @param {Function} eachFunc The function to iterate over `collection`. - * @returns {*} Returns the found element or its key, else `undefined`. - */ - function baseFindKey(collection, predicate, eachFunc) { - var result; - eachFunc(collection, function(value, key, collection) { - if (predicate(value, key, collection)) { - result = key; - return false; - } - }); - return result; - } - - /** - * The base implementation of `_.findIndex` and `_.findLastIndex` without - * support for iteratee shorthands. - * - * @private - * @param {Array} array The array to inspect. - * @param {Function} predicate The function invoked per iteration. - * @param {number} fromIndex The index to search from. - * @param {boolean} [fromRight] Specify iterating from right to left. - * @returns {number} Returns the index of the matched value, else `-1`. - */ - function baseFindIndex(array, predicate, fromIndex, fromRight) { - var length = array.length, - index = fromIndex + (fromRight ? 1 : -1); - - while ((fromRight ? index-- : ++index < length)) { - if (predicate(array[index], index, array)) { - return index; - } - } - return -1; - } - - /** - * The base implementation of `_.indexOf` without `fromIndex` bounds checks. - * - * @private - * @param {Array} array The array to inspect. - * @param {*} value The value to search for. - * @param {number} fromIndex The index to search from. - * @returns {number} Returns the index of the matched value, else `-1`. - */ - function baseIndexOf(array, value, fromIndex) { - return value === value - ? strictIndexOf(array, value, fromIndex) - : baseFindIndex(array, baseIsNaN, fromIndex); - } - - /** - * This function is like `baseIndexOf` except that it accepts a comparator. - * - * @private - * @param {Array} array The array to inspect. - * @param {*} value The value to search for. - * @param {number} fromIndex The index to search from. - * @param {Function} comparator The comparator invoked per element. - * @returns {number} Returns the index of the matched value, else `-1`. - */ - function baseIndexOfWith(array, value, fromIndex, comparator) { - var index = fromIndex - 1, - length = array.length; - - while (++index < length) { - if (comparator(array[index], value)) { - return index; - } - } - return -1; - } - - /** - * The base implementation of `_.isNaN` without support for number objects. - * - * @private - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is `NaN`, else `false`. - */ - function baseIsNaN(value) { - return value !== value; - } - - /** - * The base implementation of `_.mean` and `_.meanBy` without support for - * iteratee shorthands. - * - * @private - * @param {Array} array The array to iterate over. - * @param {Function} iteratee The function invoked per iteration. - * @returns {number} Returns the mean. - */ - function baseMean(array, iteratee) { - var length = array == null ? 0 : array.length; - return length ? (baseSum(array, iteratee) / length) : NAN; - } - - /** - * The base implementation of `_.property` without support for deep paths. - * - * @private - * @param {string} key The key of the property to get. - * @returns {Function} Returns the new accessor function. - */ - function baseProperty(key) { - return function(object) { - return object == null ? undefined : object[key]; - }; - } - - /** - * The base implementation of `_.propertyOf` without support for deep paths. - * - * @private - * @param {Object} object The object to query. - * @returns {Function} Returns the new accessor function. - */ - function basePropertyOf(object) { - return function(key) { - return object == null ? undefined : object[key]; - }; - } - - /** - * The base implementation of `_.reduce` and `_.reduceRight`, without support - * for iteratee shorthands, which iterates over `collection` using `eachFunc`. - * - * @private - * @param {Array|Object} collection The collection to iterate over. - * @param {Function} iteratee The function invoked per iteration. - * @param {*} accumulator The initial value. - * @param {boolean} initAccum Specify using the first or last element of - * `collection` as the initial value. - * @param {Function} eachFunc The function to iterate over `collection`. - * @returns {*} Returns the accumulated value. - */ - function baseReduce(collection, iteratee, accumulator, initAccum, eachFunc) { - eachFunc(collection, function(value, index, collection) { - accumulator = initAccum - ? (initAccum = false, value) - : iteratee(accumulator, value, index, collection); - }); - return accumulator; - } - - /** - * The base implementation of `_.sortBy` which uses `comparer` to define the - * sort order of `array` and replaces criteria objects with their corresponding - * values. - * - * @private - * @param {Array} array The array to sort. - * @param {Function} comparer The function to define sort order. - * @returns {Array} Returns `array`. - */ - function baseSortBy(array, comparer) { - var length = array.length; - - array.sort(comparer); - while (length--) { - array[length] = array[length].value; - } - return array; - } - - /** - * The base implementation of `_.sum` and `_.sumBy` without support for - * iteratee shorthands. - * - * @private - * @param {Array} array The array to iterate over. - * @param {Function} iteratee The function invoked per iteration. - * @returns {number} Returns the sum. - */ - function baseSum(array, iteratee) { - var result, - index = -1, - length = array.length; - - while (++index < length) { - var current = iteratee(array[index]); - if (current !== undefined) { - result = result === undefined ? current : (result + current); - } - } - return result; - } - - /** - * The base implementation of `_.times` without support for iteratee shorthands - * or max array length checks. - * - * @private - * @param {number} n The number of times to invoke `iteratee`. - * @param {Function} iteratee The function invoked per iteration. - * @returns {Array} Returns the array of results. - */ - function baseTimes(n, iteratee) { - var index = -1, - result = Array(n); - - while (++index < n) { - result[index] = iteratee(index); - } - return result; - } - - /** - * The base implementation of `_.toPairs` and `_.toPairsIn` which creates an array - * of key-value pairs for `object` corresponding to the property names of `props`. - * - * @private - * @param {Object} object The object to query. - * @param {Array} props The property names to get values for. - * @returns {Object} Returns the key-value pairs. - */ - function baseToPairs(object, props) { - return arrayMap(props, function(key) { - return [key, object[key]]; - }); - } - - /** - * The base implementation of `_.trim`. - * - * @private - * @param {string} string The string to trim. - * @returns {string} Returns the trimmed string. - */ - function baseTrim(string) { - return string - ? string.slice(0, trimmedEndIndex(string) + 1).replace(reTrimStart, '') - : string; - } - - /** - * The base implementation of `_.unary` without support for storing metadata. - * - * @private - * @param {Function} func The function to cap arguments for. - * @returns {Function} Returns the new capped function. - */ - function baseUnary(func) { - return function(value) { - return func(value); - }; - } - - /** - * 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) { - return arrayMap(props, function(key) { - return object[key]; - }); - } - - /** - * Checks if a `cache` value for `key` exists. - * - * @private - * @param {Object} cache The cache to query. - * @param {string} key The key of the entry to check. - * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. - */ - function cacheHas(cache, key) { - return cache.has(key); - } - - /** - * Used by `_.trim` and `_.trimStart` to get the index of the first string symbol - * that is not found in the character symbols. - * - * @private - * @param {Array} strSymbols The string symbols to inspect. - * @param {Array} chrSymbols The character symbols to find. - * @returns {number} Returns the index of the first unmatched string symbol. - */ - function charsStartIndex(strSymbols, chrSymbols) { - var index = -1, - length = strSymbols.length; - - while (++index < length && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {} - return index; - } - - /** - * Used by `_.trim` and `_.trimEnd` to get the index of the last string symbol - * that is not found in the character symbols. - * - * @private - * @param {Array} strSymbols The string symbols to inspect. - * @param {Array} chrSymbols The character symbols to find. - * @returns {number} Returns the index of the last unmatched string symbol. - */ - function charsEndIndex(strSymbols, chrSymbols) { - var index = strSymbols.length; - - while (index-- && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {} - return index; - } - - /** - * Gets the number of `placeholder` occurrences in `array`. - * - * @private - * @param {Array} array The array to inspect. - * @param {*} placeholder The placeholder to search for. - * @returns {number} Returns the placeholder count. - */ - function countHolders(array, placeholder) { - var length = array.length, - result = 0; - - while (length--) { - if (array[length] === placeholder) { - ++result; - } - } - return result; - } - - /** - * Used by `_.deburr` to convert Latin-1 Supplement and Latin Extended-A - * letters to basic Latin letters. - * - * @private - * @param {string} letter The matched letter to deburr. - * @returns {string} Returns the deburred letter. - */ - var deburrLetter = basePropertyOf(deburredLetters); - - /** - * Used by `_.escape` to convert characters to HTML entities. - * - * @private - * @param {string} chr The matched character to escape. - * @returns {string} Returns the escaped character. - */ - var escapeHtmlChar = basePropertyOf(htmlEscapes); - - /** - * Used by `_.template` to escape characters for inclusion in compiled string literals. - * - * @private - * @param {string} chr The matched character to escape. - * @returns {string} Returns the escaped character. - */ - function escapeStringChar(chr) { - return '\\' + stringEscapes[chr]; - } - - /** - * Gets the value at `key` of `object`. - * - * @private - * @param {Object} [object] The object to query. - * @param {string} key The key of the property to get. - * @returns {*} Returns the property value. - */ - function getValue(object, key) { - return object == null ? undefined : object[key]; - } - - /** - * Checks if `string` contains Unicode symbols. - * - * @private - * @param {string} string The string to inspect. - * @returns {boolean} Returns `true` if a symbol is found, else `false`. - */ - function hasUnicode(string) { - return reHasUnicode.test(string); - } - - /** - * Checks if `string` contains a word composed of Unicode symbols. - * - * @private - * @param {string} string The string to inspect. - * @returns {boolean} Returns `true` if a word is found, else `false`. - */ - function hasUnicodeWord(string) { - return reHasUnicodeWord.test(string); - } - - /** - * Converts `iterator` to an array. - * - * @private - * @param {Object} iterator The iterator to convert. - * @returns {Array} Returns the converted array. - */ - function iteratorToArray(iterator) { - var data, - result = []; - - while (!(data = iterator.next()).done) { - result.push(data.value); - } - return result; - } - - /** - * Converts `map` to its key-value pairs. - * - * @private - * @param {Object} map The map to convert. - * @returns {Array} Returns the key-value pairs. - */ - function mapToArray(map) { - var index = -1, - result = Array(map.size); - - map.forEach(function(value, key) { - result[++index] = [key, value]; - }); - return result; - } - - /** - * Creates a unary function that invokes `func` with its argument transformed. - * - * @private - * @param {Function} func The function to wrap. - * @param {Function} transform The argument transform. - * @returns {Function} Returns the new function. - */ - function overArg(func, transform) { - return function(arg) { - return func(transform(arg)); - }; - } - - /** - * Replaces all `placeholder` elements in `array` with an internal placeholder - * and returns an array of their indexes. - * - * @private - * @param {Array} array The array to modify. - * @param {*} placeholder The placeholder to replace. - * @returns {Array} Returns the new array of placeholder indexes. - */ - function replaceHolders(array, placeholder) { - var index = -1, - length = array.length, - resIndex = 0, - result = []; - - while (++index < length) { - var value = array[index]; - if (value === placeholder || value === PLACEHOLDER) { - array[index] = PLACEHOLDER; - result[resIndex++] = index; - } - } - return result; - } - - /** - * Converts `set` to an array of its values. - * - * @private - * @param {Object} set The set to convert. - * @returns {Array} Returns the values. - */ - function setToArray(set) { - var index = -1, - result = Array(set.size); - - set.forEach(function(value) { - result[++index] = value; - }); - return result; - } - - /** - * Converts `set` to its value-value pairs. - * - * @private - * @param {Object} set The set to convert. - * @returns {Array} Returns the value-value pairs. - */ - function setToPairs(set) { - var index = -1, - result = Array(set.size); - - set.forEach(function(value) { - result[++index] = [value, value]; - }); - return result; - } - - /** - * A specialized version of `_.indexOf` which performs strict equality - * comparisons of values, i.e. `===`. - * - * @private - * @param {Array} array The array to inspect. - * @param {*} value The value to search for. - * @param {number} fromIndex The index to search from. - * @returns {number} Returns the index of the matched value, else `-1`. - */ - function strictIndexOf(array, value, fromIndex) { - var index = fromIndex - 1, - length = array.length; - - while (++index < length) { - if (array[index] === value) { - return index; - } - } - return -1; - } - - /** - * A specialized version of `_.lastIndexOf` which performs strict equality - * comparisons of values, i.e. `===`. - * - * @private - * @param {Array} array The array to inspect. - * @param {*} value The value to search for. - * @param {number} fromIndex The index to search from. - * @returns {number} Returns the index of the matched value, else `-1`. - */ - function strictLastIndexOf(array, value, fromIndex) { - var index = fromIndex + 1; - while (index--) { - if (array[index] === value) { - return index; - } - } - return index; - } - - /** - * Gets the number of symbols in `string`. - * - * @private - * @param {string} string The string to inspect. - * @returns {number} Returns the string size. - */ - function stringSize(string) { - return hasUnicode(string) - ? unicodeSize(string) - : asciiSize(string); - } - - /** - * Converts `string` to an array. - * - * @private - * @param {string} string The string to convert. - * @returns {Array} Returns the converted array. - */ - function stringToArray(string) { - return hasUnicode(string) - ? unicodeToArray(string) - : asciiToArray(string); - } - - /** - * Used by `_.trim` and `_.trimEnd` to get the index of the last non-whitespace - * character of `string`. - * - * @private - * @param {string} string The string to inspect. - * @returns {number} Returns the index of the last non-whitespace character. - */ - function trimmedEndIndex(string) { - var index = string.length; - - while (index-- && reWhitespace.test(string.charAt(index))) {} - return index; - } - - /** - * Used by `_.unescape` to convert HTML entities to characters. - * - * @private - * @param {string} chr The matched character to unescape. - * @returns {string} Returns the unescaped character. - */ - var unescapeHtmlChar = basePropertyOf(htmlUnescapes); - - /** - * Gets the size of a Unicode `string`. - * - * @private - * @param {string} string The string inspect. - * @returns {number} Returns the string size. - */ - function unicodeSize(string) { - var result = reUnicode.lastIndex = 0; - while (reUnicode.test(string)) { - ++result; - } - return result; - } - - /** - * Converts a Unicode `string` to an array. - * - * @private - * @param {string} string The string to convert. - * @returns {Array} Returns the converted array. - */ - function unicodeToArray(string) { - return string.match(reUnicode) || []; - } - - /** - * Splits a Unicode `string` into an array of its words. - * - * @private - * @param {string} The string to inspect. - * @returns {Array} Returns the words of `string`. - */ - function unicodeWords(string) { - return string.match(reUnicodeWord) || []; - } - - /*--------------------------------------------------------------------------*/ - - /** - * Create a new pristine `lodash` function using the `context` object. - * - * @static - * @memberOf _ - * @since 1.1.0 - * @category Util - * @param {Object} [context=root] The context object. - * @returns {Function} Returns a new `lodash` function. - * @example - * - * _.mixin({ 'foo': _.constant('foo') }); - * - * var lodash = _.runInContext(); - * lodash.mixin({ 'bar': lodash.constant('bar') }); - * - * _.isFunction(_.foo); - * // => true - * _.isFunction(_.bar); - * // => false - * - * lodash.isFunction(lodash.foo); - * // => false - * lodash.isFunction(lodash.bar); - * // => true - * - * // Create a suped-up `defer` in Node.js. - * var defer = _.runInContext({ 'setTimeout': setImmediate }).defer; - */ - var runInContext = (function runInContext(context) { - context = context == null ? root : _.defaults(root.Object(), context, _.pick(root, contextProps)); - - /** Built-in constructor references. */ - var Array = context.Array, - Date = context.Date, - Error = context.Error, - Function = context.Function, - Math = context.Math, - Object = context.Object, - RegExp = context.RegExp, - String = context.String, - TypeError = context.TypeError; - - /** Used for built-in method references. */ - var arrayProto = Array.prototype, - funcProto = Function.prototype, - objectProto = Object.prototype; - - /** Used to detect overreaching core-js shims. */ - var coreJsData = context['__core-js_shared__']; - - /** Used to resolve the decompiled source of functions. */ - var funcToString = funcProto.toString; - - /** Used to check objects for own properties. */ - var hasOwnProperty = objectProto.hasOwnProperty; - - /** Used to generate unique IDs. */ - var idCounter = 0; - - /** Used to detect methods masquerading as native. */ - var maskSrcKey = (function() { - var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || ''); - return uid ? ('Symbol(src)_1.' + uid) : ''; - }()); - - /** - * Used to resolve the - * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring) - * of values. - */ - var nativeObjectToString = objectProto.toString; - - /** Used to infer the `Object` constructor. */ - var objectCtorString = funcToString.call(Object); - - /** Used to restore the original `_` reference in `_.noConflict`. */ - var oldDash = root._; - - /** Used to detect if a method is native. */ - var reIsNative = RegExp('^' + - funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\$&') - .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$' - ); - - /** Built-in value references. */ - var Buffer = moduleExports ? context.Buffer : undefined, - Symbol = context.Symbol, - Uint8Array = context.Uint8Array, - allocUnsafe = Buffer ? Buffer.allocUnsafe : undefined, - getPrototype = overArg(Object.getPrototypeOf, Object), - objectCreate = Object.create, - propertyIsEnumerable = objectProto.propertyIsEnumerable, - splice = arrayProto.splice, - spreadableSymbol = Symbol ? Symbol.isConcatSpreadable : undefined, - symIterator = Symbol ? Symbol.iterator : undefined, - symToStringTag = Symbol ? Symbol.toStringTag : undefined; - - var defineProperty = (function() { - try { - var func = getNative(Object, 'defineProperty'); - func({}, '', {}); - return func; - } catch (e) {} - }()); - - /** Mocked built-ins. */ - var ctxClearTimeout = context.clearTimeout !== root.clearTimeout && context.clearTimeout, - ctxNow = Date && Date.now !== root.Date.now && Date.now, - ctxSetTimeout = context.setTimeout !== root.setTimeout && context.setTimeout; - - /* Built-in method references for those with the same name as other `lodash` methods. */ - var nativeCeil = Math.ceil, - nativeFloor = Math.floor, - nativeGetSymbols = Object.getOwnPropertySymbols, - nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined, - nativeIsFinite = context.isFinite, - nativeJoin = arrayProto.join, - nativeKeys = overArg(Object.keys, Object), - nativeMax = Math.max, - nativeMin = Math.min, - nativeNow = Date.now, - nativeParseInt = context.parseInt, - nativeRandom = Math.random, - nativeReverse = arrayProto.reverse; - - /* Built-in method references that are verified to be native. */ - var DataView = getNative(context, 'DataView'), - Map = getNative(context, 'Map'), - Promise = getNative(context, 'Promise'), - Set = getNative(context, 'Set'), - WeakMap = getNative(context, 'WeakMap'), - nativeCreate = getNative(Object, 'create'); - - /** Used to store function metadata. */ - var metaMap = WeakMap && new WeakMap; - - /** Used to lookup unminified function names. */ - var realNames = {}; - - /** Used to detect maps, sets, and weakmaps. */ - var dataViewCtorString = toSource(DataView), - mapCtorString = toSource(Map), - promiseCtorString = toSource(Promise), - setCtorString = toSource(Set), - weakMapCtorString = toSource(WeakMap); - - /** Used to convert symbols to primitives and strings. */ - var symbolProto = Symbol ? Symbol.prototype : undefined, - symbolValueOf = symbolProto ? symbolProto.valueOf : undefined, - symbolToString = symbolProto ? symbolProto.toString : undefined; - - /*------------------------------------------------------------------------*/ - - /** - * Creates a `lodash` object which wraps `value` to enable implicit method - * chain sequences. Methods that operate on and return arrays, collections, - * and functions can be chained together. Methods that retrieve a single value - * or may return a primitive value will automatically end the chain sequence - * and return the unwrapped value. Otherwise, the value must be unwrapped - * with `_#value`. - * - * Explicit chain sequences, which must be unwrapped with `_#value`, may be - * enabled using `_.chain`. - * - * The execution of chained methods is lazy, that is, it's deferred until - * `_#value` is implicitly or explicitly called. - * - * Lazy evaluation allows several methods to support shortcut fusion. - * Shortcut fusion is an optimization to merge iteratee calls; this avoids - * the creation of intermediate arrays and can greatly reduce the number of - * iteratee executions. Sections of a chain sequence qualify for shortcut - * fusion if the section is applied to an array and iteratees accept only - * one argument. The heuristic for whether a section qualifies for shortcut - * fusion is subject to change. - * - * Chaining is supported in custom builds as long as the `_#value` method is - * directly or indirectly included in the build. - * - * In addition to lodash methods, wrappers have `Array` and `String` methods. - * - * The wrapper `Array` methods are: - * `concat`, `join`, `pop`, `push`, `shift`, `sort`, `splice`, and `unshift` - * - * The wrapper `String` methods are: - * `replace` and `split` - * - * The wrapper methods that support shortcut fusion are: - * `at`, `compact`, `drop`, `dropRight`, `dropWhile`, `filter`, `find`, - * `findLast`, `head`, `initial`, `last`, `map`, `reject`, `reverse`, `slice`, - * `tail`, `take`, `takeRight`, `takeRightWhile`, `takeWhile`, and `toArray` - * - * The chainable wrapper methods are: - * `after`, `ary`, `assign`, `assignIn`, `assignInWith`, `assignWith`, `at`, - * `before`, `bind`, `bindAll`, `bindKey`, `castArray`, `chain`, `chunk`, - * `commit`, `compact`, `concat`, `conforms`, `constant`, `countBy`, `create`, - * `curry`, `debounce`, `defaults`, `defaultsDeep`, `defer`, `delay`, - * `difference`, `differenceBy`, `differenceWith`, `drop`, `dropRight`, - * `dropRightWhile`, `dropWhile`, `extend`, `extendWith`, `fill`, `filter`, - * `flatMap`, `flatMapDeep`, `flatMapDepth`, `flatten`, `flattenDeep`, - * `flattenDepth`, `flip`, `flow`, `flowRight`, `fromPairs`, `functions`, - * `functionsIn`, `groupBy`, `initial`, `intersection`, `intersectionBy`, - * `intersectionWith`, `invert`, `invertBy`, `invokeMap`, `iteratee`, `keyBy`, - * `keys`, `keysIn`, `map`, `mapKeys`, `mapValues`, `matches`, `matchesProperty`, - * `memoize`, `merge`, `mergeWith`, `method`, `methodOf`, `mixin`, `negate`, - * `nthArg`, `omit`, `omitBy`, `once`, `orderBy`, `over`, `overArgs`, - * `overEvery`, `overSome`, `partial`, `partialRight`, `partition`, `pick`, - * `pickBy`, `plant`, `property`, `propertyOf`, `pull`, `pullAll`, `pullAllBy`, - * `pullAllWith`, `pullAt`, `push`, `range`, `rangeRight`, `rearg`, `reject`, - * `remove`, `rest`, `reverse`, `sampleSize`, `set`, `setWith`, `shuffle`, - * `slice`, `sort`, `sortBy`, `splice`, `spread`, `tail`, `take`, `takeRight`, - * `takeRightWhile`, `takeWhile`, `tap`, `throttle`, `thru`, `toArray`, - * `toPairs`, `toPairsIn`, `toPath`, `toPlainObject`, `transform`, `unary`, - * `union`, `unionBy`, `unionWith`, `uniq`, `uniqBy`, `uniqWith`, `unset`, - * `unshift`, `unzip`, `unzipWith`, `update`, `updateWith`, `values`, - * `valuesIn`, `without`, `wrap`, `xor`, `xorBy`, `xorWith`, `zip`, - * `zipObject`, `zipObjectDeep`, and `zipWith` - * - * The wrapper methods that are **not** chainable by default are: - * `add`, `attempt`, `camelCase`, `capitalize`, `ceil`, `clamp`, `clone`, - * `cloneDeep`, `cloneDeepWith`, `cloneWith`, `conformsTo`, `deburr`, - * `defaultTo`, `divide`, `each`, `eachRight`, `endsWith`, `eq`, `escape`, - * `escapeRegExp`, `every`, `find`, `findIndex`, `findKey`, `findLast`, - * `findLastIndex`, `findLastKey`, `first`, `floor`, `forEach`, `forEachRight`, - * `forIn`, `forInRight`, `forOwn`, `forOwnRight`, `get`, `gt`, `gte`, `has`, - * `hasIn`, `head`, `identity`, `includes`, `indexOf`, `inRange`, `invoke`, - * `isArguments`, `isArray`, `isArrayBuffer`, `isArrayLike`, `isArrayLikeObject`, - * `isBoolean`, `isBuffer`, `isDate`, `isElement`, `isEmpty`, `isEqual`, - * `isEqualWith`, `isError`, `isFinite`, `isFunction`, `isInteger`, `isLength`, - * `isMap`, `isMatch`, `isMatchWith`, `isNaN`, `isNative`, `isNil`, `isNull`, - * `isNumber`, `isObject`, `isObjectLike`, `isPlainObject`, `isRegExp`, - * `isSafeInteger`, `isSet`, `isString`, `isUndefined`, `isTypedArray`, - * `isWeakMap`, `isWeakSet`, `join`, `kebabCase`, `last`, `lastIndexOf`, - * `lowerCase`, `lowerFirst`, `lt`, `lte`, `max`, `maxBy`, `mean`, `meanBy`, - * `min`, `minBy`, `multiply`, `noConflict`, `noop`, `now`, `nth`, `pad`, - * `padEnd`, `padStart`, `parseInt`, `pop`, `random`, `reduce`, `reduceRight`, - * `repeat`, `result`, `round`, `runInContext`, `sample`, `shift`, `size`, - * `snakeCase`, `some`, `sortedIndex`, `sortedIndexBy`, `sortedLastIndex`, - * `sortedLastIndexBy`, `startCase`, `startsWith`, `stubArray`, `stubFalse`, - * `stubObject`, `stubString`, `stubTrue`, `subtract`, `sum`, `sumBy`, - * `template`, `times`, `toFinite`, `toInteger`, `toJSON`, `toLength`, - * `toLower`, `toNumber`, `toSafeInteger`, `toString`, `toUpper`, `trim`, - * `trimEnd`, `trimStart`, `truncate`, `unescape`, `uniqueId`, `upperCase`, - * `upperFirst`, `value`, and `words` - * - * @name _ - * @constructor - * @category Seq - * @param {*} value The value to wrap in a `lodash` instance. - * @returns {Object} Returns the new `lodash` wrapper instance. - * @example - * - * function square(n) { - * return n * n; - * } - * - * var wrapped = _([1, 2, 3]); - * - * // Returns an unwrapped value. - * wrapped.reduce(_.add); - * // => 6 - * - * // Returns a wrapped value. - * var squares = wrapped.map(square); - * - * _.isArray(squares); - * // => false - * - * _.isArray(squares.value()); - * // => true - */ - function lodash(value) { - if (isObjectLike(value) && !isArray(value) && !(value instanceof LazyWrapper)) { - if (value instanceof LodashWrapper) { - return value; - } - if (hasOwnProperty.call(value, '__wrapped__')) { - return wrapperClone(value); - } - } - return new LodashWrapper(value); - } - - /** - * The base implementation of `_.create` without support for assigning - * properties to the created object. - * - * @private - * @param {Object} proto The object to inherit from. - * @returns {Object} Returns the new object. - */ - var baseCreate = (function() { - function object() {} - return function(proto) { - if (!isObject(proto)) { - return {}; - } - if (objectCreate) { - return objectCreate(proto); - } - object.prototype = proto; - var result = new object; - object.prototype = undefined; - return result; - }; - }()); - - /** - * The function whose prototype chain sequence wrappers inherit from. - * - * @private - */ - function baseLodash() { - // No operation performed. - } - - /** - * The base constructor for creating `lodash` wrapper objects. - * - * @private - * @param {*} value The value to wrap. - * @param {boolean} [chainAll] Enable explicit method chain sequences. - */ - function LodashWrapper(value, chainAll) { - this.__wrapped__ = value; - this.__actions__ = []; - this.__chain__ = !!chainAll; - this.__index__ = 0; - this.__values__ = undefined; - } - - /** - * By default, the template delimiters used by lodash are like those in - * embedded Ruby (ERB) as well as ES2015 template strings. Change the - * following template settings to use alternative delimiters. - * - * @static - * @memberOf _ - * @type {Object} - */ - lodash.templateSettings = { - - /** - * Used to detect `data` property values to be HTML-escaped. - * - * @memberOf _.templateSettings - * @type {RegExp} - */ - 'escape': reEscape, - - /** - * Used to detect code to be evaluated. - * - * @memberOf _.templateSettings - * @type {RegExp} - */ - 'evaluate': reEvaluate, - - /** - * Used to detect `data` property values to inject. - * - * @memberOf _.templateSettings - * @type {RegExp} - */ - 'interpolate': reInterpolate, - - /** - * Used to reference the data object in the template text. - * - * @memberOf _.templateSettings - * @type {string} - */ - 'variable': '', - - /** - * Used to import variables into the compiled template. - * - * @memberOf _.templateSettings - * @type {Object} - */ - 'imports': { - - /** - * A reference to the `lodash` function. - * - * @memberOf _.templateSettings.imports - * @type {Function} - */ - '_': lodash - } - }; - - // Ensure wrappers are instances of `baseLodash`. - lodash.prototype = baseLodash.prototype; - lodash.prototype.constructor = lodash; - - LodashWrapper.prototype = baseCreate(baseLodash.prototype); - LodashWrapper.prototype.constructor = LodashWrapper; - - /*------------------------------------------------------------------------*/ - - /** - * Creates a lazy wrapper object which wraps `value` to enable lazy evaluation. - * - * @private - * @constructor - * @param {*} value The value to wrap. - */ - function LazyWrapper(value) { - this.__wrapped__ = value; - this.__actions__ = []; - this.__dir__ = 1; - this.__filtered__ = false; - this.__iteratees__ = []; - this.__takeCount__ = MAX_ARRAY_LENGTH; - this.__views__ = []; - } - - /** - * Creates a clone of the lazy wrapper object. - * - * @private - * @name clone - * @memberOf LazyWrapper - * @returns {Object} Returns the cloned `LazyWrapper` object. - */ - function lazyClone() { - var result = new LazyWrapper(this.__wrapped__); - result.__actions__ = copyArray(this.__actions__); - result.__dir__ = this.__dir__; - result.__filtered__ = this.__filtered__; - result.__iteratees__ = copyArray(this.__iteratees__); - result.__takeCount__ = this.__takeCount__; - result.__views__ = copyArray(this.__views__); - return result; - } - - /** - * Reverses the direction of lazy iteration. - * - * @private - * @name reverse - * @memberOf LazyWrapper - * @returns {Object} Returns the new reversed `LazyWrapper` object. - */ - function lazyReverse() { - if (this.__filtered__) { - var result = new LazyWrapper(this); - result.__dir__ = -1; - result.__filtered__ = true; - } else { - result = this.clone(); - result.__dir__ *= -1; - } - return result; - } - - /** - * Extracts the unwrapped value from its lazy wrapper. - * - * @private - * @name value - * @memberOf LazyWrapper - * @returns {*} Returns the unwrapped value. - */ - function lazyValue() { - var array = this.__wrapped__.value(), - dir = this.__dir__, - isArr = isArray(array), - isRight = dir < 0, - arrLength = isArr ? array.length : 0, - view = getView(0, arrLength, this.__views__), - start = view.start, - end = view.end, - length = end - start, - index = isRight ? end : (start - 1), - iteratees = this.__iteratees__, - iterLength = iteratees.length, - resIndex = 0, - takeCount = nativeMin(length, this.__takeCount__); - - if (!isArr || (!isRight && arrLength == length && takeCount == length)) { - return baseWrapperValue(array, this.__actions__); - } - var result = []; - - outer: - while (length-- && resIndex < takeCount) { - index += dir; - - var iterIndex = -1, - value = array[index]; - - while (++iterIndex < iterLength) { - var data = iteratees[iterIndex], - iteratee = data.iteratee, - type = data.type, - computed = iteratee(value); - - if (type == LAZY_MAP_FLAG) { - value = computed; - } else if (!computed) { - if (type == LAZY_FILTER_FLAG) { - continue outer; - } else { - break outer; - } - } - } - result[resIndex++] = value; - } - return result; - } - - // Ensure `LazyWrapper` is an instance of `baseLodash`. - LazyWrapper.prototype = baseCreate(baseLodash.prototype); - LazyWrapper.prototype.constructor = LazyWrapper; - - /*------------------------------------------------------------------------*/ - - /** - * Creates a hash object. - * - * @private - * @constructor - * @param {Array} [entries] The key-value pairs to cache. - */ - function Hash(entries) { - var index = -1, - length = entries == null ? 0 : entries.length; - - this.clear(); - while (++index < length) { - var entry = entries[index]; - this.set(entry[0], entry[1]); - } - } - - /** - * Removes all key-value entries from the hash. - * - * @private - * @name clear - * @memberOf Hash - */ - function hashClear() { - this.__data__ = nativeCreate ? nativeCreate(null) : {}; - this.size = 0; - } - - /** - * Removes `key` and its value from the hash. - * - * @private - * @name delete - * @memberOf Hash - * @param {Object} hash The hash to modify. - * @param {string} key The key of the value to remove. - * @returns {boolean} Returns `true` if the entry was removed, else `false`. - */ - function hashDelete(key) { - var result = this.has(key) && delete this.__data__[key]; - this.size -= result ? 1 : 0; - return result; - } - - /** - * Gets the hash value for `key`. - * - * @private - * @name get - * @memberOf Hash - * @param {string} key The key of the value to get. - * @returns {*} Returns the entry value. - */ - function hashGet(key) { - var data = this.__data__; - if (nativeCreate) { - var result = data[key]; - return result === HASH_UNDEFINED ? undefined : result; - } - return hasOwnProperty.call(data, key) ? data[key] : undefined; - } - - /** - * Checks if a hash value for `key` exists. - * - * @private - * @name has - * @memberOf Hash - * @param {string} key The key of the entry to check. - * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. - */ - function hashHas(key) { - var data = this.__data__; - return nativeCreate ? (data[key] !== undefined) : hasOwnProperty.call(data, key); - } - - /** - * Sets the hash `key` to `value`. - * - * @private - * @name set - * @memberOf Hash - * @param {string} key The key of the value to set. - * @param {*} value The value to set. - * @returns {Object} Returns the hash instance. - */ - function hashSet(key, value) { - var data = this.__data__; - this.size += this.has(key) ? 0 : 1; - data[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED : value; - return this; - } - - // Add methods to `Hash`. - Hash.prototype.clear = hashClear; - Hash.prototype['delete'] = hashDelete; - Hash.prototype.get = hashGet; - Hash.prototype.has = hashHas; - Hash.prototype.set = hashSet; - - /*------------------------------------------------------------------------*/ - - /** - * Creates an list cache object. - * - * @private - * @constructor - * @param {Array} [entries] The key-value pairs to cache. - */ - function ListCache(entries) { - var index = -1, - length = entries == null ? 0 : entries.length; - - this.clear(); - while (++index < length) { - var entry = entries[index]; - this.set(entry[0], entry[1]); - } - } - - /** - * Removes all key-value entries from the list cache. - * - * @private - * @name clear - * @memberOf ListCache - */ - function listCacheClear() { - this.__data__ = []; - this.size = 0; - } - - /** - * Removes `key` and its value from the list cache. - * - * @private - * @name delete - * @memberOf ListCache - * @param {string} key The key of the value to remove. - * @returns {boolean} Returns `true` if the entry was removed, else `false`. - */ - function listCacheDelete(key) { - var data = this.__data__, - index = assocIndexOf(data, key); - - if (index < 0) { - return false; - } - var lastIndex = data.length - 1; - if (index == lastIndex) { - data.pop(); - } else { - splice.call(data, index, 1); - } - --this.size; - return true; - } - - /** - * Gets the list cache value for `key`. - * - * @private - * @name get - * @memberOf ListCache - * @param {string} key The key of the value to get. - * @returns {*} Returns the entry value. - */ - function listCacheGet(key) { - var data = this.__data__, - index = assocIndexOf(data, key); - - return index < 0 ? undefined : data[index][1]; - } - - /** - * Checks if a list cache value for `key` exists. - * - * @private - * @name has - * @memberOf ListCache - * @param {string} key The key of the entry to check. - * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. - */ - function listCacheHas(key) { - return assocIndexOf(this.__data__, key) > -1; - } - - /** - * Sets the list cache `key` to `value`. - * - * @private - * @name set - * @memberOf ListCache - * @param {string} key The key of the value to set. - * @param {*} value The value to set. - * @returns {Object} Returns the list cache instance. - */ - function listCacheSet(key, value) { - var data = this.__data__, - index = assocIndexOf(data, key); - - if (index < 0) { - ++this.size; - data.push([key, value]); - } else { - data[index][1] = value; - } - return this; - } - - // Add methods to `ListCache`. - ListCache.prototype.clear = listCacheClear; - ListCache.prototype['delete'] = listCacheDelete; - ListCache.prototype.get = listCacheGet; - ListCache.prototype.has = listCacheHas; - ListCache.prototype.set = listCacheSet; - - /*------------------------------------------------------------------------*/ - - /** - * Creates a map cache object to store key-value pairs. - * - * @private - * @constructor - * @param {Array} [entries] The key-value pairs to cache. - */ - function MapCache(entries) { - var index = -1, - length = entries == null ? 0 : entries.length; - - this.clear(); - while (++index < length) { - var entry = entries[index]; - this.set(entry[0], entry[1]); - } - } - - /** - * Removes all key-value entries from the map. - * - * @private - * @name clear - * @memberOf MapCache - */ - function mapCacheClear() { - this.size = 0; - this.__data__ = { - 'hash': new Hash, - 'map': new (Map || ListCache), - 'string': new Hash - }; - } - - /** - * Removes `key` and its value from the map. - * - * @private - * @name delete - * @memberOf MapCache - * @param {string} key The key of the value to remove. - * @returns {boolean} Returns `true` if the entry was removed, else `false`. - */ - function mapCacheDelete(key) { - var result = getMapData(this, key)['delete'](key); - this.size -= result ? 1 : 0; - return result; - } - - /** - * Gets the map value for `key`. - * - * @private - * @name get - * @memberOf MapCache - * @param {string} key The key of the value to get. - * @returns {*} Returns the entry value. - */ - function mapCacheGet(key) { - return getMapData(this, key).get(key); - } - - /** - * Checks if a map value for `key` exists. - * - * @private - * @name has - * @memberOf MapCache - * @param {string} key The key of the entry to check. - * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. - */ - function mapCacheHas(key) { - return getMapData(this, key).has(key); - } - - /** - * Sets the map `key` to `value`. - * - * @private - * @name set - * @memberOf MapCache - * @param {string} key The key of the value to set. - * @param {*} value The value to set. - * @returns {Object} Returns the map cache instance. - */ - function mapCacheSet(key, value) { - var data = getMapData(this, key), - size = data.size; - - data.set(key, value); - this.size += data.size == size ? 0 : 1; - return this; - } - - // Add methods to `MapCache`. - MapCache.prototype.clear = mapCacheClear; - MapCache.prototype['delete'] = mapCacheDelete; - MapCache.prototype.get = mapCacheGet; - MapCache.prototype.has = mapCacheHas; - MapCache.prototype.set = mapCacheSet; - - /*------------------------------------------------------------------------*/ - - /** - * - * Creates an array cache object to store unique values. - * - * @private - * @constructor - * @param {Array} [values] The values to cache. - */ - function SetCache(values) { - var index = -1, - length = values == null ? 0 : values.length; - - this.__data__ = new MapCache; - while (++index < length) { - this.add(values[index]); - } - } - - /** - * Adds `value` to the array cache. - * - * @private - * @name add - * @memberOf SetCache - * @alias push - * @param {*} value The value to cache. - * @returns {Object} Returns the cache instance. - */ - function setCacheAdd(value) { - this.__data__.set(value, HASH_UNDEFINED); - return this; - } - - /** - * Checks if `value` is in the array cache. - * - * @private - * @name has - * @memberOf SetCache - * @param {*} value The value to search for. - * @returns {number} Returns `true` if `value` is found, else `false`. - */ - function setCacheHas(value) { - return this.__data__.has(value); - } - - // Add methods to `SetCache`. - SetCache.prototype.add = SetCache.prototype.push = setCacheAdd; - SetCache.prototype.has = setCacheHas; - - /*------------------------------------------------------------------------*/ - - /** - * Creates a stack cache object to store key-value pairs. - * - * @private - * @constructor - * @param {Array} [entries] The key-value pairs to cache. - */ - function Stack(entries) { - var data = this.__data__ = new ListCache(entries); - this.size = data.size; - } - - /** - * Removes all key-value entries from the stack. - * - * @private - * @name clear - * @memberOf Stack - */ - function stackClear() { - this.__data__ = new ListCache; - this.size = 0; - } - - /** - * Removes `key` and its value from the stack. - * - * @private - * @name delete - * @memberOf Stack - * @param {string} key The key of the value to remove. - * @returns {boolean} Returns `true` if the entry was removed, else `false`. - */ - function stackDelete(key) { - var data = this.__data__, - result = data['delete'](key); - - this.size = data.size; - return result; - } - - /** - * Gets the stack value for `key`. - * - * @private - * @name get - * @memberOf Stack - * @param {string} key The key of the value to get. - * @returns {*} Returns the entry value. - */ - function stackGet(key) { - return this.__data__.get(key); - } - - /** - * Checks if a stack value for `key` exists. - * - * @private - * @name has - * @memberOf Stack - * @param {string} key The key of the entry to check. - * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. - */ - function stackHas(key) { - return this.__data__.has(key); - } - - /** - * Sets the stack `key` to `value`. - * - * @private - * @name set - * @memberOf Stack - * @param {string} key The key of the value to set. - * @param {*} value The value to set. - * @returns {Object} Returns the stack cache instance. - */ - function stackSet(key, value) { - var data = this.__data__; - if (data instanceof ListCache) { - var pairs = data.__data__; - if (!Map || (pairs.length < LARGE_ARRAY_SIZE - 1)) { - pairs.push([key, value]); - this.size = ++data.size; - return this; - } - data = this.__data__ = new MapCache(pairs); - } - data.set(key, value); - this.size = data.size; - return this; - } - - // Add methods to `Stack`. - Stack.prototype.clear = stackClear; - Stack.prototype['delete'] = stackDelete; - Stack.prototype.get = stackGet; - Stack.prototype.has = stackHas; - Stack.prototype.set = stackSet; - - /*------------------------------------------------------------------------*/ - - /** - * Creates an array of the enumerable property names of the array-like `value`. - * - * @private - * @param {*} value The value to query. - * @param {boolean} inherited Specify returning inherited property names. - * @returns {Array} Returns the array of property names. - */ - function arrayLikeKeys(value, inherited) { - var isArr = isArray(value), - isArg = !isArr && isArguments(value), - isBuff = !isArr && !isArg && isBuffer(value), - isType = !isArr && !isArg && !isBuff && isTypedArray(value), - skipIndexes = isArr || isArg || isBuff || isType, - result = skipIndexes ? baseTimes(value.length, String) : [], - length = result.length; - - for (var key in value) { - if ((inherited || hasOwnProperty.call(value, key)) && - !(skipIndexes && ( - // Safari 9 has enumerable `arguments.length` in strict mode. - key == 'length' || - // Node.js 0.10 has enumerable non-index properties on buffers. - (isBuff && (key == 'offset' || key == 'parent')) || - // PhantomJS 2 has enumerable non-index properties on typed arrays. - (isType && (key == 'buffer' || key == 'byteLength' || key == 'byteOffset')) || - // Skip index properties. - isIndex(key, length) - ))) { - result.push(key); - } - } - return result; - } - - /** - * A specialized version of `_.sample` for arrays. - * - * @private - * @param {Array} array The array to sample. - * @returns {*} Returns the random element. - */ - function arraySample(array) { - var length = array.length; - return length ? array[baseRandom(0, length - 1)] : undefined; - } - - /** - * A specialized version of `_.sampleSize` for arrays. - * - * @private - * @param {Array} array The array to sample. - * @param {number} n The number of elements to sample. - * @returns {Array} Returns the random elements. - */ - function arraySampleSize(array, n) { - return shuffleSelf(copyArray(array), baseClamp(n, 0, array.length)); - } - - /** - * A specialized version of `_.shuffle` for arrays. - * - * @private - * @param {Array} array The array to shuffle. - * @returns {Array} Returns the new shuffled array. - */ - function arrayShuffle(array) { - return shuffleSelf(copyArray(array)); - } - - /** - * This function is like `assignValue` except that it doesn't assign - * `undefined` values. - * - * @private - * @param {Object} object The object to modify. - * @param {string} key The key of the property to assign. - * @param {*} value The value to assign. - */ - function assignMergeValue(object, key, value) { - if ((value !== undefined && !eq(object[key], value)) || - (value === undefined && !(key in object))) { - baseAssignValue(object, key, value); - } - } - - /** - * Assigns `value` to `key` of `object` if the existing value is not equivalent - * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) - * for equality comparisons. - * - * @private - * @param {Object} object The object to modify. - * @param {string} key The key of the property to assign. - * @param {*} value The value to assign. - */ - function assignValue(object, key, value) { - var objValue = object[key]; - if (!(hasOwnProperty.call(object, key) && eq(objValue, value)) || - (value === undefined && !(key in object))) { - baseAssignValue(object, key, value); - } - } - - /** - * Gets the index at which the `key` is found in `array` of key-value pairs. - * - * @private - * @param {Array} array The array to inspect. - * @param {*} key The key to search for. - * @returns {number} Returns the index of the matched value, else `-1`. - */ - function assocIndexOf(array, key) { - var length = array.length; - while (length--) { - if (eq(array[length][0], key)) { - return length; - } - } - return -1; - } - - /** - * Aggregates elements of `collection` on `accumulator` with keys transformed - * by `iteratee` and values set by `setter`. - * - * @private - * @param {Array|Object} collection The collection to iterate over. - * @param {Function} setter The function to set `accumulator` values. - * @param {Function} iteratee The iteratee to transform keys. - * @param {Object} accumulator The initial aggregated object. - * @returns {Function} Returns `accumulator`. - */ - function baseAggregator(collection, setter, iteratee, accumulator) { - baseEach(collection, function(value, key, collection) { - setter(accumulator, value, iteratee(value), collection); - }); - return accumulator; - } - - /** - * The base implementation of `_.assign` without support for multiple sources - * or `customizer` functions. - * - * @private - * @param {Object} object The destination object. - * @param {Object} source The source object. - * @returns {Object} Returns `object`. - */ - function baseAssign(object, source) { - return object && copyObject(source, keys(source), object); - } - - /** - * The base implementation of `_.assignIn` without support for multiple sources - * or `customizer` functions. - * - * @private - * @param {Object} object The destination object. - * @param {Object} source The source object. - * @returns {Object} Returns `object`. - */ - function baseAssignIn(object, source) { - return object && copyObject(source, keysIn(source), object); - } - - /** - * The base implementation of `assignValue` and `assignMergeValue` without - * value checks. - * - * @private - * @param {Object} object The object to modify. - * @param {string} key The key of the property to assign. - * @param {*} value The value to assign. - */ - function baseAssignValue(object, key, value) { - if (key == '__proto__' && defineProperty) { - defineProperty(object, key, { - 'configurable': true, - 'enumerable': true, - 'value': value, - 'writable': true - }); - } else { - object[key] = value; - } - } - - /** - * The base implementation of `_.at` without support for individual paths. - * - * @private - * @param {Object} object The object to iterate over. - * @param {string[]} paths The property paths to pick. - * @returns {Array} Returns the picked elements. - */ - function baseAt(object, paths) { - var index = -1, - length = paths.length, - result = Array(length), - skip = object == null; - - while (++index < length) { - result[index] = skip ? undefined : get(object, paths[index]); - } - return result; - } - - /** - * The base implementation of `_.clamp` which doesn't coerce arguments. - * - * @private - * @param {number} number The number to clamp. - * @param {number} [lower] The lower bound. - * @param {number} upper The upper bound. - * @returns {number} Returns the clamped number. - */ - function baseClamp(number, lower, upper) { - if (number === number) { - if (upper !== undefined) { - number = number <= upper ? number : upper; - } - if (lower !== undefined) { - number = number >= lower ? number : lower; - } - } - return number; - } - - /** - * The base implementation of `_.clone` and `_.cloneDeep` which tracks - * traversed objects. - * - * @private - * @param {*} value The value to clone. - * @param {boolean} bitmask The bitmask flags. - * 1 - Deep clone - * 2 - Flatten inherited properties - * 4 - Clone symbols - * @param {Function} [customizer] The function to customize cloning. - * @param {string} [key] The key of `value`. - * @param {Object} [object] The parent object of `value`. - * @param {Object} [stack] Tracks traversed objects and their clone counterparts. - * @returns {*} Returns the cloned value. - */ - function baseClone(value, bitmask, customizer, key, object, stack) { - var result, - isDeep = bitmask & CLONE_DEEP_FLAG, - isFlat = bitmask & CLONE_FLAT_FLAG, - isFull = bitmask & CLONE_SYMBOLS_FLAG; - - if (customizer) { - result = object ? customizer(value, key, object, stack) : customizer(value); - } - if (result !== undefined) { - return result; - } - if (!isObject(value)) { - return value; - } - var isArr = isArray(value); - if (isArr) { - result = initCloneArray(value); - if (!isDeep) { - return copyArray(value, result); - } - } else { - var tag = getTag(value), - isFunc = tag == funcTag || tag == genTag; - - if (isBuffer(value)) { - return cloneBuffer(value, isDeep); - } - if (tag == objectTag || tag == argsTag || (isFunc && !object)) { - result = (isFlat || isFunc) ? {} : initCloneObject(value); - if (!isDeep) { - return isFlat - ? copySymbolsIn(value, baseAssignIn(result, value)) - : copySymbols(value, baseAssign(result, value)); - } - } else { - if (!cloneableTags[tag]) { - return object ? value : {}; - } - result = initCloneByTag(value, tag, isDeep); - } - } - // Check for circular references and return its corresponding clone. - stack || (stack = new Stack); - var stacked = stack.get(value); - if (stacked) { - return stacked; - } - stack.set(value, result); - - if (isSet(value)) { - value.forEach(function(subValue) { - result.add(baseClone(subValue, bitmask, customizer, subValue, value, stack)); - }); - } else if (isMap(value)) { - value.forEach(function(subValue, key) { - result.set(key, baseClone(subValue, bitmask, customizer, key, value, stack)); - }); - } - - var keysFunc = isFull - ? (isFlat ? getAllKeysIn : getAllKeys) - : (isFlat ? keysIn : keys); - - var props = isArr ? undefined : keysFunc(value); - arrayEach(props || value, function(subValue, key) { - if (props) { - key = subValue; - subValue = value[key]; - } - // Recursively populate clone (susceptible to call stack limits). - assignValue(result, key, baseClone(subValue, bitmask, customizer, key, value, stack)); - }); - return result; - } - - /** - * The base implementation of `_.conforms` which doesn't clone `source`. - * - * @private - * @param {Object} source The object of property predicates to conform to. - * @returns {Function} Returns the new spec function. - */ - function baseConforms(source) { - var props = keys(source); - return function(object) { - return baseConformsTo(object, source, props); - }; - } - - /** - * The base implementation of `_.conformsTo` which accepts `props` to check. - * - * @private - * @param {Object} object The object to inspect. - * @param {Object} source The object of property predicates to conform to. - * @returns {boolean} Returns `true` if `object` conforms, else `false`. - */ - function baseConformsTo(object, source, props) { - var length = props.length; - if (object == null) { - return !length; - } - object = Object(object); - while (length--) { - var key = props[length], - predicate = source[key], - value = object[key]; - - if ((value === undefined && !(key in object)) || !predicate(value)) { - return false; - } - } - return true; - } - - /** - * The base implementation of `_.delay` and `_.defer` which accepts `args` - * to provide to `func`. - * - * @private - * @param {Function} func The function to delay. - * @param {number} wait The number of milliseconds to delay invocation. - * @param {Array} args The arguments to provide to `func`. - * @returns {number|Object} Returns the timer id or timeout object. - */ - function baseDelay(func, wait, args) { - if (typeof func != 'function') { - throw new TypeError(FUNC_ERROR_TEXT); - } - return setTimeout(function() { func.apply(undefined, args); }, wait); - } - - /** - * The base implementation of methods like `_.difference` without support - * for excluding multiple arrays or iteratee shorthands. - * - * @private - * @param {Array} array The array to inspect. - * @param {Array} values The values to exclude. - * @param {Function} [iteratee] The iteratee invoked per element. - * @param {Function} [comparator] The comparator invoked per element. - * @returns {Array} Returns the new array of filtered values. - */ - function baseDifference(array, values, iteratee, comparator) { - var index = -1, - includes = arrayIncludes, - isCommon = true, - length = array.length, - result = [], - valuesLength = values.length; - - if (!length) { - return result; - } - if (iteratee) { - values = arrayMap(values, baseUnary(iteratee)); - } - if (comparator) { - includes = arrayIncludesWith; - isCommon = false; - } - else if (values.length >= LARGE_ARRAY_SIZE) { - includes = cacheHas; - isCommon = false; - values = new SetCache(values); - } - outer: - while (++index < length) { - var value = array[index], - computed = iteratee == null ? value : iteratee(value); - - value = (comparator || value !== 0) ? value : 0; - if (isCommon && computed === computed) { - var valuesIndex = valuesLength; - while (valuesIndex--) { - if (values[valuesIndex] === computed) { - continue outer; - } - } - result.push(value); - } - else if (!includes(values, computed, comparator)) { - result.push(value); - } - } - return result; - } - - /** - * The base implementation of `_.forEach` without support for iteratee shorthands. - * - * @private - * @param {Array|Object} collection The collection to iterate over. - * @param {Function} iteratee The function invoked per iteration. - * @returns {Array|Object} Returns `collection`. - */ - var baseEach = createBaseEach(baseForOwn); - - /** - * The base implementation of `_.forEachRight` without support for iteratee shorthands. - * - * @private - * @param {Array|Object} collection The collection to iterate over. - * @param {Function} iteratee The function invoked per iteration. - * @returns {Array|Object} Returns `collection`. - */ - var baseEachRight = createBaseEach(baseForOwnRight, true); - - /** - * The base implementation of `_.every` without support for iteratee shorthands. - * - * @private - * @param {Array|Object} collection The collection to iterate over. - * @param {Function} predicate The function invoked per iteration. - * @returns {boolean} Returns `true` if all elements pass the predicate check, - * else `false` - */ - function baseEvery(collection, predicate) { - var result = true; - baseEach(collection, function(value, index, collection) { - result = !!predicate(value, index, collection); - return result; - }); - return result; - } - - /** - * The base implementation of methods like `_.max` and `_.min` which accepts a - * `comparator` to determine the extremum value. - * - * @private - * @param {Array} array The array to iterate over. - * @param {Function} iteratee The iteratee invoked per iteration. - * @param {Function} comparator The comparator used to compare values. - * @returns {*} Returns the extremum value. - */ - function baseExtremum(array, iteratee, comparator) { - var index = -1, - length = array.length; - - while (++index < length) { - var value = array[index], - current = iteratee(value); - - if (current != null && (computed === undefined - ? (current === current && !isSymbol(current)) - : comparator(current, computed) - )) { - var computed = current, - result = value; - } - } - return result; - } - - /** - * The base implementation of `_.fill` without an iteratee call guard. - * - * @private - * @param {Array} array The array to fill. - * @param {*} value The value to fill `array` with. - * @param {number} [start=0] The start position. - * @param {number} [end=array.length] The end position. - * @returns {Array} Returns `array`. - */ - function baseFill(array, value, start, end) { - var length = array.length; - - start = toInteger(start); - if (start < 0) { - start = -start > length ? 0 : (length + start); - } - end = (end === undefined || end > length) ? length : toInteger(end); - if (end < 0) { - end += length; - } - end = start > end ? 0 : toLength(end); - while (start < end) { - array[start++] = value; - } - return array; - } - - /** - * The base implementation of `_.filter` without support for iteratee shorthands. - * - * @private - * @param {Array|Object} collection The collection to iterate over. - * @param {Function} predicate The function invoked per iteration. - * @returns {Array} Returns the new filtered array. - */ - function baseFilter(collection, predicate) { - var result = []; - baseEach(collection, function(value, index, collection) { - if (predicate(value, index, collection)) { - result.push(value); - } - }); - return result; - } - - /** - * The base implementation of `_.flatten` with support for restricting flattening. - * - * @private - * @param {Array} array The array to flatten. - * @param {number} depth The maximum recursion depth. - * @param {boolean} [predicate=isFlattenable] The function invoked per iteration. - * @param {boolean} [isStrict] Restrict to values that pass `predicate` checks. - * @param {Array} [result=[]] The initial result value. - * @returns {Array} Returns the new flattened array. - */ - function baseFlatten(array, depth, predicate, isStrict, result) { - var index = -1, - length = array.length; - - predicate || (predicate = isFlattenable); - result || (result = []); - - while (++index < length) { - var value = array[index]; - if (depth > 0 && predicate(value)) { - if (depth > 1) { - // Recursively flatten arrays (susceptible to call stack limits). - baseFlatten(value, depth - 1, predicate, isStrict, result); - } else { - arrayPush(result, value); - } - } else if (!isStrict) { - result[result.length] = value; - } - } - return result; - } - - /** - * The base implementation of `baseForOwn` which iterates over `object` - * properties returned by `keysFunc` and invokes `iteratee` for each property. - * Iteratee functions may exit iteration early by explicitly returning `false`. - * - * @private - * @param {Object} object The object to iterate over. - * @param {Function} iteratee The function invoked per iteration. - * @param {Function} keysFunc The function to get the keys of `object`. - * @returns {Object} Returns `object`. - */ - var baseFor = createBaseFor(); - - /** - * This function is like `baseFor` except that it iterates over properties - * in the opposite order. - * - * @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 baseForRight = createBaseFor(true); - - /** - * The base implementation of `_.forOwn` without support for iteratee shorthands. - * - * @private - * @param {Object} object The object to iterate over. - * @param {Function} iteratee The function invoked per iteration. - * @returns {Object} Returns `object`. - */ - function baseForOwn(object, iteratee) { - return object && baseFor(object, iteratee, keys); - } - - /** - * The base implementation of `_.forOwnRight` without support for iteratee shorthands. - * - * @private - * @param {Object} object The object to iterate over. - * @param {Function} iteratee The function invoked per iteration. - * @returns {Object} Returns `object`. - */ - function baseForOwnRight(object, iteratee) { - return object && baseForRight(object, iteratee, keys); - } - - /** - * The base implementation of `_.functions` which creates an array of - * `object` function property names filtered from `props`. - * - * @private - * @param {Object} object The object to inspect. - * @param {Array} props The property names to filter. - * @returns {Array} Returns the function names. - */ - function baseFunctions(object, props) { - return arrayFilter(props, function(key) { - return isFunction(object[key]); - }); - } - - /** - * The base implementation of `_.get` without support for default values. - * - * @private - * @param {Object} object The object to query. - * @param {Array|string} path The path of the property to get. - * @returns {*} Returns the resolved value. - */ - function baseGet(object, path) { - path = castPath(path, object); - - var index = 0, - length = path.length; - - while (object != null && index < length) { - object = object[toKey(path[index++])]; - } - return (index && index == length) ? object : undefined; - } - - /** - * The base implementation of `getAllKeys` and `getAllKeysIn` which uses - * `keysFunc` and `symbolsFunc` to get the enumerable property names and - * symbols of `object`. - * - * @private - * @param {Object} object The object to query. - * @param {Function} keysFunc The function to get the keys of `object`. - * @param {Function} symbolsFunc The function to get the symbols of `object`. - * @returns {Array} Returns the array of property names and symbols. - */ - function baseGetAllKeys(object, keysFunc, symbolsFunc) { - var result = keysFunc(object); - return isArray(object) ? result : arrayPush(result, symbolsFunc(object)); - } - - /** - * The base implementation of `getTag` without fallbacks for buggy environments. - * - * @private - * @param {*} value The value to query. - * @returns {string} Returns the `toStringTag`. - */ - function baseGetTag(value) { - if (value == null) { - return value === undefined ? undefinedTag : nullTag; - } - return (symToStringTag && symToStringTag in Object(value)) - ? getRawTag(value) - : objectToString(value); - } - - /** - * The base implementation of `_.gt` which doesn't coerce arguments. - * - * @private - * @param {*} value The value to compare. - * @param {*} other The other value to compare. - * @returns {boolean} Returns `true` if `value` is greater than `other`, - * else `false`. - */ - function baseGt(value, other) { - return value > other; - } - - /** - * The base implementation of `_.has` without support for deep paths. - * - * @private - * @param {Object} [object] The object to query. - * @param {Array|string} key The key to check. - * @returns {boolean} Returns `true` if `key` exists, else `false`. - */ - function baseHas(object, key) { - return object != null && hasOwnProperty.call(object, key); - } - - /** - * The base implementation of `_.hasIn` without support for deep paths. - * - * @private - * @param {Object} [object] The object to query. - * @param {Array|string} key The key to check. - * @returns {boolean} Returns `true` if `key` exists, else `false`. - */ - function baseHasIn(object, key) { - return object != null && key in Object(object); - } - - /** - * The base implementation of `_.inRange` which doesn't coerce arguments. - * - * @private - * @param {number} number The number to check. - * @param {number} start The start of the range. - * @param {number} end The end of the range. - * @returns {boolean} Returns `true` if `number` is in the range, else `false`. - */ - function baseInRange(number, start, end) { - return number >= nativeMin(start, end) && number < nativeMax(start, end); - } - - /** - * The base implementation of methods like `_.intersection`, without support - * for iteratee shorthands, that accepts an array of arrays to inspect. - * - * @private - * @param {Array} arrays The arrays to inspect. - * @param {Function} [iteratee] The iteratee invoked per element. - * @param {Function} [comparator] The comparator invoked per element. - * @returns {Array} Returns the new array of shared values. - */ - function baseIntersection(arrays, iteratee, comparator) { - var includes = comparator ? arrayIncludesWith : arrayIncludes, - length = arrays[0].length, - othLength = arrays.length, - othIndex = othLength, - caches = Array(othLength), - maxLength = Infinity, - result = []; - - while (othIndex--) { - var array = arrays[othIndex]; - if (othIndex && iteratee) { - array = arrayMap(array, baseUnary(iteratee)); - } - maxLength = nativeMin(array.length, maxLength); - caches[othIndex] = !comparator && (iteratee || (length >= 120 && array.length >= 120)) - ? new SetCache(othIndex && array) - : undefined; - } - array = arrays[0]; - - var index = -1, - seen = caches[0]; - - outer: - while (++index < length && result.length < maxLength) { - var value = array[index], - computed = iteratee ? iteratee(value) : value; - - value = (comparator || value !== 0) ? value : 0; - if (!(seen - ? cacheHas(seen, computed) - : includes(result, computed, comparator) - )) { - othIndex = othLength; - while (--othIndex) { - var cache = caches[othIndex]; - if (!(cache - ? cacheHas(cache, computed) - : includes(arrays[othIndex], computed, comparator)) - ) { - continue outer; - } - } - if (seen) { - seen.push(computed); - } - result.push(value); - } - } - return result; - } - - /** - * The base implementation of `_.invert` and `_.invertBy` which inverts - * `object` with values transformed by `iteratee` and set by `setter`. - * - * @private - * @param {Object} object The object to iterate over. - * @param {Function} setter The function to set `accumulator` values. - * @param {Function} iteratee The iteratee to transform values. - * @param {Object} accumulator The initial inverted object. - * @returns {Function} Returns `accumulator`. - */ - function baseInverter(object, setter, iteratee, accumulator) { - baseForOwn(object, function(value, key, object) { - setter(accumulator, iteratee(value), key, object); - }); - return accumulator; - } - - /** - * The base implementation of `_.invoke` without support for individual - * method arguments. - * - * @private - * @param {Object} object The object to query. - * @param {Array|string} path The path of the method to invoke. - * @param {Array} args The arguments to invoke the method with. - * @returns {*} Returns the result of the invoked method. - */ - function baseInvoke(object, path, args) { - path = castPath(path, object); - object = parent(object, path); - var func = object == null ? object : object[toKey(last(path))]; - return func == null ? undefined : apply(func, object, args); - } - - /** - * The base implementation of `_.isArguments`. - * - * @private - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is an `arguments` object, - */ - function baseIsArguments(value) { - return isObjectLike(value) && baseGetTag(value) == argsTag; - } - - /** - * The base implementation of `_.isArrayBuffer` without Node.js optimizations. - * - * @private - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is an array buffer, else `false`. - */ - function baseIsArrayBuffer(value) { - return isObjectLike(value) && baseGetTag(value) == arrayBufferTag; - } - - /** - * The base implementation of `_.isDate` without Node.js optimizations. - * - * @private - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a date object, else `false`. - */ - function baseIsDate(value) { - return isObjectLike(value) && baseGetTag(value) == dateTag; - } - - /** - * The base implementation of `_.isEqual` which supports partial comparisons - * and tracks traversed objects. - * - * @private - * @param {*} value The value to compare. - * @param {*} other The other value to compare. - * @param {boolean} bitmask The bitmask flags. - * 1 - Unordered comparison - * 2 - Partial comparison - * @param {Function} [customizer] The function to customize comparisons. - * @param {Object} [stack] Tracks traversed `value` and `other` objects. - * @returns {boolean} Returns `true` if the values are equivalent, else `false`. - */ - function baseIsEqual(value, other, bitmask, customizer, stack) { - if (value === other) { - return true; - } - if (value == null || other == null || (!isObjectLike(value) && !isObjectLike(other))) { - return value !== value && other !== other; - } - return baseIsEqualDeep(value, other, bitmask, customizer, baseIsEqual, stack); - } - - /** - * A specialized version of `baseIsEqual` for arrays and objects which performs - * deep comparisons and tracks traversed objects enabling objects with circular - * references to be compared. - * - * @private - * @param {Object} object The object to compare. - * @param {Object} other The other object to compare. - * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details. - * @param {Function} customizer The function to customize comparisons. - * @param {Function} equalFunc The function to determine equivalents of values. - * @param {Object} [stack] Tracks traversed `object` and `other` objects. - * @returns {boolean} Returns `true` if the objects are equivalent, else `false`. - */ - function baseIsEqualDeep(object, other, bitmask, customizer, equalFunc, stack) { - var objIsArr = isArray(object), - othIsArr = isArray(other), - objTag = objIsArr ? arrayTag : getTag(object), - othTag = othIsArr ? arrayTag : getTag(other); - - objTag = objTag == argsTag ? objectTag : objTag; - othTag = othTag == argsTag ? objectTag : othTag; - - var objIsObj = objTag == objectTag, - othIsObj = othTag == objectTag, - isSameTag = objTag == othTag; - - if (isSameTag && isBuffer(object)) { - if (!isBuffer(other)) { - return false; - } - objIsArr = true; - objIsObj = false; - } - if (isSameTag && !objIsObj) { - stack || (stack = new Stack); - return (objIsArr || isTypedArray(object)) - ? equalArrays(object, other, bitmask, customizer, equalFunc, stack) - : equalByTag(object, other, objTag, bitmask, customizer, equalFunc, stack); - } - if (!(bitmask & COMPARE_PARTIAL_FLAG)) { - var objIsWrapped = objIsObj && hasOwnProperty.call(object, '__wrapped__'), - othIsWrapped = othIsObj && hasOwnProperty.call(other, '__wrapped__'); - - if (objIsWrapped || othIsWrapped) { - var objUnwrapped = objIsWrapped ? object.value() : object, - othUnwrapped = othIsWrapped ? other.value() : other; - - stack || (stack = new Stack); - return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack); - } - } - if (!isSameTag) { - return false; - } - stack || (stack = new Stack); - return equalObjects(object, other, bitmask, customizer, equalFunc, stack); - } - - /** - * The base implementation of `_.isMap` without Node.js optimizations. - * - * @private - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a map, else `false`. - */ - function baseIsMap(value) { - return isObjectLike(value) && getTag(value) == mapTag; - } - - /** - * The base implementation of `_.isMatch` without support for iteratee shorthands. - * - * @private - * @param {Object} object The object to inspect. - * @param {Object} source The object of property values to match. - * @param {Array} matchData The property names, values, and compare flags to match. - * @param {Function} [customizer] The function to customize comparisons. - * @returns {boolean} Returns `true` if `object` is a match, else `false`. - */ - function baseIsMatch(object, source, matchData, customizer) { - var index = matchData.length, - length = index, - noCustomizer = !customizer; - - if (object == null) { - return !length; - } - object = Object(object); - while (index--) { - var data = matchData[index]; - if ((noCustomizer && data[2]) - ? data[1] !== object[data[0]] - : !(data[0] in object) - ) { - return false; - } - } - while (++index < length) { - data = matchData[index]; - var key = data[0], - objValue = object[key], - srcValue = data[1]; - - if (noCustomizer && data[2]) { - if (objValue === undefined && !(key in object)) { - return false; - } - } else { - var stack = new Stack; - if (customizer) { - var result = customizer(objValue, srcValue, key, object, source, stack); - } - if (!(result === undefined - ? baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG, customizer, stack) - : result - )) { - return false; - } - } - } - return true; - } - - /** - * The base implementation of `_.isNative` without bad shim checks. - * - * @private - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a native function, - * else `false`. - */ - function baseIsNative(value) { - if (!isObject(value) || isMasked(value)) { - return false; - } - var pattern = isFunction(value) ? reIsNative : reIsHostCtor; - return pattern.test(toSource(value)); - } - - /** - * The base implementation of `_.isRegExp` without Node.js optimizations. - * - * @private - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a regexp, else `false`. - */ - function baseIsRegExp(value) { - return isObjectLike(value) && baseGetTag(value) == regexpTag; - } - - /** - * The base implementation of `_.isSet` without Node.js optimizations. - * - * @private - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a set, else `false`. - */ - function baseIsSet(value) { - return isObjectLike(value) && getTag(value) == setTag; - } - - /** - * The base implementation of `_.isTypedArray` without Node.js optimizations. - * - * @private - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a typed array, else `false`. - */ - function baseIsTypedArray(value) { - return isObjectLike(value) && - isLength(value.length) && !!typedArrayTags[baseGetTag(value)]; - } - - /** - * The base implementation of `_.iteratee`. - * - * @private - * @param {*} [value=_.identity] The value to convert to an iteratee. - * @returns {Function} Returns the iteratee. - */ - function baseIteratee(value) { - // Don't store the `typeof` result in a variable to avoid a JIT bug in Safari 9. - // See https://bugs.webkit.org/show_bug.cgi?id=156034 for more details. - if (typeof value == 'function') { - return value; - } - if (value == null) { - return identity; - } - if (typeof value == 'object') { - return isArray(value) - ? baseMatchesProperty(value[0], value[1]) - : baseMatches(value); - } - return property(value); - } - - /** - * The base implementation of `_.keys` which doesn't treat sparse arrays as dense. - * - * @private - * @param {Object} object The object to query. - * @returns {Array} Returns the array of property names. - */ - function baseKeys(object) { - if (!isPrototype(object)) { - return nativeKeys(object); - } - var result = []; - for (var key in Object(object)) { - if (hasOwnProperty.call(object, key) && key != 'constructor') { - result.push(key); - } - } - return result; - } - - /** - * The base implementation of `_.keysIn` which doesn't treat sparse arrays as dense. - * - * @private - * @param {Object} object The object to query. - * @returns {Array} Returns the array of property names. - */ - function baseKeysIn(object) { - if (!isObject(object)) { - return nativeKeysIn(object); - } - var isProto = isPrototype(object), - result = []; - - for (var key in object) { - if (!(key == 'constructor' && (isProto || !hasOwnProperty.call(object, key)))) { - result.push(key); - } - } - return result; - } - - /** - * The base implementation of `_.lt` which doesn't coerce arguments. - * - * @private - * @param {*} value The value to compare. - * @param {*} other The other value to compare. - * @returns {boolean} Returns `true` if `value` is less than `other`, - * else `false`. - */ - function baseLt(value, other) { - return value < other; - } - - /** - * The base implementation of `_.map` without support for iteratee shorthands. - * - * @private - * @param {Array|Object} collection The collection to iterate over. - * @param {Function} iteratee The function invoked per iteration. - * @returns {Array} Returns the new mapped array. - */ - function baseMap(collection, iteratee) { - var index = -1, - result = isArrayLike(collection) ? Array(collection.length) : []; - - baseEach(collection, function(value, key, collection) { - result[++index] = iteratee(value, key, collection); - }); - return result; - } - - /** - * The base implementation of `_.matches` which doesn't clone `source`. - * - * @private - * @param {Object} source The object of property values to match. - * @returns {Function} Returns the new spec function. - */ - function baseMatches(source) { - var matchData = getMatchData(source); - if (matchData.length == 1 && matchData[0][2]) { - return matchesStrictComparable(matchData[0][0], matchData[0][1]); - } - return function(object) { - return object === source || baseIsMatch(object, source, matchData); - }; - } - - /** - * The base implementation of `_.matchesProperty` which doesn't clone `srcValue`. - * - * @private - * @param {string} path The path of the property to get. - * @param {*} srcValue The value to match. - * @returns {Function} Returns the new spec function. - */ - function baseMatchesProperty(path, srcValue) { - if (isKey(path) && isStrictComparable(srcValue)) { - return matchesStrictComparable(toKey(path), srcValue); - } - return function(object) { - var objValue = get(object, path); - return (objValue === undefined && objValue === srcValue) - ? hasIn(object, path) - : baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG); - }; - } - - /** - * The base implementation of `_.merge` without support for multiple sources. - * - * @private - * @param {Object} object The destination object. - * @param {Object} source The source object. - * @param {number} srcIndex The index of `source`. - * @param {Function} [customizer] The function to customize merged values. - * @param {Object} [stack] Tracks traversed source values and their merged - * counterparts. - */ - function baseMerge(object, source, srcIndex, customizer, stack) { - if (object === source) { - return; - } - baseFor(source, function(srcValue, key) { - stack || (stack = new Stack); - if (isObject(srcValue)) { - baseMergeDeep(object, source, key, srcIndex, baseMerge, customizer, stack); - } - else { - var newValue = customizer - ? customizer(safeGet(object, key), srcValue, (key + ''), object, source, stack) - : undefined; - - if (newValue === undefined) { - newValue = srcValue; - } - assignMergeValue(object, key, newValue); - } - }, keysIn); - } - - /** - * A specialized version of `baseMerge` for arrays and objects which performs - * deep merges and tracks traversed objects enabling objects with circular - * references to be merged. - * - * @private - * @param {Object} object The destination object. - * @param {Object} source The source object. - * @param {string} key The key of the value to merge. - * @param {number} srcIndex The index of `source`. - * @param {Function} mergeFunc The function to merge values. - * @param {Function} [customizer] The function to customize assigned values. - * @param {Object} [stack] Tracks traversed source values and their merged - * counterparts. - */ - function baseMergeDeep(object, source, key, srcIndex, mergeFunc, customizer, stack) { - var objValue = safeGet(object, key), - srcValue = safeGet(source, key), - stacked = stack.get(srcValue); - - if (stacked) { - assignMergeValue(object, key, stacked); - return; - } - var newValue = customizer - ? customizer(objValue, srcValue, (key + ''), object, source, stack) - : undefined; - - var isCommon = newValue === undefined; - - if (isCommon) { - var isArr = isArray(srcValue), - isBuff = !isArr && isBuffer(srcValue), - isTyped = !isArr && !isBuff && isTypedArray(srcValue); - - newValue = srcValue; - if (isArr || isBuff || isTyped) { - if (isArray(objValue)) { - newValue = objValue; - } - else if (isArrayLikeObject(objValue)) { - newValue = copyArray(objValue); - } - else if (isBuff) { - isCommon = false; - newValue = cloneBuffer(srcValue, true); - } - else if (isTyped) { - isCommon = false; - newValue = cloneTypedArray(srcValue, true); - } - else { - newValue = []; - } - } - else if (isPlainObject(srcValue) || isArguments(srcValue)) { - newValue = objValue; - if (isArguments(objValue)) { - newValue = toPlainObject(objValue); - } - else if (!isObject(objValue) || isFunction(objValue)) { - newValue = initCloneObject(srcValue); - } - } - else { - isCommon = false; - } - } - if (isCommon) { - // Recursively merge objects and arrays (susceptible to call stack limits). - stack.set(srcValue, newValue); - mergeFunc(newValue, srcValue, srcIndex, customizer, stack); - stack['delete'](srcValue); - } - assignMergeValue(object, key, newValue); - } - - /** - * The base implementation of `_.nth` which doesn't coerce arguments. - * - * @private - * @param {Array} array The array to query. - * @param {number} n The index of the element to return. - * @returns {*} Returns the nth element of `array`. - */ - function baseNth(array, n) { - var length = array.length; - if (!length) { - return; - } - n += n < 0 ? length : 0; - return isIndex(n, length) ? array[n] : undefined; - } - - /** - * The base implementation of `_.orderBy` without param guards. - * - * @private - * @param {Array|Object} collection The collection to iterate over. - * @param {Function[]|Object[]|string[]} iteratees The iteratees to sort by. - * @param {string[]} orders The sort orders of `iteratees`. - * @returns {Array} Returns the new sorted array. - */ - function baseOrderBy(collection, iteratees, orders) { - if (iteratees.length) { - iteratees = arrayMap(iteratees, function(iteratee) { - if (isArray(iteratee)) { - return function(value) { - return baseGet(value, iteratee.length === 1 ? iteratee[0] : iteratee); - } - } - return iteratee; - }); - } else { - iteratees = [identity]; - } - - var index = -1; - iteratees = arrayMap(iteratees, baseUnary(getIteratee())); - - var result = baseMap(collection, function(value, key, collection) { - var criteria = arrayMap(iteratees, function(iteratee) { - return iteratee(value); - }); - return { 'criteria': criteria, 'index': ++index, 'value': value }; - }); - - return baseSortBy(result, function(object, other) { - return compareMultiple(object, other, orders); - }); - } - - /** - * The base implementation of `_.pick` without support for individual - * property identifiers. - * - * @private - * @param {Object} object The source object. - * @param {string[]} paths The property paths to pick. - * @returns {Object} Returns the new object. - */ - function basePick(object, paths) { - return basePickBy(object, paths, function(value, path) { - return hasIn(object, path); - }); - } - - /** - * The base implementation of `_.pickBy` without support for iteratee shorthands. - * - * @private - * @param {Object} object The source object. - * @param {string[]} paths The property paths to pick. - * @param {Function} predicate The function invoked per property. - * @returns {Object} Returns the new object. - */ - function basePickBy(object, paths, predicate) { - var index = -1, - length = paths.length, - result = {}; - - while (++index < length) { - var path = paths[index], - value = baseGet(object, path); - - if (predicate(value, path)) { - baseSet(result, castPath(path, object), value); - } - } - return result; - } - - /** - * A specialized version of `baseProperty` which supports deep paths. - * - * @private - * @param {Array|string} path The path of the property to get. - * @returns {Function} Returns the new accessor function. - */ - function basePropertyDeep(path) { - return function(object) { - return baseGet(object, path); - }; - } - - /** - * The base implementation of `_.pullAllBy` without support for iteratee - * shorthands. - * - * @private - * @param {Array} array The array to modify. - * @param {Array} values The values to remove. - * @param {Function} [iteratee] The iteratee invoked per element. - * @param {Function} [comparator] The comparator invoked per element. - * @returns {Array} Returns `array`. - */ - function basePullAll(array, values, iteratee, comparator) { - var indexOf = comparator ? baseIndexOfWith : baseIndexOf, - index = -1, - length = values.length, - seen = array; - - if (array === values) { - values = copyArray(values); - } - if (iteratee) { - seen = arrayMap(array, baseUnary(iteratee)); - } - while (++index < length) { - var fromIndex = 0, - value = values[index], - computed = iteratee ? iteratee(value) : value; - - while ((fromIndex = indexOf(seen, computed, fromIndex, comparator)) > -1) { - if (seen !== array) { - splice.call(seen, fromIndex, 1); - } - splice.call(array, fromIndex, 1); - } - } - return array; - } - - /** - * The base implementation of `_.pullAt` without support for individual - * indexes or capturing the removed elements. - * - * @private - * @param {Array} array The array to modify. - * @param {number[]} indexes The indexes of elements to remove. - * @returns {Array} Returns `array`. - */ - function basePullAt(array, indexes) { - var length = array ? indexes.length : 0, - lastIndex = length - 1; - - while (length--) { - var index = indexes[length]; - if (length == lastIndex || index !== previous) { - var previous = index; - if (isIndex(index)) { - splice.call(array, index, 1); - } else { - baseUnset(array, index); - } - } - } - return array; - } - - /** - * The base implementation of `_.random` without support for returning - * floating-point numbers. - * - * @private - * @param {number} lower The lower bound. - * @param {number} upper The upper bound. - * @returns {number} Returns the random number. - */ - function baseRandom(lower, upper) { - return lower + nativeFloor(nativeRandom() * (upper - lower + 1)); - } - - /** - * The base implementation of `_.range` and `_.rangeRight` which doesn't - * coerce arguments. - * - * @private - * @param {number} start The start of the range. - * @param {number} end The end of the range. - * @param {number} step The value to increment or decrement by. - * @param {boolean} [fromRight] Specify iterating from right to left. - * @returns {Array} Returns the range of numbers. - */ - function baseRange(start, end, step, fromRight) { - var index = -1, - length = nativeMax(nativeCeil((end - start) / (step || 1)), 0), - result = Array(length); - - while (length--) { - result[fromRight ? length : ++index] = start; - start += step; - } - return result; - } - - /** - * The base implementation of `_.repeat` which doesn't coerce arguments. - * - * @private - * @param {string} string The string to repeat. - * @param {number} n The number of times to repeat the string. - * @returns {string} Returns the repeated string. - */ - function baseRepeat(string, n) { - var result = ''; - if (!string || n < 1 || n > MAX_SAFE_INTEGER) { - return result; - } - // Leverage the exponentiation by squaring algorithm for a faster repeat. - // See https://en.wikipedia.org/wiki/Exponentiation_by_squaring for more details. - do { - if (n % 2) { - result += string; - } - n = nativeFloor(n / 2); - if (n) { - string += string; - } - } while (n); - - return result; - } - - /** - * The base implementation of `_.rest` which doesn't validate or coerce arguments. - * - * @private - * @param {Function} func The function to apply a rest parameter to. - * @param {number} [start=func.length-1] The start position of the rest parameter. - * @returns {Function} Returns the new function. - */ - function baseRest(func, start) { - return setToString(overRest(func, start, identity), func + ''); - } - - /** - * The base implementation of `_.sample`. - * - * @private - * @param {Array|Object} collection The collection to sample. - * @returns {*} Returns the random element. - */ - function baseSample(collection) { - return arraySample(values(collection)); - } - - /** - * The base implementation of `_.sampleSize` without param guards. - * - * @private - * @param {Array|Object} collection The collection to sample. - * @param {number} n The number of elements to sample. - * @returns {Array} Returns the random elements. - */ - function baseSampleSize(collection, n) { - var array = values(collection); - return shuffleSelf(array, baseClamp(n, 0, array.length)); - } - - /** - * The base implementation of `_.set`. - * - * @private - * @param {Object} object The object to modify. - * @param {Array|string} path The path of the property to set. - * @param {*} value The value to set. - * @param {Function} [customizer] The function to customize path creation. - * @returns {Object} Returns `object`. - */ - function baseSet(object, path, value, customizer) { - if (!isObject(object)) { - return object; - } - path = castPath(path, object); - - var index = -1, - length = path.length, - lastIndex = length - 1, - nested = object; - - while (nested != null && ++index < length) { - var key = toKey(path[index]), - newValue = value; - - if (key === '__proto__' || key === 'constructor' || key === 'prototype') { - return object; - } - - if (index != lastIndex) { - var objValue = nested[key]; - newValue = customizer ? customizer(objValue, key, nested) : undefined; - if (newValue === undefined) { - newValue = isObject(objValue) - ? objValue - : (isIndex(path[index + 1]) ? [] : {}); - } - } - assignValue(nested, key, newValue); - nested = nested[key]; - } - return object; - } - - /** - * The base implementation of `setData` without support for hot loop shorting. - * - * @private - * @param {Function} func The function to associate metadata with. - * @param {*} data The metadata. - * @returns {Function} Returns `func`. - */ - var baseSetData = !metaMap ? identity : function(func, data) { - metaMap.set(func, data); - return func; - }; - - /** - * The base implementation of `setToString` without support for hot loop shorting. - * - * @private - * @param {Function} func The function to modify. - * @param {Function} string The `toString` result. - * @returns {Function} Returns `func`. - */ - var baseSetToString = !defineProperty ? identity : function(func, string) { - return defineProperty(func, 'toString', { - 'configurable': true, - 'enumerable': false, - 'value': constant(string), - 'writable': true - }); - }; - - /** - * The base implementation of `_.shuffle`. - * - * @private - * @param {Array|Object} collection The collection to shuffle. - * @returns {Array} Returns the new shuffled array. - */ - function baseShuffle(collection) { - return shuffleSelf(values(collection)); - } - - /** - * The base implementation of `_.slice` without an iteratee call guard. - * - * @private - * @param {Array} array The array to slice. - * @param {number} [start=0] The start position. - * @param {number} [end=array.length] The end position. - * @returns {Array} Returns the slice of `array`. - */ - function baseSlice(array, start, end) { - var index = -1, - length = array.length; - - if (start < 0) { - start = -start > length ? 0 : (length + start); - } - end = end > length ? length : end; - if (end < 0) { - end += length; - } - length = start > end ? 0 : ((end - start) >>> 0); - start >>>= 0; - - var result = Array(length); - while (++index < length) { - result[index] = array[index + start]; - } - return result; - } - - /** - * The base implementation of `_.some` without support for iteratee shorthands. - * - * @private - * @param {Array|Object} collection The collection to iterate over. - * @param {Function} predicate The function invoked per iteration. - * @returns {boolean} Returns `true` if any element passes the predicate check, - * else `false`. - */ - function baseSome(collection, predicate) { - var result; - - baseEach(collection, function(value, index, collection) { - result = predicate(value, index, collection); - return !result; - }); - return !!result; - } - - /** - * The base implementation of `_.sortedIndex` and `_.sortedLastIndex` which - * 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 baseSortedIndex(array, value, retHighest) { - var low = 0, - high = array == null ? low : array.length; - - if (typeof value == 'number' && value === value && high <= HALF_MAX_ARRAY_LENGTH) { - while (low < high) { - var mid = (low + high) >>> 1, - computed = array[mid]; - - if (computed !== null && !isSymbol(computed) && - (retHighest ? (computed <= value) : (computed < value))) { - low = mid + 1; - } else { - high = mid; - } - } - return high; - } - return baseSortedIndexBy(array, value, identity, retHighest); - } - - /** - * The base implementation of `_.sortedIndexBy` and `_.sortedLastIndexBy` - * which 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 iteratee invoked per element. - * @param {boolean} [retHighest] Specify returning the highest qualified index. - * @returns {number} Returns the index at which `value` should be inserted - * into `array`. - */ - function baseSortedIndexBy(array, value, iteratee, retHighest) { - var low = 0, - high = array == null ? 0 : array.length; - if (high === 0) { - return 0; - } - - value = iteratee(value); - var valIsNaN = value !== value, - valIsNull = value === null, - valIsSymbol = isSymbol(value), - valIsUndefined = value === undefined; - - while (low < high) { - var mid = nativeFloor((low + high) / 2), - computed = iteratee(array[mid]), - othIsDefined = computed !== undefined, - othIsNull = computed === null, - othIsReflexive = computed === computed, - othIsSymbol = isSymbol(computed); - - if (valIsNaN) { - var setLow = retHighest || othIsReflexive; - } else if (valIsUndefined) { - setLow = othIsReflexive && (retHighest || othIsDefined); - } else if (valIsNull) { - setLow = othIsReflexive && othIsDefined && (retHighest || !othIsNull); - } else if (valIsSymbol) { - setLow = othIsReflexive && othIsDefined && !othIsNull && (retHighest || !othIsSymbol); - } else if (othIsNull || othIsSymbol) { - setLow = false; - } else { - setLow = retHighest ? (computed <= value) : (computed < value); - } - if (setLow) { - low = mid + 1; - } else { - high = mid; - } - } - return nativeMin(high, MAX_ARRAY_INDEX); - } - - /** - * The base implementation of `_.sortedUniq` and `_.sortedUniqBy` without - * support for iteratee shorthands. - * - * @private - * @param {Array} array The array to inspect. - * @param {Function} [iteratee] The iteratee invoked per element. - * @returns {Array} Returns the new duplicate free array. - */ - function baseSortedUniq(array, iteratee) { - var index = -1, - length = array.length, - resIndex = 0, - result = []; - - while (++index < length) { - var value = array[index], - computed = iteratee ? iteratee(value) : value; - - if (!index || !eq(computed, seen)) { - var seen = computed; - result[resIndex++] = value === 0 ? 0 : value; - } - } - return result; - } - - /** - * The base implementation of `_.toNumber` which doesn't ensure correct - * conversions of binary, hexadecimal, or octal string values. - * - * @private - * @param {*} value The value to process. - * @returns {number} Returns the number. - */ - function baseToNumber(value) { - if (typeof value == 'number') { - return value; - } - if (isSymbol(value)) { - return NAN; - } - return +value; - } - - /** - * The base implementation of `_.toString` which doesn't convert nullish - * values to empty strings. - * - * @private - * @param {*} value The value to process. - * @returns {string} Returns the string. - */ - function baseToString(value) { - // Exit early for strings to avoid a performance hit in some environments. - if (typeof value == 'string') { - return value; - } - if (isArray(value)) { - // Recursively convert values (susceptible to call stack limits). - return arrayMap(value, baseToString) + ''; - } - if (isSymbol(value)) { - return symbolToString ? symbolToString.call(value) : ''; - } - var result = (value + ''); - return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result; - } - - /** - * The base implementation of `_.uniqBy` without support for iteratee shorthands. - * - * @private - * @param {Array} array The array to inspect. - * @param {Function} [iteratee] The iteratee invoked per element. - * @param {Function} [comparator] The comparator invoked per element. - * @returns {Array} Returns the new duplicate free array. - */ - function baseUniq(array, iteratee, comparator) { - var index = -1, - includes = arrayIncludes, - length = array.length, - isCommon = true, - result = [], - seen = result; - - if (comparator) { - isCommon = false; - includes = arrayIncludesWith; - } - else if (length >= LARGE_ARRAY_SIZE) { - var set = iteratee ? null : createSet(array); - if (set) { - return setToArray(set); - } - isCommon = false; - includes = cacheHas; - seen = new SetCache; - } - else { - seen = iteratee ? [] : result; - } - outer: - while (++index < length) { - var value = array[index], - computed = iteratee ? iteratee(value) : value; - - value = (comparator || value !== 0) ? value : 0; - if (isCommon && computed === computed) { - var seenIndex = seen.length; - while (seenIndex--) { - if (seen[seenIndex] === computed) { - continue outer; - } - } - if (iteratee) { - seen.push(computed); - } - result.push(value); - } - else if (!includes(seen, computed, comparator)) { - if (seen !== result) { - seen.push(computed); - } - result.push(value); - } - } - return result; - } - - /** - * The base implementation of `_.unset`. - * - * @private - * @param {Object} object The object to modify. - * @param {Array|string} path The property path to unset. - * @returns {boolean} Returns `true` if the property is deleted, else `false`. - */ - function baseUnset(object, path) { - path = castPath(path, object); - object = parent(object, path); - return object == null || delete object[toKey(last(path))]; - } - - /** - * The base implementation of `_.update`. - * - * @private - * @param {Object} object The object to modify. - * @param {Array|string} path The path of the property to update. - * @param {Function} updater The function to produce the updated value. - * @param {Function} [customizer] The function to customize path creation. - * @returns {Object} Returns `object`. - */ - function baseUpdate(object, path, updater, customizer) { - return baseSet(object, path, updater(baseGet(object, path)), customizer); - } - - /** - * The base implementation of methods like `_.dropWhile` and `_.takeWhile` - * without support for iteratee shorthands. - * - * @private - * @param {Array} array The array to query. - * @param {Function} predicate The function invoked per iteration. - * @param {boolean} [isDrop] Specify dropping elements instead of taking them. - * @param {boolean} [fromRight] Specify iterating from right to left. - * @returns {Array} Returns the slice of `array`. - */ - function baseWhile(array, predicate, isDrop, fromRight) { - var length = array.length, - index = fromRight ? length : -1; - - while ((fromRight ? index-- : ++index < length) && - predicate(array[index], index, array)) {} - - return isDrop - ? baseSlice(array, (fromRight ? 0 : index), (fromRight ? index + 1 : length)) - : baseSlice(array, (fromRight ? index + 1 : 0), (fromRight ? length : index)); - } - - /** - * The base implementation of `wrapperValue` which returns the result of - * performing a sequence of actions on the unwrapped `value`, where each - * successive action is supplied the return value of the previous. - * - * @private - * @param {*} value The unwrapped value. - * @param {Array} actions Actions to perform to resolve the unwrapped value. - * @returns {*} Returns the resolved value. - */ - function baseWrapperValue(value, actions) { - var result = value; - if (result instanceof LazyWrapper) { - result = result.value(); - } - return arrayReduce(actions, function(result, action) { - return action.func.apply(action.thisArg, arrayPush([result], action.args)); - }, result); - } - - /** - * The base implementation of methods like `_.xor`, without support for - * iteratee shorthands, that accepts an array of arrays to inspect. - * - * @private - * @param {Array} arrays The arrays to inspect. - * @param {Function} [iteratee] The iteratee invoked per element. - * @param {Function} [comparator] The comparator invoked per element. - * @returns {Array} Returns the new array of values. - */ - function baseXor(arrays, iteratee, comparator) { - var length = arrays.length; - if (length < 2) { - return length ? baseUniq(arrays[0]) : []; - } - var index = -1, - result = Array(length); - - while (++index < length) { - var array = arrays[index], - othIndex = -1; - - while (++othIndex < length) { - if (othIndex != index) { - result[index] = baseDifference(result[index] || array, arrays[othIndex], iteratee, comparator); - } - } - } - return baseUniq(baseFlatten(result, 1), iteratee, comparator); - } - - /** - * This base implementation of `_.zipObject` which assigns values using `assignFunc`. - * - * @private - * @param {Array} props The property identifiers. - * @param {Array} values The property values. - * @param {Function} assignFunc The function to assign values. - * @returns {Object} Returns the new object. - */ - function baseZipObject(props, values, assignFunc) { - var index = -1, - length = props.length, - valsLength = values.length, - result = {}; - - while (++index < length) { - var value = index < valsLength ? values[index] : undefined; - assignFunc(result, props[index], value); - } - return result; - } - - /** - * Casts `value` to an empty array if it's not an array like object. - * - * @private - * @param {*} value The value to inspect. - * @returns {Array|Object} Returns the cast array-like object. - */ - function castArrayLikeObject(value) { - return isArrayLikeObject(value) ? value : []; - } - - /** - * Casts `value` to `identity` if it's not a function. - * - * @private - * @param {*} value The value to inspect. - * @returns {Function} Returns cast function. - */ - function castFunction(value) { - return typeof value == 'function' ? value : identity; - } - - /** - * Casts `value` to a path array if it's not one. - * - * @private - * @param {*} value The value to inspect. - * @param {Object} [object] The object to query keys on. - * @returns {Array} Returns the cast property path array. - */ - function castPath(value, object) { - if (isArray(value)) { - return value; - } - return isKey(value, object) ? [value] : stringToPath(toString(value)); - } - - /** - * A `baseRest` alias which can be replaced with `identity` by module - * replacement plugins. - * - * @private - * @type {Function} - * @param {Function} func The function to apply a rest parameter to. - * @returns {Function} Returns the new function. - */ - var castRest = baseRest; - - /** - * Casts `array` to a slice if it's needed. - * - * @private - * @param {Array} array The array to inspect. - * @param {number} start The start position. - * @param {number} [end=array.length] The end position. - * @returns {Array} Returns the cast slice. - */ - function castSlice(array, start, end) { - var length = array.length; - end = end === undefined ? length : end; - return (!start && end >= length) ? array : baseSlice(array, start, end); - } - - /** - * A simple wrapper around the global [`clearTimeout`](https://mdn.io/clearTimeout). - * - * @private - * @param {number|Object} id The timer id or timeout object of the timer to clear. - */ - var clearTimeout = ctxClearTimeout || function(id) { - return root.clearTimeout(id); - }; - - /** - * Creates a clone of `buffer`. - * - * @private - * @param {Buffer} buffer The buffer to clone. - * @param {boolean} [isDeep] Specify a deep clone. - * @returns {Buffer} Returns the cloned buffer. - */ - function cloneBuffer(buffer, isDeep) { - if (isDeep) { - return buffer.slice(); - } - var length = buffer.length, - result = allocUnsafe ? allocUnsafe(length) : new buffer.constructor(length); - - buffer.copy(result); - return result; - } - - /** - * Creates a clone of `arrayBuffer`. - * - * @private - * @param {ArrayBuffer} arrayBuffer The array buffer to clone. - * @returns {ArrayBuffer} Returns the cloned array buffer. - */ - function cloneArrayBuffer(arrayBuffer) { - var result = new arrayBuffer.constructor(arrayBuffer.byteLength); - new Uint8Array(result).set(new Uint8Array(arrayBuffer)); - return result; - } - - /** - * Creates a clone of `dataView`. - * - * @private - * @param {Object} dataView The data view to clone. - * @param {boolean} [isDeep] Specify a deep clone. - * @returns {Object} Returns the cloned data view. - */ - function cloneDataView(dataView, isDeep) { - var buffer = isDeep ? cloneArrayBuffer(dataView.buffer) : dataView.buffer; - return new dataView.constructor(buffer, dataView.byteOffset, dataView.byteLength); - } - - /** - * Creates a clone of `regexp`. - * - * @private - * @param {Object} regexp The regexp to clone. - * @returns {Object} Returns the cloned regexp. - */ - function cloneRegExp(regexp) { - var result = new regexp.constructor(regexp.source, reFlags.exec(regexp)); - result.lastIndex = regexp.lastIndex; - return result; - } - - /** - * Creates a clone of the `symbol` object. - * - * @private - * @param {Object} symbol The symbol object to clone. - * @returns {Object} Returns the cloned symbol object. - */ - function cloneSymbol(symbol) { - return symbolValueOf ? Object(symbolValueOf.call(symbol)) : {}; - } - - /** - * Creates a clone of `typedArray`. - * - * @private - * @param {Object} typedArray The typed array to clone. - * @param {boolean} [isDeep] Specify a deep clone. - * @returns {Object} Returns the cloned typed array. - */ - function cloneTypedArray(typedArray, isDeep) { - var buffer = isDeep ? cloneArrayBuffer(typedArray.buffer) : typedArray.buffer; - return new typedArray.constructor(buffer, typedArray.byteOffset, typedArray.length); - } - - /** - * Compares values to sort them in ascending order. - * - * @private - * @param {*} value The value to compare. - * @param {*} other The other value to compare. - * @returns {number} Returns the sort order indicator for `value`. - */ - function compareAscending(value, other) { - if (value !== other) { - var valIsDefined = value !== undefined, - valIsNull = value === null, - valIsReflexive = value === value, - valIsSymbol = isSymbol(value); - - var othIsDefined = other !== undefined, - othIsNull = other === null, - othIsReflexive = other === other, - othIsSymbol = isSymbol(other); - - if ((!othIsNull && !othIsSymbol && !valIsSymbol && value > other) || - (valIsSymbol && othIsDefined && othIsReflexive && !othIsNull && !othIsSymbol) || - (valIsNull && othIsDefined && othIsReflexive) || - (!valIsDefined && othIsReflexive) || - !valIsReflexive) { - return 1; - } - if ((!valIsNull && !valIsSymbol && !othIsSymbol && value < other) || - (othIsSymbol && valIsDefined && valIsReflexive && !valIsNull && !valIsSymbol) || - (othIsNull && valIsDefined && valIsReflexive) || - (!othIsDefined && valIsReflexive) || - !othIsReflexive) { - return -1; - } - } - return 0; - } - - /** - * Used by `_.orderBy` to compare multiple properties of a value to another - * and stable sort them. - * - * If `orders` is unspecified, all values are sorted in ascending order. Otherwise, - * specify an order of "desc" for descending or "asc" for ascending sort order - * of corresponding values. - * - * @private - * @param {Object} object The object to compare. - * @param {Object} other The other object to compare. - * @param {boolean[]|string[]} orders The order to sort by for each property. - * @returns {number} Returns the sort order indicator for `object`. - */ - function compareMultiple(object, other, orders) { - var index = -1, - objCriteria = object.criteria, - othCriteria = other.criteria, - length = objCriteria.length, - ordersLength = orders.length; - - while (++index < length) { - var result = compareAscending(objCriteria[index], othCriteria[index]); - if (result) { - if (index >= ordersLength) { - return result; - } - var order = orders[index]; - return result * (order == 'desc' ? -1 : 1); - } - } - // Fixes an `Array#sort` bug in the JS engine embedded in Adobe applications - // that causes it, under certain circumstances, to provide the same value for - // `object` and `other`. See https://github.com/jashkenas/underscore/pull/1247 - // for more details. - // - // This also ensures a stable sort in V8 and other engines. - // See https://bugs.chromium.org/p/v8/issues/detail?id=90 for more details. - return object.index - other.index; - } - - /** - * Creates an array that is the composition of partially applied arguments, - * placeholders, and provided arguments into a single array of arguments. - * - * @private - * @param {Array} args The provided arguments. - * @param {Array} partials The arguments to prepend to those provided. - * @param {Array} holders The `partials` placeholder indexes. - * @params {boolean} [isCurried] Specify composing for a curried function. - * @returns {Array} Returns the new array of composed arguments. - */ - function composeArgs(args, partials, holders, isCurried) { - var argsIndex = -1, - argsLength = args.length, - holdersLength = holders.length, - leftIndex = -1, - leftLength = partials.length, - rangeLength = nativeMax(argsLength - holdersLength, 0), - result = Array(leftLength + rangeLength), - isUncurried = !isCurried; - - while (++leftIndex < leftLength) { - result[leftIndex] = partials[leftIndex]; - } - while (++argsIndex < holdersLength) { - if (isUncurried || argsIndex < argsLength) { - result[holders[argsIndex]] = args[argsIndex]; - } - } - while (rangeLength--) { - result[leftIndex++] = args[argsIndex++]; - } - return result; - } - - /** - * This function is like `composeArgs` except that the arguments composition - * is tailored for `_.partialRight`. - * - * @private - * @param {Array} args The provided arguments. - * @param {Array} partials The arguments to append to those provided. - * @param {Array} holders The `partials` placeholder indexes. - * @params {boolean} [isCurried] Specify composing for a curried function. - * @returns {Array} Returns the new array of composed arguments. - */ - function composeArgsRight(args, partials, holders, isCurried) { - var argsIndex = -1, - argsLength = args.length, - holdersIndex = -1, - holdersLength = holders.length, - rightIndex = -1, - rightLength = partials.length, - rangeLength = nativeMax(argsLength - holdersLength, 0), - result = Array(rangeLength + rightLength), - isUncurried = !isCurried; - - while (++argsIndex < rangeLength) { - result[argsIndex] = args[argsIndex]; - } - var offset = argsIndex; - while (++rightIndex < rightLength) { - result[offset + rightIndex] = partials[rightIndex]; - } - while (++holdersIndex < holdersLength) { - if (isUncurried || argsIndex < argsLength) { - result[offset + holders[holdersIndex]] = args[argsIndex++]; - } - } - return result; - } - - /** - * Copies the values of `source` to `array`. - * - * @private - * @param {Array} source The array to copy values from. - * @param {Array} [array=[]] The array to copy values to. - * @returns {Array} Returns `array`. - */ - function copyArray(source, array) { - var index = -1, - length = source.length; - - array || (array = Array(length)); - while (++index < length) { - array[index] = source[index]; - } - return array; - } - - /** - * Copies properties of `source` to `object`. - * - * @private - * @param {Object} source The object to copy properties from. - * @param {Array} props The property identifiers to copy. - * @param {Object} [object={}] The object to copy properties to. - * @param {Function} [customizer] The function to customize copied values. - * @returns {Object} Returns `object`. - */ - function copyObject(source, props, object, customizer) { - var isNew = !object; - object || (object = {}); - - var index = -1, - length = props.length; - - while (++index < length) { - var key = props[index]; - - var newValue = customizer - ? customizer(object[key], source[key], key, object, source) - : undefined; - - if (newValue === undefined) { - newValue = source[key]; - } - if (isNew) { - baseAssignValue(object, key, newValue); - } else { - assignValue(object, key, newValue); - } - } - return object; - } - - /** - * Copies own symbols of `source` to `object`. - * - * @private - * @param {Object} source The object to copy symbols from. - * @param {Object} [object={}] The object to copy symbols to. - * @returns {Object} Returns `object`. - */ - function copySymbols(source, object) { - return copyObject(source, getSymbols(source), object); - } - - /** - * Copies own and inherited symbols of `source` to `object`. - * - * @private - * @param {Object} source The object to copy symbols from. - * @param {Object} [object={}] The object to copy symbols to. - * @returns {Object} Returns `object`. - */ - function copySymbolsIn(source, object) { - return copyObject(source, getSymbolsIn(source), object); - } - - /** - * Creates a function like `_.groupBy`. - * - * @private - * @param {Function} setter The function to set accumulator values. - * @param {Function} [initializer] The accumulator object initializer. - * @returns {Function} Returns the new aggregator function. - */ - function createAggregator(setter, initializer) { - return function(collection, iteratee) { - var func = isArray(collection) ? arrayAggregator : baseAggregator, - accumulator = initializer ? initializer() : {}; - - return func(collection, setter, getIteratee(iteratee, 2), accumulator); - }; - } - - /** - * Creates a function like `_.assign`. - * - * @private - * @param {Function} assigner The function to assign values. - * @returns {Function} Returns the new assigner function. - */ - function createAssigner(assigner) { - return baseRest(function(object, sources) { - var index = -1, - length = sources.length, - customizer = length > 1 ? sources[length - 1] : undefined, - guard = length > 2 ? sources[2] : undefined; - - customizer = (assigner.length > 3 && typeof customizer == 'function') - ? (length--, customizer) - : undefined; - - if (guard && isIterateeCall(sources[0], sources[1], guard)) { - customizer = length < 3 ? undefined : customizer; - length = 1; - } - object = Object(object); - while (++index < length) { - var source = sources[index]; - if (source) { - assigner(object, source, index, customizer); - } - } - return object; - }); - } - - /** - * Creates a `baseEach` or `baseEachRight` function. - * - * @private - * @param {Function} eachFunc The function to iterate over a collection. - * @param {boolean} [fromRight] Specify iterating from right to left. - * @returns {Function} Returns the new base function. - */ - function createBaseEach(eachFunc, fromRight) { - return function(collection, iteratee) { - if (collection == null) { - return collection; - } - if (!isArrayLike(collection)) { - return eachFunc(collection, iteratee); - } - var length = collection.length, - index = fromRight ? length : -1, - iterable = Object(collection); - - while ((fromRight ? index-- : ++index < length)) { - if (iteratee(iterable[index], index, iterable) === false) { - break; - } - } - return collection; - }; - } - - /** - * Creates a base function for methods like `_.forIn` and `_.forOwn`. - * - * @private - * @param {boolean} [fromRight] Specify iterating from right to left. - * @returns {Function} Returns the new base function. - */ - function createBaseFor(fromRight) { - return function(object, iteratee, keysFunc) { - var index = -1, - iterable = Object(object), - props = keysFunc(object), - length = props.length; - - while (length--) { - var key = props[fromRight ? length : ++index]; - if (iteratee(iterable[key], key, iterable) === false) { - break; - } - } - return object; - }; - } - - /** - * Creates a function that wraps `func` to invoke it with the optional `this` - * binding of `thisArg`. - * - * @private - * @param {Function} func The function to wrap. - * @param {number} bitmask The bitmask flags. See `createWrap` for more details. - * @param {*} [thisArg] The `this` binding of `func`. - * @returns {Function} Returns the new wrapped function. - */ - function createBind(func, bitmask, thisArg) { - var isBind = bitmask & WRAP_BIND_FLAG, - Ctor = createCtor(func); - - function wrapper() { - var fn = (this && this !== root && this instanceof wrapper) ? Ctor : func; - return fn.apply(isBind ? thisArg : this, arguments); - } - return wrapper; - } - - /** - * Creates a function like `_.lowerFirst`. - * - * @private - * @param {string} methodName The name of the `String` case method to use. - * @returns {Function} Returns the new case function. - */ - function createCaseFirst(methodName) { - return function(string) { - string = toString(string); - - var strSymbols = hasUnicode(string) - ? stringToArray(string) - : undefined; - - var chr = strSymbols - ? strSymbols[0] - : string.charAt(0); - - var trailing = strSymbols - ? castSlice(strSymbols, 1).join('') - : string.slice(1); - - return chr[methodName]() + trailing; - }; - } - - /** - * Creates a function like `_.camelCase`. - * - * @private - * @param {Function} callback The function to combine each word. - * @returns {Function} Returns the new compounder function. - */ - function createCompounder(callback) { - return function(string) { - return arrayReduce(words(deburr(string).replace(reApos, '')), callback, ''); - }; - } - - /** - * Creates a function that produces an instance of `Ctor` regardless of - * whether it was invoked as part of a `new` expression or by `call` or `apply`. - * - * @private - * @param {Function} Ctor The constructor to wrap. - * @returns {Function} Returns the new wrapped function. - */ - function createCtor(Ctor) { - return function() { - // Use a `switch` statement to work with class constructors. See - // http://ecma-international.org/ecma-262/7.0/#sec-ecmascript-function-objects-call-thisargument-argumentslist - // for more details. - var args = arguments; - switch (args.length) { - case 0: return new Ctor; - case 1: return new Ctor(args[0]); - case 2: return new Ctor(args[0], args[1]); - case 3: return new Ctor(args[0], args[1], args[2]); - case 4: return new Ctor(args[0], args[1], args[2], args[3]); - case 5: return new Ctor(args[0], args[1], args[2], args[3], args[4]); - case 6: return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5]); - case 7: return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5], args[6]); - } - var thisBinding = baseCreate(Ctor.prototype), - result = Ctor.apply(thisBinding, args); - - // Mimic the constructor's `return` behavior. - // See https://es5.github.io/#x13.2.2 for more details. - return isObject(result) ? result : thisBinding; - }; - } - - /** - * Creates a function that wraps `func` to enable currying. - * - * @private - * @param {Function} func The function to wrap. - * @param {number} bitmask The bitmask flags. See `createWrap` for more details. - * @param {number} arity The arity of `func`. - * @returns {Function} Returns the new wrapped function. - */ - function createCurry(func, bitmask, arity) { - var Ctor = createCtor(func); - - function wrapper() { - var length = arguments.length, - args = Array(length), - index = length, - placeholder = getHolder(wrapper); - - while (index--) { - args[index] = arguments[index]; - } - var holders = (length < 3 && args[0] !== placeholder && args[length - 1] !== placeholder) - ? [] - : replaceHolders(args, placeholder); - - length -= holders.length; - if (length < arity) { - return createRecurry( - func, bitmask, createHybrid, wrapper.placeholder, undefined, - args, holders, undefined, undefined, arity - length); - } - var fn = (this && this !== root && this instanceof wrapper) ? Ctor : func; - return apply(fn, this, args); - } - return wrapper; - } - - /** - * Creates a `_.find` or `_.findLast` function. - * - * @private - * @param {Function} findIndexFunc The function to find the collection index. - * @returns {Function} Returns the new find function. - */ - function createFind(findIndexFunc) { - return function(collection, predicate, fromIndex) { - var iterable = Object(collection); - if (!isArrayLike(collection)) { - var iteratee = getIteratee(predicate, 3); - collection = keys(collection); - predicate = function(key) { return iteratee(iterable[key], key, iterable); }; - } - var index = findIndexFunc(collection, predicate, fromIndex); - return index > -1 ? iterable[iteratee ? collection[index] : index] : undefined; - }; - } - - /** - * Creates a `_.flow` or `_.flowRight` function. - * - * @private - * @param {boolean} [fromRight] Specify iterating from right to left. - * @returns {Function} Returns the new flow function. - */ - function createFlow(fromRight) { - return flatRest(function(funcs) { - var length = funcs.length, - index = length, - prereq = LodashWrapper.prototype.thru; - - if (fromRight) { - funcs.reverse(); - } - while (index--) { - var func = funcs[index]; - if (typeof func != 'function') { - throw new TypeError(FUNC_ERROR_TEXT); - } - if (prereq && !wrapper && getFuncName(func) == 'wrapper') { - var wrapper = new LodashWrapper([], true); - } - } - index = wrapper ? index : length; - while (++index < length) { - func = funcs[index]; - - var funcName = getFuncName(func), - data = funcName == 'wrapper' ? getData(func) : undefined; - - if (data && isLaziable(data[0]) && - data[1] == (WRAP_ARY_FLAG | WRAP_CURRY_FLAG | WRAP_PARTIAL_FLAG | WRAP_REARG_FLAG) && - !data[4].length && data[9] == 1 - ) { - wrapper = wrapper[getFuncName(data[0])].apply(wrapper, data[3]); - } else { - wrapper = (func.length == 1 && isLaziable(func)) - ? wrapper[funcName]() - : wrapper.thru(func); - } - } - return function() { - var args = arguments, - value = args[0]; - - if (wrapper && args.length == 1 && isArray(value)) { - return wrapper.plant(value).value(); - } - var index = 0, - result = length ? funcs[index].apply(this, args) : value; - - while (++index < length) { - result = funcs[index].call(this, result); - } - return result; - }; - }); - } - - /** - * Creates a function that wraps `func` to invoke it with optional `this` - * binding of `thisArg`, partial application, and currying. - * - * @private - * @param {Function|string} func The function or method name to wrap. - * @param {number} bitmask The bitmask flags. See `createWrap` for more details. - * @param {*} [thisArg] The `this` binding of `func`. - * @param {Array} [partials] The arguments to prepend to those provided to - * the new function. - * @param {Array} [holders] The `partials` placeholder indexes. - * @param {Array} [partialsRight] The arguments to append to those provided - * to the new function. - * @param {Array} [holdersRight] The `partialsRight` placeholder indexes. - * @param {Array} [argPos] The argument positions of the new function. - * @param {number} [ary] The arity cap of `func`. - * @param {number} [arity] The arity of `func`. - * @returns {Function} Returns the new wrapped function. - */ - function createHybrid(func, bitmask, thisArg, partials, holders, partialsRight, holdersRight, argPos, ary, arity) { - var isAry = bitmask & WRAP_ARY_FLAG, - isBind = bitmask & WRAP_BIND_FLAG, - isBindKey = bitmask & WRAP_BIND_KEY_FLAG, - isCurried = bitmask & (WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG), - isFlip = bitmask & WRAP_FLIP_FLAG, - Ctor = isBindKey ? undefined : createCtor(func); - - function wrapper() { - var length = arguments.length, - args = Array(length), - index = length; - - while (index--) { - args[index] = arguments[index]; - } - if (isCurried) { - var placeholder = getHolder(wrapper), - holdersCount = countHolders(args, placeholder); - } - if (partials) { - args = composeArgs(args, partials, holders, isCurried); - } - if (partialsRight) { - args = composeArgsRight(args, partialsRight, holdersRight, isCurried); - } - length -= holdersCount; - if (isCurried && length < arity) { - var newHolders = replaceHolders(args, placeholder); - return createRecurry( - func, bitmask, createHybrid, wrapper.placeholder, thisArg, - args, newHolders, argPos, ary, arity - length - ); - } - var thisBinding = isBind ? thisArg : this, - fn = isBindKey ? thisBinding[func] : func; - - length = args.length; - if (argPos) { - args = reorder(args, argPos); - } else if (isFlip && length > 1) { - args.reverse(); - } - if (isAry && ary < length) { - args.length = ary; - } - if (this && this !== root && this instanceof wrapper) { - fn = Ctor || createCtor(fn); - } - return fn.apply(thisBinding, args); - } - return wrapper; - } - - /** - * Creates a function like `_.invertBy`. - * - * @private - * @param {Function} setter The function to set accumulator values. - * @param {Function} toIteratee The function to resolve iteratees. - * @returns {Function} Returns the new inverter function. - */ - function createInverter(setter, toIteratee) { - return function(object, iteratee) { - return baseInverter(object, setter, toIteratee(iteratee), {}); - }; - } - - /** - * Creates a function that performs a mathematical operation on two values. - * - * @private - * @param {Function} operator The function to perform the operation. - * @param {number} [defaultValue] The value used for `undefined` arguments. - * @returns {Function} Returns the new mathematical operation function. - */ - function createMathOperation(operator, defaultValue) { - return function(value, other) { - var result; - if (value === undefined && other === undefined) { - return defaultValue; - } - if (value !== undefined) { - result = value; - } - if (other !== undefined) { - if (result === undefined) { - return other; - } - if (typeof value == 'string' || typeof other == 'string') { - value = baseToString(value); - other = baseToString(other); - } else { - value = baseToNumber(value); - other = baseToNumber(other); - } - result = operator(value, other); - } - return result; - }; - } - - /** - * Creates a function like `_.over`. - * - * @private - * @param {Function} arrayFunc The function to iterate over iteratees. - * @returns {Function} Returns the new over function. - */ - function createOver(arrayFunc) { - return flatRest(function(iteratees) { - iteratees = arrayMap(iteratees, baseUnary(getIteratee())); - return baseRest(function(args) { - var thisArg = this; - return arrayFunc(iteratees, function(iteratee) { - return apply(iteratee, thisArg, args); - }); - }); - }); - } - - /** - * Creates the padding for `string` based on `length`. The `chars` string - * is truncated if the number of characters exceeds `length`. - * - * @private - * @param {number} length The padding length. - * @param {string} [chars=' '] The string used as padding. - * @returns {string} Returns the padding for `string`. - */ - function createPadding(length, chars) { - chars = chars === undefined ? ' ' : baseToString(chars); - - var charsLength = chars.length; - if (charsLength < 2) { - return charsLength ? baseRepeat(chars, length) : chars; - } - var result = baseRepeat(chars, nativeCeil(length / stringSize(chars))); - return hasUnicode(chars) - ? castSlice(stringToArray(result), 0, length).join('') - : result.slice(0, length); - } - - /** - * Creates a function that wraps `func` to invoke it with the `this` binding - * of `thisArg` and `partials` prepended to the arguments it receives. - * - * @private - * @param {Function} func The function to wrap. - * @param {number} bitmask The bitmask flags. See `createWrap` for more details. - * @param {*} thisArg The `this` binding of `func`. - * @param {Array} partials The arguments to prepend to those provided to - * the new function. - * @returns {Function} Returns the new wrapped function. - */ - function createPartial(func, bitmask, thisArg, partials) { - var isBind = bitmask & WRAP_BIND_FLAG, - Ctor = createCtor(func); - - function wrapper() { - var argsIndex = -1, - argsLength = arguments.length, - leftIndex = -1, - leftLength = partials.length, - args = Array(leftLength + argsLength), - fn = (this && this !== root && this instanceof wrapper) ? Ctor : func; - - while (++leftIndex < leftLength) { - args[leftIndex] = partials[leftIndex]; - } - while (argsLength--) { - args[leftIndex++] = arguments[++argsIndex]; - } - return apply(fn, isBind ? thisArg : this, args); - } - return wrapper; - } - - /** - * Creates a `_.range` or `_.rangeRight` function. - * - * @private - * @param {boolean} [fromRight] Specify iterating from right to left. - * @returns {Function} Returns the new range function. - */ - function createRange(fromRight) { - return function(start, end, step) { - if (step && typeof step != 'number' && isIterateeCall(start, end, step)) { - end = step = undefined; - } - // Ensure the sign of `-0` is preserved. - start = toFinite(start); - if (end === undefined) { - end = start; - start = 0; - } else { - end = toFinite(end); - } - step = step === undefined ? (start < end ? 1 : -1) : toFinite(step); - return baseRange(start, end, step, fromRight); - }; - } - - /** - * Creates a function that performs a relational operation on two values. - * - * @private - * @param {Function} operator The function to perform the operation. - * @returns {Function} Returns the new relational operation function. - */ - function createRelationalOperation(operator) { - return function(value, other) { - if (!(typeof value == 'string' && typeof other == 'string')) { - value = toNumber(value); - other = toNumber(other); - } - return operator(value, other); - }; - } - - /** - * Creates a function that wraps `func` to continue currying. - * - * @private - * @param {Function} func The function to wrap. - * @param {number} bitmask The bitmask flags. See `createWrap` for more details. - * @param {Function} wrapFunc The function to create the `func` wrapper. - * @param {*} placeholder The placeholder value. - * @param {*} [thisArg] The `this` binding of `func`. - * @param {Array} [partials] The arguments to prepend to those provided to - * the new function. - * @param {Array} [holders] The `partials` placeholder indexes. - * @param {Array} [argPos] The argument positions of the new function. - * @param {number} [ary] The arity cap of `func`. - * @param {number} [arity] The arity of `func`. - * @returns {Function} Returns the new wrapped function. - */ - function createRecurry(func, bitmask, wrapFunc, placeholder, thisArg, partials, holders, argPos, ary, arity) { - var isCurry = bitmask & WRAP_CURRY_FLAG, - newHolders = isCurry ? holders : undefined, - newHoldersRight = isCurry ? undefined : holders, - newPartials = isCurry ? partials : undefined, - newPartialsRight = isCurry ? undefined : partials; - - bitmask |= (isCurry ? WRAP_PARTIAL_FLAG : WRAP_PARTIAL_RIGHT_FLAG); - bitmask &= ~(isCurry ? WRAP_PARTIAL_RIGHT_FLAG : WRAP_PARTIAL_FLAG); - - if (!(bitmask & WRAP_CURRY_BOUND_FLAG)) { - bitmask &= ~(WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG); - } - var newData = [ - func, bitmask, thisArg, newPartials, newHolders, newPartialsRight, - newHoldersRight, argPos, ary, arity - ]; - - var result = wrapFunc.apply(undefined, newData); - if (isLaziable(func)) { - setData(result, newData); - } - result.placeholder = placeholder; - return setWrapToString(result, func, bitmask); - } - - /** - * Creates a function like `_.round`. - * - * @private - * @param {string} methodName The name of the `Math` method to use when rounding. - * @returns {Function} Returns the new round function. - */ - function createRound(methodName) { - var func = Math[methodName]; - return function(number, precision) { - number = toNumber(number); - precision = precision == null ? 0 : nativeMin(toInteger(precision), 292); - if (precision && nativeIsFinite(number)) { - // Shift with exponential notation to avoid floating-point issues. - // See [MDN](https://mdn.io/round#Examples) for more details. - var pair = (toString(number) + 'e').split('e'), - value = func(pair[0] + 'e' + (+pair[1] + precision)); - - pair = (toString(value) + 'e').split('e'); - return +(pair[0] + 'e' + (+pair[1] - precision)); - } - return func(number); - }; - } - - /** - * Creates a set object of `values`. - * - * @private - * @param {Array} values The values to add to the set. - * @returns {Object} Returns the new set. - */ - var createSet = !(Set && (1 / setToArray(new Set([,-0]))[1]) == INFINITY) ? noop : function(values) { - return new Set(values); - }; - - /** - * Creates a `_.toPairs` or `_.toPairsIn` function. - * - * @private - * @param {Function} keysFunc The function to get the keys of a given object. - * @returns {Function} Returns the new pairs function. - */ - function createToPairs(keysFunc) { - return function(object) { - var tag = getTag(object); - if (tag == mapTag) { - return mapToArray(object); - } - if (tag == setTag) { - return setToPairs(object); - } - return baseToPairs(object, keysFunc(object)); - }; - } - - /** - * Creates a function that either curries or invokes `func` with optional - * `this` binding and partially applied arguments. - * - * @private - * @param {Function|string} func The function or method name to wrap. - * @param {number} bitmask The bitmask flags. - * 1 - `_.bind` - * 2 - `_.bindKey` - * 4 - `_.curry` or `_.curryRight` of a bound function - * 8 - `_.curry` - * 16 - `_.curryRight` - * 32 - `_.partial` - * 64 - `_.partialRight` - * 128 - `_.rearg` - * 256 - `_.ary` - * 512 - `_.flip` - * @param {*} [thisArg] The `this` binding of `func`. - * @param {Array} [partials] The arguments to be partially applied. - * @param {Array} [holders] The `partials` placeholder indexes. - * @param {Array} [argPos] The argument positions of the new function. - * @param {number} [ary] The arity cap of `func`. - * @param {number} [arity] The arity of `func`. - * @returns {Function} Returns the new wrapped function. - */ - function createWrap(func, bitmask, thisArg, partials, holders, argPos, ary, arity) { - var isBindKey = bitmask & WRAP_BIND_KEY_FLAG; - if (!isBindKey && typeof func != 'function') { - throw new TypeError(FUNC_ERROR_TEXT); - } - var length = partials ? partials.length : 0; - if (!length) { - bitmask &= ~(WRAP_PARTIAL_FLAG | WRAP_PARTIAL_RIGHT_FLAG); - partials = holders = undefined; - } - ary = ary === undefined ? ary : nativeMax(toInteger(ary), 0); - arity = arity === undefined ? arity : toInteger(arity); - length -= holders ? holders.length : 0; - - if (bitmask & WRAP_PARTIAL_RIGHT_FLAG) { - var partialsRight = partials, - holdersRight = holders; - - partials = holders = undefined; - } - var data = isBindKey ? undefined : getData(func); - - var newData = [ - func, bitmask, thisArg, partials, holders, partialsRight, holdersRight, - argPos, ary, arity - ]; - - if (data) { - mergeData(newData, data); - } - func = newData[0]; - bitmask = newData[1]; - thisArg = newData[2]; - partials = newData[3]; - holders = newData[4]; - arity = newData[9] = newData[9] === undefined - ? (isBindKey ? 0 : func.length) - : nativeMax(newData[9] - length, 0); - - if (!arity && bitmask & (WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG)) { - bitmask &= ~(WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG); - } - if (!bitmask || bitmask == WRAP_BIND_FLAG) { - var result = createBind(func, bitmask, thisArg); - } else if (bitmask == WRAP_CURRY_FLAG || bitmask == WRAP_CURRY_RIGHT_FLAG) { - result = createCurry(func, bitmask, arity); - } else if ((bitmask == WRAP_PARTIAL_FLAG || bitmask == (WRAP_BIND_FLAG | WRAP_PARTIAL_FLAG)) && !holders.length) { - result = createPartial(func, bitmask, thisArg, partials); - } else { - result = createHybrid.apply(undefined, newData); - } - var setter = data ? baseSetData : setData; - return setWrapToString(setter(result, newData), func, bitmask); - } - - /** - * Used by `_.defaults` to customize its `_.assignIn` use to assign properties - * of source objects to the destination object for all destination properties - * that resolve to `undefined`. - * - * @private - * @param {*} objValue The destination value. - * @param {*} srcValue The source value. - * @param {string} key The key of the property to assign. - * @param {Object} object The parent object of `objValue`. - * @returns {*} Returns the value to assign. - */ - function customDefaultsAssignIn(objValue, srcValue, key, object) { - if (objValue === undefined || - (eq(objValue, objectProto[key]) && !hasOwnProperty.call(object, key))) { - return srcValue; - } - return objValue; - } - - /** - * Used by `_.defaultsDeep` to customize its `_.merge` use to merge source - * objects into destination objects that are passed thru. - * - * @private - * @param {*} objValue The destination value. - * @param {*} srcValue The source value. - * @param {string} key The key of the property to merge. - * @param {Object} object The parent object of `objValue`. - * @param {Object} source The parent object of `srcValue`. - * @param {Object} [stack] Tracks traversed source values and their merged - * counterparts. - * @returns {*} Returns the value to assign. - */ - function customDefaultsMerge(objValue, srcValue, key, object, source, stack) { - if (isObject(objValue) && isObject(srcValue)) { - // Recursively merge objects and arrays (susceptible to call stack limits). - stack.set(srcValue, objValue); - baseMerge(objValue, srcValue, undefined, customDefaultsMerge, stack); - stack['delete'](srcValue); - } - return objValue; - } - - /** - * Used by `_.omit` to customize its `_.cloneDeep` use to only clone plain - * objects. - * - * @private - * @param {*} value The value to inspect. - * @param {string} key The key of the property to inspect. - * @returns {*} Returns the uncloned value or `undefined` to defer cloning to `_.cloneDeep`. - */ - function customOmitClone(value) { - return isPlainObject(value) ? undefined : value; - } - - /** - * A specialized version of `baseIsEqualDeep` for arrays with support for - * partial deep comparisons. - * - * @private - * @param {Array} array The array to compare. - * @param {Array} other The other array to compare. - * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details. - * @param {Function} customizer The function to customize comparisons. - * @param {Function} equalFunc The function to determine equivalents of values. - * @param {Object} stack Tracks traversed `array` and `other` objects. - * @returns {boolean} Returns `true` if the arrays are equivalent, else `false`. - */ - function equalArrays(array, other, bitmask, customizer, equalFunc, stack) { - var isPartial = bitmask & COMPARE_PARTIAL_FLAG, - arrLength = array.length, - othLength = other.length; - - if (arrLength != othLength && !(isPartial && othLength > arrLength)) { - return false; - } - // Check that cyclic values are equal. - var arrStacked = stack.get(array); - var othStacked = stack.get(other); - if (arrStacked && othStacked) { - return arrStacked == other && othStacked == array; - } - var index = -1, - result = true, - seen = (bitmask & COMPARE_UNORDERED_FLAG) ? new SetCache : undefined; - - stack.set(array, other); - stack.set(other, array); - - // Ignore non-index properties. - while (++index < arrLength) { - var arrValue = array[index], - othValue = other[index]; - - if (customizer) { - var compared = isPartial - ? customizer(othValue, arrValue, index, other, array, stack) - : customizer(arrValue, othValue, index, array, other, stack); - } - if (compared !== undefined) { - if (compared) { - continue; - } - result = false; - break; - } - // Recursively compare arrays (susceptible to call stack limits). - if (seen) { - if (!arraySome(other, function(othValue, othIndex) { - if (!cacheHas(seen, othIndex) && - (arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) { - return seen.push(othIndex); - } - })) { - result = false; - break; - } - } else if (!( - arrValue === othValue || - equalFunc(arrValue, othValue, bitmask, customizer, stack) - )) { - result = false; - break; - } - } - stack['delete'](array); - stack['delete'](other); - return result; - } - - /** - * A specialized version of `baseIsEqualDeep` for comparing objects of - * the same `toStringTag`. - * - * **Note:** This function only supports comparing values with tags of - * `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`. - * - * @private - * @param {Object} object The object to compare. - * @param {Object} other The other object to compare. - * @param {string} tag The `toStringTag` of the objects to compare. - * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details. - * @param {Function} customizer The function to customize comparisons. - * @param {Function} equalFunc The function to determine equivalents of values. - * @param {Object} stack Tracks traversed `object` and `other` objects. - * @returns {boolean} Returns `true` if the objects are equivalent, else `false`. - */ - function equalByTag(object, other, tag, bitmask, customizer, equalFunc, stack) { - switch (tag) { - case dataViewTag: - if ((object.byteLength != other.byteLength) || - (object.byteOffset != other.byteOffset)) { - return false; - } - object = object.buffer; - other = other.buffer; - - case arrayBufferTag: - if ((object.byteLength != other.byteLength) || - !equalFunc(new Uint8Array(object), new Uint8Array(other))) { - return false; - } - return true; - - case boolTag: - case dateTag: - case numberTag: - // Coerce booleans to `1` or `0` and dates to milliseconds. - // Invalid dates are coerced to `NaN`. - return eq(+object, +other); - - case errorTag: - return object.name == other.name && object.message == other.message; - - case regexpTag: - case stringTag: - // Coerce regexes to strings and treat strings, primitives and objects, - // as equal. See http://www.ecma-international.org/ecma-262/7.0/#sec-regexp.prototype.tostring - // for more details. - return object == (other + ''); - - case mapTag: - var convert = mapToArray; - - case setTag: - var isPartial = bitmask & COMPARE_PARTIAL_FLAG; - convert || (convert = setToArray); - - if (object.size != other.size && !isPartial) { - return false; - } - // Assume cyclic values are equal. - var stacked = stack.get(object); - if (stacked) { - return stacked == other; - } - bitmask |= COMPARE_UNORDERED_FLAG; - - // Recursively compare objects (susceptible to call stack limits). - stack.set(object, other); - var result = equalArrays(convert(object), convert(other), bitmask, customizer, equalFunc, stack); - stack['delete'](object); - return result; - - case symbolTag: - if (symbolValueOf) { - return symbolValueOf.call(object) == symbolValueOf.call(other); - } - } - return false; - } - - /** - * A specialized version of `baseIsEqualDeep` for objects with support for - * partial deep comparisons. - * - * @private - * @param {Object} object The object to compare. - * @param {Object} other The other object to compare. - * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details. - * @param {Function} customizer The function to customize comparisons. - * @param {Function} equalFunc The function to determine equivalents of values. - * @param {Object} stack Tracks traversed `object` and `other` objects. - * @returns {boolean} Returns `true` if the objects are equivalent, else `false`. - */ - function equalObjects(object, other, bitmask, customizer, equalFunc, stack) { - var isPartial = bitmask & COMPARE_PARTIAL_FLAG, - objProps = getAllKeys(object), - objLength = objProps.length, - othProps = getAllKeys(other), - othLength = othProps.length; - - if (objLength != othLength && !isPartial) { - return false; - } - var index = objLength; - while (index--) { - var key = objProps[index]; - if (!(isPartial ? key in other : hasOwnProperty.call(other, key))) { - return false; - } - } - // Check that cyclic values are equal. - var objStacked = stack.get(object); - var othStacked = stack.get(other); - if (objStacked && othStacked) { - return objStacked == other && othStacked == object; - } - var result = true; - stack.set(object, other); - stack.set(other, object); - - var skipCtor = isPartial; - while (++index < objLength) { - key = objProps[index]; - var objValue = object[key], - othValue = other[key]; - - if (customizer) { - var compared = isPartial - ? customizer(othValue, objValue, key, other, object, stack) - : customizer(objValue, othValue, key, object, other, stack); - } - // Recursively compare objects (susceptible to call stack limits). - if (!(compared === undefined - ? (objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack)) - : compared - )) { - result = false; - break; - } - skipCtor || (skipCtor = key == 'constructor'); - } - if (result && !skipCtor) { - var objCtor = object.constructor, - othCtor = other.constructor; - - // Non `Object` object instances with different constructors are not equal. - if (objCtor != othCtor && - ('constructor' in object && 'constructor' in other) && - !(typeof objCtor == 'function' && objCtor instanceof objCtor && - typeof othCtor == 'function' && othCtor instanceof othCtor)) { - result = false; - } - } - stack['delete'](object); - stack['delete'](other); - return result; - } - - /** - * A specialized version of `baseRest` which flattens the rest array. - * - * @private - * @param {Function} func The function to apply a rest parameter to. - * @returns {Function} Returns the new function. - */ - function flatRest(func) { - return setToString(overRest(func, undefined, flatten), func + ''); - } - - /** - * Creates an array of own enumerable property names and symbols of `object`. - * - * @private - * @param {Object} object The object to query. - * @returns {Array} Returns the array of property names and symbols. - */ - function getAllKeys(object) { - return baseGetAllKeys(object, keys, getSymbols); - } - - /** - * Creates an array of own and inherited enumerable property names and - * symbols of `object`. - * - * @private - * @param {Object} object The object to query. - * @returns {Array} Returns the array of property names and symbols. - */ - function getAllKeysIn(object) { - return baseGetAllKeys(object, keysIn, getSymbolsIn); - } - - /** - * Gets metadata for `func`. - * - * @private - * @param {Function} func The function to query. - * @returns {*} Returns the metadata for `func`. - */ - var getData = !metaMap ? noop : function(func) { - return metaMap.get(func); - }; - - /** - * Gets the name of `func`. - * - * @private - * @param {Function} func The function to query. - * @returns {string} Returns the function name. - */ - function getFuncName(func) { - var result = (func.name + ''), - array = realNames[result], - length = hasOwnProperty.call(realNames, result) ? array.length : 0; - - while (length--) { - var data = array[length], - otherFunc = data.func; - if (otherFunc == null || otherFunc == func) { - return data.name; - } - } - return result; - } - - /** - * Gets the argument placeholder value for `func`. - * - * @private - * @param {Function} func The function to inspect. - * @returns {*} Returns the placeholder value. - */ - function getHolder(func) { - var object = hasOwnProperty.call(lodash, 'placeholder') ? lodash : func; - return object.placeholder; - } - - /** - * Gets the appropriate "iteratee" function. If `_.iteratee` is customized, - * this function returns the custom method, otherwise it returns `baseIteratee`. - * If arguments are provided, the chosen function is invoked with them and - * its result is returned. - * - * @private - * @param {*} [value] The value to convert to an iteratee. - * @param {number} [arity] The arity of the created iteratee. - * @returns {Function} Returns the chosen function or its result. - */ - function getIteratee() { - var result = lodash.iteratee || iteratee; - result = result === iteratee ? baseIteratee : result; - return arguments.length ? result(arguments[0], arguments[1]) : result; - } - - /** - * Gets the data for `map`. - * - * @private - * @param {Object} map The map to query. - * @param {string} key The reference key. - * @returns {*} Returns the map data. - */ - function getMapData(map, key) { - var data = map.__data__; - return isKeyable(key) - ? data[typeof key == 'string' ? 'string' : 'hash'] - : data.map; - } - - /** - * Gets the property names, values, and compare flags of `object`. - * - * @private - * @param {Object} object The object to query. - * @returns {Array} Returns the match data of `object`. - */ - function getMatchData(object) { - var result = keys(object), - length = result.length; - - while (length--) { - var key = result[length], - value = object[key]; - - result[length] = [key, value, isStrictComparable(value)]; - } - return result; - } - - /** - * Gets the native function at `key` of `object`. - * - * @private - * @param {Object} object The object to query. - * @param {string} key The key of the method to get. - * @returns {*} Returns the function if it's native, else `undefined`. - */ - function getNative(object, key) { - var value = getValue(object, key); - return baseIsNative(value) ? value : undefined; - } - - /** - * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values. - * - * @private - * @param {*} value The value to query. - * @returns {string} Returns the raw `toStringTag`. - */ - function getRawTag(value) { - var isOwn = hasOwnProperty.call(value, symToStringTag), - tag = value[symToStringTag]; - - try { - value[symToStringTag] = undefined; - var unmasked = true; - } catch (e) {} - - var result = nativeObjectToString.call(value); - if (unmasked) { - if (isOwn) { - value[symToStringTag] = tag; - } else { - delete value[symToStringTag]; - } - } - return result; - } - - /** - * Creates an array of the own enumerable symbols of `object`. - * - * @private - * @param {Object} object The object to query. - * @returns {Array} Returns the array of symbols. - */ - var getSymbols = !nativeGetSymbols ? stubArray : function(object) { - if (object == null) { - return []; - } - object = Object(object); - return arrayFilter(nativeGetSymbols(object), function(symbol) { - return propertyIsEnumerable.call(object, symbol); - }); - }; - - /** - * Creates an array of the own and inherited enumerable symbols of `object`. - * - * @private - * @param {Object} object The object to query. - * @returns {Array} Returns the array of symbols. - */ - var getSymbolsIn = !nativeGetSymbols ? stubArray : function(object) { - var result = []; - while (object) { - arrayPush(result, getSymbols(object)); - object = getPrototype(object); - } - return result; - }; - - /** - * Gets the `toStringTag` of `value`. - * - * @private - * @param {*} value The value to query. - * @returns {string} Returns the `toStringTag`. - */ - var getTag = baseGetTag; - - // Fallback for data views, maps, sets, and weak maps in IE 11 and promises in Node.js < 6. - if ((DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag) || - (Map && getTag(new Map) != mapTag) || - (Promise && getTag(Promise.resolve()) != promiseTag) || - (Set && getTag(new Set) != setTag) || - (WeakMap && getTag(new WeakMap) != weakMapTag)) { - getTag = function(value) { - var result = baseGetTag(value), - Ctor = result == objectTag ? value.constructor : undefined, - ctorString = Ctor ? toSource(Ctor) : ''; - - if (ctorString) { - switch (ctorString) { - case dataViewCtorString: return dataViewTag; - case mapCtorString: return mapTag; - case promiseCtorString: return promiseTag; - case setCtorString: return setTag; - case weakMapCtorString: return weakMapTag; - } - } - return result; - }; - } - - /** - * Gets the view, applying any `transforms` to the `start` and `end` positions. - * - * @private - * @param {number} start The start of the view. - * @param {number} end The end of the view. - * @param {Array} transforms The transformations to apply to the view. - * @returns {Object} Returns an object containing the `start` and `end` - * positions of the view. - */ - function getView(start, end, transforms) { - var index = -1, - length = transforms.length; - - while (++index < length) { - var data = transforms[index], - size = data.size; - - switch (data.type) { - case 'drop': start += size; break; - case 'dropRight': end -= size; break; - case 'take': end = nativeMin(end, start + size); break; - case 'takeRight': start = nativeMax(start, end - size); break; - } - } - return { 'start': start, 'end': end }; - } - - /** - * Extracts wrapper details from the `source` body comment. - * - * @private - * @param {string} source The source to inspect. - * @returns {Array} Returns the wrapper details. - */ - function getWrapDetails(source) { - var match = source.match(reWrapDetails); - return match ? match[1].split(reSplitDetails) : []; - } - - /** - * Checks if `path` exists on `object`. - * - * @private - * @param {Object} object The object to query. - * @param {Array|string} path The path to check. - * @param {Function} hasFunc The function to check properties. - * @returns {boolean} Returns `true` if `path` exists, else `false`. - */ - function hasPath(object, path, hasFunc) { - path = castPath(path, object); - - var index = -1, - length = path.length, - result = false; - - while (++index < length) { - var key = toKey(path[index]); - if (!(result = object != null && hasFunc(object, key))) { - break; - } - object = object[key]; - } - if (result || ++index != length) { - return result; - } - length = object == null ? 0 : object.length; - return !!length && isLength(length) && isIndex(key, length) && - (isArray(object) || isArguments(object)); - } - - /** - * Initializes an array clone. - * - * @private - * @param {Array} array The array to clone. - * @returns {Array} Returns the initialized clone. - */ - function initCloneArray(array) { - var length = array.length, - result = new array.constructor(length); - - // Add properties assigned by `RegExp#exec`. - if (length && typeof array[0] == 'string' && hasOwnProperty.call(array, 'index')) { - result.index = array.index; - result.input = array.input; - } - return result; - } - - /** - * Initializes an object clone. - * - * @private - * @param {Object} object The object to clone. - * @returns {Object} Returns the initialized clone. - */ - function initCloneObject(object) { - return (typeof object.constructor == 'function' && !isPrototype(object)) - ? baseCreate(getPrototype(object)) - : {}; - } - - /** - * Initializes an object clone based on its `toStringTag`. - * - * **Note:** This function only supports cloning values with tags of - * `Boolean`, `Date`, `Error`, `Map`, `Number`, `RegExp`, `Set`, or `String`. - * - * @private - * @param {Object} object The object to clone. - * @param {string} tag The `toStringTag` of the object to clone. - * @param {boolean} [isDeep] Specify a deep clone. - * @returns {Object} Returns the initialized clone. - */ - function initCloneByTag(object, tag, isDeep) { - var Ctor = object.constructor; - switch (tag) { - case arrayBufferTag: - return cloneArrayBuffer(object); - - case boolTag: - case dateTag: - return new Ctor(+object); - - case dataViewTag: - return cloneDataView(object, isDeep); - - case float32Tag: case float64Tag: - case int8Tag: case int16Tag: case int32Tag: - case uint8Tag: case uint8ClampedTag: case uint16Tag: case uint32Tag: - return cloneTypedArray(object, isDeep); - - case mapTag: - return new Ctor; - - case numberTag: - case stringTag: - return new Ctor(object); - - case regexpTag: - return cloneRegExp(object); - - case setTag: - return new Ctor; - - case symbolTag: - return cloneSymbol(object); - } - } - - /** - * Inserts wrapper `details` in a comment at the top of the `source` body. - * - * @private - * @param {string} source The source to modify. - * @returns {Array} details The details to insert. - * @returns {string} Returns the modified source. - */ - function insertWrapDetails(source, details) { - var length = details.length; - if (!length) { - return source; - } - var lastIndex = length - 1; - details[lastIndex] = (length > 1 ? '& ' : '') + details[lastIndex]; - details = details.join(length > 2 ? ', ' : ' '); - return source.replace(reWrapComment, '{\n/* [wrapped with ' + details + '] */\n'); - } - - /** - * Checks if `value` is a flattenable `arguments` object or array. - * - * @private - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is flattenable, else `false`. - */ - function isFlattenable(value) { - return isArray(value) || isArguments(value) || - !!(spreadableSymbol && value && value[spreadableSymbol]); - } - - /** - * Checks if `value` is a valid array-like index. - * - * @private - * @param {*} value The value to check. - * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index. - * @returns {boolean} Returns `true` if `value` is a valid index, else `false`. - */ - function isIndex(value, length) { - var type = typeof value; - length = length == null ? MAX_SAFE_INTEGER : length; - - return !!length && - (type == 'number' || - (type != 'symbol' && reIsUint.test(value))) && - (value > -1 && value % 1 == 0 && value < length); - } - - /** - * Checks if the given arguments are from an iteratee call. - * - * @private - * @param {*} value The potential iteratee value argument. - * @param {*} index The potential iteratee index or key argument. - * @param {*} object The potential iteratee object argument. - * @returns {boolean} Returns `true` if the arguments are from an iteratee call, - * else `false`. - */ - function isIterateeCall(value, index, object) { - if (!isObject(object)) { - return false; - } - var type = typeof index; - if (type == 'number' - ? (isArrayLike(object) && isIndex(index, object.length)) - : (type == 'string' && index in object) - ) { - return eq(object[index], value); - } - return false; - } - - /** - * Checks if `value` is a property name and not a property path. - * - * @private - * @param {*} value The value to check. - * @param {Object} [object] The object to query keys on. - * @returns {boolean} Returns `true` if `value` is a property name, else `false`. - */ - function isKey(value, object) { - if (isArray(value)) { - return false; - } - var type = typeof value; - if (type == 'number' || type == 'symbol' || type == 'boolean' || - value == null || isSymbol(value)) { - return true; - } - return reIsPlainProp.test(value) || !reIsDeepProp.test(value) || - (object != null && value in Object(object)); - } - - /** - * Checks if `value` is suitable for use as unique object key. - * - * @private - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is suitable, else `false`. - */ - function isKeyable(value) { - var type = typeof value; - return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean') - ? (value !== '__proto__') - : (value === null); - } - - /** - * Checks if `func` has a lazy counterpart. - * - * @private - * @param {Function} func The function to check. - * @returns {boolean} Returns `true` if `func` has a lazy counterpart, - * else `false`. - */ - function isLaziable(func) { - var funcName = getFuncName(func), - other = lodash[funcName]; - - if (typeof other != 'function' || !(funcName in LazyWrapper.prototype)) { - return false; - } - if (func === other) { - return true; - } - var data = getData(other); - return !!data && func === data[0]; - } - - /** - * Checks if `func` has its source masked. - * - * @private - * @param {Function} func The function to check. - * @returns {boolean} Returns `true` if `func` is masked, else `false`. - */ - function isMasked(func) { - return !!maskSrcKey && (maskSrcKey in func); - } - - /** - * Checks if `func` is capable of being masked. - * - * @private - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `func` is maskable, else `false`. - */ - var isMaskable = coreJsData ? isFunction : stubFalse; - - /** - * Checks if `value` is likely a prototype object. - * - * @private - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a prototype, else `false`. - */ - function isPrototype(value) { - var Ctor = value && value.constructor, - proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto; - - return value === proto; - } - - /** - * 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); - } - - /** - * A specialized version of `matchesProperty` for source values suitable - * for strict equality comparisons, i.e. `===`. - * - * @private - * @param {string} key The key of the property to get. - * @param {*} srcValue The value to match. - * @returns {Function} Returns the new spec function. - */ - function matchesStrictComparable(key, srcValue) { - return function(object) { - if (object == null) { - return false; - } - return object[key] === srcValue && - (srcValue !== undefined || (key in Object(object))); - }; - } - - /** - * A specialized version of `_.memoize` which clears the memoized function's - * cache when it exceeds `MAX_MEMOIZE_SIZE`. - * - * @private - * @param {Function} func The function to have its output memoized. - * @returns {Function} Returns the new memoized function. - */ - function memoizeCapped(func) { - var result = memoize(func, function(key) { - if (cache.size === MAX_MEMOIZE_SIZE) { - cache.clear(); - } - return key; - }); - - var cache = result.cache; - return result; - } - - /** - * Merges the function metadata of `source` into `data`. - * - * Merging metadata reduces the number of wrappers used to invoke a function. - * This is possible because methods like `_.bind`, `_.curry`, and `_.partial` - * may be applied regardless of execution order. Methods like `_.ary` and - * `_.rearg` modify function arguments, making the order in which they are - * executed important, preventing the merging of metadata. However, we make - * an exception for a safe combined case where curried functions have `_.ary` - * and or `_.rearg` applied. - * - * @private - * @param {Array} data The destination metadata. - * @param {Array} source The source metadata. - * @returns {Array} Returns `data`. - */ - function mergeData(data, source) { - var bitmask = data[1], - srcBitmask = source[1], - newBitmask = bitmask | srcBitmask, - isCommon = newBitmask < (WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG | WRAP_ARY_FLAG); - - var isCombo = - ((srcBitmask == WRAP_ARY_FLAG) && (bitmask == WRAP_CURRY_FLAG)) || - ((srcBitmask == WRAP_ARY_FLAG) && (bitmask == WRAP_REARG_FLAG) && (data[7].length <= source[8])) || - ((srcBitmask == (WRAP_ARY_FLAG | WRAP_REARG_FLAG)) && (source[7].length <= source[8]) && (bitmask == WRAP_CURRY_FLAG)); - - // Exit early if metadata can't be merged. - if (!(isCommon || isCombo)) { - return data; - } - // Use source `thisArg` if available. - if (srcBitmask & WRAP_BIND_FLAG) { - data[2] = source[2]; - // Set when currying a bound function. - newBitmask |= bitmask & WRAP_BIND_FLAG ? 0 : WRAP_CURRY_BOUND_FLAG; - } - // Compose partial arguments. - var value = source[3]; - if (value) { - var partials = data[3]; - data[3] = partials ? composeArgs(partials, value, source[4]) : value; - data[4] = partials ? replaceHolders(data[3], PLACEHOLDER) : source[4]; - } - // Compose partial right arguments. - value = source[5]; - if (value) { - partials = data[5]; - data[5] = partials ? composeArgsRight(partials, value, source[6]) : value; - data[6] = partials ? replaceHolders(data[5], PLACEHOLDER) : source[6]; - } - // Use source `argPos` if available. - value = source[7]; - if (value) { - data[7] = value; - } - // Use source `ary` if it's smaller. - if (srcBitmask & WRAP_ARY_FLAG) { - data[8] = data[8] == null ? source[8] : nativeMin(data[8], source[8]); - } - // Use source `arity` if one is not provided. - if (data[9] == null) { - data[9] = source[9]; - } - // Use source `func` and merge bitmasks. - data[0] = source[0]; - data[1] = newBitmask; - - return data; - } - - /** - * This function is like - * [`Object.keys`](http://ecma-international.org/ecma-262/7.0/#sec-object.keys) - * except that it includes inherited enumerable properties. - * - * @private - * @param {Object} object The object to query. - * @returns {Array} Returns the array of property names. - */ - function nativeKeysIn(object) { - var result = []; - if (object != null) { - for (var key in Object(object)) { - result.push(key); - } - } - return result; - } - - /** - * Converts `value` to a string using `Object.prototype.toString`. - * - * @private - * @param {*} value The value to convert. - * @returns {string} Returns the converted string. - */ - function objectToString(value) { - return nativeObjectToString.call(value); - } - - /** - * A specialized version of `baseRest` which transforms the rest array. - * - * @private - * @param {Function} func The function to apply a rest parameter to. - * @param {number} [start=func.length-1] The start position of the rest parameter. - * @param {Function} transform The rest array transform. - * @returns {Function} Returns the new function. - */ - function overRest(func, start, transform) { - start = nativeMax(start === undefined ? (func.length - 1) : start, 0); - return function() { - var args = arguments, - index = -1, - length = nativeMax(args.length - start, 0), - array = Array(length); - - while (++index < length) { - array[index] = args[start + index]; - } - index = -1; - var otherArgs = Array(start + 1); - while (++index < start) { - otherArgs[index] = args[index]; - } - otherArgs[start] = transform(array); - return apply(func, this, otherArgs); - }; - } - - /** - * Gets the parent value at `path` of `object`. - * - * @private - * @param {Object} object The object to query. - * @param {Array} path The path to get the parent value of. - * @returns {*} Returns the parent value. - */ - function parent(object, path) { - return path.length < 2 ? object : baseGet(object, baseSlice(path, 0, -1)); - } - - /** - * Reorder `array` according to the specified indexes where the element at - * the first index is assigned as the first element, the element at - * the second index is assigned as the second element, and so on. - * - * @private - * @param {Array} array The array to reorder. - * @param {Array} indexes The arranged array indexes. - * @returns {Array} Returns `array`. - */ - function reorder(array, indexes) { - var arrLength = array.length, - length = nativeMin(indexes.length, arrLength), - oldArray = copyArray(array); - - while (length--) { - var index = indexes[length]; - array[length] = isIndex(index, arrLength) ? oldArray[index] : undefined; - } - return array; - } - - /** - * Gets the value at `key`, unless `key` is "__proto__" or "constructor". - * - * @private - * @param {Object} object The object to query. - * @param {string} key The key of the property to get. - * @returns {*} Returns the property value. - */ - function safeGet(object, key) { - if (key === 'constructor' && typeof object[key] === 'function') { - return; - } - - if (key == '__proto__') { - return; - } - - return object[key]; - } - - /** - * Sets metadata for `func`. - * - * **Note:** If this function becomes hot, i.e. is invoked a lot in a short - * period of time, it will trip its breaker and transition to an identity - * function to avoid garbage collection pauses in V8. See - * [V8 issue 2070](https://bugs.chromium.org/p/v8/issues/detail?id=2070) - * for more details. - * - * @private - * @param {Function} func The function to associate metadata with. - * @param {*} data The metadata. - * @returns {Function} Returns `func`. - */ - var setData = shortOut(baseSetData); - - /** - * A simple wrapper around the global [`setTimeout`](https://mdn.io/setTimeout). - * - * @private - * @param {Function} func The function to delay. - * @param {number} wait The number of milliseconds to delay invocation. - * @returns {number|Object} Returns the timer id or timeout object. - */ - var setTimeout = ctxSetTimeout || function(func, wait) { - return root.setTimeout(func, wait); - }; - - /** - * Sets the `toString` method of `func` to return `string`. - * - * @private - * @param {Function} func The function to modify. - * @param {Function} string The `toString` result. - * @returns {Function} Returns `func`. - */ - var setToString = shortOut(baseSetToString); - - /** - * Sets the `toString` method of `wrapper` to mimic the source of `reference` - * with wrapper details in a comment at the top of the source body. - * - * @private - * @param {Function} wrapper The function to modify. - * @param {Function} reference The reference function. - * @param {number} bitmask The bitmask flags. See `createWrap` for more details. - * @returns {Function} Returns `wrapper`. - */ - function setWrapToString(wrapper, reference, bitmask) { - var source = (reference + ''); - return setToString(wrapper, insertWrapDetails(source, updateWrapDetails(getWrapDetails(source), bitmask))); - } - - /** - * Creates a function that'll short out and invoke `identity` instead - * of `func` when it's called `HOT_COUNT` or more times in `HOT_SPAN` - * milliseconds. - * - * @private - * @param {Function} func The function to restrict. - * @returns {Function} Returns the new shortable function. - */ - function shortOut(func) { - var count = 0, - lastCalled = 0; - - return function() { - var stamp = nativeNow(), - remaining = HOT_SPAN - (stamp - lastCalled); - - lastCalled = stamp; - if (remaining > 0) { - if (++count >= HOT_COUNT) { - return arguments[0]; - } - } else { - count = 0; - } - return func.apply(undefined, arguments); - }; - } - - /** - * A specialized version of `_.shuffle` which mutates and sets the size of `array`. - * - * @private - * @param {Array} array The array to shuffle. - * @param {number} [size=array.length] The size of `array`. - * @returns {Array} Returns `array`. - */ - function shuffleSelf(array, size) { - var index = -1, - length = array.length, - lastIndex = length - 1; - - size = size === undefined ? length : size; - while (++index < size) { - var rand = baseRandom(index, lastIndex), - value = array[rand]; - - array[rand] = array[index]; - array[index] = value; - } - array.length = size; - return array; - } - - /** - * Converts `string` to a property path array. - * - * @private - * @param {string} string The string to convert. - * @returns {Array} Returns the property path array. - */ - var stringToPath = memoizeCapped(function(string) { - var result = []; - if (string.charCodeAt(0) === 46 /* . */) { - result.push(''); - } - string.replace(rePropName, function(match, number, quote, subString) { - result.push(quote ? subString.replace(reEscapeChar, '$1') : (number || match)); - }); - return result; - }); - - /** - * Converts `value` to a string key if it's not a string or symbol. - * - * @private - * @param {*} value The value to inspect. - * @returns {string|symbol} Returns the key. - */ - function toKey(value) { - if (typeof value == 'string' || isSymbol(value)) { - return value; - } - var result = (value + ''); - return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result; - } - - /** - * Converts `func` to its source code. - * - * @private - * @param {Function} func The function to convert. - * @returns {string} Returns the source code. - */ - function toSource(func) { - if (func != null) { - try { - return funcToString.call(func); - } catch (e) {} - try { - return (func + ''); - } catch (e) {} - } - return ''; - } - - /** - * Updates wrapper `details` based on `bitmask` flags. - * - * @private - * @returns {Array} details The details to modify. - * @param {number} bitmask The bitmask flags. See `createWrap` for more details. - * @returns {Array} Returns `details`. - */ - function updateWrapDetails(details, bitmask) { - arrayEach(wrapFlags, function(pair) { - var value = '_.' + pair[0]; - if ((bitmask & pair[1]) && !arrayIncludes(details, value)) { - details.push(value); - } - }); - return details.sort(); - } - - /** - * Creates a clone of `wrapper`. - * - * @private - * @param {Object} wrapper The wrapper to clone. - * @returns {Object} Returns the cloned wrapper. - */ - function wrapperClone(wrapper) { - if (wrapper instanceof LazyWrapper) { - return wrapper.clone(); - } - var result = new LodashWrapper(wrapper.__wrapped__, wrapper.__chain__); - result.__actions__ = copyArray(wrapper.__actions__); - result.__index__ = wrapper.__index__; - result.__values__ = wrapper.__values__; - return result; - } - - /*------------------------------------------------------------------------*/ - - /** - * Creates an array of elements split into groups the length of `size`. - * If `array` can't be split evenly, the final chunk will be the remaining - * elements. - * - * @static - * @memberOf _ - * @since 3.0.0 - * @category Array - * @param {Array} array The array to process. - * @param {number} [size=1] The length of each chunk - * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. - * @returns {Array} Returns the new array of chunks. - * @example - * - * _.chunk(['a', 'b', 'c', 'd'], 2); - * // => [['a', 'b'], ['c', 'd']] - * - * _.chunk(['a', 'b', 'c', 'd'], 3); - * // => [['a', 'b', 'c'], ['d']] - */ - function chunk(array, size, guard) { - if ((guard ? isIterateeCall(array, size, guard) : size === undefined)) { - size = 1; - } else { - size = nativeMax(toInteger(size), 0); - } - var length = array == null ? 0 : array.length; - if (!length || size < 1) { - return []; - } - var index = 0, - resIndex = 0, - result = Array(nativeCeil(length / size)); - - while (index < length) { - result[resIndex++] = baseSlice(array, index, (index += size)); - } - return result; - } - - /** - * Creates an array with all falsey values removed. The values `false`, `null`, - * `0`, `""`, `undefined`, and `NaN` are falsey. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Array - * @param {Array} array The array to compact. - * @returns {Array} Returns the new array of filtered values. - * @example - * - * _.compact([0, 1, false, 2, '', 3]); - * // => [1, 2, 3] - */ - function compact(array) { - var index = -1, - length = array == null ? 0 : array.length, - resIndex = 0, - result = []; - - while (++index < length) { - var value = array[index]; - if (value) { - result[resIndex++] = value; - } - } - return result; - } - - /** - * Creates a new array concatenating `array` with any additional arrays - * and/or values. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Array - * @param {Array} array The array to concatenate. - * @param {...*} [values] The values to concatenate. - * @returns {Array} Returns the new concatenated array. - * @example - * - * var array = [1]; - * var other = _.concat(array, 2, [3], [[4]]); - * - * console.log(other); - * // => [1, 2, 3, [4]] - * - * console.log(array); - * // => [1] - */ - function concat() { - var length = arguments.length; - if (!length) { - return []; - } - var args = Array(length - 1), - array = arguments[0], - index = length; - - while (index--) { - args[index - 1] = arguments[index]; - } - return arrayPush(isArray(array) ? copyArray(array) : [array], baseFlatten(args, 1)); - } - - /** - * Creates an array of `array` values not included in the other given arrays - * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) - * for equality comparisons. The order and references of result values are - * determined by the first array. - * - * **Note:** Unlike `_.pullAll`, this method returns a new array. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Array - * @param {Array} array The array to inspect. - * @param {...Array} [values] The values to exclude. - * @returns {Array} Returns the new array of filtered values. - * @see _.without, _.xor - * @example - * - * _.difference([2, 1], [2, 3]); - * // => [1] - */ - var difference = baseRest(function(array, values) { - return isArrayLikeObject(array) - ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true)) - : []; - }); - - /** - * This method is like `_.difference` except that it accepts `iteratee` which - * is invoked for each element of `array` and `values` to generate the criterion - * by which they're compared. The order and references of result values are - * determined by the first array. The iteratee is invoked with one argument: - * (value). - * - * **Note:** Unlike `_.pullAllBy`, this method returns a new array. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Array - * @param {Array} array The array to inspect. - * @param {...Array} [values] The values to exclude. - * @param {Function} [iteratee=_.identity] The iteratee invoked per element. - * @returns {Array} Returns the new array of filtered values. - * @example - * - * _.differenceBy([2.1, 1.2], [2.3, 3.4], Math.floor); - * // => [1.2] - * - * // The `_.property` iteratee shorthand. - * _.differenceBy([{ 'x': 2 }, { 'x': 1 }], [{ 'x': 1 }], 'x'); - * // => [{ 'x': 2 }] - */ - var differenceBy = baseRest(function(array, values) { - var iteratee = last(values); - if (isArrayLikeObject(iteratee)) { - iteratee = undefined; - } - return isArrayLikeObject(array) - ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true), getIteratee(iteratee, 2)) - : []; - }); - - /** - * This method is like `_.difference` except that it accepts `comparator` - * which is invoked to compare elements of `array` to `values`. The order and - * references of result values are determined by the first array. The comparator - * is invoked with two arguments: (arrVal, othVal). - * - * **Note:** Unlike `_.pullAllWith`, this method returns a new array. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Array - * @param {Array} array The array to inspect. - * @param {...Array} [values] The values to exclude. - * @param {Function} [comparator] The comparator invoked per element. - * @returns {Array} Returns the new array of filtered values. - * @example - * - * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]; - * - * _.differenceWith(objects, [{ 'x': 1, 'y': 2 }], _.isEqual); - * // => [{ 'x': 2, 'y': 1 }] - */ - var differenceWith = baseRest(function(array, values) { - var comparator = last(values); - if (isArrayLikeObject(comparator)) { - comparator = undefined; - } - return isArrayLikeObject(array) - ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true), undefined, comparator) - : []; - }); - - /** - * Creates a slice of `array` with `n` elements dropped from the beginning. - * - * @static - * @memberOf _ - * @since 0.5.0 - * @category Array - * @param {Array} array The array to query. - * @param {number} [n=1] The number of elements to drop. - * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. - * @returns {Array} Returns the slice of `array`. - * @example - * - * _.drop([1, 2, 3]); - * // => [2, 3] - * - * _.drop([1, 2, 3], 2); - * // => [3] - * - * _.drop([1, 2, 3], 5); - * // => [] - * - * _.drop([1, 2, 3], 0); - * // => [1, 2, 3] - */ - function drop(array, n, guard) { - var length = array == null ? 0 : array.length; - if (!length) { - return []; - } - n = (guard || n === undefined) ? 1 : toInteger(n); - return baseSlice(array, n < 0 ? 0 : n, length); - } - - /** - * Creates a slice of `array` with `n` elements dropped from the end. - * - * @static - * @memberOf _ - * @since 3.0.0 - * @category Array - * @param {Array} array The array to query. - * @param {number} [n=1] The number of elements to drop. - * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. - * @returns {Array} Returns the slice of `array`. - * @example - * - * _.dropRight([1, 2, 3]); - * // => [1, 2] - * - * _.dropRight([1, 2, 3], 2); - * // => [1] - * - * _.dropRight([1, 2, 3], 5); - * // => [] - * - * _.dropRight([1, 2, 3], 0); - * // => [1, 2, 3] - */ - function dropRight(array, n, guard) { - var length = array == null ? 0 : array.length; - if (!length) { - return []; - } - n = (guard || n === undefined) ? 1 : toInteger(n); - n = length - n; - return baseSlice(array, 0, n < 0 ? 0 : n); - } - - /** - * Creates a slice of `array` excluding elements dropped from the end. - * Elements are dropped until `predicate` returns falsey. The predicate is - * invoked with three arguments: (value, index, array). - * - * @static - * @memberOf _ - * @since 3.0.0 - * @category Array - * @param {Array} array The array to query. - * @param {Function} [predicate=_.identity] The function invoked per iteration. - * @returns {Array} Returns the slice of `array`. - * @example - * - * var users = [ - * { 'user': 'barney', 'active': true }, - * { 'user': 'fred', 'active': false }, - * { 'user': 'pebbles', 'active': false } - * ]; - * - * _.dropRightWhile(users, function(o) { return !o.active; }); - * // => objects for ['barney'] - * - * // The `_.matches` iteratee shorthand. - * _.dropRightWhile(users, { 'user': 'pebbles', 'active': false }); - * // => objects for ['barney', 'fred'] - * - * // The `_.matchesProperty` iteratee shorthand. - * _.dropRightWhile(users, ['active', false]); - * // => objects for ['barney'] - * - * // The `_.property` iteratee shorthand. - * _.dropRightWhile(users, 'active'); - * // => objects for ['barney', 'fred', 'pebbles'] - */ - function dropRightWhile(array, predicate) { - return (array && array.length) - ? baseWhile(array, getIteratee(predicate, 3), true, true) - : []; - } - - /** - * Creates a slice of `array` excluding elements dropped from the beginning. - * Elements are dropped until `predicate` returns falsey. The predicate is - * invoked with three arguments: (value, index, array). - * - * @static - * @memberOf _ - * @since 3.0.0 - * @category Array - * @param {Array} array The array to query. - * @param {Function} [predicate=_.identity] The function invoked per iteration. - * @returns {Array} Returns the slice of `array`. - * @example - * - * var users = [ - * { 'user': 'barney', 'active': false }, - * { 'user': 'fred', 'active': false }, - * { 'user': 'pebbles', 'active': true } - * ]; - * - * _.dropWhile(users, function(o) { return !o.active; }); - * // => objects for ['pebbles'] - * - * // The `_.matches` iteratee shorthand. - * _.dropWhile(users, { 'user': 'barney', 'active': false }); - * // => objects for ['fred', 'pebbles'] - * - * // The `_.matchesProperty` iteratee shorthand. - * _.dropWhile(users, ['active', false]); - * // => objects for ['pebbles'] - * - * // The `_.property` iteratee shorthand. - * _.dropWhile(users, 'active'); - * // => objects for ['barney', 'fred', 'pebbles'] - */ - function dropWhile(array, predicate) { - return (array && array.length) - ? baseWhile(array, getIteratee(predicate, 3), true) - : []; - } - - /** - * Fills elements of `array` with `value` from `start` up to, but not - * including, `end`. - * - * **Note:** This method mutates `array`. - * - * @static - * @memberOf _ - * @since 3.2.0 - * @category Array - * @param {Array} array The array to fill. - * @param {*} value The value to fill `array` with. - * @param {number} [start=0] The start position. - * @param {number} [end=array.length] The end position. - * @returns {Array} Returns `array`. - * @example - * - * var array = [1, 2, 3]; - * - * _.fill(array, 'a'); - * console.log(array); - * // => ['a', 'a', 'a'] - * - * _.fill(Array(3), 2); - * // => [2, 2, 2] - * - * _.fill([4, 6, 8, 10], '*', 1, 3); - * // => [4, '*', '*', 10] - */ - function fill(array, value, start, end) { - var length = array == null ? 0 : array.length; - if (!length) { - return []; - } - if (start && typeof start != 'number' && isIterateeCall(array, value, start)) { - start = 0; - end = length; - } - return baseFill(array, value, start, end); - } - - /** - * This method is like `_.find` except that it returns the index of the first - * element `predicate` returns truthy for instead of the element itself. - * - * @static - * @memberOf _ - * @since 1.1.0 - * @category Array - * @param {Array} array The array to inspect. - * @param {Function} [predicate=_.identity] The function invoked per iteration. - * @param {number} [fromIndex=0] The index to search from. - * @returns {number} Returns the index of the found element, else `-1`. - * @example - * - * var users = [ - * { 'user': 'barney', 'active': false }, - * { 'user': 'fred', 'active': false }, - * { 'user': 'pebbles', 'active': true } - * ]; - * - * _.findIndex(users, function(o) { return o.user == 'barney'; }); - * // => 0 - * - * // The `_.matches` iteratee shorthand. - * _.findIndex(users, { 'user': 'fred', 'active': false }); - * // => 1 - * - * // The `_.matchesProperty` iteratee shorthand. - * _.findIndex(users, ['active', false]); - * // => 0 - * - * // The `_.property` iteratee shorthand. - * _.findIndex(users, 'active'); - * // => 2 - */ - function findIndex(array, predicate, fromIndex) { - var length = array == null ? 0 : array.length; - if (!length) { - return -1; - } - var index = fromIndex == null ? 0 : toInteger(fromIndex); - if (index < 0) { - index = nativeMax(length + index, 0); - } - return baseFindIndex(array, getIteratee(predicate, 3), index); - } - - /** - * This method is like `_.findIndex` except that it iterates over elements - * of `collection` from right to left. - * - * @static - * @memberOf _ - * @since 2.0.0 - * @category Array - * @param {Array} array The array to inspect. - * @param {Function} [predicate=_.identity] The function invoked per iteration. - * @param {number} [fromIndex=array.length-1] The index to search from. - * @returns {number} Returns the index of the found element, else `-1`. - * @example - * - * var users = [ - * { 'user': 'barney', 'active': true }, - * { 'user': 'fred', 'active': false }, - * { 'user': 'pebbles', 'active': false } - * ]; - * - * _.findLastIndex(users, function(o) { return o.user == 'pebbles'; }); - * // => 2 - * - * // The `_.matches` iteratee shorthand. - * _.findLastIndex(users, { 'user': 'barney', 'active': true }); - * // => 0 - * - * // The `_.matchesProperty` iteratee shorthand. - * _.findLastIndex(users, ['active', false]); - * // => 2 - * - * // The `_.property` iteratee shorthand. - * _.findLastIndex(users, 'active'); - * // => 0 - */ - function findLastIndex(array, predicate, fromIndex) { - var length = array == null ? 0 : array.length; - if (!length) { - return -1; - } - var index = length - 1; - if (fromIndex !== undefined) { - index = toInteger(fromIndex); - index = fromIndex < 0 - ? nativeMax(length + index, 0) - : nativeMin(index, length - 1); - } - return baseFindIndex(array, getIteratee(predicate, 3), index, true); - } - - /** - * Flattens `array` a single level deep. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Array - * @param {Array} array The array to flatten. - * @returns {Array} Returns the new flattened array. - * @example - * - * _.flatten([1, [2, [3, [4]], 5]]); - * // => [1, 2, [3, [4]], 5] - */ - function flatten(array) { - var length = array == null ? 0 : array.length; - return length ? baseFlatten(array, 1) : []; - } - - /** - * Recursively flattens `array`. - * - * @static - * @memberOf _ - * @since 3.0.0 - * @category Array - * @param {Array} array The array to flatten. - * @returns {Array} Returns the new flattened array. - * @example - * - * _.flattenDeep([1, [2, [3, [4]], 5]]); - * // => [1, 2, 3, 4, 5] - */ - function flattenDeep(array) { - var length = array == null ? 0 : array.length; - return length ? baseFlatten(array, INFINITY) : []; - } - - /** - * Recursively flatten `array` up to `depth` times. - * - * @static - * @memberOf _ - * @since 4.4.0 - * @category Array - * @param {Array} array The array to flatten. - * @param {number} [depth=1] The maximum recursion depth. - * @returns {Array} Returns the new flattened array. - * @example - * - * var array = [1, [2, [3, [4]], 5]]; - * - * _.flattenDepth(array, 1); - * // => [1, 2, [3, [4]], 5] - * - * _.flattenDepth(array, 2); - * // => [1, 2, 3, [4], 5] - */ - function flattenDepth(array, depth) { - var length = array == null ? 0 : array.length; - if (!length) { - return []; - } - depth = depth === undefined ? 1 : toInteger(depth); - return baseFlatten(array, depth); - } - - /** - * The inverse of `_.toPairs`; this method returns an object composed - * from key-value `pairs`. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Array - * @param {Array} pairs The key-value pairs. - * @returns {Object} Returns the new object. - * @example - * - * _.fromPairs([['a', 1], ['b', 2]]); - * // => { 'a': 1, 'b': 2 } - */ - function fromPairs(pairs) { - var index = -1, - length = pairs == null ? 0 : pairs.length, - result = {}; - - while (++index < length) { - var pair = pairs[index]; - result[pair[0]] = pair[1]; - } - return result; - } - - /** - * Gets the first element of `array`. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @alias first - * @category Array - * @param {Array} array The array to query. - * @returns {*} Returns the first element of `array`. - * @example - * - * _.head([1, 2, 3]); - * // => 1 - * - * _.head([]); - * // => undefined - */ - function head(array) { - return (array && array.length) ? array[0] : undefined; - } - - /** - * Gets the index at which the first occurrence of `value` is found in `array` - * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) - * for equality comparisons. If `fromIndex` is negative, it's used as the - * offset from the end of `array`. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Array - * @param {Array} array The array to inspect. - * @param {*} value The value to search for. - * @param {number} [fromIndex=0] The index to search from. - * @returns {number} Returns the index of the matched value, else `-1`. - * @example - * - * _.indexOf([1, 2, 1, 2], 2); - * // => 1 - * - * // Search from the `fromIndex`. - * _.indexOf([1, 2, 1, 2], 2, 2); - * // => 3 - */ - function indexOf(array, value, fromIndex) { - var length = array == null ? 0 : array.length; - if (!length) { - return -1; - } - var index = fromIndex == null ? 0 : toInteger(fromIndex); - if (index < 0) { - index = nativeMax(length + index, 0); - } - return baseIndexOf(array, value, index); - } - - /** - * Gets all but the last element of `array`. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Array - * @param {Array} array The array to query. - * @returns {Array} Returns the slice of `array`. - * @example - * - * _.initial([1, 2, 3]); - * // => [1, 2] - */ - function initial(array) { - var length = array == null ? 0 : array.length; - return length ? baseSlice(array, 0, -1) : []; - } - - /** - * Creates an array of unique values that are included in all given arrays - * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) - * for equality comparisons. The order and references of result values are - * determined by the first array. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Array - * @param {...Array} [arrays] The arrays to inspect. - * @returns {Array} Returns the new array of intersecting values. - * @example - * - * _.intersection([2, 1], [2, 3]); - * // => [2] - */ - var intersection = baseRest(function(arrays) { - var mapped = arrayMap(arrays, castArrayLikeObject); - return (mapped.length && mapped[0] === arrays[0]) - ? baseIntersection(mapped) - : []; - }); - - /** - * This method is like `_.intersection` except that it accepts `iteratee` - * which is invoked for each element of each `arrays` to generate the criterion - * by which they're compared. The order and references of result values are - * determined by the first array. The iteratee is invoked with one argument: - * (value). - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Array - * @param {...Array} [arrays] The arrays to inspect. - * @param {Function} [iteratee=_.identity] The iteratee invoked per element. - * @returns {Array} Returns the new array of intersecting values. - * @example - * - * _.intersectionBy([2.1, 1.2], [2.3, 3.4], Math.floor); - * // => [2.1] - * - * // The `_.property` iteratee shorthand. - * _.intersectionBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x'); - * // => [{ 'x': 1 }] - */ - var intersectionBy = baseRest(function(arrays) { - var iteratee = last(arrays), - mapped = arrayMap(arrays, castArrayLikeObject); - - if (iteratee === last(mapped)) { - iteratee = undefined; - } else { - mapped.pop(); - } - return (mapped.length && mapped[0] === arrays[0]) - ? baseIntersection(mapped, getIteratee(iteratee, 2)) - : []; - }); - - /** - * This method is like `_.intersection` except that it accepts `comparator` - * which is invoked to compare elements of `arrays`. The order and references - * of result values are determined by the first array. The comparator is - * invoked with two arguments: (arrVal, othVal). - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Array - * @param {...Array} [arrays] The arrays to inspect. - * @param {Function} [comparator] The comparator invoked per element. - * @returns {Array} Returns the new array of intersecting values. - * @example - * - * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]; - * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }]; - * - * _.intersectionWith(objects, others, _.isEqual); - * // => [{ 'x': 1, 'y': 2 }] - */ - var intersectionWith = baseRest(function(arrays) { - var comparator = last(arrays), - mapped = arrayMap(arrays, castArrayLikeObject); - - comparator = typeof comparator == 'function' ? comparator : undefined; - if (comparator) { - mapped.pop(); - } - return (mapped.length && mapped[0] === arrays[0]) - ? baseIntersection(mapped, undefined, comparator) - : []; - }); - - /** - * Converts all elements in `array` into a string separated by `separator`. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Array - * @param {Array} array The array to convert. - * @param {string} [separator=','] The element separator. - * @returns {string} Returns the joined string. - * @example - * - * _.join(['a', 'b', 'c'], '~'); - * // => 'a~b~c' - */ - function join(array, separator) { - return array == null ? '' : nativeJoin.call(array, separator); - } - - /** - * Gets the last element of `array`. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Array - * @param {Array} array The array to query. - * @returns {*} Returns the last element of `array`. - * @example - * - * _.last([1, 2, 3]); - * // => 3 - */ - function last(array) { - var length = array == null ? 0 : array.length; - return length ? array[length - 1] : undefined; - } - - /** - * This method is like `_.indexOf` except that it iterates over elements of - * `array` from right to left. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Array - * @param {Array} array The array to inspect. - * @param {*} value The value to search for. - * @param {number} [fromIndex=array.length-1] The index to search from. - * @returns {number} Returns the index of the matched value, else `-1`. - * @example - * - * _.lastIndexOf([1, 2, 1, 2], 2); - * // => 3 - * - * // Search from the `fromIndex`. - * _.lastIndexOf([1, 2, 1, 2], 2, 2); - * // => 1 - */ - function lastIndexOf(array, value, fromIndex) { - var length = array == null ? 0 : array.length; - if (!length) { - return -1; - } - var index = length; - if (fromIndex !== undefined) { - index = toInteger(fromIndex); - index = index < 0 ? nativeMax(length + index, 0) : nativeMin(index, length - 1); - } - return value === value - ? strictLastIndexOf(array, value, index) - : baseFindIndex(array, baseIsNaN, index, true); - } - - /** - * Gets the element at index `n` of `array`. If `n` is negative, the nth - * element from the end is returned. - * - * @static - * @memberOf _ - * @since 4.11.0 - * @category Array - * @param {Array} array The array to query. - * @param {number} [n=0] The index of the element to return. - * @returns {*} Returns the nth element of `array`. - * @example - * - * var array = ['a', 'b', 'c', 'd']; - * - * _.nth(array, 1); - * // => 'b' - * - * _.nth(array, -2); - * // => 'c'; - */ - function nth(array, n) { - return (array && array.length) ? baseNth(array, toInteger(n)) : undefined; - } - - /** - * Removes all given values from `array` using - * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) - * for equality comparisons. - * - * **Note:** Unlike `_.without`, this method mutates `array`. Use `_.remove` - * to remove elements from an array by predicate. - * - * @static - * @memberOf _ - * @since 2.0.0 - * @category Array - * @param {Array} array The array to modify. - * @param {...*} [values] The values to remove. - * @returns {Array} Returns `array`. - * @example - * - * var array = ['a', 'b', 'c', 'a', 'b', 'c']; - * - * _.pull(array, 'a', 'c'); - * console.log(array); - * // => ['b', 'b'] - */ - var pull = baseRest(pullAll); - - /** - * This method is like `_.pull` except that it accepts an array of values to remove. - * - * **Note:** Unlike `_.difference`, this method mutates `array`. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Array - * @param {Array} array The array to modify. - * @param {Array} values The values to remove. - * @returns {Array} Returns `array`. - * @example - * - * var array = ['a', 'b', 'c', 'a', 'b', 'c']; - * - * _.pullAll(array, ['a', 'c']); - * console.log(array); - * // => ['b', 'b'] - */ - function pullAll(array, values) { - return (array && array.length && values && values.length) - ? basePullAll(array, values) - : array; - } - - /** - * This method is like `_.pullAll` except that it accepts `iteratee` which is - * invoked for each element of `array` and `values` to generate the criterion - * by which they're compared. The iteratee is invoked with one argument: (value). - * - * **Note:** Unlike `_.differenceBy`, this method mutates `array`. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Array - * @param {Array} array The array to modify. - * @param {Array} values The values to remove. - * @param {Function} [iteratee=_.identity] The iteratee invoked per element. - * @returns {Array} Returns `array`. - * @example - * - * var array = [{ 'x': 1 }, { 'x': 2 }, { 'x': 3 }, { 'x': 1 }]; - * - * _.pullAllBy(array, [{ 'x': 1 }, { 'x': 3 }], 'x'); - * console.log(array); - * // => [{ 'x': 2 }] - */ - function pullAllBy(array, values, iteratee) { - return (array && array.length && values && values.length) - ? basePullAll(array, values, getIteratee(iteratee, 2)) - : array; - } - - /** - * This method is like `_.pullAll` except that it accepts `comparator` which - * is invoked to compare elements of `array` to `values`. The comparator is - * invoked with two arguments: (arrVal, othVal). - * - * **Note:** Unlike `_.differenceWith`, this method mutates `array`. - * - * @static - * @memberOf _ - * @since 4.6.0 - * @category Array - * @param {Array} array The array to modify. - * @param {Array} values The values to remove. - * @param {Function} [comparator] The comparator invoked per element. - * @returns {Array} Returns `array`. - * @example - * - * var array = [{ 'x': 1, 'y': 2 }, { 'x': 3, 'y': 4 }, { 'x': 5, 'y': 6 }]; - * - * _.pullAllWith(array, [{ 'x': 3, 'y': 4 }], _.isEqual); - * console.log(array); - * // => [{ 'x': 1, 'y': 2 }, { 'x': 5, 'y': 6 }] - */ - function pullAllWith(array, values, comparator) { - return (array && array.length && values && values.length) - ? basePullAll(array, values, undefined, comparator) - : array; - } - - /** - * Removes elements from `array` corresponding to `indexes` and returns an - * array of removed elements. - * - * **Note:** Unlike `_.at`, this method mutates `array`. - * - * @static - * @memberOf _ - * @since 3.0.0 - * @category Array - * @param {Array} array The array to modify. - * @param {...(number|number[])} [indexes] The indexes of elements to remove. - * @returns {Array} Returns the new array of removed elements. - * @example - * - * var array = ['a', 'b', 'c', 'd']; - * var pulled = _.pullAt(array, [1, 3]); - * - * console.log(array); - * // => ['a', 'c'] - * - * console.log(pulled); - * // => ['b', 'd'] - */ - var pullAt = flatRest(function(array, indexes) { - var length = array == null ? 0 : array.length, - result = baseAt(array, indexes); - - basePullAt(array, arrayMap(indexes, function(index) { - return isIndex(index, length) ? +index : index; - }).sort(compareAscending)); - - return result; - }); - - /** - * Removes all elements from `array` that `predicate` returns truthy for - * and returns an array of the removed elements. The predicate is invoked - * with three arguments: (value, index, array). - * - * **Note:** Unlike `_.filter`, this method mutates `array`. Use `_.pull` - * to pull elements from an array by value. - * - * @static - * @memberOf _ - * @since 2.0.0 - * @category Array - * @param {Array} array The array to modify. - * @param {Function} [predicate=_.identity] The function invoked per iteration. - * @returns {Array} Returns the new array of removed elements. - * @example - * - * var array = [1, 2, 3, 4]; - * var evens = _.remove(array, function(n) { - * return n % 2 == 0; - * }); - * - * console.log(array); - * // => [1, 3] - * - * console.log(evens); - * // => [2, 4] - */ - function remove(array, predicate) { - var result = []; - if (!(array && array.length)) { - return result; - } - var index = -1, - indexes = [], - length = array.length; - - predicate = getIteratee(predicate, 3); - while (++index < length) { - var value = array[index]; - if (predicate(value, index, array)) { - result.push(value); - indexes.push(index); - } - } - basePullAt(array, indexes); - return result; - } - - /** - * Reverses `array` so that the first element becomes the last, the second - * element becomes the second to last, and so on. - * - * **Note:** This method mutates `array` and is based on - * [`Array#reverse`](https://mdn.io/Array/reverse). - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Array - * @param {Array} array The array to modify. - * @returns {Array} Returns `array`. - * @example - * - * var array = [1, 2, 3]; - * - * _.reverse(array); - * // => [3, 2, 1] - * - * console.log(array); - * // => [3, 2, 1] - */ - function reverse(array) { - return array == null ? array : nativeReverse.call(array); - } - - /** - * Creates a slice of `array` from `start` up to, but not including, `end`. - * - * **Note:** This method is used instead of - * [`Array#slice`](https://mdn.io/Array/slice) to ensure dense arrays are - * returned. - * - * @static - * @memberOf _ - * @since 3.0.0 - * @category Array - * @param {Array} array The array to slice. - * @param {number} [start=0] The start position. - * @param {number} [end=array.length] The end position. - * @returns {Array} Returns the slice of `array`. - */ - function slice(array, start, end) { - var length = array == null ? 0 : array.length; - if (!length) { - return []; - } - if (end && typeof end != 'number' && isIterateeCall(array, start, end)) { - start = 0; - end = length; - } - else { - start = start == null ? 0 : toInteger(start); - end = end === undefined ? length : toInteger(end); - } - return baseSlice(array, start, end); - } - - /** - * Uses a binary search to determine the lowest index at which `value` - * should be inserted into `array` in order to maintain its sort order. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Array - * @param {Array} array The sorted array to inspect. - * @param {*} value The value to evaluate. - * @returns {number} Returns the index at which `value` should be inserted - * into `array`. - * @example - * - * _.sortedIndex([30, 50], 40); - * // => 1 - */ - function sortedIndex(array, value) { - return baseSortedIndex(array, value); - } - - /** - * This method is like `_.sortedIndex` except that it accepts `iteratee` - * which is invoked for `value` and each element of `array` to compute their - * sort ranking. The iteratee is invoked with one argument: (value). - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Array - * @param {Array} array The sorted array to inspect. - * @param {*} value The value to evaluate. - * @param {Function} [iteratee=_.identity] The iteratee invoked per element. - * @returns {number} Returns the index at which `value` should be inserted - * into `array`. - * @example - * - * var objects = [{ 'x': 4 }, { 'x': 5 }]; - * - * _.sortedIndexBy(objects, { 'x': 4 }, function(o) { return o.x; }); - * // => 0 - * - * // The `_.property` iteratee shorthand. - * _.sortedIndexBy(objects, { 'x': 4 }, 'x'); - * // => 0 - */ - function sortedIndexBy(array, value, iteratee) { - return baseSortedIndexBy(array, value, getIteratee(iteratee, 2)); - } - - /** - * This method is like `_.indexOf` except that it performs a binary - * search on a sorted `array`. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Array - * @param {Array} array The array to inspect. - * @param {*} value The value to search for. - * @returns {number} Returns the index of the matched value, else `-1`. - * @example - * - * _.sortedIndexOf([4, 5, 5, 5, 6], 5); - * // => 1 - */ - function sortedIndexOf(array, value) { - var length = array == null ? 0 : array.length; - if (length) { - var index = baseSortedIndex(array, value); - if (index < length && eq(array[index], value)) { - return index; - } - } - return -1; - } - - /** - * This method is like `_.sortedIndex` except that it returns the highest - * index at which `value` should be inserted into `array` in order to - * maintain its sort order. - * - * @static - * @memberOf _ - * @since 3.0.0 - * @category Array - * @param {Array} array The sorted array to inspect. - * @param {*} value The value to evaluate. - * @returns {number} Returns the index at which `value` should be inserted - * into `array`. - * @example - * - * _.sortedLastIndex([4, 5, 5, 5, 6], 5); - * // => 4 - */ - function sortedLastIndex(array, value) { - return baseSortedIndex(array, value, true); - } - - /** - * This method is like `_.sortedLastIndex` except that it accepts `iteratee` - * which is invoked for `value` and each element of `array` to compute their - * sort ranking. The iteratee is invoked with one argument: (value). - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Array - * @param {Array} array The sorted array to inspect. - * @param {*} value The value to evaluate. - * @param {Function} [iteratee=_.identity] The iteratee invoked per element. - * @returns {number} Returns the index at which `value` should be inserted - * into `array`. - * @example - * - * var objects = [{ 'x': 4 }, { 'x': 5 }]; - * - * _.sortedLastIndexBy(objects, { 'x': 4 }, function(o) { return o.x; }); - * // => 1 - * - * // The `_.property` iteratee shorthand. - * _.sortedLastIndexBy(objects, { 'x': 4 }, 'x'); - * // => 1 - */ - function sortedLastIndexBy(array, value, iteratee) { - return baseSortedIndexBy(array, value, getIteratee(iteratee, 2), true); - } - - /** - * This method is like `_.lastIndexOf` except that it performs a binary - * search on a sorted `array`. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Array - * @param {Array} array The array to inspect. - * @param {*} value The value to search for. - * @returns {number} Returns the index of the matched value, else `-1`. - * @example - * - * _.sortedLastIndexOf([4, 5, 5, 5, 6], 5); - * // => 3 - */ - function sortedLastIndexOf(array, value) { - var length = array == null ? 0 : array.length; - if (length) { - var index = baseSortedIndex(array, value, true) - 1; - if (eq(array[index], value)) { - return index; - } - } - return -1; - } - - /** - * This method is like `_.uniq` except that it's designed and optimized - * for sorted arrays. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Array - * @param {Array} array The array to inspect. - * @returns {Array} Returns the new duplicate free array. - * @example - * - * _.sortedUniq([1, 1, 2]); - * // => [1, 2] - */ - function sortedUniq(array) { - return (array && array.length) - ? baseSortedUniq(array) - : []; - } - - /** - * This method is like `_.uniqBy` except that it's designed and optimized - * for sorted arrays. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Array - * @param {Array} array The array to inspect. - * @param {Function} [iteratee] The iteratee invoked per element. - * @returns {Array} Returns the new duplicate free array. - * @example - * - * _.sortedUniqBy([1.1, 1.2, 2.3, 2.4], Math.floor); - * // => [1.1, 2.3] - */ - function sortedUniqBy(array, iteratee) { - return (array && array.length) - ? baseSortedUniq(array, getIteratee(iteratee, 2)) - : []; - } - - /** - * Gets all but the first element of `array`. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Array - * @param {Array} array The array to query. - * @returns {Array} Returns the slice of `array`. - * @example - * - * _.tail([1, 2, 3]); - * // => [2, 3] - */ - function tail(array) { - var length = array == null ? 0 : array.length; - return length ? baseSlice(array, 1, length) : []; - } - - /** - * Creates a slice of `array` with `n` elements taken from the beginning. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Array - * @param {Array} array The array to query. - * @param {number} [n=1] The number of elements to take. - * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. - * @returns {Array} Returns the slice of `array`. - * @example - * - * _.take([1, 2, 3]); - * // => [1] - * - * _.take([1, 2, 3], 2); - * // => [1, 2] - * - * _.take([1, 2, 3], 5); - * // => [1, 2, 3] - * - * _.take([1, 2, 3], 0); - * // => [] - */ - function take(array, n, guard) { - if (!(array && array.length)) { - return []; - } - n = (guard || n === undefined) ? 1 : toInteger(n); - return baseSlice(array, 0, n < 0 ? 0 : n); - } - - /** - * Creates a slice of `array` with `n` elements taken from the end. - * - * @static - * @memberOf _ - * @since 3.0.0 - * @category Array - * @param {Array} array The array to query. - * @param {number} [n=1] The number of elements to take. - * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. - * @returns {Array} Returns the slice of `array`. - * @example - * - * _.takeRight([1, 2, 3]); - * // => [3] - * - * _.takeRight([1, 2, 3], 2); - * // => [2, 3] - * - * _.takeRight([1, 2, 3], 5); - * // => [1, 2, 3] - * - * _.takeRight([1, 2, 3], 0); - * // => [] - */ - function takeRight(array, n, guard) { - var length = array == null ? 0 : array.length; - if (!length) { - return []; - } - n = (guard || n === undefined) ? 1 : toInteger(n); - n = length - n; - return baseSlice(array, n < 0 ? 0 : n, length); - } - - /** - * Creates a slice of `array` with elements taken from the end. Elements are - * taken until `predicate` returns falsey. The predicate is invoked with - * three arguments: (value, index, array). - * - * @static - * @memberOf _ - * @since 3.0.0 - * @category Array - * @param {Array} array The array to query. - * @param {Function} [predicate=_.identity] The function invoked per iteration. - * @returns {Array} Returns the slice of `array`. - * @example - * - * var users = [ - * { 'user': 'barney', 'active': true }, - * { 'user': 'fred', 'active': false }, - * { 'user': 'pebbles', 'active': false } - * ]; - * - * _.takeRightWhile(users, function(o) { return !o.active; }); - * // => objects for ['fred', 'pebbles'] - * - * // The `_.matches` iteratee shorthand. - * _.takeRightWhile(users, { 'user': 'pebbles', 'active': false }); - * // => objects for ['pebbles'] - * - * // The `_.matchesProperty` iteratee shorthand. - * _.takeRightWhile(users, ['active', false]); - * // => objects for ['fred', 'pebbles'] - * - * // The `_.property` iteratee shorthand. - * _.takeRightWhile(users, 'active'); - * // => [] - */ - function takeRightWhile(array, predicate) { - return (array && array.length) - ? baseWhile(array, getIteratee(predicate, 3), false, true) - : []; - } - - /** - * Creates a slice of `array` with elements taken from the beginning. Elements - * are taken until `predicate` returns falsey. The predicate is invoked with - * three arguments: (value, index, array). - * - * @static - * @memberOf _ - * @since 3.0.0 - * @category Array - * @param {Array} array The array to query. - * @param {Function} [predicate=_.identity] The function invoked per iteration. - * @returns {Array} Returns the slice of `array`. - * @example - * - * var users = [ - * { 'user': 'barney', 'active': false }, - * { 'user': 'fred', 'active': false }, - * { 'user': 'pebbles', 'active': true } - * ]; - * - * _.takeWhile(users, function(o) { return !o.active; }); - * // => objects for ['barney', 'fred'] - * - * // The `_.matches` iteratee shorthand. - * _.takeWhile(users, { 'user': 'barney', 'active': false }); - * // => objects for ['barney'] - * - * // The `_.matchesProperty` iteratee shorthand. - * _.takeWhile(users, ['active', false]); - * // => objects for ['barney', 'fred'] - * - * // The `_.property` iteratee shorthand. - * _.takeWhile(users, 'active'); - * // => [] - */ - function takeWhile(array, predicate) { - return (array && array.length) - ? baseWhile(array, getIteratee(predicate, 3)) - : []; - } - - /** - * Creates an array of unique values, in order, from all given arrays using - * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) - * for equality comparisons. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Array - * @param {...Array} [arrays] The arrays to inspect. - * @returns {Array} Returns the new array of combined values. - * @example - * - * _.union([2], [1, 2]); - * // => [2, 1] - */ - var union = baseRest(function(arrays) { - return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true)); - }); - - /** - * This method is like `_.union` except that it accepts `iteratee` which is - * invoked for each element of each `arrays` to generate the criterion by - * which uniqueness is computed. Result values are chosen from the first - * array in which the value occurs. The iteratee is invoked with one argument: - * (value). - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Array - * @param {...Array} [arrays] The arrays to inspect. - * @param {Function} [iteratee=_.identity] The iteratee invoked per element. - * @returns {Array} Returns the new array of combined values. - * @example - * - * _.unionBy([2.1], [1.2, 2.3], Math.floor); - * // => [2.1, 1.2] - * - * // The `_.property` iteratee shorthand. - * _.unionBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x'); - * // => [{ 'x': 1 }, { 'x': 2 }] - */ - var unionBy = baseRest(function(arrays) { - var iteratee = last(arrays); - if (isArrayLikeObject(iteratee)) { - iteratee = undefined; - } - return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true), getIteratee(iteratee, 2)); - }); - - /** - * This method is like `_.union` except that it accepts `comparator` which - * is invoked to compare elements of `arrays`. Result values are chosen from - * the first array in which the value occurs. The comparator is invoked - * with two arguments: (arrVal, othVal). - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Array - * @param {...Array} [arrays] The arrays to inspect. - * @param {Function} [comparator] The comparator invoked per element. - * @returns {Array} Returns the new array of combined values. - * @example - * - * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]; - * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }]; - * - * _.unionWith(objects, others, _.isEqual); - * // => [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }, { 'x': 1, 'y': 1 }] - */ - var unionWith = baseRest(function(arrays) { - var comparator = last(arrays); - comparator = typeof comparator == 'function' ? comparator : undefined; - return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true), undefined, comparator); - }); - - /** - * Creates a duplicate-free version of an array, using - * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) - * for equality comparisons, in which only the first occurrence of each element - * is kept. The order of result values is determined by the order they occur - * in the array. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Array - * @param {Array} array The array to inspect. - * @returns {Array} Returns the new duplicate free array. - * @example - * - * _.uniq([2, 1, 2]); - * // => [2, 1] - */ - function uniq(array) { - return (array && array.length) ? baseUniq(array) : []; - } - - /** - * This method is like `_.uniq` except that it accepts `iteratee` which is - * invoked for each element in `array` to generate the criterion by which - * uniqueness is computed. The order of result values is determined by the - * order they occur in the array. The iteratee is invoked with one argument: - * (value). - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Array - * @param {Array} array The array to inspect. - * @param {Function} [iteratee=_.identity] The iteratee invoked per element. - * @returns {Array} Returns the new duplicate free array. - * @example - * - * _.uniqBy([2.1, 1.2, 2.3], Math.floor); - * // => [2.1, 1.2] - * - * // The `_.property` iteratee shorthand. - * _.uniqBy([{ 'x': 1 }, { 'x': 2 }, { 'x': 1 }], 'x'); - * // => [{ 'x': 1 }, { 'x': 2 }] - */ - function uniqBy(array, iteratee) { - return (array && array.length) ? baseUniq(array, getIteratee(iteratee, 2)) : []; - } - - /** - * This method is like `_.uniq` except that it accepts `comparator` which - * is invoked to compare elements of `array`. The order of result values is - * determined by the order they occur in the array.The comparator is invoked - * with two arguments: (arrVal, othVal). - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Array - * @param {Array} array The array to inspect. - * @param {Function} [comparator] The comparator invoked per element. - * @returns {Array} Returns the new duplicate free array. - * @example - * - * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }, { 'x': 1, 'y': 2 }]; - * - * _.uniqWith(objects, _.isEqual); - * // => [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }] - */ - function uniqWith(array, comparator) { - comparator = typeof comparator == 'function' ? comparator : undefined; - return (array && array.length) ? baseUniq(array, undefined, comparator) : []; - } - - /** - * This method is like `_.zip` except that it accepts an array of grouped - * elements and creates an array regrouping the elements to their pre-zip - * configuration. - * - * @static - * @memberOf _ - * @since 1.2.0 - * @category Array - * @param {Array} array The array of grouped elements to process. - * @returns {Array} Returns the new array of regrouped elements. - * @example - * - * var zipped = _.zip(['a', 'b'], [1, 2], [true, false]); - * // => [['a', 1, true], ['b', 2, false]] - * - * _.unzip(zipped); - * // => [['a', 'b'], [1, 2], [true, false]] - */ - function unzip(array) { - if (!(array && array.length)) { - return []; - } - var length = 0; - array = arrayFilter(array, function(group) { - if (isArrayLikeObject(group)) { - length = nativeMax(group.length, length); - return true; - } - }); - return baseTimes(length, function(index) { - return arrayMap(array, baseProperty(index)); - }); - } - - /** - * This method is like `_.unzip` except that it accepts `iteratee` to specify - * how regrouped values should be combined. The iteratee is invoked with the - * elements of each group: (...group). - * - * @static - * @memberOf _ - * @since 3.8.0 - * @category Array - * @param {Array} array The array of grouped elements to process. - * @param {Function} [iteratee=_.identity] The function to combine - * regrouped values. - * @returns {Array} Returns the new array of regrouped elements. - * @example - * - * var zipped = _.zip([1, 2], [10, 20], [100, 200]); - * // => [[1, 10, 100], [2, 20, 200]] - * - * _.unzipWith(zipped, _.add); - * // => [3, 30, 300] - */ - function unzipWith(array, iteratee) { - if (!(array && array.length)) { - return []; - } - var result = unzip(array); - if (iteratee == null) { - return result; - } - return arrayMap(result, function(group) { - return apply(iteratee, undefined, group); - }); - } - - /** - * Creates an array excluding all given values using - * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) - * for equality comparisons. - * - * **Note:** Unlike `_.pull`, this method returns a new array. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Array - * @param {Array} array The array to inspect. - * @param {...*} [values] The values to exclude. - * @returns {Array} Returns the new array of filtered values. - * @see _.difference, _.xor - * @example - * - * _.without([2, 1, 2, 3], 1, 2); - * // => [3] - */ - var without = baseRest(function(array, values) { - return isArrayLikeObject(array) - ? baseDifference(array, values) - : []; - }); - - /** - * Creates an array of unique values that is the - * [symmetric difference](https://en.wikipedia.org/wiki/Symmetric_difference) - * of the given arrays. The order of result values is determined by the order - * they occur in the arrays. - * - * @static - * @memberOf _ - * @since 2.4.0 - * @category Array - * @param {...Array} [arrays] The arrays to inspect. - * @returns {Array} Returns the new array of filtered values. - * @see _.difference, _.without - * @example - * - * _.xor([2, 1], [2, 3]); - * // => [1, 3] - */ - var xor = baseRest(function(arrays) { - return baseXor(arrayFilter(arrays, isArrayLikeObject)); - }); - - /** - * This method is like `_.xor` except that it accepts `iteratee` which is - * invoked for each element of each `arrays` to generate the criterion by - * which by which they're compared. The order of result values is determined - * by the order they occur in the arrays. The iteratee is invoked with one - * argument: (value). - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Array - * @param {...Array} [arrays] The arrays to inspect. - * @param {Function} [iteratee=_.identity] The iteratee invoked per element. - * @returns {Array} Returns the new array of filtered values. - * @example - * - * _.xorBy([2.1, 1.2], [2.3, 3.4], Math.floor); - * // => [1.2, 3.4] - * - * // The `_.property` iteratee shorthand. - * _.xorBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x'); - * // => [{ 'x': 2 }] - */ - var xorBy = baseRest(function(arrays) { - var iteratee = last(arrays); - if (isArrayLikeObject(iteratee)) { - iteratee = undefined; - } - return baseXor(arrayFilter(arrays, isArrayLikeObject), getIteratee(iteratee, 2)); - }); - - /** - * This method is like `_.xor` except that it accepts `comparator` which is - * invoked to compare elements of `arrays`. The order of result values is - * determined by the order they occur in the arrays. The comparator is invoked - * with two arguments: (arrVal, othVal). - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Array - * @param {...Array} [arrays] The arrays to inspect. - * @param {Function} [comparator] The comparator invoked per element. - * @returns {Array} Returns the new array of filtered values. - * @example - * - * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]; - * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }]; - * - * _.xorWith(objects, others, _.isEqual); - * // => [{ 'x': 2, 'y': 1 }, { 'x': 1, 'y': 1 }] - */ - var xorWith = baseRest(function(arrays) { - var comparator = last(arrays); - comparator = typeof comparator == 'function' ? comparator : undefined; - return baseXor(arrayFilter(arrays, isArrayLikeObject), undefined, comparator); - }); - - /** - * Creates an array of grouped elements, the first of which contains the - * first elements of the given arrays, the second of which contains the - * second elements of the given arrays, and so on. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Array - * @param {...Array} [arrays] The arrays to process. - * @returns {Array} Returns the new array of grouped elements. - * @example - * - * _.zip(['a', 'b'], [1, 2], [true, false]); - * // => [['a', 1, true], ['b', 2, false]] - */ - var zip = baseRest(unzip); - - /** - * This method is like `_.fromPairs` except that it accepts two arrays, - * one of property identifiers and one of corresponding values. - * - * @static - * @memberOf _ - * @since 0.4.0 - * @category Array - * @param {Array} [props=[]] The property identifiers. - * @param {Array} [values=[]] The property values. - * @returns {Object} Returns the new object. - * @example - * - * _.zipObject(['a', 'b'], [1, 2]); - * // => { 'a': 1, 'b': 2 } - */ - function zipObject(props, values) { - return baseZipObject(props || [], values || [], assignValue); - } - - /** - * This method is like `_.zipObject` except that it supports property paths. - * - * @static - * @memberOf _ - * @since 4.1.0 - * @category Array - * @param {Array} [props=[]] The property identifiers. - * @param {Array} [values=[]] The property values. - * @returns {Object} Returns the new object. - * @example - * - * _.zipObjectDeep(['a.b[0].c', 'a.b[1].d'], [1, 2]); - * // => { 'a': { 'b': [{ 'c': 1 }, { 'd': 2 }] } } - */ - function zipObjectDeep(props, values) { - return baseZipObject(props || [], values || [], baseSet); - } - - /** - * This method is like `_.zip` except that it accepts `iteratee` to specify - * how grouped values should be combined. The iteratee is invoked with the - * elements of each group: (...group). - * - * @static - * @memberOf _ - * @since 3.8.0 - * @category Array - * @param {...Array} [arrays] The arrays to process. - * @param {Function} [iteratee=_.identity] The function to combine - * grouped values. - * @returns {Array} Returns the new array of grouped elements. - * @example - * - * _.zipWith([1, 2], [10, 20], [100, 200], function(a, b, c) { - * return a + b + c; - * }); - * // => [111, 222] - */ - var zipWith = baseRest(function(arrays) { - var length = arrays.length, - iteratee = length > 1 ? arrays[length - 1] : undefined; - - iteratee = typeof iteratee == 'function' ? (arrays.pop(), iteratee) : undefined; - return unzipWith(arrays, iteratee); - }); - - /*------------------------------------------------------------------------*/ - - /** - * Creates a `lodash` wrapper instance that wraps `value` with explicit method - * chain sequences enabled. The result of such sequences must be unwrapped - * with `_#value`. - * - * @static - * @memberOf _ - * @since 1.3.0 - * @category Seq - * @param {*} value The value to wrap. - * @returns {Object} Returns the new `lodash` wrapper instance. - * @example - * - * var users = [ - * { 'user': 'barney', 'age': 36 }, - * { 'user': 'fred', 'age': 40 }, - * { 'user': 'pebbles', 'age': 1 } - * ]; - * - * var youngest = _ - * .chain(users) - * .sortBy('age') - * .map(function(o) { - * return o.user + ' is ' + o.age; - * }) - * .head() - * .value(); - * // => 'pebbles is 1' - */ - function chain(value) { - var result = lodash(value); - result.__chain__ = true; - return result; - } - - /** - * This method invokes `interceptor` and returns `value`. The interceptor - * is invoked with one argument; (value). The purpose of this method is to - * "tap into" a method chain sequence in order to modify intermediate results. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Seq - * @param {*} value The value to provide to `interceptor`. - * @param {Function} interceptor The function to invoke. - * @returns {*} Returns `value`. - * @example - * - * _([1, 2, 3]) - * .tap(function(array) { - * // Mutate input array. - * array.pop(); - * }) - * .reverse() - * .value(); - * // => [2, 1] - */ - function tap(value, interceptor) { - interceptor(value); - return value; - } - - /** - * This method is like `_.tap` except that it returns the result of `interceptor`. - * The purpose of this method is to "pass thru" values replacing intermediate - * results in a method chain sequence. - * - * @static - * @memberOf _ - * @since 3.0.0 - * @category Seq - * @param {*} value The value to provide to `interceptor`. - * @param {Function} interceptor The function to invoke. - * @returns {*} Returns the result of `interceptor`. - * @example - * - * _(' abc ') - * .chain() - * .trim() - * .thru(function(value) { - * return [value]; - * }) - * .value(); - * // => ['abc'] - */ - function thru(value, interceptor) { - return interceptor(value); - } - - /** - * This method is the wrapper version of `_.at`. - * - * @name at - * @memberOf _ - * @since 1.0.0 - * @category Seq - * @param {...(string|string[])} [paths] The property paths to pick. - * @returns {Object} Returns the new `lodash` wrapper instance. - * @example - * - * var object = { 'a': [{ 'b': { 'c': 3 } }, 4] }; - * - * _(object).at(['a[0].b.c', 'a[1]']).value(); - * // => [3, 4] - */ - var wrapperAt = flatRest(function(paths) { - var length = paths.length, - start = length ? paths[0] : 0, - value = this.__wrapped__, - interceptor = function(object) { return baseAt(object, paths); }; - - if (length > 1 || this.__actions__.length || - !(value instanceof LazyWrapper) || !isIndex(start)) { - return this.thru(interceptor); - } - value = value.slice(start, +start + (length ? 1 : 0)); - value.__actions__.push({ - 'func': thru, - 'args': [interceptor], - 'thisArg': undefined - }); - return new LodashWrapper(value, this.__chain__).thru(function(array) { - if (length && !array.length) { - array.push(undefined); - } - return array; - }); - }); - - /** - * Creates a `lodash` wrapper instance with explicit method chain sequences enabled. - * - * @name chain - * @memberOf _ - * @since 0.1.0 - * @category Seq - * @returns {Object} Returns the new `lodash` wrapper instance. - * @example - * - * var users = [ - * { 'user': 'barney', 'age': 36 }, - * { 'user': 'fred', 'age': 40 } - * ]; - * - * // A sequence without explicit chaining. - * _(users).head(); - * // => { 'user': 'barney', 'age': 36 } - * - * // A sequence with explicit chaining. - * _(users) - * .chain() - * .head() - * .pick('user') - * .value(); - * // => { 'user': 'barney' } - */ - function wrapperChain() { - return chain(this); - } - - /** - * Executes the chain sequence and returns the wrapped result. - * - * @name commit - * @memberOf _ - * @since 3.2.0 - * @category Seq - * @returns {Object} Returns the new `lodash` wrapper instance. - * @example - * - * var array = [1, 2]; - * var wrapped = _(array).push(3); - * - * console.log(array); - * // => [1, 2] - * - * wrapped = wrapped.commit(); - * console.log(array); - * // => [1, 2, 3] - * - * wrapped.last(); - * // => 3 - * - * console.log(array); - * // => [1, 2, 3] - */ - function wrapperCommit() { - return new LodashWrapper(this.value(), this.__chain__); - } - - /** - * Gets the next value on a wrapped object following the - * [iterator protocol](https://mdn.io/iteration_protocols#iterator). - * - * @name next - * @memberOf _ - * @since 4.0.0 - * @category Seq - * @returns {Object} Returns the next iterator value. - * @example - * - * var wrapped = _([1, 2]); - * - * wrapped.next(); - * // => { 'done': false, 'value': 1 } - * - * wrapped.next(); - * // => { 'done': false, 'value': 2 } - * - * wrapped.next(); - * // => { 'done': true, 'value': undefined } - */ - function wrapperNext() { - if (this.__values__ === undefined) { - this.__values__ = toArray(this.value()); - } - var done = this.__index__ >= this.__values__.length, - value = done ? undefined : this.__values__[this.__index__++]; - - return { 'done': done, 'value': value }; - } - - /** - * Enables the wrapper to be iterable. - * - * @name Symbol.iterator - * @memberOf _ - * @since 4.0.0 - * @category Seq - * @returns {Object} Returns the wrapper object. - * @example - * - * var wrapped = _([1, 2]); - * - * wrapped[Symbol.iterator]() === wrapped; - * // => true - * - * Array.from(wrapped); - * // => [1, 2] - */ - function wrapperToIterator() { - return this; - } - - /** - * Creates a clone of the chain sequence planting `value` as the wrapped value. - * - * @name plant - * @memberOf _ - * @since 3.2.0 - * @category Seq - * @param {*} value The value to plant. - * @returns {Object} Returns the new `lodash` wrapper instance. - * @example - * - * function square(n) { - * return n * n; - * } - * - * var wrapped = _([1, 2]).map(square); - * var other = wrapped.plant([3, 4]); - * - * other.value(); - * // => [9, 16] - * - * wrapped.value(); - * // => [1, 4] - */ - function wrapperPlant(value) { - var result, - parent = this; - - while (parent instanceof baseLodash) { - var clone = wrapperClone(parent); - clone.__index__ = 0; - clone.__values__ = undefined; - if (result) { - previous.__wrapped__ = clone; - } else { - result = clone; - } - var previous = clone; - parent = parent.__wrapped__; - } - previous.__wrapped__ = value; - return result; - } - - /** - * This method is the wrapper version of `_.reverse`. - * - * **Note:** This method mutates the wrapped array. - * - * @name reverse - * @memberOf _ - * @since 0.1.0 - * @category Seq - * @returns {Object} Returns the new `lodash` wrapper instance. - * @example - * - * var array = [1, 2, 3]; - * - * _(array).reverse().value() - * // => [3, 2, 1] - * - * console.log(array); - * // => [3, 2, 1] - */ - function wrapperReverse() { - var value = this.__wrapped__; - if (value instanceof LazyWrapper) { - var wrapped = value; - if (this.__actions__.length) { - wrapped = new LazyWrapper(this); - } - wrapped = wrapped.reverse(); - wrapped.__actions__.push({ - 'func': thru, - 'args': [reverse], - 'thisArg': undefined - }); - return new LodashWrapper(wrapped, this.__chain__); - } - return this.thru(reverse); - } - - /** - * Executes the chain sequence to resolve the unwrapped value. - * - * @name value - * @memberOf _ - * @since 0.1.0 - * @alias toJSON, valueOf - * @category Seq - * @returns {*} Returns the resolved unwrapped value. - * @example - * - * _([1, 2, 3]).value(); - * // => [1, 2, 3] - */ - function wrapperValue() { - return baseWrapperValue(this.__wrapped__, this.__actions__); - } - - /*------------------------------------------------------------------------*/ - - /** - * Creates an object composed of keys generated from the results of running - * each element of `collection` thru `iteratee`. The corresponding value of - * each key is the number of times the key was returned by `iteratee`. The - * iteratee is invoked with one argument: (value). - * - * @static - * @memberOf _ - * @since 0.5.0 - * @category Collection - * @param {Array|Object} collection The collection to iterate over. - * @param {Function} [iteratee=_.identity] The iteratee to transform keys. - * @returns {Object} Returns the composed aggregate object. - * @example - * - * _.countBy([6.1, 4.2, 6.3], Math.floor); - * // => { '4': 1, '6': 2 } - * - * // The `_.property` iteratee shorthand. - * _.countBy(['one', 'two', 'three'], 'length'); - * // => { '3': 2, '5': 1 } - */ - var countBy = createAggregator(function(result, value, key) { - if (hasOwnProperty.call(result, key)) { - ++result[key]; - } else { - baseAssignValue(result, key, 1); - } - }); - - /** - * Checks if `predicate` returns truthy for **all** elements of `collection`. - * Iteration is stopped once `predicate` returns falsey. The predicate is - * invoked with three arguments: (value, index|key, collection). - * - * **Note:** This method returns `true` for - * [empty collections](https://en.wikipedia.org/wiki/Empty_set) because - * [everything is true](https://en.wikipedia.org/wiki/Vacuous_truth) of - * elements of empty collections. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Collection - * @param {Array|Object} collection The collection to iterate over. - * @param {Function} [predicate=_.identity] The function invoked per iteration. - * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. - * @returns {boolean} Returns `true` if all elements pass the predicate check, - * else `false`. - * @example - * - * _.every([true, 1, null, 'yes'], Boolean); - * // => false - * - * var users = [ - * { 'user': 'barney', 'age': 36, 'active': false }, - * { 'user': 'fred', 'age': 40, 'active': false } - * ]; - * - * // The `_.matches` iteratee shorthand. - * _.every(users, { 'user': 'barney', 'active': false }); - * // => false - * - * // The `_.matchesProperty` iteratee shorthand. - * _.every(users, ['active', false]); - * // => true - * - * // The `_.property` iteratee shorthand. - * _.every(users, 'active'); - * // => false - */ - function every(collection, predicate, guard) { - var func = isArray(collection) ? arrayEvery : baseEvery; - if (guard && isIterateeCall(collection, predicate, guard)) { - predicate = undefined; - } - return func(collection, getIteratee(predicate, 3)); - } - - /** - * Iterates over elements of `collection`, returning an array of all elements - * `predicate` returns truthy for. The predicate is invoked with three - * arguments: (value, index|key, collection). - * - * **Note:** Unlike `_.remove`, this method returns a new array. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Collection - * @param {Array|Object} collection The collection to iterate over. - * @param {Function} [predicate=_.identity] The function invoked per iteration. - * @returns {Array} Returns the new filtered array. - * @see _.reject - * @example - * - * var users = [ - * { 'user': 'barney', 'age': 36, 'active': true }, - * { 'user': 'fred', 'age': 40, 'active': false } - * ]; - * - * _.filter(users, function(o) { return !o.active; }); - * // => objects for ['fred'] - * - * // The `_.matches` iteratee shorthand. - * _.filter(users, { 'age': 36, 'active': true }); - * // => objects for ['barney'] - * - * // The `_.matchesProperty` iteratee shorthand. - * _.filter(users, ['active', false]); - * // => objects for ['fred'] - * - * // The `_.property` iteratee shorthand. - * _.filter(users, 'active'); - * // => objects for ['barney'] - * - * // Combining several predicates using `_.overEvery` or `_.overSome`. - * _.filter(users, _.overSome([{ 'age': 36 }, ['age', 40]])); - * // => objects for ['fred', 'barney'] - */ - function filter(collection, predicate) { - var func = isArray(collection) ? arrayFilter : baseFilter; - return func(collection, getIteratee(predicate, 3)); - } - - /** - * Iterates over elements of `collection`, returning the first element - * `predicate` returns truthy for. The predicate is invoked with three - * arguments: (value, index|key, collection). - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Collection - * @param {Array|Object} collection The collection to inspect. - * @param {Function} [predicate=_.identity] The function invoked per iteration. - * @param {number} [fromIndex=0] The index to search from. - * @returns {*} Returns the matched element, else `undefined`. - * @example - * - * var users = [ - * { 'user': 'barney', 'age': 36, 'active': true }, - * { 'user': 'fred', 'age': 40, 'active': false }, - * { 'user': 'pebbles', 'age': 1, 'active': true } - * ]; - * - * _.find(users, function(o) { return o.age < 40; }); - * // => object for 'barney' - * - * // The `_.matches` iteratee shorthand. - * _.find(users, { 'age': 1, 'active': true }); - * // => object for 'pebbles' - * - * // The `_.matchesProperty` iteratee shorthand. - * _.find(users, ['active', false]); - * // => object for 'fred' - * - * // The `_.property` iteratee shorthand. - * _.find(users, 'active'); - * // => object for 'barney' - */ - var find = createFind(findIndex); - - /** - * This method is like `_.find` except that it iterates over elements of - * `collection` from right to left. - * - * @static - * @memberOf _ - * @since 2.0.0 - * @category Collection - * @param {Array|Object} collection The collection to inspect. - * @param {Function} [predicate=_.identity] The function invoked per iteration. - * @param {number} [fromIndex=collection.length-1] The index to search from. - * @returns {*} Returns the matched element, else `undefined`. - * @example - * - * _.findLast([1, 2, 3, 4], function(n) { - * return n % 2 == 1; - * }); - * // => 3 - */ - var findLast = createFind(findLastIndex); - - /** - * Creates a flattened array of values by running each element in `collection` - * thru `iteratee` and flattening the mapped results. The iteratee is invoked - * with three arguments: (value, index|key, collection). - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Collection - * @param {Array|Object} collection The collection to iterate over. - * @param {Function} [iteratee=_.identity] The function invoked per iteration. - * @returns {Array} Returns the new flattened array. - * @example - * - * function duplicate(n) { - * return [n, n]; - * } - * - * _.flatMap([1, 2], duplicate); - * // => [1, 1, 2, 2] - */ - function flatMap(collection, iteratee) { - return baseFlatten(map(collection, iteratee), 1); - } - - /** - * This method is like `_.flatMap` except that it recursively flattens the - * mapped results. - * - * @static - * @memberOf _ - * @since 4.7.0 - * @category Collection - * @param {Array|Object} collection The collection to iterate over. - * @param {Function} [iteratee=_.identity] The function invoked per iteration. - * @returns {Array} Returns the new flattened array. - * @example - * - * function duplicate(n) { - * return [[[n, n]]]; - * } - * - * _.flatMapDeep([1, 2], duplicate); - * // => [1, 1, 2, 2] - */ - function flatMapDeep(collection, iteratee) { - return baseFlatten(map(collection, iteratee), INFINITY); - } - - /** - * This method is like `_.flatMap` except that it recursively flattens the - * mapped results up to `depth` times. - * - * @static - * @memberOf _ - * @since 4.7.0 - * @category Collection - * @param {Array|Object} collection The collection to iterate over. - * @param {Function} [iteratee=_.identity] The function invoked per iteration. - * @param {number} [depth=1] The maximum recursion depth. - * @returns {Array} Returns the new flattened array. - * @example - * - * function duplicate(n) { - * return [[[n, n]]]; - * } - * - * _.flatMapDepth([1, 2], duplicate, 2); - * // => [[1, 1], [2, 2]] - */ - function flatMapDepth(collection, iteratee, depth) { - depth = depth === undefined ? 1 : toInteger(depth); - return baseFlatten(map(collection, iteratee), depth); - } - - /** - * Iterates over elements of `collection` and invokes `iteratee` for each element. - * The iteratee is invoked with three arguments: (value, index|key, collection). - * Iteratee functions may exit iteration early by explicitly returning `false`. - * - * **Note:** As with other "Collections" methods, objects with a "length" - * property are iterated like arrays. To avoid this behavior use `_.forIn` - * or `_.forOwn` for object iteration. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @alias each - * @category Collection - * @param {Array|Object} collection The collection to iterate over. - * @param {Function} [iteratee=_.identity] The function invoked per iteration. - * @returns {Array|Object} Returns `collection`. - * @see _.forEachRight - * @example - * - * _.forEach([1, 2], function(value) { - * console.log(value); - * }); - * // => Logs `1` then `2`. - * - * _.forEach({ 'a': 1, 'b': 2 }, function(value, key) { - * console.log(key); - * }); - * // => Logs 'a' then 'b' (iteration order is not guaranteed). - */ - function forEach(collection, iteratee) { - var func = isArray(collection) ? arrayEach : baseEach; - return func(collection, getIteratee(iteratee, 3)); - } - - /** - * This method is like `_.forEach` except that it iterates over elements of - * `collection` from right to left. - * - * @static - * @memberOf _ - * @since 2.0.0 - * @alias eachRight - * @category Collection - * @param {Array|Object} collection The collection to iterate over. - * @param {Function} [iteratee=_.identity] The function invoked per iteration. - * @returns {Array|Object} Returns `collection`. - * @see _.forEach - * @example - * - * _.forEachRight([1, 2], function(value) { - * console.log(value); - * }); - * // => Logs `2` then `1`. - */ - function forEachRight(collection, iteratee) { - var func = isArray(collection) ? arrayEachRight : baseEachRight; - return func(collection, getIteratee(iteratee, 3)); - } - - /** - * Creates an object composed of keys generated from the results of running - * each element of `collection` thru `iteratee`. The order of grouped values - * is determined by the order they occur in `collection`. The corresponding - * value of each key is an array of elements responsible for generating the - * key. The iteratee is invoked with one argument: (value). - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Collection - * @param {Array|Object} collection The collection to iterate over. - * @param {Function} [iteratee=_.identity] The iteratee to transform keys. - * @returns {Object} Returns the composed aggregate object. - * @example - * - * _.groupBy([6.1, 4.2, 6.3], Math.floor); - * // => { '4': [4.2], '6': [6.1, 6.3] } - * - * // The `_.property` iteratee shorthand. - * _.groupBy(['one', 'two', 'three'], 'length'); - * // => { '3': ['one', 'two'], '5': ['three'] } - */ - var groupBy = createAggregator(function(result, value, key) { - if (hasOwnProperty.call(result, key)) { - result[key].push(value); - } else { - baseAssignValue(result, key, [value]); - } - }); - - /** - * Checks if `value` is in `collection`. If `collection` is a string, it's - * checked for a substring of `value`, otherwise - * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) - * is used for equality comparisons. If `fromIndex` is negative, it's used as - * the offset from the end of `collection`. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Collection - * @param {Array|Object|string} collection The collection to inspect. - * @param {*} value The value to search for. - * @param {number} [fromIndex=0] The index to search from. - * @param- {Object} [guard] Enables use as an iteratee for methods like `_.reduce`. - * @returns {boolean} Returns `true` if `value` is found, else `false`. - * @example - * - * _.includes([1, 2, 3], 1); - * // => true - * - * _.includes([1, 2, 3], 1, 2); - * // => false - * - * _.includes({ 'a': 1, 'b': 2 }, 1); - * // => true - * - * _.includes('abcd', 'bc'); - * // => true - */ - function includes(collection, value, fromIndex, guard) { - collection = isArrayLike(collection) ? collection : values(collection); - fromIndex = (fromIndex && !guard) ? toInteger(fromIndex) : 0; - - var length = collection.length; - if (fromIndex < 0) { - fromIndex = nativeMax(length + fromIndex, 0); - } - return isString(collection) - ? (fromIndex <= length && collection.indexOf(value, fromIndex) > -1) - : (!!length && baseIndexOf(collection, value, fromIndex) > -1); - } - - /** - * Invokes the method at `path` of each element in `collection`, returning - * an array of the results of each invoked method. Any additional arguments - * are provided to each invoked method. If `path` is a function, it's invoked - * for, and `this` bound to, each element in `collection`. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Collection - * @param {Array|Object} collection The collection to iterate over. - * @param {Array|Function|string} path The path of the method to invoke or - * the function invoked per iteration. - * @param {...*} [args] The arguments to invoke each method with. - * @returns {Array} Returns the array of results. - * @example - * - * _.invokeMap([[5, 1, 7], [3, 2, 1]], 'sort'); - * // => [[1, 5, 7], [1, 2, 3]] - * - * _.invokeMap([123, 456], String.prototype.split, ''); - * // => [['1', '2', '3'], ['4', '5', '6']] - */ - var invokeMap = baseRest(function(collection, path, args) { - var index = -1, - isFunc = typeof path == 'function', - result = isArrayLike(collection) ? Array(collection.length) : []; - - baseEach(collection, function(value) { - result[++index] = isFunc ? apply(path, value, args) : baseInvoke(value, path, args); - }); - return result; - }); - - /** - * Creates an object composed of keys generated from the results of running - * each element of `collection` thru `iteratee`. The corresponding value of - * each key is the last element responsible for generating the key. The - * iteratee is invoked with one argument: (value). - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Collection - * @param {Array|Object} collection The collection to iterate over. - * @param {Function} [iteratee=_.identity] The iteratee to transform keys. - * @returns {Object} Returns the composed aggregate object. - * @example - * - * var array = [ - * { 'dir': 'left', 'code': 97 }, - * { 'dir': 'right', 'code': 100 } - * ]; - * - * _.keyBy(array, function(o) { - * return String.fromCharCode(o.code); - * }); - * // => { 'a': { 'dir': 'left', 'code': 97 }, 'd': { 'dir': 'right', 'code': 100 } } - * - * _.keyBy(array, 'dir'); - * // => { 'left': { 'dir': 'left', 'code': 97 }, 'right': { 'dir': 'right', 'code': 100 } } - */ - var keyBy = createAggregator(function(result, value, key) { - baseAssignValue(result, key, value); - }); - - /** - * Creates an array of values by running each element in `collection` thru - * `iteratee`. The iteratee is invoked with three arguments: - * (value, index|key, collection). - * - * Many lodash methods are guarded to work as iteratees for methods like - * `_.every`, `_.filter`, `_.map`, `_.mapValues`, `_.reject`, and `_.some`. - * - * The guarded methods are: - * `ary`, `chunk`, `curry`, `curryRight`, `drop`, `dropRight`, `every`, - * `fill`, `invert`, `parseInt`, `random`, `range`, `rangeRight`, `repeat`, - * `sampleSize`, `slice`, `some`, `sortBy`, `split`, `take`, `takeRight`, - * `template`, `trim`, `trimEnd`, `trimStart`, and `words` - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Collection - * @param {Array|Object} collection The collection to iterate over. - * @param {Function} [iteratee=_.identity] The function invoked per iteration. - * @returns {Array} Returns the new mapped array. - * @example - * - * function square(n) { - * return n * n; - * } - * - * _.map([4, 8], square); - * // => [16, 64] - * - * _.map({ 'a': 4, 'b': 8 }, square); - * // => [16, 64] (iteration order is not guaranteed) - * - * var users = [ - * { 'user': 'barney' }, - * { 'user': 'fred' } - * ]; - * - * // The `_.property` iteratee shorthand. - * _.map(users, 'user'); - * // => ['barney', 'fred'] - */ - function map(collection, iteratee) { - var func = isArray(collection) ? arrayMap : baseMap; - return func(collection, getIteratee(iteratee, 3)); - } - - /** - * This method is like `_.sortBy` except that it allows specifying the sort - * orders of the iteratees to sort by. If `orders` is unspecified, all values - * are sorted in ascending order. Otherwise, specify an order of "desc" for - * descending or "asc" for ascending sort order of corresponding values. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Collection - * @param {Array|Object} collection The collection to iterate over. - * @param {Array[]|Function[]|Object[]|string[]} [iteratees=[_.identity]] - * The iteratees to sort by. - * @param {string[]} [orders] The sort orders of `iteratees`. - * @param- {Object} [guard] Enables use as an iteratee for methods like `_.reduce`. - * @returns {Array} Returns the new sorted array. - * @example - * - * var users = [ - * { 'user': 'fred', 'age': 48 }, - * { 'user': 'barney', 'age': 34 }, - * { 'user': 'fred', 'age': 40 }, - * { 'user': 'barney', 'age': 36 } - * ]; - * - * // Sort by `user` in ascending order and by `age` in descending order. - * _.orderBy(users, ['user', 'age'], ['asc', 'desc']); - * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 40]] - */ - function orderBy(collection, iteratees, orders, guard) { - if (collection == null) { - return []; - } - if (!isArray(iteratees)) { - iteratees = iteratees == null ? [] : [iteratees]; - } - orders = guard ? undefined : orders; - if (!isArray(orders)) { - orders = orders == null ? [] : [orders]; - } - return baseOrderBy(collection, iteratees, orders); - } - - /** - * Creates an array of elements split into two groups, the first of which - * contains elements `predicate` returns truthy for, the second of which - * contains elements `predicate` returns falsey for. The predicate is - * invoked with one argument: (value). - * - * @static - * @memberOf _ - * @since 3.0.0 - * @category Collection - * @param {Array|Object} collection The collection to iterate over. - * @param {Function} [predicate=_.identity] The function invoked per iteration. - * @returns {Array} Returns the array of grouped elements. - * @example - * - * var users = [ - * { 'user': 'barney', 'age': 36, 'active': false }, - * { 'user': 'fred', 'age': 40, 'active': true }, - * { 'user': 'pebbles', 'age': 1, 'active': false } - * ]; - * - * _.partition(users, function(o) { return o.active; }); - * // => objects for [['fred'], ['barney', 'pebbles']] - * - * // The `_.matches` iteratee shorthand. - * _.partition(users, { 'age': 1, 'active': false }); - * // => objects for [['pebbles'], ['barney', 'fred']] - * - * // The `_.matchesProperty` iteratee shorthand. - * _.partition(users, ['active', false]); - * // => objects for [['barney', 'pebbles'], ['fred']] - * - * // The `_.property` iteratee shorthand. - * _.partition(users, 'active'); - * // => objects for [['fred'], ['barney', 'pebbles']] - */ - var partition = createAggregator(function(result, value, key) { - result[key ? 0 : 1].push(value); - }, function() { return [[], []]; }); - - /** - * Reduces `collection` to a value which is the accumulated result of running - * each element in `collection` thru `iteratee`, where each successive - * invocation is supplied the return value of the previous. If `accumulator` - * is not given, the first element of `collection` is used as the initial - * value. The iteratee is invoked with four arguments: - * (accumulator, value, index|key, collection). - * - * Many lodash methods are guarded to work as iteratees for methods like - * `_.reduce`, `_.reduceRight`, and `_.transform`. - * - * The guarded methods are: - * `assign`, `defaults`, `defaultsDeep`, `includes`, `merge`, `orderBy`, - * and `sortBy` - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Collection - * @param {Array|Object} collection The collection to iterate over. - * @param {Function} [iteratee=_.identity] The function invoked per iteration. - * @param {*} [accumulator] The initial value. - * @returns {*} Returns the accumulated value. - * @see _.reduceRight - * @example - * - * _.reduce([1, 2], function(sum, n) { - * return sum + n; - * }, 0); - * // => 3 - * - * _.reduce({ 'a': 1, 'b': 2, 'c': 1 }, function(result, value, key) { - * (result[value] || (result[value] = [])).push(key); - * return result; - * }, {}); - * // => { '1': ['a', 'c'], '2': ['b'] } (iteration order is not guaranteed) - */ - function reduce(collection, iteratee, accumulator) { - var func = isArray(collection) ? arrayReduce : baseReduce, - initAccum = arguments.length < 3; - - return func(collection, getIteratee(iteratee, 4), accumulator, initAccum, baseEach); - } - - /** - * This method is like `_.reduce` except that it iterates over elements of - * `collection` from right to left. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Collection - * @param {Array|Object} collection The collection to iterate over. - * @param {Function} [iteratee=_.identity] The function invoked per iteration. - * @param {*} [accumulator] The initial value. - * @returns {*} Returns the accumulated value. - * @see _.reduce - * @example - * - * var array = [[0, 1], [2, 3], [4, 5]]; - * - * _.reduceRight(array, function(flattened, other) { - * return flattened.concat(other); - * }, []); - * // => [4, 5, 2, 3, 0, 1] - */ - function reduceRight(collection, iteratee, accumulator) { - var func = isArray(collection) ? arrayReduceRight : baseReduce, - initAccum = arguments.length < 3; - - return func(collection, getIteratee(iteratee, 4), accumulator, initAccum, baseEachRight); - } - - /** - * The opposite of `_.filter`; this method returns the elements of `collection` - * that `predicate` does **not** return truthy for. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Collection - * @param {Array|Object} collection The collection to iterate over. - * @param {Function} [predicate=_.identity] The function invoked per iteration. - * @returns {Array} Returns the new filtered array. - * @see _.filter - * @example - * - * var users = [ - * { 'user': 'barney', 'age': 36, 'active': false }, - * { 'user': 'fred', 'age': 40, 'active': true } - * ]; - * - * _.reject(users, function(o) { return !o.active; }); - * // => objects for ['fred'] - * - * // The `_.matches` iteratee shorthand. - * _.reject(users, { 'age': 40, 'active': true }); - * // => objects for ['barney'] - * - * // The `_.matchesProperty` iteratee shorthand. - * _.reject(users, ['active', false]); - * // => objects for ['fred'] - * - * // The `_.property` iteratee shorthand. - * _.reject(users, 'active'); - * // => objects for ['barney'] - */ - function reject(collection, predicate) { - var func = isArray(collection) ? arrayFilter : baseFilter; - return func(collection, negate(getIteratee(predicate, 3))); - } - - /** - * Gets a random element from `collection`. - * - * @static - * @memberOf _ - * @since 2.0.0 - * @category Collection - * @param {Array|Object} collection The collection to sample. - * @returns {*} Returns the random element. - * @example - * - * _.sample([1, 2, 3, 4]); - * // => 2 - */ - function sample(collection) { - var func = isArray(collection) ? arraySample : baseSample; - return func(collection); - } - - /** - * Gets `n` random elements at unique keys from `collection` up to the - * size of `collection`. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Collection - * @param {Array|Object} collection The collection to sample. - * @param {number} [n=1] The number of elements to sample. - * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. - * @returns {Array} Returns the random elements. - * @example - * - * _.sampleSize([1, 2, 3], 2); - * // => [3, 1] - * - * _.sampleSize([1, 2, 3], 4); - * // => [2, 3, 1] - */ - function sampleSize(collection, n, guard) { - if ((guard ? isIterateeCall(collection, n, guard) : n === undefined)) { - n = 1; - } else { - n = toInteger(n); - } - var func = isArray(collection) ? arraySampleSize : baseSampleSize; - return func(collection, n); - } - - /** - * Creates an array of shuffled values, using a version of the - * [Fisher-Yates shuffle](https://en.wikipedia.org/wiki/Fisher-Yates_shuffle). - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Collection - * @param {Array|Object} collection The collection to shuffle. - * @returns {Array} Returns the new shuffled array. - * @example - * - * _.shuffle([1, 2, 3, 4]); - * // => [4, 1, 3, 2] - */ - function shuffle(collection) { - var func = isArray(collection) ? arrayShuffle : baseShuffle; - return func(collection); - } - - /** - * Gets the size of `collection` by returning its length for array-like - * values or the number of own enumerable string keyed properties for objects. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Collection - * @param {Array|Object|string} collection The collection to inspect. - * @returns {number} Returns the collection size. - * @example - * - * _.size([1, 2, 3]); - * // => 3 - * - * _.size({ 'a': 1, 'b': 2 }); - * // => 2 - * - * _.size('pebbles'); - * // => 7 - */ - function size(collection) { - if (collection == null) { - return 0; - } - if (isArrayLike(collection)) { - return isString(collection) ? stringSize(collection) : collection.length; - } - var tag = getTag(collection); - if (tag == mapTag || tag == setTag) { - return collection.size; - } - return baseKeys(collection).length; - } - - /** - * Checks if `predicate` returns truthy for **any** element of `collection`. - * Iteration is stopped once `predicate` returns truthy. The predicate is - * invoked with three arguments: (value, index|key, collection). - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Collection - * @param {Array|Object} collection The collection to iterate over. - * @param {Function} [predicate=_.identity] The function invoked per iteration. - * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. - * @returns {boolean} Returns `true` if any element passes the predicate check, - * else `false`. - * @example - * - * _.some([null, 0, 'yes', false], Boolean); - * // => true - * - * var users = [ - * { 'user': 'barney', 'active': true }, - * { 'user': 'fred', 'active': false } - * ]; - * - * // The `_.matches` iteratee shorthand. - * _.some(users, { 'user': 'barney', 'active': false }); - * // => false - * - * // The `_.matchesProperty` iteratee shorthand. - * _.some(users, ['active', false]); - * // => true - * - * // The `_.property` iteratee shorthand. - * _.some(users, 'active'); - * // => true - */ - function some(collection, predicate, guard) { - var func = isArray(collection) ? arraySome : baseSome; - if (guard && isIterateeCall(collection, predicate, guard)) { - predicate = undefined; - } - return func(collection, getIteratee(predicate, 3)); - } - - /** - * Creates an array of elements, sorted in ascending order by the results of - * running each element in a collection thru each iteratee. This method - * performs a stable sort, that is, it preserves the original sort order of - * equal elements. The iteratees are invoked with one argument: (value). - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Collection - * @param {Array|Object} collection The collection to iterate over. - * @param {...(Function|Function[])} [iteratees=[_.identity]] - * The iteratees to sort by. - * @returns {Array} Returns the new sorted array. - * @example - * - * var users = [ - * { 'user': 'fred', 'age': 48 }, - * { 'user': 'barney', 'age': 36 }, - * { 'user': 'fred', 'age': 30 }, - * { 'user': 'barney', 'age': 34 } - * ]; - * - * _.sortBy(users, [function(o) { return o.user; }]); - * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 30]] - * - * _.sortBy(users, ['user', 'age']); - * // => objects for [['barney', 34], ['barney', 36], ['fred', 30], ['fred', 48]] - */ - var sortBy = baseRest(function(collection, iteratees) { - if (collection == null) { - return []; - } - var length = iteratees.length; - if (length > 1 && isIterateeCall(collection, iteratees[0], iteratees[1])) { - iteratees = []; - } else if (length > 2 && isIterateeCall(iteratees[0], iteratees[1], iteratees[2])) { - iteratees = [iteratees[0]]; - } - return baseOrderBy(collection, baseFlatten(iteratees, 1), []); - }); - - /*------------------------------------------------------------------------*/ - - /** - * Gets the timestamp of the number of milliseconds that have elapsed since - * the Unix epoch (1 January 1970 00:00:00 UTC). - * - * @static - * @memberOf _ - * @since 2.4.0 - * @category Date - * @returns {number} Returns the timestamp. - * @example - * - * _.defer(function(stamp) { - * console.log(_.now() - stamp); - * }, _.now()); - * // => Logs the number of milliseconds it took for the deferred invocation. - */ - var now = ctxNow || function() { - return root.Date.now(); - }; - - /*------------------------------------------------------------------------*/ - - /** - * The opposite of `_.before`; this method creates a function that invokes - * `func` once it's called `n` or more times. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Function - * @param {number} n The number of calls before `func` is invoked. - * @param {Function} func The function to restrict. - * @returns {Function} Returns the new restricted function. - * @example - * - * var saves = ['profile', 'settings']; - * - * var done = _.after(saves.length, function() { - * console.log('done saving!'); - * }); - * - * _.forEach(saves, function(type) { - * asyncSave({ 'type': type, 'complete': done }); - * }); - * // => Logs 'done saving!' after the two async saves have completed. - */ - function after(n, func) { - if (typeof func != 'function') { - throw new TypeError(FUNC_ERROR_TEXT); - } - n = toInteger(n); - return function() { - if (--n < 1) { - return func.apply(this, arguments); - } - }; - } - - /** - * Creates a function that invokes `func`, with up to `n` arguments, - * ignoring any additional arguments. - * - * @static - * @memberOf _ - * @since 3.0.0 - * @category Function - * @param {Function} func The function to cap arguments for. - * @param {number} [n=func.length] The arity cap. - * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. - * @returns {Function} Returns the new capped function. - * @example - * - * _.map(['6', '8', '10'], _.ary(parseInt, 1)); - * // => [6, 8, 10] - */ - function ary(func, n, guard) { - n = guard ? undefined : n; - n = (func && n == null) ? func.length : n; - return createWrap(func, WRAP_ARY_FLAG, undefined, undefined, undefined, undefined, n); - } - - /** - * Creates a function that invokes `func`, with the `this` binding and arguments - * of the created function, while it's called less than `n` times. Subsequent - * calls to the created function return the result of the last `func` invocation. - * - * @static - * @memberOf _ - * @since 3.0.0 - * @category Function - * @param {number} n The number of calls at which `func` is no longer invoked. - * @param {Function} func The function to restrict. - * @returns {Function} Returns the new restricted function. - * @example - * - * jQuery(element).on('click', _.before(5, addContactToList)); - * // => Allows adding up to 4 contacts to the list. - */ - function before(n, func) { - var result; - if (typeof func != 'function') { - throw new TypeError(FUNC_ERROR_TEXT); - } - n = toInteger(n); - return function() { - if (--n > 0) { - result = func.apply(this, arguments); - } - if (n <= 1) { - func = undefined; - } - return result; - }; - } - - /** - * Creates a function that invokes `func` with the `this` binding of `thisArg` - * and `partials` prepended to the arguments it receives. - * - * The `_.bind.placeholder` value, which defaults to `_` in monolithic builds, - * may be used as a placeholder for partially applied arguments. - * - * **Note:** Unlike native `Function#bind`, this method doesn't set the "length" - * property of bound functions. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Function - * @param {Function} func The function to bind. - * @param {*} thisArg The `this` binding of `func`. - * @param {...*} [partials] The arguments to be partially applied. - * @returns {Function} Returns the new bound function. - * @example - * - * function greet(greeting, punctuation) { - * return greeting + ' ' + this.user + punctuation; - * } - * - * var object = { 'user': 'fred' }; - * - * var bound = _.bind(greet, object, 'hi'); - * bound('!'); - * // => 'hi fred!' - * - * // Bound with placeholders. - * var bound = _.bind(greet, object, _, '!'); - * bound('hi'); - * // => 'hi fred!' - */ - var bind = baseRest(function(func, thisArg, partials) { - var bitmask = WRAP_BIND_FLAG; - if (partials.length) { - var holders = replaceHolders(partials, getHolder(bind)); - bitmask |= WRAP_PARTIAL_FLAG; - } - return createWrap(func, bitmask, thisArg, partials, holders); - }); - - /** - * Creates a function that invokes the method at `object[key]` with `partials` - * prepended to the arguments it receives. - * - * This method differs from `_.bind` by allowing bound functions to reference - * methods that may be redefined or don't yet exist. See - * [Peter Michaux's article](http://peter.michaux.ca/articles/lazy-function-definition-pattern) - * for more details. - * - * The `_.bindKey.placeholder` value, which defaults to `_` in monolithic - * builds, may be used as a placeholder for partially applied arguments. - * - * @static - * @memberOf _ - * @since 0.10.0 - * @category Function - * @param {Object} object The object to invoke the method on. - * @param {string} key The key of the method. - * @param {...*} [partials] The arguments to be partially applied. - * @returns {Function} Returns the new bound function. - * @example - * - * var object = { - * 'user': 'fred', - * 'greet': function(greeting, punctuation) { - * return greeting + ' ' + this.user + punctuation; - * } - * }; - * - * var bound = _.bindKey(object, 'greet', 'hi'); - * bound('!'); - * // => 'hi fred!' - * - * object.greet = function(greeting, punctuation) { - * return greeting + 'ya ' + this.user + punctuation; - * }; - * - * bound('!'); - * // => 'hiya fred!' - * - * // Bound with placeholders. - * var bound = _.bindKey(object, 'greet', _, '!'); - * bound('hi'); - * // => 'hiya fred!' - */ - var bindKey = baseRest(function(object, key, partials) { - var bitmask = WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG; - if (partials.length) { - var holders = replaceHolders(partials, getHolder(bindKey)); - bitmask |= WRAP_PARTIAL_FLAG; - } - return createWrap(key, bitmask, object, partials, holders); - }); - - /** - * Creates a function that accepts arguments of `func` and either invokes - * `func` returning its result, if at least `arity` number of arguments have - * been provided, or returns a function that accepts the remaining `func` - * arguments, and so on. The arity of `func` may be specified if `func.length` - * is not sufficient. - * - * The `_.curry.placeholder` value, which defaults to `_` in monolithic builds, - * may be used as a placeholder for provided arguments. - * - * **Note:** This method doesn't set the "length" property of curried functions. - * - * @static - * @memberOf _ - * @since 2.0.0 - * @category Function - * @param {Function} func The function to curry. - * @param {number} [arity=func.length] The arity of `func`. - * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. - * @returns {Function} Returns the new curried function. - * @example - * - * var abc = function(a, b, c) { - * return [a, b, c]; - * }; - * - * var curried = _.curry(abc); - * - * curried(1)(2)(3); - * // => [1, 2, 3] - * - * curried(1, 2)(3); - * // => [1, 2, 3] - * - * curried(1, 2, 3); - * // => [1, 2, 3] - * - * // Curried with placeholders. - * curried(1)(_, 3)(2); - * // => [1, 2, 3] - */ - function curry(func, arity, guard) { - arity = guard ? undefined : arity; - var result = createWrap(func, WRAP_CURRY_FLAG, undefined, undefined, undefined, undefined, undefined, arity); - result.placeholder = curry.placeholder; - return result; - } - - /** - * This method is like `_.curry` except that arguments are applied to `func` - * in the manner of `_.partialRight` instead of `_.partial`. - * - * The `_.curryRight.placeholder` value, which defaults to `_` in monolithic - * builds, may be used as a placeholder for provided arguments. - * - * **Note:** This method doesn't set the "length" property of curried functions. - * - * @static - * @memberOf _ - * @since 3.0.0 - * @category Function - * @param {Function} func The function to curry. - * @param {number} [arity=func.length] The arity of `func`. - * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. - * @returns {Function} Returns the new curried function. - * @example - * - * var abc = function(a, b, c) { - * return [a, b, c]; - * }; - * - * var curried = _.curryRight(abc); - * - * curried(3)(2)(1); - * // => [1, 2, 3] - * - * curried(2, 3)(1); - * // => [1, 2, 3] - * - * curried(1, 2, 3); - * // => [1, 2, 3] - * - * // Curried with placeholders. - * curried(3)(1, _)(2); - * // => [1, 2, 3] - */ - function curryRight(func, arity, guard) { - arity = guard ? undefined : arity; - var result = createWrap(func, WRAP_CURRY_RIGHT_FLAG, undefined, undefined, undefined, undefined, undefined, arity); - result.placeholder = curryRight.placeholder; - return result; - } - - /** - * Creates a debounced function that delays invoking `func` until after `wait` - * milliseconds have elapsed since the last time the debounced function was - * invoked. The debounced function comes with a `cancel` method to cancel - * delayed `func` invocations and a `flush` method to immediately invoke them. - * Provide `options` to indicate whether `func` should be invoked on the - * leading and/or trailing edge of the `wait` timeout. The `func` is invoked - * with the last arguments provided to the debounced function. Subsequent - * calls to the debounced function return the result of the last `func` - * invocation. - * - * **Note:** If `leading` and `trailing` options are `true`, `func` is - * invoked on the trailing edge of the timeout only if the debounced function - * is invoked more than once during the `wait` timeout. - * - * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred - * until to the next tick, similar to `setTimeout` with a timeout of `0`. - * - * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/) - * for details over the differences between `_.debounce` and `_.throttle`. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Function - * @param {Function} func The function to debounce. - * @param {number} [wait=0] The number of milliseconds to delay. - * @param {Object} [options={}] The options object. - * @param {boolean} [options.leading=false] - * Specify invoking on the leading edge of the timeout. - * @param {number} [options.maxWait] - * The maximum time `func` is allowed to be delayed before it's invoked. - * @param {boolean} [options.trailing=true] - * Specify invoking on the trailing edge of the timeout. - * @returns {Function} Returns the new debounced function. - * @example - * - * // Avoid costly calculations while the window size is in flux. - * jQuery(window).on('resize', _.debounce(calculateLayout, 150)); - * - * // Invoke `sendMail` when clicked, debouncing subsequent calls. - * jQuery(element).on('click', _.debounce(sendMail, 300, { - * 'leading': true, - * 'trailing': false - * })); - * - * // Ensure `batchLog` is invoked once after 1 second of debounced calls. - * var debounced = _.debounce(batchLog, 250, { 'maxWait': 1000 }); - * var source = new EventSource('/stream'); - * jQuery(source).on('message', debounced); - * - * // Cancel the trailing debounced invocation. - * jQuery(window).on('popstate', debounced.cancel); - */ - function debounce(func, wait, options) { - var lastArgs, - lastThis, - maxWait, - result, - timerId, - lastCallTime, - lastInvokeTime = 0, - leading = false, - maxing = false, - trailing = true; - - if (typeof func != 'function') { - throw new TypeError(FUNC_ERROR_TEXT); - } - wait = toNumber(wait) || 0; - if (isObject(options)) { - leading = !!options.leading; - maxing = 'maxWait' in options; - maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait; - trailing = 'trailing' in options ? !!options.trailing : trailing; - } - - function invokeFunc(time) { - var args = lastArgs, - thisArg = lastThis; - - lastArgs = lastThis = undefined; - lastInvokeTime = time; - result = func.apply(thisArg, args); - return result; - } - - function leadingEdge(time) { - // Reset any `maxWait` timer. - lastInvokeTime = time; - // Start the timer for the trailing edge. - timerId = setTimeout(timerExpired, wait); - // Invoke the leading edge. - return leading ? invokeFunc(time) : result; - } - - function remainingWait(time) { - var timeSinceLastCall = time - lastCallTime, - timeSinceLastInvoke = time - lastInvokeTime, - timeWaiting = wait - timeSinceLastCall; - - return maxing - ? nativeMin(timeWaiting, maxWait - timeSinceLastInvoke) - : timeWaiting; - } - - function shouldInvoke(time) { - var timeSinceLastCall = time - lastCallTime, - timeSinceLastInvoke = time - lastInvokeTime; - - // Either this is the first call, activity has stopped and we're at the - // trailing edge, the system time has gone backwards and we're treating - // it as the trailing edge, or we've hit the `maxWait` limit. - return (lastCallTime === undefined || (timeSinceLastCall >= wait) || - (timeSinceLastCall < 0) || (maxing && timeSinceLastInvoke >= maxWait)); - } - - function timerExpired() { - var time = now(); - if (shouldInvoke(time)) { - return trailingEdge(time); - } - // Restart the timer. - timerId = setTimeout(timerExpired, remainingWait(time)); - } - - function trailingEdge(time) { - timerId = undefined; - - // Only invoke if we have `lastArgs` which means `func` has been - // debounced at least once. - if (trailing && lastArgs) { - return invokeFunc(time); - } - lastArgs = lastThis = undefined; - return result; - } - - function cancel() { - if (timerId !== undefined) { - clearTimeout(timerId); - } - lastInvokeTime = 0; - lastArgs = lastCallTime = lastThis = timerId = undefined; - } - - function flush() { - return timerId === undefined ? result : trailingEdge(now()); - } - - function debounced() { - var time = now(), - isInvoking = shouldInvoke(time); - - lastArgs = arguments; - lastThis = this; - lastCallTime = time; - - if (isInvoking) { - if (timerId === undefined) { - return leadingEdge(lastCallTime); - } - if (maxing) { - // Handle invocations in a tight loop. - clearTimeout(timerId); - timerId = setTimeout(timerExpired, wait); - return invokeFunc(lastCallTime); - } - } - if (timerId === undefined) { - timerId = setTimeout(timerExpired, wait); - } - return result; - } - debounced.cancel = cancel; - debounced.flush = flush; - return debounced; - } - - /** - * Defers invoking the `func` until the current call stack has cleared. Any - * additional arguments are provided to `func` when it's invoked. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Function - * @param {Function} func The function to defer. - * @param {...*} [args] The arguments to invoke `func` with. - * @returns {number} Returns the timer id. - * @example - * - * _.defer(function(text) { - * console.log(text); - * }, 'deferred'); - * // => Logs 'deferred' after one millisecond. - */ - var defer = baseRest(function(func, args) { - return baseDelay(func, 1, args); - }); - - /** - * Invokes `func` after `wait` milliseconds. Any additional arguments are - * provided to `func` when it's invoked. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Function - * @param {Function} func The function to delay. - * @param {number} wait The number of milliseconds to delay invocation. - * @param {...*} [args] The arguments to invoke `func` with. - * @returns {number} Returns the timer id. - * @example - * - * _.delay(function(text) { - * console.log(text); - * }, 1000, 'later'); - * // => Logs 'later' after one second. - */ - var delay = baseRest(function(func, wait, args) { - return baseDelay(func, toNumber(wait) || 0, args); - }); - - /** - * Creates a function that invokes `func` with arguments reversed. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Function - * @param {Function} func The function to flip arguments for. - * @returns {Function} Returns the new flipped function. - * @example - * - * var flipped = _.flip(function() { - * return _.toArray(arguments); - * }); - * - * flipped('a', 'b', 'c', 'd'); - * // => ['d', 'c', 'b', 'a'] - */ - function flip(func) { - return createWrap(func, WRAP_FLIP_FLAG); - } - - /** - * Creates a function that memoizes the result of `func`. If `resolver` is - * provided, it determines the cache key for storing the result based on the - * arguments provided to the memoized function. By default, the first argument - * provided to the memoized function is used as the map cache key. The `func` - * is invoked with the `this` binding of the memoized function. - * - * **Note:** The cache is exposed as the `cache` property on the memoized - * function. Its creation may be customized by replacing the `_.memoize.Cache` - * constructor with one whose instances implement the - * [`Map`](http://ecma-international.org/ecma-262/7.0/#sec-properties-of-the-map-prototype-object) - * method interface of `clear`, `delete`, `get`, `has`, and `set`. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Function - * @param {Function} func The function to have its output memoized. - * @param {Function} [resolver] The function to resolve the cache key. - * @returns {Function} Returns the new memoized function. - * @example - * - * var object = { 'a': 1, 'b': 2 }; - * var other = { 'c': 3, 'd': 4 }; - * - * var values = _.memoize(_.values); - * values(object); - * // => [1, 2] - * - * values(other); - * // => [3, 4] - * - * object.a = 2; - * values(object); - * // => [1, 2] - * - * // Modify the result cache. - * values.cache.set(object, ['a', 'b']); - * values(object); - * // => ['a', 'b'] - * - * // Replace `_.memoize.Cache`. - * _.memoize.Cache = WeakMap; - */ - function memoize(func, resolver) { - if (typeof func != 'function' || (resolver != null && typeof resolver != 'function')) { - throw new TypeError(FUNC_ERROR_TEXT); - } - var memoized = function() { - var args = arguments, - key = resolver ? resolver.apply(this, args) : args[0], - cache = memoized.cache; - - if (cache.has(key)) { - return cache.get(key); - } - var result = func.apply(this, args); - memoized.cache = cache.set(key, result) || cache; - return result; - }; - memoized.cache = new (memoize.Cache || MapCache); - return memoized; - } - - // Expose `MapCache`. - memoize.Cache = MapCache; - - /** - * Creates a function that negates the result of the predicate `func`. The - * `func` predicate is invoked with the `this` binding and arguments of the - * created function. - * - * @static - * @memberOf _ - * @since 3.0.0 - * @category Function - * @param {Function} predicate The predicate to negate. - * @returns {Function} Returns the new negated function. - * @example - * - * function isEven(n) { - * return n % 2 == 0; - * } - * - * _.filter([1, 2, 3, 4, 5, 6], _.negate(isEven)); - * // => [1, 3, 5] - */ - function negate(predicate) { - if (typeof predicate != 'function') { - throw new TypeError(FUNC_ERROR_TEXT); - } - return function() { - var args = arguments; - switch (args.length) { - case 0: return !predicate.call(this); - case 1: return !predicate.call(this, args[0]); - case 2: return !predicate.call(this, args[0], args[1]); - case 3: return !predicate.call(this, args[0], args[1], args[2]); - } - return !predicate.apply(this, args); - }; - } - - /** - * Creates a function that is restricted to invoking `func` once. Repeat calls - * to the function return the value of the first invocation. The `func` is - * invoked with the `this` binding and arguments of the created function. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Function - * @param {Function} func The function to restrict. - * @returns {Function} Returns the new restricted function. - * @example - * - * var initialize = _.once(createApplication); - * initialize(); - * initialize(); - * // => `createApplication` is invoked once - */ - function once(func) { - return before(2, func); - } - - /** - * Creates a function that invokes `func` with its arguments transformed. - * - * @static - * @since 4.0.0 - * @memberOf _ - * @category Function - * @param {Function} func The function to wrap. - * @param {...(Function|Function[])} [transforms=[_.identity]] - * The argument transforms. - * @returns {Function} Returns the new function. - * @example - * - * function doubled(n) { - * return n * 2; - * } - * - * function square(n) { - * return n * n; - * } - * - * var func = _.overArgs(function(x, y) { - * return [x, y]; - * }, [square, doubled]); - * - * func(9, 3); - * // => [81, 6] - * - * func(10, 5); - * // => [100, 10] - */ - var overArgs = castRest(function(func, transforms) { - transforms = (transforms.length == 1 && isArray(transforms[0])) - ? arrayMap(transforms[0], baseUnary(getIteratee())) - : arrayMap(baseFlatten(transforms, 1), baseUnary(getIteratee())); - - var funcsLength = transforms.length; - return baseRest(function(args) { - var index = -1, - length = nativeMin(args.length, funcsLength); - - while (++index < length) { - args[index] = transforms[index].call(this, args[index]); - } - return apply(func, this, args); - }); - }); - - /** - * Creates a function that invokes `func` with `partials` prepended to the - * arguments it receives. This method is like `_.bind` except it does **not** - * alter the `this` binding. - * - * The `_.partial.placeholder` value, which defaults to `_` in monolithic - * builds, may be used as a placeholder for partially applied arguments. - * - * **Note:** This method doesn't set the "length" property of partially - * applied functions. - * - * @static - * @memberOf _ - * @since 0.2.0 - * @category Function - * @param {Function} func The function to partially apply arguments to. - * @param {...*} [partials] The arguments to be partially applied. - * @returns {Function} Returns the new partially applied function. - * @example - * - * function greet(greeting, name) { - * return greeting + ' ' + name; - * } - * - * var sayHelloTo = _.partial(greet, 'hello'); - * sayHelloTo('fred'); - * // => 'hello fred' - * - * // Partially applied with placeholders. - * var greetFred = _.partial(greet, _, 'fred'); - * greetFred('hi'); - * // => 'hi fred' - */ - var partial = baseRest(function(func, partials) { - var holders = replaceHolders(partials, getHolder(partial)); - return createWrap(func, WRAP_PARTIAL_FLAG, undefined, partials, holders); - }); - - /** - * This method is like `_.partial` except that partially applied arguments - * are appended to the arguments it receives. - * - * The `_.partialRight.placeholder` value, which defaults to `_` in monolithic - * builds, may be used as a placeholder for partially applied arguments. - * - * **Note:** This method doesn't set the "length" property of partially - * applied functions. - * - * @static - * @memberOf _ - * @since 1.0.0 - * @category Function - * @param {Function} func The function to partially apply arguments to. - * @param {...*} [partials] The arguments to be partially applied. - * @returns {Function} Returns the new partially applied function. - * @example - * - * function greet(greeting, name) { - * return greeting + ' ' + name; - * } - * - * var greetFred = _.partialRight(greet, 'fred'); - * greetFred('hi'); - * // => 'hi fred' - * - * // Partially applied with placeholders. - * var sayHelloTo = _.partialRight(greet, 'hello', _); - * sayHelloTo('fred'); - * // => 'hello fred' - */ - var partialRight = baseRest(function(func, partials) { - var holders = replaceHolders(partials, getHolder(partialRight)); - return createWrap(func, WRAP_PARTIAL_RIGHT_FLAG, undefined, partials, holders); - }); - - /** - * Creates a function that invokes `func` with arguments arranged according - * to the specified `indexes` where the argument value at the first index is - * provided as the first argument, the argument value at the second index is - * provided as the second argument, and so on. - * - * @static - * @memberOf _ - * @since 3.0.0 - * @category Function - * @param {Function} func The function to rearrange arguments for. - * @param {...(number|number[])} indexes The arranged argument indexes. - * @returns {Function} Returns the new function. - * @example - * - * var rearged = _.rearg(function(a, b, c) { - * return [a, b, c]; - * }, [2, 0, 1]); - * - * rearged('b', 'c', 'a') - * // => ['a', 'b', 'c'] - */ - var rearg = flatRest(function(func, indexes) { - return createWrap(func, WRAP_REARG_FLAG, undefined, undefined, undefined, indexes); - }); - - /** - * 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://mdn.io/rest_parameters). - * - * @static - * @memberOf _ - * @since 4.0.0 - * @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 = _.rest(function(what, names) { - * return what + ' ' + _.initial(names).join(', ') + - * (_.size(names) > 1 ? ', & ' : '') + _.last(names); - * }); - * - * say('hello', 'fred', 'barney', 'pebbles'); - * // => 'hello fred, barney, & pebbles' - */ - function rest(func, start) { - if (typeof func != 'function') { - throw new TypeError(FUNC_ERROR_TEXT); - } - start = start === undefined ? start : toInteger(start); - return baseRest(func, start); - } - - /** - * Creates a function that invokes `func` with the `this` binding of the - * create function and an array of arguments much like - * [`Function#apply`](http://www.ecma-international.org/ecma-262/7.0/#sec-function.prototype.apply). - * - * **Note:** This method is based on the - * [spread operator](https://mdn.io/spread_operator). - * - * @static - * @memberOf _ - * @since 3.2.0 - * @category Function - * @param {Function} func The function to spread arguments over. - * @param {number} [start=0] The start position of the spread. - * @returns {Function} Returns the new function. - * @example - * - * var say = _.spread(function(who, what) { - * return who + ' says ' + what; - * }); - * - * say(['fred', 'hello']); - * // => 'fred says hello' - * - * var numbers = Promise.all([ - * Promise.resolve(40), - * Promise.resolve(36) - * ]); - * - * numbers.then(_.spread(function(x, y) { - * return x + y; - * })); - * // => a Promise of 76 - */ - function spread(func, start) { - if (typeof func != 'function') { - throw new TypeError(FUNC_ERROR_TEXT); - } - start = start == null ? 0 : nativeMax(toInteger(start), 0); - return baseRest(function(args) { - var array = args[start], - otherArgs = castSlice(args, 0, start); - - if (array) { - arrayPush(otherArgs, array); - } - return apply(func, this, otherArgs); - }); - } - - /** - * Creates a throttled function that only invokes `func` at most once per - * every `wait` milliseconds. The throttled function comes with a `cancel` - * method to cancel delayed `func` invocations and a `flush` method to - * immediately invoke them. Provide `options` to indicate whether `func` - * should be invoked on the leading and/or trailing edge of the `wait` - * timeout. The `func` is invoked with the last arguments provided to the - * throttled function. Subsequent calls to the throttled function return the - * result of the last `func` invocation. - * - * **Note:** If `leading` and `trailing` options are `true`, `func` is - * invoked on the trailing edge of the timeout only if the throttled function - * is invoked more than once during the `wait` timeout. - * - * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred - * until to the next tick, similar to `setTimeout` with a timeout of `0`. - * - * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/) - * for details over the differences between `_.throttle` and `_.debounce`. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Function - * @param {Function} func The function to throttle. - * @param {number} [wait=0] The number of milliseconds to throttle invocations to. - * @param {Object} [options={}] The options object. - * @param {boolean} [options.leading=true] - * Specify invoking on the leading edge of the timeout. - * @param {boolean} [options.trailing=true] - * Specify invoking on the trailing edge of the timeout. - * @returns {Function} Returns the new throttled function. - * @example - * - * // Avoid excessively updating the position while scrolling. - * jQuery(window).on('scroll', _.throttle(updatePosition, 100)); - * - * // Invoke `renewToken` when the click event is fired, but not more than once every 5 minutes. - * var throttled = _.throttle(renewToken, 300000, { 'trailing': false }); - * jQuery(element).on('click', throttled); - * - * // Cancel the trailing throttled invocation. - * jQuery(window).on('popstate', throttled.cancel); - */ - function throttle(func, wait, options) { - var leading = true, - trailing = true; - - if (typeof func != 'function') { - throw new TypeError(FUNC_ERROR_TEXT); - } - if (isObject(options)) { - leading = 'leading' in options ? !!options.leading : leading; - trailing = 'trailing' in options ? !!options.trailing : trailing; - } - return debounce(func, wait, { - 'leading': leading, - 'maxWait': wait, - 'trailing': trailing - }); - } - - /** - * Creates a function that accepts up to one argument, ignoring any - * additional arguments. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Function - * @param {Function} func The function to cap arguments for. - * @returns {Function} Returns the new capped function. - * @example - * - * _.map(['6', '8', '10'], _.unary(parseInt)); - * // => [6, 8, 10] - */ - function unary(func) { - return ary(func, 1); - } - - /** - * Creates a function that provides `value` to `wrapper` as its first - * argument. Any additional arguments provided to the function are appended - * to those provided to the `wrapper`. The wrapper is invoked with the `this` - * binding of the created function. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Function - * @param {*} value The value to wrap. - * @param {Function} [wrapper=identity] The wrapper function. - * @returns {Function} Returns the new function. - * @example - * - * var p = _.wrap(_.escape, function(func, text) { - * return '

' + func(text) + '

'; - * }); - * - * p('fred, barney, & pebbles'); - * // => '

fred, barney, & pebbles

' - */ - function wrap(value, wrapper) { - return partial(castFunction(wrapper), value); - } - - /*------------------------------------------------------------------------*/ - - /** - * Casts `value` as an array if it's not one. - * - * @static - * @memberOf _ - * @since 4.4.0 - * @category Lang - * @param {*} value The value to inspect. - * @returns {Array} Returns the cast array. - * @example - * - * _.castArray(1); - * // => [1] - * - * _.castArray({ 'a': 1 }); - * // => [{ 'a': 1 }] - * - * _.castArray('abc'); - * // => ['abc'] - * - * _.castArray(null); - * // => [null] - * - * _.castArray(undefined); - * // => [undefined] - * - * _.castArray(); - * // => [] - * - * var array = [1, 2, 3]; - * console.log(_.castArray(array) === array); - * // => true - */ - function castArray() { - if (!arguments.length) { - return []; - } - var value = arguments[0]; - return isArray(value) ? value : [value]; - } - - /** - * Creates a shallow clone of `value`. - * - * **Note:** This method is loosely based on the - * [structured clone algorithm](https://mdn.io/Structured_clone_algorithm) - * and supports cloning arrays, array buffers, booleans, date objects, maps, - * numbers, `Object` objects, regexes, sets, strings, symbols, and typed - * arrays. The own enumerable properties of `arguments` objects are cloned - * as plain objects. An empty object is returned for uncloneable values such - * as error objects, functions, DOM nodes, and WeakMaps. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Lang - * @param {*} value The value to clone. - * @returns {*} Returns the cloned value. - * @see _.cloneDeep - * @example - * - * var objects = [{ 'a': 1 }, { 'b': 2 }]; - * - * var shallow = _.clone(objects); - * console.log(shallow[0] === objects[0]); - * // => true - */ - function clone(value) { - return baseClone(value, CLONE_SYMBOLS_FLAG); - } - - /** - * This method is like `_.clone` except that it accepts `customizer` which - * is invoked to produce the cloned value. If `customizer` returns `undefined`, - * cloning is handled by the method instead. The `customizer` is invoked with - * up to four arguments; (value [, index|key, object, stack]). - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Lang - * @param {*} value The value to clone. - * @param {Function} [customizer] The function to customize cloning. - * @returns {*} Returns the cloned value. - * @see _.cloneDeepWith - * @example - * - * function customizer(value) { - * if (_.isElement(value)) { - * return value.cloneNode(false); - * } - * } - * - * var el = _.cloneWith(document.body, customizer); - * - * console.log(el === document.body); - * // => false - * console.log(el.nodeName); - * // => 'BODY' - * console.log(el.childNodes.length); - * // => 0 - */ - function cloneWith(value, customizer) { - customizer = typeof customizer == 'function' ? customizer : undefined; - return baseClone(value, CLONE_SYMBOLS_FLAG, customizer); - } - - /** - * This method is like `_.clone` except that it recursively clones `value`. - * - * @static - * @memberOf _ - * @since 1.0.0 - * @category Lang - * @param {*} value The value to recursively clone. - * @returns {*} Returns the deep cloned value. - * @see _.clone - * @example - * - * var objects = [{ 'a': 1 }, { 'b': 2 }]; - * - * var deep = _.cloneDeep(objects); - * console.log(deep[0] === objects[0]); - * // => false - */ - function cloneDeep(value) { - return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG); - } - - /** - * This method is like `_.cloneWith` except that it recursively clones `value`. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Lang - * @param {*} value The value to recursively clone. - * @param {Function} [customizer] The function to customize cloning. - * @returns {*} Returns the deep cloned value. - * @see _.cloneWith - * @example - * - * function customizer(value) { - * if (_.isElement(value)) { - * return value.cloneNode(true); - * } - * } - * - * var el = _.cloneDeepWith(document.body, customizer); - * - * console.log(el === document.body); - * // => false - * console.log(el.nodeName); - * // => 'BODY' - * console.log(el.childNodes.length); - * // => 20 - */ - function cloneDeepWith(value, customizer) { - customizer = typeof customizer == 'function' ? customizer : undefined; - return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG, customizer); - } - - /** - * Checks if `object` conforms to `source` by invoking the predicate - * properties of `source` with the corresponding property values of `object`. - * - * **Note:** This method is equivalent to `_.conforms` when `source` is - * partially applied. - * - * @static - * @memberOf _ - * @since 4.14.0 - * @category Lang - * @param {Object} object The object to inspect. - * @param {Object} source The object of property predicates to conform to. - * @returns {boolean} Returns `true` if `object` conforms, else `false`. - * @example - * - * var object = { 'a': 1, 'b': 2 }; - * - * _.conformsTo(object, { 'b': function(n) { return n > 1; } }); - * // => true - * - * _.conformsTo(object, { 'b': function(n) { return n > 2; } }); - * // => false - */ - function conformsTo(object, source) { - return source == null || baseConformsTo(object, source, keys(source)); - } - - /** - * Performs a - * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) - * comparison between two values to determine if they are equivalent. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Lang - * @param {*} value The value to compare. - * @param {*} other The other value to compare. - * @returns {boolean} Returns `true` if the values are equivalent, else `false`. - * @example - * - * var object = { 'a': 1 }; - * var other = { 'a': 1 }; - * - * _.eq(object, object); - * // => true - * - * _.eq(object, other); - * // => false - * - * _.eq('a', 'a'); - * // => true - * - * _.eq('a', Object('a')); - * // => false - * - * _.eq(NaN, NaN); - * // => true - */ - function eq(value, other) { - return value === other || (value !== value && other !== other); - } - - /** - * Checks if `value` is greater than `other`. - * - * @static - * @memberOf _ - * @since 3.9.0 - * @category Lang - * @param {*} value The value to compare. - * @param {*} other The other value to compare. - * @returns {boolean} Returns `true` if `value` is greater than `other`, - * else `false`. - * @see _.lt - * @example - * - * _.gt(3, 1); - * // => true - * - * _.gt(3, 3); - * // => false - * - * _.gt(1, 3); - * // => false - */ - var gt = createRelationalOperation(baseGt); - - /** - * Checks if `value` is greater than or equal to `other`. - * - * @static - * @memberOf _ - * @since 3.9.0 - * @category Lang - * @param {*} value The value to compare. - * @param {*} other The other value to compare. - * @returns {boolean} Returns `true` if `value` is greater than or equal to - * `other`, else `false`. - * @see _.lte - * @example - * - * _.gte(3, 1); - * // => true - * - * _.gte(3, 3); - * // => true - * - * _.gte(1, 3); - * // => false - */ - var gte = createRelationalOperation(function(value, other) { - return value >= other; - }); - - /** - * Checks if `value` is likely an `arguments` object. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is an `arguments` object, - * else `false`. - * @example - * - * _.isArguments(function() { return arguments; }()); - * // => true - * - * _.isArguments([1, 2, 3]); - * // => false - */ - var isArguments = baseIsArguments(function() { return arguments; }()) ? baseIsArguments : function(value) { - return isObjectLike(value) && hasOwnProperty.call(value, 'callee') && - !propertyIsEnumerable.call(value, 'callee'); - }; - - /** - * Checks if `value` is classified as an `Array` object. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is an array, else `false`. - * @example - * - * _.isArray([1, 2, 3]); - * // => true - * - * _.isArray(document.body.children); - * // => false - * - * _.isArray('abc'); - * // => false - * - * _.isArray(_.noop); - * // => false - */ - var isArray = Array.isArray; - - /** - * Checks if `value` is classified as an `ArrayBuffer` object. - * - * @static - * @memberOf _ - * @since 4.3.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is an array buffer, else `false`. - * @example - * - * _.isArrayBuffer(new ArrayBuffer(2)); - * // => true - * - * _.isArrayBuffer(new Array(2)); - * // => false - */ - var isArrayBuffer = nodeIsArrayBuffer ? baseUnary(nodeIsArrayBuffer) : baseIsArrayBuffer; - - /** - * Checks if `value` is array-like. A value is considered array-like if it's - * not a function and has a `value.length` that's an integer greater than or - * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is array-like, else `false`. - * @example - * - * _.isArrayLike([1, 2, 3]); - * // => true - * - * _.isArrayLike(document.body.children); - * // => true - * - * _.isArrayLike('abc'); - * // => true - * - * _.isArrayLike(_.noop); - * // => false - */ - function isArrayLike(value) { - return value != null && isLength(value.length) && !isFunction(value); - } - - /** - * This method is like `_.isArrayLike` except that it also checks if `value` - * is an object. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is an array-like object, - * else `false`. - * @example - * - * _.isArrayLikeObject([1, 2, 3]); - * // => true - * - * _.isArrayLikeObject(document.body.children); - * // => true - * - * _.isArrayLikeObject('abc'); - * // => false - * - * _.isArrayLikeObject(_.noop); - * // => false - */ - function isArrayLikeObject(value) { - return isObjectLike(value) && isArrayLike(value); - } - - /** - * Checks if `value` is classified as a boolean primitive or object. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a boolean, else `false`. - * @example - * - * _.isBoolean(false); - * // => true - * - * _.isBoolean(null); - * // => false - */ - function isBoolean(value) { - return value === true || value === false || - (isObjectLike(value) && baseGetTag(value) == boolTag); - } - - /** - * Checks if `value` is a buffer. - * - * @static - * @memberOf _ - * @since 4.3.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a buffer, else `false`. - * @example - * - * _.isBuffer(new Buffer(2)); - * // => true - * - * _.isBuffer(new Uint8Array(2)); - * // => false - */ - var isBuffer = nativeIsBuffer || stubFalse; - - /** - * Checks if `value` is classified as a `Date` object. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a date object, else `false`. - * @example - * - * _.isDate(new Date); - * // => true - * - * _.isDate('Mon April 23 2012'); - * // => false - */ - var isDate = nodeIsDate ? baseUnary(nodeIsDate) : baseIsDate; - - /** - * Checks if `value` is likely a DOM element. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a DOM element, else `false`. - * @example - * - * _.isElement(document.body); - * // => true - * - * _.isElement(''); - * // => false - */ - function isElement(value) { - return isObjectLike(value) && value.nodeType === 1 && !isPlainObject(value); - } - - /** - * Checks if `value` is an empty object, collection, map, or set. - * - * Objects are considered empty if they have no own enumerable string keyed - * properties. - * - * Array-like values such as `arguments` objects, arrays, buffers, strings, or - * jQuery-like collections are considered empty if they have a `length` of `0`. - * Similarly, maps and sets are considered empty if they have a `size` of `0`. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is empty, else `false`. - * @example - * - * _.isEmpty(null); - * // => true - * - * _.isEmpty(true); - * // => true - * - * _.isEmpty(1); - * // => true - * - * _.isEmpty([1, 2, 3]); - * // => false - * - * _.isEmpty({ 'a': 1 }); - * // => false - */ - function isEmpty(value) { - if (value == null) { - return true; - } - if (isArrayLike(value) && - (isArray(value) || typeof value == 'string' || typeof value.splice == 'function' || - isBuffer(value) || isTypedArray(value) || isArguments(value))) { - return !value.length; - } - var tag = getTag(value); - if (tag == mapTag || tag == setTag) { - return !value.size; - } - if (isPrototype(value)) { - return !baseKeys(value).length; - } - for (var key in value) { - if (hasOwnProperty.call(value, key)) { - return false; - } - } - return true; - } - - /** - * Performs a deep comparison between two values to determine if they are - * equivalent. - * - * **Note:** This method supports comparing arrays, array buffers, booleans, - * date objects, error objects, maps, numbers, `Object` objects, regexes, - * sets, strings, symbols, and typed arrays. `Object` objects are compared - * by their own, not inherited, enumerable properties. Functions and DOM - * nodes are compared by strict equality, i.e. `===`. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Lang - * @param {*} value The value to compare. - * @param {*} other The other value to compare. - * @returns {boolean} Returns `true` if the values are equivalent, else `false`. - * @example - * - * var object = { 'a': 1 }; - * var other = { 'a': 1 }; - * - * _.isEqual(object, other); - * // => true - * - * object === other; - * // => false - */ - function isEqual(value, other) { - return baseIsEqual(value, other); - } - - /** - * This method is like `_.isEqual` except that it accepts `customizer` which - * is invoked to compare values. If `customizer` returns `undefined`, comparisons - * are handled by the method instead. The `customizer` is invoked with up to - * six arguments: (objValue, othValue [, index|key, object, other, stack]). - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Lang - * @param {*} value The value to compare. - * @param {*} other The other value to compare. - * @param {Function} [customizer] The function to customize comparisons. - * @returns {boolean} Returns `true` if the values are equivalent, else `false`. - * @example - * - * function isGreeting(value) { - * return /^h(?:i|ello)$/.test(value); - * } - * - * function customizer(objValue, othValue) { - * if (isGreeting(objValue) && isGreeting(othValue)) { - * return true; - * } - * } - * - * var array = ['hello', 'goodbye']; - * var other = ['hi', 'goodbye']; - * - * _.isEqualWith(array, other, customizer); - * // => true - */ - function isEqualWith(value, other, customizer) { - customizer = typeof customizer == 'function' ? customizer : undefined; - var result = customizer ? customizer(value, other) : undefined; - return result === undefined ? baseIsEqual(value, other, undefined, customizer) : !!result; - } - - /** - * Checks if `value` is an `Error`, `EvalError`, `RangeError`, `ReferenceError`, - * `SyntaxError`, `TypeError`, or `URIError` object. - * - * @static - * @memberOf _ - * @since 3.0.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is an error object, else `false`. - * @example - * - * _.isError(new Error); - * // => true - * - * _.isError(Error); - * // => false - */ - function isError(value) { - if (!isObjectLike(value)) { - return false; - } - var tag = baseGetTag(value); - return tag == errorTag || tag == domExcTag || - (typeof value.message == 'string' && typeof value.name == 'string' && !isPlainObject(value)); - } - - /** - * Checks if `value` is a finite primitive number. - * - * **Note:** This method is based on - * [`Number.isFinite`](https://mdn.io/Number/isFinite). - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a finite number, else `false`. - * @example - * - * _.isFinite(3); - * // => true - * - * _.isFinite(Number.MIN_VALUE); - * // => true - * - * _.isFinite(Infinity); - * // => false - * - * _.isFinite('3'); - * // => false - */ - function isFinite(value) { - return typeof value == 'number' && nativeIsFinite(value); - } - - /** - * Checks if `value` is classified as a `Function` object. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a function, else `false`. - * @example - * - * _.isFunction(_); - * // => true - * - * _.isFunction(/abc/); - * // => false - */ - function isFunction(value) { - if (!isObject(value)) { - return false; - } - // The use of `Object#toString` avoids issues with the `typeof` operator - // in Safari 9 which returns 'object' for typed arrays and other constructors. - var tag = baseGetTag(value); - return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag; - } - - /** - * Checks if `value` is an integer. - * - * **Note:** This method is based on - * [`Number.isInteger`](https://mdn.io/Number/isInteger). - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is an integer, else `false`. - * @example - * - * _.isInteger(3); - * // => true - * - * _.isInteger(Number.MIN_VALUE); - * // => false - * - * _.isInteger(Infinity); - * // => false - * - * _.isInteger('3'); - * // => false - */ - function isInteger(value) { - return typeof value == 'number' && value == toInteger(value); - } - - /** - * Checks if `value` is a valid array-like length. - * - * **Note:** This method is loosely based on - * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength). - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a valid length, else `false`. - * @example - * - * _.isLength(3); - * // => true - * - * _.isLength(Number.MIN_VALUE); - * // => false - * - * _.isLength(Infinity); - * // => false - * - * _.isLength('3'); - * // => false - */ - function isLength(value) { - return typeof value == 'number' && - value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER; - } - - /** - * Checks if `value` is the - * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types) - * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is an object, else `false`. - * @example - * - * _.isObject({}); - * // => true - * - * _.isObject([1, 2, 3]); - * // => true - * - * _.isObject(_.noop); - * // => true - * - * _.isObject(null); - * // => false - */ - function isObject(value) { - var type = typeof value; - return value != null && (type == 'object' || type == 'function'); - } - - /** - * Checks if `value` is object-like. A value is object-like if it's not `null` - * and has a `typeof` result of "object". - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is object-like, else `false`. - * @example - * - * _.isObjectLike({}); - * // => true - * - * _.isObjectLike([1, 2, 3]); - * // => true - * - * _.isObjectLike(_.noop); - * // => false - * - * _.isObjectLike(null); - * // => false - */ - function isObjectLike(value) { - return value != null && typeof value == 'object'; - } - - /** - * Checks if `value` is classified as a `Map` object. - * - * @static - * @memberOf _ - * @since 4.3.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a map, else `false`. - * @example - * - * _.isMap(new Map); - * // => true - * - * _.isMap(new WeakMap); - * // => false - */ - var isMap = nodeIsMap ? baseUnary(nodeIsMap) : baseIsMap; - - /** - * Performs a partial deep comparison between `object` and `source` to - * determine if `object` contains equivalent property values. - * - * **Note:** This method is equivalent to `_.matches` when `source` is - * partially applied. - * - * Partial comparisons will match empty array and empty object `source` - * values against any array or object value, respectively. See `_.isEqual` - * for a list of supported value comparisons. - * - * @static - * @memberOf _ - * @since 3.0.0 - * @category Lang - * @param {Object} object The object to inspect. - * @param {Object} source The object of property values to match. - * @returns {boolean} Returns `true` if `object` is a match, else `false`. - * @example - * - * var object = { 'a': 1, 'b': 2 }; - * - * _.isMatch(object, { 'b': 2 }); - * // => true - * - * _.isMatch(object, { 'b': 1 }); - * // => false - */ - function isMatch(object, source) { - return object === source || baseIsMatch(object, source, getMatchData(source)); - } - - /** - * This method is like `_.isMatch` except that it accepts `customizer` which - * is invoked to compare values. If `customizer` returns `undefined`, comparisons - * are handled by the method instead. The `customizer` is invoked with five - * arguments: (objValue, srcValue, index|key, object, source). - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Lang - * @param {Object} object The object to inspect. - * @param {Object} source The object of property values to match. - * @param {Function} [customizer] The function to customize comparisons. - * @returns {boolean} Returns `true` if `object` is a match, else `false`. - * @example - * - * function isGreeting(value) { - * return /^h(?:i|ello)$/.test(value); - * } - * - * function customizer(objValue, srcValue) { - * if (isGreeting(objValue) && isGreeting(srcValue)) { - * return true; - * } - * } - * - * var object = { 'greeting': 'hello' }; - * var source = { 'greeting': 'hi' }; - * - * _.isMatchWith(object, source, customizer); - * // => true - */ - function isMatchWith(object, source, customizer) { - customizer = typeof customizer == 'function' ? customizer : undefined; - return baseIsMatch(object, source, getMatchData(source), customizer); - } - - /** - * Checks if `value` is `NaN`. - * - * **Note:** This method is based on - * [`Number.isNaN`](https://mdn.io/Number/isNaN) and is not the same as - * global [`isNaN`](https://mdn.io/isNaN) which returns `true` for - * `undefined` and other non-number values. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is `NaN`, else `false`. - * @example - * - * _.isNaN(NaN); - * // => true - * - * _.isNaN(new Number(NaN)); - * // => true - * - * isNaN(undefined); - * // => true - * - * _.isNaN(undefined); - * // => false - */ - function isNaN(value) { - // An `NaN` primitive is the only value that is not equal to itself. - // Perform the `toStringTag` check first to avoid errors with some - // ActiveX objects in IE. - return isNumber(value) && value != +value; - } - - /** - * Checks if `value` is a pristine native function. - * - * **Note:** This method can't reliably detect native functions in the presence - * of the core-js package because core-js circumvents this kind of detection. - * Despite multiple requests, the core-js maintainer has made it clear: any - * attempt to fix the detection will be obstructed. As a result, we're left - * with little choice but to throw an error. Unfortunately, this also affects - * packages, like [babel-polyfill](https://www.npmjs.com/package/babel-polyfill), - * which rely on core-js. - * - * @static - * @memberOf _ - * @since 3.0.0 - * @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 (isMaskable(value)) { - throw new Error(CORE_ERROR_TEXT); - } - return baseIsNative(value); - } - - /** - * Checks if `value` is `null`. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is `null`, else `false`. - * @example - * - * _.isNull(null); - * // => true - * - * _.isNull(void 0); - * // => false - */ - function isNull(value) { - return value === null; - } - - /** - * Checks if `value` is `null` or `undefined`. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is nullish, else `false`. - * @example - * - * _.isNil(null); - * // => true - * - * _.isNil(void 0); - * // => true - * - * _.isNil(NaN); - * // => false - */ - function isNil(value) { - return value == null; - } - - /** - * Checks if `value` is classified as a `Number` primitive or object. - * - * **Note:** To exclude `Infinity`, `-Infinity`, and `NaN`, which are - * classified as numbers, use the `_.isFinite` method. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a number, else `false`. - * @example - * - * _.isNumber(3); - * // => true - * - * _.isNumber(Number.MIN_VALUE); - * // => true - * - * _.isNumber(Infinity); - * // => true - * - * _.isNumber('3'); - * // => false - */ - function isNumber(value) { - return typeof value == 'number' || - (isObjectLike(value) && baseGetTag(value) == numberTag); - } - - /** - * Checks if `value` is a plain object, that is, an object created by the - * `Object` constructor or one with a `[[Prototype]]` of `null`. - * - * @static - * @memberOf _ - * @since 0.8.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a plain object, else `false`. - * @example - * - * function Foo() { - * this.a = 1; - * } - * - * _.isPlainObject(new Foo); - * // => false - * - * _.isPlainObject([1, 2, 3]); - * // => false - * - * _.isPlainObject({ 'x': 0, 'y': 0 }); - * // => true - * - * _.isPlainObject(Object.create(null)); - * // => true - */ - function isPlainObject(value) { - if (!isObjectLike(value) || baseGetTag(value) != objectTag) { - return false; - } - var proto = getPrototype(value); - if (proto === null) { - return true; - } - var Ctor = hasOwnProperty.call(proto, 'constructor') && proto.constructor; - return typeof Ctor == 'function' && Ctor instanceof Ctor && - funcToString.call(Ctor) == objectCtorString; - } - - /** - * Checks if `value` is classified as a `RegExp` object. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a regexp, else `false`. - * @example - * - * _.isRegExp(/abc/); - * // => true - * - * _.isRegExp('/abc/'); - * // => false - */ - var isRegExp = nodeIsRegExp ? baseUnary(nodeIsRegExp) : baseIsRegExp; - - /** - * Checks if `value` is a safe integer. An integer is safe if it's an IEEE-754 - * double precision number which isn't the result of a rounded unsafe integer. - * - * **Note:** This method is based on - * [`Number.isSafeInteger`](https://mdn.io/Number/isSafeInteger). - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a safe integer, else `false`. - * @example - * - * _.isSafeInteger(3); - * // => true - * - * _.isSafeInteger(Number.MIN_VALUE); - * // => false - * - * _.isSafeInteger(Infinity); - * // => false - * - * _.isSafeInteger('3'); - * // => false - */ - function isSafeInteger(value) { - return isInteger(value) && value >= -MAX_SAFE_INTEGER && value <= MAX_SAFE_INTEGER; - } - - /** - * Checks if `value` is classified as a `Set` object. - * - * @static - * @memberOf _ - * @since 4.3.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a set, else `false`. - * @example - * - * _.isSet(new Set); - * // => true - * - * _.isSet(new WeakSet); - * // => false - */ - var isSet = nodeIsSet ? baseUnary(nodeIsSet) : baseIsSet; - - /** - * Checks if `value` is classified as a `String` primitive or object. - * - * @static - * @since 0.1.0 - * @memberOf _ - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a string, else `false`. - * @example - * - * _.isString('abc'); - * // => true - * - * _.isString(1); - * // => false - */ - function isString(value) { - return typeof value == 'string' || - (!isArray(value) && isObjectLike(value) && baseGetTag(value) == stringTag); - } - - /** - * Checks if `value` is classified as a `Symbol` primitive or object. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a symbol, else `false`. - * @example - * - * _.isSymbol(Symbol.iterator); - * // => true - * - * _.isSymbol('abc'); - * // => false - */ - function isSymbol(value) { - return typeof value == 'symbol' || - (isObjectLike(value) && baseGetTag(value) == symbolTag); - } - - /** - * Checks if `value` is classified as a typed array. - * - * @static - * @memberOf _ - * @since 3.0.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a typed array, else `false`. - * @example - * - * _.isTypedArray(new Uint8Array); - * // => true - * - * _.isTypedArray([]); - * // => false - */ - var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray; - - /** - * Checks if `value` is `undefined`. - * - * @static - * @since 0.1.0 - * @memberOf _ - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is `undefined`, else `false`. - * @example - * - * _.isUndefined(void 0); - * // => true - * - * _.isUndefined(null); - * // => false - */ - function isUndefined(value) { - return value === undefined; - } - - /** - * Checks if `value` is classified as a `WeakMap` object. - * - * @static - * @memberOf _ - * @since 4.3.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a weak map, else `false`. - * @example - * - * _.isWeakMap(new WeakMap); - * // => true - * - * _.isWeakMap(new Map); - * // => false - */ - function isWeakMap(value) { - return isObjectLike(value) && getTag(value) == weakMapTag; - } - - /** - * Checks if `value` is classified as a `WeakSet` object. - * - * @static - * @memberOf _ - * @since 4.3.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a weak set, else `false`. - * @example - * - * _.isWeakSet(new WeakSet); - * // => true - * - * _.isWeakSet(new Set); - * // => false - */ - function isWeakSet(value) { - return isObjectLike(value) && baseGetTag(value) == weakSetTag; - } - - /** - * Checks if `value` is less than `other`. - * - * @static - * @memberOf _ - * @since 3.9.0 - * @category Lang - * @param {*} value The value to compare. - * @param {*} other The other value to compare. - * @returns {boolean} Returns `true` if `value` is less than `other`, - * else `false`. - * @see _.gt - * @example - * - * _.lt(1, 3); - * // => true - * - * _.lt(3, 3); - * // => false - * - * _.lt(3, 1); - * // => false - */ - var lt = createRelationalOperation(baseLt); - - /** - * Checks if `value` is less than or equal to `other`. - * - * @static - * @memberOf _ - * @since 3.9.0 - * @category Lang - * @param {*} value The value to compare. - * @param {*} other The other value to compare. - * @returns {boolean} Returns `true` if `value` is less than or equal to - * `other`, else `false`. - * @see _.gte - * @example - * - * _.lte(1, 3); - * // => true - * - * _.lte(3, 3); - * // => true - * - * _.lte(3, 1); - * // => false - */ - var lte = createRelationalOperation(function(value, other) { - return value <= other; - }); - - /** - * Converts `value` to an array. - * - * @static - * @since 0.1.0 - * @memberOf _ - * @category Lang - * @param {*} value The value to convert. - * @returns {Array} Returns the converted array. - * @example - * - * _.toArray({ 'a': 1, 'b': 2 }); - * // => [1, 2] - * - * _.toArray('abc'); - * // => ['a', 'b', 'c'] - * - * _.toArray(1); - * // => [] - * - * _.toArray(null); - * // => [] - */ - function toArray(value) { - if (!value) { - return []; - } - if (isArrayLike(value)) { - return isString(value) ? stringToArray(value) : copyArray(value); - } - if (symIterator && value[symIterator]) { - return iteratorToArray(value[symIterator]()); - } - var tag = getTag(value), - func = tag == mapTag ? mapToArray : (tag == setTag ? setToArray : values); - - return func(value); - } - - /** - * Converts `value` to a finite number. - * - * @static - * @memberOf _ - * @since 4.12.0 - * @category Lang - * @param {*} value The value to convert. - * @returns {number} Returns the converted number. - * @example - * - * _.toFinite(3.2); - * // => 3.2 - * - * _.toFinite(Number.MIN_VALUE); - * // => 5e-324 - * - * _.toFinite(Infinity); - * // => 1.7976931348623157e+308 - * - * _.toFinite('3.2'); - * // => 3.2 - */ - function toFinite(value) { - if (!value) { - return value === 0 ? value : 0; - } - value = toNumber(value); - if (value === INFINITY || value === -INFINITY) { - var sign = (value < 0 ? -1 : 1); - return sign * MAX_INTEGER; - } - return value === value ? value : 0; - } - - /** - * Converts `value` to an integer. - * - * **Note:** This method is loosely based on - * [`ToInteger`](http://www.ecma-international.org/ecma-262/7.0/#sec-tointeger). - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Lang - * @param {*} value The value to convert. - * @returns {number} Returns the converted integer. - * @example - * - * _.toInteger(3.2); - * // => 3 - * - * _.toInteger(Number.MIN_VALUE); - * // => 0 - * - * _.toInteger(Infinity); - * // => 1.7976931348623157e+308 - * - * _.toInteger('3.2'); - * // => 3 - */ - function toInteger(value) { - var result = toFinite(value), - remainder = result % 1; - - return result === result ? (remainder ? result - remainder : result) : 0; - } - - /** - * Converts `value` to an integer suitable for use as the length of an - * array-like object. - * - * **Note:** This method is based on - * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength). - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Lang - * @param {*} value The value to convert. - * @returns {number} Returns the converted integer. - * @example - * - * _.toLength(3.2); - * // => 3 - * - * _.toLength(Number.MIN_VALUE); - * // => 0 - * - * _.toLength(Infinity); - * // => 4294967295 - * - * _.toLength('3.2'); - * // => 3 - */ - function toLength(value) { - return value ? baseClamp(toInteger(value), 0, MAX_ARRAY_LENGTH) : 0; - } - - /** - * Converts `value` to a number. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Lang - * @param {*} value The value to process. - * @returns {number} Returns the number. - * @example - * - * _.toNumber(3.2); - * // => 3.2 - * - * _.toNumber(Number.MIN_VALUE); - * // => 5e-324 - * - * _.toNumber(Infinity); - * // => Infinity - * - * _.toNumber('3.2'); - * // => 3.2 - */ - function toNumber(value) { - if (typeof value == 'number') { - return value; - } - if (isSymbol(value)) { - return NAN; - } - if (isObject(value)) { - var other = typeof value.valueOf == 'function' ? value.valueOf() : value; - value = isObject(other) ? (other + '') : other; - } - if (typeof value != 'string') { - return value === 0 ? value : +value; - } - value = baseTrim(value); - var isBinary = reIsBinary.test(value); - return (isBinary || reIsOctal.test(value)) - ? freeParseInt(value.slice(2), isBinary ? 2 : 8) - : (reIsBadHex.test(value) ? NAN : +value); - } - - /** - * Converts `value` to a plain object flattening inherited enumerable string - * keyed properties of `value` to own properties of the plain object. - * - * @static - * @memberOf _ - * @since 3.0.0 - * @category Lang - * @param {*} value The value to convert. - * @returns {Object} Returns the converted plain object. - * @example - * - * function Foo() { - * this.b = 2; - * } - * - * Foo.prototype.c = 3; - * - * _.assign({ 'a': 1 }, new Foo); - * // => { 'a': 1, 'b': 2 } - * - * _.assign({ 'a': 1 }, _.toPlainObject(new Foo)); - * // => { 'a': 1, 'b': 2, 'c': 3 } - */ - function toPlainObject(value) { - return copyObject(value, keysIn(value)); - } - - /** - * Converts `value` to a safe integer. A safe integer can be compared and - * represented correctly. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Lang - * @param {*} value The value to convert. - * @returns {number} Returns the converted integer. - * @example - * - * _.toSafeInteger(3.2); - * // => 3 - * - * _.toSafeInteger(Number.MIN_VALUE); - * // => 0 - * - * _.toSafeInteger(Infinity); - * // => 9007199254740991 - * - * _.toSafeInteger('3.2'); - * // => 3 - */ - function toSafeInteger(value) { - return value - ? baseClamp(toInteger(value), -MAX_SAFE_INTEGER, MAX_SAFE_INTEGER) - : (value === 0 ? value : 0); - } - - /** - * Converts `value` to a string. An empty string is returned for `null` - * and `undefined` values. The sign of `-0` is preserved. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Lang - * @param {*} value The value to convert. - * @returns {string} Returns the converted string. - * @example - * - * _.toString(null); - * // => '' - * - * _.toString(-0); - * // => '-0' - * - * _.toString([1, 2, 3]); - * // => '1,2,3' - */ - function toString(value) { - return value == null ? '' : baseToString(value); - } - - /*------------------------------------------------------------------------*/ - - /** - * Assigns own enumerable string keyed properties of source objects to the - * destination object. Source objects are applied from left to right. - * Subsequent sources overwrite property assignments of previous sources. - * - * **Note:** This method mutates `object` and is loosely based on - * [`Object.assign`](https://mdn.io/Object/assign). - * - * @static - * @memberOf _ - * @since 0.10.0 - * @category Object - * @param {Object} object The destination object. - * @param {...Object} [sources] The source objects. - * @returns {Object} Returns `object`. - * @see _.assignIn - * @example - * - * function Foo() { - * this.a = 1; - * } - * - * function Bar() { - * this.c = 3; - * } - * - * Foo.prototype.b = 2; - * Bar.prototype.d = 4; - * - * _.assign({ 'a': 0 }, new Foo, new Bar); - * // => { 'a': 1, 'c': 3 } - */ - var assign = createAssigner(function(object, source) { - if (isPrototype(source) || isArrayLike(source)) { - copyObject(source, keys(source), object); - return; - } - for (var key in source) { - if (hasOwnProperty.call(source, key)) { - assignValue(object, key, source[key]); - } - } - }); - - /** - * This method is like `_.assign` except that it iterates over own and - * inherited source properties. - * - * **Note:** This method mutates `object`. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @alias extend - * @category Object - * @param {Object} object The destination object. - * @param {...Object} [sources] The source objects. - * @returns {Object} Returns `object`. - * @see _.assign - * @example - * - * function Foo() { - * this.a = 1; - * } - * - * function Bar() { - * this.c = 3; - * } - * - * Foo.prototype.b = 2; - * Bar.prototype.d = 4; - * - * _.assignIn({ 'a': 0 }, new Foo, new Bar); - * // => { 'a': 1, 'b': 2, 'c': 3, 'd': 4 } - */ - var assignIn = createAssigner(function(object, source) { - copyObject(source, keysIn(source), object); - }); - - /** - * This method is like `_.assignIn` except that it accepts `customizer` - * which is invoked to produce the assigned values. If `customizer` returns - * `undefined`, assignment is handled by the method instead. The `customizer` - * is invoked with five arguments: (objValue, srcValue, key, object, source). - * - * **Note:** This method mutates `object`. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @alias extendWith - * @category Object - * @param {Object} object The destination object. - * @param {...Object} sources The source objects. - * @param {Function} [customizer] The function to customize assigned values. - * @returns {Object} Returns `object`. - * @see _.assignWith - * @example - * - * function customizer(objValue, srcValue) { - * return _.isUndefined(objValue) ? srcValue : objValue; - * } - * - * var defaults = _.partialRight(_.assignInWith, customizer); - * - * defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 }); - * // => { 'a': 1, 'b': 2 } - */ - var assignInWith = createAssigner(function(object, source, srcIndex, customizer) { - copyObject(source, keysIn(source), object, customizer); - }); - - /** - * This method is like `_.assign` except that it accepts `customizer` - * which is invoked to produce the assigned values. If `customizer` returns - * `undefined`, assignment is handled by the method instead. The `customizer` - * is invoked with five arguments: (objValue, srcValue, key, object, source). - * - * **Note:** This method mutates `object`. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Object - * @param {Object} object The destination object. - * @param {...Object} sources The source objects. - * @param {Function} [customizer] The function to customize assigned values. - * @returns {Object} Returns `object`. - * @see _.assignInWith - * @example - * - * function customizer(objValue, srcValue) { - * return _.isUndefined(objValue) ? srcValue : objValue; - * } - * - * var defaults = _.partialRight(_.assignWith, customizer); - * - * defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 }); - * // => { 'a': 1, 'b': 2 } - */ - var assignWith = createAssigner(function(object, source, srcIndex, customizer) { - copyObject(source, keys(source), object, customizer); - }); - - /** - * Creates an array of values corresponding to `paths` of `object`. - * - * @static - * @memberOf _ - * @since 1.0.0 - * @category Object - * @param {Object} object The object to iterate over. - * @param {...(string|string[])} [paths] The property paths to pick. - * @returns {Array} Returns the picked values. - * @example - * - * var object = { 'a': [{ 'b': { 'c': 3 } }, 4] }; - * - * _.at(object, ['a[0].b.c', 'a[1]']); - * // => [3, 4] - */ - var at = flatRest(baseAt); - - /** - * Creates an object that inherits from the `prototype` object. If a - * `properties` object is given, its own enumerable string keyed properties - * are assigned to the created object. - * - * @static - * @memberOf _ - * @since 2.3.0 - * @category Object - * @param {Object} prototype The object to inherit from. - * @param {Object} [properties] The properties to assign to the object. - * @returns {Object} Returns the new object. - * @example - * - * function Shape() { - * this.x = 0; - * this.y = 0; - * } - * - * function Circle() { - * Shape.call(this); - * } - * - * Circle.prototype = _.create(Shape.prototype, { - * 'constructor': Circle - * }); - * - * var circle = new Circle; - * circle instanceof Circle; - * // => true - * - * circle instanceof Shape; - * // => true - */ - function create(prototype, properties) { - var result = baseCreate(prototype); - return properties == null ? result : baseAssign(result, properties); - } - - /** - * Assigns own and inherited enumerable string keyed properties of source - * objects to the destination object for all destination properties that - * resolve to `undefined`. Source objects are applied from left to right. - * Once a property is set, additional values of the same property are ignored. - * - * **Note:** This method mutates `object`. - * - * @static - * @since 0.1.0 - * @memberOf _ - * @category Object - * @param {Object} object The destination object. - * @param {...Object} [sources] The source objects. - * @returns {Object} Returns `object`. - * @see _.defaultsDeep - * @example - * - * _.defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 }); - * // => { 'a': 1, 'b': 2 } - */ - var defaults = baseRest(function(object, sources) { - object = Object(object); - - var index = -1; - var length = sources.length; - var guard = length > 2 ? sources[2] : undefined; - - if (guard && isIterateeCall(sources[0], sources[1], guard)) { - length = 1; - } - - while (++index < length) { - var source = sources[index]; - var props = keysIn(source); - var propsIndex = -1; - var propsLength = props.length; - - while (++propsIndex < propsLength) { - var key = props[propsIndex]; - var value = object[key]; - - if (value === undefined || - (eq(value, objectProto[key]) && !hasOwnProperty.call(object, key))) { - object[key] = source[key]; - } - } - } - - return object; - }); - - /** - * This method is like `_.defaults` except that it recursively assigns - * default properties. - * - * **Note:** This method mutates `object`. - * - * @static - * @memberOf _ - * @since 3.10.0 - * @category Object - * @param {Object} object The destination object. - * @param {...Object} [sources] The source objects. - * @returns {Object} Returns `object`. - * @see _.defaults - * @example - * - * _.defaultsDeep({ 'a': { 'b': 2 } }, { 'a': { 'b': 1, 'c': 3 } }); - * // => { 'a': { 'b': 2, 'c': 3 } } - */ - var defaultsDeep = baseRest(function(args) { - args.push(undefined, customDefaultsMerge); - return apply(mergeWith, undefined, args); - }); - - /** - * This method is like `_.find` except that it returns the key of the first - * element `predicate` returns truthy for instead of the element itself. - * - * @static - * @memberOf _ - * @since 1.1.0 - * @category Object - * @param {Object} object The object to inspect. - * @param {Function} [predicate=_.identity] The function invoked per iteration. - * @returns {string|undefined} Returns the key of the matched element, - * else `undefined`. - * @example - * - * var users = { - * 'barney': { 'age': 36, 'active': true }, - * 'fred': { 'age': 40, 'active': false }, - * 'pebbles': { 'age': 1, 'active': true } - * }; - * - * _.findKey(users, function(o) { return o.age < 40; }); - * // => 'barney' (iteration order is not guaranteed) - * - * // The `_.matches` iteratee shorthand. - * _.findKey(users, { 'age': 1, 'active': true }); - * // => 'pebbles' - * - * // The `_.matchesProperty` iteratee shorthand. - * _.findKey(users, ['active', false]); - * // => 'fred' - * - * // The `_.property` iteratee shorthand. - * _.findKey(users, 'active'); - * // => 'barney' - */ - function findKey(object, predicate) { - return baseFindKey(object, getIteratee(predicate, 3), baseForOwn); - } - - /** - * This method is like `_.findKey` except that it iterates over elements of - * a collection in the opposite order. - * - * @static - * @memberOf _ - * @since 2.0.0 - * @category Object - * @param {Object} object The object to inspect. - * @param {Function} [predicate=_.identity] The function invoked per iteration. - * @returns {string|undefined} Returns the key of the matched element, - * else `undefined`. - * @example - * - * var users = { - * 'barney': { 'age': 36, 'active': true }, - * 'fred': { 'age': 40, 'active': false }, - * 'pebbles': { 'age': 1, 'active': true } - * }; - * - * _.findLastKey(users, function(o) { return o.age < 40; }); - * // => returns 'pebbles' assuming `_.findKey` returns 'barney' - * - * // The `_.matches` iteratee shorthand. - * _.findLastKey(users, { 'age': 36, 'active': true }); - * // => 'barney' - * - * // The `_.matchesProperty` iteratee shorthand. - * _.findLastKey(users, ['active', false]); - * // => 'fred' - * - * // The `_.property` iteratee shorthand. - * _.findLastKey(users, 'active'); - * // => 'pebbles' - */ - function findLastKey(object, predicate) { - return baseFindKey(object, getIteratee(predicate, 3), baseForOwnRight); - } - - /** - * Iterates over own and inherited enumerable string keyed properties of an - * object and invokes `iteratee` for each property. The iteratee is invoked - * with three arguments: (value, key, object). Iteratee functions may exit - * iteration early by explicitly returning `false`. - * - * @static - * @memberOf _ - * @since 0.3.0 - * @category Object - * @param {Object} object The object to iterate over. - * @param {Function} [iteratee=_.identity] The function invoked per iteration. - * @returns {Object} Returns `object`. - * @see _.forInRight - * @example - * - * function Foo() { - * this.a = 1; - * this.b = 2; - * } - * - * Foo.prototype.c = 3; - * - * _.forIn(new Foo, function(value, key) { - * console.log(key); - * }); - * // => Logs 'a', 'b', then 'c' (iteration order is not guaranteed). - */ - function forIn(object, iteratee) { - return object == null - ? object - : baseFor(object, getIteratee(iteratee, 3), keysIn); - } - - /** - * This method is like `_.forIn` except that it iterates over properties of - * `object` in the opposite order. - * - * @static - * @memberOf _ - * @since 2.0.0 - * @category Object - * @param {Object} object The object to iterate over. - * @param {Function} [iteratee=_.identity] The function invoked per iteration. - * @returns {Object} Returns `object`. - * @see _.forIn - * @example - * - * function Foo() { - * this.a = 1; - * this.b = 2; - * } - * - * Foo.prototype.c = 3; - * - * _.forInRight(new Foo, function(value, key) { - * console.log(key); - * }); - * // => Logs 'c', 'b', then 'a' assuming `_.forIn` logs 'a', 'b', then 'c'. - */ - function forInRight(object, iteratee) { - return object == null - ? object - : baseForRight(object, getIteratee(iteratee, 3), keysIn); - } - - /** - * Iterates over own enumerable string keyed properties of an object and - * invokes `iteratee` for each property. The iteratee is invoked with three - * arguments: (value, key, object). Iteratee functions may exit iteration - * early by explicitly returning `false`. - * - * @static - * @memberOf _ - * @since 0.3.0 - * @category Object - * @param {Object} object The object to iterate over. - * @param {Function} [iteratee=_.identity] The function invoked per iteration. - * @returns {Object} Returns `object`. - * @see _.forOwnRight - * @example - * - * function Foo() { - * this.a = 1; - * this.b = 2; - * } - * - * Foo.prototype.c = 3; - * - * _.forOwn(new Foo, function(value, key) { - * console.log(key); - * }); - * // => Logs 'a' then 'b' (iteration order is not guaranteed). - */ - function forOwn(object, iteratee) { - return object && baseForOwn(object, getIteratee(iteratee, 3)); - } - - /** - * This method is like `_.forOwn` except that it iterates over properties of - * `object` in the opposite order. - * - * @static - * @memberOf _ - * @since 2.0.0 - * @category Object - * @param {Object} object The object to iterate over. - * @param {Function} [iteratee=_.identity] The function invoked per iteration. - * @returns {Object} Returns `object`. - * @see _.forOwn - * @example - * - * function Foo() { - * this.a = 1; - * this.b = 2; - * } - * - * Foo.prototype.c = 3; - * - * _.forOwnRight(new Foo, function(value, key) { - * console.log(key); - * }); - * // => Logs 'b' then 'a' assuming `_.forOwn` logs 'a' then 'b'. - */ - function forOwnRight(object, iteratee) { - return object && baseForOwnRight(object, getIteratee(iteratee, 3)); - } - - /** - * Creates an array of function property names from own enumerable properties - * of `object`. - * - * @static - * @since 0.1.0 - * @memberOf _ - * @category Object - * @param {Object} object The object to inspect. - * @returns {Array} Returns the function names. - * @see _.functionsIn - * @example - * - * function Foo() { - * this.a = _.constant('a'); - * this.b = _.constant('b'); - * } - * - * Foo.prototype.c = _.constant('c'); - * - * _.functions(new Foo); - * // => ['a', 'b'] - */ - function functions(object) { - return object == null ? [] : baseFunctions(object, keys(object)); - } - - /** - * Creates an array of function property names from own and inherited - * enumerable properties of `object`. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Object - * @param {Object} object The object to inspect. - * @returns {Array} Returns the function names. - * @see _.functions - * @example - * - * function Foo() { - * this.a = _.constant('a'); - * this.b = _.constant('b'); - * } - * - * Foo.prototype.c = _.constant('c'); - * - * _.functionsIn(new Foo); - * // => ['a', 'b', 'c'] - */ - function functionsIn(object) { - return object == null ? [] : baseFunctions(object, keysIn(object)); - } - - /** - * Gets the value at `path` of `object`. If the resolved value is - * `undefined`, the `defaultValue` is returned in its place. - * - * @static - * @memberOf _ - * @since 3.7.0 - * @category Object - * @param {Object} object The object to query. - * @param {Array|string} path The path of the property to get. - * @param {*} [defaultValue] The value returned for `undefined` resolved values. - * @returns {*} Returns the resolved value. - * @example - * - * var object = { 'a': [{ 'b': { 'c': 3 } }] }; - * - * _.get(object, 'a[0].b.c'); - * // => 3 - * - * _.get(object, ['a', '0', 'b', 'c']); - * // => 3 - * - * _.get(object, 'a.b.c', 'default'); - * // => 'default' - */ - function get(object, path, defaultValue) { - var result = object == null ? undefined : baseGet(object, path); - return result === undefined ? defaultValue : result; - } - - /** - * Checks if `path` is a direct property of `object`. - * - * @static - * @since 0.1.0 - * @memberOf _ - * @category Object - * @param {Object} object The object to query. - * @param {Array|string} path The path to check. - * @returns {boolean} Returns `true` if `path` exists, else `false`. - * @example - * - * var object = { 'a': { 'b': 2 } }; - * var other = _.create({ 'a': _.create({ 'b': 2 }) }); - * - * _.has(object, 'a'); - * // => true - * - * _.has(object, 'a.b'); - * // => true - * - * _.has(object, ['a', 'b']); - * // => true - * - * _.has(other, 'a'); - * // => false - */ - function has(object, path) { - return object != null && hasPath(object, path, baseHas); - } - - /** - * Checks if `path` is a direct or inherited property of `object`. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Object - * @param {Object} object The object to query. - * @param {Array|string} path The path to check. - * @returns {boolean} Returns `true` if `path` exists, else `false`. - * @example - * - * var object = _.create({ 'a': _.create({ 'b': 2 }) }); - * - * _.hasIn(object, 'a'); - * // => true - * - * _.hasIn(object, 'a.b'); - * // => true - * - * _.hasIn(object, ['a', 'b']); - * // => true - * - * _.hasIn(object, 'b'); - * // => false - */ - function hasIn(object, path) { - return object != null && hasPath(object, path, baseHasIn); - } - - /** - * Creates an object composed of the inverted keys and values of `object`. - * If `object` contains duplicate values, subsequent values overwrite - * property assignments of previous values. - * - * @static - * @memberOf _ - * @since 0.7.0 - * @category Object - * @param {Object} object The object to invert. - * @returns {Object} Returns the new inverted object. - * @example - * - * var object = { 'a': 1, 'b': 2, 'c': 1 }; - * - * _.invert(object); - * // => { '1': 'c', '2': 'b' } - */ - var invert = createInverter(function(result, value, key) { - if (value != null && - typeof value.toString != 'function') { - value = nativeObjectToString.call(value); - } - - result[value] = key; - }, constant(identity)); - - /** - * This method is like `_.invert` except that the inverted object is generated - * from the results of running each element of `object` thru `iteratee`. The - * corresponding inverted value of each inverted key is an array of keys - * responsible for generating the inverted value. The iteratee is invoked - * with one argument: (value). - * - * @static - * @memberOf _ - * @since 4.1.0 - * @category Object - * @param {Object} object The object to invert. - * @param {Function} [iteratee=_.identity] The iteratee invoked per element. - * @returns {Object} Returns the new inverted object. - * @example - * - * var object = { 'a': 1, 'b': 2, 'c': 1 }; - * - * _.invertBy(object); - * // => { '1': ['a', 'c'], '2': ['b'] } - * - * _.invertBy(object, function(value) { - * return 'group' + value; - * }); - * // => { 'group1': ['a', 'c'], 'group2': ['b'] } - */ - var invertBy = createInverter(function(result, value, key) { - if (value != null && - typeof value.toString != 'function') { - value = nativeObjectToString.call(value); - } - - if (hasOwnProperty.call(result, value)) { - result[value].push(key); - } else { - result[value] = [key]; - } - }, getIteratee); - - /** - * Invokes the method at `path` of `object`. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Object - * @param {Object} object The object to query. - * @param {Array|string} path The path of the method to invoke. - * @param {...*} [args] The arguments to invoke the method with. - * @returns {*} Returns the result of the invoked method. - * @example - * - * var object = { 'a': [{ 'b': { 'c': [1, 2, 3, 4] } }] }; - * - * _.invoke(object, 'a[0].b.c.slice', 1, 3); - * // => [2, 3] - */ - var invoke = baseRest(baseInvoke); - - /** - * Creates an array of the own enumerable property names of `object`. - * - * **Note:** Non-object values are coerced to objects. See the - * [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys) - * for more details. - * - * @static - * @since 0.1.0 - * @memberOf _ - * @category Object - * @param {Object} object The object to query. - * @returns {Array} Returns the array of property names. - * @example - * - * function Foo() { - * this.a = 1; - * this.b = 2; - * } - * - * Foo.prototype.c = 3; - * - * _.keys(new Foo); - * // => ['a', 'b'] (iteration order is not guaranteed) - * - * _.keys('hi'); - * // => ['0', '1'] - */ - function keys(object) { - return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object); - } - - /** - * Creates an array of the own and inherited enumerable property names of `object`. - * - * **Note:** Non-object values are coerced to objects. - * - * @static - * @memberOf _ - * @since 3.0.0 - * @category Object - * @param {Object} object The object to query. - * @returns {Array} Returns the array of property names. - * @example - * - * function Foo() { - * this.a = 1; - * this.b = 2; - * } - * - * Foo.prototype.c = 3; - * - * _.keysIn(new Foo); - * // => ['a', 'b', 'c'] (iteration order is not guaranteed) - */ - function keysIn(object) { - return isArrayLike(object) ? arrayLikeKeys(object, true) : baseKeysIn(object); - } - - /** - * The opposite of `_.mapValues`; this method creates an object with the - * same values as `object` and keys generated by running each own enumerable - * string keyed property of `object` thru `iteratee`. The iteratee is invoked - * with three arguments: (value, key, object). - * - * @static - * @memberOf _ - * @since 3.8.0 - * @category Object - * @param {Object} object The object to iterate over. - * @param {Function} [iteratee=_.identity] The function invoked per iteration. - * @returns {Object} Returns the new mapped object. - * @see _.mapValues - * @example - * - * _.mapKeys({ 'a': 1, 'b': 2 }, function(value, key) { - * return key + value; - * }); - * // => { 'a1': 1, 'b2': 2 } - */ - function mapKeys(object, iteratee) { - var result = {}; - iteratee = getIteratee(iteratee, 3); - - baseForOwn(object, function(value, key, object) { - baseAssignValue(result, iteratee(value, key, object), value); - }); - return result; - } - - /** - * Creates an object with the same keys as `object` and values generated - * by running each own enumerable string keyed property of `object` thru - * `iteratee`. The iteratee is invoked with three arguments: - * (value, key, object). - * - * @static - * @memberOf _ - * @since 2.4.0 - * @category Object - * @param {Object} object The object to iterate over. - * @param {Function} [iteratee=_.identity] The function invoked per iteration. - * @returns {Object} Returns the new mapped object. - * @see _.mapKeys - * @example - * - * var users = { - * 'fred': { 'user': 'fred', 'age': 40 }, - * 'pebbles': { 'user': 'pebbles', 'age': 1 } - * }; - * - * _.mapValues(users, function(o) { return o.age; }); - * // => { 'fred': 40, 'pebbles': 1 } (iteration order is not guaranteed) - * - * // The `_.property` iteratee shorthand. - * _.mapValues(users, 'age'); - * // => { 'fred': 40, 'pebbles': 1 } (iteration order is not guaranteed) - */ - function mapValues(object, iteratee) { - var result = {}; - iteratee = getIteratee(iteratee, 3); - - baseForOwn(object, function(value, key, object) { - baseAssignValue(result, key, iteratee(value, key, object)); - }); - return result; - } - - /** - * This method is like `_.assign` except that it recursively merges own and - * inherited enumerable string keyed properties of source objects into the - * destination object. Source properties that resolve to `undefined` are - * skipped if a destination value exists. Array and plain object properties - * are merged recursively. Other objects and value types are overridden by - * assignment. Source objects are applied from left to right. Subsequent - * sources overwrite property assignments of previous sources. - * - * **Note:** This method mutates `object`. - * - * @static - * @memberOf _ - * @since 0.5.0 - * @category Object - * @param {Object} object The destination object. - * @param {...Object} [sources] The source objects. - * @returns {Object} Returns `object`. - * @example - * - * var object = { - * 'a': [{ 'b': 2 }, { 'd': 4 }] - * }; - * - * var other = { - * 'a': [{ 'c': 3 }, { 'e': 5 }] - * }; - * - * _.merge(object, other); - * // => { 'a': [{ 'b': 2, 'c': 3 }, { 'd': 4, 'e': 5 }] } - */ - var merge = createAssigner(function(object, source, srcIndex) { - baseMerge(object, source, srcIndex); - }); - - /** - * This method is like `_.merge` except that it accepts `customizer` which - * is invoked to produce the merged values of the destination and source - * properties. If `customizer` returns `undefined`, merging is handled by the - * method instead. The `customizer` is invoked with six arguments: - * (objValue, srcValue, key, object, source, stack). - * - * **Note:** This method mutates `object`. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Object - * @param {Object} object The destination object. - * @param {...Object} sources The source objects. - * @param {Function} customizer The function to customize assigned values. - * @returns {Object} Returns `object`. - * @example - * - * function customizer(objValue, srcValue) { - * if (_.isArray(objValue)) { - * return objValue.concat(srcValue); - * } - * } - * - * var object = { 'a': [1], 'b': [2] }; - * var other = { 'a': [3], 'b': [4] }; - * - * _.mergeWith(object, other, customizer); - * // => { 'a': [1, 3], 'b': [2, 4] } - */ - var mergeWith = createAssigner(function(object, source, srcIndex, customizer) { - baseMerge(object, source, srcIndex, customizer); - }); - - /** - * The opposite of `_.pick`; this method creates an object composed of the - * own and inherited enumerable property paths of `object` that are not omitted. - * - * **Note:** This method is considerably slower than `_.pick`. - * - * @static - * @since 0.1.0 - * @memberOf _ - * @category Object - * @param {Object} object The source object. - * @param {...(string|string[])} [paths] The property paths to omit. - * @returns {Object} Returns the new object. - * @example - * - * var object = { 'a': 1, 'b': '2', 'c': 3 }; - * - * _.omit(object, ['a', 'c']); - * // => { 'b': '2' } - */ - var omit = flatRest(function(object, paths) { - var result = {}; - if (object == null) { - return result; - } - var isDeep = false; - paths = arrayMap(paths, function(path) { - path = castPath(path, object); - isDeep || (isDeep = path.length > 1); - return path; - }); - copyObject(object, getAllKeysIn(object), result); - if (isDeep) { - result = baseClone(result, CLONE_DEEP_FLAG | CLONE_FLAT_FLAG | CLONE_SYMBOLS_FLAG, customOmitClone); - } - var length = paths.length; - while (length--) { - baseUnset(result, paths[length]); - } - return result; - }); - - /** - * The opposite of `_.pickBy`; this method creates an object composed of - * the own and inherited enumerable string keyed properties of `object` that - * `predicate` doesn't return truthy for. The predicate is invoked with two - * arguments: (value, key). - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Object - * @param {Object} object The source object. - * @param {Function} [predicate=_.identity] The function invoked per property. - * @returns {Object} Returns the new object. - * @example - * - * var object = { 'a': 1, 'b': '2', 'c': 3 }; - * - * _.omitBy(object, _.isNumber); - * // => { 'b': '2' } - */ - function omitBy(object, predicate) { - return pickBy(object, negate(getIteratee(predicate))); - } - - /** - * Creates an object composed of the picked `object` properties. - * - * @static - * @since 0.1.0 - * @memberOf _ - * @category Object - * @param {Object} object The source object. - * @param {...(string|string[])} [paths] The property paths to pick. - * @returns {Object} Returns the new object. - * @example - * - * var object = { 'a': 1, 'b': '2', 'c': 3 }; - * - * _.pick(object, ['a', 'c']); - * // => { 'a': 1, 'c': 3 } - */ - var pick = flatRest(function(object, paths) { - return object == null ? {} : basePick(object, paths); - }); - - /** - * Creates an object composed of the `object` properties `predicate` returns - * truthy for. The predicate is invoked with two arguments: (value, key). - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Object - * @param {Object} object The source object. - * @param {Function} [predicate=_.identity] The function invoked per property. - * @returns {Object} Returns the new object. - * @example - * - * var object = { 'a': 1, 'b': '2', 'c': 3 }; - * - * _.pickBy(object, _.isNumber); - * // => { 'a': 1, 'c': 3 } - */ - function pickBy(object, predicate) { - if (object == null) { - return {}; - } - var props = arrayMap(getAllKeysIn(object), function(prop) { - return [prop]; - }); - predicate = getIteratee(predicate); - return basePickBy(object, props, function(value, path) { - return predicate(value, path[0]); - }); - } - - /** - * This method is like `_.get` except that if the resolved value is a - * function it's invoked with the `this` binding of its parent object and - * its result is returned. - * - * @static - * @since 0.1.0 - * @memberOf _ - * @category Object - * @param {Object} object The object to query. - * @param {Array|string} path The path of the property to resolve. - * @param {*} [defaultValue] The value returned for `undefined` resolved values. - * @returns {*} Returns the resolved value. - * @example - * - * var object = { 'a': [{ 'b': { 'c1': 3, 'c2': _.constant(4) } }] }; - * - * _.result(object, 'a[0].b.c1'); - * // => 3 - * - * _.result(object, 'a[0].b.c2'); - * // => 4 - * - * _.result(object, 'a[0].b.c3', 'default'); - * // => 'default' - * - * _.result(object, 'a[0].b.c3', _.constant('default')); - * // => 'default' - */ - function result(object, path, defaultValue) { - path = castPath(path, object); - - var index = -1, - length = path.length; - - // Ensure the loop is entered when path is empty. - if (!length) { - length = 1; - object = undefined; - } - while (++index < length) { - var value = object == null ? undefined : object[toKey(path[index])]; - if (value === undefined) { - index = length; - value = defaultValue; - } - object = isFunction(value) ? value.call(object) : value; - } - return object; - } - - /** - * Sets the value at `path` of `object`. If a portion of `path` doesn't exist, - * it's created. Arrays are created for missing index properties while objects - * are created for all other missing properties. Use `_.setWith` to customize - * `path` creation. - * - * **Note:** This method mutates `object`. - * - * @static - * @memberOf _ - * @since 3.7.0 - * @category Object - * @param {Object} object The object to modify. - * @param {Array|string} path The path of the property to set. - * @param {*} value The value to set. - * @returns {Object} Returns `object`. - * @example - * - * var object = { 'a': [{ 'b': { 'c': 3 } }] }; - * - * _.set(object, 'a[0].b.c', 4); - * console.log(object.a[0].b.c); - * // => 4 - * - * _.set(object, ['x', '0', 'y', 'z'], 5); - * console.log(object.x[0].y.z); - * // => 5 - */ - function set(object, path, value) { - return object == null ? object : baseSet(object, path, value); - } - - /** - * This method is like `_.set` except that it accepts `customizer` which is - * invoked to produce the objects of `path`. If `customizer` returns `undefined` - * path creation is handled by the method instead. The `customizer` is invoked - * with three arguments: (nsValue, key, nsObject). - * - * **Note:** This method mutates `object`. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Object - * @param {Object} object The object to modify. - * @param {Array|string} path The path of the property to set. - * @param {*} value The value to set. - * @param {Function} [customizer] The function to customize assigned values. - * @returns {Object} Returns `object`. - * @example - * - * var object = {}; - * - * _.setWith(object, '[0][1]', 'a', Object); - * // => { '0': { '1': 'a' } } - */ - function setWith(object, path, value, customizer) { - customizer = typeof customizer == 'function' ? customizer : undefined; - return object == null ? object : baseSet(object, path, value, customizer); - } - - /** - * Creates an array of own enumerable string keyed-value pairs for `object` - * which can be consumed by `_.fromPairs`. If `object` is a map or set, its - * entries are returned. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @alias entries - * @category Object - * @param {Object} object The object to query. - * @returns {Array} Returns the key-value pairs. - * @example - * - * function Foo() { - * this.a = 1; - * this.b = 2; - * } - * - * Foo.prototype.c = 3; - * - * _.toPairs(new Foo); - * // => [['a', 1], ['b', 2]] (iteration order is not guaranteed) - */ - var toPairs = createToPairs(keys); - - /** - * Creates an array of own and inherited enumerable string keyed-value pairs - * for `object` which can be consumed by `_.fromPairs`. If `object` is a map - * or set, its entries are returned. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @alias entriesIn - * @category Object - * @param {Object} object The object to query. - * @returns {Array} Returns the key-value pairs. - * @example - * - * function Foo() { - * this.a = 1; - * this.b = 2; - * } - * - * Foo.prototype.c = 3; - * - * _.toPairsIn(new Foo); - * // => [['a', 1], ['b', 2], ['c', 3]] (iteration order is not guaranteed) - */ - var toPairsIn = createToPairs(keysIn); - - /** - * An alternative to `_.reduce`; this method transforms `object` to a new - * `accumulator` object which is the result of running each of its own - * enumerable string keyed properties thru `iteratee`, with each invocation - * potentially mutating the `accumulator` object. If `accumulator` is not - * provided, a new object with the same `[[Prototype]]` will be used. The - * iteratee is invoked with four arguments: (accumulator, value, key, object). - * Iteratee functions may exit iteration early by explicitly returning `false`. - * - * @static - * @memberOf _ - * @since 1.3.0 - * @category Object - * @param {Object} object The object to iterate over. - * @param {Function} [iteratee=_.identity] The function invoked per iteration. - * @param {*} [accumulator] The custom accumulator value. - * @returns {*} Returns the accumulated value. - * @example - * - * _.transform([2, 3, 4], function(result, n) { - * result.push(n *= n); - * return n % 2 == 0; - * }, []); - * // => [4, 9] - * - * _.transform({ 'a': 1, 'b': 2, 'c': 1 }, function(result, value, key) { - * (result[value] || (result[value] = [])).push(key); - * }, {}); - * // => { '1': ['a', 'c'], '2': ['b'] } - */ - function transform(object, iteratee, accumulator) { - var isArr = isArray(object), - isArrLike = isArr || isBuffer(object) || isTypedArray(object); - - iteratee = getIteratee(iteratee, 4); - if (accumulator == null) { - var Ctor = object && object.constructor; - if (isArrLike) { - accumulator = isArr ? new Ctor : []; - } - else if (isObject(object)) { - accumulator = isFunction(Ctor) ? baseCreate(getPrototype(object)) : {}; - } - else { - accumulator = {}; - } - } - (isArrLike ? arrayEach : baseForOwn)(object, function(value, index, object) { - return iteratee(accumulator, value, index, object); - }); - return accumulator; - } - - /** - * Removes the property at `path` of `object`. - * - * **Note:** This method mutates `object`. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Object - * @param {Object} object The object to modify. - * @param {Array|string} path The path of the property to unset. - * @returns {boolean} Returns `true` if the property is deleted, else `false`. - * @example - * - * var object = { 'a': [{ 'b': { 'c': 7 } }] }; - * _.unset(object, 'a[0].b.c'); - * // => true - * - * console.log(object); - * // => { 'a': [{ 'b': {} }] }; - * - * _.unset(object, ['a', '0', 'b', 'c']); - * // => true - * - * console.log(object); - * // => { 'a': [{ 'b': {} }] }; - */ - function unset(object, path) { - return object == null ? true : baseUnset(object, path); - } - - /** - * This method is like `_.set` except that accepts `updater` to produce the - * value to set. Use `_.updateWith` to customize `path` creation. The `updater` - * is invoked with one argument: (value). - * - * **Note:** This method mutates `object`. - * - * @static - * @memberOf _ - * @since 4.6.0 - * @category Object - * @param {Object} object The object to modify. - * @param {Array|string} path The path of the property to set. - * @param {Function} updater The function to produce the updated value. - * @returns {Object} Returns `object`. - * @example - * - * var object = { 'a': [{ 'b': { 'c': 3 } }] }; - * - * _.update(object, 'a[0].b.c', function(n) { return n * n; }); - * console.log(object.a[0].b.c); - * // => 9 - * - * _.update(object, 'x[0].y.z', function(n) { return n ? n + 1 : 0; }); - * console.log(object.x[0].y.z); - * // => 0 - */ - function update(object, path, updater) { - return object == null ? object : baseUpdate(object, path, castFunction(updater)); - } - - /** - * This method is like `_.update` except that it accepts `customizer` which is - * invoked to produce the objects of `path`. If `customizer` returns `undefined` - * path creation is handled by the method instead. The `customizer` is invoked - * with three arguments: (nsValue, key, nsObject). - * - * **Note:** This method mutates `object`. - * - * @static - * @memberOf _ - * @since 4.6.0 - * @category Object - * @param {Object} object The object to modify. - * @param {Array|string} path The path of the property to set. - * @param {Function} updater The function to produce the updated value. - * @param {Function} [customizer] The function to customize assigned values. - * @returns {Object} Returns `object`. - * @example - * - * var object = {}; - * - * _.updateWith(object, '[0][1]', _.constant('a'), Object); - * // => { '0': { '1': 'a' } } - */ - function updateWith(object, path, updater, customizer) { - customizer = typeof customizer == 'function' ? customizer : undefined; - return object == null ? object : baseUpdate(object, path, castFunction(updater), customizer); - } - - /** - * Creates an array of the own enumerable string keyed property values of `object`. - * - * **Note:** Non-object values are coerced to objects. - * - * @static - * @since 0.1.0 - * @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 object == null ? [] : baseValues(object, keys(object)); - } - - /** - * Creates an array of the own and inherited enumerable string keyed property - * values of `object`. - * - * **Note:** Non-object values are coerced to objects. - * - * @static - * @memberOf _ - * @since 3.0.0 - * @category Object - * @param {Object} object The object to query. - * @returns {Array} Returns the array of property values. - * @example - * - * function Foo() { - * this.a = 1; - * this.b = 2; - * } - * - * Foo.prototype.c = 3; - * - * _.valuesIn(new Foo); - * // => [1, 2, 3] (iteration order is not guaranteed) - */ - function valuesIn(object) { - return object == null ? [] : baseValues(object, keysIn(object)); - } - - /*------------------------------------------------------------------------*/ - - /** - * Clamps `number` within the inclusive `lower` and `upper` bounds. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Number - * @param {number} number The number to clamp. - * @param {number} [lower] The lower bound. - * @param {number} upper The upper bound. - * @returns {number} Returns the clamped number. - * @example - * - * _.clamp(-10, -5, 5); - * // => -5 - * - * _.clamp(10, -5, 5); - * // => 5 - */ - function clamp(number, lower, upper) { - if (upper === undefined) { - upper = lower; - lower = undefined; - } - if (upper !== undefined) { - upper = toNumber(upper); - upper = upper === upper ? upper : 0; - } - if (lower !== undefined) { - lower = toNumber(lower); - lower = lower === lower ? lower : 0; - } - return baseClamp(toNumber(number), lower, upper); - } - - /** - * Checks if `n` is between `start` and up to, but not including, `end`. If - * `end` is not specified, it's set to `start` with `start` then set to `0`. - * If `start` is greater than `end` the params are swapped to support - * negative ranges. - * - * @static - * @memberOf _ - * @since 3.3.0 - * @category Number - * @param {number} number The number to check. - * @param {number} [start=0] The start of the range. - * @param {number} end The end of the range. - * @returns {boolean} Returns `true` if `number` is in the range, else `false`. - * @see _.range, _.rangeRight - * @example - * - * _.inRange(3, 2, 4); - * // => true - * - * _.inRange(4, 8); - * // => true - * - * _.inRange(4, 2); - * // => false - * - * _.inRange(2, 2); - * // => false - * - * _.inRange(1.2, 2); - * // => true - * - * _.inRange(5.2, 4); - * // => false - * - * _.inRange(-3, -2, -6); - * // => true - */ - function inRange(number, start, end) { - start = toFinite(start); - if (end === undefined) { - end = start; - start = 0; - } else { - end = toFinite(end); - } - number = toNumber(number); - return baseInRange(number, start, end); - } - - /** - * Produces a random number between the inclusive `lower` and `upper` bounds. - * If only one argument is provided a number between `0` and the given number - * is returned. If `floating` is `true`, or either `lower` or `upper` are - * floats, a floating-point number is returned instead of an integer. - * - * **Note:** JavaScript follows the IEEE-754 standard for resolving - * floating-point values which can produce unexpected results. - * - * @static - * @memberOf _ - * @since 0.7.0 - * @category Number - * @param {number} [lower=0] The lower bound. - * @param {number} [upper=1] The upper bound. - * @param {boolean} [floating] Specify returning a floating-point number. - * @returns {number} Returns the random number. - * @example - * - * _.random(0, 5); - * // => an integer between 0 and 5 - * - * _.random(5); - * // => also an integer between 0 and 5 - * - * _.random(5, true); - * // => a floating-point number between 0 and 5 - * - * _.random(1.2, 5.2); - * // => a floating-point number between 1.2 and 5.2 - */ - function random(lower, upper, floating) { - if (floating && typeof floating != 'boolean' && isIterateeCall(lower, upper, floating)) { - upper = floating = undefined; - } - if (floating === undefined) { - if (typeof upper == 'boolean') { - floating = upper; - upper = undefined; - } - else if (typeof lower == 'boolean') { - floating = lower; - lower = undefined; - } - } - if (lower === undefined && upper === undefined) { - lower = 0; - upper = 1; - } - else { - lower = toFinite(lower); - if (upper === undefined) { - upper = lower; - lower = 0; - } else { - upper = toFinite(upper); - } - } - if (lower > upper) { - var temp = lower; - lower = upper; - upper = temp; - } - if (floating || lower % 1 || upper % 1) { - var rand = nativeRandom(); - return nativeMin(lower + (rand * (upper - lower + freeParseFloat('1e-' + ((rand + '').length - 1)))), upper); - } - return baseRandom(lower, upper); - } - - /*------------------------------------------------------------------------*/ - - /** - * Converts `string` to [camel case](https://en.wikipedia.org/wiki/CamelCase). - * - * @static - * @memberOf _ - * @since 3.0.0 - * @category String - * @param {string} [string=''] The string to convert. - * @returns {string} Returns the camel cased string. - * @example - * - * _.camelCase('Foo Bar'); - * // => 'fooBar' - * - * _.camelCase('--foo-bar--'); - * // => 'fooBar' - * - * _.camelCase('__FOO_BAR__'); - * // => 'fooBar' - */ - var camelCase = createCompounder(function(result, word, index) { - word = word.toLowerCase(); - return result + (index ? capitalize(word) : word); - }); - - /** - * Converts the first character of `string` to upper case and the remaining - * to lower case. - * - * @static - * @memberOf _ - * @since 3.0.0 - * @category String - * @param {string} [string=''] The string to capitalize. - * @returns {string} Returns the capitalized string. - * @example - * - * _.capitalize('FRED'); - * // => 'Fred' - */ - function capitalize(string) { - return upperFirst(toString(string).toLowerCase()); - } - - /** - * Deburrs `string` by converting - * [Latin-1 Supplement](https://en.wikipedia.org/wiki/Latin-1_Supplement_(Unicode_block)#Character_table) - * and [Latin Extended-A](https://en.wikipedia.org/wiki/Latin_Extended-A) - * letters to basic Latin letters and removing - * [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks). - * - * @static - * @memberOf _ - * @since 3.0.0 - * @category String - * @param {string} [string=''] The string to deburr. - * @returns {string} Returns the deburred string. - * @example - * - * _.deburr('déjà vu'); - * // => 'deja vu' - */ - function deburr(string) { - string = toString(string); - return string && string.replace(reLatin, deburrLetter).replace(reComboMark, ''); - } - - /** - * Checks if `string` ends with the given target string. - * - * @static - * @memberOf _ - * @since 3.0.0 - * @category String - * @param {string} [string=''] The string to inspect. - * @param {string} [target] The string to search for. - * @param {number} [position=string.length] The position to search up to. - * @returns {boolean} Returns `true` if `string` ends with `target`, - * else `false`. - * @example - * - * _.endsWith('abc', 'c'); - * // => true - * - * _.endsWith('abc', 'b'); - * // => false - * - * _.endsWith('abc', 'b', 2); - * // => true - */ - function endsWith(string, target, position) { - string = toString(string); - target = baseToString(target); - - var length = string.length; - position = position === undefined - ? length - : baseClamp(toInteger(position), 0, length); - - var end = position; - position -= target.length; - return position >= 0 && string.slice(position, end) == target; - } - - /** - * Converts the characters "&", "<", ">", '"', and "'" in `string` to their - * corresponding HTML entities. - * - * **Note:** No other characters are escaped. To escape additional - * characters use a third-party library like [_he_](https://mths.be/he). - * - * Though the ">" character is escaped for symmetry, characters like - * ">" and "/" don't need escaping in HTML and have no special meaning - * unless they're part of a tag or unquoted attribute value. See - * [Mathias Bynens's article](https://mathiasbynens.be/notes/ambiguous-ampersands) - * (under "semi-related fun fact") for more details. - * - * When working with HTML you should always - * [quote attribute values](http://wonko.com/post/html-escaping) to reduce - * XSS vectors. - * - * @static - * @since 0.1.0 - * @memberOf _ - * @category String - * @param {string} [string=''] The string to escape. - * @returns {string} Returns the escaped string. - * @example - * - * _.escape('fred, barney, & pebbles'); - * // => 'fred, barney, & pebbles' - */ - function escape(string) { - string = toString(string); - return (string && reHasUnescapedHtml.test(string)) - ? string.replace(reUnescapedHtml, escapeHtmlChar) - : string; - } - - /** - * Escapes the `RegExp` special characters "^", "$", "\", ".", "*", "+", - * "?", "(", ")", "[", "]", "{", "}", and "|" in `string`. - * - * @static - * @memberOf _ - * @since 3.0.0 - * @category String - * @param {string} [string=''] The string to escape. - * @returns {string} Returns the escaped string. - * @example - * - * _.escapeRegExp('[lodash](https://lodash.com/)'); - * // => '\[lodash\]\(https://lodash\.com/\)' - */ - function escapeRegExp(string) { - string = toString(string); - return (string && reHasRegExpChar.test(string)) - ? string.replace(reRegExpChar, '\\$&') - : string; - } - - /** - * Converts `string` to - * [kebab case](https://en.wikipedia.org/wiki/Letter_case#Special_case_styles). - * - * @static - * @memberOf _ - * @since 3.0.0 - * @category String - * @param {string} [string=''] The string to convert. - * @returns {string} Returns the kebab cased string. - * @example - * - * _.kebabCase('Foo Bar'); - * // => 'foo-bar' - * - * _.kebabCase('fooBar'); - * // => 'foo-bar' - * - * _.kebabCase('__FOO_BAR__'); - * // => 'foo-bar' - */ - var kebabCase = createCompounder(function(result, word, index) { - return result + (index ? '-' : '') + word.toLowerCase(); - }); - - /** - * Converts `string`, as space separated words, to lower case. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category String - * @param {string} [string=''] The string to convert. - * @returns {string} Returns the lower cased string. - * @example - * - * _.lowerCase('--Foo-Bar--'); - * // => 'foo bar' - * - * _.lowerCase('fooBar'); - * // => 'foo bar' - * - * _.lowerCase('__FOO_BAR__'); - * // => 'foo bar' - */ - var lowerCase = createCompounder(function(result, word, index) { - return result + (index ? ' ' : '') + word.toLowerCase(); - }); - - /** - * Converts the first character of `string` to lower case. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category String - * @param {string} [string=''] The string to convert. - * @returns {string} Returns the converted string. - * @example - * - * _.lowerFirst('Fred'); - * // => 'fred' - * - * _.lowerFirst('FRED'); - * // => 'fRED' - */ - var lowerFirst = createCaseFirst('toLowerCase'); - - /** - * Pads `string` on the left and right sides if it's shorter than `length`. - * Padding characters are truncated if they can't be evenly divided by `length`. - * - * @static - * @memberOf _ - * @since 3.0.0 - * @category String - * @param {string} [string=''] The string to pad. - * @param {number} [length=0] The padding length. - * @param {string} [chars=' '] The string used as padding. - * @returns {string} Returns the padded string. - * @example - * - * _.pad('abc', 8); - * // => ' abc ' - * - * _.pad('abc', 8, '_-'); - * // => '_-abc_-_' - * - * _.pad('abc', 3); - * // => 'abc' - */ - function pad(string, length, chars) { - string = toString(string); - length = toInteger(length); - - var strLength = length ? stringSize(string) : 0; - if (!length || strLength >= length) { - return string; - } - var mid = (length - strLength) / 2; - return ( - createPadding(nativeFloor(mid), chars) + - string + - createPadding(nativeCeil(mid), chars) - ); - } - - /** - * Pads `string` on the right side if it's shorter than `length`. Padding - * characters are truncated if they exceed `length`. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category String - * @param {string} [string=''] The string to pad. - * @param {number} [length=0] The padding length. - * @param {string} [chars=' '] The string used as padding. - * @returns {string} Returns the padded string. - * @example - * - * _.padEnd('abc', 6); - * // => 'abc ' - * - * _.padEnd('abc', 6, '_-'); - * // => 'abc_-_' - * - * _.padEnd('abc', 3); - * // => 'abc' - */ - function padEnd(string, length, chars) { - string = toString(string); - length = toInteger(length); - - var strLength = length ? stringSize(string) : 0; - return (length && strLength < length) - ? (string + createPadding(length - strLength, chars)) - : string; - } - - /** - * Pads `string` on the left side if it's shorter than `length`. Padding - * characters are truncated if they exceed `length`. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category String - * @param {string} [string=''] The string to pad. - * @param {number} [length=0] The padding length. - * @param {string} [chars=' '] The string used as padding. - * @returns {string} Returns the padded string. - * @example - * - * _.padStart('abc', 6); - * // => ' abc' - * - * _.padStart('abc', 6, '_-'); - * // => '_-_abc' - * - * _.padStart('abc', 3); - * // => 'abc' - */ - function padStart(string, length, chars) { - string = toString(string); - length = toInteger(length); - - var strLength = length ? stringSize(string) : 0; - return (length && strLength < length) - ? (createPadding(length - strLength, chars) + string) - : string; - } - - /** - * Converts `string` to an integer of the specified radix. If `radix` is - * `undefined` or `0`, a `radix` of `10` is used unless `value` is a - * hexadecimal, in which case a `radix` of `16` is used. - * - * **Note:** This method aligns with the - * [ES5 implementation](https://es5.github.io/#x15.1.2.2) of `parseInt`. - * - * @static - * @memberOf _ - * @since 1.1.0 - * @category String - * @param {string} string The string to convert. - * @param {number} [radix=10] The radix to interpret `value` by. - * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. - * @returns {number} Returns the converted integer. - * @example - * - * _.parseInt('08'); - * // => 8 - * - * _.map(['6', '08', '10'], _.parseInt); - * // => [6, 8, 10] - */ - function parseInt(string, radix, guard) { - if (guard || radix == null) { - radix = 0; - } else if (radix) { - radix = +radix; - } - return nativeParseInt(toString(string).replace(reTrimStart, ''), radix || 0); - } - - /** - * Repeats the given string `n` times. - * - * @static - * @memberOf _ - * @since 3.0.0 - * @category String - * @param {string} [string=''] The string to repeat. - * @param {number} [n=1] The number of times to repeat the string. - * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. - * @returns {string} Returns the repeated string. - * @example - * - * _.repeat('*', 3); - * // => '***' - * - * _.repeat('abc', 2); - * // => 'abcabc' - * - * _.repeat('abc', 0); - * // => '' - */ - function repeat(string, n, guard) { - if ((guard ? isIterateeCall(string, n, guard) : n === undefined)) { - n = 1; - } else { - n = toInteger(n); - } - return baseRepeat(toString(string), n); - } - - /** - * Replaces matches for `pattern` in `string` with `replacement`. - * - * **Note:** This method is based on - * [`String#replace`](https://mdn.io/String/replace). - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category String - * @param {string} [string=''] The string to modify. - * @param {RegExp|string} pattern The pattern to replace. - * @param {Function|string} replacement The match replacement. - * @returns {string} Returns the modified string. - * @example - * - * _.replace('Hi Fred', 'Fred', 'Barney'); - * // => 'Hi Barney' - */ - function replace() { - var args = arguments, - string = toString(args[0]); - - return args.length < 3 ? string : string.replace(args[1], args[2]); - } - - /** - * Converts `string` to - * [snake case](https://en.wikipedia.org/wiki/Snake_case). - * - * @static - * @memberOf _ - * @since 3.0.0 - * @category String - * @param {string} [string=''] The string to convert. - * @returns {string} Returns the snake cased string. - * @example - * - * _.snakeCase('Foo Bar'); - * // => 'foo_bar' - * - * _.snakeCase('fooBar'); - * // => 'foo_bar' - * - * _.snakeCase('--FOO-BAR--'); - * // => 'foo_bar' - */ - var snakeCase = createCompounder(function(result, word, index) { - return result + (index ? '_' : '') + word.toLowerCase(); - }); - - /** - * Splits `string` by `separator`. - * - * **Note:** This method is based on - * [`String#split`](https://mdn.io/String/split). - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category String - * @param {string} [string=''] The string to split. - * @param {RegExp|string} separator The separator pattern to split by. - * @param {number} [limit] The length to truncate results to. - * @returns {Array} Returns the string segments. - * @example - * - * _.split('a-b-c', '-', 2); - * // => ['a', 'b'] - */ - function split(string, separator, limit) { - if (limit && typeof limit != 'number' && isIterateeCall(string, separator, limit)) { - separator = limit = undefined; - } - limit = limit === undefined ? MAX_ARRAY_LENGTH : limit >>> 0; - if (!limit) { - return []; - } - string = toString(string); - if (string && ( - typeof separator == 'string' || - (separator != null && !isRegExp(separator)) - )) { - separator = baseToString(separator); - if (!separator && hasUnicode(string)) { - return castSlice(stringToArray(string), 0, limit); - } - } - return string.split(separator, limit); - } - - /** - * Converts `string` to - * [start case](https://en.wikipedia.org/wiki/Letter_case#Stylistic_or_specialised_usage). - * - * @static - * @memberOf _ - * @since 3.1.0 - * @category String - * @param {string} [string=''] The string to convert. - * @returns {string} Returns the start cased string. - * @example - * - * _.startCase('--foo-bar--'); - * // => 'Foo Bar' - * - * _.startCase('fooBar'); - * // => 'Foo Bar' - * - * _.startCase('__FOO_BAR__'); - * // => 'FOO BAR' - */ - var startCase = createCompounder(function(result, word, index) { - return result + (index ? ' ' : '') + upperFirst(word); - }); - - /** - * Checks if `string` starts with the given target string. - * - * @static - * @memberOf _ - * @since 3.0.0 - * @category String - * @param {string} [string=''] The string to inspect. - * @param {string} [target] The string to search for. - * @param {number} [position=0] The position to search from. - * @returns {boolean} Returns `true` if `string` starts with `target`, - * else `false`. - * @example - * - * _.startsWith('abc', 'a'); - * // => true - * - * _.startsWith('abc', 'b'); - * // => false - * - * _.startsWith('abc', 'b', 1); - * // => true - */ - function startsWith(string, target, position) { - string = toString(string); - position = position == null - ? 0 - : baseClamp(toInteger(position), 0, string.length); - - target = baseToString(target); - return string.slice(position, position + target.length) == target; - } - - /** - * Creates a compiled template function that can interpolate data properties - * in "interpolate" delimiters, HTML-escape interpolated data properties in - * "escape" delimiters, and execute JavaScript in "evaluate" delimiters. Data - * properties may be accessed as free variables in the template. If a setting - * object is given, it takes precedence over `_.templateSettings` values. - * - * **Note:** In the development build `_.template` utilizes - * [sourceURLs](http://www.html5rocks.com/en/tutorials/developertools/sourcemaps/#toc-sourceurl) - * for easier debugging. - * - * For more information on precompiling templates see - * [lodash's custom builds documentation](https://lodash.com/custom-builds). - * - * For more information on Chrome extension sandboxes see - * [Chrome's extensions documentation](https://developer.chrome.com/extensions/sandboxingEval). - * - * @static - * @since 0.1.0 - * @memberOf _ - * @category String - * @param {string} [string=''] The template string. - * @param {Object} [options={}] The options object. - * @param {RegExp} [options.escape=_.templateSettings.escape] - * The HTML "escape" delimiter. - * @param {RegExp} [options.evaluate=_.templateSettings.evaluate] - * The "evaluate" delimiter. - * @param {Object} [options.imports=_.templateSettings.imports] - * An object to import into the template as free variables. - * @param {RegExp} [options.interpolate=_.templateSettings.interpolate] - * The "interpolate" delimiter. - * @param {string} [options.sourceURL='lodash.templateSources[n]'] - * The sourceURL of the compiled template. - * @param {string} [options.variable='obj'] - * The data object variable name. - * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. - * @returns {Function} Returns the compiled template function. - * @example - * - * // Use the "interpolate" delimiter to create a compiled template. - * var compiled = _.template('hello <%= user %>!'); - * compiled({ 'user': 'fred' }); - * // => 'hello fred!' - * - * // Use the HTML "escape" delimiter to escape data property values. - * var compiled = _.template('<%- value %>'); - * compiled({ 'value': '