@remix-run/router
Advanced tools
Comparing version 0.0.0-experimental-d90c8fb3 to 0.0.0-experimental-db3389095
182
CHANGELOG.md
# `@remix-run/router` | ||
## 1.21.1 | ||
### Patch Changes | ||
- - Fix issue with fetcher data cleanup in the data layer on fetcher unmount ([#12674](https://github.com/remix-run/react-router/pull/12674)) | ||
- Fix behavior of manual fetcher keys when not opted into `future.v7_fetcherPersist` | ||
## 1.21.0 | ||
### Minor Changes | ||
- - Log deprecation warnings for v7 flags ([#11750](https://github.com/remix-run/react-router/pull/11750)) | ||
- Add deprecation warnings to `json`/`defer` in favor of returning raw objects | ||
- These methods will be removed in React Router v7 | ||
### Patch Changes | ||
- Update JSDoc URLs for new website structure (add /v6/ segment) ([#12141](https://github.com/remix-run/react-router/pull/12141)) | ||
## 1.20.0 | ||
### Minor Changes | ||
- Stabilize `unstable_patchRoutesOnNavigation` ([#11973](https://github.com/remix-run/react-router/pull/11973)) | ||
- Add new `PatchRoutesOnNavigationFunctionArgs` type for convenience ([#11967](https://github.com/remix-run/react-router/pull/11967)) | ||
- Stabilize `unstable_dataStrategy` ([#11974](https://github.com/remix-run/react-router/pull/11974)) | ||
- Stabilize the `unstable_flushSync` option for navigations and fetchers ([#11989](https://github.com/remix-run/react-router/pull/11989)) | ||
- Stabilize the `unstable_viewTransition` option for navigations and the corresponding `unstable_useViewTransitionState` hook ([#11989](https://github.com/remix-run/react-router/pull/11989)) | ||
### Patch Changes | ||
- Fix bug when submitting to the current contextual route (parent route with an index child) when an `?index` param already exists from a prior submission ([#12003](https://github.com/remix-run/react-router/pull/12003)) | ||
- Fix `useFormAction` bug - when removing `?index` param it would not keep other non-Remix `index` params ([#12003](https://github.com/remix-run/react-router/pull/12003)) | ||
- Fix bug with fetchers not persisting `preventScrollReset` through redirects during concurrent fetches ([#11999](https://github.com/remix-run/react-router/pull/11999)) | ||
- Remove internal cache to fix issues with interrupted `patchRoutesOnNavigation` calls ([#12055](https://github.com/remix-run/react-router/pull/12055)) | ||
- We used to cache in-progress calls to `patchRoutesOnNavigation` internally so that multiple navigations with the same start/end would only execute the function once and use the same promise | ||
- However, this approach was at odds with `patch` short circuiting if a navigation was interrupted (and the `request.signal` aborted) since the first invocation's `patch` would no-op | ||
- This cache also made some assumptions as to what a valid cache key might be - and is oblivious to any other application-state changes that may have occurred | ||
- So, the cache has been removed because in _most_ cases, repeated calls to something like `import()` for async routes will already be cached automatically - and if not it's easy enough for users to implement this cache in userland | ||
- Avoid unnecessary `console.error` on fetcher abort due to back-to-back revalidation calls ([#12050](https://github.com/remix-run/react-router/pull/12050)) | ||
- Expose errors thrown from `patchRoutesOnNavigation` directly to `useRouteError` instead of wrapping them in a 400 `ErrorResponse` instance ([#12111](https://github.com/remix-run/react-router/pull/12111)) | ||
- Fix types for `RouteObject` within `PatchRoutesOnNavigationFunction`'s `patch` method so it doesn't expect agnostic route objects passed to `patch` ([#11967](https://github.com/remix-run/react-router/pull/11967)) | ||
- Fix bugs with `partialHydration` when hydrating with errors ([#12070](https://github.com/remix-run/react-router/pull/12070)) | ||
- Remove internal `discoveredRoutes` FIFO queue from `unstable_patchRoutesOnNavigation` ([#11977](https://github.com/remix-run/react-router/pull/11977)) | ||
## 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/v6/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 | ||
@@ -425,3 +603,3 @@ | ||
- Added support for [**Future Flags**](https://reactrouter.com/en/main/guides/api-development-strategy) in React Router. The first flag being introduced is `future.v7_normalizeFormMethod` which will normalize the exposed `useNavigation()/useFetcher()` `formMethod` fields as uppercase HTTP methods to align with the `fetch()` behavior. ([#10207](https://github.com/remix-run/react-router/pull/10207)) | ||
- Added support for [**Future Flags**](https://reactrouter.com/v6/guides/api-development-strategy) in React Router. The first flag being introduced is `future.v7_normalizeFormMethod` which will normalize the exposed `useNavigation()/useFetcher()` `formMethod` fields as uppercase HTTP methods to align with the `fetch()` behavior. ([#10207](https://github.com/remix-run/react-router/pull/10207)) | ||
@@ -684,4 +862,4 @@ - When `future.v7_normalizeFormMethod === false` (default v6 behavior), | ||
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 `react-router`, we recommend you go check out the [docs](https://reactrouter.com), especially the [feature overview](https://reactrouter.com/en/6.4.0/start/overview) and the [tutorial](https://reactrouter.com/en/6.4.0/start/tutorial). | ||
For an overview of the features provided by `@remix-run/router`, please check out the [`README`](./README.md). |
@@ -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, PathParam, 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, getResolveToMatches as UNSAFE_getResolveToMatches, } 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"; | ||
/** | ||
@@ -165,2 +165,12 @@ * A Router instance manages all navigation and data loading/mutations | ||
* @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 | ||
@@ -262,2 +272,3 @@ * | ||
v7_relativeSplatPath: boolean; | ||
v7_skipActionErrorRevalidation: boolean; | ||
} | ||
@@ -279,2 +290,4 @@ /** | ||
window?: Window; | ||
dataStrategy?: DataStrategyFunction; | ||
patchRoutesOnNavigation?: AgnosticPatchRoutesOnNavigationFunction; | ||
} | ||
@@ -304,2 +317,4 @@ /** | ||
requestContext?: unknown; | ||
skipLoaderErrorBubbling?: boolean; | ||
dataStrategy?: DataStrategyFunction; | ||
}): Promise<StaticHandlerContext | Response>; | ||
@@ -309,2 +324,3 @@ queryRoute(request: Request, opts?: { | ||
requestContext?: unknown; | ||
dataStrategy?: DataStrategyFunction; | ||
}): Promise<any>; | ||
@@ -322,4 +338,4 @@ } | ||
deletedFetchers: string[]; | ||
unstable_viewTransitionOpts?: ViewTransitionOpts; | ||
unstable_flushSync: boolean; | ||
viewTransitionOpts?: ViewTransitionOpts; | ||
flushSync: boolean; | ||
}): void; | ||
@@ -344,3 +360,3 @@ } | ||
relative?: RelativeRoutingType; | ||
unstable_flushSync?: boolean; | ||
flushSync?: boolean; | ||
}; | ||
@@ -351,3 +367,3 @@ type BaseNavigateOptions = BaseNavigateOrFetchOptions & { | ||
fromRouteId?: string; | ||
unstable_viewTransition?: boolean; | ||
viewTransition?: boolean; | ||
}; | ||
@@ -498,2 +514,3 @@ type BaseSubmissionOptions = { | ||
v7_relativeSplatPath: boolean; | ||
v7_throwAbortReason: boolean; | ||
} | ||
@@ -515,3 +532,4 @@ export interface CreateStaticHandlerOptions { | ||
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-d90c8fb3 | ||
* @remix-run/router v0.0.0-experimental-db3389095 | ||
* | ||
@@ -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 o(e,t){if(!1===e||null==e)throw new Error(t)}function n(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,o){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||o||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 d(e,n,c,d){void 0===d&&(d={});let{window:u=document.defaultView,v5Compat:h=!1}=d,f=u.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"!==u.location.origin?u.location.origin:u.location.href,r="string"==typeof e?e:l(e);return o(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(u,f)},listen(e){if(m)throw new Error("A history only accepts one active listener");return u.addEventListener(a,g),m=e,()=>{u.removeEventListener(a,g),m=null}},createHref:e=>n(u,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 o=i(a,y),n=w.createHref(a);try{f.pushState(o,"",n)}catch(e){if(e instanceof DOMException&&"DataCloneError"===e.name)throw e;u.location.assign(n)}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 o=i(a,y),n=w.createHref(a);f.replaceState(o,"",n),h&&m&&m({action:p,location:w.location,delta:0})},go:e=>f.go(e)};return w}let u=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,n){return void 0===a&&(a=[]),void 0===n&&(n={}),e.map(((e,i)=>{let s=[...a,i],l="string"==typeof e.id?e.id:s.join("-");if(o(!0!==e.index||!e.children,"Cannot specify children on an index route"),o(!n[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 n[l]=a,a}{let a=t({},e,r(e),{id:l,children:void 0});return n[l]=a,e.children&&(a.children=f(e.children,r,s,n)),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 o=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)))))}(o);let n=null;for(let e=0;null==n&&e<o.length;++e){let t=E(a);n=D(o[e],t)}return n}function m(e,t){let{route:r,pathname:a,params:o}=e;return{id:r.id,pathname:a,params:o,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 n=(e,n,i)=>{let s={relativePath:void 0===i?e.path||"":i,caseSensitive:!0===e.caseSensitive,childrenIndex:n,route:e};s.relativePath.startsWith("/")&&(o(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=j([a,s.relativePath]),c=r.concat(s);e.children&&e.children.length>0&&(o(!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))n(e,t,r);else n(e,t)})),t}function v(e){let t=e.split("/");if(0===t.length)return[];let[r,...a]=t,o=r.endsWith("?"),n=r.replace(/\?$/,"");if(0===a.length)return o?[n,""]:[n];let i=v(a.join("/")),s=[];return s.push(...i.map((e=>""===e?n:[n,e].join("/")))),o&&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={},o="/",n=[];for(let e=0;e<r.length;++e){let i=r[e],s=e===r.length-1,l="/"===o?t:t.slice(o.length)||"/",c=S({path:i.relativePath,caseSensitive:i.caseSensitive,end:s},l);if(!c)return null;Object.assign(a,c.params);let d=i.route;n.push({params:a,pathname:j([o,c.pathname]),pathnameBase:k(j([o,c.pathnameBase])),route:d}),"/"!==c.pathnameBase&&(o=j([o,c.pathnameBase]))}return n}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);n("*"===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=[],o="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,((e,t,r)=>(a.push({paramName:t,isOptional:null!=r}),r?"/?([^\\/]+)?":"/([^\\/]+)")));e.endsWith("*")?(a.push({paramName:"*"}),o+="*"===e||"/*"===e?"(.*)$":"(?:\\/(.+)|\\/*)$"):r?o+="\\/*$":""!==e&&"/"!==e&&(o+="(?:(?=\\/|$))");return[new RegExp(o,t?void 0:"i"),a]}(e.path,e.caseSensitive,e.end),o=t.match(r);if(!o)return null;let i=o[0],s=i.replace(/(.)\/+$/,"$1"),l=o.slice(1);return{params:a.reduce(((e,t,r)=>{let{paramName:a,isOptional:o}=t;if("*"===a){let e=l[r]||"";s=i.slice(0,i.length-e.length).replace(/(.)\/+$/,"$1")}const n=l[r];return e[a]=o&&!n?void 0:(n||"").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 n(!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 P(e,t){void 0===t&&(t="/");let{pathname:r,search:a="",hash:o=""}="string"==typeof e?c(e):e,n=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:n,search:_(a),hash:C(o)}}function x(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 A(e){return e.filter(((e,t)=>0===t||e.route.path&&e.route.path.length>0))}function L(e,t){let r=A(e);return t?r.map(((t,r)=>r===e.length-1?t.pathname:t.pathnameBase)):r.map((e=>e.pathnameBase))}function M(e,r,a,n){let i;void 0===n&&(n=!1),"string"==typeof e?i=c(e):(i=t({},e),o(!i.pathname||!i.pathname.includes("?"),x("?","pathname","search",i)),o(!i.pathname||!i.pathname.includes("#"),x("#","pathname","hash",i)),o(!i.search||!i.search.includes("#"),x("#","search","hash",i)));let s,l=""===e||""===i.pathname,d=l?"/":i.pathname;if(null==d)s=a;else{let e=r.length-1;if(!n&&d.startsWith("..")){let t=d.split("/");for(;".."===t[0];)t.shift(),e-=1;i.pathname=t.join("/")}s=e>=0?r[e]:"/"}let u=P(i,s),h=d&&"/"!==d&&d.endsWith("/"),f=(l||"."===d)&&a.endsWith("/");return u.pathname.endsWith("/")||!h&&!f||(u.pathname+="/"),u}const j=e=>e.join("/").replace(/\/\/+/g,"/"),k=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),_=e=>e&&"?"!==e?e.startsWith("?")?e:"?"+e:"",C=e=>e&&"#"!==e?e.startsWith("#")?e:"#"+e:"";class T extends Error{}class O{constructor(e,t){let r;this.pendingKeysSet=new Set,this.subscribers=new Set,this.deferredKeys=[],o(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 o(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]:U(a)})}),{})}get pendingKeys(){return Array.from(this.pendingKeysSet)}}function U(e){if(!function(e){return e instanceof Promise&&!0===e._tracked}(e))return e;if(e._error)throw e._error;return e._data}const H=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 o=new Headers(a.headers);return o.set("Location",e),new Response(null,t({},a,{headers:o}))};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"],F=new Set(q),B=["get",...q],N=new Set(B),W=new Set([301,302,303,307,308]),$=new Set([307,308]),K={state:"idle",location:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0},J={state:"idle",data:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0},Y={state:"unblocked",proceed:void 0,reset:void 0,location:void 0},V=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,X=e=>({hasErrorBoundary:Boolean(e.hasErrorBoundary)}),G="remix-router-transitions";const Q=Symbol("deferred");function Z(e,t,r,a,o,n,i,s){let c,d;if(i){c=[];for(let e of t)if(c.push(e),e.route.id===i){d=e;break}}else c=t,d=t[t.length-1];let u=M(o||".",L(c,n),R(e.pathname,r)||e.pathname,"path"===s);return null==o&&(u.search=e.search,u.hash=e.hash),null!=o&&""!==o&&"."!==o||!d||!d.route.index||Ae(u.search)||(u.search=u.search?u.search.replace(/^\?/,"?index&"):"?index"),a&&"/"!==r&&(u.pathname="/"===u.pathname?r:j([r,u.pathname])),l(u)}function ee(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&&!Ee(a.formMethod))return{path:r,error:me(405,{method:a.formMethod})};let n,i,s=()=>({path:r,error:me(400,{type:"invalid-body"})}),d=a.formMethod||"get",u=e?d.toUpperCase():d.toLowerCase(),h=ve(r);if(void 0!==a.body){if("text/plain"===a.formEncType){if(!Re(u))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:u,formAction:h,formEncType:a.formEncType,formData:void 0,json:void 0,text:e}}}if("application/json"===a.formEncType){if(!Re(u))return s();try{let e="string"==typeof a.body?JSON.parse(a.body):a.body;return{path:r,submission:{formMethod:u,formAction:h,formEncType:a.formEncType,formData:void 0,json:e,text:void 0}}}catch(e){return s()}}}if(o("function"==typeof FormData,"FormData is not available in this environment"),a.formData)n=le(a.formData),i=a.formData;else if(a.body instanceof FormData)n=le(a.body),i=a.body;else if(a.body instanceof URLSearchParams)n=a.body,i=ce(n);else if(null==a.body)n=new URLSearchParams,i=new FormData;else try{n=new URLSearchParams(a.body),i=ce(n)}catch(e){return s()}let f={formMethod:u,formAction:h,formEncType:a&&a.formEncType||"application/x-www-form-urlencoded",formData:i,json:void 0,text:void 0};if(Re(f.formMethod))return{path:r,submission:f};let p=c(r);return t&&p.search&&Ae(p.search)&&n.append("index",""),p.search="?"+n,{path:l(p),submission:f}}function te(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 re(e,r,a,o,n,i,s,l,c,d,u,h,f,m,y,v){let g=v?Object.values(v)[0]:y?Object.values(y)[0]:void 0,b=e.createURL(r.location),w=e.createURL(n),D=v?Object.keys(v)[0]:void 0,S=te(a,D).filter(((e,a)=>{let{route:n}=e;if(n.lazy)return!0;if(null==n.loader)return!1;if(i)return!!n.loader.hydrate||void 0===r.loaderData[n.id]&&(!r.errors||void 0===r.errors[n.id]);if(function(e,t,r){let a=!t||r.route.id!==t.route.id,o=void 0===e[r.route.id];return a||o}(r.loaderData,r.matches[a],e)||l.some((t=>t===e.route.id)))return!0;let c=r.matches[a],d=e;return oe(e,t({currentUrl:b,currentParams:c.params,nextUrl:w,nextParams:d.params},o,{actionResult:g,defaultShouldRevalidate:s||b.pathname+b.search===w.pathname+w.search||b.search!==w.search||ae(c,d)}))})),E=[];return u.forEach(((e,n)=>{if(i||!a.some((t=>t.route.id===e.routeId))||d.has(n))return;let l=p(f,e.path,m);if(!l)return void E.push({key:n,routeId:e.routeId,path:e.path,matches:null,match:null,controller:null});let u=r.fetchers.get(n),y=Le(l,e.path),v=!1;v=!h.has(n)&&(!!c.includes(n)||(u&&"idle"!==u.state&&void 0===u.data?s:oe(y,t({currentUrl:b,currentParams:r.matches[r.matches.length-1].params,nextUrl:w,nextParams:a[a.length-1].params},o,{actionResult:g,defaultShouldRevalidate:s})))),v&&E.push({key:n,routeId:e.routeId,path:e.path,matches:l,match:y,controller:new AbortController})})),[S,E]}function ae(e,t){let r=e.route.path;return e.pathname!==t.pathname||null!=r&&r.endsWith("*")&&e.params["*"]!==t.params["*"]}function oe(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];o(s,"No route found in manifest");let l={};for(let e in i){let t=void 0!==s[e]&&"hasErrorBoundary"!==e;n(!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 ie(e,t,r,a,n,i,s,l,c){let d,h,f;void 0===c&&(c={});let p=e=>{let a,o=new Promise(((e,t)=>a=t));return f=()=>a(),t.signal.addEventListener("abort",f),Promise.race([e({request:t,params:r.params,context:c.requestContext}),o])};try{let a=r.route[e];if(r.route.lazy)if(a){let e,t=await Promise.all([p(a).catch((t=>{e=t})),ne(r.route,i,n)]);if(e)throw e;h=t[0]}else{if(await ne(r.route,i,n),a=r.route[e],!a){if("action"===e){let e=new URL(t.url),a=e.pathname+e.search;throw me(405,{method:t.method,pathname:a,routeId:r.route.id})}return{type:u.data,data:void 0}}h=await p(a)}else{if(!a){let e=new URL(t.url);throw me(404,{pathname:e.pathname+e.search})}h=await p(a)}o(void 0!==h,"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){d=u.error,h=e}finally{f&&t.signal.removeEventListener("abort",f)}if(Se(h)){let e,n=h.status;if(W.has(n)){let e=h.headers.get("Location");if(o(e,"Redirects returned/thrown from loaders/actions must have a Location header"),V.test(e)){if(!c.isStaticRequest){let r=new URL(t.url),a=e.startsWith("//")?new URL(r.protocol+e):new URL(e),o=null!=R(a.pathname,s);a.origin===r.origin&&o&&(e=a.pathname+a.search+a.hash)}}else e=Z(new URL(t.url),a.slice(0,a.indexOf(r)+1),s,!0,e,l);if(c.isStaticRequest)throw h.headers.set("Location",e),h;return{type:u.redirect,status:n,location:e,revalidate:null!==h.headers.get("X-Remix-Revalidate"),reloadDocument:null!==h.headers.get("X-Remix-Reload-Document")}}if(c.isRouteRequest){throw{type:d===u.error?u.error:u.data,response:h}}try{let t=h.headers.get("Content-Type");e=t&&/\bapplication\/json\b/.test(t)?null==h.body?null:await h.json():await h.text()}catch(e){return{type:u.error,error:e}}return d===u.error?{type:d,error:new I(n,h.statusText,e),headers:h.headers}:{type:u.data,data:e,statusCode:h.status,headers:h.headers}}return d===u.error?{type:d,error:h}:De(h)?{type:u.deferred,deferredData:h,statusCode:null==(m=h.init)?void 0:m.status,headers:(null==(y=h.init)?void 0:y.headers)&&new Headers(h.init.headers)}:{type:u.data,data:h};var m,y}function se(e,t,r,a){let o=e.createURL(ve(t)).toString(),n={signal:r};if(a&&Re(a.formMethod)){let{formMethod:e,formEncType:t}=a;n.method=e.toUpperCase(),"application/json"===t?(n.headers=new Headers({"Content-Type":t}),n.body=JSON.stringify(a.json)):"text/plain"===t?n.body=a.text:"application/x-www-form-urlencoded"===t&&a.formData?n.body=le(a.formData):n.body=a.formData}return new Request(o,n)}function le(e){let t=new URLSearchParams;for(let[r,a]of e.entries())t.append(r,"string"==typeof a?a:a.name);return t}function ce(e){let t=new FormData;for(let[r,a]of e.entries())t.append(r,a);return t}function de(e,t,r,a,n){let i,s={},l=null,c=!1,d={};return r.forEach(((r,u)=>{let h=t[u].route.id;if(o(!we(r),"Cannot handle redirect results in processLoaderData"),be(r)){let t=fe(e,h),o=r.error;a&&(o=Object.values(a)[0],a=void 0),l=l||{},null==l[t.route.id]&&(l[t.route.id]=o),s[h]=void 0,c||(c=!0,i=z(r.error)?r.error.status:500),r.headers&&(d[h]=r.headers)}else ge(r)?(n.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&&(d[h]=r.headers)})),a&&(l=a,s[Object.keys(a)[0]]=void 0),{loaderData:s,errors:l,statusCode:i||200,loaderHeaders:d}}function ue(e,r,a,n,i,s,l,c){let{loaderData:d,errors:u}=de(r,a,n,i,c);for(let r=0;r<s.length;r++){let{key:a,match:n,controller:i}=s[r];o(void 0!==l&&void 0!==l[r],"Did not find corresponding fetcher result");let c=l[r];if(!i||!i.signal.aborted)if(be(c)){let r=fe(e.matches,null==n?void 0:n.route.id);u&&u[r.route.id]||(u=t({},u,{[r.route.id]:c.error})),e.fetchers.delete(a)}else if(we(c))o(!1,"Unhandled fetcher revalidation redirect");else if(ge(c))o(!1,"Unhandled fetcher deferred data");else{let t=Ce(c.data);e.fetchers.set(a,t)}}return{loaderData:d,errors:u}}function he(e,r,a,o){let n=t({},r);for(let t of a){let a=t.route.id;if(r.hasOwnProperty(a)?void 0!==r[a]&&(n[a]=r[a]):void 0!==e[a]&&t.route.loader&&(n[a]=e[a]),o&&o.hasOwnProperty(a))break}return n}function fe(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 pe(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 me(e,t){let{pathname:r,routeId:a,method:o,type:n}=void 0===t?{}:t,i="Unknown Server Error",s="Unknown @remix-run/router error";return 400===e?(i="Bad Request",o&&r&&a?s="You made a "+o+' request to "'+r+'" but did not provide a `loader` for route "'+a+'", so there is no way to handle the request.':"defer-action"===n?s="defer() is not supported in actions":"invalid-body"===n&&(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",o&&r&&a?s="You made a "+o.toUpperCase()+' request to "'+r+'" but did not provide an `action` for route "'+a+'", so there is no way to handle the request.':o&&(s='Invalid request method "'+o.toUpperCase()+'"')),new I(e||500,i,new Error(s),!0)}function ye(e){for(let t=e.length-1;t>=0;t--){let r=e[t];if(we(r))return{result:r,idx:t}}}function ve(e){return l(t({},"string"==typeof e?c(e):e,{hash:""}))}function ge(e){return e.type===u.deferred}function be(e){return e.type===u.error}function we(e){return(e&&e.type)===u.redirect}function De(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 Se(e){return null!=e&&"number"==typeof e.status&&"string"==typeof e.statusText&&"object"==typeof e.headers&&void 0!==e.body}function Ee(e){return N.has(e.toLowerCase())}function Re(e){return F.has(e.toLowerCase())}async function Pe(e,t,r,a,n,i){for(let s=0;s<r.length;s++){let l=r[s],c=t[s];if(!c)continue;let d=e.find((e=>e.route.id===c.route.id)),u=null!=d&&!ae(d,c)&&void 0!==(i&&i[c.route.id]);if(ge(l)&&(n||u)){let e=a[s];o(e,"Expected an AbortSignal for revalidating fetcher deferred result"),await xe(l,e,n).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:u.data,data:e.deferredData.unwrappedData}}catch(e){return{type:u.error,error:e}}return{type:u.data,data:e.deferredData.data}}}function Ae(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&&Ae(r||""))return e[e.length-1];let a=A(e);return a[a.length-1]}function Me(e){let{formMethod:t,formAction:r,formEncType:a,text:o,formData:n,json:i}=e;if(t&&r&&a)return null!=o?{formMethod:t,formAction:r,formEncType:a,formData:void 0,json:void 0,text:o}:null!=n?{formMethod:t,formAction:r,formEncType:a,formData:n,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 je(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 ke(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 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=Y,e.IDLE_FETCHER=J,e.IDLE_NAVIGATION=K,e.UNSAFE_DEFERRED_SYMBOL=Q,e.UNSAFE_DeferredData=O,e.UNSAFE_ErrorResponseImpl=I,e.UNSAFE_convertRouteMatchToUiMatch=m,e.UNSAFE_convertRoutesToDataRoutes=f,e.UNSAFE_getResolveToMatches=L,e.UNSAFE_invariant=o,e.UNSAFE_warning=n,e.createBrowserHistory=function(e){return void 0===e&&(e={}),d((function(e,t){let{pathname:r,search:a,hash:o}=e.location;return s("",{pathname:r,search:a,hash:o},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={}),d((function(e,t){let{pathname:r="/",search:a="",hash:o=""}=c(e.location.hash.substr(1));return r.startsWith("/")||r.startsWith(".")||(r="/"+r),s("",{pathname:r,search:a,hash:o},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){n("/"===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:o,v5Compat:i=!1}=e;t=a.map(((e,t)=>m(e,"string"==typeof e?null:e.state,0===t?"default":void 0)));let d=f(null==o?t.length-1:o),u=r.Pop,h=null;function f(e){return Math.min(Math.max(e,0),t.length-1)}function p(){return t[d]}function m(e,r,a){void 0===r&&(r=null);let o=s(t?p().pathname:"/",e,r,a);return n("/"===o.pathname.charAt(0),"relative pathnames are not supported in memory history: "+JSON.stringify(e)),o}function y(e){return"string"==typeof e?e:l(e)}return{get index(){return d},get action(){return u},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){u=r.Push;let o=m(e,a);d+=1,t.splice(d,t.length,o),i&&h&&h({action:u,location:o,delta:1})},replace(e,a){u=r.Replace;let o=m(e,a);t[d]=o,i&&h&&h({action:u,location:o,delta:0})},go(e){u=r.Pop;let a=f(d+e),o=t[a];d=a,h&&h({action:u,location:o,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(o(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=X;let d,h,y={},v=f(e.routes,c,void 0,y),g=e.basename||"/",b=t({v7_fetcherPersist:!1,v7_normalizeFormMethod:!1,v7_partialHydration:!1,v7_prependBasename:!1,v7_relativeSplatPath:!1},e.future),w=null,D=new Set,S=null,E=null,P=null,x=null!=e.hydrationData,A=p(v,e.history.location,g),L=null;if(null==A){let t=me(404,{pathname:e.history.location.pathname}),{matches:r,route:a}=pe(v);A=r,L={[a.id]:t}}let M,j=A.some((e=>e.route.lazy)),k=A.some((e=>e.route.loader));if(j)h=!1;else if(k)if(b.v7_partialHydration){let t=e.hydrationData?e.hydrationData.loaderData:null,r=e.hydrationData?e.hydrationData.errors:null;h=A.every((e=>e.route.loader&&!0!==e.route.loader.hydrate&&(t&&void 0!==t[e.route.id]||r&&void 0!==r[e.route.id])))}else h=null!=e.hydrationData;else h=!0;let _,C={historyAction:e.history.action,location:e.history.location,matches:A,initialized:h,navigation:K,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},T=r.Pop,O=!1,U=!1,H=new Map,I=null,z=!1,q=!1,F=[],B=[],N=new Map,W=0,Q=-1,te=new Map,ae=new Set,oe=new Map,ne=new Map,le=new Set,ce=new Map,de=new Map,ve=!1;function De(e,r){void 0===r&&(r={}),C=t({},C,e);let a=[],o=[];b.v7_fetcherPersist&&C.fetchers.forEach(((e,t)=>{"idle"===e.state&&(le.has(t)?o.push(t):a.push(t))})),[...D].forEach((e=>e(C,{deletedFetchers:o,unstable_viewTransitionOpts:r.viewTransitionOpts,unstable_flushSync:!0===r.flushSync}))),b.v7_fetcherPersist&&(a.forEach((e=>C.fetchers.delete(e))),o.forEach((e=>ze(e))))}function Se(a,o,n){var i,s;let l,{flushSync:c}=void 0===n?{}:n,u=null!=C.actionData&&null!=C.navigation.formMethod&&Re(C.navigation.formMethod)&&"loading"===C.navigation.state&&!0!==(null==(i=a.state)?void 0:i._isRedirect);l=o.actionData?Object.keys(o.actionData).length>0?o.actionData:null:u?C.actionData:null;let h=o.loaderData?he(C.loaderData,o.loaderData,o.matches||[],o.errors):C.loaderData,f=C.blockers;f.size>0&&(f=new Map(f),f.forEach(((e,t)=>f.set(t,Y))));let p,m=!0===O||null!=C.navigation.formMethod&&Re(C.navigation.formMethod)&&!0!==(null==(s=a.state)?void 0:s._isRedirect);if(d&&(v=d,d=void 0),z||T===r.Pop||(T===r.Push?e.history.push(a,a.state):T===r.Replace&&e.history.replace(a,a.state)),T===r.Pop){let e=H.get(C.location.pathname);e&&e.has(a.pathname)?p={currentLocation:C.location,nextLocation:a}:H.has(a.pathname)&&(p={currentLocation:a,nextLocation:C.location})}else if(U){let e=H.get(C.location.pathname);e?e.add(a.pathname):(e=new Set([a.pathname]),H.set(C.location.pathname,e)),p={currentLocation:C.location,nextLocation:a}}De(t({},o,{actionData:l,loaderData:h,historyAction:T,location:a,initialized:!0,navigation:K,revalidation:"idle",restoreScrollPosition:Ve(a,o.matches||C.matches),preventScrollReset:m,blockers:f}),{viewTransitionOpts:p,flushSync:!0===c}),T=r.Pop,O=!1,U=!1,z=!1,q=!1,F=[],B=[]}async function Ee(a,o,n){_&&_.abort(),_=null,T=a,z=!0===(n&&n.startUninterruptedRevalidation),function(e,t){if(S&&P){let r=Ye(e,t);S[r]=P()}}(C.location,C.matches),O=!0===(n&&n.preventScrollReset),U=!0===(n&&n.enableViewTransition);let i=d||v,s=n&&n.overrideNavigation,l=p(i,o,g),h=!0===(n&&n.flushSync);if(!l){let e=me(404,{pathname:o.pathname}),{matches:t,route:r}=pe(i);return Je(),void Se(o,{matches:t,loaderData:{},errors:{[r.id]:e}},{flushSync:h})}if(C.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}(C.location,o)&&!(n&&n.submission&&Re(n.submission.formMethod)))return void Se(o,{matches:l},{flushSync:h});_=new AbortController;let f,m,w=se(e.history,o,_.signal,n&&n.submission);if(n&&n.pendingError)m={[fe(l).route.id]:n.pendingError};else if(n&&n.submission&&Re(n.submission.formMethod)){let e=await async function(e,t,a,o,n){void 0===n&&(n={});let i;Oe(),De({navigation:ke(t,a)},{flushSync:!0===n.flushSync});let s=Le(o,t);if(s.route.action||s.route.lazy){if(i=await ie("action",e,s,o,y,c,g,b.v7_relativeSplatPath),e.signal.aborted)return{shortCircuited:!0}}else i={type:u.error,error:me(405,{method:e.method,pathname:t.pathname,routeId:s.route.id})};if(we(i)){let e;return e=n&&null!=n.replace?n.replace:i.location===C.location.pathname+C.location.search,await Ae(C,i,{submission:a,replace:e}),{shortCircuited:!0}}if(be(i)){let e=fe(o,s.route.id);return!0!==(n&&n.replace)&&(T=r.Push),{pendingActionData:{},pendingActionError:{[e.route.id]:i.error}}}if(ge(i))throw me(400,{type:"defer-action"});return{pendingActionData:{[s.route.id]:i.data}}}(w,o,n.submission,l,{replace:n.replace,flushSync:h});if(e.shortCircuited)return;f=e.pendingActionData,m=e.pendingActionError,s=je(o,n.submission),h=!1,w=new Request(w.url,{signal:w.signal})}let{shortCircuited:D,loaderData:E,errors:R}=await async function(r,a,o,n,i,s,l,c,u,h,f){let p=n||je(a,i),m=i||s||Me(p),y=d||v,[w,D]=re(e.history,C,o,m,a,b.v7_partialHydration&&!0===c,q,F,B,le,oe,ae,y,g,h,f);if(Je((e=>!(o&&o.some((t=>t.route.id===e)))||w&&w.some((t=>t.route.id===e)))),Q=++W,0===w.length&&0===D.length){let e=Be();return Se(a,t({matches:o,loaderData:{},errors:f||null},h?{actionData:h}:{},e?{fetchers:new Map(C.fetchers)}:{}),{flushSync:u}),{shortCircuited:!0}}if(!(z||b.v7_partialHydration&&c)){D.forEach((e=>{let t=C.fetchers.get(e.key),r=_e(void 0,t?t.data:void 0);C.fetchers.set(e.key,r)}));let e=h||C.actionData;De(t({navigation:p},e?0===Object.keys(e).length?{actionData:null}:{actionData:e}:{},D.length>0?{fetchers:new Map(C.fetchers)}:{}),{flushSync:u})}D.forEach((e=>{N.has(e.key)&&qe(e.key),e.controller&&N.set(e.key,e.controller)}));let S=()=>D.forEach((e=>qe(e.key)));_&&_.signal.addEventListener("abort",S);let{results:E,loaderResults:R,fetcherResults:P}=await Te(C.matches,o,w,D,r);if(r.signal.aborted)return{shortCircuited:!0};_&&_.signal.removeEventListener("abort",S);D.forEach((e=>N.delete(e.key)));let x=ye(E);if(x){if(x.idx>=w.length){let e=D[x.idx-w.length].key;ae.add(e)}return await Ae(C,x.result,{replace:l}),{shortCircuited:!0}}let{loaderData:A,errors:L}=ue(C,o,w,R,f,D,P,ce);ce.forEach(((e,t)=>{e.subscribe((r=>{(r||e.done)&&ce.delete(t)}))}));let M=Be(),j=Ne(Q),k=M||j||D.length>0;return t({loaderData:A,errors:L},k?{fetchers:new Map(C.fetchers)}:{})}(w,o,l,s,n&&n.submission,n&&n.fetcherSubmission,n&&n.replace,n&&!0===n.initialHydration,h,f,m);D||(_=null,Se(o,t({matches:l},f?{actionData:f}:{},{loaderData:E,errors:R})))}async function Ae(n,l,c){let{submission:d,fetcherSubmission:u,replace:h}=void 0===c?{}:c;l.revalidate&&(q=!0);let f=s(n.location,l.location,{_isRedirect:!0});if(o(f,"Expected a location on the redirect navigation"),i){let t=!1;if(l.reloadDocument)t=!0;else if(V.test(l.location)){const r=e.history.createURL(l.location);t=r.origin!==a.location.origin||null==R(r.pathname,g)}if(t)return void(h?a.location.replace(l.location):a.location.assign(l.location))}_=null;let p=!0===h?r.Replace:r.Push,{formMethod:m,formAction:y,formEncType:v}=n.navigation;!d&&!u&&m&&y&&v&&(d=Me(n.navigation));let b=d||u;if($.has(l.status)&&b&&Re(b.formMethod))await Ee(p,f,{submission:t({},b,{formAction:l.location}),preventScrollReset:O});else{let e=je(f,d);await Ee(p,f,{overrideNavigation:e,fetcherSubmission:u,preventScrollReset:O})}}async function Te(t,r,a,o,n){let i=await Promise.all([...a.map((e=>ie("loader",n,e,r,y,c,g,b.v7_relativeSplatPath))),...o.map((t=>{if(t.matches&&t.match&&t.controller)return ie("loader",se(e.history,t.path,t.controller.signal),t.match,t.matches,y,c,g,b.v7_relativeSplatPath);return{type:u.error,error:me(404,{pathname:t.path})}}))]),s=i.slice(0,a.length),l=i.slice(a.length);return await Promise.all([Pe(t,a,s,s.map((()=>n.signal)),!1,C.loaderData),Pe(t,o.map((e=>e.match)),l,o.map((e=>e.controller?e.controller.signal:null)),!0)]),{results:i,loaderResults:s,fetcherResults:l}}function Oe(){q=!0,F.push(...Je()),oe.forEach(((e,t)=>{N.has(t)&&(B.push(t),qe(t))}))}function Ue(e,t,r){void 0===r&&(r={}),C.fetchers.set(e,t),De({fetchers:new Map(C.fetchers)},{flushSync:!0===(r&&r.flushSync)})}function He(e,t,r,a){void 0===a&&(a={});let o=fe(C.matches,t);ze(e),De({errors:{[o.route.id]:r},fetchers:new Map(C.fetchers)},{flushSync:!0===(a&&a.flushSync)})}function Ie(e){return b.v7_fetcherPersist&&(ne.set(e,(ne.get(e)||0)+1),le.has(e)&&le.delete(e)),C.fetchers.get(e)||J}function ze(e){let t=C.fetchers.get(e);!N.has(e)||t&&"loading"===t.state&&te.has(e)||qe(e),oe.delete(e),te.delete(e),ae.delete(e),le.delete(e),C.fetchers.delete(e)}function qe(e){let t=N.get(e);o(t,"Expected fetch controller: "+e),t.abort(),N.delete(e)}function Fe(e){for(let t of e){let e=Ce(Ie(t).data);C.fetchers.set(t,e)}}function Be(){let e=[],t=!1;for(let r of ae){let a=C.fetchers.get(r);o(a,"Expected fetcher: "+r),"loading"===a.state&&(ae.delete(r),e.push(r),t=!0)}return Fe(e),t}function Ne(e){let t=[];for(let[r,a]of te)if(a<e){let e=C.fetchers.get(r);o(e,"Expected fetcher: "+r),"loading"===e.state&&(qe(r),te.delete(r),t.push(r))}return Fe(t),t.length>0}function We(e){C.blockers.delete(e),de.delete(e)}function $e(e,t){let r=C.blockers.get(e)||Y;o("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(C.blockers);a.set(e,t),De({blockers:a})}function Ke(e){let{currentLocation:t,nextLocation:r,historyAction:a}=e;if(0===de.size)return;de.size>1&&n(!1,"A router only supports one blocker at a time");let o=Array.from(de.entries()),[i,s]=o[o.length-1],l=C.blockers.get(i);return l&&"proceeding"===l.state?void 0:s({currentLocation:t,nextLocation:r,historyAction:a})?i:void 0}function Je(e){let t=[];return ce.forEach(((r,a)=>{e&&!e(a)||(r.cancel(),t.push(a),ce.delete(a))})),t}function Ye(e,t){if(E){return E(e,t.map((e=>m(e,C.loaderData))))||e.key}return e.key}function Ve(e,t){if(S){let r=Ye(e,t),a=S[r];if("number"==typeof a)return a}return null}return M={get basename(){return g},get future(){return b},get state(){return C},get routes(){return v},get window(){return a},initialize:function(){if(w=e.history.listen((t=>{let{action:r,location:a,delta:o}=t;if(ve)return void(ve=!1);n(0===de.size||null!=o,"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=Ke({currentLocation:C.location,nextLocation:a,historyAction:r});return i&&null!=o?(ve=!0,e.history.go(-1*o),void $e(i,{state:"blocked",location:a,proceed(){$e(i,{state:"proceeding",proceed:void 0,reset:void 0,location:a}),e.history.go(o)},reset(){let e=new Map(C.blockers);e.set(i,Y),De({blockers:e})}})):Ee(r,a)})),i){!function(e,t){try{let r=e.sessionStorage.getItem(G);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,H);let e=()=>function(e,t){if(t.size>0){let r={};for(let[e,a]of t)r[e]=[...a];try{e.sessionStorage.setItem(G,JSON.stringify(r))}catch(e){n(!1,"Failed to save applied view transitions in sessionStorage ("+e+").")}}}(a,H);a.addEventListener("pagehide",e),I=()=>a.removeEventListener("pagehide",e)}return C.initialized||Ee(r.Pop,C.location,{initialHydration:!0}),M},subscribe:function(e){return D.add(e),()=>D.delete(e)},enableScrollRestoration:function(e,t,r){if(S=e,P=t,E=r||null,!x&&C.navigation===K){x=!0;let e=Ve(C.location,C.matches);null!=e&&De({restoreScrollPosition:e})}return()=>{S=null,P=null,E=null}},navigate:async function a(o,n){if("number"==typeof o)return void e.history.go(o);let i=Z(C.location,C.matches,g,b.v7_prependBasename,o,b.v7_relativeSplatPath,null==n?void 0:n.fromRouteId,null==n?void 0:n.relative),{path:l,submission:c,error:d}=ee(b.v7_normalizeFormMethod,!1,i,n),u=C.location,h=s(C.location,l,n&&n.state);h=t({},h,e.history.encodeLocation(h));let f=n&&null!=n.replace?n.replace:void 0,p=r.Push;!0===f?p=r.Replace:!1===f||null!=c&&Re(c.formMethod)&&c.formAction===C.location.pathname+C.location.search&&(p=r.Replace);let m=n&&"preventScrollReset"in n?!0===n.preventScrollReset:void 0,y=!0===(n&&n.unstable_flushSync),v=Ke({currentLocation:u,nextLocation:h,historyAction:p});if(!v)return await Ee(p,h,{submission:c,pendingError:d,preventScrollReset:m,replace:n&&n.replace,enableViewTransition:n&&n.unstable_viewTransition,flushSync:y});$e(v,{state:"blocked",location:h,proceed(){$e(v,{state:"proceeding",proceed:void 0,reset:void 0,location:h}),a(o,n)},reset(){let e=new Map(C.blockers);e.set(v,Y),De({blockers:e})}})},fetch:function(t,r,a,n){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.");N.has(t)&&qe(t);let i=!0===(n&&n.unstable_flushSync),s=d||v,u=Z(C.location,C.matches,g,b.v7_prependBasename,a,b.v7_relativeSplatPath,r,null==n?void 0:n.relative),h=p(s,u,g);if(!h)return void He(t,r,me(404,{pathname:u}),{flushSync:i});let{path:f,submission:m,error:w}=ee(b.v7_normalizeFormMethod,!0,u,n);if(w)return void He(t,r,w,{flushSync:i});let D=Le(h,f);O=!0===(n&&n.preventScrollReset),m&&Re(m.formMethod)?async function(t,r,a,n,i,s,l){if(Oe(),oe.delete(t),!n.route.action&&!n.route.lazy){let e=me(405,{method:l.formMethod,pathname:a,routeId:r});return void He(t,r,e,{flushSync:s})}let u=C.fetchers.get(t);Ue(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,u),{flushSync:s});let h=new AbortController,f=se(e.history,a,h.signal,l);N.set(t,h);let m=W,w=await ie("action",f,n,i,y,c,g,b.v7_relativeSplatPath);if(f.signal.aborted)return void(N.get(t)===h&&N.delete(t));if(b.v7_fetcherPersist&&le.has(t)){if(we(w)||be(w))return void Ue(t,Ce(void 0))}else{if(we(w))return N.delete(t),Q>m?void Ue(t,Ce(void 0)):(ae.add(t),Ue(t,_e(l)),Ae(C,w,{fetcherSubmission:l}));if(be(w))return void He(t,r,w.error)}if(ge(w))throw me(400,{type:"defer-action"});let D=C.navigation.location||C.location,S=se(e.history,D,h.signal),E=d||v,R="idle"!==C.navigation.state?p(E,C.navigation.location,g):C.matches;o(R,"Didn't find any matches after fetcher action");let P=++W;te.set(t,P);let x=_e(l,w.data);C.fetchers.set(t,x);let[A,L]=re(e.history,C,R,l,D,!1,q,F,B,le,oe,ae,E,g,{[n.route.id]:w.data},void 0);L.filter((e=>e.key!==t)).forEach((e=>{let t=e.key,r=C.fetchers.get(t),a=_e(void 0,r?r.data:void 0);C.fetchers.set(t,a),N.has(t)&&qe(t),e.controller&&N.set(t,e.controller)})),De({fetchers:new Map(C.fetchers)});let M=()=>L.forEach((e=>qe(e.key)));h.signal.addEventListener("abort",M);let{results:j,loaderResults:k,fetcherResults:O}=await Te(C.matches,R,A,L,S);if(h.signal.aborted)return;h.signal.removeEventListener("abort",M),te.delete(t),N.delete(t),L.forEach((e=>N.delete(e.key)));let U=ye(j);if(U){if(U.idx>=A.length){let e=L[U.idx-A.length].key;ae.add(e)}return Ae(C,U.result)}let{loaderData:H,errors:I}=ue(C,C.matches,A,k,void 0,L,O,ce);if(C.fetchers.has(t)){let e=Ce(w.data);C.fetchers.set(t,e)}Ne(P),"loading"===C.navigation.state&&P>Q?(o(T,"Expected pending action"),_&&_.abort(),Se(C.navigation.location,{matches:R,loaderData:H,errors:I,fetchers:new Map(C.fetchers)})):(De({errors:I,loaderData:he(C.loaderData,H,R,I),fetchers:new Map(C.fetchers)}),q=!1)}(t,r,f,D,h,i,m):(oe.set(t,{routeId:r,path:f}),async function(t,r,a,n,i,s,l){let d=C.fetchers.get(t);Ue(t,_e(l,d?d.data:void 0),{flushSync:s});let u=new AbortController,h=se(e.history,a,u.signal);N.set(t,u);let f=W,p=await ie("loader",h,n,i,y,c,g,b.v7_relativeSplatPath);ge(p)&&(p=await xe(p,h.signal,!0)||p);N.get(t)===u&&N.delete(t);if(h.signal.aborted)return;if(le.has(t))return void Ue(t,Ce(void 0));if(we(p))return Q>f?void Ue(t,Ce(void 0)):(ae.add(t),void await Ae(C,p));if(be(p))return void He(t,r,p.error);o(!ge(p),"Unhandled fetcher deferred data"),Ue(t,Ce(p.data))}(t,r,f,D,h,i,m))},revalidate:function(){Oe(),De({revalidation:"loading"}),"submitting"!==C.navigation.state&&("idle"!==C.navigation.state?Ee(T||C.historyAction,C.navigation.location,{overrideNavigation:C.navigation}):Ee(C.historyAction,C.location,{startUninterruptedRevalidation:!0}))},createHref:t=>e.history.createHref(t),encodeLocation:t=>e.history.encodeLocation(t),getFetcher:Ie,deleteFetcher:function(e){if(b.v7_fetcherPersist){let t=(ne.get(e)||0)-1;t<=0?(ne.delete(e),le.add(e)):ne.set(e,t)}else ze(e);De({fetchers:new Map(C.fetchers)})},dispose:function(){w&&w(),I&&I(),D.clear(),_&&_.abort(),C.fetchers.forEach(((e,t)=>ze(t))),C.blockers.forEach(((e,t)=>We(t)))},getBlocker:function(e,t){let r=C.blockers.get(e)||Y;return de.get(e)!==t&&de.set(e,t),r},deleteBlocker:We,_internalFetchControllers:N,_internalActiveDeferreds:ce,_internalSetRoutes:function(e){y={},d=f(e,c,void 0,y)}},M},e.createStaticHandler=function(e,r){o(e.length>0,"You must provide a non-empty routes array to createStaticHandler");let a,n={},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=X;let c=t({v7_relativeSplatPath:!1},r?r.future:null),d=f(e,a,void 0,n);async function h(e,r,s,l,d){o(e.signal,"query()/queryRoute() requests must contain an AbortController signal");try{if(Re(e.method.toLowerCase())){let o=await async function(e,r,o,s,l){let d;if(o.route.action||o.route.lazy){if(d=await ie("action",e,o,r,n,a,i,c.v7_relativeSplatPath,{isStaticRequest:!0,isRouteRequest:l,requestContext:s}),e.signal.aborted){throw new Error((l?"queryRoute":"query")+"() call aborted: "+e.method+" "+e.url)}}else{let t=me(405,{method:e.method,pathname:new URL(e.url).pathname,routeId:o.route.id});if(l)throw t;d={type:u.error,error:t}}if(we(d))throw new Response(null,{status:d.status,headers:{Location:d.location}});if(ge(d)){let e=me(400,{type:"defer-action"});if(l)throw e;d={type:u.error,error:e}}if(l){if(be(d))throw d.error;return{matches:[o],loaderData:{},actionData:{[o.route.id]:d.data},errors:null,statusCode:200,loaderHeaders:{},actionHeaders:{},activeDeferreds:null}}if(be(d)){let a=fe(r,o.route.id);return t({},await m(e,r,s,void 0,{[a.route.id]:d.error}),{statusCode:z(d.error)?d.error.status:500,actionData:null,actionHeaders:t({},d.headers?{[o.route.id]:d.headers}:{})})}let h=new Request(e.url,{headers:e.headers,redirect:e.redirect,signal:e.signal});return t({},await m(h,r,s),d.statusCode?{statusCode:d.statusCode}:{},{actionData:{[o.route.id]:d.data},actionHeaders:t({},d.headers?{[o.route.id]:d.headers}:{})})}(e,s,d||Le(s,r),l,null!=d);return o}let o=await m(e,s,l,d);return Se(o)?o:t({},o,{actionData:null,actionHeaders:{}})}catch(e){if((h=e)&&Se(h.response)&&(h.type===u.data||h.type===u.error)){if(e.type===u.error)throw e.response;return e.response}if(function(e){if(!Se(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 h}async function m(e,r,o,s,l){let d=null!=s;if(d&&(null==s||!s.route.loader)&&(null==s||!s.route.lazy))throw me(400,{method:e.method,pathname:new URL(e.url).pathname,routeId:null==s?void 0:s.route.id});let u=(s?[s]:te(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 h=await Promise.all([...u.map((t=>ie("loader",e,t,r,n,a,i,c.v7_relativeSplatPath,{isStaticRequest:!0,isRouteRequest:d,requestContext:o})))]);if(e.signal.aborted){throw new Error((d?"queryRoute":"query")+"() call aborted: "+e.method+" "+e.url)}let f=new Map,p=de(r,u,h,l,f),m=new Set(u.map((e=>e.route.id)));return r.forEach((e=>{m.has(e.route.id)||(p.loaderData[e.route.id]=null)})),t({},p,{matches:r,activeDeferreds:f.size>0?Object.fromEntries(f.entries()):null})}return{dataRoutes:d,query:async function(e,r){let{requestContext:a}=void 0===r?{}:r,o=new URL(e.url),n=e.method,c=s("",l(o),null,"default"),u=p(d,c,i);if(!Ee(n)&&"HEAD"!==n){let e=me(405,{method:n}),{matches:t,route:r}=pe(d);return{basename:i,location:c,matches:t,loaderData:{},actionData:null,errors:{[r.id]:e},statusCode:e.status,loaderHeaders:{},actionHeaders:{},activeDeferreds:null}}if(!u){let e=me(404,{pathname:c.pathname}),{matches:t,route:r}=pe(d);return{basename:i,location:c,matches:t,loaderData:{},actionData:null,errors:{[r.id]:e},statusCode:e.status,loaderHeaders:{},actionHeaders:{},activeDeferreds:null}}let f=await h(e,c,u,a);return Se(f)?f:t({location:c,basename:i},f)},queryRoute:async function(e,t){let{routeId:r,requestContext:a}=void 0===t?{}:t,o=new URL(e.url),n=e.method,c=s("",l(o),null,"default"),u=p(d,c,i);if(!Ee(n)&&"HEAD"!==n&&"OPTIONS"!==n)throw me(405,{method:n});if(!u)throw me(404,{pathname:c.pathname});let f=r?u.find((e=>e.route.id===r)):Le(u,c);if(r&&!f)throw me(403,{pathname:c.pathname,routeId:r});if(!f)throw me(404,{pathname:c.pathname});let m=await h(e,c,u,a,f);if(Se(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[Q]=m.activeDeferreds[f.route.id]),e}}}},e.defer=function(e,t){return void 0===t&&(t={}),new O(e,"number"==typeof t?{status:t}:t)},e.generatePath=function(e,t){void 0===t&&(t={});let r=e;r.endsWith("*")&&"*"!==r&&!r.endsWith("/*")&&(n(!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 n=e.match(/^:([\w-]+)(\??)$/);if(n){const[,e,r]=n;let a=t[e];return o("?"===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=De,e.isRouteErrorResponse=z,e.joinPaths=j,e.json=function(e,r){void 0===r&&(r={});let a="number"==typeof r?{status:r}:r,o=new Headers(a.headers);return o.has("Content-Type")||o.set("Content-Type","application/json; charset=utf-8"),new Response(JSON.stringify(e),t({},a,{headers:o}))},e.matchPath=S,e.matchRoutes=p,e.normalizePathname=k,e.parsePath=c,e.redirect=H,e.redirectDocument=(e,t)=>{let r=H(e,t);return r.headers.set("X-Remix-Reload-Document","true"),r},e.resolvePath=P,e.resolveTo=M,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=D(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:S(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 S(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 D(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:T(a),hash:_(n)}}function L(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 A(e){return e.filter(((e,t)=>0===t||e.route.path&&e.route.path.length>0))}function M(e,t){let r=A(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("?"),L("?","pathname","search",i)),n(!i.pathname||!i.pathname.includes("#"),L("#","pathname","hash",i)),n(!i.search||!i.search.includes("#"),L("#","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(/^\/*/,"/"),T=e=>e&&"?"!==e?e.startsWith("?")?e:"?"+e:"",_=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 N=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 F(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]),J=new Set([307,308]),Y={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);if(null==n&&(d.search=e.search,d.hash=e.hash),(null==n||""===n||"."===n)&&c){let e=ze(d.search);if(c.route.index&&!e)d.search=d.search?d.search.replace(/^\?/,"?index&"):"?index";else if(!c.route.index&&e){let e=new URLSearchParams(d.search),t=e.getAll("index");e.delete("index"),t.filter((e=>e)).forEach((t=>e.append("index",t)));let r=e.toString();d.search=r?"?"+r:""}}return 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&&!Oe(a.formMethod))return{path:r,error:Pe(405,{method:a.formMethod})};let o,i,s=()=>({path:r,error:Pe(400,{type:"invalid-body"})}),c=a.formMethod||"get",d=e?c.toUpperCase():c.toLowerCase(),h=Le(r);if(void 0!==a.body){if("text/plain"===a.formEncType){if(!Ue(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(!Ue(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=ve(a.formData),i=a.formData;else if(a.body instanceof FormData)o=ve(a.body),i=a.body;else if(a.body instanceof URLSearchParams)o=a.body,i=ge(o);else if(null==a.body)o=new URLSearchParams,i=new FormData;else try{o=new URLSearchParams(a.body),i=ge(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(Ue(f.formMethod))return{path:r,submission:f};let p=u(r);return t&&p.search&&ze(p.search)&&o.append("index",""),p.search="?"+o,{path:l(p),submission:f}}function ne(e,t,r){void 0===r&&(r=!1);let a=e.findIndex((e=>e.route.id===t));return a>=0?e.slice(0,r?a+1:a):e}function oe(e,r,a,n,o,i,s,l,u,c,d,h,f,m,y,v){let g=v?je(v[1])?v[1].error:v[1].data:void 0,b=e.createURL(r.location),w=e.createURL(o),S=a;i&&r.errors?S=ne(a,Object.keys(r.errors)[0],!0):v&&je(v[1])&&(S=ne(a,v[0]));let D=v?v[1].statusCode:void 0,R=s&&D&&D>=400,E=S.filter(((e,a)=>{let{route:o}=e;if(o.lazy)return!0;if(null==o.loader)return!1;if(i)return ie(o,r.loaderData,r.errors);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 le(e,t({currentUrl:b,currentParams:s.params,nextUrl:w,nextParams:c.params},n,{actionResult:g,actionStatus:D,defaultShouldRevalidate:!R&&(l||b.pathname+b.search===w.pathname+w.search||b.search!==w.search||se(s,c))}))})),P=[];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 P.push({key:o,routeId:e.routeId,path:e.path,matches:null,match:null,controller:null});let u=r.fetchers.get(o),h=Fe(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:le(h,t({currentUrl:b,currentParams:r.matches[r.matches.length-1].params,nextUrl:w,nextParams:a[a.length-1].params},n,{actionResult:g,actionStatus:D,defaultShouldRevalidate:!R&&l})),v&&P.push({key:o,routeId:e.routeId,path:e.path,matches:s,match:h,controller:new AbortController})})),[E,P]}function ie(e,t,r){if(e.lazy)return!0;if(!e.loader)return!1;let a=null!=t&&void 0!==t[e.id],n=null!=r&&void 0!==r[e.id];return!(!a&&n)&&("function"==typeof e.loader&&!0===e.loader.hydrate||!a&&!n)}function se(e,t){let r=e.route.path;return e.pathname!==t.pathname||null!=r&&r.endsWith("*")&&e.params["*"]!==t.params["*"]}function le(e,t){if(e.route.shouldRevalidate){let r=e.route.shouldRevalidate(t);if("boolean"==typeof r)return r}return t.defaultShouldRevalidate}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=>ce(e,t))))),o,[e||"_","patch",String((null==(i=s)?void 0:i.length)||"0")],a);s.push(...l)}function ce(e,t){return"id"in e&&"id"in t&&e.id===t.id||e.index===t.index&&e.path===t.path&&e.caseSensitive===t.caseSensitive&&(!(e.children&&0!==e.children.length||t.children&&0!==t.children.length)||e.children.every(((e,r)=>{var a;return null==(a=t.children)?void 0:a.some((t=>ce(e,t)))})))}async function de(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 he(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 Pe(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 Pe(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 fe(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(Ce(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:F(t)?t.status:void 0}}var o,i,s,l;return Te(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)}:Ce(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 pe(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 me(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 ye(e,t,r,a){let n=e.createURL(Le(t)).toString(),o={signal:r};if(a&&Ue(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=ve(a.formData):o.body=a.formData}return new Request(n,o)}function ve(e){let t=new URLSearchParams;for(let[r,a]of e.entries())t.append(r,"string"==typeof a?a:a.name);return t}function ge(e){let t=new FormData;for(let[r,a]of e.entries())t.append(r,a);return t}function be(e,t,r,a,o){let i,s={},l=null,u=!1,c={},d=r&&je(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(!ke(f),"Cannot handle redirect results in processLoaderData"),je(f)){let t=f.error;if(void 0!==d&&(t=d,d=void 0),l=l||{},o)l[h]=t;else{let r=Re(e,h);null==l[r.route.id]&&(l[r.route.id]=t)}s[h]=void 0,u||(u=!0,i=F(f.error)?f.error.status:500),f.headers&&(c[h]=f.headers)}else Me(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 we(e,r,a,o,i,s,l){let{loaderData:u,errors:c}=be(r,a,o,l,!1);return i.forEach((r=>{let{key:a,match:o,controller:i}=r,l=s[a];if(n(l,"Did not find corresponding fetcher result"),!i||!i.signal.aborted)if(je(l)){let r=Re(e.matches,null==o?void 0:o.route.id);c&&c[r.route.id]||(c=t({},c,{[r.route.id]:l.error})),e.fetchers.delete(a)}else if(ke(l))n(!1,"Unhandled fetcher revalidation redirect");else if(Me(l))n(!1,"Unhandled fetcher deferred data");else{let t=Ke(l.data);e.fetchers.set(a,t)}})),{loaderData:u,errors:c}}function Se(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?je(e[1])?{actionData:{}}:{actionData:{[e[0]]:e[1].data}}:{}}function Re(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 Ee(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,message:i}=void 0===t?{}:t,s="Unknown Server Error",l="Unknown @remix-run/router error";return 400===e?(s="Bad Request",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 xe(e){let t=Object.entries(e);for(let e=t.length-1;e>=0;e--){let[r,a]=t[e];if(ke(a))return{key:r,result:a}}}function Le(e){return l(t({},"string"==typeof e?u(e):e,{hash:""}))}function Ae(e){return _e(e.result)&&K.has(e.result.status)}function Me(e){return e.type===d.deferred}function je(e){return e.type===d.error}function ke(e){return(e&&e.type)===d.redirect}function Ce(e){return"object"==typeof e&&null!=e&&"type"in e&&"data"in e&&"init"in e&&"DataWithResponseInit"===e.type}function Te(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 Oe(e){return q.has(e.toLowerCase())}function Ue(e){return W.has(e.toLowerCase())}async function Ie(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&&!se(c,u)&&void 0!==(n&&n[u.route.id]);Me(l)&&d&&await Ne(l,r,!1).then((e=>{e&&(t[s]=e)}))}}async function He(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))&&(Me(l)&&(n(s,"Expected an AbortController for revalidating fetcher deferred result"),await Ne(l,s.signal,!0).then((e=>{e&&(t[o]=e)}))))}}async function Ne(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 ze(e){return new URLSearchParams(e).getAll("index").some((e=>""===e))}function Fe(e,t){let r="string"==typeof t?u(t).search:t.search;if(e[e.length-1].route.index&&ze(r||""))return e[e.length-1];let a=A(e);return a[a.length-1]}function Be(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 We(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 $e(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 qe(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 Ke(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=Y,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||"/",S=e.dataStrategy||de,D=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,L=null,A=null,M=null,j=null!=e.hydrationData,k=p(b,e.history.location,w),C=null;if(null==k&&!D){let t=Pe(404,{pathname:e.history.location.pathname}),{matches:r,route:a}=Ee(b);k=r,C={[a.id]:t}}if(k&&!e.hydrationData){ct(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;if(r){let e=k.findIndex((e=>void 0!==r[e.route.id]));h=k.slice(0,e+1).every((e=>!ie(e.route,t,r)))}else h=k.every((e=>!ie(e.route,t,r)))}else h=null!=e.hydrationData;else h=!0;else if(h=!1,k=[],R.v7_partialHydration){let t=ct(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:Y,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,N=new Map,z=null,B=!1,W=!1,$=[],q=new Set,K=new Map,ee=0,te=-1,ne=new Map,se=new Set,le=new Map,ce=new Map,ve=new Set,ge=new Map,be=new Map;function Le(e,r){var a;void 0===r&&(r={}),console.log("updateState()",r.viewTransitionOpts),console.log(" navigation change",O.navigation.state,"->",null==(a=e.navigation)?void 0:a.state),console.log(" revalidation change",O.revalidation,"->",e.revalidation),O=t({},O,e);let n=[],o=[];R.v7_fetcherPersist&&O.fetchers.forEach(((e,t)=>{"idle"===e.state&&(ve.has(t)?o.push(t):n.push(t))})),ve.forEach((e=>{O.fetchers.has(e)||K.has(e)||o.push(e)})),[...x].forEach((e=>e(O,{deletedFetchers:o,viewTransitionOpts:r.viewTransitionOpts,flushSync:!0===r.flushSync}))),R.v7_fetcherPersist?(n.forEach((e=>O.fetchers.delete(e))),o.forEach((e=>Qe(e)))):o.forEach((e=>ve.delete(e)))}function Ce(a,n,o){var i,s;let l,{flushSync:u}=void 0===o?{}:o,d=null!=O.actionData&&null!=O.navigation.formMethod&&Ue(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?Se(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&&Ue(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=N.get(O.location.pathname);e&&e.has(a.pathname)?p={currentLocation:O.location,nextLocation:a}:N.has(a.pathname)&&(p={currentLocation:a,nextLocation:O.location})}else if(H){let e=N.get(O.location.pathname);e?e.add(a.pathname):(e=new Set([a.pathname]),N.set(O.location.pathname,e)),p={currentLocation:O.location,nextLocation:a}}Le(t({},n,{actionData:l,loaderData:h,historyAction:U,location:a,initialized:!0,navigation:Y,revalidation:"idle",restoreScrollPosition:ut(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 Te(a,n,o){T&&T.abort(),T=null,U=a,B=!0===(o&&o.startUninterruptedRevalidation),function(e,t){if(L&&M){let r=lt(e,t);L[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=ct(l,i,n.pathname);if(h.active&&h.matches&&(l=h.matches),!l){let{error:e,notFoundMatches:t,route:r}=it(n.pathname);return void Ce(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&&Ue(o.submission.formMethod)))return void Ce(n,{matches:l},{flushSync:u});T=new AbortController;let f,m=ye(e.history,n,T.signal,o&&o.submission);if(o&&o.pendingError)f=[Re(l).route.id,{type:d.error,error:o.pendingError}];else if(o&&o.submission&&Ue(o.submission.formMethod)){let t=await async function(e,t,a,n,o,i){void 0===i&&(i={});let s;if(Ye(),Le({navigation:$e(t,a)},{flushSync:!0===i.flushSync}),o){let r=await dt(n,t.pathname,e.signal);if("aborted"===r.type)return{shortCircuited:!0};if("error"===r.type){let e=Re(r.partialMatches).route.id;return{matches:r.partialMatches,pendingActionResult:[e,{type:d.error,error:r.error}]}}if(!r.matches){let{notFoundMatches:e,error:r,route:a}=it(t.pathname);return{matches:e,pendingActionResult:[a.id,{type:d.error,error:r}]}}n=r.matches}let l=Fe(n,t);if(l.route.action||l.route.lazy){if(s=(await ze("action",O,e,[l],n,null))[l.route.id],e.signal.aborted)return{shortCircuited:!0}}else s={type:d.error,error:Pe(405,{method:e.method,pathname:t.pathname,routeId:l.route.id})};if(ke(s)){let t;if(i&&null!=i.replace)t=i.replace;else{t=me(s.response.headers.get("Location"),new URL(e.url),w)===O.location.pathname+O.location.search}return await Oe(e,s,!0,{submission:a,replace:t}),{shortCircuited:!0}}if(Me(s))throw Pe(400,{type:"defer-action"});if(je(s)){let e=Re(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(je(r)&&F(r.error)&&404===r.error.status)return T=null,void Ce(n,{matches:t.matches,loaderData:{},errors:{[e]:r.error}})}l=t.matches||l,f=t.pendingActionResult,s=We(n,o.submission),u=!1,h.active=!1,m=ye(e.history,m.url,m.signal)}console.log(" start handleLoaders()");let{shortCircuited:y,matches:v,loaderData:g,errors:S}=await async function(r,a,n,o,i,s,l,u,d,h,f){let p=i||We(a,s),m=s||l||Be(p),y=!(B||R.v7_partialHydration&&d);if(o){if(y){let e=_e(f);Le(t({navigation:p},void 0!==e?{actionData:e}:{}),{flushSync:h})}let e=await dt(n,a.pathname,r.signal);if("aborted"===e.type)return{shortCircuited:!0};if("error"===e.type){let t=Re(e.partialMatches).route.id;return{matches:e.partialMatches,loaderData:{},errors:{[t]:e.error}}}if(!e.matches){let{error:e,notFoundMatches:t,route:r}=it(a.pathname);return{matches:t,loaderData:{},errors:{[r.id]:e}}}n=e.matches}let v=c||b,[g,S]=oe(e.history,O,n,m,a,R.v7_partialHydration&&!0===d,R.v7_skipActionErrorRevalidation,W,$,q,ve,le,se,v,w,f);if(st((e=>!(n&&n.some((t=>t.route.id===e)))||g&&g.some((t=>t.route.id===e)))),te=++ee,0===g.length&&0===S.length){let e=tt();return Ce(a,t({matches:n,loaderData:{},errors:f&&je(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=_e(f);void 0!==t&&(e.actionData=t)}S.length>0&&(e.fetchers=function(e){return e.forEach((e=>{let t=O.fetchers.get(e.key),r=qe(void 0,t?t.data:void 0);O.fetchers.set(e.key,r)})),new Map(O.fetchers)}(S)),Le(e,{flushSync:h})}S.forEach((e=>{Ze(e.key),e.controller&&K.set(e.key,e.controller)}));let D=()=>S.forEach((e=>Ze(e.key)));T&&T.signal.addEventListener("abort",D);let{loaderResults:E,fetcherResults:P}=await Je(O,n,g,S,r);if(r.signal.aborted)return{shortCircuited:!0};T&&T.signal.removeEventListener("abort",D);S.forEach((e=>K.delete(e.key)));let x=xe(E);if(x)return await Oe(r,x.result,!0,{replace:u}),{shortCircuited:!0};if(x=xe(P),x)return se.add(x.key),await Oe(r,x.result,!0,{replace:u}),{shortCircuited:!0};let{loaderData:L,errors:A}=we(O,n,E,f,S,P,ge);ge.forEach(((e,t)=>{e.subscribe((r=>{(r||e.done)&&ge.delete(t)}))})),R.v7_partialHydration&&d&&O.errors&&(A=t({},O.errors,A));let M=tt(),j=rt(te),k=M||j||S.length>0;return t({matches:n,loaderData:L,errors:A},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);console.log(" end handleLoaders()"),y?console.log(" short circuited from handleLoaders()"):(T=null,Ce(n,t({matches:v||l},De(f),{loaderData:g,errors:S})))}function _e(e){return e&&!je(e[1])?{[e[0]]:e[1].data}:O.actionData?0===Object.keys(O.actionData).length?null:O.actionData:void 0}async function Oe(o,l,u,c){let{submission:d,fetcherSubmission:h,preventScrollReset:f,replace:p}=void 0===c?{}:c;l.response.headers.has("X-Remix-Revalidate")&&(W=!0);let m=l.response.headers.get("Location");n(m,"Expected a Location header on the redirect Response"),m=me(m,new URL(o.url),w);let y=s(O.location,m,{_isRedirect:!0});if(i){let t=!1;if(l.response.headers.has("X-Remix-Reload-Document"))t=!0;else if(G.test(m)){const r=e.history.createURL(m);t=r.origin!==a.location.origin||null==P(r.pathname,w)}if(t)return void(p?a.location.replace(m):a.location.assign(m))}T=null;let v=!0===p||l.response.headers.has("X-Remix-Replace")?r.Replace:r.Push,{formMethod:g,formAction:b,formEncType:S}=O.navigation;!d&&!h&&g&&b&&S&&(d=Be(O.navigation));let D=d||h;if(J.has(l.response.status)&&D&&Ue(D.formMethod))await Te(v,y,{submission:t({},D,{formAction:m}),preventScrollReset:f||I,enableViewTransition:u?H:void 0});else{let e=We(y,d);await Te(v,y,{overrideNavigation:e,fetcherSubmission:h,preventScrollReset:f||I,enableViewTransition:u?H:void 0})}}async function ze(e,t,r,a,n,o){let i,s={};try{i=await he(S,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:pe(a,r,e,n,w,R.v7_relativeSplatPath)}}else s[e]=await fe(t);return s}async function Je(t,r,a,n,o){let i=t.matches,s=ze("loader",t,o,a,r,null),l=Promise.all(n.map((async r=>{if(r.matches&&r.match&&r.controller){let a=(await ze("loader",t,ye(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:Pe(404,{pathname:r.path})}})}))),u=await s,c=(await l).reduce(((e,t)=>Object.assign(e,t)),{});return await Promise.all([Ie(r,u,o.signal,i,t.loaderData),He(r,c,n)]),{loaderResults:u,fetcherResults:c}}function Ye(){W=!0,$.push(...st()),le.forEach(((e,t)=>{K.has(t)&&q.add(t),Ze(t)}))}function Ve(e,t,r){void 0===r&&(r={}),O.fetchers.set(e,t),Le({fetchers:new Map(O.fetchers)},{flushSync:!0===(r&&r.flushSync)})}function Xe(e,t,r,a){void 0===a&&(a={});let n=Re(O.matches,t);Qe(e),Le({errors:{[n.route.id]:r},fetchers:new Map(O.fetchers)},{flushSync:!0===(a&&a.flushSync)})}function Ge(e){return ce.set(e,(ce.get(e)||0)+1),ve.has(e)&&ve.delete(e),O.fetchers.get(e)||V}function Qe(e){let t=O.fetchers.get(e);!K.has(e)||t&&"loading"===t.state&&ne.has(e)||Ze(e),le.delete(e),ne.delete(e),se.delete(e),R.v7_fetcherPersist&&ve.delete(e),q.delete(e),O.fetchers.delete(e)}function Ze(e){let t=K.get(e);t&&(t.abort(),K.delete(e))}function et(e){for(let t of e){let e=Ke(Ge(t).data);O.fetchers.set(t,e)}}function tt(){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 et(e),t}function rt(e){let t=[];for(let[r,a]of ne)if(a<e){let e=O.fetchers.get(r);n(e,"Expected fetcher: "+r),"loading"===e.state&&(Ze(r),ne.delete(r),t.push(r))}return et(t),t.length>0}function at(e){O.blockers.delete(e),be.delete(e)}function nt(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),Le({blockers:a})}function ot(e){let{currentLocation:t,nextLocation:r,historyAction:a}=e;if(0===be.size)return;be.size>1&&o(!1,"A router only supports one blocker at a time");let n=Array.from(be.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 it(e){let t=Pe(404,{pathname:e}),r=c||b,{matches:a,route:n}=Ee(r);return st(),{notFoundMatches:a,route:n,error:t}}function st(e){let t=[];return ge.forEach(((r,a)=>{e&&!e(a)||(r.cancel(),t.push(a),ge.delete(a))})),t}function lt(e,t){if(A){return A(e,t.map((e=>y(e,O.loaderData))))||e.key}return e.key}function ut(e,t){if(L){let r=lt(e,t),a=L[r];if("number"==typeof a)return a}return null}function ct(e,t,r){if(D){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 dt(e,t,r){if(!D)return{type:"success",matches:e};let a=e;for(;;){let e=null==c,n=c||b,o=g;try{await D({path:t,matches:a,patch:(e,t)=>{r.aborted||ue(e,t,n,o,u)}})}catch(e){return{type:"error",error:e,partialMatches:a}}finally{e&&!r.aborted&&(b=[...b])}if(r.aborted)return{type:"aborted"};let i=p(n,t,w);if(i)return{type:"success",matches:i};let s=m(n,t,w,!0);if(!s||a.length===s.length&&a.every(((e,t)=>e.route.id===s[t].route.id)))return{type:"success",matches:null};a=s}}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(_)return _(),void(_=void 0);o(0===be.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=ot({currentLocation:O.location,nextLocation:a,historyAction:r});if(i&&null!=n){let t=new Promise((e=>{_=e}));return e.history.go(-1*n),void nt(i,{state:"blocked",location:a,proceed(){nt(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),Le({blockers:e})}})}return Te(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,N);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,N);a.addEventListener("pagehide",e),z=()=>a.removeEventListener("pagehide",e)}return O.initialized||Te(r.Pop,O.location,{initialHydration:!0}),v},subscribe:function(e){return x.add(e),()=>x.delete(e)},enableScrollRestoration:function(e,t,r){if(L=e,M=t,A=r||null,!j&&O.navigation===Y){j=!0;let e=ut(O.location,O.matches);null!=e&&Le({restoreScrollPosition:e})}return()=>{L=null,M=null,A=null}},navigate:async function a(n,o){if(console.log("navigate()",n,JSON.stringify(O.navigation)),"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&&Ue(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.flushSync),v=ot({currentLocation:d,nextLocation:h,historyAction:p});if(!v)return await Te(p,h,{submission:u,pendingError:c,preventScrollReset:m,replace:o&&o.replace,enableViewTransition:o&&o.viewTransition,flushSync:y});nt(v,{state:"blocked",location:h,proceed(){nt(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),Le({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.");Ze(t);let i=!0===(o&&o.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=ct(d,s,u);if(h.active&&h.matches&&(d=h.matches),!d)return void Xe(t,r,Pe(404,{pathname:u}),{flushSync:i});let{path:f,submission:m,error:y}=ae(R.v7_normalizeFormMethod,!0,u,o);if(y)return void Xe(t,r,y,{flushSync:i});let v=Fe(d,f),g=!0===(o&&o.preventScrollReset);m&&Ue(m.formMethod)?async function(t,r,a,o,i,s,l,u,d){function h(e){if(!e.route.action&&!e.route.lazy){let e=Pe(405,{method:d.formMethod,pathname:a,routeId:r});return Xe(t,r,e,{flushSync:l}),!0}return!1}if(Ye(),le.delete(t),!s&&h(o))return;let f=O.fetchers.get(t);Ve(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}}(d,f),{flushSync:l});let m=new AbortController,y=ye(e.history,a,m.signal,d);if(s){let e=await dt(i,a,y.signal);if("aborted"===e.type)return;if("error"===e.type)return void Xe(t,r,e.error,{flushSync:l});if(!e.matches)return void Xe(t,r,Pe(404,{pathname:a}),{flushSync:l});if(h(o=Fe(i=e.matches,a)))return}K.set(t,m);let v=ee,g=(await ze("action",O,y,[o],i,t))[o.route.id];if(y.signal.aborted)return void(K.get(t)===m&&K.delete(t));if(R.v7_fetcherPersist&&ve.has(t)){if(ke(g)||je(g))return void Ve(t,Ke(void 0))}else{if(ke(g))return K.delete(t),te>v?void Ve(t,Ke(void 0)):(se.add(t),Ve(t,qe(d)),Oe(y,g,!1,{fetcherSubmission:d,preventScrollReset:u}));if(je(g))return void Xe(t,r,g.error)}if(Me(g))throw Pe(400,{type:"defer-action"});let S=O.navigation.location||O.location,D=ye(e.history,S,m.signal),E=c||b,P="idle"!==O.navigation.state?p(E,O.navigation.location,w):O.matches;n(P,"Didn't find any matches after fetcher action");let x=++ee;ne.set(t,x);let L=qe(d,g.data);O.fetchers.set(t,L);let[A,M]=oe(e.history,O,P,d,S,!1,R.v7_skipActionErrorRevalidation,W,$,q,ve,le,se,E,w,[o.route.id,g]);M.filter((e=>e.key!==t)).forEach((e=>{let t=e.key,r=O.fetchers.get(t),a=qe(void 0,r?r.data:void 0);O.fetchers.set(t,a),Ze(t),e.controller&&K.set(t,e.controller)})),Le({fetchers:new Map(O.fetchers)});let j=()=>M.forEach((e=>Ze(e.key)));m.signal.addEventListener("abort",j);let{loaderResults:k,fetcherResults:C}=await Je(O,P,A,M,D);if(m.signal.aborted)return;m.signal.removeEventListener("abort",j),ne.delete(t),K.delete(t),M.forEach((e=>K.delete(e.key)));let _=xe(k);if(_)return Oe(D,_.result,!1,{preventScrollReset:u});if(_=xe(C),_)return se.add(_.key),Oe(D,_.result,!1,{preventScrollReset:u});let{loaderData:I,errors:H}=we(O,P,k,void 0,M,C,ge);if(O.fetchers.has(t)){let e=Ke(g.data);O.fetchers.set(t,e)}rt(x),"loading"===O.navigation.state&&x>te?(n(U,"Expected pending action"),T&&T.abort(),Ce(O.navigation.location,{matches:P,loaderData:I,errors:H,fetchers:new Map(O.fetchers)})):(Le({errors:H,loaderData:Se(O.loaderData,I,P,H),fetchers:new Map(O.fetchers)}),W=!1)}(t,r,f,v,d,h.active,i,g,m):(le.set(t,{routeId:r,path:f}),async function(t,r,a,o,i,s,l,u,c){let d=O.fetchers.get(t);Ve(t,qe(c,d?d.data:void 0),{flushSync:l});let h=new AbortController,f=ye(e.history,a,h.signal);if(s){let e=await dt(i,a,f.signal);if("aborted"===e.type)return;if("error"===e.type)return void Xe(t,r,e.error,{flushSync:l});if(!e.matches)return void Xe(t,r,Pe(404,{pathname:a}),{flushSync:l});o=Fe(i=e.matches,a)}K.set(t,h);let p=ee,m=(await ze("loader",O,f,[o],i,t))[o.route.id];Me(m)&&(m=await Ne(m,f.signal,!0)||m);K.get(t)===h&&K.delete(t);if(f.signal.aborted)return;if(ve.has(t))return void Ve(t,Ke(void 0));if(ke(m))return te>p?void Ve(t,Ke(void 0)):(se.add(t),void await Oe(f,m,!1,{preventScrollReset:u}));if(je(m))return void Xe(t,r,m.error);n(!Me(m),"Unhandled fetcher deferred data"),Ve(t,Ke(m.data))}(t,r,f,v,d,h.active,i,g,m))},revalidate:function(){if(console.log("revalidate()"),console.log(" current navigation",JSON.stringify(O.navigation)),Ye(),Le({revalidation:"loading"}),"submitting"!==O.navigation.state){if("idle"===O.navigation.state)return console.log("startNavigation() - startUninterruptedRevalidation=true"),void Te(O.historyAction,O.location,{startUninterruptedRevalidation:!0});console.log("startNavigation() - interrupting",{pendingViewTransitionEnabled:H}),Te(U||O.historyAction,O.navigation.location,{overrideNavigation:O.navigation,enableViewTransition:!0===H})}},createHref:t=>e.history.createHref(t),encodeLocation:t=>e.history.encodeLocation(t),getFetcher:Ge,deleteFetcher:function(e){let t=(ce.get(e)||0)-1;t<=0?(ce.delete(e),ve.add(e),R.v7_fetcherPersist||Qe(e)):ce.set(e,t),Le({fetchers:new Map(O.fetchers)})},dispose:function(){E&&E(),z&&z(),x.clear(),T&&T.abort(),O.fetchers.forEach(((e,t)=>Qe(t))),O.blockers.forEach(((e,t)=>at(t)))},getBlocker:function(e,t){let r=O.blockers.get(e)||X;return be.get(e)!==t&&be.set(e,t),r},deleteBlocker:at,patchRoutes:function(e,t){let r=null==c;ue(e,t,c||b,g,u),r&&(b=[...b],Le({}))},_internalFetchControllers:K,_internalActiveDeferreds:ge,_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(Ue(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=Pe(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(ke(l))throw new Response(null,{status:l.response.status,headers:{Location:l.response.headers.get("Location")}});if(Me(l)){let e=Pe(400,{type:"defer-action"});if(s)throw e;l={type:d.error,error:e}}if(s){if(je(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(je(l)){let e=i?a:Re(r,a.route.id);return t({},await m(c,r,n,o,i,null,[e.route.id,l]),{statusCode:F(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||Fe(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 Pe(400,{method:e.method,pathname:new URL(e.url).pathname,routeId:null==i?void 0:i.route.id});let c=(i?[i]:s&&je(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&&je(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=be(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 he(c||de,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 pe(r.result,t,e.route.id,n,i,u.v7_relativeSplatPath)}if(_e(r.result)&&s)throw r;h[e.route.id]=await fe(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(!Oe(d)&&"HEAD"!==d){let e=Pe(405,{method:d}),{matches:t,route:r}=Ee(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=Pe(404,{pathname:f.pathname}),{matches:t,route:r}=Ee(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(!Oe(u)&&"HEAD"!==u&&"OPTIONS"!==u)throw Pe(405,{method:u});if(!f)throw Pe(404,{pathname:d.pathname});let m=r?f.find((e=>e.route.id===r)):Fe(f,d);if(r&&!m)throw Pe(403,{pathname:d.pathname,routeId:r});if(!m)throw Pe(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:F(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=Ce,e.isDeferredData=Te,e.isRouteErrorResponse=F,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=N,e.redirectDocument=(e,t)=>{let r=N(e,t);return r.headers.set("X-Remix-Reload-Document","true"),r},e.replace=(e,t)=>{let r=N(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,2 +136,3 @@ } | ||
type DataFunctionValue = Response | NonNullable<unknown> | null; | ||
type DataFunctionReturnValue = Promise<DataFunctionValue> | DataFunctionValue; | ||
/** | ||
@@ -143,3 +142,3 @@ * Route loader function signature | ||
export type LoaderFunction<Context = any> = { | ||
(args: LoaderFunctionArgs<Context>): Promise<DataFunctionValue> | DataFunctionValue; | ||
(args: LoaderFunctionArgs<Context>, handlerCtx?: unknown): DataFunctionReturnValue; | ||
} & { | ||
@@ -152,3 +151,3 @@ hydrate?: boolean; | ||
export interface ActionFunction<Context = any> { | ||
(args: ActionFunctionArgs<Context>): Promise<DataFunctionValue> | DataFunctionValue; | ||
(args: ActionFunctionArgs<Context>, handlerCtx?: unknown): DataFunctionReturnValue; | ||
} | ||
@@ -169,2 +168,3 @@ /** | ||
json?: Submission["json"]; | ||
actionStatus?: number; | ||
actionResult?: any; | ||
@@ -192,3 +192,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 | ||
@@ -226,4 +250,4 @@ * properties from framework-agnostic properties | ||
id?: string; | ||
loader?: LoaderFunction; | ||
action?: ActionFunction; | ||
loader?: LoaderFunction | boolean; | ||
action?: ActionFunction | boolean; | ||
hasErrorBoundary?: boolean; | ||
@@ -308,9 +332,10 @@ shouldRevalidate?: ShouldRevalidateFunction; | ||
} | ||
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[]; | ||
/** | ||
* Matches the given routes to a location and returns the match data. | ||
* | ||
* @see https://reactrouter.com/utils/match-routes | ||
* @see https://reactrouter.com/v6/utils/match-routes | ||
*/ | ||
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> { | ||
@@ -327,3 +352,3 @@ id: string; | ||
* | ||
* @see https://reactrouter.com/utils/generate-path | ||
* @see https://reactrouter.com/v6/utils/generate-path | ||
*/ | ||
@@ -378,5 +403,6 @@ export declare function generatePath<Path extends string>(originalPath: Path, params?: { | ||
* | ||
* @see https://reactrouter.com/utils/match-path | ||
* @see https://reactrouter.com/v6/utils/match-path | ||
*/ | ||
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; | ||
/** | ||
@@ -389,3 +415,3 @@ * @private | ||
* | ||
* @see https://reactrouter.com/utils/resolve-path | ||
* @see https://reactrouter.com/v6/utils/resolve-path | ||
*/ | ||
@@ -446,4 +472,18 @@ export declare function resolvePath(to: To, fromPathname?: string): Path; | ||
* to JSON and sets the `Content-Type` header. | ||
* | ||
* @deprecated The `json` method is deprecated in favor of returning raw objects. | ||
* This method will be removed in v7. | ||
*/ | ||
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> { | ||
@@ -477,2 +517,6 @@ _tracked?: boolean; | ||
export type DeferFunction = (data: Record<string, unknown>, init?: number | ResponseInit) => DeferredData; | ||
/** | ||
* @deprecated The `defer` method is deprecated in favor of returning raw | ||
* objects. This method will be removed in v7. | ||
*/ | ||
export declare const defer: DeferFunction; | ||
@@ -491,2 +535,9 @@ export type RedirectFunction = (url: string, init?: number | ResponseInit) => Response; | ||
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 = { | ||
@@ -493,0 +544,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
index.ts
@@ -10,4 +10,10 @@ export type { | ||
AgnosticNonIndexRouteObject, | ||
AgnosticPatchRoutesOnNavigationFunction, | ||
AgnosticPatchRoutesOnNavigationFunctionArgs, | ||
AgnosticRouteMatch, | ||
AgnosticRouteObject, | ||
DataStrategyFunction, | ||
DataStrategyFunctionArgs, | ||
DataStrategyMatch, | ||
DataStrategyResult, | ||
ErrorResponse, | ||
@@ -32,2 +38,3 @@ FormEncType, | ||
V7_FormMethod, | ||
DataWithResponseInit as UNSAFE_DataWithResponseInit, | ||
} from "./utils"; | ||
@@ -37,2 +44,3 @@ | ||
AbortedDeferredError, | ||
data, | ||
defer, | ||
@@ -49,2 +57,3 @@ generatePath, | ||
redirectDocument, | ||
replace, | ||
resolvePath, | ||
@@ -94,2 +103,3 @@ resolveTo, | ||
convertRouteMatchToUiMatch as UNSAFE_convertRouteMatchToUiMatch, | ||
decodePath as UNSAFE_decodePath, | ||
getResolveToMatches as UNSAFE_getResolveToMatches, | ||
@@ -96,0 +106,0 @@ } from "./utils"; |
{ | ||
"name": "@remix-run/router", | ||
"version": "0.0.0-experimental-d90c8fb3", | ||
"version": "0.0.0-experimental-db3389095", | ||
"description": "Nested/Data-driven/Framework-agnostic Routing", | ||
@@ -33,2 +33,2 @@ "keywords": [ | ||
} | ||
} | ||
} |
@@ -134,3 +134,3 @@ # Remix Router | ||
[remix-routers-repo]: https://github.com/brophdawg11/remix-routers | ||
[api-development-strategy]: https://reactrouter.com/en/main/guides/api-development-strategy | ||
[api-development-strategy]: https://reactrouter.com/v6/guides/api-development-strategy | ||
[future-flags-post]: https://remix.run/blog/future-flags |
178
utils.ts
@@ -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,2 +171,4 @@ } | ||
type DataFunctionReturnValue = Promise<DataFunctionValue> | DataFunctionValue; | ||
/** | ||
@@ -177,5 +178,6 @@ * Route loader function signature | ||
export type LoaderFunction<Context = any> = { | ||
(args: LoaderFunctionArgs<Context>): | ||
| Promise<DataFunctionValue> | ||
| DataFunctionValue; | ||
( | ||
args: LoaderFunctionArgs<Context>, | ||
handlerCtx?: unknown | ||
): DataFunctionReturnValue; | ||
} & { hydrate?: boolean }; | ||
@@ -187,5 +189,6 @@ | ||
export interface ActionFunction<Context = any> { | ||
(args: ActionFunctionArgs<Context>): | ||
| Promise<DataFunctionValue> | ||
| DataFunctionValue; | ||
( | ||
args: ActionFunctionArgs<Context>, | ||
handlerCtx?: unknown | ||
): DataFunctionReturnValue; | ||
} | ||
@@ -207,2 +210,3 @@ | ||
json?: Submission["json"]; | ||
actionStatus?: number; | ||
actionResult?: any; | ||
@@ -233,3 +237,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 | ||
@@ -288,4 +336,4 @@ * properties from framework-agnostic properties | ||
id?: string; | ||
loader?: LoaderFunction; | ||
action?: ActionFunction; | ||
loader?: LoaderFunction | boolean; | ||
action?: ActionFunction | boolean; | ||
hasErrorBoundary?: boolean; | ||
@@ -424,7 +472,7 @@ shouldRevalidate?: ShouldRevalidateFunction; | ||
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("-"); | ||
@@ -475,3 +523,3 @@ invariant( | ||
* | ||
* @see https://reactrouter.com/utils/match-routes | ||
* @see https://reactrouter.com/v6/utils/match-routes | ||
*/ | ||
@@ -485,2 +533,13 @@ export function matchRoutes< | ||
): 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 = | ||
@@ -507,3 +566,7 @@ typeof locationArg === "string" ? parsePath(locationArg) : locationArg; | ||
let decoded = decodePath(pathname); | ||
matches = matchRouteBranch<string, RouteObjectType>(branches[i], decoded); | ||
matches = matchRouteBranch<string, RouteObjectType>( | ||
branches[i], | ||
decoded, | ||
allowPartial | ||
); | ||
} | ||
@@ -599,3 +662,2 @@ | ||
); | ||
flattenRoutes(route.children, branches, routesMeta, path); | ||
@@ -753,3 +815,4 @@ } | ||
branch: RouteBranch<RouteObjectType>, | ||
pathname: string | ||
pathname: string, | ||
allowPartial = false | ||
): AgnosticRouteMatch<ParamKey, RouteObjectType>[] | null { | ||
@@ -773,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({ | ||
@@ -801,3 +882,3 @@ // TODO: Can this as be avoided? | ||
* | ||
* @see https://reactrouter.com/utils/generate-path | ||
* @see https://reactrouter.com/v6/utils/generate-path | ||
*/ | ||
@@ -908,3 +989,3 @@ export function generatePath<Path extends string>( | ||
* | ||
* @see https://reactrouter.com/utils/match-path | ||
* @see https://reactrouter.com/v6/utils/match-path | ||
*/ | ||
@@ -1021,3 +1102,3 @@ export function matchPath< | ||
function decodePath(value: string) { | ||
export function decodePath(value: string) { | ||
try { | ||
@@ -1070,3 +1151,3 @@ return value | ||
* | ||
* @see https://reactrouter.com/utils/resolve-path | ||
* @see https://reactrouter.com/v6/utils/resolve-path | ||
*/ | ||
@@ -1169,3 +1250,3 @@ export function resolvePath(to: To, fromPathname = "/"): Path { | ||
return pathMatches.map((match, idx) => | ||
idx === matches.length - 1 ? match.pathname : match.pathnameBase | ||
idx === pathMatches.length - 1 ? match.pathname : match.pathnameBase | ||
); | ||
@@ -1309,2 +1390,5 @@ } | ||
* to JSON and sets the `Content-Type` header. | ||
* | ||
* @deprecated The `json` method is deprecated in favor of returning raw objects. | ||
* This method will be removed in v7. | ||
*/ | ||
@@ -1325,2 +1409,24 @@ export const json: JsonFunction = (data, init = {}) => { | ||
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> { | ||
@@ -1527,2 +1633,6 @@ _tracked?: boolean; | ||
/** | ||
* @deprecated The `defer` method is deprecated in favor of returning raw | ||
* objects. This method will be removed in v7. | ||
*/ | ||
export const defer: DeferFunction = (data, init = {}) => { | ||
@@ -1571,2 +1681,14 @@ let responseInit = typeof init === "number" ? { status: init } : init; | ||
/** | ||
* 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 = { | ||
@@ -1573,0 +1695,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
2743212
25035