{ "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/debounce/index.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", "../app/Helpers/ReactHelpers.tsx", "../../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/immer/src/utils/env.ts", "../../node_modules/immer/src/utils/errors.ts", "../../node_modules/immer/src/utils/common.ts", "../../node_modules/immer/src/utils/plugins.ts", "../../node_modules/immer/src/core/scope.ts", "../../node_modules/immer/src/core/finalize.ts", "../../node_modules/immer/src/core/proxy.ts", "../../node_modules/immer/src/core/immerClass.ts", "../../node_modules/immer/src/core/current.ts", "../../node_modules/immer/src/plugins/patches.ts", "../../node_modules/immer/src/plugins/mapset.ts", "../../node_modules/immer/src/immer.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", "../app/Store.ts", "../app/Models/Urls.ts", "../app/Notifications/Notify.tsx", "../../node/Common/Topbar.ts", "../app/Services/Progress.ts", "../app/Station/StationApi.ts", "../app/Station/StationStore.ts", "../app/Stations/StationsStore.ts", "../app/Search/SearchStore.ts", "../app/Search/SearchApi.ts", "../../node_modules/date-fns/locale/en-US/_lib/formatDistance.js", "../../node_modules/date-fns/locale/_lib/buildFormatLongFn.js", "../../node_modules/date-fns/locale/en-US/_lib/formatLong.js", "../../node_modules/date-fns/locale/en-US/_lib/formatRelative.js", "../../node_modules/date-fns/locale/_lib/buildLocalizeFn.js", "../../node_modules/date-fns/locale/en-US/_lib/localize.js", "../../node_modules/date-fns/locale/_lib/buildMatchFn.js", "../../node_modules/date-fns/locale/_lib/buildMatchPatternFn.js", "../../node_modules/date-fns/locale/en-US/_lib/match.js", "../../node_modules/date-fns/locale/en-US.js", "../../node_modules/date-fns/_lib/defaultOptions.js", "../../node_modules/date-fns/constants.js", "../../node_modules/date-fns/constructFrom.js", "../../node_modules/date-fns/toDate.js", "../../node_modules/date-fns/_lib/getTimezoneOffsetInMilliseconds.js", "../../node_modules/date-fns/_lib/normalizeDates.js", "../../node_modules/date-fns/startOfDay.js", "../../node_modules/date-fns/differenceInCalendarDays.js", "../../node_modules/date-fns/startOfYear.js", "../../node_modules/date-fns/getDayOfYear.js", "../../node_modules/date-fns/startOfWeek.js", "../../node_modules/date-fns/startOfISOWeek.js", "../../node_modules/date-fns/getISOWeekYear.js", "../../node_modules/date-fns/startOfISOWeekYear.js", "../../node_modules/date-fns/getISOWeek.js", "../../node_modules/date-fns/getWeekYear.js", "../../node_modules/date-fns/startOfWeekYear.js", "../../node_modules/date-fns/getWeek.js", "../../node_modules/date-fns/_lib/addLeadingZeros.js", "../../node_modules/date-fns/_lib/format/lightFormatters.js", "../../node_modules/date-fns/_lib/format/formatters.js", "../../node_modules/date-fns/_lib/format/longFormatters.js", "../../node_modules/date-fns/_lib/protectedTokens.js", "../../node_modules/date-fns/isDate.js", "../../node_modules/date-fns/isValid.js", "../../node_modules/date-fns/format.js", "../../node_modules/date-fns/_lib/getRoundingMethod.js", "../../node_modules/date-fns/compareAsc.js", "../../node_modules/date-fns/formatDistanceStrict.js", "../app/Helpers/DateHelpers.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", "function debounce(function_, wait = 100, options = {}) {\n\tif (typeof function_ !== 'function') {\n\t\tthrow new TypeError(`Expected the first parameter to be a function, got \\`${typeof function_}\\`.`);\n\t}\n\n\tif (wait < 0) {\n\t\tthrow new RangeError('`wait` must not be negative.');\n\t}\n\n\t// TODO: Deprecate the boolean parameter at some point.\n\tconst {immediate} = typeof options === 'boolean' ? {immediate: options} : options;\n\n\tlet storedContext;\n\tlet storedArguments;\n\tlet timeoutId;\n\tlet timestamp;\n\tlet result;\n\n\tfunction run() {\n\t\tconst callContext = storedContext;\n\t\tconst callArguments = storedArguments;\n\t\tstoredContext = undefined;\n\t\tstoredArguments = undefined;\n\t\tresult = function_.apply(callContext, callArguments);\n\t\treturn result;\n\t}\n\n\tfunction later() {\n\t\tconst last = Date.now() - timestamp;\n\n\t\tif (last < wait && last >= 0) {\n\t\t\ttimeoutId = setTimeout(later, wait - last);\n\t\t} else {\n\t\t\ttimeoutId = undefined;\n\n\t\t\tif (!immediate) {\n\t\t\t\tresult = run();\n\t\t\t}\n\t\t}\n\t}\n\n\tconst debounced = function (...arguments_) {\n\t\tif (\n\t\t\tstoredContext\n\t\t\t&& this !== storedContext\n\t\t\t&& Object.getPrototypeOf(this) === Object.getPrototypeOf(storedContext)\n\t\t) {\n\t\t\tthrow new Error('Debounced method called with different contexts of the same prototype.');\n\t\t}\n\n\t\tstoredContext = this; // eslint-disable-line unicorn/no-this-assignment\n\t\tstoredArguments = arguments_;\n\t\ttimestamp = Date.now();\n\n\t\tconst callNow = immediate && !timeoutId;\n\n\t\tif (!timeoutId) {\n\t\t\ttimeoutId = setTimeout(later, wait);\n\t\t}\n\n\t\tif (callNow) {\n\t\t\tresult = run();\n\t\t}\n\n\t\treturn result;\n\t};\n\n\tObject.defineProperty(debounced, 'isPending', {\n\t\tget() {\n\t\t\treturn timeoutId !== undefined;\n\t\t},\n\t});\n\n\tdebounced.clear = () => {\n\t\tif (!timeoutId) {\n\t\t\treturn;\n\t\t}\n\n\t\tclearTimeout(timeoutId);\n\t\ttimeoutId = undefined;\n\t};\n\n\tdebounced.flush = () => {\n\t\tif (!timeoutId) {\n\t\t\treturn;\n\t\t}\n\n\t\tdebounced.trigger();\n\t};\n\n\tdebounced.trigger = () => {\n\t\tresult = run();\n\n\t\tdebounced.clear();\n\t};\n\n\treturn debounced;\n}\n\n// Adds compatibility for ES modules\nmodule.exports.debounce = debounce;\n\nmodule.exports = debounce;\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", "import { createRoot } from \"react-dom/client\";\n\nexport function renderAll(domNodes: NodeListOf, component: () => React.ReactElement) {\n\tfor (const node of Array.from(domNodes)) {\n\t\tconst root = createRoot(node);\n\n\t\troot.render(component());\n\t}\n}\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}", "// Should be no imports here!\n\n/**\n * The sentinel value returned by producers to replace the draft with undefined.\n */\nexport const NOTHING: unique symbol = Symbol.for(\"immer-nothing\")\n\n/**\n * To let Immer treat your class instances as plain immutable objects\n * (albeit with a custom prototype), you must define either an instance property\n * or a static property on each of your custom classes.\n *\n * Otherwise, your class instance will never be drafted, which means it won't be\n * safe to mutate in a produce callback.\n */\nexport const DRAFTABLE: unique symbol = Symbol.for(\"immer-draftable\")\n\nexport const DRAFT_STATE: unique symbol = Symbol.for(\"immer-state\")\n", "export const errors =\n\tprocess.env.NODE_ENV !== \"production\"\n\t\t? [\n\t\t\t\t// All error codes, starting by 0:\n\t\t\t\tfunction(plugin: string) {\n\t\t\t\t\treturn `The plugin for '${plugin}' has not been loaded into Immer. To enable the plugin, import and call \\`enable${plugin}()\\` when initializing your application.`\n\t\t\t\t},\n\t\t\t\tfunction(thing: string) {\n\t\t\t\t\treturn `produce can only be called on things that are draftable: plain objects, arrays, Map, Set or classes that are marked with '[immerable]: true'. Got '${thing}'`\n\t\t\t\t},\n\t\t\t\t\"This object has been frozen and should not be mutated\",\n\t\t\t\tfunction(data: any) {\n\t\t\t\t\treturn (\n\t\t\t\t\t\t\"Cannot use a proxy that has been revoked. Did you pass an object from inside an immer function to an async process? \" +\n\t\t\t\t\t\tdata\n\t\t\t\t\t)\n\t\t\t\t},\n\t\t\t\t\"An immer producer returned a new value *and* modified its draft. Either return a new value *or* modify the draft.\",\n\t\t\t\t\"Immer forbids circular references\",\n\t\t\t\t\"The first or second argument to `produce` must be a function\",\n\t\t\t\t\"The third argument to `produce` must be a function or undefined\",\n\t\t\t\t\"First argument to `createDraft` must be a plain object, an array, or an immerable object\",\n\t\t\t\t\"First argument to `finishDraft` must be a draft returned by `createDraft`\",\n\t\t\t\tfunction(thing: string) {\n\t\t\t\t\treturn `'current' expects a draft, got: ${thing}`\n\t\t\t\t},\n\t\t\t\t\"Object.defineProperty() cannot be used on an Immer draft\",\n\t\t\t\t\"Object.setPrototypeOf() cannot be used on an Immer draft\",\n\t\t\t\t\"Immer only supports deleting array indices\",\n\t\t\t\t\"Immer only supports setting array indices and the 'length' property\",\n\t\t\t\tfunction(thing: string) {\n\t\t\t\t\treturn `'original' expects a draft, got: ${thing}`\n\t\t\t\t}\n\t\t\t\t// Note: if more errors are added, the errorOffset in Patches.ts should be increased\n\t\t\t\t// See Patches.ts for additional errors\n\t\t ]\n\t\t: []\n\nexport function die(error: number, ...args: any[]): never {\n\tif (process.env.NODE_ENV !== \"production\") {\n\t\tconst e = errors[error]\n\t\tconst msg = typeof e === \"function\" ? e.apply(null, args as any) : e\n\t\tthrow new Error(`[Immer] ${msg}`)\n\t}\n\tthrow new Error(\n\t\t`[Immer] minified error nr: ${error}. Full error at: https://bit.ly/3cXEKWf`\n\t)\n}\n", "import {\n\tDRAFT_STATE,\n\tDRAFTABLE,\n\tObjectish,\n\tDrafted,\n\tAnyObject,\n\tAnyMap,\n\tAnySet,\n\tImmerState,\n\tArchType,\n\tdie\n} from \"../internal\"\n\nexport const getPrototypeOf = Object.getPrototypeOf\n\n/** Returns true if the given value is an Immer draft */\n/*#__PURE__*/\nexport function isDraft(value: any): boolean {\n\treturn !!value && !!value[DRAFT_STATE]\n}\n\n/** Returns true if the given value can be drafted by Immer */\n/*#__PURE__*/\nexport function isDraftable(value: any): boolean {\n\tif (!value) return false\n\treturn (\n\t\tisPlainObject(value) ||\n\t\tArray.isArray(value) ||\n\t\t!!value[DRAFTABLE] ||\n\t\t!!value.constructor?.[DRAFTABLE] ||\n\t\tisMap(value) ||\n\t\tisSet(value)\n\t)\n}\n\nconst objectCtorString = Object.prototype.constructor.toString()\n/*#__PURE__*/\nexport function isPlainObject(value: any): boolean {\n\tif (!value || typeof value !== \"object\") return false\n\tconst proto = getPrototypeOf(value)\n\tif (proto === null) {\n\t\treturn true\n\t}\n\tconst Ctor =\n\t\tObject.hasOwnProperty.call(proto, \"constructor\") && proto.constructor\n\n\tif (Ctor === Object) return true\n\n\treturn (\n\t\ttypeof Ctor == \"function\" &&\n\t\tFunction.toString.call(Ctor) === objectCtorString\n\t)\n}\n\n/** Get the underlying object that is represented by the given draft */\n/*#__PURE__*/\nexport function original(value: T): T | undefined\nexport function original(value: Drafted): any {\n\tif (!isDraft(value)) die(15, value)\n\treturn value[DRAFT_STATE].base_\n}\n\nexport function each(\n\tobj: T,\n\titer: (key: string | number, value: any, source: T) => void,\n\tenumerableOnly?: boolean\n): void\nexport function each(obj: any, iter: any) {\n\tif (getArchtype(obj) === ArchType.Object) {\n\t\tObject.entries(obj).forEach(([key, value]) => {\n\t\t\titer(key, value, obj)\n\t\t})\n\t} else {\n\t\tobj.forEach((entry: any, index: any) => iter(index, entry, obj))\n\t}\n}\n\n/*#__PURE__*/\nexport function getArchtype(thing: any): ArchType {\n\tconst state: undefined | ImmerState = thing[DRAFT_STATE]\n\treturn state\n\t\t? state.type_\n\t\t: Array.isArray(thing)\n\t\t? ArchType.Array\n\t\t: isMap(thing)\n\t\t? ArchType.Map\n\t\t: isSet(thing)\n\t\t? ArchType.Set\n\t\t: ArchType.Object\n}\n\n/*#__PURE__*/\nexport function has(thing: any, prop: PropertyKey): boolean {\n\treturn getArchtype(thing) === ArchType.Map\n\t\t? thing.has(prop)\n\t\t: Object.prototype.hasOwnProperty.call(thing, prop)\n}\n\n/*#__PURE__*/\nexport function get(thing: AnyMap | AnyObject, prop: PropertyKey): any {\n\t// @ts-ignore\n\treturn getArchtype(thing) === ArchType.Map ? thing.get(prop) : thing[prop]\n}\n\n/*#__PURE__*/\nexport function set(thing: any, propOrOldValue: PropertyKey, value: any) {\n\tconst t = getArchtype(thing)\n\tif (t === ArchType.Map) thing.set(propOrOldValue, value)\n\telse if (t === ArchType.Set) {\n\t\tthing.add(value)\n\t} else thing[propOrOldValue] = value\n}\n\n/*#__PURE__*/\nexport function is(x: any, y: any): boolean {\n\t// From: https://github.com/facebook/fbjs/blob/c69904a511b900266935168223063dd8772dfc40/packages/fbjs/src/core/shallowEqual.js\n\tif (x === y) {\n\t\treturn x !== 0 || 1 / x === 1 / y\n\t} else {\n\t\treturn x !== x && y !== y\n\t}\n}\n\n/*#__PURE__*/\nexport function isMap(target: any): target is AnyMap {\n\treturn target instanceof Map\n}\n\n/*#__PURE__*/\nexport function isSet(target: any): target is AnySet {\n\treturn target instanceof Set\n}\n/*#__PURE__*/\nexport function latest(state: ImmerState): any {\n\treturn state.copy_ || state.base_\n}\n\n/*#__PURE__*/\nexport function shallowCopy(base: any, strict: boolean) {\n\tif (isMap(base)) {\n\t\treturn new Map(base)\n\t}\n\tif (isSet(base)) {\n\t\treturn new Set(base)\n\t}\n\tif (Array.isArray(base)) return Array.prototype.slice.call(base)\n\n\tif (!strict && isPlainObject(base)) {\n\t\tif (!getPrototypeOf(base)) {\n\t\t\tconst obj = Object.create(null)\n\t\t\treturn Object.assign(obj, base)\n\t\t}\n\t\treturn {...base}\n\t}\n\n\tconst descriptors = Object.getOwnPropertyDescriptors(base)\n\tdelete descriptors[DRAFT_STATE as any]\n\tlet keys = Reflect.ownKeys(descriptors)\n\tfor (let i = 0; i < keys.length; i++) {\n\t\tconst key: any = keys[i]\n\t\tconst desc = descriptors[key]\n\t\tif (desc.writable === false) {\n\t\t\tdesc.writable = true\n\t\t\tdesc.configurable = true\n\t\t}\n\t\t// like object.assign, we will read any _own_, get/set accessors. This helps in dealing\n\t\t// with libraries that trap values, like mobx or vue\n\t\t// unlike object.assign, non-enumerables will be copied as well\n\t\tif (desc.get || desc.set)\n\t\t\tdescriptors[key] = {\n\t\t\t\tconfigurable: true,\n\t\t\t\twritable: true, // could live with !!desc.set as well here...\n\t\t\t\tenumerable: desc.enumerable,\n\t\t\t\tvalue: base[key]\n\t\t\t}\n\t}\n\treturn Object.create(getPrototypeOf(base), descriptors)\n}\n\n/**\n * Freezes draftable objects. Returns the original object.\n * By default freezes shallowly, but if the second argument is `true` it will freeze recursively.\n *\n * @param obj\n * @param deep\n */\nexport function freeze(obj: T, deep?: boolean): T\nexport function freeze(obj: any, deep: boolean = false): T {\n\tif (isFrozen(obj) || isDraft(obj) || !isDraftable(obj)) return obj\n\tif (getArchtype(obj) > 1 /* Map or Set */) {\n\t\tobj.set = obj.add = obj.clear = obj.delete = dontMutateFrozenCollections as any\n\t}\n\tObject.freeze(obj)\n\tif (deep) each(obj, (_key, value) => freeze(value, true), true)\n\treturn obj\n}\n\nfunction dontMutateFrozenCollections() {\n\tdie(2)\n}\n\nexport function isFrozen(obj: any): boolean {\n\treturn Object.isFrozen(obj)\n}\n", "import {\n\tImmerState,\n\tPatch,\n\tDrafted,\n\tImmerBaseState,\n\tAnyMap,\n\tAnySet,\n\tArchType,\n\tdie\n} from \"../internal\"\n\n/** Plugin utilities */\nconst plugins: {\n\tPatches?: {\n\t\tgeneratePatches_(\n\t\t\tstate: ImmerState,\n\t\t\tbasePath: PatchPath,\n\t\t\tpatches: Patch[],\n\t\t\tinversePatches: Patch[]\n\t\t): void\n\t\tgenerateReplacementPatches_(\n\t\t\tbase: any,\n\t\t\treplacement: any,\n\t\t\tpatches: Patch[],\n\t\t\tinversePatches: Patch[]\n\t\t): void\n\t\tapplyPatches_(draft: T, patches: Patch[]): T\n\t}\n\tMapSet?: {\n\t\tproxyMap_(target: T, parent?: ImmerState): T\n\t\tproxySet_(target: T, parent?: ImmerState): T\n\t}\n} = {}\n\ntype Plugins = typeof plugins\n\nexport function getPlugin(\n\tpluginKey: K\n): Exclude {\n\tconst plugin = plugins[pluginKey]\n\tif (!plugin) {\n\t\tdie(0, pluginKey)\n\t}\n\t// @ts-ignore\n\treturn plugin\n}\n\nexport function loadPlugin(\n\tpluginKey: K,\n\timplementation: Plugins[K]\n): void {\n\tif (!plugins[pluginKey]) plugins[pluginKey] = implementation\n}\n/** Map / Set plugin */\n\nexport interface MapState extends ImmerBaseState {\n\ttype_: ArchType.Map\n\tcopy_: AnyMap | undefined\n\tassigned_: Map | undefined\n\tbase_: AnyMap\n\trevoked_: boolean\n\tdraft_: Drafted\n}\n\nexport interface SetState extends ImmerBaseState {\n\ttype_: ArchType.Set\n\tcopy_: AnySet | undefined\n\tbase_: AnySet\n\tdrafts_: Map // maps the original value to the draft value in the new set\n\trevoked_: boolean\n\tdraft_: Drafted\n}\n\n/** Patches plugin */\n\nexport type PatchPath = (string | number)[]\n", "import {\n\tPatch,\n\tPatchListener,\n\tDrafted,\n\tImmer,\n\tDRAFT_STATE,\n\tImmerState,\n\tArchType,\n\tgetPlugin\n} from \"../internal\"\n\n/** Each scope represents a `produce` call. */\n\nexport interface ImmerScope {\n\tpatches_?: Patch[]\n\tinversePatches_?: Patch[]\n\tcanAutoFreeze_: boolean\n\tdrafts_: any[]\n\tparent_?: ImmerScope\n\tpatchListener_?: PatchListener\n\timmer_: Immer\n\tunfinalizedDrafts_: number\n}\n\nlet currentScope: ImmerScope | undefined\n\nexport function getCurrentScope() {\n\treturn currentScope!\n}\n\nfunction createScope(\n\tparent_: ImmerScope | undefined,\n\timmer_: Immer\n): ImmerScope {\n\treturn {\n\t\tdrafts_: [],\n\t\tparent_,\n\t\timmer_,\n\t\t// Whenever the modified draft contains a draft from another scope, we\n\t\t// need to prevent auto-freezing so the unowned draft can be finalized.\n\t\tcanAutoFreeze_: true,\n\t\tunfinalizedDrafts_: 0\n\t}\n}\n\nexport function usePatchesInScope(\n\tscope: ImmerScope,\n\tpatchListener?: PatchListener\n) {\n\tif (patchListener) {\n\t\tgetPlugin(\"Patches\") // assert we have the plugin\n\t\tscope.patches_ = []\n\t\tscope.inversePatches_ = []\n\t\tscope.patchListener_ = patchListener\n\t}\n}\n\nexport function revokeScope(scope: ImmerScope) {\n\tleaveScope(scope)\n\tscope.drafts_.forEach(revokeDraft)\n\t// @ts-ignore\n\tscope.drafts_ = null\n}\n\nexport function leaveScope(scope: ImmerScope) {\n\tif (scope === currentScope) {\n\t\tcurrentScope = scope.parent_\n\t}\n}\n\nexport function enterScope(immer: Immer) {\n\treturn (currentScope = createScope(currentScope, immer))\n}\n\nfunction revokeDraft(draft: Drafted) {\n\tconst state: ImmerState = draft[DRAFT_STATE]\n\tif (state.type_ === ArchType.Object || state.type_ === ArchType.Array)\n\t\tstate.revoke_()\n\telse state.revoked_ = true\n}\n", "import {\n\tImmerScope,\n\tDRAFT_STATE,\n\tisDraftable,\n\tNOTHING,\n\tPatchPath,\n\teach,\n\thas,\n\tfreeze,\n\tImmerState,\n\tisDraft,\n\tSetState,\n\tset,\n\tArchType,\n\tgetPlugin,\n\tdie,\n\trevokeScope,\n\tisFrozen\n} from \"../internal\"\n\nexport function processResult(result: any, scope: ImmerScope) {\n\tscope.unfinalizedDrafts_ = scope.drafts_.length\n\tconst baseDraft = scope.drafts_![0]\n\tconst isReplaced = result !== undefined && result !== baseDraft\n\tif (isReplaced) {\n\t\tif (baseDraft[DRAFT_STATE].modified_) {\n\t\t\trevokeScope(scope)\n\t\t\tdie(4)\n\t\t}\n\t\tif (isDraftable(result)) {\n\t\t\t// Finalize the result in case it contains (or is) a subset of the draft.\n\t\t\tresult = finalize(scope, result)\n\t\t\tif (!scope.parent_) maybeFreeze(scope, result)\n\t\t}\n\t\tif (scope.patches_) {\n\t\t\tgetPlugin(\"Patches\").generateReplacementPatches_(\n\t\t\t\tbaseDraft[DRAFT_STATE].base_,\n\t\t\t\tresult,\n\t\t\t\tscope.patches_,\n\t\t\t\tscope.inversePatches_!\n\t\t\t)\n\t\t}\n\t} else {\n\t\t// Finalize the base draft.\n\t\tresult = finalize(scope, baseDraft, [])\n\t}\n\trevokeScope(scope)\n\tif (scope.patches_) {\n\t\tscope.patchListener_!(scope.patches_, scope.inversePatches_!)\n\t}\n\treturn result !== NOTHING ? result : undefined\n}\n\nfunction finalize(rootScope: ImmerScope, value: any, path?: PatchPath) {\n\t// Don't recurse in tho recursive data structures\n\tif (isFrozen(value)) return value\n\n\tconst state: ImmerState = value[DRAFT_STATE]\n\t// A plain object, might need freezing, might contain drafts\n\tif (!state) {\n\t\teach(\n\t\t\tvalue,\n\t\t\t(key, childValue) =>\n\t\t\t\tfinalizeProperty(rootScope, state, value, key, childValue, path),\n\t\t\ttrue // See #590, don't recurse into non-enumerable of non drafted objects\n\t\t)\n\t\treturn value\n\t}\n\t// Never finalize drafts owned by another scope.\n\tif (state.scope_ !== rootScope) return value\n\t// Unmodified draft, return the (frozen) original\n\tif (!state.modified_) {\n\t\tmaybeFreeze(rootScope, state.base_, true)\n\t\treturn state.base_\n\t}\n\t// Not finalized yet, let's do that now\n\tif (!state.finalized_) {\n\t\tstate.finalized_ = true\n\t\tstate.scope_.unfinalizedDrafts_--\n\t\tconst result = state.copy_\n\t\t// Finalize all children of the copy\n\t\t// For sets we clone before iterating, otherwise we can get in endless loop due to modifying during iteration, see #628\n\t\t// To preserve insertion order in all cases we then clear the set\n\t\t// And we let finalizeProperty know it needs to re-add non-draft children back to the target\n\t\tlet resultEach = result\n\t\tlet isSet = false\n\t\tif (state.type_ === ArchType.Set) {\n\t\t\tresultEach = new Set(result)\n\t\t\tresult.clear()\n\t\t\tisSet = true\n\t\t}\n\t\teach(resultEach, (key, childValue) =>\n\t\t\tfinalizeProperty(rootScope, state, result, key, childValue, path, isSet)\n\t\t)\n\t\t// everything inside is frozen, we can freeze here\n\t\tmaybeFreeze(rootScope, result, false)\n\t\t// first time finalizing, let's create those patches\n\t\tif (path && rootScope.patches_) {\n\t\t\tgetPlugin(\"Patches\").generatePatches_(\n\t\t\t\tstate,\n\t\t\t\tpath,\n\t\t\t\trootScope.patches_,\n\t\t\t\trootScope.inversePatches_!\n\t\t\t)\n\t\t}\n\t}\n\treturn state.copy_\n}\n\nfunction finalizeProperty(\n\trootScope: ImmerScope,\n\tparentState: undefined | ImmerState,\n\ttargetObject: any,\n\tprop: string | number,\n\tchildValue: any,\n\trootPath?: PatchPath,\n\ttargetIsSet?: boolean\n) {\n\tif (process.env.NODE_ENV !== \"production\" && childValue === targetObject)\n\t\tdie(5)\n\tif (isDraft(childValue)) {\n\t\tconst path =\n\t\t\trootPath &&\n\t\t\tparentState &&\n\t\t\tparentState!.type_ !== ArchType.Set && // Set objects are atomic since they have no keys.\n\t\t\t!has((parentState as Exclude).assigned_!, prop) // Skip deep patches for assigned keys.\n\t\t\t\t? rootPath!.concat(prop)\n\t\t\t\t: undefined\n\t\t// Drafts owned by `scope` are finalized here.\n\t\tconst res = finalize(rootScope, childValue, path)\n\t\tset(targetObject, prop, res)\n\t\t// Drafts from another scope must prevented to be frozen\n\t\t// if we got a draft back from finalize, we're in a nested produce and shouldn't freeze\n\t\tif (isDraft(res)) {\n\t\t\trootScope.canAutoFreeze_ = false\n\t\t} else return\n\t} else if (targetIsSet) {\n\t\ttargetObject.add(childValue)\n\t}\n\t// Search new objects for unfinalized drafts. Frozen objects should never contain drafts.\n\tif (isDraftable(childValue) && !isFrozen(childValue)) {\n\t\tif (!rootScope.immer_.autoFreeze_ && rootScope.unfinalizedDrafts_ < 1) {\n\t\t\t// optimization: if an object is not a draft, and we don't have to\n\t\t\t// deepfreeze everything, and we are sure that no drafts are left in the remaining object\n\t\t\t// cause we saw and finalized all drafts already; we can stop visiting the rest of the tree.\n\t\t\t// This benefits especially adding large data tree's without further processing.\n\t\t\t// See add-data.js perf test\n\t\t\treturn\n\t\t}\n\t\tfinalize(rootScope, childValue)\n\t\t// immer deep freezes plain objects, so if there is no parent state, we freeze as well\n\t\tif (!parentState || !parentState.scope_.parent_)\n\t\t\tmaybeFreeze(rootScope, childValue)\n\t}\n}\n\nfunction maybeFreeze(scope: ImmerScope, value: any, deep = false) {\n\t// we never freeze for a non-root scope; as it would prevent pruning for drafts inside wrapping objects\n\tif (!scope.parent_ && scope.immer_.autoFreeze_ && scope.canAutoFreeze_) {\n\t\tfreeze(value, deep)\n\t}\n}\n", "import {\n\teach,\n\thas,\n\tis,\n\tisDraftable,\n\tshallowCopy,\n\tlatest,\n\tImmerBaseState,\n\tImmerState,\n\tDrafted,\n\tAnyObject,\n\tAnyArray,\n\tObjectish,\n\tgetCurrentScope,\n\tgetPrototypeOf,\n\tDRAFT_STATE,\n\tdie,\n\tcreateProxy,\n\tArchType,\n\tImmerScope\n} from \"../internal\"\n\ninterface ProxyBaseState extends ImmerBaseState {\n\tassigned_: {\n\t\t[property: string]: boolean\n\t}\n\tparent_?: ImmerState\n\trevoke_(): void\n}\n\nexport interface ProxyObjectState extends ProxyBaseState {\n\ttype_: ArchType.Object\n\tbase_: any\n\tcopy_: any\n\tdraft_: Drafted\n}\n\nexport interface ProxyArrayState extends ProxyBaseState {\n\ttype_: ArchType.Array\n\tbase_: AnyArray\n\tcopy_: AnyArray | null\n\tdraft_: Drafted\n}\n\ntype ProxyState = ProxyObjectState | ProxyArrayState\n\n/**\n * Returns a new draft of the `base` object.\n *\n * The second argument is the parent draft-state (used internally).\n */\nexport function createProxyProxy(\n\tbase: T,\n\tparent?: ImmerState\n): Drafted {\n\tconst isArray = Array.isArray(base)\n\tconst state: ProxyState = {\n\t\ttype_: isArray ? ArchType.Array : (ArchType.Object as any),\n\t\t// Track which produce call this is associated with.\n\t\tscope_: parent ? parent.scope_ : getCurrentScope()!,\n\t\t// True for both shallow and deep changes.\n\t\tmodified_: false,\n\t\t// Used during finalization.\n\t\tfinalized_: false,\n\t\t// Track which properties have been assigned (true) or deleted (false).\n\t\tassigned_: {},\n\t\t// The parent draft state.\n\t\tparent_: parent,\n\t\t// The base state.\n\t\tbase_: base,\n\t\t// The base proxy.\n\t\tdraft_: null as any, // set below\n\t\t// The base copy with any updated values.\n\t\tcopy_: null,\n\t\t// Called by the `produce` function.\n\t\trevoke_: null as any,\n\t\tisManual_: false\n\t}\n\n\t// the traps must target something, a bit like the 'real' base.\n\t// but also, we need to be able to determine from the target what the relevant state is\n\t// (to avoid creating traps per instance to capture the state in closure,\n\t// and to avoid creating weird hidden properties as well)\n\t// So the trick is to use 'state' as the actual 'target'! (and make sure we intercept everything)\n\t// Note that in the case of an array, we put the state in an array to have better Reflect defaults ootb\n\tlet target: T = state as any\n\tlet traps: ProxyHandler> = objectTraps\n\tif (isArray) {\n\t\ttarget = [state] as any\n\t\ttraps = arrayTraps\n\t}\n\n\tconst {revoke, proxy} = Proxy.revocable(target, traps)\n\tstate.draft_ = proxy as any\n\tstate.revoke_ = revoke\n\treturn proxy as any\n}\n\n/**\n * Object drafts\n */\nexport const objectTraps: ProxyHandler = {\n\tget(state, prop) {\n\t\tif (prop === DRAFT_STATE) return state\n\n\t\tconst source = latest(state)\n\t\tif (!has(source, prop)) {\n\t\t\t// non-existing or non-own property...\n\t\t\treturn readPropFromProto(state, source, prop)\n\t\t}\n\t\tconst value = source[prop]\n\t\tif (state.finalized_ || !isDraftable(value)) {\n\t\t\treturn value\n\t\t}\n\t\t// Check for existing draft in modified state.\n\t\t// Assigned values are never drafted. This catches any drafts we created, too.\n\t\tif (value === peek(state.base_, prop)) {\n\t\t\tprepareCopy(state)\n\t\t\treturn (state.copy_![prop as any] = createProxy(value, state))\n\t\t}\n\t\treturn value\n\t},\n\thas(state, prop) {\n\t\treturn prop in latest(state)\n\t},\n\townKeys(state) {\n\t\treturn Reflect.ownKeys(latest(state))\n\t},\n\tset(\n\t\tstate: ProxyObjectState,\n\t\tprop: string /* strictly not, but helps TS */,\n\t\tvalue\n\t) {\n\t\tconst desc = getDescriptorFromProto(latest(state), prop)\n\t\tif (desc?.set) {\n\t\t\t// special case: if this write is captured by a setter, we have\n\t\t\t// to trigger it with the correct context\n\t\t\tdesc.set.call(state.draft_, value)\n\t\t\treturn true\n\t\t}\n\t\tif (!state.modified_) {\n\t\t\t// the last check is because we need to be able to distinguish setting a non-existing to undefined (which is a change)\n\t\t\t// from setting an existing property with value undefined to undefined (which is not a change)\n\t\t\tconst current = peek(latest(state), prop)\n\t\t\t// special case, if we assigning the original value to a draft, we can ignore the assignment\n\t\t\tconst currentState: ProxyObjectState = current?.[DRAFT_STATE]\n\t\t\tif (currentState && currentState.base_ === value) {\n\t\t\t\tstate.copy_![prop] = value\n\t\t\t\tstate.assigned_[prop] = false\n\t\t\t\treturn true\n\t\t\t}\n\t\t\tif (is(value, current) && (value !== undefined || has(state.base_, prop)))\n\t\t\t\treturn true\n\t\t\tprepareCopy(state)\n\t\t\tmarkChanged(state)\n\t\t}\n\n\t\tif (\n\t\t\t(state.copy_![prop] === value &&\n\t\t\t\t// special case: handle new props with value 'undefined'\n\t\t\t\t(value !== undefined || prop in state.copy_)) ||\n\t\t\t// special case: NaN\n\t\t\t(Number.isNaN(value) && Number.isNaN(state.copy_![prop]))\n\t\t)\n\t\t\treturn true\n\n\t\t// @ts-ignore\n\t\tstate.copy_![prop] = value\n\t\tstate.assigned_[prop] = true\n\t\treturn true\n\t},\n\tdeleteProperty(state, prop: string) {\n\t\t// The `undefined` check is a fast path for pre-existing keys.\n\t\tif (peek(state.base_, prop) !== undefined || prop in state.base_) {\n\t\t\tstate.assigned_[prop] = false\n\t\t\tprepareCopy(state)\n\t\t\tmarkChanged(state)\n\t\t} else {\n\t\t\t// if an originally not assigned property was deleted\n\t\t\tdelete state.assigned_[prop]\n\t\t}\n\t\tif (state.copy_) {\n\t\t\tdelete state.copy_[prop]\n\t\t}\n\t\treturn true\n\t},\n\t// Note: We never coerce `desc.value` into an Immer draft, because we can't make\n\t// the same guarantee in ES5 mode.\n\tgetOwnPropertyDescriptor(state, prop) {\n\t\tconst owner = latest(state)\n\t\tconst desc = Reflect.getOwnPropertyDescriptor(owner, prop)\n\t\tif (!desc) return desc\n\t\treturn {\n\t\t\twritable: true,\n\t\t\tconfigurable: state.type_ !== ArchType.Array || prop !== \"length\",\n\t\t\tenumerable: desc.enumerable,\n\t\t\tvalue: owner[prop]\n\t\t}\n\t},\n\tdefineProperty() {\n\t\tdie(11)\n\t},\n\tgetPrototypeOf(state) {\n\t\treturn getPrototypeOf(state.base_)\n\t},\n\tsetPrototypeOf() {\n\t\tdie(12)\n\t}\n}\n\n/**\n * Array drafts\n */\n\nconst arrayTraps: ProxyHandler<[ProxyArrayState]> = {}\neach(objectTraps, (key, fn) => {\n\t// @ts-ignore\n\tarrayTraps[key] = function() {\n\t\targuments[0] = arguments[0][0]\n\t\treturn fn.apply(this, arguments)\n\t}\n})\narrayTraps.deleteProperty = function(state, prop) {\n\tif (process.env.NODE_ENV !== \"production\" && isNaN(parseInt(prop as any)))\n\t\tdie(13)\n\t// @ts-ignore\n\treturn arrayTraps.set!.call(this, state, prop, undefined)\n}\narrayTraps.set = function(state, prop, value) {\n\tif (\n\t\tprocess.env.NODE_ENV !== \"production\" &&\n\t\tprop !== \"length\" &&\n\t\tisNaN(parseInt(prop as any))\n\t)\n\t\tdie(14)\n\treturn objectTraps.set!.call(this, state[0], prop, value, state[0])\n}\n\n// Access a property without creating an Immer draft.\nfunction peek(draft: Drafted, prop: PropertyKey) {\n\tconst state = draft[DRAFT_STATE]\n\tconst source = state ? latest(state) : draft\n\treturn source[prop]\n}\n\nfunction readPropFromProto(state: ImmerState, source: any, prop: PropertyKey) {\n\tconst desc = getDescriptorFromProto(source, prop)\n\treturn desc\n\t\t? `value` in desc\n\t\t\t? desc.value\n\t\t\t: // This is a very special case, if the prop is a getter defined by the\n\t\t\t // prototype, we should invoke it with the draft as context!\n\t\t\t desc.get?.call(state.draft_)\n\t\t: undefined\n}\n\nfunction getDescriptorFromProto(\n\tsource: any,\n\tprop: PropertyKey\n): PropertyDescriptor | undefined {\n\t// 'in' checks proto!\n\tif (!(prop in source)) return undefined\n\tlet proto = getPrototypeOf(source)\n\twhile (proto) {\n\t\tconst desc = Object.getOwnPropertyDescriptor(proto, prop)\n\t\tif (desc) return desc\n\t\tproto = getPrototypeOf(proto)\n\t}\n\treturn undefined\n}\n\nexport function markChanged(state: ImmerState) {\n\tif (!state.modified_) {\n\t\tstate.modified_ = true\n\t\tif (state.parent_) {\n\t\t\tmarkChanged(state.parent_)\n\t\t}\n\t}\n}\n\nexport function prepareCopy(state: {\n\tbase_: any\n\tcopy_: any\n\tscope_: ImmerScope\n}) {\n\tif (!state.copy_) {\n\t\tstate.copy_ = shallowCopy(\n\t\t\tstate.base_,\n\t\t\tstate.scope_.immer_.useStrictShallowCopy_\n\t\t)\n\t}\n}\n", "import {\n\tIProduceWithPatches,\n\tIProduce,\n\tImmerState,\n\tDrafted,\n\tisDraftable,\n\tprocessResult,\n\tPatch,\n\tObjectish,\n\tDRAFT_STATE,\n\tDraft,\n\tPatchListener,\n\tisDraft,\n\tisMap,\n\tisSet,\n\tcreateProxyProxy,\n\tgetPlugin,\n\tdie,\n\tenterScope,\n\trevokeScope,\n\tleaveScope,\n\tusePatchesInScope,\n\tgetCurrentScope,\n\tNOTHING,\n\tfreeze,\n\tcurrent\n} from \"../internal\"\n\ninterface ProducersFns {\n\tproduce: IProduce\n\tproduceWithPatches: IProduceWithPatches\n}\n\nexport class Immer implements ProducersFns {\n\tautoFreeze_: boolean = true\n\tuseStrictShallowCopy_: boolean = false\n\n\tconstructor(config?: {autoFreeze?: boolean; useStrictShallowCopy?: boolean}) {\n\t\tif (typeof config?.autoFreeze === \"boolean\")\n\t\t\tthis.setAutoFreeze(config!.autoFreeze)\n\t\tif (typeof config?.useStrictShallowCopy === \"boolean\")\n\t\t\tthis.setUseStrictShallowCopy(config!.useStrictShallowCopy)\n\t}\n\n\t/**\n\t * The `produce` function takes a value and a \"recipe function\" (whose\n\t * return value often depends on the base state). The recipe function is\n\t * free to mutate its first argument however it wants. All mutations are\n\t * only ever applied to a __copy__ of the base state.\n\t *\n\t * Pass only a function to create a \"curried producer\" which relieves you\n\t * from passing the recipe function every time.\n\t *\n\t * Only plain objects and arrays are made mutable. All other objects are\n\t * considered uncopyable.\n\t *\n\t * Note: This function is __bound__ to its `Immer` instance.\n\t *\n\t * @param {any} base - the initial state\n\t * @param {Function} recipe - function that receives a proxy of the base state as first argument and which can be freely modified\n\t * @param {Function} patchListener - optional function that will be called with all the patches produced here\n\t * @returns {any} a new state, or the initial state if nothing was modified\n\t */\n\tproduce: IProduce = (base: any, recipe?: any, patchListener?: any) => {\n\t\t// curried invocation\n\t\tif (typeof base === \"function\" && typeof recipe !== \"function\") {\n\t\t\tconst defaultBase = recipe\n\t\t\trecipe = base\n\n\t\t\tconst self = this\n\t\t\treturn function curriedProduce(\n\t\t\t\tthis: any,\n\t\t\t\tbase = defaultBase,\n\t\t\t\t...args: any[]\n\t\t\t) {\n\t\t\t\treturn self.produce(base, (draft: Drafted) => recipe.call(this, draft, ...args)) // prettier-ignore\n\t\t\t}\n\t\t}\n\n\t\tif (typeof recipe !== \"function\") die(6)\n\t\tif (patchListener !== undefined && typeof patchListener !== \"function\")\n\t\t\tdie(7)\n\n\t\tlet result\n\n\t\t// Only plain objects, arrays, and \"immerable classes\" are drafted.\n\t\tif (isDraftable(base)) {\n\t\t\tconst scope = enterScope(this)\n\t\t\tconst proxy = createProxy(base, undefined)\n\t\t\tlet hasError = true\n\t\t\ttry {\n\t\t\t\tresult = recipe(proxy)\n\t\t\t\thasError = false\n\t\t\t} finally {\n\t\t\t\t// finally instead of catch + rethrow better preserves original stack\n\t\t\t\tif (hasError) revokeScope(scope)\n\t\t\t\telse leaveScope(scope)\n\t\t\t}\n\t\t\tusePatchesInScope(scope, patchListener)\n\t\t\treturn processResult(result, scope)\n\t\t} else if (!base || typeof base !== \"object\") {\n\t\t\tresult = recipe(base)\n\t\t\tif (result === undefined) result = base\n\t\t\tif (result === NOTHING) result = undefined\n\t\t\tif (this.autoFreeze_) freeze(result, true)\n\t\t\tif (patchListener) {\n\t\t\t\tconst p: Patch[] = []\n\t\t\t\tconst ip: Patch[] = []\n\t\t\t\tgetPlugin(\"Patches\").generateReplacementPatches_(base, result, p, ip)\n\t\t\t\tpatchListener(p, ip)\n\t\t\t}\n\t\t\treturn result\n\t\t} else die(1, base)\n\t}\n\n\tproduceWithPatches: IProduceWithPatches = (base: any, recipe?: any): any => {\n\t\t// curried invocation\n\t\tif (typeof base === \"function\") {\n\t\t\treturn (state: any, ...args: any[]) =>\n\t\t\t\tthis.produceWithPatches(state, (draft: any) => base(draft, ...args))\n\t\t}\n\n\t\tlet patches: Patch[], inversePatches: Patch[]\n\t\tconst result = this.produce(base, recipe, (p: Patch[], ip: Patch[]) => {\n\t\t\tpatches = p\n\t\t\tinversePatches = ip\n\t\t})\n\t\treturn [result, patches!, inversePatches!]\n\t}\n\n\tcreateDraft(base: T): Draft {\n\t\tif (!isDraftable(base)) die(8)\n\t\tif (isDraft(base)) base = current(base)\n\t\tconst scope = enterScope(this)\n\t\tconst proxy = createProxy(base, undefined)\n\t\tproxy[DRAFT_STATE].isManual_ = true\n\t\tleaveScope(scope)\n\t\treturn proxy as any\n\t}\n\n\tfinishDraft>(\n\t\tdraft: D,\n\t\tpatchListener?: PatchListener\n\t): D extends Draft ? T : never {\n\t\tconst state: ImmerState = draft && (draft as any)[DRAFT_STATE]\n\t\tif (!state || !state.isManual_) die(9)\n\t\tconst {scope_: scope} = state\n\t\tusePatchesInScope(scope, patchListener)\n\t\treturn processResult(undefined, scope)\n\t}\n\n\t/**\n\t * Pass true to automatically freeze all copies created by Immer.\n\t *\n\t * By default, auto-freezing is enabled.\n\t */\n\tsetAutoFreeze(value: boolean) {\n\t\tthis.autoFreeze_ = value\n\t}\n\n\t/**\n\t * Pass true to enable strict shallow copy.\n\t *\n\t * By default, immer does not copy the object descriptors such as getter, setter and non-enumrable properties.\n\t */\n\tsetUseStrictShallowCopy(value: boolean) {\n\t\tthis.useStrictShallowCopy_ = value\n\t}\n\n\tapplyPatches(base: T, patches: Patch[]): T {\n\t\t// If a patch replaces the entire state, take that replacement as base\n\t\t// before applying patches\n\t\tlet i: number\n\t\tfor (i = patches.length - 1; i >= 0; i--) {\n\t\t\tconst patch = patches[i]\n\t\t\tif (patch.path.length === 0 && patch.op === \"replace\") {\n\t\t\t\tbase = patch.value\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t\t// If there was a patch that replaced the entire state, start from the\n\t\t// patch after that.\n\t\tif (i > -1) {\n\t\t\tpatches = patches.slice(i + 1)\n\t\t}\n\n\t\tconst applyPatchesImpl = getPlugin(\"Patches\").applyPatches_\n\t\tif (isDraft(base)) {\n\t\t\t// N.B: never hits if some patch a replacement, patches are never drafts\n\t\t\treturn applyPatchesImpl(base, patches)\n\t\t}\n\t\t// Otherwise, produce a copy of the base state.\n\t\treturn this.produce(base, (draft: Drafted) =>\n\t\t\tapplyPatchesImpl(draft, patches)\n\t\t)\n\t}\n}\n\nexport function createProxy(\n\tvalue: T,\n\tparent?: ImmerState\n): Drafted {\n\t// precondition: createProxy should be guarded by isDraftable, so we know we can safely draft\n\tconst draft: Drafted = isMap(value)\n\t\t? getPlugin(\"MapSet\").proxyMap_(value, parent)\n\t\t: isSet(value)\n\t\t? getPlugin(\"MapSet\").proxySet_(value, parent)\n\t\t: createProxyProxy(value, parent)\n\n\tconst scope = parent ? parent.scope_ : getCurrentScope()\n\tscope.drafts_.push(draft)\n\treturn draft\n}\n", "import {\n\tdie,\n\tisDraft,\n\tshallowCopy,\n\teach,\n\tDRAFT_STATE,\n\tset,\n\tImmerState,\n\tisDraftable,\n\tisFrozen\n} from \"../internal\"\n\n/** Takes a snapshot of the current state of a draft and finalizes it (but without freezing). This is a great utility to print the current state during debugging (no Proxies in the way). The output of current can also be safely leaked outside the producer. */\nexport function current(value: T): T\nexport function current(value: any): any {\n\tif (!isDraft(value)) die(10, value)\n\treturn currentImpl(value)\n}\n\nfunction currentImpl(value: any): any {\n\tif (!isDraftable(value) || isFrozen(value)) return value\n\tconst state: ImmerState | undefined = value[DRAFT_STATE]\n\tlet copy: any\n\tif (state) {\n\t\tif (!state.modified_) return state.base_\n\t\t// Optimization: avoid generating new drafts during copying\n\t\tstate.finalized_ = true\n\t\tcopy = shallowCopy(value, state.scope_.immer_.useStrictShallowCopy_)\n\t} else {\n\t\tcopy = shallowCopy(value, true)\n\t}\n\t// recurse\n\teach(copy, (key, childValue) => {\n\t\tset(copy, key, currentImpl(childValue))\n\t})\n\tif (state) {\n\t\tstate.finalized_ = false\n\t}\n\treturn copy\n}\n", "import {immerable} from \"../immer\"\nimport {\n\tImmerState,\n\tPatch,\n\tSetState,\n\tProxyArrayState,\n\tMapState,\n\tProxyObjectState,\n\tPatchPath,\n\tget,\n\teach,\n\thas,\n\tgetArchtype,\n\tgetPrototypeOf,\n\tisSet,\n\tisMap,\n\tloadPlugin,\n\tArchType,\n\tdie,\n\tisDraft,\n\tisDraftable,\n\tNOTHING,\n\terrors\n} from \"../internal\"\n\nexport function enablePatches() {\n\tconst errorOffset = 16\n\tif (process.env.NODE_ENV !== \"production\") {\n\t\terrors.push(\n\t\t\t'Sets cannot have \"replace\" patches.',\n\t\t\tfunction(op: string) {\n\t\t\t\treturn \"Unsupported patch operation: \" + op\n\t\t\t},\n\t\t\tfunction(path: string) {\n\t\t\t\treturn \"Cannot apply patch, path doesn't resolve: \" + path\n\t\t\t},\n\t\t\t\"Patching reserved attributes like __proto__, prototype and constructor is not allowed\"\n\t\t)\n\t}\n\n\tconst REPLACE = \"replace\"\n\tconst ADD = \"add\"\n\tconst REMOVE = \"remove\"\n\n\tfunction generatePatches_(\n\t\tstate: ImmerState,\n\t\tbasePath: PatchPath,\n\t\tpatches: Patch[],\n\t\tinversePatches: Patch[]\n\t): void {\n\t\tswitch (state.type_) {\n\t\t\tcase ArchType.Object:\n\t\t\tcase ArchType.Map:\n\t\t\t\treturn generatePatchesFromAssigned(\n\t\t\t\t\tstate,\n\t\t\t\t\tbasePath,\n\t\t\t\t\tpatches,\n\t\t\t\t\tinversePatches\n\t\t\t\t)\n\t\t\tcase ArchType.Array:\n\t\t\t\treturn generateArrayPatches(state, basePath, patches, inversePatches)\n\t\t\tcase ArchType.Set:\n\t\t\t\treturn generateSetPatches(\n\t\t\t\t\t(state as any) as SetState,\n\t\t\t\t\tbasePath,\n\t\t\t\t\tpatches,\n\t\t\t\t\tinversePatches\n\t\t\t\t)\n\t\t}\n\t}\n\n\tfunction generateArrayPatches(\n\t\tstate: ProxyArrayState,\n\t\tbasePath: PatchPath,\n\t\tpatches: Patch[],\n\t\tinversePatches: Patch[]\n\t) {\n\t\tlet {base_, assigned_} = state\n\t\tlet copy_ = state.copy_!\n\n\t\t// Reduce complexity by ensuring `base` is never longer.\n\t\tif (copy_.length < base_.length) {\n\t\t\t// @ts-ignore\n\t\t\t;[base_, copy_] = [copy_, base_]\n\t\t\t;[patches, inversePatches] = [inversePatches, patches]\n\t\t}\n\n\t\t// Process replaced indices.\n\t\tfor (let i = 0; i < base_.length; i++) {\n\t\t\tif (assigned_[i] && copy_[i] !== base_[i]) {\n\t\t\t\tconst path = basePath.concat([i])\n\t\t\t\tpatches.push({\n\t\t\t\t\top: REPLACE,\n\t\t\t\t\tpath,\n\t\t\t\t\t// Need to maybe clone it, as it can in fact be the original value\n\t\t\t\t\t// due to the base/copy inversion at the start of this function\n\t\t\t\t\tvalue: clonePatchValueIfNeeded(copy_[i])\n\t\t\t\t})\n\t\t\t\tinversePatches.push({\n\t\t\t\t\top: REPLACE,\n\t\t\t\t\tpath,\n\t\t\t\t\tvalue: clonePatchValueIfNeeded(base_[i])\n\t\t\t\t})\n\t\t\t}\n\t\t}\n\n\t\t// Process added indices.\n\t\tfor (let i = base_.length; i < copy_.length; i++) {\n\t\t\tconst path = basePath.concat([i])\n\t\t\tpatches.push({\n\t\t\t\top: ADD,\n\t\t\t\tpath,\n\t\t\t\t// Need to maybe clone it, as it can in fact be the original value\n\t\t\t\t// due to the base/copy inversion at the start of this function\n\t\t\t\tvalue: clonePatchValueIfNeeded(copy_[i])\n\t\t\t})\n\t\t}\n\t\tfor (let i = copy_.length - 1; base_.length <= i; --i) {\n\t\t\tconst path = basePath.concat([i])\n\t\t\tinversePatches.push({\n\t\t\t\top: REMOVE,\n\t\t\t\tpath\n\t\t\t})\n\t\t}\n\t}\n\n\t// This is used for both Map objects and normal objects.\n\tfunction generatePatchesFromAssigned(\n\t\tstate: MapState | ProxyObjectState,\n\t\tbasePath: PatchPath,\n\t\tpatches: Patch[],\n\t\tinversePatches: Patch[]\n\t) {\n\t\tconst {base_, copy_} = state\n\t\teach(state.assigned_!, (key, assignedValue) => {\n\t\t\tconst origValue = get(base_, key)\n\t\t\tconst value = get(copy_!, key)\n\t\t\tconst op = !assignedValue ? REMOVE : has(base_, key) ? REPLACE : ADD\n\t\t\tif (origValue === value && op === REPLACE) return\n\t\t\tconst path = basePath.concat(key as any)\n\t\t\tpatches.push(op === REMOVE ? {op, path} : {op, path, value})\n\t\t\tinversePatches.push(\n\t\t\t\top === ADD\n\t\t\t\t\t? {op: REMOVE, path}\n\t\t\t\t\t: op === REMOVE\n\t\t\t\t\t? {op: ADD, path, value: clonePatchValueIfNeeded(origValue)}\n\t\t\t\t\t: {op: REPLACE, path, value: clonePatchValueIfNeeded(origValue)}\n\t\t\t)\n\t\t})\n\t}\n\n\tfunction generateSetPatches(\n\t\tstate: SetState,\n\t\tbasePath: PatchPath,\n\t\tpatches: Patch[],\n\t\tinversePatches: Patch[]\n\t) {\n\t\tlet {base_, copy_} = state\n\n\t\tlet i = 0\n\t\tbase_.forEach((value: any) => {\n\t\t\tif (!copy_!.has(value)) {\n\t\t\t\tconst path = basePath.concat([i])\n\t\t\t\tpatches.push({\n\t\t\t\t\top: REMOVE,\n\t\t\t\t\tpath,\n\t\t\t\t\tvalue\n\t\t\t\t})\n\t\t\t\tinversePatches.unshift({\n\t\t\t\t\top: ADD,\n\t\t\t\t\tpath,\n\t\t\t\t\tvalue\n\t\t\t\t})\n\t\t\t}\n\t\t\ti++\n\t\t})\n\t\ti = 0\n\t\tcopy_!.forEach((value: any) => {\n\t\t\tif (!base_.has(value)) {\n\t\t\t\tconst path = basePath.concat([i])\n\t\t\t\tpatches.push({\n\t\t\t\t\top: ADD,\n\t\t\t\t\tpath,\n\t\t\t\t\tvalue\n\t\t\t\t})\n\t\t\t\tinversePatches.unshift({\n\t\t\t\t\top: REMOVE,\n\t\t\t\t\tpath,\n\t\t\t\t\tvalue\n\t\t\t\t})\n\t\t\t}\n\t\t\ti++\n\t\t})\n\t}\n\n\tfunction generateReplacementPatches_(\n\t\tbaseValue: any,\n\t\treplacement: any,\n\t\tpatches: Patch[],\n\t\tinversePatches: Patch[]\n\t): void {\n\t\tpatches.push({\n\t\t\top: REPLACE,\n\t\t\tpath: [],\n\t\t\tvalue: replacement === NOTHING ? undefined : replacement\n\t\t})\n\t\tinversePatches.push({\n\t\t\top: REPLACE,\n\t\t\tpath: [],\n\t\t\tvalue: baseValue\n\t\t})\n\t}\n\n\tfunction applyPatches_(draft: T, patches: Patch[]): T {\n\t\tpatches.forEach(patch => {\n\t\t\tconst {path, op} = patch\n\n\t\t\tlet base: any = draft\n\t\t\tfor (let i = 0; i < path.length - 1; i++) {\n\t\t\t\tconst parentType = getArchtype(base)\n\t\t\t\tlet p = path[i]\n\t\t\t\tif (typeof p !== \"string\" && typeof p !== \"number\") {\n\t\t\t\t\tp = \"\" + p\n\t\t\t\t}\n\n\t\t\t\t// See #738, avoid prototype pollution\n\t\t\t\tif (\n\t\t\t\t\t(parentType === ArchType.Object || parentType === ArchType.Array) &&\n\t\t\t\t\t(p === \"__proto__\" || p === \"constructor\")\n\t\t\t\t)\n\t\t\t\t\tdie(errorOffset + 3)\n\t\t\t\tif (typeof base === \"function\" && p === \"prototype\")\n\t\t\t\t\tdie(errorOffset + 3)\n\t\t\t\tbase = get(base, p)\n\t\t\t\tif (typeof base !== \"object\") die(errorOffset + 2, path.join(\"/\"))\n\t\t\t}\n\n\t\t\tconst type = getArchtype(base)\n\t\t\tconst value = deepClonePatchValue(patch.value) // used to clone patch to ensure original patch is not modified, see #411\n\t\t\tconst key = path[path.length - 1]\n\t\t\tswitch (op) {\n\t\t\t\tcase REPLACE:\n\t\t\t\t\tswitch (type) {\n\t\t\t\t\t\tcase ArchType.Map:\n\t\t\t\t\t\t\treturn base.set(key, value)\n\t\t\t\t\t\t/* istanbul ignore next */\n\t\t\t\t\t\tcase ArchType.Set:\n\t\t\t\t\t\t\tdie(errorOffset)\n\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\t// if value is an object, then it's assigned by reference\n\t\t\t\t\t\t\t// in the following add or remove ops, the value field inside the patch will also be modifyed\n\t\t\t\t\t\t\t// so we use value from the cloned patch\n\t\t\t\t\t\t\t// @ts-ignore\n\t\t\t\t\t\t\treturn (base[key] = value)\n\t\t\t\t\t}\n\t\t\t\tcase ADD:\n\t\t\t\t\tswitch (type) {\n\t\t\t\t\t\tcase ArchType.Array:\n\t\t\t\t\t\t\treturn key === \"-\"\n\t\t\t\t\t\t\t\t? base.push(value)\n\t\t\t\t\t\t\t\t: base.splice(key as any, 0, value)\n\t\t\t\t\t\tcase ArchType.Map:\n\t\t\t\t\t\t\treturn base.set(key, value)\n\t\t\t\t\t\tcase ArchType.Set:\n\t\t\t\t\t\t\treturn base.add(value)\n\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\treturn (base[key] = value)\n\t\t\t\t\t}\n\t\t\t\tcase REMOVE:\n\t\t\t\t\tswitch (type) {\n\t\t\t\t\t\tcase ArchType.Array:\n\t\t\t\t\t\t\treturn base.splice(key as any, 1)\n\t\t\t\t\t\tcase ArchType.Map:\n\t\t\t\t\t\t\treturn base.delete(key)\n\t\t\t\t\t\tcase ArchType.Set:\n\t\t\t\t\t\t\treturn base.delete(patch.value)\n\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\treturn delete base[key]\n\t\t\t\t\t}\n\t\t\t\tdefault:\n\t\t\t\t\tdie(errorOffset + 1, op)\n\t\t\t}\n\t\t})\n\n\t\treturn draft\n\t}\n\n\t// optimize: this is quite a performance hit, can we detect intelligently when it is needed?\n\t// E.g. auto-draft when new objects from outside are assigned and modified?\n\t// (See failing test when deepClone just returns obj)\n\tfunction deepClonePatchValue(obj: T): T\n\tfunction deepClonePatchValue(obj: any) {\n\t\tif (!isDraftable(obj)) return obj\n\t\tif (Array.isArray(obj)) return obj.map(deepClonePatchValue)\n\t\tif (isMap(obj))\n\t\t\treturn new Map(\n\t\t\t\tArray.from(obj.entries()).map(([k, v]) => [k, deepClonePatchValue(v)])\n\t\t\t)\n\t\tif (isSet(obj)) return new Set(Array.from(obj).map(deepClonePatchValue))\n\t\tconst cloned = Object.create(getPrototypeOf(obj))\n\t\tfor (const key in obj) cloned[key] = deepClonePatchValue(obj[key])\n\t\tif (has(obj, immerable)) cloned[immerable] = obj[immerable]\n\t\treturn cloned\n\t}\n\n\tfunction clonePatchValueIfNeeded(obj: T): T {\n\t\tif (isDraft(obj)) {\n\t\t\treturn deepClonePatchValue(obj)\n\t\t} else return obj\n\t}\n\n\tloadPlugin(\"Patches\", {\n\t\tapplyPatches_,\n\t\tgeneratePatches_,\n\t\tgenerateReplacementPatches_\n\t})\n}\n", "// types only!\nimport {\n\tImmerState,\n\tAnyMap,\n\tAnySet,\n\tMapState,\n\tSetState,\n\tDRAFT_STATE,\n\tgetCurrentScope,\n\tlatest,\n\tisDraftable,\n\tcreateProxy,\n\tloadPlugin,\n\tmarkChanged,\n\tdie,\n\tArchType,\n\teach\n} from \"../internal\"\n\nexport function enableMapSet() {\n\tclass DraftMap extends Map {\n\t\t[DRAFT_STATE]: MapState\n\n\t\tconstructor(target: AnyMap, parent?: ImmerState) {\n\t\t\tsuper()\n\t\t\tthis[DRAFT_STATE] = {\n\t\t\t\ttype_: ArchType.Map,\n\t\t\t\tparent_: parent,\n\t\t\t\tscope_: parent ? parent.scope_ : getCurrentScope()!,\n\t\t\t\tmodified_: false,\n\t\t\t\tfinalized_: false,\n\t\t\t\tcopy_: undefined,\n\t\t\t\tassigned_: undefined,\n\t\t\t\tbase_: target,\n\t\t\t\tdraft_: this as any,\n\t\t\t\tisManual_: false,\n\t\t\t\trevoked_: false\n\t\t\t}\n\t\t}\n\n\t\tget size(): number {\n\t\t\treturn latest(this[DRAFT_STATE]).size\n\t\t}\n\n\t\thas(key: any): boolean {\n\t\t\treturn latest(this[DRAFT_STATE]).has(key)\n\t\t}\n\n\t\tset(key: any, value: any) {\n\t\t\tconst state: MapState = this[DRAFT_STATE]\n\t\t\tassertUnrevoked(state)\n\t\t\tif (!latest(state).has(key) || latest(state).get(key) !== value) {\n\t\t\t\tprepareMapCopy(state)\n\t\t\t\tmarkChanged(state)\n\t\t\t\tstate.assigned_!.set(key, true)\n\t\t\t\tstate.copy_!.set(key, value)\n\t\t\t\tstate.assigned_!.set(key, true)\n\t\t\t}\n\t\t\treturn this\n\t\t}\n\n\t\tdelete(key: any): boolean {\n\t\t\tif (!this.has(key)) {\n\t\t\t\treturn false\n\t\t\t}\n\n\t\t\tconst state: MapState = this[DRAFT_STATE]\n\t\t\tassertUnrevoked(state)\n\t\t\tprepareMapCopy(state)\n\t\t\tmarkChanged(state)\n\t\t\tif (state.base_.has(key)) {\n\t\t\t\tstate.assigned_!.set(key, false)\n\t\t\t} else {\n\t\t\t\tstate.assigned_!.delete(key)\n\t\t\t}\n\t\t\tstate.copy_!.delete(key)\n\t\t\treturn true\n\t\t}\n\n\t\tclear() {\n\t\t\tconst state: MapState = this[DRAFT_STATE]\n\t\t\tassertUnrevoked(state)\n\t\t\tif (latest(state).size) {\n\t\t\t\tprepareMapCopy(state)\n\t\t\t\tmarkChanged(state)\n\t\t\t\tstate.assigned_ = new Map()\n\t\t\t\teach(state.base_, key => {\n\t\t\t\t\tstate.assigned_!.set(key, false)\n\t\t\t\t})\n\t\t\t\tstate.copy_!.clear()\n\t\t\t}\n\t\t}\n\n\t\tforEach(cb: (value: any, key: any, self: any) => void, thisArg?: any) {\n\t\t\tconst state: MapState = this[DRAFT_STATE]\n\t\t\tlatest(state).forEach((_value: any, key: any, _map: any) => {\n\t\t\t\tcb.call(thisArg, this.get(key), key, this)\n\t\t\t})\n\t\t}\n\n\t\tget(key: any): any {\n\t\t\tconst state: MapState = this[DRAFT_STATE]\n\t\t\tassertUnrevoked(state)\n\t\t\tconst value = latest(state).get(key)\n\t\t\tif (state.finalized_ || !isDraftable(value)) {\n\t\t\t\treturn value\n\t\t\t}\n\t\t\tif (value !== state.base_.get(key)) {\n\t\t\t\treturn value // either already drafted or reassigned\n\t\t\t}\n\t\t\t// despite what it looks, this creates a draft only once, see above condition\n\t\t\tconst draft = createProxy(value, state)\n\t\t\tprepareMapCopy(state)\n\t\t\tstate.copy_!.set(key, draft)\n\t\t\treturn draft\n\t\t}\n\n\t\tkeys(): IterableIterator {\n\t\t\treturn latest(this[DRAFT_STATE]).keys()\n\t\t}\n\n\t\tvalues(): IterableIterator {\n\t\t\tconst iterator = this.keys()\n\t\t\treturn {\n\t\t\t\t[Symbol.iterator]: () => this.values(),\n\t\t\t\tnext: () => {\n\t\t\t\t\tconst r = iterator.next()\n\t\t\t\t\t/* istanbul ignore next */\n\t\t\t\t\tif (r.done) return r\n\t\t\t\t\tconst value = this.get(r.value)\n\t\t\t\t\treturn {\n\t\t\t\t\t\tdone: false,\n\t\t\t\t\t\tvalue\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} as any\n\t\t}\n\n\t\tentries(): IterableIterator<[any, any]> {\n\t\t\tconst iterator = this.keys()\n\t\t\treturn {\n\t\t\t\t[Symbol.iterator]: () => this.entries(),\n\t\t\t\tnext: () => {\n\t\t\t\t\tconst r = iterator.next()\n\t\t\t\t\t/* istanbul ignore next */\n\t\t\t\t\tif (r.done) return r\n\t\t\t\t\tconst value = this.get(r.value)\n\t\t\t\t\treturn {\n\t\t\t\t\t\tdone: false,\n\t\t\t\t\t\tvalue: [r.value, value]\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} as any\n\t\t}\n\n\t\t[Symbol.iterator]() {\n\t\t\treturn this.entries()\n\t\t}\n\t}\n\n\tfunction proxyMap_(target: T, parent?: ImmerState): T {\n\t\t// @ts-ignore\n\t\treturn new DraftMap(target, parent)\n\t}\n\n\tfunction prepareMapCopy(state: MapState) {\n\t\tif (!state.copy_) {\n\t\t\tstate.assigned_ = new Map()\n\t\t\tstate.copy_ = new Map(state.base_)\n\t\t}\n\t}\n\n\tclass DraftSet extends Set {\n\t\t[DRAFT_STATE]: SetState\n\t\tconstructor(target: AnySet, parent?: ImmerState) {\n\t\t\tsuper()\n\t\t\tthis[DRAFT_STATE] = {\n\t\t\t\ttype_: ArchType.Set,\n\t\t\t\tparent_: parent,\n\t\t\t\tscope_: parent ? parent.scope_ : getCurrentScope()!,\n\t\t\t\tmodified_: false,\n\t\t\t\tfinalized_: false,\n\t\t\t\tcopy_: undefined,\n\t\t\t\tbase_: target,\n\t\t\t\tdraft_: this,\n\t\t\t\tdrafts_: new Map(),\n\t\t\t\trevoked_: false,\n\t\t\t\tisManual_: false\n\t\t\t}\n\t\t}\n\n\t\tget size(): number {\n\t\t\treturn latest(this[DRAFT_STATE]).size\n\t\t}\n\n\t\thas(value: any): boolean {\n\t\t\tconst state: SetState = this[DRAFT_STATE]\n\t\t\tassertUnrevoked(state)\n\t\t\t// bit of trickery here, to be able to recognize both the value, and the draft of its value\n\t\t\tif (!state.copy_) {\n\t\t\t\treturn state.base_.has(value)\n\t\t\t}\n\t\t\tif (state.copy_.has(value)) return true\n\t\t\tif (state.drafts_.has(value) && state.copy_.has(state.drafts_.get(value)))\n\t\t\t\treturn true\n\t\t\treturn false\n\t\t}\n\n\t\tadd(value: any): any {\n\t\t\tconst state: SetState = this[DRAFT_STATE]\n\t\t\tassertUnrevoked(state)\n\t\t\tif (!this.has(value)) {\n\t\t\t\tprepareSetCopy(state)\n\t\t\t\tmarkChanged(state)\n\t\t\t\tstate.copy_!.add(value)\n\t\t\t}\n\t\t\treturn this\n\t\t}\n\n\t\tdelete(value: any): any {\n\t\t\tif (!this.has(value)) {\n\t\t\t\treturn false\n\t\t\t}\n\n\t\t\tconst state: SetState = this[DRAFT_STATE]\n\t\t\tassertUnrevoked(state)\n\t\t\tprepareSetCopy(state)\n\t\t\tmarkChanged(state)\n\t\t\treturn (\n\t\t\t\tstate.copy_!.delete(value) ||\n\t\t\t\t(state.drafts_.has(value)\n\t\t\t\t\t? state.copy_!.delete(state.drafts_.get(value))\n\t\t\t\t\t: /* istanbul ignore next */ false)\n\t\t\t)\n\t\t}\n\n\t\tclear() {\n\t\t\tconst state: SetState = this[DRAFT_STATE]\n\t\t\tassertUnrevoked(state)\n\t\t\tif (latest(state).size) {\n\t\t\t\tprepareSetCopy(state)\n\t\t\t\tmarkChanged(state)\n\t\t\t\tstate.copy_!.clear()\n\t\t\t}\n\t\t}\n\n\t\tvalues(): IterableIterator {\n\t\t\tconst state: SetState = this[DRAFT_STATE]\n\t\t\tassertUnrevoked(state)\n\t\t\tprepareSetCopy(state)\n\t\t\treturn state.copy_!.values()\n\t\t}\n\n\t\tentries(): IterableIterator<[any, any]> {\n\t\t\tconst state: SetState = this[DRAFT_STATE]\n\t\t\tassertUnrevoked(state)\n\t\t\tprepareSetCopy(state)\n\t\t\treturn state.copy_!.entries()\n\t\t}\n\n\t\tkeys(): IterableIterator {\n\t\t\treturn this.values()\n\t\t}\n\n\t\t[Symbol.iterator]() {\n\t\t\treturn this.values()\n\t\t}\n\n\t\tforEach(cb: any, thisArg?: any) {\n\t\t\tconst iterator = this.values()\n\t\t\tlet result = iterator.next()\n\t\t\twhile (!result.done) {\n\t\t\t\tcb.call(thisArg, result.value, result.value, this)\n\t\t\t\tresult = iterator.next()\n\t\t\t}\n\t\t}\n\t}\n\tfunction proxySet_(target: T, parent?: ImmerState): T {\n\t\t// @ts-ignore\n\t\treturn new DraftSet(target, parent)\n\t}\n\n\tfunction prepareSetCopy(state: SetState) {\n\t\tif (!state.copy_) {\n\t\t\t// create drafts for all entries to preserve insertion order\n\t\t\tstate.copy_ = new Set()\n\t\t\tstate.base_.forEach(value => {\n\t\t\t\tif (isDraftable(value)) {\n\t\t\t\t\tconst draft = createProxy(value, state)\n\t\t\t\t\tstate.drafts_.set(value, draft)\n\t\t\t\t\tstate.copy_!.add(draft)\n\t\t\t\t} else {\n\t\t\t\t\tstate.copy_!.add(value)\n\t\t\t\t}\n\t\t\t})\n\t\t}\n\t}\n\n\tfunction assertUnrevoked(state: any /*ES5State | MapState | SetState*/) {\n\t\tif (state.revoked_) die(3, JSON.stringify(latest(state)))\n\t}\n\n\tloadPlugin(\"MapSet\", {proxyMap_, proxySet_})\n}\n", "import {\n\tIProduce,\n\tIProduceWithPatches,\n\tImmer,\n\tDraft,\n\tImmutable\n} from \"./internal\"\n\nexport {\n\tDraft,\n\tImmutable,\n\tPatch,\n\tPatchListener,\n\toriginal,\n\tcurrent,\n\tisDraft,\n\tisDraftable,\n\tNOTHING as nothing,\n\tDRAFTABLE as immerable,\n\tfreeze,\n\tObjectish\n} from \"./internal\"\n\nconst immer = new Immer()\n\n/**\n * The `produce` function takes a value and a \"recipe function\" (whose\n * return value often depends on the base state). The recipe function is\n * free to mutate its first argument however it wants. All mutations are\n * only ever applied to a __copy__ of the base state.\n *\n * Pass only a function to create a \"curried producer\" which relieves you\n * from passing the recipe function every time.\n *\n * Only plain objects and arrays are made mutable. All other objects are\n * considered uncopyable.\n *\n * Note: This function is __bound__ to its `Immer` instance.\n *\n * @param {any} base - the initial state\n * @param {Function} producer - function that receives a proxy of the base state as first argument and which can be freely modified\n * @param {Function} patchListener - optional function that will be called with all the patches produced here\n * @returns {any} a new state, or the initial state if nothing was modified\n */\nexport const produce: IProduce = immer.produce\n\n/**\n * Like `produce`, but `produceWithPatches` always returns a tuple\n * [nextState, patches, inversePatches] (instead of just the next state)\n */\nexport const produceWithPatches: IProduceWithPatches = immer.produceWithPatches.bind(\n\timmer\n)\n\n/**\n * Pass true to automatically freeze all copies created by Immer.\n *\n * Always freeze by default, even in production mode\n */\nexport const setAutoFreeze = immer.setAutoFreeze.bind(immer)\n\n/**\n * Pass true to enable strict shallow copy.\n *\n * By default, immer does not copy the object descriptors such as getter, setter and non-enumrable properties.\n */\nexport const setUseStrictShallowCopy = immer.setUseStrictShallowCopy.bind(immer)\n\n/**\n * Apply an array of Immer patches to the first argument.\n *\n * This function is a producer, which means copy-on-write is in effect.\n */\nexport const applyPatches = immer.applyPatches.bind(immer)\n\n/**\n * Create an Immer draft from the given base state, which may be a draft itself.\n * The draft can be modified until you finalize it with the `finishDraft` function.\n */\nexport const createDraft = immer.createDraft.bind(immer)\n\n/**\n * Finalize an Immer draft from a `createDraft` call, returning the base state\n * (if no changes were made) or a modified copy. The draft must *not* be\n * mutated afterwards.\n *\n * Pass a function as the 2nd argument to generate Immer patches based on the\n * changes that were made.\n */\nexport const finishDraft = immer.finishDraft.bind(immer)\n\n/**\n * This function is actually a no-op, but can be used to cast an immutable type\n * to an draft type and make TypeScript happy\n *\n * @param value\n */\nexport function castDraft(value: T): Draft {\n\treturn value as any\n}\n\n/**\n * This function is actually a no-op, but can be used to cast a mutable type\n * to an immutable type and make TypeScript happy\n * @param value\n */\nexport function castImmutable(value: T): Immutable {\n\treturn value as any\n}\n\nexport {Immer}\n\nexport {enablePatches} from \"./plugins/patches\"\nexport {enableMapSet} from \"./plugins/mapset\"\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}", "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};\ntype AsyncThunkActionCreator = IsAny AsyncThunkAction,\n// unknown handling\nunknown extends ThunkArg ? (arg: ThunkArg) => AsyncThunkAction // argument not specified or specified as void or undefined\n: [ThunkArg] extends [void] | [undefined] ? () => AsyncThunkAction // argument contains void\n: [void] extends [ThunkArg] // make optional\n? (arg?: ThunkArg) => AsyncThunkAction // argument contains undefined\n: [undefined] extends [ThunkArg] ? WithStrictNullChecks<\n// with strict nullChecks: make optional\n(arg?: ThunkArg) => AsyncThunkAction,\n// without strict null checks this will match everything, so don't make it optional\n(arg: ThunkArg) => AsyncThunkAction> // default case: normal argument\n: (arg: ThunkArg) => 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};\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): 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 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}", "import { Action, ThunkAction, configureStore } from \"@reduxjs/toolkit\";\nimport { createContext, useContext } from \"react\";\nimport { TypedUseSelectorHook, useDispatch, useSelector } from \"react-redux\";\n\nimport { StationActionCreators, StationReducer, createStationSlice } from \"Station/StationStore\";\nimport { StationsActionCreators, StationsReducer, createStationsSlice } from \"Stations/StationsStore\";\n\nimport { SearchActionCreators, SearchReducer, createSearchSlice } from \"./Search/SearchStore\";\n\nexport interface IActionCreators {\n\tsearch: SearchActionCreators;\n\tstation: StationActionCreators;\n\tstations: StationsActionCreators;\n}\n\nfunction createStore(reducer: { search: SearchReducer; station: StationReducer; stations: StationsReducer }) {\n\treturn configureStore({\n\t\treducer\n\t});\n}\n\nexport type AppDispatch = ReturnType[\"dispatch\"];\n\nexport type AppState = ReturnType[\"getState\"]>;\n\nexport type AppThunk = ThunkAction, AppState, undefined, Action>;\n\nlet actionContext: React.Context | null = null;\n\nexport function setupActions(actions: IActionCreators) {\n\tactionContext = createContext(actions);\n\n\treturn actionContext.Provider;\n}\n\nexport function useActions() {\n\tif (actionContext == null) {\n\t\tthrow new Error(\"Action context not initialized\");\n\t}\n\n\treturn [useDispatch(), useContext(actionContext)] as const;\n}\n\nexport const useStateSelector: TypedUseSelectorHook = useSelector;\n\nexport function buildStore() {\n\tconst searchSlice = createSearchSlice();\n\tconst stationSlice = createStationSlice();\n\tconst stationsSlice = createStationsSlice();\n\n\tconst store = createStore({\n\t\tsearch: searchSlice.reducer,\n\t\tstation: stationSlice.reducer,\n\t\tstations: stationsSlice.reducer\n\t});\n\n\tconst actions: IActionCreators = {\n\t\tsearch: searchSlice.actions,\n\t\tstation: stationSlice.actions,\n\t\tstations: stationsSlice.actions\n\t};\n\n\tconst ActionProvider = setupActions(actions);\n\n\treturn {\n\t\tActionProvider,\n\t\tactions,\n\t\tstore\n\t};\n}\n", "import { IStation } from \"Api/V1/Models\";\n\nexport function stationsUrl(tag?: string, page?: number): string {\n\treturn \"/stations/\"\n\t\t+ (tag ? \"withtag/\" + urlSafe(tag) + \"/\" : \"\")\n\t\t+ (page != null ? page.toString() + \"/\" : \"\");\n}\n\nexport function editStationUrl(station: IStation): string {\n\treturn station.id != null ? \"/stations/edit/\" + id(station.id) + \"/\" + urlSafe(station.title) + \"/\" : \"\";\n}\n\nexport function playlistUrl(station: IStation): string {\n\treturn station.id != null ? \"/stations/playlist/\" + id(station.id) + \"/\" + urlSafe(station.title) + \".m3u\" : \"\";\n}\n\nfunction urlSafe(part: string) {\n\tif (!part) {\n\t\treturn \"\";\n\t}\n\n\treturn part.replace(new RegExp(\"[^\\\\w\\\\.,_\\\\-\\\\(\\\\)\\\\[\\\\]]\", \"g\"), \"_\");\n}\n\nfunction id(fullId: string) {\n\treturn fullId ? fullId.substr(0, 9) : fullId;\n}\n", "import { memo, useState } from \"react\";\nimport { createRoot } from \"react-dom/client\";\n\ninterface INotification {\n\tid: number;\n\tclassName: string;\n\ticonClassName: string;\n\tmessage?: string | null;\n\ttitle: string;\n}\n\nconst Notification = memo(function Notification(props: INotification & { onClose: () => void }) {\n\treturn (\n\t\t

\n\t);\n});\n\nlet nextId = 0;\n\nlet addNotification: (className: string, iconClassName: string, timeout: number, title: string, message?: string | null) => void = () => {\n\t/* noop */\n};\n\nfunction NotificationContainer() {\n\tconst [notifications, setNotifications] = useState([]);\n\n\tfunction dismiss(id: number) {\n\t\tsetNotifications(prev => prev.filter(notification => notification.id !== id));\n\t}\n\n\taddNotification = (className: string, iconClassName: string, timeout: number, title: string, message?: string | null) => {\n\t\tconst id = nextId++;\n\t\tsetNotifications(prev => [...prev, { className, iconClassName, id, message, title }]);\n\t\tsetTimeout(() => dismiss(id), timeout);\n\t};\n\n\treturn (\n\t\t
\n\t\t\t
\n\t\t\t\t{notifications.map(notification => (\n\t\t\t\t\t dismiss(notification.id)} />\n\t\t\t\t))}\n\t\t\t
\n\t\t
\n\t);\n}\n\nconst notificationElement = document.getElementById(\"notifications\");\nif (notificationElement != null) {\n\tconst root = createRoot(notificationElement);\n\n\troot.render();\n}\n\nexport const Notify = {\n\terror(title: string, message?: string | null) {\n\t\taddNotification(\"danger\", \"bi-exclamation-circle-fill\", 5_000, title, message);\n\t},\n\tsuccess(title: string, message?: string | null) {\n\t\taddNotification(\"success\", \"bi-check-lg\", 2_000, title, message);\n\t},\n\twarning(title: string, message?: string | null) {\n\t\taddNotification(\"warning\", \"bi-exclamation-triangle-fill\", 3_000, title, message);\n\t}\n};\n", "export interface ITopbarOptions {\n\tautoRun: boolean;\n\tbarColors: [stop: number, color: string][];\n\tbarThickness: number;\n\tcontainer?: HTMLElement | null;\n\tclassName: string | null;\n\tshadowBlur: number;\n\tshadowColor: string;\n}\n\nconst defaultOptions: ITopbarOptions = {\n\tautoRun: true,\n\tbarColors: [\n\t\t[0, \"rgba(26, 188, 156, 0.9)\"],\n\t\t[0.25, \"rgba(52, 152, 219, 0.9)\"],\n\t\t[0.50, \"rgba(241, 196, 15, 0.9)\"],\n\t\t[0.75, \"rgba(230, 126, 34, 0.9)\"],\n\t\t[1, \"rgba(211, 84, 0, 0.9)\"]\n\t],\n\tbarThickness: 3,\n\tclassName: null,\n\tshadowBlur: 10,\n\tshadowColor: \"rgba(0, 0, 0, .6)\"\n};\n\nfunction createCanvas(className: string | null, inline: boolean) {\n\tconst canvas = document.createElement(\"canvas\");\n\tconst style = canvas.style;\n\tstyle.position = inline ? \"relative\" : \"fixed\";\n\tstyle.top = style.left = style.right = style.margin = style.padding = \"0\";\n\tstyle.zIndex = inline ? \"\" : \"100001\";\n\tstyle.display = \"none\";\n\n\tif (className) {\n\t\tcanvas.classList.add(className);\n\t}\n\n\treturn canvas;\n}\n\nexport function createTopbar(opts: Partial) {\n\tconst options = {\n\t\t...defaultOptions,\n\t\t...opts\n\t};\n\n\tconst canvas = createCanvas(options.className, opts.container != null);\n\tlet progressTimerId: number | null = null;\n\tlet fadeTimerId: number | null = null;\n\tlet currentProgress = 0;\n\tlet showing = false;\n\n\t(opts.container ?? document.body).appendChild(canvas);\n\twindow.addEventListener(\"resize\", repaint);\n\n\tfunction repaint() {\n\t\tcanvas.width = window.innerWidth;\n\t\tcanvas.height = options.barThickness * 5; // need space for shadow\n\n\t\tconst ctx = canvas.getContext(\"2d\");\n\t\tif (!ctx) {\n\t\t\treturn;\n\t\t}\n\n\t\tctx.shadowBlur = options.shadowBlur;\n\t\tctx.shadowColor = options.shadowColor;\n\n\t\tconst lineGradient = ctx.createLinearGradient(0, 0, canvas.width, 0);\n\n\t\tfor (const [stop, color] of options.barColors) {\n\t\t\tlineGradient.addColorStop(stop, color);\n\t\t}\n\n\t\tctx.lineWidth = options.barThickness;\n\t\tctx.beginPath();\n\t\tctx.moveTo(0, options.barThickness / 2);\n\t\tctx.lineTo(\n\t\t\tMath.ceil(currentProgress * canvas.width),\n\t\t\toptions.barThickness / 2\n\t\t);\n\t\tctx.strokeStyle = lineGradient;\n\t\tctx.stroke();\n\t}\n\n\tfunction show() {\n\t\tif (showing) {\n\t\t\treturn;\n\t\t}\n\n\t\tshowing = true;\n\n\t\tif (fadeTimerId != null) {\n\t\t\twindow.cancelAnimationFrame(fadeTimerId);\n\t\t}\n\n\t\tcanvas.style.opacity = \"1\";\n\t\tcanvas.style.display = \"block\";\n\t\tprogress(0);\n\n\t\tfunction loop() {\n\t\t\tprogressTimerId = window.requestAnimationFrame(loop);\n\t\t\tprogress(\n\t\t\t\t\"+\" + (0.05 * Math.pow(1 - Math.sqrt(currentProgress), 2)).toString()\n\t\t\t);\n\t\t}\n\n\t\tif (options.autoRun) {\n\t\t\tloop();\n\t\t}\n\t}\n\n\tfunction progress(to?: number | string) {\n\t\tif (typeof to === \"undefined\") {\n\t\t\treturn currentProgress;\n\t\t}\n\n\t\tif (typeof to === \"string\") {\n\t\t\tto = (to.includes(\"+\") || to.includes(\"-\") ? currentProgress : 0) + parseFloat(to);\n\t\t}\n\n\t\tcurrentProgress = to > 1 ? 1 : to;\n\t\trepaint();\n\n\t\treturn currentProgress;\n\t}\n\n\tfunction hide() {\n\t\tif (!showing) {\n\t\t\treturn;\n\t\t}\n\n\t\tshowing = false;\n\n\t\tif (progressTimerId != null) {\n\t\t\twindow.cancelAnimationFrame(progressTimerId);\n\t\t\tprogressTimerId = null;\n\t\t}\n\n\t\tfunction loop() {\n\t\t\tif (progress(\"+.1\") >= 1) {\n\t\t\t\tcanvas.style.opacity = (parseFloat(canvas.style.opacity) - 0.05).toString();\n\n\t\t\t\tif (parseFloat(canvas.style.opacity) <= 0.05) {\n\t\t\t\t\tcanvas.style.display = \"none\";\n\t\t\t\t\tfadeTimerId = null;\n\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tfadeTimerId = window.requestAnimationFrame(loop);\n\t\t}\n\n\t\tloop();\n\t}\n\n\treturn {\n\t\thide,\n\t\tprogress,\n\t\tshow\n\t};\n}\n", "import { createTopbar } from \"Common/Topbar\";\n\nlet progressCount = 0;\nconst topbar = createTopbar({\n\tbarColors: [\n\t\t[0, \"rgba(255, 119, 68, .7)\"],\n\t\t[1, \"rgba(255, 143, 0, .7)\"]\n\t]\n});\n\nfunction enter() {\n\tprogressCount++;\n\ttopbar.show();\n}\n\nfunction exit() {\n\tprogressCount--;\n\n\tif (progressCount === 0) {\n\t\ttopbar.hide();\n\t}\n}\n\nfunction isCanvasSupported() {\n\tconst elem = document.createElement(\"canvas\");\n\n\treturn !!elem.getContext(\"2d\");\n}\n\nexport async function progress(promise: Promise): Promise {\n\tif (!isCanvasSupported()) {\n\t\treturn promise;\n\t}\n\n\tenter();\n\n\ttry {\n\t\tconst result = await promise;\n\t\texit();\n\n\t\treturn result;\n\t} catch {\n\t\texit();\n\n\t\treturn promise;\n\t}\n}\n", "import { IStation } from \"Api/V1/Models\";\nimport { progress } from \"Services/Progress\";\n\nexport const StationApi = {\n\tcreate(station: IStation) {\n\t\treturn stationApiRequest(\"POST\", \"/api/v1/stations/create\", station);\n\t},\n\tremove(station: IStation) {\n\t\tif (!station.id) {\n\t\t\tthrow Error(\"Station ID is missing\");\n\t\t}\n\n\t\treturn stationApiRequest(\"DELETE\", `/api/v1/stations/${station.id}`);\n\t},\n\trestore(station: IStation) {\n\t\tif (!station.id) {\n\t\t\tthrow Error(\"Station ID is missing\");\n\t\t}\n\n\t\treturn stationApiRequest(\"POST\", `/api/v1/stations/${station.id}/restore`);\n\t},\n\tupdate(station: IStation) {\n\t\tif (!station.id) {\n\t\t\tthrow Error(\"Station ID is missing\");\n\t\t}\n\n\t\treturn stationApiRequest(\"POST\", `/api/v1/stations/${station.id}/update`, station);\n\t}\n};\n\nfunction stationApiRequest(method: string, url: string, station?: IStation) {\n\tconst headers = new Headers();\n\theaders.append(\"Accept\", \"application/json\");\n\theaders.append(\"Content-Type\", \"application/json\");\n\theaders.append(\"X-XSRF-TOKEN\", getAntiForgeryToken());\n\n\tconst options: RequestInit = {\n\t\tbody: JSON.stringify(station),\n\t\tcredentials: \"include\",\n\t\theaders,\n\t\tmethod\n\t};\n\n\treturn progress(fetch(url, options));\n}\n\nfunction getAntiForgeryToken(): string {\n\tconst token = document.querySelector(\"input[name=\\\"__RequestVerificationToken\\\"]\")?.value;\n\n\tif (!token) {\n\t\tthrow new Error(\"Did not find anti forgery token\");\n\t}\n\n\treturn token;\n}\n", "import { PayloadAction, createSlice } from \"@reduxjs/toolkit\";\n\nimport { IStation } from \"Api/V1/Models\";\nimport { IStationResponse } from \"Api/V1/Stations\";\nimport { editStationUrl } from \"Models/Urls\";\nimport { Notify } from \"Notifications/Notify\";\n\nimport { AppThunk, IActionCreators } from \"../Store\";\n\nimport { StationApi } from \"./StationApi\";\n\nexport interface IStationState {\n\tavailableTags: string[];\n\tdirty: boolean;\n\toperationFailed: boolean;\n\toperationInProgress: boolean;\n\tstation: IStation;\n}\n\ndeclare const stationState: IStationState;\n\nconst blankStation: IStation = {\n\tendpoints: [],\n\tid: null,\n\tlinks: {\n\t\tapplication: \"\",\n\t\tpage: \"\",\n\t\twebsite: \"\"\n\t},\n\ttags: [],\n\ttitle: \"\"\n};\n\nconst blankState: IStationState = {\n\tavailableTags: [],\n\tdirty: false,\n\toperationFailed: false,\n\toperationInProgress: false,\n\tstation: blankStation\n};\n\nfunction addTag(station: IStation, tag: string | undefined): IStation {\n\tif (tag == null) {\n\t\treturn station;\n\t}\n\n\tconst lowercaseTag = tag.toLowerCase();\n\tif (station.tags.some(t => t.toLowerCase() === lowercaseTag)) {\n\t\treturn station;\n\t}\n\n\tconst tags = [...station.tags, tag];\n\n\treturn { ...station, tags };\n}\n\nfunction removeTag(station: IStation, tag: string | undefined): IStation {\n\tif (tag == null) {\n\t\treturn station;\n\t}\n\n\tconst lowercaseTag = tag.toLowerCase();\n\tif (!station.tags.some(t => t.toLowerCase() === lowercaseTag)) {\n\t\treturn station;\n\t}\n\n\tconst tags = station.tags.filter(t => t.toLowerCase() !== lowercaseTag);\n\n\treturn { ...station, tags };\n}\n\nfunction addEndpoint(station: IStation, href: string | undefined) {\n\tif (href == null) {\n\t\treturn station;\n\t}\n\n\tconst endpoints = [...station.endpoints, { href }];\n\n\treturn { ...station, endpoints };\n}\n\nfunction removeEndpoint(station: IStation, href: string | undefined) {\n\tif (href == null) {\n\t\treturn station;\n\t}\n\n\tconst endpoints = station.endpoints.filter(endpoint => endpoint.href !== href);\n\n\treturn { ...station, endpoints };\n}\n\nfunction moveEndpoint(station: IStation, href: string | undefined, delta: number) {\n\tif (href == null) {\n\t\treturn station;\n\t}\n\n\tconst endpoints = station.endpoints.slice();\n\tconst index = endpoints.findIndex(e => e.href === href);\n\tconst endpoint = endpoints.splice(index, 1)[0];\n\tendpoints.splice(index + delta, 0, endpoint);\n\n\treturn { ...station, endpoints };\n}\n\nexport function createStationSlice() {\n\t/* eslint-disable sort-keys */\n\treturn createSlice({\n\t\tinitialState: { ...blankState, ...(typeof stationState !== \"undefined\" ? stationState : {}) },\n\t\tname: \"station\",\n\t\treducers: {\n\t\t\teditStationTitle: (state, { payload }: PayloadAction<{ title: string }>) => {\n\t\t\t\tstate.station.title = payload.title;\n\t\t\t},\n\t\t\teditStationWebsite: (state, { payload }: PayloadAction<{ url: string }>) => {\n\t\t\t\tstate.station.links.website = payload.url;\n\t\t\t},\n\t\t\taddStationEndpoint: (state, { payload }: PayloadAction<{ href: string }>) => {\n\t\t\t\tstate.station = addEndpoint(state.station, payload.href);\n\t\t\t},\n\t\t\tremoveStationEndpoint: (state, { payload }: PayloadAction<{ href: string }>) => {\n\t\t\t\tstate.station = removeEndpoint(state.station, payload.href);\n\t\t\t},\n\t\t\tmoveStationEndpointUp: (state, { payload }: PayloadAction<{ href: string }>) => {\n\t\t\t\tstate.station = moveEndpoint(state.station, payload.href, -1);\n\t\t\t},\n\t\t\tmoveStationEndpointDown: (state, { payload }: PayloadAction<{ href: string }>) => {\n\t\t\t\tstate.station = moveEndpoint(state.station, payload.href, +1);\n\t\t\t},\n\t\t\taddStationTag: (state, { payload }: PayloadAction<{ tag: string }>) => {\n\t\t\t\tstate.station = addTag(state.station, payload.tag);\n\t\t\t},\n\t\t\tremoveStationTag: (state, { payload }: PayloadAction<{ tag: string }>) => {\n\t\t\t\tstate.station = removeTag(state.station, payload.tag);\n\t\t\t},\n\t\t\tstationRequestTriggered: state => {\n\t\t\t\tstate.dirty = true;\n\t\t\t},\n\t\t\tstationRequestStarted: state => {\n\t\t\t\tstate.operationFailed = false;\n\t\t\t\tstate.operationInProgress = true;\n\t\t\t},\n\t\t\tstationRequestFailed: state => {\n\t\t\t\tstate.operationFailed = true;\n\t\t\t\tstate.operationInProgress = false;\n\t\t\t},\n\t\t\tstationRequestCompleted: (state, { payload }: PayloadAction<{ response: IStationResponse }>) => {\n\t\t\t\tif (payload.response.stations.length > 0) {\n\t\t\t\t\tconst station = payload.response.stations[0];\n\t\t\t\t\tif (state.station.id == null && station.id != null) {\n\t\t\t\t\t\twindow.location.href = editStationUrl(station);\n\t\t\t\t\t}\n\n\t\t\t\t\tstate.dirty = false;\n\t\t\t\t\tstate.operationInProgress = false;\n\t\t\t\t\tstate.station = station;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t});\n\t/* eslint-enable sort-keys */\n}\n\nexport type StationActionCreators = ReturnType[\"actions\"];\n\nexport type StationReducer = ReturnType[\"reducer\"];\n\nasync function getErrorText(response: Response): Promise<{ title: string; message: string | null }> {\n\tconst contentType = response.headers.get(\"Content-Type\");\n\tlet message = response.headers.get(\"X-ErrorMessage\");\n\tconst stackTraceBase64 = response.headers.get(\"X-Stacktrace-Base64\");\n\tif (contentType?.startsWith(\"application/json\") === true) {\n\t\tconst error = await response.json() as { exceptionMessage?: string; message?: string };\n\t\tmessage = error.exceptionMessage ?? error.message ?? null;\n\t}\n\n\tif (stackTraceBase64) {\n\t\tconsole.error(atob(stackTraceBase64));\n\t}\n\n\tif (response.status >= 400 && response.status < 500) {\n\t\treturn { message, title: \"Client error\" };\n\t}\n\n\tif (response.status >= 500 && response.status < 600) {\n\t\treturn { message, title: \"Server error\" };\n\t}\n\n\treturn { message, title: \"Unknown error\" };\n}\n\nfunction isEmpty(value: string) {\n\treturn value.length === 0;\n}\n\nexport function stationIsValid(station: IStation) {\n\tif (isEmpty(station.title) || isEmpty(station.links.website)) {\n\t\treturn false;\n\t}\n\n\tif (station.tags.length === 0 || station.endpoints.length === 0) {\n\t\treturn false;\n\t}\n\n\treturn true;\n}\n\nfunction stationApiAction(actions: IActionCreators, method: (station: IStation) => Promise, successMessage: string, validate: boolean): AppThunk {\n\treturn async (dispatch, getState) => {\n\t\tdispatch(actions.station.stationRequestTriggered());\n\n\t\tconst state = getState();\n\t\tif (validate && !stationIsValid(state.station.station)) {\n\t\t\treturn;\n\t\t}\n\n\t\tdispatch({ type: \"StationRequestStarted\" });\n\n\t\ttry {\n\t\t\tconst response = await method(state.station.station);\n\t\t\tif (response.ok) {\n\t\t\t\tconst content = await response.json() as IStationResponse;\n\t\t\t\tdispatch(actions.station.stationRequestCompleted({ response: content }));\n\t\t\t\tNotify.success(successMessage);\n\t\t\t} else {\n\t\t\t\tconst { title, message } = await getErrorText(response);\n\t\t\t\tNotify.error(title, message);\n\t\t\t\tdispatch(actions.station.stationRequestFailed());\n\t\t\t}\n\t\t} catch {\n\t\t\tNotify.error(\"Network error\");\n\t\t\tdispatch(actions.station.stationRequestFailed());\n\t\t}\n\t};\n}\n\nexport function createStation(actions: IActionCreators) {\n\treturn stationApiAction(actions, station => StationApi.create(station), \"Station created\", true);\n}\n\nexport function updateStation(actions: IActionCreators) {\n\treturn stationApiAction(actions, station => StationApi.update(station), \"Station updated\", true);\n}\n\nexport function deleteStation(actions: IActionCreators) {\n\treturn stationApiAction(actions, station => StationApi.remove(station), \"Station flagged as deleted\", false);\n}\n\nexport function restoreStation(actions: IActionCreators) {\n\treturn stationApiAction(actions, station => StationApi.restore(station), \"Station restored\", false);\n}\n", "import { createSlice } from \"@reduxjs/toolkit\";\n\nimport { IStation } from \"Api/V1/Models\";\n\nexport interface IStationsState {\n\tcanManageStations: boolean;\n\ttagName: string;\n\tpage: number;\n\tpageCount: number;\n\tprevPage?: string;\n\tnextPage?: string;\n\tstations: IStation[];\n}\n\ndeclare const stationsState: IStationsState;\n\nconst blankState: IStationsState = {\n\tcanManageStations: false,\n\tpage: 1,\n\tpageCount: 1,\n\tstations: [],\n\ttagName: \"\"\n};\n\nexport function createStationsSlice() {\n\treturn createSlice({\n\t\tinitialState: { ...blankState, ...(typeof stationsState !== \"undefined\" ? stationsState : {}) },\n\t\tname: \"stations\",\n\t\treducers: {\n\t\t}\n\t});\n}\n\nexport type StationsActionCreators = ReturnType[\"actions\"];\n\nexport type StationsReducer = ReturnType[\"reducer\"];\n", "import { PayloadAction, createSlice } from \"@reduxjs/toolkit\";\nimport debounce from \"debounce\";\n\nimport { IStation } from \"Api/V1/Models\";\nimport { ISearchResponse } from \"Api/V1/Search\";\n\nimport type { AppDispatch, AppThunk, IActionCreators } from \"../Store\";\n\nimport { SearchApi } from \"./SearchApi\";\n\nexport interface ISearchState {\n\tquery: string;\n\tsearching: boolean;\n\tsearchCompleted: boolean;\n\tsearchFailed: boolean;\n\tshowSearch: boolean;\n\tshowSearchResults: boolean;\n\tstations: IStation[];\n\ttags: string[];\n\twithinactive: boolean;\n}\n\ndeclare const searchState: ISearchState;\n\nconst blankState: ISearchState = {\n\tquery: \"\",\n\tsearchCompleted: false,\n\tsearchFailed: false,\n\tsearching: false,\n\tshowSearch: false,\n\tshowSearchResults: false,\n\tstations: [],\n\ttags: [],\n\twithinactive: false\n};\n\nexport function createSearchSlice() {\n\t/* eslint-disable sort-keys */\n\treturn createSlice({\n\t\tinitialState: { ...blankState, ...(typeof searchState !== \"undefined\" ? searchState : {}) },\n\t\tname: \"search\",\n\t\treducers: {\n\t\t\tclearSearch: () => {\n\t\t\t\treturn blankState;\n\t\t\t},\n\t\t\tsearchTriggered: (state, { payload }: PayloadAction<{ query: string }>) => {\n\t\t\t\tstate.query = payload.query;\n\t\t\t},\n\t\t\tsearchStarted: state => {\n\t\t\t\tstate.searching = true;\n\t\t\t\tstate.showSearchResults = true;\n\t\t\t},\n\t\t\tsearchFailed: (state, { payload }: PayloadAction<{ query: string }>) => {\n\t\t\t\tif (payload.query !== state.query) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tstate.searchCompleted = false;\n\t\t\t\tstate.searchFailed = true;\n\t\t\t\tstate.searching = false;\n\t\t\t\tstate.stations = [];\n\t\t\t\tstate.tags = [];\n\t\t\t},\n\t\t\tsearchCompleted: (state, { payload }: PayloadAction<{ query: string; response: ISearchResponse }>) => {\n\t\t\t\tif (payload.query !== state.query) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tstate.searchCompleted = true;\n\t\t\t\tstate.searchFailed = false;\n\t\t\t\tstate.searching = false;\n\t\t\t\tstate.stations = payload.response.stations;\n\t\t\t\tstate.tags = payload.response.tags;\n\t\t\t}\n\t\t}\n\t});\n\t/* eslint-enable sort-keys */\n}\n\nexport type SearchActionCreators = ReturnType[\"actions\"];\n\nexport type SearchReducer = ReturnType[\"reducer\"];\n\nasync function actualSearch(dispatch: AppDispatch, actions: IActionCreators, query: string, count: number, withinactive: boolean) {\n\tif (query.length < 2) {\n\t\treturn;\n\t}\n\n\tdispatch(actions.search.searchStarted());\n\n\ttry {\n\t\tdispatch(actions.search.searchCompleted({\n\t\t\tquery,\n\t\t\tresponse: await SearchApi.search(query, count, withinactive)\n\t\t}));\n\t} catch {\n\t\tdispatch(actions.search.searchFailed({ query }));\n\t}\n}\n\nconst throttledSearch = debounce(actualSearch, 500, false);\n\nexport function search(actions: IActionCreators, query: string, count: number, throttled = true): AppThunk {\n\treturn async (dispatch, getState) => {\n\t\tif (query.length === 0) {\n\t\t\tdispatch(actions.search.clearSearch());\n\n\t\t\treturn;\n\t\t}\n\n\t\tdispatch(actions.search.searchTriggered({ query }));\n\n\t\tconst state = getState();\n\t\tconst withinactive = state.search.withinactive === true;\n\t\tif (throttled) {\n\t\t\tawait throttledSearch(dispatch, actions, query, count, withinactive);\n\t\t} else {\n\t\t\tawait actualSearch(dispatch, actions, query, count, withinactive);\n\t\t}\n\t};\n}\n", "import { ISearchResponse } from \"Api/V1/Search\";\nimport { progress } from \"Services/Progress\";\n\nconst cache: Record = {};\n\ninterface IQueryParams {\n\tcount: number;\n\tquery: string;\n\twithinactive: boolean;\n}\n\nfunction getQueryString(params: Partial): string {\n\tconst keys = Object.keys(params) as (keyof IQueryParams)[];\n\n\treturn keys.map(key => `${key}=${params[key]?.toString() ?? \"\"}`).join(\"&\");\n}\n\nexport const SearchApi = {\n\tasync search(query: string, count: number, withinactive: boolean): Promise {\n\t\tconst qs = getQueryString(withinactive ? { count, query, withinactive } : { count, query });\n\t\tconst cachedResponse = cache[qs];\n\t\tif (cachedResponse) {\n\t\t\treturn cachedResponse;\n\t\t}\n\n\t\tconst headers = new Headers();\n\t\theaders.append(\"Accept\", \"application/json\");\n\n\t\tconst response = await progress(fetch(\"/api/v1/search/?\" + qs, { credentials: \"include\", headers }));\n\t\tif (response.ok) {\n\t\t\treturn cache[qs] = await response.json() as ISearchResponse;\n\t\t}\n\n\t\tthrow new Error(\"Search API error\");\n\t}\n};\n", "const formatDistanceLocale = {\n lessThanXSeconds: {\n one: \"less than a second\",\n other: \"less than {{count}} seconds\",\n },\n\n xSeconds: {\n one: \"1 second\",\n other: \"{{count}} seconds\",\n },\n\n halfAMinute: \"half a minute\",\n\n lessThanXMinutes: {\n one: \"less than a minute\",\n other: \"less than {{count}} minutes\",\n },\n\n xMinutes: {\n one: \"1 minute\",\n other: \"{{count}} minutes\",\n },\n\n aboutXHours: {\n one: \"about 1 hour\",\n other: \"about {{count}} hours\",\n },\n\n xHours: {\n one: \"1 hour\",\n other: \"{{count}} hours\",\n },\n\n xDays: {\n one: \"1 day\",\n other: \"{{count}} days\",\n },\n\n aboutXWeeks: {\n one: \"about 1 week\",\n other: \"about {{count}} weeks\",\n },\n\n xWeeks: {\n one: \"1 week\",\n other: \"{{count}} weeks\",\n },\n\n aboutXMonths: {\n one: \"about 1 month\",\n other: \"about {{count}} months\",\n },\n\n xMonths: {\n one: \"1 month\",\n other: \"{{count}} months\",\n },\n\n aboutXYears: {\n one: \"about 1 year\",\n other: \"about {{count}} years\",\n },\n\n xYears: {\n one: \"1 year\",\n other: \"{{count}} years\",\n },\n\n overXYears: {\n one: \"over 1 year\",\n other: \"over {{count}} years\",\n },\n\n almostXYears: {\n one: \"almost 1 year\",\n other: \"almost {{count}} years\",\n },\n};\n\nexport const formatDistance = (token, count, options) => {\n let result;\n\n const tokenValue = formatDistanceLocale[token];\n if (typeof tokenValue === \"string\") {\n result = tokenValue;\n } else if (count === 1) {\n result = tokenValue.one;\n } else {\n result = tokenValue.other.replace(\"{{count}}\", count.toString());\n }\n\n if (options?.addSuffix) {\n if (options.comparison && options.comparison > 0) {\n return \"in \" + result;\n } else {\n return result + \" ago\";\n }\n }\n\n return result;\n};\n", "export function buildFormatLongFn(args) {\n return (options = {}) => {\n // TODO: Remove String()\n const width = options.width ? String(options.width) : args.defaultWidth;\n const format = args.formats[width] || args.formats[args.defaultWidth];\n return format;\n };\n}\n", "import { buildFormatLongFn } from \"../../_lib/buildFormatLongFn.js\";\n\nconst dateFormats = {\n full: \"EEEE, MMMM do, y\",\n long: \"MMMM do, y\",\n medium: \"MMM d, y\",\n short: \"MM/dd/yyyy\",\n};\n\nconst timeFormats = {\n full: \"h:mm:ss a zzzz\",\n long: \"h:mm:ss a z\",\n medium: \"h:mm:ss a\",\n short: \"h:mm a\",\n};\n\nconst dateTimeFormats = {\n full: \"{{date}} 'at' {{time}}\",\n long: \"{{date}} 'at' {{time}}\",\n medium: \"{{date}}, {{time}}\",\n short: \"{{date}}, {{time}}\",\n};\n\nexport const formatLong = {\n date: buildFormatLongFn({\n formats: dateFormats,\n defaultWidth: \"full\",\n }),\n\n time: buildFormatLongFn({\n formats: timeFormats,\n defaultWidth: \"full\",\n }),\n\n dateTime: buildFormatLongFn({\n formats: dateTimeFormats,\n defaultWidth: \"full\",\n }),\n};\n", "const formatRelativeLocale = {\n lastWeek: \"'last' eeee 'at' p\",\n yesterday: \"'yesterday at' p\",\n today: \"'today at' p\",\n tomorrow: \"'tomorrow at' p\",\n nextWeek: \"eeee 'at' p\",\n other: \"P\",\n};\n\nexport const formatRelative = (token, _date, _baseDate, _options) =>\n formatRelativeLocale[token];\n", "/**\n * The localize function argument callback which allows to convert raw value to\n * the actual type.\n *\n * @param value - The value to convert\n *\n * @returns The converted value\n */\n\n/**\n * The map of localized values for each width.\n */\n\n/**\n * The index type of the locale unit value. It types conversion of units of\n * values that don't start at 0 (i.e. quarters).\n */\n\n/**\n * Converts the unit value to the tuple of values.\n */\n\n/**\n * The tuple of localized era values. The first element represents BC,\n * the second element represents AD.\n */\n\n/**\n * The tuple of localized quarter values. The first element represents Q1.\n */\n\n/**\n * The tuple of localized day values. The first element represents Sunday.\n */\n\n/**\n * The tuple of localized month values. The first element represents January.\n */\n\nexport function buildLocalizeFn(args) {\n return (value, options) => {\n const context = options?.context ? String(options.context) : \"standalone\";\n\n let valuesArray;\n if (context === \"formatting\" && args.formattingValues) {\n const defaultWidth = args.defaultFormattingWidth || args.defaultWidth;\n const width = options?.width ? String(options.width) : defaultWidth;\n\n valuesArray =\n args.formattingValues[width] || args.formattingValues[defaultWidth];\n } else {\n const defaultWidth = args.defaultWidth;\n const width = options?.width ? String(options.width) : args.defaultWidth;\n\n valuesArray = args.values[width] || args.values[defaultWidth];\n }\n const index = args.argumentCallback ? args.argumentCallback(value) : value;\n\n // @ts-expect-error - For some reason TypeScript just don't want to match it, no matter how hard we try. I challenge you to try to remove it!\n return valuesArray[index];\n };\n}\n", "import { buildLocalizeFn } from \"../../_lib/buildLocalizeFn.js\";\n\nconst eraValues = {\n narrow: [\"B\", \"A\"],\n abbreviated: [\"BC\", \"AD\"],\n wide: [\"Before Christ\", \"Anno Domini\"],\n};\n\nconst quarterValues = {\n narrow: [\"1\", \"2\", \"3\", \"4\"],\n abbreviated: [\"Q1\", \"Q2\", \"Q3\", \"Q4\"],\n wide: [\"1st quarter\", \"2nd quarter\", \"3rd quarter\", \"4th quarter\"],\n};\n\n// Note: in English, the names of days of the week and months are capitalized.\n// If you are making a new locale based on this one, check if the same is true for the language you're working on.\n// Generally, formatted dates should look like they are in the middle of a sentence,\n// e.g. in Spanish language the weekdays and months should be in the lowercase.\nconst monthValues = {\n narrow: [\"J\", \"F\", \"M\", \"A\", \"M\", \"J\", \"J\", \"A\", \"S\", \"O\", \"N\", \"D\"],\n abbreviated: [\n \"Jan\",\n \"Feb\",\n \"Mar\",\n \"Apr\",\n \"May\",\n \"Jun\",\n \"Jul\",\n \"Aug\",\n \"Sep\",\n \"Oct\",\n \"Nov\",\n \"Dec\",\n ],\n\n wide: [\n \"January\",\n \"February\",\n \"March\",\n \"April\",\n \"May\",\n \"June\",\n \"July\",\n \"August\",\n \"September\",\n \"October\",\n \"November\",\n \"December\",\n ],\n};\n\nconst dayValues = {\n narrow: [\"S\", \"M\", \"T\", \"W\", \"T\", \"F\", \"S\"],\n short: [\"Su\", \"Mo\", \"Tu\", \"We\", \"Th\", \"Fr\", \"Sa\"],\n abbreviated: [\"Sun\", \"Mon\", \"Tue\", \"Wed\", \"Thu\", \"Fri\", \"Sat\"],\n wide: [\n \"Sunday\",\n \"Monday\",\n \"Tuesday\",\n \"Wednesday\",\n \"Thursday\",\n \"Friday\",\n \"Saturday\",\n ],\n};\n\nconst dayPeriodValues = {\n narrow: {\n am: \"a\",\n pm: \"p\",\n midnight: \"mi\",\n noon: \"n\",\n morning: \"morning\",\n afternoon: \"afternoon\",\n evening: \"evening\",\n night: \"night\",\n },\n abbreviated: {\n am: \"AM\",\n pm: \"PM\",\n midnight: \"midnight\",\n noon: \"noon\",\n morning: \"morning\",\n afternoon: \"afternoon\",\n evening: \"evening\",\n night: \"night\",\n },\n wide: {\n am: \"a.m.\",\n pm: \"p.m.\",\n midnight: \"midnight\",\n noon: \"noon\",\n morning: \"morning\",\n afternoon: \"afternoon\",\n evening: \"evening\",\n night: \"night\",\n },\n};\n\nconst formattingDayPeriodValues = {\n narrow: {\n am: \"a\",\n pm: \"p\",\n midnight: \"mi\",\n noon: \"n\",\n morning: \"in the morning\",\n afternoon: \"in the afternoon\",\n evening: \"in the evening\",\n night: \"at night\",\n },\n abbreviated: {\n am: \"AM\",\n pm: \"PM\",\n midnight: \"midnight\",\n noon: \"noon\",\n morning: \"in the morning\",\n afternoon: \"in the afternoon\",\n evening: \"in the evening\",\n night: \"at night\",\n },\n wide: {\n am: \"a.m.\",\n pm: \"p.m.\",\n midnight: \"midnight\",\n noon: \"noon\",\n morning: \"in the morning\",\n afternoon: \"in the afternoon\",\n evening: \"in the evening\",\n night: \"at night\",\n },\n};\n\nconst ordinalNumber = (dirtyNumber, _options) => {\n const number = Number(dirtyNumber);\n\n // If ordinal numbers depend on context, for example,\n // if they are different for different grammatical genders,\n // use `options.unit`.\n //\n // `unit` can be 'year', 'quarter', 'month', 'week', 'date', 'dayOfYear',\n // 'day', 'hour', 'minute', 'second'.\n\n const rem100 = number % 100;\n if (rem100 > 20 || rem100 < 10) {\n switch (rem100 % 10) {\n case 1:\n return number + \"st\";\n case 2:\n return number + \"nd\";\n case 3:\n return number + \"rd\";\n }\n }\n return number + \"th\";\n};\n\nexport const localize = {\n ordinalNumber,\n\n era: buildLocalizeFn({\n values: eraValues,\n defaultWidth: \"wide\",\n }),\n\n quarter: buildLocalizeFn({\n values: quarterValues,\n defaultWidth: \"wide\",\n argumentCallback: (quarter) => quarter - 1,\n }),\n\n month: buildLocalizeFn({\n values: monthValues,\n defaultWidth: \"wide\",\n }),\n\n day: buildLocalizeFn({\n values: dayValues,\n defaultWidth: \"wide\",\n }),\n\n dayPeriod: buildLocalizeFn({\n values: dayPeriodValues,\n defaultWidth: \"wide\",\n formattingValues: formattingDayPeriodValues,\n defaultFormattingWidth: \"wide\",\n }),\n};\n", "export function buildMatchFn(args) {\n return (string, options = {}) => {\n const width = options.width;\n\n const matchPattern =\n (width && args.matchPatterns[width]) ||\n args.matchPatterns[args.defaultMatchWidth];\n const matchResult = string.match(matchPattern);\n\n if (!matchResult) {\n return null;\n }\n const matchedString = matchResult[0];\n\n const parsePatterns =\n (width && args.parsePatterns[width]) ||\n args.parsePatterns[args.defaultParseWidth];\n\n const key = Array.isArray(parsePatterns)\n ? findIndex(parsePatterns, (pattern) => pattern.test(matchedString))\n : // [TODO] -- I challenge you to fix the type\n findKey(parsePatterns, (pattern) => pattern.test(matchedString));\n\n let value;\n\n value = args.valueCallback ? args.valueCallback(key) : key;\n value = options.valueCallback\n ? // [TODO] -- I challenge you to fix the type\n options.valueCallback(value)\n : value;\n\n const rest = string.slice(matchedString.length);\n\n return { value, rest };\n };\n}\n\nfunction findKey(object, predicate) {\n for (const key in object) {\n if (\n Object.prototype.hasOwnProperty.call(object, key) &&\n predicate(object[key])\n ) {\n return key;\n }\n }\n return undefined;\n}\n\nfunction findIndex(array, predicate) {\n for (let key = 0; key < array.length; key++) {\n if (predicate(array[key])) {\n return key;\n }\n }\n return undefined;\n}\n", "export function buildMatchPatternFn(args) {\n return (string, options = {}) => {\n const matchResult = string.match(args.matchPattern);\n if (!matchResult) return null;\n const matchedString = matchResult[0];\n\n const parseResult = string.match(args.parsePattern);\n if (!parseResult) return null;\n let value = args.valueCallback\n ? args.valueCallback(parseResult[0])\n : parseResult[0];\n\n // [TODO] I challenge you to fix the type\n value = options.valueCallback ? options.valueCallback(value) : value;\n\n const rest = string.slice(matchedString.length);\n\n return { value, rest };\n };\n}\n", "import { buildMatchFn } from \"../../_lib/buildMatchFn.js\";\nimport { buildMatchPatternFn } from \"../../_lib/buildMatchPatternFn.js\";\n\nconst matchOrdinalNumberPattern = /^(\\d+)(th|st|nd|rd)?/i;\nconst parseOrdinalNumberPattern = /\\d+/i;\n\nconst matchEraPatterns = {\n narrow: /^(b|a)/i,\n abbreviated: /^(b\\.?\\s?c\\.?|b\\.?\\s?c\\.?\\s?e\\.?|a\\.?\\s?d\\.?|c\\.?\\s?e\\.?)/i,\n wide: /^(before christ|before common era|anno domini|common era)/i,\n};\nconst parseEraPatterns = {\n any: [/^b/i, /^(a|c)/i],\n};\n\nconst matchQuarterPatterns = {\n narrow: /^[1234]/i,\n abbreviated: /^q[1234]/i,\n wide: /^[1234](th|st|nd|rd)? quarter/i,\n};\nconst parseQuarterPatterns = {\n any: [/1/i, /2/i, /3/i, /4/i],\n};\n\nconst matchMonthPatterns = {\n narrow: /^[jfmasond]/i,\n abbreviated: /^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,\n wide: /^(january|february|march|april|may|june|july|august|september|october|november|december)/i,\n};\nconst parseMonthPatterns = {\n narrow: [\n /^j/i,\n /^f/i,\n /^m/i,\n /^a/i,\n /^m/i,\n /^j/i,\n /^j/i,\n /^a/i,\n /^s/i,\n /^o/i,\n /^n/i,\n /^d/i,\n ],\n\n any: [\n /^ja/i,\n /^f/i,\n /^mar/i,\n /^ap/i,\n /^may/i,\n /^jun/i,\n /^jul/i,\n /^au/i,\n /^s/i,\n /^o/i,\n /^n/i,\n /^d/i,\n ],\n};\n\nconst matchDayPatterns = {\n narrow: /^[smtwf]/i,\n short: /^(su|mo|tu|we|th|fr|sa)/i,\n abbreviated: /^(sun|mon|tue|wed|thu|fri|sat)/i,\n wide: /^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i,\n};\nconst parseDayPatterns = {\n narrow: [/^s/i, /^m/i, /^t/i, /^w/i, /^t/i, /^f/i, /^s/i],\n any: [/^su/i, /^m/i, /^tu/i, /^w/i, /^th/i, /^f/i, /^sa/i],\n};\n\nconst matchDayPeriodPatterns = {\n narrow: /^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,\n any: /^([ap]\\.?\\s?m\\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i,\n};\nconst parseDayPeriodPatterns = {\n any: {\n am: /^a/i,\n pm: /^p/i,\n midnight: /^mi/i,\n noon: /^no/i,\n morning: /morning/i,\n afternoon: /afternoon/i,\n evening: /evening/i,\n night: /night/i,\n },\n};\n\nexport const match = {\n ordinalNumber: buildMatchPatternFn({\n matchPattern: matchOrdinalNumberPattern,\n parsePattern: parseOrdinalNumberPattern,\n valueCallback: (value) => parseInt(value, 10),\n }),\n\n era: buildMatchFn({\n matchPatterns: matchEraPatterns,\n defaultMatchWidth: \"wide\",\n parsePatterns: parseEraPatterns,\n defaultParseWidth: \"any\",\n }),\n\n quarter: buildMatchFn({\n matchPatterns: matchQuarterPatterns,\n defaultMatchWidth: \"wide\",\n parsePatterns: parseQuarterPatterns,\n defaultParseWidth: \"any\",\n valueCallback: (index) => index + 1,\n }),\n\n month: buildMatchFn({\n matchPatterns: matchMonthPatterns,\n defaultMatchWidth: \"wide\",\n parsePatterns: parseMonthPatterns,\n defaultParseWidth: \"any\",\n }),\n\n day: buildMatchFn({\n matchPatterns: matchDayPatterns,\n defaultMatchWidth: \"wide\",\n parsePatterns: parseDayPatterns,\n defaultParseWidth: \"any\",\n }),\n\n dayPeriod: buildMatchFn({\n matchPatterns: matchDayPeriodPatterns,\n defaultMatchWidth: \"any\",\n parsePatterns: parseDayPeriodPatterns,\n defaultParseWidth: \"any\",\n }),\n};\n", "import { formatDistance } from \"./en-US/_lib/formatDistance.js\";\nimport { formatLong } from \"./en-US/_lib/formatLong.js\";\nimport { formatRelative } from \"./en-US/_lib/formatRelative.js\";\nimport { localize } from \"./en-US/_lib/localize.js\";\nimport { match } from \"./en-US/_lib/match.js\";\n\n/**\n * @category Locales\n * @summary English locale (United States).\n * @language English\n * @iso-639-2 eng\n * @author Sasha Koss [@kossnocorp](https://github.com/kossnocorp)\n * @author Lesha Koss [@leshakoss](https://github.com/leshakoss)\n */\nexport const enUS = {\n code: \"en-US\",\n formatDistance: formatDistance,\n formatLong: formatLong,\n formatRelative: formatRelative,\n localize: localize,\n match: match,\n options: {\n weekStartsOn: 0 /* Sunday */,\n firstWeekContainsDate: 1,\n },\n};\n\n// Fallback for modularized imports:\nexport default enUS;\n", "let defaultOptions = {};\n\nexport function getDefaultOptions() {\n return defaultOptions;\n}\n\nexport function setDefaultOptions(newOptions) {\n defaultOptions = newOptions;\n}\n", "/**\n * @module constants\n * @summary Useful constants\n * @description\n * Collection of useful date constants.\n *\n * The constants could be imported from `date-fns/constants`:\n *\n * ```ts\n * import { maxTime, minTime } from \"./constants/date-fns/constants\";\n *\n * function isAllowedTime(time) {\n * return time <= maxTime && time >= minTime;\n * }\n * ```\n */\n\n/**\n * @constant\n * @name daysInWeek\n * @summary Days in 1 week.\n */\nexport const daysInWeek = 7;\n\n/**\n * @constant\n * @name daysInYear\n * @summary Days in 1 year.\n *\n * @description\n * How many days in a year.\n *\n * One years equals 365.2425 days according to the formula:\n *\n * > Leap year occurs every 4 years, except for years that are divisible by 100 and not divisible by 400.\n * > 1 mean year = (365+1/4-1/100+1/400) days = 365.2425 days\n */\nexport const daysInYear = 365.2425;\n\n/**\n * @constant\n * @name maxTime\n * @summary Maximum allowed time.\n *\n * @example\n * import { maxTime } from \"./constants/date-fns/constants\";\n *\n * const isValid = 8640000000000001 <= maxTime;\n * //=> false\n *\n * new Date(8640000000000001);\n * //=> Invalid Date\n */\nexport const maxTime = Math.pow(10, 8) * 24 * 60 * 60 * 1000;\n\n/**\n * @constant\n * @name minTime\n * @summary Minimum allowed time.\n *\n * @example\n * import { minTime } from \"./constants/date-fns/constants\";\n *\n * const isValid = -8640000000000001 >= minTime;\n * //=> false\n *\n * new Date(-8640000000000001)\n * //=> Invalid Date\n */\nexport const minTime = -maxTime;\n\n/**\n * @constant\n * @name millisecondsInWeek\n * @summary Milliseconds in 1 week.\n */\nexport const millisecondsInWeek = 604800000;\n\n/**\n * @constant\n * @name millisecondsInDay\n * @summary Milliseconds in 1 day.\n */\nexport const millisecondsInDay = 86400000;\n\n/**\n * @constant\n * @name millisecondsInMinute\n * @summary Milliseconds in 1 minute\n */\nexport const millisecondsInMinute = 60000;\n\n/**\n * @constant\n * @name millisecondsInHour\n * @summary Milliseconds in 1 hour\n */\nexport const millisecondsInHour = 3600000;\n\n/**\n * @constant\n * @name millisecondsInSecond\n * @summary Milliseconds in 1 second\n */\nexport const millisecondsInSecond = 1000;\n\n/**\n * @constant\n * @name minutesInYear\n * @summary Minutes in 1 year.\n */\nexport const minutesInYear = 525600;\n\n/**\n * @constant\n * @name minutesInMonth\n * @summary Minutes in 1 month.\n */\nexport const minutesInMonth = 43200;\n\n/**\n * @constant\n * @name minutesInDay\n * @summary Minutes in 1 day.\n */\nexport const minutesInDay = 1440;\n\n/**\n * @constant\n * @name minutesInHour\n * @summary Minutes in 1 hour.\n */\nexport const minutesInHour = 60;\n\n/**\n * @constant\n * @name monthsInQuarter\n * @summary Months in 1 quarter.\n */\nexport const monthsInQuarter = 3;\n\n/**\n * @constant\n * @name monthsInYear\n * @summary Months in 1 year.\n */\nexport const monthsInYear = 12;\n\n/**\n * @constant\n * @name quartersInYear\n * @summary Quarters in 1 year\n */\nexport const quartersInYear = 4;\n\n/**\n * @constant\n * @name secondsInHour\n * @summary Seconds in 1 hour.\n */\nexport const secondsInHour = 3600;\n\n/**\n * @constant\n * @name secondsInMinute\n * @summary Seconds in 1 minute.\n */\nexport const secondsInMinute = 60;\n\n/**\n * @constant\n * @name secondsInDay\n * @summary Seconds in 1 day.\n */\nexport const secondsInDay = secondsInHour * 24;\n\n/**\n * @constant\n * @name secondsInWeek\n * @summary Seconds in 1 week.\n */\nexport const secondsInWeek = secondsInDay * 7;\n\n/**\n * @constant\n * @name secondsInYear\n * @summary Seconds in 1 year.\n */\nexport const secondsInYear = secondsInDay * daysInYear;\n\n/**\n * @constant\n * @name secondsInMonth\n * @summary Seconds in 1 month\n */\nexport const secondsInMonth = secondsInYear / 12;\n\n/**\n * @constant\n * @name secondsInQuarter\n * @summary Seconds in 1 quarter.\n */\nexport const secondsInQuarter = secondsInMonth * 3;\n\n/**\n * @constant\n * @name constructFromSymbol\n * @summary Symbol enabling Date extensions to inherit properties from the reference date.\n *\n * The symbol is used to enable the `constructFrom` function to construct a date\n * using a reference date and a value. It allows to transfer extra properties\n * from the reference date to the new date. It's useful for extensions like\n * [`TZDate`](https://github.com/date-fns/tz) that accept a time zone as\n * a constructor argument.\n */\nexport const constructFromSymbol = Symbol.for(\"constructDateFrom\");\n", "import { constructFromSymbol } from \"./constants.js\";\n\n/**\n * @name constructFrom\n * @category Generic Helpers\n * @summary Constructs a date using the reference date and the value\n *\n * @description\n * The function constructs a new date using the constructor from the reference\n * date and the given value. It helps to build generic functions that accept\n * date extensions.\n *\n * It defaults to `Date` if the passed reference date is a number or a string.\n *\n * Starting from v3.7.0, it allows to construct a date using `[Symbol.for(\"constructDateFrom\")]`\n * enabling to transfer extra properties from the reference date to the new date.\n * It's useful for extensions like [`TZDate`](https://github.com/date-fns/tz)\n * that accept a time zone as a constructor argument.\n *\n * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).\n *\n * @param date - The reference date to take constructor from\n * @param value - The value to create the date\n *\n * @returns Date initialized using the given date and value\n *\n * @example\n * import { constructFrom } from \"./constructFrom/date-fns\";\n *\n * // A function that clones a date preserving the original type\n * function cloneDate(date: DateType): DateType {\n * return constructFrom(\n * date, // Use constructor from the given date\n * date.getTime() // Use the date value to create a new date\n * );\n * }\n */\nexport function constructFrom(date, value) {\n if (typeof date === \"function\") return date(value);\n\n if (date && typeof date === \"object\" && constructFromSymbol in date)\n return date[constructFromSymbol](value);\n\n if (date instanceof Date) return new date.constructor(value);\n\n return new Date(value);\n}\n\n// Fallback for modularized imports:\nexport default constructFrom;\n", "import { constructFrom } from \"./constructFrom.js\";\n\n/**\n * @name toDate\n * @category Common Helpers\n * @summary Convert the given argument to an instance of Date.\n *\n * @description\n * Convert the given argument to an instance of Date.\n *\n * If the argument is an instance of Date, the function returns its clone.\n *\n * If the argument is a number, it is treated as a timestamp.\n *\n * If the argument is none of the above, the function returns Invalid Date.\n *\n * Starting from v3.7.0, it clones a date using `[Symbol.for(\"constructDateFrom\")]`\n * enabling to transfer extra properties from the reference date to the new date.\n * It's useful for extensions like [`TZDate`](https://github.com/date-fns/tz)\n * that accept a time zone as a constructor argument.\n *\n * **Note**: *all* Date arguments passed to any *date-fns* function is processed by `toDate`.\n *\n * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).\n * @typeParam ResultDate - The result `Date` type, it is the type returned from the context function if it is passed, or inferred from the arguments.\n *\n * @param argument - The value to convert\n *\n * @returns The parsed date in the local time zone\n *\n * @example\n * // Clone the date:\n * const result = toDate(new Date(2014, 1, 11, 11, 30, 30))\n * //=> Tue Feb 11 2014 11:30:30\n *\n * @example\n * // Convert the timestamp to date:\n * const result = toDate(1392098430000)\n * //=> Tue Feb 11 2014 11:30:30\n */\nexport function toDate(argument, context) {\n // [TODO] Get rid of `toDate` or `constructFrom`?\n return constructFrom(context || argument, argument);\n}\n\n// Fallback for modularized imports:\nexport default toDate;\n", "import { toDate } from \"../toDate.js\";\n\n/**\n * Google Chrome as of 67.0.3396.87 introduced timezones with offset that includes seconds.\n * They usually appear for dates that denote time before the timezones were introduced\n * (e.g. for 'Europe/Prague' timezone the offset is GMT+00:57:44 before 1 October 1891\n * and GMT+01:00:00 after that date)\n *\n * Date#getTimezoneOffset returns the offset in minutes and would return 57 for the example above,\n * which would lead to incorrect calculations.\n *\n * This function returns the timezone offset in milliseconds that takes seconds in account.\n */\nexport function getTimezoneOffsetInMilliseconds(date) {\n const _date = toDate(date);\n const utcDate = new Date(\n Date.UTC(\n _date.getFullYear(),\n _date.getMonth(),\n _date.getDate(),\n _date.getHours(),\n _date.getMinutes(),\n _date.getSeconds(),\n _date.getMilliseconds(),\n ),\n );\n utcDate.setUTCFullYear(_date.getFullYear());\n return +date - +utcDate;\n}\n", "import { constructFrom } from \"../constructFrom.js\";\n\nexport function normalizeDates(context, ...dates) {\n const normalize = constructFrom.bind(\n null,\n context || dates.find((date) => typeof date === \"object\"),\n );\n return dates.map(normalize);\n}\n", "import { toDate } from \"./toDate.js\";\n\n/**\n * The {@link startOfDay} function options.\n */\n\n/**\n * @name startOfDay\n * @category Day Helpers\n * @summary Return the start of a day for the given date.\n *\n * @description\n * Return the start of a day for the given date.\n * The result will be in the local timezone.\n *\n * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).\n * @typeParam ResultDate - The result `Date` type, it is the type returned from the context function if it is passed, or inferred from the arguments.\n *\n * @param date - The original date\n * @param options - The options\n *\n * @returns The start of a day\n *\n * @example\n * // The start of a day for 2 September 2014 11:55:00:\n * const result = startOfDay(new Date(2014, 8, 2, 11, 55, 0))\n * //=> Tue Sep 02 2014 00:00:00\n */\nexport function startOfDay(date, options) {\n const _date = toDate(date, options?.in);\n _date.setHours(0, 0, 0, 0);\n return _date;\n}\n\n// Fallback for modularized imports:\nexport default startOfDay;\n", "import { getTimezoneOffsetInMilliseconds } from \"./_lib/getTimezoneOffsetInMilliseconds.js\";\nimport { normalizeDates } from \"./_lib/normalizeDates.js\";\nimport { millisecondsInDay } from \"./constants.js\";\nimport { startOfDay } from \"./startOfDay.js\";\n\n/**\n * The {@link differenceInCalendarDays} function options.\n */\n\n/**\n * @name differenceInCalendarDays\n * @category Day Helpers\n * @summary Get the number of calendar days between the given dates.\n *\n * @description\n * Get the number of calendar days between the given dates. This means that the times are removed\n * from the dates and then the difference in days is calculated.\n *\n * @param laterDate - The later date\n * @param earlierDate - The earlier date\n * @param options - The options object\n *\n * @returns The number of calendar days\n *\n * @example\n * // How many calendar days are between\n * // 2 July 2011 23:00:00 and 2 July 2012 00:00:00?\n * const result = differenceInCalendarDays(\n * new Date(2012, 6, 2, 0, 0),\n * new Date(2011, 6, 2, 23, 0)\n * )\n * //=> 366\n * // How many calendar days are between\n * // 2 July 2011 23:59:00 and 3 July 2011 00:01:00?\n * const result = differenceInCalendarDays(\n * new Date(2011, 6, 3, 0, 1),\n * new Date(2011, 6, 2, 23, 59)\n * )\n * //=> 1\n */\nexport function differenceInCalendarDays(laterDate, earlierDate, options) {\n const [laterDate_, earlierDate_] = normalizeDates(\n options?.in,\n laterDate,\n earlierDate,\n );\n\n const laterStartOfDay = startOfDay(laterDate_);\n const earlierStartOfDay = startOfDay(earlierDate_);\n\n const laterTimestamp =\n +laterStartOfDay - getTimezoneOffsetInMilliseconds(laterStartOfDay);\n const earlierTimestamp =\n +earlierStartOfDay - getTimezoneOffsetInMilliseconds(earlierStartOfDay);\n\n // Round the number of days to the nearest integer because the number of\n // milliseconds in a day is not constant (e.g. it's different in the week of\n // the daylight saving time clock shift).\n return Math.round((laterTimestamp - earlierTimestamp) / millisecondsInDay);\n}\n\n// Fallback for modularized imports:\nexport default differenceInCalendarDays;\n", "import { toDate } from \"./toDate.js\";\n\n/**\n * The {@link startOfYear} function options.\n */\n\n/**\n * @name startOfYear\n * @category Year Helpers\n * @summary Return the start of a year for the given date.\n *\n * @description\n * Return the start of a year for the given date.\n * The result will be in the local timezone.\n *\n * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).\n * @typeParam ResultDate - The result `Date` type, it is the type returned from the context function if it is passed, or inferred from the arguments.\n *\n * @param date - The original date\n * @param options - The options\n *\n * @returns The start of a year\n *\n * @example\n * // The start of a year for 2 September 2014 11:55:00:\n * const result = startOfYear(new Date(2014, 8, 2, 11, 55, 00))\n * //=> Wed Jan 01 2014 00:00:00\n */\nexport function startOfYear(date, options) {\n const date_ = toDate(date, options?.in);\n date_.setFullYear(date_.getFullYear(), 0, 1);\n date_.setHours(0, 0, 0, 0);\n return date_;\n}\n\n// Fallback for modularized imports:\nexport default startOfYear;\n", "import { differenceInCalendarDays } from \"./differenceInCalendarDays.js\";\nimport { startOfYear } from \"./startOfYear.js\";\nimport { toDate } from \"./toDate.js\";\n\n/**\n * The {@link getDayOfYear} function options.\n */\n\n/**\n * @name getDayOfYear\n * @category Day Helpers\n * @summary Get the day of the year of the given date.\n *\n * @description\n * Get the day of the year of the given date.\n *\n * @param date - The given date\n * @param options - The options\n *\n * @returns The day of year\n *\n * @example\n * // Which day of the year is 2 July 2014?\n * const result = getDayOfYear(new Date(2014, 6, 2))\n * //=> 183\n */\nexport function getDayOfYear(date, options) {\n const _date = toDate(date, options?.in);\n const diff = differenceInCalendarDays(_date, startOfYear(_date));\n const dayOfYear = diff + 1;\n return dayOfYear;\n}\n\n// Fallback for modularized imports:\nexport default getDayOfYear;\n", "import { getDefaultOptions } from \"./_lib/defaultOptions.js\";\nimport { toDate } from \"./toDate.js\";\n\n/**\n * The {@link startOfWeek} function options.\n */\n\n/**\n * @name startOfWeek\n * @category Week Helpers\n * @summary Return the start of a week for the given date.\n *\n * @description\n * Return the start of a week for the given date.\n * The result will be in the local timezone.\n *\n * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).\n * @typeParam ResultDate - The result `Date` type, it is the type returned from the context function if it is passed, or inferred from the arguments.\n *\n * @param date - The original date\n * @param options - An object with options\n *\n * @returns The start of a week\n *\n * @example\n * // The start of a week for 2 September 2014 11:55:00:\n * const result = startOfWeek(new Date(2014, 8, 2, 11, 55, 0))\n * //=> Sun Aug 31 2014 00:00:00\n *\n * @example\n * // If the week starts on Monday, the start of the week for 2 September 2014 11:55:00:\n * const result = startOfWeek(new Date(2014, 8, 2, 11, 55, 0), { weekStartsOn: 1 })\n * //=> Mon Sep 01 2014 00:00:00\n */\nexport function startOfWeek(date, options) {\n const defaultOptions = getDefaultOptions();\n const weekStartsOn =\n options?.weekStartsOn ??\n options?.locale?.options?.weekStartsOn ??\n defaultOptions.weekStartsOn ??\n defaultOptions.locale?.options?.weekStartsOn ??\n 0;\n\n const _date = toDate(date, options?.in);\n const day = _date.getDay();\n const diff = (day < weekStartsOn ? 7 : 0) + day - weekStartsOn;\n\n _date.setDate(_date.getDate() - diff);\n _date.setHours(0, 0, 0, 0);\n return _date;\n}\n\n// Fallback for modularized imports:\nexport default startOfWeek;\n", "import { startOfWeek } from \"./startOfWeek.js\";\n\n/**\n * The {@link startOfISOWeek} function options.\n */\n\n/**\n * @name startOfISOWeek\n * @category ISO Week Helpers\n * @summary Return the start of an ISO week for the given date.\n *\n * @description\n * Return the start of an ISO week for the given date.\n * The result will be in the local timezone.\n *\n * ISO week-numbering year: http://en.wikipedia.org/wiki/ISO_week_date\n *\n * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).\n * @typeParam ResultDate - The result `Date` type, it is the type returned from the context function if it is passed, or inferred from the arguments.\n *\n * @param date - The original date\n * @param options - An object with options\n *\n * @returns The start of an ISO week\n *\n * @example\n * // The start of an ISO week for 2 September 2014 11:55:00:\n * const result = startOfISOWeek(new Date(2014, 8, 2, 11, 55, 0))\n * //=> Mon Sep 01 2014 00:00:00\n */\nexport function startOfISOWeek(date, options) {\n return startOfWeek(date, { ...options, weekStartsOn: 1 });\n}\n\n// Fallback for modularized imports:\nexport default startOfISOWeek;\n", "import { constructFrom } from \"./constructFrom.js\";\nimport { startOfISOWeek } from \"./startOfISOWeek.js\";\nimport { toDate } from \"./toDate.js\";\n\n/**\n * The {@link getISOWeekYear} function options.\n */\n\n/**\n * @name getISOWeekYear\n * @category ISO Week-Numbering Year Helpers\n * @summary Get the ISO week-numbering year of the given date.\n *\n * @description\n * Get the ISO week-numbering year of the given date,\n * which always starts 3 days before the year's first Thursday.\n *\n * ISO week-numbering year: http://en.wikipedia.org/wiki/ISO_week_date\n *\n * @param date - The given date\n *\n * @returns The ISO week-numbering year\n *\n * @example\n * // Which ISO-week numbering year is 2 January 2005?\n * const result = getISOWeekYear(new Date(2005, 0, 2))\n * //=> 2004\n */\nexport function getISOWeekYear(date, options) {\n const _date = toDate(date, options?.in);\n const year = _date.getFullYear();\n\n const fourthOfJanuaryOfNextYear = constructFrom(_date, 0);\n fourthOfJanuaryOfNextYear.setFullYear(year + 1, 0, 4);\n fourthOfJanuaryOfNextYear.setHours(0, 0, 0, 0);\n const startOfNextYear = startOfISOWeek(fourthOfJanuaryOfNextYear);\n\n const fourthOfJanuaryOfThisYear = constructFrom(_date, 0);\n fourthOfJanuaryOfThisYear.setFullYear(year, 0, 4);\n fourthOfJanuaryOfThisYear.setHours(0, 0, 0, 0);\n const startOfThisYear = startOfISOWeek(fourthOfJanuaryOfThisYear);\n\n if (_date.getTime() >= startOfNextYear.getTime()) {\n return year + 1;\n } else if (_date.getTime() >= startOfThisYear.getTime()) {\n return year;\n } else {\n return year - 1;\n }\n}\n\n// Fallback for modularized imports:\nexport default getISOWeekYear;\n", "import { constructFrom } from \"./constructFrom.js\";\nimport { getISOWeekYear } from \"./getISOWeekYear.js\";\nimport { startOfISOWeek } from \"./startOfISOWeek.js\";\n\n/**\n * The {@link startOfISOWeekYear} function options.\n */\n\n/**\n * @name startOfISOWeekYear\n * @category ISO Week-Numbering Year Helpers\n * @summary Return the start of an ISO week-numbering year for the given date.\n *\n * @description\n * Return the start of an ISO week-numbering year,\n * which always starts 3 days before the year's first Thursday.\n * The result will be in the local timezone.\n *\n * ISO week-numbering year: http://en.wikipedia.org/wiki/ISO_week_date\n *\n * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).\n * @typeParam ResultDate - The result `Date` type, it is the type returned from the context function if it is passed, or inferred from the arguments.\n *\n * @param date - The original date\n * @param options - An object with options\n *\n * @returns The start of an ISO week-numbering year\n *\n * @example\n * // The start of an ISO week-numbering year for 2 July 2005:\n * const result = startOfISOWeekYear(new Date(2005, 6, 2))\n * //=> Mon Jan 03 2005 00:00:00\n */\nexport function startOfISOWeekYear(date, options) {\n const year = getISOWeekYear(date, options);\n const fourthOfJanuary = constructFrom(options?.in || date, 0);\n fourthOfJanuary.setFullYear(year, 0, 4);\n fourthOfJanuary.setHours(0, 0, 0, 0);\n return startOfISOWeek(fourthOfJanuary);\n}\n\n// Fallback for modularized imports:\nexport default startOfISOWeekYear;\n", "import { millisecondsInWeek } from \"./constants.js\";\nimport { startOfISOWeek } from \"./startOfISOWeek.js\";\nimport { startOfISOWeekYear } from \"./startOfISOWeekYear.js\";\nimport { toDate } from \"./toDate.js\";\n\n/**\n * The {@link getISOWeek} function options.\n */\n\n/**\n * @name getISOWeek\n * @category ISO Week Helpers\n * @summary Get the ISO week of the given date.\n *\n * @description\n * Get the ISO week of the given date.\n *\n * ISO week-numbering year: http://en.wikipedia.org/wiki/ISO_week_date\n *\n * @param date - The given date\n * @param options - The options\n *\n * @returns The ISO week\n *\n * @example\n * // Which week of the ISO-week numbering year is 2 January 2005?\n * const result = getISOWeek(new Date(2005, 0, 2))\n * //=> 53\n */\nexport function getISOWeek(date, options) {\n const _date = toDate(date, options?.in);\n const diff = +startOfISOWeek(_date) - +startOfISOWeekYear(_date);\n\n // Round the number of weeks to the nearest integer because the number of\n // milliseconds in a week is not constant (e.g. it's different in the week of\n // the daylight saving time clock shift).\n return Math.round(diff / millisecondsInWeek) + 1;\n}\n\n// Fallback for modularized imports:\nexport default getISOWeek;\n", "import { getDefaultOptions } from \"./_lib/defaultOptions.js\";\nimport { constructFrom } from \"./constructFrom.js\";\nimport { startOfWeek } from \"./startOfWeek.js\";\nimport { toDate } from \"./toDate.js\";\n\n/**\n * The {@link getWeekYear} function options.\n */\n\n/**\n * @name getWeekYear\n * @category Week-Numbering Year Helpers\n * @summary Get the local week-numbering year of the given date.\n *\n * @description\n * Get the local week-numbering year of the given date.\n * The exact calculation depends on the values of\n * `options.weekStartsOn` (which is the index of the first day of the week)\n * and `options.firstWeekContainsDate` (which is the day of January, which is always in\n * the first week of the week-numbering year)\n *\n * Week numbering: https://en.wikipedia.org/wiki/Week#The_ISO_week_date_system\n *\n * @param date - The given date\n * @param options - An object with options.\n *\n * @returns The local week-numbering year\n *\n * @example\n * // Which week numbering year is 26 December 2004 with the default settings?\n * const result = getWeekYear(new Date(2004, 11, 26))\n * //=> 2005\n *\n * @example\n * // Which week numbering year is 26 December 2004 if week starts on Saturday?\n * const result = getWeekYear(new Date(2004, 11, 26), { weekStartsOn: 6 })\n * //=> 2004\n *\n * @example\n * // Which week numbering year is 26 December 2004 if the first week contains 4 January?\n * const result = getWeekYear(new Date(2004, 11, 26), { firstWeekContainsDate: 4 })\n * //=> 2004\n */\nexport function getWeekYear(date, options) {\n const _date = toDate(date, options?.in);\n const year = _date.getFullYear();\n\n const defaultOptions = getDefaultOptions();\n const firstWeekContainsDate =\n options?.firstWeekContainsDate ??\n options?.locale?.options?.firstWeekContainsDate ??\n defaultOptions.firstWeekContainsDate ??\n defaultOptions.locale?.options?.firstWeekContainsDate ??\n 1;\n\n const firstWeekOfNextYear = constructFrom(options?.in || date, 0);\n firstWeekOfNextYear.setFullYear(year + 1, 0, firstWeekContainsDate);\n firstWeekOfNextYear.setHours(0, 0, 0, 0);\n const startOfNextYear = startOfWeek(firstWeekOfNextYear, options);\n\n const firstWeekOfThisYear = constructFrom(options?.in || date, 0);\n firstWeekOfThisYear.setFullYear(year, 0, firstWeekContainsDate);\n firstWeekOfThisYear.setHours(0, 0, 0, 0);\n const startOfThisYear = startOfWeek(firstWeekOfThisYear, options);\n\n if (+_date >= +startOfNextYear) {\n return year + 1;\n } else if (+_date >= +startOfThisYear) {\n return year;\n } else {\n return year - 1;\n }\n}\n\n// Fallback for modularized imports:\nexport default getWeekYear;\n", "import { getDefaultOptions } from \"./_lib/defaultOptions.js\";\nimport { constructFrom } from \"./constructFrom.js\";\nimport { getWeekYear } from \"./getWeekYear.js\";\nimport { startOfWeek } from \"./startOfWeek.js\";\n\n/**\n * The {@link startOfWeekYear} function options.\n */\n\n/**\n * @name startOfWeekYear\n * @category Week-Numbering Year Helpers\n * @summary Return the start of a local week-numbering year for the given date.\n *\n * @description\n * Return the start of a local week-numbering year.\n * The exact calculation depends on the values of\n * `options.weekStartsOn` (which is the index of the first day of the week)\n * and `options.firstWeekContainsDate` (which is the day of January, which is always in\n * the first week of the week-numbering year)\n *\n * Week numbering: https://en.wikipedia.org/wiki/Week#The_ISO_week_date_system\n *\n * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).\n * @typeParam ResultDate - The result `Date` type.\n *\n * @param date - The original date\n * @param options - An object with options\n *\n * @returns The start of a week-numbering year\n *\n * @example\n * // The start of an a week-numbering year for 2 July 2005 with default settings:\n * const result = startOfWeekYear(new Date(2005, 6, 2))\n * //=> Sun Dec 26 2004 00:00:00\n *\n * @example\n * // The start of a week-numbering year for 2 July 2005\n * // if Monday is the first day of week\n * // and 4 January is always in the first week of the year:\n * const result = startOfWeekYear(new Date(2005, 6, 2), {\n * weekStartsOn: 1,\n * firstWeekContainsDate: 4\n * })\n * //=> Mon Jan 03 2005 00:00:00\n */\nexport function startOfWeekYear(date, options) {\n const defaultOptions = getDefaultOptions();\n const firstWeekContainsDate =\n options?.firstWeekContainsDate ??\n options?.locale?.options?.firstWeekContainsDate ??\n defaultOptions.firstWeekContainsDate ??\n defaultOptions.locale?.options?.firstWeekContainsDate ??\n 1;\n\n const year = getWeekYear(date, options);\n const firstWeek = constructFrom(options?.in || date, 0);\n firstWeek.setFullYear(year, 0, firstWeekContainsDate);\n firstWeek.setHours(0, 0, 0, 0);\n const _date = startOfWeek(firstWeek, options);\n return _date;\n}\n\n// Fallback for modularized imports:\nexport default startOfWeekYear;\n", "import { millisecondsInWeek } from \"./constants.js\";\nimport { startOfWeek } from \"./startOfWeek.js\";\nimport { startOfWeekYear } from \"./startOfWeekYear.js\";\nimport { toDate } from \"./toDate.js\";\n\n/**\n * The {@link getWeek} function options.\n */\n\n/**\n * @name getWeek\n * @category Week Helpers\n * @summary Get the local week index of the given date.\n *\n * @description\n * Get the local week index of the given date.\n * The exact calculation depends on the values of\n * `options.weekStartsOn` (which is the index of the first day of the week)\n * and `options.firstWeekContainsDate` (which is the day of January, which is always in\n * the first week of the week-numbering year)\n *\n * Week numbering: https://en.wikipedia.org/wiki/Week#The_ISO_week_date_system\n *\n * @param date - The given date\n * @param options - An object with options\n *\n * @returns The week\n *\n * @example\n * // Which week of the local week numbering year is 2 January 2005 with default options?\n * const result = getWeek(new Date(2005, 0, 2))\n * //=> 2\n *\n * @example\n * // Which week of the local week numbering year is 2 January 2005,\n * // if Monday is the first day of the week,\n * // and the first week of the year always contains 4 January?\n * const result = getWeek(new Date(2005, 0, 2), {\n * weekStartsOn: 1,\n * firstWeekContainsDate: 4\n * })\n * //=> 53\n */\nexport function getWeek(date, options) {\n const _date = toDate(date, options?.in);\n const diff = +startOfWeek(_date, options) - +startOfWeekYear(_date, options);\n\n // Round the number of weeks to the nearest integer because the number of\n // milliseconds in a week is not constant (e.g. it's different in the week of\n // the daylight saving time clock shift).\n return Math.round(diff / millisecondsInWeek) + 1;\n}\n\n// Fallback for modularized imports:\nexport default getWeek;\n", "export function addLeadingZeros(number, targetLength) {\n const sign = number < 0 ? \"-\" : \"\";\n const output = Math.abs(number).toString().padStart(targetLength, \"0\");\n return sign + output;\n}\n", "import { addLeadingZeros } from \"../addLeadingZeros.js\";\n\n/*\n * | | Unit | | Unit |\n * |-----|--------------------------------|-----|--------------------------------|\n * | a | AM, PM | A* | |\n * | d | Day of month | D | |\n * | h | Hour [1-12] | H | Hour [0-23] |\n * | m | Minute | M | Month |\n * | s | Second | S | Fraction of second |\n * | y | Year (abs) | Y | |\n *\n * Letters marked by * are not implemented but reserved by Unicode standard.\n */\n\nexport const lightFormatters = {\n // Year\n y(date, token) {\n // From http://www.unicode.org/reports/tr35/tr35-31/tr35-dates.html#Date_Format_tokens\n // | Year | y | yy | yyy | yyyy | yyyyy |\n // |----------|-------|----|-------|-------|-------|\n // | AD 1 | 1 | 01 | 001 | 0001 | 00001 |\n // | AD 12 | 12 | 12 | 012 | 0012 | 00012 |\n // | AD 123 | 123 | 23 | 123 | 0123 | 00123 |\n // | AD 1234 | 1234 | 34 | 1234 | 1234 | 01234 |\n // | AD 12345 | 12345 | 45 | 12345 | 12345 | 12345 |\n\n const signedYear = date.getFullYear();\n // Returns 1 for 1 BC (which is year 0 in JavaScript)\n const year = signedYear > 0 ? signedYear : 1 - signedYear;\n return addLeadingZeros(token === \"yy\" ? year % 100 : year, token.length);\n },\n\n // Month\n M(date, token) {\n const month = date.getMonth();\n return token === \"M\" ? String(month + 1) : addLeadingZeros(month + 1, 2);\n },\n\n // Day of the month\n d(date, token) {\n return addLeadingZeros(date.getDate(), token.length);\n },\n\n // AM or PM\n a(date, token) {\n const dayPeriodEnumValue = date.getHours() / 12 >= 1 ? \"pm\" : \"am\";\n\n switch (token) {\n case \"a\":\n case \"aa\":\n return dayPeriodEnumValue.toUpperCase();\n case \"aaa\":\n return dayPeriodEnumValue;\n case \"aaaaa\":\n return dayPeriodEnumValue[0];\n case \"aaaa\":\n default:\n return dayPeriodEnumValue === \"am\" ? \"a.m.\" : \"p.m.\";\n }\n },\n\n // Hour [1-12]\n h(date, token) {\n return addLeadingZeros(date.getHours() % 12 || 12, token.length);\n },\n\n // Hour [0-23]\n H(date, token) {\n return addLeadingZeros(date.getHours(), token.length);\n },\n\n // Minute\n m(date, token) {\n return addLeadingZeros(date.getMinutes(), token.length);\n },\n\n // Second\n s(date, token) {\n return addLeadingZeros(date.getSeconds(), token.length);\n },\n\n // Fraction of second\n S(date, token) {\n const numberOfDigits = token.length;\n const milliseconds = date.getMilliseconds();\n const fractionalSeconds = Math.trunc(\n milliseconds * Math.pow(10, numberOfDigits - 3),\n );\n return addLeadingZeros(fractionalSeconds, token.length);\n },\n};\n", "import { getDayOfYear } from \"../../getDayOfYear.js\";\nimport { getISOWeek } from \"../../getISOWeek.js\";\nimport { getISOWeekYear } from \"../../getISOWeekYear.js\";\nimport { getWeek } from \"../../getWeek.js\";\nimport { getWeekYear } from \"../../getWeekYear.js\";\n\nimport { addLeadingZeros } from \"../addLeadingZeros.js\";\nimport { lightFormatters } from \"./lightFormatters.js\";\n\nconst dayPeriodEnum = {\n am: \"am\",\n pm: \"pm\",\n midnight: \"midnight\",\n noon: \"noon\",\n morning: \"morning\",\n afternoon: \"afternoon\",\n evening: \"evening\",\n night: \"night\",\n};\n\n/*\n * | | Unit | | Unit |\n * |-----|--------------------------------|-----|--------------------------------|\n * | a | AM, PM | A* | Milliseconds in day |\n * | b | AM, PM, noon, midnight | B | Flexible day period |\n * | c | Stand-alone local day of week | C* | Localized hour w/ day period |\n * | d | Day of month | D | Day of year |\n * | e | Local day of week | E | Day of week |\n * | f | | F* | Day of week in month |\n * | g* | Modified Julian day | G | Era |\n * | h | Hour [1-12] | H | Hour [0-23] |\n * | i! | ISO day of week | I! | ISO week of year |\n * | j* | Localized hour w/ day period | J* | Localized hour w/o day period |\n * | k | Hour [1-24] | K | Hour [0-11] |\n * | l* | (deprecated) | L | Stand-alone month |\n * | m | Minute | M | Month |\n * | n | | N | |\n * | o! | Ordinal number modifier | O | Timezone (GMT) |\n * | p! | Long localized time | P! | Long localized date |\n * | q | Stand-alone quarter | Q | Quarter |\n * | r* | Related Gregorian year | R! | ISO week-numbering year |\n * | s | Second | S | Fraction of second |\n * | t! | Seconds timestamp | T! | Milliseconds timestamp |\n * | u | Extended year | U* | Cyclic year |\n * | v* | Timezone (generic non-locat.) | V* | Timezone (location) |\n * | w | Local week of year | W* | Week of month |\n * | x | Timezone (ISO-8601 w/o Z) | X | Timezone (ISO-8601) |\n * | y | Year (abs) | Y | Local week-numbering year |\n * | z | Timezone (specific non-locat.) | Z* | Timezone (aliases) |\n *\n * Letters marked by * are not implemented but reserved by Unicode standard.\n *\n * Letters marked by ! are non-standard, but implemented by date-fns:\n * - `o` modifies the previous token to turn it into an ordinal (see `format` docs)\n * - `i` is ISO day of week. For `i` and `ii` is returns numeric ISO week days,\n * i.e. 7 for Sunday, 1 for Monday, etc.\n * - `I` is ISO week of year, as opposed to `w` which is local week of year.\n * - `R` is ISO week-numbering year, as opposed to `Y` which is local week-numbering year.\n * `R` is supposed to be used in conjunction with `I` and `i`\n * for universal ISO week-numbering date, whereas\n * `Y` is supposed to be used in conjunction with `w` and `e`\n * for week-numbering date specific to the locale.\n * - `P` is long localized date format\n * - `p` is long localized time format\n */\n\nexport const formatters = {\n // Era\n G: function (date, token, localize) {\n const era = date.getFullYear() > 0 ? 1 : 0;\n switch (token) {\n // AD, BC\n case \"G\":\n case \"GG\":\n case \"GGG\":\n return localize.era(era, { width: \"abbreviated\" });\n // A, B\n case \"GGGGG\":\n return localize.era(era, { width: \"narrow\" });\n // Anno Domini, Before Christ\n case \"GGGG\":\n default:\n return localize.era(era, { width: \"wide\" });\n }\n },\n\n // Year\n y: function (date, token, localize) {\n // Ordinal number\n if (token === \"yo\") {\n const signedYear = date.getFullYear();\n // Returns 1 for 1 BC (which is year 0 in JavaScript)\n const year = signedYear > 0 ? signedYear : 1 - signedYear;\n return localize.ordinalNumber(year, { unit: \"year\" });\n }\n\n return lightFormatters.y(date, token);\n },\n\n // Local week-numbering year\n Y: function (date, token, localize, options) {\n const signedWeekYear = getWeekYear(date, options);\n // Returns 1 for 1 BC (which is year 0 in JavaScript)\n const weekYear = signedWeekYear > 0 ? signedWeekYear : 1 - signedWeekYear;\n\n // Two digit year\n if (token === \"YY\") {\n const twoDigitYear = weekYear % 100;\n return addLeadingZeros(twoDigitYear, 2);\n }\n\n // Ordinal number\n if (token === \"Yo\") {\n return localize.ordinalNumber(weekYear, { unit: \"year\" });\n }\n\n // Padding\n return addLeadingZeros(weekYear, token.length);\n },\n\n // ISO week-numbering year\n R: function (date, token) {\n const isoWeekYear = getISOWeekYear(date);\n\n // Padding\n return addLeadingZeros(isoWeekYear, token.length);\n },\n\n // Extended year. This is a single number designating the year of this calendar system.\n // The main difference between `y` and `u` localizers are B.C. years:\n // | Year | `y` | `u` |\n // |------|-----|-----|\n // | AC 1 | 1 | 1 |\n // | BC 1 | 1 | 0 |\n // | BC 2 | 2 | -1 |\n // Also `yy` always returns the last two digits of a year,\n // while `uu` pads single digit years to 2 characters and returns other years unchanged.\n u: function (date, token) {\n const year = date.getFullYear();\n return addLeadingZeros(year, token.length);\n },\n\n // Quarter\n Q: function (date, token, localize) {\n const quarter = Math.ceil((date.getMonth() + 1) / 3);\n switch (token) {\n // 1, 2, 3, 4\n case \"Q\":\n return String(quarter);\n // 01, 02, 03, 04\n case \"QQ\":\n return addLeadingZeros(quarter, 2);\n // 1st, 2nd, 3rd, 4th\n case \"Qo\":\n return localize.ordinalNumber(quarter, { unit: \"quarter\" });\n // Q1, Q2, Q3, Q4\n case \"QQQ\":\n return localize.quarter(quarter, {\n width: \"abbreviated\",\n context: \"formatting\",\n });\n // 1, 2, 3, 4 (narrow quarter; could be not numerical)\n case \"QQQQQ\":\n return localize.quarter(quarter, {\n width: \"narrow\",\n context: \"formatting\",\n });\n // 1st quarter, 2nd quarter, ...\n case \"QQQQ\":\n default:\n return localize.quarter(quarter, {\n width: \"wide\",\n context: \"formatting\",\n });\n }\n },\n\n // Stand-alone quarter\n q: function (date, token, localize) {\n const quarter = Math.ceil((date.getMonth() + 1) / 3);\n switch (token) {\n // 1, 2, 3, 4\n case \"q\":\n return String(quarter);\n // 01, 02, 03, 04\n case \"qq\":\n return addLeadingZeros(quarter, 2);\n // 1st, 2nd, 3rd, 4th\n case \"qo\":\n return localize.ordinalNumber(quarter, { unit: \"quarter\" });\n // Q1, Q2, Q3, Q4\n case \"qqq\":\n return localize.quarter(quarter, {\n width: \"abbreviated\",\n context: \"standalone\",\n });\n // 1, 2, 3, 4 (narrow quarter; could be not numerical)\n case \"qqqqq\":\n return localize.quarter(quarter, {\n width: \"narrow\",\n context: \"standalone\",\n });\n // 1st quarter, 2nd quarter, ...\n case \"qqqq\":\n default:\n return localize.quarter(quarter, {\n width: \"wide\",\n context: \"standalone\",\n });\n }\n },\n\n // Month\n M: function (date, token, localize) {\n const month = date.getMonth();\n switch (token) {\n case \"M\":\n case \"MM\":\n return lightFormatters.M(date, token);\n // 1st, 2nd, ..., 12th\n case \"Mo\":\n return localize.ordinalNumber(month + 1, { unit: \"month\" });\n // Jan, Feb, ..., Dec\n case \"MMM\":\n return localize.month(month, {\n width: \"abbreviated\",\n context: \"formatting\",\n });\n // J, F, ..., D\n case \"MMMMM\":\n return localize.month(month, {\n width: \"narrow\",\n context: \"formatting\",\n });\n // January, February, ..., December\n case \"MMMM\":\n default:\n return localize.month(month, { width: \"wide\", context: \"formatting\" });\n }\n },\n\n // Stand-alone month\n L: function (date, token, localize) {\n const month = date.getMonth();\n switch (token) {\n // 1, 2, ..., 12\n case \"L\":\n return String(month + 1);\n // 01, 02, ..., 12\n case \"LL\":\n return addLeadingZeros(month + 1, 2);\n // 1st, 2nd, ..., 12th\n case \"Lo\":\n return localize.ordinalNumber(month + 1, { unit: \"month\" });\n // Jan, Feb, ..., Dec\n case \"LLL\":\n return localize.month(month, {\n width: \"abbreviated\",\n context: \"standalone\",\n });\n // J, F, ..., D\n case \"LLLLL\":\n return localize.month(month, {\n width: \"narrow\",\n context: \"standalone\",\n });\n // January, February, ..., December\n case \"LLLL\":\n default:\n return localize.month(month, { width: \"wide\", context: \"standalone\" });\n }\n },\n\n // Local week of year\n w: function (date, token, localize, options) {\n const week = getWeek(date, options);\n\n if (token === \"wo\") {\n return localize.ordinalNumber(week, { unit: \"week\" });\n }\n\n return addLeadingZeros(week, token.length);\n },\n\n // ISO week of year\n I: function (date, token, localize) {\n const isoWeek = getISOWeek(date);\n\n if (token === \"Io\") {\n return localize.ordinalNumber(isoWeek, { unit: \"week\" });\n }\n\n return addLeadingZeros(isoWeek, token.length);\n },\n\n // Day of the month\n d: function (date, token, localize) {\n if (token === \"do\") {\n return localize.ordinalNumber(date.getDate(), { unit: \"date\" });\n }\n\n return lightFormatters.d(date, token);\n },\n\n // Day of year\n D: function (date, token, localize) {\n const dayOfYear = getDayOfYear(date);\n\n if (token === \"Do\") {\n return localize.ordinalNumber(dayOfYear, { unit: \"dayOfYear\" });\n }\n\n return addLeadingZeros(dayOfYear, token.length);\n },\n\n // Day of week\n E: function (date, token, localize) {\n const dayOfWeek = date.getDay();\n switch (token) {\n // Tue\n case \"E\":\n case \"EE\":\n case \"EEE\":\n return localize.day(dayOfWeek, {\n width: \"abbreviated\",\n context: \"formatting\",\n });\n // T\n case \"EEEEE\":\n return localize.day(dayOfWeek, {\n width: \"narrow\",\n context: \"formatting\",\n });\n // Tu\n case \"EEEEEE\":\n return localize.day(dayOfWeek, {\n width: \"short\",\n context: \"formatting\",\n });\n // Tuesday\n case \"EEEE\":\n default:\n return localize.day(dayOfWeek, {\n width: \"wide\",\n context: \"formatting\",\n });\n }\n },\n\n // Local day of week\n e: function (date, token, localize, options) {\n const dayOfWeek = date.getDay();\n const localDayOfWeek = (dayOfWeek - options.weekStartsOn + 8) % 7 || 7;\n switch (token) {\n // Numerical value (Nth day of week with current locale or weekStartsOn)\n case \"e\":\n return String(localDayOfWeek);\n // Padded numerical value\n case \"ee\":\n return addLeadingZeros(localDayOfWeek, 2);\n // 1st, 2nd, ..., 7th\n case \"eo\":\n return localize.ordinalNumber(localDayOfWeek, { unit: \"day\" });\n case \"eee\":\n return localize.day(dayOfWeek, {\n width: \"abbreviated\",\n context: \"formatting\",\n });\n // T\n case \"eeeee\":\n return localize.day(dayOfWeek, {\n width: \"narrow\",\n context: \"formatting\",\n });\n // Tu\n case \"eeeeee\":\n return localize.day(dayOfWeek, {\n width: \"short\",\n context: \"formatting\",\n });\n // Tuesday\n case \"eeee\":\n default:\n return localize.day(dayOfWeek, {\n width: \"wide\",\n context: \"formatting\",\n });\n }\n },\n\n // Stand-alone local day of week\n c: function (date, token, localize, options) {\n const dayOfWeek = date.getDay();\n const localDayOfWeek = (dayOfWeek - options.weekStartsOn + 8) % 7 || 7;\n switch (token) {\n // Numerical value (same as in `e`)\n case \"c\":\n return String(localDayOfWeek);\n // Padded numerical value\n case \"cc\":\n return addLeadingZeros(localDayOfWeek, token.length);\n // 1st, 2nd, ..., 7th\n case \"co\":\n return localize.ordinalNumber(localDayOfWeek, { unit: \"day\" });\n case \"ccc\":\n return localize.day(dayOfWeek, {\n width: \"abbreviated\",\n context: \"standalone\",\n });\n // T\n case \"ccccc\":\n return localize.day(dayOfWeek, {\n width: \"narrow\",\n context: \"standalone\",\n });\n // Tu\n case \"cccccc\":\n return localize.day(dayOfWeek, {\n width: \"short\",\n context: \"standalone\",\n });\n // Tuesday\n case \"cccc\":\n default:\n return localize.day(dayOfWeek, {\n width: \"wide\",\n context: \"standalone\",\n });\n }\n },\n\n // ISO day of week\n i: function (date, token, localize) {\n const dayOfWeek = date.getDay();\n const isoDayOfWeek = dayOfWeek === 0 ? 7 : dayOfWeek;\n switch (token) {\n // 2\n case \"i\":\n return String(isoDayOfWeek);\n // 02\n case \"ii\":\n return addLeadingZeros(isoDayOfWeek, token.length);\n // 2nd\n case \"io\":\n return localize.ordinalNumber(isoDayOfWeek, { unit: \"day\" });\n // Tue\n case \"iii\":\n return localize.day(dayOfWeek, {\n width: \"abbreviated\",\n context: \"formatting\",\n });\n // T\n case \"iiiii\":\n return localize.day(dayOfWeek, {\n width: \"narrow\",\n context: \"formatting\",\n });\n // Tu\n case \"iiiiii\":\n return localize.day(dayOfWeek, {\n width: \"short\",\n context: \"formatting\",\n });\n // Tuesday\n case \"iiii\":\n default:\n return localize.day(dayOfWeek, {\n width: \"wide\",\n context: \"formatting\",\n });\n }\n },\n\n // AM or PM\n a: function (date, token, localize) {\n const hours = date.getHours();\n const dayPeriodEnumValue = hours / 12 >= 1 ? \"pm\" : \"am\";\n\n switch (token) {\n case \"a\":\n case \"aa\":\n return localize.dayPeriod(dayPeriodEnumValue, {\n width: \"abbreviated\",\n context: \"formatting\",\n });\n case \"aaa\":\n return localize\n .dayPeriod(dayPeriodEnumValue, {\n width: \"abbreviated\",\n context: \"formatting\",\n })\n .toLowerCase();\n case \"aaaaa\":\n return localize.dayPeriod(dayPeriodEnumValue, {\n width: \"narrow\",\n context: \"formatting\",\n });\n case \"aaaa\":\n default:\n return localize.dayPeriod(dayPeriodEnumValue, {\n width: \"wide\",\n context: \"formatting\",\n });\n }\n },\n\n // AM, PM, midnight, noon\n b: function (date, token, localize) {\n const hours = date.getHours();\n let dayPeriodEnumValue;\n if (hours === 12) {\n dayPeriodEnumValue = dayPeriodEnum.noon;\n } else if (hours === 0) {\n dayPeriodEnumValue = dayPeriodEnum.midnight;\n } else {\n dayPeriodEnumValue = hours / 12 >= 1 ? \"pm\" : \"am\";\n }\n\n switch (token) {\n case \"b\":\n case \"bb\":\n return localize.dayPeriod(dayPeriodEnumValue, {\n width: \"abbreviated\",\n context: \"formatting\",\n });\n case \"bbb\":\n return localize\n .dayPeriod(dayPeriodEnumValue, {\n width: \"abbreviated\",\n context: \"formatting\",\n })\n .toLowerCase();\n case \"bbbbb\":\n return localize.dayPeriod(dayPeriodEnumValue, {\n width: \"narrow\",\n context: \"formatting\",\n });\n case \"bbbb\":\n default:\n return localize.dayPeriod(dayPeriodEnumValue, {\n width: \"wide\",\n context: \"formatting\",\n });\n }\n },\n\n // in the morning, in the afternoon, in the evening, at night\n B: function (date, token, localize) {\n const hours = date.getHours();\n let dayPeriodEnumValue;\n if (hours >= 17) {\n dayPeriodEnumValue = dayPeriodEnum.evening;\n } else if (hours >= 12) {\n dayPeriodEnumValue = dayPeriodEnum.afternoon;\n } else if (hours >= 4) {\n dayPeriodEnumValue = dayPeriodEnum.morning;\n } else {\n dayPeriodEnumValue = dayPeriodEnum.night;\n }\n\n switch (token) {\n case \"B\":\n case \"BB\":\n case \"BBB\":\n return localize.dayPeriod(dayPeriodEnumValue, {\n width: \"abbreviated\",\n context: \"formatting\",\n });\n case \"BBBBB\":\n return localize.dayPeriod(dayPeriodEnumValue, {\n width: \"narrow\",\n context: \"formatting\",\n });\n case \"BBBB\":\n default:\n return localize.dayPeriod(dayPeriodEnumValue, {\n width: \"wide\",\n context: \"formatting\",\n });\n }\n },\n\n // Hour [1-12]\n h: function (date, token, localize) {\n if (token === \"ho\") {\n let hours = date.getHours() % 12;\n if (hours === 0) hours = 12;\n return localize.ordinalNumber(hours, { unit: \"hour\" });\n }\n\n return lightFormatters.h(date, token);\n },\n\n // Hour [0-23]\n H: function (date, token, localize) {\n if (token === \"Ho\") {\n return localize.ordinalNumber(date.getHours(), { unit: \"hour\" });\n }\n\n return lightFormatters.H(date, token);\n },\n\n // Hour [0-11]\n K: function (date, token, localize) {\n const hours = date.getHours() % 12;\n\n if (token === \"Ko\") {\n return localize.ordinalNumber(hours, { unit: \"hour\" });\n }\n\n return addLeadingZeros(hours, token.length);\n },\n\n // Hour [1-24]\n k: function (date, token, localize) {\n let hours = date.getHours();\n if (hours === 0) hours = 24;\n\n if (token === \"ko\") {\n return localize.ordinalNumber(hours, { unit: \"hour\" });\n }\n\n return addLeadingZeros(hours, token.length);\n },\n\n // Minute\n m: function (date, token, localize) {\n if (token === \"mo\") {\n return localize.ordinalNumber(date.getMinutes(), { unit: \"minute\" });\n }\n\n return lightFormatters.m(date, token);\n },\n\n // Second\n s: function (date, token, localize) {\n if (token === \"so\") {\n return localize.ordinalNumber(date.getSeconds(), { unit: \"second\" });\n }\n\n return lightFormatters.s(date, token);\n },\n\n // Fraction of second\n S: function (date, token) {\n return lightFormatters.S(date, token);\n },\n\n // Timezone (ISO-8601. If offset is 0, output is always `'Z'`)\n X: function (date, token, _localize) {\n const timezoneOffset = date.getTimezoneOffset();\n\n if (timezoneOffset === 0) {\n return \"Z\";\n }\n\n switch (token) {\n // Hours and optional minutes\n case \"X\":\n return formatTimezoneWithOptionalMinutes(timezoneOffset);\n\n // Hours, minutes and optional seconds without `:` delimiter\n // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets\n // so this token always has the same output as `XX`\n case \"XXXX\":\n case \"XX\": // Hours and minutes without `:` delimiter\n return formatTimezone(timezoneOffset);\n\n // Hours, minutes and optional seconds with `:` delimiter\n // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets\n // so this token always has the same output as `XXX`\n case \"XXXXX\":\n case \"XXX\": // Hours and minutes with `:` delimiter\n default:\n return formatTimezone(timezoneOffset, \":\");\n }\n },\n\n // Timezone (ISO-8601. If offset is 0, output is `'+00:00'` or equivalent)\n x: function (date, token, _localize) {\n const timezoneOffset = date.getTimezoneOffset();\n\n switch (token) {\n // Hours and optional minutes\n case \"x\":\n return formatTimezoneWithOptionalMinutes(timezoneOffset);\n\n // Hours, minutes and optional seconds without `:` delimiter\n // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets\n // so this token always has the same output as `xx`\n case \"xxxx\":\n case \"xx\": // Hours and minutes without `:` delimiter\n return formatTimezone(timezoneOffset);\n\n // Hours, minutes and optional seconds with `:` delimiter\n // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets\n // so this token always has the same output as `xxx`\n case \"xxxxx\":\n case \"xxx\": // Hours and minutes with `:` delimiter\n default:\n return formatTimezone(timezoneOffset, \":\");\n }\n },\n\n // Timezone (GMT)\n O: function (date, token, _localize) {\n const timezoneOffset = date.getTimezoneOffset();\n\n switch (token) {\n // Short\n case \"O\":\n case \"OO\":\n case \"OOO\":\n return \"GMT\" + formatTimezoneShort(timezoneOffset, \":\");\n // Long\n case \"OOOO\":\n default:\n return \"GMT\" + formatTimezone(timezoneOffset, \":\");\n }\n },\n\n // Timezone (specific non-location)\n z: function (date, token, _localize) {\n const timezoneOffset = date.getTimezoneOffset();\n\n switch (token) {\n // Short\n case \"z\":\n case \"zz\":\n case \"zzz\":\n return \"GMT\" + formatTimezoneShort(timezoneOffset, \":\");\n // Long\n case \"zzzz\":\n default:\n return \"GMT\" + formatTimezone(timezoneOffset, \":\");\n }\n },\n\n // Seconds timestamp\n t: function (date, token, _localize) {\n const timestamp = Math.trunc(+date / 1000);\n return addLeadingZeros(timestamp, token.length);\n },\n\n // Milliseconds timestamp\n T: function (date, token, _localize) {\n return addLeadingZeros(+date, token.length);\n },\n};\n\nfunction formatTimezoneShort(offset, delimiter = \"\") {\n const sign = offset > 0 ? \"-\" : \"+\";\n const absOffset = Math.abs(offset);\n const hours = Math.trunc(absOffset / 60);\n const minutes = absOffset % 60;\n if (minutes === 0) {\n return sign + String(hours);\n }\n return sign + String(hours) + delimiter + addLeadingZeros(minutes, 2);\n}\n\nfunction formatTimezoneWithOptionalMinutes(offset, delimiter) {\n if (offset % 60 === 0) {\n const sign = offset > 0 ? \"-\" : \"+\";\n return sign + addLeadingZeros(Math.abs(offset) / 60, 2);\n }\n return formatTimezone(offset, delimiter);\n}\n\nfunction formatTimezone(offset, delimiter = \"\") {\n const sign = offset > 0 ? \"-\" : \"+\";\n const absOffset = Math.abs(offset);\n const hours = addLeadingZeros(Math.trunc(absOffset / 60), 2);\n const minutes = addLeadingZeros(absOffset % 60, 2);\n return sign + hours + delimiter + minutes;\n}\n", "const dateLongFormatter = (pattern, formatLong) => {\n switch (pattern) {\n case \"P\":\n return formatLong.date({ width: \"short\" });\n case \"PP\":\n return formatLong.date({ width: \"medium\" });\n case \"PPP\":\n return formatLong.date({ width: \"long\" });\n case \"PPPP\":\n default:\n return formatLong.date({ width: \"full\" });\n }\n};\n\nconst timeLongFormatter = (pattern, formatLong) => {\n switch (pattern) {\n case \"p\":\n return formatLong.time({ width: \"short\" });\n case \"pp\":\n return formatLong.time({ width: \"medium\" });\n case \"ppp\":\n return formatLong.time({ width: \"long\" });\n case \"pppp\":\n default:\n return formatLong.time({ width: \"full\" });\n }\n};\n\nconst dateTimeLongFormatter = (pattern, formatLong) => {\n const matchResult = pattern.match(/(P+)(p+)?/) || [];\n const datePattern = matchResult[1];\n const timePattern = matchResult[2];\n\n if (!timePattern) {\n return dateLongFormatter(pattern, formatLong);\n }\n\n let dateTimeFormat;\n\n switch (datePattern) {\n case \"P\":\n dateTimeFormat = formatLong.dateTime({ width: \"short\" });\n break;\n case \"PP\":\n dateTimeFormat = formatLong.dateTime({ width: \"medium\" });\n break;\n case \"PPP\":\n dateTimeFormat = formatLong.dateTime({ width: \"long\" });\n break;\n case \"PPPP\":\n default:\n dateTimeFormat = formatLong.dateTime({ width: \"full\" });\n break;\n }\n\n return dateTimeFormat\n .replace(\"{{date}}\", dateLongFormatter(datePattern, formatLong))\n .replace(\"{{time}}\", timeLongFormatter(timePattern, formatLong));\n};\n\nexport const longFormatters = {\n p: timeLongFormatter,\n P: dateTimeLongFormatter,\n};\n", "const dayOfYearTokenRE = /^D+$/;\nconst weekYearTokenRE = /^Y+$/;\n\nconst throwTokens = [\"D\", \"DD\", \"YY\", \"YYYY\"];\n\nexport function isProtectedDayOfYearToken(token) {\n return dayOfYearTokenRE.test(token);\n}\n\nexport function isProtectedWeekYearToken(token) {\n return weekYearTokenRE.test(token);\n}\n\nexport function warnOrThrowProtectedError(token, format, input) {\n const _message = message(token, format, input);\n console.warn(_message);\n if (throwTokens.includes(token)) throw new RangeError(_message);\n}\n\nfunction message(token, format, input) {\n const subject = token[0] === \"Y\" ? \"years\" : \"days of the month\";\n return `Use \\`${token.toLowerCase()}\\` instead of \\`${token}\\` (in \\`${format}\\`) for formatting ${subject} to the input \\`${input}\\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`;\n}\n", "/**\n * @name isDate\n * @category Common Helpers\n * @summary Is the given value a date?\n *\n * @description\n * Returns true if the given value is an instance of Date. The function works for dates transferred across iframes.\n *\n * @param value - The value to check\n *\n * @returns True if the given value is a date\n *\n * @example\n * // For a valid date:\n * const result = isDate(new Date())\n * //=> true\n *\n * @example\n * // For an invalid date:\n * const result = isDate(new Date(NaN))\n * //=> true\n *\n * @example\n * // For some value:\n * const result = isDate('2014-02-31')\n * //=> false\n *\n * @example\n * // For an object:\n * const result = isDate({})\n * //=> false\n */\nexport function isDate(value) {\n return (\n value instanceof Date ||\n (typeof value === \"object\" &&\n Object.prototype.toString.call(value) === \"[object Date]\")\n );\n}\n\n// Fallback for modularized imports:\nexport default isDate;\n", "import { isDate } from \"./isDate.js\";\nimport { toDate } from \"./toDate.js\";\n\n/**\n * @name isValid\n * @category Common Helpers\n * @summary Is the given date valid?\n *\n * @description\n * Returns false if argument is Invalid Date and true otherwise.\n * Argument is converted to Date using `toDate`. See [toDate](https://date-fns.org/docs/toDate)\n * Invalid Date is a Date, whose time value is NaN.\n *\n * Time value of Date: http://es5.github.io/#x15.9.1.1\n *\n * @param date - The date to check\n *\n * @returns The date is valid\n *\n * @example\n * // For the valid date:\n * const result = isValid(new Date(2014, 1, 31))\n * //=> true\n *\n * @example\n * // For the value, convertible into a date:\n * const result = isValid(1393804800000)\n * //=> true\n *\n * @example\n * // For the invalid date:\n * const result = isValid(new Date(''))\n * //=> false\n */\nexport function isValid(date) {\n return !((!isDate(date) && typeof date !== \"number\") || isNaN(+toDate(date)));\n}\n\n// Fallback for modularized imports:\nexport default isValid;\n", "import { defaultLocale } from \"./_lib/defaultLocale.js\";\nimport { getDefaultOptions } from \"./_lib/defaultOptions.js\";\nimport { formatters } from \"./_lib/format/formatters.js\";\nimport { longFormatters } from \"./_lib/format/longFormatters.js\";\nimport {\n isProtectedDayOfYearToken,\n isProtectedWeekYearToken,\n warnOrThrowProtectedError,\n} from \"./_lib/protectedTokens.js\";\nimport { isValid } from \"./isValid.js\";\nimport { toDate } from \"./toDate.js\";\n\n// Rexports of internal for libraries to use.\n// See: https://github.com/date-fns/date-fns/issues/3638#issuecomment-1877082874\nexport { formatters, longFormatters };\n\n// This RegExp consists of three parts separated by `|`:\n// - [yYQqMLwIdDecihHKkms]o matches any available ordinal number token\n// (one of the certain letters followed by `o`)\n// - (\\w)\\1* matches any sequences of the same letter\n// - '' matches two quote characters in a row\n// - '(''|[^'])+('|$) matches anything surrounded by two quote characters ('),\n// except a single quote symbol, which ends the sequence.\n// Two quote characters do not end the sequence.\n// If there is no matching single quote\n// then the sequence will continue until the end of the string.\n// - . matches any single character unmatched by previous parts of the RegExps\nconst formattingTokensRegExp =\n /[yYQqMLwIdDecihHKkms]o|(\\w)\\1*|''|'(''|[^'])+('|$)|./g;\n\n// This RegExp catches symbols escaped by quotes, and also\n// sequences of symbols P, p, and the combinations like `PPPPPPPppppp`\nconst longFormattingTokensRegExp = /P+p+|P+|p+|''|'(''|[^'])+('|$)|./g;\n\nconst escapedStringRegExp = /^'([^]*?)'?$/;\nconst doubleQuoteRegExp = /''/g;\nconst unescapedLatinCharacterRegExp = /[a-zA-Z]/;\n\nexport { format as formatDate };\n\n/**\n * The {@link format} function options.\n */\n\n/**\n * @name format\n * @alias formatDate\n * @category Common Helpers\n * @summary Format the date.\n *\n * @description\n * Return the formatted date string in the given format. The result may vary by locale.\n *\n * > \u26A0\uFE0F Please note that the `format` tokens differ from Moment.js and other libraries.\n * > See: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md\n *\n * The characters wrapped between two single quotes characters (') are escaped.\n * Two single quotes in a row, whether inside or outside a quoted sequence, represent a 'real' single quote.\n * (see the last example)\n *\n * Format of the string is based on Unicode Technical Standard #35:\n * https://www.unicode.org/reports/tr35/tr35-dates.html#Date_Field_Symbol_Table\n * with a few additions (see note 7 below the table).\n *\n * Accepted patterns:\n * | Unit | Pattern | Result examples | Notes |\n * |---------------------------------|---------|-----------------------------------|-------|\n * | Era | G..GGG | AD, BC | |\n * | | GGGG | Anno Domini, Before Christ | 2 |\n * | | GGGGG | A, B | |\n * | Calendar year | y | 44, 1, 1900, 2017 | 5 |\n * | | yo | 44th, 1st, 0th, 17th | 5,7 |\n * | | yy | 44, 01, 00, 17 | 5 |\n * | | yyy | 044, 001, 1900, 2017 | 5 |\n * | | yyyy | 0044, 0001, 1900, 2017 | 5 |\n * | | yyyyy | ... | 3,5 |\n * | Local week-numbering year | Y | 44, 1, 1900, 2017 | 5 |\n * | | Yo | 44th, 1st, 1900th, 2017th | 5,7 |\n * | | YY | 44, 01, 00, 17 | 5,8 |\n * | | YYY | 044, 001, 1900, 2017 | 5 |\n * | | YYYY | 0044, 0001, 1900, 2017 | 5,8 |\n * | | YYYYY | ... | 3,5 |\n * | ISO week-numbering year | R | -43, 0, 1, 1900, 2017 | 5,7 |\n * | | RR | -43, 00, 01, 1900, 2017 | 5,7 |\n * | | RRR | -043, 000, 001, 1900, 2017 | 5,7 |\n * | | RRRR | -0043, 0000, 0001, 1900, 2017 | 5,7 |\n * | | RRRRR | ... | 3,5,7 |\n * | Extended year | u | -43, 0, 1, 1900, 2017 | 5 |\n * | | uu | -43, 01, 1900, 2017 | 5 |\n * | | uuu | -043, 001, 1900, 2017 | 5 |\n * | | uuuu | -0043, 0001, 1900, 2017 | 5 |\n * | | uuuuu | ... | 3,5 |\n * | Quarter (formatting) | Q | 1, 2, 3, 4 | |\n * | | Qo | 1st, 2nd, 3rd, 4th | 7 |\n * | | QQ | 01, 02, 03, 04 | |\n * | | QQQ | Q1, Q2, Q3, Q4 | |\n * | | QQQQ | 1st quarter, 2nd quarter, ... | 2 |\n * | | QQQQQ | 1, 2, 3, 4 | 4 |\n * | Quarter (stand-alone) | q | 1, 2, 3, 4 | |\n * | | qo | 1st, 2nd, 3rd, 4th | 7 |\n * | | qq | 01, 02, 03, 04 | |\n * | | qqq | Q1, Q2, Q3, Q4 | |\n * | | qqqq | 1st quarter, 2nd quarter, ... | 2 |\n * | | qqqqq | 1, 2, 3, 4 | 4 |\n * | Month (formatting) | M | 1, 2, ..., 12 | |\n * | | Mo | 1st, 2nd, ..., 12th | 7 |\n * | | MM | 01, 02, ..., 12 | |\n * | | MMM | Jan, Feb, ..., Dec | |\n * | | MMMM | January, February, ..., December | 2 |\n * | | MMMMM | J, F, ..., D | |\n * | Month (stand-alone) | L | 1, 2, ..., 12 | |\n * | | Lo | 1st, 2nd, ..., 12th | 7 |\n * | | LL | 01, 02, ..., 12 | |\n * | | LLL | Jan, Feb, ..., Dec | |\n * | | LLLL | January, February, ..., December | 2 |\n * | | LLLLL | J, F, ..., D | |\n * | Local week of year | w | 1, 2, ..., 53 | |\n * | | wo | 1st, 2nd, ..., 53th | 7 |\n * | | ww | 01, 02, ..., 53 | |\n * | ISO week of year | I | 1, 2, ..., 53 | 7 |\n * | | Io | 1st, 2nd, ..., 53th | 7 |\n * | | II | 01, 02, ..., 53 | 7 |\n * | Day of month | d | 1, 2, ..., 31 | |\n * | | do | 1st, 2nd, ..., 31st | 7 |\n * | | dd | 01, 02, ..., 31 | |\n * | Day of year | D | 1, 2, ..., 365, 366 | 9 |\n * | | Do | 1st, 2nd, ..., 365th, 366th | 7 |\n * | | DD | 01, 02, ..., 365, 366 | 9 |\n * | | DDD | 001, 002, ..., 365, 366 | |\n * | | DDDD | ... | 3 |\n * | Day of week (formatting) | E..EEE | Mon, Tue, Wed, ..., Sun | |\n * | | EEEE | Monday, Tuesday, ..., Sunday | 2 |\n * | | EEEEE | M, T, W, T, F, S, S | |\n * | | EEEEEE | Mo, Tu, We, Th, Fr, Sa, Su | |\n * | ISO day of week (formatting) | i | 1, 2, 3, ..., 7 | 7 |\n * | | io | 1st, 2nd, ..., 7th | 7 |\n * | | ii | 01, 02, ..., 07 | 7 |\n * | | iii | Mon, Tue, Wed, ..., Sun | 7 |\n * | | iiii | Monday, Tuesday, ..., Sunday | 2,7 |\n * | | iiiii | M, T, W, T, F, S, S | 7 |\n * | | iiiiii | Mo, Tu, We, Th, Fr, Sa, Su | 7 |\n * | Local day of week (formatting) | e | 2, 3, 4, ..., 1 | |\n * | | eo | 2nd, 3rd, ..., 1st | 7 |\n * | | ee | 02, 03, ..., 01 | |\n * | | eee | Mon, Tue, Wed, ..., Sun | |\n * | | eeee | Monday, Tuesday, ..., Sunday | 2 |\n * | | eeeee | M, T, W, T, F, S, S | |\n * | | eeeeee | Mo, Tu, We, Th, Fr, Sa, Su | |\n * | Local day of week (stand-alone) | c | 2, 3, 4, ..., 1 | |\n * | | co | 2nd, 3rd, ..., 1st | 7 |\n * | | cc | 02, 03, ..., 01 | |\n * | | ccc | Mon, Tue, Wed, ..., Sun | |\n * | | cccc | Monday, Tuesday, ..., Sunday | 2 |\n * | | ccccc | M, T, W, T, F, S, S | |\n * | | cccccc | Mo, Tu, We, Th, Fr, Sa, Su | |\n * | AM, PM | a..aa | AM, PM | |\n * | | aaa | am, pm | |\n * | | aaaa | a.m., p.m. | 2 |\n * | | aaaaa | a, p | |\n * | AM, PM, noon, midnight | b..bb | AM, PM, noon, midnight | |\n * | | bbb | am, pm, noon, midnight | |\n * | | bbbb | a.m., p.m., noon, midnight | 2 |\n * | | bbbbb | a, p, n, mi | |\n * | Flexible day period | B..BBB | at night, in the morning, ... | |\n * | | BBBB | at night, in the morning, ... | 2 |\n * | | BBBBB | at night, in the morning, ... | |\n * | Hour [1-12] | h | 1, 2, ..., 11, 12 | |\n * | | ho | 1st, 2nd, ..., 11th, 12th | 7 |\n * | | hh | 01, 02, ..., 11, 12 | |\n * | Hour [0-23] | H | 0, 1, 2, ..., 23 | |\n * | | Ho | 0th, 1st, 2nd, ..., 23rd | 7 |\n * | | HH | 00, 01, 02, ..., 23 | |\n * | Hour [0-11] | K | 1, 2, ..., 11, 0 | |\n * | | Ko | 1st, 2nd, ..., 11th, 0th | 7 |\n * | | KK | 01, 02, ..., 11, 00 | |\n * | Hour [1-24] | k | 24, 1, 2, ..., 23 | |\n * | | ko | 24th, 1st, 2nd, ..., 23rd | 7 |\n * | | kk | 24, 01, 02, ..., 23 | |\n * | Minute | m | 0, 1, ..., 59 | |\n * | | mo | 0th, 1st, ..., 59th | 7 |\n * | | mm | 00, 01, ..., 59 | |\n * | Second | s | 0, 1, ..., 59 | |\n * | | so | 0th, 1st, ..., 59th | 7 |\n * | | ss | 00, 01, ..., 59 | |\n * | Fraction of second | S | 0, 1, ..., 9 | |\n * | | SS | 00, 01, ..., 99 | |\n * | | SSS | 000, 001, ..., 999 | |\n * | | SSSS | ... | 3 |\n * | Timezone (ISO-8601 w/ Z) | X | -08, +0530, Z | |\n * | | XX | -0800, +0530, Z | |\n * | | XXX | -08:00, +05:30, Z | |\n * | | XXXX | -0800, +0530, Z, +123456 | 2 |\n * | | XXXXX | -08:00, +05:30, Z, +12:34:56 | |\n * | Timezone (ISO-8601 w/o Z) | x | -08, +0530, +00 | |\n * | | xx | -0800, +0530, +0000 | |\n * | | xxx | -08:00, +05:30, +00:00 | 2 |\n * | | xxxx | -0800, +0530, +0000, +123456 | |\n * | | xxxxx | -08:00, +05:30, +00:00, +12:34:56 | |\n * | Timezone (GMT) | O...OOO | GMT-8, GMT+5:30, GMT+0 | |\n * | | OOOO | GMT-08:00, GMT+05:30, GMT+00:00 | 2 |\n * | Timezone (specific non-locat.) | z...zzz | GMT-8, GMT+5:30, GMT+0 | 6 |\n * | | zzzz | GMT-08:00, GMT+05:30, GMT+00:00 | 2,6 |\n * | Seconds timestamp | t | 512969520 | 7 |\n * | | tt | ... | 3,7 |\n * | Milliseconds timestamp | T | 512969520900 | 7 |\n * | | TT | ... | 3,7 |\n * | Long localized date | P | 04/29/1453 | 7 |\n * | | PP | Apr 29, 1453 | 7 |\n * | | PPP | April 29th, 1453 | 7 |\n * | | PPPP | Friday, April 29th, 1453 | 2,7 |\n * | Long localized time | p | 12:00 AM | 7 |\n * | | pp | 12:00:00 AM | 7 |\n * | | ppp | 12:00:00 AM GMT+2 | 7 |\n * | | pppp | 12:00:00 AM GMT+02:00 | 2,7 |\n * | Combination of date and time | Pp | 04/29/1453, 12:00 AM | 7 |\n * | | PPpp | Apr 29, 1453, 12:00:00 AM | 7 |\n * | | PPPppp | April 29th, 1453 at ... | 7 |\n * | | PPPPpppp| Friday, April 29th, 1453 at ... | 2,7 |\n * Notes:\n * 1. \"Formatting\" units (e.g. formatting quarter) in the default en-US locale\n * are the same as \"stand-alone\" units, but are different in some languages.\n * \"Formatting\" units are declined according to the rules of the language\n * in the context of a date. \"Stand-alone\" units are always nominative singular:\n *\n * `format(new Date(2017, 10, 6), 'do LLLL', {locale: cs}) //=> '6. listopad'`\n *\n * `format(new Date(2017, 10, 6), 'do MMMM', {locale: cs}) //=> '6. listopadu'`\n *\n * 2. Any sequence of the identical letters is a pattern, unless it is escaped by\n * the single quote characters (see below).\n * If the sequence is longer than listed in table (e.g. `EEEEEEEEEEE`)\n * the output will be the same as default pattern for this unit, usually\n * the longest one (in case of ISO weekdays, `EEEE`). Default patterns for units\n * are marked with \"2\" in the last column of the table.\n *\n * `format(new Date(2017, 10, 6), 'MMM') //=> 'Nov'`\n *\n * `format(new Date(2017, 10, 6), 'MMMM') //=> 'November'`\n *\n * `format(new Date(2017, 10, 6), 'MMMMM') //=> 'N'`\n *\n * `format(new Date(2017, 10, 6), 'MMMMMM') //=> 'November'`\n *\n * `format(new Date(2017, 10, 6), 'MMMMMMM') //=> 'November'`\n *\n * 3. Some patterns could be unlimited length (such as `yyyyyyyy`).\n * The output will be padded with zeros to match the length of the pattern.\n *\n * `format(new Date(2017, 10, 6), 'yyyyyyyy') //=> '00002017'`\n *\n * 4. `QQQQQ` and `qqqqq` could be not strictly numerical in some locales.\n * These tokens represent the shortest form of the quarter.\n *\n * 5. The main difference between `y` and `u` patterns are B.C. years:\n *\n * | Year | `y` | `u` |\n * |------|-----|-----|\n * | AC 1 | 1 | 1 |\n * | BC 1 | 1 | 0 |\n * | BC 2 | 2 | -1 |\n *\n * Also `yy` always returns the last two digits of a year,\n * while `uu` pads single digit years to 2 characters and returns other years unchanged:\n *\n * | Year | `yy` | `uu` |\n * |------|------|------|\n * | 1 | 01 | 01 |\n * | 14 | 14 | 14 |\n * | 376 | 76 | 376 |\n * | 1453 | 53 | 1453 |\n *\n * The same difference is true for local and ISO week-numbering years (`Y` and `R`),\n * except local week-numbering years are dependent on `options.weekStartsOn`\n * and `options.firstWeekContainsDate` (compare [getISOWeekYear](https://date-fns.org/docs/getISOWeekYear)\n * and [getWeekYear](https://date-fns.org/docs/getWeekYear)).\n *\n * 6. Specific non-location timezones are currently unavailable in `date-fns`,\n * so right now these tokens fall back to GMT timezones.\n *\n * 7. These patterns are not in the Unicode Technical Standard #35:\n * - `i`: ISO day of week\n * - `I`: ISO week of year\n * - `R`: ISO week-numbering year\n * - `t`: seconds timestamp\n * - `T`: milliseconds timestamp\n * - `o`: ordinal number modifier\n * - `P`: long localized date\n * - `p`: long localized time\n *\n * 8. `YY` and `YYYY` tokens represent week-numbering years but they are often confused with years.\n * You should enable `options.useAdditionalWeekYearTokens` to use them. See: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md\n *\n * 9. `D` and `DD` tokens represent days of the year but they are often confused with days of the month.\n * You should enable `options.useAdditionalDayOfYearTokens` to use them. See: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md\n *\n * @param date - The original date\n * @param format - The string of tokens\n * @param options - An object with options\n *\n * @returns The formatted date string\n *\n * @throws `date` must not be Invalid Date\n * @throws `options.locale` must contain `localize` property\n * @throws `options.locale` must contain `formatLong` property\n * @throws use `yyyy` instead of `YYYY` for formatting years using [format provided] to the input [input provided]; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md\n * @throws use `yy` instead of `YY` for formatting years using [format provided] to the input [input provided]; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md\n * @throws use `d` instead of `D` for formatting days of the month using [format provided] to the input [input provided]; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md\n * @throws use `dd` instead of `DD` for formatting days of the month using [format provided] to the input [input provided]; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md\n * @throws format string contains an unescaped latin alphabet character\n *\n * @example\n * // Represent 11 February 2014 in middle-endian format:\n * const result = format(new Date(2014, 1, 11), 'MM/dd/yyyy')\n * //=> '02/11/2014'\n *\n * @example\n * // Represent 2 July 2014 in Esperanto:\n * import { eoLocale } from 'date-fns/locale/eo'\n * const result = format(new Date(2014, 6, 2), \"do 'de' MMMM yyyy\", {\n * locale: eoLocale\n * })\n * //=> '2-a de julio 2014'\n *\n * @example\n * // Escape string by single quote characters:\n * const result = format(new Date(2014, 6, 2, 15), \"h 'o''clock'\")\n * //=> \"3 o'clock\"\n */\nexport function format(date, formatStr, options) {\n const defaultOptions = getDefaultOptions();\n const locale = options?.locale ?? defaultOptions.locale ?? defaultLocale;\n\n const firstWeekContainsDate =\n options?.firstWeekContainsDate ??\n options?.locale?.options?.firstWeekContainsDate ??\n defaultOptions.firstWeekContainsDate ??\n defaultOptions.locale?.options?.firstWeekContainsDate ??\n 1;\n\n const weekStartsOn =\n options?.weekStartsOn ??\n options?.locale?.options?.weekStartsOn ??\n defaultOptions.weekStartsOn ??\n defaultOptions.locale?.options?.weekStartsOn ??\n 0;\n\n const originalDate = toDate(date, options?.in);\n\n if (!isValid(originalDate)) {\n throw new RangeError(\"Invalid time value\");\n }\n\n let parts = formatStr\n .match(longFormattingTokensRegExp)\n .map((substring) => {\n const firstCharacter = substring[0];\n if (firstCharacter === \"p\" || firstCharacter === \"P\") {\n const longFormatter = longFormatters[firstCharacter];\n return longFormatter(substring, locale.formatLong);\n }\n return substring;\n })\n .join(\"\")\n .match(formattingTokensRegExp)\n .map((substring) => {\n // Replace two single quote characters with one single quote character\n if (substring === \"''\") {\n return { isToken: false, value: \"'\" };\n }\n\n const firstCharacter = substring[0];\n if (firstCharacter === \"'\") {\n return { isToken: false, value: cleanEscapedString(substring) };\n }\n\n if (formatters[firstCharacter]) {\n return { isToken: true, value: substring };\n }\n\n if (firstCharacter.match(unescapedLatinCharacterRegExp)) {\n throw new RangeError(\n \"Format string contains an unescaped latin alphabet character `\" +\n firstCharacter +\n \"`\",\n );\n }\n\n return { isToken: false, value: substring };\n });\n\n // invoke localize preprocessor (only for french locales at the moment)\n if (locale.localize.preprocessor) {\n parts = locale.localize.preprocessor(originalDate, parts);\n }\n\n const formatterOptions = {\n firstWeekContainsDate,\n weekStartsOn,\n locale,\n };\n\n return parts\n .map((part) => {\n if (!part.isToken) return part.value;\n\n const token = part.value;\n\n if (\n (!options?.useAdditionalWeekYearTokens &&\n isProtectedWeekYearToken(token)) ||\n (!options?.useAdditionalDayOfYearTokens &&\n isProtectedDayOfYearToken(token))\n ) {\n warnOrThrowProtectedError(token, formatStr, String(date));\n }\n\n const formatter = formatters[token[0]];\n return formatter(originalDate, token, locale.localize, formatterOptions);\n })\n .join(\"\");\n}\n\nfunction cleanEscapedString(input) {\n const matched = input.match(escapedStringRegExp);\n\n if (!matched) {\n return input;\n }\n\n return matched[1].replace(doubleQuoteRegExp, \"'\");\n}\n\n// Fallback for modularized imports:\nexport default format;\n", "export function getRoundingMethod(method) {\n return (number) => {\n const round = method ? Math[method] : Math.trunc;\n const result = round(number);\n // Prevent negative zero\n return result === 0 ? 0 : result;\n };\n}\n", "import { toDate } from \"./toDate.js\";\n\n/**\n * @name compareAsc\n * @category Common Helpers\n * @summary Compare the two dates and return -1, 0 or 1.\n *\n * @description\n * Compare the two dates and return 1 if the first date is after the second,\n * -1 if the first date is before the second or 0 if dates are equal.\n *\n * @param dateLeft - The first date to compare\n * @param dateRight - The second date to compare\n *\n * @returns The result of the comparison\n *\n * @example\n * // Compare 11 February 1987 and 10 July 1989:\n * const result = compareAsc(new Date(1987, 1, 11), new Date(1989, 6, 10))\n * //=> -1\n *\n * @example\n * // Sort the array of dates:\n * const result = [\n * new Date(1995, 6, 2),\n * new Date(1987, 1, 11),\n * new Date(1989, 6, 10)\n * ].sort(compareAsc)\n * //=> [\n * // Wed Feb 11 1987 00:00:00,\n * // Mon Jul 10 1989 00:00:00,\n * // Sun Jul 02 1995 00:00:00\n * // ]\n */\nexport function compareAsc(dateLeft, dateRight) {\n const diff = +toDate(dateLeft) - +toDate(dateRight);\n\n if (diff < 0) return -1;\n else if (diff > 0) return 1;\n\n // Return 0 if diff is 0; return NaN if diff is NaN\n return diff;\n}\n\n// Fallback for modularized imports:\nexport default compareAsc;\n", "import { defaultLocale } from \"./_lib/defaultLocale.js\";\nimport { getDefaultOptions } from \"./_lib/defaultOptions.js\";\nimport { getRoundingMethod } from \"./_lib/getRoundingMethod.js\";\nimport { getTimezoneOffsetInMilliseconds } from \"./_lib/getTimezoneOffsetInMilliseconds.js\";\nimport { normalizeDates } from \"./_lib/normalizeDates.js\";\nimport { compareAsc } from \"./compareAsc.js\";\nimport {\n millisecondsInMinute,\n minutesInDay,\n minutesInMonth,\n minutesInYear,\n} from \"./constants.js\";\n\n/**\n * The {@link formatDistanceStrict} function options.\n */\n\n/**\n * The unit used to format the distance in {@link formatDistanceStrict}.\n */\n\n/**\n * @name formatDistanceStrict\n * @category Common Helpers\n * @summary Return the distance between the given dates in words.\n *\n * @description\n * Return the distance between the given dates in words, using strict units.\n * This is like `formatDistance`, but does not use helpers like 'almost', 'over',\n * 'less than' and the like.\n *\n * | Distance between dates | Result |\n * |------------------------|---------------------|\n * | 0 ... 59 secs | [0..59] seconds |\n * | 1 ... 59 mins | [1..59] minutes |\n * | 1 ... 23 hrs | [1..23] hours |\n * | 1 ... 29 days | [1..29] days |\n * | 1 ... 11 months | [1..11] months |\n * | 1 ... N years | [1..N] years |\n *\n * @param laterDate - The date\n * @param earlierDate - The date to compare with\n * @param options - An object with options\n *\n * @returns The distance in words\n *\n * @throws `date` must not be Invalid Date\n * @throws `baseDate` must not be Invalid Date\n * @throws `options.unit` must be 'second', 'minute', 'hour', 'day', 'month' or 'year'\n * @throws `options.locale` must contain `formatDistance` property\n *\n * @example\n * // What is the distance between 2 July 2014 and 1 January 2015?\n * const result = formatDistanceStrict(new Date(2014, 6, 2), new Date(2015, 0, 2))\n * //=> '6 months'\n *\n * @example\n * // What is the distance between 1 January 2015 00:00:15\n * // and 1 January 2015 00:00:00?\n * const result = formatDistanceStrict(\n * new Date(2015, 0, 1, 0, 0, 15),\n * new Date(2015, 0, 1, 0, 0, 0)\n * )\n * //=> '15 seconds'\n *\n * @example\n * // What is the distance from 1 January 2016\n * // to 1 January 2015, with a suffix?\n * const result = formatDistanceStrict(new Date(2015, 0, 1), new Date(2016, 0, 1), {\n * addSuffix: true\n * })\n * //=> '1 year ago'\n *\n * @example\n * // What is the distance from 1 January 2016\n * // to 1 January 2015, in minutes?\n * const result = formatDistanceStrict(new Date(2016, 0, 1), new Date(2015, 0, 1), {\n * unit: 'minute'\n * })\n * //=> '525600 minutes'\n *\n * @example\n * // What is the distance from 1 January 2015\n * // to 28 January 2015, in months, rounded up?\n * const result = formatDistanceStrict(new Date(2015, 0, 28), new Date(2015, 0, 1), {\n * unit: 'month',\n * roundingMethod: 'ceil'\n * })\n * //=> '1 month'\n *\n * @example\n * // What is the distance between 1 August 2016 and 1 January 2015 in Esperanto?\n * import { eoLocale } from 'date-fns/locale/eo'\n * const result = formatDistanceStrict(new Date(2016, 7, 1), new Date(2015, 0, 1), {\n * locale: eoLocale\n * })\n * //=> '1 jaro'\n */\n\nexport function formatDistanceStrict(laterDate, earlierDate, options) {\n const defaultOptions = getDefaultOptions();\n const locale = options?.locale ?? defaultOptions.locale ?? defaultLocale;\n\n const comparison = compareAsc(laterDate, earlierDate);\n\n if (isNaN(comparison)) {\n throw new RangeError(\"Invalid time value\");\n }\n\n const localizeOptions = Object.assign({}, options, {\n addSuffix: options?.addSuffix,\n comparison: comparison,\n });\n\n const [laterDate_, earlierDate_] = normalizeDates(\n options?.in,\n ...(comparison > 0 ? [earlierDate, laterDate] : [laterDate, earlierDate]),\n );\n\n const roundingMethod = getRoundingMethod(options?.roundingMethod ?? \"round\");\n\n const milliseconds = earlierDate_.getTime() - laterDate_.getTime();\n const minutes = milliseconds / millisecondsInMinute;\n\n const timezoneOffset =\n getTimezoneOffsetInMilliseconds(earlierDate_) -\n getTimezoneOffsetInMilliseconds(laterDate_);\n\n // Use DST-normalized difference in minutes for years, months and days;\n // use regular difference in minutes for hours, minutes and seconds.\n const dstNormalizedMinutes =\n (milliseconds - timezoneOffset) / millisecondsInMinute;\n\n const defaultUnit = options?.unit;\n let unit;\n if (!defaultUnit) {\n if (minutes < 1) {\n unit = \"second\";\n } else if (minutes < 60) {\n unit = \"minute\";\n } else if (minutes < minutesInDay) {\n unit = \"hour\";\n } else if (dstNormalizedMinutes < minutesInMonth) {\n unit = \"day\";\n } else if (dstNormalizedMinutes < minutesInYear) {\n unit = \"month\";\n } else {\n unit = \"year\";\n }\n } else {\n unit = defaultUnit;\n }\n\n // 0 up to 60 seconds\n if (unit === \"second\") {\n const seconds = roundingMethod(milliseconds / 1000);\n return locale.formatDistance(\"xSeconds\", seconds, localizeOptions);\n\n // 1 up to 60 mins\n } else if (unit === \"minute\") {\n const roundedMinutes = roundingMethod(minutes);\n return locale.formatDistance(\"xMinutes\", roundedMinutes, localizeOptions);\n\n // 1 up to 24 hours\n } else if (unit === \"hour\") {\n const hours = roundingMethod(minutes / 60);\n return locale.formatDistance(\"xHours\", hours, localizeOptions);\n\n // 1 up to 30 days\n } else if (unit === \"day\") {\n const days = roundingMethod(dstNormalizedMinutes / minutesInDay);\n return locale.formatDistance(\"xDays\", days, localizeOptions);\n\n // 1 up to 12 months\n } else if (unit === \"month\") {\n const months = roundingMethod(dstNormalizedMinutes / minutesInMonth);\n return months === 12 && defaultUnit !== \"month\"\n ? locale.formatDistance(\"xYears\", 1, localizeOptions)\n : locale.formatDistance(\"xMonths\", months, localizeOptions);\n\n // 1 year up to max Date\n } else {\n const years = roundingMethod(dstNormalizedMinutes / minutesInYear);\n return locale.formatDistance(\"xYears\", years, localizeOptions);\n }\n}\n\n// Fallback for modularized imports:\nexport default formatDistanceStrict;\n", "\uFEFFimport { format } from \"date-fns/format\";\nimport { formatDistanceStrict } from \"date-fns/formatDistanceStrict\";\n\nexport function friendlyDate(dateTime: Date | string | undefined) {\n\tif (dateTime == null) {\n\t\treturn \"\";\n\t}\n\n\tconst date = typeof dateTime === \"string\" ? parseDateTime(dateTime) : dateTime;\n\tif (date == null) {\n\t\treturn \"\";\n\t}\n\n\tconst now = Date.now();\n\tconst diff = (now - date.getTime()) / 1000;\n\n\tif (diff < 0 || diff > 60 * 60 * 24 * 7) {\n\t\treturn format(date, \"yyyy-MM-dd\");\n\t}\n\n\treturn formatDistanceStrict(date, now, { addSuffix: true });\n}\n\nfunction parseDateTime(dateString: string): Date | null {\n\tif (!dateString) {\n\t\treturn null;\n\t}\n\n\tconst matcher = /\\/Date\\((\\d+)\\)\\//;\n\tconst matched = matcher.exec(dateString);\n\tif (matched != null && matched.length > 1) {\n\t\treturn new Date(parseInt(matched[1], 10));\n\t}\n\n\treturn new Date(dateString);\n}\n"], "mappings": "6GAAA,IAAAA,GAAAC,GAAAC,IAAA,cAWA,IAAIC,GAAQ,KACZ,SAASC,GAAGC,EAAGC,EAAG,CAChB,OAAQD,IAAMC,IAAYD,IAAN,GAAW,EAAIA,IAAM,EAAIC,IAAQD,IAAMA,GAAKC,IAAMA,CACxE,CACA,IAAIC,GAA0B,OAAO,OAAO,IAA7B,WAAkC,OAAO,GAAKH,GAC3DI,GAAuBL,GAAM,qBAC7BM,GAASN,GAAM,OACfO,GAAYP,GAAM,UAClBQ,GAAUR,GAAM,QAChBS,GAAgBT,GAAM,cACxBD,GAAQ,iCAAmC,SACzCW,EACAC,EACAC,EACAC,EACAC,EACA,CACA,IAAIC,EAAUT,GAAO,IAAI,EACzB,GAAaS,EAAQ,UAAjB,KAA0B,CAC5B,IAAIC,EAAO,CAAE,SAAU,GAAI,MAAO,IAAK,EACvCD,EAAQ,QAAUC,CACpB,MAAOA,EAAOD,EAAQ,QACtBA,EAAUP,GACR,UAAY,CACV,SAASS,EAAiBC,EAAc,CACtC,GAAI,CAACC,EAAS,CAIZ,GAHAA,EAAU,GACVC,EAAmBF,EACnBA,EAAeL,EAASK,CAAY,EACrBJ,IAAX,QAAsBE,EAAK,SAAU,CACvC,IAAIK,EAAmBL,EAAK,MAC5B,GAAIF,EAAQO,EAAkBH,CAAY,EACxC,OAAQI,EAAoBD,CAChC,CACA,OAAQC,EAAoBJ,CAC9B,CAEA,GADAG,EAAmBC,EACflB,G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,EAC/D,OAAOlB,EAAO,eAAe,QAASwB,EAAMpB,CAAe,CAG7D,SAAWa,IAAS,QAAS,CAC3B,IAAMQ,EAASjB,EAAeO,EAAuBI,EAAc,EACnE,OAAOM,IAAW,IAAMT,IAAgB,QACpChB,EAAO,eAAe,SAAU,EAAGI,CAAe,EAClDJ,EAAO,eAAe,UAAWyB,EAAQrB,CAAe,CAG9D,KAAO,CACL,IAAMsB,EAAQlB,EAAeO,EAAuBK,EAAa,EACjE,OAAOpB,EAAO,eAAe,SAAU0B,EAAOtB,CAAe,CAC/D,CACF,CCtLO,SAASuB,GAAaC,EAAqC,CACjE,GAAIA,GAAY,KACf,MAAO,GAGR,IAAMC,EAAO,OAAOD,GAAa,SAAWE,GAAcF,CAAQ,EAAIA,EACtE,GAAIC,GAAQ,KACX,MAAO,GAGR,IAAME,EAAM,KAAK,IAAI,EACfC,GAAQD,EAAMF,EAAK,QAAQ,GAAK,IAEtC,OAAIG,EAAO,GAAKA,EAAO,GAAK,GAAK,GAAK,EAC9BC,GAAOJ,EAAM,YAAY,EAG1BK,GAAqBL,EAAME,EAAK,CAAE,UAAW,EAAK,CAAC,CAC3D,CAEA,SAASD,GAAcK,EAAiC,CACvD,GAAI,CAACA,EACJ,OAAO,KAIR,IAAMC,EADU,oBACQ,KAAKD,CAAU,EACvC,OAAIC,GAAW,MAAQA,EAAQ,OAAS,EAChC,IAAI,KAAK,SAASA,EAAQ,CAAC,EAAG,EAAE,CAAC,EAGlC,IAAI,KAAKD,CAAU,CAC3B", "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", "require_debounce", "__commonJSMin", "exports", "module", "debounce", "function_", "wait", "options", "immediate", "storedContext", "storedArguments", "timeoutId", "timestamp", "result", "run", "callContext", "callArguments", "later", "last", "debounced", "arguments_", "callNow", "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", "is", "x", "y", "shallowEqual", "objA", "objB", "keysA", "keysB", "i", "FORWARD_REF_STATICS", "MEMO_STATICS", "TYPE_STATICS", "ForwardRef", "Memo", "objectPrototype", "ContextKey", "gT", "getContext", "contextMap", "_a", "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", "import_client", "renderAll", "domNodes", "component", "node", "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", "finalReducerKeys", "unexpectedKeyCache", "shapeAssertionError", "e", "state", "action", "hasChanged", "nextState", "i", "previousStateForKey", "nextStateForKey", "actionType", "compose", "funcs", "arg", "a", "b", "args", "applyMiddleware", "middlewares", "createStore", "reducer", "preloadedState", "store", "dispatch", "formatProdErrorMessage", "middlewareAPI", "action", "chain", "middleware", "__spreadProps", "__spreadValues", "isAction", "isPlainObject", "NOTHING", "DRAFTABLE", "DRAFT_STATE", "die", "error", "args", "getPrototypeOf", "isDraft", "value", "DRAFT_STATE", "isDraftable", "isPlainObject", "DRAFTABLE", "_a", "isMap", "isSet", "objectCtorString", "proto", "Ctor", "each", "obj", "iter", "getArchtype", "key", "value", "entry", "index", "thing", "state", "DRAFT_STATE", "isMap", "isSet", "has", "prop", "set", "thing", "propOrOldValue", "value", "t", "getArchtype", "is", "x", "y", "isMap", "target", "isSet", "latest", "state", "shallowCopy", "base", "strict", "isPlainObject", "getPrototypeOf", "__spreadValues", "descriptors", "DRAFT_STATE", "keys", "i", "key", "desc", "freeze", "obj", "deep", "isFrozen", "isDraft", "isDraftable", "dontMutateFrozenCollections", "each", "_key", "die", "plugins", "getPlugin", "pluginKey", "plugin", "currentScope", "getCurrentScope", "createScope", "parent_", "immer_", "usePatchesInScope", "scope", "patchListener", "getPlugin", "revokeScope", "leaveScope", "revokeDraft", "enterScope", "immer", "draft", "state", "DRAFT_STATE", "processResult", "result", "baseDraft", "die", "isDraftable", "finalize", "maybeFreeze", "NOTHING", "rootScope", "value", "path", "isFrozen", "each", "key", "childValue", "finalizeProperty", "resultEach", "isSet", "parentState", "targetObject", "prop", "rootPath", "targetIsSet", "isDraft", "has", "res", "set", "deep", "freeze", "createProxyProxy", "base", "parent", "isArray", "target", "traps", "objectTraps", "arrayTraps", "revoke", "proxy", "source", "latest", "readPropFromProto", "peek", "prepareCopy", "createProxy", "desc", "getDescriptorFromProto", "current", "currentState", "is", "markChanged", "owner", "getPrototypeOf", "fn", "_a", "proto", "shallowCopy", "Immer", "config", "recipe", "defaultBase", "self", "args", "hasError", "p", "ip", "patches", "inversePatches", "i", "patch", "applyPatchesImpl", "isMap", "currentImpl", "copy", "immer", "Immer", "produce", "produceWithPatches", "setAutoFreeze", "setUseStrictShallowCopy", "applyPatches", "createDraft", "finishDraft", "createThunkMiddleware", "extraArgument", "dispatch", "getState", "next", "action", "thunk", "withExtraArgument", "composeWithDevTools", "compose", "devToolsEnhancer", "noop", "hasMatchFunction", "v", "createAction", "type", "prepareAction", "actionCreator", "args", "prepared", "formatProdErrorMessage", "__spreadValues", "action", "isAction", "Tuple", "_Tuple", "items", "arr", "freezeDraftable", "val", "isDraftable", "produce", "getOrInsertComputed", "map", "key", "compute", "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", "listener", "wrappedListener", "unsubscribe", "action", "_a", "SHOULD_AUTOBATCH", "buildGetDefaultEnhancers", "middlewareEnhancer", "autoBatch", "enhancerArray", "Tuple", "configureStore", "getDefaultMiddleware", "buildGetDefaultMiddleware", "reducer", "middleware", "devTools", "preloadedState", "enhancers", "rootReducer", "isPlainObject", "combineReducers", "formatProdErrorMessage", "finalMiddleware", "finalCompose", "compose", "composeWithDevTools", "__spreadValues", "applyMiddleware", "getDefaultEnhancers", "storeEnhancers", "composedEnhancer", "createStore", "executeReducerBuilderCallback", "builderCallback", "actionsMap", "actionMatchers", "defaultCaseReducer", "builder", "typeOrActionCreator", "type", "matcher", "isStateFunction", "x", "createReducer", "initialState", "mapOrBuilderCallback", "finalActionMatchers", "finalDefaultCaseReducer", "getInitialState", "freezeDraftable", "frozenInitialState", "state", "caseReducers", "cr", "previousState", "caseReducer", "isDraft", "result", "isDraftable", "createNextState", "draft", "matches", "hasMatchFunction", "isAnyOf", "matchers", "urlAlphabet", "nanoid", "size", "id", "i", "commonProperties", "RejectWithValue", "payload", "meta", "__publicField", "FulfillWithMeta", "miniSerializeError", "value", "simpleError", "property", "createAsyncThunk", "typePrefix", "payloadCreator", "options", "fulfilled", "createAction", "requestId", "arg", "__spreadProps", "__spreadValues", "pending", "rejected", "error", "actionCreator", "dispatch", "getState", "extra", "abortController", "abortHandler", "abortReason", "abort", "reason", "promise", "__async", "finalAction", "conditionResult", "_a", "isThenable", "abortedPromise", "_", "reject", "_b", "result", "err", "unwrapResult", "isAnyOf", "action", "asyncThunkSymbol", "asyncThunkCreator", "getType", "slice", "actionKey", "buildCreateSlice", "creators", "cAT", "_a", "asyncThunkSymbol", "options", "name", "reducerPath", "formatProdErrorMessage", "reducers", "buildReducerCreators", "reducerNames", "context", "contextMethods", "typeOrActionCreator", "reducer", "type", "matcher", "actionCreator", "reducerName", "reducerDefinition", "reducerDetails", "isAsyncThunkSliceReducerDefinition", "handleThunkCaseReducerDefinition", "handleNormalReducerDefinition", "buildReducer", "extraReducers", "actionMatchers", "defaultCaseReducer", "executeReducerBuilderCallback", "finalCaseReducers", "__spreadValues", "createReducer", "builder", "key", "sM", "m", "selectSelf", "state", "injectedSelectorCache", "_reducer", "action", "getInitialState", "makeSelectorProps", "injected", "selectSlice", "sliceState", "getSelectors", "selectState", "selectorCache", "getOrInsertComputed", "map", "selector", "wrapSelector", "__spreadProps", "injectable", "_b", "pathOpt", "config", "__objRest", "newReducerPath", "wrapper", "rootState", "args", "createSlice", "asyncThunk", "payloadCreator", "caseReducer", "prepare", "createNotation", "maybeReducerWithPrepare", "prepareCallback", "isCaseReducerWithPrepareDefinition", "createAction", "fulfilled", "pending", "rejected", "settled", "thunk", "noop", "listener", "completed", "cancelled", "taskCancelled", "taskCompleted", "listenerCancelled", "listenerCompleted", "assign", "alm", "addListener", "assign", "createAction", "alm", "clearAllListeners", "removeListener", "ORIGINAL_STATE", "formatProdErrorMessage", "code", "import_react", "stationsUrl", "tag", "page", "urlSafe", "editStationUrl", "station", "id", "urlSafe", "part", "id", "fullId", "import_react", "import_client", "import_jsx_runtime", "Notification", "props", "nextId", "addNotification", "NotificationContainer", "notifications", "setNotifications", "dismiss", "id", "prev", "notification", "className", "iconClassName", "timeout", "title", "message", "__spreadProps", "__spreadValues", "notificationElement", "Notify", "defaultOptions", "createCanvas", "className", "inline", "canvas", "style", "createTopbar", "opts", "_a", "options", "__spreadValues", "progressTimerId", "fadeTimerId", "currentProgress", "showing", "repaint", "ctx", "lineGradient", "stop", "color", "show", "progress", "loop", "to", "hide", "progressCount", "topbar", "createTopbar", "enter", "exit", "isCanvasSupported", "progress", "promise", "__async", "result", "e", "StationApi", "station", "stationApiRequest", "method", "url", "headers", "getAntiForgeryToken", "options", "progress", "_a", "token", "blankStation", "blankState", "addTag", "station", "tag", "lowercaseTag", "t", "tags", "__spreadProps", "__spreadValues", "removeTag", "addEndpoint", "href", "endpoints", "removeEndpoint", "endpoint", "moveEndpoint", "delta", "index", "e", "createStationSlice", "createSlice", "state", "payload", "editStationUrl", "getErrorText", "response", "__async", "_a", "_b", "contentType", "message", "stackTraceBase64", "error", "isEmpty", "value", "stationIsValid", "stationApiAction", "actions", "method", "successMessage", "validate", "dispatch", "getState", "content", "Notify", "title", "createStation", "StationApi", "updateStation", "deleteStation", "restoreStation", "blankState", "createStationsSlice", "createSlice", "__spreadValues", "import_debounce", "cache", "getQueryString", "params", "key", "_a", "_b", "SearchApi", "query", "count", "withinactive", "__async", "qs", "cachedResponse", "headers", "response", "progress", "blankState", "createSearchSlice", "createSlice", "__spreadValues", "state", "payload", "actualSearch", "dispatch", "actions", "query", "count", "withinactive", "__async", "SearchApi", "e", "throttledSearch", "debounce", "search", "throttled", "getState", "createStore", "reducer", "configureStore", "actionContext", "setupActions", "actions", "useActions", "useDispatch", "useStateSelector", "useSelector", "buildStore", "searchSlice", "createSearchSlice", "stationSlice", "createStationSlice", "stationsSlice", "createStationsSlice", "store", "formatDistanceLocale", "formatDistance", "token", "count", "options", "result", "tokenValue", "buildFormatLongFn", "args", "options", "width", "dateFormats", "timeFormats", "dateTimeFormats", "formatLong", "buildFormatLongFn", "formatRelativeLocale", "formatRelative", "token", "_date", "_baseDate", "_options", "buildLocalizeFn", "args", "value", "options", "context", "valuesArray", "defaultWidth", "width", "index", "eraValues", "quarterValues", "monthValues", "dayValues", "dayPeriodValues", "formattingDayPeriodValues", "ordinalNumber", "dirtyNumber", "_options", "number", "rem100", "localize", "buildLocalizeFn", "quarter", "buildMatchFn", "args", "string", "options", "width", "matchPattern", "matchResult", "matchedString", "parsePatterns", "key", "findIndex", "pattern", "findKey", "value", "rest", "object", "predicate", "array", "buildMatchPatternFn", "args", "string", "options", "matchResult", "matchedString", "parseResult", "value", "rest", "matchOrdinalNumberPattern", "parseOrdinalNumberPattern", "matchEraPatterns", "parseEraPatterns", "matchQuarterPatterns", "parseQuarterPatterns", "matchMonthPatterns", "parseMonthPatterns", "matchDayPatterns", "parseDayPatterns", "matchDayPeriodPatterns", "parseDayPeriodPatterns", "match", "buildMatchPatternFn", "value", "buildMatchFn", "index", "enUS", "formatDistance", "formatLong", "formatRelative", "localize", "match", "defaultOptions", "getDefaultOptions", "maxTime", "minTime", "millisecondsInWeek", "millisecondsInDay", "millisecondsInMinute", "minutesInYear", "minutesInMonth", "minutesInDay", "secondsInHour", "secondsInDay", "secondsInHour", "secondsInWeek", "secondsInYear", "secondsInMonth", "secondsInQuarter", "constructFromSymbol", "constructFrom", "date", "value", "constructFromSymbol", "toDate", "argument", "context", "constructFrom", "getTimezoneOffsetInMilliseconds", "date", "_date", "toDate", "utcDate", "normalizeDates", "context", "dates", "normalize", "constructFrom", "date", "startOfDay", "date", "options", "_date", "toDate", "differenceInCalendarDays", "laterDate", "earlierDate", "options", "laterDate_", "earlierDate_", "normalizeDates", "laterStartOfDay", "startOfDay", "earlierStartOfDay", "laterTimestamp", "getTimezoneOffsetInMilliseconds", "earlierTimestamp", "millisecondsInDay", "startOfYear", "date", "options", "date_", "toDate", "getDayOfYear", "date", "options", "_date", "toDate", "differenceInCalendarDays", "startOfYear", "startOfWeek", "date", "options", "_a", "_b", "_c", "_d", "_e", "_f", "_g", "_h", "defaultOptions", "getDefaultOptions", "weekStartsOn", "_date", "toDate", "day", "diff", "startOfISOWeek", "date", "options", "startOfWeek", "__spreadProps", "__spreadValues", "getISOWeekYear", "date", "options", "_date", "toDate", "year", "fourthOfJanuaryOfNextYear", "constructFrom", "startOfNextYear", "startOfISOWeek", "fourthOfJanuaryOfThisYear", "startOfThisYear", "startOfISOWeekYear", "date", "options", "year", "getISOWeekYear", "fourthOfJanuary", "constructFrom", "startOfISOWeek", "getISOWeek", "date", "options", "_date", "toDate", "diff", "startOfISOWeek", "startOfISOWeekYear", "millisecondsInWeek", "getWeekYear", "date", "options", "_a", "_b", "_c", "_d", "_e", "_f", "_g", "_h", "_date", "toDate", "year", "defaultOptions", "getDefaultOptions", "firstWeekContainsDate", "firstWeekOfNextYear", "constructFrom", "startOfNextYear", "startOfWeek", "firstWeekOfThisYear", "startOfThisYear", "startOfWeekYear", "date", "options", "_a", "_b", "_c", "_d", "_e", "_f", "_g", "_h", "defaultOptions", "getDefaultOptions", "firstWeekContainsDate", "year", "getWeekYear", "firstWeek", "constructFrom", "startOfWeek", "getWeek", "date", "options", "_date", "toDate", "diff", "startOfWeek", "startOfWeekYear", "millisecondsInWeek", "addLeadingZeros", "number", "targetLength", "sign", "output", "lightFormatters", "date", "token", "signedYear", "year", "addLeadingZeros", "month", "dayPeriodEnumValue", "numberOfDigits", "milliseconds", "fractionalSeconds", "dayPeriodEnum", "formatters", "date", "token", "localize", "era", "signedYear", "year", "lightFormatters", "options", "signedWeekYear", "getWeekYear", "weekYear", "twoDigitYear", "addLeadingZeros", "isoWeekYear", "getISOWeekYear", "quarter", "month", "week", "getWeek", "isoWeek", "getISOWeek", "dayOfYear", "getDayOfYear", "dayOfWeek", "localDayOfWeek", "isoDayOfWeek", "dayPeriodEnumValue", "hours", "_localize", "timezoneOffset", "formatTimezoneWithOptionalMinutes", "formatTimezone", "formatTimezoneShort", "timestamp", "offset", "delimiter", "sign", "absOffset", "minutes", "dateLongFormatter", "pattern", "formatLong", "timeLongFormatter", "dateTimeLongFormatter", "matchResult", "datePattern", "timePattern", "dateTimeFormat", "longFormatters", "dayOfYearTokenRE", "weekYearTokenRE", "throwTokens", "isProtectedDayOfYearToken", "token", "isProtectedWeekYearToken", "warnOrThrowProtectedError", "format", "input", "_message", "message", "subject", "isDate", "value", "isValid", "date", "isDate", "toDate", "formattingTokensRegExp", "longFormattingTokensRegExp", "escapedStringRegExp", "doubleQuoteRegExp", "unescapedLatinCharacterRegExp", "format", "date", "formatStr", "options", "_a", "_b", "_c", "_d", "_e", "_f", "_g", "_h", "_i", "_j", "_k", "_l", "_m", "_n", "_o", "_p", "_q", "_r", "defaultOptions", "getDefaultOptions", "locale", "enUS", "firstWeekContainsDate", "weekStartsOn", "originalDate", "toDate", "isValid", "parts", "longFormattingTokensRegExp", "substring", "firstCharacter", "longFormatter", "longFormatters", "formattingTokensRegExp", "cleanEscapedString", "formatters", "unescapedLatinCharacterRegExp", "formatterOptions", "part", "token", "isProtectedWeekYearToken", "isProtectedDayOfYearToken", "warnOrThrowProtectedError", "formatter", "input", "matched", "escapedStringRegExp", "doubleQuoteRegExp", "getRoundingMethod", "method", "number", "result", "compareAsc", "dateLeft", "dateRight", "diff", "toDate", "formatDistanceStrict", "laterDate", "earlierDate", "options", "_a", "_b", "_c", "defaultOptions", "getDefaultOptions", "locale", "enUS", "comparison", "compareAsc", "localizeOptions", "laterDate_", "earlierDate_", "normalizeDates", "roundingMethod", "getRoundingMethod", "milliseconds", "minutes", "millisecondsInMinute", "timezoneOffset", "getTimezoneOffsetInMilliseconds", "dstNormalizedMinutes", "defaultUnit", "unit", "minutesInDay", "minutesInMonth", "minutesInYear", "seconds", "roundedMinutes", "hours", "days", "months", "years", "friendlyDate", "dateTime", "date", "parseDateTime", "now", "diff", "format", "formatDistanceStrict", "dateString", "matched"] }