UNPKG

storybook-addon-remix-react-router

Version:

Use Remix React Router in your stories. (Formerly storybook-addon-react-router-v6)

1 lines 324 kB
{"version":3,"sources":["../src/constants.ts","../src/features/decorator/contexts/DeepRouteMatchesContext.tsx","../src/features/decorator/contexts/StoryContext.tsx","../src/features/decorator/hooks/useRouteContextMatches.ts","../src/features/decorator/utils/getFormDataSummary.ts","../src/features/decorator/utils/getHumanReadableBody.ts","../src/features/decorator/hooks/useDataEventBuilder.ts","../src/features/decorator/hooks/useActionDecorator.ts","../src/features/decorator/hooks/useLoaderDecorator.ts","../src/features/decorator/hooks/useRouteObjectsDecorator.ts","../src/features/decorator/hooks/useStory.tsx","../src/features/decorator/utils/injectStory.ts","../../../node_modules/.pnpm/@remix-run+router@1.21.0/node_modules/@remix-run/router/history.ts","../../../node_modules/.pnpm/@remix-run+router@1.21.0/node_modules/@remix-run/router/utils.ts","../../../node_modules/.pnpm/@remix-run+router@1.21.0/node_modules/@remix-run/router/router.ts","../src/features/decorator/utils/normalizeHistory.ts","../src/utils/misc.ts","../src/features/decorator/utils/normalizeRouting.tsx","../src/features/decorator/hooks/useDeepRouteMatches.tsx","../src/features/decorator/utils/searchParamsToRecord.ts","../src/features/decorator/hooks/useCurrentUrl.ts","../src/features/decorator/hooks/useNavigationEventBuilder.ts","../src/features/decorator/components/RouterLogger.tsx","../src/features/decorator/components/StoryRouter.tsx","../src/features/decorator/components/ReactRouterDecorator.tsx","../src/features/decorator/utils/isValidReactNode.ts","../src/features/decorator/utils/castRouterRoute.tsx","../src/features/decorator/utils/castParametersV2.ts","../src/features/decorator/withRouter.tsx","../src/features/decorator/utils/routesHelpers/reactRouterParameters.tsx","../src/features/decorator/utils/optionalStoryArg.ts","../src/features/decorator/utils/routesHelpers/reactRouterOutlet.ts","../src/features/decorator/utils/routesHelpers/reactRouterOutlets.ts","../src/features/decorator/utils/routesHelpers/reactRouterNestedOutlets.ts","../src/features/decorator/utils/routesHelpers/reactRouterNestedAncestors.ts"],"names":["ADDON_ID","PARAM_KEY","EVENTS","DeepRouteMatchesContext","React","StoryContext","useRouteContextMatches","deepRouteMatches","setDeepRouteMatches","useState","RouteContext","UNSAFE_RouteContext","target","p","v","currentMatches","getFormDataSummary","formData","data","value","key","getHumanReadableBody","request","requestClone","contentTypeHeader","humanReadableBody","useDataEventBuilder","eventCount","useRef","useCallback","eventName","eventArgs","params","context","requestData","useActionDecorator","channel","addons","createEventData","action","actionArgs","actionResult","useLoaderDecorator","loader","loaderArgs","loaderResult","useRouteObjectsDecorator","decorateAction","decorateLoader","decorateRouteObjects","routeDefinitions","routeDefinition","children","lazy","augmentedRouteDefinition","lazyResult","augmentedLazyResult","useStory","contextValue","injectStory","routes","StoryElement","route","Action","invariant","message","Error","warning","cond","console","warn","ResultType","generatePath","originalPath","path","endsWith","replace","prefix","startsWith","stringify","String","segments","split","map","segment","index","array","length","keyMatch","match","optional","param","filter","join","validMutationMethodsArr","Set","validRequestMethodsArr","validRequestMethods","normalizeHistory","navigationHistory","location","initialEntries","initialIndex","compactNavigationHistory","i","userPath","pathParams","searchParams","hash","state","isInitialLocation","inferredPath","inferLocationPathFromRoutes","basePath","obviousRoute","pathToObviousRoute","appendPathSegment","pathSegment","blankValues","basePathParts","s","pathSegmentParts","hasOwnProperty","obj","prop","castArray","normalizeRouting","routing","useDeepRouteMatches","searchParamsToRecord","result","currentValue","useCurrentUrl","useLocation","url","useNavigationEventBuilder","useParams","search","useSearchParams","navigationType","useNavigationType","matches","currentUrl","matchesData","routeMatch","locationData","RouterLogger","renderStory","storyContext","buildEventData","storyLoadedEmittedLocationKeyRef","lastNavigationEventLocationKeyRef","lastRouteMatchesRef","storyLoaded","shouldEmitNavigationEvents","StoryRouter","addonParameters","hydrationData","future","fallback","memoryRouter","useMemo","normalizedRoutes","decoratedRoutes","injectedRoutes","resolvedOptions","createMemoryRouter","expandProps","fallbackElement","Fallback","RouterProvider","ReactRouterDecorator","isValidReactNode","castRouterRoute","definition","castParametersV2","parameters","exclusiveV2properties","v2params","outlet","withRouter","makeDecorator","getStory","reactRouterParameters","optionalStoryArg","args","story","rest","reactRouterOutlet","outletDefinitionObject","reactRouterOutlets","outlets","reactRouterNestedOutlets","outletsRoot","lastOutlet","outletDefinitionObjet","reactRouterNestedAncestors","ancestors","ancestorsRoot","lastAncestor","ancestor","ancestorDefinitionObjet"],"mappings":"qOAAO,IAAMA,CAAW,CAAA,2BAAA,CAEXC,CAAAA,CAAY,cAEZC,CAAS,CAAA,CACpB,KAAO,CAAA,CAAA,EAAGF,CAAQ,CAClB,MAAA,CAAA,CAAA,UAAA,CAAY,CAAGA,EAAAA,CAAQ,cACvB,YAAc,CAAA,CAAA,EAAGA,CAAQ,CAAA,aAAA,CAAA,CACzB,cAAe,CAAGA,EAAAA,CAAQ,CAC1B,cAAA,CAAA,CAAA,cAAA,CAAgB,GAAGA,CAAQ,CAAA,eAAA,CAAA,CAC3B,cAAgB,CAAA,CAAA,EAAGA,CAAQ,CAAA,eAAA,CAAA,CAC3B,cAAgB,CAAA,CAAA,EAAGA,CAAQ,CAC3B,eAAA,CAAA,CAAA,cAAA,CAAgB,CAAGA,EAAAA,CAAQ,iBAC7B,ECTO,IAAMG,CAAAA,CAAuDC,mBAAM,aAA4B,CAAA,EAAE,CAAA,CCDjG,IAAMC,CAAAA,CAAeD,mBAAM,aAOhC,CAAA,KAAA,CAAS,CCVX,CAOO,SAASE,CAAAA,EAAuC,CACrD,GAAM,CAACC,CAAkBC,CAAAA,CAAmB,EAAIC,UAAuB,CAAA,EAAE,CAAA,CAEnEC,EAAeC,+BAErB,CAAA,OAAAD,CAAa,CAAA,QAAA,CAAS,SAAW,IAAI,KAAA,CAAMA,CAAa,CAAA,QAAA,CAAS,UAAY,EAAC,CAAG,CAC/E,GAAA,CAAIE,EAAaC,CAAcC,CAAAA,CAAAA,CAAmB,CAChD,OAAID,IAAM,eACJC,EAAAA,CAAAA,GAAM,KACRN,CAAAA,EAAAA,CAAAA,CAAqBO,CACfD,EAAAA,CAAAA,CAAE,O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ACzC,IAAMG,CAAAA,CAAWH,CAAU,CAAA,CAAC,EACtBI,CAA0B5B,CAAAA,CAAAA,CAAgB2B,CAAQ,CAAA,CACxDC,EAAwB,IAAS,GAAA,EAAA,CACjCF,CAAa,CAAA,QAAA,CAAW,CAACE,CAAuB,CAAA,CAChDF,CAAeE,CAAAA,EACjB,CAEA,OAAAF,CAAAA,CAAa,QAAW,CAAA,CACtB,CACE,GAAGb,CAAAA,CACH,KAAO,CAAA,CAAA,CAAA,CACP,gBAAiB,CACnB,CAAA,CACF,CAEO,CAAA,CAACY,CAAa,CACvB","file":"index.cjs","sourcesContent":["export const ADDON_ID = 'storybook/react-router-v6';\nexport const PANEL_ID = `${ADDON_ID}/panel`;\nexport const PARAM_KEY = `reactRouter`;\n\nexport const EVENTS = {\n CLEAR: `${ADDON_ID}/clear`,\n NAVIGATION: `${ADDON_ID}/navigation`,\n STORY_LOADED: `${ADDON_ID}/story-loaded`,\n ROUTE_MATCHES: `${ADDON_ID}/route-matches`,\n ACTION_INVOKED: `${ADDON_ID}/action_invoked`,\n ACTION_SETTLED: `${ADDON_ID}/action_settled`,\n LOADER_INVOKED: `${ADDON_ID}/loader_invoked`,\n LOADER_SETTLED: `${ADDON_ID}/loader_settled`,\n} as const;\n","import React from 'react';\n\nimport type { RouteMatch } from 'react-router';\n\nexport const DeepRouteMatchesContext: React.Context<RouteMatch[]> = React.createContext<RouteMatch[]>([]);\n","import React from 'react';\nimport { ReactRouterAddonStoryParameters } from '../components/ReactRouterDecorator';\n\nexport const StoryContext = React.createContext<\n | {\n renderStory: (context: unknown) => React.ReactElement;\n storyContext: { args: Record<string, unknown> };\n addonParameters: ReactRouterAddonStoryParameters;\n }\n | undefined\n>(undefined);\n","import { useState } from 'react';\nimport { UNSAFE_RouteContext, RouteMatch } from 'react-router';\n\ntype Ctx = {\n _currentValue?: { matches: RouteMatch[] };\n};\n\nexport function useRouteContextMatches(): RouteMatch[] {\n const [deepRouteMatches, setDeepRouteMatches] = useState<RouteMatch[]>([]);\n\n const RouteContext = UNSAFE_RouteContext as unknown as { Provider: { _context: Ctx } };\n\n RouteContext.Provider._context = new Proxy(RouteContext.Provider._context ?? {}, {\n set(target: Ctx, p: keyof Ctx, v: Ctx[keyof Ctx]) {\n if (p === '_currentValue') {\n if (v !== undefined) {\n setDeepRouteMatches((currentMatches) => {\n if (v.matches.length > currentMatches.length) {\n return v.matches;\n }\n return currentMatches;\n });\n }\n }\n\n return Reflect.set(target, p, v);\n },\n });\n\n return deepRouteMatches;\n}\n","export type FileSummary = { filename: string; filesize: number; filetype: string };\n\nexport function getFormDataSummary(formData: FormData): Record<string, string | FileSummary> {\n const data: Record<string, string | FileSummary> = {};\n\n formData.forEach((value, key) => {\n if (value instanceof File) {\n data[key] = {\n filename: value.name,\n filesize: value.size,\n filetype: value.type,\n };\n return;\n }\n\n data[key] = value;\n });\n\n return data;\n}\n","import { FileSummary, getFormDataSummary } from './getFormDataSummary';\n\nexport async function getHumanReadableBody(request: Request) {\n const requestClone = request.clone();\n const contentTypeHeader = requestClone.headers.get('content-type') || '';\n\n let humanReadableBody: string | Record<string, string | FileSummary> | undefined = undefined;\n\n switch (true) {\n case contentTypeHeader.startsWith('text'):\n humanReadableBody = await requestClone.text();\n break;\n case contentTypeHeader.startsWith('application/json'):\n humanReadableBody = await requestClone.json();\n break;\n case contentTypeHeader.startsWith('multipart/form-data'):\n case contentTypeHeader.startsWith('application/x-www-form-urlencoded'): {\n humanReadableBody = getFormDataSummary(await requestClone.formData());\n break;\n }\n }\n\n return humanReadableBody;\n}\n","import type { RouterDataEvent, DataEventArgs, RouterDataEventName } from '../../panel/types';\nimport { useCallback, useRef } from 'react';\nimport { EVENTS } from '../../../constants';\n\nimport { getHumanReadableBody } from '../utils/getHumanReadableBody';\n\nexport const useDataEventBuilder = () => {\n const eventCount = useRef(0);\n\n return useCallback(\n async (\n eventName: RouterDataEventName,\n eventArgs?: DataEventArgs[keyof DataEventArgs]\n ): Promise<RouterDataEvent> => {\n eventCount.current++;\n const key = `${eventName}_${eventCount.current}`;\n\n switch (eventName) {\n case EVENTS.ACTION_INVOKED: {\n const { request, params, context } = eventArgs as DataEventArgs[typeof eventName];\n const requestData = {\n url: request.url,\n method: request.method,\n body: await getHumanReadableBody(request),\n };\n\n const data = { params, request: requestData, context };\n return { key, type: eventName, data };\n }\n\n case EVENTS.ACTION_SETTLED: {\n return { key, type: eventName, data: eventArgs };\n }\n\n case EVENTS.LOADER_INVOKED: {\n const { request, params, context } = eventArgs as DataEventArgs[typeof eventName];\n\n const requestData = {\n url: request.url,\n method: request.method,\n body: await getHumanReadableBody(request),\n };\n\n const data = { params, request: requestData, context };\n return { key, type: eventName, data };\n }\n\n case EVENTS.LOADER_SETTLED: {\n return { key, type: eventName, data: eventArgs };\n }\n }\n },\n []\n );\n};\n","import { ActionFunctionArgs } from '@remix-run/router/utils';\nimport { addons } from '@storybook/preview-api';\nimport { useCallback } from 'react';\nimport { ActionFunction } from 'react-router';\nimport { EVENTS } from '../../../constants';\nimport { useDataEventBuilder } from './useDataEventBuilder';\n\nexport function useActionDecorator() {\n const channel = addons.getChannel();\n const createEventData = useDataEventBuilder();\n\n return useCallback(\n (action: ActionFunction) =>\n async function (actionArgs: ActionFunctionArgs) {\n if (action === undefined) return;\n\n channel.emit(EVENTS.ACTION_INVOKED, await createEventData(EVENTS.ACTION_INVOKED, actionArgs));\n const actionResult = await action(actionArgs);\n channel.emit(EVENTS.ACTION_SETTLED, await createEventData(EVENTS.ACTION_SETTLED, actionResult));\n\n return actionResult;\n },\n [channel, createEventData]\n );\n}\n","import { addons } from '@storybook/preview-api';\nimport { useCallback } from 'react';\nimport { LoaderFunction, LoaderFunctionArgs } from 'react-router';\nimport { EVENTS } from '../../../constants';\nimport { useDataEventBuilder } from './useDataEventBuilder';\n\nexport function useLoaderDecorator() {\n const channel = addons.getChannel();\n const createEventData = useDataEventBuilder();\n\n return useCallback(\n (loader: LoaderFunction) =>\n async function (loaderArgs: LoaderFunctionArgs) {\n if (loader === undefined) return;\n\n channel.emit(EVENTS.LOADER_INVOKED, await createEventData(EVENTS.LOADER_INVOKED, loaderArgs));\n const loaderResult = await loader(loaderArgs);\n channel.emit(EVENTS.LOADER_SETTLED, await createEventData(EVENTS.LOADER_SETTLED, loaderResult));\n\n return loaderResult;\n },\n [channel, createEventData]\n );\n}\n","import { useCallback } from 'react';\nimport { RouterRoute } from '../types';\nimport { useActionDecorator } from './useActionDecorator';\nimport { useLoaderDecorator } from './useLoaderDecorator';\n\ntype RouteObjectDecorator = <T extends RouterRoute[]>(routeDefinitions: T) => T;\n\nexport function useRouteObjectsDecorator(): RouteObjectDecorator {\n const decorateAction = useActionDecorator();\n const decorateLoader = useLoaderDecorator();\n\n const decorateRouteObjects = useCallback(\n <T extends RouterRoute[]>(routeDefinitions: T): T => {\n return routeDefinitions.map((routeDefinition) => {\n // eslint-disable-next-line prefer-const\n let { action, loader, children, lazy } = routeDefinition;\n const augmentedRouteDefinition = { ...routeDefinition };\n\n if (lazy) {\n augmentedRouteDefinition.lazy = async function () {\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n const lazyResult = await lazy!();\n const augmentedLazyResult = { ...lazyResult };\n if (typeof lazyResult.action === 'function') augmentedLazyResult.action = decorateAction(lazyResult.action);\n if (typeof lazyResult.loader === 'function') augmentedLazyResult.loader = decorateLoader(lazyResult.loader);\n\n return augmentedLazyResult;\n };\n }\n\n if (typeof action === 'function') {\n augmentedRouteDefinition.action = decorateAction(action);\n }\n\n if (typeof loader === 'function') {\n augmentedRouteDefinition.loader = decorateLoader(loader);\n }\n\n if (children) {\n augmentedRouteDefinition.children = decorateRouteObjects(children);\n }\n\n return augmentedRouteDefinition;\n }) as T;\n },\n [decorateAction, decorateLoader]\n );\n\n return decorateRouteObjects;\n}\n","import React from 'react';\nimport { StoryContext } from '../contexts/StoryContext';\n\nexport const useStory = () => {\n const contextValue = React.useContext(StoryContext);\n\n if (contextValue === undefined) {\n throw new Error('useStory should be used inside <StoryContext>');\n }\n\n return contextValue;\n};\n","import React from 'react';\nimport { RouterRoute } from '../types';\n\nexport function injectStory(routes: RouterRoute[], StoryElement: React.ReactElement): RouterRoute[] {\n // Single route, no children\n if (routes.length === 1 && (routes[0].children === undefined || routes[0].children.length === 0)) {\n return [{ ...routes[0], element: StoryElement }];\n }\n\n const storyRouteIndex = routes.findIndex((route) => route.useStoryElement);\n\n if (storyRouteIndex !== -1) {\n return routes.map((route) => {\n if (!route.useStoryElement) return route;\n\n return {\n ...route,\n element: StoryElement,\n };\n });\n }\n\n return routes.map((route) => {\n if (!route.children) return route;\n\n return {\n ...route,\n children: injectStory(route.children, StoryElement),\n };\n });\n}\n","////////////////////////////////////////////////////////////////////////////////\n//#region Types and Constants\n////////////////////////////////////////////////////////////////////////////////\n\n/**\n * Actions represent the type of change to a location value.\n */\nexport enum Action {\n /**\n * A POP indicates a change to an arbitrary index in the history stack, such\n * as a back or forward navigation. It does not describe the direction of the\n * navigation, only that the current index changed.\n *\n * Note: This is the default action for newly created history objects.\n */\n Pop = \"POP\",\n\n /**\n * A PUSH indicates a new entry being added to the history stack, such as when\n * a link is clicked and a new page loads. When this happens, all subsequent\n * entries in the stack are lost.\n */\n Push = \"PUSH\",\n\n /**\n * A REPLACE indicates the entry at the current index in the history stack\n * being replaced by a new one.\n */\n Replace = \"REPLACE\",\n}\n\n/**\n * The pathname, search, and hash values of a URL.\n */\nexport interface Path {\n /**\n * A URL pathname, beginning with a /.\n */\n pathname: string;\n\n /**\n * A URL search string, beginning with a ?.\n */\n search: string;\n\n /**\n * A URL fragment identifier, beginning with a #.\n */\n hash: string;\n}\n\n// TODO: (v7) Change the Location generic default from `any` to `unknown` and\n// remove Remix `useLocation` wrapper.\n\n/**\n * An entry in a history stack. A location contains information about the\n * URL path, as well as possibly some arbitrary state and a key.\n */\nexport interface Location<State = any> extends Path {\n /**\n * A value of arbitrary data associated with this location.\n */\n state: State;\n\n /**\n * A unique string associated with this location. May be used to safely store\n * and retrieve data in some other storage API, like `localStorage`.\n *\n * Note: This value is always \"default\" on the initial location.\n */\n key: string;\n}\n\n/**\n * A change to the current location.\n */\nexport interface Update {\n /**\n * The action that triggered the change.\n */\n action: Action;\n\n /**\n * The new location.\n */\n location: Location;\n\n /**\n * The delta between this location and the former location in the history stack\n */\n delta: number | null;\n}\n\n/**\n * A function that receives notifications about location changes.\n */\nexport interface Listener {\n (update: Update): void;\n}\n\n/**\n * Describes a location that is the destination of some navigation, either via\n * `history.push` or `history.replace`. This may be either a URL or the pieces\n * of a URL path.\n */\nexport type To = string | Partial<Path>;\n\n/**\n * A history is an interface to the navigation stack. The history serves as the\n * source of truth for the current location, as well as provides a set of\n * methods that may be used to change it.\n *\n * It is similar to the DOM's `window.history` object, but with a smaller, more\n * focused API.\n */\nexport interface History {\n /**\n * The last action that modified the current location. This will always be\n * Action.Pop when a history instance is first created. This value is mutable.\n */\n readonly action: Action;\n\n /**\n * The current location. This value is mutable.\n */\n readonly location: Location;\n\n /**\n * Returns a valid href for the given `to` value that may be used as\n * the value of an <a href> attribute.\n *\n * @param to - The destination URL\n */\n createHref(to: To): string;\n\n /**\n * Returns a URL for the given `to` value\n *\n * @param to - The destination URL\n */\n createURL(to: To): URL;\n\n /**\n * Encode a location the same way window.history would do (no-op for memory\n * history) so we ensure our PUSH/REPLACE navigations for data routers\n * behave the same as POP\n *\n * @param to Unencoded path\n */\n encodeLocation(to: To): Path;\n\n /**\n * Pushes a new location onto the history stack, increasing its length by one.\n * If there were any entries in the stack after the current one, they are\n * lost.\n *\n * @param to - The new URL\n * @param state - Data to associate with the new location\n */\n push(to: To, state?: any): void;\n\n /**\n * Replaces the current location in the history stack with a new one. The\n * location that was replaced will no longer be available.\n *\n * @param to - The new URL\n * @param state - Data to associate with the new location\n */\n replace(to: To, state?: any): void;\n\n /**\n * Navigates `n` entries backward/forward in the history stack relative to the\n * current index. For example, a \"back\" navigation would use go(-1).\n *\n * @param delta - The delta in the stack index\n */\n go(delta: number): void;\n\n /**\n * Sets up a listener that will be called whenever the current location\n * changes.\n *\n * @param listener - A function that will be called when the location changes\n * @returns unlisten - A function that may be used to stop listening\n */\n listen(listener: Listener): () => void;\n}\n\ntype HistoryState = {\n usr: any;\n key?: string;\n idx: number;\n};\n\nconst PopStateEventType = \"popstate\";\n//#endregion\n\n////////////////////////////////////////////////////////////////////////////////\n//#region Memory History\n////////////////////////////////////////////////////////////////////////////////\n\n/**\n * A user-supplied object that describes a location. Used when providing\n * entries to `createMemoryHistory` via its `initialEntries` option.\n */\nexport type InitialEntry = string | Partial<Location>;\n\nexport type MemoryHistoryOptions = {\n initialEntries?: InitialEntry[];\n initialIndex?: number;\n v5Compat?: boolean;\n};\n\n/**\n * A memory history stores locations in memory. This is useful in stateful\n * environments where there is no web browser, such as node tests or React\n * Native.\n */\nexport interface MemoryHistory extends History {\n /**\n * The current index in the history stack.\n */\n readonly index: number;\n}\n\n/**\n * Memory history stores the current location in memory. It is designed for use\n * in stateful non-browser environments like tests and React Native.\n */\nexport function createMemoryHistory(\n options: MemoryHistoryOptions = {}\n): MemoryHistory {\n let { initialEntries = [\"/\"], initialIndex, v5Compat = false } = options;\n let entries: Location[]; // Declare so we can access from createMemoryLocation\n entries = initialEntries.map((entry, index) =>\n createMemoryLocation(\n entry,\n typeof entry === \"string\" ? null : entry.state,\n index === 0 ? \"default\" : undefined\n )\n );\n let index = clampIndex(\n initialIndex == null ? entries.length - 1 : initialIndex\n );\n let action = Action.Pop;\n let listener: Listener | null = null;\n\n function clampIndex(n: number): number {\n return Math.min(Math.max(n, 0), entries.length - 1);\n }\n function getCurrentLocation(): Location {\n return entries[index];\n }\n function createMemoryLocation(\n to: To,\n state: any = null,\n key?: string\n ): Location {\n let location = createLocation(\n entries ? getCurrentLocation().pathname : \"/\",\n to,\n state,\n key\n );\n warning(\n location.pathname.charAt(0) === \"/\",\n `relative pathnames are not supported in memory history: ${JSON.stringify(\n to\n )}`\n );\n return location;\n }\n\n function createHref(to: To) {\n return typeof to === \"string\" ? to : createPath(to);\n }\n\n let history: MemoryHistory = {\n get index() {\n return index;\n },\n get action() {\n return action;\n },\n get location() {\n return getCurrentLocation();\n },\n createHref,\n createURL(to) {\n return new URL(createHref(to), \"http://localhost\");\n },\n encodeLocation(to: To) {\n let path = typeof to === \"string\" ? parsePath(to) : to;\n return {\n pathname: path.pathname || \"\",\n search: path.search || \"\",\n hash: path.hash || \"\",\n };\n },\n push(to, state) {\n action = Action.Push;\n let nextLocation = createMemoryLocation(to, state);\n index += 1;\n entries.splice(index, entries.length, nextLocation);\n if (v5Compat && listener) {\n listener({ action, location: nextLocation, delta: 1 });\n }\n },\n replace(to, state) {\n action = Action.Replace;\n let nextLocation = createMemoryLocation(to, state);\n entries[index] = nextLocation;\n if (v5Compat && listener) {\n listener({ action, location: nextLocation, delta: 0 });\n }\n },\n go(delta) {\n action = Action.Pop;\n let nextIndex = clampIndex(index + delta);\n let nextLocation = entries[nextIndex];\n index = nextIndex;\n if (listener) {\n listener({ action, location: nextLocation, delta });\n }\n },\n listen(fn: Listener) {\n listener = fn;\n return () => {\n listener = null;\n };\n },\n };\n\n return history;\n}\n//#endregion\n\n////////////////////////////////////////////////////////////////////////////////\n//#region Browser History\n////////////////////////////////////////////////////////////////////////////////\n\n/**\n * A browser history stores the current location in regular URLs in a web\n * browser environment. This is the standard for most web apps and provides the\n * cleanest URLs the browser's address bar.\n *\n * @see https://github.com/remix-run/history/tree/main/docs/api-reference.md#browserhistory\n */\nexport interface BrowserHistory extends UrlHistory {}\n\nexport type BrowserHistoryOptions = UrlHistoryOptions;\n\n/**\n * Browser history stores the location in regular URLs. This is the standard for\n * most web apps, but it requires some configuration on the server to ensure you\n * serve the same app at multiple URLs.\n *\n * @see https://github.com/remix-run/history/tree/main/docs/api-reference.md#createbrowserhistory\n */\nexport function createBrowserHistory(\n options: BrowserHistoryOptions = {}\n): BrowserHistory {\n function createBrowserLocation(\n window: Window,\n globalHistory: Window[\"history\"]\n ) {\n let { pathname, search, hash } = window.location;\n return createLocation(\n \"\",\n { pathname, search, hash },\n // state defaults to `null` because `window.history.state` does\n (globalHistory.state && globalHistory.state.usr) || null,\n (globalHistory.state && globalHistory.state.key) || \"default\"\n );\n }\n\n function createBrowserHref(window: Window, to: To) {\n return typeof to === \"string\" ? to : createPath(to);\n }\n\n return getUrlBasedHistory(\n createBrowserLocation,\n createBrowserHref,\n null,\n options\n );\n}\n//#endregion\n\n////////////////////////////////////////////////////////////////////////////////\n//#region Hash History\n////////////////////////////////////////////////////////////////////////////////\n\n/**\n * A hash history stores the current location in the fragment identifier portion\n * of the URL in a web browser environment.\n *\n * This is ideal for apps that do not control the server for some reason\n * (because the fragment identifier is never sent to the server), including some\n * shared hosting environments that do not provide fine-grained controls over\n * which pages are served at which URLs.\n *\n * @see https://github.com/remix-run/history/tree/main/docs/api-reference.md#hashhistory\n */\nexport interface HashHistory extends UrlHistory {}\n\nexport type HashHistoryOptions = UrlHistoryOptions;\n\n/**\n * Hash history stores the location in window.location.hash. This makes it ideal\n * for situations where you don't want to send the location to the server for\n * some reason, either because you do cannot configure it or the URL space is\n * reserved for something else.\n *\n * @see https://github.com/remix-run/history/tree/main/docs/api-reference.md#createhashhistory\n */\nexport function createHashHistory(\n options: HashHistoryOptions = {}\n): HashHistory {\n function createHashLocation(\n window: Window,\n globalHistory: Window[\"history\"]\n ) {\n let {\n pathname = \"/\",\n search = \"\",\n hash = \"\",\n } = parsePath(window.location.hash.substr(1));\n\n // Hash URL should always have a leading / just like window.location.pathname\n // does, so if an app ends up at a route like /#something then we add a\n // leading slash so all of our path-matching behaves the same as if it would\n // in a browser router. This is particularly important when there exists a\n // root splat route (<Route path=\"*\">) since that matches internally against\n // \"/*\" and we'd expect /#something to 404 in a hash router app.\n if (!pathname.startsWith(\"/\") && !pathname.startsWith(\".\")) {\n pathname = \"/\" + pathname;\n }\n\n return createLocation(\n \"\",\n { pathname, search, hash },\n // state defaults to `null` because `window.history.state` does\n (globalHistory.state && globalHistory.state.usr) || null,\n (globalHistory.state && globalHistory.state.key) || \"default\"\n );\n }\n\n function createHashHref(window: Window, to: To) {\n let base = window.document.querySelector(\"base\");\n let href = \"\";\n\n if (base && base.getAttribute(\"href\")) {\n let url = window.location.href;\n let hashIndex = url.indexOf(\"#\");\n href = hashIndex === -1 ? url : url.sl