react-router 6.3.0 → 6.4.0-pre.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- {"version":3,"file":"react-router.development.js","sources":["../../../packages/react-router/lib/context.ts","../../../packages/react-router/lib/router.ts","../../../packages/react-router/lib/hooks.tsx","../../../packages/react-router/lib/components.tsx"],"sourcesContent":["import * as React from \"react\";\nimport type { History, Location } from \"history\";\nimport { Action as NavigationType } from \"history\";\n\nimport type { RouteMatch } from \"./router\";\n\n/**\n * A Navigator is a \"location changer\"; it's how you get to different locations.\n *\n * Every history instance conforms to the Navigator interface, but the\n * distinction is useful primarily when it comes to the low-level <Router> API\n * where both the location and a navigator must be provided separately in order\n * to avoid \"tearing\" that may occur in a suspense-enabled app if the action\n * and/or location were to be read directly from the history instance.\n */\nexport type Navigator = Pick<History, \"go\" | \"push\" | \"replace\" | \"createHref\">;\n\ninterface NavigationContextObject {\n basename: string;\n navigator: Navigator;\n static: boolean;\n}\n\nexport const NavigationContext = React.createContext<NavigationContextObject>(\n null!\n);\n\nif (__DEV__) {\n NavigationContext.displayName = \"Navigation\";\n}\n\ninterface LocationContextObject {\n location: Location;\n navigationType: NavigationType;\n}\n\nexport const LocationContext = React.createContext<LocationContextObject>(\n null!\n);\n\nif (__DEV__) {\n LocationContext.displayName = \"Location\";\n}\n\ninterface RouteContextObject {\n outlet: React.ReactElement | null;\n matches: RouteMatch[];\n}\n\nexport const RouteContext = React.createContext<RouteContextObject>({\n outlet: null,\n matches: [],\n});\n\nif (__DEV__) {\n RouteContext.displayName = \"Route\";\n}\n","import type { Location, Path, To } from \"history\";\nimport { parsePath } from \"history\";\n\nexport function invariant(cond: any, message: string): asserts cond {\n if (!cond) throw new Error(message);\n}\n\nexport function warning(cond: any, message: string): void {\n if (!cond) {\n // eslint-disable-next-line no-console\n if (typeof console !== \"undefined\") console.warn(message);\n\n try {\n // Welcome to debugging React Router!\n //\n // This error is thrown as a convenience so you can more easily\n // find the source for a warning that appears in the console by\n // enabling \"pause on exceptions\" in your JavaScript debugger.\n throw new Error(message);\n // eslint-disable-next-line no-empty\n } catch (e) {}\n }\n}\n\nconst alreadyWarned: Record<string, boolean> = {};\nexport function warningOnce(key: string, cond: boolean, message: string) {\n if (!cond && !alreadyWarned[key]) {\n alreadyWarned[key] = true;\n warning(false, message);\n }\n}\n\ntype ParamParseFailed = { failed: true };\n\ntype ParamParseSegment<Segment extends string> =\n // Check here if there exists a forward slash in the string.\n Segment extends `${infer LeftSegment}/${infer RightSegment}`\n ? // If there is a forward slash, then attempt to parse each side of the\n // forward slash.\n ParamParseSegment<LeftSegment> extends infer LeftResult\n ? ParamParseSegment<RightSegment> extends infer RightResult\n ? LeftResult extends string\n ? // If the left side is successfully parsed as a param, then check if\n // the right side can be successfully parsed as well. If both sides\n // can be parsed, then the result is a union of the two sides\n // (read: \"foo\" | \"bar\").\n RightResult extends string\n ? LeftResult | RightResult\n : LeftResult\n : // If the left side is not successfully parsed as a param, then check\n // if only the right side can be successfully parse as a param. If it\n // can, then the result is just right, else it's a failure.\n RightResult extends string\n ? RightResult\n : ParamParseFailed\n : ParamParseFailed\n : // If the left side didn't parse into a param, then just check the right\n // side.\n ParamParseSegment<RightSegment> extends infer RightResult\n ? RightResult extends string\n ? RightResult\n : ParamParseFailed\n : ParamParseFailed\n : // If there's no forward slash, then check if this segment starts with a\n // colon. If it does, then this is a dynamic segment, so the result is\n // just the remainder of the string. Otherwise, it's a failure.\n Segment extends `:${infer Remaining}`\n ? Remaining\n : ParamParseFailed;\n\n// Attempt to parse the given string segment. If it fails, then just return the\n// plain string type as a default fallback. Otherwise return the union of the\n// parsed string literals that were referenced as dynamic segments in the route.\nexport type ParamParseKey<Segment extends string> =\n ParamParseSegment<Segment> extends string\n ? ParamParseSegment<Segment>\n : string;\n\n/**\n * The parameters that were parsed from the URL path.\n */\nexport type Params<Key extends string = string> = {\n readonly [key in Key]: string | undefined;\n};\n\n/**\n * A route object represents a logical route, with (optionally) its child\n * routes organized in a tree-like structure.\n */\nexport interface RouteObject {\n caseSensitive?: boolean;\n children?: RouteObject[];\n element?: React.ReactNode;\n index?: boolean;\n path?: string;\n}\n\n/**\n * Returns a path with params interpolated.\n *\n * @see https://reactrouter.com/docs/en/v6/api#generatepath\n */\nexport function generatePath(path: string, params: Params = {}): string {\n return path\n .replace(/:(\\w+)/g, (_, key) => {\n invariant(params[key] != null, `Missing \":${key}\" param`);\n return params[key]!;\n })\n .replace(/\\/*\\*$/, (_) =>\n params[\"*\"] == null ? \"\" : params[\"*\"].replace(/^\\/*/, \"/\")\n );\n}\n\n/**\n * A RouteMatch contains info about how a route matched a URL.\n */\nexport interface RouteMatch<ParamKey extends string = string> {\n /**\n * The names and values of dynamic parameters in the URL.\n */\n params: Params<ParamKey>;\n /**\n * The portion of the URL pathname that was matched.\n */\n pathname: string;\n /**\n * The portion of the URL pathname that was matched before child routes.\n */\n pathnameBase: string;\n /**\n * The route object that was used to match.\n */\n route: RouteObject;\n}\n\n/**\n * Matches the given routes to a location and returns the match data.\n *\n * @see https://reactrouter.com/docs/en/v6/api#matchroutes\n */\nexport function matchRoutes(\n routes: RouteObject[],\n locationArg: Partial<Location> | string,\n basename = \"/\"\n): RouteMatch[] | null {\n let location =\n typeof locationArg === \"string\" ? parsePath(locationArg) : locationArg;\n\n let pathname = stripBasename(location.pathname || \"/\", basename);\n\n if (pathname == null) {\n return null;\n }\n\n let branches = flattenRoutes(routes);\n rankRouteBranches(branches);\n\n let matches = null;\n for (let i = 0; matches == null && i < branches.length; ++i) {\n matches = matchRouteBranch(branches[i], pathname);\n }\n\n return matches;\n}\n\ninterface RouteMeta {\n relativePath: string;\n caseSensitive: boolean;\n childrenIndex: number;\n route: RouteObject;\n}\n\ninterface RouteBranch {\n path: string;\n score: number;\n routesMeta: RouteMeta[];\n}\n\nfunction flattenRoutes(\n routes: RouteObject[],\n branches: RouteBranch[] = [],\n parentsMeta: RouteMeta[] = [],\n parentPath = \"\"\n): RouteBranch[] {\n routes.forEach((route, index) => {\n let meta: RouteMeta = {\n relativePath: route.path || \"\",\n caseSensitive: route.caseSensitive === true,\n childrenIndex: index,\n route,\n };\n\n if (meta.relativePath.startsWith(\"/\")) {\n invariant(\n meta.relativePath.startsWith(parentPath),\n `Absolute route path \"${meta.relativePath}\" nested under path ` +\n `\"${parentPath}\" is not valid. An absolute child route path ` +\n `must start with the combined path of all its parent routes.`\n );\n\n meta.relativePath = meta.relativePath.slice(parentPath.length);\n }\n\n let path = joinPaths([parentPath, meta.relativePath]);\n let routesMeta = parentsMeta.concat(meta);\n\n // Add the children before adding this route to the array so we traverse the\n // route tree depth-first and child routes appear before their parents in\n // the \"flattened\" version.\n if (route.children && route.children.length > 0) {\n invariant(\n route.index !== true,\n `Index routes must not have child routes. Please remove ` +\n `all child routes from route path \"${path}\".`\n );\n\n flattenRoutes(route.children, branches, routesMeta, path);\n }\n\n // Routes without a path shouldn't ever match by themselves unless they are\n // index routes, so don't add them to the list of possible branches.\n if (route.path == null && !route.index) {\n return;\n }\n\n branches.push({ path, score: computeScore(path, route.index), routesMeta });\n });\n\n return branches;\n}\n\nfunction rankRouteBranches(branches: RouteBranch[]): void {\n branches.sort((a, b) =>\n a.score !== b.score\n ? b.score - a.score // Higher score first\n : compareIndexes(\n a.routesMeta.map((meta) => meta.childrenIndex),\n b.routesMeta.map((meta) => meta.childrenIndex)\n )\n );\n}\n\nconst paramRe = /^:\\w+$/;\nconst dynamicSegmentValue = 3;\nconst indexRouteValue = 2;\nconst emptySegmentValue = 1;\nconst staticSegmentValue = 10;\nconst splatPenalty = -2;\nconst isSplat = (s: string) => s === \"*\";\n\nfunction computeScore(path: string, index: boolean | undefined): number {\n let segments = path.split(\"/\");\n let initialScore = segments.length;\n if (segments.some(isSplat)) {\n initialScore += splatPenalty;\n }\n\n if (index) {\n initialScore += indexRouteValue;\n }\n\n return segments\n .filter((s) => !isSplat(s))\n .reduce(\n (score, segment) =>\n score +\n (paramRe.test(segment)\n ? dynamicSegmentValue\n : segment === \"\"\n ? emptySegmentValue\n : staticSegmentValue),\n initialScore\n );\n}\n\nfunction compareIndexes(a: number[], b: number[]): number {\n let siblings =\n a.length === b.length && a.slice(0, -1).every((n, i) => n === b[i]);\n\n return siblings\n ? // If two routes are siblings, we should try to match the earlier sibling\n // first. This allows people to have fine-grained control over the matching\n // behavior by simply putting routes with identical paths in the order they\n // want them tried.\n a[a.length - 1] - b[b.length - 1]\n : // Otherwise, it doesn't really make sense to rank non-siblings by index,\n // so they sort equally.\n 0;\n}\n\nfunction matchRouteBranch<ParamKey extends string = string>(\n branch: RouteBranch,\n pathname: string\n): RouteMatch<ParamKey>[] | null {\n let { routesMeta } = branch;\n\n let matchedParams = {};\n let matchedPathname = \"/\";\n let matches: RouteMatch[] = [];\n for (let i = 0; i < routesMeta.length; ++i) {\n let meta = routesMeta[i];\n let end = i === routesMeta.length - 1;\n let remainingPathname =\n matchedPathname === \"/\"\n ? pathname\n : pathname.slice(matchedPathname.length) || \"/\";\n let match = matchPath(\n { path: meta.relativePath, caseSensitive: meta.caseSensitive, end },\n remainingPathname\n );\n\n if (!match) return null;\n\n Object.assign(matchedParams, match.params);\n\n let route = meta.route;\n\n matches.push({\n params: matchedParams,\n pathname: joinPaths([matchedPathname, match.pathname]),\n pathnameBase: normalizePathname(\n joinPaths([matchedPathname, match.pathnameBase])\n ),\n route,\n });\n\n if (match.pathnameBase !== \"/\") {\n matchedPathname = joinPaths([matchedPathname, match.pathnameBase]);\n }\n }\n\n return matches;\n}\n\n/**\n * A PathPattern is used to match on some portion of a URL pathname.\n */\nexport interface PathPattern<Path extends string = string> {\n /**\n * A string to match against a URL pathname. May contain `:id`-style segments\n * to indicate placeholders for dynamic parameters. May also end with `/*` to\n * indicate matching the rest of the URL pathname.\n */\n path: Path;\n /**\n * Should be `true` if the static portions of the `path` should be matched in\n * the same case.\n */\n caseSensitive?: boolean;\n /**\n * Should be `true` if this pattern should match the entire URL pathname.\n */\n end?: boolean;\n}\n\n/**\n * A PathMatch contains info about how a PathPattern matched on a URL pathname.\n */\nexport interface PathMatch<ParamKey extends string = string> {\n /**\n * The names and values of dynamic parameters in the URL.\n */\n params: Params<ParamKey>;\n /**\n * The portion of the URL pathname that was matched.\n */\n pathname: string;\n /**\n * The portion of the URL pathname that was matched before child routes.\n */\n pathnameBase: string;\n /**\n * The pattern that was used to match.\n */\n pattern: PathPattern;\n}\n\ntype Mutable<T> = {\n -readonly [P in keyof T]: T[P];\n};\n\n/**\n * Performs pattern matching on a URL pathname and returns information about\n * the match.\n *\n * @see https://reactrouter.com/docs/en/v6/api#matchpath\n */\nexport function matchPath<\n ParamKey extends ParamParseKey<Path>,\n Path extends string\n>(\n pattern: PathPattern<Path> | Path,\n pathname: string\n): PathMatch<ParamKey> | null {\n if (typeof pattern === \"string\") {\n pattern = { path: pattern, caseSensitive: false, end: true };\n }\n\n let [matcher, paramNames] = compilePath(\n pattern.path,\n pattern.caseSensitive,\n pattern.end\n );\n\n let match = pathname.match(matcher);\n if (!match) return null;\n\n let matchedPathname = match[0];\n let pathnameBase = matchedPathname.replace(/(.)\\/+$/, \"$1\");\n let captureGroups = match.slice(1);\n let params: Params = paramNames.reduce<Mutable<Params>>(\n (memo, paramName, index) => {\n // We need to compute the pathnameBase here using the raw splat value\n // instead of using params[\"*\"] later because it will be decoded then\n if (paramName === \"*\") {\n let splatValue = captureGroups[index] || \"\";\n pathnameBase = matchedPathname\n .slice(0, matchedPathname.length - splatValue.length)\n .replace(/(.)\\/+$/, \"$1\");\n }\n\n memo[paramName] = safelyDecodeURIComponent(\n captureGroups[index] || \"\",\n paramName\n );\n return memo;\n },\n {}\n );\n\n return {\n params,\n pathname: matchedPathname,\n pathnameBase,\n pattern,\n };\n}\n\nfunction compilePath(\n path: string,\n caseSensitive = false,\n end = true\n): [RegExp, string[]] {\n warning(\n path === \"*\" || !path.endsWith(\"*\") || path.endsWith(\"/*\"),\n `Route path \"${path}\" will be treated as if it were ` +\n `\"${path.replace(/\\*$/, \"/*\")}\" because the \\`*\\` character must ` +\n `always follow a \\`/\\` in the pattern. To get rid of this warning, ` +\n `please change the route path to \"${path.replace(/\\*$/, \"/*\")}\".`\n );\n\n let paramNames: string[] = [];\n let regexpSource =\n \"^\" +\n path\n .replace(/\\/*\\*?$/, \"\") // Ignore trailing / and /*, we'll handle it below\n .replace(/^\\/*/, \"/\") // Make sure it has a leading /\n .replace(/[\\\\.*+^$?{}|()[\\]]/g, \"\\\\$&\") // Escape special regex chars\n .replace(/:(\\w+)/g, (_: string, paramName: string) => {\n paramNames.push(paramName);\n return \"([^\\\\/]+)\";\n });\n\n if (path.endsWith(\"*\")) {\n paramNames.push(\"*\");\n regexpSource +=\n path === \"*\" || path === \"/*\"\n ? \"(.*)$\" // Already matched the initial /, just match the rest\n : \"(?:\\\\/(.+)|\\\\/*)$\"; // Don't include the / in params[\"*\"]\n } else {\n regexpSource += end\n ? \"\\\\/*$\" // When matching to the end, ignore trailing slashes\n : // Otherwise, match a word boundary or a proceeding /. The word boundary restricts\n // parent routes to matching only their own words and nothing more, e.g. parent\n // route \"/home\" should not match \"/home2\".\n // Additionally, allow paths starting with `.`, `-`, `~`, and url-encoded entities,\n // but do not consume the character in the matched path so they can match against\n // nested paths.\n \"(?:(?=[.~-]|%[0-9A-F]{2})|\\\\b|\\\\/|$)\";\n }\n\n let matcher = new RegExp(regexpSource, caseSensitive ? undefined : \"i\");\n\n return [matcher, paramNames];\n}\n\nfunction safelyDecodeURIComponent(value: string, paramName: string) {\n try {\n return decodeURIComponent(value);\n } catch (error) {\n warning(\n false,\n `The value for the URL param \"${paramName}\" will not be decoded because` +\n ` the string \"${value}\" is a malformed URL segment. This is probably` +\n ` due to a bad percent encoding (${error}).`\n );\n\n return value;\n }\n}\n\n/**\n * Returns a resolved path object relative to the given pathname.\n *\n * @see https://reactrouter.com/docs/en/v6/api#resolvepath\n */\nexport function resolvePath(to: To, fromPathname = \"/\"): Path {\n let {\n pathname: toPathname,\n search = \"\",\n hash = \"\",\n } = typeof to === \"string\" ? parsePath(to) : to;\n\n let pathname = toPathname\n ? toPathname.startsWith(\"/\")\n ? toPathname\n : resolvePathname(toPathname, fromPathname)\n : fromPathname;\n\n return {\n pathname,\n search: normalizeSearch(search),\n hash: normalizeHash(hash),\n };\n}\n\nfunction resolvePathname(relativePath: string, fromPathname: string): string {\n let segments = fromPathname.replace(/\\/+$/, \"\").split(\"/\");\n let relativeSegments = relativePath.split(\"/\");\n\n relativeSegments.forEach((segment) => {\n if (segment === \"..\") {\n // Keep the root \"\" segment so the pathname starts at /\n if (segments.length > 1) segments.pop();\n } else if (segment !== \".\") {\n segments.push(segment);\n }\n });\n\n return segments.length > 1 ? segments.join(\"/\") : \"/\";\n}\n\nexport function resolveTo(\n toArg: To,\n routePathnames: string[],\n locationPathname: string\n): Path {\n let to = typeof toArg === \"string\" ? parsePath(toArg) : toArg;\n let toPathname = toArg === \"\" || to.pathname === \"\" ? \"/\" : to.pathname;\n\n // If a pathname is explicitly provided in `to`, it should be relative to the\n // route context. This is explained in `Note on `<Link to>` values` in our\n // migration guide from v5 as a means of disambiguation between `to` values\n // that begin with `/` and those that do not. However, this is problematic for\n // `to` values that do not provide a pathname. `to` can simply be a search or\n // hash string, in which case we should assume that the navigation is relative\n // to the current location's pathname and *not* the route pathname.\n let from: string;\n if (toPathname == null) {\n from = locationPathname;\n } else {\n let routePathnameIndex = routePathnames.length - 1;\n\n if (toPathname.startsWith(\"..\")) {\n let toSegments = toPathname.split(\"/\");\n\n // Each leading .. segment means \"go up one route\" instead of \"go up one\n // URL segment\". This is a key difference from how <a href> works and a\n // major reason we call this a \"to\" value instead of a \"href\".\n while (toSegments[0] === \"..\") {\n toSegments.shift();\n routePathnameIndex -= 1;\n }\n\n to.pathname = toSegments.join(\"/\");\n }\n\n // If there are more \"..\" segments than parent routes, resolve relative to\n // the root / URL.\n from = routePathnameIndex >= 0 ? routePathnames[routePathnameIndex] : \"/\";\n }\n\n let path = resolvePath(to, from);\n\n // Ensure the pathname has a trailing slash if the original to value had one.\n if (\n toPathname &&\n toPathname !== \"/\" &&\n toPathname.endsWith(\"/\") &&\n !path.pathname.endsWith(\"/\")\n ) {\n path.pathname += \"/\";\n }\n\n return path;\n}\n\nexport function getToPathname(to: To): string | undefined {\n // Empty strings should be treated the same as / paths\n return to === \"\" || (to as Path).pathname === \"\"\n ? \"/\"\n : typeof to === \"string\"\n ? parsePath(to).pathname\n : to.pathname;\n}\n\nexport function stripBasename(\n pathname: string,\n basename: string\n): string | null {\n if (basename === \"/\") return pathname;\n\n if (!pathname.toLowerCase().startsWith(basename.toLowerCase())) {\n return null;\n }\n\n let nextChar = pathname.charAt(basename.length);\n if (nextChar && nextChar !== \"/\") {\n // pathname does not start with basename/\n return null;\n }\n\n return pathname.slice(basename.length) || \"/\";\n}\n\nexport const joinPaths = (paths: string[]): string =>\n paths.join(\"/\").replace(/\\/\\/+/g, \"/\");\n\nexport const normalizePathname = (pathname: string): string =>\n pathname.replace(/\\/+$/, \"\").replace(/^\\/*/, \"/\");\n\nconst normalizeSearch = (search: string): string =>\n !search || search === \"?\"\n ? \"\"\n : search.startsWith(\"?\")\n ? search\n : \"?\" + search;\n\nconst normalizeHash = (hash: string): string =>\n !hash || hash === \"#\" ? \"\" : hash.startsWith(\"#\") ? hash : \"#\" + hash;\n","import * as React from \"react\";\nimport type { Location, Path, To } from \"history\";\nimport { Action as NavigationType, parsePath } from \"history\";\n\nimport { LocationContext, NavigationContext, RouteContext } from \"./context\";\nimport type {\n ParamParseKey,\n Params,\n PathMatch,\n PathPattern,\n RouteMatch,\n RouteObject,\n} from \"./router\";\nimport {\n getToPathname,\n invariant,\n joinPaths,\n matchPath,\n matchRoutes,\n resolveTo,\n warning,\n warningOnce,\n} from \"./router\";\n\n/**\n * Returns the full href for the given \"to\" value. This is useful for building\n * custom links that are also accessible and preserve right-click behavior.\n *\n * @see https://reactrouter.com/docs/en/v6/api#usehref\n */\nexport function useHref(to: To): string {\n invariant(\n useInRouterContext(),\n // TODO: This error is probably because they somehow have 2 versions of the\n // router loaded. We can help them understand how to avoid that.\n `useHref() may be used only in the context of a <Router> component.`\n );\n\n let { basename, navigator } = React.useContext(NavigationContext);\n let { hash, pathname, search } = useResolvedPath(to);\n\n let joinedPathname = pathname;\n if (basename !== \"/\") {\n let toPathname = getToPathname(to);\n let endsWithSlash = toPathname != null && toPathname.endsWith(\"/\");\n joinedPathname =\n pathname === \"/\"\n ? basename + (endsWithSlash ? \"/\" : \"\")\n : joinPaths([basename, pathname]);\n }\n\n return navigator.createHref({ pathname: joinedPathname, search, hash });\n}\n\n/**\n * Returns true if this component is a descendant of a <Router>.\n *\n * @see https://reactrouter.com/docs/en/v6/api#useinroutercontext\n */\nexport function useInRouterContext(): boolean {\n return React.useContext(LocationContext) != null;\n}\n\n/**\n * Returns the current location object, which represents the current URL in web\n * browsers.\n *\n * Note: If you're using this it may mean you're doing some of your own\n * \"routing\" in your app, and we'd like to know what your use case is. We may\n * be able to provide something higher-level to better suit your needs.\n *\n * @see https://reactrouter.com/docs/en/v6/api#uselocation\n */\nexport function useLocation(): Location {\n invariant(\n useInRouterContext(),\n // TODO: This error is probably because they somehow have 2 versions of the\n // router loaded. We can help them understand how to avoid that.\n `useLocation() may be used only in the context of a <Router> component.`\n );\n\n return React.useContext(LocationContext).location;\n}\n\n/**\n * Returns the current navigation action which describes how the router came to\n * the current location, either by a pop, push, or replace on the history stack.\n *\n * @see https://reactrouter.com/docs/en/v6/api#usenavigationtype\n */\nexport function useNavigationType(): NavigationType {\n return React.useContext(LocationContext).navigationType;\n}\n\n/**\n * Returns true if the URL for the given \"to\" value matches the current URL.\n * This is useful for components that need to know \"active\" state, e.g.\n * <NavLink>.\n *\n * @see https://reactrouter.com/docs/en/v6/api#usematch\n */\nexport function useMatch<\n ParamKey extends ParamParseKey<Path>,\n Path extends string\n>(pattern: PathPattern<Path> | Path): PathMatch<ParamKey> | null {\n invariant(\n useInRouterContext(),\n // TODO: This error is probably because they somehow have 2 versions of the\n // router loaded. We can help them understand how to avoid that.\n `useMatch() may be used only in the context of a <Router> component.`\n );\n\n let { pathname } = useLocation();\n return React.useMemo(\n () => matchPath<ParamKey, Path>(pattern, pathname),\n [pathname, pattern]\n );\n}\n\n/**\n * The interface for the navigate() function returned from useNavigate().\n */\nexport interface NavigateFunction {\n (to: To, options?: NavigateOptions): void;\n (delta: number): void;\n}\n\nexport interface NavigateOptions {\n replace?: boolean;\n state?: any;\n}\n\n/**\n * Returns an imperative method for changing the location. Used by <Link>s, but\n * may also be used by other elements to change the location.\n *\n * @see https://reactrouter.com/docs/en/v6/api#usenavigate\n */\nexport function useNavigate(): NavigateFunction {\n invariant(\n useInRouterContext(),\n // TODO: This error is probably because they somehow have 2 versions of the\n // router loaded. We can help them understand how to avoid that.\n `useNavigate() may be used only in the context of a <Router> component.`\n );\n\n let { basename, navigator } = React.useContext(NavigationContext);\n let { matches } = React.useContext(RouteContext);\n let { pathname: locationPathname } = useLocation();\n\n let routePathnamesJson = JSON.stringify(\n matches.map((match) => match.pathnameBase)\n );\n\n let activeRef = React.useRef(false);\n React.useEffect(() => {\n activeRef.current = true;\n });\n\n let navigate: NavigateFunction = React.useCallback(\n (to: To | number, options: NavigateOptions = {}) => {\n warning(\n activeRef.current,\n `You should call navigate() in a React.useEffect(), not when ` +\n `your component is first rendered.`\n );\n\n if (!activeRef.current) return;\n\n if (typeof to === \"number\") {\n navigator.go(to);\n return;\n }\n\n let path = resolveTo(\n to,\n JSON.parse(routePathnamesJson),\n locationPathname\n );\n\n if (basename !== \"/\") {\n path.pathname = joinPaths([basename, path.pathname]);\n }\n\n (!!options.replace ? navigator.replace : navigator.push)(\n path,\n options.state\n );\n },\n [basename, navigator, routePathnamesJson, locationPathname]\n );\n\n return navigate;\n}\n\nconst OutletContext = React.createContext<unknown>(null);\n\n/**\n * Returns the context (if provided) for the child route at this level of the route\n * hierarchy.\n * @see https://reactrouter.com/docs/en/v6/api#useoutletcontext\n */\nexport function useOutletContext<Context = unknown>(): Context {\n return React.useContext(OutletContext) as Context;\n}\n\n/**\n * Returns the element for the child route at this level of the route\n * hierarchy. Used internally by <Outlet> to render child routes.\n *\n * @see https://reactrouter.com/docs/en/v6/api#useoutlet\n */\nexport function useOutlet(context?: unknown): React.ReactElement | null {\n let outlet = React.useContext(RouteContext).outlet;\n if (outlet) {\n return (\n <OutletContext.Provider value={context}>{outlet}</OutletContext.Provider>\n );\n }\n return outlet;\n}\n\n/**\n * Returns an object of key/value pairs of the dynamic params from the current\n * URL that were matched by the route path.\n *\n * @see https://reactrouter.com/docs/en/v6/api#useparams\n */\nexport function useParams<\n ParamsOrKey extends string | Record<string, string | undefined> = string\n>(): Readonly<\n [ParamsOrKey] extends [string] ? Params<ParamsOrKey> : Partial<ParamsOrKey>\n> {\n let { matches } = React.useContext(RouteContext);\n let routeMatch = matches[matches.length - 1];\n return routeMatch ? (routeMatch.params as any) : {};\n}\n\n/**\n * Resolves the pathname of the given `to` value against the current location.\n *\n * @see https://reactrouter.com/docs/en/v6/api#useresolvedpath\n */\nexport function useResolvedPath(to: To): Path {\n let { matches } = React.useContext(RouteContext);\n let { pathname: locationPathname } = useLocation();\n\n let routePathnamesJson = JSON.stringify(\n matches.map((match) => match.pathnameBase)\n );\n\n return React.useMemo(\n () => resolveTo(to, JSON.parse(routePathnamesJson), locationPathname),\n [to, routePathnamesJson, locationPathname]\n );\n}\n\n/**\n * Returns the element of the route that matched the current location, prepared\n * with the correct context to render the remainder of the route tree. Route\n * elements in the tree must render an <Outlet> to render their child route's\n * element.\n *\n * @see https://reactrouter.com/docs/en/v6/api#useroutes\n */\nexport function useRoutes(\n routes: RouteObject[],\n locationArg?: Partial<Location> | string\n): React.ReactElement | null {\n invariant(\n useInRouterContext(),\n // TODO: This error is probably because they somehow have 2 versions of the\n // router loaded. We can help them understand how to avoid that.\n `useRoutes() may be used only in the context of a <Router> component.`\n );\n\n let { matches: parentMatches } = React.useContext(RouteContext);\n let routeMatch = parentMatches[parentMatches.length - 1];\n let parentParams = routeMatch ? routeMatch.params : {};\n let parentPathname = routeMatch ? routeMatch.pathname : \"/\";\n let parentPathnameBase = routeMatch ? routeMatch.pathnameBase : \"/\";\n let parentRoute = routeMatch && routeMatch.route;\n\n if (__DEV__) {\n // You won't get a warning about 2 different <Routes> under a <Route>\n // without a trailing *, but this is a best-effort warning anyway since we\n // cannot even give the warning unless they land at the parent route.\n //\n // Example:\n //\n // <Routes>\n // {/* This route path MUST end with /* because otherwise\n // it will never match /blog/post/123 */}\n // <Route path=\"blog\" element={<Blog />} />\n // <Route path=\"blog/feed\" element={<BlogFeed />} />\n // </Routes>\n //\n // function Blog() {\n // return (\n // <Routes>\n // <Route path=\"post/:id\" element={<Post />} />\n // </Routes>\n // );\n // }\n let parentPath = (parentRoute && parentRoute.path) || \"\";\n warningOnce(\n parentPathname,\n !parentRoute || parentPath.endsWith(\"*\"),\n `You rendered descendant <Routes> (or called \\`useRoutes()\\`) at ` +\n `\"${parentPathname}\" (under <Route path=\"${parentPath}\">) but the ` +\n `parent route path has no trailing \"*\". This means if you navigate ` +\n `deeper, the parent won't match anymore and therefore the child ` +\n `routes will never render.\\n\\n` +\n `Please change the parent <Route path=\"${parentPath}\"> to <Route ` +\n `path=\"${parentPath === \"/\" ? \"*\" : `${parentPath}/*`}\">.`\n );\n }\n\n let locationFromContext = useLocation();\n\n let location;\n if (locationArg) {\n let parsedLocationArg =\n typeof locationArg === \"string\" ? parsePath(locationArg) : locationArg;\n\n invariant(\n parentPathnameBase === \"/\" ||\n parsedLocationArg.pathname?.startsWith(parentPathnameBase),\n `When overriding the location using \\`<Routes location>\\` or \\`useRoutes(routes, location)\\`, ` +\n `the location pathname must begin with the portion of the URL pathname that was ` +\n `matched by all parent routes. The current pathname base is \"${parentPathnameBase}\" ` +\n `but pathname \"${parsedLocationArg.pathname}\" was given in the \\`location\\` prop.`\n );\n\n location = parsedLocationArg;\n } else {\n location = locationFromContext;\n }\n\n let pathname = location.pathname || \"/\";\n let remainingPathname =\n parentPathnameBase === \"/\"\n ? pathname\n : pathname.slice(parentPathnameBase.length) || \"/\";\n let matches = matchRoutes(routes, { pathname: remainingPathname });\n\n if (__DEV__) {\n warning(\n parentRoute || matches != null,\n `No routes matched location \"${location.pathname}${location.search}${location.hash}\" `\n );\n\n warning(\n matches == null ||\n matches[matches.length - 1].route.element !== undefined,\n `Matched leaf route at location \"${location.pathname}${location.search}${location.hash}\" does not have an element. ` +\n `This means it will render an <Outlet /> with a null value by default resulting in an \"empty\" page.`\n );\n }\n\n return _renderMatches(\n matches &&\n matches.map((match) =>\n Object.assign({}, match, {\n params: Object.assign({}, parentParams, match.params),\n pathname: joinPaths([parentPathnameBase, match.pathname]),\n pathnameBase:\n match.pathnameBase === \"/\"\n ? parentPathnameBase\n : joinPaths([parentPathnameBase, match.pathnameBase]),\n })\n ),\n parentMatches\n );\n}\n\nexport function _renderMatches(\n matches: RouteMatch[] | null,\n parentMatches: RouteMatch[] = []\n): React.ReactElement | null {\n if (matches == null) return null;\n\n return matches.reduceRight((outlet, match, index) => {\n return (\n <RouteContext.Provider\n children={\n match.route.element !== undefined ? match.route.element : outlet\n }\n value={{\n outlet,\n matches: parentMatches.concat(matches.slice(0, index + 1)),\n }}\n />\n );\n }, null as React.ReactElement | null);\n}\n","import * as React from \"react\";\nimport type { InitialEntry, Location, MemoryHistory, To } from \"history\";\nimport {\n Action as NavigationType,\n createMemoryHistory,\n parsePath,\n} from \"history\";\n\nimport { LocationContext, NavigationContext, Navigator } from \"./context\";\nimport {\n useInRouterContext,\n useNavigate,\n useOutlet,\n useRoutes,\n _renderMatches,\n} from \"./hooks\";\nimport type { RouteMatch, RouteObject } from \"./router\";\nimport { invariant, normalizePathname, stripBasename, warning } from \"./router\";\n\nexport interface MemoryRouterProps {\n basename?: string;\n children?: React.ReactNode;\n initialEntries?: InitialEntry[];\n initialIndex?: number;\n}\n\n/**\n * A <Router> that stores all entries in memory.\n *\n * @see https://reactrouter.com/docs/en/v6/api#memoryrouter\n */\nexport function MemoryRouter({\n basename,\n children,\n initialEntries,\n initialIndex,\n}: MemoryRouterProps): React.ReactElement {\n let historyRef = React.useRef<MemoryHistory>();\n if (historyRef.current == null) {\n historyRef.current = createMemoryHistory({ initialEntries, initialIndex });\n }\n\n let history = historyRef.current;\n let [state, setState] = React.useState({\n action: history.action,\n location: history.location,\n });\n\n React.useLayoutEffect(() => history.listen(setState), [history]);\n\n return (\n <Router\n basename={basename}\n children={children}\n location={state.location}\n navigationType={state.action}\n navigator={history}\n />\n );\n}\n\nexport interface NavigateProps {\n to: To;\n replace?: boolean;\n state?: any;\n}\n\n/**\n * Changes the current location.\n *\n * Note: This API is mostly useful in React.Component subclasses that are not\n * able to use hooks. In functional components, we recommend you use the\n * `useNavigate` hook instead.\n *\n * @see https://reactrouter.com/docs/en/v6/api#navigate\n */\nexport function Navigate({ to, replace, state }: NavigateProps): null {\n invariant(\n useInRouterContext(),\n // TODO: This error is probably because they somehow have 2 versions of\n // the router loaded. We can help them understand how to avoid that.\n `<Navigate> may be used only in the context of a <Router> component.`\n );\n\n warning(\n !React.useContext(NavigationContext).static,\n `<Navigate> must not be used on the initial render in a <StaticRouter>. ` +\n `This is a no-op, but you should modify your code so the <Navigate> is ` +\n `only ever rendered in response to some user interaction or state change.`\n );\n\n let navigate = useNavigate();\n React.useEffect(() => {\n navigate(to, { replace, state });\n });\n\n return null;\n}\n\nexport interface OutletProps {\n context?: unknown;\n}\n\n/**\n * Renders the child route's element, if there is one.\n *\n * @see https://reactrouter.com/docs/en/v6/api#outlet\n */\nexport function Outlet(props: OutletProps): React.ReactElement | null {\n return useOutlet(props.context);\n}\n\nexport interface RouteProps {\n caseSensitive?: boolean;\n children?: React.ReactNode;\n element?: React.ReactNode | null;\n index?: boolean;\n path?: string;\n}\n\nexport interface PathRouteProps {\n caseSensitive?: boolean;\n children?: React.ReactNode;\n element?: React.ReactNode | null;\n index?: false;\n path: string;\n}\n\nexport interface LayoutRouteProps {\n children?: React.ReactNode;\n element?: React.ReactNode | null;\n}\n\nexport interface IndexRouteProps {\n element?: React.ReactNode | null;\n index: true;\n}\n\n/**\n * Declares an element that should be rendered at a certain URL path.\n *\n * @see https://reactrouter.com/docs/en/v6/api#route\n */\nexport function Route(\n _props: PathRouteProps | LayoutRouteProps | IndexRouteProps\n): React.ReactElement | null {\n invariant(\n false,\n `A <Route> is only ever to be used as the child of <Routes> element, ` +\n `never rendered directly. Please wrap your <Route> in a <Routes>.`\n );\n}\n\nexport interface RouterProps {\n basename?: string;\n children?: React.ReactNode;\n location: Partial<Location> | string;\n navigationType?: NavigationType;\n navigator: Navigator;\n static?: boolean;\n}\n\n/**\n * Provides location context for the rest of the app.\n *\n * Note: You usually won't render a <Router> directly. Instead, you'll render a\n * router that is more specific to your environment such as a <BrowserRouter>\n * in web browsers or a <StaticRouter> for server rendering.\n *\n * @see https://reactrouter.com/docs/en/v6/api#router\n */\nexport function Router({\n basename: basenameProp = \"/\",\n children = null,\n location: locationProp,\n navigationType = NavigationType.Pop,\n navigator,\n static: staticProp = false,\n}: RouterProps): React.ReactElement | null {\n invariant(\n !useInRouterContext(),\n `You cannot render a <Router> inside another <Router>.` +\n ` You should never have more than one in your app.`\n );\n\n let basename = normalizePathname(basenameProp);\n let navigationContext = React.useMemo(\n () => ({ basename, navigator, static: staticProp }),\n [basename, navigator, staticProp]\n );\n\n if (typeof locationProp === \"string\") {\n locationProp = parsePath(locationProp);\n }\n\n let {\n pathname = \"/\",\n search = \"\",\n hash = \"\",\n state = null,\n key = \"default\",\n } = locationProp;\n\n let location = React.useMemo(() => {\n let trailingPathname = stripBasename(pathname, basename);\n\n if (trailingPathname == null) {\n return null;\n }\n\n return {\n pathname: trailingPathname,\n search,\n hash,\n state,\n key,\n };\n }, [basename, pathname, search, hash, state, key]);\n\n warning(\n location != null,\n `<Router basename=\"${basename}\"> is not able to match the URL ` +\n `\"${pathname}${search}${hash}\" because it does not start with the ` +\n `basename, so the <Router> won't render anything.`\n );\n\n if (location == null) {\n return null;\n }\n\n return (\n <NavigationContext.Provider value={navigationContext}>\n <LocationContext.Provider\n children={children}\n value={{ location, navigationType }}\n />\n </NavigationContext.Provider>\n );\n}\n\nexport interface RoutesProps {\n children?: React.ReactNode;\n location?: Partial<Location> | string;\n}\n\n/**\n * A container for a nested tree of <Route> elements that renders the branch\n * that best matches the current location.\n *\n * @see https://reactrouter.com/docs/en/v6/api#routes\n */\nexport function Routes({\n children,\n location,\n}: RoutesProps): React.ReactElement | null {\n return useRoutes(createRoutesFromChildren(children), location);\n}\n\n///////////////////////////////////////////////////////////////////////////////\n// UTILS\n///////////////////////////////////////////////////////////////////////////////\n\n/**\n * Creates a route config from a React \"children\" object, which is usually\n * either a `<Route>` element or an array of them. Used internally by\n * `<Routes>` to create a route config from its children.\n *\n * @see https://reactrouter.com/docs/en/v6/api#createroutesfromchildren\n */\nexport function createRoutesFromChildren(\n children: React.ReactNode\n): RouteObject[] {\n let routes: RouteObject[] = [];\n\n React.Children.forEach(children, (element) => {\n if (!React.isValidElement(element)) {\n // Ignore non-elements. This allows people to more easily inline\n // conditionals in their route config.\n return;\n }\n\n if (element.type === React.Fragment) {\n // Transparently support React.Fragment and its children.\n routes.push.apply(\n routes,\n createRoutesFromChildren(element.props.children)\n );\n return;\n }\n\n invariant(\n element.type === Route,\n `[${\n typeof element.type === \"string\" ? element.type : element.type.name\n }] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>`\n );\n\n let route: RouteObject = {\n caseSensitive: element.props.caseSensitive,\n element: element.props.element,\n index: element.props.index,\n path: element.props.path,\n };\n\n if (element.props.children) {\n route.children = createRoutesFromChildren(element.props.children);\n }\n\n routes.push(route);\n });\n\n return routes;\n}\n\n/**\n * Renders the result of `matchRoutes()` into a React element.\n */\nexport function renderMatches(\n matches: RouteMatch[] | null\n): React.ReactElement | null {\n return _renderMatches(matches);\n}\n"],"names":["NavigationContext","React","displayName","LocationContext","RouteContext","outlet","matches","invariant","cond","message","Error","warning","console","warn","e","alreadyWarned","warningOnce","key","generatePath","path","params","replace","_","matchRoutes","routes","locationArg","basename","location","parsePath","pathname","stripBasename","branches","flattenRoutes","rankRouteBranches","i","length","matchRouteBranch","parentsMeta","parentPath","forEach","route","index","meta","relativePath","caseSensitive","childrenIndex","startsWith","slice","joinPaths","routesMeta","concat","children","push","score","computeScore","sort","a","b","compareIndexes","map","paramRe","dynamicSegmentValue","indexRouteValue","emptySegmentValue","staticSegmentValue","splatPenalty","isSplat","s","segments","split","initialScore","some","filter","reduce","segment","test","siblings","every","n","branch","matchedParams","matchedPathname","end","remainingPathname","match","matchPath","Object","assign","pathnameBase","normalizePathname","pattern","matcher","paramNames","compilePath","captureGroups","memo","paramName","splatValue","safelyDecodeURIComponent","endsWith","regexpSource","RegExp","undefined","value","decodeURIComponent","error","resolvePath","to","fromPathname","toPathname","search","hash","resolvePathname","normalizeSearch","normalizeHash","relativeSegments","pop","join","resolveTo","toArg","routePathnames","locationPathname","from","routePathnameIndex","toSegments","shift","getToPathname","toLowerCase","nextChar","charAt","paths","useHref","useInRouterContext","navigator","useResolvedPath","joinedPathname","endsWithSlash","createHref","useLocation","useNavigationType","navigationType","useMatch","useNavigate","routePathnamesJson","JSON","stringify","activeRef","current","navigate","options","go","parse","state","OutletContext","useOutletContext","useOutlet","context","React.createElement","useParams","routeMatch","useRoutes","parentMatches","parentParams","parentPathname","parentPathnameBase","parentRoute","locationFromContext","parsedLocationArg","element","_renderMatches","reduceRight","MemoryRouter","initialEntries","initialIndex","historyRef","createMemoryHistory","history","setState","action","listen","Navigate","static","Outlet","props","Route","_props","Router","basenameProp","locationProp","NavigationType","Pop","staticProp","navigationContext","trailingPathname","Routes","createRoutesFromChildren","type","apply","name","renderMatches"],"mappings":";;;;;;;;;;;;;;MAuBaA,iBAAiB,gBAAGC,aAAA,CAC/B,IAD+B;;AAIpB;AACXD,EAAAA,iBAAiB,CAACE,WAAlB,GAAgC,YAAhC;AACD;;MAOYC,eAAe,gBAAGF,aAAA,CAC7B,IAD6B;;AAIlB;AACXE,EAAA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sB;AAC3B,SAAOmK,cAAc,CAACnK,OAAD,CAArB;AACD;;;;"}
1
+ {"version":3,"file":"react-router.development.js","sources":["../../../packages/react-router/lib/use-sync-external-store-shim/useSyncExternalStoreShimClient.ts","../../../packages/react-router/lib/use-sync-external-store-shim/useSyncExternalStoreShimServer.ts","../../../packages/react-router/lib/use-sync-external-store-shim/index.ts","../../../packages/react-router/lib/context.ts","../../../packages/react-router/lib/hooks.tsx","../../../packages/react-router/lib/components.tsx"],"sourcesContent":["/**\n * Copyright (c) Facebook, Inc. and its 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\nimport * as React from \"react\";\n\n/**\n * inlined Object.is polyfill to avoid requiring consumers ship their own\n * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is\n */\nfunction isPolyfill(x: any, y: any) {\n return (\n (x === y && (x !== 0 || 1 / x === 1 / y)) || (x !== x && y !== y) // eslint-disable-line no-self-compare\n );\n}\n\nconst is: (x: any, y: any) => boolean =\n typeof Object.is === \"function\" ? Object.is : isPolyfill;\n\n// Intentionally not using named imports because Rollup uses dynamic\n// dispatch for CommonJS interop named imports.\nconst { useState, useEffect, useLayoutEffect, useDebugValue } = React;\n\nlet didWarnOld18Alpha = false;\nlet didWarnUncachedGetSnapshot = false;\n\n// Disclaimer: This shim breaks many of the rules of React, and only works\n// because of a very particular set of implementation details and assumptions\n// -- change any one of them and it will break. The most important assumption\n// is that updates are always synchronous, because concurrent rendering is\n// only available in versions of React that also have a built-in\n// useSyncExternalStore API. And we only use this shim when the built-in API\n// does not exist.\n//\n// Do not assume that the clever hacks used by this hook also work in general.\n// The point of this shim is to replace the need for hacks by other libraries.\nexport function useSyncExternalStore<T>(\n subscribe: (fn: () => void) => () => void,\n getSnapshot: () => T,\n // Note: The shim does not use getServerSnapshot, because pre-18 versions of\n // React do not expose a way to check if we're hydrating. So users of the shim\n // will need to track that themselves and return the correct value\n // from `getSnapshot`.\n getServerSnapshot?: () => T\n): T {\n if (__DEV__) {\n if (!didWarnOld18Alpha) {\n // @ts-expect-error\n if (React.startTransition !== undefined) {\n didWarnOld18Alpha = true;\n console.error(\n \"You are using an outdated, pre-release alpha of React 18 that \" +\n \"does not support useSyncExternalStore. The \" +\n \"use-sync-external-store shim will not work correctly. Upgrade \" +\n \"to a newer pre-release.\"\n );\n }\n }\n }\n\n // Read the current snapshot from the store on every render. Again, this\n // breaks the rules of React, and only works here because of specific\n // implementation details, most importantly that updates are\n // always synchronous.\n const value = getSnapshot();\n if (__DEV__) {\n if (!didWarnUncachedGetSnapshot) {\n const cachedValue = getSnapshot();\n if (!is(value, cachedValue)) {\n console.error(\n \"The result of getSnapshot should be cached to avoid an infinite loop\"\n );\n didWarnUncachedGetSnapshot = true;\n }\n }\n }\n\n // Because updates are synchronous, we don't queue them. Instead we force a\n // re-render whenever the subscribed state changes by updating an some\n // arbitrary useState hook. Then, during render, we call getSnapshot to read\n // the current value.\n //\n // Because we don't actually use the state returned by the useState hook, we\n // can save a bit of memory by storing other stuff in that slot.\n //\n // To implement the early bailout, we need to track some things on a mutable\n // object. Usually, we would put that in a useRef hook, but we can stash it in\n // our useState hook instead.\n //\n // To force a re-render, we call forceUpdate({inst}). That works because the\n // new object always fails an equality check.\n const [{ inst }, forceUpdate] = useState({ inst: { value, getSnapshot } });\n\n // Track the latest getSnapshot function with a ref. This needs to be updated\n // in the layout phase so we can access it during the tearing check that\n // happens on subscribe.\n useLayoutEffect(() => {\n inst.value = value;\n inst.getSnapshot = getSnapshot;\n\n // Whenever getSnapshot or subscribe changes, we need to check in the\n // commit phase if there was an interleaved mutation. In concurrent mode\n // this can happen all the time, but even in synchronous mode, an earlier\n // effect may have mutated the store.\n if (checkIfSnapshotChanged(inst)) {\n // Force a re-render.\n forceUpdate({ inst });\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [subscribe, value, getSnapshot]);\n\n useEffect(() => {\n // Check for changes right before subscribing. Subsequent changes will be\n // detected in the subscription handler.\n if (checkIfSnapshotChanged(inst)) {\n // Force a re-render.\n forceUpdate({ inst });\n }\n const handleStoreChange = () => {\n // TODO: Because there is no cross-renderer API for batching updates, it's\n // up to the consumer of this library to wrap their subscription event\n // with unstable_batchedUpdates. Should we try to detect when this isn't\n // the case and print a warning in development?\n\n // The store changed. Check if the snapshot changed since the last time we\n // read from the store.\n if (checkIfSnapshotChanged(inst)) {\n // Force a re-render.\n forceUpdate({ inst });\n }\n };\n // Subscribe to the store and return a clean-up function.\n return subscribe(handleStoreChange);\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [subscribe]);\n\n useDebugValue(value);\n return value;\n}\n\nfunction checkIfSnapshotChanged(inst: any) {\n const latestGetSnapshot = inst.getSnapshot;\n const prevValue = inst.value;\n try {\n const nextValue = latestGetSnapshot();\n return !is(prevValue, nextValue);\n } catch (error) {\n return true;\n }\n}\n","/**\n * Copyright (c) Facebook, Inc. and its 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 * @flow\n */\n\nexport function useSyncExternalStore<T>(\n subscribe: (fn: () => void) => () => void,\n getSnapshot: () => T,\n getServerSnapshot?: () => T\n): T {\n // Note: The shim does not use getServerSnapshot, because pre-18 versions of\n // React do not expose a way to check if we're hydrating. So users of the shim\n // will need to track that themselves and return the correct value\n // from `getSnapshot`.\n return getSnapshot();\n}\n","/**\n * Inlined into the react-router repo since use-sync-external-store does not\n * provide a UMD-compatible package, so we need this to be able to distribute\n * UMD react-router bundles\n */\n\n/**\n * Copyright (c) Facebook, Inc. and its 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 * @flow\n */\n\nimport * as React from \"react\";\n\nimport { useSyncExternalStore as client } from \"./useSyncExternalStoreShimClient\";\nimport { useSyncExternalStore as server } from \"./useSyncExternalStoreShimServer\";\n\nconst canUseDOM: boolean = !!(\n typeof window !== \"undefined\" &&\n typeof window.document !== \"undefined\" &&\n typeof window.document.createElement !== \"undefined\"\n);\nconst isServerEnvironment = !canUseDOM;\nconst shim = isServerEnvironment ? server : client;\n\nexport const useSyncExternalStore =\n // @ts-expect-error\n React.useSyncExternalStore !== undefined ? React.useSyncExternalStore : shim;\n","import * as React from \"react\";\nimport type { History, Location, RouteMatch, Router } from \"@remix-run/router\";\nimport { Action as NavigationType } from \"@remix-run/router\";\n\n// Contexts for data routers\nexport const DataRouterContext = React.createContext<Router | null>(null);\nif (__DEV__) {\n DataRouterContext.displayName = \"DataRouter\";\n}\n\nexport const DataRouterStateContext = React.createContext<\n Router[\"state\"] | null\n>(null);\nif (__DEV__) {\n DataRouterStateContext.displayName = \"DataRouterState\";\n}\n\n/**\n * A Navigator is a \"location changer\"; it's how you get to different locations.\n *\n * Every history instance conforms to the Navigator interface, but the\n * distinction is useful primarily when it comes to the low-level <Router> API\n * where both the location and a navigator must be provided separately in order\n * to avoid \"tearing\" that may occur in a suspense-enabled app if the action\n * and/or location were to be read directly from the history instance.\n */\nexport type Navigator = Pick<History, \"go\" | \"push\" | \"replace\" | \"createHref\">;\n\ninterface NavigationContextObject {\n basename: string;\n navigator: Navigator;\n static: boolean;\n}\n\nexport const NavigationContext = React.createContext<NavigationContextObject>(\n null!\n);\n\nif (__DEV__) {\n NavigationContext.displayName = \"Navigation\";\n}\n\ninterface LocationContextObject {\n location: Location;\n navigationType: NavigationType;\n}\n\nexport const LocationContext = React.createContext<LocationContextObject>(\n null!\n);\n\nif (__DEV__) {\n LocationContext.displayName = \"Location\";\n}\n\ninterface RouteContextObject {\n outlet: React.ReactElement | null;\n matches: RouteMatch[];\n}\n\nexport const RouteContext = React.createContext<RouteContextObject>({\n outlet: null,\n matches: [],\n});\n\nif (__DEV__) {\n RouteContext.displayName = \"Route\";\n}\n\ninterface RouteContextObject {\n outlet: React.ReactElement | null;\n matches: RouteMatch[];\n}\n\nexport const RouteErrorContext = React.createContext<any>(null);\n\nif (__DEV__) {\n RouteErrorContext.displayName = \"RouteError\";\n}\n","import * as React from \"react\";\nimport type {\n Location,\n ParamParseKey,\n Params,\n Path,\n PathMatch,\n PathPattern,\n RouteMatch,\n RouteObject,\n Router as DataRouter,\n To,\n} from \"@remix-run/router\";\nimport {\n Action as NavigationType,\n getToPathname,\n invariant,\n joinPaths,\n matchPath,\n matchRoutes,\n parsePath,\n resolveTo,\n warning,\n} from \"@remix-run/router\";\n\nimport {\n DataRouterContext,\n DataRouterStateContext,\n LocationContext,\n NavigationContext,\n RouteContext,\n RouteErrorContext,\n} from \"./context\";\n\n/**\n * Returns the full href for the given \"to\" value. This is useful for building\n * custom links that are also accessible and preserve right-click behavior.\n *\n * @see https://reactrouter.com/docs/en/v6/hooks/use-href\n */\nexport function useHref(to: To): string {\n invariant(\n useInRouterContext(),\n // TODO: This error is probably because they somehow have 2 versions of the\n // router loaded. We can help them understand how to avoid that.\n `useHref() may be used only in the context of a <Router> component.`\n );\n\n let { basename, navigator } = React.useContext(NavigationContext);\n let { hash, pathname, search } = useResolvedPath(to);\n\n let joinedPathname = pathname;\n if (basename !== \"/\") {\n let toPathname = getToPathname(to);\n let endsWithSlash = toPathname != null && toPathname.endsWith(\"/\");\n joinedPathname =\n pathname === \"/\"\n ? basename + (endsWithSlash ? \"/\" : \"\")\n : joinPaths([basename, pathname]);\n }\n\n return navigator.createHref({ pathname: joinedPathname, search, hash });\n}\n\n/**\n * Returns true if this component is a descendant of a <Router>.\n *\n * @see https://reactrouter.com/docs/en/v6/hooks/use-in-router-context\n */\nexport function useInRouterContext(): boolean {\n return React.useContext(LocationContext) != null;\n}\n\n/**\n * Returns the current location object, which represents the current URL in web\n * browsers.\n *\n * Note: If you're using this it may mean you're doing some of your own\n * \"routing\" in your app, and we'd like to know what your use case is. We may\n * be able to provide something higher-level to better suit your needs.\n *\n * @see https://reactrouter.com/docs/en/v6/hooks/use-location\n */\nexport function useLocation(): Location {\n invariant(\n useInRouterContext(),\n // TODO: This error is probably because they somehow have 2 versions of the\n // router loaded. We can help them understand how to avoid that.\n `useLocation() may be used only in the context of a <Router> component.`\n );\n\n return React.useContext(LocationContext).location;\n}\n\n/**\n * Returns the current navigation action which describes how the router came to\n * the current location, either by a pop, push, or replace on the history stack.\n *\n * @see https://reactrouter.com/docs/en/v6/hooks/use-navigation-type\n */\nexport function useNavigationType(): NavigationType {\n return React.useContext(LocationContext).navigationType;\n}\n\n/**\n * Returns true if the URL for the given \"to\" value matches the current URL.\n * This is useful for components that need to know \"active\" state, e.g.\n * <NavLink>.\n *\n * @see https://reactrouter.com/docs/en/v6/hooks/use-match\n */\nexport function useMatch<\n ParamKey extends ParamParseKey<Path>,\n Path extends string\n>(pattern: PathPattern<Path> | Path): PathMatch<ParamKey> | null {\n invariant(\n useInRouterContext(),\n // TODO: This error is probably because they somehow have 2 versions of the\n // router loaded. We can help them understand how to avoid that.\n `useMatch() may be used only in the context of a <Router> component.`\n );\n\n let { pathname } = useLocation();\n return React.useMemo(\n () => matchPath<ParamKey, Path>(pattern, pathname),\n [pathname, pattern]\n );\n}\n\n/**\n * The interface for the navigate() function returned from useNavigate().\n */\nexport interface NavigateFunction {\n (to: To, options?: NavigateOptions): void;\n (delta: number): void;\n}\n\nexport interface NavigateOptions {\n replace?: boolean;\n state?: any;\n}\n\n/**\n * Returns an imperative method for changing the location. Used by <Link>s, but\n * may also be used by other elements to change the location.\n *\n * @see https://reactrouter.com/docs/en/v6/hooks/use-navigate\n */\nexport function useNavigate(): NavigateFunction {\n invariant(\n useInRouterContext(),\n // TODO: This error is probably because they somehow have 2 versions of the\n // router loaded. We can help them understand how to avoid that.\n `useNavigate() may be used only in the context of a <Router> component.`\n );\n\n let { basename, navigator } = React.useContext(NavigationContext);\n let { matches } = React.useContext(RouteContext);\n let { pathname: locationPathname } = useLocation();\n\n let routePathnamesJson = JSON.stringify(\n matches.map((match) => match.pathnameBase)\n );\n\n let activeRef = React.useRef(false);\n React.useEffect(() => {\n activeRef.current = true;\n });\n\n let navigate: NavigateFunction = React.useCallback(\n (to: To | number, options: NavigateOptions = {}) => {\n warning(\n activeRef.current,\n `You should call navigate() in a React.useEffect(), not when ` +\n `your component is first rendered.`\n );\n\n if (!activeRef.current) return;\n\n if (typeof to === \"number\") {\n navigator.go(to);\n return;\n }\n\n let path = resolveTo(\n to,\n JSON.parse(routePathnamesJson),\n locationPathname\n );\n\n if (basename !== \"/\") {\n path.pathname = joinPaths([basename, path.pathname]);\n }\n\n (!!options.replace ? navigator.replace : navigator.push)(\n path,\n options.state\n );\n },\n [basename, navigator, routePathnamesJson, locationPathname]\n );\n\n return navigate;\n}\n\nconst OutletContext = React.createContext<unknown>(null);\n\n/**\n * Returns the context (if provided) for the child route at this level of the route\n * hierarchy.\n * @see https://reactrouter.com/docs/en/v6/hooks/use-outlet-context\n */\nexport function useOutletContext<Context = unknown>(): Context {\n return React.useContext(OutletContext) as Context;\n}\n\n/**\n * Returns the element for the child route at this level of the route\n * hierarchy. Used internally by <Outlet> to render child routes.\n *\n * @see https://reactrouter.com/docs/en/v6/hooks/use-outlet\n */\nexport function useOutlet(context?: unknown): React.ReactElement | null {\n let outlet = React.useContext(RouteContext).outlet;\n if (outlet) {\n return (\n <OutletContext.Provider value={context}>{outlet}</OutletContext.Provider>\n );\n }\n return outlet;\n}\n\n/**\n * Returns an object of key/value pairs of the dynamic params from the current\n * URL that were matched by the route path.\n *\n * @see https://reactrouter.com/docs/en/v6/hooks/use-params\n */\nexport function useParams<\n ParamsOrKey extends string | Record<string, string | undefined> = string\n>(): Readonly<\n [ParamsOrKey] extends [string] ? Params<ParamsOrKey> : Partial<ParamsOrKey>\n> {\n let { matches } = React.useContext(RouteContext);\n let routeMatch = matches[matches.length - 1];\n return routeMatch ? (routeMatch.params as any) : {};\n}\n\n/**\n * Resolves the pathname of the given `to` value against the current location.\n *\n * @see https://reactrouter.com/docs/en/v6/hooks/use-resolved-path\n */\nexport function useResolvedPath(to: To): Path {\n let { matches } = React.useContext(RouteContext);\n let { pathname: locationPathname } = useLocation();\n\n let routePathnamesJson = JSON.stringify(\n matches.map((match) => match.pathnameBase)\n );\n\n return React.useMemo(\n () => resolveTo(to, JSON.parse(routePathnamesJson), locationPathname),\n [to, routePathnamesJson, locationPathname]\n );\n}\n\n/**\n * Returns the element of the route that matched the current location, prepared\n * with the correct context to render the remainder of the route tree. Route\n * elements in the tree must render an <Outlet> to render their child route's\n * element.\n *\n * @see https://reactrouter.com/docs/en/v6/hooks/use-routes\n */\nexport function useRoutes(\n routes: RouteObject[],\n locationArg?: Partial<Location> | string\n): React.ReactElement | null {\n invariant(\n useInRouterContext(),\n // TODO: This error is probably because they somehow have 2 versions of the\n // router loaded. We can help them understand how to avoid that.\n `useRoutes() may be used only in the context of a <Router> component.`\n );\n\n let dataRouterStateContext = React.useContext(DataRouterStateContext);\n let { matches: parentMatches } = React.useContext(RouteContext);\n let routeMatch = parentMatches[parentMatches.length - 1];\n let parentParams = routeMatch ? routeMatch.params : {};\n let parentPathname = routeMatch ? routeMatch.pathname : \"/\";\n let parentPathnameBase = routeMatch ? routeMatch.pathnameBase : \"/\";\n let parentRoute = routeMatch && routeMatch.route;\n\n if (__DEV__) {\n // You won't get a warning about 2 different <Routes> under a <Route>\n // without a trailing *, but this is a best-effort warning anyway since we\n // cannot even give the warning unless they land at the parent route.\n //\n // Example:\n //\n // <Routes>\n // {/* This route path MUST end with /* because otherwise\n // it will never match /blog/post/123 */}\n // <Route path=\"blog\" element={<Blog />} />\n // <Route path=\"blog/feed\" element={<BlogFeed />} />\n // </Routes>\n //\n // function Blog() {\n // return (\n // <Routes>\n // <Route path=\"post/:id\" element={<Post />} />\n // </Routes>\n // );\n // }\n let parentPath = (parentRoute && parentRoute.path) || \"\";\n warningOnce(\n parentPathname,\n !parentRoute || parentPath.endsWith(\"*\"),\n `You rendered descendant <Routes> (or called \\`useRoutes()\\`) at ` +\n `\"${parentPathname}\" (under <Route path=\"${parentPath}\">) but the ` +\n `parent route path has no trailing \"*\". This means if you navigate ` +\n `deeper, the parent won't match anymore and therefore the child ` +\n `routes will never render.\\n\\n` +\n `Please change the parent <Route path=\"${parentPath}\"> to <Route ` +\n `path=\"${parentPath === \"/\" ? \"*\" : `${parentPath}/*`}\">.`\n );\n }\n\n let locationFromContext = useLocation();\n\n let location;\n if (locationArg) {\n let parsedLocationArg =\n typeof locationArg === \"string\" ? parsePath(locationArg) : locationArg;\n\n invariant(\n parentPathnameBase === \"/\" ||\n parsedLocationArg.pathname?.startsWith(parentPathnameBase),\n `When overriding the location using \\`<Routes location>\\` or \\`useRoutes(routes, location)\\`, ` +\n `the location pathname must begin with the portion of the URL pathname that was ` +\n `matched by all parent routes. The current pathname base is \"${parentPathnameBase}\" ` +\n `but pathname \"${parsedLocationArg.pathname}\" was given in the \\`location\\` prop.`\n );\n\n location = parsedLocationArg;\n } else {\n location = locationFromContext;\n }\n\n let pathname = location.pathname || \"/\";\n let remainingPathname =\n parentPathnameBase === \"/\"\n ? pathname\n : pathname.slice(parentPathnameBase.length) || \"/\";\n let matches = matchRoutes(routes, { pathname: remainingPathname });\n\n if (__DEV__) {\n warning(\n parentRoute || matches != null,\n `No routes matched location \"${location.pathname}${location.search}${location.hash}\" `\n );\n\n warning(\n matches == null ||\n matches[matches.length - 1].route.element !== undefined,\n `Matched leaf route at location \"${location.pathname}${location.search}${location.hash}\" does not have an element. ` +\n `This means it will render an <Outlet /> with a null value by default resulting in an \"empty\" page.`\n );\n }\n\n return _renderMatches(\n matches &&\n matches.map((match) =>\n Object.assign({}, match, {\n params: Object.assign({}, parentParams, match.params),\n pathname: joinPaths([parentPathnameBase, match.pathname]),\n pathnameBase:\n match.pathnameBase === \"/\"\n ? parentPathnameBase\n : joinPaths([parentPathnameBase, match.pathnameBase]),\n })\n ),\n parentMatches,\n dataRouterStateContext\n );\n}\n\nfunction DefaultErrorElement() {\n let error = useRouteError();\n let lightgrey = \"rgba(200,200,200, 0.5)\";\n let preStyles = { padding: \"0.5rem\", backgroundColor: lightgrey };\n let codeStyles = { padding: \"2px 4px\", backgroundColor: lightgrey };\n return (\n <>\n <h2>Unhandled Thrown Error!</h2>\n <p style={{ fontStyle: \"italic\" }}>{error?.message || error}</p>\n {error?.stack ? <pre style={preStyles}>{error?.stack}</pre> : null}\n <p>💿 Hey developer 👋</p>\n <p>\n You can provide a way better UX than this when your app throws errors by\n providing your own&nbsp;\n <code style={codeStyles}>errorElement</code> props on&nbsp;\n <code style={codeStyles}>&lt;Route&gt;</code>\n </p>\n </>\n );\n}\n\ntype RenderErrorBoundaryProps = React.PropsWithChildren<{\n location: Location;\n error: any;\n component: React.ReactNode;\n}>;\n\ntype RenderErrorBoundaryState = {\n location: Location;\n error: any;\n};\n\nexport class RenderErrorBoundary extends React.Component<\n RenderErrorBoundaryProps,\n RenderErrorBoundaryState\n> {\n constructor(props: RenderErrorBoundaryProps) {\n super(props);\n this.state = {\n location: props.location,\n error: props.error,\n };\n }\n\n static getDerivedStateFromError(error: any) {\n return { error: error };\n }\n\n static getDerivedStateFromProps(\n props: RenderErrorBoundaryProps,\n state: RenderErrorBoundaryState\n ) {\n // When we get into an error state, the user will likely click \"back\" to the\n // previous page that didn't have an error. Because this wraps the entire\n // application, that will have no effect--the error page continues to display.\n // This gives us a mechanism to recover from the error when the location changes.\n //\n // Whether we're in an error state or not, we update the location in state\n // so that when we are in an error state, it gets reset when a new location\n // comes in and the user recovers from the error.\n if (state.location !== props.location) {\n return {\n error: props.error,\n location: props.location,\n };\n }\n\n // If we're not changing locations, preserve the location but still surface\n // any new errors that may come through. We retain the existing error, we do\n // this because the error provided from the app state may be cleared without\n // the location changing.\n return {\n error: props.error || state.error,\n location: state.location,\n };\n }\n\n componentDidCatch(error: any, errorInfo: any) {\n console.error(\n \"React Router caught the following error during render\",\n error,\n errorInfo\n );\n }\n\n render() {\n return this.state.error ? (\n <RouteErrorContext.Provider\n value={this.state.error}\n children={this.props.component}\n />\n ) : (\n this.props.children\n );\n }\n}\n\nexport function _renderMatches(\n matches: RouteMatch[] | null,\n parentMatches: RouteMatch[] = [],\n dataRouterState?: DataRouter[\"state\"] | null\n): React.ReactElement | null {\n if (matches == null) return null;\n\n let renderedMatches = matches;\n\n // If we have data errors, trim matches to the highest error boundary\n let errors = dataRouterState?.errors;\n if (errors != null) {\n let errorIndex = renderedMatches.findIndex(\n (m) => m.route.id && errors?.[m.route.id]\n );\n invariant(\n errorIndex >= 0,\n `Could not find a matching route for the current errors: ${errors}`\n );\n renderedMatches = renderedMatches.slice(\n 0,\n Math.min(renderedMatches.length, errorIndex + 1)\n );\n }\n\n return renderedMatches.reduceRight((outlet, match, index) => {\n let error = match.route.id ? errors?.[match.route.id] : null;\n // Only data routers handle errors\n let errorElement = dataRouterState\n ? match.route.errorElement || <DefaultErrorElement />\n : null;\n let getChildren = () => (\n <RouteContext.Provider\n children={\n error\n ? errorElement\n : match.route.element !== undefined\n ? match.route.element\n : outlet\n }\n value={{\n outlet,\n matches: parentMatches.concat(renderedMatches.slice(0, index + 1)),\n }}\n />\n );\n\n // Only wrap in an error boundary within data router usages when we have an\n // errorElement on this route. Otherwise let it bubble up to an ancestor\n // errorElement\n return dataRouterState && (match.route.errorElement || index === 0) ? (\n <RenderErrorBoundary\n location={dataRouterState.location}\n component={errorElement}\n error={error}\n children={getChildren()}\n />\n ) : (\n getChildren()\n );\n }, null as React.ReactElement | null);\n}\n\nenum DataRouterHook {\n UseLoaderData = \"useLoaderData\",\n UseActionData = \"useActionData\",\n UseRouteError = \"useRouteError\",\n UseNavigation = \"useNavigation\",\n UseRouteLoaderData = \"useRouteLoaderData\",\n UseMatches = \"useMatches\",\n UseRevalidator = \"useRevalidator\",\n}\n\nfunction useDataRouterState(hookName: DataRouterHook) {\n let state = React.useContext(DataRouterStateContext);\n invariant(state, `${hookName} must be used within a DataRouter`);\n return state;\n}\n\n/**\n * Returns the current navigation, defaulting to an \"idle\" navigation when\n * no navigation is in progress\n */\nexport function useNavigation() {\n let state = useDataRouterState(DataRouterHook.UseNavigation);\n return state.navigation;\n}\n\n/**\n * Returns a revalidate function for manually triggering revalidation, as well\n * as the current state of any manual revalidations\n */\nexport function useRevalidator() {\n let router = React.useContext(DataRouterContext);\n invariant(router, `useRevalidator must be used within a DataRouter`);\n let state = useDataRouterState(DataRouterHook.UseRevalidator);\n return { revalidate: router.revalidate, state: state.revalidation };\n}\n\n/**\n * Returns the active route matches, useful for accessing loaderData for\n * parent/child routes or the route \"handle\" property\n */\nexport function useMatches() {\n let { matches, loaderData } = useDataRouterState(DataRouterHook.UseMatches);\n return React.useMemo(\n () =>\n matches.map((match) => {\n let { pathname, params } = match;\n return {\n id: match.route.id,\n pathname,\n params,\n data: loaderData[match.route.id],\n handle: match.route.handle,\n };\n }),\n [matches, loaderData]\n );\n}\n\n/**\n * Returns the loader data for the nearest ancestor Route loader\n */\nexport function useLoaderData() {\n let state = useDataRouterState(DataRouterHook.UseLoaderData);\n\n let route = React.useContext(RouteContext);\n invariant(route, `useLoaderData must be used inside a RouteContext`);\n\n let thisRoute = route.matches[route.matches.length - 1];\n invariant(\n thisRoute.route.id,\n `${useLoaderData} can only be used on routes that contain a unique \"id\"`\n );\n\n return state.loaderData?.[thisRoute.route.id];\n}\n\n/**\n * Returns the loaderData for the given routeId\n */\nexport function useRouteLoaderData(routeId: string): any {\n let state = useDataRouterState(DataRouterHook.UseRouteLoaderData);\n return state.loaderData?.[routeId];\n}\n\n/**\n * Returns the action data for the nearest ancestor Route action\n */\nexport function useActionData() {\n let state = useDataRouterState(DataRouterHook.UseRouteError);\n\n let route = React.useContext(RouteContext);\n invariant(route, `useRouteError must be used inside a RouteContext`);\n\n return Object.values(state?.actionData || {})[0];\n}\n\n/**\n * Returns the nearest ancestor Route error, which could be a loader/action\n * error or a render error. This is intended to be called from your\n * errorElement to display a proper error message.\n */\nexport function useRouteError() {\n let error = React.useContext(RouteErrorContext);\n let state = useDataRouterState(DataRouterHook.UseRouteError);\n let route = React.useContext(RouteContext);\n let thisRoute = route.matches[route.matches.length - 1];\n\n // If this was a render error, we put it in a RouteError context inside\n // of RenderErrorBoundary\n if (error) {\n return error;\n }\n\n invariant(route, `useRouteError must be used inside a RouteContext`);\n invariant(\n thisRoute.route.id,\n `useRouteError can only be used on routes that contain a unique \"id\"`\n );\n\n // Otherwise look for errors from our data router state\n return state.errors?.[thisRoute.route.id];\n}\n\nconst alreadyWarned: Record<string, boolean> = {};\n\nfunction warningOnce(key: string, cond: boolean, message: string) {\n if (!cond && !alreadyWarned[key]) {\n alreadyWarned[key] = true;\n warning(false, message);\n }\n}\n","import * as React from \"react\";\nimport type {\n HydrationState,\n InitialEntry,\n Location,\n MemoryHistory,\n RouteMatch,\n RouteObject,\n Router as DataRouter,\n RouterState,\n To,\n} from \"@remix-run/router\";\nimport {\n Action as NavigationType,\n createMemoryHistory,\n createMemoryRouter,\n invariant,\n normalizePathname,\n parsePath,\n stripBasename,\n warning,\n} from \"@remix-run/router\";\nimport { useSyncExternalStore as useSyncExternalStoreShim } from \"./use-sync-external-store-shim\";\n\nimport {\n LocationContext,\n NavigationContext,\n Navigator,\n DataRouterContext,\n DataRouterStateContext,\n} from \"./context\";\nimport {\n useInRouterContext,\n useNavigate,\n useOutlet,\n useRoutes,\n _renderMatches,\n} from \"./hooks\";\n\n// Module-scoped singleton to hold the router. Extracted from the React lifecycle\n// to avoid issues w.r.t. dual initialization fetches in concurrent rendering.\n// Data router apps are expected to have a static route tree and are not intended\n// to be unmounted/remounted at runtime.\nlet routerSingleton: DataRouter;\n\n/**\n * Unit-testing-only function to reset the router between tests\n * @private\n */\nexport function _resetModuleScope() {\n // @ts-expect-error\n routerSingleton = null;\n}\n\n/**\n * @private\n */\nexport function useRenderDataRouter({\n children,\n fallbackElement,\n routes,\n createRouter,\n}: {\n children?: React.ReactNode;\n fallbackElement: React.ReactElement;\n routes?: RouteObject[];\n createRouter: (routes: RouteObject[]) => DataRouter;\n}): React.ReactElement {\n if (!routerSingleton) {\n routerSingleton = createRouter(\n routes || createRoutesFromChildren(children)\n ).initialize();\n }\n let router = routerSingleton;\n\n // Sync router state to our component state to force re-renders\n let state: RouterState = useSyncExternalStoreShim(\n router.subscribe,\n () => router.state\n );\n\n let navigator = React.useMemo((): Navigator => {\n return {\n createHref: router.createHref,\n go: (n) => router.navigate(n),\n push: (to, state) => router.navigate(to, { state }),\n replace: (to, state) => router.navigate(to, { replace: true, state }),\n };\n }, [router]);\n\n if (!state.initialized) {\n return fallbackElement || null;\n }\n\n return (\n <DataRouterContext.Provider value={router}>\n <DataRouterStateContext.Provider value={state}>\n <Router\n location={state.location}\n navigationType={state.historyAction}\n navigator={navigator}\n >\n <DataRoutes routes={routes} children={children} />\n </Router>\n </DataRouterStateContext.Provider>\n </DataRouterContext.Provider>\n );\n}\n\nexport interface DataMemoryRouterProps {\n children?: React.ReactNode;\n initialEntries?: InitialEntry[];\n initialIndex?: number;\n hydrationData?: HydrationState;\n fallbackElement: React.ReactElement;\n routes?: RouteObject[];\n}\n\nexport function DataMemoryRouter({\n children,\n initialEntries,\n initialIndex,\n hydrationData,\n fallbackElement,\n routes,\n}: DataMemoryRouterProps): React.ReactElement {\n return useRenderDataRouter({\n children,\n fallbackElement,\n routes,\n createRouter: (routes) =>\n createMemoryRouter({\n initialEntries,\n initialIndex,\n routes,\n hydrationData,\n }),\n });\n}\n\nexport interface MemoryRouterProps {\n basename?: string;\n children?: React.ReactNode;\n initialEntries?: InitialEntry[];\n initialIndex?: number;\n}\n\n/**\n * A <Router> that stores all entries in memory.\n *\n * @see https://reactrouter.com/docs/en/v6/routers/memory-router\n */\nexport function MemoryRouter({\n basename,\n children,\n initialEntries,\n initialIndex,\n}: MemoryRouterProps): React.ReactElement {\n let historyRef = React.useRef<MemoryHistory>();\n if (historyRef.current == null) {\n historyRef.current = createMemoryHistory({\n initialEntries,\n initialIndex,\n v5Compat: true,\n });\n }\n\n let history = historyRef.current;\n let [state, setState] = React.useState({\n action: history.action,\n location: history.location,\n });\n\n React.useLayoutEffect(() => history.listen(setState), [history]);\n\n return (\n <Router\n basename={basename}\n children={children}\n location={state.location}\n navigationType={state.action}\n navigator={history}\n />\n );\n}\n\nexport interface NavigateProps {\n to: To;\n replace?: boolean;\n state?: any;\n}\n\n/**\n * Changes the current location.\n *\n * Note: This API is mostly useful in React.Component subclasses that are not\n * able to use hooks. In functional components, we recommend you use the\n * `useNavigate` hook instead.\n *\n * @see https://reactrouter.com/docs/en/v6/components/navigate\n */\nexport function Navigate({ to, replace, state }: NavigateProps): null {\n invariant(\n useInRouterContext(),\n // TODO: This error is probably because they somehow have 2 versions of\n // the router loaded. We can help them understand how to avoid that.\n `<Navigate> may be used only in the context of a <Router> component.`\n );\n\n warning(\n !React.useContext(NavigationContext).static,\n `<Navigate> must not be used on the initial render in a <StaticRouter>. ` +\n `This is a no-op, but you should modify your code so the <Navigate> is ` +\n `only ever rendered in response to some user interaction or state change.`\n );\n\n let navigate = useNavigate();\n React.useEffect(() => {\n navigate(to, { replace, state });\n });\n\n return null;\n}\n\nexport interface OutletProps {\n context?: unknown;\n}\n\n/**\n * Renders the child route's element, if there is one.\n *\n * @see https://reactrouter.com/docs/en/v6/components/outlet\n */\nexport function Outlet(props: OutletProps): React.ReactElement | null {\n return useOutlet(props.context);\n}\n\ninterface DataRouteProps {\n id?: RouteObject[\"id\"];\n loader?: RouteObject[\"loader\"];\n action?: RouteObject[\"action\"];\n errorElement?: RouteObject[\"errorElement\"];\n shouldRevalidate?: RouteObject[\"shouldRevalidate\"];\n handle?: RouteObject[\"handle\"];\n}\n\nexport interface RouteProps extends DataRouteProps {\n caseSensitive?: boolean;\n children?: React.ReactNode;\n element?: React.ReactNode | null;\n index?: boolean;\n path?: string;\n}\n\nexport interface PathRouteProps extends DataRouteProps {\n caseSensitive?: boolean;\n children?: React.ReactNode;\n element?: React.ReactNode | null;\n index?: false;\n path: string;\n}\n\nexport interface LayoutRouteProps extends DataRouteProps {\n children?: React.ReactNode;\n element?: React.ReactNode | null;\n}\n\nexport interface IndexRouteProps extends DataRouteProps {\n element?: React.ReactNode | null;\n index: true;\n}\n\n/**\n * Declares an element that should be rendered at a certain URL path.\n *\n * @see https://reactrouter.com/docs/en/v6/components/route\n */\nexport function Route(\n _props: PathRouteProps | LayoutRouteProps | IndexRouteProps\n): React.ReactElement | null {\n invariant(\n false,\n `A <Route> is only ever to be used as the child of <Routes> element, ` +\n `never rendered directly. Please wrap your <Route> in a <Routes>.`\n );\n}\n\nexport interface RouterProps {\n basename?: string;\n children?: React.ReactNode;\n location: Partial<Location> | string;\n navigationType?: NavigationType;\n navigator: Navigator;\n static?: boolean;\n}\n\n/**\n * Provides location context for the rest of the app.\n *\n * Note: You usually won't render a <Router> directly. Instead, you'll render a\n * router that is more specific to your environment such as a <BrowserRouter>\n * in web browsers or a <StaticRouter> for server rendering.\n *\n * @see https://reactrouter.com/docs/en/v6/routers/router\n */\nexport function Router({\n basename: basenameProp = \"/\",\n children = null,\n location: locationProp,\n navigationType = NavigationType.Pop,\n navigator,\n static: staticProp = false,\n}: RouterProps): React.ReactElement | null {\n invariant(\n !useInRouterContext(),\n `You cannot render a <Router> inside another <Router>.` +\n ` You should never have more than one in your app.`\n );\n\n let basename = normalizePathname(basenameProp);\n let navigationContext = React.useMemo(\n () => ({ basename, navigator, static: staticProp }),\n [basename, navigator, staticProp]\n );\n\n if (typeof locationProp === \"string\") {\n locationProp = parsePath(locationProp);\n }\n\n let {\n pathname = \"/\",\n search = \"\",\n hash = \"\",\n state = null,\n key = \"default\",\n } = locationProp;\n\n let location = React.useMemo(() => {\n let trailingPathname = stripBasename(pathname, basename);\n\n if (trailingPathname == null) {\n return null;\n }\n\n return {\n pathname: trailingPathname,\n search,\n hash,\n state,\n key,\n };\n }, [basename, pathname, search, hash, state, key]);\n\n warning(\n location != null,\n `<Router basename=\"${basename}\"> is not able to match the URL ` +\n `\"${pathname}${search}${hash}\" because it does not start with the ` +\n `basename, so the <Router> won't render anything.`\n );\n\n if (location == null) {\n return null;\n }\n\n return (\n <NavigationContext.Provider value={navigationContext}>\n <LocationContext.Provider\n children={children}\n value={{ location, navigationType }}\n />\n </NavigationContext.Provider>\n );\n}\n\nexport interface RoutesProps {\n children?: React.ReactNode;\n location?: Partial<Location> | string;\n}\n\n/**\n * A container for a nested tree of <Route> elements that renders the branch\n * that best matches the current location.\n *\n * @see https://reactrouter.com/docs/en/v6/components/routes\n */\nexport function Routes({\n children,\n location,\n}: RoutesProps): React.ReactElement | null {\n return useRoutes(createRoutesFromChildren(children), location);\n}\n\ninterface DataRoutesProps extends RoutesProps {\n routes?: RouteObject[];\n}\n\n/**\n * @private\n * Used as an extension to <Routes> and accepts a manual `routes` array to be\n * instead of using JSX children. Extracted to it's own component to avoid\n * conditional usage of `useRoutes` if we have to render a `fallbackElement`\n */\nfunction DataRoutes({\n children,\n location,\n routes,\n}: DataRoutesProps): React.ReactElement | null {\n return useRoutes(routes || createRoutesFromChildren(children), location);\n}\n\n///////////////////////////////////////////////////////////////////////////////\n// UTILS\n///////////////////////////////////////////////////////////////////////////////\n\n/**\n * Creates a route config from a React \"children\" object, which is usually\n * either a `<Route>` element or an array of them. Used internally by\n * `<Routes>` to create a route config from its children.\n *\n * @see https://reactrouter.com/docs/en/v6/utils/create-routes-from-children\n */\nexport function createRoutesFromChildren(\n children: React.ReactNode,\n parentPath: number[] = []\n): RouteObject[] {\n let routes: RouteObject[] = [];\n\n React.Children.forEach(children, (element, index) => {\n if (!React.isValidElement(element)) {\n // Ignore non-elements. This allows people to more easily inline\n // conditionals in their route config.\n return;\n }\n\n if (element.type === React.Fragment) {\n // Transparently support React.Fragment and its children.\n routes.push.apply(\n routes,\n createRoutesFromChildren(element.props.children, parentPath)\n );\n return;\n }\n\n invariant(\n element.type === Route,\n `[${\n typeof element.type === \"string\" ? element.type : element.type.name\n }] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>`\n );\n\n let treePath = [...parentPath, index];\n let route: RouteObject = {\n id: element.props.id || treePath.join(\"-\"),\n caseSensitive: element.props.caseSensitive,\n element: element.props.element,\n index: element.props.index,\n path: element.props.path,\n loader: element.props.loader,\n action: element.props.action,\n errorElement: element.props.errorElement,\n shouldRevalidate: element.props.shouldRevalidate,\n handle: element.props.handle,\n };\n\n if (element.props.children) {\n route.children = createRoutesFromChildren(\n element.props.children,\n treePath\n );\n }\n\n routes.push(route);\n });\n\n return routes;\n}\n\n/**\n * Renders the result of `matchRoutes()` into a React element.\n */\nexport function renderMatches(\n matches: RouteMatch[] | null,\n dataRouterState: DataRouter[\"state\"] | null\n): React.ReactElement | null {\n return _renderMatches(matches, undefined, dataRouterState);\n}\n"],"names":["isPolyfill","x","y","is","Object","useState","useEffect","useLayoutEffect","useDebugValue","React","didWarnOld18Alpha","didWarnUncachedGetSnapshot","useSyncExternalStore","subscribe","getSnapshot","getServerSnapshot","undefined","console","error","value","cachedValue","inst","forceUpdate","checkIfSnapshotChanged","handleStoreChange","latestGetSnapshot","prevValue","nextValue","canUseDOM","window","document","createElement","isServerEnvironment","shim","server","client","DataRouterContext","displayName","DataRouterStateContext","NavigationContext","LocationContext","RouteContext","outlet","matches","RouteErrorContext","useHref","to","useInRouterContext","invariant","basename","navigator","hash","pathname","search","useResolvedPath","joinedPathname","toPathname","getToPathname","endsWithSlash","endsWith","joinPaths","createHref","useLocation","location","useNavigationType","navigationType","useMatch","pattern","matchPath","useNavigate","locationPathname","routePathnamesJson","JSON","stringify","map","match","pathnameBase","activeRef","current","navigate","options","warning","go","path","resolveTo","parse","replace","push","state","OutletContext","useOutletContext","useOutlet","context","React.createElement","useParams","routeMatch","length","params","useRoutes","routes","locationArg","dataRouterStateContext","parentMatches","parentParams","parentPathname","parentPathnameBase","parentRoute","route","parentPath","warningOnce","locationFromContext","parsedLocationArg","parsePath","startsWith","remainingPathname","slice","matchRoutes","element","_renderMatches","assign","DefaultErrorElement","useRouteError","lightgrey","preStyles","padding","backgroundColor","codeStyles","fontStyle","message","stack","RenderErrorBoundary","constructor","props","getDerivedStateFromError","getDerivedStateFromProps","componentDidCatch","errorInfo","render","component","children","dataRouterState","renderedMatches","errors","errorIndex","findIndex","m","id","Math","min","reduceRight","index","errorElement","getChildren","concat","DataRouterHook","useDataRouterState","hookName","useNavigation","UseNavigation","navigation","useRevalidator","router","UseRevalidator","revalidate","revalidation","useMatches","loaderData","UseMatches","data","handle","useLoaderData","UseLoaderData","thisRoute","useRouteLoaderData","routeId","UseRouteLoaderData","useActionData","UseRouteError","values","actionData","alreadyWarned","key","cond","routerSingleton","useRenderDataRouter","fallbackElement","createRouter","createRoutesFromChildren","initialize","useSyncExternalStoreShim","n","initialized","historyAction","DataMemoryRouter","initialEntries","initialIndex","hydrationData","createMemoryRouter","MemoryRouter","historyRef","createMemoryHistory","v5Compat","history","setState","action","listen","Navigate","static","Outlet","Route","_props","Router","basenameProp","locationProp","NavigationType","Pop","staticProp","normalizePathname","navigationContext","trailingPathname","stripBasename","Routes","DataRoutes","forEach","type","apply","name","treePath","join","caseSensitive","loader","shouldRevalidate","renderMatches"],"mappings":";;;;;;;;;;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AAIA;AACA;AACA;AACA;;AACA,SAASA,UAAT,CAAoBC,CAApB,EAA4BC,CAA5B,EAAoC;AAClC,SACGD,CAAC,KAAKC,CAAN,KAAYD,CAAC,KAAK,CAAN,IAAW,IAAIA,CAAJ,KAAU,IAAIC,CAArC,CAAD,IAA8CD,CAAC,KAAKA,CAAN,IAAWC,CAAC,KAAKA,CADjE;AAAA;AAGD;;AAED,MAAMC,EAA+B,GACnC,OAAOC,MAAM,CAACD,EAAd,KAAqB,UAArB,GAAkCC,MAAM,CAACD,EAAzC,GAA8CH,UADhD;AAIA;;AACA,MAAM;AAAEK,EAAAA,QAAF;AAAYC,EAAAA,SAAZ;AAAuBC,EAAAA,eAAvB;AAAwCC,EAAAA;AAAxC,IAA0DC,KAAhE;AAEA,IAAIC,iBAAiB,GAAG,KAAxB;AACA,IAAIC,0BAA0B,GAAG,KAAjC;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACO,SAASC,oBAAT,CACLC,SADK,EAELC,WAFK;AAIL;AACA;AACA;AACAC,iBAPK,EAQF;A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QADyB,EAEvCwF,QAFuC,CAAzC;AAID;;AAEDhI,IAAAA,MAAM,CAACZ,IAAP,CAAYoB,KAAZ;AACD,GA7CD;AA+CA,SAAOR,MAAP;AACD;AAED;AACA;AACA;;AACA,AAAO,SAASqI,aAAT,CACL7L,OADK,EAELiG,eAFK,EAGsB;AAC3B,SAAOtB,cAAc,CAAC3E,OAAD,EAAU3B,SAAV,EAAqB4H,eAArB,CAArB;AACD;;;;"}
@@ -1,5 +1,5 @@
1
1
  /**
2
- * React Router v6.3.0
2
+ * React Router v6.4.0-pre.0
3
3
  *
4
4
  * Copyright (c) Remix Software Inc.
5
5
  *
@@ -8,5 +8,5 @@
8
8
  *
9
9
  * @license MIT
10
10
  */
11
- import{parsePath as e,createMemoryHistory as t,Action as n}from"history";export{Action as NavigationType,createPath,parsePath}from"history";import{createContext as a,useContext as r,useMemo as l,useRef as i,useEffect as s,useCallback as o,createElement as h,useState as c,useLayoutEffect as u,Children as p,isValidElement as m,Fragment as f}from"react";const g=a(null),d=a(null),v=a({outlet:null,matches:[]});function y(e,t){if(!e)throw new Error(t)}function x(e,t={}){return e.replace(/:(\w+)/g,((e,n)=>(null==t[n]&&y(!1),t[n]))).replace(/\/*\*$/,(e=>null==t["*"]?"":t["*"].replace(/^\/*/,"/")))}function S(t,n,a="/"){let r=O(("string"==typeof n?e(n):n).pathname||"/",a);if(null==r)return null;let l=$(t);!function(e){e.sort(((e,t)=>e.score!==t.score?t.score-e.score:function(e,t){return e.length===t.length&&e.slice(0,-1).every(((e,n)=>e===t[n]))?e[e.length-1]-t[t.length-1]:0}(e.routesMeta.map((e=>e.childrenIndex)),t.routesMeta.map((e=>e.childrenIndex)))))}(l);let i=null;for(let e=0;null==i&&e<l.length;++e)i=B(l[e],r);return i}function $(e,t=[],n=[],a=""){return e.forEach(((e,r)=>{let l={relativePath:e.path||"",caseSensitive:!0===e.caseSensitive,childrenIndex:r,route:e};l.relativePath.startsWith("/")&&(l.relativePath.startsWith(a)||y(!1),l.relativePath=l.relativePath.slice(a.length));let i=j([a,l.relativePath]),s=n.concat(l);e.children&&e.children.length>0&&(!0===e.index&&y(!1),$(e.children,t,s,i)),(null!=e.path||e.index)&&t.push({path:i,score:b(i,e.index),routesMeta:s})})),t}const P=/^:\w+$/,W=e=>"*"===e;function b(e,t){let n=e.split("/"),a=n.length;return n.some(W)&&(a+=-2),t&&(a+=2),n.filter((e=>!W(e))).reduce(((e,t)=>e+(P.test(t)?3:""===t?1:10)),a)}function B(e,t){let{routesMeta:n}=e,a={},r="/",l=[];for(let i=0;i<n.length;++i){let e=n[i],s=i===n.length-1,o="/"===r?t:t.slice(r.length)||"/",h=E({path:e.relativePath,caseSensitive:e.caseSensitive,end:s},o);if(!h)return null;Object.assign(a,h.params);let c=e.route;l.push({params:a,pathname:j([r,h.pathname]),pathnameBase:A(j([r,h.pathnameBase])),route:c}),"/"!==h.pathnameBase&&(r=j([r,h.pathnameBase]))}return l}function E(e,t){"string"==typeof e&&(e={path:e,caseSensitive:!1,end:!0});let[n,a]=function(e,t=!1,n=!0){let a=[],r="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^$?{}|()[\]]/g,"\\$&").replace(/:(\w+)/g,((e,t)=>(a.push(t),"([^\\/]+)")));e.endsWith("*")?(a.push("*"),r+="*"===e||"/*"===e?"(.*)$":"(?:\\/(.+)|\\/*)$"):r+=n?"\\/*$":"(?:(?=[.~-]|%[0-9A-F]{2})|\\b|\\/|$)";return[new RegExp(r,t?void 0:"i"),a]}(e.path,e.caseSensitive,e.end),r=t.match(n);if(!r)return null;let l=r[0],i=l.replace(/(.)\/+$/,"$1"),s=r.slice(1);return{params:a.reduce(((e,t,n)=>{if("*"===t){let e=s[n]||"";i=l.slice(0,l.length-e.length).replace(/(.)\/+$/,"$1")}return e[t]=function(e,t){try{return decodeURIComponent(e)}catch(n){return e}}(s[n]||""),e}),{}),pathname:l,pathnameBase:i,pattern:e}}function N(t,n="/"){let{pathname:a,search:r="",hash:l=""}="string"==typeof t?e(t):t,i=a?a.startsWith("/")?a:function(e,t){let n=t.replace(/\/+$/,"").split("/");return e.split("/").forEach((e=>{".."===e?n.length>1&&n.pop():"."!==e&&n.push(e)})),n.length>1?n.join("/"):"/"}(a,n):n;return{pathname:i,search:C(r),hash:I(l)}}function w(t,n,a){let r,l="string"==typeof t?e(t):t,i=""===t||""===l.pathname?"/":l.pathname;if(null==i)r=a;else{let e=n.length-1;if(i.startsWith("..")){let t=i.split("/");for(;".."===t[0];)t.shift(),e-=1;l.pathname=t.join("/")}r=e>=0?n[e]:"/"}let s=N(l,r);return i&&"/"!==i&&i.endsWith("/")&&!s.pathname.endsWith("/")&&(s.pathname+="/"),s}function O(e,t){if("/"===t)return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let n=e.charAt(t.length);return n&&"/"!==n?null:e.slice(t.length)||"/"}const j=e=>e.join("/").replace(/\/\/+/g,"/"),A=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),C=e=>e&&"?"!==e?e.startsWith("?")?e:"?"+e:"",I=e=>e&&"#"!==e?e.startsWith("#")?e:"#"+e:"";function T(t){F()||y(!1);let{basename:n,navigator:a}=r(g),{hash:l,pathname:i,search:s}=q(t),o=i;if("/"!==n){let a=function(t){return""===t||""===t.pathname?"/":"string"==typeof t?e(t).pathname:t.pathname}(t),r=null!=a&&a.endsWith("/");o="/"===i?n+(r?"/":""):j([n,i])}return a.createHref({pathname:o,search:s,hash:l})}function F(){return null!=r(d)}function J(){return F()||y(!1),r(d).location}function M(){return r(d).navigationType}function R(e){F()||y(!1);let{pathname:t}=J();return l((()=>E(e,t)),[t,e])}function U(){F()||y(!1);let{basename:e,navigator:t}=r(g),{matches:n}=r(v),{pathname:a}=J(),l=JSON.stringify(n.map((e=>e.pathnameBase))),h=i(!1);return s((()=>{h.current=!0})),o(((n,r={})=>{if(!h.current)return;if("number"==typeof n)return void t.go(n);let i=w(n,JSON.parse(l),a);"/"!==e&&(i.pathname=j([e,i.pathname])),(r.replace?t.replace:t.push)(i,r.state)}),[e,t,l,a])}const L=a(null);function _(){return r(L)}function k(e){let t=r(v).outlet;return t?h(L.Provider,{value:e},t):t}function H(){let{matches:e}=r(v),t=e[e.length-1];return t?t.params:{}}function q(e){let{matches:t}=r(v),{pathname:n}=J(),a=JSON.stringify(t.map((e=>e.pathnameBase)));return l((()=>w(e,JSON.parse(a),n)),[e,a,n])}function z(t,n){F()||y(!1);let a,{matches:l}=r(v),i=l[l.length-1],s=i?i.params:{},o=(i&&i.pathname,i?i.pathnameBase:"/"),h=(i&&i.route,J());if(n){let t="string"==typeof n?e(n):n;"/"===o||t.pathname?.startsWith(o)||y(!1),a=t}else a=h;let c=a.pathname||"/",u=S(t,{pathname:"/"===o?c:c.slice(o.length)||"/"});return D(u&&u.map((e=>Object.assign({},e,{params:Object.assign({},s,e.params),pathname:j([o,e.pathname]),pathnameBase:"/"===e.pathnameBase?o:j([o,e.pathnameBase])}))),l)}function D(e,t=[]){return null==e?null:e.reduceRight(((n,a,r)=>h(v.Provider,{children:void 0!==a.route.element?a.route.element:n,value:{outlet:n,matches:t.concat(e.slice(0,r+1))}})),null)}function G({basename:e,children:n,initialEntries:a,initialIndex:r}){let l=i();null==l.current&&(l.current=t({initialEntries:a,initialIndex:r}));let s=l.current,[o,p]=c({action:s.action,location:s.location});return u((()=>s.listen(p)),[s]),h(X,{basename:e,children:n,location:o.location,navigationType:o.action,navigator:s})}function K({to:e,replace:t,state:n}){F()||y(!1);let a=U();return s((()=>{a(e,{replace:t,state:n})})),null}function Q(e){return k(e.context)}function V(e){y(!1)}function X({basename:t="/",children:a=null,location:r,navigationType:i=n.Pop,navigator:s,static:o=!1}){F()&&y(!1);let c=A(t),u=l((()=>({basename:c,navigator:s,static:o})),[c,s,o]);"string"==typeof r&&(r=e(r));let{pathname:p="/",search:m="",hash:f="",state:v=null,key:x="default"}=r,S=l((()=>{let e=O(p,c);return null==e?null:{pathname:e,search:m,hash:f,state:v,key:x}}),[c,p,m,f,v,x]);return null==S?null:h(g.Provider,{value:u},h(d.Provider,{children:a,value:{location:S,navigationType:i}}))}function Y({children:e,location:t}){return z(Z(e),t)}function Z(e){let t=[];return p.forEach(e,(e=>{if(!m(e))return;if(e.type===f)return void t.push.apply(t,Z(e.props.children));e.type!==V&&y(!1);let n={caseSensitive:e.props.caseSensitive,element:e.props.element,index:e.props.index,path:e.props.path};e.props.children&&(n.children=Z(e.props.children)),t.push(n)})),t}function ee(e){return D(e)}export{G as MemoryRouter,K as Navigate,Q as Outlet,V as Route,X as Router,Y as Routes,d as UNSAFE_LocationContext,g as UNSAFE_NavigationContext,v as UNSAFE_RouteContext,Z as createRoutesFromChildren,x as generatePath,E as matchPath,S as matchRoutes,ee as renderMatches,N as resolvePath,T as useHref,F as useInRouterContext,J as useLocation,R as useMatch,U as useNavigate,M as useNavigationType,k as useOutlet,_ as useOutletContext,H as useParams,q as useResolvedPath,z as useRoutes};
11
+ import{invariant as e,resolveTo as t,getToPathname as r,joinPaths as n,matchPath as a,parsePath as o,matchRoutes as i,createMemoryRouter as l,createMemoryHistory as u,Action as s,normalizePathname as c,stripBasename as p}from"@remix-run/router";export{Action as NavigationType,createPath,generatePath,isRouteErrorResponse,json,matchPath,matchRoutes,parsePath,redirect,resolvePath}from"@remix-run/router";import*as h from"react";import{useSyncExternalStore as d,createContext as m,useContext as f,useMemo as v,useRef as g,useEffect as y,useCallback as E,createElement as R,Fragment as b,Component as S,useState as x,useLayoutEffect as U,Children as D,isValidElement as N}from"react";const P="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},{useState:w,useEffect:k,useLayoutEffect:A,useDebugValue:C}=h;function L(e){const t=e.getSnapshot,r=e.value;try{const e=t();return!P(r,e)}catch(n){return!0}}const O=!("undefined"==typeof window||void 0===window.document||void 0===window.document.createElement),j=void 0!==d?d:!O?function(e,t,r){return t()}:function(e,t,r){const n=t(),[{inst:a},o]=w({inst:{value:n,getSnapshot:t}});return A((()=>{a.value=n,a.getSnapshot=t,L(a)&&o({inst:a})}),[e,n,t]),k((()=>{L(a)&&o({inst:a});return e((()=>{L(a)&&o({inst:a})}))}),[e]),C(n),n},F=m(null),T=m(null),B=m(null),I=m(null),_=m({outlet:null,matches:[]}),H=m(null);function J(t){M()||e(!1);let{basename:a,navigator:o}=f(B),{hash:i,pathname:l,search:u}=Q(t),s=l;if("/"!==a){let e=r(t),o=null!=e&&e.endsWith("/");s="/"===l?a+(o?"/":""):n([a,l])}return o.createHref({pathname:s,search:u,hash:i})}function M(){return null!=f(I)}function z(){return M()||e(!1),f(I).location}function W(){return f(I).navigationType}function V(t){M()||e(!1);let{pathname:r}=z();return v((()=>a(t,r)),[r,t])}function X(){M()||e(!1);let{basename:r,navigator:a}=f(B),{matches:o}=f(_),{pathname:i}=z(),l=JSON.stringify(o.map((e=>e.pathnameBase))),u=g(!1);return y((()=>{u.current=!0})),E(((e,o={})=>{if(!u.current)return;if("number"==typeof e)return void a.go(e);let s=t(e,JSON.parse(l),i);"/"!==r&&(s.pathname=n([r,s.pathname])),(o.replace?a.replace:a.push)(s,o.state)}),[r,a,l,i])}const Y=m(null);function q(){return f(Y)}function G(e){let t=f(_).outlet;return t?R(Y.Provider,{value:e},t):t}function K(){let{matches:e}=f(_),t=e[e.length-1];return t?t.params:{}}function Q(e){let{matches:r}=f(_),{pathname:n}=z(),a=JSON.stringify(r.map((e=>e.pathnameBase)));return v((()=>t(e,JSON.parse(a),n)),[e,a,n])}function Z(t,r){M()||e(!1);let a,l=f(T),{matches:u}=f(_),s=u[u.length-1],c=s?s.params:{},p=(s&&s.pathname,s?s.pathnameBase:"/"),h=(s&&s.route,z());if(r){let t="string"==typeof r?o(r):r;"/"===p||t.pathname?.startsWith(p)||e(!1),a=t}else a=h;let d=a.pathname||"/",m="/"===p?d:d.slice(p.length)||"/",v=i(t,{pathname:m});return te(v&&v.map((e=>Object.assign({},e,{params:Object.assign({},c,e.params),pathname:n([p,e.pathname]),pathnameBase:"/"===e.pathnameBase?p:n([p,e.pathnameBase])}))),u,l)}function $(){let e=ce(),t="rgba(200,200,200, 0.5)",r={padding:"0.5rem",backgroundColor:t},n={padding:"2px 4px",backgroundColor:t};return R(b,null,R("h2",null,"Unhandled Thrown Error!"),R("p",{style:{fontStyle:"italic"}},e?.message||e),e?.stack?R("pre",{style:r},e?.stack):null,R("p",null,"💿 Hey developer 👋"),R("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",R("code",{style:n},"errorElement")," props on ",R("code",{style:n},"<Route>")))}class ee extends S{constructor(e){super(e),this.state={location:e.location,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,t){return t.location!==e.location?{error:e.error,location:e.location}:{error:e.error||t.error,location:t.location}}componentDidCatch(e,t){console.error("React Router caught the following error during render",e,t)}render(){return this.state.error?R(H.Provider,{value:this.state.error,children:this.props.component}):this.props.children}}function te(t,r=[],n){if(null==t)return null;let a=t,o=n?.errors;if(null!=o){let t=a.findIndex((e=>e.route.id&&o?.[e.route.id]));t>=0||e(!1),a=a.slice(0,Math.min(a.length,t+1))}return a.reduceRight(((e,t,i)=>{let l=t.route.id?o?.[t.route.id]:null,u=n?t.route.errorElement||R($,null):null,s=()=>R(_.Provider,{children:l?u:void 0!==t.route.element?t.route.element:e,value:{outlet:e,matches:r.concat(a.slice(0,i+1))}});return n&&(t.route.errorElement||0===i)?R(ee,{location:n.location,component:u,error:l,children:s()}):s()}),null)}var re;function ne(t){let r=f(T);return r||e(!1),r}function ae(){return ne(re.UseNavigation).navigation}function oe(){let t=f(F);t||e(!1);let r=ne(re.UseRevalidator);return{revalidate:t.revalidate,state:r.revalidation}}function ie(){let{matches:e,loaderData:t}=ne(re.UseMatches);return v((()=>e.map((e=>{let{pathname:r,params:n}=e;return{id:e.route.id,pathname:r,params:n,data:t[e.route.id],handle:e.route.handle}}))),[e,t])}function le(){let t=ne(re.UseLoaderData),r=f(_);r||e(!1);let n=r.matches[r.matches.length-1];return n.route.id||e(!1),t.loaderData?.[n.route.id]}function ue(e){return ne(re.UseRouteLoaderData).loaderData?.[e]}function se(){let t=ne(re.UseRouteError);return f(_)||e(!1),Object.values(t?.actionData||{})[0]}function ce(){let t=f(H),r=ne(re.UseRouteError),n=f(_),a=n.matches[n.matches.length-1];return t||(n||e(!1),a.route.id||e(!1),r.errors?.[a.route.id])}let pe;function he({children:e,fallbackElement:t,routes:r,createRouter:n}){pe||(pe=n(r||be(e)).initialize());let a=pe,o=j(a.subscribe,(()=>a.state)),i=v((()=>({createHref:a.createHref,go:e=>a.navigate(e),push:(e,t)=>a.navigate(e,{state:t}),replace:(e,t)=>a.navigate(e,{replace:!0,state:t})})),[a]);return o.initialized?R(F.Provider,{value:a},R(T.Provider,{value:o},R(ye,{location:o.location,navigationType:o.historyAction,navigator:i},R(Re,{routes:r,children:e})))):t||null}function de({children:e,initialEntries:t,initialIndex:r,hydrationData:n,fallbackElement:a,routes:o}){return he({children:e,fallbackElement:a,routes:o,createRouter:e=>l({initialEntries:t,initialIndex:r,routes:e,hydrationData:n})})}function me({basename:e,children:t,initialEntries:r,initialIndex:n}){let a=g();null==a.current&&(a.current=u({initialEntries:r,initialIndex:n,v5Compat:!0}));let o=a.current,[i,l]=x({action:o.action,location:o.location});return U((()=>o.listen(l)),[o]),R(ye,{basename:e,children:t,location:i.location,navigationType:i.action,navigator:o})}function fe({to:t,replace:r,state:n}){M()||e(!1);let a=X();return y((()=>{a(t,{replace:r,state:n})})),null}function ve(e){return G(e.context)}function ge(t){e(!1)}function ye({basename:t="/",children:r=null,location:n,navigationType:a=s.Pop,navigator:i,static:l=!1}){M()&&e(!1);let u=c(t),h=v((()=>({basename:u,navigator:i,static:l})),[u,i,l]);"string"==typeof n&&(n=o(n));let{pathname:d="/",search:m="",hash:f="",state:g=null,key:y="default"}=n,E=v((()=>{let e=p(d,u);return null==e?null:{pathname:e,search:m,hash:f,state:g,key:y}}),[u,d,m,f,g,y]);return null==E?null:R(B.Provider,{value:h},R(I.Provider,{children:r,value:{location:E,navigationType:a}}))}function Ee({children:e,location:t}){return Z(be(e),t)}function Re({children:e,location:t,routes:r}){return Z(r||be(e),t)}function be(t,r=[]){let n=[];return D.forEach(t,((t,a)=>{if(!N(t))return;if(t.type===b)return void n.push.apply(n,be(t.props.children,r));t.type!==ge&&e(!1);let o=[...r,a],i={id:t.props.id||o.join("-"),caseSensitive:t.props.caseSensitive,element:t.props.element,index:t.props.index,path:t.props.path,loader:t.props.loader,action:t.props.action,errorElement:t.props.errorElement,shouldRevalidate:t.props.shouldRevalidate,handle:t.props.handle};t.props.children&&(i.children=be(t.props.children,o)),n.push(i)})),n}function Se(e,t){return te(e,void 0,t)}!function(e){e.UseLoaderData="useLoaderData",e.UseActionData="useActionData",e.UseRouteError="useRouteError",e.UseNavigation="useNavigation",e.UseRouteLoaderData="useRouteLoaderData",e.UseMatches="useMatches",e.UseRevalidator="useRevalidator"}(re||(re={}));export{de as DataMemoryRouter,me as MemoryRouter,fe as Navigate,ve as Outlet,ge as Route,ye as Router,Ee as Routes,F as UNSAFE_DataRouterContext,T as UNSAFE_DataRouterStateContext,I as UNSAFE_LocationContext,B as UNSAFE_NavigationContext,_ as UNSAFE_RouteContext,be as createRoutesFromChildren,Se as renderMatches,se as useActionData,J as useHref,M as useInRouterContext,le as useLoaderData,z as useLocation,V as useMatch,ie as useMatches,X as useNavigate,ae as useNavigation,W as useNavigationType,G as useOutlet,q as useOutletContext,K as useParams,he as useRenderDataRouter,Q as useResolvedPath,oe as useRevalidator,ce as useRouteError,ue as useRouteLoaderData,Z as useRoutes};
12
12
  //# sourceMappingURL=react-router.production.min.js.map