{"version":3,"sources":["../src/devModeChecks/identityFunctionCheck.ts","../src/devModeChecks/inputStabilityCheck.ts","../src/devModeChecks/setGlobalDevModeChecks.ts","../src/utils.ts","../src/autotrackMemoize/autotracking.ts","../src/autotrackMemoize/tracking.ts","../src/autotrackMemoize/proxy.ts","../src/lruMemoize.ts","../src/autotrackMemoize/autotrackMemoize.ts","../src/weakMapMemoize.ts","../src/createSelectorCreator.ts","../src/createStructuredSelector.ts"],"sourcesContent":["import type { AnyFunction } from '../types'\n\n/**\n * Runs a check to determine if the given result function behaves as an\n * identity function. An identity function is one that returns its\n * input unchanged, for example, `x => x`. This check helps ensure\n * efficient memoization and prevent unnecessary re-renders by encouraging\n * proper use of transformation logic in result functions and\n * extraction logic in input selectors.\n *\n * @param resultFunc - The result function to be checked.\n * @param inputSelectorsResults - The results of the input selectors.\n * @param outputSelectorResult - The result of the output selector.\n *\n * @see {@link https://reselect.js.org/api/development-only-stability-checks#identityfunctioncheck `identityFunctionCheck`}\n *\n * @since 5.0.0\n * @internal\n */\nexport const runIdentityFunctionCheck = (\n  resultFunc: AnyFunction,\n  inputSelectorsResults: unknown[],\n  outputSelectorResult: unknown\n) => {\n  if (\n    inputSelectorsResults.length === 1 &&\n    inputSelectorsResults[0] === outputSelectorResult\n  ) {\n    let isInputSameAsOutput = false\n    try {\n      const emptyObject = {}\n      if (resultFunc(emptyObject) === emptyObject) isInputSameAsOutput = true\n    } catch {\n      // Do nothing\n    }\n    if (isInputSameAsOutput) {\n      let stack: string | undefined = undefined\n      try {\n        throw new Error()\n      } catch (e) {\n        // eslint-disable-next-line @typescript-eslint/no-extra-semi, no-extra-semi\n        ;({ stack } = e as Error)\n      }\n      console.warn(\n        'The result function returned its own inputs without modification. e.g' +\n          '\\n`createSelector([state => state.todos], todos => todos)`' +\n          '\\nThis could lead to inefficient memoization and unnecessary re-renders.' +\n          '\\nEnsure transformation logic is in the result function, and extraction logic is in the input selectors.',\n        { stack }\n      )\n    }\n  }\n}\n","import type { CreateSelectorOptions, UnknownMemoizer } from '../types'\n\n/**\n * Runs a stability check to ensure the input selector results remain stable\n * when provided with the same arguments. This function is designed to detect\n * changes in the output of input selectors, which can impact the performance of memoized selectors.\n *\n * @param inputSelectorResultsObject - An object containing two arrays: `inputSelectorResults` and `inputSelectorResultsCopy`, representing the results of input selectors.\n * @param options - Options object consisting of a `memoize` function and a `memoizeOptions` object.\n * @param inputSelectorArgs - List of arguments being passed to the input selectors.\n *\n * @see {@link https://reselect.js.org/api/development-only-stability-checks/#inputstabilitycheck `inputStabilityCheck`}\n *\n * @since 5.0.0\n * @internal\n */\nexport const runInputStabilityCheck = (\n  inputSelectorResultsObject: {\n    inputSelectorResults: unknown[]\n    inputSelectorResultsCopy: unknown[]\n  },\n  options: Required<\n    Pick<\n      CreateSelectorOptions<UnknownMemoizer, UnknownMemoizer>,\n      'memoize' | 'memoizeOptions'\n    >\n  >,\n  inputSelectorArgs: unknown[] | IArguments\n) => {\n  const { memoize, memoizeOptions } = options\n  const { inputSelectorResults, inputSelectorResultsCopy } =\n    inputSelectorResultsObject\n  const createAnEmptyObject = memoize(() => ({}), ...memoizeOptions)\n  // if the memoize method thinks the parameters are equal, these *should* be the same reference\n  const areInputSelectorResultsEqual =\n    createAnEmptyObject.apply(null, inputSelectorResults) ===\n    createAnEmptyObject.apply(null, inputSelectorResultsCopy)\n  if (!areInputSelectorResultsEqual) {\n    let stack: string | undefined = undefined\n    try {\n      throw new Error()\n    } catch (e) {\n      // eslint-disable-next-line @typescript-eslint/no-extra-semi, no-extra-semi\n      ;({ stack } = e as Error)\n    }\n    console.warn(\n      'An input selector returned a different result when passed same arguments.' +\n        '\\nThis means your output selector will likely run more frequently than intended.' +\n        '\\nAvoid returning a new reference inside your input selector, e.g.' +\n        '\\n`createSelector([state => state.todos.map(todo => todo.id)], todoIds => todoIds.length)`',\n      {\n        arguments: inputSelectorArgs,\n        firstInputs: inputSelectorResults,\n        secondInputs: inputSelectorResultsCopy,\n        stack\n      }\n    )\n  }\n}\n","import type { DevModeChecks } from '../types'\n\n/**\n * Global configuration for development mode checks. This specifies the default\n * frequency at which each development mode check should be performed.\n *\n * @since 5.0.0\n * @internal\n */\nexport const globalDevModeChecks: DevModeChecks = {\n  inputStabilityCheck: 'once',\n  identityFunctionCheck: 'once'\n}\n\n/**\n * Overrides the development mode checks settings for all selectors.\n *\n * Reselect performs additional checks in development mode to help identify and\n * warn about potential issues in selector behavior. This function allows you to\n * customize the behavior of these checks across all selectors in your application.\n *\n * **Note**: This setting can still be overridden per selector inside `createSelector`'s `options` object.\n * See {@link https://github.com/reduxjs/reselect#2-per-selector-by-passing-an-identityfunctioncheck-option-directly-to-createselector per-selector-configuration}\n * and {@linkcode CreateSelectorOptions.identityFunctionCheck identityFunctionCheck} for more details.\n *\n * _The development mode checks do not run in production builds._\n *\n * @param devModeChecks - An object specifying the desired settings for development mode checks. You can provide partial overrides. Unspecified settings will retain their current values.\n *\n * @example\n * ```ts\n * import { setGlobalDevModeChecks } from 'reselect'\n * import { DevModeChecks } from '../types'\n *\n * // Run only the first time the selector is called. (default)\n * setGlobalDevModeChecks({ inputStabilityCheck: 'once' })\n *\n * // Run every time the selector is called.\n * setGlobalDevModeChecks({ inputStabilityCheck: 'always' })\n *\n * // Never run the input stability check.\n * setGlobalDevModeChecks({ inputStabilityCheck: 'never' })\n *\n * // Run only the first time the selector is called. (default)\n * setGlobalDevModeChecks({ identityFunctionCheck: 'once' })\n *\n * // Run every time the selector is called.\n * setGlobalDevModeChecks({ identityFunctionCheck: 'always' })\n *\n * // Never run the identity function check.\n * setGlobalDevModeChecks({ identityFunctionCheck: 'never' })\n * ```\n * @see {@link https://reselect.js.org/api/development-only-stability-checks Development-Only Stability Checks}\n * @see {@link https://reselect.js.org/api/development-only-stability-checks#1-globally-through-setglobaldevmodechecks global-configuration}\n *\n * @since 5.0.0\n * @public\n */\nexport const setGlobalDevModeChecks = (\n  devModeChecks: Partial<DevModeChecks>\n) => {\n  Object.assign(globalDevModeChecks, devModeChecks)\n}\n","import { runIdentityFunctionCheck } from './devModeChecks/identityFunctionCheck'\nimport { runInputStabilityCheck } from './devModeChecks/inputStabilityCheck'\nimport { globalDevModeChecks } from './devModeChecks/setGlobalDevModeChecks'\n// eslint-disable-next-line @typescript-eslint/consistent-type-imports\nimport type {\n  DevModeChecks,\n  Selector,\n  SelectorArray,\n  DevModeChecksExecutionInfo\n} from './types'\n\nexport const NOT_FOUND = /* @__PURE__ */ Symbol('NOT_FOUND')\nexport type NOT_FOUND_TYPE = typeof NOT_FOUND\n\n/**\n * Assert that the provided value is a function. If the assertion fails,\n * a `TypeError` is thrown with an optional custom error message.\n *\n * @param func - The value to be checked.\n * @param  errorMessage - An optional custom error message to use if the assertion fails.\n * @throws A `TypeError` if the assertion fails.\n */\nexport function assertIsFunction<FunctionType extends Function>(\n  func: unknown,\n  errorMessage = `expected a function, instead received ${typeof func}`\n): asserts func is FunctionType {\n  if (typeof func !== 'function') {\n    throw new TypeError(errorMessage)\n  }\n}\n\n/**\n * Assert that the provided value is an object. If the assertion fails,\n * a `TypeError` is thrown with an optional custom error message.\n *\n * @param object - The value to be checked.\n * @param  errorMessage - An optional custom error message to use if the assertion fails.\n * @throws A `TypeError` if the assertion fails.\n */\nexport function assertIsObject<ObjectType extends Record<string, unknown>>(\n  object: unknown,\n  errorMessage = `expected an object, instead received ${typeof object}`\n): asserts object is ObjectType {\n  if (typeof object !== 'object') {\n    throw new TypeError(errorMessage)\n  }\n}\n\n/**\n * Assert that the provided array is an array of functions. If the assertion fails,\n * a `TypeError` is thrown with an optional custom error message.\n *\n * @param array - The array to be checked.\n * @param  errorMessage - An optional custom error message to use if the assertion fails.\n * @throws A `TypeError` if the assertion fails.\n */\nexport function assertIsArrayOfFunctions<FunctionType extends Function>(\n  array: unknown[],\n  errorMessage = `expected all items to be functions, instead received the following types: `\n): asserts array is FunctionType[] {\n  if (\n    !array.every((item): item is FunctionType => typeof item === 'function')\n  ) {\n    const itemTypes = array\n      .map(item =>\n        typeof item === 'function'\n          ? `function ${item.name || 'unnamed'}()`\n          : typeof item\n      )\n      .join(', ')\n    throw new TypeError(`${errorMessage}[${itemTypes}]`)\n  }\n}\n\n/**\n * Ensure that the input is an array. If it's already an array, it's returned as is.\n * If it's not an array, it will be wrapped in a new array.\n *\n * @param item - The item to be checked.\n * @returns An array containing the input item. If the input is already an array, it's returned without modification.\n */\nexport const ensureIsArray = (item: unknown) => {\n  return Array.isArray(item) ? item : [item]\n}\n\n/**\n * Extracts the \"dependencies\" / \"input selectors\" from the arguments of `createSelector`.\n *\n * @param createSelectorArgs - Arguments passed to `createSelector` as an array.\n * @returns An array of \"input selectors\" / \"dependencies\".\n * @throws A `TypeError` if any of the input selectors is not function.\n */\nexport function getDependencies(createSelectorArgs: unknown[]) {\n  const dependencies = Array.isArray(createSelectorArgs[0])\n    ? createSelectorArgs[0]\n    : createSelectorArgs\n\n  assertIsArrayOfFunctions<Selector>(\n    dependencies,\n    `createSelector expects all input-selectors to be functions, but received the following types: `\n  )\n\n  return dependencies as SelectorArray\n}\n\n/**\n * Runs each input selector and returns their collective results as an array.\n *\n * @param dependencies - An array of \"dependencies\" or \"input selectors\".\n * @param inputSelectorArgs - An array of arguments being passed to the input selectors.\n * @returns An array of input selector results.\n */\nexport function collectInputSelectorResults(\n  dependencies: SelectorArray,\n  inputSelectorArgs: unknown[] | IArguments\n) {\n  const inputSelectorResults = []\n  const { length } = dependencies\n  for (let i = 0; i < length; i++) {\n    // @ts-ignore\n    // apply arguments instead of spreading and mutate a local list of params for performance.\n    inputSelectorResults.push(dependencies[i].apply(null, inputSelectorArgs))\n  }\n  return inputSelectorResults\n}\n\n/**\n * Retrieves execution information for development mode checks.\n *\n * @param devModeChecks - Custom Settings for development mode checks. These settings will override the global defaults.\n * @param firstRun - Indicates whether it is the first time the selector has run.\n * @returns  An object containing the execution information for each development mode check.\n */\nexport const getDevModeChecksExecutionInfo = (\n  firstRun: boolean,\n  devModeChecks: Partial<DevModeChecks>\n) => {\n  const { identityFunctionCheck, inputStabilityCheck } = {\n    ...globalDevModeChecks,\n    ...devModeChecks\n  }\n  return {\n    identityFunctionCheck: {\n      shouldRun:\n        identityFunctionCheck === 'always' ||\n        (identityFunctionCheck === 'once' && firstRun),\n      run: runIdentityFunctionCheck\n    },\n    inputStabilityCheck: {\n      shouldRun:\n        inputStabilityCheck === 'always' ||\n        (inputStabilityCheck === 'once' && firstRun),\n      run: runInputStabilityCheck\n    }\n  } satisfies DevModeChecksExecutionInfo\n}\n","// Original autotracking implementation source:\n// - https://gist.github.com/pzuraq/79bf862e0f8cd9521b79c4b6eccdc4f9\n// Additional references:\n// - https://www.pzuraq.com/blog/how-autotracking-works\n// - https://v5.chriskrycho.com/journal/autotracking-elegant-dx-via-cutting-edge-cs/\nimport type { EqualityFn } from '../types'\nimport { assertIsFunction } from '../utils'\n\n// The global revision clock. Every time state changes, the clock increments.\nexport let $REVISION = 0\n\n// The current dependency tracker. Whenever we compute a cache, we create a Set\n// to track any dependencies that are used while computing. If no cache is\n// computing, then the tracker is null.\nlet CURRENT_TRACKER: Set<Cell<any> | TrackingCache> | null = null\n\n// Storage represents a root value in the system - the actual state of our app.\nexport class Cell<T> {\n  revision = $REVISION\n\n  _value: T\n  _lastValue: T\n  _isEqual: EqualityFn = tripleEq\n\n  constructor(initialValue: T, isEqual: EqualityFn = tripleEq) {\n    this._value = this._lastValue = initialValue\n    this._isEqual = isEqual\n  }\n\n  // Whenever a storage value is read, it'll add itself to the current tracker if\n  // one exists, entangling its state with that cache.\n  get value() {\n    CURRENT_TRACKER?.add(this)\n\n    return this._value\n  }\n\n  // Whenever a storage value is updated, we bump the global revision clock,\n  // assign the revision for this storage to the new value, _and_ we schedule a\n  // rerender. This is important, and it's what makes autotracking  _pull_\n  // based. We don't actively tell the caches which depend on the storage that\n  // anything has happened. Instead, we recompute the caches when needed.\n  set value(newValue) {\n    if (this.value === newValue) return\n\n    this._value = newValue\n    this.revision = ++$REVISION\n  }\n}\n\nfunction tripleEq(a: unknown, b: unknown) {\n  return a === b\n}\n\n// Caches represent derived state in the system. They are ultimately functions\n// that are memoized based on what state they use to produce their output,\n// meaning they will only rerun IFF a storage value that could affect the output\n// has changed. Otherwise, they'll return the cached value.\nexport class TrackingCache {\n  _cachedValue: any\n  _cachedRevision = -1\n  _deps: any[] = []\n  hits = 0\n\n  fn: () => any\n\n  constructor(fn: () => any) {\n    this.fn = fn\n  }\n\n  clear() {\n    this._cachedValue = undefined\n    this._cachedRevision = -1\n    this._deps = []\n    this.hits = 0\n  }\n\n  get value() {\n    // When getting the value for a Cache, first we check all the dependencies of\n    // the cache to see what their current revision is. If the current revision is\n    // greater than the cached revision, then something has changed.\n    if (this.revision > this._cachedRevision) {\n      const { fn } = this\n\n      // We create a new dependency tracker for this cache. As the cache runs\n      // its function, any Storage or Cache instances which are used while\n      // computing will be added to this tracker. In the end, it will be the\n      // full list of dependencies that this Cache depends on.\n      const currentTracker = new Set<Cell<any>>()\n      const prevTracker = CURRENT_TRACKER\n\n      CURRENT_TRACKER = currentTracker\n\n      // try {\n      this._cachedValue = fn()\n      // } finally {\n      CURRENT_TRACKER = prevTracker\n      this.hits++\n      this._deps = Array.from(currentTracker)\n\n      // Set the cached revision. This is the current clock count of all the\n      // dependencies. If any dependency changes, this number will be less\n      // than the new revision.\n      this._cachedRevision = this.revision\n      // }\n    }\n\n    // If there is a current tracker, it means another Cache is computing and\n    // using this one, so we add this one to the tracker.\n    CURRENT_TRACKER?.add(this)\n\n    // Always return the cached value.\n    return this._cachedValue\n  }\n\n  get revision() {\n    // The current revision is the max of all the dependencies' revisions.\n    return Math.max(...this._deps.map(d => d.revision), 0)\n  }\n}\n\nexport function getValue<T>(cell: Cell<T>): T {\n  if (!(cell instanceof Cell)) {\n    console.warn('Not a valid cell! ', cell)\n  }\n\n  return cell.value\n}\n\ntype CellValue<T extends Cell<unknown>> = T extends Cell<infer U> ? U : never\n\nexport function setValue<T extends Cell<unknown>>(\n  storage: T,\n  value: CellValue<T>\n): void {\n  if (!(storage instanceof Cell)) {\n    throw new TypeError(\n      'setValue must be passed a tracked store created with `createStorage`.'\n    )\n  }\n\n  storage.value = storage._lastValue = value\n}\n\nexport function createCell<T = unknown>(\n  initialValue: T,\n  isEqual: EqualityFn = tripleEq\n): Cell<T> {\n  return new Cell(initialValue, isEqual)\n}\n\nexport function createCache<T = unknown>(fn: () => T): TrackingCache {\n  assertIsFunction(\n    fn,\n    'the first parameter to `createCache` must be a function'\n  )\n\n  return new TrackingCache(fn)\n}\n","import type { Cell } from './autotracking'\nimport {\n  getValue as consumeTag,\n  createCell as createStorage,\n  setValue\n} from './autotracking'\n\nexport type Tag = Cell<unknown>\n\nconst neverEq = (a: any, b: any): boolean => false\n\nexport function createTag(): Tag {\n  return createStorage(null, neverEq)\n}\nexport { consumeTag }\nexport function dirtyTag(tag: Tag, value: any): void {\n  setValue(tag, value)\n}\n\nexport interface Node<\n  T extends Array<unknown> | Record<string, unknown> =\n    | Array<unknown>\n    | Record<string, unknown>\n> {\n  collectionTag: Tag | null\n  tag: Tag | null\n  tags: Record<string, Tag>\n  children: Record<string, Node>\n  proxy: T\n  value: T\n  id: number\n}\n\nexport const consumeCollection = (node: Node): void => {\n  let tag = node.collectionTag\n\n  if (tag === null) {\n    tag = node.collectionTag = createTag()\n  }\n\n  consumeTag(tag)\n}\n\nexport const dirtyCollection = (node: Node): void => {\n  const tag = node.collectionTag\n\n  if (tag !== null) {\n    dirtyTag(tag, null)\n  }\n}\n","// Original source:\n// - https://github.com/simonihmig/tracked-redux/blob/master/packages/tracked-redux/src/-private/proxy.ts\n\nimport type { Node, Tag } from './tracking'\nimport {\n  consumeCollection,\n  consumeTag,\n  createTag,\n  dirtyCollection,\n  dirtyTag\n} from './tracking'\n\nexport const REDUX_PROXY_LABEL = /* @__PURE__ */ Symbol()\n\nlet nextId = 0\n\nconst proto = /* @__PURE__ */ Object.getPrototypeOf({})\n\nclass ObjectTreeNode<T extends Record<string, unknown>> implements Node<T> {\n  proxy: T = new Proxy(this, objectProxyHandler) as unknown as T\n  tag = createTag()\n  tags = {} as Record<string, Tag>\n  children = {} as Record<string, Node>\n  collectionTag = null\n  id = nextId++\n\n  constructor(public value: T) {\n    this.value = value\n    this.tag.value = value\n  }\n}\n\nconst objectProxyHandler = {\n  get(node: Node, key: string | symbol): unknown {\n    function calculateResult() {\n      const { value } = node\n\n      const childValue = Reflect.get(value, key)\n\n      if (typeof key === 'symbol') {\n        return childValue\n      }\n\n      if (key in proto) {\n        return childValue\n      }\n\n      if (typeof childValue === 'object' && childValue !== null) {\n        let childNode = node.children[key]\n\n        if (childNode === undefined) {\n          childNode = node.children[key] = createNode(childValue)\n        }\n\n        if (childNode.tag) {\n          consumeTag(childNode.tag)\n        }\n\n        return childNode.proxy\n      } else {\n        let tag = node.tags[key]\n\n        if (tag === undefined) {\n          tag = node.tags[key] = createTag()\n          tag.value = childValue\n        }\n\n        consumeTag(tag)\n\n        return childValue\n      }\n    }\n    const res = calculateResult()\n    return res\n  },\n\n  ownKeys(node: Node): ArrayLike<string | symbol> {\n    consumeCollection(node)\n    return Reflect.ownKeys(node.value)\n  },\n\n  getOwnPropertyDescriptor(\n    node: Node,\n    prop: string | symbol\n  ): PropertyDescriptor | undefined {\n    return Reflect.getOwnPropertyDescriptor(node.value, prop)\n  },\n\n  has(node: Node, prop: string | symbol): boolean {\n    return Reflect.has(node.value, prop)\n  }\n}\n\nclass ArrayTreeNode<T extends Array<unknown>> implements Node<T> {\n  proxy: T = new Proxy([this], arrayProxyHandler) as unknown as T\n  tag = createTag()\n  tags = {}\n  children = {}\n  collectionTag = null\n  id = nextId++\n\n  constructor(public value: T) {\n    this.value = value\n    this.tag.value = value\n  }\n}\n\nconst arrayProxyHandler = {\n  get([node]: [Node], key: string | symbol): unknown {\n    if (key === 'length') {\n      consumeCollection(node)\n    }\n\n    return objectProxyHandler.get(node, key)\n  },\n\n  ownKeys([node]: [Node]): ArrayLike<string | symbol> {\n    return objectProxyHandler.ownKeys(node)\n  },\n\n  getOwnPropertyDescriptor(\n    [node]: [Node],\n    prop: string | symbol\n  ): PropertyDescriptor | undefined {\n    return objectProxyHandler.getOwnPropertyDescriptor(node, prop)\n  },\n\n  has([node]: [Node], prop: string | symbol): boolean {\n    return objectProxyHandler.has(node, prop)\n  }\n}\n\nexport function createNode<T extends Array<unknown> | Record<string, unknown>>(\n  value: T\n): Node<T> {\n  if (Array.isArray(value)) {\n    return new ArrayTreeNode(value)\n  }\n\n  return new ObjectTreeNode(value) as Node<T>\n}\n\nconst keysMap = new WeakMap<\n  Array<unknown> | Record<string, unknown>,\n  Set<string>\n>()\n\nexport function updateNode<T extends Array<unknown> | Record<string, unknown>>(\n  node: Node<T>,\n  newValue: T\n): void {\n  const { value, tags, children } = node\n\n  node.value = newValue\n\n  if (\n    Array.isArray(value) &&\n    Array.isArray(newValue) &&\n    value.length !== newValue.length\n  ) {\n    dirtyCollection(node)\n  } else {\n    if (value !== newValue) {\n      let oldKeysSize = 0\n      let newKeysSize = 0\n      let anyKeysAdded = false\n\n      for (const _key in value) {\n        oldKeysSize++\n      }\n\n      for (const key in newValue) {\n        newKeysSize++\n        if (!(key in value)) {\n          anyKeysAdded = true\n          break\n        }\n      }\n\n      const isDifferent = anyKeysAdded || oldKeysSize !== newKeysSize\n\n      if (isDifferent) {\n        dirtyCollection(node)\n      }\n    }\n  }\n\n  for (const key in tags) {\n    const childValue = (value as Record<string, unknown>)[key]\n    const newChildValue = (newValue as Record<string, unknown>)[key]\n\n    if (childValue !== newChildValue) {\n      dirtyCollection(node)\n      dirtyTag(tags[key], newChildValue)\n    }\n\n    if (typeof newChildValue === 'object' && newChildValue !== null) {\n      delete tags[key]\n    }\n  }\n\n  for (const key in children) {\n    const childNode = children[key]\n    const newChildValue = (newValue as Record<string, unknown>)[key]\n\n    const childValue = childNode.value\n\n    if (childValue === newChildValue) {\n      continue\n    } else if (typeof newChildValue === 'object' && newChildValue !== null) {\n      updateNode(childNode, newChildValue as Record<string, unknown>)\n    } else {\n      deleteNode(childNode)\n      delete children[key]\n    }\n  }\n}\n\nfunction deleteNode(node: Node): void {\n  if (node.tag) {\n    dirtyTag(node.tag, null)\n  }\n  dirtyCollection(node)\n  for (const key in node.tags) {\n    dirtyTag(node.tags[key], null)\n  }\n  for (const key in node.children) {\n    deleteNode(node.children[key])\n  }\n}\n","import type {\n  AnyFunction,\n  DefaultMemoizeFields,\n  EqualityFn,\n  Simplify\n} from './types'\n\nimport type { NOT_FOUND_TYPE } from './utils'\nimport { NOT_FOUND } from './utils'\n\n// Cache implementation based on Erik Rasmussen's `lru-memoize`:\n// https://github.com/erikras/lru-memoize\n\ninterface Entry {\n  key: unknown\n  value: unknown\n}\n\ninterface Cache {\n  get(key: unknown): unknown | NOT_FOUND_TYPE\n  put(key: unknown, value: unknown): void\n  getEntries(): Entry[]\n  clear(): void\n}\n\nfunction createSingletonCache(equals: EqualityFn): Cache {\n  let entry: Entry | undefined\n  return {\n    get(key: unknown) {\n      if (entry && equals(entry.key, key)) {\n        return entry.value\n      }\n\n      return NOT_FOUND\n    },\n\n    put(key: unknown, value: unknown) {\n      entry = { key, value }\n    },\n\n    getEntries() {\n      return entry ? [entry] : []\n    },\n\n    clear() {\n      entry = undefined\n    }\n  }\n}\n\nfunction createLruCache(maxSize: number, equals: EqualityFn): Cache {\n  let entries: Entry[] = []\n\n  function get(key: unknown) {\n    const cacheIndex = entries.findIndex(entry => equals(key, entry.key))\n\n    // We found a cached entry\n    if (cacheIndex > -1) {\n      const entry = entries[cacheIndex]\n\n      // Cached entry not at top of cache, move it to the top\n      if (cacheIndex > 0) {\n        entries.splice(cacheIndex, 1)\n        entries.unshift(entry)\n      }\n\n      return entry.value\n    }\n\n    // No entry found in cache, return sentinel\n    return NOT_FOUND\n  }\n\n  function put(key: unknown, value: unknown) {\n    if (get(key) === NOT_FOUND) {\n      // TODO Is unshift slow?\n      entries.unshift({ key, value })\n      if (entries.length > maxSize) {\n        entries.pop()\n      }\n    }\n  }\n\n  function getEntries() {\n    return entries\n  }\n\n  function clear() {\n    entries = []\n  }\n\n  return { get, put, getEntries, clear }\n}\n\n/**\n * Runs a simple reference equality check.\n * What {@linkcode lruMemoize lruMemoize} uses by default.\n *\n * **Note**: This function was previously known as `defaultEqualityCheck`.\n *\n * @public\n */\nexport const referenceEqualityCheck: EqualityFn = (a, b) => a === b\n\nexport function createCacheKeyComparator(equalityCheck: EqualityFn) {\n  return function areArgumentsShallowlyEqual(\n    prev: unknown[] | IArguments | null,\n    next: unknown[] | IArguments | null\n  ): boolean {\n    if (prev === null || next === null || prev.length !== next.length) {\n      return false\n    }\n\n    // Do this in a for loop (and not a `forEach` or an `every`) so we can determine equality as fast as possible.\n    const { length } = prev\n    for (let i = 0; i < length; i++) {\n      if (!equalityCheck(prev[i], next[i])) {\n        return false\n      }\n    }\n\n    return true\n  }\n}\n\n/**\n * Options for configuring the behavior of a function memoized with\n * LRU (Least Recently Used) caching.\n *\n * @template Result - The type of the return value of the memoized function.\n *\n * @public\n */\nexport interface LruMemoizeOptions<Result = any> {\n  /**\n   * Function used to compare the individual arguments of the\n   * provided calculation function.\n   *\n   * @default referenceEqualityCheck\n   */\n  equalityCheck?: EqualityFn\n\n  /**\n   * If provided, used to compare a newly generated output value against\n   * previous values in the cache. If a match is found,\n   * the old value is returned. This addresses the common\n   * ```ts\n   * todos.map(todo => todo.id)\n   * ```\n   * use case, where an update to another field in the original data causes\n   * a recalculation due to changed references, but the output is still\n   * effectively the same.\n   *\n   * @since 4.1.0\n   */\n  resultEqualityCheck?: EqualityFn<Result>\n\n  /**\n   * The maximum size of the cache used by the selector.\n   * A size greater than 1 means the selector will use an\n   * LRU (Least Recently Used) cache, allowing for the caching of multiple\n   * results based on different sets of arguments.\n   *\n   * @default 1\n   */\n  maxSize?: number\n}\n\n/**\n * Creates a memoized version of a function with an optional\n * LRU (Least Recently Used) cache. The memoized function uses a cache to\n * store computed values. Depending on the `maxSize` option, it will use\n * either a singleton cache (for a single entry) or an\n * LRU cache (for multiple entries).\n *\n * **Note**: This function was previously known as `defaultMemoize`.\n *\n * @param func - The function to be memoized.\n * @param equalityCheckOrOptions - Either an equality check function or an options object.\n * @returns A memoized function with a `.clearCache()` method attached.\n *\n * @template Func - The type of the function that is memoized.\n *\n * @see {@link https://reselect.js.org/api/lruMemoize `lruMemoize`}\n *\n * @public\n */\nexport function lruMemoize<Func extends AnyFunction>(\n  func: Func,\n  equalityCheckOrOptions?: EqualityFn | LruMemoizeOptions<ReturnType<Func>>\n) {\n  const providedOptions =\n    typeof equalityCheckOrOptions === 'object'\n      ? equalityCheckOrOptions\n      : { equalityCheck: equalityCheckOrOptions }\n\n  const {\n    equalityCheck = referenceEqualityCheck,\n    maxSize = 1,\n    resultEqualityCheck\n  } = providedOptions\n\n  const comparator = createCacheKeyComparator(equalityCheck)\n\n  let resultsCount = 0\n\n  const cache =\n    maxSize <= 1\n      ? createSingletonCache(comparator)\n      : createLruCache(maxSize, comparator)\n\n  function memoized() {\n    let value = cache.get(arguments) as ReturnType<Func>\n    if (value === NOT_FOUND) {\n      // apply arguments instead of spreading for performance.\n      // @ts-ignore\n      value = func.apply(null, arguments) as ReturnType<Func>\n      resultsCount++\n\n      if (resultEqualityCheck) {\n        const entries = cache.getEntries()\n        const matchingEntry = entries.find(entry =>\n          resultEqualityCheck(entry.value as ReturnType<Func>, value)\n        )\n\n        if (matchingEntry) {\n          value = matchingEntry.value as ReturnType<Func>\n          resultsCount !== 0 && resultsCount--\n        }\n      }\n\n      cache.put(arguments, value)\n    }\n    return value\n  }\n\n  memoized.clearCache = () => {\n    cache.clear()\n    memoized.resetResultsCount()\n  }\n\n  memoized.resultsCount = () => resultsCount\n\n  memoized.resetResultsCount = () => {\n    resultsCount = 0\n  }\n\n  return memoized as Func & Simplify<DefaultMemoizeFields>\n}\n","import { createNode, updateNode } from './proxy'\nimport type { Node } from './tracking'\n\nimport { createCacheKeyComparator, referenceEqualityCheck } from '../lruMemoize'\nimport type { AnyFunction, DefaultMemoizeFields, Simplify } from '../types'\nimport { createCache } from './autotracking'\n\n/**\n * Uses an \"auto-tracking\" approach inspired by the work of the Ember Glimmer team.\n * It uses a Proxy to wrap arguments and track accesses to nested fields\n * in your selector on first read. Later, when the selector is called with\n * new arguments, it identifies which accessed fields have changed and\n * only recalculates the result if one or more of those accessed fields have changed.\n * This allows it to be more precise than the shallow equality checks in `lruMemoize`.\n *\n * __Design Tradeoffs for `autotrackMemoize`:__\n * - Pros:\n *    - It is likely to avoid excess calculations and recalculate fewer times than `lruMemoize` will,\n *    which may also result in fewer component re-renders.\n * - Cons:\n *    - It only has a cache size of 1.\n *    - It is slower than `lruMemoize`, because it has to do more work. (How much slower is dependent on the number of accessed fields in a selector, number of calls, frequency of input changes, etc)\n *    - It can have some unexpected behavior. Because it tracks nested field accesses,\n *    cases where you don't access a field will not recalculate properly.\n *    For example, a badly-written selector like:\n *      ```ts\n *      createSelector([state => state.todos], todos => todos)\n *      ```\n *      that just immediately returns the extracted value will never update, because it doesn't see any field accesses to check.\n *\n * __Use Cases for `autotrackMemoize`:__\n * - It is likely best used for cases where you need to access specific nested fields\n * in data, and avoid recalculating if other fields in the same data objects are immutably updated.\n *\n * @param func - The function to be memoized.\n * @returns A memoized function with a `.clearCache()` method attached.\n *\n * @example\n * <caption>Using `createSelector`</caption>\n * ```ts\n * import { unstable_autotrackMemoize as autotrackMemoize, createSelector } from 'reselect'\n *\n * const selectTodoIds = createSelector(\n *   [(state: RootState) => state.todos],\n *   (todos) => todos.map(todo => todo.id),\n *   { memoize: autotrackMemoize }\n * )\n * ```\n *\n * @example\n * <caption>Using `createSelectorCreator`</caption>\n * ```ts\n * import { unstable_autotrackMemoize as autotrackMemoize, createSelectorCreator } from 'reselect'\n *\n * const createSelectorAutotrack = createSelectorCreator({ memoize: autotrackMemoize })\n *\n * const selectTodoIds = createSelectorAutotrack(\n *   [(state: RootState) => state.todos],\n *   (todos) => todos.map(todo => todo.id)\n * )\n * ```\n *\n * @template Func - The type of the function that is memoized.\n *\n * @see {@link https://reselect.js.org/api/unstable_autotrackMemoize autotrackMemoize}\n *\n * @since 5.0.0\n * @public\n * @experimental\n */\nexport function autotrackMemoize<Func extends AnyFunction>(func: Func) {\n  // we reference arguments instead of spreading them for performance reasons\n\n  const node: Node<Record<string, unknown>> = createNode(\n    [] as unknown as Record<string, unknown>\n  )\n\n  let lastArgs: IArguments | null = null\n\n  const shallowEqual = createCacheKeyComparator(referenceEqualityCheck)\n\n  const cache = createCache(() => {\n    const res = func.apply(null, node.proxy as unknown as any[])\n    return res\n  })\n\n  function memoized() {\n    if (!shallowEqual(lastArgs, arguments)) {\n      updateNode(node, arguments as unknown as Record<string, unknown>)\n      lastArgs = arguments\n    }\n    return cache.value\n  }\n\n  memoized.clearCache = () => {\n    return cache.clear()\n  }\n\n  return memoized as Func & Simplify<DefaultMemoizeFields>\n}\n","// Original source:\n// - https://github.com/facebook/react/blob/0b974418c9a56f6c560298560265dcf4b65784bc/packages/react/src/ReactCache.js\n\nimport type {\n  AnyFunction,\n  DefaultMemoizeFields,\n  EqualityFn,\n  Simplify\n} from './types'\n\nclass StrongRef<T> {\n  constructor(private value: T) {}\n  deref() {\n    return this.value\n  }\n}\n\n/**\n * @returns The {@linkcode StrongRef} if {@linkcode WeakRef} is not available.\n *\n * @since 5.1.2\n * @internal\n */\nconst getWeakRef = () =>\n  typeof WeakRef === 'undefined'\n    ? (StrongRef as unknown as typeof WeakRef)\n    : WeakRef\n\nconst Ref = /* @__PURE__ */ getWeakRef()\n\nconst UNTERMINATED = 0\nconst TERMINATED = 1\n\ninterface UnterminatedCacheNode<T> {\n  /**\n   * Status, represents whether the cached computation returned a value or threw an error.\n   */\n  s: 0\n  /**\n   * Value, either the cached result or an error, depending on status.\n   */\n  v: void\n  /**\n   * Object cache, a `WeakMap` where non-primitive arguments are stored.\n   */\n  o: null | WeakMap<Function | Object, CacheNode<T>>\n  /**\n   * Primitive cache, a regular Map where primitive arguments are stored.\n   */\n  p: null | Map<string | number | null | void | symbol | boolean, CacheNode<T>>\n}\n\ninterface TerminatedCacheNode<T> {\n  /**\n   * Status, represents whether the cached computation returned a value or threw an error.\n   */\n  s: 1\n  /**\n   * Value, either the cached result or an error, depending on status.\n   */\n  v: T\n  /**\n   * Object cache, a `WeakMap` where non-primitive arguments are stored.\n   */\n  o: null | WeakMap<Function | Object, CacheNode<T>>\n  /**\n   * Primitive cache, a regular `Map` where primitive arguments are stored.\n   */\n  p: null | Map<string | number | null | void | symbol | boolean, CacheNode<T>>\n}\n\ntype CacheNode<T> = TerminatedCacheNode<T> | UnterminatedCacheNode<T>\n\nfunction createCacheNode<T>(): CacheNode<T> {\n  return {\n    s: UNTERMINATED,\n    v: undefined,\n    o: null,\n    p: null\n  }\n}\n\n/**\n * Configuration options for a memoization function utilizing `WeakMap` for\n * its caching mechanism.\n *\n * @template Result - The type of the return value of the memoized function.\n *\n * @since 5.0.0\n * @public\n */\nexport interface WeakMapMemoizeOptions<Result = any> {\n  /**\n   * If provided, used to compare a newly generated output value against previous values in the cache.\n   * If a match is found, the old value is returned. This addresses the common\n   * ```ts\n   * todos.map(todo => todo.id)\n   * ```\n   * use case, where an update to another field in the original data causes a recalculation\n   * due to changed references, but the output is still effectively the same.\n   *\n   * @since 5.0.0\n   */\n  resultEqualityCheck?: EqualityFn<Result>\n}\n\n/**\n * Derefences the argument if it is a Ref. Else if it is a value already, return it.\n *\n * @param r - the object to maybe deref\n * @returns The derefenced value if the argument is a Ref, else the argument value itself.\n */\nfunction maybeDeref(r: any) {\n  if (r instanceof Ref) {\n    return r.deref()\n  }\n\n  return r\n}\n\n/**\n * Creates a tree of `WeakMap`-based cache nodes based on the identity of the\n * arguments it's been called with (in this case, the extracted values from your input selectors).\n * This allows `weakMapMemoize` to have an effectively infinite cache size.\n * Cache results will be kept in memory as long as references to the arguments still exist,\n * and then cleared out as the arguments are garbage-collected.\n *\n * __Design Tradeoffs for `weakMapMemoize`:__\n * - Pros:\n *   - It has an effectively infinite cache size, but you have no control over\n *   how long values are kept in cache as it's based on garbage collection and `WeakMap`s.\n * - Cons:\n *   - There's currently no way to alter the argument comparisons.\n *   They're based on strict reference equality.\n *   - It's roughly the same speed as `lruMemoize`, although likely a fraction slower.\n *\n * __Use Cases for `weakMapMemoize`:__\n * - This memoizer is likely best used for cases where you need to call the\n * same selector instance with many different arguments, such as a single\n * selector instance that is used in a list item component and called with\n * item IDs like:\n *   ```ts\n *   useSelector(state => selectSomeData(state, props.category))\n *   ```\n * @param func - The function to be memoized.\n * @returns A memoized function with a `.clearCache()` method attached.\n *\n * @example\n * <caption>Using `createSelector`</caption>\n * ```ts\n * import { createSelector, weakMapMemoize } from 'reselect'\n *\n * interface RootState {\n *   items: { id: number; category: string; name: string }[]\n * }\n *\n * const selectItemsByCategory = createSelector(\n *   [\n *     (state: RootState) => state.items,\n *     (state: RootState, category: string) => category\n *   ],\n *   (items, category) => items.filter(item => item.category === category),\n *   {\n *     memoize: weakMapMemoize,\n *     argsMemoize: weakMapMemoize\n *   }\n * )\n * ```\n *\n * @example\n * <caption>Using `createSelectorCreator`</caption>\n * ```ts\n * import { createSelectorCreator, weakMapMemoize } from 'reselect'\n *\n * const createSelectorWeakMap = createSelectorCreator({ memoize: weakMapMemoize, argsMemoize: weakMapMemoize })\n *\n * const selectItemsByCategory = createSelectorWeakMap(\n *   [\n *     (state: RootState) => state.items,\n *     (state: RootState, category: string) => category\n *   ],\n *   (items, category) => items.filter(item => item.category === category)\n * )\n * ```\n *\n * @template Func - The type of the function that is memoized.\n *\n * @see {@link https://reselect.js.org/api/weakMapMemoize `weakMapMemoize`}\n *\n * @since 5.0.0\n * @public\n * @experimental\n */\nexport function weakMapMemoize<Func extends AnyFunction>(\n  func: Func,\n  options: WeakMapMemoizeOptions<ReturnType<Func>> = {}\n) {\n  let fnNode = createCacheNode()\n  const { resultEqualityCheck } = options\n\n  let lastResult: WeakRef<object> | undefined\n\n  let resultsCount = 0\n\n  function memoized() {\n    let cacheNode = fnNode\n    const { length } = arguments\n    for (let i = 0, l = length; i < l; i++) {\n      const arg = arguments[i]\n      if (\n        typeof arg === 'function' ||\n        (typeof arg === 'object' && arg !== null)\n      ) {\n        // Objects go into a WeakMap\n        let objectCache = cacheNode.o\n        if (objectCache === null) {\n          cacheNode.o = objectCache = new WeakMap()\n        }\n        const objectNode = objectCache.get(arg)\n        if (objectNode === undefined) {\n          cacheNode = createCacheNode()\n          objectCache.set(arg, cacheNode)\n        } else {\n          cacheNode = objectNode\n        }\n      } else {\n        // Primitives go into a regular Map\n        let primitiveCache = cacheNode.p\n        if (primitiveCache === null) {\n          cacheNode.p = primitiveCache = new Map()\n        }\n        const primitiveNode = primitiveCache.get(arg)\n        if (primitiveNode === undefined) {\n          cacheNode = createCacheNode()\n          primitiveCache.set(arg, cacheNode)\n        } else {\n          cacheNode = primitiveNode\n        }\n      }\n    }\n\n    const terminatedNode = cacheNode as unknown as TerminatedCacheNode<any>\n\n    let result\n\n    if (cacheNode.s === TERMINATED) {\n      result = cacheNode.v\n    } else {\n      // Allow errors to propagate\n      result = func.apply(null, arguments as unknown as any[])\n      resultsCount++\n\n      if (resultEqualityCheck) {\n        // Deref lastResult if it is a Ref\n        const lastResultValue = maybeDeref(lastResult)\n\n        if (\n          lastResultValue != null &&\n          resultEqualityCheck(lastResultValue as ReturnType<Func>, result)\n        ) {\n          result = lastResultValue\n\n          resultsCount !== 0 && resultsCount--\n        }\n\n        const needsWeakRef =\n          (typeof result === 'object' && result !== null) ||\n          typeof result === 'function'\n\n        lastResult = needsWeakRef ? /* @__PURE__ */ new Ref(result) : result\n      }\n    }\n\n    terminatedNode.s = TERMINATED\n\n    terminatedNode.v = result\n    return result\n  }\n\n  memoized.clearCache = () => {\n    fnNode = createCacheNode()\n    memoized.resetResultsCount()\n  }\n\n  memoized.resultsCount = () => resultsCount\n\n  memoized.resetResultsCount = () => {\n    resultsCount = 0\n  }\n\n  return memoized as Func & Simplify<DefaultMemoizeFields>\n}\n","import { weakMapMemoize } from './weakMapMemoize'\n\nimport type {\n  Combiner,\n  CreateSelectorOptions,\n  DropFirstParameter,\n  ExtractMemoizerFields,\n  GetParamsFromSelectors,\n  GetStateFromSelectors,\n  InterruptRecursion,\n  OutputSelector,\n  Selector,\n  SelectorArray,\n  SetRequired,\n  Simplify,\n  UnknownMemoizer\n} from './types'\n\nimport {\n  assertIsFunction,\n  collectInputSelectorResults,\n  ensureIsArray,\n  getDependencies,\n  getDevModeChecksExecutionInfo\n} from './utils'\n\n/**\n * An instance of `createSelector`, customized with a given memoize implementation.\n *\n * @template MemoizeFunction - The type of the memoize function that is used to memoize the `resultFunc` inside `createSelector` (e.g., `lruMemoize` or `weakMapMemoize`).\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.\n * @template StateType - The type of state that the selectors created with this selector creator will operate on.\n *\n * @public\n */\nexport interface CreateSelectorFunction<\n  MemoizeFunction extends UnknownMemoizer = typeof weakMapMemoize,\n  ArgsMemoizeFunction extends UnknownMemoizer = typeof weakMapMemoize,\n  StateType = any\n> {\n  /**\n   * Creates a memoized selector function.\n   *\n   * @param createSelectorArgs - An arbitrary number of input selectors as separate inline arguments and a `combiner` function.\n   * @returns A memoized output selector.\n   *\n   * @template InputSelectors - The type of the input selectors as an array.\n   * @template Result - The return type of the `combiner` as well as the output selector.\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`.\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`.\n   *\n   * @see {@link https://reselect.js.org/api/createselector `createSelector`}\n   */\n  <InputSelectors extends SelectorArray<StateType>, Result>(\n    ...createSelectorArgs: [\n      ...inputSelectors: InputSelectors,\n      combiner: Combiner<InputSelectors, Result>\n    ]\n  ): OutputSelector<\n    InputSelectors,\n    Result,\n    MemoizeFunction,\n    ArgsMemoizeFunction\n  > &\n    InterruptRecursion\n\n  /**\n   * Creates a memoized selector function.\n   *\n   * @param createSelectorArgs - An arbitrary number of input selectors as separate inline arguments, a `combiner` function and an `options` object.\n   * @returns A memoized output selector.\n   *\n   * @template InputSelectors - The type of the input selectors as an array.\n   * @template Result - The return type of the `combiner` as well as the output selector.\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`.\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`.\n   *\n   * @see {@link https://reselect.js.org/api/createselector `createSelector`}\n   */\n  <\n    InputSelectors extends SelectorArray<StateType>,\n    Result,\n    OverrideMemoizeFunction extends UnknownMemoizer = MemoizeFunction,\n    OverrideArgsMemoizeFunction extends UnknownMemoizer = ArgsMemoizeFunction\n  >(\n    ...createSelectorArgs: [\n      ...inputSelectors: InputSelectors,\n      combiner: Combiner<InputSelectors, Result>,\n      createSelectorOptions: Simplify<\n        CreateSelectorOptions<\n          MemoizeFunction,\n          ArgsMemoizeFunction,\n          OverrideMemoizeFunction,\n          OverrideArgsMemoizeFunction\n        >\n      >\n    ]\n  ): OutputSelector<\n    InputSelectors,\n    Result,\n    OverrideMemoizeFunction,\n    OverrideArgsMemoizeFunction\n  > &\n    InterruptRecursion\n\n  /**\n   * Creates a memoized selector function.\n   *\n   * @param inputSelectors - An array of input selectors.\n   * @param combiner - A function that Combines the input selectors and returns an output selector. Otherwise known as the result function.\n   * @param createSelectorOptions - An optional options object that allows for further customization per selector.\n   * @returns A memoized output selector.\n   *\n   * @template InputSelectors - The type of the input selectors array.\n   * @template Result - The return type of the `combiner` as well as the output selector.\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`.\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`.\n   *\n   * @see {@link https://reselect.js.org/api/createselector `createSelector`}\n   */\n  <\n    InputSelectors extends SelectorArray<StateType>,\n    Result,\n    OverrideMemoizeFunction extends UnknownMemoizer = MemoizeFunction,\n    OverrideArgsMemoizeFunction extends UnknownMemoizer = ArgsMemoizeFunction\n  >(\n    inputSelectors: [...InputSelectors],\n    combiner: Combiner<InputSelectors, Result>,\n    createSelectorOptions?: Simplify<\n      CreateSelectorOptions<\n        MemoizeFunction,\n        ArgsMemoizeFunction,\n        OverrideMemoizeFunction,\n        OverrideArgsMemoizeFunction\n      >\n    >\n  ): OutputSelector<\n    InputSelectors,\n    Result,\n    OverrideMemoizeFunction,\n    OverrideArgsMemoizeFunction\n  > &\n    InterruptRecursion\n\n  /**\n   * Creates a \"pre-typed\" version of {@linkcode createSelector createSelector}\n   * where the `state` type is predefined.\n   *\n   * This allows you to set the `state` type once, eliminating the need to\n   * specify it with every {@linkcode createSelector createSelector} call.\n   *\n   * @returns A pre-typed `createSelector` with the state type already defined.\n   *\n   * @example\n   * ```ts\n   * import { createSelector } from 'reselect'\n   *\n   * export interface RootState {\n   *   todos: { id: number; completed: boolean }[]\n   *   alerts: { id: number; read: boolean }[]\n   * }\n   *\n   * export const createAppSelector = createSelector.withTypes<RootState>()\n   *\n   * const selectTodoIds = createAppSelector(\n   *   [\n   *     // Type of `state` is set to `RootState`, no need to manually set the type\n   *     state => state.todos\n   *   ],\n   *   todos => todos.map(({ id }) => id)\n   * )\n   * ```\n   * @template OverrideStateType - The specific type of state used by all selectors created with this selector creator.\n   *\n   * @see {@link https://reselect.js.org/api/createselector#defining-a-pre-typed-createselector `createSelector.withTypes`}\n   *\n   * @since 5.1.0\n   */\n  withTypes: <OverrideStateType extends StateType>() => CreateSelectorFunction<\n    MemoizeFunction,\n    ArgsMemoizeFunction,\n    OverrideStateType\n  >\n}\n\n/**\n * Creates a selector creator function with the specified memoization function\n * and options for customizing memoization behavior.\n *\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.\n * @returns A customized `createSelector` function.\n *\n * @example\n * ```ts\n * const customCreateSelector = createSelectorCreator({\n *   memoize: customMemoize, // Function to be used to memoize `resultFunc`\n *   memoizeOptions: [memoizeOption1, memoizeOption2], // Options passed to `customMemoize` as the second argument onwards\n *   argsMemoize: customArgsMemoize, // Function to be used to memoize the selector's arguments\n *   argsMemoizeOptions: [argsMemoizeOption1, argsMemoizeOption2] // Options passed to `customArgsMemoize` as the second argument onwards\n * })\n *\n * const customSelector = customCreateSelector(\n *   [inputSelector1, inputSelector2],\n *   resultFunc // `resultFunc` will be passed as the first argument to `customMemoize`\n * )\n *\n * customSelector(\n *   ...selectorArgs // Will be memoized by `customArgsMemoize`\n * )\n * ```\n *\n * @template MemoizeFunction - The type of the memoize function that is used to memoize the `resultFunc` inside `createSelector` (e.g., `lruMemoize` or `weakMapMemoize`).\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.\n *\n * @see {@link https://reselect.js.org/api/createSelectorCreator#using-options-since-500 `createSelectorCreator`}\n *\n * @since 5.0.0\n * @public\n */\nexport function createSelectorCreator<\n  MemoizeFunction extends UnknownMemoizer,\n  ArgsMemoizeFunction extends UnknownMemoizer = typeof weakMapMemoize\n>(\n  options: Simplify<\n    SetRequired<\n      CreateSelectorOptions<\n        typeof weakMapMemoize,\n        typeof weakMapMemoize,\n        MemoizeFunction,\n        ArgsMemoizeFunction\n      >,\n      'memoize'\n    >\n  >\n): CreateSelectorFunction<MemoizeFunction, ArgsMemoizeFunction>\n\n/**\n * Creates a selector creator function with the specified memoization function\n * and options for customizing memoization behavior.\n *\n * @param memoize - The `memoize` function responsible for memoizing the `resultFunc` inside `createSelector` (e.g., `lruMemoize` or `weakMapMemoize`).\n * @param memoizeOptionsFromArgs - Optional configuration options for the memoization function. These options are then passed to the memoize function as the second argument onwards.\n * @returns A customized `createSelector` function.\n *\n * @example\n * ```ts\n * const customCreateSelector = createSelectorCreator(customMemoize, // Function to be used to memoize `resultFunc`\n *   option1, // Will be passed as second argument to `customMemoize`\n *   option2, // Will be passed as third argument to `customMemoize`\n *   option3 // Will be passed as fourth argument to `customMemoize`\n * )\n *\n * const customSelector = customCreateSelector(\n *   [inputSelector1, inputSelector2],\n *   resultFunc // `resultFunc` will be passed as the first argument to `customMemoize`\n * )\n * ```\n *\n * @template MemoizeFunction - The type of the memoize function that is used to memoize the `resultFunc` inside `createSelector` (e.g., `lruMemoize` or `weakMapMemoize`).\n *\n * @see {@link https://reselect.js.org/api/createSelectorCreator#using-memoize-and-memoizeoptions `createSelectorCreator`}\n *\n * @public\n */\nexport function createSelectorCreator<MemoizeFunction extends UnknownMemoizer>(\n  memoize: MemoizeFunction,\n  ...memoizeOptionsFromArgs: DropFirstParameter<MemoizeFunction>\n): CreateSelectorFunction<MemoizeFunction>\n\n/**\n * Creates a selector creator function with the specified memoization\n * function and options for customizing memoization behavior.\n *\n * @param memoizeOrOptions - Either A `memoize` function or an `options` object containing the `memoize` function.\n * @param memoizeOptionsFromArgs - Optional configuration options for the memoization function. These options are then passed to the memoize function as the second argument onwards.\n * @returns A customized `createSelector` function.\n *\n * @template MemoizeFunction - The type of the memoize function that is used to memoize the `resultFunc` inside `createSelector` (e.g., `lruMemoize` or `weakMapMemoize`).\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.\n * @template MemoizeOrOptions - The type of the first argument. It can either be a `memoize` function or an `options` object containing the `memoize` function.\n */\nexport function createSelectorCreator<\n  MemoizeFunction extends UnknownMemoizer,\n  ArgsMemoizeFunction extends UnknownMemoizer,\n  MemoizeOrOptions extends\n    | MemoizeFunction\n    | SetRequired<\n        CreateSelectorOptions<MemoizeFunction, ArgsMemoizeFunction>,\n        'memoize'\n      >\n>(\n  memoizeOrOptions: MemoizeOrOptions,\n  ...memoizeOptionsFromArgs: MemoizeOrOptions extends SetRequired<\n    CreateSelectorOptions<MemoizeFunction, ArgsMemoizeFunction>,\n    'memoize'\n  >\n    ? never\n    : DropFirstParameter<MemoizeFunction>\n) {\n  /** options initially passed into `createSelectorCreator`. */\n  const createSelectorCreatorOptions: SetRequired<\n    CreateSelectorOptions<MemoizeFunction, ArgsMemoizeFunction>,\n    'memoize'\n  > = typeof memoizeOrOptions === 'function'\n    ? {\n        memoize: memoizeOrOptions as MemoizeFunction,\n        memoizeOptions: memoizeOptionsFromArgs\n      }\n    : memoizeOrOptions\n\n  const createSelector = <\n    InputSelectors extends SelectorArray,\n    Result,\n    OverrideMemoizeFunction extends UnknownMemoizer = MemoizeFunction,\n    OverrideArgsMemoizeFunction extends UnknownMemoizer = ArgsMemoizeFunction\n  >(\n    ...createSelectorArgs: [\n      ...inputSelectors: [...InputSelectors],\n      combiner: Combiner<InputSelectors, Result>,\n      createSelectorOptions?: CreateSelectorOptions<\n        MemoizeFunction,\n        ArgsMemoizeFunction,\n        OverrideMemoizeFunction,\n        OverrideArgsMemoizeFunction\n      >\n    ]\n  ) => {\n    let recomputations = 0\n    let dependencyRecomputations = 0\n    let lastResult: Result\n\n    // Due to the intricacies of rest params, we can't do an optional arg after `...createSelectorArgs`.\n    // So, start by declaring the default value here.\n    // (And yes, the words 'memoize' and 'options' appear too many times in this next sequence.)\n    let directlyPassedOptions: CreateSelectorOptions<\n      MemoizeFunction,\n      ArgsMemoizeFunction,\n      OverrideMemoizeFunction,\n      OverrideArgsMemoizeFunction\n    > = {}\n\n    // Normally, the result func or \"combiner\" is the last arg\n    let resultFunc = createSelectorArgs.pop() as\n      | Combiner<InputSelectors, Result>\n      | CreateSelectorOptions<\n          MemoizeFunction,\n          ArgsMemoizeFunction,\n          OverrideMemoizeFunction,\n          OverrideArgsMemoizeFunction\n        >\n\n    // If the result func is actually an _object_, assume it's our options object\n    if (typeof resultFunc === 'object') {\n      directlyPassedOptions = resultFunc\n      // and pop the real result func off\n      resultFunc = createSelectorArgs.pop() as Combiner<InputSelectors, Result>\n    }\n\n    assertIsFunction(\n      resultFunc,\n      `createSelector expects an output function after the inputs, but received: [${typeof resultFunc}]`\n    )\n\n    // Determine which set of options we're using. Prefer options passed directly,\n    // but fall back to options given to `createSelectorCreator`.\n    const combinedOptions = {\n      ...createSelectorCreatorOptions,\n      ...directlyPassedOptions\n    }\n\n    const {\n      memoize,\n      memoizeOptions = [],\n      argsMemoize = weakMapMemoize,\n      argsMemoizeOptions = []\n    } = combinedOptions\n\n    // Simplifying assumption: it's unlikely that the first options arg of the provided memoizer\n    // is an array. In most libs I've looked at, it's an equality function or options object.\n    // Based on that, if `memoizeOptions` _is_ an array, we assume it's a full\n    // user-provided array of options. Otherwise, it must be just the _first_ arg, and so\n    // we wrap it in an array so we can apply it.\n    const finalMemoizeOptions = ensureIsArray(memoizeOptions)\n    const finalArgsMemoizeOptions = ensureIsArray(argsMemoizeOptions)\n    const dependencies = getDependencies(createSelectorArgs) as InputSelectors\n\n    const memoizedResultFunc = memoize(function recomputationWrapper() {\n      recomputations++\n      // apply arguments instead of spreading for performance.\n      // @ts-ignore\n      return (resultFunc as Combiner<InputSelectors, Result>).apply(\n        null,\n        arguments as unknown as Parameters<Combiner<InputSelectors, Result>>\n      )\n    }, ...finalMemoizeOptions) as Combiner<InputSelectors, Result> &\n      ExtractMemoizerFields<OverrideMemoizeFunction>\n\n    let firstRun = true\n\n    // If a selector is called with the exact same arguments we don't need to traverse our dependencies again.\n    const selector = argsMemoize(function dependenciesChecker() {\n      dependencyRecomputations++\n      /** Return values of input selectors which the `resultFunc` takes as arguments. */\n      const inputSelectorResults = collectInputSelectorResults(\n        dependencies,\n        arguments\n      )\n\n      // apply arguments instead of spreading for performance.\n      // @ts-ignore\n      lastResult = memoizedResultFunc.apply(null, inputSelectorResults)\n\n      if (process.env.NODE_ENV !== 'production') {\n        const { devModeChecks = {} } = combinedOptions\n        const { identityFunctionCheck, inputStabilityCheck } =\n          getDevModeChecksExecutionInfo(firstRun, devModeChecks)\n        if (identityFunctionCheck.shouldRun) {\n          identityFunctionCheck.run(\n            resultFunc as Combiner<InputSelectors, Result>,\n            inputSelectorResults,\n            lastResult\n          )\n        }\n\n        if (inputStabilityCheck.shouldRun) {\n          // make a second copy of the params, to check if we got the same results\n          const inputSelectorResultsCopy = collectInputSelectorResults(\n            dependencies,\n            arguments\n          )\n\n          inputStabilityCheck.run(\n            { inputSelectorResults, inputSelectorResultsCopy },\n            { memoize, memoizeOptions: finalMemoizeOptions },\n            arguments\n          )\n        }\n\n        if (firstRun) firstRun = false\n      }\n\n      return lastResult\n    }, ...finalArgsMemoizeOptions) as unknown as Selector<\n      GetStateFromSelectors<InputSelectors>,\n      Result,\n      GetParamsFromSelectors<InputSelectors>\n    > &\n      ExtractMemoizerFields<OverrideArgsMemoizeFunction>\n\n    return Object.assign(selector, {\n      resultFunc,\n      memoizedResultFunc,\n      dependencies,\n      dependencyRecomputations: () => dependencyRecomputations,\n      resetDependencyRecomputations: () => {\n        dependencyRecomputations = 0\n      },\n      lastResult: () => lastResult,\n      recomputations: () => recomputations,\n      resetRecomputations: () => {\n        recomputations = 0\n      },\n      memoize,\n      argsMemoize\n    }) as OutputSelector<\n      InputSelectors,\n      Result,\n      OverrideMemoizeFunction,\n      OverrideArgsMemoizeFunction\n    >\n  }\n\n  Object.assign(createSelector, {\n    withTypes: () => createSelector\n  })\n\n  return createSelector as CreateSelectorFunction<\n    MemoizeFunction,\n    ArgsMemoizeFunction\n  >\n}\n\n/**\n * Accepts one or more \"input selectors\" (either as separate arguments or a single array),\n * a single \"result function\" / \"combiner\", and an optional options object, and\n * generates a memoized selector function.\n *\n * @see {@link https://reselect.js.org/api/createSelector `createSelector`}\n *\n * @public\n */\nexport const createSelector =\n  /* #__PURE__ */ createSelectorCreator(weakMapMemoize)\n","import { createSelector } from './createSelectorCreator'\n\nimport type { CreateSelectorFunction } from './createSelectorCreator'\nimport type {\n  InterruptRecursion,\n  ObjectValuesToTuple,\n  OutputSelector,\n  Selector,\n  Simplify,\n  UnknownMemoizer\n} from './types'\nimport { assertIsObject } from './utils'\nimport type { weakMapMemoize } from './weakMapMemoize'\n\n/**\n * Represents a mapping of selectors to their return types.\n *\n * @template TObject - An object type where each property is a selector function.\n *\n * @public\n */\nexport type SelectorResultsMap<TObject extends SelectorsObject> = {\n  [Key in keyof TObject]: ReturnType<TObject[Key]>\n}\n\n/**\n * Represents a mapping of selectors for each key in a given root state.\n *\n * This type is a utility that takes a root state object type and\n * generates a corresponding set of selectors. Each selector is associated\n * with a key in the root state, allowing for the selection\n * of specific parts of the state.\n *\n * @template RootState - The type of the root state object.\n *\n * @since 5.0.0\n * @public\n */\nexport type RootStateSelectors<RootState = any> = {\n  [Key in keyof RootState]: Selector<RootState, RootState[Key], []>\n}\n\n/**\n * @deprecated Please use {@linkcode StructuredSelectorCreator.withTypes createStructuredSelector.withTypes<RootState>()} instead. This type will be removed in the future.\n * @template RootState - The type of the root state object.\n *\n * @since 5.0.0\n * @public\n */\nexport type TypedStructuredSelectorCreator<RootState = any> =\n  /**\n   * A convenience function that simplifies returning an object\n   * made up of selector results.\n   *\n   * @param inputSelectorsObject - A key value pair consisting of input selectors.\n   * @param selectorCreator - A custom selector creator function. It defaults to `createSelector`.\n   * @returns A memoized structured selector.\n   *\n   * @example\n   * <caption>Modern Use Case</caption>\n   * ```ts\n   * import { createSelector, createStructuredSelector } from 'reselect'\n   *\n   * interface RootState {\n   *   todos: {\n   *     id: number\n   *     completed: boolean\n   *     title: string\n   *     description: string\n   *   }[]\n   *   alerts: { id: number; read: boolean }[]\n   * }\n   *\n   * // This:\n   * const structuredSelector = createStructuredSelector(\n   *   {\n   *     todos: (state: RootState) => state.todos,\n   *     alerts: (state: RootState) => state.alerts,\n   *     todoById: (state: RootState, id: number) => state.todos[id]\n   *   },\n   *   createSelector\n   * )\n   *\n   * // Is essentially the same as this:\n   * const selector = createSelector(\n   *   [\n   *     (state: RootState) => state.todos,\n   *     (state: RootState) => state.alerts,\n   *     (state: RootState, id: number) => state.todos[id]\n   *   ],\n   *   (todos, alerts, todoById) => {\n   *     return {\n   *       todos,\n   *       alerts,\n   *       todoById\n   *     }\n   *   }\n   * )\n   * ```\n   *\n   * @example\n   * <caption>In your component:</caption>\n   * ```tsx\n   * import type { RootState } from 'createStructuredSelector/modernUseCase'\n   * import { structuredSelector } from 'createStructuredSelector/modernUseCase'\n   * import type { FC } from 'react'\n   * import { useSelector } from 'react-redux'\n   *\n   * interface Props {\n   *   id: number\n   * }\n   *\n   * const MyComponent: FC<Props> = ({ id }) => {\n   *   const { todos, alerts, todoById } = useSelector((state: RootState) =>\n   *     structuredSelector(state, id)\n   *   )\n   *\n   *   return (\n   *     <div>\n   *       Next to do is:\n   *       <h2>{todoById.title}</h2>\n   *       <p>Description: {todoById.description}</p>\n   *       <ul>\n   *         <h3>All other to dos:</h3>\n   *         {todos.map(todo => (\n   *           <li key={todo.id}>{todo.title}</li>\n   *         ))}\n   *       </ul>\n   *     </div>\n   *   )\n   * }\n   * ```\n   *\n   * @example\n   * <caption>Simple Use Case</caption>\n   * ```ts\n   * const selectA = state => state.a\n   * const selectB = state => state.b\n   *\n   * // The result function in the following selector\n   * // is simply building an object from the input selectors\n   * const structuredSelector = createSelector(selectA, selectB, (a, b) => ({\n   *   a,\n   *   b\n   * }))\n   *\n   * const result = structuredSelector({ a: 1, b: 2 }) // will produce { x: 1, y: 2 }\n   * ```\n   *\n   * @template InputSelectorsObject - The shape of the input selectors object.\n   * @template MemoizeFunction - The type of the memoize function that is used to create the structured selector. It defaults to `weakMapMemoize`.\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`.\n   *\n   * @see {@link https://reselect.js.org/api/createStructuredSelector `createStructuredSelector`}\n   */\n  <\n    InputSelectorsObject extends RootStateSelectors<RootState> = RootStateSelectors<RootState>,\n    MemoizeFunction extends UnknownMemoizer = typeof weakMapMemoize,\n    ArgsMemoizeFunction extends UnknownMemoizer = typeof weakMapMemoize\n  >(\n    inputSelectorsObject: InputSelectorsObject,\n    selectorCreator?: CreateSelectorFunction<\n      MemoizeFunction,\n      ArgsMemoizeFunction\n    >\n  ) => OutputSelector<\n    ObjectValuesToTuple<InputSelectorsObject>,\n    Simplify<SelectorResultsMap<InputSelectorsObject>>,\n    MemoizeFunction,\n    ArgsMemoizeFunction\n  > &\n    InterruptRecursion\n\n/**\n * Represents an object where each property is a selector function.\n *\n * @template StateType - The type of state that all the selectors operate on.\n *\n * @public\n */\nexport type SelectorsObject<StateType = any> = Record<\n  string,\n  Selector<StateType>\n>\n\n/**\n * It provides a way to create structured selectors.\n * The structured selector can take multiple input selectors\n * and map their output to an object with specific keys.\n *\n * @template StateType - The type of state that the structured selectors created with this structured selector creator will operate on.\n *\n * @see {@link https://reselect.js.org/api/createStructuredSelector `createStructuredSelector`}\n *\n * @public\n */\nexport interface StructuredSelectorCreator<StateType = any> {\n  /**\n   * A convenience function that simplifies returning an object\n   * made up of selector results.\n   *\n   * @param inputSelectorsObject - A key value pair consisting of input selectors.\n   * @param selectorCreator - A custom selector creator function. It defaults to `createSelector`.\n   * @returns A memoized structured selector.\n   *\n   * @example\n   * <caption>Modern Use Case</caption>\n   * ```ts\n   * import { createSelector, createStructuredSelector } from 'reselect'\n   *\n   * interface RootState {\n   *   todos: {\n   *     id: number\n   *     completed: boolean\n   *     title: string\n   *     description: string\n   *   }[]\n   *   alerts: { id: number; read: boolean }[]\n   * }\n   *\n   * // This:\n   * const structuredSelector = createStructuredSelector(\n   *   {\n   *     todos: (state: RootState) => state.todos,\n   *     alerts: (state: RootState) => state.alerts,\n   *     todoById: (state: RootState, id: number) => state.todos[id]\n   *   },\n   *   createSelector\n   * )\n   *\n   * // Is essentially the same as this:\n   * const selector = createSelector(\n   *   [\n   *     (state: RootState) => state.todos,\n   *     (state: RootState) => state.alerts,\n   *     (state: RootState, id: number) => state.todos[id]\n   *   ],\n   *   (todos, alerts, todoById) => {\n   *     return {\n   *       todos,\n   *       alerts,\n   *       todoById\n   *     }\n   *   }\n   * )\n   * ```\n   *\n   * @example\n   * <caption>In your component:</caption>\n   * ```tsx\n   * import type { RootState } from 'createStructuredSelector/modernUseCase'\n   * import { structuredSelector } from 'createStructuredSelector/modernUseCase'\n   * import type { FC } from 'react'\n   * import { useSelector } from 'react-redux'\n   *\n   * interface Props {\n   *   id: number\n   * }\n   *\n   * const MyComponent: FC<Props> = ({ id }) => {\n   *   const { todos, alerts, todoById } = useSelector((state: RootState) =>\n   *     structuredSelector(state, id)\n   *   )\n   *\n   *   return (\n   *     <div>\n   *       Next to do is:\n   *       <h2>{todoById.title}</h2>\n   *       <p>Description: {todoById.description}</p>\n   *       <ul>\n   *         <h3>All other to dos:</h3>\n   *         {todos.map(todo => (\n   *           <li key={todo.id}>{todo.title}</li>\n   *         ))}\n   *       </ul>\n   *     </div>\n   *   )\n   * }\n   * ```\n   *\n   * @example\n   * <caption>Simple Use Case</caption>\n   * ```ts\n   * const selectA = state => state.a\n   * const selectB = state => state.b\n   *\n   * // The result function in the following selector\n   * // is simply building an object from the input selectors\n   * const structuredSelector = createSelector(selectA, selectB, (a, b) => ({\n   *   a,\n   *   b\n   * }))\n   *\n   * const result = structuredSelector({ a: 1, b: 2 }) // will produce { x: 1, y: 2 }\n   * ```\n   *\n   * @template InputSelectorsObject - The shape of the input selectors object.\n   * @template MemoizeFunction - The type of the memoize function that is used to create the structured selector. It defaults to `weakMapMemoize`.\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`.\n   *\n   * @see {@link https://reselect.js.org/api/createStructuredSelector `createStructuredSelector`}\n   */\n  <\n    InputSelectorsObject extends SelectorsObject<StateType>,\n    MemoizeFunction extends UnknownMemoizer = typeof weakMapMemoize,\n    ArgsMemoizeFunction extends UnknownMemoizer = typeof weakMapMemoize\n  >(\n    inputSelectorsObject: InputSelectorsObject,\n    selectorCreator?: CreateSelectorFunction<\n      MemoizeFunction,\n      ArgsMemoizeFunction\n    >\n  ): OutputSelector<\n    ObjectValuesToTuple<InputSelectorsObject>,\n    Simplify<SelectorResultsMap<InputSelectorsObject>>,\n    MemoizeFunction,\n    ArgsMemoizeFunction\n  > &\n    InterruptRecursion\n\n  /**\n   * Creates a \"pre-typed\" version of\n   * {@linkcode createStructuredSelector createStructuredSelector}\n   * where the `state` type is predefined.\n   *\n   * This allows you to set the `state` type once, eliminating the need to\n   * specify it with every\n   * {@linkcode createStructuredSelector createStructuredSelector} call.\n   *\n   * @returns A pre-typed `createStructuredSelector` with the state type already defined.\n   *\n   * @example\n   * ```ts\n   * import { createStructuredSelector } from 'reselect'\n   *\n   * export interface RootState {\n   *   todos: { id: number; completed: boolean }[]\n   *   alerts: { id: number; read: boolean }[]\n   * }\n   *\n   * export const createStructuredAppSelector =\n   *   createStructuredSelector.withTypes<RootState>()\n   *\n   * const structuredAppSelector = createStructuredAppSelector({\n   *   // Type of `state` is set to `RootState`, no need to manually set the type\n   *   todos: state => state.todos,\n   *   alerts: state => state.alerts,\n   *   todoById: (state, id: number) => state.todos[id]\n   * })\n   *\n   * ```\n   * @template OverrideStateType - The specific type of state used by all structured selectors created with this structured selector creator.\n   *\n   * @see {@link https://reselect.js.org/api/createstructuredselector#defining-a-pre-typed-createstructuredselector `createSelector.withTypes`}\n   *\n   * @since 5.1.0\n   */\n  withTypes: <\n    OverrideStateType extends StateType\n  >() => StructuredSelectorCreator<OverrideStateType>\n}\n\n/**\n * A convenience function that simplifies returning an object\n * made up of selector results.\n *\n * @param inputSelectorsObject - A key value pair consisting of input selectors.\n * @param selectorCreator - A custom selector creator function. It defaults to `createSelector`.\n * @returns A memoized structured selector.\n *\n * @example\n * <caption>Modern Use Case</caption>\n * ```ts\n * import { createSelector, createStructuredSelector } from 'reselect'\n *\n * interface RootState {\n *   todos: {\n *     id: number\n *     completed: boolean\n *     title: string\n *     description: string\n *   }[]\n *   alerts: { id: number; read: boolean }[]\n * }\n *\n * // This:\n * const structuredSelector = createStructuredSelector(\n *   {\n *     todos: (state: RootState) => state.todos,\n *     alerts: (state: RootState) => state.alerts,\n *     todoById: (state: RootState, id: number) => state.todos[id]\n *   },\n *   createSelector\n * )\n *\n * // Is essentially the same as this:\n * const selector = createSelector(\n *   [\n *     (state: RootState) => state.todos,\n *     (state: RootState) => state.alerts,\n *     (state: RootState, id: number) => state.todos[id]\n *   ],\n *   (todos, alerts, todoById) => {\n *     return {\n *       todos,\n *       alerts,\n *       todoById\n *     }\n *   }\n * )\n * ```\n *\n * @see {@link https://reselect.js.org/api/createStructuredSelector `createStructuredSelector`}\n *\n * @public\n */\nexport const createStructuredSelector: StructuredSelectorCreator =\n  /* @__PURE__ */ Object.assign(\n    <\n      InputSelectorsObject extends SelectorsObject,\n      MemoizeFunction extends UnknownMemoizer = typeof weakMapMemoize,\n      ArgsMemoizeFunction extends UnknownMemoizer = typeof weakMapMemoize\n    >(\n      inputSelectorsObject: InputSelectorsObject,\n      selectorCreator: CreateSelectorFunction<\n        MemoizeFunction,\n        ArgsMemoizeFunction\n      > = createSelector as CreateSelectorFunction<\n        MemoizeFunction,\n        ArgsMemoizeFunction\n      >\n    ) => {\n      assertIsObject(\n        inputSelectorsObject,\n        'createStructuredSelector expects first argument to be an object ' +\n          `where each property is a selector, instead received a ${typeof inputSelectorsObject}`\n      )\n      const inputSelectorKeys = Object.keys(inputSelectorsObject)\n      const dependencies = inputSelectorKeys.map(\n        key => inputSelectorsObject[key]\n      )\n      const structuredSelector = selectorCreator(\n        dependencies,\n        (...inputSelectorResults: any[]) => {\n          return inputSelectorResults.reduce((composition, value, index) => {\n            composition[inputSelectorKeys[index]] = value\n            return composition\n          }, {})\n        }\n      )\n      return structuredSelector\n    },\n    { withTypes: () => createStructuredSelector }\n  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