Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@remix-run/router

Package Overview
Dependencies
Maintainers
2
Versions
219
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@remix-run/router - npm Package Compare versions

Comparing version 0.0.0-experimental-7f486334 to 0.0.0-experimental-819a53c77

385

CHANGELOG.md
# `@remix-run/router`
## 1.19.2
### Patch Changes
- Update the `unstable_dataStrategy` API to allow for more advanced implementations ([#11943](https://github.com/remix-run/react-router/pull/11943))
- Rename `unstable_HandlerResult` to `unstable_DataStrategyResult`
- The return signature has changed from a parallel array of `unstable_DataStrategyResult[]` (parallel to `matches`) to a key/value object of `routeId => unstable_DataStrategyResult`
- This allows you to more easily decide to opt-into or out-of revalidating data that may not have been revalidated by default (via `match.shouldLoad`)
- ⚠️ This is a breaking change if you've currently adopted `unstable_dataStrategy`
- Added a new `fetcherKey` parameter to `unstable_dataStrategy` to allow differentiation from navigational and fetcher calls
- You should now return/throw a result from your `handlerOverride` instead of returning a `DataStrategyResult`
- If you are aggregating the results of `match.resolve()` into a final results object you should not need to think about the `DataStrategyResult` type
- If you are manually filling your results object from within your `handlerOverride`, then you will need to assign a `DataStrategyResult` as the value so React Router knows if it's a successful execution or an error.
- Preserve view transition through redirects ([#11925](https://github.com/remix-run/react-router/pull/11925))
- Fix blocker usage when `blocker.proceed` is called quickly/synchronously ([#11930](https://github.com/remix-run/react-router/pull/11930))
- Preserve pending view transitions through a router revalidation call ([#11917](https://github.com/remix-run/react-router/pull/11917))
## 1.19.1
### Patch Changes
- Fog of War: Update `unstable_patchRoutesOnMiss` logic so that we call the method when we match routes with dynamic param or splat segments in case there exists a higher-scoring static route that we've not yet discovered. ([#11883](https://github.com/remix-run/react-router/pull/11883))
- We also now leverage an internal FIFO queue of previous paths we've already called `unstable_patchRouteOnMiss` against so that we don't re-call on subsequent navigations to the same path
- Rename `unstable_patchRoutesOnMiss` to `unstable_patchRoutesOnNavigation` to match new behavior ([#11888](https://github.com/remix-run/react-router/pull/11888))
## 1.19.0
### Minor Changes
- Add a new `replace(url, init?)` alternative to `redirect(url, init?)` that performs a `history.replaceState` instead of a `history.pushState` on client-side navigation redirects ([#11811](https://github.com/remix-run/react-router/pull/11811))
- Add a new `unstable_data()` API for usage with Remix Single Fetch ([#11836](https://github.com/remix-run/react-router/pull/11836))
- This API is not intended for direct usage in React Router SPA applications
- It is primarily intended for usage with `createStaticHandler.query()` to allow loaders/actions to return arbitrary data + `status`/`headers` without forcing the serialization of data into a `Response` instance
- This allows for more advanced serialization tactics via `unstable_dataStrategy` such as serializing via `turbo-stream` in Remix Single Fetch
- ⚠️ This removes the `status` field from `HandlerResult`
- If you need to return a specific `status` from `unstable_dataStrategy` you should instead do so via `unstable_data()`
### Patch Changes
- Fix internal cleanup of interrupted fetchers to avoid invalid revalidations on navigations ([#11839](https://github.com/remix-run/react-router/pull/11839))
- When a `fetcher.load` is interrupted by an `action` submission, we track it internally and force revalidation once the `action` completes
- We previously only cleared out this internal tracking info on a successful _navigation_ submission
- Therefore, if the `fetcher.load` was interrupted by a `fetcher.submit`, then we wouldn't remove it from this internal tracking info on successful load (incorrectly)
- And then on the next navigation it's presence in the internal tracking would automatically trigger execution of the `fetcher.load` again, ignoring any `shouldRevalidate` logic
- This fix cleans up the internal tracking so it applies to both navigation submission and fetcher submissions
- Fix initial hydration behavior when using `future.v7_partialHydration` along with `unstable_patchRoutesOnMiss` ([#11838](https://github.com/remix-run/react-router/pull/11838))
- During initial hydration, `router.state.matches` will now include any partial matches so that we can render ancestor `HydrateFallback` components
## 1.18.0
### Minor Changes
- Stabilize `future.unstable_skipActionErrorRevalidation` as `future.v7_skipActionErrorRevalidation` ([#11769](https://github.com/remix-run/react-router/pull/11769))
- When this flag is enabled, actions will not automatically trigger a revalidation if they return/throw a `Response` with a `4xx`/`5xx` status code
- You may still opt-into revalidation via `shouldRevalidate`
- This also changes `shouldRevalidate`'s `unstable_actionStatus` parameter to `actionStatus`
### Patch Changes
- Fix bubbling of errors thrown from `unstable_patchRoutesOnMiss` ([#11786](https://github.com/remix-run/react-router/pull/11786))
- Fix hydration in SSR apps using `unstable_patchRoutesOnMiss` that matched a splat route on the server ([#11790](https://github.com/remix-run/react-router/pull/11790))
## 1.17.1
### Patch Changes
- Fog of War (unstable): Trigger a new `router.routes` identity/reflow during route patching ([#11740](https://github.com/remix-run/react-router/pull/11740))
- Fog of War (unstable): Fix initial matching when a splat route matches ([#11759](https://github.com/remix-run/react-router/pull/11759))
## 1.17.0
### Minor Changes
- Add support for Lazy Route Discovery (a.k.a. Fog of War) ([#11626](https://github.com/remix-run/react-router/pull/11626))
- RFC: <https://github.com/remix-run/react-router/discussions/11113>
- `unstable_patchRoutesOnMiss` docs: <https://reactrouter.com/en/main/routers/create-browser-router>
## 1.16.1
### Patch Changes
- Support `unstable_dataStrategy` on `staticHandler.queryRoute` ([#11515](https://github.com/remix-run/react-router/pull/11515))
## 1.16.0
### Minor Changes
- Add a new `unstable_dataStrategy` configuration option ([#11098](https://github.com/remix-run/react-router/pull/11098))
- This option allows Data Router applications to take control over the approach for executing route loaders and actions
- The default implementation is today's behavior, to fetch all loaders in parallel, but this option allows users to implement more advanced data flows including Remix single-fetch, middleware/context APIs, automatic loader caching, and more
- Move `unstable_dataStrategy` from `createStaticHandler` to `staticHandler.query` so it can be request-specific for use with the `ResponseStub` approach in Remix. It's not really applicable to `queryRoute` for now since that's a singular handler call anyway so any pre-processing/post/processing could be done there manually. ([#11377](https://github.com/remix-run/react-router/pull/11377))
- Add a new `future.unstable_skipActionRevalidation` future flag ([#11098](https://github.com/remix-run/react-router/pull/11098))
- Currently, active loaders revalidate after any action, regardless of the result
- With this flag enabled, actions that return/throw a 4xx/5xx response status will no longer automatically revalidate
- This should reduce load on your server since it's rare that a 4xx/5xx should actually mutate any data
- If you need to revalidate after a 4xx/5xx result with this flag enabled, you can still do that via returning `true` from `shouldRevalidate`
- `shouldRevalidate` now also receives a new `unstable_actionStatus` argument alongside `actionResult` so you can make decision based on the status of the `action` response without having to encode it into the action data
- Added a `skipLoaderErrorBubbling` flag to `staticHandler.query` to disable error bubbling on loader executions for single-fetch scenarios where the client-side router will handle the bubbling ([#11098](https://github.com/remix-run/react-router/pull/11098))
## 1.15.3
### Patch Changes
- Fix a `future.v7_partialHydration` bug that would re-run loaders below the boundary on hydration if SSR loader errors bubbled to a parent boundary ([#11324](https://github.com/remix-run/react-router/pull/11324))
- Fix a `future.v7_partialHydration` bug that would consider the router uninitialized if a route did not have a loader ([#11325](https://github.com/remix-run/react-router/pull/11325))
## 1.15.2
### Patch Changes
- Preserve hydrated errors during partial hydration runs ([#11305](https://github.com/remix-run/react-router/pull/11305))
## 1.15.1
### Patch Changes
- Fix encoding/decoding issues with pre-encoded dynamic parameter values ([#11199](https://github.com/remix-run/react-router/pull/11199))
## 1.15.0
### Minor Changes
- Add a `createStaticHandler` `future.v7_throwAbortReason` flag to throw `request.signal.reason` (defaults to a `DOMException`) when a request is aborted instead of an `Error` such as `new Error("query() call aborted: GET /path")` ([#11104](https://github.com/remix-run/react-router/pull/11104))
- Please note that `DOMException` was added in Node v17 so you will not get a `DOMException` on Node 16 and below.
### Patch Changes
- Respect the `ErrorResponse` status code if passed to `getStaticContextFormError` ([#11213](https://github.com/remix-run/react-router/pull/11213))
## 1.14.2
### Patch Changes
- Fix bug where dashes were not picked up in dynamic parameter names ([#11160](https://github.com/remix-run/react-router/pull/11160))
- Do not attempt to deserialize empty JSON responses ([#11164](https://github.com/remix-run/react-router/pull/11164))
## 1.14.1
### Patch Changes
- Fix bug with `route.lazy` not working correctly on initial SPA load when `v7_partialHydration` is specified ([#11121](https://github.com/remix-run/react-router/pull/11121))
- Fix bug preventing revalidation from occurring for persisted fetchers unmounted during the `submitting` phase ([#11102](https://github.com/remix-run/react-router/pull/11102))
- De-dup relative path logic in `resolveTo` ([#11097](https://github.com/remix-run/react-router/pull/11097))
## 1.14.0
### Minor Changes
- Added a new `future.v7_partialHydration` future flag that enables partial hydration of a data router when Server-Side Rendering. This allows you to provide `hydrationData.loaderData` that has values for _some_ initially matched route loaders, but not all. When this flag is enabled, the router will call `loader` functions for routes that do not have hydration loader data during `router.initialize()`, and it will render down to the deepest provided `HydrateFallback` (up to the first route without hydration data) while it executes the unhydrated routes. ([#11033](https://github.com/remix-run/react-router/pull/11033))
For example, the following router has a `root` and `index` route, but only provided `hydrationData.loaderData` for the `root` route. Because the `index` route has a `loader`, we need to run that during initialization. With `future.v7_partialHydration` specified, `<RouterProvider>` will render the `RootComponent` (because it has data) and then the `IndexFallback` (since it does not have data). Once `indexLoader` finishes, application will update and display `IndexComponent`.
```jsx
let router = createBrowserRouter(
[
{
id: "root",
path: "/",
loader: rootLoader,
Component: RootComponent,
Fallback: RootFallback,
children: [
{
id: "index",
index: true,
loader: indexLoader,
Component: IndexComponent,
HydrateFallback: IndexFallback,
},
],
},
],
{
future: {
v7_partialHydration: true,
},
hydrationData: {
loaderData: {
root: { message: "Hydrated from Root!" },
},
},
}
);
```
If the above example did not have an `IndexFallback`, then `RouterProvider` would instead render the `RootFallback` while it executed the `indexLoader`.
**Note:** When `future.v7_partialHydration` is provided, the `<RouterProvider fallbackElement>` prop is ignored since you can move it to a `Fallback` on your top-most route. The `fallbackElement` prop will be removed in React Router v7 when `v7_partialHydration` behavior becomes the standard behavior.
- Add a new `future.v7_relativeSplatPath` flag to implement a breaking bug fix to relative routing when inside a splat route. ([#11087](https://github.com/remix-run/react-router/pull/11087))
This fix was originally added in [#10983](https://github.com/remix-run/react-router/issues/10983) and was later reverted in [#11078](https://github.com/remix-run/react-router/pull/11078) because it was determined that a large number of existing applications were relying on the buggy behavior (see [#11052](https://github.com/remix-run/react-router/issues/11052))
**The Bug**
The buggy behavior is that without this flag, the default behavior when resolving relative paths is to _ignore_ any splat (`*`) portion of the current route path.
**The Background**
This decision was originally made thinking that it would make the concept of nested different sections of your apps in `<Routes>` easier if relative routing would _replace_ the current splat:
```jsx
<BrowserRouter>
<Routes>
<Route path="/" element={<Home />} />
<Route path="dashboard/*" element={<Dashboard />} />
</Routes>
</BrowserRouter>
```
Any paths like `/dashboard`, `/dashboard/team`, `/dashboard/projects` will match the `Dashboard` route. The dashboard component itself can then render nested `<Routes>`:
```jsx
function Dashboard() {
return (
<div>
<h2>Dashboard</h2>
<nav>
<Link to="/">Dashboard Home</Link>
<Link to="team">Team</Link>
<Link to="projects">Projects</Link>
</nav>
<Routes>
<Route path="/" element={<DashboardHome />} />
<Route path="team" element={<DashboardTeam />} />
<Route path="projects" element={<DashboardProjects />} />
</Routes>
</div>
);
}
```
Now, all links and route paths are relative to the router above them. This makes code splitting and compartmentalizing your app really easy. You could render the `Dashboard` as its own independent app, or embed it into your large app without making any changes to it.
**The Problem**
The problem is that this concept of ignoring part of a path breaks a lot of other assumptions in React Router - namely that `"."` always means the current location pathname for that route. When we ignore the splat portion, we start getting invalid paths when using `"."`:
```jsx
// If we are on URL /dashboard/team, and we want to link to /dashboard/team:
function DashboardTeam() {
// ❌ This is broken and results in <a href="/dashboard">
return <Link to=".">A broken link to the Current URL</Link>;
// ✅ This is fixed but super unintuitive since we're already at /dashboard/team!
return <Link to="./team">A broken link to the Current URL</Link>;
}
```
We've also introduced an issue that we can no longer move our `DashboardTeam` component around our route hierarchy easily - since it behaves differently if we're underneath a non-splat route, such as `/dashboard/:widget`. Now, our `"."` links will, properly point to ourself _inclusive of the dynamic param value_ so behavior will break from it's corresponding usage in a `/dashboard/*` route.
Even worse, consider a nested splat route configuration:
```jsx
<BrowserRouter>
<Routes>
<Route path="dashboard">
<Route path="*" element={<Dashboard />} />
</Route>
</Routes>
</BrowserRouter>
```
Now, a `<Link to=".">` and a `<Link to="..">` inside the `Dashboard` component go to the same place! That is definitely not correct!
Another common issue arose in Data Routers (and Remix) where any `<Form>` should post to it's own route `action` if you the user doesn't specify a form action:
```jsx
let router = createBrowserRouter({
path: "/dashboard",
children: [
{
path: "*",
action: dashboardAction,
Component() {
// ❌ This form is broken! It throws a 405 error when it submits because
// it tries to submit to /dashboard (without the splat value) and the parent
// `/dashboard` route doesn't have an action
return <Form method="post">...</Form>;
},
},
],
});
```
This is just a compounded issue from the above because the default location for a `Form` to submit to is itself (`"."`) - and if we ignore the splat portion, that now resolves to the parent route.
**The Solution**
If you are leveraging this behavior, it's recommended to enable the future flag, move your splat to it's own route, and leverage `../` for any links to "sibling" pages:
```jsx
<BrowserRouter>
<Routes>
<Route path="dashboard">
<Route index path="*" element={<Dashboard />} />
</Route>
</Routes>
</BrowserRouter>
function Dashboard() {
return (
<div>
<h2>Dashboard</h2>
<nav>
<Link to="..">Dashboard Home</Link>
<Link to="../team">Team</Link>
<Link to="../projects">Projects</Link>
</nav>
<Routes>
<Route path="/" element={<DashboardHome />} />
<Route path="team" element={<DashboardTeam />} />
<Route path="projects" element={<DashboardProjects />} />
</Router>
</div>
);
}
```
This way, `.` means "the full current pathname for my route" in all cases (including static, dynamic, and splat routes) and `..` always means "my parents pathname".
### Patch Changes
- Catch and bubble errors thrown when trying to unwrap responses from `loader`/`action` functions ([#11061](https://github.com/remix-run/react-router/pull/11061))
- Fix `relative="path"` issue when rendering `Link`/`NavLink` outside of matched routes ([#11062](https://github.com/remix-run/react-router/pull/11062))
## 1.13.1
### Patch Changes
- Revert the `useResolvedPath` fix for splat routes due to a large number of applications that were relying on the buggy behavior (see <https://github.com/remix-run/react-router/issues/11052#issuecomment-1836589329>). We plan to re-introduce this fix behind a future flag in the next minor version. ([#11078](https://github.com/remix-run/react-router/pull/11078))
## 1.13.0
### Minor Changes
- Export the `PathParam` type from the public API ([#10719](https://github.com/remix-run/react-router/pull/10719))
### Patch Changes
- Fix bug with `resolveTo` in splat routes ([#11045](https://github.com/remix-run/react-router/pull/11045))
- This is a follow up to [#10983](https://github.com/remix-run/react-router/pull/10983) to handle the few other code paths using `getPathContributingMatches`
- This removes the `UNSAFE_getPathContributingMatches` export from `@remix-run/router` since we no longer need this in the `react-router`/`react-router-dom` layers
- Do not revalidate unmounted fetchers when `v7_fetcherPersist` is enabled ([#11044](https://github.com/remix-run/react-router/pull/11044))
## 1.12.0
### Minor Changes
- Add `unstable_flushSync` option to `router.navigate` and `router.fetch` to tell the React Router layer to opt-out of `React.startTransition` and into `ReactDOM.flushSync` for state updates ([#11005](https://github.com/remix-run/react-router/pull/11005))
### Patch Changes
- Fix `relative="path"` bug where relative path calculations started from the full location pathname, instead of from the current contextual route pathname. ([#11006](https://github.com/remix-run/react-router/pull/11006))
```jsx
<Route path="/a">
<Route path="/b" element={<Component />}>
<Route path="/c" />
</Route>
</Route>;
function Component() {
return (
<>
{/* This is now correctly relative to /a/b, not /a/b/c */}
<Link to=".." relative="path" />
<Outlet />
</>
);
}
```
## 1.11.0

@@ -440,9 +816,4 @@

For an overview of the features provided by `react-router`, we recommend you go check out the [docs][rr-docs], especially the [feature overview][rr-feature-overview] and the [tutorial][rr-tutorial].
For an overview of the features provided by `react-router`, we recommend you go check out the [docs](https://reactrouter.com), especially the [feature overview](https://reactrouter.com/start/overview) and the [tutorial](https://reactrouter.com/start/tutorial).
For an overview of the features provided by `@remix-run/router`, please check out the [`README`][remix-router-readme].
[rr-docs]: https://reactrouter.com
[rr-feature-overview]: https://reactrouter.com/start/overview
[rr-tutorial]: https://reactrouter.com/start/tutorial
[remix-router-readme]: https://github.com/remix-run/react-router/blob/main/packages/router/README.md
For an overview of the features provided by `@remix-run/router`, please check out the [`README`](./README.md).

6

dist/index.d.ts

@@ -1,3 +0,3 @@

export type { ActionFunction, ActionFunctionArgs, AgnosticDataIndexRouteObject, AgnosticDataNonIndexRouteObject, AgnosticDataRouteMatch, AgnosticDataRouteObject, AgnosticIndexRouteObject, AgnosticNonIndexRouteObject, AgnosticRouteMatch, AgnosticRouteObject, ErrorResponse, FormEncType, FormMethod, HTMLFormMethod, JsonFunction, LazyRouteFunction, LoaderFunction, LoaderFunctionArgs, ParamParseKey, Params, PathMatch, PathPattern, RedirectFunction, ShouldRevalidateFunction, ShouldRevalidateFunctionArgs, TrackedPromise, UIMatch, V7_FormMethod, } from "./utils";
export { AbortedDeferredError, defer, generatePath, getToPathname, isRouteErrorResponse, joinPaths, json, matchPath, matchRoutes, normalizePathname, redirect, redirectDocument, resolvePath, resolveTo, stripBasename, } from "./utils";
export type { ActionFunction, ActionFunctionArgs, AgnosticDataIndexRouteObject, AgnosticDataNonIndexRouteObject, AgnosticDataRouteMatch, AgnosticDataRouteObject, AgnosticIndexRouteObject, AgnosticNonIndexRouteObject, AgnosticPatchRoutesOnNavigationFunction, AgnosticPatchRoutesOnNavigationFunctionArgs, AgnosticRouteMatch, AgnosticRouteObject, DataStrategyFunction, DataStrategyFunctionArgs, DataStrategyMatch, DataStrategyResult, ErrorResponse, FormEncType, FormMethod, HTMLFormMethod, JsonFunction, LazyRouteFunction, LoaderFunction, LoaderFunctionArgs, ParamParseKey, Params, PathMatch, PathParam, PathPattern, RedirectFunction, ShouldRevalidateFunction, ShouldRevalidateFunctionArgs, TrackedPromise, UIMatch, V7_FormMethod, DataWithResponseInit as UNSAFE_DataWithResponseInit, } from "./utils";
export { AbortedDeferredError, data, defer, generatePath, getToPathname, isRouteErrorResponse, joinPaths, json, matchPath, matchRoutes, normalizePathname, redirect, redirectDocument, replace, resolvePath, resolveTo, stripBasename, } from "./utils";
export type { BrowserHistory, BrowserHistoryOptions, HashHistory, HashHistoryOptions, History, InitialEntry, Location, MemoryHistory, MemoryHistoryOptions, Path, To, } from "./history";

@@ -8,3 +8,3 @@ export { Action, createBrowserHistory, createHashHistory, createMemoryHistory, createPath, parsePath, } from "./history";

export type { RouteManifest as UNSAFE_RouteManifest } from "./utils";
export { DeferredData as UNSAFE_DeferredData, ErrorResponseImpl as UNSAFE_ErrorResponseImpl, convertRoutesToDataRoutes as UNSAFE_convertRoutesToDataRoutes, convertRouteMatchToUiMatch as UNSAFE_convertRouteMatchToUiMatch, getPathContributingMatches as UNSAFE_getPathContributingMatches, } from "./utils";
export { DeferredData as UNSAFE_DeferredData, ErrorResponseImpl as UNSAFE_ErrorResponseImpl, convertRoutesToDataRoutes as UNSAFE_convertRoutesToDataRoutes, convertRouteMatchToUiMatch as UNSAFE_convertRouteMatchToUiMatch, decodePath as UNSAFE_decodePath, getResolveToMatches as UNSAFE_getResolveToMatches, } from "./utils";
export { invariant as UNSAFE_invariant, warning as UNSAFE_warning, } from "./history";
import type { History, Location, Path, To } from "./history";
import { Action as HistoryAction } from "./history";
import type { AgnosticDataRouteMatch, AgnosticDataRouteObject, AgnosticRouteObject, DeferredData, DetectErrorBoundaryFunction, FormEncType, HTMLFormMethod, MapRoutePropertiesFunction, RouteData, Submission, UIMatch } from "./utils";
import type { AgnosticDataRouteMatch, AgnosticDataRouteObject, AgnosticRouteObject, DataStrategyFunction, DeferredData, DetectErrorBoundaryFunction, FormEncType, HTMLFormMethod, MapRoutePropertiesFunction, RouteData, Submission, UIMatch, AgnosticPatchRoutesOnNavigationFunction, DataWithResponseInit } from "./utils";
/**

@@ -19,2 +19,9 @@ * A Router instance manages all navigation and data loading/mutations

*
* Return the future config for the router
*/
get future(): FutureConfig;
/**
* @internal
* PRIVATE - DO NOT USE
*
* Return the current state of the router

@@ -132,2 +139,10 @@ */

*/
abortFetcher(key: string, data?: unknown): void;
/**
* @internal
* PRIVATE - DO NOT USE
*
* Delete the fetcher for a given key
* @param key
*/
deleteFetcher(key: string): void;

@@ -160,2 +175,12 @@ /**

* @internal
* PRIVATE DO NOT USE
*
* Patch additional children routes into an existing parent route
* @param routeId The parent route id or a callback function accepting `patch`
* to perform batch patching
* @param children The additional children routes
*/
patchRoutes(routeId: string | null, children: AgnosticRouteObject[]): void;
/**
* @internal
* PRIVATE - DO NOT USE

@@ -254,3 +279,6 @@ *

v7_normalizeFormMethod: boolean;
v7_partialHydration: boolean;
v7_prependBasename: boolean;
v7_relativeSplatPath: boolean;
v7_skipActionErrorRevalidation: boolean;
}

@@ -272,2 +300,4 @@ /**

window?: Window;
dataStrategy?: DataStrategyFunction;
patchRoutesOnNavigation?: AgnosticPatchRoutesOnNavigationFunction;
}

@@ -297,2 +327,4 @@ /**

requestContext?: unknown;
skipLoaderErrorBubbling?: boolean;
dataStrategy?: DataStrategyFunction;
}): Promise<StaticHandlerContext | Response>;

@@ -302,2 +334,3 @@ queryRoute(request: Request, opts?: {

requestContext?: unknown;
dataStrategy?: DataStrategyFunction;
}): Promise<any>;

@@ -316,3 +349,3 @@ }

unstable_viewTransitionOpts?: ViewTransitionOpts;
unstable_flushSync?: boolean;
unstable_flushSync: boolean;
}): void;

@@ -484,2 +517,9 @@ }

export declare const UNSAFE_DEFERRED_SYMBOL: unique symbol;
/**
* Future flags to toggle new feature behavior
*/
export interface StaticHandlerFutureConfig {
v7_relativeSplatPath: boolean;
v7_throwAbortReason: boolean;
}
export interface CreateStaticHandlerOptions {

@@ -492,2 +532,3 @@ basename?: string;

mapRouteProperties?: MapRoutePropertiesFunction;
future?: Partial<StaticHandlerFutureConfig>;
}

@@ -500,3 +541,4 @@ export declare function createStaticHandler(routes: AgnosticRouteObject[], opts?: CreateStaticHandlerOptions): StaticHandler;

export declare function getStaticContextFromError(routes: AgnosticDataRouteObject[], context: StaticHandlerContext, error: any): StaticHandlerContext;
export declare function isDataWithResponseInit(value: any): value is DataWithResponseInit<unknown>;
export declare function isDeferredData(value: any): value is DeferredData;
export {};
/**
* @remix-run/router v0.0.0-experimental-7f486334
* @remix-run/router v0.0.0-experimental-819a53c77
*

@@ -11,3 +11,3 @@ * Copyright (c) Remix Software Inc.

*/
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).RemixRouter={})}(this,(function(e){"use strict";function t(){return t=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var a in r)Object.prototype.hasOwnProperty.call(r,a)&&(e[a]=r[a])}return e},t.apply(this,arguments)}let r=function(e){return e.Pop="POP",e.Push="PUSH",e.Replace="REPLACE",e}({});const a="popstate";function n(e,t){if(!1===e||null==e)throw new Error(t)}function o(e,t){if(!e){"undefined"!=typeof console&&console.warn(t);try{throw new Error(t)}catch(e){}}}function i(e,t){return{usr:e.state,key:e.key,idx:t}}function s(e,r,a,n){return void 0===a&&(a=null),t({pathname:"string"==typeof e?e:e.pathname,search:"",hash:""},"string"==typeof r?c(r):r,{state:a,key:r&&r.key||n||Math.random().toString(36).substr(2,8)})}function l(e){let{pathname:t="/",search:r="",hash:a=""}=e;return r&&"?"!==r&&(t+="?"===r.charAt(0)?r:"?"+r),a&&"#"!==a&&(t+="#"===a.charAt(0)?a:"#"+a),t}function c(e){let t={};if(e){let r=e.indexOf("#");r>=0&&(t.hash=e.substr(r),e=e.substr(0,r));let a=e.indexOf("?");a>=0&&(t.search=e.substr(a),e=e.substr(0,a)),e&&(t.pathname=e)}return t}function u(e,o,c,u){void 0===u&&(u={});let{window:d=document.defaultView,v5Compat:h=!1}=u,f=d.history,p=r.Pop,m=null,y=v();function v(){return(f.state||{idx:null}).idx}function g(){p=r.Pop;let e=v(),t=null==e?null:e-y;y=e,m&&m({action:p,location:w.location,delta:t})}function b(e){let t="null"!==d.location.origin?d.location.origin:d.location.href,r="string"==typeof e?e:l(e);return n(t,"No window.location.(origin|href) available to create URL for href: "+r),new URL(r,t)}null==y&&(y=0,f.replaceState(t({},f.state,{idx:y}),""));let w={get action(){return p},get location(){return e(d,f)},listen(e){if(m)throw new Error("A history only accepts one active listener");return d.addEventListener(a,g),m=e,()=>{d.removeEventListener(a,g),m=null}},createHref:e=>o(d,e),createURL:b,encodeLocation(e){let t=b(e);return{pathname:t.pathname,search:t.search,hash:t.hash}},push:function(e,t){p=r.Push;let a=s(w.location,e,t);c&&c(a,e),y=v()+1;let n=i(a,y),o=w.createHref(a);try{f.pushState(n,"",o)}catch(e){if(e instanceof DOMException&&"DataCloneError"===e.name)throw e;d.location.assign(o)}h&&m&&m({action:p,location:w.location,delta:1})},replace:function(e,t){p=r.Replace;let a=s(w.location,e,t);c&&c(a,e),y=v();let n=i(a,y),o=w.createHref(a);f.replaceState(n,"",o),h&&m&&m({action:p,location:w.location,delta:0})},go:e=>f.go(e)};return w}let d=function(e){return e.data="data",e.deferred="deferred",e.redirect="redirect",e.error="error",e}({});const h=new Set(["lazy","caseSensitive","path","id","index","children"]);function f(e,r,a,o){return void 0===a&&(a=[]),void 0===o&&(o={}),e.map(((e,i)=>{let s=[...a,i],l="string"==typeof e.id?e.id:s.join("-");if(n(!0!==e.index||!e.children,"Cannot specify children on an index route"),n(!o[l],'Found a route id collision on id "'+l+"\". Route id's must be globally unique within Data Router usages"),function(e){return!0===e.index}(e)){let a=t({},e,r(e),{id:l});return o[l]=a,a}{let a=t({},e,r(e),{id:l,children:void 0});return o[l]=a,e.children&&(a.children=f(e.children,r,s,o)),a}}))}function p(e,t,r){void 0===r&&(r="/");let a=R(("string"==typeof t?c(t):t).pathname||"/",r);if(null==a)return null;let n=y(e);!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,r)=>e===t[r]))?e[e.length-1]-t[t.length-1]:0}(e.routesMeta.map((e=>e.childrenIndex)),t.routesMeta.map((e=>e.childrenIndex)))))}(n);let o=null;for(let e=0;null==o&&e<n.length;++e)o=D(n[e],E(a));return o}function m(e,t){let{route:r,pathname:a,params:n}=e;return{id:r.id,pathname:a,params:n,data:t[r.id],handle:r.handle}}function y(e,t,r,a){void 0===t&&(t=[]),void 0===r&&(r=[]),void 0===a&&(a="");let o=(e,o,i)=>{let s={relativePath:void 0===i?e.path||"":i,caseSensitive:!0===e.caseSensitive,childrenIndex:o,route:e};s.relativePath.startsWith("/")&&(n(s.relativePath.startsWith(a),'Absolute route path "'+s.relativePath+'" nested under path "'+a+'" is not valid. An absolute child route path must start with the combined path of all its parent routes.'),s.relativePath=s.relativePath.slice(a.length));let l=M([a,s.relativePath]),c=r.concat(s);e.children&&e.children.length>0&&(n(!0!==e.index,'Index routes must not have child routes. Please remove all child routes from route path "'+l+'".'),y(e.children,t,c,l)),(null!=e.path||e.index)&&t.push({path:l,score:w(l,e.index),routesMeta:c})};return e.forEach(((e,t)=>{var r;if(""!==e.path&&null!=(r=e.path)&&r.includes("?"))for(let r of v(e.path))o(e,t,r);else o(e,t)})),t}function v(e){let t=e.split("/");if(0===t.length)return[];let[r,...a]=t,n=r.endsWith("?"),o=r.replace(/\?$/,"");if(0===a.length)return n?[o,""]:[o];let i=v(a.join("/")),s=[];return s.push(...i.map((e=>""===e?o:[o,e].join("/")))),n&&s.push(...i),s.map((t=>e.startsWith("/")&&""===t?"/":t))}const g=/^:\w+$/,b=e=>"*"===e;function w(e,t){let r=e.split("/"),a=r.length;return r.some(b)&&(a+=-2),t&&(a+=2),r.filter((e=>!b(e))).reduce(((e,t)=>e+(g.test(t)?3:""===t?1:10)),a)}function D(e,t){let{routesMeta:r}=e,a={},n="/",o=[];for(let e=0;e<r.length;++e){let i=r[e],s=e===r.length-1,l="/"===n?t:t.slice(n.length)||"/",c=S({path:i.relativePath,caseSensitive:i.caseSensitive,end:s},l);if(!c)return null;Object.assign(a,c.params);let u=i.route;o.push({params:a,pathname:M([n,c.pathname]),pathnameBase:j(M([n,c.pathnameBase])),route:u}),"/"!==c.pathnameBase&&(n=M([n,c.pathnameBase]))}return o}function S(e,t){"string"==typeof e&&(e={path:e,caseSensitive:!1,end:!0});let[r,a]=function(e,t,r){void 0===t&&(t=!1);void 0===r&&(r=!0);o("*"===e||!e.endsWith("*")||e.endsWith("/*"),'Route path "'+e+'" will be treated as if it were "'+e.replace(/\*$/,"/*")+'" because the `*` character must always follow a `/` in the pattern. To get rid of this warning, please change the route path to "'+e.replace(/\*$/,"/*")+'".');let a=[],n="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:(\w+)(\?)?/g,((e,t,r)=>(a.push({paramName:t,isOptional:null!=r}),r?"/?([^\\/]+)?":"/([^\\/]+)")));e.endsWith("*")?(a.push({paramName:"*"}),n+="*"===e||"/*"===e?"(.*)$":"(?:\\/(.+)|\\/*)$"):r?n+="\\/*$":""!==e&&"/"!==e&&(n+="(?:(?=\\/|$))");return[new RegExp(n,t?void 0:"i"),a]}(e.path,e.caseSensitive,e.end),n=t.match(r);if(!n)return null;let i=n[0],s=i.replace(/(.)\/+$/,"$1"),l=n.slice(1);return{params:a.reduce(((e,t,r)=>{let{paramName:a,isOptional:n}=t;if("*"===a){let e=l[r]||"";s=i.slice(0,i.length-e.length).replace(/(.)\/+$/,"$1")}const c=l[r];return e[a]=n&&!c?void 0:function(e,t){try{return decodeURIComponent(e)}catch(r){return o(!1,'The value for the URL param "'+t+'" will not be decoded because the string "'+e+'" is a malformed URL segment. This is probably due to a bad percent encoding ('+r+")."),e}}(c||"",a),e}),{}),pathname:i,pathnameBase:s,pattern:e}}function E(e){try{return decodeURI(e)}catch(t){return o(!1,'The URL path "'+e+'" could not be decoded because it is is a malformed URL segment. This is probably due to a bad percent encoding ('+t+")."),e}}function R(e,t){if("/"===t)return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let r=t.endsWith("/")?t.length-1:t.length,a=e.charAt(r);return a&&"/"!==a?null:e.slice(r)||"/"}function x(e,t){void 0===t&&(t="/");let{pathname:r,search:a="",hash:n=""}="string"==typeof e?c(e):e,o=r?r.startsWith("/")?r:function(e,t){let r=t.replace(/\/+$/,"").split("/");return e.split("/").forEach((e=>{".."===e?r.length>1&&r.pop():"."!==e&&r.push(e)})),r.length>1?r.join("/"):"/"}(r,t):t;return{pathname:o,search:k(a),hash:C(n)}}function P(e,t,r,a){return"Cannot include a '"+e+"' character in a manually specified `to."+t+"` field ["+JSON.stringify(a)+"]. Please separate it out to the `to."+r+'` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.'}function L(e){return e.filter(((e,t)=>0===t||e.route.path&&e.route.path.length>0))}function A(e,r,a,o){let i;void 0===o&&(o=!1),"string"==typeof e?i=c(e):(i=t({},e),n(!i.pathname||!i.pathname.includes("?"),P("?","pathname","search",i)),n(!i.pathname||!i.pathname.includes("#"),P("#","pathname","hash",i)),n(!i.search||!i.search.includes("#"),P("#","search","hash",i)));let s,l=""===e||""===i.pathname,u=l?"/":i.pathname;if(o||null==u)s=a;else{let e=r.length-1;if(u.startsWith("..")){let t=u.split("/");for(;".."===t[0];)t.shift(),e-=1;i.pathname=t.join("/")}s=e>=0?r[e]:"/"}let d=x(i,s),h=u&&"/"!==u&&u.endsWith("/"),f=(l||"."===u)&&a.endsWith("/");return d.pathname.endsWith("/")||!h&&!f||(d.pathname+="/"),d}const M=e=>e.join("/").replace(/\/\/+/g,"/"),j=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),k=e=>e&&"?"!==e?e.startsWith("?")?e:"?"+e:"",C=e=>e&&"#"!==e?e.startsWith("#")?e:"#"+e:"";class T extends Error{}class U{constructor(e,t){let r;this.pendingKeysSet=new Set,this.subscribers=new Set,this.deferredKeys=[],n(e&&"object"==typeof e&&!Array.isArray(e),"defer() only accepts plain objects"),this.abortPromise=new Promise(((e,t)=>r=t)),this.controller=new AbortController;let a=()=>r(new T("Deferred data aborted"));this.unlistenAbortSignal=()=>this.controller.signal.removeEventListener("abort",a),this.controller.signal.addEventListener("abort",a),this.data=Object.entries(e).reduce(((e,t)=>{let[r,a]=t;return Object.assign(e,{[r]:this.trackPromise(r,a)})}),{}),this.done&&this.unlistenAbortSignal(),this.init=t}trackPromise(e,t){if(!(t instanceof Promise))return t;this.deferredKeys.push(e),this.pendingKeysSet.add(e);let r=Promise.race([t,this.abortPromise]).then((t=>this.onSettle(r,e,void 0,t)),(t=>this.onSettle(r,e,t)));return r.catch((()=>{})),Object.defineProperty(r,"_tracked",{get:()=>!0}),r}onSettle(e,t,r,a){if(this.controller.signal.aborted&&r instanceof T)return this.unlistenAbortSignal(),Object.defineProperty(e,"_error",{get:()=>r}),Promise.reject(r);if(this.pendingKeysSet.delete(t),this.done&&this.unlistenAbortSignal(),void 0===r&&void 0===a){let r=new Error('Deferred data for key "'+t+'" resolved/rejected with `undefined`, you must resolve/reject with a value or `null`.');return Object.defineProperty(e,"_error",{get:()=>r}),this.emit(!1,t),Promise.reject(r)}return void 0===a?(Object.defineProperty(e,"_error",{get:()=>r}),this.emit(!1,t),Promise.reject(r)):(Object.defineProperty(e,"_data",{get:()=>a}),this.emit(!1,t),a)}emit(e,t){this.subscribers.forEach((r=>r(e,t)))}subscribe(e){return this.subscribers.add(e),()=>this.subscribers.delete(e)}cancel(){this.controller.abort(),this.pendingKeysSet.forEach(((e,t)=>this.pendingKeysSet.delete(t))),this.emit(!0)}async resolveData(e){let t=!1;if(!this.done){let r=()=>this.cancel();e.addEventListener("abort",r),t=await new Promise((t=>{this.subscribe((a=>{e.removeEventListener("abort",r),(a||this.done)&&t(a)}))}))}return t}get done(){return 0===this.pendingKeysSet.size}get unwrappedData(){return n(null!==this.data&&this.done,"Can only unwrap data on initialized and settled deferreds"),Object.entries(this.data).reduce(((e,t)=>{let[r,a]=t;return Object.assign(e,{[r]:O(a)})}),{})}get pendingKeys(){return Array.from(this.pendingKeysSet)}}function O(e){if(!function(e){return e instanceof Promise&&!0===e._tracked}(e))return e;if(e._error)throw e._error;return e._data}const _=function(e,r){void 0===r&&(r=302);let a=r;"number"==typeof a?a={status:a}:void 0===a.status&&(a.status=302);let n=new Headers(a.headers);return n.set("Location",e),new Response(null,t({},a,{headers:n}))};class I{constructor(e,t,r,a){void 0===a&&(a=!1),this.status=e,this.statusText=t||"",this.internal=a,r instanceof Error?(this.data=r.toString(),this.error=r):this.data=r}}function z(e){return null!=e&&"number"==typeof e.status&&"string"==typeof e.statusText&&"boolean"==typeof e.internal&&"data"in e}const q=["post","put","patch","delete"],H=new Set(q),N=["get",...q],B=new Set(N),F=new Set([301,302,303,307,308]),W=new Set([307,308]),$={state:"idle",location:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0},K={state:"idle",data:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0},J={state:"unblocked",proceed:void 0,reset:void 0,location:void 0},Y=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,V=e=>({hasErrorBoundary:Boolean(e.hasErrorBoundary)}),X="remix-router-transitions";const G=Symbol("deferred");function Q(e,t,r,a,n,o,i){let s,c;if(null!=o&&"path"!==i){s=[];for(let e of t)if(s.push(e),e.route.id===o){c=e;break}}else s=t,c=t[t.length-1];let u=A(n||".",L(s).map((e=>e.pathnameBase)),R(e.pathname,r)||e.pathname,"path"===i);return null==n&&(u.search=e.search,u.hash=e.hash),null!=n&&""!==n&&"."!==n||!c||!c.route.index||Pe(u.search)||(u.search=u.search?u.search.replace(/^\?/,"?index&"):"?index"),a&&"/"!==r&&(u.pathname="/"===u.pathname?r:M([r,u.pathname])),l(u)}function Z(e,t,r,a){if(!a||!function(e){return null!=e&&("formData"in e&&null!=e.formData||"body"in e&&void 0!==e.body)}(a))return{path:r};if(a.formMethod&&!Se(a.formMethod))return{path:r,error:pe(405,{method:a.formMethod})};let o,i,s=()=>({path:r,error:pe(400,{type:"invalid-body"})}),u=a.formMethod||"get",d=e?u.toUpperCase():u.toLowerCase(),h=ye(r);if(void 0!==a.body){if("text/plain"===a.formEncType){if(!Ee(d))return s();let e="string"==typeof a.body?a.body:a.body instanceof FormData||a.body instanceof URLSearchParams?Array.from(a.body.entries()).reduce(((e,t)=>{let[r,a]=t;return""+e+r+"="+a+"\n"}),""):String(a.body);return{path:r,submission:{formMethod:d,formAction:h,formEncType:a.formEncType,formData:void 0,json:void 0,text:e}}}if("application/json"===a.formEncType){if(!Ee(d))return s();try{let e="string"==typeof a.body?JSON.parse(a.body):a.body;return{path:r,submission:{formMethod:d,formAction:h,formEncType:a.formEncType,formData:void 0,json:e,text:void 0}}}catch(e){return s()}}}if(n("function"==typeof FormData,"FormData is not available in this environment"),a.formData)o=se(a.formData),i=a.formData;else if(a.body instanceof FormData)o=se(a.body),i=a.body;else if(a.body instanceof URLSearchParams)o=a.body,i=le(o);else if(null==a.body)o=new URLSearchParams,i=new FormData;else try{o=new URLSearchParams(a.body),i=le(o)}catch(e){return s()}let f={formMethod:d,formAction:h,formEncType:a&&a.formEncType||"application/x-www-form-urlencoded",formData:i,json:void 0,text:void 0};if(Ee(f.formMethod))return{path:r,submission:f};let p=c(r);return t&&p.search&&Pe(p.search)&&o.append("index",""),p.search="?"+o,{path:l(p),submission:f}}function ee(e,t){let r=e;if(t){let a=e.findIndex((e=>e.route.id===t));a>=0&&(r=e.slice(0,a))}return r}function te(e,r,a,n,o,i,s,l,c,u,d,h,f,m){let y=m?Object.values(m)[0]:f?Object.values(f)[0]:void 0,v=e.createURL(r.location),g=e.createURL(o),b=m?Object.keys(m)[0]:void 0,w=ee(a,b).filter(((e,a)=>{if(e.route.lazy)return!0;if(null==e.route.loader)return!1;if(function(e,t,r){let a=!t||r.route.id!==t.route.id,n=void 0===e[r.route.id];return a||n}(r.loaderData,r.matches[a],e)||s.some((t=>t===e.route.id)))return!0;let o=r.matches[a],l=e;return ae(e,t({currentUrl:v,currentParams:o.params,nextUrl:g,nextParams:l.params},n,{actionResult:y,defaultShouldRevalidate:i||v.pathname+v.search===g.pathname+g.search||v.search!==g.search||re(o,l)}))})),D=[];return c.forEach(((e,o)=>{if(!a.some((t=>t.route.id===e.routeId)))return;let s=p(d,e.path,h);if(!s)return void D.push({key:o,routeId:e.routeId,path:e.path,matches:null,match:null,controller:null});let c=r.fetchers.get(o),f=Le(s,e.path),m=!1;m=!u.has(o)&&(!!l.includes(o)||(c&&"idle"!==c.state&&void 0===c.data?i:ae(f,t({currentUrl:v,currentParams:r.matches[r.matches.length-1].params,nextUrl:g,nextParams:a[a.length-1].params},n,{actionResult:y,defaultShouldRevalidate:i})))),m&&D.push({key:o,routeId:e.routeId,path:e.path,matches:s,match:f,controller:new AbortController})})),[w,D]}function re(e,t){let r=e.route.path;return e.pathname!==t.pathname||null!=r&&r.endsWith("*")&&e.params["*"]!==t.params["*"]}function ae(e,t){if(e.route.shouldRevalidate){let r=e.route.shouldRevalidate(t);if("boolean"==typeof r)return r}return t.defaultShouldRevalidate}async function ne(e,r,a){if(!e.lazy)return;let i=await e.lazy();if(!e.lazy)return;let s=a[e.id];n(s,"No route found in manifest");let l={};for(let e in i){let t=void 0!==s[e]&&"hasErrorBoundary"!==e;o(!t,'Route "'+s.id+'" has a static property "'+e+'" defined but its lazy function is also returning a value for this property. The lazy route property "'+e+'" will be ignored.'),t||h.has(e)||(l[e]=i[e])}Object.assign(s,l),Object.assign(s,t({},r(s),{lazy:void 0}))}async function oe(e,t,r,a,o,i,s,l){let c,u,h;void 0===l&&(l={});let f=e=>{let a,n=new Promise(((e,t)=>a=t));return h=()=>a(),t.signal.addEventListener("abort",h),Promise.race([e({request:t,params:r.params,context:l.requestContext}),n])};try{let a=r.route[e];if(r.route.lazy)if(a){let e,t=await Promise.all([f(a).catch((t=>{e=t})),ne(r.route,i,o)]);if(e)throw e;u=t[0]}else{if(await ne(r.route,i,o),a=r.route[e],!a){if("action"===e){let e=new URL(t.url),a=e.pathname+e.search;throw pe(405,{method:t.method,pathname:a,routeId:r.route.id})}return{type:d.data,data:void 0}}u=await f(a)}else{if(!a){let e=new URL(t.url);throw pe(404,{pathname:e.pathname+e.search})}u=await f(a)}n(void 0!==u,"You defined "+("action"===e?"an action":"a loader")+' for route "'+r.route.id+"\" but didn't return anything from your `"+e+"` function. Please return a value or `null`.")}catch(e){c=d.error,u=e}finally{h&&t.signal.removeEventListener("abort",h)}if(De(u)){let e,o=u.status;if(F.has(o)){let e=u.headers.get("Location");if(n(e,"Redirects returned/thrown from loaders/actions must have a Location header"),Y.test(e)){if(!l.isStaticRequest){let r=new URL(t.url),a=e.startsWith("//")?new URL(r.protocol+e):new URL(e),n=null!=R(a.pathname,s);a.origin===r.origin&&n&&(e=a.pathname+a.search+a.hash)}}else e=Q(new URL(t.url),a.slice(0,a.indexOf(r)+1),s,!0,e);if(l.isStaticRequest)throw u.headers.set("Location",e),u;return{type:d.redirect,status:o,location:e,revalidate:null!==u.headers.get("X-Remix-Revalidate"),reloadDocument:null!==u.headers.get("X-Remix-Reload-Document")}}if(l.isRouteRequest){throw{type:c===d.error?d.error:d.data,response:u}}let i=u.headers.get("Content-Type");return e=i&&/\bapplication\/json\b/.test(i)?await u.json():await u.text(),c===d.error?{type:c,error:new I(o,u.statusText,e),headers:u.headers}:{type:d.data,data:e,statusCode:u.status,headers:u.headers}}return c===d.error?{type:c,error:u}:we(u)?{type:d.deferred,deferredData:u,statusCode:null==(p=u.init)?void 0:p.status,headers:(null==(m=u.init)?void 0:m.headers)&&new Headers(u.init.headers)}:{type:d.data,data:u};var p,m}function ie(e,t,r,a){let n=e.createURL(ye(t)).toString(),o={signal:r};if(a&&Ee(a.formMethod)){let{formMethod:e,formEncType:t}=a;o.method=e.toUpperCase(),"application/json"===t?(o.headers=new Headers({"Content-Type":t}),o.body=JSON.stringify(a.json)):"text/plain"===t?o.body=a.text:"application/x-www-form-urlencoded"===t&&a.formData?o.body=se(a.formData):o.body=a.formData}return new Request(n,o)}function se(e){let t=new URLSearchParams;for(let[r,a]of e.entries())t.append(r,"string"==typeof a?a:a.name);return t}function le(e){let t=new FormData;for(let[r,a]of e.entries())t.append(r,a);return t}function ce(e,t,r,a,o){let i,s={},l=null,c=!1,u={};return r.forEach(((r,d)=>{let h=t[d].route.id;if(n(!be(r),"Cannot handle redirect results in processLoaderData"),ge(r)){let t=he(e,h),n=r.error;a&&(n=Object.values(a)[0],a=void 0),l=l||{},null==l[t.route.id]&&(l[t.route.id]=n),s[h]=void 0,c||(c=!0,i=z(r.error)?r.error.status:500),r.headers&&(u[h]=r.headers)}else ve(r)?(o.set(h,r.deferredData),s[h]=r.deferredData.data):s[h]=r.data,null==r.statusCode||200===r.statusCode||c||(i=r.statusCode),r.headers&&(u[h]=r.headers)})),a&&(l=a,s[Object.keys(a)[0]]=void 0),{loaderData:s,errors:l,statusCode:i||200,loaderHeaders:u}}function ue(e,r,a,o,i,s,l,c){let{loaderData:u,errors:d}=ce(r,a,o,i,c);for(let r=0;r<s.length;r++){let{key:a,match:o,controller:i}=s[r];n(void 0!==l&&void 0!==l[r],"Did not find corresponding fetcher result");let c=l[r];if(!i||!i.signal.aborted)if(ge(c)){let r=he(e.matches,null==o?void 0:o.route.id);d&&d[r.route.id]||(d=t({},d,{[r.route.id]:c.error})),e.fetchers.delete(a)}else if(be(c))n(!1,"Unhandled fetcher revalidation redirect");else if(ve(c))n(!1,"Unhandled fetcher deferred data");else{let t=Ce(c.data);e.fetchers.set(a,t)}}return{loaderData:u,errors:d}}function de(e,r,a,n){let o=t({},r);for(let t of a){let a=t.route.id;if(r.hasOwnProperty(a)?void 0!==r[a]&&(o[a]=r[a]):void 0!==e[a]&&t.route.loader&&(o[a]=e[a]),n&&n.hasOwnProperty(a))break}return o}function he(e,t){return(t?e.slice(0,e.findIndex((e=>e.route.id===t))+1):[...e]).reverse().find((e=>!0===e.route.hasErrorBoundary))||e[0]}function fe(e){let t=1===e.length?e[0]:e.find((e=>e.index||!e.path||"/"===e.path))||{id:"__shim-error-route__"};return{matches:[{params:{},pathname:"",pathnameBase:"",route:t}],route:t}}function pe(e,t){let{pathname:r,routeId:a,method:n,type:o}=void 0===t?{}:t,i="Unknown Server Error",s="Unknown @remix-run/router error";return 400===e?(i="Bad Request",n&&r&&a?s="You made a "+n+' request to "'+r+'" but did not provide a `loader` for route "'+a+'", so there is no way to handle the request.':"defer-action"===o?s="defer() is not supported in actions":"invalid-body"===o&&(s="Unable to encode submission body")):403===e?(i="Forbidden",s='Route "'+a+'" does not match URL "'+r+'"'):404===e?(i="Not Found",s='No route matches URL "'+r+'"'):405===e&&(i="Method Not Allowed",n&&r&&a?s="You made a "+n.toUpperCase()+' request to "'+r+'" but did not provide an `action` for route "'+a+'", so there is no way to handle the request.':n&&(s='Invalid request method "'+n.toUpperCase()+'"')),new I(e||500,i,new Error(s),!0)}function me(e){for(let t=e.length-1;t>=0;t--){let r=e[t];if(be(r))return{result:r,idx:t}}}function ye(e){return l(t({},"string"==typeof e?c(e):e,{hash:""}))}function ve(e){return e.type===d.deferred}function ge(e){return e.type===d.error}function be(e){return(e&&e.type)===d.redirect}function we(e){let t=e;return t&&"object"==typeof t&&"object"==typeof t.data&&"function"==typeof t.subscribe&&"function"==typeof t.cancel&&"function"==typeof t.resolveData}function De(e){return null!=e&&"number"==typeof e.status&&"string"==typeof e.statusText&&"object"==typeof e.headers&&void 0!==e.body}function Se(e){return B.has(e.toLowerCase())}function Ee(e){return H.has(e.toLowerCase())}async function Re(e,t,r,a,o,i){for(let s=0;s<r.length;s++){let l=r[s],c=t[s];if(!c)continue;let u=e.find((e=>e.route.id===c.route.id)),d=null!=u&&!re(u,c)&&void 0!==(i&&i[c.route.id]);if(ve(l)&&(o||d)){let e=a[s];n(e,"Expected an AbortSignal for revalidating fetcher deferred result"),await xe(l,e,o).then((e=>{e&&(r[s]=e||r[s])}))}}}async function xe(e,t,r){if(void 0===r&&(r=!1),!await e.deferredData.resolveData(t)){if(r)try{return{type:d.data,data:e.deferredData.unwrappedData}}catch(e){return{type:d.error,error:e}}return{type:d.data,data:e.deferredData.data}}}function Pe(e){return new URLSearchParams(e).getAll("index").some((e=>""===e))}function Le(e,t){let r="string"==typeof t?c(t).search:t.search;if(e[e.length-1].route.index&&Pe(r||""))return e[e.length-1];let a=L(e);return a[a.length-1]}function Ae(e){let{formMethod:t,formAction:r,formEncType:a,text:n,formData:o,json:i}=e;if(t&&r&&a)return null!=n?{formMethod:t,formAction:r,formEncType:a,formData:void 0,json:void 0,text:n}:null!=o?{formMethod:t,formAction:r,formEncType:a,formData:o,json:void 0,text:void 0}:void 0!==i?{formMethod:t,formAction:r,formEncType:a,formData:void 0,json:i,text:void 0}:void 0}function Me(e,t){if(t){return{state:"loading",location:e,formMethod:t.formMethod,formAction:t.formAction,formEncType:t.formEncType,formData:t.formData,json:t.json,text:t.text}}return{state:"loading",location:e,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0}}function je(e,t){return{state:"submitting",location:e,formMethod:t.formMethod,formAction:t.formAction,formEncType:t.formEncType,formData:t.formData,json:t.json,text:t.text}}function ke(e,t){if(e){return{state:"loading",formMethod:e.formMethod,formAction:e.formAction,formEncType:e.formEncType,formData:e.formData,json:e.json,text:e.text,data:t}}return{state:"loading",formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0,data:t}}function Ce(e){return{state:"idle",formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0,data:e}}e.AbortedDeferredError=T,e.Action=r,e.IDLE_BLOCKER=J,e.IDLE_FETCHER=K,e.IDLE_NAVIGATION=$,e.UNSAFE_DEFERRED_SYMBOL=G,e.UNSAFE_DeferredData=U,e.UNSAFE_ErrorResponseImpl=I,e.UNSAFE_convertRouteMatchToUiMatch=m,e.UNSAFE_convertRoutesToDataRoutes=f,e.UNSAFE_getPathContributingMatches=L,e.UNSAFE_invariant=n,e.UNSAFE_warning=o,e.createBrowserHistory=function(e){return void 0===e&&(e={}),u((function(e,t){let{pathname:r,search:a,hash:n}=e.location;return s("",{pathname:r,search:a,hash:n},t.state&&t.state.usr||null,t.state&&t.state.key||"default")}),(function(e,t){return"string"==typeof t?t:l(t)}),null,e)},e.createHashHistory=function(e){return void 0===e&&(e={}),u((function(e,t){let{pathname:r="/",search:a="",hash:n=""}=c(e.location.hash.substr(1));return r.startsWith("/")||r.startsWith(".")||(r="/"+r),s("",{pathname:r,search:a,hash:n},t.state&&t.state.usr||null,t.state&&t.state.key||"default")}),(function(e,t){let r=e.document.querySelector("base"),a="";if(r&&r.getAttribute("href")){let t=e.location.href,r=t.indexOf("#");a=-1===r?t:t.slice(0,r)}return a+"#"+("string"==typeof t?t:l(t))}),(function(e,t){o("/"===e.pathname.charAt(0),"relative pathnames are not supported in hash history.push("+JSON.stringify(t)+")")}),e)},e.createMemoryHistory=function(e){void 0===e&&(e={});let t,{initialEntries:a=["/"],initialIndex:n,v5Compat:i=!1}=e;t=a.map(((e,t)=>m(e,"string"==typeof e?null:e.state,0===t?"default":void 0)));let u=f(null==n?t.length-1:n),d=r.Pop,h=null;function f(e){return Math.min(Math.max(e,0),t.length-1)}function p(){return t[u]}function m(e,r,a){void 0===r&&(r=null);let n=s(t?p().pathname:"/",e,r,a);return o("/"===n.pathname.charAt(0),"relative pathnames are not supported in memory history: "+JSON.stringify(e)),n}function y(e){return"string"==typeof e?e:l(e)}return{get index(){return u},get action(){return d},get location(){return p()},createHref:y,createURL:e=>new URL(y(e),"http://localhost"),encodeLocation(e){let t="string"==typeof e?c(e):e;return{pathname:t.pathname||"",search:t.search||"",hash:t.hash||""}},push(e,a){d=r.Push;let n=m(e,a);u+=1,t.splice(u,t.length,n),i&&h&&h({action:d,location:n,delta:1})},replace(e,a){d=r.Replace;let n=m(e,a);t[u]=n,i&&h&&h({action:d,location:n,delta:0})},go(e){d=r.Pop;let a=f(u+e),n=t[a];u=a,h&&h({action:d,location:n,delta:e})},listen:e=>(h=e,()=>{h=null})}},e.createPath=l,e.createRouter=function(e){const a=e.window?e.window:"undefined"!=typeof window?window:void 0,i=void 0!==a&&void 0!==a.document&&void 0!==a.document.createElement,l=!i;let c;if(n(e.routes.length>0,"You must provide a non-empty routes array to createRouter"),e.mapRouteProperties)c=e.mapRouteProperties;else if(e.detectErrorBoundary){let t=e.detectErrorBoundary;c=e=>({hasErrorBoundary:t(e)})}else c=V;let u,h={},y=f(e.routes,c,void 0,h),v=e.basename||"/",g=t({v7_fetcherPersist:!1,v7_normalizeFormMethod:!1,v7_prependBasename:!1},e.future),b=null,w=new Set,D=null,S=null,E=null,x=null!=e.hydrationData,P=p(y,e.history.location,v),L=null;if(null==P){let t=pe(404,{pathname:e.history.location.pathname}),{matches:r,route:a}=fe(y);P=r,L={[a.id]:t}}let A,M,j=!(P.some((e=>e.route.lazy))||P.some((e=>e.route.loader))&&null==e.hydrationData),k={historyAction:e.history.action,location:e.history.location,matches:P,initialized:j,navigation:$,restoreScrollPosition:null==e.hydrationData&&null,preventScrollReset:!1,revalidation:"idle",loaderData:e.hydrationData&&e.hydrationData.loaderData||{},actionData:e.hydrationData&&e.hydrationData.actionData||null,errors:e.hydrationData&&e.hydrationData.errors||L,fetchers:new Map,blockers:new Map},C=r.Pop,T=!1,U=!1,O=!1,_=new Map,I=null,z=!1,q=!1,H=[],N=[],B=new Map,F=0,G=-1,ee=new Map,re=new Set,ae=new Map,ne=new Map,se=new Set,le=new Map,ce=new Map,ye=!1;function we(e,r){k=t({},k,e);let a=[],n=[];g.v7_fetcherPersist&&k.fetchers.forEach(((e,t)=>{"idle"===e.state&&(se.has(t)?n.push(t):a.push(t))})),[...w].forEach((e=>e(k,{deletedFetchers:n,unstable_viewTransitionOpts:r.viewTransitionOpts,unstable_flushSync:r.flushSync}))),g.v7_fetcherPersist&&(a.forEach((e=>k.fetchers.delete(e))),n.forEach((e=>ze(e))))}function De(a,n){var o,i;let s,l=null!=k.actionData&&null!=k.navigation.formMethod&&Ee(k.navigation.formMethod)&&"loading"===k.navigation.state&&!0!==(null==(o=a.state)?void 0:o._isRedirect);s=n.actionData?Object.keys(n.actionData).length>0?n.actionData:null:l?k.actionData:null;let c=n.loaderData?de(k.loaderData,n.loaderData,n.matches||[],n.errors):k.loaderData,d=k.blockers;d.size>0&&(d=new Map(d),d.forEach(((e,t)=>d.set(t,J))));let h,f=!0===T||null!=k.navigation.formMethod&&Ee(k.navigation.formMethod)&&!0!==(null==(i=a.state)?void 0:i._isRedirect);if(u&&(y=u,u=void 0),z||C===r.Pop||(C===r.Push?e.history.push(a,a.state):C===r.Replace&&e.history.replace(a,a.state)),C===r.Pop){let e=_.get(k.location.pathname);e&&e.has(a.pathname)?h={currentLocation:k.location,nextLocation:a}:_.has(a.pathname)&&(h={currentLocation:a,nextLocation:k.location})}else if(U){let e=_.get(k.location.pathname);e?e.add(a.pathname):(e=new Set([a.pathname]),_.set(k.location.pathname,e)),h={currentLocation:k.location,nextLocation:a}}we(t({},n,{actionData:s,loaderData:c,historyAction:C,location:a,initialized:!0,navigation:$,revalidation:"idle",restoreScrollPosition:Ye(a,n.matches||k.matches),preventScrollReset:f,blockers:d}),{viewTransitionOpts:h,flushSync:O}),C=r.Pop,T=!1,U=!1,O=!1,z=!1,q=!1,H=[],N=[]}async function Se(a,n,o){M&&M.abort(),M=null,C=a,z=!0===(o&&o.startUninterruptedRevalidation),function(e,t){if(D&&E){let r=Je(e,t);D[r]=E()}}(k.location,k.matches),T=!0===(o&&o.preventScrollReset),U=!0===(o&&o.enableViewTransition),O=!0===(o&&o.flushSync);let i=u||y,s=o&&o.overrideNavigation,l=p(i,n,v);if(!l){let e=pe(404,{pathname:n.pathname}),{matches:t,route:r}=fe(i);return Ke(),void De(n,{matches:t,loaderData:{},errors:{[r.id]:e}})}if(k.initialized&&!q&&function(e,t){if(e.pathname!==t.pathname||e.search!==t.search)return!1;if(""===e.hash)return""!==t.hash;if(e.hash===t.hash)return!0;if(""!==t.hash)return!0;return!1}(k.location,n)&&!(o&&o.submission&&Ee(o.submission.formMethod)))return void De(n,{matches:l});M=new AbortController;let f,m,g=ie(e.history,n,M.signal,o&&o.submission);if(o&&o.pendingError)m={[he(l).route.id]:o.pendingError};else if(o&&o.submission&&Ee(o.submission.formMethod)){let e=await async function(e,t,a,n,o){void 0===o&&(o={});let i;Ue(),we({navigation:je(t,a)},{flushSync:O});let s=Le(n,t);if(s.route.action||s.route.lazy){if(i=await oe("action",e,s,n,h,c,v),e.signal.aborted)return{shortCircuited:!0}}else i={type:d.error,error:pe(405,{method:e.method,pathname:t.pathname,routeId:s.route.id})};if(be(i)){let e;return e=o&&null!=o.replace?o.replace:i.location===k.location.pathname+k.location.search,await Pe(k,i,{submission:a,replace:e}),{shortCircuited:!0}}if(ge(i)){let e=he(n,s.route.id);return!0!==(o&&o.replace)&&(C=r.Push),{pendingActionData:{},pendingActionError:{[e.route.id]:i.error}}}if(ve(i))throw pe(400,{type:"defer-action"});return{pendingActionData:{[s.route.id]:i.data}}}(g,n,o.submission,l,{replace:o.replace});if(e.shortCircuited)return;f=e.pendingActionData,m=e.pendingActionError,s=Me(n,o.submission),g=new Request(g.url,{signal:g.signal})}let{shortCircuited:b,loaderData:w,errors:S}=await async function(r,a,n,o,i,s,l,c,d){let h=o||Me(a,i),f=i||s||Ae(h),p=u||y,[m,g]=te(e.history,k,n,f,a,q,H,N,ae,re,p,v,c,d);if(Ke((e=>!(n&&n.some((t=>t.route.id===e)))||m&&m.some((t=>t.route.id===e)))),G=++F,0===m.length&&0===g.length){let e=Ne();return De(a,t({matches:n,loaderData:{},errors:d||null},c?{actionData:c}:{},e?{fetchers:new Map(k.fetchers)}:{})),{shortCircuited:!0}}if(!z){g.forEach((e=>{let t=k.fetchers.get(e.key),r=ke(void 0,t?t.data:void 0);k.fetchers.set(e.key,r)}));let e=c||k.actionData;we(t({navigation:h},e?0===Object.keys(e).length?{actionData:null}:{actionData:e}:{},g.length>0?{fetchers:new Map(k.fetchers)}:{}),{flushSync:O})}g.forEach((e=>{B.has(e.key)&&qe(e.key),e.controller&&B.set(e.key,e.controller)}));let b=()=>g.forEach((e=>qe(e.key)));M&&M.signal.addEventListener("abort",b);let{results:w,loaderResults:D,fetcherResults:S}=await Te(k.matches,n,m,g,r);if(r.signal.aborted)return{shortCircuited:!0};M&&M.signal.removeEventListener("abort",b);g.forEach((e=>B.delete(e.key)));let E=me(w);if(E){if(E.idx>=m.length){let e=g[E.idx-m.length].key;re.add(e)}return await Pe(k,E.result,{replace:l}),{shortCircuited:!0}}let{loaderData:R,errors:x}=ue(k,n,m,D,d,g,S,le);le.forEach(((e,t)=>{e.subscribe((r=>{(r||e.done)&&le.delete(t)}))}));let P=Ne(),L=Be(G),A=P||L||g.length>0;return t({loaderData:R,errors:x},A?{fetchers:new Map(k.fetchers)}:{})}(g,n,l,s,o&&o.submission,o&&o.fetcherSubmission,o&&o.replace,f,m);b||(M=null,De(n,t({matches:l},f?{actionData:f}:{},{loaderData:w,errors:S})))}async function Pe(o,l,c){let{submission:u,fetcherSubmission:d,replace:h}=void 0===c?{}:c;l.revalidate&&(q=!0);let f=s(o.location,l.location,{_isRedirect:!0});if(n(f,"Expected a location on the redirect navigation"),i){let t=!1;if(l.reloadDocument)t=!0;else if(Y.test(l.location)){const r=e.history.createURL(l.location);t=r.origin!==a.location.origin||null==R(r.pathname,v)}if(t)return void(h?a.location.replace(l.location):a.location.assign(l.location))}M=null;let p=!0===h?r.Replace:r.Push,{formMethod:m,formAction:y,formEncType:g}=o.navigation;!u&&!d&&m&&y&&g&&(u=Ae(o.navigation));let b=u||d;if(W.has(l.status)&&b&&Ee(b.formMethod))await Se(p,f,{submission:t({},b,{formAction:l.location}),preventScrollReset:T});else{let e=Me(f,u);await Se(p,f,{overrideNavigation:e,fetcherSubmission:d,preventScrollReset:T})}}async function Te(t,r,a,n,o){let i=await Promise.all([...a.map((e=>oe("loader",o,e,r,h,c,v))),...n.map((t=>{if(t.matches&&t.match&&t.controller)return oe("loader",ie(e.history,t.path,t.controller.signal),t.match,t.matches,h,c,v);return{type:d.error,error:pe(404,{pathname:t.path})}}))]),s=i.slice(0,a.length),l=i.slice(a.length);return await Promise.all([Re(t,a,s,s.map((()=>o.signal)),!1,k.loaderData),Re(t,n.map((e=>e.match)),l,n.map((e=>e.controller?e.controller.signal:null)),!0)]),{results:i,loaderResults:s,fetcherResults:l}}function Ue(){q=!0,H.push(...Ke()),ae.forEach(((e,t)=>{B.has(t)&&(N.push(t),qe(t))}))}function Oe(e,t,r){k.fetchers.set(e,t),we({fetchers:new Map(k.fetchers)},{flushSync:r.flushSync})}function _e(e,t,r,a){let n=he(k.matches,t);ze(e),we({errors:{[n.route.id]:r},fetchers:new Map(k.fetchers)},{flushSync:a.flushSync})}function Ie(e){return g.v7_fetcherPersist&&(ne.set(e,(ne.get(e)||0)+1),se.has(e)&&se.delete(e)),k.fetchers.get(e)||K}function ze(e){let t=k.fetchers.get(e);!B.has(e)||t&&"loading"===t.state&&ee.has(e)||qe(e),ae.delete(e),ee.delete(e),re.delete(e),se.delete(e),k.fetchers.delete(e)}function qe(e){let t=B.get(e);n(t,"Expected fetch controller: "+e),t.abort(),B.delete(e)}function He(e){for(let t of e){let e=Ce(Ie(t).data);k.fetchers.set(t,e)}}function Ne(){let e=[],t=!1;for(let r of re){let a=k.fetchers.get(r);n(a,"Expected fetcher: "+r),"loading"===a.state&&(re.delete(r),e.push(r),t=!0)}return He(e),t}function Be(e){let t=[];for(let[r,a]of ee)if(a<e){let e=k.fetchers.get(r);n(e,"Expected fetcher: "+r),"loading"===e.state&&(qe(r),ee.delete(r),t.push(r))}return He(t),t.length>0}function Fe(e){k.blockers.delete(e),ce.delete(e)}function We(e,t){let r=k.blockers.get(e)||J;n("unblocked"===r.state&&"blocked"===t.state||"blocked"===r.state&&"blocked"===t.state||"blocked"===r.state&&"proceeding"===t.state||"blocked"===r.state&&"unblocked"===t.state||"proceeding"===r.state&&"unblocked"===t.state,"Invalid blocker state transition: "+r.state+" -> "+t.state);let a=new Map(k.blockers);a.set(e,t),we({blockers:a},{flushSync:!1})}function $e(e){let{currentLocation:t,nextLocation:r,historyAction:a}=e;if(0===ce.size)return;ce.size>1&&o(!1,"A router only supports one blocker at a time");let n=Array.from(ce.entries()),[i,s]=n[n.length-1],l=k.blockers.get(i);return l&&"proceeding"===l.state?void 0:s({currentLocation:t,nextLocation:r,historyAction:a})?i:void 0}function Ke(e){let t=[];return le.forEach(((r,a)=>{e&&!e(a)||(r.cancel(),t.push(a),le.delete(a))})),t}function Je(e,t){if(S){return S(e,t.map((e=>m(e,k.loaderData))))||e.key}return e.key}function Ye(e,t){if(D){let r=Je(e,t),a=D[r];if("number"==typeof a)return a}return null}return A={get basename(){return v},get state(){return k},get routes(){return y},get window(){return a},initialize:function(){if(b=e.history.listen((t=>{let{action:r,location:a,delta:n}=t;if(ye)return void(ye=!1);o(0===ce.size||null!=n,"You are trying to use a blocker on a POP navigation to a location that was not created by @remix-run/router. This will fail silently in production. This can happen if you are navigating outside the router via `window.history.pushState`/`window.location.hash` instead of using router navigation APIs. This can also happen if you are using createHashRouter and the user manually changes the URL.");let i=$e({currentLocation:k.location,nextLocation:a,historyAction:r});return i&&null!=n?(ye=!0,e.history.go(-1*n),void We(i,{state:"blocked",location:a,proceed(){We(i,{state:"proceeding",proceed:void 0,reset:void 0,location:a}),e.history.go(n)},reset(){let e=new Map(k.blockers);e.set(i,J),we({blockers:e},{flushSync:!1})}})):Se(r,a)})),i){!function(e,t){try{let r=e.sessionStorage.getItem(X);if(r){let e=JSON.parse(r);for(let[r,a]of Object.entries(e||{}))a&&Array.isArray(a)&&t.set(r,new Set(a||[]))}}catch(e){}}(a,_);let e=()=>function(e,t){if(t.size>0){let r={};for(let[e,a]of t)r[e]=[...a];try{e.sessionStorage.setItem(X,JSON.stringify(r))}catch(e){o(!1,"Failed to save applied view transitions in sessionStorage ("+e+").")}}}(a,_);a.addEventListener("pagehide",e),I=()=>a.removeEventListener("pagehide",e)}return k.initialized||Se(r.Pop,k.location),A},subscribe:function(e){return w.add(e),()=>w.delete(e)},enableScrollRestoration:function(e,t,r){if(D=e,E=t,S=r||null,!x&&k.navigation===$){x=!0;let e=Ye(k.location,k.matches);null!=e&&we({restoreScrollPosition:e},{flushSync:!1})}return()=>{D=null,E=null,S=null}},navigate:async function a(n,o){if("number"==typeof n)return void e.history.go(n);let i=Q(k.location,k.matches,v,g.v7_prependBasename,n,null==o?void 0:o.fromRouteId,null==o?void 0:o.relative),{path:l,submission:c,error:u}=Z(g.v7_normalizeFormMethod,!1,i,o),d=k.location,h=s(k.location,l,o&&o.state);h=t({},h,e.history.encodeLocation(h));let f=o&&null!=o.replace?o.replace:void 0,p=r.Push;!0===f?p=r.Replace:!1===f||null!=c&&Ee(c.formMethod)&&c.formAction===k.location.pathname+k.location.search&&(p=r.Replace);let m=o&&"preventScrollReset"in o?!0===o.preventScrollReset:void 0,y=!0===(o&&o.unstable_flushSync),b=$e({currentLocation:d,nextLocation:h,historyAction:p});if(!b)return await Se(p,h,{submission:c,pendingError:u,preventScrollReset:m,replace:o&&o.replace,enableViewTransition:o&&o.unstable_viewTransition,flushSync:y});We(b,{state:"blocked",location:h,proceed(){We(b,{state:"proceeding",proceed:void 0,reset:void 0,location:h}),a(n,o)},reset(){let e=new Map(k.blockers);e.set(b,J),we({blockers:e},{flushSync:y})}})},fetch:function(t,r,a,o){if(l)throw new Error("router.fetch() was called during the server render, but it shouldn't be. You are likely calling a useFetcher() method in the body of your component. Try moving it to a useEffect or a callback.");B.has(t)&&qe(t);let i=!0===(o&&o.unstable_flushSync),s=u||y,d=Q(k.location,k.matches,v,g.v7_prependBasename,a,r,null==o?void 0:o.relative),f=p(s,d,v);if(!f)return void _e(t,r,pe(404,{pathname:d}),{flushSync:i});let{path:m,submission:b,error:w}=Z(g.v7_normalizeFormMethod,!0,d,o);if(w)return void _e(t,r,w,{flushSync:i});let D=Le(f,m);T=!0===(o&&o.preventScrollReset),b&&Ee(b.formMethod)?async function(t,r,a,o,i,s,l){if(Ue(),ae.delete(t),!o.route.action&&!o.route.lazy){let e=pe(405,{method:l.formMethod,pathname:a,routeId:r});return void _e(t,r,e,{flushSync:s})}let d=k.fetchers.get(t);Oe(t,function(e,t){return{state:"submitting",formMethod:e.formMethod,formAction:e.formAction,formEncType:e.formEncType,formData:e.formData,json:e.json,text:e.text,data:t?t.data:void 0}}(l,d),{flushSync:s});let f=new AbortController,m=ie(e.history,a,f.signal,l);B.set(t,f);let g=F,b=await oe("action",m,o,i,h,c,v);if(m.signal.aborted)return void(B.get(t)===f&&B.delete(t));if(se.has(t))return void Oe(t,Ce(void 0),{flushSync:s});if(be(b))return B.delete(t),G>g?void Oe(t,Ce(void 0),{flushSync:s}):(re.add(t),Oe(t,ke(l),{flushSync:s}),Pe(k,b,{fetcherSubmission:l}));if(ge(b))return void _e(t,r,b.error,{flushSync:s});if(ve(b))throw pe(400,{type:"defer-action"});let w=k.navigation.location||k.location,D=ie(e.history,w,f.signal),S=u||y,E="idle"!==k.navigation.state?p(S,k.navigation.location,v):k.matches;n(E,"Didn't find any matches after fetcher action");let R=++F;ee.set(t,R);let x=ke(l,b.data);k.fetchers.set(t,x);let[P,L]=te(e.history,k,E,l,w,q,H,N,ae,re,S,v,{[o.route.id]:b.data},void 0);L.filter((e=>e.key!==t)).forEach((e=>{let t=e.key,r=k.fetchers.get(t),a=ke(void 0,r?r.data:void 0);k.fetchers.set(t,a),B.has(t)&&qe(t),e.controller&&B.set(t,e.controller)})),we({fetchers:new Map(k.fetchers)},{flushSync:s});let A=()=>L.forEach((e=>qe(e.key)));f.signal.addEventListener("abort",A);let{results:j,loaderResults:T,fetcherResults:U}=await Te(k.matches,E,P,L,D);if(f.signal.aborted)return;f.signal.removeEventListener("abort",A),ee.delete(t),B.delete(t),L.forEach((e=>B.delete(e.key)));let O=me(j);if(O){if(O.idx>=P.length){let e=L[O.idx-P.length].key;re.add(e)}return Pe(k,O.result)}let{loaderData:_,errors:I}=ue(k,k.matches,P,T,void 0,L,U,le);if(k.fetchers.has(t)){let e=Ce(b.data);k.fetchers.set(t,e)}Be(R),"loading"===k.navigation.state&&R>G?(n(C,"Expected pending action"),M&&M.abort(),De(k.navigation.location,{matches:E,loaderData:_,errors:I,fetchers:new Map(k.fetchers)})):(we({errors:I,loaderData:de(k.loaderData,_,E,I),fetchers:new Map(k.fetchers)},{flushSync:s}),q=!1)}(t,r,m,D,f,i,b):(ae.set(t,{routeId:r,path:m}),async function(t,r,a,o,i,s,l){let u=k.fetchers.get(t);Oe(t,ke(l,u?u.data:void 0),{flushSync:s});let d=new AbortController,f=ie(e.history,a,d.signal);B.set(t,d);let p=F,m=await oe("loader",f,o,i,h,c,v);ve(m)&&(m=await xe(m,f.signal,!0)||m);B.get(t)===d&&B.delete(t);if(f.signal.aborted)return;if(se.has(t))return void Oe(t,Ce(void 0),{flushSync:s});if(be(m))return G>p?void Oe(t,Ce(void 0),{flushSync:s}):(re.add(t),void await Pe(k,m));if(ge(m))return void _e(t,r,m.error,{flushSync:s});n(!ve(m),"Unhandled fetcher deferred data"),Oe(t,Ce(m.data),{flushSync:s})}(t,r,m,D,f,i,b))},revalidate:function(){Ue(),we({revalidation:"loading"},{flushSync:!1}),"submitting"!==k.navigation.state&&("idle"!==k.navigation.state?Se(C||k.historyAction,k.navigation.location,{overrideNavigation:k.navigation}):Se(k.historyAction,k.location,{startUninterruptedRevalidation:!0}))},createHref:t=>e.history.createHref(t),encodeLocation:t=>e.history.encodeLocation(t),getFetcher:Ie,deleteFetcher:function(e){if(g.v7_fetcherPersist){let t=(ne.get(e)||0)-1;t<=0?(ne.delete(e),se.add(e)):ne.set(e,t)}else ze(e);we({fetchers:new Map(k.fetchers)},{flushSync:!1})},dispose:function(){b&&b(),I&&I(),w.clear(),M&&M.abort(),k.fetchers.forEach(((e,t)=>ze(t))),k.blockers.forEach(((e,t)=>Fe(t)))},getBlocker:function(e,t){let r=k.blockers.get(e)||J;return ce.get(e)!==t&&ce.set(e,t),r},deleteBlocker:Fe,_internalFetchControllers:B,_internalActiveDeferreds:le,_internalSetRoutes:function(e){h={},u=f(e,c,void 0,h)}},A},e.createStaticHandler=function(e,r){n(e.length>0,"You must provide a non-empty routes array to createStaticHandler");let a,o={},i=(r?r.basename:null)||"/";if(null!=r&&r.mapRouteProperties)a=r.mapRouteProperties;else if(null!=r&&r.detectErrorBoundary){let e=r.detectErrorBoundary;a=t=>({hasErrorBoundary:e(t)})}else a=V;let c=f(e,a,void 0,o);async function u(e,r,s,l,c){n(e.signal,"query()/queryRoute() requests must contain an AbortController signal");try{if(Ee(e.method.toLowerCase())){let n=await async function(e,r,n,s,l){let c;if(n.route.action||n.route.lazy){if(c=await oe("action",e,n,r,o,a,i,{isStaticRequest:!0,isRouteRequest:l,requestContext:s}),e.signal.aborted){throw new Error((l?"queryRoute":"query")+"() call aborted: "+e.method+" "+e.url)}}else{let t=pe(405,{method:e.method,pathname:new URL(e.url).pathname,routeId:n.route.id});if(l)throw t;c={type:d.error,error:t}}if(be(c))throw new Response(null,{status:c.status,headers:{Location:c.location}});if(ve(c)){let e=pe(400,{type:"defer-action"});if(l)throw e;c={type:d.error,error:e}}if(l){if(ge(c))throw c.error;return{matches:[n],loaderData:{},actionData:{[n.route.id]:c.data},errors:null,statusCode:200,loaderHeaders:{},actionHeaders:{},activeDeferreds:null}}if(ge(c)){let a=he(r,n.route.id);return t({},await h(e,r,s,void 0,{[a.route.id]:c.error}),{statusCode:z(c.error)?c.error.status:500,actionData:null,actionHeaders:t({},c.headers?{[n.route.id]:c.headers}:{})})}let u=new Request(e.url,{headers:e.headers,redirect:e.redirect,signal:e.signal});return t({},await h(u,r,s),c.statusCode?{statusCode:c.statusCode}:{},{actionData:{[n.route.id]:c.data},actionHeaders:t({},c.headers?{[n.route.id]:c.headers}:{})})}(e,s,c||Le(s,r),l,null!=c);return n}let n=await h(e,s,l,c);return De(n)?n:t({},n,{actionData:null,actionHeaders:{}})}catch(e){if((u=e)&&De(u.response)&&(u.type===d.data||u.type===d.error)){if(e.type===d.error)throw e.response;return e.response}if(function(e){if(!De(e))return!1;let t=e.status,r=e.headers.get("Location");return t>=300&&t<=399&&null!=r}(e))return e;throw e}var u}async function h(e,r,n,s,l){let c=null!=s;if(c&&(null==s||!s.route.loader)&&(null==s||!s.route.lazy))throw pe(400,{method:e.method,pathname:new URL(e.url).pathname,routeId:null==s?void 0:s.route.id});let u=(s?[s]:ee(r,Object.keys(l||{})[0])).filter((e=>e.route.loader||e.route.lazy));if(0===u.length)return{matches:r,loaderData:r.reduce(((e,t)=>Object.assign(e,{[t.route.id]:null})),{}),errors:l||null,statusCode:200,loaderHeaders:{},activeDeferreds:null};let d=await Promise.all([...u.map((t=>oe("loader",e,t,r,o,a,i,{isStaticRequest:!0,isRouteRequest:c,requestContext:n})))]);if(e.signal.aborted){throw new Error((c?"queryRoute":"query")+"() call aborted: "+e.method+" "+e.url)}let h=new Map,f=ce(r,u,d,l,h),p=new Set(u.map((e=>e.route.id)));return r.forEach((e=>{p.has(e.route.id)||(f.loaderData[e.route.id]=null)})),t({},f,{matches:r,activeDeferreds:h.size>0?Object.fromEntries(h.entries()):null})}return{dataRoutes:c,query:async function(e,r){let{requestContext:a}=void 0===r?{}:r,n=new URL(e.url),o=e.method,d=s("",l(n),null,"default"),h=p(c,d,i);if(!Se(o)&&"HEAD"!==o){let e=pe(405,{method:o}),{matches:t,route:r}=fe(c);return{basename:i,location:d,matches:t,loaderData:{},actionData:null,errors:{[r.id]:e},statusCode:e.status,loaderHeaders:{},actionHeaders:{},activeDeferreds:null}}if(!h){let e=pe(404,{pathname:d.pathname}),{matches:t,route:r}=fe(c);return{basename:i,location:d,matches:t,loaderData:{},actionData:null,errors:{[r.id]:e},statusCode:e.status,loaderHeaders:{},actionHeaders:{},activeDeferreds:null}}let f=await u(e,d,h,a);return De(f)?f:t({location:d,basename:i},f)},queryRoute:async function(e,t){let{routeId:r,requestContext:a}=void 0===t?{}:t,n=new URL(e.url),o=e.method,d=s("",l(n),null,"default"),h=p(c,d,i);if(!Se(o)&&"HEAD"!==o&&"OPTIONS"!==o)throw pe(405,{method:o});if(!h)throw pe(404,{pathname:d.pathname});let f=r?h.find((e=>e.route.id===r)):Le(h,d);if(r&&!f)throw pe(403,{pathname:d.pathname,routeId:r});if(!f)throw pe(404,{pathname:d.pathname});let m=await u(e,d,h,a,f);if(De(m))return m;let y=m.errors?Object.values(m.errors)[0]:void 0;if(void 0!==y)throw y;if(m.actionData)return Object.values(m.actionData)[0];if(m.loaderData){var v;let e=Object.values(m.loaderData)[0];return null!=(v=m.activeDeferreds)&&v[f.route.id]&&(e[G]=m.activeDeferreds[f.route.id]),e}}}},e.defer=function(e,t){return void 0===t&&(t={}),new U(e,"number"==typeof t?{status:t}:t)},e.generatePath=function(e,t){void 0===t&&(t={});let r=e;r.endsWith("*")&&"*"!==r&&!r.endsWith("/*")&&(o(!1,'Route path "'+r+'" will be treated as if it were "'+r.replace(/\*$/,"/*")+'" because the `*` character must always follow a `/` in the pattern. To get rid of this warning, please change the route path to "'+r.replace(/\*$/,"/*")+'".'),r=r.replace(/\*$/,"/*"));const a=r.startsWith("/")?"/":"",i=e=>null==e?"":"string"==typeof e?e:String(e);return a+r.split(/\/+/).map(((e,r,a)=>{if(r===a.length-1&&"*"===e){return i(t["*"])}const o=e.match(/^:(\w+)(\??)$/);if(o){const[,e,r]=o;let a=t[e];return n("?"===r||null!=a,'Missing ":'+e+'" param'),i(a)}return e.replace(/\?$/g,"")})).filter((e=>!!e)).join("/")},e.getStaticContextFromError=function(e,r,a){return t({},r,{statusCode:500,errors:{[r._deepestRenderedBoundaryId||e[0].id]:a}})},e.getToPathname=function(e){return""===e||""===e.pathname?"/":"string"==typeof e?c(e).pathname:e.pathname},e.isDeferredData=we,e.isRouteErrorResponse=z,e.joinPaths=M,e.json=function(e,r){void 0===r&&(r={});let a="number"==typeof r?{status:r}:r,n=new Headers(a.headers);return n.has("Content-Type")||n.set("Content-Type","application/json; charset=utf-8"),new Response(JSON.stringify(e),t({},a,{headers:n}))},e.matchPath=S,e.matchRoutes=p,e.normalizePathname=j,e.parsePath=c,e.redirect=_,e.redirectDocument=(e,t)=>{let r=_(e,t);return r.headers.set("X-Remix-Reload-Document","true"),r},e.resolvePath=x,e.resolveTo=A,e.stripBasename=R,Object.defineProperty(e,"__esModule",{value:!0})}));
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).RemixRouter={})}(this,(function(e){"use strict";function t(){return t=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var a in r)Object.prototype.hasOwnProperty.call(r,a)&&(e[a]=r[a])}return e},t.apply(this,arguments)}let r=function(e){return e.Pop="POP",e.Push="PUSH",e.Replace="REPLACE",e}({});const a="popstate";function n(e,t){if(!1===e||null==e)throw new Error(t)}function o(e,t){if(!e){"undefined"!=typeof console&&console.warn(t);try{throw new Error(t)}catch(e){}}}function i(e,t){return{usr:e.state,key:e.key,idx:t}}function s(e,r,a,n){return void 0===a&&(a=null),t({pathname:"string"==typeof e?e:e.pathname,search:"",hash:""},"string"==typeof r?u(r):r,{state:a,key:r&&r.key||n||Math.random().toString(36).substr(2,8)})}function l(e){let{pathname:t="/",search:r="",hash:a=""}=e;return r&&"?"!==r&&(t+="?"===r.charAt(0)?r:"?"+r),a&&"#"!==a&&(t+="#"===a.charAt(0)?a:"#"+a),t}function u(e){let t={};if(e){let r=e.indexOf("#");r>=0&&(t.hash=e.substr(r),e=e.substr(0,r));let a=e.indexOf("?");a>=0&&(t.search=e.substr(a),e=e.substr(0,a)),e&&(t.pathname=e)}return t}function c(e,o,u,c){void 0===c&&(c={});let{window:d=document.defaultView,v5Compat:h=!1}=c,f=d.history,p=r.Pop,m=null,y=v();function v(){return(f.state||{idx:null}).idx}function g(){p=r.Pop;let e=v(),t=null==e?null:e-y;y=e,m&&m({action:p,location:w.location,delta:t})}function b(e){let t="null"!==d.location.origin?d.location.origin:d.location.href,r="string"==typeof e?e:l(e);return r=r.replace(/ $/,"%20"),n(t,"No window.location.(origin|href) available to create URL for href: "+r),new URL(r,t)}null==y&&(y=0,f.replaceState(t({},f.state,{idx:y}),""));let w={get action(){return p},get location(){return e(d,f)},listen(e){if(m)throw new Error("A history only accepts one active listener");return d.addEventListener(a,g),m=e,()=>{d.removeEventListener(a,g),m=null}},createHref:e=>o(d,e),createURL:b,encodeLocation(e){let t=b(e);return{pathname:t.pathname,search:t.search,hash:t.hash}},push:function(e,t){p=r.Push;let a=s(w.location,e,t);u&&u(a,e),y=v()+1;let n=i(a,y),o=w.createHref(a);try{f.pushState(n,"",o)}catch(e){if(e instanceof DOMException&&"DataCloneError"===e.name)throw e;d.location.assign(o)}h&&m&&m({action:p,location:w.location,delta:1})},replace:function(e,t){p=r.Replace;let a=s(w.location,e,t);u&&u(a,e),y=v();let n=i(a,y),o=w.createHref(a);f.replaceState(n,"",o),h&&m&&m({action:p,location:w.location,delta:0})},go:e=>f.go(e)};return w}let d=function(e){return e.data="data",e.deferred="deferred",e.redirect="redirect",e.error="error",e}({});const h=new Set(["lazy","caseSensitive","path","id","index","children"]);function f(e,r,a,o){return void 0===a&&(a=[]),void 0===o&&(o={}),e.map(((e,i)=>{let s=[...a,String(i)],l="string"==typeof e.id?e.id:s.join("-");if(n(!0!==e.index||!e.children,"Cannot specify children on an index route"),n(!o[l],'Found a route id collision on id "'+l+"\". Route id's must be globally unique within Data Router usages"),function(e){return!0===e.index}(e)){let a=t({},e,r(e),{id:l});return o[l]=a,a}{let a=t({},e,r(e),{id:l,children:void 0});return o[l]=a,e.children&&(a.children=f(e.children,r,s,o)),a}}))}function p(e,t,r){return void 0===r&&(r="/"),m(e,t,r,!1)}function m(e,t,r,a){let n=P(("string"==typeof t?u(t):t).pathname||"/",r);if(null==n)return null;let o=v(e);!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,r)=>e===t[r]))?e[e.length-1]-t[t.length-1]:0}(e.routesMeta.map((e=>e.childrenIndex)),t.routesMeta.map((e=>e.childrenIndex)))))}(o);let i=null;for(let e=0;null==i&&e<o.length;++e){let t=E(n);i=S(o[e],t,a)}return i}function y(e,t){let{route:r,pathname:a,params:n}=e;return{id:r.id,pathname:a,params:n,data:t[r.id],handle:r.handle}}function v(e,t,r,a){void 0===t&&(t=[]),void 0===r&&(r=[]),void 0===a&&(a="");let o=(e,o,i)=>{let s={relativePath:void 0===i?e.path||"":i,caseSensitive:!0===e.caseSensitive,childrenIndex:o,route:e};s.relativePath.startsWith("/")&&(n(s.relativePath.startsWith(a),'Absolute route path "'+s.relativePath+'" nested under path "'+a+'" is not valid. An absolute child route path must start with the combined path of all its parent routes.'),s.relativePath=s.relativePath.slice(a.length));let l=k([a,s.relativePath]),u=r.concat(s);e.children&&e.children.length>0&&(n(!0!==e.index,'Index routes must not have child routes. Please remove all child routes from route path "'+l+'".'),v(e.children,t,u,l)),(null!=e.path||e.index)&&t.push({path:l,score:D(l,e.index),routesMeta:u})};return e.forEach(((e,t)=>{var r;if(""!==e.path&&null!=(r=e.path)&&r.includes("?"))for(let r of g(e.path))o(e,t,r);else o(e,t)})),t}function g(e){let t=e.split("/");if(0===t.length)return[];let[r,...a]=t,n=r.endsWith("?"),o=r.replace(/\?$/,"");if(0===a.length)return n?[o,""]:[o];let i=g(a.join("/")),s=[];return s.push(...i.map((e=>""===e?o:[o,e].join("/")))),n&&s.push(...i),s.map((t=>e.startsWith("/")&&""===t?"/":t))}const b=/^:[\w-]+$/,w=e=>"*"===e;function D(e,t){let r=e.split("/"),a=r.length;return r.some(w)&&(a+=-2),t&&(a+=2),r.filter((e=>!w(e))).reduce(((e,t)=>e+(b.test(t)?3:""===t?1:10)),a)}function S(e,t,r){void 0===r&&(r=!1);let{routesMeta:a}=e,n={},o="/",i=[];for(let e=0;e<a.length;++e){let s=a[e],l=e===a.length-1,u="/"===o?t:t.slice(o.length)||"/",c=R({path:s.relativePath,caseSensitive:s.caseSensitive,end:l},u),d=s.route;if(!c&&l&&r&&!a[a.length-1].route.index&&(c=R({path:s.relativePath,caseSensitive:s.caseSensitive,end:!1},u)),!c)return null;Object.assign(n,c.params),i.push({params:n,pathname:k([o,c.pathname]),pathnameBase:C(k([o,c.pathnameBase])),route:d}),"/"!==c.pathnameBase&&(o=k([o,c.pathnameBase]))}return i}function R(e,t){"string"==typeof e&&(e={path:e,caseSensitive:!1,end:!0});let[r,a]=function(e,t,r){void 0===t&&(t=!1);void 0===r&&(r=!0);o("*"===e||!e.endsWith("*")||e.endsWith("/*"),'Route path "'+e+'" will be treated as if it were "'+e.replace(/\*$/,"/*")+'" because the `*` character must always follow a `/` in the pattern. To get rid of this warning, please change the route path to "'+e.replace(/\*$/,"/*")+'".');let a=[],n="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,((e,t,r)=>(a.push({paramName:t,isOptional:null!=r}),r?"/?([^\\/]+)?":"/([^\\/]+)")));e.endsWith("*")?(a.push({paramName:"*"}),n+="*"===e||"/*"===e?"(.*)$":"(?:\\/(.+)|\\/*)$"):r?n+="\\/*$":""!==e&&"/"!==e&&(n+="(?:(?=\\/|$))");return[new RegExp(n,t?void 0:"i"),a]}(e.path,e.caseSensitive,e.end),n=t.match(r);if(!n)return null;let i=n[0],s=i.replace(/(.)\/+$/,"$1"),l=n.slice(1);return{params:a.reduce(((e,t,r)=>{let{paramName:a,isOptional:n}=t;if("*"===a){let e=l[r]||"";s=i.slice(0,i.length-e.length).replace(/(.)\/+$/,"$1")}const o=l[r];return e[a]=n&&!o?void 0:(o||"").replace(/%2F/g,"/"),e}),{}),pathname:i,pathnameBase:s,pattern:e}}function E(e){try{return e.split("/").map((e=>decodeURIComponent(e).replace(/\//g,"%2F"))).join("/")}catch(t){return o(!1,'The URL path "'+e+'" could not be decoded because it is is a malformed URL segment. This is probably due to a bad percent encoding ('+t+")."),e}}function P(e,t){if("/"===t)return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let r=t.endsWith("/")?t.length-1:t.length,a=e.charAt(r);return a&&"/"!==a?null:e.slice(r)||"/"}function x(e,t){void 0===t&&(t="/");let{pathname:r,search:a="",hash:n=""}="string"==typeof e?u(e):e,o=r?r.startsWith("/")?r:function(e,t){let r=t.replace(/\/+$/,"").split("/");return e.split("/").forEach((e=>{".."===e?r.length>1&&r.pop():"."!==e&&r.push(e)})),r.length>1?r.join("/"):"/"}(r,t):t;return{pathname:o,search:_(a),hash:T(n)}}function A(e,t,r,a){return"Cannot include a '"+e+"' character in a manually specified `to."+t+"` field ["+JSON.stringify(a)+"]. Please separate it out to the `to."+r+'` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.'}function L(e){return e.filter(((e,t)=>0===t||e.route.path&&e.route.path.length>0))}function M(e,t){let r=L(e);return t?r.map(((e,t)=>t===r.length-1?e.pathname:e.pathnameBase)):r.map((e=>e.pathnameBase))}function j(e,r,a,o){let i;void 0===o&&(o=!1),"string"==typeof e?i=u(e):(i=t({},e),n(!i.pathname||!i.pathname.includes("?"),A("?","pathname","search",i)),n(!i.pathname||!i.pathname.includes("#"),A("#","pathname","hash",i)),n(!i.search||!i.search.includes("#"),A("#","search","hash",i)));let s,l=""===e||""===i.pathname,c=l?"/":i.pathname;if(null==c)s=a;else{let e=r.length-1;if(!o&&c.startsWith("..")){let t=c.split("/");for(;".."===t[0];)t.shift(),e-=1;i.pathname=t.join("/")}s=e>=0?r[e]:"/"}let d=x(i,s),h=c&&"/"!==c&&c.endsWith("/"),f=(l||"."===c)&&a.endsWith("/");return d.pathname.endsWith("/")||!h&&!f||(d.pathname+="/"),d}const k=e=>e.join("/").replace(/\/\/+/g,"/"),C=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),_=e=>e&&"?"!==e?e.startsWith("?")?e:"?"+e:"",T=e=>e&&"#"!==e?e.startsWith("#")?e:"#"+e:"";class O{constructor(e,t){this.type="DataWithResponseInit",this.data=e,this.init=t||null}}class U extends Error{}class I{constructor(e,t){let r;this.pendingKeysSet=new Set,this.subscribers=new Set,this.deferredKeys=[],n(e&&"object"==typeof e&&!Array.isArray(e),"defer() only accepts plain objects"),this.abortPromise=new Promise(((e,t)=>r=t)),this.controller=new AbortController;let a=()=>r(new U("Deferred data aborted"));this.unlistenAbortSignal=()=>this.controller.signal.removeEventListener("abort",a),this.controller.signal.addEventListener("abort",a),this.data=Object.entries(e).reduce(((e,t)=>{let[r,a]=t;return Object.assign(e,{[r]:this.trackPromise(r,a)})}),{}),this.done&&this.unlistenAbortSignal(),this.init=t}trackPromise(e,t){if(!(t instanceof Promise))return t;this.deferredKeys.push(e),this.pendingKeysSet.add(e);let r=Promise.race([t,this.abortPromise]).then((t=>this.onSettle(r,e,void 0,t)),(t=>this.onSettle(r,e,t)));return r.catch((()=>{})),Object.defineProperty(r,"_tracked",{get:()=>!0}),r}onSettle(e,t,r,a){if(this.controller.signal.aborted&&r instanceof U)return this.unlistenAbortSignal(),Object.defineProperty(e,"_error",{get:()=>r}),Promise.reject(r);if(this.pendingKeysSet.delete(t),this.done&&this.unlistenAbortSignal(),void 0===r&&void 0===a){let r=new Error('Deferred data for key "'+t+'" resolved/rejected with `undefined`, you must resolve/reject with a value or `null`.');return Object.defineProperty(e,"_error",{get:()=>r}),this.emit(!1,t),Promise.reject(r)}return void 0===a?(Object.defineProperty(e,"_error",{get:()=>r}),this.emit(!1,t),Promise.reject(r)):(Object.defineProperty(e,"_data",{get:()=>a}),this.emit(!1,t),a)}emit(e,t){this.subscribers.forEach((r=>r(e,t)))}subscribe(e){return this.subscribers.add(e),()=>this.subscribers.delete(e)}cancel(){this.controller.abort(),this.pendingKeysSet.forEach(((e,t)=>this.pendingKeysSet.delete(t))),this.emit(!0)}async resolveData(e){let t=!1;if(!this.done){let r=()=>this.cancel();e.addEventListener("abort",r),t=await new Promise((t=>{this.subscribe((a=>{e.removeEventListener("abort",r),(a||this.done)&&t(a)}))}))}return t}get done(){return 0===this.pendingKeysSet.size}get unwrappedData(){return n(null!==this.data&&this.done,"Can only unwrap data on initialized and settled deferreds"),Object.entries(this.data).reduce(((e,t)=>{let[r,a]=t;return Object.assign(e,{[r]:H(a)})}),{})}get pendingKeys(){return Array.from(this.pendingKeysSet)}}function H(e){if(!function(e){return e instanceof Promise&&!0===e._tracked}(e))return e;if(e._error)throw e._error;return e._data}const F=function(e,r){void 0===r&&(r=302);let a=r;"number"==typeof a?a={status:a}:void 0===a.status&&(a.status=302);let n=new Headers(a.headers);return n.set("Location",e),new Response(null,t({},a,{headers:n}))};class z{constructor(e,t,r,a){void 0===a&&(a=!1),this.status=e,this.statusText=t||"",this.internal=a,r instanceof Error?(this.data=r.toString(),this.error=r):this.data=r}}function N(e){return null!=e&&"number"==typeof e.status&&"string"==typeof e.statusText&&"boolean"==typeof e.internal&&"data"in e}const B=["post","put","patch","delete"],W=new Set(B),$=["get",...B],q=new Set($),K=new Set([301,302,303,307,308]),Y=new Set([307,308]),J={state:"idle",location:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0},V={state:"idle",data:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0},X={state:"unblocked",proceed:void 0,reset:void 0,location:void 0},G=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,Q=e=>({hasErrorBoundary:Boolean(e.hasErrorBoundary)}),Z="remix-router-transitions";const ee=Symbol("deferred");function te(e,t,r){if(r.v7_throwAbortReason&&void 0!==e.signal.reason)throw e.signal.reason;throw new Error((t?"queryRoute":"query")+"() call aborted: "+e.method+" "+e.url)}function re(e,t,r,a,n,o,i,s){let u,c;if(i){u=[];for(let e of t)if(u.push(e),e.route.id===i){c=e;break}}else u=t,c=t[t.length-1];let d=j(n||".",M(u,o),P(e.pathname,r)||e.pathname,"path"===s);return null==n&&(d.search=e.search,d.hash=e.hash),null!=n&&""!==n&&"."!==n||!c||!c.route.index||Fe(d.search)||(d.search=d.search?d.search.replace(/^\?/,"?index&"):"?index"),a&&"/"!==r&&(d.pathname="/"===d.pathname?r:k([r,d.pathname])),l(d)}function ae(e,t,r,a){if(!a||!function(e){return null!=e&&("formData"in e&&null!=e.formData||"body"in e&&void 0!==e.body)}(a))return{path:r};if(a.formMethod&&!Te(a.formMethod))return{path:r,error:Ee(405,{method:a.formMethod})};let o,i,s=()=>({path:r,error:Ee(400,{type:"invalid-body"})}),c=a.formMethod||"get",d=e?c.toUpperCase():c.toLowerCase(),h=xe(r);if(void 0!==a.body){if("text/plain"===a.formEncType){if(!Oe(d))return s();let e="string"==typeof a.body?a.body:a.body instanceof FormData||a.body instanceof URLSearchParams?Array.from(a.body.entries()).reduce(((e,t)=>{let[r,a]=t;return""+e+r+"="+a+"\n"}),""):String(a.body);return{path:r,submission:{formMethod:d,formAction:h,formEncType:a.formEncType,formData:void 0,json:void 0,text:e}}}if("application/json"===a.formEncType){if(!Oe(d))return s();try{let e="string"==typeof a.body?JSON.parse(a.body):a.body;return{path:r,submission:{formMethod:d,formAction:h,formEncType:a.formEncType,formData:void 0,json:e,text:void 0}}}catch(e){return s()}}}if(n("function"==typeof FormData,"FormData is not available in this environment"),a.formData)o=ye(a.formData),i=a.formData;else if(a.body instanceof FormData)o=ye(a.body),i=a.body;else if(a.body instanceof URLSearchParams)o=a.body,i=ve(o);else if(null==a.body)o=new URLSearchParams,i=new FormData;else try{o=new URLSearchParams(a.body),i=ve(o)}catch(e){return s()}let f={formMethod:d,formAction:h,formEncType:a&&a.formEncType||"application/x-www-form-urlencoded",formData:i,json:void 0,text:void 0};if(Oe(f.formMethod))return{path:r,submission:f};let p=u(r);return t&&p.search&&Fe(p.search)&&o.append("index",""),p.search="?"+o,{path:l(p),submission:f}}function ne(e,t){let r=e;if(t){let a=e.findIndex((e=>e.route.id===t));a>=0&&(r=e.slice(0,a))}return r}function oe(e,r,a,n,o,i,s,l,u,c,d,h,f,m,y,v){let g=v?Me(v[1])?v[1].error:v[1].data:void 0,b=e.createURL(r.location),w=e.createURL(o),D=v&&Me(v[1])?v[0]:void 0,S=D?ne(a,D):a,R=v?v[1].statusCode:void 0,E=s&&R&&R>=400,P=S.filter(((e,a)=>{let{route:o}=e;if(o.lazy)return!0;if(null==o.loader)return!1;if(i)return!("function"==typeof o.loader&&!o.loader.hydrate)||void 0===r.loaderData[o.id]&&(!r.errors||void 0===r.errors[o.id]);if(function(e,t,r){let a=!t||r.route.id!==t.route.id,n=void 0===e[r.route.id];return a||n}(r.loaderData,r.matches[a],e)||u.some((t=>t===e.route.id)))return!0;let s=r.matches[a],c=e;return se(e,t({currentUrl:b,currentParams:s.params,nextUrl:w,nextParams:c.params},n,{actionResult:g,actionStatus:R,defaultShouldRevalidate:!E&&(l||b.pathname+b.search===w.pathname+w.search||b.search!==w.search||ie(s,c))}))})),x=[];return h.forEach(((e,o)=>{if(i||!a.some((t=>t.route.id===e.routeId))||d.has(o))return;let s=p(m,e.path,y);if(!s)return void x.push({key:o,routeId:e.routeId,path:e.path,matches:null,match:null,controller:null});let u=r.fetchers.get(o),h=ze(s,e.path),v=!1;f.has(o)?v=!1:c.has(o)?(c.delete(o),v=!0):v=u&&"idle"!==u.state&&void 0===u.data?l:se(h,t({currentUrl:b,currentParams:r.matches[r.matches.length-1].params,nextUrl:w,nextParams:a[a.length-1].params},n,{actionResult:g,actionStatus:R,defaultShouldRevalidate:!E&&l})),v&&x.push({key:o,routeId:e.routeId,path:e.path,matches:s,match:h,controller:new AbortController})})),[P,x]}function ie(e,t){let r=e.route.path;return e.pathname!==t.pathname||null!=r&&r.endsWith("*")&&e.params["*"]!==t.params["*"]}function se(e,t){if(e.route.shouldRevalidate){let r=e.route.shouldRevalidate(t);if("boolean"==typeof r)return r}return t.defaultShouldRevalidate}async function le(e,t,r,a,n,o,i,s){let l=[t,...r.map((e=>e.route.id))].join("-");try{let c=i.get(l);c||(c=e({path:t,matches:r,patch:(e,t)=>{s.aborted||ue(e,t,a,n,o)}}),i.set(l,c)),c&&("object"==typeof(u=c)&&null!=u&&"then"in u)&&await c}finally{i.delete(l)}var u}function ue(e,t,r,a,o){var i;let s;if(e){let t=a[e];n(t,"No route found to patch children into: routeId = "+e),t.children||(t.children=[]),s=t.children}else s=r;let l=f(t.filter((e=>!s.some((t=>e.index===t.index&&e.path===t.path&&e.caseSensitive===t.caseSensitive)))),o,[e||"_","patch",String((null==(i=s)?void 0:i.length)||"0")],a);s.push(...l)}async function ce(e){let{matches:t}=e,r=t.filter((e=>e.shouldLoad));return(await Promise.all(r.map((e=>e.resolve())))).reduce(((e,t,a)=>Object.assign(e,{[r[a].route.id]:t})),{})}async function de(e,r,a,i,s,l,u,c,f,p){let m=l.map((e=>e.route.lazy?async function(e,r,a){if(!e.lazy)return;let i=await e.lazy();if(!e.lazy)return;let s=a[e.id];n(s,"No route found in manifest");let l={};for(let e in i){let t=void 0!==s[e]&&"hasErrorBoundary"!==e;o(!t,'Route "'+s.id+'" has a static property "'+e+'" defined but its lazy function is also returning a value for this property. The lazy route property "'+e+'" will be ignored.'),t||h.has(e)||(l[e]=i[e])}Object.assign(s,l),Object.assign(s,t({},r(s),{lazy:void 0}))}(e.route,f,c):void 0)),y=l.map(((e,a)=>{let o=m[a],l=s.some((t=>t.route.id===e.route.id));return t({},e,{shouldLoad:l,resolve:async t=>(t&&"GET"===i.method&&(e.route.lazy||e.route.loader)&&(l=!0),l?async function(e,t,r,a,o,i){let s,l,u=a=>{let n,s=new Promise(((e,t)=>n=t));l=()=>n(),t.signal.addEventListener("abort",l);let u=n=>"function"!=typeof a?Promise.reject(new Error('You cannot call the handler for a route which defines a boolean "'+e+'" [routeId: '+r.route.id+"]")):a({request:t,params:r.params,context:i},...void 0!==n?[n]:[]),c=(async()=>{try{return{type:"data",result:await(o?o((e=>u(e))):u())}}catch(e){return{type:"error",result:e}}})();return Promise.race([c,s])};try{let o=r.route[e];if(a)if(o){let e,[t]=await Promise.all([u(o).catch((t=>{e=t})),a]);if(void 0!==e)throw e;s=t}else{if(await a,o=r.route[e],!o){if("action"===e){let e=new URL(t.url),a=e.pathname+e.search;throw Ee(405,{method:t.method,pathname:a,routeId:r.route.id})}return{type:d.data,result:void 0}}s=await u(o)}else{if(!o){let e=new URL(t.url);throw Ee(404,{pathname:e.pathname+e.search})}s=await u(o)}n(void 0!==s.result,"You defined "+("action"===e?"an action":"a loader")+' for route "'+r.route.id+"\" but didn't return anything from your `"+e+"` function. Please return a value or `null`.")}catch(e){return{type:d.error,result:e}}finally{l&&t.signal.removeEventListener("abort",l)}return s}(r,i,e,o,t,p):Promise.resolve({type:d.data,result:void 0}))})})),v=await e({matches:y,request:i,params:l[0].params,fetcherKey:u,context:p});try{await Promise.all(m)}catch(e){}return v}async function he(e){let{result:t,type:r}=e;if(_e(t)){let e;try{let r=t.headers.get("Content-Type");e=r&&/\bapplication\/json\b/.test(r)?null==t.body?null:await t.json():await t.text()}catch(e){return{type:d.error,error:e}}return r===d.error?{type:d.error,error:new z(t.status,t.statusText,e),statusCode:t.status,headers:t.headers}:{type:d.data,data:e,statusCode:t.status,headers:t.headers}}if(r===d.error){if(ke(t)){var a,n;if(t.data instanceof Error)return{type:d.error,error:t.data,statusCode:null==(n=t.init)?void 0:n.status};t=new z((null==(a=t.init)?void 0:a.status)||500,void 0,t.data)}return{type:d.error,error:t,statusCode:N(t)?t.status:void 0}}var o,i,s,l;return Ce(t)?{type:d.deferred,deferredData:t,statusCode:null==(o=t.init)?void 0:o.status,headers:(null==(i=t.init)?void 0:i.headers)&&new Headers(t.init.headers)}:ke(t)?{type:d.data,data:t.data,statusCode:null==(s=t.init)?void 0:s.status,headers:null!=(l=t.init)&&l.headers?new Headers(t.init.headers):void 0}:{type:d.data,data:t}}function fe(e,t,r,a,o,i){let s=e.headers.get("Location");if(n(s,"Redirects returned/thrown from loaders/actions must have a Location header"),!G.test(s)){let n=a.slice(0,a.findIndex((e=>e.route.id===r))+1);s=re(new URL(t.url),n,o,!0,s,i),e.headers.set("Location",s)}return e}function pe(e,t,r){if(G.test(e)){let a=e,n=a.startsWith("//")?new URL(t.protocol+a):new URL(a),o=null!=P(n.pathname,r);if(n.origin===t.origin&&o)return n.pathname+n.search+n.hash}return e}function me(e,t,r,a){let n=e.createURL(xe(t)).toString(),o={signal:r};if(a&&Oe(a.formMethod)){let{formMethod:e,formEncType:t}=a;o.method=e.toUpperCase(),"application/json"===t?(o.headers=new Headers({"Content-Type":t}),o.body=JSON.stringify(a.json)):"text/plain"===t?o.body=a.text:"application/x-www-form-urlencoded"===t&&a.formData?o.body=ye(a.formData):o.body=a.formData}return new Request(n,o)}function ye(e){let t=new URLSearchParams;for(let[r,a]of e.entries())t.append(r,"string"==typeof a?a:a.name);return t}function ve(e){let t=new FormData;for(let[r,a]of e.entries())t.append(r,a);return t}function ge(e,t,r,a,o){let i,s={},l=null,u=!1,c={},d=r&&Me(r[1])?r[1].error:void 0;return e.forEach((r=>{if(!(r.route.id in t))return;let h=r.route.id,f=t[h];if(n(!je(f),"Cannot handle redirect results in processLoaderData"),Me(f)){let t=f.error;if(void 0!==d&&(t=d,d=void 0),l=l||{},o)l[h]=t;else{let r=Se(e,h);null==l[r.route.id]&&(l[r.route.id]=t)}s[h]=void 0,u||(u=!0,i=N(f.error)?f.error.status:500),f.headers&&(c[h]=f.headers)}else Le(f)?(a.set(h,f.deferredData),s[h]=f.deferredData.data,null==f.statusCode||200===f.statusCode||u||(i=f.statusCode),f.headers&&(c[h]=f.headers)):(s[h]=f.data,f.statusCode&&200!==f.statusCode&&!u&&(i=f.statusCode),f.headers&&(c[h]=f.headers))})),void 0!==d&&r&&(l={[r[0]]:d},s[r[0]]=void 0),{loaderData:s,errors:l,statusCode:i||200,loaderHeaders:c}}function be(e,r,a,o,i,s,l,u){let{loaderData:c,errors:d}=ge(r,o,i,u,!1);return s.forEach((r=>{let{key:a,match:o,controller:i}=r,s=l[a];if(n(s,"Did not find corresponding fetcher result"),!i||!i.signal.aborted)if(Me(s)){let r=Se(e.matches,null==o?void 0:o.route.id);d&&d[r.route.id]||(d=t({},d,{[r.route.id]:s.error})),e.fetchers.delete(a)}else if(je(s))n(!1,"Unhandled fetcher revalidation redirect");else if(Le(s))n(!1,"Unhandled fetcher deferred data");else{let t=qe(s.data);e.fetchers.set(a,t)}})),{loaderData:c,errors:d}}function we(e,r,a,n){let o=t({},r);for(let t of a){let a=t.route.id;if(r.hasOwnProperty(a)?void 0!==r[a]&&(o[a]=r[a]):void 0!==e[a]&&t.route.loader&&(o[a]=e[a]),n&&n.hasOwnProperty(a))break}return o}function De(e){return e?Me(e[1])?{actionData:{}}:{actionData:{[e[0]]:e[1].data}}:{}}function Se(e,t){return(t?e.slice(0,e.findIndex((e=>e.route.id===t))+1):[...e]).reverse().find((e=>!0===e.route.hasErrorBoundary))||e[0]}function Re(e){let t=1===e.length?e[0]:e.find((e=>e.index||!e.path||"/"===e.path))||{id:"__shim-error-route__"};return{matches:[{params:{},pathname:"",pathnameBase:"",route:t}],route:t}}function Ee(e,t){let{pathname:r,routeId:a,method:n,type:o,message:i}=void 0===t?{}:t,s="Unknown Server Error",l="Unknown @remix-run/router error";return 400===e?(s="Bad Request","route-discovery"===o?l='Unable to match URL "'+r+'" - the `patchRoutesOnNavigation()` function threw the following error:\n'+i:n&&r&&a?l="You made a "+n+' request to "'+r+'" but did not provide a `loader` for route "'+a+'", so there is no way to handle the request.':"defer-action"===o?l="defer() is not supported in actions":"invalid-body"===o&&(l="Unable to encode submission body")):403===e?(s="Forbidden",l='Route "'+a+'" does not match URL "'+r+'"'):404===e?(s="Not Found",l='No route matches URL "'+r+'"'):405===e&&(s="Method Not Allowed",n&&r&&a?l="You made a "+n.toUpperCase()+' request to "'+r+'" but did not provide an `action` for route "'+a+'", so there is no way to handle the request.':n&&(l='Invalid request method "'+n.toUpperCase()+'"')),new z(e||500,s,new Error(l),!0)}function Pe(e){let t=Object.entries(e);for(let e=t.length-1;e>=0;e--){let[r,a]=t[e];if(je(a))return{key:r,result:a}}}function xe(e){return l(t({},"string"==typeof e?u(e):e,{hash:""}))}function Ae(e){return _e(e.result)&&K.has(e.result.status)}function Le(e){return e.type===d.deferred}function Me(e){return e.type===d.error}function je(e){return(e&&e.type)===d.redirect}function ke(e){return"object"==typeof e&&null!=e&&"type"in e&&"data"in e&&"init"in e&&"DataWithResponseInit"===e.type}function Ce(e){let t=e;return t&&"object"==typeof t&&"object"==typeof t.data&&"function"==typeof t.subscribe&&"function"==typeof t.cancel&&"function"==typeof t.resolveData}function _e(e){return null!=e&&"number"==typeof e.status&&"string"==typeof e.statusText&&"object"==typeof e.headers&&void 0!==e.body}function Te(e){return q.has(e.toLowerCase())}function Oe(e){return W.has(e.toLowerCase())}async function Ue(e,t,r,a,n){let o=Object.entries(t);for(let i=0;i<o.length;i++){let[s,l]=o[i],u=e.find((e=>(null==e?void 0:e.route.id)===s));if(!u)continue;let c=a.find((e=>e.route.id===u.route.id)),d=null!=c&&!ie(c,u)&&void 0!==(n&&n[u.route.id]);Le(l)&&d&&await He(l,r,!1).then((e=>{e&&(t[s]=e)}))}}async function Ie(e,t,r){for(let a=0;a<r.length;a++){let{key:o,routeId:i,controller:s}=r[a],l=t[o];e.find((e=>(null==e?void 0:e.route.id)===i))&&(Le(l)&&(n(s,"Expected an AbortController for revalidating fetcher deferred result"),await He(l,s.signal,!0).then((e=>{e&&(t[o]=e)}))))}}async function He(e,t,r){if(void 0===r&&(r=!1),!await e.deferredData.resolveData(t)){if(r)try{return{type:d.data,data:e.deferredData.unwrappedData}}catch(e){return{type:d.error,error:e}}return{type:d.data,data:e.deferredData.data}}}function Fe(e){return new URLSearchParams(e).getAll("index").some((e=>""===e))}function ze(e,t){let r="string"==typeof t?u(t).search:t.search;if(e[e.length-1].route.index&&Fe(r||""))return e[e.length-1];let a=L(e);return a[a.length-1]}function Ne(e){let{formMethod:t,formAction:r,formEncType:a,text:n,formData:o,json:i}=e;if(t&&r&&a)return null!=n?{formMethod:t,formAction:r,formEncType:a,formData:void 0,json:void 0,text:n}:null!=o?{formMethod:t,formAction:r,formEncType:a,formData:o,json:void 0,text:void 0}:void 0!==i?{formMethod:t,formAction:r,formEncType:a,formData:void 0,json:i,text:void 0}:void 0}function Be(e,t){if(t){return{state:"loading",location:e,formMethod:t.formMethod,formAction:t.formAction,formEncType:t.formEncType,formData:t.formData,json:t.json,text:t.text}}return{state:"loading",location:e,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0}}function We(e,t){return{state:"submitting",location:e,formMethod:t.formMethod,formAction:t.formAction,formEncType:t.formEncType,formData:t.formData,json:t.json,text:t.text}}function $e(e,t){if(e){return{state:"loading",formMethod:e.formMethod,formAction:e.formAction,formEncType:e.formEncType,formData:e.formData,json:e.json,text:e.text,data:t}}return{state:"loading",formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0,data:t}}function qe(e){return{state:"idle",formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0,data:e}}e.AbortedDeferredError=U,e.Action=r,e.IDLE_BLOCKER=X,e.IDLE_FETCHER=V,e.IDLE_NAVIGATION=J,e.UNSAFE_DEFERRED_SYMBOL=ee,e.UNSAFE_DeferredData=I,e.UNSAFE_ErrorResponseImpl=z,e.UNSAFE_convertRouteMatchToUiMatch=y,e.UNSAFE_convertRoutesToDataRoutes=f,e.UNSAFE_decodePath=E,e.UNSAFE_getResolveToMatches=M,e.UNSAFE_invariant=n,e.UNSAFE_warning=o,e.createBrowserHistory=function(e){return void 0===e&&(e={}),c((function(e,t){let{pathname:r,search:a,hash:n}=e.location;return s("",{pathname:r,search:a,hash:n},t.state&&t.state.usr||null,t.state&&t.state.key||"default")}),(function(e,t){return"string"==typeof t?t:l(t)}),null,e)},e.createHashHistory=function(e){return void 0===e&&(e={}),c((function(e,t){let{pathname:r="/",search:a="",hash:n=""}=u(e.location.hash.substr(1));return r.startsWith("/")||r.startsWith(".")||(r="/"+r),s("",{pathname:r,search:a,hash:n},t.state&&t.state.usr||null,t.state&&t.state.key||"default")}),(function(e,t){let r=e.document.querySelector("base"),a="";if(r&&r.getAttribute("href")){let t=e.location.href,r=t.indexOf("#");a=-1===r?t:t.slice(0,r)}return a+"#"+("string"==typeof t?t:l(t))}),(function(e,t){o("/"===e.pathname.charAt(0),"relative pathnames are not supported in hash history.push("+JSON.stringify(t)+")")}),e)},e.createMemoryHistory=function(e){void 0===e&&(e={});let t,{initialEntries:a=["/"],initialIndex:n,v5Compat:i=!1}=e;t=a.map(((e,t)=>m(e,"string"==typeof e?null:e.state,0===t?"default":void 0)));let c=f(null==n?t.length-1:n),d=r.Pop,h=null;function f(e){return Math.min(Math.max(e,0),t.length-1)}function p(){return t[c]}function m(e,r,a){void 0===r&&(r=null);let n=s(t?p().pathname:"/",e,r,a);return o("/"===n.pathname.charAt(0),"relative pathnames are not supported in memory history: "+JSON.stringify(e)),n}function y(e){return"string"==typeof e?e:l(e)}return{get index(){return c},get action(){return d},get location(){return p()},createHref:y,createURL:e=>new URL(y(e),"http://localhost"),encodeLocation(e){let t="string"==typeof e?u(e):e;return{pathname:t.pathname||"",search:t.search||"",hash:t.hash||""}},push(e,a){d=r.Push;let n=m(e,a);c+=1,t.splice(c,t.length,n),i&&h&&h({action:d,location:n,delta:1})},replace(e,a){d=r.Replace;let n=m(e,a);t[c]=n,i&&h&&h({action:d,location:n,delta:0})},go(e){d=r.Pop;let a=f(c+e),n=t[a];c=a,h&&h({action:d,location:n,delta:e})},listen:e=>(h=e,()=>{h=null})}},e.createPath=l,e.createRouter=function(e){const a=e.window?e.window:"undefined"!=typeof window?window:void 0,i=void 0!==a&&void 0!==a.document&&void 0!==a.document.createElement,l=!i;let u;if(n(e.routes.length>0,"You must provide a non-empty routes array to createRouter"),e.mapRouteProperties)u=e.mapRouteProperties;else if(e.detectErrorBoundary){let t=e.detectErrorBoundary;u=e=>({hasErrorBoundary:t(e)})}else u=Q;let c,h,v,g={},b=f(e.routes,u,void 0,g),w=e.basename||"/",D=e.dataStrategy||ce,S=e.patchRoutesOnNavigation,R=t({v7_fetcherPersist:!1,v7_normalizeFormMethod:!1,v7_partialHydration:!1,v7_prependBasename:!1,v7_relativeSplatPath:!1,v7_skipActionErrorRevalidation:!1},e.future),E=null,x=new Set,A=null,L=null,M=null,j=null!=e.hydrationData,k=p(b,e.history.location,w),C=null;if(null==k&&!S){let t=Ee(404,{pathname:e.history.location.pathname}),{matches:r,route:a}=Re(b);k=r,C={[a.id]:t}}if(k&&!e.hydrationData){pt(k,b,e.history.location.pathname).active&&(k=null)}if(k)if(k.some((e=>e.route.lazy)))h=!1;else if(k.some((e=>e.route.loader)))if(R.v7_partialHydration){let t=e.hydrationData?e.hydrationData.loaderData:null,r=e.hydrationData?e.hydrationData.errors:null,a=e=>!e.route.loader||("function"!=typeof e.route.loader||!0!==e.route.loader.hydrate)&&(t&&void 0!==t[e.route.id]||r&&void 0!==r[e.route.id]);if(r){let e=k.findIndex((e=>void 0!==r[e.route.id]));h=k.slice(0,e+1).every(a)}else h=k.every(a)}else h=null!=e.hydrationData;else h=!0;else if(h=!1,k=[],R.v7_partialHydration){let t=pt(null,b,e.history.location.pathname);t.active&&t.matches&&(k=t.matches)}let _,T,O={historyAction:e.history.action,location:e.history.location,matches:k,initialized:h,navigation:J,restoreScrollPosition:null==e.hydrationData&&null,preventScrollReset:!1,revalidation:"idle",loaderData:e.hydrationData&&e.hydrationData.loaderData||{},actionData:e.hydrationData&&e.hydrationData.actionData||null,errors:e.hydrationData&&e.hydrationData.errors||C,fetchers:new Map,blockers:new Map},U=r.Pop,I=!1,H=!1,F=new Map,z=null,B=!1,W=!1,$=[],q=new Set,K=new Map,ee=new Map,te=0,ne=-1,ie=new Map,se=new Set,ye=new Map,ve=new Map,ge=new Set,xe=new Map,ke=new Map,Ce=new Map;function _e(e,r){void 0===r&&(r={}),O=t({},O,e);let a=[],n=[];R.v7_fetcherPersist&&O.fetchers.forEach(((e,t)=>{"idle"===e.state&&(ge.has(t)?n.push(t):a.push(t))})),[...x].forEach((e=>e(O,{deletedFetchers:n,unstable_viewTransitionOpts:r.viewTransitionOpts,unstable_flushSync:!0===r.flushSync}))),R.v7_fetcherPersist&&(a.forEach((e=>O.fetchers.delete(e))),n.forEach((e=>tt(e))))}function Te(a,n,o){var i,s;let l,{flushSync:u}=void 0===o?{}:o,d=null!=O.actionData&&null!=O.navigation.formMethod&&Oe(O.navigation.formMethod)&&"loading"===O.navigation.state&&!0!==(null==(i=a.state)?void 0:i._isRedirect);l=n.actionData?Object.keys(n.actionData).length>0?n.actionData:null:d?O.actionData:null;let h=n.loaderData?we(O.loaderData,n.loaderData,n.matches||[],n.errors):O.loaderData,f=O.blockers;f.size>0&&(f=new Map(f),f.forEach(((e,t)=>f.set(t,X))));let p,m=!0===I||null!=O.navigation.formMethod&&Oe(O.navigation.formMethod)&&!0!==(null==(s=a.state)?void 0:s._isRedirect);if(c&&(b=c,c=void 0),B||U===r.Pop||(U===r.Push?e.history.push(a,a.state):U===r.Replace&&e.history.replace(a,a.state)),U===r.Pop){let e=F.get(O.location.pathname);e&&e.has(a.pathname)?p={currentLocation:O.location,nextLocation:a}:F.has(a.pathname)&&(p={currentLocation:a,nextLocation:O.location})}else if(H){let e=F.get(O.location.pathname);e?e.add(a.pathname):(e=new Set([a.pathname]),F.set(O.location.pathname,e)),p={currentLocation:O.location,nextLocation:a}}_e(t({},n,{actionData:l,loaderData:h,historyAction:U,location:a,initialized:!0,navigation:J,revalidation:"idle",restoreScrollPosition:ft(a,n.matches||O.matches),preventScrollReset:m,blockers:f}),{viewTransitionOpts:p,flushSync:!0===u}),U=r.Pop,I=!1,H=!1,B=!1,W=!1,$=[]}async function Fe(a,n,o){_&&_.abort(),_=null,U=a,B=!0===(o&&o.startUninterruptedRevalidation),function(e,t){if(A&&M){let r=ht(e,t);A[r]=M()}}(O.location,O.matches),I=!0===(o&&o.preventScrollReset),H=!0===(o&&o.enableViewTransition);let i=c||b,s=o&&o.overrideNavigation,l=p(i,n,w),u=!0===(o&&o.flushSync),h=pt(l,i,n.pathname);if(h.active&&h.matches&&(l=h.matches),!l){let{error:e,notFoundMatches:t,route:r}=ut(n.pathname);return void Te(n,{matches:t,loaderData:{},errors:{[r.id]:e}},{flushSync:u})}if(O.initialized&&!W&&function(e,t){if(e.pathname!==t.pathname||e.search!==t.search)return!1;if(""===e.hash)return""!==t.hash;if(e.hash===t.hash)return!0;if(""!==t.hash)return!0;return!1}(O.location,n)&&!(o&&o.submission&&Oe(o.submission.formMethod)))return void Te(n,{matches:l},{flushSync:u});_=new AbortController;let f,m=me(e.history,n,_.signal,o&&o.submission);if(o&&o.pendingError)f=[Se(l).route.id,{type:d.error,error:o.pendingError}];else if(o&&o.submission&&Oe(o.submission.formMethod)){let t=await async function(e,t,a,n,o,i){void 0===i&&(i={});let s;if(Xe(),_e({navigation:We(t,a)},{flushSync:!0===i.flushSync}),o){let r=await mt(n,t.pathname,e.signal);if("aborted"===r.type)return{shortCircuited:!0};if("error"===r.type){let{boundaryId:e,error:a}=ct(t.pathname,r);return{matches:r.partialMatches,pendingActionResult:[e,{type:d.error,error:a}]}}if(!r.matches){let{notFoundMatches:e,error:r,route:a}=ut(t.pathname);return{matches:e,pendingActionResult:[a.id,{type:d.error,error:r}]}}n=r.matches}let l=ze(n,t);if(l.route.action||l.route.lazy){if(s=(await Je("action",O,e,[l],n,null))[l.route.id],e.signal.aborted)return{shortCircuited:!0}}else s={type:d.error,error:Ee(405,{method:e.method,pathname:t.pathname,routeId:l.route.id})};if(je(s)){let t;if(i&&null!=i.replace)t=i.replace;else{t=pe(s.response.headers.get("Location"),new URL(e.url),w)===O.location.pathname+O.location.search}return await Ye(e,s,!0,{submission:a,replace:t}),{shortCircuited:!0}}if(Le(s))throw Ee(400,{type:"defer-action"});if(Me(s)){let e=Se(n,l.route.id);return!0!==(i&&i.replace)&&(U=r.Push),{matches:n,pendingActionResult:[e.route.id,s]}}return{matches:n,pendingActionResult:[l.route.id,s]}}(m,n,o.submission,l,h.active,{replace:o.replace,flushSync:u});if(t.shortCircuited)return;if(t.pendingActionResult){let[e,r]=t.pendingActionResult;if(Me(r)&&N(r.error)&&404===r.error.status)return _=null,void Te(n,{matches:t.matches,loaderData:{},errors:{[e]:r.error}})}l=t.matches||l,f=t.pendingActionResult,s=Be(n,o.submission),u=!1,h.active=!1,m=me(e.history,m.url,m.signal)}let{shortCircuited:y,matches:v,loaderData:g,errors:D}=await async function(r,a,n,o,i,s,l,u,d,h,f){let p=i||Be(a,s),m=s||l||Ne(p),y=!(B||R.v7_partialHydration&&d);if(o){if(y){let e=Ke(f);_e(t({navigation:p},void 0!==e?{actionData:e}:{}),{flushSync:h})}let e=await mt(n,a.pathname,r.signal);if("aborted"===e.type)return{shortCircuited:!0};if("error"===e.type){let{boundaryId:t,error:r}=ct(a.pathname,e);return{matches:e.partialMatches,loaderData:{},errors:{[t]:r}}}if(!e.matches){let{error:e,notFoundMatches:t,route:r}=ut(a.pathname);return{matches:t,loaderData:{},errors:{[r.id]:e}}}n=e.matches}let v=c||b,[g,D]=oe(e.history,O,n,m,a,R.v7_partialHydration&&!0===d,R.v7_skipActionErrorRevalidation,W,$,q,ge,ye,se,v,w,f);if(dt((e=>!(n&&n.some((t=>t.route.id===e)))||g&&g.some((t=>t.route.id===e)))),ne=++te,0===g.length&&0===D.length){let e=nt();return Te(a,t({matches:n,loaderData:{},errors:f&&Me(f[1])?{[f[0]]:f[1].error}:null},De(f),e?{fetchers:new Map(O.fetchers)}:{}),{flushSync:h}),{shortCircuited:!0}}if(y){let e={};if(!o){e.navigation=p;let t=Ke(f);void 0!==t&&(e.actionData=t)}D.length>0&&(e.fetchers=function(e){return e.forEach((e=>{let t=O.fetchers.get(e.key),r=$e(void 0,t?t.data:void 0);O.fetchers.set(e.key,r)})),new Map(O.fetchers)}(D)),_e(e,{flushSync:h})}D.forEach((e=>{K.has(e.key)&&rt(e.key),e.controller&&K.set(e.key,e.controller)}));let S=()=>D.forEach((e=>rt(e.key)));_&&_.signal.addEventListener("abort",S);let{loaderResults:E,fetcherResults:P}=await Ve(O,n,g,D,r);if(r.signal.aborted)return{shortCircuited:!0};_&&_.signal.removeEventListener("abort",S);D.forEach((e=>Qe(e.key)));let x=Pe(E);if(x)return await Ye(r,x.result,!0,{replace:u}),{shortCircuited:!0};if(x=Pe(P),x)return se.add(x.key),await Ye(r,x.result,!0,{replace:u}),{shortCircuited:!0};let{loaderData:A,errors:L}=be(O,n,g,E,f,D,P,xe);xe.forEach(((e,t)=>{e.subscribe((r=>{(r||e.done)&&xe.delete(t)}))})),R.v7_partialHydration&&d&&O.errors&&Object.entries(O.errors).filter((e=>{let[t]=e;return!g.some((e=>e.route.id===t))})).forEach((e=>{let[t,r]=e;L=Object.assign(L||{},{[t]:r})}));let M=nt(),j=ot(ne),k=M||j||D.length>0;return t({matches:n,loaderData:A,errors:L},k?{fetchers:new Map(O.fetchers)}:{})}(m,n,l,h.active,s,o&&o.submission,o&&o.fetcherSubmission,o&&o.replace,o&&!0===o.initialHydration,u,f);y||(_=null,Te(n,t({matches:v||l},De(f),{loaderData:g,errors:D})))}function Ke(e){return e&&!Me(e[1])?{[e[0]]:e[1].data}:O.actionData?0===Object.keys(O.actionData).length?null:O.actionData:void 0}async function Ye(o,l,u,c){let{submission:d,fetcherSubmission:h,replace:f}=void 0===c?{}:c;l.response.headers.has("X-Remix-Revalidate")&&(W=!0);let p=l.response.headers.get("Location");n(p,"Expected a Location header on the redirect Response"),p=pe(p,new URL(o.url),w);let m=s(O.location,p,{_isRedirect:!0});if(i){let t=!1;if(l.response.headers.has("X-Remix-Reload-Document"))t=!0;else if(G.test(p)){const r=e.history.createURL(p);t=r.origin!==a.location.origin||null==P(r.pathname,w)}if(t)return void(f?a.location.replace(p):a.location.assign(p))}_=null;let y=!0===f||l.response.headers.has("X-Remix-Replace")?r.Replace:r.Push,{formMethod:v,formAction:g,formEncType:b}=O.navigation;!d&&!h&&v&&g&&b&&(d=Ne(O.navigation));let D=d||h;if(Y.has(l.response.status)&&D&&Oe(D.formMethod))await Fe(y,m,{submission:t({},D,{formAction:p}),preventScrollReset:I,enableViewTransition:u?H:void 0});else{let e=Be(m,d);await Fe(y,m,{overrideNavigation:e,fetcherSubmission:h,preventScrollReset:I,enableViewTransition:u?H:void 0})}}async function Je(e,t,r,a,n,o){let i,s={};try{i=await de(D,e,t,r,a,n,o,g,u)}catch(e){return a.forEach((t=>{s[t.route.id]={type:d.error,error:e}})),s}for(let[e,t]of Object.entries(i))if(Ae(t)){let a=t.result;s[e]={type:d.redirect,response:fe(a,r,e,n,w,R.v7_relativeSplatPath)}}else s[e]=await he(t);return s}async function Ve(t,r,a,n,o){let i=t.matches,s=Je("loader",t,o,a,r,null),l=Promise.all(n.map((async r=>{if(r.matches&&r.match&&r.controller){let a=(await Je("loader",t,me(e.history,r.path,r.controller.signal),[r.match],r.matches,r.key))[r.match.route.id];return{[r.key]:a}}return Promise.resolve({[r.key]:{type:d.error,error:Ee(404,{pathname:r.path})}})}))),u=await s,c=(await l).reduce(((e,t)=>Object.assign(e,t)),{});return await Promise.all([Ue(r,u,o.signal,i,t.loaderData),Ie(r,c,n)]),{loaderResults:u,fetcherResults:c}}function Xe(){W=!0,$.push(...dt()),ye.forEach(((e,t)=>{K.has(t)&&(q.add(t),rt(t))}))}function Ge(e,t,r){void 0===r&&(r={}),O.fetchers.set(e,t),_e({fetchers:new Map(O.fetchers)},{flushSync:!0===(r&&r.flushSync)})}function Qe(e){let t=K.get(e);t&&ee.set(e,t),K.delete(e)}function Ze(e,t,r,a){void 0===a&&(a={});let n=Se(O.matches,t);tt(e),_e({errors:{[n.route.id]:r},fetchers:new Map(O.fetchers)},{flushSync:!0===(a&&a.flushSync)})}function et(e){return R.v7_fetcherPersist&&(ve.set(e,(ve.get(e)||0)+1),ge.has(e)&&ge.delete(e)),O.fetchers.get(e)||V}function tt(e){let t=O.fetchers.get(e);!K.has(e)||t&&"loading"===t.state&&ie.has(e)||rt(e),ee.delete(e),ye.delete(e),ie.delete(e),se.delete(e),ge.delete(e),q.delete(e),O.fetchers.delete(e)}function rt(e,t){let r=K.get(e);n(r,"Expected fetch controller: "+e),r.abort(t),K.delete(e)}function at(e){for(let t of e){let e=qe(et(t).data);O.fetchers.set(t,e)}}function nt(){let e=[],t=!1;for(let r of se){let a=O.fetchers.get(r);n(a,"Expected fetcher: "+r),"loading"===a.state&&(se.delete(r),e.push(r),t=!0)}return at(e),t}function ot(e){let t=[];for(let[r,a]of ie)if(a<e){let e=O.fetchers.get(r);n(e,"Expected fetcher: "+r),"loading"===e.state&&(rt(r),ie.delete(r),t.push(r))}return at(t),t.length>0}function it(e){O.blockers.delete(e),ke.delete(e)}function st(e,t){let r=O.blockers.get(e)||X;n("unblocked"===r.state&&"blocked"===t.state||"blocked"===r.state&&"blocked"===t.state||"blocked"===r.state&&"proceeding"===t.state||"blocked"===r.state&&"unblocked"===t.state||"proceeding"===r.state&&"unblocked"===t.state,"Invalid blocker state transition: "+r.state+" -> "+t.state);let a=new Map(O.blockers);a.set(e,t),_e({blockers:a})}function lt(e){let{currentLocation:t,nextLocation:r,historyAction:a}=e;if(0===ke.size)return;ke.size>1&&o(!1,"A router only supports one blocker at a time");let n=Array.from(ke.entries()),[i,s]=n[n.length-1],l=O.blockers.get(i);return l&&"proceeding"===l.state?void 0:s({currentLocation:t,nextLocation:r,historyAction:a})?i:void 0}function ut(e){let t=Ee(404,{pathname:e}),r=c||b,{matches:a,route:n}=Re(r);return dt(),{notFoundMatches:a,route:n,error:t}}function ct(e,t){return{boundaryId:Se(t.partialMatches).route.id,error:Ee(400,{type:"route-discovery",pathname:e,message:null!=t.error&&"message"in t.error?t.error:String(t.error)})}}function dt(e){let t=[];return xe.forEach(((r,a)=>{e&&!e(a)||(r.cancel(),t.push(a),xe.delete(a))})),t}function ht(e,t){if(L){return L(e,t.map((e=>y(e,O.loaderData))))||e.key}return e.key}function ft(e,t){if(A){let r=ht(e,t),a=A[r];if("number"==typeof a)return a}return null}function pt(e,t,r){if(S){if(!e){return{active:!0,matches:m(t,r,w,!0)||[]}}if(Object.keys(e[0].params).length>0){return{active:!0,matches:m(t,r,w,!0)}}}return{active:!1,matches:null}}async function mt(e,t,r){let a=e;for(;;){let e=null==c,n=c||b;try{await le(S,t,a,n,g,u,Ce,r)}catch(e){return{type:"error",error:e,partialMatches:a}}finally{e&&(b=[...b])}if(r.aborted)return{type:"aborted"};let o=p(n,t,w);if(o)return{type:"success",matches:o};let i=m(n,t,w,!0);if(!i||a.length===i.length&&a.every(((e,t)=>e.route.id===i[t].route.id)))return{type:"success",matches:null};a=i}}return v={get basename(){return w},get future(){return R},get state(){return O},get routes(){return b},get window(){return a},initialize:function(){if(E=e.history.listen((t=>{let{action:r,location:a,delta:n}=t;if(T)return T(),void(T=void 0);o(0===ke.size||null!=n,"You are trying to use a blocker on a POP navigation to a location that was not created by @remix-run/router. This will fail silently in production. This can happen if you are navigating outside the router via `window.history.pushState`/`window.location.hash` instead of using router navigation APIs. This can also happen if you are using createHashRouter and the user manually changes the URL.");let i=lt({currentLocation:O.location,nextLocation:a,historyAction:r});if(i&&null!=n){let t=new Promise((e=>{T=e}));return e.history.go(-1*n),void st(i,{state:"blocked",location:a,proceed(){st(i,{state:"proceeding",proceed:void 0,reset:void 0,location:a}),t.then((()=>e.history.go(n)))},reset(){let e=new Map(O.blockers);e.set(i,X),_e({blockers:e})}})}return Fe(r,a)})),i){!function(e,t){try{let r=e.sessionStorage.getItem(Z);if(r){let e=JSON.parse(r);for(let[r,a]of Object.entries(e||{}))a&&Array.isArray(a)&&t.set(r,new Set(a||[]))}}catch(e){}}(a,F);let e=()=>function(e,t){if(t.size>0){let r={};for(let[e,a]of t)r[e]=[...a];try{e.sessionStorage.setItem(Z,JSON.stringify(r))}catch(e){o(!1,"Failed to save applied view transitions in sessionStorage ("+e+").")}}}(a,F);a.addEventListener("pagehide",e),z=()=>a.removeEventListener("pagehide",e)}return O.initialized||Fe(r.Pop,O.location,{initialHydration:!0}),v},subscribe:function(e){return x.add(e),()=>x.delete(e)},enableScrollRestoration:function(e,t,r){if(A=e,M=t,L=r||null,!j&&O.navigation===J){j=!0;let e=ft(O.location,O.matches);null!=e&&_e({restoreScrollPosition:e})}return()=>{A=null,M=null,L=null}},navigate:async function a(n,o){if("number"==typeof n)return void e.history.go(n);let i=re(O.location,O.matches,w,R.v7_prependBasename,n,R.v7_relativeSplatPath,null==o?void 0:o.fromRouteId,null==o?void 0:o.relative),{path:l,submission:u,error:c}=ae(R.v7_normalizeFormMethod,!1,i,o),d=O.location,h=s(O.location,l,o&&o.state);h=t({},h,e.history.encodeLocation(h));let f=o&&null!=o.replace?o.replace:void 0,p=r.Push;!0===f?p=r.Replace:!1===f||null!=u&&Oe(u.formMethod)&&u.formAction===O.location.pathname+O.location.search&&(p=r.Replace);let m=o&&"preventScrollReset"in o?!0===o.preventScrollReset:void 0,y=!0===(o&&o.unstable_flushSync),v=lt({currentLocation:d,nextLocation:h,historyAction:p});if(!v)return await Fe(p,h,{submission:u,pendingError:c,preventScrollReset:m,replace:o&&o.replace,enableViewTransition:o&&o.unstable_viewTransition,flushSync:y});st(v,{state:"blocked",location:h,proceed(){st(v,{state:"proceeding",proceed:void 0,reset:void 0,location:h}),a(n,o)},reset(){let e=new Map(O.blockers);e.set(v,X),_e({blockers:e})}})},fetch:function(t,r,a,o){if(l)throw new Error("router.fetch() was called during the server render, but it shouldn't be. You are likely calling a useFetcher() method in the body of your component. Try moving it to a useEffect or a callback.");K.has(t)&&rt(t);let i=!0===(o&&o.unstable_flushSync),s=c||b,u=re(O.location,O.matches,w,R.v7_prependBasename,a,R.v7_relativeSplatPath,r,null==o?void 0:o.relative),d=p(s,u,w),h=pt(d,s,u);if(h.active&&h.matches&&(d=h.matches),!d)return void Ze(t,r,Ee(404,{pathname:u}),{flushSync:i});let{path:f,submission:m,error:y}=ae(R.v7_normalizeFormMethod,!0,u,o);if(y)return void Ze(t,r,y,{flushSync:i});let v=ze(d,f);I=!0===(o&&o.preventScrollReset),m&&Oe(m.formMethod)?async function(t,r,a,o,i,s,l,u){function d(e){if(!e.route.action&&!e.route.lazy){let e=Ee(405,{method:u.formMethod,pathname:a,routeId:r});return Ze(t,r,e,{flushSync:l}),!0}return!1}if(Xe(),ye.delete(t),!s&&d(o))return;let h=O.fetchers.get(t);Ge(t,function(e,t){return{state:"submitting",formMethod:e.formMethod,formAction:e.formAction,formEncType:e.formEncType,formData:e.formData,json:e.json,text:e.text,data:t?t.data:void 0}}(u,h),{flushSync:l});let f=new AbortController,m=me(e.history,a,f.signal,u);if(s){let e=await mt(i,a,m.signal);if("aborted"===e.type)return;if("error"===e.type){let{error:n}=ct(a,e);return void Ze(t,r,n,{flushSync:l})}if(!e.matches)return void Ze(t,r,Ee(404,{pathname:a}),{flushSync:l});if(d(o=ze(i=e.matches,a)))return}K.set(t,f);let y=te,v=(await Je("action",O,m,[o],i,t))[o.route.id];if(m.signal.aborted)return void(K.get(t)===f&&Qe(t));if(R.v7_fetcherPersist&&ge.has(t)){if(je(v)||Me(v))return void Ge(t,qe(void 0))}else{if(je(v))return Qe(t),ne>y?void Ge(t,qe(void 0)):(se.add(t),Ge(t,$e(u)),Ye(m,v,!1,{fetcherSubmission:u}));if(Me(v))return void Ze(t,r,v.error)}if(Le(v))throw Ee(400,{type:"defer-action"});let g=O.navigation.location||O.location,D=me(e.history,g,f.signal),S=c||b,E="idle"!==O.navigation.state?p(S,O.navigation.location,w):O.matches;n(E,"Didn't find any matches after fetcher action");let P=++te;ie.set(t,P);let x=$e(u,v.data);O.fetchers.set(t,x);let[A,L]=oe(e.history,O,E,u,g,!1,R.v7_skipActionErrorRevalidation,W,$,q,ge,ye,se,S,w,[o.route.id,v]);L.filter((e=>e.key!==t)).forEach((e=>{let t=e.key,r=O.fetchers.get(t),a=$e(void 0,r?r.data:void 0);O.fetchers.set(t,a),K.has(t)&&rt(t),e.controller&&K.set(t,e.controller)})),_e({fetchers:new Map(O.fetchers)});let M=()=>L.forEach((e=>rt(e.key)));f.signal.addEventListener("abort",M);let{loaderResults:j,fetcherResults:k}=await Ve(O,E,A,L,D);if(f.signal.aborted)return;f.signal.removeEventListener("abort",M),ie.delete(t),Qe(t),L.forEach((e=>Qe(e.key)));let C=Pe(j);if(C)return Ye(D,C.result,!1);if(C=Pe(k),C)return se.add(C.key),Ye(D,C.result,!1);let{loaderData:T,errors:I}=be(O,E,A,j,void 0,L,k,xe);if(O.fetchers.has(t)){let e=qe(v.data);O.fetchers.set(t,e)}ot(P),"loading"===O.navigation.state&&P>ne?(n(U,"Expected pending action"),_&&_.abort(),Te(O.navigation.location,{matches:E,loaderData:T,errors:I,fetchers:new Map(O.fetchers)})):(_e({errors:I,loaderData:we(O.loaderData,T,E,I),fetchers:new Map(O.fetchers)}),W=!1)}(t,r,f,v,d,h.active,i,m):(ye.set(t,{routeId:r,path:f}),async function(t,r,a,o,i,s,l,u){let c=O.fetchers.get(t);Ge(t,$e(u,c?c.data:void 0),{flushSync:l});let d=new AbortController,h=me(e.history,a,d.signal);if(s){let e=await mt(i,a,h.signal);if("aborted"===e.type)return;if("error"===e.type){let{error:n}=ct(a,e);return void Ze(t,r,n,{flushSync:l})}if(!e.matches)return void Ze(t,r,Ee(404,{pathname:a}),{flushSync:l});o=ze(i=e.matches,a)}K.set(t,d);let f=te,p=(await Je("loader",O,h,[o],i,t))[o.route.id];Le(p)&&(p=await He(p,h.signal,!0)||p);K.get(t)===d&&Qe(t);if(h.signal.aborted)return;if(ge.has(t))return void Ge(t,qe(void 0));if(je(p))return ne>f?void Ge(t,qe(void 0)):(se.add(t),void await Ye(h,p,!1));if(Me(p))return void Ze(t,r,p.error);n(!Le(p),"Unhandled fetcher deferred data"),Ge(t,qe(p.data))}(t,r,f,v,d,h.active,i,m))},revalidate:function(){Xe(),_e({revalidation:"loading"}),"submitting"!==O.navigation.state&&("idle"!==O.navigation.state?Fe(U||O.historyAction,O.navigation.location,{overrideNavigation:O.navigation,enableViewTransition:!0===H}):Fe(O.historyAction,O.location,{startUninterruptedRevalidation:!0}))},createHref:t=>e.history.createHref(t),encodeLocation:t=>e.history.encodeLocation(t),getFetcher:et,deleteFetcher:function(e){if(R.v7_fetcherPersist){let t=(ve.get(e)||0)-1;t<=0?(ve.delete(e),ge.add(e)):ve.set(e,t)}else tt(e);_e({fetchers:new Map(O.fetchers)})},abortFetcher(e,t){let{reason:r,data:a}=void 0===t?{}:t;K.has(e)?rt(e,r):ee.has(e)&&ee.get(e).abort(r),Ge(e,qe(void 0===a?null:a))},dispose:function(){E&&E(),z&&z(),x.clear(),_&&_.abort(),O.fetchers.forEach(((e,t)=>tt(t))),O.blockers.forEach(((e,t)=>it(t)))},getBlocker:function(e,t){let r=O.blockers.get(e)||X;return ke.get(e)!==t&&ke.set(e,t),r},deleteBlocker:it,patchRoutes:function(e,t){let r=null==c;ue(e,t,c||b,g,u),r&&(b=[...b],_e({}))},_internalFetchControllers:K,_internalActiveDeferreds:xe,_internalSetRoutes:function(e){g={},c=f(e,u,void 0,g)}},v},e.createStaticHandler=function(e,r){n(e.length>0,"You must provide a non-empty routes array to createStaticHandler");let a,o={},i=(r?r.basename:null)||"/";if(null!=r&&r.mapRouteProperties)a=r.mapRouteProperties;else if(null!=r&&r.detectErrorBoundary){let e=r.detectErrorBoundary;a=t=>({hasErrorBoundary:e(t)})}else a=Q;let u=t({v7_relativeSplatPath:!1,v7_throwAbortReason:!1},r?r.future:null),c=f(e,a,void 0,o);async function h(e,r,a,o,i,s,l){n(e.signal,"query()/queryRoute() requests must contain an AbortController signal");try{if(Oe(e.method.toLowerCase())){let n=await async function(e,r,a,n,o,i,s){let l;if(a.route.action||a.route.lazy){l=(await y("action",e,[a],r,s,n,o))[a.route.id],e.signal.aborted&&te(e,s,u)}else{let t=Ee(405,{method:e.method,pathname:new URL(e.url).pathname,routeId:a.route.id});if(s)throw t;l={type:d.error,error:t}}if(je(l))throw new Response(null,{status:l.response.status,headers:{Location:l.response.headers.get("Location")}});if(Le(l)){let e=Ee(400,{type:"defer-action"});if(s)throw e;l={type:d.error,error:e}}if(s){if(Me(l))throw l.error;return{matches:[a],loaderData:{},actionData:{[a.route.id]:l.data},errors:null,statusCode:200,loaderHeaders:{},actionHeaders:{},activeDeferreds:null}}let c=new Request(e.url,{headers:e.headers,redirect:e.redirect,signal:e.signal});if(Me(l)){let e=i?a:Se(r,a.route.id);return t({},await m(c,r,n,o,i,null,[e.route.id,l]),{statusCode:N(l.error)?l.error.status:null!=l.statusCode?l.statusCode:500,actionData:null,actionHeaders:t({},l.headers?{[a.route.id]:l.headers}:{})})}return t({},await m(c,r,n,o,i,null),{actionData:{[a.route.id]:l.data}},l.statusCode?{statusCode:l.statusCode}:{},{actionHeaders:l.headers?{[a.route.id]:l.headers}:{}})}(e,a,l||ze(a,r),o,i,s,null!=l);return n}let n=await m(e,a,o,i,s,l);return _e(n)?n:t({},n,{actionData:null,actionHeaders:{}})}catch(e){if(function(e){return null!=e&&"object"==typeof e&&"type"in e&&"result"in e&&(e.type===d.data||e.type===d.error)}(e)&&_e(e.result)){if(e.type===d.error)throw e.result;return e.result}if(function(e){if(!_e(e))return!1;let t=e.status,r=e.headers.get("Location");return t>=300&&t<=399&&null!=r}(e))return e;throw e}}async function m(e,r,a,n,o,i,s){let l=null!=i;if(l&&(null==i||!i.route.loader)&&(null==i||!i.route.lazy))throw Ee(400,{method:e.method,pathname:new URL(e.url).pathname,routeId:null==i?void 0:i.route.id});let c=(i?[i]:s&&Me(s[1])?ne(r,s[0]):r).filter((e=>e.route.loader||e.route.lazy));if(0===c.length)return{matches:r,loaderData:r.reduce(((e,t)=>Object.assign(e,{[t.route.id]:null})),{}),errors:s&&Me(s[1])?{[s[0]]:s[1].error}:null,statusCode:200,loaderHeaders:{},activeDeferreds:null};let d=await y("loader",e,c,r,l,a,n);e.signal.aborted&&te(e,l,u);let h=new Map,f=ge(r,d,s,h,o),p=new Set(c.map((e=>e.route.id)));return r.forEach((e=>{p.has(e.route.id)||(f.loaderData[e.route.id]=null)})),t({},f,{matches:r,activeDeferreds:h.size>0?Object.fromEntries(h.entries()):null})}async function y(e,t,r,n,s,l,c){let d=await de(c||ce,e,null,t,r,n,null,o,a,l),h={};return await Promise.all(n.map((async e=>{if(!(e.route.id in d))return;let r=d[e.route.id];if(Ae(r)){throw fe(r.result,t,e.route.id,n,i,u.v7_relativeSplatPath)}if(_e(r.result)&&s)throw r;h[e.route.id]=await he(r)}))),h}return{dataRoutes:c,query:async function(e,r){let{requestContext:a,skipLoaderErrorBubbling:n,dataStrategy:o}=void 0===r?{}:r,u=new URL(e.url),d=e.method,f=s("",l(u),null,"default"),m=p(c,f,i);if(!Te(d)&&"HEAD"!==d){let e=Ee(405,{method:d}),{matches:t,route:r}=Re(c);return{basename:i,location:f,matches:t,loaderData:{},actionData:null,errors:{[r.id]:e},statusCode:e.status,loaderHeaders:{},actionHeaders:{},activeDeferreds:null}}if(!m){let e=Ee(404,{pathname:f.pathname}),{matches:t,route:r}=Re(c);return{basename:i,location:f,matches:t,loaderData:{},actionData:null,errors:{[r.id]:e},statusCode:e.status,loaderHeaders:{},actionHeaders:{},activeDeferreds:null}}let y=await h(e,f,m,a,o||null,!0===n,null);return _e(y)?y:t({location:f,basename:i},y)},queryRoute:async function(e,t){let{routeId:r,requestContext:a,dataStrategy:n}=void 0===t?{}:t,o=new URL(e.url),u=e.method,d=s("",l(o),null,"default"),f=p(c,d,i);if(!Te(u)&&"HEAD"!==u&&"OPTIONS"!==u)throw Ee(405,{method:u});if(!f)throw Ee(404,{pathname:d.pathname});let m=r?f.find((e=>e.route.id===r)):ze(f,d);if(r&&!m)throw Ee(403,{pathname:d.pathname,routeId:r});if(!m)throw Ee(404,{pathname:d.pathname});let y=await h(e,d,f,a,n||null,!1,m);if(_e(y))return y;let v=y.errors?Object.values(y.errors)[0]:void 0;if(void 0!==v)throw v;if(y.actionData)return Object.values(y.actionData)[0];if(y.loaderData){var g;let e=Object.values(y.loaderData)[0];return null!=(g=y.activeDeferreds)&&g[m.route.id]&&(e[ee]=y.activeDeferreds[m.route.id]),e}}}},e.data=function(e,t){return new O(e,"number"==typeof t?{status:t}:t)},e.defer=function(e,t){return void 0===t&&(t={}),new I(e,"number"==typeof t?{status:t}:t)},e.generatePath=function(e,t){void 0===t&&(t={});let r=e;r.endsWith("*")&&"*"!==r&&!r.endsWith("/*")&&(o(!1,'Route path "'+r+'" will be treated as if it were "'+r.replace(/\*$/,"/*")+'" because the `*` character must always follow a `/` in the pattern. To get rid of this warning, please change the route path to "'+r.replace(/\*$/,"/*")+'".'),r=r.replace(/\*$/,"/*"));const a=r.startsWith("/")?"/":"",i=e=>null==e?"":"string"==typeof e?e:String(e);return a+r.split(/\/+/).map(((e,r,a)=>{if(r===a.length-1&&"*"===e){return i(t["*"])}const o=e.match(/^:([\w-]+)(\??)$/);if(o){const[,e,r]=o;let a=t[e];return n("?"===r||null!=a,'Missing ":'+e+'" param'),i(a)}return e.replace(/\?$/g,"")})).filter((e=>!!e)).join("/")},e.getStaticContextFromError=function(e,r,a){return t({},r,{statusCode:N(a)?a.status:500,errors:{[r._deepestRenderedBoundaryId||e[0].id]:a}})},e.getToPathname=function(e){return""===e||""===e.pathname?"/":"string"==typeof e?u(e).pathname:e.pathname},e.isDataWithResponseInit=ke,e.isDeferredData=Ce,e.isRouteErrorResponse=N,e.joinPaths=k,e.json=function(e,r){void 0===r&&(r={});let a="number"==typeof r?{status:r}:r,n=new Headers(a.headers);return n.has("Content-Type")||n.set("Content-Type","application/json; charset=utf-8"),new Response(JSON.stringify(e),t({},a,{headers:n}))},e.matchPath=R,e.matchRoutes=p,e.normalizePathname=C,e.parsePath=u,e.redirect=F,e.redirectDocument=(e,t)=>{let r=F(e,t);return r.headers.set("X-Remix-Reload-Document","true"),r},e.replace=(e,t)=>{let r=F(e,t);return r.headers.set("X-Remix-Replace","true"),r},e.resolvePath=x,e.resolveTo=j,e.stripBasename=P,Object.defineProperty(e,"__esModule",{value:!0})}));
//# sourceMappingURL=router.umd.min.js.map

@@ -19,3 +19,3 @@ import type { Location, Path, To } from "./history";

type: ResultType.data;
data: any;
data: unknown;
statusCode?: number;

@@ -38,6 +38,3 @@ headers?: Headers;

type: ResultType.redirect;
status: number;
location: string;
revalidate: boolean;
reloadDocument?: boolean;
response: Response;
}

@@ -49,3 +46,4 @@ /**

type: ResultType.error;
error: any;
error: unknown;
statusCode?: number;
headers?: Headers;

@@ -138,8 +136,11 @@ }

type DataFunctionValue = Response | NonNullable<unknown> | null;
type DataFunctionReturnValue = Promise<DataFunctionValue> | DataFunctionValue;
/**
* Route loader function signature
*/
export interface LoaderFunction<Context = any> {
(args: LoaderFunctionArgs<Context>): Promise<DataFunctionValue> | DataFunctionValue;
}
export type LoaderFunction<Context = any> = {
(args: LoaderFunctionArgs<Context>, handlerCtx?: unknown): DataFunctionReturnValue;
} & {
hydrate?: boolean;
};
/**

@@ -149,3 +150,3 @@ * Route action function signature

export interface ActionFunction<Context = any> {
(args: ActionFunctionArgs<Context>): Promise<DataFunctionValue> | DataFunctionValue;
(args: ActionFunctionArgs<Context>, handlerCtx?: unknown): DataFunctionReturnValue;
}

@@ -166,2 +167,3 @@ /**

json?: Submission["json"];
actionStatus?: number;
actionResult?: any;

@@ -189,3 +191,27 @@ defaultShouldRevalidate: boolean;

}
export interface DataStrategyMatch extends AgnosticRouteMatch<string, AgnosticDataRouteObject> {
shouldLoad: boolean;
resolve: (handlerOverride?: (handler: (ctx?: unknown) => DataFunctionReturnValue) => DataFunctionReturnValue) => Promise<DataStrategyResult>;
}
export interface DataStrategyFunctionArgs<Context = any> extends DataFunctionArgs<Context> {
matches: DataStrategyMatch[];
fetcherKey: string | null;
}
/**
* Result from a loader or action called via dataStrategy
*/
export interface DataStrategyResult {
type: "data" | "error";
result: unknown;
}
export interface DataStrategyFunction {
(args: DataStrategyFunctionArgs): Promise<Record<string, DataStrategyResult>>;
}
export type AgnosticPatchRoutesOnNavigationFunctionArgs<O extends AgnosticRouteObject = AgnosticRouteObject, M extends AgnosticRouteMatch = AgnosticRouteMatch> = {
path: string;
matches: M[];
patch: (routeId: string | null, children: O[]) => void;
};
export type AgnosticPatchRoutesOnNavigationFunction<O extends AgnosticRouteObject = AgnosticRouteObject, M extends AgnosticRouteMatch = AgnosticRouteMatch> = (opts: AgnosticPatchRoutesOnNavigationFunctionArgs<O, M>) => void | Promise<void>;
/**
* Function provided by the framework-aware layers to set any framework-specific

@@ -223,4 +249,4 @@ * properties from framework-agnostic properties

id?: string;
loader?: LoaderFunction;
action?: ActionFunction;
loader?: LoaderFunction | boolean;
action?: ActionFunction | boolean;
hasErrorBoundary?: boolean;

@@ -272,3 +298,3 @@ shouldRevalidate?: ShouldRevalidateFunction;

*/
type PathParam<Path extends string> = Path extends "*" | "/*" ? "*" : Path extends `${infer Rest}/*` ? "*" | _PathParam<Rest> : _PathParam<Path>;
export type PathParam<Path extends string> = Path extends "*" | "/*" ? "*" : Path extends `${infer Rest}/*` ? "*" | _PathParam<Rest> : _PathParam<Path>;
export type ParamParseKey<Segment extends string> = [

@@ -306,3 +332,3 @@ PathParam<Segment>

}
export declare function convertRoutesToDataRoutes(routes: AgnosticRouteObject[], mapRouteProperties: MapRoutePropertiesFunction, parentPath?: number[], manifest?: RouteManifest): AgnosticDataRouteObject[];
export declare function convertRoutesToDataRoutes(routes: AgnosticRouteObject[], mapRouteProperties: MapRoutePropertiesFunction, parentPath?: string[], manifest?: RouteManifest): AgnosticDataRouteObject[];
/**

@@ -314,2 +340,3 @@ * Matches the given routes to a location and returns the match data.

export declare function matchRoutes<RouteObjectType extends AgnosticRouteObject = AgnosticRouteObject>(routes: RouteObjectType[], locationArg: Partial<Location> | string, basename?: string): AgnosticRouteMatch<string, RouteObjectType>[] | null;
export declare function matchRoutesImpl<RouteObjectType extends AgnosticRouteObject = AgnosticRouteObject>(routes: RouteObjectType[], locationArg: Partial<Location> | string, basename: string, allowPartial: boolean): AgnosticRouteMatch<string, RouteObjectType>[] | null;
export interface UIMatch<Data = unknown, Handle = unknown> {

@@ -379,2 +406,3 @@ id: string;

export declare function matchPath<ParamKey extends ParamParseKey<Path>, Path extends string>(pattern: PathPattern<Path> | Path, pathname: string): PathMatch<ParamKey> | null;
export declare function decodePath(value: string): string;
/**

@@ -414,2 +442,3 @@ * @private

export declare function getPathContributingMatches<T extends AgnosticRouteMatch = AgnosticRouteMatch>(matches: T[]): T[];
export declare function getResolveToMatches<T extends AgnosticRouteMatch = AgnosticRouteMatch>(matches: T[], v7_relativeSplatPath: boolean): string[];
/**

@@ -445,2 +474,13 @@ * @private

export declare const json: JsonFunction;
export declare class DataWithResponseInit<D> {
type: string;
data: D;
init: ResponseInit | null;
constructor(data: D, init?: ResponseInit);
}
/**
* Create "responses" that contain `status`/`headers` without forcing
* serialization into an actual `Response` - used by Remix single fetch
*/
export declare function data<D>(data: D, init?: number | ResponseInit): DataWithResponseInit<D>;
export interface TrackedPromise extends Promise<any> {

@@ -487,2 +527,9 @@ _tracked?: boolean;

export declare const redirectDocument: RedirectFunction;
/**
* A redirect response that will perform a `history.replaceState` instead of a
* `history.pushState` for client-side navigation redirects.
* Sets the status code and the `Location` header.
* Defaults to "302 Found".
*/
export declare const replace: RedirectFunction;
export type ErrorResponse = {

@@ -489,0 +536,0 @@ status: number;

@@ -693,2 +693,6 @@ ////////////////////////////////////////////////////////////////////////////////

let href = typeof to === "string" ? to : createPath(to);
// Treating this as a full URL will strip any trailing spaces so we need to
// pre-encode them since they might be part of a matching splat param from
// an ancestor route
href = href.replace(/ $/, "%20");
invariant(

@@ -695,0 +699,0 @@ base,

@@ -10,4 +10,10 @@ export type {

AgnosticNonIndexRouteObject,
AgnosticPatchRoutesOnNavigationFunction,
AgnosticPatchRoutesOnNavigationFunctionArgs,
AgnosticRouteMatch,
AgnosticRouteObject,
DataStrategyFunction,
DataStrategyFunctionArgs,
DataStrategyMatch,
DataStrategyResult,
ErrorResponse,

@@ -24,2 +30,3 @@ FormEncType,

PathMatch,
PathParam,
PathPattern,

@@ -32,2 +39,3 @@ RedirectFunction,

V7_FormMethod,
DataWithResponseInit as UNSAFE_DataWithResponseInit,
} from "./utils";

@@ -37,2 +45,3 @@

AbortedDeferredError,
data,
defer,

@@ -49,2 +58,3 @@ generatePath,

redirectDocument,
replace,
resolvePath,

@@ -94,3 +104,4 @@ resolveTo,

convertRouteMatchToUiMatch as UNSAFE_convertRouteMatchToUiMatch,
getPathContributingMatches as UNSAFE_getPathContributingMatches,
decodePath as UNSAFE_decodePath,
getResolveToMatches as UNSAFE_getResolveToMatches,
} from "./utils";

@@ -97,0 +108,0 @@

{
"name": "@remix-run/router",
"version": "0.0.0-experimental-7f486334",
"version": "0.0.0-experimental-819a53c77",
"description": "Nested/Data-driven/Framework-agnostic Routing",

@@ -33,2 +33,2 @@ "keywords": [

}
}
}

@@ -7,3 +7,3 @@ # Remix Router

> **Warning**
> [!WARNING]
>

@@ -10,0 +10,0 @@ > This router is a low-level package intended to be consumed by UI layer routing libraries. You should very likely not be using this package directly unless you are authoring a routing library such as [`react-router-dom`][react-router-repo] or one of it's other [UI ports][remix-routers-repo].

@@ -23,3 +23,3 @@ import type { Location, Path, To } from "./history";

type: ResultType.data;
data: any;
data: unknown;
statusCode?: number;

@@ -44,6 +44,4 @@ headers?: Headers;

type: ResultType.redirect;
status: number;
location: string;
revalidate: boolean;
reloadDocument?: boolean;
// We keep the raw Response for redirects so we can return it verbatim
response: Response;
}

@@ -56,3 +54,4 @@

type: ResultType.error;
error: any;
error: unknown;
statusCode?: number;
headers?: Headers;

@@ -172,10 +171,13 @@ }

type DataFunctionReturnValue = Promise<DataFunctionValue> | DataFunctionValue;
/**
* Route loader function signature
*/
export interface LoaderFunction<Context = any> {
(args: LoaderFunctionArgs<Context>):
| Promise<DataFunctionValue>
| DataFunctionValue;
}
export type LoaderFunction<Context = any> = {
(
args: LoaderFunctionArgs<Context>,
handlerCtx?: unknown
): DataFunctionReturnValue;
} & { hydrate?: boolean };

@@ -186,5 +188,6 @@ /**

export interface ActionFunction<Context = any> {
(args: ActionFunctionArgs<Context>):
| Promise<DataFunctionValue>
| DataFunctionValue;
(
args: ActionFunctionArgs<Context>,
handlerCtx?: unknown
): DataFunctionReturnValue;
}

@@ -206,2 +209,3 @@

json?: Submission["json"];
actionStatus?: number;
actionResult?: any;

@@ -232,3 +236,47 @@ defaultShouldRevalidate: boolean;

export interface DataStrategyMatch
extends AgnosticRouteMatch<string, AgnosticDataRouteObject> {
shouldLoad: boolean;
resolve: (
handlerOverride?: (
handler: (ctx?: unknown) => DataFunctionReturnValue
) => DataFunctionReturnValue
) => Promise<DataStrategyResult>;
}
export interface DataStrategyFunctionArgs<Context = any>
extends DataFunctionArgs<Context> {
matches: DataStrategyMatch[];
fetcherKey: string | null;
}
/**
* Result from a loader or action called via dataStrategy
*/
export interface DataStrategyResult {
type: "data" | "error";
result: unknown; // data, Error, Response, DeferredData, DataWithResponseInit
}
export interface DataStrategyFunction {
(args: DataStrategyFunctionArgs): Promise<Record<string, DataStrategyResult>>;
}
export type AgnosticPatchRoutesOnNavigationFunctionArgs<
O extends AgnosticRouteObject = AgnosticRouteObject,
M extends AgnosticRouteMatch = AgnosticRouteMatch
> = {
path: string;
matches: M[];
patch: (routeId: string | null, children: O[]) => void;
};
export type AgnosticPatchRoutesOnNavigationFunction<
O extends AgnosticRouteObject = AgnosticRouteObject,
M extends AgnosticRouteMatch = AgnosticRouteMatch
> = (
opts: AgnosticPatchRoutesOnNavigationFunctionArgs<O, M>
) => void | Promise<void>;
/**
* Function provided by the framework-aware layers to set any framework-specific

@@ -287,4 +335,4 @@ * properties from framework-agnostic properties

id?: string;
loader?: LoaderFunction;
action?: ActionFunction;
loader?: LoaderFunction | boolean;
action?: ActionFunction | boolean;
hasErrorBoundary?: boolean;

@@ -360,3 +408,3 @@ shouldRevalidate?: ShouldRevalidateFunction;

*/
type PathParam<Path extends string> =
export type PathParam<Path extends string> =
// check if path is just a wildcard

@@ -424,7 +472,7 @@ Path extends "*" | "/*"

mapRouteProperties: MapRoutePropertiesFunction,
parentPath: number[] = [],
parentPath: string[] = [],
manifest: RouteManifest = {}
): AgnosticDataRouteObject[] {
return routes.map((route, index) => {
let treePath = [...parentPath, index];
let treePath = [...parentPath, String(index)];
let id = typeof route.id === "string" ? route.id : treePath.join("-");

@@ -484,2 +532,13 @@ invariant(

): AgnosticRouteMatch<string, RouteObjectType>[] | null {
return matchRoutesImpl(routes, locationArg, basename, false);
}
export function matchRoutesImpl<
RouteObjectType extends AgnosticRouteObject = AgnosticRouteObject
>(
routes: RouteObjectType[],
locationArg: Partial<Location> | string,
basename: string,
allowPartial: boolean
): AgnosticRouteMatch<string, RouteObjectType>[] | null {
let location =

@@ -499,11 +558,13 @@ typeof locationArg === "string" ? parsePath(locationArg) : locationArg;

for (let i = 0; matches == null && i < branches.length; ++i) {
// Incoming pathnames are generally encoded from either window.location
// or from router.navigate, but we want to match against the unencoded
// paths in the route definitions. Memory router locations won't be
// encoded here but there also shouldn't be anything to decode so this
// should be a safe operation. This avoids needing matchRoutes to be
// history-aware.
let decoded = decodePath(pathname);
matches = matchRouteBranch<string, RouteObjectType>(
branches[i],
// Incoming pathnames are generally encoded from either window.location
// or from router.navigate, but we want to match against the unencoded
// paths in the route definitions. Memory router locations won't be
// encoded here but there also shouldn't be anything to decode so this
// should be a safe operation. This avoids needing matchRoutes to be
// history-aware.
safelyDecodeURI(pathname)
decoded,
allowPartial
);

@@ -600,3 +661,2 @@ }

);
flattenRoutes(route.children, branches, routesMeta, path);

@@ -701,3 +761,3 @@ }

const paramRe = /^:\w+$/;
const paramRe = /^:[\w-]+$/;
const dynamicSegmentValue = 3;

@@ -755,3 +815,4 @@ const indexRouteValue = 2;

branch: RouteBranch<RouteObjectType>,
pathname: string
pathname: string,
allowPartial = false
): AgnosticRouteMatch<ParamKey, RouteObjectType>[] | null {

@@ -775,8 +836,26 @@ let { routesMeta } = branch;

if (!match) return null;
let route = meta.route;
if (
!match &&
end &&
allowPartial &&
!routesMeta[routesMeta.length - 1].route.index
) {
match = matchPath(
{
path: meta.relativePath,
caseSensitive: meta.caseSensitive,
end: false,
},
remainingPathname
);
}
if (!match) {
return null;
}
Object.assign(matchedParams, match.params);
let route = meta.route;
matches.push({

@@ -841,3 +920,3 @@ // TODO: Can this as be avoided?

const keyMatch = segment.match(/^:(\w+)(\??)$/);
const keyMatch = segment.match(/^:([\w-]+)(\??)$/);
if (keyMatch) {

@@ -950,3 +1029,3 @@ const [, key, optional] = keyMatch;

} else {
memo[paramName] = safelyDecodeURIComponent(value || "", paramName);
memo[paramName] = (value || "").replace(/%2F/g, "/");
}

@@ -988,6 +1067,9 @@ return memo;

.replace(/[\\.*+^${}|()[\]]/g, "\\$&") // Escape special regex chars
.replace(/\/:(\w+)(\?)?/g, (_: string, paramName: string, isOptional) => {
params.push({ paramName, isOptional: isOptional != null });
return isOptional ? "/?([^\\/]+)?" : "/([^\\/]+)";
});
.replace(
/\/:([\w-]+)(\?)?/g,
(_: string, paramName: string, isOptional) => {
params.push({ paramName, isOptional: isOptional != null });
return isOptional ? "/?([^\\/]+)?" : "/([^\\/]+)";
}
);

@@ -1021,5 +1103,8 @@ if (path.endsWith("*")) {

function safelyDecodeURI(value: string) {
export function decodePath(value: string) {
try {
return decodeURI(value);
return value
.split("/")
.map((v) => decodeURIComponent(v).replace(/\//g, "%2F"))
.join("/");
} catch (error) {

@@ -1037,17 +1122,2 @@ warning(

function safelyDecodeURIComponent(value: string, paramName: string) {
try {
return decodeURIComponent(value);
} catch (error) {
warning(
false,
`The value for the URL param "${paramName}" will not be decoded because` +
` the string "${value}" is a malformed URL segment. This is probably` +
` due to a bad percent encoding (${error}).`
);
return value;
}
}
/**

@@ -1169,2 +1239,21 @@ * @private

// Return the array of pathnames for the current route matches - used to
// generate the routePathnames input for resolveTo()
export function getResolveToMatches<
T extends AgnosticRouteMatch = AgnosticRouteMatch
>(matches: T[], v7_relativeSplatPath: boolean) {
let pathMatches = getPathContributingMatches(matches);
// When v7_relativeSplatPath is enabled, use the full pathname for the leaf
// match so we include splat values for "." links. See:
// https://github.com/remix-run/react-router/issues/11052#issuecomment-1836589329
if (v7_relativeSplatPath) {
return pathMatches.map((match, idx) =>
idx === pathMatches.length - 1 ? match.pathname : match.pathnameBase
);
}
return pathMatches.map((match) => match.pathnameBase);
}
/**

@@ -1213,3 +1302,3 @@ * @private

// to the current location's pathname and *not* the route pathname.
if (isPathRelative || toPathname == null) {
if (toPathname == null) {
from = locationPathname;

@@ -1219,8 +1308,9 @@ } else {

if (toPathname.startsWith("..")) {
// With relative="route" (the default), each leading .. segment means
// "go up one route" instead of "go up one URL segment". This is a key
// difference from how <a href> works and a major reason we call this a
// "to" value instead of a "href".
if (!isPathRelative && toPathname.startsWith("..")) {
let toSegments = toPathname.split("/");
// Each leading .. segment means "go up one route" instead of "go up one
// URL segment". This is a key difference from how <a href> works and a
// major reason we call this a "to" value instead of a "href".
while (toSegments[0] === "..") {

@@ -1234,4 +1324,2 @@ toSegments.shift();

// If there are more ".." segments than parent routes, resolve relative to
// the root / URL.
from = routePathnameIndex >= 0 ? routePathnames[routePathnameIndex] : "/";

@@ -1321,2 +1409,24 @@ }

export class DataWithResponseInit<D> {
type: string = "DataWithResponseInit";
data: D;
init: ResponseInit | null;
constructor(data: D, init?: ResponseInit) {
this.data = data;
this.init = init || null;
}
}
/**
* Create "responses" that contain `status`/`headers` without forcing
* serialization into an actual `Response` - used by Remix single fetch
*/
export function data<D>(data: D, init?: number | ResponseInit) {
return new DataWithResponseInit(
data,
typeof init === "number" ? { status: init } : init
);
}
export interface TrackedPromise extends Promise<any> {

@@ -1566,2 +1676,14 @@ _tracked?: boolean;

/**
* A redirect response that will perform a `history.replaceState` instead of a
* `history.pushState` for client-side navigation redirects.
* Sets the status code and the `Location` header.
* Defaults to "302 Found".
*/
export const replace: RedirectFunction = (url, init) => {
let response = redirect(url, init);
response.headers.set("X-Remix-Replace", "true");
return response;
};
export type ErrorResponse = {

@@ -1568,0 +1690,0 @@ status: number;

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc