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mB/B,MAAM,KAAMiC,GA8BrClD,CACT,MAAM+C,GAON,OAAOlE,OAAOyE,OAAOL,EAAU,CAC7BV,aACAS,qBACA5E,eACAiE,yBAA0BA,IAAMA,EAChCkB,8BAA+BA,KAC7BlB,EAA2B,CAAC,EAE9BrC,WAAYA,IAAMA,EAClBoC,eAAgBA,IAAMA,EACtBoB,oBAAqBA,KACnBpB,EAAiB,CAAC,EAEpBL,UACAY,eAOJ,EAMA,OAJA9D,OAAOyE,OAAOrB,EAAgB,CAC5BwB,UAAWA,IAAMxB,IAGZA,CAIT,CAWO,IAAMyB,EACKjC,EAAsB7B,GC5E3B+D,EACX9E,OAAOyE,QACL,SAKEM,GAQG,IAPHC,EAAApG,UAAAC,OAAA,QAAAC,IAAAF,UAAA,GAAAA,UAAA,GAGIiG,GJpYH,SACLI,GAE8B,IAD9BtG,EAAAC,UAAAC,OAAA,QAAAC,IAAAF,UAAA,GAAAA,UAAA,2CAAAG,cAA8DkG,GAE9D,GAAsB,iBAAXA,EACT,MAAM,IAAIjG,UAAUL,EAExB,CIkYMuG,CACEH,EAAA,yHAAAhG,cAEkEgG,IAEpE,MAAMI,EAAoBnF,OAAOoF,KAAKL,GAIhCM,EAAqBL,EAHNG,EAAkBxF,KACrC2F,GAAOP,EAAqBO,MAI5B,WAAoC,QAAAC,EAAA3G,UAAAC,OAAhCwF,EAAA,IAAAlF,MAAAoG,GAAAC,EAAA,EAAAA,EAAAD,EAAAC,IAAAnB,EAAAmB,GAAA5G,UAAA4G,GACF,OAAOnB,EAAqBoB,QAAO,CAACC,EAAarF,EAAOsF,KACtDD,EAAYP,EAAkBQ,IAAUtF,EACjCqF,IACN,CAAC,EACN,IAEF,OAAOL,CACT,GACA,CAAET,UAAWA,IAAME,G","sources":["../node_modules/reselect/src/utils.ts","../node_modules/reselect/src/autotrackMemoize/proxy.ts","../node_modules/reselect/src/weakMapMemoize.ts","../node_modules/reselect/src/createSelectorCreator.ts","../node_modules/reselect/src/createStructuredSelector.ts"],"sourcesContent":["import { runIdentityFunctionCheck } from './devModeChecks/identityFunctionCheck'\r\nimport { runInputStabilityCheck } from './devModeChecks/inputStabilityCheck'\r\nimport { globalDevModeChecks } from './devModeChecks/setGlobalDevModeChecks'\r\n// eslint-disable-next-line @typescript-eslint/consistent-type-imports\r\nimport type {\r\n DevModeChecks,\r\n Selector,\r\n SelectorArray,\r\n DevModeChecksExecutionInfo\r\n} from './types'\r\n\r\nexport const NOT_FOUND = /* @__PURE__ */ Symbol('NOT_FOUND')\r\nexport type NOT_FOUND_TYPE = typeof NOT_FOUND\r\n\r\n/**\r\n * Assert that the provided value is a function. If the assertion fails,\r\n * a `TypeError` is thrown with an optional custom error message.\r\n *\r\n * @param func - The value to be checked.\r\n * @param errorMessage - An optional custom error message to use if the assertion fails.\r\n * @throws A `TypeError` if the assertion fails.\r\n */\r\nexport function assertIsFunction(\r\n func: unknown,\r\n errorMessage = `expected a function, instead received ${typeof func}`\r\n): asserts func is FunctionType {\r\n if (typeof func !== 'function') {\r\n throw new TypeError(errorMessage)\r\n }\r\n}\r\n\r\n/**\r\n * Assert that the provided value is an object. If the assertion fails,\r\n * a `TypeError` is thrown with an optional custom error message.\r\n *\r\n * @param object - The value to be checked.\r\n * @param errorMessage - An optional custom error message to use if the assertion fails.\r\n * @throws A `TypeError` if the assertion fails.\r\n */\r\nexport function assertIsObject>(\r\n object: unknown,\r\n errorMessage = `expected an object, instead received ${typeof object}`\r\n): asserts object is ObjectType {\r\n if (typeof object !== 'object') {\r\n throw new TypeError(errorMessage)\r\n }\r\n}\r\n\r\n/**\r\n * Assert that the provided array is an array of functions. If the assertion fails,\r\n * a `TypeError` is thrown with an optional custom error message.\r\n *\r\n * @param array - The array to be checked.\r\n * @param errorMessage - An optional custom error message to use if the assertion fails.\r\n * @throws A `TypeError` if the assertion fails.\r\n */\r\nexport function assertIsArrayOfFunctions(\r\n array: unknown[],\r\n errorMessage = `expected all items to be functions, instead received the following types: `\r\n): asserts array is FunctionType[] {\r\n if (\r\n !array.every((item): item is FunctionType => typeof item === 'function')\r\n ) {\r\n const itemTypes = array\r\n .map(item =>\r\n typeof item === 'function'\r\n ? `function ${item.name || 'unnamed'}()`\r\n : typeof item\r\n )\r\n .join(', ')\r\n throw new TypeError(`${errorMessage}[${itemTypes}]`)\r\n }\r\n}\r\n\r\n/**\r\n * Ensure that the input is an array. If it's already an array, it's returned as is.\r\n * If it's not an array, it will be wrapped in a new array.\r\n *\r\n * @param item - The item to be checked.\r\n * @returns An array containing the input item. If the input is already an array, it's returned without modification.\r\n */\r\nexport const ensureIsArray = (item: unknown) => {\r\n return Array.isArray(item) ? item : [item]\r\n}\r\n\r\n/**\r\n * Extracts the \"dependencies\" / \"input selectors\" from the arguments of `createSelector`.\r\n *\r\n * @param createSelectorArgs - Arguments passed to `createSelector` as an array.\r\n * @returns An array of \"input selectors\" / \"dependencies\".\r\n * @throws A `TypeError` if any of the input selectors is not function.\r\n */\r\nexport function getDependencies(createSelectorArgs: unknown[]) {\r\n const dependencies = Array.isArray(createSelectorArgs[0])\r\n ? createSelectorArgs[0]\r\n : createSelectorArgs\r\n\r\n assertIsArrayOfFunctions(\r\n dependencies,\r\n `createSelector expects all input-selectors to be functions, but received the following types: `\r\n )\r\n\r\n return dependencies as SelectorArray\r\n}\r\n\r\n/**\r\n * Runs each input selector and returns their collective results as an array.\r\n *\r\n * @param dependencies - An array of \"dependencies\" or \"input selectors\".\r\n * @param inputSelectorArgs - An array of arguments being passed to the input selectors.\r\n * @returns An array of input selector results.\r\n */\r\nexport function collectInputSelectorResults(\r\n dependencies: SelectorArray,\r\n inputSelectorArgs: unknown[] | IArguments\r\n) {\r\n const inputSelectorResults = []\r\n const { length } = dependencies\r\n for (let i = 0; i < length; i++) {\r\n // @ts-ignore\r\n // apply arguments instead of spreading and mutate a local list of params for performance.\r\n inputSelectorResults.push(dependencies[i].apply(null, inputSelectorArgs))\r\n }\r\n return inputSelectorResults\r\n}\r\n\r\n/**\r\n * Retrieves execution information for development mode checks.\r\n *\r\n * @param devModeChecks - Custom Settings for development mode checks. These settings will override the global defaults.\r\n * @param firstRun - Indicates whether it is the first time the selector has run.\r\n * @returns An object containing the execution information for each development mode check.\r\n */\r\nexport const getDevModeChecksExecutionInfo = (\r\n firstRun: boolean,\r\n devModeChecks: Partial\r\n) => {\r\n const { identityFunctionCheck, inputStabilityCheck } = {\r\n ...globalDevModeChecks,\r\n ...devModeChecks\r\n }\r\n return {\r\n identityFunctionCheck: {\r\n shouldRun:\r\n identityFunctionCheck === 'always' ||\r\n (identityFunctionCheck === 'once' && firstRun),\r\n run: runIdentityFunctionCheck\r\n },\r\n inputStabilityCheck: {\r\n shouldRun:\r\n inputStabilityCheck === 'always' ||\r\n (inputStabilityCheck === 'once' && firstRun),\r\n run: runInputStabilityCheck\r\n }\r\n } satisfies DevModeChecksExecutionInfo\r\n}\r\n","// Original source:\r\n// - https://github.com/simonihmig/tracked-redux/blob/master/packages/tracked-redux/src/-private/proxy.ts\r\n\r\nimport type { Node, Tag } from './tracking'\r\nimport {\r\n consumeCollection,\r\n consumeTag,\r\n createTag,\r\n dirtyCollection,\r\n dirtyTag\r\n} from './tracking'\r\n\r\nexport const REDUX_PROXY_LABEL = Symbol()\r\n\r\nlet nextId = 0\r\n\r\nconst proto = Object.getPrototypeOf({})\r\n\r\nclass ObjectTreeNode> implements Node {\r\n proxy: T = new Proxy(this, objectProxyHandler) as unknown as T\r\n tag = createTag()\r\n tags = {} as Record\r\n children = {} as Record\r\n collectionTag = null\r\n id = nextId++\r\n\r\n constructor(public value: T) {\r\n this.value = value\r\n this.tag.value = value\r\n }\r\n}\r\n\r\nconst objectProxyHandler = {\r\n get(node: Node, key: string | symbol): unknown {\r\n function calculateResult() {\r\n const { value } = node\r\n\r\n const childValue = Reflect.get(value, key)\r\n\r\n if (typeof key === 'symbol') {\r\n return childValue\r\n }\r\n\r\n if (key in proto) {\r\n return childValue\r\n }\r\n\r\n if (typeof childValue === 'object' && childValue !== null) {\r\n let childNode = node.children[key]\r\n\r\n if (childNode === undefined) {\r\n childNode = node.children[key] = createNode(childValue)\r\n }\r\n\r\n if (childNode.tag) {\r\n consumeTag(childNode.tag)\r\n }\r\n\r\n return childNode.proxy\r\n } else {\r\n let tag = node.tags[key]\r\n\r\n if (tag === undefined) {\r\n tag = node.tags[key] = createTag()\r\n tag.value = childValue\r\n }\r\n\r\n consumeTag(tag)\r\n\r\n return childValue\r\n }\r\n }\r\n const res = calculateResult()\r\n return res\r\n },\r\n\r\n ownKeys(node: Node): ArrayLike {\r\n consumeCollection(node)\r\n return Reflect.ownKeys(node.value)\r\n },\r\n\r\n getOwnPropertyDescriptor(\r\n node: Node,\r\n prop: string | symbol\r\n ): PropertyDescriptor | undefined {\r\n return Reflect.getOwnPropertyDescriptor(node.value, prop)\r\n },\r\n\r\n has(node: Node, prop: string | symbol): boolean {\r\n return Reflect.has(node.value, prop)\r\n }\r\n}\r\n\r\nclass ArrayTreeNode> implements Node {\r\n proxy: T = new Proxy([this], arrayProxyHandler) as unknown as T\r\n tag = createTag()\r\n tags = {}\r\n children = {}\r\n collectionTag = null\r\n id = nextId++\r\n\r\n constructor(public value: T) {\r\n this.value = value\r\n this.tag.value = value\r\n }\r\n}\r\n\r\nconst arrayProxyHandler = {\r\n get([node]: [Node], key: string | symbol): unknown {\r\n if (key === 'length') {\r\n consumeCollection(node)\r\n }\r\n\r\n return objectProxyHandler.get(node, key)\r\n },\r\n\r\n ownKeys([node]: [Node]): ArrayLike {\r\n return objectProxyHandler.ownKeys(node)\r\n },\r\n\r\n getOwnPropertyDescriptor(\r\n [node]: [Node],\r\n prop: string | symbol\r\n ): PropertyDescriptor | undefined {\r\n return objectProxyHandler.getOwnPropertyDescriptor(node, prop)\r\n },\r\n\r\n has([node]: [Node], prop: string | symbol): boolean {\r\n return objectProxyHandler.has(node, prop)\r\n }\r\n}\r\n\r\nexport function createNode | Record>(\r\n value: T\r\n): Node {\r\n if (Array.isArray(value)) {\r\n return new ArrayTreeNode(value)\r\n }\r\n\r\n return new ObjectTreeNode(value) as Node\r\n}\r\n\r\nconst keysMap = new WeakMap<\r\n Array | Record,\r\n Set\r\n>()\r\n\r\nexport function updateNode | Record>(\r\n node: Node,\r\n newValue: T\r\n): void {\r\n const { value, tags, children } = node\r\n\r\n node.value = newValue\r\n\r\n if (\r\n Array.isArray(value) &&\r\n Array.isArray(newValue) &&\r\n value.length !== newValue.length\r\n ) {\r\n dirtyCollection(node)\r\n } else {\r\n if (value !== newValue) {\r\n let oldKeysSize = 0\r\n let newKeysSize = 0\r\n let anyKeysAdded = false\r\n\r\n for (const _key in value) {\r\n oldKeysSize++\r\n }\r\n\r\n for (const key in newValue) {\r\n newKeysSize++\r\n if (!(key in value)) {\r\n anyKeysAdded = true\r\n break\r\n }\r\n }\r\n\r\n const isDifferent = anyKeysAdded || oldKeysSize !== newKeysSize\r\n\r\n if (isDifferent) {\r\n dirtyCollection(node)\r\n }\r\n }\r\n }\r\n\r\n for (const key in tags) {\r\n const childValue = (value as Record)[key]\r\n const newChildValue = (newValue as Record)[key]\r\n\r\n if (childValue !== newChildValue) {\r\n dirtyCollection(node)\r\n dirtyTag(tags[key], newChildValue)\r\n }\r\n\r\n if (typeof newChildValue === 'object' && newChildValue !== null) {\r\n delete tags[key]\r\n }\r\n }\r\n\r\n for (const key in children) {\r\n const childNode = children[key]\r\n const newChildValue = (newValue as Record)[key]\r\n\r\n const childValue = childNode.value\r\n\r\n if (childValue === newChildValue) {\r\n continue\r\n } else if (typeof newChildValue === 'object' && newChildValue !== null) {\r\n updateNode(childNode, newChildValue as Record)\r\n } else {\r\n deleteNode(childNode)\r\n delete children[key]\r\n }\r\n }\r\n}\r\n\r\nfunction deleteNode(node: Node): void {\r\n if (node.tag) {\r\n dirtyTag(node.tag, null)\r\n }\r\n dirtyCollection(node)\r\n for (const key in node.tags) {\r\n dirtyTag(node.tags[key], null)\r\n }\r\n for (const key in node.children) {\r\n deleteNode(node.children[key])\r\n }\r\n}\r\n","// Original source:\r\n// - https://github.com/facebook/react/blob/0b974418c9a56f6c560298560265dcf4b65784bc/packages/react/src/ReactCache.js\r\n\r\nimport type {\r\n AnyFunction,\r\n DefaultMemoizeFields,\r\n EqualityFn,\r\n Simplify\r\n} from './types'\r\n\r\nclass StrongRef {\r\n constructor(private value: T) {}\r\n deref() {\r\n return this.value\r\n }\r\n}\r\n\r\nconst Ref =\r\n typeof WeakRef !== 'undefined'\r\n ? WeakRef\r\n : (StrongRef as unknown as typeof WeakRef)\r\n\r\nconst UNTERMINATED = 0\r\nconst TERMINATED = 1\r\n\r\ninterface UnterminatedCacheNode {\r\n /**\r\n * Status, represents whether the cached computation returned a value or threw an error.\r\n */\r\n s: 0\r\n /**\r\n * Value, either the cached result or an error, depending on status.\r\n */\r\n v: void\r\n /**\r\n * Object cache, a `WeakMap` where non-primitive arguments are stored.\r\n */\r\n o: null | WeakMap>\r\n /**\r\n * Primitive cache, a regular Map where primitive arguments are stored.\r\n */\r\n p: null | Map>\r\n}\r\n\r\ninterface TerminatedCacheNode {\r\n /**\r\n * Status, represents whether the cached computation returned a value or threw an error.\r\n */\r\n s: 1\r\n /**\r\n * Value, either the cached result or an error, depending on status.\r\n */\r\n v: T\r\n /**\r\n * Object cache, a `WeakMap` where non-primitive arguments are stored.\r\n */\r\n o: null | WeakMap>\r\n /**\r\n * Primitive cache, a regular `Map` where primitive arguments are stored.\r\n */\r\n p: null | Map>\r\n}\r\n\r\ntype CacheNode = TerminatedCacheNode | UnterminatedCacheNode\r\n\r\nfunction createCacheNode(): CacheNode {\r\n return {\r\n s: UNTERMINATED,\r\n v: undefined,\r\n o: null,\r\n p: null\r\n }\r\n}\r\n\r\n/**\r\n * Configuration options for a memoization function utilizing `WeakMap` for\r\n * its caching mechanism.\r\n *\r\n * @template Result - The type of the return value of the memoized function.\r\n *\r\n * @since 5.0.0\r\n * @public\r\n */\r\nexport interface WeakMapMemoizeOptions {\r\n /**\r\n * If provided, used to compare a newly generated output value against previous values in the cache.\r\n * If a match is found, the old value is returned. This addresses the common\r\n * ```ts\r\n * todos.map(todo => todo.id)\r\n * ```\r\n * use case, where an update to another field in the original data causes a recalculation\r\n * due to changed references, but the output is still effectively the same.\r\n *\r\n * @since 5.0.0\r\n */\r\n resultEqualityCheck?: EqualityFn\r\n}\r\n\r\n/**\r\n * Creates a tree of `WeakMap`-based cache nodes based on the identity of the\r\n * arguments it's been called with (in this case, the extracted values from your input selectors).\r\n * This allows `weakMapMemoize` to have an effectively infinite cache size.\r\n * Cache results will be kept in memory as long as references to the arguments still exist,\r\n * and then cleared out as the arguments are garbage-collected.\r\n *\r\n * __Design Tradeoffs for `weakMapMemoize`:__\r\n * - Pros:\r\n * - It has an effectively infinite cache size, but you have no control over\r\n * how long values are kept in cache as it's based on garbage collection and `WeakMap`s.\r\n * - Cons:\r\n * - There's currently no way to alter the argument comparisons.\r\n * They're based on strict reference equality.\r\n * - It's roughly the same speed as `lruMemoize`, although likely a fraction slower.\r\n *\r\n * __Use Cases for `weakMapMemoize`:__\r\n * - This memoizer is likely best used for cases where you need to call the\r\n * same selector instance with many different arguments, such as a single\r\n * selector instance that is used in a list item component and called with\r\n * item IDs like:\r\n * ```ts\r\n * useSelector(state => selectSomeData(state, props.category))\r\n * ```\r\n * @param func - The function to be memoized.\r\n * @returns A memoized function with a `.clearCache()` method attached.\r\n *\r\n * @example\r\n * Using `createSelector`\r\n * ```ts\r\n * import { createSelector, weakMapMemoize } from 'reselect'\r\n *\r\n * interface RootState {\r\n * items: { id: number; category: string; name: string }[]\r\n * }\r\n *\r\n * const selectItemsByCategory = createSelector(\r\n * [\r\n * (state: RootState) => state.items,\r\n * (state: RootState, category: string) => category\r\n * ],\r\n * (items, category) => items.filter(item => item.category === category),\r\n * {\r\n * memoize: weakMapMemoize,\r\n * argsMemoize: weakMapMemoize\r\n * }\r\n * )\r\n * ```\r\n *\r\n * @example\r\n * Using `createSelectorCreator`\r\n * ```ts\r\n * import { createSelectorCreator, weakMapMemoize } from 'reselect'\r\n *\r\n * const createSelectorWeakMap = createSelectorCreator({ memoize: weakMapMemoize, argsMemoize: weakMapMemoize })\r\n *\r\n * const selectItemsByCategory = createSelectorWeakMap(\r\n * [\r\n * (state: RootState) => state.items,\r\n * (state: RootState, category: string) => category\r\n * ],\r\n * (items, category) => items.filter(item => item.category === category)\r\n * )\r\n * ```\r\n *\r\n * @template Func - The type of the function that is memoized.\r\n *\r\n * @see {@link https://reselect.js.org/api/weakMapMemoize `weakMapMemoize`}\r\n *\r\n * @since 5.0.0\r\n * @public\r\n * @experimental\r\n */\r\nexport function weakMapMemoize(\r\n func: Func,\r\n options: WeakMapMemoizeOptions> = {}\r\n) {\r\n let fnNode = createCacheNode()\r\n const { resultEqualityCheck } = options\r\n\r\n let lastResult: WeakRef | undefined\r\n\r\n let resultsCount = 0\r\n\r\n function memoized() {\r\n let cacheNode = fnNode\r\n const { length } = arguments\r\n for (let i = 0, l = length; i < l; i++) {\r\n const arg = arguments[i]\r\n if (\r\n typeof arg === 'function' ||\r\n (typeof arg === 'object' && arg !== null)\r\n ) {\r\n // Objects go into a WeakMap\r\n let objectCache = cacheNode.o\r\n if (objectCache === null) {\r\n cacheNode.o = objectCache = new WeakMap()\r\n }\r\n const objectNode = objectCache.get(arg)\r\n if (objectNode === undefined) {\r\n cacheNode = createCacheNode()\r\n objectCache.set(arg, cacheNode)\r\n } else {\r\n cacheNode = objectNode\r\n }\r\n } else {\r\n // Primitives go into a regular Map\r\n let primitiveCache = cacheNode.p\r\n if (primitiveCache === null) {\r\n cacheNode.p = primitiveCache = new Map()\r\n }\r\n const primitiveNode = primitiveCache.get(arg)\r\n if (primitiveNode === undefined) {\r\n cacheNode = createCacheNode()\r\n primitiveCache.set(arg, cacheNode)\r\n } else {\r\n cacheNode = primitiveNode\r\n }\r\n }\r\n }\r\n\r\n const terminatedNode = cacheNode as unknown as TerminatedCacheNode\r\n\r\n let result\r\n\r\n if (cacheNode.s === TERMINATED) {\r\n result = cacheNode.v\r\n } else {\r\n // Allow errors to propagate\r\n result = func.apply(null, arguments as unknown as any[])\r\n resultsCount++\r\n\r\n if (resultEqualityCheck) {\r\n const lastResultValue = lastResult?.deref?.() ?? lastResult\r\n\r\n if (\r\n lastResultValue != null &&\r\n resultEqualityCheck(lastResultValue as ReturnType, result)\r\n ) {\r\n result = lastResultValue\r\n\r\n resultsCount !== 0 && resultsCount--\r\n }\r\n\r\n const needsWeakRef =\r\n (typeof result === 'object' && result !== null) ||\r\n typeof result === 'function'\r\n\r\n lastResult = needsWeakRef ? new Ref(result) : result\r\n }\r\n }\r\n\r\n terminatedNode.s = TERMINATED\r\n\r\n terminatedNode.v = result\r\n return result\r\n }\r\n\r\n memoized.clearCache = () => {\r\n fnNode = createCacheNode()\r\n memoized.resetResultsCount()\r\n }\r\n\r\n memoized.resultsCount = () => resultsCount\r\n\r\n memoized.resetResultsCount = () => {\r\n resultsCount = 0\r\n }\r\n\r\n return memoized as Func & Simplify\r\n}\r\n","import { weakMapMemoize } from './weakMapMemoize'\r\n\r\nimport type {\r\n Combiner,\r\n CreateSelectorOptions,\r\n DropFirstParameter,\r\n ExtractMemoizerFields,\r\n GetParamsFromSelectors,\r\n GetStateFromSelectors,\r\n InterruptRecursion,\r\n OutputSelector,\r\n Selector,\r\n SelectorArray,\r\n SetRequired,\r\n Simplify,\r\n UnknownMemoizer\r\n} from './types'\r\n\r\nimport {\r\n assertIsFunction,\r\n collectInputSelectorResults,\r\n ensureIsArray,\r\n getDependencies,\r\n getDevModeChecksExecutionInfo\r\n} from './utils'\r\n\r\n/**\r\n * An instance of `createSelector`, customized with a given memoize implementation.\r\n *\r\n * @template MemoizeFunction - The type of the memoize function that is used to memoize the `resultFunc` inside `createSelector` (e.g., `lruMemoize` or `weakMapMemoize`).\r\n * @template ArgsMemoizeFunction - The type of the optional memoize function that is used to memoize the arguments passed into the output selector generated by `createSelector` (e.g., `lruMemoize` or `weakMapMemoize`). If none is explicitly provided, `weakMapMemoize` will be used.\r\n * @template StateType - The type of state that the selectors created with this selector creator will operate on.\r\n *\r\n * @public\r\n */\r\nexport interface CreateSelectorFunction<\r\n MemoizeFunction extends UnknownMemoizer = typeof weakMapMemoize,\r\n ArgsMemoizeFunction extends UnknownMemoizer = typeof weakMapMemoize,\r\n StateType = any\r\n> {\r\n /**\r\n * Creates a memoized selector function.\r\n *\r\n * @param createSelectorArgs - An arbitrary number of input selectors as separate inline arguments and a `combiner` function.\r\n * @returns A memoized output selector.\r\n *\r\n * @template InputSelectors - The type of the input selectors as an array.\r\n * @template Result - The return type of the `combiner` as well as the output selector.\r\n * @template OverrideMemoizeFunction - The type of the optional `memoize` function that could be passed into the options object to override the original `memoize` function that was initially passed into `createSelectorCreator`.\r\n * @template OverrideArgsMemoizeFunction - The type of the optional `argsMemoize` function that could be passed into the options object to override the original `argsMemoize` function that was initially passed into `createSelectorCreator`.\r\n *\r\n * @see {@link https://reselect.js.org/api/createselector `createSelector`}\r\n */\r\n , Result>(\r\n ...createSelectorArgs: [\r\n ...inputSelectors: InputSelectors,\r\n combiner: Combiner\r\n ]\r\n ): OutputSelector<\r\n InputSelectors,\r\n Result,\r\n MemoizeFunction,\r\n ArgsMemoizeFunction\r\n > &\r\n InterruptRecursion\r\n\r\n /**\r\n * Creates a memoized selector function.\r\n *\r\n * @param createSelectorArgs - An arbitrary number of input selectors as separate inline arguments, a `combiner` function and an `options` object.\r\n * @returns A memoized output selector.\r\n *\r\n * @template InputSelectors - The type of the input selectors as an array.\r\n * @template Result - The return type of the `combiner` as well as the output selector.\r\n * @template OverrideMemoizeFunction - The type of the optional `memoize` function that could be passed into the options object to override the original `memoize` function that was initially passed into `createSelectorCreator`.\r\n * @template OverrideArgsMemoizeFunction - The type of the optional `argsMemoize` function that could be passed into the options object to override the original `argsMemoize` function that was initially passed into `createSelectorCreator`.\r\n *\r\n * @see {@link https://reselect.js.org/api/createselector `createSelector`}\r\n */\r\n <\r\n InputSelectors extends SelectorArray,\r\n Result,\r\n OverrideMemoizeFunction extends UnknownMemoizer = MemoizeFunction,\r\n OverrideArgsMemoizeFunction extends UnknownMemoizer = ArgsMemoizeFunction\r\n >(\r\n ...createSelectorArgs: [\r\n ...inputSelectors: InputSelectors,\r\n combiner: Combiner,\r\n createSelectorOptions: Simplify<\r\n CreateSelectorOptions<\r\n MemoizeFunction,\r\n ArgsMemoizeFunction,\r\n OverrideMemoizeFunction,\r\n OverrideArgsMemoizeFunction\r\n >\r\n >\r\n ]\r\n ): OutputSelector<\r\n InputSelectors,\r\n Result,\r\n OverrideMemoizeFunction,\r\n OverrideArgsMemoizeFunction\r\n > &\r\n InterruptRecursion\r\n\r\n /**\r\n * Creates a memoized selector function.\r\n *\r\n * @param inputSelectors - An array of input selectors.\r\n * @param combiner - A function that Combines the input selectors and returns an output selector. Otherwise known as the result function.\r\n * @param createSelectorOptions - An optional options object that allows for further customization per selector.\r\n * @returns A memoized output selector.\r\n *\r\n * @template InputSelectors - The type of the input selectors array.\r\n * @template Result - The return type of the `combiner` as well as the output selector.\r\n * @template OverrideMemoizeFunction - The type of the optional `memoize` function that could be passed into the options object to override the original `memoize` function that was initially passed into `createSelectorCreator`.\r\n * @template OverrideArgsMemoizeFunction - The type of the optional `argsMemoize` function that could be passed into the options object to override the original `argsMemoize` function that was initially passed into `createSelectorCreator`.\r\n *\r\n * @see {@link https://reselect.js.org/api/createselector `createSelector`}\r\n */\r\n <\r\n InputSelectors extends SelectorArray,\r\n Result,\r\n OverrideMemoizeFunction extends UnknownMemoizer = MemoizeFunction,\r\n OverrideArgsMemoizeFunction extends UnknownMemoizer = ArgsMemoizeFunction\r\n >(\r\n inputSelectors: [...InputSelectors],\r\n combiner: Combiner,\r\n createSelectorOptions?: Simplify<\r\n CreateSelectorOptions<\r\n MemoizeFunction,\r\n ArgsMemoizeFunction,\r\n OverrideMemoizeFunction,\r\n OverrideArgsMemoizeFunction\r\n >\r\n >\r\n ): OutputSelector<\r\n InputSelectors,\r\n Result,\r\n OverrideMemoizeFunction,\r\n OverrideArgsMemoizeFunction\r\n > &\r\n InterruptRecursion\r\n\r\n /**\r\n * Creates a \"pre-typed\" version of {@linkcode createSelector createSelector}\r\n * where the `state` type is predefined.\r\n *\r\n * This allows you to set the `state` type once, eliminating the need to\r\n * specify it with every {@linkcode createSelector createSelector} call.\r\n *\r\n * @returns A pre-typed `createSelector` with the state type already defined.\r\n *\r\n * @example\r\n * ```ts\r\n * import { createSelector } from 'reselect'\r\n *\r\n * export interface RootState {\r\n * todos: { id: number; completed: boolean }[]\r\n * alerts: { id: number; read: boolean }[]\r\n * }\r\n *\r\n * export const createAppSelector = createSelector.withTypes()\r\n *\r\n * const selectTodoIds = createAppSelector(\r\n * [\r\n * // Type of `state` is set to `RootState`, no need to manually set the type\r\n * state => state.todos\r\n * ],\r\n * todos => todos.map(({ id }) => id)\r\n * )\r\n * ```\r\n * @template OverrideStateType - The specific type of state used by all selectors created with this selector creator.\r\n *\r\n * @see {@link https://reselect.js.org/api/createselector#defining-a-pre-typed-createselector `createSelector.withTypes`}\r\n *\r\n * @since 5.1.0\r\n */\r\n withTypes: () => CreateSelectorFunction<\r\n MemoizeFunction,\r\n ArgsMemoizeFunction,\r\n OverrideStateType\r\n >\r\n}\r\n\r\n/**\r\n * Creates a selector creator function with the specified memoization function\r\n * and options for customizing memoization behavior.\r\n *\r\n * @param options - An options object containing the `memoize` function responsible for memoizing the `resultFunc` inside `createSelector` (e.g., `lruMemoize` or `weakMapMemoize`). It also provides additional options for customizing memoization. While the `memoize` property is mandatory, the rest are optional.\r\n * @returns A customized `createSelector` function.\r\n *\r\n * @example\r\n * ```ts\r\n * const customCreateSelector = createSelectorCreator({\r\n * memoize: customMemoize, // Function to be used to memoize `resultFunc`\r\n * memoizeOptions: [memoizeOption1, memoizeOption2], // Options passed to `customMemoize` as the second argument onwards\r\n * argsMemoize: customArgsMemoize, // Function to be used to memoize the selector's arguments\r\n * argsMemoizeOptions: [argsMemoizeOption1, argsMemoizeOption2] // Options passed to `customArgsMemoize` as the second argument onwards\r\n * })\r\n *\r\n * const customSelector = customCreateSelector(\r\n * [inputSelector1, inputSelector2],\r\n * resultFunc // `resultFunc` will be passed as the first argument to `customMemoize`\r\n * )\r\n *\r\n * customSelector(\r\n * ...selectorArgs // Will be memoized by `customArgsMemoize`\r\n * )\r\n * ```\r\n *\r\n * @template MemoizeFunction - The type of the memoize function that is used to memoize the `resultFunc` inside `createSelector` (e.g., `lruMemoize` or `weakMapMemoize`).\r\n * @template ArgsMemoizeFunction - The type of the optional memoize function that is used to memoize the arguments passed into the output selector generated by `createSelector` (e.g., `lruMemoize` or `weakMapMemoize`). If none is explicitly provided, `weakMapMemoize` will be used.\r\n *\r\n * @see {@link https://reselect.js.org/api/createSelectorCreator#using-options-since-500 `createSelectorCreator`}\r\n *\r\n * @since 5.0.0\r\n * @public\r\n */\r\nexport function createSelectorCreator<\r\n MemoizeFunction extends UnknownMemoizer,\r\n ArgsMemoizeFunction extends UnknownMemoizer = typeof weakMapMemoize\r\n>(\r\n options: Simplify<\r\n SetRequired<\r\n CreateSelectorOptions<\r\n typeof weakMapMemoize,\r\n typeof weakMapMemoize,\r\n MemoizeFunction,\r\n ArgsMemoizeFunction\r\n >,\r\n 'memoize'\r\n >\r\n >\r\n): CreateSelectorFunction\r\n\r\n/**\r\n * Creates a selector creator function with the specified memoization function\r\n * and options for customizing memoization behavior.\r\n *\r\n * @param memoize - The `memoize` function responsible for memoizing the `resultFunc` inside `createSelector` (e.g., `lruMemoize` or `weakMapMemoize`).\r\n * @param memoizeOptionsFromArgs - Optional configuration options for the memoization function. These options are then passed to the memoize function as the second argument onwards.\r\n * @returns A customized `createSelector` function.\r\n *\r\n * @example\r\n * ```ts\r\n * const customCreateSelector = createSelectorCreator(customMemoize, // Function to be used to memoize `resultFunc`\r\n * option1, // Will be passed as second argument to `customMemoize`\r\n * option2, // Will be passed as third argument to `customMemoize`\r\n * option3 // Will be passed as fourth argument to `customMemoize`\r\n * )\r\n *\r\n * const customSelector = customCreateSelector(\r\n * [inputSelector1, inputSelector2],\r\n * resultFunc // `resultFunc` will be passed as the first argument to `customMemoize`\r\n * )\r\n * ```\r\n *\r\n * @template MemoizeFunction - The type of the memoize function that is used to memoize the `resultFunc` inside `createSelector` (e.g., `lruMemoize` or `weakMapMemoize`).\r\n *\r\n * @see {@link https://reselect.js.org/api/createSelectorCreator#using-memoize-and-memoizeoptions `createSelectorCreator`}\r\n *\r\n * @public\r\n */\r\nexport function createSelectorCreator(\r\n memoize: MemoizeFunction,\r\n ...memoizeOptionsFromArgs: DropFirstParameter\r\n): CreateSelectorFunction\r\n\r\n/**\r\n * Creates a selector creator function with the specified memoization\r\n * function and options for customizing memoization behavior.\r\n *\r\n * @param memoizeOrOptions - Either A `memoize` function or an `options` object containing the `memoize` function.\r\n * @param memoizeOptionsFromArgs - Optional configuration options for the memoization function. These options are then passed to the memoize function as the second argument onwards.\r\n * @returns A customized `createSelector` function.\r\n *\r\n * @template MemoizeFunction - The type of the memoize function that is used to memoize the `resultFunc` inside `createSelector` (e.g., `lruMemoize` or `weakMapMemoize`).\r\n * @template ArgsMemoizeFunction - The type of the optional memoize function that is used to memoize the arguments passed into the output selector generated by `createSelector` (e.g., `lruMemoize` or `weakMapMemoize`). If none is explicitly provided, `weakMapMemoize` will be used.\r\n * @template MemoizeOrOptions - The type of the first argument. It can either be a `memoize` function or an `options` object containing the `memoize` function.\r\n */\r\nexport function createSelectorCreator<\r\n MemoizeFunction extends UnknownMemoizer,\r\n ArgsMemoizeFunction extends UnknownMemoizer,\r\n MemoizeOrOptions extends\r\n | MemoizeFunction\r\n | SetRequired<\r\n CreateSelectorOptions,\r\n 'memoize'\r\n >\r\n>(\r\n memoizeOrOptions: MemoizeOrOptions,\r\n ...memoizeOptionsFromArgs: MemoizeOrOptions extends SetRequired<\r\n CreateSelectorOptions,\r\n 'memoize'\r\n >\r\n ? never\r\n : DropFirstParameter\r\n) {\r\n /** options initially passed into `createSelectorCreator`. */\r\n const createSelectorCreatorOptions: SetRequired<\r\n CreateSelectorOptions,\r\n 'memoize'\r\n > = typeof memoizeOrOptions === 'function'\r\n ? {\r\n memoize: memoizeOrOptions as MemoizeFunction,\r\n memoizeOptions: memoizeOptionsFromArgs\r\n }\r\n : memoizeOrOptions\r\n\r\n const createSelector = <\r\n InputSelectors extends SelectorArray,\r\n Result,\r\n OverrideMemoizeFunction extends UnknownMemoizer = MemoizeFunction,\r\n OverrideArgsMemoizeFunction extends UnknownMemoizer = ArgsMemoizeFunction\r\n >(\r\n ...createSelectorArgs: [\r\n ...inputSelectors: [...InputSelectors],\r\n combiner: Combiner,\r\n createSelectorOptions?: CreateSelectorOptions<\r\n MemoizeFunction,\r\n ArgsMemoizeFunction,\r\n OverrideMemoizeFunction,\r\n OverrideArgsMemoizeFunction\r\n >\r\n ]\r\n ) => {\r\n let recomputations = 0\r\n let dependencyRecomputations = 0\r\n let lastResult: Result\r\n\r\n // Due to the intricacies of rest params, we can't do an optional arg after `...createSelectorArgs`.\r\n // So, start by declaring the default value here.\r\n // (And yes, the words 'memoize' and 'options' appear too many times in this next sequence.)\r\n let directlyPassedOptions: CreateSelectorOptions<\r\n MemoizeFunction,\r\n ArgsMemoizeFunction,\r\n OverrideMemoizeFunction,\r\n OverrideArgsMemoizeFunction\r\n > = {}\r\n\r\n // Normally, the result func or \"combiner\" is the last arg\r\n let resultFunc = createSelectorArgs.pop() as\r\n | Combiner\r\n | CreateSelectorOptions<\r\n MemoizeFunction,\r\n ArgsMemoizeFunction,\r\n OverrideMemoizeFunction,\r\n OverrideArgsMemoizeFunction\r\n >\r\n\r\n // If the result func is actually an _object_, assume it's our options object\r\n if (typeof resultFunc === 'object') {\r\n directlyPassedOptions = resultFunc\r\n // and pop the real result func off\r\n resultFunc = createSelectorArgs.pop() as Combiner\r\n }\r\n\r\n assertIsFunction(\r\n resultFunc,\r\n `createSelector expects an output function after the inputs, but received: [${typeof resultFunc}]`\r\n )\r\n\r\n // Determine which set of options we're using. Prefer options passed directly,\r\n // but fall back to options given to `createSelectorCreator`.\r\n const combinedOptions = {\r\n ...createSelectorCreatorOptions,\r\n ...directlyPassedOptions\r\n }\r\n\r\n const {\r\n memoize,\r\n memoizeOptions = [],\r\n argsMemoize = weakMapMemoize,\r\n argsMemoizeOptions = [],\r\n devModeChecks = {}\r\n } = combinedOptions\r\n\r\n // Simplifying assumption: it's unlikely that the first options arg of the provided memoizer\r\n // is an array. In most libs I've looked at, it's an equality function or options object.\r\n // Based on that, if `memoizeOptions` _is_ an array, we assume it's a full\r\n // user-provided array of options. Otherwise, it must be just the _first_ arg, and so\r\n // we wrap it in an array so we can apply it.\r\n const finalMemoizeOptions = ensureIsArray(memoizeOptions)\r\n const finalArgsMemoizeOptions = ensureIsArray(argsMemoizeOptions)\r\n const dependencies = getDependencies(createSelectorArgs) as InputSelectors\r\n\r\n const memoizedResultFunc = memoize(function recomputationWrapper() {\r\n recomputations++\r\n // apply arguments instead of spreading for performance.\r\n // @ts-ignore\r\n return (resultFunc as Combiner).apply(\r\n null,\r\n arguments as unknown as Parameters>\r\n )\r\n }, ...finalMemoizeOptions) as Combiner &\r\n ExtractMemoizerFields\r\n\r\n let firstRun = true\r\n\r\n // If a selector is called with the exact same arguments we don't need to traverse our dependencies again.\r\n const selector = argsMemoize(function dependenciesChecker() {\r\n dependencyRecomputations++\r\n /** Return values of input selectors which the `resultFunc` takes as arguments. */\r\n const inputSelectorResults = collectInputSelectorResults(\r\n dependencies,\r\n arguments\r\n )\r\n\r\n // apply arguments instead of spreading for performance.\r\n // @ts-ignore\r\n lastResult = memoizedResultFunc.apply(null, inputSelectorResults)\r\n\r\n if (process.env.NODE_ENV !== 'production') {\r\n const { identityFunctionCheck, inputStabilityCheck } =\r\n getDevModeChecksExecutionInfo(firstRun, devModeChecks)\r\n if (identityFunctionCheck.shouldRun) {\r\n identityFunctionCheck.run(\r\n resultFunc as Combiner,\r\n inputSelectorResults,\r\n lastResult\r\n )\r\n }\r\n\r\n if (inputStabilityCheck.shouldRun) {\r\n // make a second copy of the params, to check if we got the same results\r\n const inputSelectorResultsCopy = collectInputSelectorResults(\r\n dependencies,\r\n arguments\r\n )\r\n\r\n inputStabilityCheck.run(\r\n { inputSelectorResults, inputSelectorResultsCopy },\r\n { memoize, memoizeOptions: finalMemoizeOptions },\r\n arguments\r\n )\r\n }\r\n\r\n if (firstRun) firstRun = false\r\n }\r\n\r\n return lastResult\r\n }, ...finalArgsMemoizeOptions) as unknown as Selector<\r\n GetStateFromSelectors,\r\n Result,\r\n GetParamsFromSelectors\r\n > &\r\n ExtractMemoizerFields\r\n\r\n return Object.assign(selector, {\r\n resultFunc,\r\n memoizedResultFunc,\r\n dependencies,\r\n dependencyRecomputations: () => dependencyRecomputations,\r\n resetDependencyRecomputations: () => {\r\n dependencyRecomputations = 0\r\n },\r\n lastResult: () => lastResult,\r\n recomputations: () => recomputations,\r\n resetRecomputations: () => {\r\n recomputations = 0\r\n },\r\n memoize,\r\n argsMemoize\r\n }) as OutputSelector<\r\n InputSelectors,\r\n Result,\r\n OverrideMemoizeFunction,\r\n OverrideArgsMemoizeFunction\r\n >\r\n }\r\n\r\n Object.assign(createSelector, {\r\n withTypes: () => createSelector\r\n })\r\n\r\n return createSelector as CreateSelectorFunction<\r\n MemoizeFunction,\r\n ArgsMemoizeFunction\r\n >\r\n}\r\n\r\n/**\r\n * Accepts one or more \"input selectors\" (either as separate arguments or a single array),\r\n * a single \"result function\" / \"combiner\", and an optional options object, and\r\n * generates a memoized selector function.\r\n *\r\n * @see {@link https://reselect.js.org/api/createSelector `createSelector`}\r\n *\r\n * @public\r\n */\r\nexport const createSelector =\r\n /* #__PURE__ */ createSelectorCreator(weakMapMemoize)\r\n","import { createSelector } from './createSelectorCreator'\r\n\r\nimport type { CreateSelectorFunction } from './createSelectorCreator'\r\nimport type {\r\n InterruptRecursion,\r\n ObjectValuesToTuple,\r\n OutputSelector,\r\n Selector,\r\n Simplify,\r\n UnknownMemoizer\r\n} from './types'\r\nimport { assertIsObject } from './utils'\r\nimport type { weakMapMemoize } from './weakMapMemoize'\r\n\r\n/**\r\n * Represents a mapping of selectors to their return types.\r\n *\r\n * @template TObject - An object type where each property is a selector function.\r\n *\r\n * @public\r\n */\r\nexport type SelectorResultsMap = {\r\n [Key in keyof TObject]: ReturnType\r\n}\r\n\r\n/**\r\n * Represents a mapping of selectors for each key in a given root state.\r\n *\r\n * This type is a utility that takes a root state object type and\r\n * generates a corresponding set of selectors. Each selector is associated\r\n * with a key in the root state, allowing for the selection\r\n * of specific parts of the state.\r\n *\r\n * @template RootState - The type of the root state object.\r\n *\r\n * @since 5.0.0\r\n * @public\r\n */\r\nexport type RootStateSelectors = {\r\n [Key in keyof RootState]: Selector\r\n}\r\n\r\n/**\r\n * @deprecated Please use {@linkcode StructuredSelectorCreator.withTypes createStructuredSelector.withTypes()} instead. This type will be removed in the future.\r\n * @template RootState - The type of the root state object.\r\n *\r\n * @since 5.0.0\r\n * @public\r\n */\r\nexport type TypedStructuredSelectorCreator =\r\n /**\r\n * A convenience function that simplifies returning an object\r\n * made up of selector results.\r\n *\r\n * @param inputSelectorsObject - A key value pair consisting of input selectors.\r\n * @param selectorCreator - A custom selector creator function. It defaults to `createSelector`.\r\n * @returns A memoized structured selector.\r\n *\r\n * @example\r\n * Modern Use Case\r\n * ```ts\r\n * import { createSelector, createStructuredSelector } from 'reselect'\r\n *\r\n * interface RootState {\r\n * todos: {\r\n * id: number\r\n * completed: boolean\r\n * title: string\r\n * description: string\r\n * }[]\r\n * alerts: { id: number; read: boolean }[]\r\n * }\r\n *\r\n * // This:\r\n * const structuredSelector = createStructuredSelector(\r\n * {\r\n * todos: (state: RootState) => state.todos,\r\n * alerts: (state: RootState) => state.alerts,\r\n * todoById: (state: RootState, id: number) => state.todos[id]\r\n * },\r\n * createSelector\r\n * )\r\n *\r\n * // Is essentially the same as this:\r\n * const selector = createSelector(\r\n * [\r\n * (state: RootState) => state.todos,\r\n * (state: RootState) => state.alerts,\r\n * (state: RootState, id: number) => state.todos[id]\r\n * ],\r\n * (todos, alerts, todoById) => {\r\n * return {\r\n * todos,\r\n * alerts,\r\n * todoById\r\n * }\r\n * }\r\n * )\r\n * ```\r\n *\r\n * @example\r\n * In your component:\r\n * ```tsx\r\n * import type { RootState } from 'createStructuredSelector/modernUseCase'\r\n * import { structuredSelector } from 'createStructuredSelector/modernUseCase'\r\n * import type { FC } from 'react'\r\n * import { useSelector } from 'react-redux'\r\n *\r\n * interface Props {\r\n * id: number\r\n * }\r\n *\r\n * const MyComponent: FC = ({ id }) => {\r\n * const { todos, alerts, todoById } = useSelector((state: RootState) =>\r\n * structuredSelector(state, id)\r\n * )\r\n *\r\n * return (\r\n *
\r\n * Next to do is:\r\n *

{todoById.title}

\r\n *

Description: {todoById.description}

\r\n *
    \r\n *

    All other to dos:

    \r\n * {todos.map(todo => (\r\n *
  • {todo.title}
  • \r\n * ))}\r\n *
\r\n *
\r\n * )\r\n * }\r\n * ```\r\n *\r\n * @example\r\n * Simple Use Case\r\n * ```ts\r\n * const selectA = state => state.a\r\n * const selectB = state => state.b\r\n *\r\n * // The result function in the following selector\r\n * // is simply building an object from the input selectors\r\n * const structuredSelector = createSelector(selectA, selectB, (a, b) => ({\r\n * a,\r\n * b\r\n * }))\r\n *\r\n * const result = structuredSelector({ a: 1, b: 2 }) // will produce { x: 1, y: 2 }\r\n * ```\r\n *\r\n * @template InputSelectorsObject - The shape of the input selectors object.\r\n * @template MemoizeFunction - The type of the memoize function that is used to create the structured selector. It defaults to `weakMapMemoize`.\r\n * @template ArgsMemoizeFunction - The type of the of the memoize function that is used to memoize the arguments passed into the generated structured selector. It defaults to `weakMapMemoize`.\r\n *\r\n * @see {@link https://reselect.js.org/api/createStructuredSelector `createStructuredSelector`}\r\n */\r\n <\r\n InputSelectorsObject extends RootStateSelectors = RootStateSelectors,\r\n MemoizeFunction extends UnknownMemoizer = typeof weakMapMemoize,\r\n ArgsMemoizeFunction extends UnknownMemoizer = typeof weakMapMemoize\r\n >(\r\n inputSelectorsObject: InputSelectorsObject,\r\n selectorCreator?: CreateSelectorFunction<\r\n MemoizeFunction,\r\n ArgsMemoizeFunction\r\n >\r\n ) => OutputSelector<\r\n ObjectValuesToTuple,\r\n Simplify>,\r\n MemoizeFunction,\r\n ArgsMemoizeFunction\r\n > &\r\n InterruptRecursion\r\n\r\n/**\r\n * Represents an object where each property is a selector function.\r\n *\r\n * @template StateType - The type of state that all the selectors operate on.\r\n *\r\n * @public\r\n */\r\nexport type SelectorsObject = Record<\r\n string,\r\n Selector\r\n>\r\n\r\n/**\r\n * It provides a way to create structured selectors.\r\n * The structured selector can take multiple input selectors\r\n * and map their output to an object with specific keys.\r\n *\r\n * @template StateType - The type of state that the structured selectors created with this structured selector creator will operate on.\r\n *\r\n * @see {@link https://reselect.js.org/api/createStructuredSelector `createStructuredSelector`}\r\n *\r\n * @public\r\n */\r\nexport interface StructuredSelectorCreator {\r\n /**\r\n * A convenience function that simplifies returning an object\r\n * made up of selector results.\r\n *\r\n * @param inputSelectorsObject - A key value pair consisting of input selectors.\r\n * @param selectorCreator - A custom selector creator function. It defaults to `createSelector`.\r\n * @returns A memoized structured selector.\r\n *\r\n * @example\r\n * Modern Use Case\r\n * ```ts\r\n * import { createSelector, createStructuredSelector } from 'reselect'\r\n *\r\n * interface RootState {\r\n * todos: {\r\n * id: number\r\n * completed: boolean\r\n * title: string\r\n * description: string\r\n * }[]\r\n * alerts: { id: number; read: boolean }[]\r\n * }\r\n *\r\n * // This:\r\n * const structuredSelector = createStructuredSelector(\r\n * {\r\n * todos: (state: RootState) => state.todos,\r\n * alerts: (state: RootState) => state.alerts,\r\n * todoById: (state: RootState, id: number) => state.todos[id]\r\n * },\r\n * createSelector\r\n * )\r\n *\r\n * // Is essentially the same as this:\r\n * const selector = createSelector(\r\n * [\r\n * (state: RootState) => state.todos,\r\n * (state: RootState) => state.alerts,\r\n * (state: RootState, id: number) => state.todos[id]\r\n * ],\r\n * (todos, alerts, todoById) => {\r\n * return {\r\n * todos,\r\n * alerts,\r\n * todoById\r\n * }\r\n * }\r\n * )\r\n * ```\r\n *\r\n * @example\r\n * In your component:\r\n * ```tsx\r\n * import type { RootState } from 'createStructuredSelector/modernUseCase'\r\n * import { structuredSelector } from 'createStructuredSelector/modernUseCase'\r\n * import type { FC } from 'react'\r\n * import { useSelector } from 'react-redux'\r\n *\r\n * interface Props {\r\n * id: number\r\n * }\r\n *\r\n * const MyComponent: FC = ({ id }) => {\r\n * const { todos, alerts, todoById } = useSelector((state: RootState) =>\r\n * structuredSelector(state, id)\r\n * )\r\n *\r\n * return (\r\n *
\r\n * Next to do is:\r\n *

{todoById.title}

\r\n *

Description: {todoById.description}

\r\n *
    \r\n *

    All other to dos:

    \r\n * {todos.map(todo => (\r\n *
  • {todo.title}
  • \r\n * ))}\r\n *
\r\n *
\r\n * )\r\n * }\r\n * ```\r\n *\r\n * @example\r\n * Simple Use Case\r\n * ```ts\r\n * const selectA = state => state.a\r\n * const selectB = state => state.b\r\n *\r\n * // The result function in the following selector\r\n * // is simply building an object from the input selectors\r\n * const structuredSelector = createSelector(selectA, selectB, (a, b) => ({\r\n * a,\r\n * b\r\n * }))\r\n *\r\n * const result = structuredSelector({ a: 1, b: 2 }) // will produce { x: 1, y: 2 }\r\n * ```\r\n *\r\n * @template InputSelectorsObject - The shape of the input selectors object.\r\n * @template MemoizeFunction - The type of the memoize function that is used to create the structured selector. It defaults to `weakMapMemoize`.\r\n * @template ArgsMemoizeFunction - The type of the of the memoize function that is used to memoize the arguments passed into the generated structured selector. It defaults to `weakMapMemoize`.\r\n *\r\n * @see {@link https://reselect.js.org/api/createStructuredSelector `createStructuredSelector`}\r\n */\r\n <\r\n InputSelectorsObject extends SelectorsObject,\r\n MemoizeFunction extends UnknownMemoizer = typeof weakMapMemoize,\r\n ArgsMemoizeFunction extends UnknownMemoizer = typeof weakMapMemoize\r\n >(\r\n inputSelectorsObject: InputSelectorsObject,\r\n selectorCreator?: CreateSelectorFunction<\r\n MemoizeFunction,\r\n ArgsMemoizeFunction\r\n >\r\n ): OutputSelector<\r\n ObjectValuesToTuple,\r\n Simplify>,\r\n MemoizeFunction,\r\n ArgsMemoizeFunction\r\n > &\r\n InterruptRecursion\r\n\r\n /**\r\n * Creates a \"pre-typed\" version of\r\n * {@linkcode createStructuredSelector createStructuredSelector}\r\n * where the `state` type is predefined.\r\n *\r\n * This allows you to set the `state` type once, eliminating the need to\r\n * specify it with every\r\n * {@linkcode createStructuredSelector createStructuredSelector} call.\r\n *\r\n * @returns A pre-typed `createStructuredSelector` with the state type already defined.\r\n *\r\n * @example\r\n * ```ts\r\n * import { createStructuredSelector } from 'reselect'\r\n *\r\n * export interface RootState {\r\n * todos: { id: number; completed: boolean }[]\r\n * alerts: { id: number; read: boolean }[]\r\n * }\r\n *\r\n * export const createStructuredAppSelector =\r\n * createStructuredSelector.withTypes()\r\n *\r\n * const structuredAppSelector = createStructuredAppSelector({\r\n * // Type of `state` is set to `RootState`, no need to manually set the type\r\n * todos: state => state.todos,\r\n * alerts: state => state.alerts,\r\n * todoById: (state, id: number) => state.todos[id]\r\n * })\r\n *\r\n * ```\r\n * @template OverrideStateType - The specific type of state used by all structured selectors created with this structured selector creator.\r\n *\r\n * @see {@link https://reselect.js.org/api/createstructuredselector#defining-a-pre-typed-createstructuredselector `createSelector.withTypes`}\r\n *\r\n * @since 5.1.0\r\n */\r\n withTypes: <\r\n OverrideStateType extends StateType\r\n >() => StructuredSelectorCreator\r\n}\r\n\r\n/**\r\n * A convenience function that simplifies returning an object\r\n * made up of selector results.\r\n *\r\n * @param inputSelectorsObject - A key value pair consisting of input selectors.\r\n * @param selectorCreator - A custom selector creator function. It defaults to `createSelector`.\r\n * @returns A memoized structured selector.\r\n *\r\n * @example\r\n * Modern Use Case\r\n * ```ts\r\n * import { createSelector, createStructuredSelector } from 'reselect'\r\n *\r\n * interface RootState {\r\n * todos: {\r\n * id: number\r\n * completed: boolean\r\n * title: string\r\n * description: string\r\n * }[]\r\n * alerts: { id: number; read: boolean }[]\r\n * }\r\n *\r\n * // This:\r\n * const structuredSelector = createStructuredSelector(\r\n * {\r\n * todos: (state: RootState) => state.todos,\r\n * alerts: (state: RootState) => state.alerts,\r\n * todoById: (state: RootState, id: number) => state.todos[id]\r\n * },\r\n * createSelector\r\n * )\r\n *\r\n * // Is essentially the same as this:\r\n * const selector = createSelector(\r\n * [\r\n * (state: RootState) => state.todos,\r\n * (state: RootState) => state.alerts,\r\n * (state: RootState, id: number) => state.todos[id]\r\n * ],\r\n * (todos, alerts, todoById) => {\r\n * return {\r\n * todos,\r\n * alerts,\r\n * todoById\r\n * }\r\n * }\r\n * )\r\n * ```\r\n *\r\n * @see {@link https://reselect.js.org/api/createStructuredSelector `createStructuredSelector`}\r\n *\r\n * @public\r\n */\r\nexport const createStructuredSelector: StructuredSelectorCreator =\r\n Object.assign(\r\n <\r\n InputSelectorsObject extends SelectorsObject,\r\n MemoizeFunction extends UnknownMemoizer = typeof weakMapMemoize,\r\n ArgsMemoizeFunction extends UnknownMemoizer = typeof weakMapMemoize\r\n >(\r\n inputSelectorsObject: InputSelectorsObject,\r\n selectorCreator: CreateSelectorFunction<\r\n MemoizeFunction,\r\n ArgsMemoizeFunction\r\n > = createSelector as CreateSelectorFunction<\r\n MemoizeFunction,\r\n ArgsMemoizeFunction\r\n >\r\n ) => {\r\n assertIsObject(\r\n inputSelectorsObject,\r\n 'createStructuredSelector expects first argument to be an object ' +\r\n `where each property is a selector, instead received a ${typeof inputSelectorsObject}`\r\n )\r\n const inputSelectorKeys = Object.keys(inputSelectorsObject)\r\n const dependencies = inputSelectorKeys.map(\r\n key => inputSelectorsObject[key]\r\n )\r\n const structuredSelector = selectorCreator(\r\n dependencies,\r\n (...inputSelectorResults: any[]) => {\r\n return inputSelectorResults.reduce((composition, value, index) => {\r\n composition[inputSelectorKeys[index]] = value\r\n return composition\r\n }, {})\r\n }\r\n )\r\n return structuredSelector\r\n },\r\n { withTypes: () => createStructuredSelector }\r\n ) as StructuredSelectorCreator\r\n"],"names":["assertIsFunction","func","errorMessage","arguments","length","undefined","concat","TypeError","ensureIsArray","item","Array","isArray","getDependencies","createSelectorArgs","dependencies","array","every","itemTypes","map","name","join","assertIsArrayOfFunctions","Symbol","Object","getPrototypeOf","Ref","WeakRef","constructor","value","deref","this","UNTERMINATED","TERMINATED","createCacheNode","s","v","o","p","weakMapMemoize","options","fnNode","resultEqualityCheck","lastResult","resultsCount","memoized","cacheNode","i","l","arg","objectCache","WeakMap","objectNode","get","set","primitiveCache","Map","primitiveNode","terminatedNode","result","apply","_lastResult$deref","_lastResult","_lastResult$deref2","lastResultValue","call","clearCache","resetResultsCount","createSelectorCreator","memoizeOrOptions","_len","memoizeOptionsFromArgs","_key2","createSelectorCreatorOptions","memoize","memoizeOptions","createSelector2","_len2","_key3","recomputations","dependencyRecomputations","directlyPassedOptions","resultFunc","pop","combinedOptions","_objectSpread","argsMemoize","argsMemoizeOptions","devModeChecks","finalMemoizeOptions","finalArgsMemoizeOptions","memoizedResultFunc","selector","inputSelectorResults","inputSelectorArgs","push","collectInputSelectorResults","assign","resetDependencyRecomputations","resetRecomputations","withTypes","createSelector","createStructuredSelector","inputSelectorsObject","selectorCreator","object","assertIsObject","inputSelectorKeys","keys","structuredSelector","key","_len3","_key4","reduce","composition","index"],"sourceRoot":""}