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

@remix-run/router

Package Overview
Dependencies
Maintainers
2
Versions
217
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 1.5.0 to 1.6.0-pre.0

21

CHANGELOG.md
# `@remix-run/router`
## 1.6.0-pre.0
### Minor Changes
- - Enable relative routing in the `@remix-run/router` when providing a source route ID from which the path is relative to: ([#10336](https://github.com/remix-run/react-router/pull/10336))
- Example: `router.navigate("../path", { fromRouteId: "some-route" })`.
- This also applies to `router.fetch` which already receives a source route ID
- Introduce a new `@remix-run/router` `future.v7_prependBasename` flag to enable `basename` prefixing to all paths coming into `router.navigate` and `router.fetch`.
- Previously the `basename` was prepended in the React Router layer, but now that relative routing is being handled by the router we need prepend the `basename` _after_ resolving any relative paths
- This also enables `basename` support in `useFetcher` as well
### Patch Changes
- Enhance `LoaderFunction`/`ActionFunction` return type to prevent `undefined` from being a valid return value ([#10267](https://github.com/remix-run/react-router/pull/10267))
- Ensure proper 404 error on `fetcher.load` call to a route without a `loader` ([#10345](https://github.com/remix-run/react-router/pull/10345))
- Deprecate the `createRouter` `detectErrorBoundary` option in favor of the new `mapRouteProperties` option for converting a framework-agnostic route to a framework-aware route. This allows us to set more than just the `hasErrorBoundary` property during route pre-processing, and is now used for mapping `Component -> element` and `ErrorBoundary -> errorElement` in `react-router`. ([#10287](https://github.com/remix-run/react-router/pull/10287))
- Fixed a bug where fetchers were incorrectly attempting to revalidate on search params changes or routing to the same URL (using the same logic for route `loader` revalidations). However, since fetchers have a static href, they should only revalidate on `action` submissions or `router.revalidate` calls. ([#10344](https://github.com/remix-run/react-router/pull/10344))
- Decouple `AbortController` usage between revalidating fetchers and the thing that triggered them such that the unmount/deletion of a revalidating fetcher doesn't impact the ongoing triggering navigation/revalidation ([#10271](https://github.com/remix-run/react-router/pull/10271))
## 1.5.0

@@ -4,0 +25,0 @@

34

dist/router.d.ts
import type { History, Location, Path, To } from "./history";
import { Action as HistoryAction } from "./history";
import type { DeferredData, AgnosticDataRouteMatch, AgnosticDataRouteObject, FormEncType, FormMethod, DetectErrorBoundaryFunction, RouteData, AgnosticRouteObject, AgnosticRouteMatch, V7_FormMethod, HTMLFormMethod } from "./utils";
import type { DeferredData, AgnosticDataRouteMatch, AgnosticDataRouteObject, FormEncType, FormMethod, DetectErrorBoundaryFunction, RouteData, AgnosticRouteObject, AgnosticRouteMatch, V7_FormMethod, HTMLFormMethod, MapRoutePropertiesFunction } from "./utils";
/**

@@ -72,3 +72,3 @@ * A Router instance manages all navigation and data loading/mutations

*/
navigate(to: To, opts?: RouterNavigateOptions): Promise<void>;
navigate(to: To | null, opts?: RouterNavigateOptions): Promise<void>;
/**

@@ -85,3 +85,3 @@ * @internal

*/
fetch(key: string, routeId: string, href: string, opts?: RouterNavigateOptions): void;
fetch(key: string, routeId: string, href: string | null, opts?: RouterNavigateOptions): void;
/**

@@ -245,2 +245,3 @@ * @internal

v7_normalizeFormMethod: boolean;
v7_prependBasename: boolean;
}

@@ -254,4 +255,8 @@ /**

basename?: string;
/**
* @deprecated Use `mapRouteProperties` instead
*/
detectErrorBoundary?: DetectErrorBoundaryFunction;
future?: FutureConfig;
mapRouteProperties?: MapRoutePropertiesFunction;
future?: Partial<FutureConfig>;
hydrationData?: HydrationState;

@@ -314,17 +319,18 @@ }

}
/**
* Options for a navigate() call for a Link navigation
*/
declare type LinkNavigateOptions = {
export declare type RelativeRoutingType = "route" | "path";
declare type BaseNavigateOptions = {
replace?: boolean;
state?: any;
preventScrollReset?: boolean;
relative?: RelativeRoutingType;
fromRouteId?: string;
};
/**
* Options for a navigate() call for a Link navigation
*/
declare type LinkNavigateOptions = BaseNavigateOptions;
/**
* Options for a navigate() call for a Form navigation
*/
declare type SubmissionNavigateOptions = {
replace?: boolean;
state?: any;
preventScrollReset?: boolean;
declare type SubmissionNavigateOptions = BaseNavigateOptions & {
formMethod?: HTMLFormMethod;

@@ -440,3 +446,7 @@ formEncType?: FormEncType;

basename?: string;
/**
* @deprecated Use `mapRouteProperties` instead
*/
detectErrorBoundary?: DetectErrorBoundaryFunction;
mapRouteProperties?: MapRoutePropertiesFunction;
}

@@ -443,0 +453,0 @@ export declare function createStaticHandler(routes: AgnosticRouteObject[], opts?: CreateStaticHandlerOptions): StaticHandler;

/**
* @remix-run/router v1.5.0
* @remix-run/router v1.6.0-pre.0
*

@@ -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)}var r;e.Action=void 0,(r=e.Action||(e.Action={})).Pop="POP",r.Push="PUSH",r.Replace="REPLACE";const a="popstate";function o(e,t){if(!1===e||null==e)throw new Error(t)}function n(e,t){if(!e){"undefined"!=typeof console&&console.warn(t);try{throw new Error(t)}catch(e){}}}function i(e,t){return{usr:e.state,key:e.key,idx:t}}function s(e,r,a,o){return void 0===a&&(a=null),t({pathname:"string"==typeof e?e:e.pathname,search:"",hash:""},"string"==typeof r?c(r):r,{state:a,key:r&&r.key||o||Math.random().toString(36).substr(2,8)})}function l(e){let{pathname:t="/",search:r="",hash:a=""}=e;return r&&"?"!==r&&(t+="?"===r.charAt(0)?r:"?"+r),a&&"#"!==a&&(t+="#"===a.charAt(0)?a:"#"+a),t}function c(e){let t={};if(e){let r=e.indexOf("#");r>=0&&(t.hash=e.substr(r),e=e.substr(0,r));let a=e.indexOf("?");a>=0&&(t.search=e.substr(a),e=e.substr(0,a)),e&&(t.pathname=e)}return t}function d(r,n,c,d){void 0===d&&(d={});let{window:u=document.defaultView,v5Compat:h=!1}=d,f=u.history,p=e.Action.Pop,m=null,y=v();function v(){return(f.state||{idx:null}).idx}function g(){p=e.Action.Pop;let t=v(),r=null==t?null:t-y;y=t,m&&m({action:p,location:w.location,delta:r})}function b(e){let t="null"!==u.location.origin?u.location.origin:u.location.href,r="string"==typeof e?e:l(e);return o(t,"No window.location.(origin|href) available to create URL for href: "+r),new URL(r,t)}null==y&&(y=0,f.replaceState(t({},f.state,{idx:y}),""));let w={get action(){return p},get location(){return r(u,f)},listen(e){if(m)throw new Error("A history only accepts one active listener");return u.addEventListener(a,g),m=e,()=>{u.removeEventListener(a,g),m=null}},createHref:e=>n(u,e),createURL:b,encodeLocation(e){let t=b(e);return{pathname:t.pathname,search:t.search,hash:t.hash}},push:function(t,r){p=e.Action.Push;let a=s(w.location,t,r);c&&c(a,t),y=v()+1;let o=i(a,y),n=w.createHref(a);try{f.pushState(o,"",n)}catch(e){u.location.assign(n)}h&&m&&m({action:p,location:w.location,delta:1})},replace:function(t,r){p=e.Action.Replace;let a=s(w.location,t,r);c&&c(a,t),y=v();let o=i(a,y),n=w.createHref(a);f.replaceState(o,"",n),h&&m&&m({action:p,location:w.location,delta:0})},go:e=>f.go(e)};return w}let u;!function(e){e.data="data",e.deferred="deferred",e.redirect="redirect",e.error="error"}(u||(u={}));const h=new Set(["lazy","caseSensitive","path","id","index","children"]);function f(e,r,a,n){return void 0===a&&(a=[]),void 0===n&&(n={}),e.map(((e,i)=>{let s=[...a,i],l="string"==typeof e.id?e.id:s.join("-");if(o(!0!==e.index||!e.children,"Cannot specify children on an index route"),o(!n[l],'Found a route id collision on id "'+l+"\". Route id's must be globally unique within Data Router usages"),function(e){return!0===e.index}(e)){let a=t({},e,{hasErrorBoundary:r(e),id:l});return n[l]=a,a}{let a=t({},e,{id:l,hasErrorBoundary:r(e),children:void 0});return n[l]=a,e.children&&(a.children=f(e.children,r,s,n)),a}}))}function p(e,t,r){void 0===r&&(r="/");let a=R(("string"==typeof t?c(t):t).pathname||"/",r);if(null==a)return null;let o=m(e);!function(e){e.sort(((e,t)=>e.score!==t.score?t.score-e.score:function(e,t){return e.length===t.length&&e.slice(0,-1).every(((e,r)=>e===t[r]))?e[e.length-1]-t[t.length-1]:0}(e.routesMeta.map((e=>e.childrenIndex)),t.routesMeta.map((e=>e.childrenIndex)))))}(o);let n=null;for(let e=0;null==n&&e<o.length;++e)n=w(o[e],A(a));return n}function m(e,t,r,a){void 0===t&&(t=[]),void 0===r&&(r=[]),void 0===a&&(a="");let n=(e,n,i)=>{let s={relativePath:void 0===i?e.path||"":i,caseSensitive:!0===e.caseSensitive,childrenIndex:n,route:e};s.relativePath.startsWith("/")&&(o(s.relativePath.startsWith(a),'Absolute route path "'+s.relativePath+'" nested under path "'+a+'" is not valid. An absolute child route path must start with the combined path of all its parent routes.'),s.relativePath=s.relativePath.slice(a.length));let l=L([a,s.relativePath]),c=r.concat(s);e.children&&e.children.length>0&&(o(!0!==e.index,'Index routes must not have child routes. Please remove all child routes from route path "'+l+'".'),m(e.children,t,c,l)),(null!=e.path||e.index)&&t.push({path:l,score:b(l,e.index),routesMeta:c})};return e.forEach(((e,t)=>{var r;if(""!==e.path&&null!=(r=e.path)&&r.includes("?"))for(let r of y(e.path))n(e,t,r);else n(e,t)})),t}function y(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=y(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 v=/^:\w+$/,g=e=>"*"===e;function b(e,t){let r=e.split("/"),a=r.length;return r.some(g)&&(a+=-2),t&&(a+=2),r.filter((e=>!g(e))).reduce(((e,t)=>e+(v.test(t)?3:""===t?1:10)),a)}function w(e,t){let{routesMeta:r}=e,a={},o="/",n=[];for(let e=0;e<r.length;++e){let i=r[e],s=e===r.length-1,l="/"===o?t:t.slice(o.length)||"/",c=D({path:i.relativePath,caseSensitive:i.caseSensitive,end:s},l);if(!c)return null;Object.assign(a,c.params);let d=i.route;n.push({params:a,pathname:L([o,c.pathname]),pathnameBase:k(L([o,c.pathnameBase])),route:d}),"/"!==c.pathnameBase&&(o=L([o,c.pathnameBase]))}return n}function D(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)=>(a.push(t),"/([^\\/]+)")));e.endsWith("*")?(a.push("*"),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)=>{if("*"===t){let e=l[r]||"";s=i.slice(0,i.length-e.length).replace(/(.)\/+$/,"$1")}return e[t]=function(e,t){try{return decodeURIComponent(e)}catch(r){return n(!1,'The value for the URL param "'+t+'" will not be decoded because the string "'+e+'" is a malformed URL segment. This is probably due to a bad percent encoding ('+r+")."),e}}(l[r]||"",t),e}),{}),pathname:i,pathnameBase:s,pattern:e}}function A(e){try{return decodeURI(e)}catch(t){return n(!1,'The URL path "'+e+'" could not be decoded because it is is a malformed URL segment. This is probably due to a bad percent encoding ('+t+")."),e}}function R(e,t){if("/"===t)return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let r=t.endsWith("/")?t.length-1:t.length,a=e.charAt(r);return a&&"/"!==a?null:e.slice(r)||"/"}function E(e,t){void 0===t&&(t="/");let{pathname:r,search:a="",hash:o=""}="string"==typeof e?c(e):e,n=r?r.startsWith("/")?r:function(e,t){let r=t.replace(/\/+$/,"").split("/");return e.split("/").forEach((e=>{".."===e?r.length>1&&r.pop():"."!==e&&r.push(e)})),r.length>1?r.join("/"):"/"}(r,t):t;return{pathname:n,search:x(a),hash:C(o)}}function S(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 P(e){return e.filter(((e,t)=>0===t||e.route.path&&e.route.path.length>0))}function M(e,r,a,n){let i;void 0===n&&(n=!1),"string"==typeof e?i=c(e):(i=t({},e),o(!i.pathname||!i.pathname.includes("?"),S("?","pathname","search",i)),o(!i.pathname||!i.pathname.includes("#"),S("#","pathname","hash",i)),o(!i.search||!i.search.includes("#"),S("#","search","hash",i)));let s,l=""===e||""===i.pathname,d=l?"/":i.pathname;if(n||null==d)s=a;else{let e=r.length-1;if(d.startsWith("..")){let t=d.split("/");for(;".."===t[0];)t.shift(),e-=1;i.pathname=t.join("/")}s=e>=0?r[e]:"/"}let u=E(i,s),h=d&&"/"!==d&&d.endsWith("/"),f=(l||"."===d)&&a.endsWith("/");return u.pathname.endsWith("/")||!h&&!f||(u.pathname+="/"),u}const L=e=>e.join("/").replace(/\/\/+/g,"/"),k=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),x=e=>e&&"?"!==e?e.startsWith("?")?e:"?"+e:"",C=e=>e&&"#"!==e?e.startsWith("#")?e:"#"+e:"";class U extends Error{}class j{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,null,t)),(t=>this.onSettle(r,e,t)));return r.catch((()=>{})),Object.defineProperty(r,"_tracked",{get:()=>!0}),r}onSettle(e,t,r,a){return this.controller.signal.aborted&&r instanceof U?(this.unlistenAbortSignal(),Object.defineProperty(e,"_error",{get:()=>r}),Promise.reject(r)):(this.pendingKeysSet.delete(t),this.done&&this.unlistenAbortSignal(),r?(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]:T(a)})}),{})}get pendingKeys(){return Array.from(this.pendingKeysSet)}}function T(e){if(!function(e){return e instanceof Promise&&!0===e._tracked}(e))return e;if(e._error)throw e._error;return e._data}class O{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 _(e){return null!=e&&"number"==typeof e.status&&"string"==typeof e.statusText&&"boolean"==typeof e.internal&&"data"in e}const F=["post","put","patch","delete"],H=new Set(F),z=["get",...F],I=new Set(z),B=new Set([301,302,303,307,308]),q=new Set([307,308]),N={state:"idle",location:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0},$={state:"idle",data:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0},W={state:"unblocked",proceed:void 0,reset:void 0,location:void 0},K=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,Y="undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement,J=!Y,V=e=>Boolean(e.hasErrorBoundary);const G=Symbol("deferred");function X(e,t,r,a){void 0===a&&(a=!1);let o,n="string"==typeof e?e:l(e);if(!r||!function(e){return null!=e&&"formData"in e}(r))return{path:n};if(r.formMethod&&!we(r.formMethod))return{path:n,error:ue(405,{method:r.formMethod})};if(r.formData){let e=r.formMethod||"get";if(o={formMethod:t.v7_normalizeFormMethod?e.toUpperCase():e.toLowerCase(),formAction:fe(n),formEncType:r&&r.formEncType||"application/x-www-form-urlencoded",formData:r.formData},De(o.formMethod))return{path:n,submission:o}}let i=c(n),s=ne(r.formData);return a&&i.search&&Ee(i.search)&&s.append("index",""),i.search="?"+s,{path:l(i),submission:o}}function Q(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 Z(e,r,a,o,n,i,s,l,c,d,u,h,f){let m=f?Object.values(f)[0]:h?Object.values(h)[0]:void 0,y=e.createURL(r.location),v=e.createURL(n),g=i||y.toString()===v.toString()||y.search!==v.search,b=f?Object.keys(f)[0]:void 0,w=Q(a,b).filter(((e,a)=>{if(e.route.lazy)return!0;if(null==e.route.loader)return!1;if(function(e,t,r){let a=!t||r.route.id!==t.route.id,o=void 0===e[r.route.id];return a||o}(r.loaderData,r.matches[a],e)||s.some((t=>t===e.route.id)))return!0;let n=r.matches[a],i=e;return te(e,t({currentUrl:y,currentParams:n.params,nextUrl:v,nextParams:i.params},o,{actionResult:m,defaultShouldRevalidate:g||ee(n,i)}))})),D=[];return c.forEach(((e,n)=>{if(!a.some((t=>t.route.id===e.routeId)))return;let i=p(d,e.path,u);if(!i)return void D.push(t({key:n},e,{matches:null,match:null}));let s=Pe(i,e.path);(l.includes(n)||te(s,t({currentUrl:y,currentParams:r.matches[r.matches.length-1].params,nextUrl:v,nextParams:a[a.length-1].params},o,{actionResult:m,defaultShouldRevalidate:g})))&&D.push(t({key:n,matches:i,match:s},e))})),[w,D]}function ee(e,t){let r=e.route.path;return e.pathname!==t.pathname||null!=r&&r.endsWith("*")&&e.params["*"]!==t.params["*"]}function te(e,t){if(e.route.shouldRevalidate){let r=e.route.shouldRevalidate(t);if("boolean"==typeof r)return r}return t.defaultShouldRevalidate}async function re(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,{hasErrorBoundary:r(t({},s)),lazy:void 0})}async function ae(e,t,r,a,n,i,s,c,d,h){let f,p,m;void 0===s&&(s="/"),void 0===c&&(c=!1),void 0===d&&(d=!1);let y=e=>{let a,o=new Promise(((e,t)=>a=t));return m=()=>a(),t.signal.addEventListener("abort",m),Promise.race([e({request:t,params:r.params,context:h}),o])};try{let a=r.route[e];if(r.route.lazy)if(a){p=(await Promise.all([y(a),re(r.route,i,n)]))[0]}else{if(await re(r.route,i,n),a=r.route[e],!a){if("action"===e)throw ue(405,{method:t.method,pathname:new URL(t.url).pathname,routeId:r.route.id});return{type:u.data,data:void 0}}p=await y(a)}else o(a,"Could not find the "+e+' to run on the "'+r.route.id+'" route'),p=await y(a);o(void 0!==p,"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){f=u.error,p=e}finally{m&&t.signal.removeEventListener("abort",m)}if(ge(p)){let e,n=p.status;if(B.has(n)){let e=p.headers.get("Location");if(o(e,"Redirects returned/thrown from loaders/actions must have a Location header"),K.test(e)){if(!c){let r=new URL(t.url),a=e.startsWith("//")?new URL(r.protocol+e):new URL(e),o=null!=R(a.pathname,s);a.origin===r.origin&&o&&(e=a.pathname+a.search+a.hash)}}else{let n=M(e,P(a.slice(0,a.indexOf(r)+1)).map((e=>e.pathnameBase)),new URL(t.url).pathname);if(o(l(n),"Unable to resolve redirect location: "+e),s){let e=n.pathname;n.pathname="/"===e?s:L([s,e])}e=l(n)}if(c)throw p.headers.set("Location",e),p;return{type:u.redirect,status:n,location:e,revalidate:null!==p.headers.get("X-Remix-Revalidate")}}if(d)throw{type:f||u.data,response:p};let i=p.headers.get("Content-Type");return e=i&&/\bapplication\/json\b/.test(i)?await p.json():await p.text(),f===u.error?{type:f,error:new O(n,p.statusText,e),headers:p.headers}:{type:u.data,data:e,statusCode:p.status,headers:p.headers}}return f===u.error?{type:f,error:p}:ve(p)?{type:u.deferred,deferredData:p,statusCode:null==(v=p.init)?void 0:v.status,headers:(null==(g=p.init)?void 0:g.headers)&&new Headers(p.init.headers)}:{type:u.data,data:p};var v,g}function oe(e,t,r,a){let o=e.createURL(fe(t)).toString(),n={signal:r};if(a&&De(a.formMethod)){let{formMethod:e,formEncType:t,formData:r}=a;n.method=e.toUpperCase(),n.body="application/x-www-form-urlencoded"===t?ne(r):r}return new Request(o,n)}function ne(e){let t=new URLSearchParams;for(let[r,a]of e.entries())t.append(r,a instanceof File?a.name:a);return t}function ie(e,t,r,a,n){let i,s={},l=null,c=!1,d={};return r.forEach(((r,u)=>{let h=t[u].route.id;if(o(!ye(r),"Cannot handle redirect results in processLoaderData"),me(r)){let t=ce(e,h),o=r.error;a&&(o=Object.values(a)[0],a=void 0),l=l||{},null==l[t.route.id]&&(l[t.route.id]=o),s[h]=void 0,c||(c=!0,i=_(r.error)?r.error.status:500),r.headers&&(d[h]=r.headers)}else pe(r)?(n.set(h,r.deferredData),s[h]=r.deferredData.data):s[h]=r.data,null==r.statusCode||200===r.statusCode||c||(i=r.statusCode),r.headers&&(d[h]=r.headers)})),a&&(l=a,s[Object.keys(a)[0]]=void 0),{loaderData:s,errors:l,statusCode:i||200,loaderHeaders:d}}function se(e,r,a,n,i,s,l,c){let{loaderData:d,errors:u}=ie(r,a,n,i,c);for(let r=0;r<s.length;r++){let{key:a,match:n}=s[r];o(void 0!==l&&void 0!==l[r],"Did not find corresponding fetcher result");let i=l[r];if(me(i)){let r=ce(e.matches,null==n?void 0:n.route.id);u&&u[r.route.id]||(u=t({},u,{[r.route.id]:i.error})),e.fetchers.delete(a)}else if(ye(i))o(!1,"Unhandled fetcher revalidation redirect");else if(pe(i))o(!1,"Unhandled fetcher deferred data");else{let t={state:"idle",data:i.data,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0," _hasFetcherDoneAnything ":!0};e.fetchers.set(a,t)}}return{loaderData:d,errors:u}}function le(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 ce(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 de(e){let t=e.find((e=>e.index||!e.path||"/"===e.path))||{id:"__shim-error-route__"};return{matches:[{params:{},pathname:"",pathnameBase:"",route:t}],route:t}}function ue(e,t){let{pathname:r,routeId:a,method:o,type:n}=void 0===t?{}:t,i="Unknown Server Error",s="Unknown @remix-run/router error";return 400===e?(i="Bad Request",o&&r&&a?s="You made a "+o+' request to "'+r+'" but did not provide a `loader` for route "'+a+'", so there is no way to handle the request.':"defer-action"===n&&(s="defer() is not supported in actions")):403===e?(i="Forbidden",s='Route "'+a+'" does not match URL "'+r+'"'):404===e?(i="Not Found",s='No route matches URL "'+r+'"'):405===e&&(i="Method Not Allowed",o&&r&&a?s="You made a "+o.toUpperCase()+' request to "'+r+'" but did not provide an `action` for route "'+a+'", so there is no way to handle the request.':o&&(s='Invalid request method "'+o.toUpperCase()+'"')),new O(e||500,i,new Error(s),!0)}function he(e){for(let t=e.length-1;t>=0;t--){let r=e[t];if(ye(r))return r}}function fe(e){return l(t({},"string"==typeof e?c(e):e,{hash:""}))}function pe(e){return e.type===u.deferred}function me(e){return e.type===u.error}function ye(e){return(e&&e.type)===u.redirect}function ve(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 ge(e){return null!=e&&"number"==typeof e.status&&"string"==typeof e.statusText&&"object"==typeof e.headers&&void 0!==e.body}function be(e){if(!ge(e))return!1;let t=e.status,r=e.headers.get("Location");return t>=300&&t<=399&&null!=r}function we(e){return I.has(e.toLowerCase())}function De(e){return H.has(e.toLowerCase())}async function Ae(e,t,r,a,o,n){for(let i=0;i<r.length;i++){let s=r[i],l=t[i];if(!l)continue;let c=e.find((e=>e.route.id===l.route.id)),d=null!=c&&!ee(c,l)&&void 0!==(n&&n[l.route.id]);pe(s)&&(o||d)&&await Re(s,a,o).then((e=>{e&&(r[i]=e||r[i])}))}}async function Re(e,t,r){if(void 0===r&&(r=!1),!await e.deferredData.resolveData(t)){if(r)try{return{type:u.data,data:e.deferredData.unwrappedData}}catch(e){return{type:u.error,error:e}}return{type:u.data,data:e.deferredData.data}}}function Ee(e){return new URLSearchParams(e).getAll("index").some((e=>""===e))}function Se(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 Pe(e,t){let r="string"==typeof t?c(t).search:t.search;if(e[e.length-1].route.index&&Ee(r||""))return e[e.length-1];let a=P(e);return a[a.length-1]}e.AbortedDeferredError=U,e.ErrorResponse=O,e.IDLE_BLOCKER=W,e.IDLE_FETCHER=$,e.IDLE_NAVIGATION=N,e.UNSAFE_DEFERRED_SYMBOL=G,e.UNSAFE_DeferredData=j,e.UNSAFE_convertRoutesToDataRoutes=f,e.UNSAFE_getPathContributingMatches=P,e.UNSAFE_invariant=o,e.UNSAFE_warning=n,e.createBrowserHistory=function(e){return void 0===e&&(e={}),d((function(e,t){let{pathname:r,search:a,hash:o}=e.location;return s("",{pathname:r,search:a,hash:o},t.state&&t.state.usr||null,t.state&&t.state.key||"default")}),(function(e,t){return"string"==typeof t?t:l(t)}),null,e)},e.createHashHistory=function(e){return void 0===e&&(e={}),d((function(e,t){let{pathname:r="/",search:a="",hash:o=""}=c(e.location.hash.substr(1));return 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(t){void 0===t&&(t={});let r,{initialEntries:a=["/"],initialIndex:o,v5Compat:i=!1}=t;r=a.map(((e,t)=>m(e,"string"==typeof e?null:e.state,0===t?"default":void 0)));let d=f(null==o?r.length-1:o),u=e.Action.Pop,h=null;function f(e){return Math.min(Math.max(e,0),r.length-1)}function p(){return r[d]}function m(e,t,a){void 0===t&&(t=null);let o=s(r?p().pathname:"/",e,t,a);return n("/"===o.pathname.charAt(0),"relative pathnames are not supported in memory history: "+JSON.stringify(e)),o}function y(e){return"string"==typeof e?e:l(e)}return{get index(){return d},get action(){return u},get location(){return p()},createHref:y,createURL:e=>new URL(y(e),"http://localhost"),encodeLocation(e){let t="string"==typeof e?c(e):e;return{pathname:t.pathname||"",search:t.search||"",hash:t.hash||""}},push(t,a){u=e.Action.Push;let o=m(t,a);d+=1,r.splice(d,r.length,o),i&&h&&h({action:u,location:o,delta:1})},replace(t,a){u=e.Action.Replace;let o=m(t,a);r[d]=o,i&&h&&h({action:u,location:o,delta:0})},go(t){u=e.Action.Pop;let a=f(d+t),o=r[a];d=a,h&&h({action:u,location:o,delta:t})},listen:e=>(h=e,()=>{h=null})}},e.createPath=l,e.createRouter=function(r){o(r.routes.length>0,"You must provide a non-empty routes array to createRouter");let a,i=r.detectErrorBoundary||V,l={},c=f(r.routes,i,void 0,l),d=t({v7_normalizeFormMethod:!1},r.future),h=null,m=new Set,y=null,v=null,g=null,b=null!=r.hydrationData,w=p(c,r.history.location,r.basename),D=null;if(null==w){let e=ue(404,{pathname:r.history.location.pathname}),{matches:t,route:a}=de(c);w=t,D={[a.id]:e}}let A,E,S=!(w.some((e=>e.route.lazy))||w.some((e=>e.route.loader))&&null==r.hydrationData),P={historyAction:r.history.action,location:r.history.location,matches:w,initialized:S,navigation:N,restoreScrollPosition:null==r.hydrationData&&null,preventScrollReset:!1,revalidation:"idle",loaderData:r.hydrationData&&r.hydrationData.loaderData||{},actionData:r.hydrationData&&r.hydrationData.actionData||null,errors:r.hydrationData&&r.hydrationData.errors||D,fetchers:new Map,blockers:new Map},M=e.Action.Pop,L=!1,k=!1,x=!1,C=[],U=[],j=new Map,T=0,O=-1,_=new Map,F=new Set,H=new Map,z=new Map,I=new Map,B=!1;function G(e){P=t({},P,e),m.forEach((e=>e(P)))}function Q(o,n){var i,s;let l,d=null!=P.actionData&&null!=P.navigation.formMethod&&De(P.navigation.formMethod)&&"loading"===P.navigation.state&&!0!==(null==(i=o.state)?void 0:i._isRedirect);l=n.actionData?Object.keys(n.actionData).length>0?n.actionData:null:d?P.actionData:null;let u=n.loaderData?le(P.loaderData,n.loaderData,n.matches||[],n.errors):P.loaderData;for(let[e]of I)Ee(e);let h=!0===L||null!=P.navigation.formMethod&&De(P.navigation.formMethod)&&!0!==(null==(s=o.state)?void 0:s._isRedirect);a&&(c=a,a=void 0),G(t({},n,{actionData:l,loaderData:u,historyAction:M,location:o,initialized:!0,navigation:N,revalidation:"idle",restoreScrollPosition:xe(o,n.matches||P.matches),preventScrollReset:h,blockers:new Map(P.blockers)})),k||M===e.Action.Pop||(M===e.Action.Push?r.history.push(o,o.state):M===e.Action.Replace&&r.history.replace(o,o.state)),M=e.Action.Pop,L=!1,k=!1,x=!1,C=[],U=[]}async function ee(n,s,d){E&&E.abort(),E=null,M=n,k=!0===(d&&d.startUninterruptedRevalidation),function(e,t){if(y&&v&&g){let r=t.map((e=>Se(e,P.loaderData))),a=v(e,r)||e.key;y[a]=g()}}(P.location,P.matches),L=!0===(d&&d.preventScrollReset);let h=a||c,f=d&&d.overrideNavigation,m=p(h,s,r.basename);if(!m){let e=ue(404,{pathname:s.pathname}),{matches:t,route:r}=de(h);return ke(),void Q(s,{matches:t,loaderData:{},errors:{[r.id]:e}})}if(!(b=P.location,w=s,b.pathname!==w.pathname||b.search!==w.search||b.hash===w.hash||d&&d.submission&&De(d.submission.formMethod)))return void Q(s,{matches:m});var b,w;E=new AbortController;let D,R,S=oe(r.history,s,E.signal,d&&d.submission);if(d&&d.pendingError)R={[ce(m).route.id]:d.pendingError};else if(d&&d.submission&&De(d.submission.formMethod)){let r=await async function(r,a,o,n,s){let c;ie(),G({navigation:t({state:"submitting",location:a},o)});let d=Pe(n,a);if(d.route.action||d.route.lazy){if(c=await ae("action",r,d,n,l,i,A.basename),r.signal.aborted)return{shortCircuited:!0}}else c={type:u.error,error:ue(405,{method:r.method,pathname:a.pathname,routeId:d.route.id})};if(ye(c)){let e;return e=s&&null!=s.replace?s.replace:c.location===P.location.pathname+P.location.search,await re(P,c,{submission:o,replace:e}),{shortCircuited:!0}}if(me(c)){let t=ce(n,d.route.id);return!0!==(s&&s.replace)&&(M=e.Action.Push),{pendingActionData:{},pendingActionError:{[t.route.id]:c.error}}}if(pe(c))throw ue(400,{type:"defer-action"});return{pendingActionData:{[d.route.id]:c.data}}}(S,s,d.submission,m,{replace:d.replace});if(r.shortCircuited)return;D=r.pendingActionData,R=r.pendingActionError,f=t({state:"loading",location:s},d.submission),S=new Request(S.url,{signal:S.signal})}let{shortCircuited:_,loaderData:I,errors:B}=await async function(e,n,i,s,l,d,u,h,f){let p=s;if(!p){p=t({state:"loading",location:n,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0},l)}let m=l||d?l||d:p.formMethod&&p.formAction&&p.formData&&p.formEncType?{formMethod:p.formMethod,formAction:p.formAction,formData:p.formData,formEncType:p.formEncType}:void 0,y=a||c,[v,g]=Z(r.history,P,i,m,n,x,C,U,H,y,r.basename,h,f);if(ke((e=>!(i&&i.some((t=>t.route.id===e)))||v&&v.some((t=>t.route.id===e)))),0===v.length&&0===g.length)return Q(n,t({matches:i,loaderData:{},errors:f||null},h?{actionData:h}:{})),{shortCircuited:!0};if(!k){g.forEach((e=>{let t=P.fetchers.get(e.key),r={state:"loading",data:t&&t.data,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0," _hasFetcherDoneAnything ":!0};P.fetchers.set(e.key,r)}));let e=h||P.actionData;G(t({navigation:p},e?0===Object.keys(e).length?{actionData:null}:{actionData:e}:{},g.length>0?{fetchers:new Map(P.fetchers)}:{}))}O=++T,g.forEach((e=>j.set(e.key,E)));let{results:b,loaderResults:w,fetcherResults:D}=await ne(P.matches,i,v,g,e);if(e.signal.aborted)return{shortCircuited:!0};g.forEach((e=>j.delete(e.key)));let A=he(b);if(A)return await re(P,A,{replace:u}),{shortCircuited:!0};let{loaderData:R,errors:S}=se(P,i,v,w,f,g,D,z);z.forEach(((e,t)=>{e.subscribe((r=>{(r||e.done)&&z.delete(t)}))})),function(){let e=[];for(let t of F){let r=P.fetchers.get(t);o(r,"Expected fetcher: "+t),"loading"===r.state&&(F.delete(t),e.push(t))}be(e)}();let M=we(O);return t({loaderData:R,errors:S},M||g.length>0?{fetchers:new Map(P.fetchers)}:{})}(S,s,m,f,d&&d.submission,d&&d.fetcherSubmission,d&&d.replace,D,R);_||(E=null,Q(s,t({matches:m},D?{actionData:D}:{},{loaderData:I,errors:B})))}function te(e){return P.fetchers.get(e)||$}async function re(a,n,i){var l;let{submission:c,replace:d,isFetchActionRedirect:u}=void 0===i?{}:i;n.revalidate&&(x=!0);let h=s(a.location,n.location,t({_isRedirect:!0},u?{_isFetchActionRedirect:!0}:{}));if(o(h,"Expected a location on the redirect navigation"),K.test(n.location)&&Y&&void 0!==(null==(l=window)?void 0:l.location)){let e=r.history.createURL(n.location),t=null==R(e.pathname,r.basename||"/");if(window.location.origin!==e.origin||t)return void(d?window.location.replace(n.location):window.location.assign(n.location))}E=null;let f=!0===d?e.Action.Replace:e.Action.Push,{formMethod:p,formAction:m,formEncType:y,formData:v}=a.navigation;!c&&p&&m&&v&&y&&(c={formMethod:p,formAction:m,formEncType:y,formData:v}),q.has(n.status)&&c&&De(c.formMethod)?await ee(f,h,{submission:t({},c,{formAction:n.location}),preventScrollReset:L}):u?await ee(f,h,{overrideNavigation:{state:"loading",location:h,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0},fetcherSubmission:c,preventScrollReset:L}):await ee(f,h,{overrideNavigation:{state:"loading",location:h,formMethod:c?c.formMethod:void 0,formAction:c?c.formAction:void 0,formEncType:c?c.formEncType:void 0,formData:c?c.formData:void 0},preventScrollReset:L})}async function ne(e,t,a,o,n){let s=await Promise.all([...a.map((e=>ae("loader",n,e,t,l,i,A.basename))),...o.map((e=>{if(e.matches&&e.match)return ae("loader",oe(r.history,e.path,n.signal),e.match,e.matches,l,i,A.basename);return{type:u.error,error:ue(404,{pathname:e.path})}}))]),c=s.slice(0,a.length),d=s.slice(a.length);return await Promise.all([Ae(e,a,c,n.signal,!1,P.loaderData),Ae(e,o.map((e=>e.match)),d,n.signal,!0)]),{results:s,loaderResults:c,fetcherResults:d}}function ie(){x=!0,C.push(...ke()),H.forEach(((e,t)=>{j.has(t)&&(U.push(t),ge(t))}))}function fe(e,t,r){let a=ce(P.matches,t);ve(e),G({errors:{[a.route.id]:r},fetchers:new Map(P.fetchers)})}function ve(e){j.has(e)&&ge(e),H.delete(e),_.delete(e),F.delete(e),P.fetchers.delete(e)}function ge(e){let t=j.get(e);o(t,"Expected fetch controller: "+e),t.abort(),j.delete(e)}function be(e){for(let t of e){let e={state:"idle",data:te(t).data,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0," _hasFetcherDoneAnything ":!0};P.fetchers.set(t,e)}}function we(e){let t=[];for(let[r,a]of _)if(a<e){let e=P.fetchers.get(r);o(e,"Expected fetcher: "+r),"loading"===e.state&&(ge(r),_.delete(r),t.push(r))}return be(t),t.length>0}function Ee(e){P.blockers.delete(e),I.delete(e)}function Me(e,t){let r=P.blockers.get(e)||W;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),P.blockers.set(e,t),G({blockers:new Map(P.blockers)})}function Le(e){let{currentLocation:t,nextLocation:r,historyAction:a}=e;if(0===I.size)return;I.size>1&&n(!1,"A router only supports one blocker at a time");let o=Array.from(I.entries()),[i,s]=o[o.length-1],l=P.blockers.get(i);return l&&"proceeding"===l.state?void 0:s({currentLocation:t,nextLocation:r,historyAction:a})?i:void 0}function ke(e){let t=[];return z.forEach(((r,a)=>{e&&!e(a)||(r.cancel(),t.push(a),z.delete(a))})),t}function xe(e,t){if(y&&v&&g){let r=t.map((e=>Se(e,P.loaderData))),a=v(e,r)||e.key,o=y[a];if("number"==typeof o)return o}return null}return A={get basename(){return r.basename},get state(){return P},get routes(){return c},initialize:function(){return h=r.history.listen((e=>{let{action:t,location:a,delta:o}=e;if(B)return void(B=!1);n(0===I.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=Le({currentLocation:P.location,nextLocation:a,historyAction:t});return i&&null!=o?(B=!0,r.history.go(-1*o),void Me(i,{state:"blocked",location:a,proceed(){Me(i,{state:"proceeding",proceed:void 0,reset:void 0,location:a}),r.history.go(o)},reset(){Ee(i),G({blockers:new Map(A.state.blockers)})}})):ee(t,a)})),P.initialized||ee(e.Action.Pop,P.location),A},subscribe:function(e){return m.add(e),()=>m.delete(e)},enableScrollRestoration:function(e,t,r){if(y=e,g=t,v=r||(e=>e.key),!b&&P.navigation===N){b=!0;let e=xe(P.location,P.matches);null!=e&&G({restoreScrollPosition:e})}return()=>{y=null,g=null,v=null}},navigate:async function a(o,n){if("number"==typeof o)return void r.history.go(o);let{path:i,submission:l,error:c}=X(o,d,n),u=P.location,h=s(P.location,i,n&&n.state);h=t({},h,r.history.encodeLocation(h));let f=n&&null!=n.replace?n.replace:void 0,p=e.Action.Push;!0===f?p=e.Action.Replace:!1===f||null!=l&&De(l.formMethod)&&l.formAction===P.location.pathname+P.location.search&&(p=e.Action.Replace);let m=n&&"preventScrollReset"in n?!0===n.preventScrollReset:void 0,y=Le({currentLocation:u,nextLocation:h,historyAction:p});if(!y)return await ee(p,h,{submission:l,pendingError:c,preventScrollReset:m,replace:n&&n.replace});Me(y,{state:"blocked",location:h,proceed(){Me(y,{state:"proceeding",proceed:void 0,reset:void 0,location:h}),a(o,n)},reset(){Ee(y),G({blockers:new Map(P.blockers)})}})},fetch:function(e,n,s,u){if(J)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.");j.has(e)&&ge(e);let h=p(a||c,s,r.basename);if(!h)return void fe(e,n,ue(404,{pathname:s}));let{path:f,submission:m}=X(s,d,u,!0),y=Pe(h,f);L=!0===(u&&u.preventScrollReset),m&&De(m.formMethod)?async function(e,n,s,d,u,h){if(ie(),H.delete(e),!d.route.action&&!d.route.lazy){let t=ue(405,{method:h.formMethod,pathname:s,routeId:n});return void fe(e,n,t)}let f=P.fetchers.get(e),m=t({state:"submitting"},h,{data:f&&f.data," _hasFetcherDoneAnything ":!0});P.fetchers.set(e,m),G({fetchers:new Map(P.fetchers)});let y=new AbortController,v=oe(r.history,s,y.signal,h);j.set(e,y);let g=await ae("action",v,d,u,l,i,A.basename);if(v.signal.aborted)return void(j.get(e)===y&&j.delete(e));if(ye(g)){j.delete(e),F.add(e);let r=t({state:"loading"},h,{data:void 0," _hasFetcherDoneAnything ":!0});return P.fetchers.set(e,r),G({fetchers:new Map(P.fetchers)}),re(P,g,{submission:h,isFetchActionRedirect:!0})}if(me(g))return void fe(e,n,g.error);if(pe(g))throw ue(400,{type:"defer-action"});let b=P.navigation.location||P.location,w=oe(r.history,b,y.signal),D=a||c,R="idle"!==P.navigation.state?p(D,P.navigation.location,r.basename):P.matches;o(R,"Didn't find any matches after fetcher action");let S=++T;_.set(e,S);let L=t({state:"loading",data:g.data},h,{" _hasFetcherDoneAnything ":!0});P.fetchers.set(e,L);let[k,I]=Z(r.history,P,R,h,b,x,C,U,H,D,r.basename,{[d.route.id]:g.data},void 0);I.filter((t=>t.key!==e)).forEach((e=>{let t=e.key,r=P.fetchers.get(t),a={state:"loading",data:r&&r.data,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0," _hasFetcherDoneAnything ":!0};P.fetchers.set(t,a),j.set(t,y)})),G({fetchers:new Map(P.fetchers)});let{results:B,loaderResults:q,fetcherResults:N}=await ne(P.matches,R,k,I,w);if(y.signal.aborted)return;_.delete(e),j.delete(e),I.forEach((e=>j.delete(e.key)));let $=he(B);if($)return re(P,$);let{loaderData:W,errors:K}=se(P,P.matches,k,q,void 0,I,N,z),Y={state:"idle",data:g.data,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0," _hasFetcherDoneAnything ":!0};P.fetchers.set(e,Y);let J=we(S);"loading"===P.navigation.state&&S>O?(o(M,"Expected pending action"),E&&E.abort(),Q(P.navigation.location,{matches:R,loaderData:W,errors:K,fetchers:new Map(P.fetchers)})):(G(t({errors:K,loaderData:le(P.loaderData,W,R,K)},J?{fetchers:new Map(P.fetchers)}:{})),x=!1)}(e,n,f,y,h,m):(H.set(e,{routeId:n,path:f}),async function(e,a,n,s,c,d){let u=P.fetchers.get(e),h=t({state:"loading",formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0},d,{data:u&&u.data," _hasFetcherDoneAnything ":!0});P.fetchers.set(e,h),G({fetchers:new Map(P.fetchers)});let f=new AbortController,p=oe(r.history,n,f.signal);j.set(e,f);let m=await ae("loader",p,s,c,l,i,A.basename);pe(m)&&(m=await Re(m,p.signal,!0)||m);j.get(e)===f&&j.delete(e);if(p.signal.aborted)return;if(ye(m))return void await re(P,m);if(me(m)){let t=ce(P.matches,a);return P.fetchers.delete(e),void G({fetchers:new Map(P.fetchers),errors:{[t.route.id]:m.error}})}o(!pe(m),"Unhandled fetcher deferred data");let y={state:"idle",data:m.data,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0," _hasFetcherDoneAnything ":!0};P.fetchers.set(e,y),G({fetchers:new Map(P.fetchers)})}(e,n,f,y,h,m))},revalidate:function(){ie(),G({revalidation:"loading"}),"submitting"!==P.navigation.state&&("idle"!==P.navigation.state?ee(M||P.historyAction,P.navigation.location,{overrideNavigation:P.navigation}):ee(P.historyAction,P.location,{startUninterruptedRevalidation:!0}))},createHref:e=>r.history.createHref(e),encodeLocation:e=>r.history.encodeLocation(e),getFetcher:te,deleteFetcher:ve,dispose:function(){h&&h(),m.clear(),E&&E.abort(),P.fetchers.forEach(((e,t)=>ve(t))),P.blockers.forEach(((e,t)=>Ee(t)))},getBlocker:function(e,t){let r=P.blockers.get(e)||W;return I.get(e)!==t&&I.set(e,t),r},deleteBlocker:Ee,_internalFetchControllers:j,_internalActiveDeferreds:z,_internalSetRoutes:function(e){a=e}},A},e.createStaticHandler=function(e,r){o(e.length>0,"You must provide a non-empty routes array to createStaticHandler");let a={},n=(null==r?void 0:r.detectErrorBoundary)||V,i=f(e,n,void 0,a),c=(r?r.basename:null)||"/";async function d(e,r,i,s,l){o(e.signal,"query()/queryRoute() requests must contain an AbortController signal");try{if(De(e.method.toLowerCase())){let o=await async function(e,r,o,i,s){let l;if(o.route.action||o.route.lazy){if(l=await ae("action",e,o,r,a,n,c,!0,s,i),e.signal.aborted){throw new Error((s?"queryRoute":"query")+"() call aborted")}}else{let t=ue(405,{method:e.method,pathname:new URL(e.url).pathname,routeId:o.route.id});if(s)throw t;l={type:u.error,error:t}}if(ye(l))throw new Response(null,{status:l.status,headers:{Location:l.location}});if(pe(l)){let e=ue(400,{type:"defer-action"});if(s)throw e;l={type:u.error,error:e}}if(s){if(me(l))throw l.error;return{matches:[o],loaderData:{},actionData:{[o.route.id]:l.data},errors:null,statusCode:200,loaderHeaders:{},actionHeaders:{},activeDeferreds:null}}if(me(l)){let a=ce(r,o.route.id);return t({},await h(e,r,i,void 0,{[a.route.id]:l.error}),{statusCode:_(l.error)?l.error.status:500,actionData:null,actionHeaders:t({},l.headers?{[o.route.id]:l.headers}:{})})}let d=new Request(e.url,{headers:e.headers,redirect:e.redirect,signal:e.signal});return t({},await h(d,r,i),l.statusCode?{statusCode:l.statusCode}:{},{actionData:{[o.route.id]:l.data},actionHeaders:t({},l.headers?{[o.route.id]:l.headers}:{})})}(e,i,l||Pe(i,r),s,null!=l);return o}let o=await h(e,i,s,l);return ge(o)?o:t({},o,{actionData:null,actionHeaders:{}})}catch(e){if((d=e)&&ge(d.response)&&(d.type===u.data||u.error)){if(e.type===u.error&&!be(e.response))throw e.response;return e.response}if(be(e))return e;throw e}var d}async function h(e,r,o,i,s){let l=null!=i;if(l&&(null==i||!i.route.loader)&&(null==i||!i.route.lazy))throw ue(400,{method:e.method,pathname:new URL(e.url).pathname,routeId:null==i?void 0:i.route.id});let d=(i?[i]:Q(r,Object.keys(s||{})[0])).filter((e=>e.route.loader||e.route.lazy));if(0===d.length)return{matches:r,loaderData:r.reduce(((e,t)=>Object.assign(e,{[t.route.id]:null})),{}),errors:s||null,statusCode:200,loaderHeaders:{},activeDeferreds:null};let u=await Promise.all([...d.map((t=>ae("loader",e,t,r,a,n,c,!0,l,o)))]);if(e.signal.aborted){throw new Error((l?"queryRoute":"query")+"() call aborted")}let h=new Map,f=ie(r,d,u,s,h),p=new Set(d.map((e=>e.route.id)));return r.forEach((e=>{p.has(e.route.id)||(f.loaderData[e.route.id]=null)})),t({},f,{matches:r,activeDeferreds:h.size>0?Object.fromEntries(h.entries()):null})}return{dataRoutes:i,query:async function(e,r){let{requestContext:a}=void 0===r?{}:r,o=new URL(e.url),n=e.method,u=s("",l(o),null,"default"),h=p(i,u,c);if(!we(n)&&"HEAD"!==n){let e=ue(405,{method:n}),{matches:t,route:r}=de(i);return{basename:c,location:u,matches:t,loaderData:{},actionData:null,errors:{[r.id]:e},statusCode:e.status,loaderHeaders:{},actionHeaders:{},activeDeferreds:null}}if(!h){let e=ue(404,{pathname:u.pathname}),{matches:t,route:r}=de(i);return{basename:c,location:u,matches:t,loaderData:{},actionData:null,errors:{[r.id]:e},statusCode:e.status,loaderHeaders:{},actionHeaders:{},activeDeferreds:null}}let f=await d(e,u,h,a);return ge(f)?f:t({location:u,basename:c},f)},queryRoute:async function(e,t){let{routeId:r,requestContext:a}=void 0===t?{}:t,o=new URL(e.url),n=e.method,u=s("",l(o),null,"default"),h=p(i,u,c);if(!we(n)&&"HEAD"!==n&&"OPTIONS"!==n)throw ue(405,{method:n});if(!h)throw ue(404,{pathname:u.pathname});let f=r?h.find((e=>e.route.id===r)):Pe(h,u);if(r&&!f)throw ue(403,{pathname:u.pathname,routeId:r});if(!f)throw ue(404,{pathname:u.pathname});let m=await d(e,u,h,a,f);if(ge(m))return m;let y=m.errors?Object.values(m.errors)[0]:void 0;if(void 0!==y)throw y;if(m.actionData)return Object.values(m.actionData)[0];if(m.loaderData){var v;let e=Object.values(m.loaderData)[0];return null!=(v=m.activeDeferreds)&&v[f.route.id]&&(e[G]=m.activeDeferreds[f.route.id]),e}}}},e.defer=function(e,t){return void 0===t&&(t={}),new j(e,"number"==typeof t?{status:t}:t)},e.generatePath=function(e,t){void 0===t&&(t={});let r=e;return 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(/\*$/,"/*")),(r.startsWith("/")?"/":"")+r.split(/\/+/).map(((e,r,a)=>{if(r===a.length-1&&"*"===e){return t["*"]}const n=e.match(/^:(\w+)(\??)$/);if(n){const[,e,r]=n;let a=t[e];return"?"===r?null==a?"":a:(null==a&&o(!1,'Missing ":'+e+'" param'),a)}return e.replace(/\?$/g,"")})).filter((e=>!!e)).join("/")},e.getStaticContextFromError=function(e,r,a){return t({},r,{statusCode:500,errors:{[r._deepestRenderedBoundaryId||e[0].id]:a}})},e.getToPathname=function(e){return""===e||""===e.pathname?"/":"string"==typeof e?c(e).pathname:e.pathname},e.isDeferredData=ve,e.isRouteErrorResponse=_,e.joinPaths=L,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=D,e.matchRoutes=p,e.normalizePathname=k,e.parsePath=c,e.redirect=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}))},e.resolvePath=E,e.resolveTo=M,e.stripBasename=R,Object.defineProperty(e,"__esModule",{value:!0})}));
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).RemixRouter={})}(this,(function(e){"use strict";function t(){return t=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var a in r)Object.prototype.hasOwnProperty.call(r,a)&&(e[a]=r[a])}return e},t.apply(this,arguments)}var r;e.Action=void 0,(r=e.Action||(e.Action={})).Pop="POP",r.Push="PUSH",r.Replace="REPLACE";const a="popstate";function o(e,t){if(!1===e||null==e)throw new Error(t)}function n(e,t){if(!e){"undefined"!=typeof console&&console.warn(t);try{throw new Error(t)}catch(e){}}}function i(e,t){return{usr:e.state,key:e.key,idx:t}}function s(e,r,a,o){return void 0===a&&(a=null),t({pathname:"string"==typeof e?e:e.pathname,search:"",hash:""},"string"==typeof r?c(r):r,{state:a,key:r&&r.key||o||Math.random().toString(36).substr(2,8)})}function l(e){let{pathname:t="/",search:r="",hash:a=""}=e;return r&&"?"!==r&&(t+="?"===r.charAt(0)?r:"?"+r),a&&"#"!==a&&(t+="#"===a.charAt(0)?a:"#"+a),t}function c(e){let t={};if(e){let r=e.indexOf("#");r>=0&&(t.hash=e.substr(r),e=e.substr(0,r));let a=e.indexOf("?");a>=0&&(t.search=e.substr(a),e=e.substr(0,a)),e&&(t.pathname=e)}return t}function d(r,n,c,d){void 0===d&&(d={});let{window:u=document.defaultView,v5Compat:h=!1}=d,f=u.history,p=e.Action.Pop,m=null,v=y();function y(){return(f.state||{idx:null}).idx}function g(){p=e.Action.Pop;let t=y(),r=null==t?null:t-v;v=t,m&&m({action:p,location:w.location,delta:r})}function b(e){let t="null"!==u.location.origin?u.location.origin:u.location.href,r="string"==typeof e?e:l(e);return o(t,"No window.location.(origin|href) available to create URL for href: "+r),new URL(r,t)}null==v&&(v=0,f.replaceState(t({},f.state,{idx:v}),""));let w={get action(){return p},get location(){return r(u,f)},listen(e){if(m)throw new Error("A history only accepts one active listener");return u.addEventListener(a,g),m=e,()=>{u.removeEventListener(a,g),m=null}},createHref:e=>n(u,e),createURL:b,encodeLocation(e){let t=b(e);return{pathname:t.pathname,search:t.search,hash:t.hash}},push:function(t,r){p=e.Action.Push;let a=s(w.location,t,r);c&&c(a,t),v=y()+1;let o=i(a,v),n=w.createHref(a);try{f.pushState(o,"",n)}catch(e){u.location.assign(n)}h&&m&&m({action:p,location:w.location,delta:1})},replace:function(t,r){p=e.Action.Replace;let a=s(w.location,t,r);c&&c(a,t),v=y();let o=i(a,v),n=w.createHref(a);f.replaceState(o,"",n),h&&m&&m({action:p,location:w.location,delta:0})},go:e=>f.go(e)};return w}let u;!function(e){e.data="data",e.deferred="deferred",e.redirect="redirect",e.error="error"}(u||(u={}));const h=new Set(["lazy","caseSensitive","path","id","index","children"]);function f(e,r,a,n){return void 0===a&&(a=[]),void 0===n&&(n={}),e.map(((e,i)=>{let s=[...a,i],l="string"==typeof e.id?e.id:s.join("-");if(o(!0!==e.index||!e.children,"Cannot specify children on an index route"),o(!n[l],'Found a route id collision on id "'+l+"\". Route id's must be globally unique within Data Router usages"),function(e){return!0===e.index}(e)){let a=t({},e,r(e),{id:l});return n[l]=a,a}{let a=t({},e,r(e),{id:l,children:void 0});return n[l]=a,e.children&&(a.children=f(e.children,r,s,n)),a}}))}function p(e,t,r){void 0===r&&(r="/");let a=A(("string"==typeof t?c(t):t).pathname||"/",r);if(null==a)return null;let o=m(e);!function(e){e.sort(((e,t)=>e.score!==t.score?t.score-e.score:function(e,t){return e.length===t.length&&e.slice(0,-1).every(((e,r)=>e===t[r]))?e[e.length-1]-t[t.length-1]:0}(e.routesMeta.map((e=>e.childrenIndex)),t.routesMeta.map((e=>e.childrenIndex)))))}(o);let n=null;for(let e=0;null==n&&e<o.length;++e)n=w(o[e],R(a));return n}function m(e,t,r,a){void 0===t&&(t=[]),void 0===r&&(r=[]),void 0===a&&(a="");let n=(e,n,i)=>{let s={relativePath:void 0===i?e.path||"":i,caseSensitive:!0===e.caseSensitive,childrenIndex:n,route:e};s.relativePath.startsWith("/")&&(o(s.relativePath.startsWith(a),'Absolute route path "'+s.relativePath+'" nested under path "'+a+'" is not valid. An absolute child route path must start with the combined path of all its parent routes.'),s.relativePath=s.relativePath.slice(a.length));let l=L([a,s.relativePath]),c=r.concat(s);e.children&&e.children.length>0&&(o(!0!==e.index,'Index routes must not have child routes. Please remove all child routes from route path "'+l+'".'),m(e.children,t,c,l)),(null!=e.path||e.index)&&t.push({path:l,score:b(l,e.index),routesMeta:c})};return e.forEach(((e,t)=>{var r;if(""!==e.path&&null!=(r=e.path)&&r.includes("?"))for(let r of v(e.path))n(e,t,r);else n(e,t)})),t}function v(e){let t=e.split("/");if(0===t.length)return[];let[r,...a]=t,o=r.endsWith("?"),n=r.replace(/\?$/,"");if(0===a.length)return o?[n,""]:[n];let i=v(a.join("/")),s=[];return s.push(...i.map((e=>""===e?n:[n,e].join("/")))),o&&s.push(...i),s.map((t=>e.startsWith("/")&&""===t?"/":t))}const y=/^:\w+$/,g=e=>"*"===e;function b(e,t){let r=e.split("/"),a=r.length;return r.some(g)&&(a+=-2),t&&(a+=2),r.filter((e=>!g(e))).reduce(((e,t)=>e+(y.test(t)?3:""===t?1:10)),a)}function w(e,t){let{routesMeta:r}=e,a={},o="/",n=[];for(let e=0;e<r.length;++e){let i=r[e],s=e===r.length-1,l="/"===o?t:t.slice(o.length)||"/",c=D({path:i.relativePath,caseSensitive:i.caseSensitive,end:s},l);if(!c)return null;Object.assign(a,c.params);let d=i.route;n.push({params:a,pathname:L([o,c.pathname]),pathnameBase:k(L([o,c.pathnameBase])),route:d}),"/"!==c.pathnameBase&&(o=L([o,c.pathnameBase]))}return n}function D(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)=>(a.push(t),"/([^\\/]+)")));e.endsWith("*")?(a.push("*"),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)=>{if("*"===t){let e=l[r]||"";s=i.slice(0,i.length-e.length).replace(/(.)\/+$/,"$1")}return e[t]=function(e,t){try{return decodeURIComponent(e)}catch(r){return n(!1,'The value for the URL param "'+t+'" will not be decoded because the string "'+e+'" is a malformed URL segment. This is probably due to a bad percent encoding ('+r+")."),e}}(l[r]||"",t),e}),{}),pathname:i,pathnameBase:s,pattern:e}}function R(e){try{return decodeURI(e)}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 A(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 E(e,t){void 0===t&&(t="/");let{pathname:r,search:a="",hash:o=""}="string"==typeof e?c(e):e,n=r?r.startsWith("/")?r:function(e,t){let r=t.replace(/\/+$/,"").split("/");return e.split("/").forEach((e=>{".."===e?r.length>1&&r.pop():"."!==e&&r.push(e)})),r.length>1?r.join("/"):"/"}(r,t):t;return{pathname:n,search:x(a),hash:C(o)}}function P(e,t,r,a){return"Cannot include a '"+e+"' character in a manually specified `to."+t+"` field ["+JSON.stringify(a)+"]. Please separate it out to the `to."+r+'` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.'}function S(e){return e.filter(((e,t)=>0===t||e.route.path&&e.route.path.length>0))}function M(e,r,a,n){let i;void 0===n&&(n=!1),"string"==typeof e?i=c(e):(i=t({},e),o(!i.pathname||!i.pathname.includes("?"),P("?","pathname","search",i)),o(!i.pathname||!i.pathname.includes("#"),P("#","pathname","hash",i)),o(!i.search||!i.search.includes("#"),P("#","search","hash",i)));let s,l=""===e||""===i.pathname,d=l?"/":i.pathname;if(n||null==d)s=a;else{let e=r.length-1;if(d.startsWith("..")){let t=d.split("/");for(;".."===t[0];)t.shift(),e-=1;i.pathname=t.join("/")}s=e>=0?r[e]:"/"}let u=E(i,s),h=d&&"/"!==d&&d.endsWith("/"),f=(l||"."===d)&&a.endsWith("/");return u.pathname.endsWith("/")||!h&&!f||(u.pathname+="/"),u}const L=e=>e.join("/").replace(/\/\/+/g,"/"),k=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),x=e=>e&&"?"!==e?e.startsWith("?")?e:"?"+e:"",C=e=>e&&"#"!==e?e.startsWith("#")?e:"#"+e:"";class U extends Error{}class j{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,null,t)),(t=>this.onSettle(r,e,t)));return r.catch((()=>{})),Object.defineProperty(r,"_tracked",{get:()=>!0}),r}onSettle(e,t,r,a){return this.controller.signal.aborted&&r instanceof U?(this.unlistenAbortSignal(),Object.defineProperty(e,"_error",{get:()=>r}),Promise.reject(r)):(this.pendingKeysSet.delete(t),this.done&&this.unlistenAbortSignal(),r?(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]:_(a)})}),{})}get pendingKeys(){return Array.from(this.pendingKeysSet)}}function _(e){if(!function(e){return e instanceof Promise&&!0===e._tracked}(e))return e;if(e._error)throw e._error;return e._data}class T{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 O(e){return null!=e&&"number"==typeof e.status&&"string"==typeof e.statusText&&"boolean"==typeof e.internal&&"data"in e}const I=["post","put","patch","delete"],F=new Set(I),z=["get",...I],H=new Set(z),B=new Set([301,302,303,307,308]),q=new Set([307,308]),N={state:"idle",location:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0},$={state:"idle",data:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0},W={state:"unblocked",proceed:void 0,reset:void 0,location:void 0},K=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,Y="undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement,J=!Y,V=e=>({hasErrorBoundary:Boolean(e.hasErrorBoundary)});const G=Symbol("deferred");function X(e,t,r,a,o,n,i){let s,c;if(null!=n&&"path"!==i){s=[];for(let e of t)if(s.push(e),e.route.id===n){c=e;break}}else s=t,c=t[t.length-1];let d=M(o||".",S(s).map((e=>e.pathnameBase)),e.pathname,"path"===i);return null==o&&(d.search=e.search,d.hash=e.hash),null!=o&&""!==o&&"."!==o||!c||!c.route.index||Pe(d.search)||(d.search=d.search?d.search.replace(/^\?/,"?index&"):"?index"),a&&"/"!==r&&(d.pathname="/"===d.pathname?r:L([r,d.pathname])),l(d)}function Q(e,t,r,a){if(!a||!function(e){return null!=e&&"formData"in e}(a))return{path:r};if(a.formMethod&&!De(a.formMethod))return{path:r,error:he(405,{method:a.formMethod})};let o;if(a.formData){let t=a.formMethod||"get";if(o={formMethod:e?t.toUpperCase():t.toLowerCase(),formAction:pe(r),formEncType:a&&a.formEncType||"application/x-www-form-urlencoded",formData:a.formData},Re(o.formMethod))return{path:r,submission:o}}let n=c(r),i=ie(a.formData);return t&&n.search&&Pe(n.search)&&i.append("index",""),n.search="?"+i,{path:l(n),submission:o}}function Z(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 ee(e,r,a,o,n,i,s,l,c,d,u,h,f){let m=f?Object.values(f)[0]:h?Object.values(h)[0]:void 0,v=e.createURL(r.location),y=e.createURL(n),g=f?Object.keys(f)[0]:void 0,b=Z(a,g).filter(((e,a)=>{if(e.route.lazy)return!0;if(null==e.route.loader)return!1;if(function(e,t,r){let a=!t||r.route.id!==t.route.id,o=void 0===e[r.route.id];return a||o}(r.loaderData,r.matches[a],e)||s.some((t=>t===e.route.id)))return!0;let n=r.matches[a],l=e;return re(e,t({currentUrl:v,currentParams:n.params,nextUrl:y,nextParams:l.params},o,{actionResult:m,defaultShouldRevalidate:i||v.toString()===y.toString()||v.search!==y.search||te(n,l)}))})),w=[];return c.forEach(((e,n)=>{if(!a.some((t=>t.route.id===e.routeId)))return;let s=p(d,e.path,u);if(!s)return void w.push({key:n,routeId:e.routeId,path:e.path,matches:null,match:null,controller:null});let c=Me(s,e.path);(l.includes(n)||re(c,t({currentUrl:v,currentParams:r.matches[r.matches.length-1].params,nextUrl:y,nextParams:a[a.length-1].params},o,{actionResult:m,defaultShouldRevalidate:i})))&&w.push({key:n,routeId:e.routeId,path:e.path,matches:s,match:c,controller:new AbortController})})),[b,w]}function te(e,t){let r=e.route.path;return e.pathname!==t.pathname||null!=r&&r.endsWith("*")&&e.params["*"]!==t.params["*"]}function re(e,t){if(e.route.shouldRevalidate){let r=e.route.shouldRevalidate(t);if("boolean"==typeof r)return r}return t.defaultShouldRevalidate}async function ae(e,r,a){if(!e.lazy)return;let i=await e.lazy();if(!e.lazy)return;let s=a[e.id];o(s,"No route found in manifest");let l={};for(let e in i){let t=void 0!==s[e]&&"hasErrorBoundary"!==e;n(!t,'Route "'+s.id+'" has a static property "'+e+'" defined but its lazy function is also returning a value for this property. The lazy route property "'+e+'" will be ignored.'),t||h.has(e)||(l[e]=i[e])}Object.assign(s,l),Object.assign(s,t({},r(s),{lazy:void 0}))}async function oe(e,t,r,a,n,i,s,l,c,d){let h,f,p;void 0===l&&(l=!1),void 0===c&&(c=!1);let m=e=>{let a,o=new Promise(((e,t)=>a=t));return p=()=>a(),t.signal.addEventListener("abort",p),Promise.race([e({request:t,params:r.params,context:d}),o])};try{let a=r.route[e];if(r.route.lazy)if(a){f=(await Promise.all([m(a),ae(r.route,i,n)]))[0]}else{if(await ae(r.route,i,n),a=r.route[e],!a){if("action"===e){let e=new URL(t.url),a=e.pathname+e.search;throw he(405,{method:t.method,pathname:a,routeId:r.route.id})}return{type:u.data,data:void 0}}f=await m(a)}else{if(!a){let e=new URL(t.url);throw he(404,{pathname:e.pathname+e.search})}f=await m(a)}o(void 0!==f,"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){h=u.error,f=e}finally{p&&t.signal.removeEventListener("abort",p)}if(be(f)){let e,n=f.status;if(B.has(n)){let e=f.headers.get("Location");if(o(e,"Redirects returned/thrown from loaders/actions must have a Location header"),K.test(e)){if(!l){let r=new URL(t.url),a=e.startsWith("//")?new URL(r.protocol+e):new URL(e),o=null!=A(a.pathname,s);a.origin===r.origin&&o&&(e=a.pathname+a.search+a.hash)}}else e=X(new URL(t.url),a.slice(0,a.indexOf(r)+1),s,!0,e);if(l)throw f.headers.set("Location",e),f;return{type:u.redirect,status:n,location:e,revalidate:null!==f.headers.get("X-Remix-Revalidate")}}if(c)throw{type:h||u.data,response:f};let i=f.headers.get("Content-Type");return e=i&&/\bapplication\/json\b/.test(i)?await f.json():await f.text(),h===u.error?{type:h,error:new T(n,f.statusText,e),headers:f.headers}:{type:u.data,data:e,statusCode:f.status,headers:f.headers}}return h===u.error?{type:h,error:f}:ge(f)?{type:u.deferred,deferredData:f,statusCode:null==(v=f.init)?void 0:v.status,headers:(null==(y=f.init)?void 0:y.headers)&&new Headers(f.init.headers)}:{type:u.data,data:f};var v,y}function ne(e,t,r,a){let o=e.createURL(pe(t)).toString(),n={signal:r};if(a&&Re(a.formMethod)){let{formMethod:e,formEncType:t,formData:r}=a;n.method=e.toUpperCase(),n.body="application/x-www-form-urlencoded"===t?ie(r):r}return new Request(o,n)}function ie(e){let t=new URLSearchParams;for(let[r,a]of e.entries())t.append(r,a instanceof File?a.name:a);return t}function se(e,t,r,a,n){let i,s={},l=null,c=!1,d={};return r.forEach(((r,u)=>{let h=t[u].route.id;if(o(!ye(r),"Cannot handle redirect results in processLoaderData"),ve(r)){let t=de(e,h),o=r.error;a&&(o=Object.values(a)[0],a=void 0),l=l||{},null==l[t.route.id]&&(l[t.route.id]=o),s[h]=void 0,c||(c=!0,i=O(r.error)?r.error.status:500),r.headers&&(d[h]=r.headers)}else me(r)?(n.set(h,r.deferredData),s[h]=r.deferredData.data):s[h]=r.data,null==r.statusCode||200===r.statusCode||c||(i=r.statusCode),r.headers&&(d[h]=r.headers)})),a&&(l=a,s[Object.keys(a)[0]]=void 0),{loaderData:s,errors:l,statusCode:i||200,loaderHeaders:d}}function le(e,r,a,n,i,s,l,c){let{loaderData:d,errors:u}=se(r,a,n,i,c);for(let r=0;r<s.length;r++){let{key:a,match:n,controller:i}=s[r];o(void 0!==l&&void 0!==l[r],"Did not find corresponding fetcher result");let c=l[r];if(!i||!i.signal.aborted)if(ve(c)){let r=de(e.matches,null==n?void 0:n.route.id);u&&u[r.route.id]||(u=t({},u,{[r.route.id]:c.error})),e.fetchers.delete(a)}else if(ye(c))o(!1,"Unhandled fetcher revalidation redirect");else if(me(c))o(!1,"Unhandled fetcher deferred data");else{let t={state:"idle",data:c.data,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0," _hasFetcherDoneAnything ":!0};e.fetchers.set(a,t)}}return{loaderData:d,errors:u}}function ce(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 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 ue(e){let t=e.find((e=>e.index||!e.path||"/"===e.path))||{id:"__shim-error-route__"};return{matches:[{params:{},pathname:"",pathnameBase:"",route:t}],route:t}}function he(e,t){let{pathname:r,routeId:a,method:o,type:n}=void 0===t?{}:t,i="Unknown Server Error",s="Unknown @remix-run/router error";return 400===e?(i="Bad Request",o&&r&&a?s="You made a "+o+' request to "'+r+'" but did not provide a `loader` for route "'+a+'", so there is no way to handle the request.':"defer-action"===n&&(s="defer() is not supported in actions")):403===e?(i="Forbidden",s='Route "'+a+'" does not match URL "'+r+'"'):404===e?(i="Not Found",s='No route matches URL "'+r+'"'):405===e&&(i="Method Not Allowed",o&&r&&a?s="You made a "+o.toUpperCase()+' request to "'+r+'" but did not provide an `action` for route "'+a+'", so there is no way to handle the request.':o&&(s='Invalid request method "'+o.toUpperCase()+'"')),new T(e||500,i,new Error(s),!0)}function fe(e){for(let t=e.length-1;t>=0;t--){let r=e[t];if(ye(r))return r}}function pe(e){return l(t({},"string"==typeof e?c(e):e,{hash:""}))}function me(e){return e.type===u.deferred}function ve(e){return e.type===u.error}function ye(e){return(e&&e.type)===u.redirect}function ge(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 be(e){return null!=e&&"number"==typeof e.status&&"string"==typeof e.statusText&&"object"==typeof e.headers&&void 0!==e.body}function we(e){if(!be(e))return!1;let t=e.status,r=e.headers.get("Location");return t>=300&&t<=399&&null!=r}function De(e){return H.has(e.toLowerCase())}function Re(e){return F.has(e.toLowerCase())}async function Ae(e,t,r,a,n,i){for(let s=0;s<r.length;s++){let l=r[s],c=t[s];if(!c)continue;let d=e.find((e=>e.route.id===c.route.id)),u=null!=d&&!te(d,c)&&void 0!==(i&&i[c.route.id]);if(me(l)&&(n||u)){let e=a[s];o(e,"Expected an AbortSignal for revalidating fetcher deferred result"),await Ee(l,e,n).then((e=>{e&&(r[s]=e||r[s])}))}}}async function Ee(e,t,r){if(void 0===r&&(r=!1),!await e.deferredData.resolveData(t)){if(r)try{return{type:u.data,data:e.deferredData.unwrappedData}}catch(e){return{type:u.error,error:e}}return{type:u.data,data:e.deferredData.data}}}function Pe(e){return new URLSearchParams(e).getAll("index").some((e=>""===e))}function Se(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 Me(e,t){let r="string"==typeof t?c(t).search:t.search;if(e[e.length-1].route.index&&Pe(r||""))return e[e.length-1];let a=S(e);return a[a.length-1]}e.AbortedDeferredError=U,e.ErrorResponse=T,e.IDLE_BLOCKER=W,e.IDLE_FETCHER=$,e.IDLE_NAVIGATION=N,e.UNSAFE_DEFERRED_SYMBOL=G,e.UNSAFE_DeferredData=j,e.UNSAFE_convertRoutesToDataRoutes=f,e.UNSAFE_getPathContributingMatches=S,e.UNSAFE_invariant=o,e.UNSAFE_warning=n,e.createBrowserHistory=function(e){return void 0===e&&(e={}),d((function(e,t){let{pathname:r,search:a,hash:o}=e.location;return s("",{pathname:r,search:a,hash:o},t.state&&t.state.usr||null,t.state&&t.state.key||"default")}),(function(e,t){return"string"==typeof t?t:l(t)}),null,e)},e.createHashHistory=function(e){return void 0===e&&(e={}),d((function(e,t){let{pathname:r="/",search:a="",hash:o=""}=c(e.location.hash.substr(1));return 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(t){void 0===t&&(t={});let r,{initialEntries:a=["/"],initialIndex:o,v5Compat:i=!1}=t;r=a.map(((e,t)=>m(e,"string"==typeof e?null:e.state,0===t?"default":void 0)));let d=f(null==o?r.length-1:o),u=e.Action.Pop,h=null;function f(e){return Math.min(Math.max(e,0),r.length-1)}function p(){return r[d]}function m(e,t,a){void 0===t&&(t=null);let o=s(r?p().pathname:"/",e,t,a);return n("/"===o.pathname.charAt(0),"relative pathnames are not supported in memory history: "+JSON.stringify(e)),o}function v(e){return"string"==typeof e?e:l(e)}return{get index(){return d},get action(){return u},get location(){return p()},createHref:v,createURL:e=>new URL(v(e),"http://localhost"),encodeLocation(e){let t="string"==typeof e?c(e):e;return{pathname:t.pathname||"",search:t.search||"",hash:t.hash||""}},push(t,a){u=e.Action.Push;let o=m(t,a);d+=1,r.splice(d,r.length,o),i&&h&&h({action:u,location:o,delta:1})},replace(t,a){u=e.Action.Replace;let o=m(t,a);r[d]=o,i&&h&&h({action:u,location:o,delta:0})},go(t){u=e.Action.Pop;let a=f(d+t),o=r[a];d=a,h&&h({action:u,location:o,delta:t})},listen:e=>(h=e,()=>{h=null})}},e.createPath=l,e.createRouter=function(r){let a;if(o(r.routes.length>0,"You must provide a non-empty routes array to createRouter"),r.mapRouteProperties)a=r.mapRouteProperties;else if(r.detectErrorBoundary){let e=r.detectErrorBoundary;a=t=>({hasErrorBoundary:e(t)})}else a=V;let i,l={},c=f(r.routes,a,void 0,l),d=r.basename||"/",h=t({v7_normalizeFormMethod:!1,v7_prependBasename:!1},r.future),m=null,v=new Set,y=null,g=null,b=null,w=null!=r.hydrationData,D=p(c,r.history.location,d),R=null;if(null==D){let e=he(404,{pathname:r.history.location.pathname}),{matches:t,route:a}=ue(c);D=t,R={[a.id]:e}}let E,P,S=!(D.some((e=>e.route.lazy))||D.some((e=>e.route.loader))&&null==r.hydrationData),M={historyAction:r.history.action,location:r.history.location,matches:D,initialized:S,navigation:N,restoreScrollPosition:null==r.hydrationData&&null,preventScrollReset:!1,revalidation:"idle",loaderData:r.hydrationData&&r.hydrationData.loaderData||{},actionData:r.hydrationData&&r.hydrationData.actionData||null,errors:r.hydrationData&&r.hydrationData.errors||R,fetchers:new Map,blockers:new Map},L=e.Action.Pop,k=!1,x=!1,C=!1,U=[],j=[],_=new Map,T=0,O=-1,I=new Map,F=new Set,z=new Map,H=new Map,B=new Map,G=!1;function Z(e){M=t({},M,e),v.forEach((e=>e(M)))}function te(a,o){var n,s;let l,d=null!=M.actionData&&null!=M.navigation.formMethod&&Re(M.navigation.formMethod)&&"loading"===M.navigation.state&&!0!==(null==(n=a.state)?void 0:n._isRedirect);l=o.actionData?Object.keys(o.actionData).length>0?o.actionData:null:d?M.actionData:null;let u=o.loaderData?ce(M.loaderData,o.loaderData,o.matches||[],o.errors):M.loaderData;for(let[e]of B)ke(e);let h=!0===k||null!=M.navigation.formMethod&&Re(M.navigation.formMethod)&&!0!==(null==(s=a.state)?void 0:s._isRedirect);i&&(c=i,i=void 0),Z(t({},o,{actionData:l,loaderData:u,historyAction:L,location:a,initialized:!0,navigation:N,revalidation:"idle",restoreScrollPosition:je(a,o.matches||M.matches),preventScrollReset:h,blockers:new Map(M.blockers)})),x||L===e.Action.Pop||(L===e.Action.Push?r.history.push(a,a.state):L===e.Action.Replace&&r.history.replace(a,a.state)),L=e.Action.Pop,k=!1,x=!1,C=!1,U=[],j=[]}async function re(o,n,s){P&&P.abort(),P=null,L=o,x=!0===(s&&s.startUninterruptedRevalidation),function(e,t){if(y&&g&&b){let r=t.map((e=>Se(e,M.loaderData))),a=g(e,r)||e.key;y[a]=b()}}(M.location,M.matches),k=!0===(s&&s.preventScrollReset);let h=i||c,f=s&&s.overrideNavigation,m=p(h,n,d);if(!m){let e=he(404,{pathname:n.pathname}),{matches:t,route:r}=ue(h);return Ue(),void te(n,{matches:t,loaderData:{},errors:{[r.id]:e}})}if(!(v=M.location,w=n,v.pathname!==w.pathname||v.search!==w.search||v.hash===w.hash||s&&s.submission&&Re(s.submission.formMethod)))return void te(n,{matches:m});var v,w;P=new AbortController;let D,R,A=ne(r.history,n,P.signal,s&&s.submission);if(s&&s.pendingError)R={[de(m).route.id]:s.pendingError};else if(s&&s.submission&&Re(s.submission.formMethod)){let r=await async function(r,o,n,i,s){let c;pe(),Z({navigation:t({state:"submitting",location:o},n)});let h=Me(i,o);if(h.route.action||h.route.lazy){if(c=await oe("action",r,h,i,l,a,d),r.signal.aborted)return{shortCircuited:!0}}else c={type:u.error,error:he(405,{method:r.method,pathname:o.pathname,routeId:h.route.id})};if(ye(c)){let e;return e=s&&null!=s.replace?s.replace:c.location===M.location.pathname+M.location.search,await ie(M,c,{submission:n,replace:e}),{shortCircuited:!0}}if(ve(c)){let t=de(i,h.route.id);return!0!==(s&&s.replace)&&(L=e.Action.Push),{pendingActionData:{},pendingActionError:{[t.route.id]:c.error}}}if(me(c))throw he(400,{type:"defer-action"});return{pendingActionData:{[h.route.id]:c.data}}}(A,n,s.submission,m,{replace:s.replace});if(r.shortCircuited)return;D=r.pendingActionData,R=r.pendingActionError,f=t({state:"loading",location:n},s.submission),A=new Request(A.url,{signal:A.signal})}let{shortCircuited:E,loaderData:S,errors:I}=await async function(e,a,o,n,s,l,u,h,f){let p=n;if(!p){p=t({state:"loading",location:a,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0},s)}let m=s||l?s||l:p.formMethod&&p.formAction&&p.formData&&p.formEncType?{formMethod:p.formMethod,formAction:p.formAction,formData:p.formData,formEncType:p.formEncType}:void 0,v=i||c,[y,g]=ee(r.history,M,o,m,a,C,U,j,z,v,d,h,f);if(Ue((e=>!(o&&o.some((t=>t.route.id===e)))||y&&y.some((t=>t.route.id===e)))),0===y.length&&0===g.length){let e=Pe();return te(a,t({matches:o,loaderData:{},errors:f||null},h?{actionData:h}:{},e?{fetchers:new Map(M.fetchers)}:{})),{shortCircuited:!0}}if(!x){g.forEach((e=>{let t=M.fetchers.get(e.key),r={state:"loading",data:t&&t.data,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0," _hasFetcherDoneAnything ":!0};M.fetchers.set(e.key,r)}));let e=h||M.actionData;Z(t({navigation:p},e?0===Object.keys(e).length?{actionData:null}:{actionData:e}:{},g.length>0?{fetchers:new Map(M.fetchers)}:{}))}O=++T,g.forEach((e=>{e.controller&&_.set(e.key,e.controller)}));let b=()=>g.forEach((e=>we(e.key)));P&&P.signal.addEventListener("abort",b);let{results:w,loaderResults:D,fetcherResults:R}=await se(M.matches,o,y,g,e);if(e.signal.aborted)return{shortCircuited:!0};P&&P.signal.removeEventListener("abort",b);g.forEach((e=>_.delete(e.key)));let A=fe(w);if(A)return await ie(M,A,{replace:u}),{shortCircuited:!0};let{loaderData:E,errors:S}=le(M,o,y,D,f,g,R,H);H.forEach(((e,t)=>{e.subscribe((r=>{(r||e.done)&&H.delete(t)}))}));let L=Pe(),k=Le(O),I=L||k||g.length>0;return t({loaderData:E,errors:S},I?{fetchers:new Map(M.fetchers)}:{})}(A,n,m,f,s&&s.submission,s&&s.fetcherSubmission,s&&s.replace,D,R);E||(P=null,te(n,t({matches:m},D?{actionData:D}:{},{loaderData:S,errors:I})))}function ae(e){return M.fetchers.get(e)||$}async function ie(a,n,i){var l;let{submission:c,replace:u,isFetchActionRedirect:h}=void 0===i?{}:i;n.revalidate&&(C=!0);let f=s(a.location,n.location,t({_isRedirect:!0},h?{_isFetchActionRedirect:!0}:{}));if(o(f,"Expected a location on the redirect navigation"),K.test(n.location)&&Y&&void 0!==(null==(l=window)?void 0:l.location)){let e=r.history.createURL(n.location),t=null==A(e.pathname,d);if(window.location.origin!==e.origin||t)return void(u?window.location.replace(n.location):window.location.assign(n.location))}P=null;let p=!0===u?e.Action.Replace:e.Action.Push,{formMethod:m,formAction:v,formEncType:y,formData:g}=a.navigation;!c&&m&&v&&g&&y&&(c={formMethod:m,formAction:v,formEncType:y,formData:g}),q.has(n.status)&&c&&Re(c.formMethod)?await re(p,f,{submission:t({},c,{formAction:n.location}),preventScrollReset:k}):h?await re(p,f,{overrideNavigation:{state:"loading",location:f,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0},fetcherSubmission:c,preventScrollReset:k}):await re(p,f,{overrideNavigation:{state:"loading",location:f,formMethod:c?c.formMethod:void 0,formAction:c?c.formAction:void 0,formEncType:c?c.formEncType:void 0,formData:c?c.formData:void 0},preventScrollReset:k})}async function se(e,t,o,n,i){let s=await Promise.all([...o.map((e=>oe("loader",i,e,t,l,a,d))),...n.map((e=>{if(e.matches&&e.match&&e.controller)return oe("loader",ne(r.history,e.path,e.controller.signal),e.match,e.matches,l,a,d);return{type:u.error,error:he(404,{pathname:e.path})}}))]),c=s.slice(0,o.length),h=s.slice(o.length);return await Promise.all([Ae(e,o,c,c.map((()=>i.signal)),!1,M.loaderData),Ae(e,n.map((e=>e.match)),h,n.map((e=>e.controller?e.controller.signal:null)),!0)]),{results:s,loaderResults:c,fetcherResults:h}}function pe(){C=!0,U.push(...Ue()),z.forEach(((e,t)=>{_.has(t)&&(j.push(t),we(t))}))}function ge(e,t,r){let a=de(M.matches,t);be(e),Z({errors:{[a.route.id]:r},fetchers:new Map(M.fetchers)})}function be(e){_.has(e)&&we(e),z.delete(e),I.delete(e),F.delete(e),M.fetchers.delete(e)}function we(e){let t=_.get(e);o(t,"Expected fetch controller: "+e),t.abort(),_.delete(e)}function De(e){for(let t of e){let e={state:"idle",data:ae(t).data,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0," _hasFetcherDoneAnything ":!0};M.fetchers.set(t,e)}}function Pe(){let e=[],t=!1;for(let r of F){let a=M.fetchers.get(r);o(a,"Expected fetcher: "+r),"loading"===a.state&&(F.delete(r),e.push(r),t=!0)}return De(e),t}function Le(e){let t=[];for(let[r,a]of I)if(a<e){let e=M.fetchers.get(r);o(e,"Expected fetcher: "+r),"loading"===e.state&&(we(r),I.delete(r),t.push(r))}return De(t),t.length>0}function ke(e){M.blockers.delete(e),B.delete(e)}function xe(e,t){let r=M.blockers.get(e)||W;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),M.blockers.set(e,t),Z({blockers:new Map(M.blockers)})}function Ce(e){let{currentLocation:t,nextLocation:r,historyAction:a}=e;if(0===B.size)return;B.size>1&&n(!1,"A router only supports one blocker at a time");let o=Array.from(B.entries()),[i,s]=o[o.length-1],l=M.blockers.get(i);return l&&"proceeding"===l.state?void 0:s({currentLocation:t,nextLocation:r,historyAction:a})?i:void 0}function Ue(e){let t=[];return H.forEach(((r,a)=>{e&&!e(a)||(r.cancel(),t.push(a),H.delete(a))})),t}function je(e,t){if(y&&g&&b){let r=t.map((e=>Se(e,M.loaderData))),a=g(e,r)||e.key,o=y[a];if("number"==typeof o)return o}return null}return E={get basename(){return d},get state(){return M},get routes(){return c},initialize:function(){return m=r.history.listen((e=>{let{action:t,location:a,delta:o}=e;if(G)return void(G=!1);n(0===B.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=Ce({currentLocation:M.location,nextLocation:a,historyAction:t});return i&&null!=o?(G=!0,r.history.go(-1*o),void xe(i,{state:"blocked",location:a,proceed(){xe(i,{state:"proceeding",proceed:void 0,reset:void 0,location:a}),r.history.go(o)},reset(){ke(i),Z({blockers:new Map(E.state.blockers)})}})):re(t,a)})),M.initialized||re(e.Action.Pop,M.location),E},subscribe:function(e){return v.add(e),()=>v.delete(e)},enableScrollRestoration:function(e,t,r){if(y=e,b=t,g=r||(e=>e.key),!w&&M.navigation===N){w=!0;let e=je(M.location,M.matches);null!=e&&Z({restoreScrollPosition:e})}return()=>{y=null,b=null,g=null}},navigate:async function a(o,n){if("number"==typeof o)return void r.history.go(o);let i=X(M.location,M.matches,d,h.v7_prependBasename,o,null==n?void 0:n.fromRouteId,null==n?void 0:n.relative),{path:l,submission:c,error:u}=Q(h.v7_normalizeFormMethod,!1,i,n),f=M.location,p=s(M.location,l,n&&n.state);p=t({},p,r.history.encodeLocation(p));let m=n&&null!=n.replace?n.replace:void 0,v=e.Action.Push;!0===m?v=e.Action.Replace:!1===m||null!=c&&Re(c.formMethod)&&c.formAction===M.location.pathname+M.location.search&&(v=e.Action.Replace);let y=n&&"preventScrollReset"in n?!0===n.preventScrollReset:void 0,g=Ce({currentLocation:f,nextLocation:p,historyAction:v});if(!g)return await re(v,p,{submission:c,pendingError:u,preventScrollReset:y,replace:n&&n.replace});xe(g,{state:"blocked",location:p,proceed(){xe(g,{state:"proceeding",proceed:void 0,reset:void 0,location:p}),a(o,n)},reset(){ke(g),Z({blockers:new Map(M.blockers)})}})},fetch:function(e,n,s,u){if(J)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.");_.has(e)&&we(e);let f=i||c,m=X(M.location,M.matches,d,h.v7_prependBasename,s,n,null==u?void 0:u.relative),v=p(f,m,d);if(!v)return void ge(e,n,he(404,{pathname:m}));let{path:y,submission:g}=Q(h.v7_normalizeFormMethod,!0,m,u),b=Me(v,y);k=!0===(u&&u.preventScrollReset),g&&Re(g.formMethod)?async function(e,n,s,u,h,f){if(pe(),z.delete(e),!u.route.action&&!u.route.lazy){let t=he(405,{method:f.formMethod,pathname:s,routeId:n});return void ge(e,n,t)}let m=M.fetchers.get(e),v=t({state:"submitting"},f,{data:m&&m.data," _hasFetcherDoneAnything ":!0});M.fetchers.set(e,v),Z({fetchers:new Map(M.fetchers)});let y=new AbortController,g=ne(r.history,s,y.signal,f);_.set(e,y);let b=await oe("action",g,u,h,l,a,d);if(g.signal.aborted)return void(_.get(e)===y&&_.delete(e));if(ye(b)){_.delete(e),F.add(e);let r=t({state:"loading"},f,{data:void 0," _hasFetcherDoneAnything ":!0});return M.fetchers.set(e,r),Z({fetchers:new Map(M.fetchers)}),ie(M,b,{submission:f,isFetchActionRedirect:!0})}if(ve(b))return void ge(e,n,b.error);if(me(b))throw he(400,{type:"defer-action"});let w=M.navigation.location||M.location,D=ne(r.history,w,y.signal),R=i||c,A="idle"!==M.navigation.state?p(R,M.navigation.location,d):M.matches;o(A,"Didn't find any matches after fetcher action");let E=++T;I.set(e,E);let S=t({state:"loading",data:b.data},f,{" _hasFetcherDoneAnything ":!0});M.fetchers.set(e,S);let[k,x]=ee(r.history,M,A,f,w,C,U,j,z,R,d,{[u.route.id]:b.data},void 0);x.filter((t=>t.key!==e)).forEach((e=>{let t=e.key,r=M.fetchers.get(t),a={state:"loading",data:r&&r.data,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0," _hasFetcherDoneAnything ":!0};M.fetchers.set(t,a),e.controller&&_.set(t,e.controller)})),Z({fetchers:new Map(M.fetchers)});let B=()=>x.forEach((e=>we(e.key)));y.signal.addEventListener("abort",B);let{results:q,loaderResults:N,fetcherResults:$}=await se(M.matches,A,k,x,D);if(y.signal.aborted)return;y.signal.removeEventListener("abort",B),I.delete(e),_.delete(e),x.forEach((e=>_.delete(e.key)));let W=fe(q);if(W)return ie(M,W);let{loaderData:K,errors:Y}=le(M,M.matches,k,N,void 0,x,$,H),J={state:"idle",data:b.data,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0," _hasFetcherDoneAnything ":!0};M.fetchers.set(e,J);let V=Le(E);"loading"===M.navigation.state&&E>O?(o(L,"Expected pending action"),P&&P.abort(),te(M.navigation.location,{matches:A,loaderData:K,errors:Y,fetchers:new Map(M.fetchers)})):(Z(t({errors:Y,loaderData:ce(M.loaderData,K,A,Y)},V?{fetchers:new Map(M.fetchers)}:{})),C=!1)}(e,n,y,b,v,g):(z.set(e,{routeId:n,path:y}),async function(e,n,i,s,c,u){let h=M.fetchers.get(e),f=t({state:"loading",formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0},u,{data:h&&h.data," _hasFetcherDoneAnything ":!0});M.fetchers.set(e,f),Z({fetchers:new Map(M.fetchers)});let p=new AbortController,m=ne(r.history,i,p.signal);_.set(e,p);let v=await oe("loader",m,s,c,l,a,d);me(v)&&(v=await Ee(v,m.signal,!0)||v);_.get(e)===p&&_.delete(e);if(m.signal.aborted)return;if(ye(v))return F.add(e),void await ie(M,v);if(ve(v)){let t=de(M.matches,n);return M.fetchers.delete(e),void Z({fetchers:new Map(M.fetchers),errors:{[t.route.id]:v.error}})}o(!me(v),"Unhandled fetcher deferred data");let y={state:"idle",data:v.data,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0," _hasFetcherDoneAnything ":!0};M.fetchers.set(e,y),Z({fetchers:new Map(M.fetchers)})}(e,n,y,b,v,g))},revalidate:function(){pe(),Z({revalidation:"loading"}),"submitting"!==M.navigation.state&&("idle"!==M.navigation.state?re(L||M.historyAction,M.navigation.location,{overrideNavigation:M.navigation}):re(M.historyAction,M.location,{startUninterruptedRevalidation:!0}))},createHref:e=>r.history.createHref(e),encodeLocation:e=>r.history.encodeLocation(e),getFetcher:ae,deleteFetcher:be,dispose:function(){m&&m(),v.clear(),P&&P.abort(),M.fetchers.forEach(((e,t)=>be(t))),M.blockers.forEach(((e,t)=>ke(t)))},getBlocker:function(e,t){let r=M.blockers.get(e)||W;return B.get(e)!==t&&B.set(e,t),r},deleteBlocker:ke,_internalFetchControllers:_,_internalActiveDeferreds:H,_internalSetRoutes:function(e){i=e}},E},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=V;let c=f(e,a,void 0,n);async function d(e,r,s,l,c){o(e.signal,"query()/queryRoute() requests must contain an AbortController signal");try{if(Re(e.method.toLowerCase())){let o=await async function(e,r,o,s,l){let c;if(o.route.action||o.route.lazy){if(c=await oe("action",e,o,r,n,a,i,!0,l,s),e.signal.aborted){throw new Error((l?"queryRoute":"query")+"() call aborted")}}else{let t=he(405,{method:e.method,pathname:new URL(e.url).pathname,routeId:o.route.id});if(l)throw t;c={type:u.error,error:t}}if(ye(c))throw new Response(null,{status:c.status,headers:{Location:c.location}});if(me(c)){let e=he(400,{type:"defer-action"});if(l)throw e;c={type:u.error,error:e}}if(l){if(ve(c))throw c.error;return{matches:[o],loaderData:{},actionData:{[o.route.id]:c.data},errors:null,statusCode:200,loaderHeaders:{},actionHeaders:{},activeDeferreds:null}}if(ve(c)){let a=de(r,o.route.id);return t({},await h(e,r,s,void 0,{[a.route.id]:c.error}),{statusCode:O(c.error)?c.error.status:500,actionData:null,actionHeaders:t({},c.headers?{[o.route.id]:c.headers}:{})})}let d=new Request(e.url,{headers:e.headers,redirect:e.redirect,signal:e.signal});return t({},await h(d,r,s),c.statusCode?{statusCode:c.statusCode}:{},{actionData:{[o.route.id]:c.data},actionHeaders:t({},c.headers?{[o.route.id]:c.headers}:{})})}(e,s,c||Me(s,r),l,null!=c);return o}let o=await h(e,s,l,c);return be(o)?o:t({},o,{actionData:null,actionHeaders:{}})}catch(e){if((d=e)&&be(d.response)&&(d.type===u.data||u.error)){if(e.type===u.error&&!we(e.response))throw e.response;return e.response}if(we(e))return e;throw e}var d}async function h(e,r,o,s,l){let c=null!=s;if(c&&(null==s||!s.route.loader)&&(null==s||!s.route.lazy))throw he(400,{method:e.method,pathname:new URL(e.url).pathname,routeId:null==s?void 0:s.route.id});let d=(s?[s]:Z(r,Object.keys(l||{})[0])).filter((e=>e.route.loader||e.route.lazy));if(0===d.length)return{matches:r,loaderData:r.reduce(((e,t)=>Object.assign(e,{[t.route.id]:null})),{}),errors:l||null,statusCode:200,loaderHeaders:{},activeDeferreds:null};let u=await Promise.all([...d.map((t=>oe("loader",e,t,r,n,a,i,!0,c,o)))]);if(e.signal.aborted){throw new Error((c?"queryRoute":"query")+"() call aborted")}let h=new Map,f=se(r,d,u,l,h),p=new Set(d.map((e=>e.route.id)));return r.forEach((e=>{p.has(e.route.id)||(f.loaderData[e.route.id]=null)})),t({},f,{matches:r,activeDeferreds:h.size>0?Object.fromEntries(h.entries()):null})}return{dataRoutes:c,query:async function(e,r){let{requestContext:a}=void 0===r?{}:r,o=new URL(e.url),n=e.method,u=s("",l(o),null,"default"),h=p(c,u,i);if(!De(n)&&"HEAD"!==n){let e=he(405,{method:n}),{matches:t,route:r}=ue(c);return{basename:i,location:u,matches:t,loaderData:{},actionData:null,errors:{[r.id]:e},statusCode:e.status,loaderHeaders:{},actionHeaders:{},activeDeferreds:null}}if(!h){let e=he(404,{pathname:u.pathname}),{matches:t,route:r}=ue(c);return{basename:i,location:u,matches:t,loaderData:{},actionData:null,errors:{[r.id]:e},statusCode:e.status,loaderHeaders:{},actionHeaders:{},activeDeferreds:null}}let f=await d(e,u,h,a);return be(f)?f:t({location:u,basename:i},f)},queryRoute:async function(e,t){let{routeId:r,requestContext:a}=void 0===t?{}:t,o=new URL(e.url),n=e.method,u=s("",l(o),null,"default"),h=p(c,u,i);if(!De(n)&&"HEAD"!==n&&"OPTIONS"!==n)throw he(405,{method:n});if(!h)throw he(404,{pathname:u.pathname});let f=r?h.find((e=>e.route.id===r)):Me(h,u);if(r&&!f)throw he(403,{pathname:u.pathname,routeId:r});if(!f)throw he(404,{pathname:u.pathname});let m=await d(e,u,h,a,f);if(be(m))return m;let v=m.errors?Object.values(m.errors)[0]:void 0;if(void 0!==v)throw v;if(m.actionData)return Object.values(m.actionData)[0];if(m.loaderData){var y;let e=Object.values(m.loaderData)[0];return null!=(y=m.activeDeferreds)&&y[f.route.id]&&(e[G]=m.activeDeferreds[f.route.id]),e}}}},e.defer=function(e,t){return void 0===t&&(t={}),new j(e,"number"==typeof t?{status:t}:t)},e.generatePath=function(e,t){void 0===t&&(t={});let r=e;return 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(/\*$/,"/*")),(r.startsWith("/")?"/":"")+r.split(/\/+/).map(((e,r,a)=>{if(r===a.length-1&&"*"===e){return t["*"]}const n=e.match(/^:(\w+)(\??)$/);if(n){const[,e,r]=n;let a=t[e];return"?"===r?null==a?"":a:(null==a&&o(!1,'Missing ":'+e+'" param'),a)}return e.replace(/\?$/g,"")})).filter((e=>!!e)).join("/")},e.getStaticContextFromError=function(e,r,a){return t({},r,{statusCode:500,errors:{[r._deepestRenderedBoundaryId||e[0].id]:a}})},e.getToPathname=function(e){return""===e||""===e.pathname?"/":"string"==typeof e?c(e).pathname:e.pathname},e.isDeferredData=ge,e.isRouteErrorResponse=O,e.joinPaths=L,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=D,e.matchRoutes=p,e.normalizePathname=k,e.parsePath=c,e.redirect=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}))},e.resolvePath=E,e.resolveTo=M,e.stripBasename=A,Object.defineProperty(e,"__esModule",{value:!0})}));
//# sourceMappingURL=router.umd.min.js.map

@@ -105,6 +105,12 @@ import type { Location, Path, To } from "./history";

/**
* Loaders and actions can return anything except `undefined` (`null` is a
* valid return value if there is no data to return). Responses are preferred
* and will ease any future migration to Remix
*/
declare type DataFunctionValue = Response | NonNullable<unknown> | null;
/**
* Route loader function signature
*/
export interface LoaderFunction {
(args: LoaderFunctionArgs): Promise<Response> | Response | Promise<any> | any;
(args: LoaderFunctionArgs): Promise<DataFunctionValue> | DataFunctionValue;
}

@@ -115,3 +121,3 @@ /**

export interface ActionFunction {
(args: ActionFunctionArgs): Promise<Response> | Response | Promise<any> | any;
(args: ActionFunctionArgs): Promise<DataFunctionValue> | DataFunctionValue;
}

@@ -142,2 +148,4 @@ /**

* from the framework-aware `errorElement` prop
*
* @deprecated Use `mapRouteProperties` instead
*/

@@ -148,2 +156,11 @@ export interface DetectErrorBoundaryFunction {

/**
* Function provided by the framework-aware layers to set any framework-specific
* properties from framework-agnostic properties
*/
export interface MapRoutePropertiesFunction {
(route: AgnosticRouteObject): {
hasErrorBoundary: boolean;
} & Record<string, any>;
}
/**
* Keys we cannot change from within a lazy() function. We spread all other keys

@@ -250,3 +267,3 @@ * onto the route. Either they're meaningful to the router, or they'll get

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

@@ -253,0 +270,0 @@ * Matches the given routes to a location and returns the match data.

MIT License
Copyright (c) React Training 2015-2019
Copyright (c) Remix Software 2020-2022
Copyright (c) React Training LLC 2015-2019
Copyright (c) Remix Software Inc. 2020-2021
Copyright (c) Shopify Inc. 2022-2023

@@ -6,0 +7,0 @@ Permission is hereby granted, free of charge, to any person obtaining a copy

{
"name": "@remix-run/router",
"version": "1.5.0",
"version": "1.6.0-pre.0",
"description": "Nested/Data-driven/Framework-agnostic Routing",

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

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

If you're using React Router, you should never `import` anything directly from the `@remix-run/router` or `react-router` packages, but you should have everything you need in either `react-router-dom` or `react-router-native`. Both of those packages re-export everything from `@remix-run/router` and `react-router`.
If you're using React Router, you should never `import` anything directly from the `@remix-run/router` - you should have everything you need in `react-router-dom` (or `react-router`/`react-router-native` if you're not rendering in the browser). All of those packages should re-export everything you would otherwise need from `@remix-run/router`.

@@ -20,7 +20,19 @@ > **Warning**

let router = createRouter({
// Routes array
routes: ,
// History instance
history,
}).initialize()
// Required properties
routes: [{
path: '/',
loader: ({ request, params }) => { /* ... */ },
children: [{
path: 'home',
loader: ({ request, params }) => { /* ... */ },
}]
},
history: createBrowserHistory(),
// Optional properties
basename, // Base path
mapRouteProperties, // Map framework-agnostic routes to framework-aware routes
future, // Future flags
hydrationData, // Hydration data if using server-side-rendering
}).initialize();
```

@@ -83,2 +95,7 @@

});
// Relative routing from a source routeId
router.navigate("../../somewhere", {
fromRouteId: "active-route-id",
});
```

@@ -107,2 +124,11 @@

### Future Flags
We use _Future Flags_ in the router to help us introduce breaking changes in an opt-in fashion ahead of major releases. Please check out the [blog post][future-flags-post] and [React Router Docs][api-development-strategy] for more information on this process. The currently available future flags in `@remix-run/router` are:
| Flag | Description |
| ------------------------ | ------------------------------------------------------------------------- |
| `v7_normalizeFormMethod` | Normalize `useNavigation().formMethod` to be an uppercase HTTP Method |
| `v7_prependBasename` | Prepend the `basename` to incoming `router.navigate`/`router.fetch` paths |
[react-router]: https://reactrouter.com

@@ -112,1 +138,3 @@ [remix]: https://remix.run

[remix-routers-repo]: https://github.com/brophdawg11/remix-routers
[api-development-strategy]: https://reactrouter.com/en/main/guides/api-development-strategy
[future-flags-post]: https://remix.run/blog/future-flags

@@ -127,6 +127,13 @@ import type { Location, Path, To } from "./history";

/**
* Loaders and actions can return anything except `undefined` (`null` is a
* valid return value if there is no data to return). Responses are preferred
* and will ease any future migration to Remix
*/
type DataFunctionValue = Response | NonNullable<unknown> | null;
/**
* Route loader function signature
*/
export interface LoaderFunction {
(args: LoaderFunctionArgs): Promise<Response> | Response | Promise<any> | any;
(args: LoaderFunctionArgs): Promise<DataFunctionValue> | DataFunctionValue;
}

@@ -138,3 +145,3 @@

export interface ActionFunction {
(args: ActionFunctionArgs): Promise<Response> | Response | Promise<any> | any;
(args: ActionFunctionArgs): Promise<DataFunctionValue> | DataFunctionValue;
}

@@ -167,2 +174,4 @@

* from the framework-aware `errorElement` prop
*
* @deprecated Use `mapRouteProperties` instead
*/

@@ -174,2 +183,12 @@ export interface DetectErrorBoundaryFunction {

/**
* Function provided by the framework-aware layers to set any framework-specific
* properties from framework-agnostic properties
*/
export interface MapRoutePropertiesFunction {
(route: AgnosticRouteObject): {
hasErrorBoundary: boolean;
} & Record<string, any>;
}
/**
* Keys we cannot change from within a lazy() function. We spread all other keys

@@ -345,3 +364,3 @@ * onto the route. Either they're meaningful to the router, or they'll get

routes: AgnosticRouteObject[],
detectErrorBoundary: DetectErrorBoundaryFunction,
mapRouteProperties: MapRoutePropertiesFunction,
parentPath: number[] = [],

@@ -366,3 +385,3 @@ manifest: RouteManifest = {}

...route,
hasErrorBoundary: detectErrorBoundary(route),
...mapRouteProperties(route),
id,

@@ -375,4 +394,4 @@ };

...route,
...mapRouteProperties(route),
id,
hasErrorBoundary: detectErrorBoundary(route),
children: undefined,

@@ -385,3 +404,3 @@ };

route.children,
detectErrorBoundary,
mapRouteProperties,
treePath,

@@ -388,0 +407,0 @@ manifest

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