{ "version": 3, "sources": ["../../../node_modules/use-sync-external-store/cjs/use-sync-external-store-with-selector.production.js", "../../../node_modules/use-sync-external-store/with-selector.js", "../../../node_modules/react-redux/src/utils/react.ts", "../../../node_modules/react-redux/src/utils/react-is.ts", "../../../node_modules/react-redux/src/utils/warning.ts", "../../../node_modules/react-redux/src/connect/verifySubselectors.ts", "../../../node_modules/react-redux/src/connect/selectorFactory.ts", "../../../node_modules/react-redux/src/utils/bindActionCreators.ts", "../../../node_modules/react-redux/src/utils/isPlainObject.ts", "../../../node_modules/react-redux/src/utils/verifyPlainObject.ts", "../../../node_modules/react-redux/src/connect/wrapMapToProps.ts", "../../../node_modules/react-redux/src/connect/invalidArgFactory.ts", "../../../node_modules/react-redux/src/connect/mapDispatchToProps.ts", "../../../node_modules/react-redux/src/connect/mapStateToProps.ts", "../../../node_modules/react-redux/src/connect/mergeProps.ts", "../../../node_modules/react-redux/src/utils/batch.ts", "../../../node_modules/react-redux/src/utils/Subscription.ts", "../../../node_modules/react-redux/src/utils/useIsomorphicLayoutEffect.ts", "../../../node_modules/react-redux/src/utils/shallowEqual.ts", "../../../node_modules/react-redux/src/utils/hoistStatics.ts", "../../../node_modules/react-redux/src/components/Context.ts", "../../../node_modules/react-redux/src/components/connect.tsx", "../../../node_modules/react-redux/src/components/Provider.tsx", "../../../node_modules/react-redux/src/hooks/useReduxContext.ts", "../../../node_modules/react-redux/src/hooks/useStore.ts", "../../../node_modules/react-redux/src/hooks/useDispatch.ts", "../../../node_modules/react-redux/src/hooks/useSelector.ts", "../../../node_modules/react-redux/src/exports.ts", "../../../node_modules/redux/src/utils/formatProdErrorMessage.ts", "../../../node_modules/redux/src/utils/symbol-observable.ts", "../../../node_modules/redux/src/utils/actionTypes.ts", "../../../node_modules/redux/src/utils/isPlainObject.ts", "../../../node_modules/redux/src/utils/kindOf.ts", "../../../node_modules/redux/src/createStore.ts", "../../../node_modules/redux/src/utils/warning.ts", "../../../node_modules/redux/src/combineReducers.ts", "../../../node_modules/redux/src/bindActionCreators.ts", "../../../node_modules/redux/src/compose.ts", "../../../node_modules/redux/src/applyMiddleware.ts", "../../../node_modules/redux/src/utils/isAction.ts", "../../../node_modules/reselect/src/devModeChecks/identityFunctionCheck.ts", "../../../node_modules/reselect/src/devModeChecks/inputStabilityCheck.ts", "../../../node_modules/reselect/src/devModeChecks/setGlobalDevModeChecks.ts", "../../../node_modules/reselect/src/utils.ts", "../../../node_modules/reselect/src/autotrackMemoize/autotracking.ts", "../../../node_modules/reselect/src/autotrackMemoize/tracking.ts", "../../../node_modules/reselect/src/autotrackMemoize/proxy.ts", "../../../node_modules/reselect/src/lruMemoize.ts", "../../../node_modules/reselect/src/autotrackMemoize/autotrackMemoize.ts", "../../../node_modules/reselect/src/weakMapMemoize.ts", "../../../node_modules/reselect/src/createSelectorCreator.ts", "../../../node_modules/reselect/src/createStructuredSelector.ts", "../../../node_modules/redux-thunk/dist/redux-thunk.mjs", "../../../node_modules/@reduxjs/toolkit/src/index.ts", "../../../node_modules/@reduxjs/toolkit/src/createDraftSafeSelector.ts", "../../../node_modules/@reduxjs/toolkit/src/configureStore.ts", "../../../node_modules/@reduxjs/toolkit/src/devtoolsExtension.ts", "../../../node_modules/@reduxjs/toolkit/src/getDefaultMiddleware.ts", "../../../node_modules/@reduxjs/toolkit/src/createAction.ts", "../../../node_modules/@reduxjs/toolkit/src/tsHelpers.ts", "../../../node_modules/@reduxjs/toolkit/src/actionCreatorInvariantMiddleware.ts", "../../../node_modules/@reduxjs/toolkit/src/utils.ts", "../../../node_modules/@reduxjs/toolkit/src/immutableStateInvariantMiddleware.ts", "../../../node_modules/@reduxjs/toolkit/src/serializableStateInvariantMiddleware.ts", "../../../node_modules/@reduxjs/toolkit/src/autoBatchEnhancer.ts", "../../../node_modules/@reduxjs/toolkit/src/getDefaultEnhancers.ts", "../../../node_modules/@reduxjs/toolkit/src/createReducer.ts", "../../../node_modules/@reduxjs/toolkit/src/mapBuilders.ts", "../../../node_modules/@reduxjs/toolkit/src/matchers.ts", "../../../node_modules/@reduxjs/toolkit/src/nanoid.ts", "../../../node_modules/@reduxjs/toolkit/src/createAsyncThunk.ts", "../../../node_modules/@reduxjs/toolkit/src/createSlice.ts", "../../../node_modules/@reduxjs/toolkit/src/entities/entity_state.ts", "../../../node_modules/@reduxjs/toolkit/src/entities/state_selectors.ts", "../../../node_modules/@reduxjs/toolkit/src/entities/state_adapter.ts", "../../../node_modules/@reduxjs/toolkit/src/entities/utils.ts", "../../../node_modules/@reduxjs/toolkit/src/entities/unsorted_state_adapter.ts", "../../../node_modules/@reduxjs/toolkit/src/entities/sorted_state_adapter.ts", "../../../node_modules/@reduxjs/toolkit/src/entities/create_adapter.ts", "../../../node_modules/@reduxjs/toolkit/src/listenerMiddleware/index.ts", "../../../node_modules/@reduxjs/toolkit/src/listenerMiddleware/exceptions.ts", "../../../node_modules/@reduxjs/toolkit/src/listenerMiddleware/utils.ts", "../../../node_modules/@reduxjs/toolkit/src/listenerMiddleware/task.ts", "../../../node_modules/@reduxjs/toolkit/src/dynamicMiddleware/index.ts", "../../../node_modules/@reduxjs/toolkit/src/combineSlices.ts", "../../../node_modules/@reduxjs/toolkit/src/formatProdErrorMessage.ts"], "sourcesContent": ["/**\n * @license React\n * use-sync-external-store-with-selector.production.js\n *\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n\"use strict\";\nvar React = require(\"react\");\nfunction is(x, y) {\n return (x === y && (0 !== x || 1 / x === 1 / y)) || (x !== x && y !== y);\n}\nvar objectIs = \"function\" === typeof Object.is ? Object.is : is,\n useSyncExternalStore = React.useSyncExternalStore,\n useRef = React.useRef,\n useEffect = React.useEffect,\n useMemo = React.useMemo,\n useDebugValue = React.useDebugValue;\nexports.useSyncExternalStoreWithSelector = function (\n subscribe,\n getSnapshot,\n getServerSnapshot,\n selector,\n isEqual\n) {\n var instRef = useRef(null);\n if (null === instRef.current) {\n var inst = { hasValue: !1, value: null };\n instRef.current = inst;\n } else inst = instRef.current;\n instRef = useMemo(\n function () {\n function memoizedSelector(nextSnapshot) {\n if (!hasMemo) {\n hasMemo = !0;\n memoizedSnapshot = nextSnapshot;\n nextSnapshot = selector(nextSnapshot);\n if (void 0 !== isEqual && inst.hasValue) {\n var currentSelection = inst.value;\n if (isEqual(currentSelection, nextSnapshot))\n return (memoizedSelection = currentSelection);\n }\n return (memoizedSelection = nextSnapshot);\n }\n currentSelection = memoizedSelection;\n if (objectIs(memoizedSnapshot, nextSnapshot)) return currentSelection;\n var nextSelection = selector(nextSnapshot);\n if (void 0 !== isEqual && isEqual(currentSelection, nextSelection))\n return (memoizedSnapshot = nextSnapshot), currentSelection;\n memoizedSnapshot = nextSnapshot;\n return (memoizedSelection = nextSelection);\n }\n var hasMemo = !1,\n memoizedSnapshot,\n memoizedSelection,\n maybeGetServerSnapshot =\n void 0 === getServerSnapshot ? null : getServerSnapshot;\n return [\n function () {\n return memoizedSelector(getSnapshot());\n },\n null === maybeGetServerSnapshot\n ? void 0\n : function () {\n return memoizedSelector(maybeGetServerSnapshot());\n }\n ];\n },\n [getSnapshot, getServerSnapshot, selector, isEqual]\n );\n var value = useSyncExternalStore(subscribe, instRef[0], instRef[1]);\n useEffect(\n function () {\n inst.hasValue = !0;\n inst.value = value;\n },\n [value]\n );\n useDebugValue(value);\n return value;\n};\n", "'use strict';\n\nif (process.env.NODE_ENV === 'production') {\n module.exports = require('./cjs/use-sync-external-store-with-selector.production.js');\n} else {\n module.exports = require('./cjs/use-sync-external-store-with-selector.development.js');\n}\n", "import * as React from 'react'\n\nexport { React }\n", "import type { ElementType, MemoExoticComponent, ReactElement } from 'react'\nimport { React } from './react'\n\n// Directly ported from:\n// https://unpkg.com/browse/react-is@19.0.0/cjs/react-is.production.js\n// It's very possible this could change in the future, but given that\n// we only use these in `connect`, this is a low priority.\n\nexport const IS_REACT_19 = /* @__PURE__ */ React.version.startsWith('19')\n\nconst REACT_ELEMENT_TYPE = /* @__PURE__ */ Symbol.for(\n IS_REACT_19 ? 'react.transitional.element' : 'react.element',\n)\nconst REACT_PORTAL_TYPE = /* @__PURE__ */ Symbol.for('react.portal')\nconst REACT_FRAGMENT_TYPE = /* @__PURE__ */ Symbol.for('react.fragment')\nconst REACT_STRICT_MODE_TYPE = /* @__PURE__ */ Symbol.for('react.strict_mode')\nconst REACT_PROFILER_TYPE = /* @__PURE__ */ Symbol.for('react.profiler')\nconst REACT_CONSUMER_TYPE = /* @__PURE__ */ Symbol.for('react.consumer')\nconst REACT_CONTEXT_TYPE = /* @__PURE__ */ Symbol.for('react.context')\nconst REACT_FORWARD_REF_TYPE = /* @__PURE__ */ Symbol.for('react.forward_ref')\nconst REACT_SUSPENSE_TYPE = /* @__PURE__ */ Symbol.for('react.suspense')\nconst REACT_SUSPENSE_LIST_TYPE = /* @__PURE__ */ Symbol.for(\n 'react.suspense_list',\n)\nconst REACT_MEMO_TYPE = /* @__PURE__ */ Symbol.for('react.memo')\nconst REACT_LAZY_TYPE = /* @__PURE__ */ Symbol.for('react.lazy')\nconst REACT_OFFSCREEN_TYPE = /* @__PURE__ */ Symbol.for('react.offscreen')\nconst REACT_CLIENT_REFERENCE = /* @__PURE__ */ Symbol.for(\n 'react.client.reference',\n)\n\nexport const ForwardRef = REACT_FORWARD_REF_TYPE\nexport const Memo = REACT_MEMO_TYPE\n\nexport function isValidElementType(type: any): type is ElementType {\n return typeof type === 'string' ||\n typeof type === 'function' ||\n type === REACT_FRAGMENT_TYPE ||\n type === REACT_PROFILER_TYPE ||\n type === REACT_STRICT_MODE_TYPE ||\n type === REACT_SUSPENSE_TYPE ||\n type === REACT_SUSPENSE_LIST_TYPE ||\n type === REACT_OFFSCREEN_TYPE ||\n (typeof type === 'object' &&\n type !== null &&\n (type.$$typeof === REACT_LAZY_TYPE ||\n type.$$typeof === REACT_MEMO_TYPE ||\n type.$$typeof === REACT_CONTEXT_TYPE ||\n type.$$typeof === REACT_CONSUMER_TYPE ||\n type.$$typeof === REACT_FORWARD_REF_TYPE ||\n type.$$typeof === REACT_CLIENT_REFERENCE ||\n type.getModuleId !== undefined))\n ? !0\n : !1\n}\n\nfunction typeOf(object: any): symbol | undefined {\n if (typeof object === 'object' && object !== null) {\n const { $$typeof } = object\n\n switch ($$typeof) {\n case REACT_ELEMENT_TYPE:\n switch (((object = object.type), object)) {\n case REACT_FRAGMENT_TYPE:\n case REACT_PROFILER_TYPE:\n case REACT_STRICT_MODE_TYPE:\n case REACT_SUSPENSE_TYPE:\n case REACT_SUSPENSE_LIST_TYPE:\n return object\n default:\n switch (((object = object && object.$$typeof), object)) {\n case REACT_CONTEXT_TYPE:\n case REACT_FORWARD_REF_TYPE:\n case REACT_LAZY_TYPE:\n case REACT_MEMO_TYPE:\n return object\n case REACT_CONSUMER_TYPE:\n return object\n default:\n return $$typeof\n }\n }\n case REACT_PORTAL_TYPE:\n return $$typeof\n }\n }\n}\n\nexport function isContextConsumer(object: any): object is ReactElement {\n return IS_REACT_19\n ? typeOf(object) === REACT_CONSUMER_TYPE\n : typeOf(object) === REACT_CONTEXT_TYPE\n}\n\nexport function isMemo(object: any): object is MemoExoticComponent {\n return typeOf(object) === REACT_MEMO_TYPE\n}\n", "/**\r\n * Prints a warning in the console if it exists.\r\n *\r\n * @param {String} message The warning message.\r\n * @returns {void}\r\n */\r\nexport default function warning(message: string) {\r\n /* eslint-disable no-console */\r\n if (typeof console !== 'undefined' && typeof console.error === 'function') {\r\n console.error(message)\r\n }\r\n /* eslint-enable no-console */\r\n try {\r\n // This error was thrown as a convenience so that if you enable\r\n // \"break on all exceptions\" in your console,\r\n // it would pause the execution at this line.\r\n throw new Error(message)\r\n /* eslint-disable no-empty */\r\n } catch (e) {}\r\n /* eslint-enable no-empty */\r\n}\r\n", "import warning from '../utils/warning'\n\nfunction verify(selector: unknown, methodName: string): void {\n if (!selector) {\n throw new Error(`Unexpected value for ${methodName} in connect.`)\n } else if (\n methodName === 'mapStateToProps' ||\n methodName === 'mapDispatchToProps'\n ) {\n if (!Object.prototype.hasOwnProperty.call(selector, 'dependsOnOwnProps')) {\n warning(\n `The selector for ${methodName} of connect did not specify a value for dependsOnOwnProps.`,\n )\n }\n }\n}\n\nexport default function verifySubselectors(\n mapStateToProps: unknown,\n mapDispatchToProps: unknown,\n mergeProps: unknown,\n): void {\n verify(mapStateToProps, 'mapStateToProps')\n verify(mapDispatchToProps, 'mapDispatchToProps')\n verify(mergeProps, 'mergeProps')\n}\n", "import type { Dispatch, Action } from 'redux'\nimport type { ComponentType } from 'react'\nimport verifySubselectors from './verifySubselectors'\nimport type { EqualityFn, ExtendedEqualityFn } from '../types'\n\nexport type SelectorFactory = (\n dispatch: Dispatch>,\n factoryOptions: TFactoryOptions,\n) => Selector\n\nexport type Selector = TOwnProps extends\n | null\n | undefined\n ? (state: S) => TProps\n : (state: S, ownProps: TOwnProps) => TProps\n\nexport type MapStateToProps = (\n state: State,\n ownProps: TOwnProps,\n) => TStateProps\n\nexport type MapStateToPropsFactory = (\n initialState: State,\n ownProps: TOwnProps,\n) => MapStateToProps\n\nexport type MapStateToPropsParam =\n | MapStateToPropsFactory\n | MapStateToProps\n | null\n | undefined\n\nexport type MapDispatchToPropsFunction = (\n dispatch: Dispatch>,\n ownProps: TOwnProps,\n) => TDispatchProps\n\nexport type MapDispatchToProps =\n | MapDispatchToPropsFunction\n | TDispatchProps\n\nexport type MapDispatchToPropsFactory = (\n dispatch: Dispatch>,\n ownProps: TOwnProps,\n) => MapDispatchToPropsFunction\n\nexport type MapDispatchToPropsParam =\n | MapDispatchToPropsFactory\n | MapDispatchToProps\n\nexport type MapDispatchToPropsNonObject =\n | MapDispatchToPropsFactory\n | MapDispatchToPropsFunction\n\nexport type MergeProps = (\n stateProps: TStateProps,\n dispatchProps: TDispatchProps,\n ownProps: TOwnProps,\n) => TMergedProps\n\ninterface PureSelectorFactoryComparisonOptions {\n readonly areStatesEqual: ExtendedEqualityFn\n readonly areStatePropsEqual: EqualityFn\n readonly areOwnPropsEqual: EqualityFn\n}\n\nfunction pureFinalPropsSelectorFactory<\n TStateProps,\n TOwnProps,\n TDispatchProps,\n TMergedProps,\n State,\n>(\n mapStateToProps: WrappedMapStateToProps,\n mapDispatchToProps: WrappedMapDispatchToProps,\n mergeProps: MergeProps,\n dispatch: Dispatch>,\n {\n areStatesEqual,\n areOwnPropsEqual,\n areStatePropsEqual,\n }: PureSelectorFactoryComparisonOptions,\n) {\n let hasRunAtLeastOnce = false\n let state: State\n let ownProps: TOwnProps\n let stateProps: TStateProps\n let dispatchProps: TDispatchProps\n let mergedProps: TMergedProps\n\n function handleFirstCall(firstState: State, firstOwnProps: TOwnProps) {\n state = firstState\n ownProps = firstOwnProps\n stateProps = mapStateToProps(state, ownProps)\n dispatchProps = mapDispatchToProps(dispatch, ownProps)\n mergedProps = mergeProps(stateProps, dispatchProps, ownProps)\n hasRunAtLeastOnce = true\n return mergedProps\n }\n\n function handleNewPropsAndNewState() {\n stateProps = mapStateToProps(state, ownProps)\n\n if (mapDispatchToProps.dependsOnOwnProps)\n dispatchProps = mapDispatchToProps(dispatch, ownProps)\n\n mergedProps = mergeProps(stateProps, dispatchProps, ownProps)\n return mergedProps\n }\n\n function handleNewProps() {\n if (mapStateToProps.dependsOnOwnProps)\n stateProps = mapStateToProps(state, ownProps)\n\n if (mapDispatchToProps.dependsOnOwnProps)\n dispatchProps = mapDispatchToProps(dispatch, ownProps)\n\n mergedProps = mergeProps(stateProps, dispatchProps, ownProps)\n return mergedProps\n }\n\n function handleNewState() {\n const nextStateProps = mapStateToProps(state, ownProps)\n const statePropsChanged = !areStatePropsEqual(nextStateProps, stateProps)\n stateProps = nextStateProps\n\n if (statePropsChanged)\n mergedProps = mergeProps(stateProps, dispatchProps, ownProps)\n\n return mergedProps\n }\n\n function handleSubsequentCalls(nextState: State, nextOwnProps: TOwnProps) {\n const propsChanged = !areOwnPropsEqual(nextOwnProps, ownProps)\n const stateChanged = !areStatesEqual(\n nextState,\n state,\n nextOwnProps,\n ownProps,\n )\n state = nextState\n ownProps = nextOwnProps\n\n if (propsChanged && stateChanged) return handleNewPropsAndNewState()\n if (propsChanged) return handleNewProps()\n if (stateChanged) return handleNewState()\n return mergedProps\n }\n\n return function pureFinalPropsSelector(\n nextState: State,\n nextOwnProps: TOwnProps,\n ) {\n return hasRunAtLeastOnce\n ? handleSubsequentCalls(nextState, nextOwnProps)\n : handleFirstCall(nextState, nextOwnProps)\n }\n}\n\ninterface WrappedMapStateToProps {\n (state: State, ownProps: TOwnProps): TStateProps\n readonly dependsOnOwnProps: boolean\n}\n\ninterface WrappedMapDispatchToProps {\n (dispatch: Dispatch>, ownProps: TOwnProps): TDispatchProps\n readonly dependsOnOwnProps: boolean\n}\n\nexport interface InitOptions\n extends PureSelectorFactoryComparisonOptions {\n readonly shouldHandleStateChanges: boolean\n readonly displayName: string\n readonly wrappedComponentName: string\n readonly WrappedComponent: ComponentType\n readonly areMergedPropsEqual: EqualityFn\n}\n\nexport interface SelectorFactoryOptions<\n TStateProps,\n TOwnProps,\n TDispatchProps,\n TMergedProps,\n State,\n> extends InitOptions {\n readonly initMapStateToProps: (\n dispatch: Dispatch>,\n options: InitOptions,\n ) => WrappedMapStateToProps\n readonly initMapDispatchToProps: (\n dispatch: Dispatch>,\n options: InitOptions,\n ) => WrappedMapDispatchToProps\n readonly initMergeProps: (\n dispatch: Dispatch>,\n options: InitOptions,\n ) => MergeProps\n}\n\n// TODO: Add more comments\n\n// The selector returned by selectorFactory will memoize its results,\n// allowing connect's shouldComponentUpdate to return false if final\n// props have not changed.\n\nexport default function finalPropsSelectorFactory<\n TStateProps,\n TOwnProps,\n TDispatchProps,\n TMergedProps,\n State,\n>(\n dispatch: Dispatch>,\n {\n initMapStateToProps,\n initMapDispatchToProps,\n initMergeProps,\n ...options\n }: SelectorFactoryOptions<\n TStateProps,\n TOwnProps,\n TDispatchProps,\n TMergedProps,\n State\n >,\n) {\n const mapStateToProps = initMapStateToProps(dispatch, options)\n const mapDispatchToProps = initMapDispatchToProps(dispatch, options)\n const mergeProps = initMergeProps(dispatch, options)\n\n if (process.env.NODE_ENV !== 'production') {\n verifySubselectors(mapStateToProps, mapDispatchToProps, mergeProps)\n }\n\n return pureFinalPropsSelectorFactory<\n TStateProps,\n TOwnProps,\n TDispatchProps,\n TMergedProps,\n State\n >(mapStateToProps, mapDispatchToProps, mergeProps, dispatch, options)\n}\n", "import type { ActionCreatorsMapObject, Dispatch } from 'redux'\n\nexport default function bindActionCreators(\n actionCreators: ActionCreatorsMapObject,\n dispatch: Dispatch,\n): ActionCreatorsMapObject {\n const boundActionCreators: ActionCreatorsMapObject = {}\n\n for (const key in actionCreators) {\n const actionCreator = actionCreators[key]\n if (typeof actionCreator === 'function') {\n boundActionCreators[key] = (...args) => dispatch(actionCreator(...args))\n }\n }\n return boundActionCreators\n}\n", "/**\n * @param {any} obj The object to inspect.\n * @returns {boolean} True if the argument appears to be a plain object.\n */\nexport default function isPlainObject(obj: unknown) {\n if (typeof obj !== 'object' || obj === null) return false\n\n const proto = Object.getPrototypeOf(obj)\n if (proto === null) return true\n\n let baseProto = proto\n while (Object.getPrototypeOf(baseProto) !== null) {\n baseProto = Object.getPrototypeOf(baseProto)\n }\n\n return proto === baseProto\n}\n", "import isPlainObject from './isPlainObject'\nimport warning from './warning'\n\nexport default function verifyPlainObject(\n value: unknown,\n displayName: string,\n methodName: string,\n) {\n if (!isPlainObject(value)) {\n warning(\n `${methodName}() in ${displayName} must return a plain object. Instead received ${value}.`,\n )\n }\n}\n", "import type { ActionCreatorsMapObject, Dispatch, ActionCreator } from 'redux'\n\nimport type { FixTypeLater } from '../types'\nimport verifyPlainObject from '../utils/verifyPlainObject'\n\ntype AnyState = { [key: string]: any }\ntype StateOrDispatch = S | Dispatch\n\ntype AnyProps = { [key: string]: any }\n\nexport type MapToProps

= {\n // eslint-disable-next-line no-unused-vars\n (stateOrDispatch: StateOrDispatch, ownProps?: P): FixTypeLater\n dependsOnOwnProps?: boolean\n}\n\nexport function wrapMapToPropsConstant(\n // * Note:\n // It seems that the dispatch argument\n // could be a dispatch function in some cases (ex: whenMapDispatchToPropsIsMissing)\n // and a state object in some others (ex: whenMapStateToPropsIsMissing)\n // eslint-disable-next-line no-unused-vars\n getConstant: (dispatch: Dispatch) =>\n | {\n dispatch?: Dispatch\n dependsOnOwnProps?: boolean\n }\n | ActionCreatorsMapObject\n | ActionCreator,\n) {\n return function initConstantSelector(dispatch: Dispatch) {\n const constant = getConstant(dispatch)\n\n function constantSelector() {\n return constant\n }\n constantSelector.dependsOnOwnProps = false\n return constantSelector\n }\n}\n\n// dependsOnOwnProps is used by createMapToPropsProxy to determine whether to pass props as args\n// to the mapToProps function being wrapped. It is also used by makePurePropsSelector to determine\n// whether mapToProps needs to be invoked when props have changed.\n//\n// A length of one signals that mapToProps does not depend on props from the parent component.\n// A length of zero is assumed to mean mapToProps is getting args via arguments or ...args and\n// therefore not reporting its length accurately..\n// TODO Can this get pulled out so that we can subscribe directly to the store if we don't need ownProps?\nfunction getDependsOnOwnProps(mapToProps: MapToProps) {\n return mapToProps.dependsOnOwnProps\n ? Boolean(mapToProps.dependsOnOwnProps)\n : mapToProps.length !== 1\n}\n\n// Used by whenMapStateToPropsIsFunction and whenMapDispatchToPropsIsFunction,\n// this function wraps mapToProps in a proxy function which does several things:\n//\n// * Detects whether the mapToProps function being called depends on props, which\n// is used by selectorFactory to decide if it should reinvoke on props changes.\n//\n// * On first call, handles mapToProps if returns another function, and treats that\n// new function as the true mapToProps for subsequent calls.\n//\n// * On first call, verifies the first result is a plain object, in order to warn\n// the developer that their mapToProps function is not returning a valid result.\n//\nexport function wrapMapToPropsFunc

(\n mapToProps: MapToProps,\n methodName: string,\n) {\n return function initProxySelector(\n dispatch: Dispatch,\n { displayName }: { displayName: string },\n ) {\n const proxy = function mapToPropsProxy(\n stateOrDispatch: StateOrDispatch,\n ownProps?: P,\n ): MapToProps {\n return proxy.dependsOnOwnProps\n ? proxy.mapToProps(stateOrDispatch, ownProps)\n : proxy.mapToProps(stateOrDispatch, undefined)\n }\n\n // allow detectFactoryAndVerify to get ownProps\n proxy.dependsOnOwnProps = true\n\n proxy.mapToProps = function detectFactoryAndVerify(\n stateOrDispatch: StateOrDispatch,\n ownProps?: P,\n ): MapToProps {\n proxy.mapToProps = mapToProps\n proxy.dependsOnOwnProps = getDependsOnOwnProps(mapToProps)\n let props = proxy(stateOrDispatch, ownProps)\n\n if (typeof props === 'function') {\n proxy.mapToProps = props\n proxy.dependsOnOwnProps = getDependsOnOwnProps(props)\n props = proxy(stateOrDispatch, ownProps)\n }\n\n if (process.env.NODE_ENV !== 'production')\n verifyPlainObject(props, displayName, methodName)\n\n return props\n }\n\n return proxy\n }\n}\n", "import type { Action, Dispatch } from 'redux'\n\nexport function createInvalidArgFactory(arg: unknown, name: string) {\n return (\n dispatch: Dispatch>,\n options: { readonly wrappedComponentName: string },\n ) => {\n throw new Error(\n `Invalid value of type ${typeof arg} for ${name} argument when connecting component ${\n options.wrappedComponentName\n }.`,\n )\n }\n}\n", "import type { Action, Dispatch } from 'redux'\nimport bindActionCreators from '../utils/bindActionCreators'\nimport { wrapMapToPropsConstant, wrapMapToPropsFunc } from './wrapMapToProps'\nimport { createInvalidArgFactory } from './invalidArgFactory'\nimport type { MapDispatchToPropsParam } from './selectorFactory'\n\nexport function mapDispatchToPropsFactory(\n mapDispatchToProps:\n | MapDispatchToPropsParam\n | undefined,\n) {\n return mapDispatchToProps && typeof mapDispatchToProps === 'object'\n ? wrapMapToPropsConstant((dispatch: Dispatch>) =>\n // @ts-ignore\n bindActionCreators(mapDispatchToProps, dispatch),\n )\n : !mapDispatchToProps\n ? wrapMapToPropsConstant((dispatch: Dispatch>) => ({\n dispatch,\n }))\n : typeof mapDispatchToProps === 'function'\n ? // @ts-ignore\n wrapMapToPropsFunc(mapDispatchToProps, 'mapDispatchToProps')\n : createInvalidArgFactory(mapDispatchToProps, 'mapDispatchToProps')\n}\n", "import { wrapMapToPropsConstant, wrapMapToPropsFunc } from './wrapMapToProps'\nimport { createInvalidArgFactory } from './invalidArgFactory'\nimport type { MapStateToPropsParam } from './selectorFactory'\n\nexport function mapStateToPropsFactory(\n mapStateToProps: MapStateToPropsParam,\n) {\n return !mapStateToProps\n ? wrapMapToPropsConstant(() => ({}))\n : typeof mapStateToProps === 'function'\n ? // @ts-ignore\n wrapMapToPropsFunc(mapStateToProps, 'mapStateToProps')\n : createInvalidArgFactory(mapStateToProps, 'mapStateToProps')\n}\n", "import type { Action, Dispatch } from 'redux'\nimport verifyPlainObject from '../utils/verifyPlainObject'\nimport { createInvalidArgFactory } from './invalidArgFactory'\nimport type { MergeProps } from './selectorFactory'\nimport type { EqualityFn } from '../types'\n\nfunction defaultMergeProps<\n TStateProps,\n TDispatchProps,\n TOwnProps,\n TMergedProps,\n>(\n stateProps: TStateProps,\n dispatchProps: TDispatchProps,\n ownProps: TOwnProps,\n): TMergedProps {\n // @ts-ignore\n return { ...ownProps, ...stateProps, ...dispatchProps }\n}\n\nfunction wrapMergePropsFunc<\n TStateProps,\n TDispatchProps,\n TOwnProps,\n TMergedProps,\n>(\n mergeProps: MergeProps,\n): (\n dispatch: Dispatch>,\n options: {\n readonly displayName: string\n readonly areMergedPropsEqual: EqualityFn\n },\n) => MergeProps {\n return function initMergePropsProxy(\n dispatch,\n { displayName, areMergedPropsEqual },\n ) {\n let hasRunOnce = false\n let mergedProps: TMergedProps\n\n return function mergePropsProxy(\n stateProps: TStateProps,\n dispatchProps: TDispatchProps,\n ownProps: TOwnProps,\n ) {\n const nextMergedProps = mergeProps(stateProps, dispatchProps, ownProps)\n\n if (hasRunOnce) {\n if (!areMergedPropsEqual(nextMergedProps, mergedProps))\n mergedProps = nextMergedProps\n } else {\n hasRunOnce = true\n mergedProps = nextMergedProps\n\n if (process.env.NODE_ENV !== 'production')\n verifyPlainObject(mergedProps, displayName, 'mergeProps')\n }\n\n return mergedProps\n }\n }\n}\n\nexport function mergePropsFactory<\n TStateProps,\n TDispatchProps,\n TOwnProps,\n TMergedProps,\n>(\n mergeProps?: MergeProps,\n) {\n return !mergeProps\n ? () => defaultMergeProps\n : typeof mergeProps === 'function'\n ? wrapMergePropsFunc(mergeProps)\n : createInvalidArgFactory(mergeProps, 'mergeProps')\n}\n", "// Default to a dummy \"batch\" implementation that just runs the callback\r\nexport function defaultNoopBatch(callback: () => void) {\r\n callback()\r\n}\r\n", "import { defaultNoopBatch as batch } from './batch'\n\n// encapsulates the subscription logic for connecting a component to the redux store, as\n// well as nesting subscriptions of descendant components, so that we can ensure the\n// ancestor components re-render before descendants\n\ntype VoidFunc = () => void\n\ntype Listener = {\n callback: VoidFunc\n next: Listener | null\n prev: Listener | null\n}\n\nfunction createListenerCollection() {\n let first: Listener | null = null\n let last: Listener | null = null\n\n return {\n clear() {\n first = null\n last = null\n },\n\n notify() {\n batch(() => {\n let listener = first\n while (listener) {\n listener.callback()\n listener = listener.next\n }\n })\n },\n\n get() {\n const listeners: Listener[] = []\n let listener = first\n while (listener) {\n listeners.push(listener)\n listener = listener.next\n }\n return listeners\n },\n\n subscribe(callback: () => void) {\n let isSubscribed = true\n\n const listener: Listener = (last = {\n callback,\n next: null,\n prev: last,\n })\n\n if (listener.prev) {\n listener.prev.next = listener\n } else {\n first = listener\n }\n\n return function unsubscribe() {\n if (!isSubscribed || first === null) return\n isSubscribed = false\n\n if (listener.next) {\n listener.next.prev = listener.prev\n } else {\n last = listener.prev\n }\n if (listener.prev) {\n listener.prev.next = listener.next\n } else {\n first = listener.next\n }\n }\n },\n }\n}\n\ntype ListenerCollection = ReturnType\n\nexport interface Subscription {\n addNestedSub: (listener: VoidFunc) => VoidFunc\n notifyNestedSubs: VoidFunc\n handleChangeWrapper: VoidFunc\n isSubscribed: () => boolean\n onStateChange?: VoidFunc | null\n trySubscribe: VoidFunc\n tryUnsubscribe: VoidFunc\n getListeners: () => ListenerCollection\n}\n\nconst nullListeners = {\n notify() {},\n get: () => [],\n} as unknown as ListenerCollection\n\nexport function createSubscription(store: any, parentSub?: Subscription) {\n let unsubscribe: VoidFunc | undefined\n let listeners: ListenerCollection = nullListeners\n\n // Reasons to keep the subscription active\n let subscriptionsAmount = 0\n\n // Is this specific subscription subscribed (or only nested ones?)\n let selfSubscribed = false\n\n function addNestedSub(listener: () => void) {\n trySubscribe()\n\n const cleanupListener = listeners.subscribe(listener)\n\n // cleanup nested sub\n let removed = false\n return () => {\n if (!removed) {\n removed = true\n cleanupListener()\n tryUnsubscribe()\n }\n }\n }\n\n function notifyNestedSubs() {\n listeners.notify()\n }\n\n function handleChangeWrapper() {\n if (subscription.onStateChange) {\n subscription.onStateChange()\n }\n }\n\n function isSubscribed() {\n return selfSubscribed\n }\n\n function trySubscribe() {\n subscriptionsAmount++\n if (!unsubscribe) {\n unsubscribe = parentSub\n ? parentSub.addNestedSub(handleChangeWrapper)\n : store.subscribe(handleChangeWrapper)\n\n listeners = createListenerCollection()\n }\n }\n\n function tryUnsubscribe() {\n subscriptionsAmount--\n if (unsubscribe && subscriptionsAmount === 0) {\n unsubscribe()\n unsubscribe = undefined\n listeners.clear()\n listeners = nullListeners\n }\n }\n\n function trySubscribeSelf() {\n if (!selfSubscribed) {\n selfSubscribed = true\n trySubscribe()\n }\n }\n\n function tryUnsubscribeSelf() {\n if (selfSubscribed) {\n selfSubscribed = false\n tryUnsubscribe()\n }\n }\n\n const subscription: Subscription = {\n addNestedSub,\n notifyNestedSubs,\n handleChangeWrapper,\n isSubscribed,\n trySubscribe: trySubscribeSelf,\n tryUnsubscribe: tryUnsubscribeSelf,\n getListeners: () => listeners,\n }\n\n return subscription\n}\n", "import { React } from '../utils/react'\n\n// React currently throws a warning when using useLayoutEffect on the server.\n// To get around it, we can conditionally useEffect on the server (no-op) and\n// useLayoutEffect in the browser. We need useLayoutEffect to ensure the store\n// subscription callback always has the selector from the latest render commit\n// available, otherwise a store update may happen between render and the effect,\n// which may cause missed updates; we also must ensure the store subscription\n// is created synchronously, otherwise a store update may occur before the\n// subscription is created and an inconsistent state may be observed\n\n// Matches logic in React's `shared/ExecutionEnvironment` file\nconst canUseDOM = () =>\n !!(\n typeof window !== 'undefined' &&\n typeof window.document !== 'undefined' &&\n typeof window.document.createElement !== 'undefined'\n )\n\nconst isDOM = /* @__PURE__ */ canUseDOM()\n\n// Under React Native, we know that we always want to use useLayoutEffect\n\n/**\n * Checks if the code is running in a React Native environment.\n *\n * @returns Whether the code is running in a React Native environment.\n *\n * @see {@link https://github.com/facebook/react-native/issues/1331 Reference}\n */\nconst isRunningInReactNative = () =>\n typeof navigator !== 'undefined' && navigator.product === 'ReactNative'\n\nconst isReactNative = /* @__PURE__ */ isRunningInReactNative()\n\nconst getUseIsomorphicLayoutEffect = () =>\n isDOM || isReactNative ? React.useLayoutEffect : React.useEffect\n\nexport const useIsomorphicLayoutEffect =\n /* @__PURE__ */ getUseIsomorphicLayoutEffect()\n", "function is(x: unknown, y: unknown) {\r\n if (x === y) {\r\n return x !== 0 || y !== 0 || 1 / x === 1 / y\r\n } else {\r\n return x !== x && y !== y\r\n }\r\n}\r\n\r\nexport default function shallowEqual(objA: any, objB: any) {\r\n if (is(objA, objB)) return true\r\n\r\n if (\r\n typeof objA !== 'object' ||\r\n objA === null ||\r\n typeof objB !== 'object' ||\r\n objB === null\r\n ) {\r\n return false\r\n }\r\n\r\n const keysA = Object.keys(objA)\r\n const keysB = Object.keys(objB)\r\n\r\n if (keysA.length !== keysB.length) return false\r\n\r\n for (let i = 0; i < keysA.length; i++) {\r\n if (\r\n !Object.prototype.hasOwnProperty.call(objB, keysA[i]) ||\r\n !is(objA[keysA[i]], objB[keysA[i]])\r\n ) {\r\n return false\r\n }\r\n }\r\n\r\n return true\r\n}\r\n", "// Copied directly from:\n// https://github.com/mridgway/hoist-non-react-statics/blob/main/src/index.js\n// https://unpkg.com/browse/@types/hoist-non-react-statics@3.3.6/index.d.ts\n\n/**\n * Copyright 2015, Yahoo! Inc.\n * Copyrights licensed under the New BSD License. See the accompanying LICENSE file for terms.\n */\nimport type { ForwardRefExoticComponent, MemoExoticComponent } from 'react'\nimport { ForwardRef, Memo, isMemo } from '../utils/react-is'\n\nconst REACT_STATICS = {\n childContextTypes: true,\n contextType: true,\n contextTypes: true,\n defaultProps: true,\n displayName: true,\n getDefaultProps: true,\n getDerivedStateFromError: true,\n getDerivedStateFromProps: true,\n mixins: true,\n propTypes: true,\n type: true,\n} as const\n\nconst KNOWN_STATICS = {\n name: true,\n length: true,\n prototype: true,\n caller: true,\n callee: true,\n arguments: true,\n arity: true,\n} as const\n\nconst FORWARD_REF_STATICS = {\n $$typeof: true,\n render: true,\n defaultProps: true,\n displayName: true,\n propTypes: true,\n} as const\n\nconst MEMO_STATICS = {\n $$typeof: true,\n compare: true,\n defaultProps: true,\n displayName: true,\n propTypes: true,\n type: true,\n} as const\n\nconst TYPE_STATICS = {\n [ForwardRef]: FORWARD_REF_STATICS,\n [Memo]: MEMO_STATICS,\n} as const\n\nfunction getStatics(component: any) {\n // React v16.11 and below\n if (isMemo(component)) {\n return MEMO_STATICS\n }\n\n // React v16.12 and above\n return TYPE_STATICS[component['$$typeof']] || REACT_STATICS\n}\n\nexport type NonReactStatics<\n Source,\n C extends {\n [key: string]: true\n } = {},\n> = {\n [key in Exclude<\n keyof Source,\n Source extends MemoExoticComponent\n ? keyof typeof MEMO_STATICS | keyof C\n : Source extends ForwardRefExoticComponent\n ? keyof typeof FORWARD_REF_STATICS | keyof C\n : keyof typeof REACT_STATICS | keyof typeof KNOWN_STATICS | keyof C\n >]: Source[key]\n}\n\nconst defineProperty = Object.defineProperty\nconst getOwnPropertyNames = Object.getOwnPropertyNames\nconst getOwnPropertySymbols = Object.getOwnPropertySymbols\nconst getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor\nconst getPrototypeOf = Object.getPrototypeOf\nconst objectPrototype = Object.prototype\n\nexport default function hoistNonReactStatics<\n Target,\n Source,\n CustomStatic extends {\n [key: string]: true\n } = {},\n>(\n targetComponent: Target,\n sourceComponent: Source,\n): Target & NonReactStatics {\n if (typeof sourceComponent !== 'string') {\n // don't hoist over string (html) components\n\n if (objectPrototype) {\n const inheritedComponent = getPrototypeOf(sourceComponent)\n if (inheritedComponent && inheritedComponent !== objectPrototype) {\n hoistNonReactStatics(targetComponent, inheritedComponent)\n }\n }\n\n let keys: (string | symbol)[] = getOwnPropertyNames(sourceComponent)\n\n if (getOwnPropertySymbols) {\n keys = keys.concat(getOwnPropertySymbols(sourceComponent))\n }\n\n const targetStatics = getStatics(targetComponent)\n const sourceStatics = getStatics(sourceComponent)\n\n for (let i = 0; i < keys.length; ++i) {\n const key = keys[i]\n if (\n !KNOWN_STATICS[key as keyof typeof KNOWN_STATICS] &&\n !(sourceStatics && sourceStatics[key as keyof typeof sourceStatics]) &&\n !(targetStatics && targetStatics[key as keyof typeof targetStatics])\n ) {\n const descriptor = getOwnPropertyDescriptor(sourceComponent, key)\n try {\n // Avoid failures from read-only properties\n defineProperty(targetComponent, key, descriptor!)\n } catch (e) {\n // ignore\n }\n }\n }\n }\n\n return targetComponent as any\n}\n", "import type { Context } from 'react'\nimport { React } from '../utils/react'\nimport type { Action, Store, UnknownAction } from 'redux'\nimport type { Subscription } from '../utils/Subscription'\nimport type { ProviderProps } from './Provider'\n\nexport interface ReactReduxContextValue<\n SS = any,\n A extends Action = UnknownAction,\n> extends Pick {\n store: Store\n subscription: Subscription\n getServerState?: () => SS\n}\n\nconst ContextKey = /* @__PURE__ */ Symbol.for(`react-redux-context`)\nconst gT: {\n [ContextKey]?: Map<\n typeof React.createContext,\n Context\n >\n} = (\n typeof globalThis !== 'undefined'\n ? globalThis\n : /* fall back to a per-module scope (pre-8.1 behaviour) if `globalThis` is not available */ {}\n) as any\n\nfunction getContext(): Context {\n if (!React.createContext) return {} as any\n\n const contextMap = (gT[ContextKey] ??= new Map<\n typeof React.createContext,\n Context\n >())\n let realContext = contextMap.get(React.createContext)\n if (!realContext) {\n realContext = React.createContext(\n null as any,\n )\n if (process.env.NODE_ENV !== 'production') {\n realContext.displayName = 'ReactRedux'\n }\n contextMap.set(React.createContext, realContext)\n }\n return realContext\n}\n\nexport const ReactReduxContext = /*#__PURE__*/ getContext()\n\nexport type ReactReduxContextInstance = typeof ReactReduxContext\n", "/* eslint-disable valid-jsdoc, @typescript-eslint/no-unused-vars */\nimport type { ComponentType } from 'react'\nimport { React } from '../utils/react'\nimport { isValidElementType, isContextConsumer } from '../utils/react-is'\n\nimport type { Store } from 'redux'\n\nimport type {\n ConnectedComponent,\n InferableComponentEnhancer,\n InferableComponentEnhancerWithProps,\n ResolveThunks,\n DispatchProp,\n ConnectPropsMaybeWithoutContext,\n} from '../types'\n\nimport type {\n MapStateToPropsParam,\n MapDispatchToPropsParam,\n MergeProps,\n MapDispatchToPropsNonObject,\n SelectorFactoryOptions,\n} from '../connect/selectorFactory'\nimport defaultSelectorFactory from '../connect/selectorFactory'\nimport { mapDispatchToPropsFactory } from '../connect/mapDispatchToProps'\nimport { mapStateToPropsFactory } from '../connect/mapStateToProps'\nimport { mergePropsFactory } from '../connect/mergeProps'\n\nimport type { Subscription } from '../utils/Subscription'\nimport { createSubscription } from '../utils/Subscription'\nimport { useIsomorphicLayoutEffect } from '../utils/useIsomorphicLayoutEffect'\nimport shallowEqual from '../utils/shallowEqual'\nimport hoistStatics from '../utils/hoistStatics'\nimport warning from '../utils/warning'\n\nimport type {\n ReactReduxContextValue,\n ReactReduxContextInstance,\n} from './Context'\nimport { ReactReduxContext } from './Context'\n\n// Define some constant arrays just to avoid re-creating these\nconst EMPTY_ARRAY: [unknown, number] = [null, 0]\nconst NO_SUBSCRIPTION_ARRAY = [null, null]\n\n// Attempts to stringify whatever not-really-a-component value we were given\n// for logging in an error message\nconst stringifyComponent = (Comp: unknown) => {\n try {\n return JSON.stringify(Comp)\n } catch (err) {\n return String(Comp)\n }\n}\n\ntype EffectFunc = (...args: any[]) => void | ReturnType\n\n// This is \"just\" a `useLayoutEffect`, but with two modifications:\n// - we need to fall back to `useEffect` in SSR to avoid annoying warnings\n// - we extract this to a separate function to avoid closing over values\n// and causing memory leaks\nfunction useIsomorphicLayoutEffectWithArgs(\n effectFunc: EffectFunc,\n effectArgs: any[],\n dependencies?: React.DependencyList,\n) {\n useIsomorphicLayoutEffect(() => effectFunc(...effectArgs), dependencies)\n}\n\n// Effect callback, extracted: assign the latest props values to refs for later usage\nfunction captureWrapperProps(\n lastWrapperProps: React.MutableRefObject,\n lastChildProps: React.MutableRefObject,\n renderIsScheduled: React.MutableRefObject,\n wrapperProps: unknown,\n // actualChildProps: unknown,\n childPropsFromStoreUpdate: React.MutableRefObject,\n notifyNestedSubs: () => void,\n) {\n // We want to capture the wrapper props and child props we used for later comparisons\n lastWrapperProps.current = wrapperProps\n renderIsScheduled.current = false\n\n // If the render was from a store update, clear out that reference and cascade the subscriber update\n if (childPropsFromStoreUpdate.current) {\n childPropsFromStoreUpdate.current = null\n notifyNestedSubs()\n }\n}\n\n// Effect callback, extracted: subscribe to the Redux store or nearest connected ancestor,\n// check for updates after dispatched actions, and trigger re-renders.\nfunction subscribeUpdates(\n shouldHandleStateChanges: boolean,\n store: Store,\n subscription: Subscription,\n childPropsSelector: (state: unknown, props: unknown) => unknown,\n lastWrapperProps: React.MutableRefObject,\n lastChildProps: React.MutableRefObject,\n renderIsScheduled: React.MutableRefObject,\n isMounted: React.MutableRefObject,\n childPropsFromStoreUpdate: React.MutableRefObject,\n notifyNestedSubs: () => void,\n // forceComponentUpdateDispatch: React.Dispatch,\n additionalSubscribeListener: () => void,\n) {\n // If we're not subscribed to the store, nothing to do here\n if (!shouldHandleStateChanges) return () => {}\n\n // Capture values for checking if and when this component unmounts\n let didUnsubscribe = false\n let lastThrownError: Error | null = null\n\n // We'll run this callback every time a store subscription update propagates to this component\n const checkForUpdates = () => {\n if (didUnsubscribe || !isMounted.current) {\n // Don't run stale listeners.\n // Redux doesn't guarantee unsubscriptions happen until next dispatch.\n return\n }\n\n // TODO We're currently calling getState ourselves here, rather than letting `uSES` do it\n const latestStoreState = store.getState()\n\n let newChildProps, error\n try {\n // Actually run the selector with the most recent store state and wrapper props\n // to determine what the child props should be\n newChildProps = childPropsSelector(\n latestStoreState,\n lastWrapperProps.current,\n )\n } catch (e) {\n error = e\n lastThrownError = e as Error | null\n }\n\n if (!error) {\n lastThrownError = null\n }\n\n // If the child props haven't changed, nothing to do here - cascade the subscription update\n if (newChildProps === lastChildProps.current) {\n if (!renderIsScheduled.current) {\n notifyNestedSubs()\n }\n } else {\n // Save references to the new child props. Note that we track the \"child props from store update\"\n // as a ref instead of a useState/useReducer because we need a way to determine if that value has\n // been processed. If this went into useState/useReducer, we couldn't clear out the value without\n // forcing another re-render, which we don't want.\n lastChildProps.current = newChildProps\n childPropsFromStoreUpdate.current = newChildProps\n renderIsScheduled.current = true\n\n // TODO This is hacky and not how `uSES` is meant to be used\n // Trigger the React `useSyncExternalStore` subscriber\n additionalSubscribeListener()\n }\n }\n\n // Actually subscribe to the nearest connected ancestor (or store)\n subscription.onStateChange = checkForUpdates\n subscription.trySubscribe()\n\n // Pull data from the store after first render in case the store has\n // changed since we began.\n checkForUpdates()\n\n const unsubscribeWrapper = () => {\n didUnsubscribe = true\n subscription.tryUnsubscribe()\n subscription.onStateChange = null\n\n if (lastThrownError) {\n // It's possible that we caught an error due to a bad mapState function, but the\n // parent re-rendered without this component and we're about to unmount.\n // This shouldn't happen as long as we do top-down subscriptions correctly, but\n // if we ever do those wrong, this throw will surface the error in our tests.\n // In that case, throw the error from here so it doesn't get lost.\n throw lastThrownError\n }\n }\n\n return unsubscribeWrapper\n}\n\n// Reducer initial state creation for our update reducer\nconst initStateUpdates = () => EMPTY_ARRAY\n\nexport interface ConnectProps {\n /** A custom Context instance that the component can use to access the store from an alternate Provider using that same Context instance */\n context?: ReactReduxContextInstance\n /** A Redux store instance to be used for subscriptions instead of the store from a Provider */\n store?: Store\n}\n\ninterface InternalConnectProps extends ConnectProps {\n reactReduxForwardedRef?: React.ForwardedRef\n}\n\nfunction strictEqual(a: unknown, b: unknown) {\n return a === b\n}\n\n/**\n * Infers the type of props that a connector will inject into a component.\n */\nexport type ConnectedProps =\n TConnector extends InferableComponentEnhancerWithProps<\n infer TInjectedProps,\n any\n >\n ? unknown extends TInjectedProps\n ? TConnector extends InferableComponentEnhancer\n ? TInjectedProps\n : never\n : TInjectedProps\n : never\n\nexport interface ConnectOptions<\n State = unknown,\n TStateProps = {},\n TOwnProps = {},\n TMergedProps = {},\n> {\n forwardRef?: boolean\n context?: typeof ReactReduxContext\n areStatesEqual?: (\n nextState: State,\n prevState: State,\n nextOwnProps: TOwnProps,\n prevOwnProps: TOwnProps,\n ) => boolean\n\n areOwnPropsEqual?: (\n nextOwnProps: TOwnProps,\n prevOwnProps: TOwnProps,\n ) => boolean\n\n areStatePropsEqual?: (\n nextStateProps: TStateProps,\n prevStateProps: TStateProps,\n ) => boolean\n areMergedPropsEqual?: (\n nextMergedProps: TMergedProps,\n prevMergedProps: TMergedProps,\n ) => boolean\n}\n\n/**\n * Connects a React component to a Redux store.\n *\n * - Without arguments, just wraps the component, without changing the behavior / props\n *\n * - If 2 params are passed (3rd param, mergeProps, is skipped), default behavior\n * is to override ownProps (as stated in the docs), so what remains is everything that's\n * not a state or dispatch prop\n *\n * - When 3rd param is passed, we don't know if ownProps propagate and whether they\n * should be valid component props, because it depends on mergeProps implementation.\n * As such, it is the user's responsibility to extend ownProps interface from state or\n * dispatch props or both when applicable\n *\n * @param mapStateToProps\n * @param mapDispatchToProps\n * @param mergeProps\n * @param options\n */\nexport interface Connect {\n // tslint:disable:no-unnecessary-generics\n (): InferableComponentEnhancer\n\n /** mapState only */\n (\n mapStateToProps: MapStateToPropsParam,\n ): InferableComponentEnhancerWithProps\n\n /** mapDispatch only (as a function) */\n (\n mapStateToProps: null | undefined,\n mapDispatchToProps: MapDispatchToPropsNonObject,\n ): InferableComponentEnhancerWithProps\n\n /** mapDispatch only (as an object) */\n (\n mapStateToProps: null | undefined,\n mapDispatchToProps: MapDispatchToPropsParam,\n ): InferableComponentEnhancerWithProps<\n ResolveThunks,\n TOwnProps\n >\n\n /** mapState and mapDispatch (as a function)*/\n (\n mapStateToProps: MapStateToPropsParam,\n mapDispatchToProps: MapDispatchToPropsNonObject,\n ): InferableComponentEnhancerWithProps<\n TStateProps & TDispatchProps,\n TOwnProps\n >\n\n /** mapState and mapDispatch (nullish) */\n (\n mapStateToProps: MapStateToPropsParam,\n mapDispatchToProps: null | undefined,\n ): InferableComponentEnhancerWithProps\n\n /** mapState and mapDispatch (as an object) */\n (\n mapStateToProps: MapStateToPropsParam,\n mapDispatchToProps: MapDispatchToPropsParam,\n ): InferableComponentEnhancerWithProps<\n TStateProps & ResolveThunks,\n TOwnProps\n >\n\n /** mergeProps only */\n (\n mapStateToProps: null | undefined,\n mapDispatchToProps: null | undefined,\n mergeProps: MergeProps,\n ): InferableComponentEnhancerWithProps\n\n /** mapState and mergeProps */\n <\n TStateProps = {},\n no_dispatch = {},\n TOwnProps = {},\n TMergedProps = {},\n State = DefaultState,\n >(\n mapStateToProps: MapStateToPropsParam,\n mapDispatchToProps: null | undefined,\n mergeProps: MergeProps,\n ): InferableComponentEnhancerWithProps\n\n /** mapDispatch (as a object) and mergeProps */\n (\n mapStateToProps: null | undefined,\n mapDispatchToProps: MapDispatchToPropsParam,\n mergeProps: MergeProps,\n ): InferableComponentEnhancerWithProps\n\n /** mapState and options */\n (\n mapStateToProps: MapStateToPropsParam,\n mapDispatchToProps: null | undefined,\n mergeProps: null | undefined,\n options: ConnectOptions,\n ): InferableComponentEnhancerWithProps\n\n /** mapDispatch (as a function) and options */\n (\n mapStateToProps: null | undefined,\n mapDispatchToProps: MapDispatchToPropsNonObject,\n mergeProps: null | undefined,\n options: ConnectOptions<{}, TStateProps, TOwnProps>,\n ): InferableComponentEnhancerWithProps\n\n /** mapDispatch (as an object) and options*/\n (\n mapStateToProps: null | undefined,\n mapDispatchToProps: MapDispatchToPropsParam,\n mergeProps: null | undefined,\n options: ConnectOptions<{}, TStateProps, TOwnProps>,\n ): InferableComponentEnhancerWithProps<\n ResolveThunks,\n TOwnProps\n >\n\n /** mapState, mapDispatch (as a function), and options */\n (\n mapStateToProps: MapStateToPropsParam,\n mapDispatchToProps: MapDispatchToPropsNonObject,\n mergeProps: null | undefined,\n options: ConnectOptions,\n ): InferableComponentEnhancerWithProps<\n TStateProps & TDispatchProps,\n TOwnProps\n >\n\n /** mapState, mapDispatch (as an object), and options */\n (\n mapStateToProps: MapStateToPropsParam,\n mapDispatchToProps: MapDispatchToPropsParam,\n mergeProps: null | undefined,\n options: ConnectOptions,\n ): InferableComponentEnhancerWithProps<\n TStateProps & ResolveThunks,\n TOwnProps\n >\n\n /** mapState, mapDispatch, mergeProps, and options */\n <\n TStateProps = {},\n TDispatchProps = {},\n TOwnProps = {},\n TMergedProps = {},\n State = DefaultState,\n >(\n mapStateToProps: MapStateToPropsParam,\n mapDispatchToProps: MapDispatchToPropsParam,\n mergeProps: MergeProps<\n TStateProps,\n TDispatchProps,\n TOwnProps,\n TMergedProps\n >,\n options?: ConnectOptions,\n ): InferableComponentEnhancerWithProps\n // tslint:enable:no-unnecessary-generics\n}\n\nlet hasWarnedAboutDeprecatedPureOption = false\n\n/**\n * Connects a React component to a Redux store.\n *\n * - Without arguments, just wraps the component, without changing the behavior / props\n *\n * - If 2 params are passed (3rd param, mergeProps, is skipped), default behavior\n * is to override ownProps (as stated in the docs), so what remains is everything that's\n * not a state or dispatch prop\n *\n * - When 3rd param is passed, we don't know if ownProps propagate and whether they\n * should be valid component props, because it depends on mergeProps implementation.\n * As such, it is the user's responsibility to extend ownProps interface from state or\n * dispatch props or both when applicable\n *\n * @param mapStateToProps A function that extracts values from state\n * @param mapDispatchToProps Setup for dispatching actions\n * @param mergeProps Optional callback to merge state and dispatch props together\n * @param options Options for configuring the connection\n *\n */\nfunction connect<\n TStateProps = {},\n TDispatchProps = {},\n TOwnProps = {},\n TMergedProps = {},\n State = unknown,\n>(\n mapStateToProps?: MapStateToPropsParam,\n mapDispatchToProps?: MapDispatchToPropsParam,\n mergeProps?: MergeProps,\n {\n // The `pure` option has been removed, so TS doesn't like us destructuring this to check its existence.\n // @ts-ignore\n pure,\n areStatesEqual = strictEqual,\n areOwnPropsEqual = shallowEqual,\n areStatePropsEqual = shallowEqual,\n areMergedPropsEqual = shallowEqual,\n\n // use React's forwardRef to expose a ref of the wrapped component\n forwardRef = false,\n\n // the context consumer to use\n context = ReactReduxContext,\n }: ConnectOptions = {},\n): unknown {\n if (process.env.NODE_ENV !== 'production') {\n if (pure !== undefined && !hasWarnedAboutDeprecatedPureOption) {\n hasWarnedAboutDeprecatedPureOption = true\n warning(\n 'The `pure` option has been removed. `connect` is now always a \"pure/memoized\" component',\n )\n }\n }\n\n const Context = context\n\n const initMapStateToProps = mapStateToPropsFactory(mapStateToProps)\n const initMapDispatchToProps = mapDispatchToPropsFactory(mapDispatchToProps)\n const initMergeProps = mergePropsFactory(mergeProps)\n\n const shouldHandleStateChanges = Boolean(mapStateToProps)\n\n const wrapWithConnect = (\n WrappedComponent: ComponentType,\n ) => {\n type WrappedComponentProps = TProps &\n ConnectPropsMaybeWithoutContext\n\n if (process.env.NODE_ENV !== 'production') {\n const isValid = /*#__PURE__*/ isValidElementType(WrappedComponent)\n if (!isValid)\n throw new Error(\n `You must pass a component to the function returned by connect. Instead received ${stringifyComponent(\n WrappedComponent,\n )}`,\n )\n }\n\n const wrappedComponentName =\n WrappedComponent.displayName || WrappedComponent.name || 'Component'\n\n const displayName = `Connect(${wrappedComponentName})`\n\n const selectorFactoryOptions: SelectorFactoryOptions<\n any,\n any,\n any,\n any,\n State\n > = {\n shouldHandleStateChanges,\n displayName,\n wrappedComponentName,\n WrappedComponent,\n // @ts-ignore\n initMapStateToProps,\n initMapDispatchToProps,\n initMergeProps,\n areStatesEqual,\n areStatePropsEqual,\n areOwnPropsEqual,\n areMergedPropsEqual,\n }\n\n function ConnectFunction(\n props: InternalConnectProps & TOwnProps,\n ) {\n const [propsContext, reactReduxForwardedRef, wrapperProps] =\n React.useMemo(() => {\n // Distinguish between actual \"data\" props that were passed to the wrapper component,\n // and values needed to control behavior (forwarded refs, alternate context instances).\n // To maintain the wrapperProps object reference, memoize this destructuring.\n const { reactReduxForwardedRef, ...wrapperProps } = props\n return [props.context, reactReduxForwardedRef, wrapperProps]\n }, [props])\n\n const ContextToUse: ReactReduxContextInstance = React.useMemo(() => {\n // Users may optionally pass in a custom context instance to use instead of our ReactReduxContext.\n // Memoize the check that determines which context instance we should use.\n let ResultContext = Context\n if (propsContext?.Consumer) {\n if (process.env.NODE_ENV !== 'production') {\n const isValid = /*#__PURE__*/ isContextConsumer(\n // @ts-ignore\n ,\n )\n if (!isValid) {\n throw new Error(\n 'You must pass a valid React context consumer as `props.context`',\n )\n }\n ResultContext = propsContext\n }\n }\n return ResultContext\n }, [propsContext, Context])\n\n // Retrieve the store and ancestor subscription via context, if available\n const contextValue = React.useContext(ContextToUse)\n\n // The store _must_ exist as either a prop or in context.\n // We'll check to see if it _looks_ like a Redux store first.\n // This allows us to pass through a `store` prop that is just a plain value.\n const didStoreComeFromProps =\n Boolean(props.store) &&\n Boolean(props.store!.getState) &&\n Boolean(props.store!.dispatch)\n const didStoreComeFromContext =\n Boolean(contextValue) && Boolean(contextValue!.store)\n\n if (\n process.env.NODE_ENV !== 'production' &&\n !didStoreComeFromProps &&\n !didStoreComeFromContext\n ) {\n throw new Error(\n `Could not find \"store\" in the context of ` +\n `\"${displayName}\". Either wrap the root component in a , ` +\n `or pass a custom React context provider to and the corresponding ` +\n `React context consumer to ${displayName} in connect options.`,\n )\n }\n\n // Based on the previous check, one of these must be true\n const store: Store = didStoreComeFromProps\n ? props.store!\n : contextValue!.store\n\n const getServerState = didStoreComeFromContext\n ? contextValue!.getServerState\n : store.getState\n\n const childPropsSelector = React.useMemo(() => {\n // The child props selector needs the store reference as an input.\n // Re-create this selector whenever the store changes.\n return defaultSelectorFactory(store.dispatch, selectorFactoryOptions)\n }, [store])\n\n const [subscription, notifyNestedSubs] = React.useMemo(() => {\n if (!shouldHandleStateChanges) return NO_SUBSCRIPTION_ARRAY\n\n // This Subscription's source should match where store came from: props vs. context. A component\n // connected to the store via props shouldn't use subscription from context, or vice versa.\n const subscription = createSubscription(\n store,\n didStoreComeFromProps ? undefined : contextValue!.subscription,\n )\n\n // `notifyNestedSubs` is duplicated to handle the case where the component is unmounted in\n // the middle of the notification loop, where `subscription` will then be null. This can\n // probably be avoided if Subscription's listeners logic is changed to not call listeners\n // that have been unsubscribed in the middle of the notification loop.\n const notifyNestedSubs =\n subscription.notifyNestedSubs.bind(subscription)\n\n return [subscription, notifyNestedSubs]\n }, [store, didStoreComeFromProps, contextValue])\n\n // Determine what {store, subscription} value should be put into nested context, if necessary,\n // and memoize that value to avoid unnecessary context updates.\n const overriddenContextValue = React.useMemo(() => {\n if (didStoreComeFromProps) {\n // This component is directly subscribed to a store from props.\n // We don't want descendants reading from this store - pass down whatever\n // the existing context value is from the nearest connected ancestor.\n return contextValue!\n }\n\n // Otherwise, put this component's subscription instance into context, so that\n // connected descendants won't update until after this component is done\n return {\n ...contextValue,\n subscription,\n } as ReactReduxContextValue\n }, [didStoreComeFromProps, contextValue, subscription])\n\n // Set up refs to coordinate values between the subscription effect and the render logic\n const lastChildProps = React.useRef(undefined)\n const lastWrapperProps = React.useRef(wrapperProps)\n const childPropsFromStoreUpdate = React.useRef(undefined)\n const renderIsScheduled = React.useRef(false)\n const isMounted = React.useRef(false)\n\n // TODO: Change this to `React.useRef(undefined)` after upgrading to React 19.\n /**\n * @todo Change this to `React.useRef(undefined)` after upgrading to React 19.\n */\n const latestSubscriptionCallbackError = React.useRef(\n undefined,\n )\n\n useIsomorphicLayoutEffect(() => {\n isMounted.current = true\n return () => {\n isMounted.current = false\n }\n }, [])\n\n const actualChildPropsSelector = React.useMemo(() => {\n const selector = () => {\n // Tricky logic here:\n // - This render may have been triggered by a Redux store update that produced new child props\n // - However, we may have gotten new wrapper props after that\n // If we have new child props, and the same wrapper props, we know we should use the new child props as-is.\n // But, if we have new wrapper props, those might change the child props, so we have to recalculate things.\n // So, we'll use the child props from store update only if the wrapper props are the same as last time.\n if (\n childPropsFromStoreUpdate.current &&\n wrapperProps === lastWrapperProps.current\n ) {\n return childPropsFromStoreUpdate.current\n }\n\n // TODO We're reading the store directly in render() here. Bad idea?\n // This will likely cause Bad Things (TM) to happen in Concurrent Mode.\n // Note that we do this because on renders _not_ caused by store updates, we need the latest store state\n // to determine what the child props should be.\n return childPropsSelector(store.getState(), wrapperProps)\n }\n return selector\n }, [store, wrapperProps])\n\n // We need this to execute synchronously every time we re-render. However, React warns\n // about useLayoutEffect in SSR, so we try to detect environment and fall back to\n // just useEffect instead to avoid the warning, since neither will run anyway.\n\n const subscribeForReact = React.useMemo(() => {\n const subscribe = (reactListener: () => void) => {\n if (!subscription) {\n return () => {}\n }\n\n return subscribeUpdates(\n shouldHandleStateChanges,\n store,\n subscription,\n // @ts-ignore\n childPropsSelector,\n lastWrapperProps,\n lastChildProps,\n renderIsScheduled,\n isMounted,\n childPropsFromStoreUpdate,\n notifyNestedSubs,\n reactListener,\n )\n }\n\n return subscribe\n }, [subscription])\n\n useIsomorphicLayoutEffectWithArgs(captureWrapperProps, [\n lastWrapperProps,\n lastChildProps,\n renderIsScheduled,\n wrapperProps,\n childPropsFromStoreUpdate,\n notifyNestedSubs,\n ])\n\n let actualChildProps: Record\n\n try {\n actualChildProps = React.useSyncExternalStore(\n // TODO We're passing through a big wrapper that does a bunch of extra side effects besides subscribing\n subscribeForReact,\n // TODO This is incredibly hacky. We've already processed the store update and calculated new child props,\n // TODO and we're just passing that through so it triggers a re-render for us rather than relying on `uSES`.\n actualChildPropsSelector,\n getServerState\n ? () => childPropsSelector(getServerState(), wrapperProps)\n : actualChildPropsSelector,\n )\n } catch (err) {\n if (latestSubscriptionCallbackError.current) {\n // eslint-disable-next-line no-extra-semi\n ;(err as Error).message +=\n `\\nThe error may be correlated with this previous error:\\n${latestSubscriptionCallbackError.current.stack}\\n\\n`\n }\n\n throw err\n }\n\n useIsomorphicLayoutEffect(() => {\n latestSubscriptionCallbackError.current = undefined\n childPropsFromStoreUpdate.current = undefined\n lastChildProps.current = actualChildProps\n })\n\n // Now that all that's done, we can finally try to actually render the child component.\n // We memoize the elements for the rendered child component as an optimization.\n const renderedWrappedComponent = React.useMemo(() => {\n return (\n // @ts-ignore\n \n )\n }, [reactReduxForwardedRef, WrappedComponent, actualChildProps])\n\n // If React sees the exact same element reference as last time, it bails out of re-rendering\n // that child, same as if it was wrapped in React.memo() or returned false from shouldComponentUpdate.\n const renderedChild = React.useMemo(() => {\n if (shouldHandleStateChanges) {\n // If this component is subscribed to store updates, we need to pass its own\n // subscription instance down to our descendants. That means rendering the same\n // Context instance, and putting a different value into the context.\n return (\n \n {renderedWrappedComponent}\n \n )\n }\n\n return renderedWrappedComponent\n }, [ContextToUse, renderedWrappedComponent, overriddenContextValue])\n\n return renderedChild\n }\n\n const _Connect = React.memo(ConnectFunction)\n\n type ConnectedWrapperComponent = typeof _Connect & {\n WrappedComponent: typeof WrappedComponent\n }\n\n // Add a hacky cast to get the right output type\n const Connect = _Connect as unknown as ConnectedComponent<\n typeof WrappedComponent,\n WrappedComponentProps\n >\n Connect.WrappedComponent = WrappedComponent\n Connect.displayName = ConnectFunction.displayName = displayName\n\n if (forwardRef) {\n const _forwarded = React.forwardRef(\n function forwardConnectRef(props, ref) {\n // @ts-ignore\n return \n },\n )\n\n const forwarded = _forwarded as ConnectedWrapperComponent\n forwarded.displayName = displayName\n forwarded.WrappedComponent = WrappedComponent\n return /*#__PURE__*/ hoistStatics(forwarded, WrappedComponent)\n }\n\n return /*#__PURE__*/ hoistStatics(Connect, WrappedComponent)\n }\n\n return wrapWithConnect\n}\n\nexport default connect as Connect\n", "import type { Context, ReactNode } from 'react'\nimport { React } from '../utils/react'\nimport type { Action, Store, UnknownAction } from 'redux'\nimport type { DevModeCheckFrequency } from '../hooks/useSelector'\nimport { createSubscription } from '../utils/Subscription'\nimport { useIsomorphicLayoutEffect } from '../utils/useIsomorphicLayoutEffect'\nimport type { ReactReduxContextValue } from './Context'\nimport { ReactReduxContext } from './Context'\n\nexport interface ProviderProps<\n A extends Action = UnknownAction,\n S = unknown,\n> {\n /**\n * The single Redux store in your application.\n */\n store: Store\n\n /**\n * An optional server state snapshot. Will be used during initial hydration render if available, to ensure that the UI output is consistent with the HTML generated on the server.\n */\n serverState?: S\n\n /**\n * Optional context to be used internally in react-redux. Use React.createContext() to create a context to be used.\n * If this is used, you'll need to customize `connect` by supplying the same context provided to the Provider.\n * Set the initial value to null, and the hooks will error\n * if this is not overwritten by Provider.\n */\n context?: Context | null>\n\n /**\n * Determines the frequency of stability checks for all selectors.\n * This setting overrides the global configuration for\n * the `useSelector` stability check, allowing you to specify how often\n * these checks should occur in development mode.\n *\n * @since 8.1.0\n */\n stabilityCheck?: DevModeCheckFrequency\n\n /**\n * Determines the frequency of identity function checks for all selectors.\n * This setting overrides the global configuration for\n * the `useSelector` identity function check, allowing you to specify how often\n * these checks should occur in development mode.\n *\n * **Note**: Previously referred to as `noopCheck`.\n *\n * @since 9.0.0\n */\n identityFunctionCheck?: DevModeCheckFrequency\n\n children: ReactNode\n}\n\nfunction Provider = UnknownAction, S = unknown>(\n providerProps: ProviderProps,\n) {\n const { children, context, serverState, store } = providerProps\n\n const contextValue = React.useMemo(() => {\n const subscription = createSubscription(store)\n\n const baseContextValue = {\n store,\n subscription,\n getServerState: serverState ? () => serverState : undefined,\n }\n\n if (process.env.NODE_ENV === 'production') {\n return baseContextValue\n } else {\n const { identityFunctionCheck = 'once', stabilityCheck = 'once' } =\n providerProps\n\n return /* @__PURE__ */ Object.assign(baseContextValue, {\n stabilityCheck,\n identityFunctionCheck,\n })\n }\n }, [store, serverState])\n\n const previousState = React.useMemo(() => store.getState(), [store])\n\n useIsomorphicLayoutEffect(() => {\n const { subscription } = contextValue\n subscription.onStateChange = subscription.notifyNestedSubs\n subscription.trySubscribe()\n\n if (previousState !== store.getState()) {\n subscription.notifyNestedSubs()\n }\n return () => {\n subscription.tryUnsubscribe()\n subscription.onStateChange = undefined\n }\n }, [contextValue, previousState])\n\n const Context = context || ReactReduxContext\n\n return {children}\n}\n\nexport default Provider\n", "import { React } from '../utils/react'\nimport { ReactReduxContext } from '../components/Context'\nimport type { ReactReduxContextValue } from '../components/Context'\n\n/**\n * Hook factory, which creates a `useReduxContext` hook bound to a given context. This is a low-level\n * hook that you should usually not need to call directly.\n *\n * @param {React.Context} [context=ReactReduxContext] Context passed to your ``.\n * @returns {Function} A `useReduxContext` hook bound to the specified context.\n */\nexport function createReduxContextHook(context = ReactReduxContext) {\n return function useReduxContext(): ReactReduxContextValue {\n const contextValue = React.useContext(context)\n\n if (process.env.NODE_ENV !== 'production' && !contextValue) {\n throw new Error(\n 'could not find react-redux context value; please ensure the component is wrapped in a ',\n )\n }\n\n return contextValue!\n }\n}\n\n/**\n * A hook to access the value of the `ReactReduxContext`. This is a low-level\n * hook that you should usually not need to call directly.\n *\n * @returns {any} the value of the `ReactReduxContext`\n *\n * @example\n *\n * import React from 'react'\n * import { useReduxContext } from 'react-redux'\n *\n * export const CounterComponent = () => {\n * const { store } = useReduxContext()\n * return

\n * }\n */\nexport const useReduxContext = /*#__PURE__*/ createReduxContextHook()\n", "import type { Context } from 'react'\nimport type { Action, Store } from 'redux'\nimport type { ReactReduxContextValue } from '../components/Context'\nimport { ReactReduxContext } from '../components/Context'\nimport {\n createReduxContextHook,\n useReduxContext as useDefaultReduxContext,\n} from './useReduxContext'\n\n/**\n * Represents a type that extracts the action type from a given Redux store.\n *\n * @template StoreType - The specific type of the Redux store.\n *\n * @since 9.1.0\n * @internal\n */\nexport type ExtractStoreActionType =\n StoreType extends Store ? ActionType : never\n\n/**\n * Represents a custom hook that provides access to the Redux store.\n *\n * @template StoreType - The specific type of the Redux store that gets returned.\n *\n * @since 9.1.0\n * @public\n */\nexport interface UseStore {\n /**\n * Returns the Redux store instance.\n *\n * @returns The Redux store instance.\n */\n (): StoreType\n\n /**\n * Returns the Redux store instance with specific state and action types.\n *\n * @returns The Redux store with the specified state and action types.\n *\n * @template StateType - The specific type of the state used in the store.\n * @template ActionType - The specific type of the actions used in the store.\n */\n <\n StateType extends ReturnType = ReturnType<\n StoreType['getState']\n >,\n ActionType extends Action = ExtractStoreActionType,\n >(): Store\n\n /**\n * Creates a \"pre-typed\" version of {@linkcode useStore useStore}\n * where the type of the Redux `store` is predefined.\n *\n * This allows you to set the `store` type once, eliminating the need to\n * specify it with every {@linkcode useStore useStore} call.\n *\n * @returns A pre-typed `useStore` with the store type already defined.\n *\n * @example\n * ```ts\n * export const useAppStore = useStore.withTypes()\n * ```\n *\n * @template OverrideStoreType - The specific type of the Redux store that gets returned.\n *\n * @since 9.1.0\n */\n withTypes: <\n OverrideStoreType extends StoreType,\n >() => UseStore\n}\n\n/**\n * Hook factory, which creates a `useStore` hook bound to a given context.\n *\n * @param {React.Context} [context=ReactReduxContext] Context passed to your ``.\n * @returns {Function} A `useStore` hook bound to the specified context.\n */\nexport function createStoreHook<\n StateType = unknown,\n ActionType extends Action = Action,\n>(\n // @ts-ignore\n context?: Context | null> = ReactReduxContext,\n) {\n const useReduxContext =\n context === ReactReduxContext\n ? useDefaultReduxContext\n : // @ts-ignore\n createReduxContextHook(context)\n const useStore = () => {\n const { store } = useReduxContext()\n return store\n }\n\n Object.assign(useStore, {\n withTypes: () => useStore,\n })\n\n return useStore as UseStore>\n}\n\n/**\n * A hook to access the redux store.\n *\n * @returns {any} the redux store\n *\n * @example\n *\n * import React from 'react'\n * import { useStore } from 'react-redux'\n *\n * export const ExampleComponent = () => {\n * const store = useStore()\n * return
{store.getState()}
\n * }\n */\nexport const useStore = /*#__PURE__*/ createStoreHook()\n", "import type { Context } from 'react'\nimport type { Action, Dispatch, UnknownAction } from 'redux'\n\nimport type { ReactReduxContextValue } from '../components/Context'\nimport { ReactReduxContext } from '../components/Context'\nimport { createStoreHook, useStore as useDefaultStore } from './useStore'\n\n/**\n * Represents a custom hook that provides a dispatch function\n * from the Redux store.\n *\n * @template DispatchType - The specific type of the dispatch function.\n *\n * @since 9.1.0\n * @public\n */\nexport interface UseDispatch<\n DispatchType extends Dispatch = Dispatch,\n> {\n /**\n * Returns the dispatch function from the Redux store.\n *\n * @returns The dispatch function from the Redux store.\n *\n * @template AppDispatch - The specific type of the dispatch function.\n */\n (): AppDispatch\n\n /**\n * Creates a \"pre-typed\" version of {@linkcode useDispatch useDispatch}\n * where the type of the `dispatch` function is predefined.\n *\n * This allows you to set the `dispatch` type once, eliminating the need to\n * specify it with every {@linkcode useDispatch useDispatch} call.\n *\n * @returns A pre-typed `useDispatch` with the dispatch type already defined.\n *\n * @example\n * ```ts\n * export const useAppDispatch = useDispatch.withTypes()\n * ```\n *\n * @template OverrideDispatchType - The specific type of the dispatch function.\n *\n * @since 9.1.0\n */\n withTypes: <\n OverrideDispatchType extends DispatchType,\n >() => UseDispatch\n}\n\n/**\n * Hook factory, which creates a `useDispatch` hook bound to a given context.\n *\n * @param {React.Context} [context=ReactReduxContext] Context passed to your ``.\n * @returns {Function} A `useDispatch` hook bound to the specified context.\n */\nexport function createDispatchHook<\n StateType = unknown,\n ActionType extends Action = UnknownAction,\n>(\n // @ts-ignore\n context?: Context | null> = ReactReduxContext,\n) {\n const useStore =\n context === ReactReduxContext ? useDefaultStore : createStoreHook(context)\n\n const useDispatch = () => {\n const store = useStore()\n return store.dispatch\n }\n\n Object.assign(useDispatch, {\n withTypes: () => useDispatch,\n })\n\n return useDispatch as UseDispatch>\n}\n\n/**\n * A hook to access the redux `dispatch` function.\n *\n * @returns {any|function} redux store's `dispatch` function\n *\n * @example\n *\n * import React, { useCallback } from 'react'\n * import { useDispatch } from 'react-redux'\n *\n * export const CounterComponent = ({ value }) => {\n * const dispatch = useDispatch()\n * const increaseCounter = useCallback(() => dispatch({ type: 'increase-counter' }), [])\n * return (\n *
\n * {value}\n * \n *
\n * )\n * }\n */\nexport const useDispatch = /*#__PURE__*/ createDispatchHook()\n", "//import * as React from 'react'\nimport { React } from '../utils/react'\nimport { useSyncExternalStoreWithSelector } from 'use-sync-external-store/with-selector.js'\nimport type { ReactReduxContextValue } from '../components/Context'\nimport { ReactReduxContext } from '../components/Context'\nimport type { EqualityFn, NoInfer } from '../types'\nimport {\n createReduxContextHook,\n useReduxContext as useDefaultReduxContext,\n} from './useReduxContext'\n\n/**\n * The frequency of development mode checks.\n *\n * @since 8.1.0\n * @internal\n */\nexport type DevModeCheckFrequency = 'never' | 'once' | 'always'\n\n/**\n * Represents the configuration for development mode checks.\n *\n * @since 9.0.0\n * @internal\n */\nexport interface DevModeChecks {\n /**\n * Overrides the global stability check for the selector.\n * - `once` - Run only the first time the selector is called.\n * - `always` - Run every time the selector is called.\n * - `never` - Never run the stability check.\n *\n * @default 'once'\n *\n * @since 8.1.0\n */\n stabilityCheck: DevModeCheckFrequency\n\n /**\n * Overrides the global identity function check for the selector.\n * - `once` - Run only the first time the selector is called.\n * - `always` - Run every time the selector is called.\n * - `never` - Never run the identity function check.\n *\n * **Note**: Previously referred to as `noopCheck`.\n *\n * @default 'once'\n *\n * @since 9.0.0\n */\n identityFunctionCheck: DevModeCheckFrequency\n}\n\nexport interface UseSelectorOptions {\n equalityFn?: EqualityFn\n\n /**\n * `useSelector` performs additional checks in development mode to help\n * identify and warn about potential issues in selector behavior. This\n * option allows you to customize the behavior of these checks per selector.\n *\n * @since 9.0.0\n */\n devModeChecks?: Partial\n}\n\n/**\n * Represents a custom hook that allows you to extract data from the\n * Redux store state, using a selector function. The selector function\n * takes the current state as an argument and returns a part of the state\n * or some derived data. The hook also supports an optional equality\n * function or options object to customize its behavior.\n *\n * @template StateType - The specific type of state this hook operates on.\n *\n * @public\n */\nexport interface UseSelector {\n /**\n * A function that takes a selector function as its first argument.\n * The selector function is responsible for selecting a part of\n * the Redux store's state or computing derived data.\n *\n * @param selector - A function that receives the current state and returns a part of the state or some derived data.\n * @param equalityFnOrOptions - An optional equality function or options object for customizing the behavior of the selector.\n * @returns The selected part of the state or derived data.\n *\n * @template TState - The specific type of state this hook operates on.\n * @template Selected - The type of the value that the selector function will return.\n */\n (\n selector: (state: TState) => Selected,\n equalityFnOrOptions?: EqualityFn | UseSelectorOptions,\n ): Selected\n\n /**\n * Creates a \"pre-typed\" version of {@linkcode useSelector useSelector}\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 useSelector useSelector} call.\n *\n * @returns A pre-typed `useSelector` with the state type already defined.\n *\n * @example\n * ```ts\n * export const useAppSelector = useSelector.withTypes()\n * ```\n *\n * @template OverrideStateType - The specific type of state this hook operates on.\n *\n * @since 9.1.0\n */\n withTypes: <\n OverrideStateType extends StateType,\n >() => UseSelector\n}\n\nconst refEquality: EqualityFn = (a, b) => a === b\n\n/**\n * Hook factory, which creates a `useSelector` hook bound to a given context.\n *\n * @param {React.Context} [context=ReactReduxContext] Context passed to your ``.\n * @returns {Function} A `useSelector` hook bound to the specified context.\n */\nexport function createSelectorHook(\n context: React.Context | null> = ReactReduxContext,\n): UseSelector {\n const useReduxContext =\n context === ReactReduxContext\n ? useDefaultReduxContext\n : createReduxContextHook(context)\n\n const useSelector = (\n selector: (state: TState) => Selected,\n equalityFnOrOptions:\n | EqualityFn>\n | UseSelectorOptions> = {},\n ): Selected => {\n const { equalityFn = refEquality } =\n typeof equalityFnOrOptions === 'function'\n ? { equalityFn: equalityFnOrOptions }\n : equalityFnOrOptions\n if (process.env.NODE_ENV !== 'production') {\n if (!selector) {\n throw new Error(`You must pass a selector to useSelector`)\n }\n if (typeof selector !== 'function') {\n throw new Error(`You must pass a function as a selector to useSelector`)\n }\n if (typeof equalityFn !== 'function') {\n throw new Error(\n `You must pass a function as an equality function to useSelector`,\n )\n }\n }\n\n const reduxContext = useReduxContext()\n\n const { store, subscription, getServerState } = reduxContext\n\n const firstRun = React.useRef(true)\n\n const wrappedSelector = React.useCallback(\n {\n [selector.name](state: TState) {\n const selected = selector(state)\n if (process.env.NODE_ENV !== 'production') {\n const { devModeChecks = {} } =\n typeof equalityFnOrOptions === 'function'\n ? {}\n : equalityFnOrOptions\n const { identityFunctionCheck, stabilityCheck } = reduxContext\n const {\n identityFunctionCheck: finalIdentityFunctionCheck,\n stabilityCheck: finalStabilityCheck,\n } = {\n stabilityCheck,\n identityFunctionCheck,\n ...devModeChecks,\n }\n if (\n finalStabilityCheck === 'always' ||\n (finalStabilityCheck === 'once' && firstRun.current)\n ) {\n const toCompare = selector(state)\n if (!equalityFn(selected, toCompare)) {\n let stack: string | undefined = undefined\n try {\n throw new Error()\n } catch (e) {\n // eslint-disable-next-line no-extra-semi\n ;({ stack } = e as Error)\n }\n console.warn(\n 'Selector ' +\n (selector.name || 'unknown') +\n ' returned a different result when called with the same parameters. This can lead to unnecessary rerenders.' +\n '\\nSelectors that return a new reference (such as an object or an array) should be memoized: https://redux.js.org/usage/deriving-data-selectors#optimizing-selectors-with-memoization',\n {\n state,\n selected,\n selected2: toCompare,\n stack,\n },\n )\n }\n }\n if (\n finalIdentityFunctionCheck === 'always' ||\n (finalIdentityFunctionCheck === 'once' && firstRun.current)\n ) {\n // @ts-ignore\n if (selected === state) {\n let stack: string | undefined = undefined\n try {\n throw new Error()\n } catch (e) {\n // eslint-disable-next-line no-extra-semi\n ;({ stack } = e as Error)\n }\n console.warn(\n 'Selector ' +\n (selector.name || 'unknown') +\n ' returned the root state when called. This can lead to unnecessary rerenders.' +\n '\\nSelectors that return the entire state are almost certainly a mistake, as they will cause a rerender whenever *anything* in state changes.',\n { stack },\n )\n }\n }\n if (firstRun.current) firstRun.current = false\n }\n return selected\n },\n }[selector.name],\n [selector],\n )\n\n const selectedState = useSyncExternalStoreWithSelector(\n subscription.addNestedSub,\n store.getState,\n getServerState || store.getState,\n wrappedSelector,\n equalityFn,\n )\n\n React.useDebugValue(selectedState)\n\n return selectedState\n }\n\n Object.assign(useSelector, {\n withTypes: () => useSelector,\n })\n\n return useSelector as UseSelector\n}\n\n/**\n * A hook to access the redux store's state. This hook takes a selector function\n * as an argument. The selector is called with the store state.\n *\n * This hook takes an optional equality comparison function as the second parameter\n * that allows you to customize the way the selected state is compared to determine\n * whether the component needs to be re-rendered.\n *\n * @param {Function} selector the selector function\n * @param {Function=} equalityFn the function that will be used to determine equality\n *\n * @returns {any} the selected state\n *\n * @example\n *\n * import React from 'react'\n * import { useSelector } from 'react-redux'\n *\n * export const CounterComponent = () => {\n * const counter = useSelector(state => state.counter)\n * return
{counter}
\n * }\n */\nexport const useSelector = /*#__PURE__*/ createSelectorHook()\n", "import connect from './components/connect'\nexport type {\n Connect,\n ConnectProps,\n ConnectedProps,\n} from './components/connect'\n\nimport shallowEqual from './utils/shallowEqual'\n\nimport Provider from './components/Provider'\nimport { defaultNoopBatch } from './utils/batch'\n\nexport { ReactReduxContext } from './components/Context'\nexport type { ReactReduxContextValue } from './components/Context'\n\nexport type { ProviderProps } from './components/Provider'\n\nexport type {\n MapDispatchToProps,\n MapDispatchToPropsFactory,\n MapDispatchToPropsFunction,\n MapDispatchToPropsNonObject,\n MapDispatchToPropsParam,\n MapStateToProps,\n MapStateToPropsFactory,\n MapStateToPropsParam,\n MergeProps,\n Selector,\n SelectorFactory,\n} from './connect/selectorFactory'\n\nexport { createDispatchHook, useDispatch } from './hooks/useDispatch'\nexport type { UseDispatch } from './hooks/useDispatch'\n\nexport { createSelectorHook, useSelector } from './hooks/useSelector'\nexport type { UseSelector } from './hooks/useSelector'\n\nexport { createStoreHook, useStore } from './hooks/useStore'\nexport type { UseStore } from './hooks/useStore'\n\nexport type { Subscription } from './utils/Subscription'\n\nexport * from './types'\n\n/**\n * @deprecated As of React 18, batching is enabled by default for ReactDOM and React Native.\n * This is now a no-op that immediately runs the callback.\n */\nconst batch = defaultNoopBatch\n\nexport { Provider, batch, connect, shallowEqual }\n", "/**\n * Adapted from React: https://github.com/facebook/react/blob/master/packages/shared/formatProdErrorMessage.js\n *\n * Do not require this module directly! Use normal throw error calls. These messages will be replaced with error codes\n * during build.\n * @param {number} code\n */\nexport function formatProdErrorMessage(code: number) {\n return `Minified Redux error #${code}; visit https://redux.js.org/Errors?code=${code} for the full message or ` + 'use the non-minified dev environment for full errors. ';\n}", "declare global {\n interface SymbolConstructor {\n readonly observable: symbol;\n }\n}\nconst $$observable = /* #__PURE__ */(() => typeof Symbol === 'function' && Symbol.observable || '@@observable')();\nexport default $$observable;", "/**\n * These are private action types reserved by Redux.\n * For any unknown actions, you must return the current state.\n * If the current state is undefined, you must return the initial state.\n * Do not reference these action types directly in your code.\n */\n\nconst randomString = () => Math.random().toString(36).substring(7).split('').join('.');\nconst ActionTypes = {\n INIT: `@@redux/INIT${/* #__PURE__ */randomString()}`,\n REPLACE: `@@redux/REPLACE${/* #__PURE__ */randomString()}`,\n PROBE_UNKNOWN_ACTION: () => `@@redux/PROBE_UNKNOWN_ACTION${randomString()}`\n};\nexport default ActionTypes;", "/**\n * @param obj The object to inspect.\n * @returns True if the argument appears to be a plain object.\n */\nexport default function isPlainObject(obj: any): obj is object {\n if (typeof obj !== 'object' || obj === null) return false;\n let proto = obj;\n while (Object.getPrototypeOf(proto) !== null) {\n proto = Object.getPrototypeOf(proto);\n }\n return Object.getPrototypeOf(obj) === proto || Object.getPrototypeOf(obj) === null;\n}", "// Inlined / shortened version of `kindOf` from https://github.com/jonschlinkert/kind-of\nexport function miniKindOf(val: any): string {\n if (val === void 0) return 'undefined';\n if (val === null) return 'null';\n const type = typeof val;\n switch (type) {\n case 'boolean':\n case 'string':\n case 'number':\n case 'symbol':\n case 'function':\n {\n return type;\n }\n }\n if (Array.isArray(val)) return 'array';\n if (isDate(val)) return 'date';\n if (isError(val)) return 'error';\n const constructorName = ctorName(val);\n switch (constructorName) {\n case 'Symbol':\n case 'Promise':\n case 'WeakMap':\n case 'WeakSet':\n case 'Map':\n case 'Set':\n return constructorName;\n }\n\n // other\n return Object.prototype.toString.call(val).slice(8, -1).toLowerCase().replace(/\\s/g, '');\n}\nfunction ctorName(val: any): string | null {\n return typeof val.constructor === 'function' ? val.constructor.name : null;\n}\nfunction isError(val: any) {\n return val instanceof Error || typeof val.message === 'string' && val.constructor && typeof val.constructor.stackTraceLimit === 'number';\n}\nfunction isDate(val: any) {\n if (val instanceof Date) return true;\n return typeof val.toDateString === 'function' && typeof val.getDate === 'function' && typeof val.setDate === 'function';\n}\nexport function kindOf(val: any) {\n let typeOfVal: string = typeof val;\n if (process.env.NODE_ENV !== 'production') {\n typeOfVal = miniKindOf(val);\n }\n return typeOfVal;\n}", "import { formatProdErrorMessage as _formatProdErrorMessage13 } from \"src/utils/formatProdErrorMessage\";\nimport { formatProdErrorMessage as _formatProdErrorMessage12 } from \"src/utils/formatProdErrorMessage\";\nimport { formatProdErrorMessage as _formatProdErrorMessage11 } from \"src/utils/formatProdErrorMessage\";\nimport { formatProdErrorMessage as _formatProdErrorMessage10 } from \"src/utils/formatProdErrorMessage\";\nimport { formatProdErrorMessage as _formatProdErrorMessage9 } from \"src/utils/formatProdErrorMessage\";\nimport { formatProdErrorMessage as _formatProdErrorMessage8 } from \"src/utils/formatProdErrorMessage\";\nimport { formatProdErrorMessage as _formatProdErrorMessage7 } from \"src/utils/formatProdErrorMessage\";\nimport { formatProdErrorMessage as _formatProdErrorMessage6 } from \"src/utils/formatProdErrorMessage\";\nimport { formatProdErrorMessage as _formatProdErrorMessage5 } from \"src/utils/formatProdErrorMessage\";\nimport { formatProdErrorMessage as _formatProdErrorMessage4 } from \"src/utils/formatProdErrorMessage\";\nimport { formatProdErrorMessage as _formatProdErrorMessage3 } from \"src/utils/formatProdErrorMessage\";\nimport { formatProdErrorMessage as _formatProdErrorMessage2 } from \"src/utils/formatProdErrorMessage\";\nimport { formatProdErrorMessage as _formatProdErrorMessage } from \"src/utils/formatProdErrorMessage\";\nimport $$observable from './utils/symbol-observable';\nimport { Store, StoreEnhancer, Dispatch, Observer, ListenerCallback, UnknownIfNonSpecific } from './types/store';\nimport { Action } from './types/actions';\nimport { Reducer } from './types/reducers';\nimport ActionTypes from './utils/actionTypes';\nimport isPlainObject from './utils/isPlainObject';\nimport { kindOf } from './utils/kindOf';\n\n/**\n * @deprecated\n *\n * **We recommend using the `configureStore` method\n * of the `@reduxjs/toolkit` package**, which replaces `createStore`.\n *\n * Redux Toolkit is our recommended approach for writing Redux logic today,\n * including store setup, reducers, data fetching, and more.\n *\n * **For more details, please read this Redux docs page:**\n * **https://redux.js.org/introduction/why-rtk-is-redux-today**\n *\n * `configureStore` from Redux Toolkit is an improved version of `createStore` that\n * simplifies setup and helps avoid common bugs.\n *\n * You should not be using the `redux` core package by itself today, except for learning purposes.\n * The `createStore` method from the core `redux` package will not be removed, but we encourage\n * all users to migrate to using Redux Toolkit for all Redux code.\n *\n * If you want to use `createStore` without this visual deprecation warning, use\n * the `legacy_createStore` import instead:\n *\n * `import { legacy_createStore as createStore} from 'redux'`\n *\n */\nexport function createStore(reducer: Reducer, enhancer?: StoreEnhancer): Store> & Ext;\n/**\n * @deprecated\n *\n * **We recommend using the `configureStore` method\n * of the `@reduxjs/toolkit` package**, which replaces `createStore`.\n *\n * Redux Toolkit is our recommended approach for writing Redux logic today,\n * including store setup, reducers, data fetching, and more.\n *\n * **For more details, please read this Redux docs page:**\n * **https://redux.js.org/introduction/why-rtk-is-redux-today**\n *\n * `configureStore` from Redux Toolkit is an improved version of `createStore` that\n * simplifies setup and helps avoid common bugs.\n *\n * You should not be using the `redux` core package by itself today, except for learning purposes.\n * The `createStore` method from the core `redux` package will not be removed, but we encourage\n * all users to migrate to using Redux Toolkit for all Redux code.\n *\n * If you want to use `createStore` without this visual deprecation warning, use\n * the `legacy_createStore` import instead:\n *\n * `import { legacy_createStore as createStore} from 'redux'`\n *\n */\nexport function createStore(reducer: Reducer, preloadedState?: PreloadedState | undefined, enhancer?: StoreEnhancer): Store> & Ext;\nexport function createStore(reducer: Reducer, preloadedState?: PreloadedState | StoreEnhancer | undefined, enhancer?: StoreEnhancer): Store> & Ext {\n if (typeof reducer !== 'function') {\n throw new Error(process.env.NODE_ENV === \"production\" ? _formatProdErrorMessage(2) : `Expected the root reducer to be a function. Instead, received: '${kindOf(reducer)}'`);\n }\n if (typeof preloadedState === 'function' && typeof enhancer === 'function' || typeof enhancer === 'function' && typeof arguments[3] === 'function') {\n throw new Error(process.env.NODE_ENV === \"production\" ? _formatProdErrorMessage2(0) : 'It looks like you are passing several store enhancers to ' + 'createStore(). This is not supported. Instead, compose them ' + 'together to a single function. See https://redux.js.org/tutorials/fundamentals/part-4-store#creating-a-store-with-enhancers for an example.');\n }\n if (typeof preloadedState === 'function' && typeof enhancer === 'undefined') {\n enhancer = (preloadedState as StoreEnhancer);\n preloadedState = undefined;\n }\n if (typeof enhancer !== 'undefined') {\n if (typeof enhancer !== 'function') {\n throw new Error(process.env.NODE_ENV === \"production\" ? _formatProdErrorMessage3(1) : `Expected the enhancer to be a function. Instead, received: '${kindOf(enhancer)}'`);\n }\n return enhancer(createStore)(reducer, (preloadedState as PreloadedState | undefined));\n }\n let currentReducer = reducer;\n let currentState: S | PreloadedState | undefined = (preloadedState as PreloadedState | undefined);\n let currentListeners: Map | null = new Map();\n let nextListeners = currentListeners;\n let listenerIdCounter = 0;\n let isDispatching = false;\n\n /**\n * This makes a shallow copy of currentListeners so we can use\n * nextListeners as a temporary list while dispatching.\n *\n * This prevents any bugs around consumers calling\n * subscribe/unsubscribe in the middle of a dispatch.\n */\n function ensureCanMutateNextListeners() {\n if (nextListeners === currentListeners) {\n nextListeners = new Map();\n currentListeners.forEach((listener, key) => {\n nextListeners.set(key, listener);\n });\n }\n }\n\n /**\n * Reads the state tree managed by the store.\n *\n * @returns The current state tree of your application.\n */\n function getState(): S {\n if (isDispatching) {\n throw new Error(process.env.NODE_ENV === \"production\" ? _formatProdErrorMessage4(3) : 'You may not call store.getState() while the reducer is executing. ' + 'The reducer has already received the state as an argument. ' + 'Pass it down from the top reducer instead of reading it from the store.');\n }\n return (currentState as S);\n }\n\n /**\n * Adds a change listener. It will be called any time an action is dispatched,\n * and some part of the state tree may potentially have changed. You may then\n * call `getState()` to read the current state tree inside the callback.\n *\n * You may call `dispatch()` from a change listener, with the following\n * caveats:\n *\n * 1. The subscriptions are snapshotted just before every `dispatch()` call.\n * If you subscribe or unsubscribe while the listeners are being invoked, this\n * will not have any effect on the `dispatch()` that is currently in progress.\n * However, the next `dispatch()` call, whether nested or not, will use a more\n * recent snapshot of the subscription list.\n *\n * 2. The listener should not expect to see all state changes, as the state\n * might have been updated multiple times during a nested `dispatch()` before\n * the listener is called. It is, however, guaranteed that all subscribers\n * registered before the `dispatch()` started will be called with the latest\n * state by the time it exits.\n *\n * @param listener A callback to be invoked on every dispatch.\n * @returns A function to remove this change listener.\n */\n function subscribe(listener: () => void) {\n if (typeof listener !== 'function') {\n throw new Error(process.env.NODE_ENV === \"production\" ? _formatProdErrorMessage5(4) : `Expected the listener to be a function. Instead, received: '${kindOf(listener)}'`);\n }\n if (isDispatching) {\n throw new Error(process.env.NODE_ENV === \"production\" ? _formatProdErrorMessage6(5) : 'You may not call store.subscribe() while the reducer is executing. ' + 'If you would like to be notified after the store has been updated, subscribe from a ' + 'component and invoke store.getState() in the callback to access the latest state. ' + 'See https://redux.js.org/api/store#subscribelistener for more details.');\n }\n let isSubscribed = true;\n ensureCanMutateNextListeners();\n const listenerId = listenerIdCounter++;\n nextListeners.set(listenerId, listener);\n return function unsubscribe() {\n if (!isSubscribed) {\n return;\n }\n if (isDispatching) {\n throw new Error(process.env.NODE_ENV === \"production\" ? _formatProdErrorMessage7(6) : 'You may not unsubscribe from a store listener while the reducer is executing. ' + 'See https://redux.js.org/api/store#subscribelistener for more details.');\n }\n isSubscribed = false;\n ensureCanMutateNextListeners();\n nextListeners.delete(listenerId);\n currentListeners = null;\n };\n }\n\n /**\n * Dispatches an action. It is the only way to trigger a state change.\n *\n * The `reducer` function, used to create the store, will be called with the\n * current state tree and the given `action`. Its return value will\n * be considered the **next** state of the tree, and the change listeners\n * will be notified.\n *\n * The base implementation only supports plain object actions. If you want to\n * dispatch a Promise, an Observable, a thunk, or something else, you need to\n * wrap your store creating function into the corresponding middleware. For\n * example, see the documentation for the `redux-thunk` package. Even the\n * middleware will eventually dispatch plain object actions using this method.\n *\n * @param action A plain object representing “what changed”. It is\n * a good idea to keep actions serializable so you can record and replay user\n * sessions, or use the time travelling `redux-devtools`. An action must have\n * a `type` property which may not be `undefined`. It is a good idea to use\n * string constants for action types.\n *\n * @returns For convenience, the same action object you dispatched.\n *\n * Note that, if you use a custom middleware, it may wrap `dispatch()` to\n * return something else (for example, a Promise you can await).\n */\n function dispatch(action: A) {\n if (!isPlainObject(action)) {\n throw new Error(process.env.NODE_ENV === \"production\" ? _formatProdErrorMessage8(7) : `Actions must be plain objects. Instead, the actual type was: '${kindOf(action)}'. You may need to add middleware to your store setup to handle dispatching other values, such as 'redux-thunk' to handle dispatching functions. See https://redux.js.org/tutorials/fundamentals/part-4-store#middleware and https://redux.js.org/tutorials/fundamentals/part-6-async-logic#using-the-redux-thunk-middleware for examples.`);\n }\n if (typeof action.type === 'undefined') {\n throw new Error(process.env.NODE_ENV === \"production\" ? _formatProdErrorMessage9(8) : 'Actions may not have an undefined \"type\" property. You may have misspelled an action type string constant.');\n }\n if (typeof action.type !== 'string') {\n throw new Error(process.env.NODE_ENV === \"production\" ? _formatProdErrorMessage10(17) : `Action \"type\" property must be a string. Instead, the actual type was: '${kindOf(action.type)}'. Value was: '${action.type}' (stringified)`);\n }\n if (isDispatching) {\n throw new Error(process.env.NODE_ENV === \"production\" ? _formatProdErrorMessage11(9) : 'Reducers may not dispatch actions.');\n }\n try {\n isDispatching = true;\n currentState = currentReducer(currentState, action);\n } finally {\n isDispatching = false;\n }\n const listeners = currentListeners = nextListeners;\n listeners.forEach(listener => {\n listener();\n });\n return action;\n }\n\n /**\n * Replaces the reducer currently used by the store to calculate the state.\n *\n * You might need this if your app implements code splitting and you want to\n * load some of the reducers dynamically. You might also need this if you\n * implement a hot reloading mechanism for Redux.\n *\n * @param nextReducer The reducer for the store to use instead.\n */\n function replaceReducer(nextReducer: Reducer): void {\n if (typeof nextReducer !== 'function') {\n throw new Error(process.env.NODE_ENV === \"production\" ? _formatProdErrorMessage12(10) : `Expected the nextReducer to be a function. Instead, received: '${kindOf(nextReducer)}`);\n }\n currentReducer = ((nextReducer as unknown) as Reducer);\n\n // This action has a similar effect to ActionTypes.INIT.\n // Any reducers that existed in both the new and old rootReducer\n // will receive the previous state. This effectively populates\n // the new state tree with any relevant data from the old one.\n dispatch(({\n type: ActionTypes.REPLACE\n } as A));\n }\n\n /**\n * Interoperability point for observable/reactive libraries.\n * @returns A minimal observable of state changes.\n * For more information, see the observable proposal:\n * https://github.com/tc39/proposal-observable\n */\n function observable() {\n const outerSubscribe = subscribe;\n return {\n /**\n * The minimal observable subscription method.\n * @param observer Any object that can be used as an observer.\n * The observer object should have a `next` method.\n * @returns An object with an `unsubscribe` method that can\n * be used to unsubscribe the observable from the store, and prevent further\n * emission of values from the observable.\n */\n subscribe(observer: unknown) {\n if (typeof observer !== 'object' || observer === null) {\n throw new Error(process.env.NODE_ENV === \"production\" ? _formatProdErrorMessage13(11) : `Expected the observer to be an object. Instead, received: '${kindOf(observer)}'`);\n }\n function observeState() {\n const observerAsObserver = (observer as Observer);\n if (observerAsObserver.next) {\n observerAsObserver.next(getState());\n }\n }\n observeState();\n const unsubscribe = outerSubscribe(observeState);\n return {\n unsubscribe\n };\n },\n [$$observable]() {\n return this;\n }\n };\n }\n\n // When a store is created, an \"INIT\" action is dispatched so that every\n // reducer returns their initial state. This effectively populates\n // the initial state tree.\n dispatch(({\n type: ActionTypes.INIT\n } as A));\n const store = (({\n dispatch: (dispatch as Dispatch
),\n subscribe,\n getState,\n replaceReducer,\n [$$observable]: observable\n } as unknown) as Store & Ext);\n return store;\n}\n\n/**\n * Creates a Redux store that holds the state tree.\n *\n * **We recommend using `configureStore` from the\n * `@reduxjs/toolkit` package**, which replaces `createStore`:\n * **https://redux.js.org/introduction/why-rtk-is-redux-today**\n *\n * The only way to change the data in the store is to call `dispatch()` on it.\n *\n * There should only be a single store in your app. To specify how different\n * parts of the state tree respond to actions, you may combine several reducers\n * into a single reducer function by using `combineReducers`.\n *\n * @param {Function} reducer A function that returns the next state tree, given\n * the current state tree and the action to handle.\n *\n * @param {any} [preloadedState] The initial state. You may optionally specify it\n * to hydrate the state from the server in universal apps, or to restore a\n * previously serialized user session.\n * If you use `combineReducers` to produce the root reducer function, this must be\n * an object with the same shape as `combineReducers` keys.\n *\n * @param {Function} [enhancer] The store enhancer. You may optionally specify it\n * to enhance the store with third-party capabilities such as middleware,\n * time travel, persistence, etc. The only store enhancer that ships with Redux\n * is `applyMiddleware()`.\n *\n * @returns {Store} A Redux store that lets you read the state, dispatch actions\n * and subscribe to changes.\n */\nexport function legacy_createStore(reducer: Reducer, enhancer?: StoreEnhancer): Store> & Ext;\n/**\n * Creates a Redux store that holds the state tree.\n *\n * **We recommend using `configureStore` from the\n * `@reduxjs/toolkit` package**, which replaces `createStore`:\n * **https://redux.js.org/introduction/why-rtk-is-redux-today**\n *\n * The only way to change the data in the store is to call `dispatch()` on it.\n *\n * There should only be a single store in your app. To specify how different\n * parts of the state tree respond to actions, you may combine several reducers\n * into a single reducer function by using `combineReducers`.\n *\n * @param {Function} reducer A function that returns the next state tree, given\n * the current state tree and the action to handle.\n *\n * @param {any} [preloadedState] The initial state. You may optionally specify it\n * to hydrate the state from the server in universal apps, or to restore a\n * previously serialized user session.\n * If you use `combineReducers` to produce the root reducer function, this must be\n * an object with the same shape as `combineReducers` keys.\n *\n * @param {Function} [enhancer] The store enhancer. You may optionally specify it\n * to enhance the store with third-party capabilities such as middleware,\n * time travel, persistence, etc. The only store enhancer that ships with Redux\n * is `applyMiddleware()`.\n *\n * @returns {Store} A Redux store that lets you read the state, dispatch actions\n * and subscribe to changes.\n */\nexport function legacy_createStore(reducer: Reducer, preloadedState?: PreloadedState | undefined, enhancer?: StoreEnhancer): Store> & Ext;\nexport function legacy_createStore(reducer: Reducer, preloadedState?: PreloadedState | StoreEnhancer | undefined, enhancer?: StoreEnhancer): Store> & Ext {\n return createStore(reducer, (preloadedState as any), enhancer);\n}", "/**\n * Prints a warning in the console if it exists.\n *\n * @param message The warning message.\n */\nexport default function warning(message: string): void {\n /* eslint-disable no-console */\n if (typeof console !== 'undefined' && typeof console.error === 'function') {\n console.error(message);\n }\n /* eslint-enable no-console */\n try {\n // This error was thrown as a convenience so that if you enable\n // \"break on all exceptions\" in your console,\n // it would pause the execution at this line.\n throw new Error(message);\n } catch (e) {} // eslint-disable-line no-empty\n}", "import { formatProdErrorMessage as _formatProdErrorMessage3 } from \"src/utils/formatProdErrorMessage\";\nimport { formatProdErrorMessage as _formatProdErrorMessage2 } from \"src/utils/formatProdErrorMessage\";\nimport { formatProdErrorMessage as _formatProdErrorMessage } from \"src/utils/formatProdErrorMessage\";\nimport { Action } from './types/actions';\nimport { ActionFromReducersMapObject, PreloadedStateShapeFromReducersMapObject, Reducer, StateFromReducersMapObject } from './types/reducers';\nimport ActionTypes from './utils/actionTypes';\nimport isPlainObject from './utils/isPlainObject';\nimport warning from './utils/warning';\nimport { kindOf } from './utils/kindOf';\nfunction getUnexpectedStateShapeWarningMessage(inputState: object, reducers: {\n [key: string]: Reducer;\n}, action: Action, unexpectedKeyCache: {\n [key: string]: true;\n}) {\n const reducerKeys = Object.keys(reducers);\n const argumentName = action && action.type === ActionTypes.INIT ? 'preloadedState argument passed to createStore' : 'previous state received by the reducer';\n if (reducerKeys.length === 0) {\n return 'Store does not have a valid reducer. Make sure the argument passed ' + 'to combineReducers is an object whose values are reducers.';\n }\n if (!isPlainObject(inputState)) {\n return `The ${argumentName} has unexpected type of \"${kindOf(inputState)}\". Expected argument to be an object with the following ` + `keys: \"${reducerKeys.join('\", \"')}\"`;\n }\n const unexpectedKeys = Object.keys(inputState).filter(key => !reducers.hasOwnProperty(key) && !unexpectedKeyCache[key]);\n unexpectedKeys.forEach(key => {\n unexpectedKeyCache[key] = true;\n });\n if (action && action.type === ActionTypes.REPLACE) return;\n if (unexpectedKeys.length > 0) {\n return `Unexpected ${unexpectedKeys.length > 1 ? 'keys' : 'key'} ` + `\"${unexpectedKeys.join('\", \"')}\" found in ${argumentName}. ` + `Expected to find one of the known reducer keys instead: ` + `\"${reducerKeys.join('\", \"')}\". Unexpected keys will be ignored.`;\n }\n}\nfunction assertReducerShape(reducers: {\n [key: string]: Reducer;\n}) {\n Object.keys(reducers).forEach(key => {\n const reducer = reducers[key];\n const initialState = reducer(undefined, {\n type: ActionTypes.INIT\n });\n if (typeof initialState === 'undefined') {\n throw new Error(process.env.NODE_ENV === \"production\" ? _formatProdErrorMessage(12) : `The slice reducer for key \"${key}\" returned undefined during initialization. ` + `If the state passed to the reducer is undefined, you must ` + `explicitly return the initial state. The initial state may ` + `not be undefined. If you don't want to set a value for this reducer, ` + `you can use null instead of undefined.`);\n }\n if (typeof reducer(undefined, {\n type: ActionTypes.PROBE_UNKNOWN_ACTION()\n }) === 'undefined') {\n throw new Error(process.env.NODE_ENV === \"production\" ? _formatProdErrorMessage2(13) : `The slice reducer for key \"${key}\" returned undefined when probed with a random type. ` + `Don't try to handle '${ActionTypes.INIT}' or other actions in \"redux/*\" ` + `namespace. They are considered private. Instead, you must return the ` + `current state for any unknown actions, unless it is undefined, ` + `in which case you must return the initial state, regardless of the ` + `action type. The initial state may not be undefined, but can be null.`);\n }\n });\n}\n\n/**\n * Turns an object whose values are different reducer functions, into a single\n * reducer function. It will call every child reducer, and gather their results\n * into a single state object, whose keys correspond to the keys of the passed\n * reducer functions.\n *\n * @template S Combined state object type.\n *\n * @param reducers An object whose values correspond to different reducer\n * functions that need to be combined into one. One handy way to obtain it\n * is to use `import * as reducers` syntax. The reducers may never\n * return undefined for any action. Instead, they should return their\n * initial state if the state passed to them was undefined, and the current\n * state for any unrecognized action.\n *\n * @returns A reducer function that invokes every reducer inside the passed\n * object, and builds a state object with the same shape.\n */\nexport default function combineReducers(reducers: M): M[keyof M] extends Reducer | undefined ? Reducer, ActionFromReducersMapObject, Partial>> : never;\nexport default function combineReducers(reducers: {\n [key: string]: Reducer;\n}) {\n const reducerKeys = Object.keys(reducers);\n const finalReducers: {\n [key: string]: Reducer;\n } = {};\n for (let i = 0; i < reducerKeys.length; i++) {\n const key = reducerKeys[i];\n if (process.env.NODE_ENV !== 'production') {\n if (typeof reducers[key] === 'undefined') {\n warning(`No reducer provided for key \"${key}\"`);\n }\n }\n if (typeof reducers[key] === 'function') {\n finalReducers[key] = reducers[key];\n }\n }\n const finalReducerKeys = Object.keys(finalReducers);\n\n // This is used to make sure we don't warn about the same\n // keys multiple times.\n let unexpectedKeyCache: {\n [key: string]: true;\n };\n if (process.env.NODE_ENV !== 'production') {\n unexpectedKeyCache = {};\n }\n let shapeAssertionError: unknown;\n try {\n assertReducerShape(finalReducers);\n } catch (e) {\n shapeAssertionError = e;\n }\n return function combination(state: StateFromReducersMapObject = {}, action: Action) {\n if (shapeAssertionError) {\n throw shapeAssertionError;\n }\n if (process.env.NODE_ENV !== 'production') {\n const warningMessage = getUnexpectedStateShapeWarningMessage(state, finalReducers, action, unexpectedKeyCache);\n if (warningMessage) {\n warning(warningMessage);\n }\n }\n let hasChanged = false;\n const nextState: StateFromReducersMapObject = {};\n for (let i = 0; i < finalReducerKeys.length; i++) {\n const key = finalReducerKeys[i];\n const reducer = finalReducers[key];\n const previousStateForKey = state[key];\n const nextStateForKey = reducer(previousStateForKey, action);\n if (typeof nextStateForKey === 'undefined') {\n const actionType = action && action.type;\n throw new Error(process.env.NODE_ENV === \"production\" ? _formatProdErrorMessage3(14) : `When called with an action of type ${actionType ? `\"${String(actionType)}\"` : '(unknown type)'}, the slice reducer for key \"${key}\" returned undefined. ` + `To ignore an action, you must explicitly return the previous state. ` + `If you want this reducer to hold no value, you can return null instead of undefined.`);\n }\n nextState[key] = nextStateForKey;\n hasChanged = hasChanged || nextStateForKey !== previousStateForKey;\n }\n hasChanged = hasChanged || finalReducerKeys.length !== Object.keys(state).length;\n return hasChanged ? nextState : state;\n };\n}", "import { formatProdErrorMessage as _formatProdErrorMessage } from \"src/utils/formatProdErrorMessage\";\nimport { Dispatch } from './types/store';\nimport { ActionCreator, ActionCreatorsMapObject, Action } from './types/actions';\nimport { kindOf } from './utils/kindOf';\nfunction bindActionCreator(actionCreator: ActionCreator, dispatch: Dispatch) {\n return function (this: any, ...args: any[]) {\n return dispatch(actionCreator.apply(this, args));\n };\n}\n\n/**\n * Turns an object whose values are action creators, into an object with the\n * same keys, but with every function wrapped into a `dispatch` call so they\n * may be invoked directly. This is just a convenience method, as you can call\n * `store.dispatch(MyActionCreators.doSomething())` yourself just fine.\n *\n * For convenience, you can also pass an action creator as the first argument,\n * and get a dispatch wrapped function in return.\n *\n * @param actionCreators An object whose values are action\n * creator functions. One handy way to obtain it is to use `import * as`\n * syntax. You may also pass a single function.\n *\n * @param dispatch The `dispatch` function available on your Redux\n * store.\n *\n * @returns The object mimicking the original object, but with\n * every action creator wrapped into the `dispatch` call. If you passed a\n * function as `actionCreators`, the return value will also be a single\n * function.\n */\nexport default function bindActionCreators>(actionCreator: C, dispatch: Dispatch): C;\nexport default function bindActionCreators, B extends ActionCreator>(actionCreator: A, dispatch: Dispatch): B;\nexport default function bindActionCreators>(actionCreators: M, dispatch: Dispatch): M;\nexport default function bindActionCreators(actionCreators: M, dispatch: Dispatch): N;\nexport default function bindActionCreators(actionCreators: ActionCreator | ActionCreatorsMapObject, dispatch: Dispatch) {\n if (typeof actionCreators === 'function') {\n return bindActionCreator(actionCreators, dispatch);\n }\n if (typeof actionCreators !== 'object' || actionCreators === null) {\n throw new Error(process.env.NODE_ENV === \"production\" ? _formatProdErrorMessage(16) : `bindActionCreators expected an object or a function, but instead received: '${kindOf(actionCreators)}'. ` + `Did you write \"import ActionCreators from\" instead of \"import * as ActionCreators from\"?`);\n }\n const boundActionCreators: ActionCreatorsMapObject = {};\n for (const key in actionCreators) {\n const actionCreator = actionCreators[key];\n if (typeof actionCreator === 'function') {\n boundActionCreators[key] = bindActionCreator(actionCreator, dispatch);\n }\n }\n return boundActionCreators;\n}", "type Func = (...a: T) => R;\n\n/**\n * Composes single-argument functions from right to left. The rightmost\n * function can take multiple arguments as it provides the signature for the\n * resulting composite function.\n *\n * @param funcs The functions to compose.\n * @returns A function obtained by composing the argument functions from right\n * to left. For example, `compose(f, g, h)` is identical to doing\n * `(...args) => f(g(h(...args)))`.\n */\nexport default function compose(): (a: R) => R;\nexport default function compose(f: F): F;\n\n/* two functions */\nexport default function compose(f1: (a: A) => R, f2: Func): Func;\n\n/* three functions */\nexport default function compose(f1: (b: B) => R, f2: (a: A) => B, f3: Func): Func;\n\n/* four functions */\nexport default function compose(f1: (c: C) => R, f2: (b: B) => C, f3: (a: A) => B, f4: Func): Func;\n\n/* rest */\nexport default function compose(f1: (a: any) => R, ...funcs: Function[]): (...args: any[]) => R;\nexport default function compose(...funcs: Function[]): (...args: any[]) => R;\nexport default function compose(...funcs: Function[]) {\n if (funcs.length === 0) {\n // infer the argument type so it is usable in inference down the line\n return (arg: T) => arg;\n }\n if (funcs.length === 1) {\n return funcs[0];\n }\n return funcs.reduce((a, b) => (...args: any) => a(b(...args)));\n}", "import { formatProdErrorMessage as _formatProdErrorMessage } from \"src/utils/formatProdErrorMessage\";\nimport compose from './compose';\nimport { Middleware, MiddlewareAPI } from './types/middleware';\nimport { StoreEnhancer, Dispatch } from './types/store';\n\n/**\n * Creates a store enhancer that applies middleware to the dispatch method\n * of the Redux store. This is handy for a variety of tasks, such as expressing\n * asynchronous actions in a concise manner, or logging every action payload.\n *\n * See `redux-thunk` package as an example of the Redux middleware.\n *\n * Because middleware is potentially asynchronous, this should be the first\n * store enhancer in the composition chain.\n *\n * Note that each middleware will be given the `dispatch` and `getState` functions\n * as named arguments.\n *\n * @param middlewares The middleware chain to be applied.\n * @returns A store enhancer applying the middleware.\n *\n * @template Ext Dispatch signature added by a middleware.\n * @template S The type of the state supported by a middleware.\n */\nexport default function applyMiddleware(): StoreEnhancer;\nexport default function applyMiddleware(middleware1: Middleware): StoreEnhancer<{\n dispatch: Ext1;\n}>;\nexport default function applyMiddleware(middleware1: Middleware, middleware2: Middleware): StoreEnhancer<{\n dispatch: Ext1 & Ext2;\n}>;\nexport default function applyMiddleware(middleware1: Middleware, middleware2: Middleware, middleware3: Middleware): StoreEnhancer<{\n dispatch: Ext1 & Ext2 & Ext3;\n}>;\nexport default function applyMiddleware(middleware1: Middleware, middleware2: Middleware, middleware3: Middleware, middleware4: Middleware): StoreEnhancer<{\n dispatch: Ext1 & Ext2 & Ext3 & Ext4;\n}>;\nexport default function applyMiddleware(middleware1: Middleware, middleware2: Middleware, middleware3: Middleware, middleware4: Middleware, middleware5: Middleware): StoreEnhancer<{\n dispatch: Ext1 & Ext2 & Ext3 & Ext4 & Ext5;\n}>;\nexport default function applyMiddleware(...middlewares: Middleware[]): StoreEnhancer<{\n dispatch: Ext;\n}>;\nexport default function applyMiddleware(...middlewares: Middleware[]): StoreEnhancer {\n return createStore => (reducer, preloadedState) => {\n const store = createStore(reducer, preloadedState);\n let dispatch: Dispatch = () => {\n throw new Error(process.env.NODE_ENV === \"production\" ? _formatProdErrorMessage(15) : 'Dispatching while constructing your middleware is not allowed. ' + 'Other middleware would not be applied to this dispatch.');\n };\n const middlewareAPI: MiddlewareAPI = {\n getState: store.getState,\n dispatch: (action, ...args) => dispatch(action, ...args)\n };\n const chain = middlewares.map(middleware => middleware(middlewareAPI));\n dispatch = compose(...chain)(store.dispatch);\n return {\n ...store,\n dispatch\n };\n };\n}", "import { Action } from '../types/actions';\nimport isPlainObject from './isPlainObject';\nexport default function isAction(action: unknown): action is Action {\n return isPlainObject(action) && 'type' in action && typeof (action as Record<'type', unknown>).type === 'string';\n}", "import type { AnyFunction } from '../types'\r\n\r\n/**\r\n * Runs a check to determine if the given result function behaves as an\r\n * identity function. An identity function is one that returns its\r\n * input unchanged, for example, `x => x`. This check helps ensure\r\n * efficient memoization and prevent unnecessary re-renders by encouraging\r\n * proper use of transformation logic in result functions and\r\n * extraction logic in input selectors.\r\n *\r\n * @param resultFunc - The result function to be checked.\r\n * @param inputSelectorsResults - The results of the input selectors.\r\n * @param outputSelectorResult - The result of the output selector.\r\n *\r\n * @see {@link https://reselect.js.org/api/development-only-stability-checks#identityfunctioncheck `identityFunctionCheck`}\r\n *\r\n * @since 5.0.0\r\n * @internal\r\n */\r\nexport const runIdentityFunctionCheck = (\r\n resultFunc: AnyFunction,\r\n inputSelectorsResults: unknown[],\r\n outputSelectorResult: unknown\r\n) => {\r\n if (\r\n inputSelectorsResults.length === 1 &&\r\n inputSelectorsResults[0] === outputSelectorResult\r\n ) {\r\n let isInputSameAsOutput = false\r\n try {\r\n const emptyObject = {}\r\n if (resultFunc(emptyObject) === emptyObject) isInputSameAsOutput = true\r\n } catch {\r\n // Do nothing\r\n }\r\n if (isInputSameAsOutput) {\r\n let stack: string | undefined = undefined\r\n try {\r\n throw new Error()\r\n } catch (e) {\r\n // eslint-disable-next-line @typescript-eslint/no-extra-semi, no-extra-semi\r\n ;({ stack } = e as Error)\r\n }\r\n console.warn(\r\n 'The result function returned its own inputs without modification. e.g' +\r\n '\\n`createSelector([state => state.todos], todos => todos)`' +\r\n '\\nThis could lead to inefficient memoization and unnecessary re-renders.' +\r\n '\\nEnsure transformation logic is in the result function, and extraction logic is in the input selectors.',\r\n { stack }\r\n )\r\n }\r\n }\r\n}\r\n", "import type { CreateSelectorOptions, UnknownMemoizer } from '../types'\r\n\r\n/**\r\n * Runs a stability check to ensure the input selector results remain stable\r\n * when provided with the same arguments. This function is designed to detect\r\n * changes in the output of input selectors, which can impact the performance of memoized selectors.\r\n *\r\n * @param inputSelectorResultsObject - An object containing two arrays: `inputSelectorResults` and `inputSelectorResultsCopy`, representing the results of input selectors.\r\n * @param options - Options object consisting of a `memoize` function and a `memoizeOptions` object.\r\n * @param inputSelectorArgs - List of arguments being passed to the input selectors.\r\n *\r\n * @see {@link https://reselect.js.org/api/development-only-stability-checks/#inputstabilitycheck `inputStabilityCheck`}\r\n *\r\n * @since 5.0.0\r\n * @internal\r\n */\r\nexport const runInputStabilityCheck = (\r\n inputSelectorResultsObject: {\r\n inputSelectorResults: unknown[]\r\n inputSelectorResultsCopy: unknown[]\r\n },\r\n options: Required<\r\n Pick<\r\n CreateSelectorOptions,\r\n 'memoize' | 'memoizeOptions'\r\n >\r\n >,\r\n inputSelectorArgs: unknown[] | IArguments\r\n) => {\r\n const { memoize, memoizeOptions } = options\r\n const { inputSelectorResults, inputSelectorResultsCopy } =\r\n inputSelectorResultsObject\r\n const createAnEmptyObject = memoize(() => ({}), ...memoizeOptions)\r\n // if the memoize method thinks the parameters are equal, these *should* be the same reference\r\n const areInputSelectorResultsEqual =\r\n createAnEmptyObject.apply(null, inputSelectorResults) ===\r\n createAnEmptyObject.apply(null, inputSelectorResultsCopy)\r\n if (!areInputSelectorResultsEqual) {\r\n let stack: string | undefined = undefined\r\n try {\r\n throw new Error()\r\n } catch (e) {\r\n // eslint-disable-next-line @typescript-eslint/no-extra-semi, no-extra-semi\r\n ;({ stack } = e as Error)\r\n }\r\n console.warn(\r\n 'An input selector returned a different result when passed same arguments.' +\r\n '\\nThis means your output selector will likely run more frequently than intended.' +\r\n '\\nAvoid returning a new reference inside your input selector, e.g.' +\r\n '\\n`createSelector([state => state.todos.map(todo => todo.id)], todoIds => todoIds.length)`',\r\n {\r\n arguments: inputSelectorArgs,\r\n firstInputs: inputSelectorResults,\r\n secondInputs: inputSelectorResultsCopy,\r\n stack\r\n }\r\n )\r\n }\r\n}\r\n", "import type { DevModeChecks } from '../types'\r\n\r\n/**\r\n * Global configuration for development mode checks. This specifies the default\r\n * frequency at which each development mode check should be performed.\r\n *\r\n * @since 5.0.0\r\n * @internal\r\n */\r\nexport const globalDevModeChecks: DevModeChecks = {\r\n inputStabilityCheck: 'once',\r\n identityFunctionCheck: 'once'\r\n}\r\n\r\n/**\r\n * Overrides the development mode checks settings for all selectors.\r\n *\r\n * Reselect performs additional checks in development mode to help identify and\r\n * warn about potential issues in selector behavior. This function allows you to\r\n * customize the behavior of these checks across all selectors in your application.\r\n *\r\n * **Note**: This setting can still be overridden per selector inside `createSelector`'s `options` object.\r\n * See {@link https://github.com/reduxjs/reselect#2-per-selector-by-passing-an-identityfunctioncheck-option-directly-to-createselector per-selector-configuration}\r\n * and {@linkcode CreateSelectorOptions.identityFunctionCheck identityFunctionCheck} for more details.\r\n *\r\n * _The development mode checks do not run in production builds._\r\n *\r\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.\r\n *\r\n * @example\r\n * ```ts\r\n * import { setGlobalDevModeChecks } from 'reselect'\r\n * import { DevModeChecks } from '../types'\r\n *\r\n * // Run only the first time the selector is called. (default)\r\n * setGlobalDevModeChecks({ inputStabilityCheck: 'once' })\r\n *\r\n * // Run every time the selector is called.\r\n * setGlobalDevModeChecks({ inputStabilityCheck: 'always' })\r\n *\r\n * // Never run the input stability check.\r\n * setGlobalDevModeChecks({ inputStabilityCheck: 'never' })\r\n *\r\n * // Run only the first time the selector is called. (default)\r\n * setGlobalDevModeChecks({ identityFunctionCheck: 'once' })\r\n *\r\n * // Run every time the selector is called.\r\n * setGlobalDevModeChecks({ identityFunctionCheck: 'always' })\r\n *\r\n * // Never run the identity function check.\r\n * setGlobalDevModeChecks({ identityFunctionCheck: 'never' })\r\n * ```\r\n * @see {@link https://reselect.js.org/api/development-only-stability-checks Development-Only Stability Checks}\r\n * @see {@link https://reselect.js.org/api/development-only-stability-checks#1-globally-through-setglobaldevmodechecks global-configuration}\r\n *\r\n * @since 5.0.0\r\n * @public\r\n */\r\nexport const setGlobalDevModeChecks = (\r\n devModeChecks: Partial\r\n) => {\r\n Object.assign(globalDevModeChecks, devModeChecks)\r\n}\r\n", "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 autotracking implementation source:\r\n// - https://gist.github.com/pzuraq/79bf862e0f8cd9521b79c4b6eccdc4f9\r\n// Additional references:\r\n// - https://www.pzuraq.com/blog/how-autotracking-works\r\n// - https://v5.chriskrycho.com/journal/autotracking-elegant-dx-via-cutting-edge-cs/\r\nimport type { EqualityFn } from '../types'\r\nimport { assertIsFunction } from '../utils'\r\n\r\n// The global revision clock. Every time state changes, the clock increments.\r\nexport let $REVISION = 0\r\n\r\n// The current dependency tracker. Whenever we compute a cache, we create a Set\r\n// to track any dependencies that are used while computing. If no cache is\r\n// computing, then the tracker is null.\r\nlet CURRENT_TRACKER: Set | TrackingCache> | null = null\r\n\r\n// Storage represents a root value in the system - the actual state of our app.\r\nexport class Cell {\r\n revision = $REVISION\r\n\r\n _value: T\r\n _lastValue: T\r\n _isEqual: EqualityFn = tripleEq\r\n\r\n constructor(initialValue: T, isEqual: EqualityFn = tripleEq) {\r\n this._value = this._lastValue = initialValue\r\n this._isEqual = isEqual\r\n }\r\n\r\n // Whenever a storage value is read, it'll add itself to the current tracker if\r\n // one exists, entangling its state with that cache.\r\n get value() {\r\n CURRENT_TRACKER?.add(this)\r\n\r\n return this._value\r\n }\r\n\r\n // Whenever a storage value is updated, we bump the global revision clock,\r\n // assign the revision for this storage to the new value, _and_ we schedule a\r\n // rerender. This is important, and it's what makes autotracking _pull_\r\n // based. We don't actively tell the caches which depend on the storage that\r\n // anything has happened. Instead, we recompute the caches when needed.\r\n set value(newValue) {\r\n if (this.value === newValue) return\r\n\r\n this._value = newValue\r\n this.revision = ++$REVISION\r\n }\r\n}\r\n\r\nfunction tripleEq(a: unknown, b: unknown) {\r\n return a === b\r\n}\r\n\r\n// Caches represent derived state in the system. They are ultimately functions\r\n// that are memoized based on what state they use to produce their output,\r\n// meaning they will only rerun IFF a storage value that could affect the output\r\n// has changed. Otherwise, they'll return the cached value.\r\nexport class TrackingCache {\r\n _cachedValue: any\r\n _cachedRevision = -1\r\n _deps: any[] = []\r\n hits = 0\r\n\r\n fn: () => any\r\n\r\n constructor(fn: () => any) {\r\n this.fn = fn\r\n }\r\n\r\n clear() {\r\n this._cachedValue = undefined\r\n this._cachedRevision = -1\r\n this._deps = []\r\n this.hits = 0\r\n }\r\n\r\n get value() {\r\n // When getting the value for a Cache, first we check all the dependencies of\r\n // the cache to see what their current revision is. If the current revision is\r\n // greater than the cached revision, then something has changed.\r\n if (this.revision > this._cachedRevision) {\r\n const { fn } = this\r\n\r\n // We create a new dependency tracker for this cache. As the cache runs\r\n // its function, any Storage or Cache instances which are used while\r\n // computing will be added to this tracker. In the end, it will be the\r\n // full list of dependencies that this Cache depends on.\r\n const currentTracker = new Set>()\r\n const prevTracker = CURRENT_TRACKER\r\n\r\n CURRENT_TRACKER = currentTracker\r\n\r\n // try {\r\n this._cachedValue = fn()\r\n // } finally {\r\n CURRENT_TRACKER = prevTracker\r\n this.hits++\r\n this._deps = Array.from(currentTracker)\r\n\r\n // Set the cached revision. This is the current clock count of all the\r\n // dependencies. If any dependency changes, this number will be less\r\n // than the new revision.\r\n this._cachedRevision = this.revision\r\n // }\r\n }\r\n\r\n // If there is a current tracker, it means another Cache is computing and\r\n // using this one, so we add this one to the tracker.\r\n CURRENT_TRACKER?.add(this)\r\n\r\n // Always return the cached value.\r\n return this._cachedValue\r\n }\r\n\r\n get revision() {\r\n // The current revision is the max of all the dependencies' revisions.\r\n return Math.max(...this._deps.map(d => d.revision), 0)\r\n }\r\n}\r\n\r\nexport function getValue(cell: Cell): T {\r\n if (!(cell instanceof Cell)) {\r\n console.warn('Not a valid cell! ', cell)\r\n }\r\n\r\n return cell.value\r\n}\r\n\r\ntype CellValue> = T extends Cell ? U : never\r\n\r\nexport function setValue>(\r\n storage: T,\r\n value: CellValue\r\n): void {\r\n if (!(storage instanceof Cell)) {\r\n throw new TypeError(\r\n 'setValue must be passed a tracked store created with `createStorage`.'\r\n )\r\n }\r\n\r\n storage.value = storage._lastValue = value\r\n}\r\n\r\nexport function createCell(\r\n initialValue: T,\r\n isEqual: EqualityFn = tripleEq\r\n): Cell {\r\n return new Cell(initialValue, isEqual)\r\n}\r\n\r\nexport function createCache(fn: () => T): TrackingCache {\r\n assertIsFunction(\r\n fn,\r\n 'the first parameter to `createCache` must be a function'\r\n )\r\n\r\n return new TrackingCache(fn)\r\n}\r\n", "import type { Cell } from './autotracking'\r\nimport {\r\n getValue as consumeTag,\r\n createCell as createStorage,\r\n setValue\r\n} from './autotracking'\r\n\r\nexport type Tag = Cell\r\n\r\nconst neverEq = (a: any, b: any): boolean => false\r\n\r\nexport function createTag(): Tag {\r\n return createStorage(null, neverEq)\r\n}\r\nexport { consumeTag }\r\nexport function dirtyTag(tag: Tag, value: any): void {\r\n setValue(tag, value)\r\n}\r\n\r\nexport interface Node<\r\n T extends Array | Record =\r\n | Array\r\n | Record\r\n> {\r\n collectionTag: Tag | null\r\n tag: Tag | null\r\n tags: Record\r\n children: Record\r\n proxy: T\r\n value: T\r\n id: number\r\n}\r\n\r\nexport const consumeCollection = (node: Node): void => {\r\n let tag = node.collectionTag\r\n\r\n if (tag === null) {\r\n tag = node.collectionTag = createTag()\r\n }\r\n\r\n consumeTag(tag)\r\n}\r\n\r\nexport const dirtyCollection = (node: Node): void => {\r\n const tag = node.collectionTag\r\n\r\n if (tag !== null) {\r\n dirtyTag(tag, null)\r\n }\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", "import type {\r\n AnyFunction,\r\n DefaultMemoizeFields,\r\n EqualityFn,\r\n Simplify\r\n} from './types'\r\n\r\nimport type { NOT_FOUND_TYPE } from './utils'\r\nimport { NOT_FOUND } from './utils'\r\n\r\n// Cache implementation based on Erik Rasmussen's `lru-memoize`:\r\n// https://github.com/erikras/lru-memoize\r\n\r\ninterface Entry {\r\n key: unknown\r\n value: unknown\r\n}\r\n\r\ninterface Cache {\r\n get(key: unknown): unknown | NOT_FOUND_TYPE\r\n put(key: unknown, value: unknown): void\r\n getEntries(): Entry[]\r\n clear(): void\r\n}\r\n\r\nfunction createSingletonCache(equals: EqualityFn): Cache {\r\n let entry: Entry | undefined\r\n return {\r\n get(key: unknown) {\r\n if (entry && equals(entry.key, key)) {\r\n return entry.value\r\n }\r\n\r\n return NOT_FOUND\r\n },\r\n\r\n put(key: unknown, value: unknown) {\r\n entry = { key, value }\r\n },\r\n\r\n getEntries() {\r\n return entry ? [entry] : []\r\n },\r\n\r\n clear() {\r\n entry = undefined\r\n }\r\n }\r\n}\r\n\r\nfunction createLruCache(maxSize: number, equals: EqualityFn): Cache {\r\n let entries: Entry[] = []\r\n\r\n function get(key: unknown) {\r\n const cacheIndex = entries.findIndex(entry => equals(key, entry.key))\r\n\r\n // We found a cached entry\r\n if (cacheIndex > -1) {\r\n const entry = entries[cacheIndex]\r\n\r\n // Cached entry not at top of cache, move it to the top\r\n if (cacheIndex > 0) {\r\n entries.splice(cacheIndex, 1)\r\n entries.unshift(entry)\r\n }\r\n\r\n return entry.value\r\n }\r\n\r\n // No entry found in cache, return sentinel\r\n return NOT_FOUND\r\n }\r\n\r\n function put(key: unknown, value: unknown) {\r\n if (get(key) === NOT_FOUND) {\r\n // TODO Is unshift slow?\r\n entries.unshift({ key, value })\r\n if (entries.length > maxSize) {\r\n entries.pop()\r\n }\r\n }\r\n }\r\n\r\n function getEntries() {\r\n return entries\r\n }\r\n\r\n function clear() {\r\n entries = []\r\n }\r\n\r\n return { get, put, getEntries, clear }\r\n}\r\n\r\n/**\r\n * Runs a simple reference equality check.\r\n * What {@linkcode lruMemoize lruMemoize} uses by default.\r\n *\r\n * **Note**: This function was previously known as `defaultEqualityCheck`.\r\n *\r\n * @public\r\n */\r\nexport const referenceEqualityCheck: EqualityFn = (a, b) => a === b\r\n\r\nexport function createCacheKeyComparator(equalityCheck: EqualityFn) {\r\n return function areArgumentsShallowlyEqual(\r\n prev: unknown[] | IArguments | null,\r\n next: unknown[] | IArguments | null\r\n ): boolean {\r\n if (prev === null || next === null || prev.length !== next.length) {\r\n return false\r\n }\r\n\r\n // Do this in a for loop (and not a `forEach` or an `every`) so we can determine equality as fast as possible.\r\n const { length } = prev\r\n for (let i = 0; i < length; i++) {\r\n if (!equalityCheck(prev[i], next[i])) {\r\n return false\r\n }\r\n }\r\n\r\n return true\r\n }\r\n}\r\n\r\n/**\r\n * Options for configuring the behavior of a function memoized with\r\n * LRU (Least Recently Used) caching.\r\n *\r\n * @template Result - The type of the return value of the memoized function.\r\n *\r\n * @public\r\n */\r\nexport interface LruMemoizeOptions {\r\n /**\r\n * Function used to compare the individual arguments of the\r\n * provided calculation function.\r\n *\r\n * @default referenceEqualityCheck\r\n */\r\n equalityCheck?: EqualityFn\r\n\r\n /**\r\n * If provided, used to compare a newly generated output value against\r\n * previous values in the cache. If a match is found,\r\n * 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\r\n * a recalculation due to changed references, but the output is still\r\n * effectively the same.\r\n *\r\n * @since 4.1.0\r\n */\r\n resultEqualityCheck?: EqualityFn\r\n\r\n /**\r\n * The maximum size of the cache used by the selector.\r\n * A size greater than 1 means the selector will use an\r\n * LRU (Least Recently Used) cache, allowing for the caching of multiple\r\n * results based on different sets of arguments.\r\n *\r\n * @default 1\r\n */\r\n maxSize?: number\r\n}\r\n\r\n/**\r\n * Creates a memoized version of a function with an optional\r\n * LRU (Least Recently Used) cache. The memoized function uses a cache to\r\n * store computed values. Depending on the `maxSize` option, it will use\r\n * either a singleton cache (for a single entry) or an\r\n * LRU cache (for multiple entries).\r\n *\r\n * **Note**: This function was previously known as `defaultMemoize`.\r\n *\r\n * @param func - The function to be memoized.\r\n * @param equalityCheckOrOptions - Either an equality check function or an options object.\r\n * @returns A memoized function with a `.clearCache()` method attached.\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/lruMemoize `lruMemoize`}\r\n *\r\n * @public\r\n */\r\nexport function lruMemoize(\r\n func: Func,\r\n equalityCheckOrOptions?: EqualityFn | LruMemoizeOptions>\r\n) {\r\n const providedOptions =\r\n typeof equalityCheckOrOptions === 'object'\r\n ? equalityCheckOrOptions\r\n : { equalityCheck: equalityCheckOrOptions }\r\n\r\n const {\r\n equalityCheck = referenceEqualityCheck,\r\n maxSize = 1,\r\n resultEqualityCheck\r\n } = providedOptions\r\n\r\n const comparator = createCacheKeyComparator(equalityCheck)\r\n\r\n let resultsCount = 0\r\n\r\n const cache =\r\n maxSize <= 1\r\n ? createSingletonCache(comparator)\r\n : createLruCache(maxSize, comparator)\r\n\r\n function memoized() {\r\n let value = cache.get(arguments) as ReturnType\r\n if (value === NOT_FOUND) {\r\n // apply arguments instead of spreading for performance.\r\n // @ts-ignore\r\n value = func.apply(null, arguments) as ReturnType\r\n resultsCount++\r\n\r\n if (resultEqualityCheck) {\r\n const entries = cache.getEntries()\r\n const matchingEntry = entries.find(entry =>\r\n resultEqualityCheck(entry.value as ReturnType, value)\r\n )\r\n\r\n if (matchingEntry) {\r\n value = matchingEntry.value as ReturnType\r\n resultsCount !== 0 && resultsCount--\r\n }\r\n }\r\n\r\n cache.put(arguments, value)\r\n }\r\n return value\r\n }\r\n\r\n memoized.clearCache = () => {\r\n cache.clear()\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 { createNode, updateNode } from './proxy'\r\nimport type { Node } from './tracking'\r\n\r\nimport { createCacheKeyComparator, referenceEqualityCheck } from '../lruMemoize'\r\nimport type { AnyFunction, DefaultMemoizeFields, Simplify } from '../types'\r\nimport { createCache } from './autotracking'\r\n\r\n/**\r\n * Uses an \"auto-tracking\" approach inspired by the work of the Ember Glimmer team.\r\n * It uses a Proxy to wrap arguments and track accesses to nested fields\r\n * in your selector on first read. Later, when the selector is called with\r\n * new arguments, it identifies which accessed fields have changed and\r\n * only recalculates the result if one or more of those accessed fields have changed.\r\n * This allows it to be more precise than the shallow equality checks in `lruMemoize`.\r\n *\r\n * __Design Tradeoffs for `autotrackMemoize`:__\r\n * - Pros:\r\n * - It is likely to avoid excess calculations and recalculate fewer times than `lruMemoize` will,\r\n * which may also result in fewer component re-renders.\r\n * - Cons:\r\n * - It only has a cache size of 1.\r\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)\r\n * - It can have some unexpected behavior. Because it tracks nested field accesses,\r\n * cases where you don't access a field will not recalculate properly.\r\n * For example, a badly-written selector like:\r\n * ```ts\r\n * createSelector([state => state.todos], todos => todos)\r\n * ```\r\n * that just immediately returns the extracted value will never update, because it doesn't see any field accesses to check.\r\n *\r\n * __Use Cases for `autotrackMemoize`:__\r\n * - It is likely best used for cases where you need to access specific nested fields\r\n * in data, and avoid recalculating if other fields in the same data objects are immutably updated.\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 { unstable_autotrackMemoize as autotrackMemoize, createSelector } from 'reselect'\r\n *\r\n * const selectTodoIds = createSelector(\r\n * [(state: RootState) => state.todos],\r\n * (todos) => todos.map(todo => todo.id),\r\n * { memoize: autotrackMemoize }\r\n * )\r\n * ```\r\n *\r\n * @example\r\n * Using `createSelectorCreator`\r\n * ```ts\r\n * import { unstable_autotrackMemoize as autotrackMemoize, createSelectorCreator } from 'reselect'\r\n *\r\n * const createSelectorAutotrack = createSelectorCreator({ memoize: autotrackMemoize })\r\n *\r\n * const selectTodoIds = createSelectorAutotrack(\r\n * [(state: RootState) => state.todos],\r\n * (todos) => todos.map(todo => todo.id)\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/unstable_autotrackMemoize autotrackMemoize}\r\n *\r\n * @since 5.0.0\r\n * @public\r\n * @experimental\r\n */\r\nexport function autotrackMemoize(func: Func) {\r\n // we reference arguments instead of spreading them for performance reasons\r\n\r\n const node: Node> = createNode(\r\n [] as unknown as Record\r\n )\r\n\r\n let lastArgs: IArguments | null = null\r\n\r\n const shallowEqual = createCacheKeyComparator(referenceEqualityCheck)\r\n\r\n const cache = createCache(() => {\r\n const res = func.apply(null, node.proxy as unknown as any[])\r\n return res\r\n })\r\n\r\n function memoized() {\r\n if (!shallowEqual(lastArgs, arguments)) {\r\n updateNode(node, arguments as unknown as Record)\r\n lastArgs = arguments\r\n }\r\n return cache.value\r\n }\r\n\r\n memoized.clearCache = () => {\r\n return cache.clear()\r\n }\r\n\r\n return memoized as Func & Simplify\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", "// src/index.ts\nfunction createThunkMiddleware(extraArgument) {\n const middleware = ({ dispatch, getState }) => (next) => (action) => {\n if (typeof action === \"function\") {\n return action(dispatch, getState, extraArgument);\n }\n return next(action);\n };\n return middleware;\n}\nvar thunk = createThunkMiddleware();\nvar withExtraArgument = createThunkMiddleware;\nexport {\n thunk,\n withExtraArgument\n};\n", "// This must remain here so that the `mangleErrors.cjs` build script\n// does not have to import this into each source file it rewrites.\nimport { formatProdErrorMessage } from './formatProdErrorMessage';\nexport * from 'redux';\nexport { produce as createNextState, current, freeze, original, isDraft } from 'immer';\nexport type { Draft } from 'immer';\nexport { createSelector, createSelectorCreator, lruMemoize, weakMapMemoize } from 'reselect';\nexport type { Selector, OutputSelector } from 'reselect';\nexport { createDraftSafeSelector, createDraftSafeSelectorCreator } from './createDraftSafeSelector';\nexport type { ThunkAction, ThunkDispatch, ThunkMiddleware } from 'redux-thunk';\nexport {\n// js\nconfigureStore } from './configureStore';\nexport type {\n// types\nConfigureStoreOptions, EnhancedStore } from './configureStore';\nexport type { DevToolsEnhancerOptions } from './devtoolsExtension';\nexport {\n// js\ncreateAction, isActionCreator, isFSA as isFluxStandardAction } from './createAction';\nexport type {\n// types\nPayloadAction, PayloadActionCreator, ActionCreatorWithNonInferrablePayload, ActionCreatorWithOptionalPayload, ActionCreatorWithPayload, ActionCreatorWithoutPayload, ActionCreatorWithPreparedPayload, PrepareAction } from './createAction';\nexport {\n// js\ncreateReducer } from './createReducer';\nexport type {\n// types\nActions, CaseReducer, CaseReducers } from './createReducer';\nexport {\n// js\ncreateSlice, buildCreateSlice, asyncThunkCreator, ReducerType } from './createSlice';\nexport type {\n// types\nCreateSliceOptions, Slice, CaseReducerActions, SliceCaseReducers, ValidateSliceCaseReducers, CaseReducerWithPrepare, ReducerCreators, SliceSelectors } from './createSlice';\nexport type { ActionCreatorInvariantMiddlewareOptions } from './actionCreatorInvariantMiddleware';\nexport { createActionCreatorInvariantMiddleware } from './actionCreatorInvariantMiddleware';\nexport {\n// js\ncreateImmutableStateInvariantMiddleware, isImmutableDefault } from './immutableStateInvariantMiddleware';\nexport type {\n// types\nImmutableStateInvariantMiddlewareOptions } from './immutableStateInvariantMiddleware';\nexport {\n// js\ncreateSerializableStateInvariantMiddleware, findNonSerializableValue, isPlain } from './serializableStateInvariantMiddleware';\nexport type {\n// types\nSerializableStateInvariantMiddlewareOptions } from './serializableStateInvariantMiddleware';\nexport type {\n// types\nActionReducerMapBuilder } from './mapBuilders';\nexport { Tuple } from './utils';\nexport { createEntityAdapter } from './entities/create_adapter';\nexport type { EntityState, EntityAdapter, EntitySelectors, EntityStateAdapter, EntityId, Update, IdSelector, Comparer } from './entities/models';\nexport { createAsyncThunk, unwrapResult, miniSerializeError } from './createAsyncThunk';\nexport type { AsyncThunk, AsyncThunkOptions, AsyncThunkAction, AsyncThunkPayloadCreatorReturnValue, AsyncThunkPayloadCreator, GetState, GetThunkAPI, SerializedError, CreateAsyncThunkFunction } from './createAsyncThunk';\nexport {\n// js\nisAllOf, isAnyOf, isPending, isRejected, isFulfilled, isAsyncThunkAction, isRejectedWithValue } from './matchers';\nexport type {\n// types\nActionMatchingAllOf, ActionMatchingAnyOf } from './matchers';\nexport { nanoid } from './nanoid';\nexport type { ListenerEffect, ListenerMiddleware, ListenerEffectAPI, ListenerMiddlewareInstance, CreateListenerMiddlewareOptions, ListenerErrorHandler, TypedStartListening, TypedAddListener, TypedStopListening, TypedRemoveListener, UnsubscribeListener, UnsubscribeListenerOptions, ForkedTaskExecutor, ForkedTask, ForkedTaskAPI, AsyncTaskExecutor, SyncTaskExecutor, TaskCancelled, TaskRejected, TaskResolved, TaskResult } from './listenerMiddleware/index';\nexport type { AnyListenerPredicate } from './listenerMiddleware/types';\nexport { createListenerMiddleware, addListener, removeListener, clearAllListeners, TaskAbortError } from './listenerMiddleware/index';\nexport type { AddMiddleware, DynamicDispatch, DynamicMiddlewareInstance, GetDispatchType as GetDispatch, MiddlewareApiConfig } from './dynamicMiddleware/types';\nexport { createDynamicMiddleware } from './dynamicMiddleware/index';\nexport { SHOULD_AUTOBATCH, prepareAutoBatched, autoBatchEnhancer } from './autoBatchEnhancer';\nexport type { AutoBatchOptions } from './autoBatchEnhancer';\nexport { combineSlices } from './combineSlices';\nexport type { CombinedSliceReducer, WithSlice } from './combineSlices';\nexport type { ExtractDispatchExtensions as TSHelpersExtractDispatchExtensions, SafePromise } from './tsHelpers';\nexport { formatProdErrorMessage } from './formatProdErrorMessage';", "import { current, isDraft } from 'immer';\nimport { createSelectorCreator, weakMapMemoize } from 'reselect';\nexport const createDraftSafeSelectorCreator: typeof createSelectorCreator = (...args: unknown[]) => {\n const createSelector = (createSelectorCreator as any)(...args);\n const createDraftSafeSelector = Object.assign((...args: unknown[]) => {\n const selector = createSelector(...args);\n const wrappedSelector = (value: unknown, ...rest: unknown[]) => selector(isDraft(value) ? current(value) : value, ...rest);\n Object.assign(wrappedSelector, selector);\n return wrappedSelector as any;\n }, {\n withTypes: () => createDraftSafeSelector\n });\n return createDraftSafeSelector;\n};\n\n/**\n * \"Draft-Safe\" version of `reselect`'s `createSelector`:\n * If an `immer`-drafted object is passed into the resulting selector's first argument,\n * the selector will act on the current draft value, instead of returning a cached value\n * that might be possibly outdated if the draft has been modified since.\n * @public\n */\nexport const createDraftSafeSelector = /* @__PURE__ */\ncreateDraftSafeSelectorCreator(weakMapMemoize);", "import { formatProdErrorMessage as _formatProdErrorMessage, formatProdErrorMessage as _formatProdErrorMessage2, formatProdErrorMessage as _formatProdErrorMessage3, formatProdErrorMessage as _formatProdErrorMessage4, formatProdErrorMessage as _formatProdErrorMessage5, formatProdErrorMessage as _formatProdErrorMessage6, formatProdErrorMessage as _formatProdErrorMessage7 } from \"@reduxjs/toolkit\";\nimport type { Reducer, ReducersMapObject, Middleware, Action, StoreEnhancer, Store, UnknownAction } from 'redux';\nimport { applyMiddleware, createStore, compose, combineReducers, isPlainObject } from 'redux';\nimport type { DevToolsEnhancerOptions as DevToolsOptions } from './devtoolsExtension';\nimport { composeWithDevTools } from './devtoolsExtension';\nimport type { ThunkMiddlewareFor, GetDefaultMiddleware } from './getDefaultMiddleware';\nimport { buildGetDefaultMiddleware } from './getDefaultMiddleware';\nimport type { ExtractDispatchExtensions, ExtractStoreExtensions, ExtractStateExtensions, UnknownIfNonSpecific } from './tsHelpers';\nimport type { Tuple } from './utils';\nimport type { GetDefaultEnhancers } from './getDefaultEnhancers';\nimport { buildGetDefaultEnhancers } from './getDefaultEnhancers';\n\n/**\n * Options for `configureStore()`.\n *\n * @public\n */\nexport interface ConfigureStoreOptions> = Tuple>, E extends Tuple = Tuple, P = S> {\n /**\n * A single reducer function that will be used as the root reducer, or an\n * object of slice reducers that will be passed to `combineReducers()`.\n */\n reducer: Reducer | ReducersMapObject;\n\n /**\n * An array of Redux middleware to install, or a callback receiving `getDefaultMiddleware` and returning a Tuple of middleware.\n * If not supplied, defaults to the set of middleware returned by `getDefaultMiddleware()`.\n *\n * @example `middleware: (gDM) => gDM().concat(logger, apiMiddleware, yourCustomMiddleware)`\n * @see https://redux-toolkit.js.org/api/getDefaultMiddleware#intended-usage\n */\n middleware?: (getDefaultMiddleware: GetDefaultMiddleware) => M;\n\n /**\n * Whether to enable Redux DevTools integration. Defaults to `true`.\n *\n * Additional configuration can be done by passing Redux DevTools options\n */\n devTools?: boolean | DevToolsOptions;\n\n /**\n * The initial state, same as Redux's createStore.\n * You may optionally specify it to hydrate the state\n * from the server in universal apps, or to restore a previously serialized\n * user session. If you use `combineReducers()` to produce the root reducer\n * function (either directly or indirectly by passing an object as `reducer`),\n * this must be an object with the same shape as the reducer map keys.\n */\n // we infer here, and instead complain if the reducer doesn't match\n preloadedState?: P;\n\n /**\n * The store enhancers to apply. See Redux's `createStore()`.\n * All enhancers will be included before the DevTools Extension enhancer.\n * If you need to customize the order of enhancers, supply a callback\n * function that will receive a `getDefaultEnhancers` function that returns a Tuple,\n * and should return a Tuple of enhancers (such as `getDefaultEnhancers().concat(offline)`).\n * If you only need to add middleware, you can use the `middleware` parameter instead.\n */\n enhancers?: (getDefaultEnhancers: GetDefaultEnhancers) => E;\n}\nexport type Middlewares = ReadonlyArray>;\ntype Enhancers = ReadonlyArray;\n\n/**\n * A Redux store returned by `configureStore()`. Supports dispatching\n * side-effectful _thunks_ in addition to plain actions.\n *\n * @public\n */\nexport type EnhancedStore = ExtractStoreExtensions & Store>>;\n\n/**\n * A friendly abstraction over the standard Redux `createStore()` function.\n *\n * @param options The store configuration.\n * @returns A configured Redux store.\n *\n * @public\n */\nexport function configureStore> = Tuple<[ThunkMiddlewareFor]>, E extends Tuple = Tuple<[StoreEnhancer<{\n dispatch: ExtractDispatchExtensions;\n}>, StoreEnhancer]>, P = S>(options: ConfigureStoreOptions): EnhancedStore {\n const getDefaultMiddleware = buildGetDefaultMiddleware();\n const {\n reducer = undefined,\n middleware,\n devTools = true,\n preloadedState = undefined,\n enhancers = undefined\n } = options || {};\n let rootReducer: Reducer;\n if (typeof reducer === 'function') {\n rootReducer = reducer;\n } else if (isPlainObject(reducer)) {\n rootReducer = combineReducers(reducer) as unknown as Reducer;\n } else {\n throw new Error(process.env.NODE_ENV === \"production\" ? _formatProdErrorMessage(1) : '`reducer` is a required argument, and must be a function or an object of functions that can be passed to combineReducers');\n }\n if (process.env.NODE_ENV !== 'production' && middleware && typeof middleware !== 'function') {\n throw new Error(process.env.NODE_ENV === \"production\" ? _formatProdErrorMessage2(2) : '`middleware` field must be a callback');\n }\n let finalMiddleware: Tuple>;\n if (typeof middleware === 'function') {\n finalMiddleware = middleware(getDefaultMiddleware);\n if (process.env.NODE_ENV !== 'production' && !Array.isArray(finalMiddleware)) {\n throw new Error(process.env.NODE_ENV === \"production\" ? _formatProdErrorMessage3(3) : 'when using a middleware builder function, an array of middleware must be returned');\n }\n } else {\n finalMiddleware = getDefaultMiddleware();\n }\n if (process.env.NODE_ENV !== 'production' && finalMiddleware.some((item: any) => typeof item !== 'function')) {\n throw new Error(process.env.NODE_ENV === \"production\" ? _formatProdErrorMessage4(4) : 'each middleware provided to configureStore must be a function');\n }\n let finalCompose = compose;\n if (devTools) {\n finalCompose = composeWithDevTools({\n // Enable capture of stack traces for dispatched Redux actions\n trace: process.env.NODE_ENV !== 'production',\n ...(typeof devTools === 'object' && devTools)\n });\n }\n const middlewareEnhancer = applyMiddleware(...finalMiddleware);\n const getDefaultEnhancers = buildGetDefaultEnhancers(middlewareEnhancer);\n if (process.env.NODE_ENV !== 'production' && enhancers && typeof enhancers !== 'function') {\n throw new Error(process.env.NODE_ENV === \"production\" ? _formatProdErrorMessage5(5) : '`enhancers` field must be a callback');\n }\n let storeEnhancers = typeof enhancers === 'function' ? enhancers(getDefaultEnhancers) : getDefaultEnhancers();\n if (process.env.NODE_ENV !== 'production' && !Array.isArray(storeEnhancers)) {\n throw new Error(process.env.NODE_ENV === \"production\" ? _formatProdErrorMessage6(6) : '`enhancers` callback must return an array');\n }\n if (process.env.NODE_ENV !== 'production' && storeEnhancers.some((item: any) => typeof item !== 'function')) {\n throw new Error(process.env.NODE_ENV === \"production\" ? _formatProdErrorMessage7(7) : 'each enhancer provided to configureStore must be a function');\n }\n if (process.env.NODE_ENV !== 'production' && finalMiddleware.length && !storeEnhancers.includes(middlewareEnhancer)) {\n console.error('middlewares were provided, but middleware enhancer was not included in final enhancers - make sure to call `getDefaultEnhancers`');\n }\n const composedEnhancer: StoreEnhancer = finalCompose(...storeEnhancers);\n return createStore(rootReducer, preloadedState as P, composedEnhancer);\n}", "import type { Action, ActionCreator, StoreEnhancer } from 'redux';\nimport { compose } from 'redux';\n\n/**\n * @public\n */\nexport interface DevToolsEnhancerOptions {\n /**\n * the instance name to be showed on the monitor page. Default value is `document.title`.\n * If not specified and there's no document title, it will consist of `tabId` and `instanceId`.\n */\n name?: string;\n /**\n * action creators functions to be available in the Dispatcher.\n */\n actionCreators?: ActionCreator[] | {\n [key: string]: ActionCreator;\n };\n /**\n * if more than one action is dispatched in the indicated interval, all new actions will be collected and sent at once.\n * It is the joint between performance and speed. When set to `0`, all actions will be sent instantly.\n * Set it to a higher value when experiencing perf issues (also `maxAge` to a lower value).\n *\n * @default 500 ms.\n */\n latency?: number;\n /**\n * (> 1) - maximum allowed actions to be stored in the history tree. The oldest actions are removed once maxAge is reached. It's critical for performance.\n *\n * @default 50\n */\n maxAge?: number;\n /**\n * Customizes how actions and state are serialized and deserialized. Can be a boolean or object. If given a boolean, the behavior is the same as if you\n * were to pass an object and specify `options` as a boolean. Giving an object allows fine-grained customization using the `replacer` and `reviver`\n * functions.\n */\n serialize?: boolean | {\n /**\n * - `undefined` - will use regular `JSON.stringify` to send data (it's the fast mode).\n * - `false` - will handle also circular references.\n * - `true` - will handle also date, regex, undefined, error objects, symbols, maps, sets and functions.\n * - object, which contains `date`, `regex`, `undefined`, `error`, `symbol`, `map`, `set` and `function` keys.\n * For each of them you can indicate if to include (by setting as `true`).\n * For `function` key you can also specify a custom function which handles serialization.\n * See [`jsan`](https://github.com/kolodny/jsan) for more details.\n */\n options?: undefined | boolean | {\n date?: true;\n regex?: true;\n undefined?: true;\n error?: true;\n symbol?: true;\n map?: true;\n set?: true;\n function?: true | ((fn: (...args: any[]) => any) => string);\n };\n /**\n * [JSON replacer function](https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify#The_replacer_parameter) used for both actions and states stringify.\n * In addition, you can specify a data type by adding a [`__serializedType__`](https://github.com/zalmoxisus/remotedev-serialize/blob/master/helpers/index.js#L4)\n * key. So you can deserialize it back while importing or persisting data.\n * Moreover, it will also [show a nice preview showing the provided custom type](https://cloud.githubusercontent.com/assets/7957859/21814330/a17d556a-d761-11e6-85ef-159dd12f36c5.png):\n */\n replacer?: (key: string, value: unknown) => any;\n /**\n * [JSON `reviver` function](https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/JSON/parse#Using_the_reviver_parameter)\n * used for parsing the imported actions and states. See [`remotedev-serialize`](https://github.com/zalmoxisus/remotedev-serialize/blob/master/immutable/serialize.js#L8-L41)\n * as an example on how to serialize special data types and get them back.\n */\n reviver?: (key: string, value: unknown) => any;\n /**\n * Automatically serialize/deserialize immutablejs via [remotedev-serialize](https://github.com/zalmoxisus/remotedev-serialize).\n * Just pass the Immutable library. It will support all ImmutableJS structures. You can even export them into a file and get them back.\n * The only exception is `Record` class, for which you should pass this in addition the references to your classes in `refs`.\n */\n immutable?: any;\n /**\n * ImmutableJS `Record` classes used to make possible restore its instances back when importing, persisting...\n */\n refs?: any;\n };\n /**\n * function which takes `action` object and id number as arguments, and should return `action` object back.\n */\n actionSanitizer?: (action: A, id: number) => A;\n /**\n * function which takes `state` object and index as arguments, and should return `state` object back.\n */\n stateSanitizer?: (state: S, index: number) => S;\n /**\n * *string or array of strings as regex* - actions types to be hidden / shown in the monitors (while passed to the reducers).\n * If `actionsAllowlist` specified, `actionsDenylist` is ignored.\n */\n actionsDenylist?: string | string[];\n /**\n * *string or array of strings as regex* - actions types to be hidden / shown in the monitors (while passed to the reducers).\n * If `actionsAllowlist` specified, `actionsDenylist` is ignored.\n */\n actionsAllowlist?: string | string[];\n /**\n * called for every action before sending, takes `state` and `action` object, and returns `true` in case it allows sending the current data to the monitor.\n * Use it as a more advanced version of `actionsDenylist`/`actionsAllowlist` parameters.\n */\n predicate?: (state: S, action: A) => boolean;\n /**\n * if specified as `false`, it will not record the changes till clicking on `Start recording` button.\n * Available only for Redux enhancer, for others use `autoPause`.\n *\n * @default true\n */\n shouldRecordChanges?: boolean;\n /**\n * if specified, whenever clicking on `Pause recording` button and there are actions in the history log, will add this action type.\n * If not specified, will commit when paused. Available only for Redux enhancer.\n *\n * @default \"@@PAUSED\"\"\n */\n pauseActionType?: string;\n /**\n * auto pauses when the extension’s window is not opened, and so has zero impact on your app when not in use.\n * Not available for Redux enhancer (as it already does it but storing the data to be sent).\n *\n * @default false\n */\n autoPause?: boolean;\n /**\n * if specified as `true`, it will not allow any non-monitor actions to be dispatched till clicking on `Unlock changes` button.\n * Available only for Redux enhancer.\n *\n * @default false\n */\n shouldStartLocked?: boolean;\n /**\n * if set to `false`, will not recompute the states on hot reloading (or on replacing the reducers). Available only for Redux enhancer.\n *\n * @default true\n */\n shouldHotReload?: boolean;\n /**\n * if specified as `true`, whenever there's an exception in reducers, the monitors will show the error message, and next actions will not be dispatched.\n *\n * @default false\n */\n shouldCatchErrors?: boolean;\n /**\n * If you want to restrict the extension, specify the features you allow.\n * If not specified, all of the features are enabled. When set as an object, only those included as `true` will be allowed.\n * Note that except `true`/`false`, `import` and `export` can be set as `custom` (which is by default for Redux enhancer), meaning that the importing/exporting occurs on the client side.\n * Otherwise, you'll get/set the data right from the monitor part.\n */\n features?: {\n /**\n * start/pause recording of dispatched actions\n */\n pause?: boolean;\n /**\n * lock/unlock dispatching actions and side effects\n */\n lock?: boolean;\n /**\n * persist states on page reloading\n */\n persist?: boolean;\n /**\n * export history of actions in a file\n */\n export?: boolean | 'custom';\n /**\n * import history of actions from a file\n */\n import?: boolean | 'custom';\n /**\n * jump back and forth (time travelling)\n */\n jump?: boolean;\n /**\n * skip (cancel) actions\n */\n skip?: boolean;\n /**\n * drag and drop actions in the history list\n */\n reorder?: boolean;\n /**\n * dispatch custom actions or action creators\n */\n dispatch?: boolean;\n /**\n * generate tests for the selected actions\n */\n test?: boolean;\n };\n /**\n * Set to true or a stacktrace-returning function to record call stack traces for dispatched actions.\n * Defaults to false.\n */\n trace?: boolean | ((action: A) => string);\n /**\n * The maximum number of stack trace entries to record per action. Defaults to 10.\n */\n traceLimit?: number;\n}\ntype Compose = typeof compose;\ninterface ComposeWithDevTools {\n (options: DevToolsEnhancerOptions): Compose;\n (...funcs: StoreEnhancer[]): StoreEnhancer;\n}\n\n/**\n * @public\n */\nexport const composeWithDevTools: ComposeWithDevTools = typeof window !== 'undefined' && (window as any).__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ ? (window as any).__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ : function () {\n if (arguments.length === 0) return undefined;\n if (typeof arguments[0] === 'object') return compose;\n return compose.apply(null, arguments as any as Function[]);\n};\n\n/**\n * @public\n */\nexport const devToolsEnhancer: {\n (options: DevToolsEnhancerOptions): StoreEnhancer;\n} = typeof window !== 'undefined' && (window as any).__REDUX_DEVTOOLS_EXTENSION__ ? (window as any).__REDUX_DEVTOOLS_EXTENSION__ : function () {\n return function (noop) {\n return noop;\n };\n};", "import type { Middleware, UnknownAction } from 'redux';\nimport type { ThunkMiddleware } from 'redux-thunk';\nimport { thunk as thunkMiddleware, withExtraArgument } from 'redux-thunk';\nimport type { ActionCreatorInvariantMiddlewareOptions } from './actionCreatorInvariantMiddleware';\nimport { createActionCreatorInvariantMiddleware } from './actionCreatorInvariantMiddleware';\nimport type { ImmutableStateInvariantMiddlewareOptions } from './immutableStateInvariantMiddleware';\n/* PROD_START_REMOVE_UMD */\nimport { createImmutableStateInvariantMiddleware } from './immutableStateInvariantMiddleware';\n/* PROD_STOP_REMOVE_UMD */\n\nimport type { SerializableStateInvariantMiddlewareOptions } from './serializableStateInvariantMiddleware';\nimport { createSerializableStateInvariantMiddleware } from './serializableStateInvariantMiddleware';\nimport type { ExcludeFromTuple } from './tsHelpers';\nimport { Tuple } from './utils';\nfunction isBoolean(x: any): x is boolean {\n return typeof x === 'boolean';\n}\ninterface ThunkOptions {\n extraArgument: E;\n}\ninterface GetDefaultMiddlewareOptions {\n thunk?: boolean | ThunkOptions;\n immutableCheck?: boolean | ImmutableStateInvariantMiddlewareOptions;\n serializableCheck?: boolean | SerializableStateInvariantMiddlewareOptions;\n actionCreatorCheck?: boolean | ActionCreatorInvariantMiddlewareOptions;\n}\nexport type ThunkMiddlewareFor = O extends {\n thunk: false;\n} ? never : O extends {\n thunk: {\n extraArgument: infer E;\n };\n} ? ThunkMiddleware : ThunkMiddleware;\nexport type GetDefaultMiddleware = (options?: O) => Tuple], never>>;\nexport const buildGetDefaultMiddleware = (): GetDefaultMiddleware => function getDefaultMiddleware(options) {\n const {\n thunk = true,\n immutableCheck = true,\n serializableCheck = true,\n actionCreatorCheck = true\n } = options ?? {};\n let middlewareArray = new Tuple();\n if (thunk) {\n if (isBoolean(thunk)) {\n middlewareArray.push(thunkMiddleware);\n } else {\n middlewareArray.push(withExtraArgument(thunk.extraArgument));\n }\n }\n if (process.env.NODE_ENV !== 'production') {\n if (immutableCheck) {\n /* PROD_START_REMOVE_UMD */\n let immutableOptions: ImmutableStateInvariantMiddlewareOptions = {};\n if (!isBoolean(immutableCheck)) {\n immutableOptions = immutableCheck;\n }\n middlewareArray.unshift(createImmutableStateInvariantMiddleware(immutableOptions));\n /* PROD_STOP_REMOVE_UMD */\n }\n if (serializableCheck) {\n let serializableOptions: SerializableStateInvariantMiddlewareOptions = {};\n if (!isBoolean(serializableCheck)) {\n serializableOptions = serializableCheck;\n }\n middlewareArray.push(createSerializableStateInvariantMiddleware(serializableOptions));\n }\n if (actionCreatorCheck) {\n let actionCreatorOptions: ActionCreatorInvariantMiddlewareOptions = {};\n if (!isBoolean(actionCreatorCheck)) {\n actionCreatorOptions = actionCreatorCheck;\n }\n middlewareArray.unshift(createActionCreatorInvariantMiddleware(actionCreatorOptions));\n }\n }\n return middlewareArray as any;\n};", "import { formatProdErrorMessage as _formatProdErrorMessage } from \"@reduxjs/toolkit\";\nimport { isAction } from 'redux';\nimport type { IsUnknownOrNonInferrable, IfMaybeUndefined, IfVoid, IsAny } from './tsHelpers';\nimport { hasMatchFunction } from './tsHelpers';\n\n/**\n * An action with a string type and an associated payload. This is the\n * type of action returned by `createAction()` action creators.\n *\n * @template P The type of the action's payload.\n * @template T the type used for the action type.\n * @template M The type of the action's meta (optional)\n * @template E The type of the action's error (optional)\n *\n * @public\n */\nexport type PayloadAction

= {\n payload: P;\n type: T;\n} & ([M] extends [never] ? {} : {\n meta: M;\n}) & ([E] extends [never] ? {} : {\n error: E;\n});\n\n/**\n * A \"prepare\" method to be used as the second parameter of `createAction`.\n * Takes any number of arguments and returns a Flux Standard Action without\n * type (will be added later) that *must* contain a payload (might be undefined).\n *\n * @public\n */\nexport type PrepareAction

= ((...args: any[]) => {\n payload: P;\n}) | ((...args: any[]) => {\n payload: P;\n meta: any;\n}) | ((...args: any[]) => {\n payload: P;\n error: any;\n}) | ((...args: any[]) => {\n payload: P;\n meta: any;\n error: any;\n});\n\n/**\n * Internal version of `ActionCreatorWithPreparedPayload`. Not to be used externally.\n *\n * @internal\n */\nexport type _ActionCreatorWithPreparedPayload | void, T extends string = string> = PA extends PrepareAction ? ActionCreatorWithPreparedPayload, P, T, ReturnType extends {\n error: infer E;\n} ? E : never, ReturnType extends {\n meta: infer M;\n} ? M : never> : void;\n\n/**\n * Basic type for all action creators.\n *\n * @inheritdoc {redux#ActionCreator}\n */\nexport type BaseActionCreator = {\n type: T;\n match: (action: unknown) => action is PayloadAction;\n};\n\n/**\n * An action creator that takes multiple arguments that are passed\n * to a `PrepareAction` method to create the final Action.\n * @typeParam Args arguments for the action creator function\n * @typeParam P `payload` type\n * @typeParam T `type` name\n * @typeParam E optional `error` type\n * @typeParam M optional `meta` type\n *\n * @inheritdoc {redux#ActionCreator}\n *\n * @public\n */\nexport interface ActionCreatorWithPreparedPayload extends BaseActionCreator {\n /**\n * Calling this {@link redux#ActionCreator} with `Args` will return\n * an Action with a payload of type `P` and (depending on the `PrepareAction`\n * method used) a `meta`- and `error` property of types `M` and `E` respectively.\n */\n (...args: Args): PayloadAction;\n}\n\n/**\n * An action creator of type `T` that takes an optional payload of type `P`.\n *\n * @inheritdoc {redux#ActionCreator}\n *\n * @public\n */\nexport interface ActionCreatorWithOptionalPayload extends BaseActionCreator {\n /**\n * Calling this {@link redux#ActionCreator} with an argument will\n * return a {@link PayloadAction} of type `T` with a payload of `P`.\n * Calling it without an argument will return a PayloadAction with a payload of `undefined`.\n */\n (payload?: P): PayloadAction;\n}\n\n/**\n * An action creator of type `T` that takes no payload.\n *\n * @inheritdoc {redux#ActionCreator}\n *\n * @public\n */\nexport interface ActionCreatorWithoutPayload extends BaseActionCreator {\n /**\n * Calling this {@link redux#ActionCreator} will\n * return a {@link PayloadAction} of type `T` with a payload of `undefined`\n */\n (noArgument: void): PayloadAction;\n}\n\n/**\n * An action creator of type `T` that requires a payload of type P.\n *\n * @inheritdoc {redux#ActionCreator}\n *\n * @public\n */\nexport interface ActionCreatorWithPayload extends BaseActionCreator {\n /**\n * Calling this {@link redux#ActionCreator} with an argument will\n * return a {@link PayloadAction} of type `T` with a payload of `P`\n */\n (payload: P): PayloadAction;\n}\n\n/**\n * An action creator of type `T` whose `payload` type could not be inferred. Accepts everything as `payload`.\n *\n * @inheritdoc {redux#ActionCreator}\n *\n * @public\n */\nexport interface ActionCreatorWithNonInferrablePayload extends BaseActionCreator {\n /**\n * Calling this {@link redux#ActionCreator} with an argument will\n * return a {@link PayloadAction} of type `T` with a payload\n * of exactly the type of the argument.\n */\n (payload: PT): PayloadAction;\n}\n\n/**\n * An action creator that produces actions with a `payload` attribute.\n *\n * @typeParam P the `payload` type\n * @typeParam T the `type` of the resulting action\n * @typeParam PA if the resulting action is preprocessed by a `prepare` method, the signature of said method.\n *\n * @public\n */\nexport type PayloadActionCreator

| void = void> = IfPrepareActionMethodProvided,\n// else\nIsAny, IsUnknownOrNonInferrable,\n// else\nIfVoid,\n// else\nIfMaybeUndefined,\n// else\nActionCreatorWithPayload>>>>>;\n\n/**\n * A utility function to create an action creator for the given action type\n * string. The action creator accepts a single argument, which will be included\n * in the action object as a field called payload. The action creator function\n * will also have its toString() overridden so that it returns the action type.\n *\n * @param type The action type to use for created actions.\n * @param prepare (optional) a method that takes any number of arguments and returns { payload } or { payload, meta }.\n * If this is given, the resulting action creator will pass its arguments to this method to calculate payload & meta.\n *\n * @public\n */\nexport function createAction

(type: T): PayloadActionCreator;\n\n/**\n * A utility function to create an action creator for the given action type\n * string. The action creator accepts a single argument, which will be included\n * in the action object as a field called payload. The action creator function\n * will also have its toString() overridden so that it returns the action type.\n *\n * @param type The action type to use for created actions.\n * @param prepare (optional) a method that takes any number of arguments and returns { payload } or { payload, meta }.\n * If this is given, the resulting action creator will pass its arguments to this method to calculate payload & meta.\n *\n * @public\n */\nexport function createAction, T extends string = string>(type: T, prepareAction: PA): PayloadActionCreator['payload'], T, PA>;\nexport function createAction(type: string, prepareAction?: Function): any {\n function actionCreator(...args: any[]) {\n if (prepareAction) {\n let prepared = prepareAction(...args);\n if (!prepared) {\n throw new Error(process.env.NODE_ENV === \"production\" ? _formatProdErrorMessage(0) : 'prepareAction did not return an object');\n }\n return {\n type,\n payload: prepared.payload,\n ...('meta' in prepared && {\n meta: prepared.meta\n }),\n ...('error' in prepared && {\n error: prepared.error\n })\n };\n }\n return {\n type,\n payload: args[0]\n };\n }\n actionCreator.toString = () => `${type}`;\n actionCreator.type = type;\n actionCreator.match = (action: unknown): action is PayloadAction => isAction(action) && action.type === type;\n return actionCreator;\n}\n\n/**\n * Returns true if value is an RTK-like action creator, with a static type property and match method.\n */\nexport function isActionCreator(action: unknown): action is BaseActionCreator & Function {\n return typeof action === 'function' && 'type' in action &&\n // hasMatchFunction only wants Matchers but I don't see the point in rewriting it\n hasMatchFunction(action as any);\n}\n\n/**\n * Returns true if value is an action with a string type and valid Flux Standard Action keys.\n */\nexport function isFSA(action: unknown): action is {\n type: string;\n payload?: unknown;\n error?: unknown;\n meta?: unknown;\n} {\n return isAction(action) && Object.keys(action).every(isValidKey);\n}\nfunction isValidKey(key: string) {\n return ['type', 'payload', 'error', 'meta'].indexOf(key) > -1;\n}\n\n// helper types for more readable typings\n\ntype IfPrepareActionMethodProvided | void, True, False> = PA extends (...args: any[]) => any ? True : False;", "import type { Middleware, StoreEnhancer } from 'redux';\nimport type { Tuple } from './utils';\nexport function safeAssign(target: T, ...args: Array>>) {\n Object.assign(target, ...args);\n}\n\n/**\n * return True if T is `any`, otherwise return False\n * taken from https://github.com/joonhocho/tsdef\n *\n * @internal\n */\nexport type IsAny =\n// test if we are going the left AND right path in the condition\ntrue | false extends (T extends never ? true : false) ? True : False;\nexport type CastAny = IsAny;\n\n/**\n * return True if T is `unknown`, otherwise return False\n * taken from https://github.com/joonhocho/tsdef\n *\n * @internal\n */\nexport type IsUnknown = unknown extends T ? IsAny : False;\nexport type FallbackIfUnknown = IsUnknown;\n\n/**\n * @internal\n */\nexport type IfMaybeUndefined = [undefined] extends [P] ? True : False;\n\n/**\n * @internal\n */\nexport type IfVoid = [void] extends [P] ? True : False;\n\n/**\n * @internal\n */\nexport type IsEmptyObj = T extends any ? keyof T extends never ? IsUnknown>> : False : never;\n\n/**\n * returns True if TS version is above 3.5, False if below.\n * uses feature detection to detect TS version >= 3.5\n * * versions below 3.5 will return `{}` for unresolvable interference\n * * versions above will return `unknown`\n *\n * @internal\n */\nexport type AtLeastTS35 = [True, False][IsUnknown() => T>, 0, 1>];\n\n/**\n * @internal\n */\nexport type IsUnknownOrNonInferrable = AtLeastTS35, IsEmptyObj>>;\n\n/**\n * Convert a Union type `(A|B)` to an intersection type `(A&B)`\n */\nexport type UnionToIntersection = (U extends any ? (k: U) => void : never) extends (k: infer I) => void ? I : never;\n\n// Appears to have a convenient side effect of ignoring `never` even if that's not what you specified\nexport type ExcludeFromTuple = T extends [infer Head, ...infer Tail] ? ExcludeFromTuple : Acc;\ntype ExtractDispatchFromMiddlewareTuple = MiddlewareTuple extends [infer Head, ...infer Tail] ? ExtractDispatchFromMiddlewareTuple ? IsAny : {})> : Acc;\nexport type ExtractDispatchExtensions = M extends Tuple ? ExtractDispatchFromMiddlewareTuple : M extends ReadonlyArray ? ExtractDispatchFromMiddlewareTuple<[...M], {}> : never;\ntype ExtractStoreExtensionsFromEnhancerTuple = EnhancerTuple extends [infer Head, ...infer Tail] ? ExtractStoreExtensionsFromEnhancerTuple ? IsAny : {})> : Acc;\nexport type ExtractStoreExtensions = E extends Tuple ? ExtractStoreExtensionsFromEnhancerTuple : E extends ReadonlyArray ? UnionToIntersection ? Ext extends {} ? IsAny : {} : {}> : never;\ntype ExtractStateExtensionsFromEnhancerTuple = EnhancerTuple extends [infer Head, ...infer Tail] ? ExtractStateExtensionsFromEnhancerTuple ? IsAny : {})> : Acc;\nexport type ExtractStateExtensions = E extends Tuple ? ExtractStateExtensionsFromEnhancerTuple : E extends ReadonlyArray ? UnionToIntersection ? StateExt extends {} ? IsAny : {} : {}> : never;\n\n/**\n * Helper type. Passes T out again, but boxes it in a way that it cannot\n * \"widen\" the type by accident if it is a generic that should be inferred\n * from elsewhere.\n *\n * @internal\n */\nexport type NoInfer = [T][T extends any ? 0 : never];\nexport type NonUndefined = T extends undefined ? never : T;\nexport type WithRequiredProp = Omit & Required>;\nexport type WithOptionalProp = Omit & Partial>;\nexport interface TypeGuard {\n (value: any): value is T;\n}\nexport interface HasMatchFunction {\n match: TypeGuard;\n}\nexport const hasMatchFunction = (v: Matcher): v is HasMatchFunction => {\n return v && typeof (v as HasMatchFunction).match === 'function';\n};\n\n/** @public */\nexport type Matcher = HasMatchFunction | TypeGuard;\n\n/** @public */\nexport type ActionFromMatcher> = M extends Matcher ? T : never;\nexport type Id = { [K in keyof T]: T[K] } & {};\nexport type Tail = T extends [any, ...infer Tail] ? Tail : never;\nexport type UnknownIfNonSpecific = {} extends T ? unknown : T;\n\n/**\n * A Promise that will never reject.\n * @see https://github.com/reduxjs/redux-toolkit/issues/4101\n */\nexport type SafePromise = Promise & {\n __linterBrands: 'SafePromise';\n};\n\n/**\n * Properly wraps a Promise as a {@link SafePromise} with .catch(fallback).\n */\nexport function asSafePromise(promise: Promise, fallback: (error: unknown) => Rejected) {\n return promise.catch(fallback) as SafePromise;\n}", "import type { Middleware } from 'redux';\nimport { isActionCreator as isRTKAction } from './createAction';\nexport interface ActionCreatorInvariantMiddlewareOptions {\n /**\n * The function to identify whether a value is an action creator.\n * The default checks for a function with a static type property and match method.\n */\n isActionCreator?: (action: unknown) => action is Function & {\n type?: unknown;\n };\n}\nexport function getMessage(type?: unknown) {\n const splitType = type ? `${type}`.split('/') : [];\n const actionName = splitType[splitType.length - 1] || 'actionCreator';\n return `Detected an action creator with type \"${type || 'unknown'}\" being dispatched. \nMake sure you're calling the action creator before dispatching, i.e. \\`dispatch(${actionName}())\\` instead of \\`dispatch(${actionName})\\`. This is necessary even if the action has no payload.`;\n}\nexport function createActionCreatorInvariantMiddleware(options: ActionCreatorInvariantMiddlewareOptions = {}): Middleware {\n if (process.env.NODE_ENV === 'production') {\n return () => next => action => next(action);\n }\n const {\n isActionCreator = isRTKAction\n } = options;\n return () => next => action => {\n if (isActionCreator(action)) {\n console.warn(getMessage(action.type));\n }\n return next(action);\n };\n}", "import { produce as createNextState, isDraftable } from 'immer';\nexport function getTimeMeasureUtils(maxDelay: number, fnName: string) {\n let elapsed = 0;\n return {\n measureTime(fn: () => T): T {\n const started = Date.now();\n try {\n return fn();\n } finally {\n const finished = Date.now();\n elapsed += finished - started;\n }\n },\n warnIfExceeded() {\n if (elapsed > maxDelay) {\n console.warn(`${fnName} took ${elapsed}ms, which is more than the warning threshold of ${maxDelay}ms. \nIf your state or actions are very large, you may want to disable the middleware as it might cause too much of a slowdown in development mode. See https://redux-toolkit.js.org/api/getDefaultMiddleware for instructions.\nIt is disabled in production builds, so you don't need to worry about that.`);\n }\n }\n };\n}\nexport function delay(ms: number) {\n return new Promise(resolve => setTimeout(resolve, ms));\n}\nexport class Tuple = []> extends Array {\n constructor(length: number);\n constructor(...items: Items);\n constructor(...items: any[]) {\n super(...items);\n Object.setPrototypeOf(this, Tuple.prototype);\n }\n static override get [Symbol.species]() {\n return Tuple as any;\n }\n override concat>(items: Tuple): Tuple<[...Items, ...AdditionalItems]>;\n override concat>(items: AdditionalItems): Tuple<[...Items, ...AdditionalItems]>;\n override concat>(...items: AdditionalItems): Tuple<[...Items, ...AdditionalItems]>;\n override concat(...arr: any[]) {\n return super.concat.apply(this, arr);\n }\n prepend>(items: Tuple): Tuple<[...AdditionalItems, ...Items]>;\n prepend>(items: AdditionalItems): Tuple<[...AdditionalItems, ...Items]>;\n prepend>(...items: AdditionalItems): Tuple<[...AdditionalItems, ...Items]>;\n prepend(...arr: any[]) {\n if (arr.length === 1 && Array.isArray(arr[0])) {\n return new Tuple(...arr[0].concat(this));\n }\n return new Tuple(...arr.concat(this));\n }\n}\nexport function freezeDraftable(val: T) {\n return isDraftable(val) ? createNextState(val, () => {}) : val;\n}\nexport function getOrInsert(map: WeakMap, key: K, value: V): V;\nexport function getOrInsert(map: Map, key: K, value: V): V;\nexport function getOrInsert(map: Map | WeakMap, key: K, value: V): V {\n if (map.has(key)) return map.get(key) as V;\n return map.set(key, value).get(key) as V;\n}\nexport function getOrInsertComputed(map: WeakMap, key: K, compute: (key: K) => V): V;\nexport function getOrInsertComputed(map: Map, key: K, compute: (key: K) => V): V;\nexport function getOrInsertComputed(map: Map | WeakMap, key: K, compute: (key: K) => V): V {\n if (map.has(key)) return map.get(key) as V;\n return map.set(key, compute(key)).get(key) as V;\n}\nexport function promiseWithResolvers(): {\n promise: Promise;\n resolve: (value: T | PromiseLike) => void;\n reject: (reason?: any) => void;\n} {\n let resolve: any;\n let reject: any;\n const promise = new Promise((res, rej) => {\n resolve = res;\n reject = rej;\n });\n return {\n promise,\n resolve,\n reject\n };\n}", "import { formatProdErrorMessage as _formatProdErrorMessage, formatProdErrorMessage as _formatProdErrorMessage2 } from \"@reduxjs/toolkit\";\nimport type { Middleware } from 'redux';\nimport type { IgnorePaths } from './serializableStateInvariantMiddleware';\nimport { getTimeMeasureUtils } from './utils';\ntype EntryProcessor = (key: string, value: any) => any;\n\n/**\n * The default `isImmutable` function.\n *\n * @public\n */\nexport function isImmutableDefault(value: unknown): boolean {\n return typeof value !== 'object' || value == null || Object.isFrozen(value);\n}\nexport function trackForMutations(isImmutable: IsImmutableFunc, ignorePaths: IgnorePaths | undefined, obj: any) {\n const trackedProperties = trackProperties(isImmutable, ignorePaths, obj);\n return {\n detectMutations() {\n return detectMutations(isImmutable, ignorePaths, trackedProperties, obj);\n }\n };\n}\ninterface TrackedProperty {\n value: any;\n children: Record;\n}\nfunction trackProperties(isImmutable: IsImmutableFunc, ignorePaths: IgnorePaths = [], obj: Record, path: string = '', checkedObjects: Set> = new Set()) {\n const tracked: Partial = {\n value: obj\n };\n if (!isImmutable(obj) && !checkedObjects.has(obj)) {\n checkedObjects.add(obj);\n tracked.children = {};\n for (const key in obj) {\n const childPath = path ? path + '.' + key : key;\n if (ignorePaths.length && ignorePaths.indexOf(childPath) !== -1) {\n continue;\n }\n tracked.children[key] = trackProperties(isImmutable, ignorePaths, obj[key], childPath);\n }\n }\n return tracked as TrackedProperty;\n}\nfunction detectMutations(isImmutable: IsImmutableFunc, ignoredPaths: IgnorePaths = [], trackedProperty: TrackedProperty, obj: any, sameParentRef: boolean = false, path: string = ''): {\n wasMutated: boolean;\n path?: string;\n} {\n const prevObj = trackedProperty ? trackedProperty.value : undefined;\n const sameRef = prevObj === obj;\n if (sameParentRef && !sameRef && !Number.isNaN(obj)) {\n return {\n wasMutated: true,\n path\n };\n }\n if (isImmutable(prevObj) || isImmutable(obj)) {\n return {\n wasMutated: false\n };\n }\n\n // Gather all keys from prev (tracked) and after objs\n const keysToDetect: Record = {};\n for (let key in trackedProperty.children) {\n keysToDetect[key] = true;\n }\n for (let key in obj) {\n keysToDetect[key] = true;\n }\n const hasIgnoredPaths = ignoredPaths.length > 0;\n for (let key in keysToDetect) {\n const nestedPath = path ? path + '.' + key : key;\n if (hasIgnoredPaths) {\n const hasMatches = ignoredPaths.some(ignored => {\n if (ignored instanceof RegExp) {\n return ignored.test(nestedPath);\n }\n return nestedPath === ignored;\n });\n if (hasMatches) {\n continue;\n }\n }\n const result = detectMutations(isImmutable, ignoredPaths, trackedProperty.children[key], obj[key], sameRef, nestedPath);\n if (result.wasMutated) {\n return result;\n }\n }\n return {\n wasMutated: false\n };\n}\ntype IsImmutableFunc = (value: any) => boolean;\n\n/**\n * Options for `createImmutableStateInvariantMiddleware()`.\n *\n * @public\n */\nexport interface ImmutableStateInvariantMiddlewareOptions {\n /**\n Callback function to check if a value is considered to be immutable.\n This function is applied recursively to every value contained in the state.\n The default implementation will return true for primitive types\n (like numbers, strings, booleans, null and undefined).\n */\n isImmutable?: IsImmutableFunc;\n /**\n An array of dot-separated path strings that match named nodes from\n the root state to ignore when checking for immutability.\n Defaults to undefined\n */\n ignoredPaths?: IgnorePaths;\n /** Print a warning if checks take longer than N ms. Default: 32ms */\n warnAfter?: number;\n}\n\n/**\n * Creates a middleware that checks whether any state was mutated in between\n * dispatches or during a dispatch. If any mutations are detected, an error is\n * thrown.\n *\n * @param options Middleware options.\n *\n * @public\n */\nexport function createImmutableStateInvariantMiddleware(options: ImmutableStateInvariantMiddlewareOptions = {}): Middleware {\n if (process.env.NODE_ENV === 'production') {\n return () => next => action => next(action);\n } else {\n function stringify(obj: any, serializer?: EntryProcessor, indent?: string | number, decycler?: EntryProcessor): string {\n return JSON.stringify(obj, getSerialize(serializer, decycler), indent);\n }\n function getSerialize(serializer?: EntryProcessor, decycler?: EntryProcessor): EntryProcessor {\n let stack: any[] = [],\n keys: any[] = [];\n if (!decycler) decycler = function (_: string, value: any) {\n if (stack[0] === value) return '[Circular ~]';\n return '[Circular ~.' + keys.slice(0, stack.indexOf(value)).join('.') + ']';\n };\n return function (this: any, key: string, value: any) {\n if (stack.length > 0) {\n var thisPos = stack.indexOf(this);\n ~thisPos ? stack.splice(thisPos + 1) : stack.push(this);\n ~thisPos ? keys.splice(thisPos, Infinity, key) : keys.push(key);\n if (~stack.indexOf(value)) value = decycler!.call(this, key, value);\n } else stack.push(value);\n return serializer == null ? value : serializer.call(this, key, value);\n };\n }\n let {\n isImmutable = isImmutableDefault,\n ignoredPaths,\n warnAfter = 32\n } = options;\n const track = trackForMutations.bind(null, isImmutable, ignoredPaths);\n return ({\n getState\n }) => {\n let state = getState();\n let tracker = track(state);\n let result;\n return next => action => {\n const measureUtils = getTimeMeasureUtils(warnAfter, 'ImmutableStateInvariantMiddleware');\n measureUtils.measureTime(() => {\n state = getState();\n result = tracker.detectMutations();\n // Track before potentially not meeting the invariant\n tracker = track(state);\n if (result.wasMutated) {\n throw new Error(process.env.NODE_ENV === \"production\" ? _formatProdErrorMessage(19) : `A state mutation was detected between dispatches, in the path '${result.path || ''}'. This may cause incorrect behavior. (https://redux.js.org/style-guide/style-guide#do-not-mutate-state)`);\n }\n });\n const dispatchedAction = next(action);\n measureUtils.measureTime(() => {\n state = getState();\n result = tracker.detectMutations();\n // Track before potentially not meeting the invariant\n tracker = track(state);\n if (result.wasMutated) {\n throw new Error(process.env.NODE_ENV === \"production\" ? _formatProdErrorMessage2(20) : `A state mutation was detected inside a dispatch, in the path: ${result.path || ''}. Take a look at the reducer(s) handling the action ${stringify(action)}. (https://redux.js.org/style-guide/style-guide#do-not-mutate-state)`);\n }\n });\n measureUtils.warnIfExceeded();\n return dispatchedAction;\n };\n };\n }\n}", "import type { Middleware } from 'redux';\nimport { isAction, isPlainObject } from 'redux';\nimport { getTimeMeasureUtils } from './utils';\n\n/**\n * Returns true if the passed value is \"plain\", i.e. a value that is either\n * directly JSON-serializable (boolean, number, string, array, plain object)\n * or `undefined`.\n *\n * @param val The value to check.\n *\n * @public\n */\nexport function isPlain(val: any) {\n const type = typeof val;\n return val == null || type === 'string' || type === 'boolean' || type === 'number' || Array.isArray(val) || isPlainObject(val);\n}\ninterface NonSerializableValue {\n keyPath: string;\n value: unknown;\n}\nexport type IgnorePaths = readonly (string | RegExp)[];\n\n/**\n * @public\n */\nexport function findNonSerializableValue(value: unknown, path: string = '', isSerializable: (value: unknown) => boolean = isPlain, getEntries?: (value: unknown) => [string, any][], ignoredPaths: IgnorePaths = [], cache?: WeakSet): NonSerializableValue | false {\n let foundNestedSerializable: NonSerializableValue | false;\n if (!isSerializable(value)) {\n return {\n keyPath: path || '',\n value: value\n };\n }\n if (typeof value !== 'object' || value === null) {\n return false;\n }\n if (cache?.has(value)) return false;\n const entries = getEntries != null ? getEntries(value) : Object.entries(value);\n const hasIgnoredPaths = ignoredPaths.length > 0;\n for (const [key, nestedValue] of entries) {\n const nestedPath = path ? path + '.' + key : key;\n if (hasIgnoredPaths) {\n const hasMatches = ignoredPaths.some(ignored => {\n if (ignored instanceof RegExp) {\n return ignored.test(nestedPath);\n }\n return nestedPath === ignored;\n });\n if (hasMatches) {\n continue;\n }\n }\n if (!isSerializable(nestedValue)) {\n return {\n keyPath: nestedPath,\n value: nestedValue\n };\n }\n if (typeof nestedValue === 'object') {\n foundNestedSerializable = findNonSerializableValue(nestedValue, nestedPath, isSerializable, getEntries, ignoredPaths, cache);\n if (foundNestedSerializable) {\n return foundNestedSerializable;\n }\n }\n }\n if (cache && isNestedFrozen(value)) cache.add(value);\n return false;\n}\nexport function isNestedFrozen(value: object) {\n if (!Object.isFrozen(value)) return false;\n for (const nestedValue of Object.values(value)) {\n if (typeof nestedValue !== 'object' || nestedValue === null) continue;\n if (!isNestedFrozen(nestedValue)) return false;\n }\n return true;\n}\n\n/**\n * Options for `createSerializableStateInvariantMiddleware()`.\n *\n * @public\n */\nexport interface SerializableStateInvariantMiddlewareOptions {\n /**\n * The function to check if a value is considered serializable. This\n * function is applied recursively to every value contained in the\n * state. Defaults to `isPlain()`.\n */\n isSerializable?: (value: any) => boolean;\n /**\n * The function that will be used to retrieve entries from each\n * value. If unspecified, `Object.entries` will be used. Defaults\n * to `undefined`.\n */\n getEntries?: (value: any) => [string, any][];\n\n /**\n * An array of action types to ignore when checking for serializability.\n * Defaults to []\n */\n ignoredActions?: string[];\n\n /**\n * An array of dot-separated path strings or regular expressions to ignore\n * when checking for serializability, Defaults to\n * ['meta.arg', 'meta.baseQueryMeta']\n */\n ignoredActionPaths?: (string | RegExp)[];\n\n /**\n * An array of dot-separated path strings or regular expressions to ignore\n * when checking for serializability, Defaults to []\n */\n ignoredPaths?: (string | RegExp)[];\n /**\n * Execution time warning threshold. If the middleware takes longer\n * than `warnAfter` ms, a warning will be displayed in the console.\n * Defaults to 32ms.\n */\n warnAfter?: number;\n\n /**\n * Opt out of checking state. When set to `true`, other state-related params will be ignored.\n */\n ignoreState?: boolean;\n\n /**\n * Opt out of checking actions. When set to `true`, other action-related params will be ignored.\n */\n ignoreActions?: boolean;\n\n /**\n * Opt out of caching the results. The cache uses a WeakSet and speeds up repeated checking processes.\n * The cache is automatically disabled if no browser support for WeakSet is present.\n */\n disableCache?: boolean;\n}\n\n/**\n * Creates a middleware that, after every state change, checks if the new\n * state is serializable. If a non-serializable value is found within the\n * state, an error is printed to the console.\n *\n * @param options Middleware options.\n *\n * @public\n */\nexport function createSerializableStateInvariantMiddleware(options: SerializableStateInvariantMiddlewareOptions = {}): Middleware {\n if (process.env.NODE_ENV === 'production') {\n return () => next => action => next(action);\n } else {\n const {\n isSerializable = isPlain,\n getEntries,\n ignoredActions = [],\n ignoredActionPaths = ['meta.arg', 'meta.baseQueryMeta'],\n ignoredPaths = [],\n warnAfter = 32,\n ignoreState = false,\n ignoreActions = false,\n disableCache = false\n } = options;\n const cache: WeakSet | undefined = !disableCache && WeakSet ? new WeakSet() : undefined;\n return storeAPI => next => action => {\n if (!isAction(action)) {\n return next(action);\n }\n const result = next(action);\n const measureUtils = getTimeMeasureUtils(warnAfter, 'SerializableStateInvariantMiddleware');\n if (!ignoreActions && !(ignoredActions.length && ignoredActions.indexOf(action.type as any) !== -1)) {\n measureUtils.measureTime(() => {\n const foundActionNonSerializableValue = findNonSerializableValue(action, '', isSerializable, getEntries, ignoredActionPaths, cache);\n if (foundActionNonSerializableValue) {\n const {\n keyPath,\n value\n } = foundActionNonSerializableValue;\n console.error(`A non-serializable value was detected in an action, in the path: \\`${keyPath}\\`. Value:`, value, '\\nTake a look at the logic that dispatched this action: ', action, '\\n(See https://redux.js.org/faq/actions#why-should-type-be-a-string-or-at-least-serializable-why-should-my-action-types-be-constants)', '\\n(To allow non-serializable values see: https://redux-toolkit.js.org/usage/usage-guide#working-with-non-serializable-data)');\n }\n });\n }\n if (!ignoreState) {\n measureUtils.measureTime(() => {\n const state = storeAPI.getState();\n const foundStateNonSerializableValue = findNonSerializableValue(state, '', isSerializable, getEntries, ignoredPaths, cache);\n if (foundStateNonSerializableValue) {\n const {\n keyPath,\n value\n } = foundStateNonSerializableValue;\n console.error(`A non-serializable value was detected in the state, in the path: \\`${keyPath}\\`. Value:`, value, `\nTake a look at the reducer(s) handling this action type: ${action.type}.\n(See https://redux.js.org/faq/organizing-state#can-i-put-functions-promises-or-other-non-serializable-items-in-my-store-state)`);\n }\n });\n measureUtils.warnIfExceeded();\n }\n return result;\n };\n }\n}", "import type { StoreEnhancer } from 'redux';\nexport const SHOULD_AUTOBATCH = 'RTK_autoBatch';\nexport const prepareAutoBatched = () => (payload: T): {\n payload: T;\n meta: unknown;\n} => ({\n payload,\n meta: {\n [SHOULD_AUTOBATCH]: true\n }\n});\nconst createQueueWithTimer = (timeout: number) => {\n return (notify: () => void) => {\n setTimeout(notify, timeout);\n };\n};\nexport type AutoBatchOptions = {\n type: 'tick';\n} | {\n type: 'timer';\n timeout: number;\n} | {\n type: 'raf';\n} | {\n type: 'callback';\n queueNotification: (notify: () => void) => void;\n};\n\n/**\n * A Redux store enhancer that watches for \"low-priority\" actions, and delays\n * notifying subscribers until either the queued callback executes or the\n * next \"standard-priority\" action is dispatched.\n *\n * This allows dispatching multiple \"low-priority\" actions in a row with only\n * a single subscriber notification to the UI after the sequence of actions\n * is finished, thus improving UI re-render performance.\n *\n * Watches for actions with the `action.meta[SHOULD_AUTOBATCH]` attribute.\n * This can be added to `action.meta` manually, or by using the\n * `prepareAutoBatched` helper.\n *\n * By default, it will queue a notification for the end of the event loop tick.\n * However, you can pass several other options to configure the behavior:\n * - `{type: 'tick'}`: queues using `queueMicrotask`\n * - `{type: 'timer', timeout: number}`: queues using `setTimeout`\n * - `{type: 'raf'}`: queues using `requestAnimationFrame` (default)\n * - `{type: 'callback', queueNotification: (notify: () => void) => void}`: lets you provide your own callback\n *\n *\n */\nexport const autoBatchEnhancer = (options: AutoBatchOptions = {\n type: 'raf'\n}): StoreEnhancer => next => (...args) => {\n const store = next(...args);\n let notifying = true;\n let shouldNotifyAtEndOfTick = false;\n let notificationQueued = false;\n const listeners = new Set<() => void>();\n const queueCallback = options.type === 'tick' ? queueMicrotask : options.type === 'raf' ?\n // requestAnimationFrame won't exist in SSR environments. Fall back to a vague approximation just to keep from erroring.\n typeof window !== 'undefined' && window.requestAnimationFrame ? window.requestAnimationFrame : createQueueWithTimer(10) : options.type === 'callback' ? options.queueNotification : createQueueWithTimer(options.timeout);\n const notifyListeners = () => {\n // We're running at the end of the event loop tick.\n // Run the real listener callbacks to actually update the UI.\n notificationQueued = false;\n if (shouldNotifyAtEndOfTick) {\n shouldNotifyAtEndOfTick = false;\n listeners.forEach(l => l());\n }\n };\n return Object.assign({}, store, {\n // Override the base `store.subscribe` method to keep original listeners\n // from running if we're delaying notifications\n subscribe(listener: () => void) {\n // Each wrapped listener will only call the real listener if\n // the `notifying` flag is currently active when it's called.\n // This lets the base store work as normal, while the actual UI\n // update becomes controlled by this enhancer.\n const wrappedListener: typeof listener = () => notifying && listener();\n const unsubscribe = store.subscribe(wrappedListener);\n listeners.add(listener);\n return () => {\n unsubscribe();\n listeners.delete(listener);\n };\n },\n // Override the base `store.dispatch` method so that we can check actions\n // for the `shouldAutoBatch` flag and determine if batching is active\n dispatch(action: any) {\n try {\n // If the action does _not_ have the `shouldAutoBatch` flag,\n // we resume/continue normal notify-after-each-dispatch behavior\n notifying = !action?.meta?.[SHOULD_AUTOBATCH];\n // If a `notifyListeners` microtask was queued, you can't cancel it.\n // Instead, we set a flag so that it's a no-op when it does run\n shouldNotifyAtEndOfTick = !notifying;\n if (shouldNotifyAtEndOfTick) {\n // We've seen at least 1 action with `SHOULD_AUTOBATCH`. Try to queue\n // a microtask to notify listeners at the end of the event loop tick.\n // Make sure we only enqueue this _once_ per tick.\n if (!notificationQueued) {\n notificationQueued = true;\n queueCallback(notifyListeners);\n }\n }\n // Go ahead and process the action as usual, including reducers.\n // If normal notification behavior is enabled, the store will notify\n // all of its own listeners, and the wrapper callbacks above will\n // see `notifying` is true and pass on to the real listener callbacks.\n // If we're \"batching\" behavior, then the wrapped callbacks will\n // bail out, causing the base store notification behavior to be no-ops.\n return store.dispatch(action);\n } finally {\n // Assume we're back to normal behavior after each action\n notifying = true;\n }\n }\n });\n};", "import type { StoreEnhancer } from 'redux';\nimport type { AutoBatchOptions } from './autoBatchEnhancer';\nimport { autoBatchEnhancer } from './autoBatchEnhancer';\nimport { Tuple } from './utils';\nimport type { Middlewares } from './configureStore';\nimport type { ExtractDispatchExtensions } from './tsHelpers';\ntype GetDefaultEnhancersOptions = {\n autoBatch?: boolean | AutoBatchOptions;\n};\nexport type GetDefaultEnhancers> = (options?: GetDefaultEnhancersOptions) => Tuple<[StoreEnhancer<{\n dispatch: ExtractDispatchExtensions;\n}>]>;\nexport const buildGetDefaultEnhancers = ,>(middlewareEnhancer: StoreEnhancer<{\n dispatch: ExtractDispatchExtensions;\n}>): GetDefaultEnhancers => function getDefaultEnhancers(options) {\n const {\n autoBatch = true\n } = options ?? {};\n let enhancerArray = new Tuple(middlewareEnhancer);\n if (autoBatch) {\n enhancerArray.push(autoBatchEnhancer(typeof autoBatch === 'object' ? autoBatch : undefined));\n }\n return enhancerArray as any;\n};", "import { formatProdErrorMessage as _formatProdErrorMessage } from \"@reduxjs/toolkit\";\nimport type { Draft } from 'immer';\nimport { produce as createNextState, isDraft, isDraftable } from 'immer';\nimport type { Action, Reducer, UnknownAction } from 'redux';\nimport type { ActionReducerMapBuilder } from './mapBuilders';\nimport { executeReducerBuilderCallback } from './mapBuilders';\nimport type { NoInfer, TypeGuard } from './tsHelpers';\nimport { freezeDraftable } from './utils';\n\n/**\n * Defines a mapping from action types to corresponding action object shapes.\n *\n * @deprecated This should not be used manually - it is only used for internal\n * inference purposes and should not have any further value.\n * It might be removed in the future.\n * @public\n */\nexport type Actions = Record;\nexport type ActionMatcherDescription = {\n matcher: TypeGuard;\n reducer: CaseReducer>;\n};\nexport type ReadonlyActionMatcherDescriptionCollection = ReadonlyArray>;\nexport type ActionMatcherDescriptionCollection = Array>;\n\n/**\n * A *case reducer* is a reducer function for a specific action type. Case\n * reducers can be composed to full reducers using `createReducer()`.\n *\n * Unlike a normal Redux reducer, a case reducer is never called with an\n * `undefined` state to determine the initial state. Instead, the initial\n * state is explicitly specified as an argument to `createReducer()`.\n *\n * In addition, a case reducer can choose to mutate the passed-in `state`\n * value directly instead of returning a new state. This does not actually\n * cause the store state to be mutated directly; instead, thanks to\n * [immer](https://github.com/mweststrate/immer), the mutations are\n * translated to copy operations that result in a new state.\n *\n * @public\n */\nexport type CaseReducer = (state: Draft, action: A) => NoInfer | void | Draft>;\n\n/**\n * A mapping from action types to case reducers for `createReducer()`.\n *\n * @deprecated This should not be used manually - it is only used\n * for internal inference purposes and using it manually\n * would lead to type erasure.\n * It might be removed in the future.\n * @public\n */\nexport type CaseReducers = { [T in keyof AS]: AS[T] extends Action ? CaseReducer : void };\nexport type NotFunction = T extends Function ? never : T;\nfunction isStateFunction(x: unknown): x is () => S {\n return typeof x === 'function';\n}\nexport type ReducerWithInitialState> = Reducer & {\n getInitialState: () => S;\n};\n\n/**\n * A utility function that allows defining a reducer as a mapping from action\n * type to *case reducer* functions that handle these action types. The\n * reducer's initial state is passed as the first argument.\n *\n * @remarks\n * The body of every case reducer is implicitly wrapped with a call to\n * `produce()` from the [immer](https://github.com/mweststrate/immer) library.\n * This means that rather than returning a new state object, you can also\n * mutate the passed-in state object directly; these mutations will then be\n * automatically and efficiently translated into copies, giving you both\n * convenience and immutability.\n *\n * @overloadSummary\n * This function accepts a callback that receives a `builder` object as its argument.\n * That builder provides `addCase`, `addMatcher` and `addDefaultCase` functions that may be\n * called to define what actions this reducer will handle.\n *\n * @param initialState - `State | (() => State)`: The initial state that should be used when the reducer is called the first time. This may also be a \"lazy initializer\" function, which should return an initial state value when called. This will be used whenever the reducer is called with `undefined` as its state value, and is primarily useful for cases like reading initial state from `localStorage`.\n * @param builderCallback - `(builder: Builder) => void` A callback that receives a *builder* object to define\n * case reducers via calls to `builder.addCase(actionCreatorOrType, reducer)`.\n * @example\n```ts\nimport {\n createAction,\n createReducer,\n UnknownAction,\n PayloadAction,\n} from \"@reduxjs/toolkit\";\n\nconst increment = createAction(\"increment\");\nconst decrement = createAction(\"decrement\");\n\nfunction isActionWithNumberPayload(\n action: UnknownAction\n): action is PayloadAction {\n return typeof action.payload === \"number\";\n}\n\nconst reducer = createReducer(\n {\n counter: 0,\n sumOfNumberPayloads: 0,\n unhandledActions: 0,\n },\n (builder) => {\n builder\n .addCase(increment, (state, action) => {\n // action is inferred correctly here\n state.counter += action.payload;\n })\n // You can chain calls, or have separate `builder.addCase()` lines each time\n .addCase(decrement, (state, action) => {\n state.counter -= action.payload;\n })\n // You can apply a \"matcher function\" to incoming actions\n .addMatcher(isActionWithNumberPayload, (state, action) => {})\n // and provide a default case if no other handlers matched\n .addDefaultCase((state, action) => {});\n }\n);\n```\n * @public\n */\nexport function createReducer>(initialState: S | (() => S), mapOrBuilderCallback: (builder: ActionReducerMapBuilder) => void): ReducerWithInitialState {\n if (process.env.NODE_ENV !== 'production') {\n if (typeof mapOrBuilderCallback === 'object') {\n throw new Error(process.env.NODE_ENV === \"production\" ? _formatProdErrorMessage(8) : \"The object notation for `createReducer` has been removed. Please use the 'builder callback' notation instead: https://redux-toolkit.js.org/api/createReducer\");\n }\n }\n let [actionsMap, finalActionMatchers, finalDefaultCaseReducer] = executeReducerBuilderCallback(mapOrBuilderCallback);\n\n // Ensure the initial state gets frozen either way (if draftable)\n let getInitialState: () => S;\n if (isStateFunction(initialState)) {\n getInitialState = () => freezeDraftable(initialState());\n } else {\n const frozenInitialState = freezeDraftable(initialState);\n getInitialState = () => frozenInitialState;\n }\n function reducer(state = getInitialState(), action: any): S {\n let caseReducers = [actionsMap[action.type], ...finalActionMatchers.filter(({\n matcher\n }) => matcher(action)).map(({\n reducer\n }) => reducer)];\n if (caseReducers.filter(cr => !!cr).length === 0) {\n caseReducers = [finalDefaultCaseReducer];\n }\n return caseReducers.reduce((previousState, caseReducer): S => {\n if (caseReducer) {\n if (isDraft(previousState)) {\n // If it's already a draft, we must already be inside a `createNextState` call,\n // likely because this is being wrapped in `createReducer`, `createSlice`, or nested\n // inside an existing draft. It's safe to just pass the draft to the mutator.\n const draft = previousState as Draft; // We can assume this is already a draft\n const result = caseReducer(draft, action);\n if (result === undefined) {\n return previousState;\n }\n return result as S;\n } else if (!isDraftable(previousState)) {\n // If state is not draftable (ex: a primitive, such as 0), we want to directly\n // return the caseReducer func and not wrap it with produce.\n const result = caseReducer(previousState as any, action);\n if (result === undefined) {\n if (previousState === null) {\n return previousState;\n }\n throw Error('A case reducer on a non-draftable value must not return undefined');\n }\n return result as S;\n } else {\n // @ts-ignore createNextState() produces an Immutable> rather\n // than an Immutable, and TypeScript cannot find out how to reconcile\n // these two types.\n return createNextState(previousState, (draft: Draft) => {\n return caseReducer(draft, action);\n });\n }\n }\n return previousState;\n }, state);\n }\n reducer.getInitialState = getInitialState;\n return reducer as ReducerWithInitialState;\n}", "import { formatProdErrorMessage as _formatProdErrorMessage, formatProdErrorMessage as _formatProdErrorMessage2, formatProdErrorMessage as _formatProdErrorMessage3, formatProdErrorMessage as _formatProdErrorMessage4, formatProdErrorMessage as _formatProdErrorMessage5, formatProdErrorMessage as _formatProdErrorMessage6 } from \"@reduxjs/toolkit\";\nimport type { Action } from 'redux';\nimport type { CaseReducer, CaseReducers, ActionMatcherDescriptionCollection } from './createReducer';\nimport type { TypeGuard } from './tsHelpers';\nexport type TypedActionCreator = {\n (...args: any[]): Action;\n type: Type;\n};\n\n/**\n * A builder for an action <-> reducer map.\n *\n * @public\n */\nexport interface ActionReducerMapBuilder {\n /**\n * Adds a case reducer to handle a single exact action type.\n * @remarks\n * All calls to `builder.addCase` must come before any calls to `builder.addMatcher` or `builder.addDefaultCase`.\n * @param actionCreator - Either a plain action type string, or an action creator generated by [`createAction`](./createAction) that can be used to determine the action type.\n * @param reducer - The actual case reducer function.\n */\n addCase>(actionCreator: ActionCreator, reducer: CaseReducer>): ActionReducerMapBuilder;\n /**\n * Adds a case reducer to handle a single exact action type.\n * @remarks\n * All calls to `builder.addCase` must come before any calls to `builder.addMatcher` or `builder.addDefaultCase`.\n * @param actionCreator - Either a plain action type string, or an action creator generated by [`createAction`](./createAction) that can be used to determine the action type.\n * @param reducer - The actual case reducer function.\n */\n addCase>(type: Type, reducer: CaseReducer): ActionReducerMapBuilder;\n\n /**\n * Allows you to match your incoming actions against your own filter function instead of only the `action.type` property.\n * @remarks\n * If multiple matcher reducers match, all of them will be executed in the order\n * they were defined in - even if a case reducer already matched.\n * All calls to `builder.addMatcher` must come after any calls to `builder.addCase` and before any calls to `builder.addDefaultCase`.\n * @param matcher - A matcher function. In TypeScript, this should be a [type predicate](https://www.typescriptlang.org/docs/handbook/2/narrowing.html#using-type-predicates)\n * function\n * @param reducer - The actual case reducer function.\n *\n * @example\n ```ts\n import {\n createAction,\n createReducer,\n AsyncThunk,\n UnknownAction,\n } from \"@reduxjs/toolkit\";\n type GenericAsyncThunk = AsyncThunk;\n type PendingAction = ReturnType;\n type RejectedAction = ReturnType;\n type FulfilledAction = ReturnType;\n const initialState: Record = {};\n const resetAction = createAction(\"reset-tracked-loading-state\");\n function isPendingAction(action: UnknownAction): action is PendingAction {\n return typeof action.type === \"string\" && action.type.endsWith(\"/pending\");\n }\n const reducer = createReducer(initialState, (builder) => {\n builder\n .addCase(resetAction, () => initialState)\n // matcher can be defined outside as a type predicate function\n .addMatcher(isPendingAction, (state, action) => {\n state[action.meta.requestId] = \"pending\";\n })\n .addMatcher(\n // matcher can be defined inline as a type predicate function\n (action): action is RejectedAction => action.type.endsWith(\"/rejected\"),\n (state, action) => {\n state[action.meta.requestId] = \"rejected\";\n }\n )\n // matcher can just return boolean and the matcher can receive a generic argument\n .addMatcher(\n (action) => action.type.endsWith(\"/fulfilled\"),\n (state, action) => {\n state[action.meta.requestId] = \"fulfilled\";\n }\n );\n });\n ```\n */\n addMatcher(matcher: TypeGuard | ((action: any) => boolean), reducer: CaseReducer): Omit, 'addCase'>;\n\n /**\n * Adds a \"default case\" reducer that is executed if no case reducer and no matcher\n * reducer was executed for this action.\n * @param reducer - The fallback \"default case\" reducer function.\n *\n * @example\n ```ts\n import { createReducer } from '@reduxjs/toolkit'\n const initialState = { otherActions: 0 }\n const reducer = createReducer(initialState, builder => {\n builder\n // .addCase(...)\n // .addMatcher(...)\n .addDefaultCase((state, action) => {\n state.otherActions++\n })\n })\n ```\n */\n addDefaultCase(reducer: CaseReducer): {};\n}\nexport function executeReducerBuilderCallback(builderCallback: (builder: ActionReducerMapBuilder) => void): [CaseReducers, ActionMatcherDescriptionCollection, CaseReducer | undefined] {\n const actionsMap: CaseReducers = {};\n const actionMatchers: ActionMatcherDescriptionCollection = [];\n let defaultCaseReducer: CaseReducer | undefined;\n const builder = {\n addCase(typeOrActionCreator: string | TypedActionCreator, reducer: CaseReducer) {\n if (process.env.NODE_ENV !== 'production') {\n /*\n to keep the definition by the user in line with actual behavior,\n we enforce `addCase` to always be called before calling `addMatcher`\n as matching cases take precedence over matchers\n */\n if (actionMatchers.length > 0) {\n throw new Error(process.env.NODE_ENV === \"production\" ? _formatProdErrorMessage(26) : '`builder.addCase` should only be called before calling `builder.addMatcher`');\n }\n if (defaultCaseReducer) {\n throw new Error(process.env.NODE_ENV === \"production\" ? _formatProdErrorMessage2(27) : '`builder.addCase` should only be called before calling `builder.addDefaultCase`');\n }\n }\n const type = typeof typeOrActionCreator === 'string' ? typeOrActionCreator : typeOrActionCreator.type;\n if (!type) {\n throw new Error(process.env.NODE_ENV === \"production\" ? _formatProdErrorMessage3(28) : '`builder.addCase` cannot be called with an empty action type');\n }\n if (type in actionsMap) {\n throw new Error(process.env.NODE_ENV === \"production\" ? _formatProdErrorMessage4(29) : '`builder.addCase` cannot be called with two reducers for the same action type ' + `'${type}'`);\n }\n actionsMap[type] = reducer;\n return builder;\n },\n addMatcher(matcher: TypeGuard, reducer: CaseReducer) {\n if (process.env.NODE_ENV !== 'production') {\n if (defaultCaseReducer) {\n throw new Error(process.env.NODE_ENV === \"production\" ? _formatProdErrorMessage5(30) : '`builder.addMatcher` should only be called before calling `builder.addDefaultCase`');\n }\n }\n actionMatchers.push({\n matcher,\n reducer\n });\n return builder;\n },\n addDefaultCase(reducer: CaseReducer) {\n if (process.env.NODE_ENV !== 'production') {\n if (defaultCaseReducer) {\n throw new Error(process.env.NODE_ENV === \"production\" ? _formatProdErrorMessage6(31) : '`builder.addDefaultCase` can only be called once');\n }\n }\n defaultCaseReducer = reducer;\n return builder;\n }\n };\n builderCallback(builder);\n return [actionsMap, actionMatchers, defaultCaseReducer];\n}", "import type { ActionFromMatcher, Matcher, UnionToIntersection } from './tsHelpers';\nimport { hasMatchFunction } from './tsHelpers';\nimport type { AsyncThunk, AsyncThunkFulfilledActionCreator, AsyncThunkPendingActionCreator, AsyncThunkRejectedActionCreator } from './createAsyncThunk';\n\n/** @public */\nexport type ActionMatchingAnyOf[]> = ActionFromMatcher;\n\n/** @public */\nexport type ActionMatchingAllOf[]> = UnionToIntersection>;\nconst matches = (matcher: Matcher, action: any) => {\n if (hasMatchFunction(matcher)) {\n return matcher.match(action);\n } else {\n return matcher(action);\n }\n};\n\n/**\n * A higher-order function that returns a function that may be used to check\n * whether an action matches any one of the supplied type guards or action\n * creators.\n *\n * @param matchers The type guards or action creators to match against.\n *\n * @public\n */\nexport function isAnyOf[]>(...matchers: Matchers) {\n return (action: any): action is ActionMatchingAnyOf => {\n return matchers.some(matcher => matches(matcher, action));\n };\n}\n\n/**\n * A higher-order function that returns a function that may be used to check\n * whether an action matches all of the supplied type guards or action\n * creators.\n *\n * @param matchers The type guards or action creators to match against.\n *\n * @public\n */\nexport function isAllOf[]>(...matchers: Matchers) {\n return (action: any): action is ActionMatchingAllOf => {\n return matchers.every(matcher => matches(matcher, action));\n };\n}\n\n/**\n * @param action A redux action\n * @param validStatus An array of valid meta.requestStatus values\n *\n * @internal\n */\nexport function hasExpectedRequestMetadata(action: any, validStatus: readonly string[]) {\n if (!action || !action.meta) return false;\n const hasValidRequestId = typeof action.meta.requestId === 'string';\n const hasValidRequestStatus = validStatus.indexOf(action.meta.requestStatus) > -1;\n return hasValidRequestId && hasValidRequestStatus;\n}\nfunction isAsyncThunkArray(a: [any] | AnyAsyncThunk[]): a is AnyAsyncThunk[] {\n return typeof a[0] === 'function' && 'pending' in a[0] && 'fulfilled' in a[0] && 'rejected' in a[0];\n}\nexport type UnknownAsyncThunkPendingAction = ReturnType>;\nexport type PendingActionFromAsyncThunk = ActionFromMatcher;\n\n/**\n * A higher-order function that returns a function that may be used to check\n * whether an action was created by an async thunk action creator, and that\n * the action is pending.\n *\n * @public\n */\nexport function isPending(): (action: any) => action is UnknownAsyncThunkPendingAction;\n/**\n * A higher-order function that returns a function that may be used to check\n * whether an action belongs to one of the provided async thunk action creators,\n * and that the action is pending.\n *\n * @param asyncThunks (optional) The async thunk action creators to match against.\n *\n * @public\n */\nexport function isPending(...asyncThunks: AsyncThunks): (action: any) => action is PendingActionFromAsyncThunk;\n/**\n * Tests if `action` is a pending thunk action\n * @public\n */\nexport function isPending(action: any): action is UnknownAsyncThunkPendingAction;\nexport function isPending(...asyncThunks: AsyncThunks | [any]) {\n if (asyncThunks.length === 0) {\n return (action: any) => hasExpectedRequestMetadata(action, ['pending']);\n }\n if (!isAsyncThunkArray(asyncThunks)) {\n return isPending()(asyncThunks[0]);\n }\n return isAnyOf(...asyncThunks.map(asyncThunk => asyncThunk.pending));\n}\nexport type UnknownAsyncThunkRejectedAction = ReturnType>;\nexport type RejectedActionFromAsyncThunk = ActionFromMatcher;\n\n/**\n * A higher-order function that returns a function that may be used to check\n * whether an action was created by an async thunk action creator, and that\n * the action is rejected.\n *\n * @public\n */\nexport function isRejected(): (action: any) => action is UnknownAsyncThunkRejectedAction;\n/**\n * A higher-order function that returns a function that may be used to check\n * whether an action belongs to one of the provided async thunk action creators,\n * and that the action is rejected.\n *\n * @param asyncThunks (optional) The async thunk action creators to match against.\n *\n * @public\n */\nexport function isRejected(...asyncThunks: AsyncThunks): (action: any) => action is RejectedActionFromAsyncThunk;\n/**\n * Tests if `action` is a rejected thunk action\n * @public\n */\nexport function isRejected(action: any): action is UnknownAsyncThunkRejectedAction;\nexport function isRejected(...asyncThunks: AsyncThunks | [any]) {\n if (asyncThunks.length === 0) {\n return (action: any) => hasExpectedRequestMetadata(action, ['rejected']);\n }\n if (!isAsyncThunkArray(asyncThunks)) {\n return isRejected()(asyncThunks[0]);\n }\n return isAnyOf(...asyncThunks.map(asyncThunk => asyncThunk.rejected));\n}\nexport type UnknownAsyncThunkRejectedWithValueAction = ReturnType>;\nexport type RejectedWithValueActionFromAsyncThunk = ActionFromMatcher & (T extends AsyncThunk ? {\n payload: RejectedValue;\n} : unknown);\n\n/**\n * A higher-order function that returns a function that may be used to check\n * whether an action was created by an async thunk action creator, and that\n * the action is rejected with value.\n *\n * @public\n */\nexport function isRejectedWithValue(): (action: any) => action is UnknownAsyncThunkRejectedAction;\n/**\n * A higher-order function that returns a function that may be used to check\n * whether an action belongs to one of the provided async thunk action creators,\n * and that the action is rejected with value.\n *\n * @param asyncThunks (optional) The async thunk action creators to match against.\n *\n * @public\n */\nexport function isRejectedWithValue(...asyncThunks: AsyncThunks): (action: any) => action is RejectedWithValueActionFromAsyncThunk;\n/**\n * Tests if `action` is a rejected thunk action with value\n * @public\n */\nexport function isRejectedWithValue(action: any): action is UnknownAsyncThunkRejectedAction;\nexport function isRejectedWithValue(...asyncThunks: AsyncThunks | [any]) {\n const hasFlag = (action: any): action is any => {\n return action && action.meta && action.meta.rejectedWithValue;\n };\n if (asyncThunks.length === 0) {\n return isAllOf(isRejected(...asyncThunks), hasFlag);\n }\n if (!isAsyncThunkArray(asyncThunks)) {\n return isRejectedWithValue()(asyncThunks[0]);\n }\n return isAllOf(isRejected(...asyncThunks), hasFlag);\n}\nexport type UnknownAsyncThunkFulfilledAction = ReturnType>;\nexport type FulfilledActionFromAsyncThunk = ActionFromMatcher;\n\n/**\n * A higher-order function that returns a function that may be used to check\n * whether an action was created by an async thunk action creator, and that\n * the action is fulfilled.\n *\n * @public\n */\nexport function isFulfilled(): (action: any) => action is UnknownAsyncThunkFulfilledAction;\n/**\n * A higher-order function that returns a function that may be used to check\n * whether an action belongs to one of the provided async thunk action creators,\n * and that the action is fulfilled.\n *\n * @param asyncThunks (optional) The async thunk action creators to match against.\n *\n * @public\n */\nexport function isFulfilled(...asyncThunks: AsyncThunks): (action: any) => action is FulfilledActionFromAsyncThunk;\n/**\n * Tests if `action` is a fulfilled thunk action\n * @public\n */\nexport function isFulfilled(action: any): action is UnknownAsyncThunkFulfilledAction;\nexport function isFulfilled(...asyncThunks: AsyncThunks | [any]) {\n if (asyncThunks.length === 0) {\n return (action: any) => hasExpectedRequestMetadata(action, ['fulfilled']);\n }\n if (!isAsyncThunkArray(asyncThunks)) {\n return isFulfilled()(asyncThunks[0]);\n }\n return isAnyOf(...asyncThunks.map(asyncThunk => asyncThunk.fulfilled));\n}\nexport type UnknownAsyncThunkAction = UnknownAsyncThunkPendingAction | UnknownAsyncThunkRejectedAction | UnknownAsyncThunkFulfilledAction;\nexport type AnyAsyncThunk = {\n pending: {\n match: (action: any) => action is any;\n };\n fulfilled: {\n match: (action: any) => action is any;\n };\n rejected: {\n match: (action: any) => action is any;\n };\n};\nexport type ActionsFromAsyncThunk = ActionFromMatcher | ActionFromMatcher | ActionFromMatcher;\n\n/**\n * A higher-order function that returns a function that may be used to check\n * whether an action was created by an async thunk action creator.\n *\n * @public\n */\nexport function isAsyncThunkAction(): (action: any) => action is UnknownAsyncThunkAction;\n/**\n * A higher-order function that returns a function that may be used to check\n * whether an action belongs to one of the provided async thunk action creators.\n *\n * @param asyncThunks (optional) The async thunk action creators to match against.\n *\n * @public\n */\nexport function isAsyncThunkAction(...asyncThunks: AsyncThunks): (action: any) => action is ActionsFromAsyncThunk;\n/**\n * Tests if `action` is a thunk action\n * @public\n */\nexport function isAsyncThunkAction(action: any): action is UnknownAsyncThunkAction;\nexport function isAsyncThunkAction(...asyncThunks: AsyncThunks | [any]) {\n if (asyncThunks.length === 0) {\n return (action: any) => hasExpectedRequestMetadata(action, ['pending', 'fulfilled', 'rejected']);\n }\n if (!isAsyncThunkArray(asyncThunks)) {\n return isAsyncThunkAction()(asyncThunks[0]);\n }\n return isAnyOf(...asyncThunks.flatMap(asyncThunk => [asyncThunk.pending, asyncThunk.rejected, asyncThunk.fulfilled]));\n}", "// Borrowed from https://github.com/ai/nanoid/blob/3.0.2/non-secure/index.js\n// This alphabet uses `A-Za-z0-9_-` symbols. A genetic algorithm helped\n// optimize the gzip compression for this alphabet.\nlet urlAlphabet = 'ModuleSymbhasOwnPr-0123456789ABCDEFGHNRVfgctiUvz_KqYTJkLxpZXIjQW';\n\n/**\r\n *\r\n * @public\r\n */\nexport let nanoid = (size = 21) => {\n let id = '';\n // A compact alternative for `for (var i = 0; i < step; i++)`.\n let i = size;\n while (i--) {\n // `| 0` is more compact and faster than `Math.floor()`.\n id += urlAlphabet[Math.random() * 64 | 0];\n }\n return id;\n};", "import type { Dispatch, UnknownAction } from 'redux';\nimport type { ThunkDispatch } from 'redux-thunk';\nimport type { ActionCreatorWithPreparedPayload } from './createAction';\nimport { createAction } from './createAction';\nimport { isAnyOf } from './matchers';\nimport { nanoid } from './nanoid';\nimport type { FallbackIfUnknown, Id, IsAny, IsUnknown, SafePromise } from './tsHelpers';\nexport type BaseThunkAPI = {\n dispatch: D;\n getState: () => S;\n extra: E;\n requestId: string;\n signal: AbortSignal;\n abort: (reason?: string) => void;\n rejectWithValue: IsUnknown RejectWithValue, (value: RejectedValue, meta: RejectedMeta) => RejectWithValue>;\n fulfillWithValue: IsUnknown(value: FulfilledValue) => FulfilledValue, (value: FulfilledValue, meta: FulfilledMeta) => FulfillWithMeta>;\n};\n\n/**\n * @public\n */\nexport interface SerializedError {\n name?: string;\n message?: string;\n stack?: string;\n code?: string;\n}\nconst commonProperties: Array = ['name', 'message', 'stack', 'code'];\nclass RejectWithValue {\n /*\n type-only property to distinguish between RejectWithValue and FulfillWithMeta\n does not exist at runtime\n */\n private readonly _type!: 'RejectWithValue';\n constructor(public readonly payload: Payload, public readonly meta: RejectedMeta) {}\n}\nclass FulfillWithMeta {\n /*\n type-only property to distinguish between RejectWithValue and FulfillWithMeta\n does not exist at runtime\n */\n private readonly _type!: 'FulfillWithMeta';\n constructor(public readonly payload: Payload, public readonly meta: FulfilledMeta) {}\n}\n\n/**\n * Serializes an error into a plain object.\n * Reworked from https://github.com/sindresorhus/serialize-error\n *\n * @public\n */\nexport const miniSerializeError = (value: any): SerializedError => {\n if (typeof value === 'object' && value !== null) {\n const simpleError: SerializedError = {};\n for (const property of commonProperties) {\n if (typeof value[property] === 'string') {\n simpleError[property] = value[property];\n }\n }\n return simpleError;\n }\n return {\n message: String(value)\n };\n};\nexport type AsyncThunkConfig = {\n state?: unknown;\n dispatch?: ThunkDispatch;\n extra?: unknown;\n rejectValue?: unknown;\n serializedErrorType?: unknown;\n pendingMeta?: unknown;\n fulfilledMeta?: unknown;\n rejectedMeta?: unknown;\n};\nexport type GetState = ThunkApiConfig extends {\n state: infer State;\n} ? State : unknown;\ntype GetExtra = ThunkApiConfig extends {\n extra: infer Extra;\n} ? Extra : unknown;\ntype GetDispatch = ThunkApiConfig extends {\n dispatch: infer Dispatch;\n} ? FallbackIfUnknown, GetExtra, UnknownAction>> : ThunkDispatch, GetExtra, UnknownAction>;\nexport type GetThunkAPI = BaseThunkAPI, GetExtra, GetDispatch, GetRejectValue, GetRejectedMeta, GetFulfilledMeta>;\ntype GetRejectValue = ThunkApiConfig extends {\n rejectValue: infer RejectValue;\n} ? RejectValue : unknown;\ntype GetPendingMeta = ThunkApiConfig extends {\n pendingMeta: infer PendingMeta;\n} ? PendingMeta : unknown;\ntype GetFulfilledMeta = ThunkApiConfig extends {\n fulfilledMeta: infer FulfilledMeta;\n} ? FulfilledMeta : unknown;\ntype GetRejectedMeta = ThunkApiConfig extends {\n rejectedMeta: infer RejectedMeta;\n} ? RejectedMeta : unknown;\ntype GetSerializedErrorType = ThunkApiConfig extends {\n serializedErrorType: infer GetSerializedErrorType;\n} ? GetSerializedErrorType : SerializedError;\ntype MaybePromise = T | Promise | (T extends any ? Promise : never);\n\n/**\n * A type describing the return value of the `payloadCreator` argument to `createAsyncThunk`.\n * Might be useful for wrapping `createAsyncThunk` in custom abstractions.\n *\n * @public\n */\nexport type AsyncThunkPayloadCreatorReturnValue = MaybePromise, Returned, FulfillWithMeta>> | RejectWithValue, GetRejectedMeta>>;\n/**\n * A type describing the `payloadCreator` argument to `createAsyncThunk`.\n * Might be useful for wrapping `createAsyncThunk` in custom abstractions.\n *\n * @public\n */\nexport type AsyncThunkPayloadCreator = (arg: ThunkArg, thunkAPI: GetThunkAPI) => AsyncThunkPayloadCreatorReturnValue;\n\n/**\n * A ThunkAction created by `createAsyncThunk`.\n * Dispatching it returns a Promise for either a\n * fulfilled or rejected action.\n * Also, the returned value contains an `abort()` method\n * that allows the asyncAction to be cancelled from the outside.\n *\n * @public\n */\nexport type AsyncThunkAction = (dispatch: NonNullable>, getState: () => GetState, extra: GetExtra) => SafePromise> | ReturnType>> & {\n abort: (reason?: string) => void;\n requestId: string;\n arg: ThunkArg;\n unwrap: () => Promise;\n};\n\n/**\n * Config provided when calling the async thunk action creator.\n */\nexport interface AsyncThunkDispatchConfig {\n /**\n * An external `AbortSignal` that will be tracked by the internal `AbortSignal`.\n */\n signal?: AbortSignal;\n}\ntype AsyncThunkActionCreator = IsAny AsyncThunkAction,\n// unknown handling\nunknown extends ThunkArg ? (arg: ThunkArg, config?: AsyncThunkDispatchConfig) => AsyncThunkAction // argument not specified or specified as void or undefined\n: [ThunkArg] extends [void] | [undefined] ? (arg?: undefined, config?: AsyncThunkDispatchConfig) => AsyncThunkAction // argument contains void\n: [void] extends [ThunkArg] // make optional\n? (arg?: ThunkArg, config?: AsyncThunkDispatchConfig) => AsyncThunkAction // argument contains undefined\n: [undefined] extends [ThunkArg] ? WithStrictNullChecks<\n// with strict nullChecks: make optional\n(arg?: ThunkArg, config?: AsyncThunkDispatchConfig) => AsyncThunkAction,\n// without strict null checks this will match everything, so don't make it optional\n(arg: ThunkArg, config?: AsyncThunkDispatchConfig) => AsyncThunkAction> // default case: normal argument\n: (arg: ThunkArg, config?: AsyncThunkDispatchConfig) => AsyncThunkAction>;\n\n/**\n * Options object for `createAsyncThunk`.\n *\n * @public\n */\nexport type AsyncThunkOptions = {\n /**\n * A method to control whether the asyncThunk should be executed. Has access to the\n * `arg`, `api.getState()` and `api.extra` arguments.\n *\n * @returns `false` if it should be skipped\n */\n condition?(arg: ThunkArg, api: Pick, 'getState' | 'extra'>): MaybePromise;\n /**\n * If `condition` returns `false`, the asyncThunk will be skipped.\n * This option allows you to control whether a `rejected` action with `meta.condition == false`\n * will be dispatched or not.\n *\n * @default `false`\n */\n dispatchConditionRejection?: boolean;\n serializeError?: (x: unknown) => GetSerializedErrorType;\n\n /**\n * A function to use when generating the `requestId` for the request sequence.\n *\n * @default `nanoid`\n */\n idGenerator?: (arg: ThunkArg) => string;\n} & IsUnknown, {\n /**\n * A method to generate additional properties to be added to `meta` of the pending action.\n *\n * Using this optional overload will not modify the types correctly, this overload is only in place to support JavaScript users.\n * Please use the `ThunkApiConfig` parameter `pendingMeta` to get access to a correctly typed overload\n */\n getPendingMeta?(base: {\n arg: ThunkArg;\n requestId: string;\n }, api: Pick, 'getState' | 'extra'>): GetPendingMeta;\n}, {\n /**\n * A method to generate additional properties to be added to `meta` of the pending action.\n */\n getPendingMeta(base: {\n arg: ThunkArg;\n requestId: string;\n }, api: Pick, 'getState' | 'extra'>): GetPendingMeta;\n}>;\nexport type AsyncThunkPendingActionCreator = ActionCreatorWithPreparedPayload<[string, ThunkArg, GetPendingMeta?], undefined, string, never, {\n arg: ThunkArg;\n requestId: string;\n requestStatus: 'pending';\n} & GetPendingMeta>;\nexport type AsyncThunkRejectedActionCreator = ActionCreatorWithPreparedPayload<[Error | null, string, ThunkArg, GetRejectValue?, GetRejectedMeta?], GetRejectValue | undefined, string, GetSerializedErrorType, {\n arg: ThunkArg;\n requestId: string;\n requestStatus: 'rejected';\n aborted: boolean;\n condition: boolean;\n} & (({\n rejectedWithValue: false;\n} & { [K in keyof GetRejectedMeta]?: undefined }) | ({\n rejectedWithValue: true;\n} & GetRejectedMeta))>;\nexport type AsyncThunkFulfilledActionCreator = ActionCreatorWithPreparedPayload<[Returned, string, ThunkArg, GetFulfilledMeta?], Returned, string, never, {\n arg: ThunkArg;\n requestId: string;\n requestStatus: 'fulfilled';\n} & GetFulfilledMeta>;\n\n/**\n * A type describing the return value of `createAsyncThunk`.\n * Might be useful for wrapping `createAsyncThunk` in custom abstractions.\n *\n * @public\n */\nexport type AsyncThunk = AsyncThunkActionCreator & {\n pending: AsyncThunkPendingActionCreator;\n rejected: AsyncThunkRejectedActionCreator;\n fulfilled: AsyncThunkFulfilledActionCreator;\n // matchSettled?\n settled: (action: any) => action is ReturnType | AsyncThunkFulfilledActionCreator>;\n typePrefix: string;\n};\nexport type OverrideThunkApiConfigs = Id>;\nexport type CreateAsyncThunkFunction = {\n /**\n *\n * @param typePrefix\n * @param payloadCreator\n * @param options\n *\n * @public\n */\n // separate signature without `AsyncThunkConfig` for better inference\n (typePrefix: string, payloadCreator: AsyncThunkPayloadCreator, options?: AsyncThunkOptions): AsyncThunk;\n\n /**\n *\n * @param typePrefix\n * @param payloadCreator\n * @param options\n *\n * @public\n */\n (typePrefix: string, payloadCreator: AsyncThunkPayloadCreator>, options?: AsyncThunkOptions>): AsyncThunk>;\n};\ntype CreateAsyncThunk = CreateAsyncThunkFunction & {\n withTypes(): CreateAsyncThunk>;\n};\nconst externalAbortMessage = 'External signal was aborted';\nexport const createAsyncThunk = /* @__PURE__ */(() => {\n function createAsyncThunk(typePrefix: string, payloadCreator: AsyncThunkPayloadCreator, options?: AsyncThunkOptions): AsyncThunk {\n type RejectedValue = GetRejectValue;\n type PendingMeta = GetPendingMeta;\n type FulfilledMeta = GetFulfilledMeta;\n type RejectedMeta = GetRejectedMeta;\n const fulfilled: AsyncThunkFulfilledActionCreator = createAction(typePrefix + '/fulfilled', (payload: Returned, requestId: string, arg: ThunkArg, meta?: FulfilledMeta) => ({\n payload,\n meta: {\n ...(meta as any || {}),\n arg,\n requestId,\n requestStatus: 'fulfilled' as const\n }\n }));\n const pending: AsyncThunkPendingActionCreator = createAction(typePrefix + '/pending', (requestId: string, arg: ThunkArg, meta?: PendingMeta) => ({\n payload: undefined,\n meta: {\n ...(meta as any || {}),\n arg,\n requestId,\n requestStatus: 'pending' as const\n }\n }));\n const rejected: AsyncThunkRejectedActionCreator = createAction(typePrefix + '/rejected', (error: Error | null, requestId: string, arg: ThunkArg, payload?: RejectedValue, meta?: RejectedMeta) => ({\n payload,\n error: (options && options.serializeError || miniSerializeError)(error || 'Rejected') as GetSerializedErrorType,\n meta: {\n ...(meta as any || {}),\n arg,\n requestId,\n rejectedWithValue: !!payload,\n requestStatus: 'rejected' as const,\n aborted: error?.name === 'AbortError',\n condition: error?.name === 'ConditionError'\n }\n }));\n function actionCreator(arg: ThunkArg, {\n signal\n }: AsyncThunkDispatchConfig = {}): AsyncThunkAction> {\n return (dispatch, getState, extra) => {\n const requestId = options?.idGenerator ? options.idGenerator(arg) : nanoid();\n const abortController = new AbortController();\n let abortHandler: (() => void) | undefined;\n let abortReason: string | undefined;\n function abort(reason?: string) {\n abortReason = reason;\n abortController.abort();\n }\n if (signal) {\n if (signal.aborted) {\n abort(externalAbortMessage);\n } else {\n signal.addEventListener('abort', () => abort(externalAbortMessage), {\n once: true\n });\n }\n }\n const promise = async function () {\n let finalAction: ReturnType;\n try {\n let conditionResult = options?.condition?.(arg, {\n getState,\n extra\n });\n if (isThenable(conditionResult)) {\n conditionResult = await conditionResult;\n }\n if (conditionResult === false || abortController.signal.aborted) {\n // eslint-disable-next-line no-throw-literal\n throw {\n name: 'ConditionError',\n message: 'Aborted due to condition callback returning false.'\n };\n }\n const abortedPromise = new Promise((_, reject) => {\n abortHandler = () => {\n reject({\n name: 'AbortError',\n message: abortReason || 'Aborted'\n });\n };\n abortController.signal.addEventListener('abort', abortHandler);\n });\n dispatch(pending(requestId, arg, options?.getPendingMeta?.({\n requestId,\n arg\n }, {\n getState,\n extra\n })) as any);\n finalAction = await Promise.race([abortedPromise, Promise.resolve(payloadCreator(arg, {\n dispatch,\n getState,\n extra,\n requestId,\n signal: abortController.signal,\n abort,\n rejectWithValue: ((value: RejectedValue, meta?: RejectedMeta) => {\n return new RejectWithValue(value, meta);\n }) as any,\n fulfillWithValue: ((value: unknown, meta?: FulfilledMeta) => {\n return new FulfillWithMeta(value, meta);\n }) as any\n })).then(result => {\n if (result instanceof RejectWithValue) {\n throw result;\n }\n if (result instanceof FulfillWithMeta) {\n return fulfilled(result.payload, requestId, arg, result.meta);\n }\n return fulfilled(result as any, requestId, arg);\n })]);\n } catch (err) {\n finalAction = err instanceof RejectWithValue ? rejected(null, requestId, arg, err.payload, err.meta) : rejected(err as any, requestId, arg);\n } finally {\n if (abortHandler) {\n abortController.signal.removeEventListener('abort', abortHandler);\n }\n }\n // We dispatch the result action _after_ the catch, to avoid having any errors\n // here get swallowed by the try/catch block,\n // per https://twitter.com/dan_abramov/status/770914221638942720\n // and https://github.com/reduxjs/redux-toolkit/blob/e85eb17b39a2118d859f7b7746e0f3fee523e089/docs/tutorials/advanced-tutorial.md#async-error-handling-logic-in-thunks\n\n const skipDispatch = options && !options.dispatchConditionRejection && rejected.match(finalAction) && (finalAction as any).meta.condition;\n if (!skipDispatch) {\n dispatch(finalAction as any);\n }\n return finalAction;\n }();\n return Object.assign(promise as SafePromise, {\n abort,\n requestId,\n arg,\n unwrap() {\n return promise.then(unwrapResult);\n }\n });\n };\n }\n return Object.assign(actionCreator as AsyncThunkActionCreator, {\n pending,\n rejected,\n fulfilled,\n settled: isAnyOf(rejected, fulfilled),\n typePrefix\n });\n }\n createAsyncThunk.withTypes = () => createAsyncThunk;\n return createAsyncThunk as CreateAsyncThunk;\n})();\ninterface UnwrappableAction {\n payload: any;\n meta?: any;\n error?: any;\n}\ntype UnwrappedActionPayload = Exclude['payload'];\n\n/**\n * @public\n */\nexport function unwrapResult(action: R): UnwrappedActionPayload {\n if (action.meta && action.meta.rejectedWithValue) {\n throw action.payload;\n }\n if (action.error) {\n throw action.error;\n }\n return action.payload;\n}\ntype WithStrictNullChecks = undefined extends boolean ? False : True;\nfunction isThenable(value: any): value is PromiseLike {\n return value !== null && typeof value === 'object' && typeof value.then === 'function';\n}", "import { formatProdErrorMessage as _formatProdErrorMessage, formatProdErrorMessage as _formatProdErrorMessage2, formatProdErrorMessage as _formatProdErrorMessage3, formatProdErrorMessage as _formatProdErrorMessage4, formatProdErrorMessage as _formatProdErrorMessage5, formatProdErrorMessage as _formatProdErrorMessage6, formatProdErrorMessage as _formatProdErrorMessage7, formatProdErrorMessage as _formatProdErrorMessage8 } from \"@reduxjs/toolkit\";\nimport type { Action, Reducer, UnknownAction } from 'redux';\nimport type { Selector } from 'reselect';\nimport type { InjectConfig } from './combineSlices';\nimport type { ActionCreatorWithoutPayload, PayloadAction, PayloadActionCreator, PrepareAction, _ActionCreatorWithPreparedPayload } from './createAction';\nimport { createAction } from './createAction';\nimport type { AsyncThunk, AsyncThunkConfig, AsyncThunkOptions, AsyncThunkPayloadCreator, OverrideThunkApiConfigs } from './createAsyncThunk';\nimport { createAsyncThunk as _createAsyncThunk } from './createAsyncThunk';\nimport type { ActionMatcherDescriptionCollection, CaseReducer, ReducerWithInitialState } from './createReducer';\nimport { createReducer } from './createReducer';\nimport type { ActionReducerMapBuilder, TypedActionCreator } from './mapBuilders';\nimport { executeReducerBuilderCallback } from './mapBuilders';\nimport type { Id, TypeGuard } from './tsHelpers';\nimport { getOrInsertComputed } from './utils';\nconst asyncThunkSymbol = /* @__PURE__ */Symbol.for('rtk-slice-createasyncthunk');\n// type is annotated because it's too long to infer\nexport const asyncThunkCreator: {\n [asyncThunkSymbol]: typeof _createAsyncThunk;\n} = {\n [asyncThunkSymbol]: _createAsyncThunk\n};\ntype InjectIntoConfig = InjectConfig & {\n reducerPath?: NewReducerPath;\n};\n\n/**\n * The return value of `createSlice`\n *\n * @public\n */\nexport interface Slice = SliceCaseReducers, Name extends string = string, ReducerPath extends string = Name, Selectors extends SliceSelectors = SliceSelectors> {\n /**\n * The slice name.\n */\n name: Name;\n\n /**\n * The slice reducer path.\n */\n reducerPath: ReducerPath;\n\n /**\n * The slice's reducer.\n */\n reducer: Reducer;\n\n /**\n * Action creators for the types of actions that are handled by the slice\n * reducer.\n */\n actions: CaseReducerActions;\n\n /**\n * The individual case reducer functions that were passed in the `reducers` parameter.\n * This enables reuse and testing if they were defined inline when calling `createSlice`.\n */\n caseReducers: SliceDefinedCaseReducers;\n\n /**\n * Provides access to the initial state value given to the slice.\n * If a lazy state initializer was provided, it will be called and a fresh value returned.\n */\n getInitialState: () => State;\n\n /**\n * Get localised slice selectors (expects to be called with *just* the slice's state as the first parameter)\n */\n getSelectors(): Id>;\n\n /**\n * Get globalised slice selectors (`selectState` callback is expected to receive first parameter and return slice state)\n */\n getSelectors(selectState: (rootState: RootState) => State): Id>;\n\n /**\n * Selectors that assume the slice's state is `rootState[slice.reducerPath]` (which is usually the case)\n *\n * Equivalent to `slice.getSelectors((state: RootState) => state[slice.reducerPath])`.\n */\n get selectors(): Id>;\n\n /**\n * Inject slice into provided reducer (return value from `combineSlices`), and return injected slice.\n */\n injectInto(this: this, injectable: {\n inject: (slice: {\n reducerPath: string;\n reducer: Reducer;\n }, config?: InjectConfig) => void;\n }, config?: InjectIntoConfig): InjectedSlice;\n\n /**\n * Select the slice state, using the slice's current reducerPath.\n *\n * Will throw an error if slice is not found.\n */\n selectSlice(state: { [K in ReducerPath]: State }): State;\n}\n\n/**\n * A slice after being called with `injectInto(reducer)`.\n *\n * Selectors can now be called with an `undefined` value, in which case they use the slice's initial state.\n */\ntype InjectedSlice = SliceCaseReducers, Name extends string = string, ReducerPath extends string = Name, Selectors extends SliceSelectors = SliceSelectors> = Omit, 'getSelectors' | 'selectors'> & {\n /**\n * Get localised slice selectors (expects to be called with *just* the slice's state as the first parameter)\n */\n getSelectors(): Id>;\n\n /**\n * Get globalised slice selectors (`selectState` callback is expected to receive first parameter and return slice state)\n */\n getSelectors(selectState: (rootState: RootState) => State | undefined): Id>;\n\n /**\n * Selectors that assume the slice's state is `rootState[slice.name]` (which is usually the case)\n *\n * Equivalent to `slice.getSelectors((state: RootState) => state[slice.name])`.\n */\n get selectors(): Id>;\n\n /**\n * Select the slice state, using the slice's current reducerPath.\n *\n * Returns initial state if slice is not found.\n */\n selectSlice(state: { [K in ReducerPath]?: State | undefined }): State;\n};\n\n/**\n * Options for `createSlice()`.\n *\n * @public\n */\nexport interface CreateSliceOptions = SliceCaseReducers, Name extends string = string, ReducerPath extends string = Name, Selectors extends SliceSelectors = SliceSelectors> {\n /**\n * The slice's name. Used to namespace the generated action types.\n */\n name: Name;\n\n /**\n * The slice's reducer path. Used when injecting into a combined slice reducer.\n */\n reducerPath?: ReducerPath;\n\n /**\n * The initial state that should be used when the reducer is called the first time. This may also be a \"lazy initializer\" function, which should return an initial state value when called. This will be used whenever the reducer is called with `undefined` as its state value, and is primarily useful for cases like reading initial state from `localStorage`.\n */\n initialState: State | (() => State);\n\n /**\n * A mapping from action types to action-type-specific *case reducer*\n * functions. For every action type, a matching action creator will be\n * generated using `createAction()`.\n */\n reducers: ValidateSliceCaseReducers | ((creators: ReducerCreators) => CR);\n\n /**\n * A callback that receives a *builder* object to define\n * case reducers via calls to `builder.addCase(actionCreatorOrType, reducer)`.\n *\n *\n * @example\n ```ts\n import { createAction, createSlice, Action } from '@reduxjs/toolkit'\n const incrementBy = createAction('incrementBy')\n const decrement = createAction('decrement')\n interface RejectedAction extends Action {\n error: Error\n }\n function isRejectedAction(action: Action): action is RejectedAction {\n return action.type.endsWith('rejected')\n }\n createSlice({\n name: 'counter',\n initialState: 0,\n reducers: {},\n extraReducers: builder => {\n builder\n .addCase(incrementBy, (state, action) => {\n // action is inferred correctly here if using TS\n })\n // You can chain calls, or have separate `builder.addCase()` lines each time\n .addCase(decrement, (state, action) => {})\n // You can match a range of action types\n .addMatcher(\n isRejectedAction,\n // `action` will be inferred as a RejectedAction due to isRejectedAction being defined as a type guard\n (state, action) => {}\n )\n // and provide a default case if no other handlers matched\n .addDefaultCase((state, action) => {})\n }\n })\n ```\n */\n extraReducers?: (builder: ActionReducerMapBuilder) => void;\n\n /**\n * A map of selectors that receive the slice's state and any additional arguments, and return a result.\n */\n selectors?: Selectors;\n}\nexport enum ReducerType {\n reducer = 'reducer',\n reducerWithPrepare = 'reducerWithPrepare',\n asyncThunk = 'asyncThunk',\n}\ntype ReducerDefinition = {\n _reducerDefinitionType: T;\n};\nexport type CaseReducerDefinition = CaseReducer & ReducerDefinition;\n\n/**\n * A CaseReducer with a `prepare` method.\n *\n * @public\n */\nexport type CaseReducerWithPrepare = {\n reducer: CaseReducer;\n prepare: PrepareAction;\n};\nexport interface CaseReducerWithPrepareDefinition extends CaseReducerWithPrepare, ReducerDefinition {}\ntype AsyncThunkSliceReducerConfig = {\n pending?: CaseReducer['pending']>>;\n rejected?: CaseReducer['rejected']>>;\n fulfilled?: CaseReducer['fulfilled']>>;\n settled?: CaseReducer['rejected' | 'fulfilled']>>;\n options?: AsyncThunkOptions;\n};\ntype AsyncThunkSliceReducerDefinition = AsyncThunkSliceReducerConfig & ReducerDefinition & {\n payloadCreator: AsyncThunkPayloadCreator;\n};\n\n/**\n * Providing these as part of the config would cause circular types, so we disallow passing them\n */\ntype PreventCircular = { [K in keyof ThunkApiConfig]: K extends 'state' | 'dispatch' ? never : ThunkApiConfig[K] };\ninterface AsyncThunkCreator = PreventCircular> {\n (payloadCreator: AsyncThunkPayloadCreator, config?: AsyncThunkSliceReducerConfig): AsyncThunkSliceReducerDefinition;\n = {}>(payloadCreator: AsyncThunkPayloadCreator, config?: AsyncThunkSliceReducerConfig): AsyncThunkSliceReducerDefinition;\n withTypes>(): AsyncThunkCreator>;\n}\nexport interface ReducerCreators {\n reducer(caseReducer: CaseReducer): CaseReducerDefinition;\n reducer(caseReducer: CaseReducer>): CaseReducerDefinition>;\n asyncThunk: AsyncThunkCreator;\n preparedReducer>(prepare: Prepare, reducer: CaseReducer>>): {\n _reducerDefinitionType: ReducerType.reducerWithPrepare;\n prepare: Prepare;\n reducer: CaseReducer>>;\n };\n}\n\n/**\n * The type describing a slice's `reducers` option.\n *\n * @public\n */\nexport type SliceCaseReducers = Record | Record> | CaseReducerWithPrepare>>;\n\n/**\n * The type describing a slice's `selectors` option.\n */\nexport type SliceSelectors = {\n [K: string]: (sliceState: State, ...args: any[]) => any;\n};\ntype SliceActionType = ActionName extends string | number ? `${SliceName}/${ActionName}` : string;\n\n/**\n * Derives the slice's `actions` property from the `reducers` options\n *\n * @public\n */\nexport type CaseReducerActions, SliceName extends string> = { [Type in keyof CaseReducers]: CaseReducers[Type] extends infer Definition ? Definition extends {\n prepare: any;\n} ? ActionCreatorForCaseReducerWithPrepare> : Definition extends AsyncThunkSliceReducerDefinition ? AsyncThunk : Definition extends {\n reducer: any;\n} ? ActionCreatorForCaseReducer> : ActionCreatorForCaseReducer> : never };\n\n/**\n * Get a `PayloadActionCreator` type for a passed `CaseReducerWithPrepare`\n *\n * @internal\n */\ntype ActionCreatorForCaseReducerWithPrepare = _ActionCreatorWithPreparedPayload;\n\n/**\n * Get a `PayloadActionCreator` type for a passed `CaseReducer`\n *\n * @internal\n */\ntype ActionCreatorForCaseReducer = CR extends (state: any, action: infer Action) => any ? Action extends {\n payload: infer P;\n} ? PayloadActionCreator : ActionCreatorWithoutPayload : ActionCreatorWithoutPayload;\n\n/**\n * Extracts the CaseReducers out of a `reducers` object, even if they are\n * tested into a `CaseReducerWithPrepare`.\n *\n * @internal\n */\ntype SliceDefinedCaseReducers> = { [Type in keyof CaseReducers]: CaseReducers[Type] extends infer Definition ? Definition extends AsyncThunkSliceReducerDefinition ? Id, 'fulfilled' | 'rejected' | 'pending' | 'settled'>> : Definition extends {\n reducer: infer Reducer;\n} ? Reducer : Definition : never };\ntype RemappedSelector = S extends Selector ? Selector & {\n unwrapped: S;\n} : never;\n\n/**\n * Extracts the final selector type from the `selectors` object.\n *\n * Removes the `string` index signature from the default value.\n */\ntype SliceDefinedSelectors, RootState> = { [K in keyof Selectors as string extends K ? never : K]: RemappedSelector };\n\n/**\n * Used on a SliceCaseReducers object.\n * Ensures that if a CaseReducer is a `CaseReducerWithPrepare`, that\n * the `reducer` and the `prepare` function use the same type of `payload`.\n *\n * Might do additional such checks in the future.\n *\n * This type is only ever useful if you want to write your own wrapper around\n * `createSlice`. Please don't use it otherwise!\n *\n * @public\n */\nexport type ValidateSliceCaseReducers> = ACR & { [T in keyof ACR]: ACR[T] extends {\n reducer(s: S, action?: infer A): any;\n} ? {\n prepare(...a: never[]): Omit;\n} : {} };\nfunction getType(slice: string, actionKey: string): string {\n return `${slice}/${actionKey}`;\n}\ninterface BuildCreateSliceConfig {\n creators?: {\n asyncThunk?: typeof asyncThunkCreator;\n };\n}\nexport function buildCreateSlice({\n creators\n}: BuildCreateSliceConfig = {}) {\n const cAT = creators?.asyncThunk?.[asyncThunkSymbol];\n return function createSlice, Name extends string, Selectors extends SliceSelectors, ReducerPath extends string = Name>(options: CreateSliceOptions): Slice {\n const {\n name,\n reducerPath = name as unknown as ReducerPath\n } = options;\n if (!name) {\n throw new Error(process.env.NODE_ENV === \"production\" ? _formatProdErrorMessage(11) : '`name` is a required option for createSlice');\n }\n if (typeof process !== 'undefined' && process.env.NODE_ENV === 'development') {\n if (options.initialState === undefined) {\n console.error('You must provide an `initialState` value that is not `undefined`. You may have misspelled `initialState`');\n }\n }\n const reducers = (typeof options.reducers === 'function' ? options.reducers(buildReducerCreators()) : options.reducers) || {};\n const reducerNames = Object.keys(reducers);\n const context: ReducerHandlingContext = {\n sliceCaseReducersByName: {},\n sliceCaseReducersByType: {},\n actionCreators: {},\n sliceMatchers: []\n };\n const contextMethods: ReducerHandlingContextMethods = {\n addCase(typeOrActionCreator: string | TypedActionCreator, reducer: CaseReducer) {\n const type = typeof typeOrActionCreator === 'string' ? typeOrActionCreator : typeOrActionCreator.type;\n if (!type) {\n throw new Error(process.env.NODE_ENV === \"production\" ? _formatProdErrorMessage2(12) : '`context.addCase` cannot be called with an empty action type');\n }\n if (type in context.sliceCaseReducersByType) {\n throw new Error(process.env.NODE_ENV === \"production\" ? _formatProdErrorMessage3(13) : '`context.addCase` cannot be called with two reducers for the same action type: ' + type);\n }\n context.sliceCaseReducersByType[type] = reducer;\n return contextMethods;\n },\n addMatcher(matcher, reducer) {\n context.sliceMatchers.push({\n matcher,\n reducer\n });\n return contextMethods;\n },\n exposeAction(name, actionCreator) {\n context.actionCreators[name] = actionCreator;\n return contextMethods;\n },\n exposeCaseReducer(name, reducer) {\n context.sliceCaseReducersByName[name] = reducer;\n return contextMethods;\n }\n };\n reducerNames.forEach(reducerName => {\n const reducerDefinition = reducers[reducerName];\n const reducerDetails: ReducerDetails = {\n reducerName,\n type: getType(name, reducerName),\n createNotation: typeof options.reducers === 'function'\n };\n if (isAsyncThunkSliceReducerDefinition(reducerDefinition)) {\n handleThunkCaseReducerDefinition(reducerDetails, reducerDefinition, contextMethods, cAT);\n } else {\n handleNormalReducerDefinition(reducerDetails, reducerDefinition as any, contextMethods);\n }\n });\n function buildReducer() {\n if (process.env.NODE_ENV !== 'production') {\n if (typeof options.extraReducers === 'object') {\n throw new Error(process.env.NODE_ENV === \"production\" ? _formatProdErrorMessage4(14) : \"The object notation for `createSlice.extraReducers` has been removed. Please use the 'builder callback' notation instead: https://redux-toolkit.js.org/api/createSlice\");\n }\n }\n const [extraReducers = {}, actionMatchers = [], defaultCaseReducer = undefined] = typeof options.extraReducers === 'function' ? executeReducerBuilderCallback(options.extraReducers) : [options.extraReducers];\n const finalCaseReducers = {\n ...extraReducers,\n ...context.sliceCaseReducersByType\n };\n return createReducer(options.initialState, builder => {\n for (let key in finalCaseReducers) {\n builder.addCase(key, finalCaseReducers[key] as CaseReducer);\n }\n for (let sM of context.sliceMatchers) {\n builder.addMatcher(sM.matcher, sM.reducer);\n }\n for (let m of actionMatchers) {\n builder.addMatcher(m.matcher, m.reducer);\n }\n if (defaultCaseReducer) {\n builder.addDefaultCase(defaultCaseReducer);\n }\n });\n }\n const selectSelf = (state: State) => state;\n const injectedSelectorCache = new Map State | undefined, Record any>>>();\n let _reducer: ReducerWithInitialState;\n function reducer(state: State | undefined, action: UnknownAction) {\n if (!_reducer) _reducer = buildReducer();\n return _reducer(state, action);\n }\n function getInitialState() {\n if (!_reducer) _reducer = buildReducer();\n return _reducer.getInitialState();\n }\n function makeSelectorProps(reducerPath: CurrentReducerPath, injected = false): Pick, 'getSelectors' | 'selectors' | 'selectSlice' | 'reducerPath'> {\n function selectSlice(state: { [K in CurrentReducerPath]: State }) {\n let sliceState = state[reducerPath];\n if (typeof sliceState === 'undefined') {\n if (injected) {\n sliceState = getInitialState();\n } else if (process.env.NODE_ENV !== 'production') {\n throw new Error(process.env.NODE_ENV === \"production\" ? _formatProdErrorMessage5(15) : 'selectSlice returned undefined for an uninjected slice reducer');\n }\n }\n return sliceState;\n }\n function getSelectors(selectState: (rootState: any) => State = selectSelf) {\n const selectorCache = getOrInsertComputed(injectedSelectorCache, injected, () => new WeakMap());\n return getOrInsertComputed(selectorCache, selectState, () => {\n const map: Record> = {};\n for (const [name, selector] of Object.entries(options.selectors ?? {})) {\n map[name] = wrapSelector(selector, selectState, getInitialState, injected);\n }\n return map;\n }) as any;\n }\n return {\n reducerPath,\n getSelectors,\n get selectors() {\n return getSelectors(selectSlice);\n },\n selectSlice\n };\n }\n const slice: Slice = {\n name,\n reducer,\n actions: context.actionCreators as any,\n caseReducers: context.sliceCaseReducersByName as any,\n getInitialState,\n ...makeSelectorProps(reducerPath),\n injectInto(injectable, {\n reducerPath: pathOpt,\n ...config\n } = {}) {\n const newReducerPath = pathOpt ?? reducerPath;\n injectable.inject({\n reducerPath: newReducerPath,\n reducer\n }, config);\n return {\n ...slice,\n ...makeSelectorProps(newReducerPath, true)\n } as any;\n }\n };\n return slice;\n };\n}\nfunction wrapSelector>(selector: S, selectState: Selector, getInitialState: () => State, injected?: boolean) {\n function wrapper(rootState: NewState, ...args: any[]) {\n let sliceState = selectState(rootState);\n if (typeof sliceState === 'undefined') {\n if (injected) {\n sliceState = getInitialState();\n } else if (process.env.NODE_ENV !== 'production') {\n throw new Error(process.env.NODE_ENV === \"production\" ? _formatProdErrorMessage6(16) : 'selectState returned undefined for an uninjected slice reducer');\n }\n }\n return selector(sliceState, ...args);\n }\n wrapper.unwrapped = selector;\n return wrapper as RemappedSelector;\n}\n\n/**\n * A function that accepts an initial state, an object full of reducer\n * functions, and a \"slice name\", and automatically generates\n * action creators and action types that correspond to the\n * reducers and state.\n *\n * @public\n */\nexport const createSlice = /* @__PURE__ */buildCreateSlice();\ninterface ReducerHandlingContext {\n sliceCaseReducersByName: Record | Pick, 'fulfilled' | 'rejected' | 'pending' | 'settled'>>;\n sliceCaseReducersByType: Record>;\n sliceMatchers: ActionMatcherDescriptionCollection;\n actionCreators: Record;\n}\ninterface ReducerHandlingContextMethods {\n /**\n * Adds a case reducer to handle a single action type.\n * @param actionCreator - Either a plain action type string, or an action creator generated by [`createAction`](./createAction) that can be used to determine the action type.\n * @param reducer - The actual case reducer function.\n */\n addCase>(actionCreator: ActionCreator, reducer: CaseReducer>): ReducerHandlingContextMethods;\n /**\n * Adds a case reducer to handle a single action type.\n * @param actionCreator - Either a plain action type string, or an action creator generated by [`createAction`](./createAction) that can be used to determine the action type.\n * @param reducer - The actual case reducer function.\n */\n addCase>(type: Type, reducer: CaseReducer): ReducerHandlingContextMethods;\n\n /**\n * Allows you to match incoming actions against your own filter function instead of only the `action.type` property.\n * @remarks\n * If multiple matcher reducers match, all of them will be executed in the order\n * they were defined in - even if a case reducer already matched.\n * All calls to `builder.addMatcher` must come after any calls to `builder.addCase` and before any calls to `builder.addDefaultCase`.\n * @param matcher - A matcher function. In TypeScript, this should be a [type predicate](https://www.typescriptlang.org/docs/handbook/2/narrowing.html#using-type-predicates)\n * function\n * @param reducer - The actual case reducer function.\n *\n */\n addMatcher(matcher: TypeGuard, reducer: CaseReducer): ReducerHandlingContextMethods;\n /**\n * Add an action to be exposed under the final `slice.actions` key.\n * @param name The key to be exposed as.\n * @param actionCreator The action to expose.\n * @example\n * context.exposeAction(\"addPost\", createAction(\"addPost\"));\n *\n * export const { addPost } = slice.actions\n *\n * dispatch(addPost(post))\n */\n exposeAction(name: string, actionCreator: Function): ReducerHandlingContextMethods;\n /**\n * Add a case reducer to be exposed under the final `slice.caseReducers` key.\n * @param name The key to be exposed as.\n * @param reducer The reducer to expose.\n * @example\n * context.exposeCaseReducer(\"addPost\", (state, action: PayloadAction) => {\n * state.push(action.payload)\n * })\n *\n * slice.caseReducers.addPost([], addPost(post))\n */\n exposeCaseReducer(name: string, reducer: CaseReducer | Pick, 'fulfilled' | 'rejected' | 'pending' | 'settled'>): ReducerHandlingContextMethods;\n}\ninterface ReducerDetails {\n /** The key the reducer was defined under */\n reducerName: string;\n /** The predefined action type, i.e. `${slice.name}/${reducerName}` */\n type: string;\n /** Whether create. notation was used when defining reducers */\n createNotation: boolean;\n}\nfunction buildReducerCreators(): ReducerCreators {\n function asyncThunk(payloadCreator: AsyncThunkPayloadCreator, config: AsyncThunkSliceReducerConfig): AsyncThunkSliceReducerDefinition {\n return {\n _reducerDefinitionType: ReducerType.asyncThunk,\n payloadCreator,\n ...config\n };\n }\n asyncThunk.withTypes = () => asyncThunk;\n return {\n reducer(caseReducer: CaseReducer) {\n return Object.assign({\n // hack so the wrapping function has the same name as the original\n // we need to create a wrapper so the `reducerDefinitionType` is not assigned to the original\n [caseReducer.name](...args: Parameters) {\n return caseReducer(...args);\n }\n }[caseReducer.name], {\n _reducerDefinitionType: ReducerType.reducer\n } as const);\n },\n preparedReducer(prepare, reducer) {\n return {\n _reducerDefinitionType: ReducerType.reducerWithPrepare,\n prepare,\n reducer\n };\n },\n asyncThunk: asyncThunk as any\n };\n}\nfunction handleNormalReducerDefinition({\n type,\n reducerName,\n createNotation\n}: ReducerDetails, maybeReducerWithPrepare: CaseReducer | CaseReducerWithPrepare>, context: ReducerHandlingContextMethods) {\n let caseReducer: CaseReducer;\n let prepareCallback: PrepareAction | undefined;\n if ('reducer' in maybeReducerWithPrepare) {\n if (createNotation && !isCaseReducerWithPrepareDefinition(maybeReducerWithPrepare)) {\n throw new Error(process.env.NODE_ENV === \"production\" ? _formatProdErrorMessage7(17) : 'Please use the `create.preparedReducer` notation for prepared action creators with the `create` notation.');\n }\n caseReducer = maybeReducerWithPrepare.reducer;\n prepareCallback = maybeReducerWithPrepare.prepare;\n } else {\n caseReducer = maybeReducerWithPrepare;\n }\n context.addCase(type, caseReducer).exposeCaseReducer(reducerName, caseReducer).exposeAction(reducerName, prepareCallback ? createAction(type, prepareCallback) : createAction(type));\n}\nfunction isAsyncThunkSliceReducerDefinition(reducerDefinition: any): reducerDefinition is AsyncThunkSliceReducerDefinition {\n return reducerDefinition._reducerDefinitionType === ReducerType.asyncThunk;\n}\nfunction isCaseReducerWithPrepareDefinition(reducerDefinition: any): reducerDefinition is CaseReducerWithPrepareDefinition {\n return reducerDefinition._reducerDefinitionType === ReducerType.reducerWithPrepare;\n}\nfunction handleThunkCaseReducerDefinition({\n type,\n reducerName\n}: ReducerDetails, reducerDefinition: AsyncThunkSliceReducerDefinition, context: ReducerHandlingContextMethods, cAT: typeof _createAsyncThunk | undefined) {\n if (!cAT) {\n throw new Error(process.env.NODE_ENV === \"production\" ? _formatProdErrorMessage8(18) : 'Cannot use `create.asyncThunk` in the built-in `createSlice`. ' + 'Use `buildCreateSlice({ creators: { asyncThunk: asyncThunkCreator } })` to create a customised version of `createSlice`.');\n }\n const {\n payloadCreator,\n fulfilled,\n pending,\n rejected,\n settled,\n options\n } = reducerDefinition;\n const thunk = cAT(type, payloadCreator, options as any);\n context.exposeAction(reducerName, thunk);\n if (fulfilled) {\n context.addCase(thunk.fulfilled, fulfilled);\n }\n if (pending) {\n context.addCase(thunk.pending, pending);\n }\n if (rejected) {\n context.addCase(thunk.rejected, rejected);\n }\n if (settled) {\n context.addMatcher(thunk.settled, settled);\n }\n context.exposeCaseReducer(reducerName, {\n fulfilled: fulfilled || noop,\n pending: pending || noop,\n rejected: rejected || noop,\n settled: settled || noop\n });\n}\nfunction noop() {}", "import type { EntityId, EntityState, EntityStateAdapter, EntityStateFactory } from './models';\nexport function getInitialEntityState(): EntityState {\n return {\n ids: [],\n entities: {} as Record\n };\n}\nexport function createInitialStateFactory(stateAdapter: EntityStateAdapter): EntityStateFactory {\n function getInitialState(state?: undefined, entities?: readonly T[] | Record): EntityState;\n function getInitialState(additionalState: S, entities?: readonly T[] | Record): EntityState & S;\n function getInitialState(additionalState: any = {}, entities?: readonly T[] | Record): any {\n const state = Object.assign(getInitialEntityState(), additionalState);\n return entities ? stateAdapter.setAll(state, entities) : state;\n }\n return {\n getInitialState\n };\n}", "import type { CreateSelectorFunction, Selector } from 'reselect';\nimport { createDraftSafeSelector } from '../createDraftSafeSelector';\nimport type { EntityId, EntitySelectors, EntityState } from './models';\ntype AnyFunction = (...args: any) => any;\ntype AnyCreateSelectorFunction = CreateSelectorFunction<(f: F) => F, (f: F) => F>;\nexport type GetSelectorsOptions = {\n createSelector?: AnyCreateSelectorFunction;\n};\nexport function createSelectorsFactory() {\n function getSelectors(selectState?: undefined, options?: GetSelectorsOptions): EntitySelectors, Id>;\n function getSelectors(selectState: (state: V) => EntityState, options?: GetSelectorsOptions): EntitySelectors;\n function getSelectors(selectState?: (state: V) => EntityState, options: GetSelectorsOptions = {}): EntitySelectors {\n const {\n createSelector = createDraftSafeSelector as AnyCreateSelectorFunction\n } = options;\n const selectIds = (state: EntityState) => state.ids;\n const selectEntities = (state: EntityState) => state.entities;\n const selectAll = createSelector(selectIds, selectEntities, (ids, entities): T[] => ids.map(id => entities[id]!));\n const selectId = (_: unknown, id: Id) => id;\n const selectById = (entities: Record, id: Id) => entities[id];\n const selectTotal = createSelector(selectIds, ids => ids.length);\n if (!selectState) {\n return {\n selectIds,\n selectEntities,\n selectAll,\n selectTotal,\n selectById: createSelector(selectEntities, selectId, selectById)\n };\n }\n const selectGlobalizedEntities = createSelector(selectState as Selector>, selectEntities);\n return {\n selectIds: createSelector(selectState, selectIds),\n selectEntities: selectGlobalizedEntities,\n selectAll: createSelector(selectState, selectAll),\n selectTotal: createSelector(selectState, selectTotal),\n selectById: createSelector(selectGlobalizedEntities, selectId, selectById)\n };\n }\n return {\n getSelectors\n };\n}", "import { produce as createNextState, isDraft } from 'immer';\nimport type { Draft } from 'immer';\nimport type { EntityId, DraftableEntityState, PreventAny } from './models';\nimport type { PayloadAction } from '../createAction';\nimport { isFSA } from '../createAction';\nexport const isDraftTyped = isDraft as (value: T | Draft) => value is Draft;\nexport function createSingleArgumentStateOperator(mutator: (state: DraftableEntityState) => void) {\n const operator = createStateOperator((_: undefined, state: DraftableEntityState) => mutator(state));\n return function operation>(state: PreventAny): S {\n return operator(state as S, undefined);\n };\n}\nexport function createStateOperator(mutator: (arg: R, state: DraftableEntityState) => void) {\n return function operation>(state: S, arg: R | PayloadAction): S {\n function isPayloadActionArgument(arg: R | PayloadAction): arg is PayloadAction {\n return isFSA(arg);\n }\n const runMutator = (draft: DraftableEntityState) => {\n if (isPayloadActionArgument(arg)) {\n mutator(arg.payload, draft);\n } else {\n mutator(arg, draft);\n }\n };\n if (isDraftTyped>(state)) {\n // we must already be inside a `createNextState` call, likely because\n // this is being wrapped in `createReducer` or `createSlice`.\n // It's safe to just pass the draft to the mutator.\n runMutator(state);\n\n // since it's a draft, we'll just return it\n return state;\n }\n return createNextState(state, runMutator);\n };\n}", "import type { Draft } from 'immer';\nimport { current, isDraft } from 'immer';\nimport type { DraftableEntityState, EntityId, IdSelector, Update } from './models';\nexport function selectIdValue(entity: T, selectId: IdSelector) {\n const key = selectId(entity);\n if (process.env.NODE_ENV !== 'production' && key === undefined) {\n console.warn('The entity passed to the `selectId` implementation returned undefined.', 'You should probably provide your own `selectId` implementation.', 'The entity that was passed:', entity, 'The `selectId` implementation:', selectId.toString());\n }\n return key;\n}\nexport function ensureEntitiesArray(entities: readonly T[] | Record): readonly T[] {\n if (!Array.isArray(entities)) {\n entities = Object.values(entities);\n }\n return entities;\n}\nexport function getCurrent(value: T | Draft): T {\n return (isDraft(value) ? current(value) : value) as T;\n}\nexport function splitAddedUpdatedEntities(newEntities: readonly T[] | Record, selectId: IdSelector, state: DraftableEntityState): [T[], Update[], Id[]] {\n newEntities = ensureEntitiesArray(newEntities);\n const existingIdsArray = getCurrent(state.ids);\n const existingIds = new Set(existingIdsArray);\n const added: T[] = [];\n const updated: Update[] = [];\n for (const entity of newEntities) {\n const id = selectIdValue(entity, selectId);\n if (existingIds.has(id)) {\n updated.push({\n id,\n changes: entity\n });\n } else {\n added.push(entity);\n }\n }\n return [added, updated, existingIdsArray];\n}", "import type { Draft } from 'immer';\nimport type { EntityStateAdapter, IdSelector, Update, EntityId, DraftableEntityState } from './models';\nimport { createStateOperator, createSingleArgumentStateOperator } from './state_adapter';\nimport { selectIdValue, ensureEntitiesArray, splitAddedUpdatedEntities } from './utils';\nexport function createUnsortedStateAdapter(selectId: IdSelector): EntityStateAdapter {\n type R = DraftableEntityState;\n function addOneMutably(entity: T, state: R): void {\n const key = selectIdValue(entity, selectId);\n if (key in state.entities) {\n return;\n }\n state.ids.push(key as Id & Draft);\n (state.entities as Record)[key] = entity;\n }\n function addManyMutably(newEntities: readonly T[] | Record, state: R): void {\n newEntities = ensureEntitiesArray(newEntities);\n for (const entity of newEntities) {\n addOneMutably(entity, state);\n }\n }\n function setOneMutably(entity: T, state: R): void {\n const key = selectIdValue(entity, selectId);\n if (!(key in state.entities)) {\n state.ids.push(key as Id & Draft);\n }\n ;\n (state.entities as Record)[key] = entity;\n }\n function setManyMutably(newEntities: readonly T[] | Record, state: R): void {\n newEntities = ensureEntitiesArray(newEntities);\n for (const entity of newEntities) {\n setOneMutably(entity, state);\n }\n }\n function setAllMutably(newEntities: readonly T[] | Record, state: R): void {\n newEntities = ensureEntitiesArray(newEntities);\n state.ids = [];\n state.entities = {} as Record;\n addManyMutably(newEntities, state);\n }\n function removeOneMutably(key: Id, state: R): void {\n return removeManyMutably([key], state);\n }\n function removeManyMutably(keys: readonly Id[], state: R): void {\n let didMutate = false;\n keys.forEach(key => {\n if (key in state.entities) {\n delete (state.entities as Record)[key];\n didMutate = true;\n }\n });\n if (didMutate) {\n state.ids = (state.ids as Id[]).filter(id => id in state.entities) as Id[] | Draft;\n }\n }\n function removeAllMutably(state: R): void {\n Object.assign(state, {\n ids: [],\n entities: {}\n });\n }\n function takeNewKey(keys: {\n [id: string]: Id;\n }, update: Update, state: R): boolean {\n const original: T | undefined = (state.entities as Record)[update.id];\n if (original === undefined) {\n return false;\n }\n const updated: T = Object.assign({}, original, update.changes);\n const newKey = selectIdValue(updated, selectId);\n const hasNewKey = newKey !== update.id;\n if (hasNewKey) {\n keys[update.id] = newKey;\n delete (state.entities as Record)[update.id];\n }\n ;\n (state.entities as Record)[newKey] = updated;\n return hasNewKey;\n }\n function updateOneMutably(update: Update, state: R): void {\n return updateManyMutably([update], state);\n }\n function updateManyMutably(updates: ReadonlyArray>, state: R): void {\n const newKeys: {\n [id: string]: Id;\n } = {};\n const updatesPerEntity: {\n [id: string]: Update;\n } = {};\n updates.forEach(update => {\n // Only apply updates to entities that currently exist\n if (update.id in state.entities) {\n // If there are multiple updates to one entity, merge them together\n updatesPerEntity[update.id] = {\n id: update.id,\n // Spreads ignore falsy values, so this works even if there isn't\n // an existing update already at this key\n changes: {\n ...updatesPerEntity[update.id]?.changes,\n ...update.changes\n }\n };\n }\n });\n updates = Object.values(updatesPerEntity);\n const didMutateEntities = updates.length > 0;\n if (didMutateEntities) {\n const didMutateIds = updates.filter(update => takeNewKey(newKeys, update, state)).length > 0;\n if (didMutateIds) {\n state.ids = Object.values(state.entities).map(e => selectIdValue(e as T, selectId));\n }\n }\n }\n function upsertOneMutably(entity: T, state: R): void {\n return upsertManyMutably([entity], state);\n }\n function upsertManyMutably(newEntities: readonly T[] | Record, state: R): void {\n const [added, updated] = splitAddedUpdatedEntities(newEntities, selectId, state);\n updateManyMutably(updated, state);\n addManyMutably(added, state);\n }\n return {\n removeAll: createSingleArgumentStateOperator(removeAllMutably),\n addOne: createStateOperator(addOneMutably),\n addMany: createStateOperator(addManyMutably),\n setOne: createStateOperator(setOneMutably),\n setMany: createStateOperator(setManyMutably),\n setAll: createStateOperator(setAllMutably),\n updateOne: createStateOperator(updateOneMutably),\n updateMany: createStateOperator(updateManyMutably),\n upsertOne: createStateOperator(upsertOneMutably),\n upsertMany: createStateOperator(upsertManyMutably),\n removeOne: createStateOperator(removeOneMutably),\n removeMany: createStateOperator(removeManyMutably)\n };\n}", "import type { IdSelector, Comparer, EntityStateAdapter, Update, EntityId, DraftableEntityState } from './models';\nimport { createStateOperator } from './state_adapter';\nimport { createUnsortedStateAdapter } from './unsorted_state_adapter';\nimport { selectIdValue, ensureEntitiesArray, splitAddedUpdatedEntities, getCurrent } from './utils';\n\n// Borrowed from Replay\nexport function findInsertIndex(sortedItems: T[], item: T, comparisonFunction: Comparer): number {\n let lowIndex = 0;\n let highIndex = sortedItems.length;\n while (lowIndex < highIndex) {\n let middleIndex = lowIndex + highIndex >>> 1;\n const currentItem = sortedItems[middleIndex];\n const res = comparisonFunction(item, currentItem);\n if (res >= 0) {\n lowIndex = middleIndex + 1;\n } else {\n highIndex = middleIndex;\n }\n }\n return lowIndex;\n}\nexport function insert(sortedItems: T[], item: T, comparisonFunction: Comparer): T[] {\n const insertAtIndex = findInsertIndex(sortedItems, item, comparisonFunction);\n sortedItems.splice(insertAtIndex, 0, item);\n return sortedItems;\n}\nexport function createSortedStateAdapter(selectId: IdSelector, comparer: Comparer): EntityStateAdapter {\n type R = DraftableEntityState;\n const {\n removeOne,\n removeMany,\n removeAll\n } = createUnsortedStateAdapter(selectId);\n function addOneMutably(entity: T, state: R): void {\n return addManyMutably([entity], state);\n }\n function addManyMutably(newEntities: readonly T[] | Record, state: R, existingIds?: Id[]): void {\n newEntities = ensureEntitiesArray(newEntities);\n const existingKeys = new Set(existingIds ?? getCurrent(state.ids));\n const models = newEntities.filter(model => !existingKeys.has(selectIdValue(model, selectId)));\n if (models.length !== 0) {\n mergeFunction(state, models);\n }\n }\n function setOneMutably(entity: T, state: R): void {\n return setManyMutably([entity], state);\n }\n function setManyMutably(newEntities: readonly T[] | Record, state: R): void {\n newEntities = ensureEntitiesArray(newEntities);\n if (newEntities.length !== 0) {\n for (const item of newEntities) {\n delete (state.entities as Record)[selectId(item)];\n }\n mergeFunction(state, newEntities);\n }\n }\n function setAllMutably(newEntities: readonly T[] | Record, state: R): void {\n newEntities = ensureEntitiesArray(newEntities);\n state.entities = {} as Record;\n state.ids = [];\n addManyMutably(newEntities, state, []);\n }\n function updateOneMutably(update: Update, state: R): void {\n return updateManyMutably([update], state);\n }\n function updateManyMutably(updates: ReadonlyArray>, state: R): void {\n let appliedUpdates = false;\n let replacedIds = false;\n for (let update of updates) {\n const entity: T | undefined = (state.entities as Record)[update.id];\n if (!entity) {\n continue;\n }\n appliedUpdates = true;\n Object.assign(entity, update.changes);\n const newId = selectId(entity);\n if (update.id !== newId) {\n // We do support the case where updates can change an item's ID.\n // This makes things trickier - go ahead and swap the IDs in state now.\n replacedIds = true;\n delete (state.entities as Record)[update.id];\n const oldIndex = (state.ids as Id[]).indexOf(update.id);\n state.ids[oldIndex] = newId;\n (state.entities as Record)[newId] = entity;\n }\n }\n if (appliedUpdates) {\n mergeFunction(state, [], appliedUpdates, replacedIds);\n }\n }\n function upsertOneMutably(entity: T, state: R): void {\n return upsertManyMutably([entity], state);\n }\n function upsertManyMutably(newEntities: readonly T[] | Record, state: R): void {\n const [added, updated, existingIdsArray] = splitAddedUpdatedEntities(newEntities, selectId, state);\n if (updated.length) {\n updateManyMutably(updated, state);\n }\n if (added.length) {\n addManyMutably(added, state, existingIdsArray);\n }\n }\n function areArraysEqual(a: readonly unknown[], b: readonly unknown[]) {\n if (a.length !== b.length) {\n return false;\n }\n for (let i = 0; i < a.length; i++) {\n if (a[i] === b[i]) {\n continue;\n }\n return false;\n }\n return true;\n }\n type MergeFunction = (state: R, addedItems: readonly T[], appliedUpdates?: boolean, replacedIds?: boolean) => void;\n const mergeFunction: MergeFunction = (state, addedItems, appliedUpdates, replacedIds) => {\n const currentEntities = getCurrent(state.entities);\n const currentIds = getCurrent(state.ids);\n const stateEntities = state.entities as Record;\n let ids: Iterable = currentIds;\n if (replacedIds) {\n ids = new Set(currentIds);\n }\n let sortedEntities: T[] = [];\n for (const id of ids) {\n const entity = currentEntities[id];\n if (entity) {\n sortedEntities.push(entity);\n }\n }\n const wasPreviouslyEmpty = sortedEntities.length === 0;\n\n // Insert/overwrite all new/updated\n for (const item of addedItems) {\n stateEntities[selectId(item)] = item;\n if (!wasPreviouslyEmpty) {\n // Binary search insertion generally requires fewer comparisons\n insert(sortedEntities, item, comparer);\n }\n }\n if (wasPreviouslyEmpty) {\n // All we have is the incoming values, sort them\n sortedEntities = addedItems.slice().sort(comparer);\n } else if (appliedUpdates) {\n // We should have a _mostly_-sorted array already\n sortedEntities.sort(comparer);\n }\n const newSortedIds = sortedEntities.map(selectId);\n if (!areArraysEqual(currentIds, newSortedIds)) {\n state.ids = newSortedIds;\n }\n };\n return {\n removeOne,\n removeMany,\n removeAll,\n addOne: createStateOperator(addOneMutably),\n updateOne: createStateOperator(updateOneMutably),\n upsertOne: createStateOperator(upsertOneMutably),\n setOne: createStateOperator(setOneMutably),\n setMany: createStateOperator(setManyMutably),\n setAll: createStateOperator(setAllMutably),\n addMany: createStateOperator(addManyMutably),\n updateMany: createStateOperator(updateManyMutably),\n upsertMany: createStateOperator(upsertManyMutably)\n };\n}", "import type { EntityAdapter, EntityId, EntityAdapterOptions } from './models';\nimport { createInitialStateFactory } from './entity_state';\nimport { createSelectorsFactory } from './state_selectors';\nimport { createSortedStateAdapter } from './sorted_state_adapter';\nimport { createUnsortedStateAdapter } from './unsorted_state_adapter';\nimport type { WithRequiredProp } from '../tsHelpers';\nexport function createEntityAdapter(options: WithRequiredProp, 'selectId'>): EntityAdapter;\nexport function createEntityAdapter(options?: Omit, 'selectId'>): EntityAdapter;\n\n/**\n *\n * @param options\n *\n * @public\n */\nexport function createEntityAdapter(options: EntityAdapterOptions = {}): EntityAdapter {\n const {\n selectId,\n sortComparer\n }: Required> = {\n sortComparer: false,\n selectId: (instance: any) => instance.id,\n ...options\n };\n const stateAdapter = sortComparer ? createSortedStateAdapter(selectId, sortComparer) : createUnsortedStateAdapter(selectId);\n const stateFactory = createInitialStateFactory(stateAdapter);\n const selectorsFactory = createSelectorsFactory();\n return {\n selectId,\n sortComparer,\n ...stateFactory,\n ...selectorsFactory,\n ...stateAdapter\n };\n}", "import { formatProdErrorMessage as _formatProdErrorMessage, formatProdErrorMessage as _formatProdErrorMessage2, formatProdErrorMessage as _formatProdErrorMessage3 } from \"@reduxjs/toolkit\";\nimport type { Action, Dispatch, MiddlewareAPI, UnknownAction } from 'redux';\nimport { isAction } from 'redux';\nimport type { ThunkDispatch } from 'redux-thunk';\nimport { createAction } from '../createAction';\nimport { nanoid } from '../nanoid';\nimport { TaskAbortError, listenerCancelled, listenerCompleted, taskCancelled, taskCompleted } from './exceptions';\nimport { createDelay, createPause, raceWithSignal, runTask, validateActive } from './task';\nimport type { AbortSignalWithReason, AddListenerOverloads, AnyListenerPredicate, CreateListenerMiddlewareOptions, FallbackAddListenerOptions, ForkOptions, ForkedTask, ForkedTaskExecutor, ListenerEntry, ListenerErrorHandler, ListenerErrorInfo, ListenerMiddleware, ListenerMiddlewareInstance, TakePattern, TaskResult, TypedAddListener, TypedCreateListenerEntry, TypedRemoveListener, UnsubscribeListener, UnsubscribeListenerOptions } from './types';\nimport { abortControllerWithReason, addAbortSignalListener, assertFunction, catchRejection, noop } from './utils';\nexport { TaskAbortError } from './exceptions';\nexport type { AsyncTaskExecutor, CreateListenerMiddlewareOptions, ForkedTask, ForkedTaskAPI, ForkedTaskExecutor, ListenerEffect, ListenerEffectAPI, ListenerErrorHandler, ListenerMiddleware, ListenerMiddlewareInstance, SyncTaskExecutor, TaskCancelled, TaskRejected, TaskResolved, TaskResult, TypedAddListener, TypedRemoveListener, TypedStartListening, TypedStopListening, UnsubscribeListener, UnsubscribeListenerOptions } from './types';\n\n//Overly-aggressive byte-shaving\nconst {\n assign\n} = Object;\n/**\n * @internal\n */\nconst INTERNAL_NIL_TOKEN = {} as const;\nconst alm = 'listenerMiddleware' as const;\nconst createFork = (parentAbortSignal: AbortSignalWithReason, parentBlockingPromises: Promise[]) => {\n const linkControllers = (controller: AbortController) => addAbortSignalListener(parentAbortSignal, () => abortControllerWithReason(controller, parentAbortSignal.reason));\n return (taskExecutor: ForkedTaskExecutor, opts?: ForkOptions): ForkedTask => {\n assertFunction(taskExecutor, 'taskExecutor');\n const childAbortController = new AbortController();\n linkControllers(childAbortController);\n const result = runTask(async (): Promise => {\n validateActive(parentAbortSignal);\n validateActive(childAbortController.signal);\n const result = (await taskExecutor({\n pause: createPause(childAbortController.signal),\n delay: createDelay(childAbortController.signal),\n signal: childAbortController.signal\n })) as T;\n validateActive(childAbortController.signal);\n return result;\n }, () => abortControllerWithReason(childAbortController, taskCompleted));\n if (opts?.autoJoin) {\n parentBlockingPromises.push(result.catch(noop));\n }\n return {\n result: createPause>(parentAbortSignal)(result),\n cancel() {\n abortControllerWithReason(childAbortController, taskCancelled);\n }\n };\n };\n};\nconst createTakePattern = (startListening: AddListenerOverloads, signal: AbortSignal): TakePattern => {\n /**\n * A function that takes a ListenerPredicate and an optional timeout,\n * and resolves when either the predicate returns `true` based on an action\n * state combination or when the timeout expires.\n * If the parent listener is canceled while waiting, this will throw a\n * TaskAbortError.\n */\n const take = async

,>(predicate: P, timeout: number | undefined) => {\n validateActive(signal);\n\n // Placeholder unsubscribe function until the listener is added\n let unsubscribe: UnsubscribeListener = () => {};\n const tuplePromise = new Promise<[Action, S, S]>((resolve, reject) => {\n // Inside the Promise, we synchronously add the listener.\n let stopListening = startListening({\n predicate: predicate as any,\n effect: (action, listenerApi): void => {\n // One-shot listener that cleans up as soon as the predicate passes\n listenerApi.unsubscribe();\n // Resolve the promise with the same arguments the predicate saw\n resolve([action, listenerApi.getState(), listenerApi.getOriginalState()]);\n }\n });\n unsubscribe = () => {\n stopListening();\n reject();\n };\n });\n const promises: (Promise | Promise<[Action, S, S]>)[] = [tuplePromise];\n if (timeout != null) {\n promises.push(new Promise(resolve => setTimeout(resolve, timeout, null)));\n }\n try {\n const output = await raceWithSignal(signal, Promise.race(promises));\n validateActive(signal);\n return output;\n } finally {\n // Always clean up the listener\n unsubscribe();\n }\n };\n return ((predicate: AnyListenerPredicate, timeout: number | undefined) => catchRejection(take(predicate, timeout))) as TakePattern;\n};\nconst getListenerEntryPropsFrom = (options: FallbackAddListenerOptions) => {\n let {\n type,\n actionCreator,\n matcher,\n predicate,\n effect\n } = options;\n if (type) {\n predicate = createAction(type).match;\n } else if (actionCreator) {\n type = actionCreator!.type;\n predicate = actionCreator.match;\n } else if (matcher) {\n predicate = matcher;\n } else if (predicate) {\n // pass\n } else {\n throw new Error(process.env.NODE_ENV === \"production\" ? _formatProdErrorMessage(21) : 'Creating or removing a listener requires one of the known fields for matching an action');\n }\n assertFunction(effect, 'options.listener');\n return {\n predicate,\n type,\n effect\n };\n};\n\n/** Accepts the possible options for creating a listener, and returns a formatted listener entry */\nexport const createListenerEntry: TypedCreateListenerEntry = /* @__PURE__ */assign((options: FallbackAddListenerOptions) => {\n const {\n type,\n predicate,\n effect\n } = getListenerEntryPropsFrom(options);\n const entry: ListenerEntry = {\n id: nanoid(),\n effect,\n type,\n predicate,\n pending: new Set(),\n unsubscribe: () => {\n throw new Error(process.env.NODE_ENV === \"production\" ? _formatProdErrorMessage2(22) : 'Unsubscribe not initialized');\n }\n };\n return entry;\n}, {\n withTypes: () => createListenerEntry\n}) as unknown as TypedCreateListenerEntry;\nconst findListenerEntry = (listenerMap: Map, options: FallbackAddListenerOptions) => {\n const {\n type,\n effect,\n predicate\n } = getListenerEntryPropsFrom(options);\n return Array.from(listenerMap.values()).find(entry => {\n const matchPredicateOrType = typeof type === 'string' ? entry.type === type : entry.predicate === predicate;\n return matchPredicateOrType && entry.effect === effect;\n });\n};\nconst cancelActiveListeners = (entry: ListenerEntry>) => {\n entry.pending.forEach(controller => {\n abortControllerWithReason(controller, listenerCancelled);\n });\n};\nconst createClearListenerMiddleware = (listenerMap: Map) => {\n return () => {\n listenerMap.forEach(cancelActiveListeners);\n listenerMap.clear();\n };\n};\n\n/**\n * Safely reports errors to the `errorHandler` provided.\n * Errors that occur inside `errorHandler` are notified in a new task.\n * Inspired by [rxjs reportUnhandledError](https://github.com/ReactiveX/rxjs/blob/6fafcf53dc9e557439b25debaeadfd224b245a66/src/internal/util/reportUnhandledError.ts)\n * @param errorHandler\n * @param errorToNotify\n */\nconst safelyNotifyError = (errorHandler: ListenerErrorHandler, errorToNotify: unknown, errorInfo: ListenerErrorInfo): void => {\n try {\n errorHandler(errorToNotify, errorInfo);\n } catch (errorHandlerError) {\n // We cannot let an error raised here block the listener queue.\n // The error raised here will be picked up by `window.onerror`, `process.on('error')` etc...\n setTimeout(() => {\n throw errorHandlerError;\n }, 0);\n }\n};\n\n/**\n * @public\n */\nexport const addListener = /* @__PURE__ */assign(/* @__PURE__ */createAction(`${alm}/add`), {\n withTypes: () => addListener\n}) as unknown as TypedAddListener;\n\n/**\n * @public\n */\nexport const clearAllListeners = /* @__PURE__ */createAction(`${alm}/removeAll`);\n\n/**\n * @public\n */\nexport const removeListener = /* @__PURE__ */assign(/* @__PURE__ */createAction(`${alm}/remove`), {\n withTypes: () => removeListener\n}) as unknown as TypedRemoveListener;\nconst defaultErrorHandler: ListenerErrorHandler = (...args: unknown[]) => {\n console.error(`${alm}/error`, ...args);\n};\n\n/**\n * @public\n */\nexport const createListenerMiddleware = = ThunkDispatch, ExtraArgument = unknown>(middlewareOptions: CreateListenerMiddlewareOptions = {}) => {\n const listenerMap = new Map();\n const {\n extra,\n onError = defaultErrorHandler\n } = middlewareOptions;\n assertFunction(onError, 'onError');\n const insertEntry = (entry: ListenerEntry) => {\n entry.unsubscribe = () => listenerMap.delete(entry.id);\n listenerMap.set(entry.id, entry);\n return (cancelOptions?: UnsubscribeListenerOptions) => {\n entry.unsubscribe();\n if (cancelOptions?.cancelActive) {\n cancelActiveListeners(entry);\n }\n };\n };\n const startListening = ((options: FallbackAddListenerOptions) => {\n const entry = findListenerEntry(listenerMap, options) ?? createListenerEntry(options as any);\n return insertEntry(entry);\n }) as AddListenerOverloads;\n assign(startListening, {\n withTypes: () => startListening\n });\n const stopListening = (options: FallbackAddListenerOptions & UnsubscribeListenerOptions): boolean => {\n const entry = findListenerEntry(listenerMap, options);\n if (entry) {\n entry.unsubscribe();\n if (options.cancelActive) {\n cancelActiveListeners(entry);\n }\n }\n return !!entry;\n };\n assign(stopListening, {\n withTypes: () => stopListening\n });\n const notifyListener = async (entry: ListenerEntry>, action: unknown, api: MiddlewareAPI, getOriginalState: () => StateType) => {\n const internalTaskController = new AbortController();\n const take = createTakePattern(startListening as AddListenerOverloads, internalTaskController.signal);\n const autoJoinPromises: Promise[] = [];\n try {\n entry.pending.add(internalTaskController);\n await Promise.resolve(entry.effect(action,\n // Use assign() rather than ... to avoid extra helper functions added to bundle\n assign({}, api, {\n getOriginalState,\n condition: (predicate: AnyListenerPredicate, timeout?: number) => take(predicate, timeout).then(Boolean),\n take,\n delay: createDelay(internalTaskController.signal),\n pause: createPause(internalTaskController.signal),\n extra,\n signal: internalTaskController.signal,\n fork: createFork(internalTaskController.signal, autoJoinPromises),\n unsubscribe: entry.unsubscribe,\n subscribe: () => {\n listenerMap.set(entry.id, entry);\n },\n cancelActiveListeners: () => {\n entry.pending.forEach((controller, _, set) => {\n if (controller !== internalTaskController) {\n abortControllerWithReason(controller, listenerCancelled);\n set.delete(controller);\n }\n });\n },\n cancel: () => {\n abortControllerWithReason(internalTaskController, listenerCancelled);\n entry.pending.delete(internalTaskController);\n },\n throwIfCancelled: () => {\n validateActive(internalTaskController.signal);\n }\n })));\n } catch (listenerError) {\n if (!(listenerError instanceof TaskAbortError)) {\n safelyNotifyError(onError, listenerError, {\n raisedBy: 'effect'\n });\n }\n } finally {\n await Promise.all(autoJoinPromises);\n abortControllerWithReason(internalTaskController, listenerCompleted); // Notify that the task has completed\n entry.pending.delete(internalTaskController);\n }\n };\n const clearListenerMiddleware = createClearListenerMiddleware(listenerMap);\n const middleware: ListenerMiddleware = api => next => action => {\n if (!isAction(action)) {\n // we only want to notify listeners for action objects\n return next(action);\n }\n if (addListener.match(action)) {\n return startListening(action.payload as any);\n }\n if (clearAllListeners.match(action)) {\n clearListenerMiddleware();\n return;\n }\n if (removeListener.match(action)) {\n return stopListening(action.payload);\n }\n\n // Need to get this state _before_ the reducer processes the action\n let originalState: StateType | typeof INTERNAL_NIL_TOKEN = api.getState();\n\n // `getOriginalState` can only be called synchronously.\n // @see https://github.com/reduxjs/redux-toolkit/discussions/1648#discussioncomment-1932820\n const getOriginalState = (): StateType => {\n if (originalState === INTERNAL_NIL_TOKEN) {\n throw new Error(process.env.NODE_ENV === \"production\" ? _formatProdErrorMessage3(23) : `${alm}: getOriginalState can only be called synchronously`);\n }\n return originalState as StateType;\n };\n let result: unknown;\n try {\n // Actually forward the action to the reducer before we handle listeners\n result = next(action);\n if (listenerMap.size > 0) {\n const currentState = api.getState();\n // Work around ESBuild+TS transpilation issue\n const listenerEntries = Array.from(listenerMap.values());\n for (const entry of listenerEntries) {\n let runListener = false;\n try {\n runListener = entry.predicate(action, currentState, originalState);\n } catch (predicateError) {\n runListener = false;\n safelyNotifyError(onError, predicateError, {\n raisedBy: 'predicate'\n });\n }\n if (!runListener) {\n continue;\n }\n notifyListener(entry, action, api, getOriginalState);\n }\n }\n } finally {\n // Remove `originalState` store from this scope.\n originalState = INTERNAL_NIL_TOKEN;\n }\n return result;\n };\n return {\n middleware,\n startListening,\n stopListening,\n clearListeners: clearListenerMiddleware\n } as ListenerMiddlewareInstance;\n};", "import type { SerializedError } from '@reduxjs/toolkit';\nconst task = 'task';\nconst listener = 'listener';\nconst completed = 'completed';\nconst cancelled = 'cancelled';\n\n/* TaskAbortError error codes */\nexport const taskCancelled = `task-${cancelled}` as const;\nexport const taskCompleted = `task-${completed}` as const;\nexport const listenerCancelled = `${listener}-${cancelled}` as const;\nexport const listenerCompleted = `${listener}-${completed}` as const;\nexport class TaskAbortError implements SerializedError {\n name = 'TaskAbortError';\n message: string;\n constructor(public code: string | undefined) {\n this.message = `${task} ${cancelled} (reason: ${code})`;\n }\n}", "import { formatProdErrorMessage as _formatProdErrorMessage } from \"@reduxjs/toolkit\";\nimport type { AbortSignalWithReason } from './types';\nexport const assertFunction: (func: unknown, expected: string) => asserts func is (...args: unknown[]) => unknown = (func: unknown, expected: string) => {\n if (typeof func !== 'function') {\n throw new TypeError(process.env.NODE_ENV === \"production\" ? _formatProdErrorMessage(32) : `${expected} is not a function`);\n }\n};\nexport const noop = () => {};\nexport const catchRejection = (promise: Promise, onError = noop): Promise => {\n promise.catch(onError);\n return promise;\n};\nexport const addAbortSignalListener = (abortSignal: AbortSignal, callback: (evt: Event) => void) => {\n abortSignal.addEventListener('abort', callback, {\n once: true\n });\n return () => abortSignal.removeEventListener('abort', callback);\n};\n\n/**\n * Calls `abortController.abort(reason)` and patches `signal.reason`.\n * if it is not supported.\n *\n * At the time of writing `signal.reason` is available in FF chrome, edge node 17 and deno.\n * @param abortController\n * @param reason\n * @returns\n * @see https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal/reason\n */\nexport const abortControllerWithReason = (abortController: AbortController, reason: T): void => {\n type Consumer = (val: T) => void;\n const signal = abortController.signal as AbortSignalWithReason;\n if (signal.aborted) {\n return;\n }\n\n // Patch `reason` if necessary.\n // - We use defineProperty here because reason is a getter of `AbortSignal.__proto__`.\n // - We need to patch 'reason' before calling `.abort()` because listeners to the 'abort'\n // event are are notified immediately.\n if (!('reason' in signal)) {\n Object.defineProperty(signal, 'reason', {\n enumerable: true,\n value: reason,\n configurable: true,\n writable: true\n });\n }\n ;\n (abortController.abort as Consumer)(reason);\n};", "import { TaskAbortError } from './exceptions';\nimport type { AbortSignalWithReason, TaskResult } from './types';\nimport { addAbortSignalListener, catchRejection, noop } from './utils';\n\n/**\n * Synchronously raises {@link TaskAbortError} if the task tied to the input `signal` has been cancelled.\n * @param signal\n * @param reason\n * @see {TaskAbortError}\n */\nexport const validateActive = (signal: AbortSignal): void => {\n if (signal.aborted) {\n const {\n reason\n } = signal as AbortSignalWithReason;\n throw new TaskAbortError(reason);\n }\n};\n\n/**\n * Generates a race between the promise(s) and the AbortSignal\n * This avoids `Promise.race()`-related memory leaks:\n * https://github.com/nodejs/node/issues/17469#issuecomment-349794909\n */\nexport function raceWithSignal(signal: AbortSignalWithReason, promise: Promise): Promise {\n let cleanup = noop;\n return new Promise((resolve, reject) => {\n const notifyRejection = () => reject(new TaskAbortError(signal.reason));\n if (signal.aborted) {\n notifyRejection();\n return;\n }\n cleanup = addAbortSignalListener(signal, notifyRejection);\n promise.finally(() => cleanup()).then(resolve, reject);\n }).finally(() => {\n // after this point, replace `cleanup` with a noop, so there is no reference to `signal` any more\n cleanup = noop;\n });\n}\n\n/**\n * Runs a task and returns promise that resolves to {@link TaskResult}.\n * Second argument is an optional `cleanUp` function that always runs after task.\n *\n * **Note:** `runTask` runs the executor in the next microtask.\n * @returns\n */\nexport const runTask = async (task: () => Promise, cleanUp?: () => void): Promise> => {\n try {\n await Promise.resolve();\n const value = await task();\n return {\n status: 'ok',\n value\n };\n } catch (error: any) {\n return {\n status: error instanceof TaskAbortError ? 'cancelled' : 'rejected',\n error\n };\n } finally {\n cleanUp?.();\n }\n};\n\n/**\n * Given an input `AbortSignal` and a promise returns another promise that resolves\n * as soon the input promise is provided or rejects as soon as\n * `AbortSignal.abort` is `true`.\n * @param signal\n * @returns\n */\nexport const createPause = (signal: AbortSignal) => {\n return (promise: Promise): Promise => {\n return catchRejection(raceWithSignal(signal, promise).then(output => {\n validateActive(signal);\n return output;\n }));\n };\n};\n\n/**\n * Given an input `AbortSignal` and `timeoutMs` returns a promise that resolves\n * after `timeoutMs` or rejects as soon as `AbortSignal.abort` is `true`.\n * @param signal\n * @returns\n */\nexport const createDelay = (signal: AbortSignal) => {\n const pause = createPause(signal);\n return (timeoutMs: number): Promise => {\n return pause(new Promise(resolve => setTimeout(resolve, timeoutMs)));\n };\n};", "import type { Dispatch, Middleware, UnknownAction } from 'redux';\nimport { compose } from 'redux';\nimport { createAction } from '../createAction';\nimport { isAllOf } from '../matchers';\nimport { nanoid } from '../nanoid';\nimport { getOrInsertComputed } from '../utils';\nimport type { AddMiddleware, DynamicMiddleware, DynamicMiddlewareInstance, MiddlewareEntry, WithMiddleware } from './types';\nexport type { DynamicMiddlewareInstance, GetDispatchType as GetDispatch, MiddlewareApiConfig } from './types';\nconst createMiddlewareEntry = = Dispatch>(middleware: Middleware): MiddlewareEntry => ({\n middleware,\n applied: new Map()\n});\nconst matchInstance = (instanceId: string) => (action: any): action is {\n meta: {\n instanceId: string;\n };\n} => action?.meta?.instanceId === instanceId;\nexport const createDynamicMiddleware = = Dispatch>(): DynamicMiddlewareInstance => {\n const instanceId = nanoid();\n const middlewareMap = new Map, MiddlewareEntry>();\n const withMiddleware = Object.assign(createAction('dynamicMiddleware/add', (...middlewares: Middleware[]) => ({\n payload: middlewares,\n meta: {\n instanceId\n }\n })), {\n withTypes: () => withMiddleware\n }) as WithMiddleware;\n const addMiddleware = Object.assign(function addMiddleware(...middlewares: Middleware[]) {\n middlewares.forEach(middleware => {\n getOrInsertComputed(middlewareMap, middleware, createMiddlewareEntry);\n });\n }, {\n withTypes: () => addMiddleware\n }) as AddMiddleware;\n const getFinalMiddleware: Middleware<{}, State, DispatchType> = api => {\n const appliedMiddleware = Array.from(middlewareMap.values()).map(entry => getOrInsertComputed(entry.applied, api, entry.middleware));\n return compose(...appliedMiddleware);\n };\n const isWithMiddleware = isAllOf(withMiddleware, matchInstance(instanceId));\n const middleware: DynamicMiddleware = api => next => action => {\n if (isWithMiddleware(action)) {\n addMiddleware(...action.payload);\n return api.dispatch;\n }\n return getFinalMiddleware(api)(next)(action);\n };\n return {\n middleware,\n addMiddleware,\n withMiddleware,\n instanceId\n };\n};", "import { formatProdErrorMessage as _formatProdErrorMessage, formatProdErrorMessage as _formatProdErrorMessage2 } from \"@reduxjs/toolkit\";\nimport type { Reducer, StateFromReducersMapObject, UnknownAction } from 'redux';\nimport { combineReducers } from 'redux';\nimport { nanoid } from './nanoid';\nimport type { Id, NonUndefined, Tail, UnionToIntersection, WithOptionalProp } from './tsHelpers';\nimport { getOrInsertComputed } from './utils';\ntype SliceLike = {\n reducerPath: ReducerPath;\n reducer: Reducer;\n};\ntype AnySliceLike = SliceLike;\ntype SliceLikeReducerPath = A extends SliceLike ? ReducerPath : never;\ntype SliceLikeState = A extends SliceLike ? State : never;\nexport type WithSlice = { [Path in SliceLikeReducerPath]: SliceLikeState };\ntype ReducerMap = Record;\ntype ExistingSliceLike = { [ReducerPath in keyof DeclaredState]: SliceLike> }[keyof DeclaredState];\nexport type InjectConfig = {\n /**\n * Allow replacing reducer with a different reference. Normally, an error will be thrown if a different reducer instance to the one already injected is used.\n */\n overrideExisting?: boolean;\n};\n\n/**\n * A reducer that allows for slices/reducers to be injected after initialisation.\n */\nexport interface CombinedSliceReducer extends Reducer> {\n /**\n * Provide a type for slices that will be injected lazily.\n *\n * One way to do this would be with interface merging:\n * ```ts\n *\n * export interface LazyLoadedSlices {}\n *\n * export const rootReducer = combineSlices(stringSlice).withLazyLoadedSlices();\n *\n * // elsewhere\n *\n * declare module './reducer' {\n * export interface LazyLoadedSlices extends WithSlice {}\n * }\n *\n * const withBoolean = rootReducer.inject(booleanSlice);\n *\n * // elsewhere again\n *\n * declare module './reducer' {\n * export interface LazyLoadedSlices {\n * customName: CustomState\n * }\n * }\n *\n * const withCustom = rootReducer.inject({ reducerPath: \"customName\", reducer: customSlice.reducer })\n * ```\n */\n withLazyLoadedSlices(): CombinedSliceReducer>>;\n\n /**\n * Inject a slice.\n *\n * Accepts an individual slice, RTKQ API instance, or a \"slice-like\" { reducerPath, reducer } object.\n *\n * ```ts\n * rootReducer.inject(booleanSlice)\n * rootReducer.inject(baseApi)\n * rootReducer.inject({ reducerPath: 'boolean' as const, reducer: newReducer }, { overrideExisting: true })\n * ```\n *\n */\n inject>>(slice: Sl, config?: InjectConfig): CombinedSliceReducer>>;\n\n /**\n * Inject a slice.\n *\n * Accepts an individual slice, RTKQ API instance, or a \"slice-like\" { reducerPath, reducer } object.\n *\n * ```ts\n * rootReducer.inject(booleanSlice)\n * rootReducer.inject(baseApi)\n * rootReducer.inject({ reducerPath: 'boolean' as const, reducer: newReducer }, { overrideExisting: true })\n * ```\n *\n */\n inject(slice: SliceLike, config?: InjectConfig): CombinedSliceReducer>>>;\n\n /**\n * Create a selector that guarantees that the slices injected will have a defined value when selector is run.\n *\n * ```ts\n * const selectBooleanWithoutInjection = (state: RootState) => state.boolean;\n * // ^? boolean | undefined\n *\n * const selectBoolean = rootReducer.inject(booleanSlice).selector((state) => {\n * // if action hasn't been dispatched since slice was injected, this would usually be undefined\n * // however selector() uses a Proxy around the first parameter to ensure that it evaluates to the initial state instead, if undefined\n * return state.boolean;\n * // ^? boolean\n * })\n * ```\n *\n * If the reducer is nested inside the root state, a selectState callback can be passed to retrieve the reducer's state.\n *\n * ```ts\n *\n * export interface LazyLoadedSlices {};\n *\n * export const innerReducer = combineSlices(stringSlice).withLazyLoadedSlices();\n *\n * export const rootReducer = combineSlices({ inner: innerReducer });\n *\n * export type RootState = ReturnType;\n *\n * // elsewhere\n *\n * declare module \"./reducer.ts\" {\n * export interface LazyLoadedSlices extends WithSlice {}\n * }\n *\n * const withBool = innerReducer.inject(booleanSlice);\n *\n * const selectBoolean = withBool.selector(\n * (state) => state.boolean,\n * (rootState: RootState) => state.inner\n * );\n * // now expects to be passed RootState instead of innerReducer state\n *\n * ```\n *\n * Value passed to selectorFn will be a Proxy - use selector.original(proxy) to get original state value (useful for debugging)\n *\n * ```ts\n * const injectedReducer = rootReducer.inject(booleanSlice);\n * const selectBoolean = injectedReducer.selector((state) => {\n * console.log(injectedReducer.selector.original(state).boolean) // possibly undefined\n * return state.boolean\n * })\n * ```\n */\n selector: {\n /**\n * Create a selector that guarantees that the slices injected will have a defined value when selector is run.\n *\n * ```ts\n * const selectBooleanWithoutInjection = (state: RootState) => state.boolean;\n * // ^? boolean | undefined\n *\n * const selectBoolean = rootReducer.inject(booleanSlice).selector((state) => {\n * // if action hasn't been dispatched since slice was injected, this would usually be undefined\n * // however selector() uses a Proxy around the first parameter to ensure that it evaluates to the initial state instead, if undefined\n * return state.boolean;\n * // ^? boolean\n * })\n * ```\n *\n * Value passed to selectorFn will be a Proxy - use selector.original(proxy) to get original state value (useful for debugging)\n *\n * ```ts\n * const injectedReducer = rootReducer.inject(booleanSlice);\n * const selectBoolean = injectedReducer.selector((state) => {\n * console.log(injectedReducer.selector.original(state).boolean) // undefined\n * return state.boolean\n * })\n * ```\n */\n unknown>(selectorFn: Selector): (state: WithOptionalProp[0], Exclude>, ...args: Tail>) => ReturnType;\n\n /**\n * Create a selector that guarantees that the slices injected will have a defined value when selector is run.\n *\n * ```ts\n * const selectBooleanWithoutInjection = (state: RootState) => state.boolean;\n * // ^? boolean | undefined\n *\n * const selectBoolean = rootReducer.inject(booleanSlice).selector((state) => {\n * // if action hasn't been dispatched since slice was injected, this would usually be undefined\n * // however selector() uses a Proxy around the first parameter to ensure that it evaluates to the initial state instead, if undefined\n * return state.boolean;\n * // ^? boolean\n * })\n * ```\n *\n * If the reducer is nested inside the root state, a selectState callback can be passed to retrieve the reducer's state.\n *\n * ```ts\n *\n * interface LazyLoadedSlices {};\n *\n * const innerReducer = combineSlices(stringSlice).withLazyLoadedSlices();\n *\n * const rootReducer = combineSlices({ inner: innerReducer });\n *\n * type RootState = ReturnType;\n *\n * // elsewhere\n *\n * declare module \"./reducer.ts\" {\n * interface LazyLoadedSlices extends WithSlice {}\n * }\n *\n * const withBool = innerReducer.inject(booleanSlice);\n *\n * const selectBoolean = withBool.selector(\n * (state) => state.boolean,\n * (rootState: RootState) => state.inner\n * );\n * // now expects to be passed RootState instead of innerReducer state\n *\n * ```\n *\n * Value passed to selectorFn will be a Proxy - use selector.original(proxy) to get original state value (useful for debugging)\n *\n * ```ts\n * const injectedReducer = rootReducer.inject(booleanSlice);\n * const selectBoolean = injectedReducer.selector((state) => {\n * console.log(injectedReducer.selector.original(state).boolean) // possibly undefined\n * return state.boolean\n * })\n * ```\n */\n unknown, RootState>(selectorFn: Selector, selectState: (rootState: RootState, ...args: Tail>) => WithOptionalProp[0], Exclude>): (state: RootState, ...args: Tail>) => ReturnType;\n /**\n * Returns the unproxied state. Useful for debugging.\n * @param state state Proxy, that ensures injected reducers have value\n * @returns original, unproxied state\n * @throws if value passed is not a state Proxy\n */\n original: (state: DeclaredState) => InitialState & Partial;\n };\n}\ntype InitialState> = UnionToIntersection : StateFromReducersMapObject : never>;\nconst isSliceLike = (maybeSliceLike: AnySliceLike | ReducerMap): maybeSliceLike is AnySliceLike => 'reducerPath' in maybeSliceLike && typeof maybeSliceLike.reducerPath === 'string';\nconst getReducers = (slices: Array) => slices.flatMap(sliceOrMap => isSliceLike(sliceOrMap) ? [[sliceOrMap.reducerPath, sliceOrMap.reducer] as const] : Object.entries(sliceOrMap));\nconst ORIGINAL_STATE = Symbol.for('rtk-state-proxy-original');\nconst isStateProxy = (value: any) => !!value && !!value[ORIGINAL_STATE];\nconst stateProxyMap = new WeakMap();\nconst createStateProxy = (state: State, reducerMap: Partial>) => getOrInsertComputed(stateProxyMap, state, () => new Proxy(state, {\n get: (target, prop, receiver) => {\n if (prop === ORIGINAL_STATE) return target;\n const result = Reflect.get(target, prop, receiver);\n if (typeof result === 'undefined') {\n const reducer = reducerMap[prop.toString()];\n if (reducer) {\n // ensure action type is random, to prevent reducer treating it differently\n const reducerResult = reducer(undefined, {\n type: nanoid()\n });\n if (typeof reducerResult === 'undefined') {\n throw new Error(process.env.NODE_ENV === \"production\" ? _formatProdErrorMessage(24) : `The slice reducer for key \"${prop.toString()}\" returned undefined when called for selector(). ` + `If the state passed to the reducer is undefined, you must ` + `explicitly return the initial state. The initial state may ` + `not be undefined. If you don't want to set a value for this reducer, ` + `you can use null instead of undefined.`);\n }\n return reducerResult;\n }\n }\n return result;\n }\n})) as State;\nconst original = (state: any) => {\n if (!isStateProxy(state)) {\n throw new Error(process.env.NODE_ENV === \"production\" ? _formatProdErrorMessage2(25) : 'original must be used on state Proxy');\n }\n return state[ORIGINAL_STATE];\n};\nconst noopReducer: Reducer> = (state = {}) => state;\nexport function combineSlices>(...slices: Slices): CombinedSliceReducer>> {\n const reducerMap = Object.fromEntries(getReducers(slices));\n const getReducer = () => Object.keys(reducerMap).length ? combineReducers(reducerMap) : noopReducer;\n let reducer = getReducer();\n function combinedReducer(state: Record, action: UnknownAction) {\n return reducer(state, action);\n }\n combinedReducer.withLazyLoadedSlices = () => combinedReducer;\n const inject = (slice: AnySliceLike, config: InjectConfig = {}): typeof combinedReducer => {\n const {\n reducerPath,\n reducer: reducerToInject\n } = slice;\n const currentReducer = reducerMap[reducerPath];\n if (!config.overrideExisting && currentReducer && currentReducer !== reducerToInject) {\n if (typeof process !== 'undefined' && process.env.NODE_ENV === 'development') {\n console.error(`called \\`inject\\` to override already-existing reducer ${reducerPath} without specifying \\`overrideExisting: true\\``);\n }\n return combinedReducer;\n }\n reducerMap[reducerPath] = reducerToInject;\n reducer = getReducer();\n return combinedReducer;\n };\n const selector = Object.assign(function makeSelector(selectorFn: (state: State, ...args: Args) => any, selectState?: (rootState: RootState, ...args: Args) => State) {\n return function selector(state: State, ...args: Args) {\n return selectorFn(createStateProxy(selectState ? selectState(state as any, ...args) : state, reducerMap), ...args);\n };\n }, {\n original\n });\n return Object.assign(combinedReducer, {\n inject,\n selector\n }) as any;\n}", "/**\n * Adapted from React: https://github.com/facebook/react/blob/master/packages/shared/formatProdErrorMessage.js\n *\n * Do not require this module directly! Use normal throw error calls. These messages will be replaced with error codes\n * during build.\n * @param {number} code\n */\nexport function formatProdErrorMessage(code: number) {\n return `Minified Redux Toolkit error #${code}; visit https://redux-toolkit.js.org/Errors?code=${code} for the full message or ` + 'use the non-minified dev environment for full errors. ';\n}"], "mappings": "6DAAA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,GACjCI,GAAoB,GAAGL,EAAQ,IAAIE,EAAS,GAC5CI,GAAoB,GAAGN,EAAQ,IAAIC,EAAS,GDIzD,GAAM,CACJ,OAAAM,EACF,EAAI,OAKJ,IAAMC,EAAM,qBAuKL,IAAMC,GAA6BC,GAAsBC,EAAa,GAAGC,CAAG,MAAM,EAAG,CAC1F,UAAW,IAAMH,EACnB,CAAC,EAKYI,GAAmCF,EAAa,GAAGC,CAAG,YAAY,EAKlEE,GAAgCJ,GAAsBC,EAAa,GAAGC,CAAG,SAAS,EAAG,CAChG,UAAW,IAAME,EACnB,CAAC,EK+BD,IAAMC,GAAiB,OAAO,IAAI,0BAA0B,EClOrD,SAASC,GAAuBC,EAAc,CACnD,MAAO,iCAAiCA,CAAI,oDAAoDA,CAAI,iFACtG", "names": ["require_use_sync_external_store_with_selector_production", "__commonJSMin", "exports", "React", "is", "x", "y", "objectIs", "useSyncExternalStore", "useRef", "useEffect", "useMemo", "useDebugValue", "subscribe", "getSnapshot", "getServerSnapshot", "selector", "isEqual", "instRef", "inst", "memoizedSelector", "nextSnapshot", "hasMemo", "memoizedSnapshot", "currentSelection", "memoizedSelection", "nextSelection", "maybeGetServerSnapshot", "value", "require_with_selector", "__commonJSMin", "exports", "module", "React", "import_with_selector", "REACT_FORWARD_REF_TYPE", "REACT_MEMO_TYPE", "ForwardRef", "REACT_FORWARD_REF_TYPE", "Memo", "REACT_MEMO_TYPE", "defaultNoopBatch", "callback", "createListenerCollection", "first", "last", "listener", "listeners", "isSubscribed", "nullListeners", "createSubscription", "store", "parentSub", "unsubscribe", "subscriptionsAmount", "selfSubscribed", "addNestedSub", "trySubscribe", "cleanupListener", "removed", "tryUnsubscribe", "notifyNestedSubs", "handleChangeWrapper", "subscription", "trySubscribeSelf", "tryUnsubscribeSelf", "canUseDOM", "isDOM", "isRunningInReactNative", "isReactNative", "getUseIsomorphicLayoutEffect", "useIsomorphicLayoutEffect", "FORWARD_REF_STATICS", "MEMO_STATICS", "TYPE_STATICS", "ForwardRef", "Memo", "objectPrototype", "ContextKey", "gT", "getContext", "contextMap", "realContext", "ReactReduxContext", "Provider", "providerProps", "children", "context", "serverState", "store", "contextValue", "subscription", "createSubscription", "previousState", "useIsomorphicLayoutEffect", "ReactReduxContext", "Provider_default", "createReduxContextHook", "useReduxContext", "createStoreHook", "useStore", "createDispatchHook", "useDispatch", "refEquality", "a", "b", "createSelectorHook", "useSelector", "selector", "equalityFnOrOptions", "equalityFn", "reduxContext", "getServerState", "firstRun", "wrappedSelector", "state", "selectedState", "formatProdErrorMessage", "code", "$$observable", "symbol_observable_default", "randomString", "ActionTypes", "actionTypes_default", "isPlainObject", "obj", "proto", "createStore", "reducer", "preloadedState", "enhancer", "formatProdErrorMessage", "currentReducer", "currentState", "currentListeners", "nextListeners", "listenerIdCounter", "isDispatching", "ensureCanMutateNextListeners", "listener", "key", "getState", "subscribe", "isSubscribed", "listenerId", "dispatch", "action", "isPlainObject", "replaceReducer", "nextReducer", "actionTypes_default", "observable", "outerSubscribe", "observer", "observeState", "observerAsObserver", "symbol_observable_default", "assertReducerShape", "reducers", "key", "reducer", "actionTypes_default", "formatProdErrorMessage", "combineReducers", "reducerKeys", "finalReducers", "i", "finalReducerKeys", "unexpectedKeyCache", "shapeAssertionError", "e", "state", "action", "hasChanged", "nextState", "previousStateForKey", "nextStateForKey", "actionType", "bindActionCreator", "actionCreator", "dispatch", "args", "bindActionCreators", "actionCreators", "boundActionCreators", "compose", "funcs", "arg", "a", "b", "applyMiddleware", "middlewares", "createStore", "preloadedState", "store", "middlewareAPI", "chain", "middleware", "isAction", "isPlainObject", "assertIsFunction", "func", "errorMessage", "assertIsObject", "object", "assertIsArrayOfFunctions", "array", "item", "itemTypes", "ensureIsArray", "getDependencies", "createSelectorArgs", "dependencies", "collectInputSelectorResults", "inputSelectorArgs", "inputSelectorResults", "length", "i", "REDUX_PROXY_LABEL", "proto", "StrongRef", "value", "Ref", "UNTERMINATED", "TERMINATED", "createCacheNode", "weakMapMemoize", "func", "options", "fnNode", "resultEqualityCheck", "lastResult", "resultsCount", "memoized", "cacheNode", "length", "i", "l", "arg", "objectCache", "objectNode", "primitiveCache", "primitiveNode", "terminatedNode", "result", "lastResultValue", "createSelectorCreator", "memoizeOrOptions", "memoizeOptionsFromArgs", "createSelectorCreatorOptions", "createSelector", "createSelectorArgs", "recomputations", "dependencyRecomputations", "directlyPassedOptions", "resultFunc", "assertIsFunction", "combinedOptions", "memoize", "memoizeOptions", "argsMemoize", "argsMemoizeOptions", "devModeChecks", "finalMemoizeOptions", "ensureIsArray", "finalArgsMemoizeOptions", "dependencies", "getDependencies", "memoizedResultFunc", "firstRun", "selector", "inputSelectorResults", "collectInputSelectorResults", "createStructuredSelector", "inputSelectorsObject", "selectorCreator", "assertIsObject", "inputSelectorKeys", "key", "composition", "index", "createThunkMiddleware", "extraArgument", "dispatch", "getState", "next", "action", "thunk", "withExtraArgument", "composeWithDevTools", "compose", "devToolsEnhancer", "noop", "hasMatchFunction", "v", "createAction", "type", "prepareAction", "actionCreator", "args", "prepared", "formatProdErrorMessage", "action", "isAction", "Tuple", "_Tuple", "items", "arr", "isBoolean", "x", "buildGetDefaultMiddleware", "options", "thunk", "immutableCheck", "serializableCheck", "actionCreatorCheck", "middlewareArray", "Tuple", "withExtraArgument", "SHOULD_AUTOBATCH", "createQueueWithTimer", "timeout", "notify", "autoBatchEnhancer", "options", "next", "args", "store", "notifying", "shouldNotifyAtEndOfTick", "notificationQueued", "listeners", "queueCallback", "notifyListeners", "l", "listener", "wrappedListener", "unsubscribe", "action", "SHOULD_AUTOBATCH", "buildGetDefaultEnhancers", "middlewareEnhancer", "autoBatch", "enhancerArray", "Tuple", "configureStore", "getDefaultMiddleware", "buildGetDefaultMiddleware", "reducer", "middleware", "devTools", "preloadedState", "enhancers", "rootReducer", "isPlainObject", "combineReducers", "formatProdErrorMessage", "finalMiddleware", "finalCompose", "compose", "composeWithDevTools", "applyMiddleware", "getDefaultEnhancers", "storeEnhancers", "composedEnhancer", "createStore", "matches", "matcher", "action", "hasMatchFunction", "isAnyOf", "matchers", "urlAlphabet", "nanoid", "size", "id", "i", "commonProperties", "RejectWithValue", "payload", "meta", "FulfillWithMeta", "miniSerializeError", "value", "simpleError", "property", "externalAbortMessage", "createAsyncThunk", "typePrefix", "payloadCreator", "options", "fulfilled", "createAction", "requestId", "arg", "pending", "rejected", "error", "actionCreator", "signal", "dispatch", "getState", "extra", "abortController", "abortHandler", "abortReason", "abort", "reason", "promise", "finalAction", "conditionResult", "isThenable", "abortedPromise", "_", "reject", "result", "err", "unwrapResult", "isAnyOf", "action", "asyncThunkSymbol", "asyncThunkCreator", "listener", "completed", "cancelled", "taskCancelled", "taskCompleted", "listenerCancelled", "listenerCompleted", "assign", "alm", "addListener", "assign", "createAction", "alm", "clearAllListeners", "removeListener", "ORIGINAL_STATE", "formatProdErrorMessage", "code"] }