Socket
Socket
Sign inDemoInstall

@remix-run/router

Package Overview
Dependencies
Maintainers
2
Versions
212
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@remix-run/router - npm Package Compare versions

Comparing version 0.0.0-experimental-52e9b8eb3 to 0.0.0-experimental-5a6545bf7

53

CHANGELOG.md
# `@remix-run/router`
## 1.19.0
### Minor Changes
- Add a new `replace(url, init?)` alternative to `redirect(url, init?)` that performs a `history.replaceState` instead of a `history.pushState` on client-side navigation redirects ([#11811](https://github.com/remix-run/react-router/pull/11811))
- Add a new `unstable_data()` API for usage with Remix Single Fetch ([#11836](https://github.com/remix-run/react-router/pull/11836))
- This API is not intended for direct usage in React Router SPA applications
- It is primarily intended for usage with `createStaticHandler.query()` to allow loaders/actions to return arbitrary data + `status`/`headers` without forcing the serialization of data into a `Response` instance
- This allows for more advanced serialization tactics via `unstable_dataStrategy` such as serializing via `turbo-stream` in Remix Single Fetch
- ⚠️ This removes the `status` field from `HandlerResult`
- If you need to return a specific `status` from `unstable_dataStrategy` you should instead do so via `unstable_data()`
### Patch Changes
- Fix internal cleanup of interrupted fetchers to avoid invalid revalidations on navigations ([#11839](https://github.com/remix-run/react-router/pull/11839))
- When a `fetcher.load` is interrupted by an `action` submission, we track it internally and force revalidation once the `action` completes
- We previously only cleared out this internal tracking info on a successful _navigation_ submission
- Therefore, if the `fetcher.load` was interrupted by a `fetcher.submit`, then we wouldn't remove it from this internal tracking info on successful load (incorrectly)
- And then on the next navigation it's presence in the internal tracking would automatically trigger execution of the `fetcher.load` again, ignoring any `shouldRevalidate` logic
- This fix cleans up the internal tracking so it applies to both navigation submission and fetcher submissions
- Fix initial hydration behavior when using `future.v7_partialHydration` along with `unstable_patchRoutesOnMiss` ([#11838](https://github.com/remix-run/react-router/pull/11838))
- During initial hydration, `router.state.matches` will now include any partial matches so that we can render ancestor `HydrateFallback` components
## 1.18.0
### Minor Changes
- Stabilize `future.unstable_skipActionErrorRevalidation` as `future.v7_skipActionErrorRevalidation` ([#11769](https://github.com/remix-run/react-router/pull/11769))
- When this flag is enabled, actions will not automatically trigger a revalidation if they return/throw a `Response` with a `4xx`/`5xx` status code
- You may still opt-into revalidation via `shouldRevalidate`
- This also changes `shouldRevalidate`'s `unstable_actionStatus` parameter to `actionStatus`
### Patch Changes
- Fix bubbling of errors thrown from `unstable_patchRoutesOnMiss` ([#11786](https://github.com/remix-run/react-router/pull/11786))
- Fix hydration in SSR apps using `unstable_patchRoutesOnMiss` that matched a splat route on the server ([#11790](https://github.com/remix-run/react-router/pull/11790))
## 1.17.1
### Patch Changes
- Fog of War (unstable): Trigger a new `router.routes` identity/reflow during route patching ([#11740](https://github.com/remix-run/react-router/pull/11740))
- Fog of War (unstable): Fix initial matching when a splat route matches ([#11759](https://github.com/remix-run/react-router/pull/11759))
## 1.17.0
### Minor Changes
- Add support for Lazy Route Discovery (a.k.a. Fog of War) ([#11626](https://github.com/remix-run/react-router/pull/11626))
- RFC: <https://github.com/remix-run/react-router/discussions/11113>
- `unstable_patchRoutesOnMiss` docs: <https://reactrouter.com/en/main/routers/create-browser-router>
## 1.16.1

@@ -4,0 +57,0 @@

6

dist/index.d.ts

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

export type { ActionFunction, ActionFunctionArgs, AgnosticDataIndexRouteObject, AgnosticDataNonIndexRouteObject, AgnosticDataRouteMatch, AgnosticDataRouteObject, AgnosticIndexRouteObject, AgnosticNonIndexRouteObject, AgnosticRouteMatch, AgnosticRouteObject, DataStrategyFunction as unstable_DataStrategyFunction, DataStrategyFunctionArgs as unstable_DataStrategyFunctionArgs, DataStrategyMatch as unstable_DataStrategyMatch, ErrorResponse, FormEncType, FormMethod, HandlerResult as unstable_HandlerResult, 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, AgnosticRouteMatch, AgnosticRouteObject, DataStrategyFunction as unstable_DataStrategyFunction, DataStrategyFunctionArgs as unstable_DataStrategyFunctionArgs, DataStrategyMatch as unstable_DataStrategyMatch, ErrorResponse, FormEncType, FormMethod, HandlerResult as unstable_HandlerResult, HTMLFormMethod, JsonFunction, LazyRouteFunction, LoaderFunction, LoaderFunctionArgs, ParamParseKey, Params, AgnosticPatchRoutesOnNavigationFunction as unstable_AgnosticPatchRoutesOnNavigationFunction, PathMatch, PathParam, PathPattern, RedirectFunction, ShouldRevalidateFunction, ShouldRevalidateFunctionArgs, TrackedPromise, UIMatch, V7_FormMethod, DataWithResponseInit as UNSAFE_DataWithResponseInit, } from "./utils";
export { AbortedDeferredError, data as unstable_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, DataStrategyFunction, 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,3 +272,3 @@ *

v7_relativeSplatPath: boolean;
unstable_skipActionErrorRevalidation: boolean;
v7_skipActionErrorRevalidation: boolean;
}

@@ -280,2 +290,3 @@ /**

window?: Window;
unstable_patchRoutesOnNavigation?: AgnosticPatchRoutesOnNavigationFunction;
unstable_dataStrategy?: DataStrategyFunction;

@@ -515,3 +526,4 @@ }

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-52e9b8eb3
* @remix-run/router v0.0.0-experimental-5a6545bf7
*

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

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

result: unknown;
status?: number;
}

@@ -171,3 +170,3 @@ type LowerCaseFormMethod = "get" | "post" | "put" | "patch" | "delete";

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

@@ -205,2 +204,9 @@ defaultShouldRevalidate: boolean;

}
export interface AgnosticPatchRoutesOnNavigationFunction<M extends AgnosticRouteMatch = AgnosticRouteMatch> {
(opts: {
path: string;
matches: M[];
patch: (routeId: string | null, children: AgnosticRouteObject[]) => void;
}): void | Promise<void>;
}
/**

@@ -257,3 +263,3 @@ * Function provided by the framework-aware layers to set any framework-specific

export type AgnosticNonIndexRouteObject = AgnosticBaseRouteObject & {
children?: AgnosticRouteObject[] | (() => Promise<AgnosticRouteObject[]>);
children?: AgnosticRouteObject[];
index?: false;

@@ -270,3 +276,3 @@ };

export type AgnosticDataNonIndexRouteObject = AgnosticNonIndexRouteObject & {
children?: AgnosticDataRouteObject[] | (() => Promise<AgnosticDataRouteObject[]>);
children?: AgnosticDataRouteObject[];
id: string;

@@ -329,3 +335,3 @@ };

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, allowPartial?: boolean, 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> {

@@ -395,2 +401,3 @@ id: string;

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

@@ -461,2 +468,13 @@ * @private

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

@@ -503,2 +521,9 @@ _tracked?: boolean;

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

@@ -505,0 +530,0 @@ status: number;

@@ -26,2 +26,3 @@ export type {

Params,
AgnosticPatchRoutesOnNavigationFunction as unstable_AgnosticPatchRoutesOnNavigationFunction,
PathMatch,

@@ -36,2 +37,3 @@ PathParam,

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

@@ -41,2 +43,3 @@

AbortedDeferredError,
data as unstable_data,
defer,

@@ -53,2 +56,3 @@ generatePath,

redirectDocument,
replace,
resolvePath,

@@ -98,2 +102,3 @@ resolveTo,

convertRouteMatchToUiMatch as UNSAFE_convertRouteMatchToUiMatch,
decodePath as UNSAFE_decodePath,
getResolveToMatches as UNSAFE_getResolveToMatches,

@@ -100,0 +105,0 @@ } from "./utils";

{
"name": "@remix-run/router",
"version": "0.0.0-experimental-52e9b8eb3",
"version": "0.0.0-experimental-5a6545bf7",
"description": "Nested/Data-driven/Framework-agnostic Routing",

@@ -5,0 +5,0 @@ "keywords": [

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

type: "data" | "error";
result: unknown; // data, Error, Response, DeferredData
status?: number;
result: unknown; // data, Error, Response, DeferredData, DataWithResponseInit
}

@@ -214,3 +213,3 @@

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

@@ -260,2 +259,12 @@ defaultShouldRevalidate: boolean;

export interface AgnosticPatchRoutesOnNavigationFunction<
M extends AgnosticRouteMatch = AgnosticRouteMatch
> {
(opts: {
path: string;
matches: M[];
patch: (routeId: string | null, children: AgnosticRouteObject[]) => void;
}): void | Promise<void>;
}
/**

@@ -335,3 +344,3 @@ * Function provided by the framework-aware layers to set any framework-specific

export type AgnosticNonIndexRouteObject = AgnosticBaseRouteObject & {
children?: AgnosticRouteObject[] | (() => Promise<AgnosticRouteObject[]>);
children?: AgnosticRouteObject[];
index?: false;

@@ -353,5 +362,3 @@ };

export type AgnosticDataNonIndexRouteObject = AgnosticNonIndexRouteObject & {
children?:
| AgnosticDataRouteObject[]
| (() => Promise<AgnosticDataRouteObject[]>);
children?: AgnosticDataRouteObject[];
id: string;

@@ -488,21 +495,8 @@ };

if (route.children) {
if (typeof route.children === "function") {
let loadChildren = route.children;
pathOrLayoutRoute.children = async () => {
let children = await loadChildren();
return convertRoutesToDataRoutes(
children,
mapRouteProperties,
treePath,
manifest
);
};
} else {
pathOrLayoutRoute.children = convertRoutesToDataRoutes(
route.children,
mapRouteProperties,
treePath,
manifest
);
}
pathOrLayoutRoute.children = convertRoutesToDataRoutes(
route.children,
mapRouteProperties,
treePath,
manifest
);
}

@@ -527,3 +521,3 @@

): AgnosticRouteMatch<string, RouteObjectType>[] | null {
return matchRoutesImpl(routes, locationArg, false, basename);
return matchRoutesImpl(routes, locationArg, basename, false);
}

@@ -536,4 +530,4 @@

locationArg: Partial<Location> | string,
allowPartial = false,
basename = "/"
basename: string,
allowPartial: boolean
): AgnosticRouteMatch<string, RouteObjectType>[] | null {

@@ -549,3 +543,3 @@ let location =

let branches = flattenRoutes(routes, allowPartial);
let branches = flattenRoutes(routes);
rankRouteBranches(branches);

@@ -615,3 +609,2 @@

routes: RouteObjectType[],
allowPartial: boolean,
branches: RouteBranch<RouteObjectType>[] = [],

@@ -659,7 +652,3 @@ parentsMeta: RouteMeta<RouteObjectType>[] = [],

);
invariant(
typeof route.children !== "function",
"Route children must be resolved prior to calling flattenRoutes"
);
flattenRoutes(route.children, allowPartial, branches, routesMeta, path);
flattenRoutes(route.children, branches, routesMeta, path);
}

@@ -669,5 +658,3 @@

// index routes, so don't add them to the list of possible branches.
// When partial matching we do want these to match so we can detect their
// async children() functions
if (route.path == null && !route.index && !allowPartial) {
if (route.path == null && !route.index) {
return;

@@ -841,5 +828,8 @@ }

// If this route has a `children()` function then allow partial matching
// up to this point if requested
if (!match && end && allowPartial && typeof route.children === "function") {
if (
!match &&
end &&
allowPartial &&
!routesMeta[routesMeta.length - 1].route.index
) {
match = matchPath(

@@ -1100,3 +1090,3 @@ {

function decodePath(value: string) {
export function decodePath(value: string) {
try {

@@ -1247,3 +1237,3 @@ return value

return pathMatches.map((match, idx) =>
idx === matches.length - 1 ? match.pathname : match.pathnameBase
idx === pathMatches.length - 1 ? match.pathname : match.pathnameBase
);

@@ -1402,2 +1392,24 @@ }

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

@@ -1647,2 +1659,14 @@ _tracked?: boolean;

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

@@ -1649,0 +1673,0 @@ status: number;

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

Sorry, the diff of this file is not supported yet

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

Sorry, the diff of this file is not supported yet

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

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc