From 710f9869f0dad21c47b47bd39f763908e207147a Mon Sep 17 00:00:00 2001 From: Bryan Helmkamp Date: Tue, 21 Apr 2026 15:45:35 -0400 Subject: [PATCH] fix(auth): stop demo mode from overriding authentication The demo router hardcoded AuthMode::Disabled, which caused /auth/config and /auth/me to lie and let demo endpoints be reached without a session whenever the fabro-demo=1 cookie was set. With the cookie set on a GitHub-configured server, /login rendered "Paste your dev token" with no input and no GitHub button because /auth/config returned empty methods. Have the demo router inherit the real AuthMode so demo mode is purely a data-source toggle: authentication is identical regardless of the cookie. Update the translate test that locked in the old bypass, add a companion test for the authed happy path, and add a regression test that /auth/config returns real methods under the demo cookie. As defense in depth, the login page now renders an explicit "no authentication method is configured" state when methods is empty instead of the misleading dev-token prompt. Co-Authored-By: Claude Opus 4.7 (1M context) --- apps/fabro-web/app/routes/auth-login.tsx | 4 ++- lib/crates/fabro-server/src/auth/translate.rs | 34 +++++++++++++++++-- lib/crates/fabro-server/src/server.rs | 2 +- lib/crates/fabro-server/src/web_auth.rs | 28 +++++++++++++++ .../{entry-nabtzckk.js => entry-q11nrnd3.js} | 2 +- lib/crates/fabro-spa/assets/index.html | 2 +- 6 files changed, 66 insertions(+), 6 deletions(-) rename lib/crates/fabro-spa/assets/assets/{entry-nabtzckk.js => entry-q11nrnd3.js} (98%) diff --git a/apps/fabro-web/app/routes/auth-login.tsx b/apps/fabro-web/app/routes/auth-login.tsx index 09096f73a..69ec23b57 100644 --- a/apps/fabro-web/app/routes/auth-login.tsx +++ b/apps/fabro-web/app/routes/auth-login.tsx @@ -40,7 +40,9 @@ export default function AuthLogin({ loaderData }: any) {

{hasGitHub ? "Authenticate with your GitHub account to continue." - : "Paste your dev token to continue."} + : hasDevToken + ? "Paste your dev token to continue." + : "No authentication method is configured on this server."}

{hasGitHub ? ( diff --git a/lib/crates/fabro-server/src/auth/translate.rs b/lib/crates/fabro-server/src/auth/translate.rs index 416607a33..5c05edb37 100644 --- a/lib/crates/fabro-server/src/auth/translate.rs +++ b/lib/crates/fabro-server/src/auth/translate.rs @@ -547,7 +547,7 @@ mod tests { } #[tokio::test] - async fn full_router_routes_demo_cookie_to_demo_handler_without_credentials() { + async fn full_router_rejects_demo_cookie_without_credentials() { let state = test_state(); let app = server::build_router_with_options( state, @@ -568,7 +568,37 @@ mod tests { .await .unwrap(); - assert_status!(response, StatusCode::OK).await; + assert_status!(response, StatusCode::UNAUTHORIZED).await; + } + + #[tokio::test] + async fn full_router_routes_demo_cookie_to_demo_handler_with_session() { + let state = test_state(); + let cookie = session_cookie(&github_session(), state.as_ref()); + let app = server::build_router_with_options( + Arc::clone(&state), + &auth_mode(), + Arc::new(crate::ip_allowlist::IpAllowlistConfig::default()), + RouterOptions::default(), + ); + + let response = app + .oneshot( + Request::builder() + .method("POST") + .uri("/api/v1/health/diagnostics") + .header(header::COOKIE, format!("{cookie}; fabro-demo=1")) + .body(Body::empty()) + .unwrap(), + ) + .await + .unwrap(); + + let body = response_json!(response).await; + assert_eq!( + body["sections"][0]["checks"][0]["summary"], "demo configured", + "demo handler should have served /health/diagnostics", + ); } #[tokio::test] diff --git a/lib/crates/fabro-server/src/server.rs b/lib/crates/fabro-server/src/server.rs index 814f3832c..19ae6a41f 100644 --- a/lib/crates/fabro-server/src/server.rs +++ b/lib/crates/fabro-server/src/server.rs @@ -975,7 +975,7 @@ pub fn build_router_with_options( let demo_router = Router::new() .nest("/api/v1", api_common.clone().merge(demo_routes())) - .layer(axum::Extension(AuthMode::Disabled)) + .layer(axum::Extension(auth_mode.clone())) .layer(axum::Extension(Arc::clone(&github_endpoints))) .with_state(state.clone()); diff --git a/lib/crates/fabro-server/src/web_auth.rs b/lib/crates/fabro-server/src/web_auth.rs index 762e8af89..0ceb1170d 100644 --- a/lib/crates/fabro-server/src/web_auth.rs +++ b/lib/crates/fabro-server/src/web_auth.rs @@ -1117,6 +1117,34 @@ mod tests { assert_eq!(body, json!({ "methods": ["dev-token"] })); } + #[tokio::test] + async fn auth_config_returns_real_methods_when_demo_cookie_set() { + let state = server::create_test_app_state_with_session_key( + github_settings("https://fabro.example"), + Some("web-auth-test-key-material-0123456789"), + false, + ); + let app = server::build_router_with_options( + state, + &github_auth_mode(), + Arc::new(crate::ip_allowlist::IpAllowlistConfig::default()), + server::RouterOptions::default(), + ); + + let response = app + .oneshot( + Request::builder() + .uri("/api/v1/auth/config") + .header(header::COOKIE, "fabro-demo=1") + .body(Body::empty()) + .unwrap(), + ) + .await + .unwrap(); + let body = response_json!(response).await; + assert_eq!(body, json!({ "methods": ["github"] })); + } + #[tokio::test] async fn login_github_sets_secure_state_cookie_for_https_web_url() { let app = test_auth_router_with_settings( diff --git a/lib/crates/fabro-spa/assets/assets/entry-nabtzckk.js b/lib/crates/fabro-spa/assets/assets/entry-q11nrnd3.js similarity index 98% rename from lib/crates/fabro-spa/assets/assets/entry-nabtzckk.js rename to lib/crates/fabro-spa/assets/assets/entry-q11nrnd3.js index dafc872c7..9a5faddae 100644 --- a/lib/crates/fabro-spa/assets/assets/entry-nabtzckk.js +++ b/lib/crates/fabro-spa/assets/assets/entry-q11nrnd3.js @@ -240,7 +240,7 @@ React keys must be passed directly to JSX without using spread: <%s key={someKey} {...props} />`,M0,H0,l0,H0),z0[H0+M0]=!0)}if(H0=null,N0!==void 0&&(Q(N0),H0=""+N0),W(q0)&&(Q(q0.key),H0=""+q0.key),"key"in q0){N0={};for(var t0 in q0)t0!=="key"&&(N0[t0]=q0[t0])}else N0=q0;return H0&&$(N0,typeof f==="function"?f.displayName||f.name||"Unknown":f),M(f,H0,N0,q(),I0,i0)}function O(f){_(f)?f._store&&(f._store.validated=1):typeof f==="object"&&f!==null&&f.$$typeof===g&&(f._payload.status==="fulfilled"?_(f._payload.value)&&f._payload.value._store&&(f._payload.value._store.validated=1):f._store&&(f._store.validated=1))}function _(f){return typeof f==="object"&&f!==null&&f.$$typeof===F}var F=Symbol.for("react.transitional.element"),P=Symbol.for("react.portal"),R=Symbol.for("react.fragment"),v=Symbol.for("react.strict_mode"),L=Symbol.for("react.profiler"),T=Symbol.for("react.consumer"),C=Symbol.for("react.context"),E=Symbol.for("react.forward_ref"),b=Symbol.for("react.suspense"),S=Symbol.for("react.suspense_list"),j=Symbol.for("react.memo"),g=Symbol.for("react.lazy"),s=Symbol.for("react.activity"),k=Symbol.for("react.client.reference"),o=PJ.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,X0=Object.prototype.hasOwnProperty,W0=Array.isArray,e=console.createTask?console.createTask:function(){return null};PJ={react_stack_bottom_frame:function(f){return f()}};var c,Z0={},$0=PJ.react_stack_bottom_frame.bind(PJ,B)(),n=e(z(B)),z0={};b60.Fragment=R,b60.jsx=function(f,q0,N0){var M0=1e4>o.recentlyCreatedOwnerStacks++;return w(f,q0,N0,!1,M0?Error("react-stack-top-frame"):$0,M0?e(z(f)):n)},b60.jsxs=function(f,q0,N0){var M0=1e4>o.recentlyCreatedOwnerStacks++;return w(f,q0,N0,!0,M0?Error("react-stack-top-frame"):$0,M0?e(z(f)):n)}})()});var og=D3((qw,sg)=>{(function(Z,Y){typeof qw=="object"&&typeof sg<"u"?Y(qw):typeof define=="function"&&define.amd?define(["exports"],Y):Y((Z=Z||self).lru_map=Z.lru_map||{})})(qw,function(Z){let Y=Symbol("newer"),Q=Symbol("older");class z{constructor(U,M){typeof U!=="number"&&(M=U,U=0),this.size=0,this.limit=U,this.oldest=this.newest=void 0,this._keymap=new Map,M&&(this.assign(M),U<1&&(this.limit=this.size))}_markEntryAsUsed(U){if(U===this.newest)return;U[Y]&&(U===this.oldest&&(this.oldest=U[Y]),U[Y][Q]=U[Q]),U[Q]&&(U[Q][Y]=U[Y]),U[Y]=void 0,U[Q]=this.newest,this.newest&&(this.newest[Y]=U),this.newest=U}assign(U){let M,w=this.limit||Number.MAX_VALUE;this._keymap.clear();let O=U[Symbol.iterator]();for(let _=O.next();!_.done;_=O.next()){let F=new q(_.value[0],_.value[1]);if(this._keymap.set(F.key,F),M?(M[Y]=F,F[Q]=M):this.oldest=F,M=F,w--==0)throw Error("overflow")}this.newest=M,this.size=this._keymap.size}get(U){var M=this._keymap.get(U);return M?(this._markEntryAsUsed(M),M.value):void 0}set(U,M){var w=this._keymap.get(U);return w?(w.value=M,this._markEntryAsUsed(w),this):(this._keymap.set(U,w=new q(U,M)),this.newest?(this.newest[Y]=w,w[Q]=this.newest):this.oldest=w,this.newest=w,++this.size,this.size>this.limit&&this.shift(),this)}shift(){var U=this.oldest;if(U)return this.oldest[Y]?(this.oldest=this.oldest[Y],this.oldest[Q]=void 0):(this.oldest=void 0,this.newest=void 0),U[Y]=U[Q]=void 0,this._keymap.delete(U.key),--this.size,[U.key,U.value]}find(U){let M=this._keymap.get(U);return M?M.value:void 0}has(U){return this._keymap.has(U)}delete(U){var M=this._keymap.get(U);return M?(this._keymap.delete(M.key),M[Y]&&M[Q]?(M[Q][Y]=M[Y],M[Y][Q]=M[Q]):M[Y]?(M[Y][Q]=void 0,this.oldest=M[Y]):M[Q]?(M[Q][Y]=void 0,this.newest=M[Q]):this.oldest=this.newest=void 0,this.size--,M.value):void 0}clear(){this.oldest=this.newest=void 0,this.size=0,this._keymap.clear()}keys(){return new W(this.oldest)}values(){return new $(this.oldest)}entries(){return this}[Symbol.iterator](){return new B(this.oldest)}forEach(U,M){typeof M!=="object"&&(M=this);let w=this.oldest;for(;w;)U.call(M,w.value,w.key,this),w=w[Y]}toJSON(){for(var U=Array(this.size),M=0,w=this.oldest;w;)U[M++]={key:w.key,value:w.value},w=w[Y];return U}toString(){for(var U="",M=this.oldest;M;)U+=String(M.key)+":"+M.value,M=M[Y],M&&(U+=" < ");return U}}Z.LRUMap=z;function q(U,M){this.key=U,this.value=M,this[Y]=void 0,this[Q]=void 0}function B(U){this.entry=U}B.prototype[Symbol.iterator]=function(){return this},B.prototype.next=function(){let U=this.entry;return U?(this.entry=U[Y],{done:!1,value:[U.key,U.value]}):{done:!0,value:void 0}};function W(U){this.entry=U}W.prototype[Symbol.iterator]=function(){return this},W.prototype.next=function(){let U=this.entry;return U?(this.entry=U[Y],{done:!1,value:U.key}):{done:!0,value:void 0}};function $(U){this.entry=U}$.prototype[Symbol.iterator]=function(){return this},$.prototype.next=function(){let U=this.entry;return U?(this.entry=U[Y],{done:!1,value:U.value}):{done:!0,value:void 0}}})});var uc=h(J0(),1),pc=h(lI(),1);var B4=h(J0(),1),h0=h(J0(),1),Z1=h(J0(),1),$A=h(J0(),1),Zy=h(J0(),1),Z5=h(J0(),1),Vo=h(J0(),1),Ro=h(J0(),1),Lo=h(J0(),1),g0=h(J0(),1),Hy=h(J0(),1),Aj=(Z)=>{throw TypeError(Z)},Ca=(Z,Y,Q)=>Y.has(Z)||Aj("Cannot "+Q),pF=(Z,Y,Q)=>(Ca(Z,Y,"read from private field"),Q?Q.call(Z):Y.get(Z)),Da=(Z,Y,Q)=>Y.has(Z)?Aj("Cannot add the same private member more than once"):Y instanceof WeakSet?Y.add(Z):Y.set(Z,Q);var rI="popstate";function Pj(Z={}){function Y(z,q){let{pathname:B,search:W,hash:$}=z.location;return rK("",{pathname:B,search:W,hash:$},q.state&&q.state.usr||null,q.state&&q.state.key||"default")}function Q(z,q){return typeof q==="string"?q:f6(q)}return Ea(Y,Q,null,Z)}function G1(Z,Y){if(Z===!1||Z===null||typeof Z>"u")throw Error(Y)}function h5(Z,Y){if(!Z){if(typeof console<"u")console.warn(Y);try{throw Error(Y)}catch(Q){}}}function ba(){return Math.random().toString(36).substring(2,10)}function aI(Z,Y){return{usr:Z.state,key:Z.key,idx:Y}}function rK(Z,Y,Q=null,z){return{pathname:typeof Z==="string"?Z:Z.pathname,search:"",hash:"",...typeof Y==="string"?j3(Y):Y,state:Q,key:Y&&Y.key||z||ba()}}function f6({pathname:Z="/",search:Y="",hash:Q=""}){if(Y&&Y!=="?")Z+=Y.charAt(0)==="?"?Y:"?"+Y;if(Q&&Q!=="#")Z+=Q.charAt(0)==="#"?Q:"#"+Q;return Z}function j3(Z){let Y={};if(Z){let Q=Z.indexOf("#");if(Q>=0)Y.hash=Z.substring(Q),Z=Z.substring(0,Q);let z=Z.indexOf("?");if(z>=0)Y.search=Z.substring(z),Z=Z.substring(0,z);if(Z)Y.pathname=Z}return Y}function Ea(Z,Y,Q,z={}){let{window:q=document.defaultView,v5Compat:B=!1}=z,W=q.history,$="POP",U=null,M=w();if(M==null)M=0,W.replaceState({...W.state,idx:M},"");function w(){return(W.state||{idx:null}).idx}function O(){$="POP";let v=w(),L=v==null?null:v-M;if(M=v,U)U({action:$,location:R.location,delta:L})}function _(v,L){$="PUSH";let T=rK(R.location,v,L);if(Q)Q(T,v);M=w()+1;let C=aI(T,M),E=R.createHref(T);try{W.pushState(C,"",E)}catch(b){if(b instanceof DOMException&&b.name==="DataCloneError")throw b;q.location.assign(E)}if(B&&U)U({action:$,location:R.location,delta:1})}function F(v,L){$="REPLACE";let T=rK(R.location,v,L);if(Q)Q(T,v);M=w();let C=aI(T,M),E=R.createHref(T);if(W.replaceState(C,"",E),B&&U)U({action:$,location:R.location,delta:0})}function P(v){return Vj(v)}let R={get action(){return $},get location(){return Z(q,W)},listen(v){if(U)throw Error("A history only accepts one active listener");return q.addEventListener(rI,O),U=v,()=>{q.removeEventListener(rI,O),U=null}},createHref(v){return Y(q,v)},createURL:P,encodeLocation(v){let L=P(v);return{pathname:L.pathname,search:L.search,hash:L.hash}},push:_,replace:F,go(v){return W.go(v)}};return R}function Vj(Z,Y=!1){let Q="http://localhost";if(typeof window<"u")Q=window.location.origin!=="null"?window.location.origin:window.location.href;G1(Q,"No window.location.(origin|href) available to create URL");let z=typeof Z==="string"?Z:f6(Z);if(z=z.replace(/ $/,"%20"),!Y&&z.startsWith("//"))z=Q+z;return new URL(z,Q)}var cK,aF=class{constructor(Z){if(Da(this,cK,new Map),Z)for(let[Y,Q]of Z)this.set(Y,Q)}get(Z){if(pF(this,cK).has(Z))return pF(this,cK).get(Z);if(Z.defaultValue!==void 0)return Z.defaultValue;throw Error("No value found for context")}set(Z,Y){pF(this,cK).set(Z,Y)}};cK=new WeakMap;var Ia=new Set(["lazy","caseSensitive","path","id","index","children"]);function ja(Z){return Ia.has(Z)}var ya=new Set(["lazy","caseSensitive","path","id","index","middleware","children"]);function Sa(Z){return ya.has(Z)}function ka(Z){return Z.index===!0}function aK(Z,Y,Q=[],z={},q=!1){return Z.map((B,W)=>{let $=[...Q,String(W)],U=typeof B.id==="string"?B.id:$.join("-");if(G1(B.index!==!0||!B.children,"Cannot specify children on an index route"),G1(q||!z[U],`Found a route id collision on id "${U}". Route id's must be globally unique within Data Router usages`),ka(B)){let M={...B,id:U};return z[U]=sI(M,Y(M)),M}else{let M={...B,id:U,children:void 0};if(z[U]=sI(M,Y(M)),B.children)M.children=aK(B.children,Y,$,z,q);return M}})}function sI(Z,Y){return Object.assign(Z,{...Y,...typeof Y.lazy==="object"&&Y.lazy!=null?{lazy:{...Z.lazy,...Y.lazy}}:{}})}function x8(Z,Y,Q="/"){return dK(Z,Y,Q,!1)}function dK(Z,Y,Q,z){let q=typeof Y==="string"?j3(Y):Y,B=y4(q.pathname||"/",Q);if(B==null)return null;let W=Lj(Z);xa(W);let $=null;for(let U=0;$==null&&U{let w={relativePath:M===void 0?W.path||"":M,caseSensitive:W.caseSensitive===!0,childrenIndex:$,route:W};if(w.relativePath.startsWith("/")){if(!w.relativePath.startsWith(z)&&U)return;G1(w.relativePath.startsWith(z),`Absolute route path "${w.relativePath}" nested under path "${z}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),w.relativePath=w.relativePath.slice(z.length)}let O=E3([z,w.relativePath]),_=Q.concat(w);if(W.children&&W.children.length>0)G1(W.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${O}".`),Lj(W.children,Y,_,O,U);if(W.path==null&&!W.index)return;Y.push({path:O,score:ca(O,W.index),routesMeta:_})};return Z.forEach((W,$)=>{if(W.path===""||!W.path?.includes("?"))B(W,$);else for(let U of Tj(W.path))B(W,$,!0,U)}),Y}function Tj(Z){let Y=Z.split("/");if(Y.length===0)return[];let[Q,...z]=Y,q=Q.endsWith("?"),B=Q.replace(/\?$/,"");if(z.length===0)return q?[B,""]:[B];let W=Tj(z.join("/")),$=[];if($.push(...W.map((U)=>U===""?B:[B,U].join("/"))),q)$.push(...W);return $.map((U)=>Z.startsWith("/")&&U===""?"/":U)}function xa(Z){Z.sort((Y,Q)=>Y.score!==Q.score?Q.score-Y.score:da(Y.routesMeta.map((z)=>z.childrenIndex),Q.routesMeta.map((z)=>z.childrenIndex)))}var fa=/^:[\w-]+$/,ha=3,ga=2,ma=1,ua=10,pa=-2,oI=(Z)=>Z==="*";function ca(Z,Y){let Q=Z.split("/"),z=Q.length;if(Q.some(oI))z+=pa;if(Y)z+=ga;return Q.filter((q)=>!oI(q)).reduce((q,B)=>q+(fa.test(B)?ha:B===""?ma:ua),z)}function da(Z,Y){return Z.length===Y.length&&Z.slice(0,-1).every((z,q)=>z===Y[q])?Z[Z.length-1]-Y[Y.length-1]:0}function la(Z,Y,Q=!1){let{routesMeta:z}=Z,q={},B="/",W=[];for(let $=0;${if(w==="*"){let P=$[_]||"";W=B.slice(0,B.length-P.length).replace(/(.)\/+$/,"$1")}let F=$[_];if(O&&!F)M[w]=void 0;else M[w]=(F||"").replace(/%2F/g,"/");return M},{}),pathname:B,pathnameBase:W,pattern:Z}}function ra(Z,Y=!1,Q=!0){h5(Z==="*"||!Z.endsWith("*")||Z.endsWith("/*"),`Route path "${Z}" will be treated as if it were "${Z.replace(/\*$/,"/*")}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${Z.replace(/\*$/,"/*")}".`);let z=[],q="^"+Z.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(W,$,U)=>{return z.push({paramName:$,isOptional:U!=null}),U?"/?([^\\/]+)?":"/([^\\/]+)"}).replace(/\/([\w-]+)\?(\/|$)/g,"(/$1)?$2");if(Z.endsWith("*"))z.push({paramName:"*"}),q+=Z==="*"||Z==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$";else if(Q)q+="\\/*$";else if(Z!==""&&Z!=="/")q+="(?:(?=\\/|$))";return[new RegExp(q,Y?void 0:"i"),z]}function aa(Z){try{return Z.split("/").map((Y)=>decodeURIComponent(Y).replace(/\//g,"%2F")).join("/")}catch(Y){return h5(!1,`The URL path "${Z}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${Y}).`),Z}}function y4(Z,Y){if(Y==="/")return Z;if(!Z.toLowerCase().startsWith(Y.toLowerCase()))return null;let Q=Y.endsWith("/")?Y.length-1:Y.length,z=Z.charAt(Q);if(z&&z!=="/")return null;return Z.slice(Q)||"/"}function sa({basename:Z,pathname:Y}){return Y==="/"?Z:E3([Z,Y])}var vj=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,$U=(Z)=>vj.test(Z);function Cj(Z,Y="/"){let{pathname:Q,search:z="",hash:q=""}=typeof Z==="string"?j3(Z):Z,B;if(Q)if($U(Q))B=Q;else{if(Q.includes("//")){let W=Q;Q=Q.replace(/\/\/+/g,"/"),h5(!1,`Pathnames cannot have embedded double slashes - normalizing ${W} -> ${Q}`)}if(Q.startsWith("/"))B=iI(Q.substring(1),"/");else B=iI(Q,Y)}else B=Y;return{pathname:B,search:ia(z),hash:ta(q)}}function iI(Z,Y){let Q=Y.replace(/\/+$/,"").split("/");return Z.split("/").forEach((q)=>{if(q===".."){if(Q.length>1)Q.pop()}else if(q!==".")Q.push(q)}),Q.length>1?Q.join("/"):"/"}function cF(Z,Y,Q,z){return`Cannot include a '${Z}' character in a manually specified \`to.${Y}\` field [${JSON.stringify(z)}]. Please separate it out to the \`to.${Q}\` field. Alternatively you may provide the full path as a string in and the router will parse it for you.`}function Dj(Z){return Z.filter((Y,Q)=>Q===0||Y.route.path&&Y.route.path.length>0)}function GU(Z){let Y=Dj(Z);return Y.map((Q,z)=>z===Y.length-1?Q.pathname:Q.pathnameBase)}function UU(Z,Y,Q,z=!1){let q;if(typeof Z==="string")q=j3(Z);else q={...Z},G1(!q.pathname||!q.pathname.includes("?"),cF("?","pathname","search",q)),G1(!q.pathname||!q.pathname.includes("#"),cF("#","pathname","hash",q)),G1(!q.search||!q.search.includes("#"),cF("#","search","hash",q));let B=Z===""||q.pathname==="",W=B?"/":q.pathname,$;if(W==null)$=Q;else{let O=Y.length-1;if(!z&&W.startsWith("..")){let _=W.split("/");while(_[0]==="..")_.shift(),O-=1;q.pathname=_.join("/")}$=O>=0?Y[O]:"/"}let U=Cj(q,$),M=W&&W!=="/"&&W.endsWith("/"),w=(B||W===".")&&Q.endsWith("/");if(!U.pathname.endsWith("/")&&(M||w))U.pathname+="/";return U}var E3=(Z)=>Z.join("/").replace(/\/\/+/g,"/"),oa=(Z)=>Z.replace(/\/+$/,"").replace(/^\/*/,"/"),ia=(Z)=>!Z||Z==="?"?"":Z.startsWith("?")?Z:"?"+Z,ta=(Z)=>!Z||Z==="#"?"":Z.startsWith("#")?Z:"#"+Z;var MU=(Z,Y=302)=>{let Q=Y;if(typeof Q==="number")Q={status:Q};else if(typeof Q.status>"u")Q.status=302;let z=new Headers(Q.headers);return z.set("Location",Z),new Response(null,{...Q,headers:z})};var eQ=class{constructor(Z,Y,Q,z=!1){if(this.status=Z,this.statusText=Y||"",this.internal=z,Q instanceof Error)this.data=Q.toString(),this.error=Q;else this.data=Q}};function I3(Z){return Z!=null&&typeof Z.status==="number"&&typeof Z.statusText==="string"&&typeof Z.internal==="boolean"&&"data"in Z}function oK(Z){return Z.map((Y)=>Y.route.path).filter(Boolean).join("/").replace(/\/\/*/g,"/")||"/"}var bj=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function Ej(Z,Y){let Q=Z;if(typeof Q!=="string"||!vj.test(Q))return{absoluteURL:void 0,isExternal:!1,to:Q};let z=Q,q=!1;if(bj)try{let B=new URL(window.location.href),W=Q.startsWith("//")?new URL(B.protocol+Q):new URL(Q),$=y4(W.pathname,Y);if(W.origin===B.origin&&$!=null)Q=$+W.search+W.hash;else q=!0}catch(B){h5(!1,` contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:z,isExternal:q,to:Q}}var zZ=Symbol("Uninstrumented");function na(Z,Y){let Q={lazy:[],"lazy.loader":[],"lazy.action":[],"lazy.middleware":[],middleware:[],loader:[],action:[]};Z.forEach((q)=>q({id:Y.id,index:Y.index,path:Y.path,instrument(B){let W=Object.keys(Q);for(let $ of W)if(B[$])Q[$].push(B[$])}}));let z={};if(typeof Y.lazy==="function"&&Q.lazy.length>0){let q=iQ(Q.lazy,Y.lazy,()=>{return});if(q)z.lazy=q}if(typeof Y.lazy==="object"){let q=Y.lazy;["middleware","loader","action"].forEach((B)=>{let W=q[B],$=Q[`lazy.${B}`];if(typeof W==="function"&&$.length>0){let U=iQ($,W,()=>{return});if(U)z.lazy=Object.assign(z.lazy||{},{[B]:U})}})}if(["loader","action"].forEach((q)=>{let B=Y[q];if(typeof B==="function"&&Q[q].length>0){let W=B[zZ]??B,$=iQ(Q[q],W,(...U)=>tI(U[0]));if($){if(q==="loader"&&W.hydrate===!0)$.hydrate=!0;$[zZ]=W,z[q]=$}}}),Y.middleware&&Y.middleware.length>0&&Q.middleware.length>0)z.middleware=Y.middleware.map((q)=>{let B=q[zZ]??q,W=iQ(Q.middleware,B,(...$)=>tI($[0]));if(W)return W[zZ]=B,W;return q});return z}function ea(Z,Y){let Q={navigate:[],fetch:[]};if(Y.forEach((z)=>z({instrument(q){let B=Object.keys(q);for(let W of B)if(q[W])Q[W].push(q[W])}})),Q.navigate.length>0){let z=Z.navigate[zZ]??Z.navigate,q=iQ(Q.navigate,z,(...B)=>{let[W,$]=B;return{to:typeof W==="number"||typeof W==="string"?W:W?f6(W):".",...nI(Z,$??{})}});if(q)q[zZ]=z,Z.navigate=q}if(Q.fetch.length>0){let z=Z.fetch[zZ]??Z.fetch,q=iQ(Q.fetch,z,(...B)=>{let[W,,$,U]=B;return{href:$??".",fetcherKey:W,...nI(Z,U??{})}});if(q)q[zZ]=z,Z.fetch=q}return Z}function iQ(Z,Y,Q){if(Z.length===0)return null;return async(...z)=>{let q=await Ij(Z,Q(...z),()=>Y(...z),Z.length-1);if(q.type==="error")throw q.value;return q.value}}async function Ij(Z,Y,Q,z){let q=Z[z],B;if(!q)try{B={type:"success",value:await Q()}}catch(W){B={type:"error",value:W}}else{let W=void 0,$=async()=>{if(W)console.error("You cannot call instrumented handlers more than once");else W=Ij(Z,Y,Q,z-1);if(B=await W,G1(B,"Expected a result"),B.type==="error"&&B.value instanceof Error)return{status:"error",error:B.value};return{status:"success",error:void 0}};try{await q($,Y)}catch(U){console.error("An instrumentation function threw an error:",U)}if(!W)await $();await W}if(B)return B;return{type:"error",value:Error("No result assigned in instrumentation chain.")}}function tI(Z){let{request:Y,context:Q,params:z,unstable_pattern:q}=Z;return{request:Zs(Y),params:{...z},unstable_pattern:q,context:Ys(Q)}}function nI(Z,Y){return{currentUrl:f6(Z.state.location),..."formMethod"in Y?{formMethod:Y.formMethod}:{},..."formEncType"in Y?{formEncType:Y.formEncType}:{},..."formData"in Y?{formData:Y.formData}:{},..."body"in Y?{body:Y.body}:{}}}function Zs(Z){return{method:Z.method,url:Z.url,headers:{get:(...Y)=>Z.headers.get(...Y)}}}function Ys(Z){if(Qs(Z)){let Y={...Z};return Object.freeze(Y),Y}else return{get:(Y)=>Z.get(Y)}}var Js=Object.getOwnPropertyNames(Object.prototype).sort().join("\x00");function Qs(Z){if(Z===null||typeof Z!=="object")return!1;let Y=Object.getPrototypeOf(Z);return Y===Object.prototype||Y===null||Object.getOwnPropertyNames(Y).sort().join("\x00")===Js}var jj=["POST","PUT","PATCH","DELETE"],Xs=new Set(jj),zs=["GET",...jj],qs=new Set(zs),yj=new Set([301,302,303,307,308]),Ks=new Set([307,308]),qU={state:"idle",location:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0},ZA={state:"idle",data:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0},sQ={state:"unblocked",proceed:void 0,reset:void 0,location:void 0},Bs=(Z)=>({hasErrorBoundary:Boolean(Z.hasErrorBoundary)}),Sj="remix-router-transitions",kj=Symbol("ResetLoaderData");function xj(Z){let Y=Z.window?Z.window:typeof window<"u"?window:void 0,Q=typeof Y<"u"&&typeof Y.document<"u"&&typeof Y.document.createElement<"u";G1(Z.routes.length>0,"You must provide a non-empty routes array to createRouter");let z=Z.hydrationRouteProperties||[],q=Z.mapRouteProperties||Bs,B=q;if(Z.unstable_instrumentations){let m=Z.unstable_instrumentations;B=(t)=>{return{...q(t),...na(m.map((B0)=>B0.route).filter(Boolean),t)}}}let W={},$=aK(Z.routes,B,void 0,W),U,M=Z.basename||"/";if(!M.startsWith("/"))M=`/${M}`;let w=Z.dataStrategy||Ms,O={...Z.future},_=null,F=new Set,P=null,R=null,v=null,L=Z.hydrationData!=null,T=x8($,Z.history.location,M),C=!1,E=null,b;if(T==null&&!Z.patchRoutesOnNavigation){let m=z6(404,{pathname:Z.history.location.pathname}),{matches:t,route:B0}=JU($);b=!0,T=t,E={[B0.id]:m}}else{if(T&&!Z.hydrationData){if(_5(T,$,Z.history.location.pathname).active)T=null}if(!T){b=!1,T=[];let m=_5(null,$,Z.history.location.pathname);if(m.active&&m.matches)C=!0,T=m.matches}else if(T.some((m)=>m.route.lazy))b=!1;else if(!T.some((m)=>YA(m.route)))b=!0;else{let m=Z.hydrationData?Z.hydrationData.loaderData:null,t=Z.hydrationData?Z.hydrationData.errors:null;if(t){let B0=T.findIndex((_0)=>t[_0.route.id]!==void 0);b=T.slice(0,B0+1).every((_0)=>!oF(_0.route,m,t))}else b=T.every((B0)=>!oF(B0.route,m,t))}}let S,j={historyAction:Z.history.action,location:Z.history.location,matches:T,initialized:b,navigation:qU,restoreScrollPosition:Z.hydrationData!=null?!1:null,preventScrollReset:!1,revalidation:"idle",loaderData:Z.hydrationData&&Z.hydrationData.loaderData||{},actionData:Z.hydrationData&&Z.hydrationData.actionData||null,errors:Z.hydrationData&&Z.hydrationData.errors||E,fetchers:new Map,blockers:new Map},g="POP",s=null,k=!1,o,X0=!1,W0=new Map,e=null,c=!1,Z0=!1,$0=new Set,n=new Map,z0=0,f=-1,q0=new Map,N0=new Set,M0=new Map,I0=new Map,i0=new Set,H0=new Map,l0=void 0,t0=null;function L1(){if(_=Z.history.listen(({action:m,location:t,delta:B0})=>{if(l0){l0(),l0=void 0;return}h5(H0.size===0||B0!=null,"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 _0=Y1({currentLocation:j.location,nextLocation:t,historyAction:m});if(_0&&B0!=null){let P0=new Promise((f0)=>{l0=f0});Z.history.go(B0*-1),k0(_0,{state:"blocked",location:t,proceed(){k0(_0,{state:"proceeding",proceed:void 0,reset:void 0,location:t}),P0.then(()=>Z.history.go(B0))},reset(){let f0=new Map(j.blockers);f0.set(_0,sQ),C1({blockers:f0})}}),s?.resolve(),s=null;return}return w1(m,t)}),Q){Is(Y,W0);let m=()=>js(Y,W0);Y.addEventListener("pagehide",m),e=()=>Y.removeEventListener("pagehide",m)}if(!j.initialized)w1("POP",j.location,{initialHydration:!0});return S}function B1(){if(_)_();if(e)e();F.clear(),o&&o.abort(),j.fetchers.forEach((m,t)=>Z4(t)),j.blockers.forEach((m,t)=>L0(t))}function R0(m){return F.add(m),()=>F.delete(m)}function C1(m,t={}){if(m.matches)m.matches=m.matches.map((P0)=>{let f0=W[P0.route.id],y0=P0.route;if(y0.element!==f0.element||y0.errorElement!==f0.errorElement||y0.hydrateFallbackElement!==f0.hydrateFallbackElement)return{...P0,route:f0};return P0});j={...j,...m};let B0=[],_0=[];j.fetchers.forEach((P0,f0)=>{if(P0.state==="idle")if(i0.has(f0))B0.push(f0);else _0.push(f0)}),i0.forEach((P0)=>{if(!j.fetchers.has(P0)&&!n.has(P0))B0.push(P0)}),[...F].forEach((P0)=>P0(j,{deletedFetchers:B0,newErrors:m.errors??null,viewTransitionOpts:t.viewTransitionOpts,flushSync:t.flushSync===!0})),B0.forEach((P0)=>Z4(P0)),_0.forEach((P0)=>j.fetchers.delete(P0))}function Q5(m,t,{flushSync:B0}={}){let _0=j.actionData!=null&&j.navigation.formMethod!=null&&P7(j.navigation.formMethod)&&j.navigation.state==="loading"&&m.state?._isRedirect!==!0,P0;if(t.actionData)if(Object.keys(t.actionData).length>0)P0=t.actionData;else P0=null;else if(_0)P0=j.actionData;else P0=null;let f0=t.loaderData?Bj(j.loaderData,t.loaderData,t.matches||[],t.errors):j.loaderData,y0=j.blockers;if(y0.size>0)y0=new Map(y0),y0.forEach((J1,d0)=>y0.set(d0,sQ));let S0=c?!1:q5(m,t.matches||j.matches),c0=k===!0||j.navigation.formMethod!=null&&P7(j.navigation.formMethod)&&m.state?._isRedirect!==!0;if(U)$=U,U=void 0;if(c);else if(g==="POP");else if(g==="PUSH")Z.history.push(m,m.state);else if(g==="REPLACE")Z.history.replace(m,m.state);let r0;if(g==="POP"){let J1=W0.get(j.location.pathname);if(J1&&J1.has(m.pathname))r0={currentLocation:j.location,nextLocation:m};else if(W0.has(m.pathname))r0={currentLocation:m,nextLocation:j.location}}else if(X0){let J1=W0.get(j.location.pathname);if(J1)J1.add(m.pathname);else J1=new Set([m.pathname]),W0.set(j.location.pathname,J1);r0={currentLocation:j.location,nextLocation:m}}C1({...t,actionData:P0,loaderData:f0,historyAction:g,location:m,initialized:!0,navigation:qU,revalidation:"idle",restoreScrollPosition:S0,preventScrollReset:c0,blockers:y0},{viewTransitionOpts:r0,flushSync:B0===!0}),g="POP",k=!1,X0=!1,c=!1,Z0=!1,s?.resolve(),s=null,t0?.resolve(),t0=null}async function n5(m,t){if(s?.resolve(),s=null,typeof m==="number"){if(!s)s=Uj();let c1=s.promise;return Z.history.go(m),c1}let B0=sF(j.location,j.matches,M,m,t?.fromRouteId,t?.relative),{path:_0,submission:P0,error:f0}=eI(!1,B0,t),y0=j.location,S0=rK(j.location,_0,t&&t.state);S0={...S0,...Z.history.encodeLocation(S0)};let c0=t&&t.replace!=null?t.replace:void 0,r0="PUSH";if(c0===!0)r0="REPLACE";else if(c0===!1);else if(P0!=null&&P7(P0.formMethod)&&P0.formAction===j.location.pathname+j.location.search)r0="REPLACE";let J1=t&&"preventScrollReset"in t?t.preventScrollReset===!0:void 0,d0=(t&&t.flushSync)===!0,p1=Y1({currentLocation:y0,nextLocation:S0,historyAction:r0});if(p1){k0(p1,{state:"blocked",location:S0,proceed(){k0(p1,{state:"proceeding",proceed:void 0,reset:void 0,location:S0}),n5(m,t)},reset(){let c1=new Map(j.blockers);c1.set(p1,sQ),C1({blockers:c1})}});return}await w1(r0,S0,{submission:P0,pendingError:f0,preventScrollReset:J1,replace:t&&t.replace,enableViewTransition:t&&t.viewTransition,flushSync:d0,callSiteDefaultShouldRevalidate:t&&t.unstable_defaultShouldRevalidate})}function N5(){if(!t0)t0=Uj();Z7(),C1({revalidation:"loading"});let m=t0.promise;if(j.navigation.state==="submitting")return m;if(j.navigation.state==="idle")return w1(j.historyAction,j.location,{startUninterruptedRevalidation:!0}),m;return w1(g||j.historyAction,j.navigation.location,{overrideNavigation:j.navigation,enableViewTransition:X0===!0}),m}async function w1(m,t,B0){o&&o.abort(),o=null,g=m,c=(B0&&B0.startUninterruptedRevalidation)===!0,O5(j.location,j.matches),k=(B0&&B0.preventScrollReset)===!0,X0=(B0&&B0.enableViewTransition)===!0;let _0=U||$,P0=B0&&B0.overrideNavigation,f0=B0?.initialHydration&&j.matches&&j.matches.length>0&&!C?j.matches:x8(_0,t,M),y0=(B0&&B0.flushSync)===!0;if(f0&&j.initialized&&!Z0&&Ps(j.location,t)&&!(B0&&B0.submission&&P7(B0.submission.formMethod))){Q5(t,{matches:f0},{flushSync:y0});return}let S0=_5(f0,_0,t.pathname);if(S0.active&&S0.matches)f0=S0.matches;if(!f0){let{error:Z2,notFoundMatches:h2,route:t1}=x0(t.pathname);Q5(t,{matches:h2,loaderData:{},errors:{[t1.id]:Z2}},{flushSync:y0});return}o=new AbortController;let c0=oQ(Z.history,t,o.signal,B0&&B0.submission),r0=Z.getContext?await Z.getContext():new aF,J1;if(B0&&B0.pendingError)J1=[XZ(f0).route.id,{type:"error",error:B0.pendingError}];else if(B0&&B0.submission&&P7(B0.submission.formMethod)){let Z2=await t6(c0,t,B0.submission,f0,r0,S0.active,B0&&B0.initialHydration===!0,{replace:B0.replace,flushSync:y0});if(Z2.shortCircuited)return;if(Z2.pendingActionResult){let[h2,t1]=Z2.pendingActionResult;if(j4(t1)&&I3(t1.error)&&t1.error.status===404){o=null,Q5(t,{matches:Z2.matches,loaderData:{},errors:{[h2]:t1.error}});return}}f0=Z2.matches||f0,J1=Z2.pendingActionResult,P0=dF(t,B0.submission),y0=!1,S0.active=!1,c0=oQ(Z.history,c0.url,c0.signal)}let{shortCircuited:d0,matches:p1,loaderData:c1,errors:k5}=await W1(c0,t,f0,r0,S0.active,P0,B0&&B0.submission,B0&&B0.fetcherSubmission,B0&&B0.replace,B0&&B0.initialHydration===!0,y0,J1,B0&&B0.callSiteDefaultShouldRevalidate);if(d0)return;o=null,Q5(t,{matches:p1||f0,...Wj(J1),loaderData:c1,errors:k5})}async function t6(m,t,B0,_0,P0,f0,y0,S0={}){Z7();let c0=bs(t,B0);if(C1({navigation:c0},{flushSync:S0.flushSync===!0}),f0){let d0=await e5(_0,t.pathname,m.signal);if(d0.type==="aborted")return{shortCircuited:!0};else if(d0.type==="error"){if(d0.partialMatches.length===0){let{matches:c1,route:k5}=JU($);return{matches:c1,pendingActionResult:[k5.id,{type:"error",error:d0.error}]}}let p1=XZ(d0.partialMatches).route.id;return{matches:d0.partialMatches,pendingActionResult:[p1,{type:"error",error:d0.error}]}}else if(!d0.matches){let{notFoundMatches:p1,error:c1,route:k5}=x0(t.pathname);return{matches:p1,pendingActionResult:[k5.id,{type:"error",error:c1}]}}else _0=d0.matches}let r0,J1=KU(_0,t);if(!J1.route.action&&!J1.route.lazy)r0={type:"error",error:z6(405,{method:m.method,pathname:t.pathname,routeId:J1.route.id})};else{let d0=tQ(B,W,m,_0,J1,y0?[]:z,P0),p1=await V6(m,d0,P0,null);if(r0=p1[J1.route.id],!r0){for(let c1 of _0)if(p1[c1.route.id]){r0=p1[c1.route.id];break}}if(m.signal.aborted)return{shortCircuited:!0}}if(yY(r0)){let d0;if(S0&&S0.replace!=null)d0=S0.replace;else d0=zj(r0.response.headers.get("Location"),new URL(m.url),M,Z.history)===j.location.pathname+j.location.search;return await x2(m,r0,!0,{submission:B0,replace:d0}),{shortCircuited:!0}}if(j4(r0)){let d0=XZ(_0,J1.route.id);if((S0&&S0.replace)!==!0)g="PUSH";return{matches:_0,pendingActionResult:[d0.route.id,r0,J1.route.id]}}return{matches:_0,pendingActionResult:[J1.route.id,r0]}}async function W1(m,t,B0,_0,P0,f0,y0,S0,c0,r0,J1,d0,p1){let c1=f0||dF(t,y0),k5=y0||S0||Gj(c1),Z2=!c&&!r0;if(P0){if(Z2){let G2=w4(d0);C1({navigation:c1,...G2!==void 0?{actionData:G2}:{}},{flushSync:J1})}let D1=await e5(B0,t.pathname,m.signal);if(D1.type==="aborted")return{shortCircuited:!0};else if(D1.type==="error"){if(D1.partialMatches.length===0){let{matches:N9,route:W8}=JU($);return{matches:N9,loaderData:{},errors:{[W8.id]:D1.error}}}let G2=XZ(D1.partialMatches).route.id;return{matches:D1.partialMatches,loaderData:{},errors:{[G2]:D1.error}}}else if(!D1.matches){let{error:G2,notFoundMatches:N9,route:W8}=x0(t.pathname);return{matches:N9,loaderData:{},errors:{[W8.id]:G2}}}else B0=D1.matches}let h2=U||$,{dsMatches:t1,revalidatingFetchers:y7}=Zj(m,_0,B,W,Z.history,j,B0,k5,t,r0?[]:z,r0===!0,Z0,$0,i0,M0,N0,h2,M,Z.patchRoutesOnNavigation!=null,d0,p1);if(f=++z0,!Z.dataStrategy&&!t1.some((D1)=>D1.shouldLoad)&&!t1.some((D1)=>D1.route.middleware&&D1.route.middleware.length>0)&&y7.length===0){let D1=y();return Q5(t,{matches:B0,loaderData:{},errors:d0&&j4(d0[1])?{[d0[0]]:d0[1].error}:null,...Wj(d0),...D1?{fetchers:new Map(j.fetchers)}:{}},{flushSync:J1}),{shortCircuited:!0}}if(Z2){let D1={};if(!P0){D1.navigation=c1;let G2=w4(d0);if(G2!==void 0)D1.actionData=G2}if(y7.length>0)D1.fetchers=S1(y7);C1(D1,{flushSync:J1})}y7.forEach((D1)=>{if(Y7(D1.key),D1.controller)n.set(D1.key,D1.controller)});let n6=()=>y7.forEach((D1)=>Y7(D1.key));if(o)o.signal.addEventListener("abort",n6);let{loaderResults:L2,fetcherResults:S7}=await R6(t1,y7,m,_0);if(m.signal.aborted)return{shortCircuited:!0};if(o)o.signal.removeEventListener("abort",n6);y7.forEach((D1)=>n.delete(D1.key));let g2=QU(L2);if(g2)return await x2(m,g2.result,!0,{replace:c0}),{shortCircuited:!0};if(g2=QU(S7),g2)return N0.add(g2.key),await x2(m,g2.result,!0,{replace:c0}),{shortCircuited:!0};let{loaderData:aJ,errors:T6}=Kj(j,B0,L2,d0,y7,S7);if(r0&&j.errors)T6={...j.errors,...T6};let l4=y(),w9=Y0(f),e6=l4||w9||y7.length>0;return{matches:B0,loaderData:aJ,errors:T6,...e6?{fetchers:new Map(j.fetchers)}:{}}}function w4(m){if(m&&!j4(m[1]))return{[m[0]]:m[1].data};else if(j.actionData)if(Object.keys(j.actionData).length===0)return null;else return j.actionData}function S1(m){return m.forEach((t)=>{let B0=j.fetchers.get(t.key),_0=uK(void 0,B0?B0.data:void 0);j.fetchers.set(t.key,_0)}),new Map(j.fetchers)}async function P6(m,t,B0,_0){Y7(m);let P0=(_0&&_0.flushSync)===!0,f0=U||$,y0=sF(j.location,j.matches,M,B0,t,_0?.relative),S0=x8(f0,y0,M),c0=_5(S0,f0,y0);if(c0.active&&c0.matches)S0=c0.matches;if(!S0){$2(m,t,z6(404,{pathname:y0}),{flushSync:P0});return}let{path:r0,submission:J1,error:d0}=eI(!0,y0,_0);if(d0){$2(m,t,d0,{flushSync:P0});return}let p1=Z.getContext?await Z.getContext():new aF,c1=(_0&&_0.preventScrollReset)===!0;if(J1&&P7(J1.formMethod)){await e2(m,t,r0,S0,p1,c0.active,P0,c1,J1,_0&&_0.unstable_defaultShouldRevalidate);return}M0.set(m,{routeId:t,path:r0}),await c4(m,t,r0,S0,p1,c0.active,P0,c1,J1)}async function e2(m,t,B0,_0,P0,f0,y0,S0,c0,r0){Z7(),M0.delete(m);let J1=j.fetchers.get(m);v5(m,Es(c0,J1),{flushSync:y0});let d0=new AbortController,p1=oQ(Z.history,B0,d0.signal,c0);if(f0){let C5=await e5(_0,new URL(p1.url).pathname,p1.signal,m);if(C5.type==="aborted")return;else if(C5.type==="error"){$2(m,t,C5.error,{flushSync:y0});return}else if(!C5.matches){$2(m,t,z6(404,{pathname:B0}),{flushSync:y0});return}else _0=C5.matches}let c1=KU(_0,B0);if(!c1.route.action&&!c1.route.lazy){let C5=z6(405,{method:c0.formMethod,pathname:B0,routeId:t});$2(m,t,C5,{flushSync:y0});return}n.set(m,d0);let k5=z0,Z2=tQ(B,W,p1,_0,c1,z,P0),h2=await V6(p1,Z2,P0,m),t1=h2[c1.route.id];if(!t1){for(let C5 of Z2)if(h2[C5.route.id]){t1=h2[C5.route.id];break}}if(p1.signal.aborted){if(n.get(m)===d0)n.delete(m);return}if(i0.has(m)){if(yY(t1)||j4(t1)){v5(m,k8(void 0));return}}else{if(yY(t1))if(n.delete(m),f>k5){v5(m,k8(void 0));return}else return N0.add(m),v5(m,uK(c0)),x2(p1,t1,!1,{fetcherSubmission:c0,preventScrollReset:S0});if(j4(t1)){$2(m,t,t1.error);return}}let y7=j.navigation.location||j.location,n6=oQ(Z.history,y7,d0.signal),L2=U||$,S7=j.navigation.state!=="idle"?x8(L2,j.navigation.location,M):j.matches;G1(S7,"Didn't find any matches after fetcher action");let g2=++z0;q0.set(m,g2);let aJ=uK(c0,t1.data);j.fetchers.set(m,aJ);let{dsMatches:T6,revalidatingFetchers:l4}=Zj(n6,P0,B,W,Z.history,j,S7,c0,y7,z,!1,Z0,$0,i0,M0,N0,L2,M,Z.patchRoutesOnNavigation!=null,[c1.route.id,t1],r0);l4.filter((C5)=>C5.key!==m).forEach((C5)=>{let O9=C5.key,sJ=j.fetchers.get(O9),dW=uK(void 0,sJ?sJ.data:void 0);if(j.fetchers.set(O9,dW),Y7(O9),C5.controller)n.set(O9,C5.controller)}),C1({fetchers:new Map(j.fetchers)});let w9=()=>l4.forEach((C5)=>Y7(C5.key));d0.signal.addEventListener("abort",w9);let{loaderResults:e6,fetcherResults:D1}=await R6(T6,l4,n6,P0);if(d0.signal.aborted)return;if(d0.signal.removeEventListener("abort",w9),q0.delete(m),n.delete(m),l4.forEach((C5)=>n.delete(C5.key)),j.fetchers.has(m)){let C5=k8(t1.data);j.fetchers.set(m,C5)}let G2=QU(e6);if(G2)return x2(n6,G2.result,!1,{preventScrollReset:S0});if(G2=QU(D1),G2)return N0.add(G2.key),x2(n6,G2.result,!1,{preventScrollReset:S0});let{loaderData:N9,errors:W8}=Kj(j,S7,e6,void 0,l4,D1);if(Y0(g2),j.navigation.state==="loading"&&g2>f)G1(g,"Expected pending action"),o&&o.abort(),Q5(j.navigation.location,{matches:S7,loaderData:N9,errors:W8,fetchers:new Map(j.fetchers)});else C1({errors:W8,loaderData:Bj(j.loaderData,N9,S7,W8),fetchers:new Map(j.fetchers)}),Z0=!1}async function c4(m,t,B0,_0,P0,f0,y0,S0,c0){let r0=j.fetchers.get(m);v5(m,uK(c0,r0?r0.data:void 0),{flushSync:y0});let J1=new AbortController,d0=oQ(Z.history,B0,J1.signal);if(f0){let t1=await e5(_0,new URL(d0.url).pathname,d0.signal,m);if(t1.type==="aborted")return;else if(t1.type==="error"){$2(m,t,t1.error,{flushSync:y0});return}else if(!t1.matches){$2(m,t,z6(404,{pathname:B0}),{flushSync:y0});return}else _0=t1.matches}let p1=KU(_0,B0);n.set(m,J1);let c1=z0,k5=tQ(B,W,d0,_0,p1,z,P0),h2=(await V6(d0,k5,P0,m))[p1.route.id];if(n.get(m)===J1)n.delete(m);if(d0.signal.aborted)return;if(i0.has(m)){v5(m,k8(void 0));return}if(yY(h2))if(f>c1){v5(m,k8(void 0));return}else{N0.add(m),await x2(d0,h2,!1,{preventScrollReset:S0});return}if(j4(h2)){$2(m,t,h2.error);return}v5(m,k8(h2.data))}async function x2(m,t,B0,{submission:_0,fetcherSubmission:P0,preventScrollReset:f0,replace:y0}={}){if(!B0)s?.resolve(),s=null;if(t.response.headers.has("X-Remix-Revalidate"))Z0=!0;let S0=t.response.headers.get("Location");G1(S0,"Expected a Location header on the redirect Response"),S0=zj(S0,new URL(m.url),M,Z.history);let c0=rK(j.location,S0,{_isRedirect:!0});if(Q){let k5=!1;if(t.response.headers.has("X-Remix-Reload-Document"))k5=!0;else if($U(S0)){let Z2=Vj(S0,!0);k5=Z2.origin!==Y.location.origin||y4(Z2.pathname,M)==null}if(k5){if(y0)Y.location.replace(S0);else Y.location.assign(S0);return}}o=null;let r0=y0===!0||t.response.headers.has("X-Remix-Replace")?"REPLACE":"PUSH",{formMethod:J1,formAction:d0,formEncType:p1}=j.navigation;if(!_0&&!P0&&J1&&d0&&p1)_0=Gj(j.navigation);let c1=_0||P0;if(Ks.has(t.response.status)&&c1&&P7(c1.formMethod))await w1(r0,c0,{submission:{...c1,formAction:S0},preventScrollReset:f0||k,enableViewTransition:B0?X0:void 0});else{let k5=dF(c0,_0);await w1(r0,c0,{overrideNavigation:k5,fetcherSubmission:P0,preventScrollReset:f0||k,enableViewTransition:B0?X0:void 0})}}async function V6(m,t,B0,_0){let P0,f0={};try{P0=await ws(w,m,t,_0,B0,!1)}catch(y0){return t.filter((S0)=>S0.shouldLoad).forEach((S0)=>{f0[S0.route.id]={type:"error",error:y0}}),f0}if(m.signal.aborted)return f0;if(!P7(m.method))for(let y0 of t){if(P0[y0.route.id]?.type==="error")break;if(!P0.hasOwnProperty(y0.route.id)&&!j.loaderData.hasOwnProperty(y0.route.id)&&(!j.errors||!j.errors.hasOwnProperty(y0.route.id))&&y0.shouldCallHandler())P0[y0.route.id]={type:"error",result:Error(`No result returned from dataStrategy for route ${y0.route.id}`)}}for(let[y0,S0]of Object.entries(P0))if(Ts(S0)){let c0=S0.result;f0[y0]={type:"redirect",response:Fs(c0,m,y0,t,M)}}else f0[y0]=await _s(S0);return f0}async function R6(m,t,B0,_0){let P0=V6(B0,m,_0,null),f0=Promise.all(t.map(async(c0)=>{if(c0.matches&&c0.match&&c0.request&&c0.controller){let J1=(await V6(c0.request,c0.matches,_0,c0.key))[c0.match.route.id];return{[c0.key]:J1}}else return Promise.resolve({[c0.key]:{type:"error",error:z6(404,{pathname:c0.path})}})})),y0=await P0,S0=(await f0).reduce((c0,r0)=>Object.assign(c0,r0),{});return{loaderResults:y0,fetcherResults:S0}}function Z7(){Z0=!0,M0.forEach((m,t)=>{if(n.has(t))$0.add(t);Y7(t)})}function v5(m,t,B0={}){j.fetchers.set(m,t),C1({fetchers:new Map(j.fetchers)},{flushSync:(B0&&B0.flushSync)===!0})}function $2(m,t,B0,_0={}){let P0=XZ(j.matches,t);Z4(m),C1({errors:{[P0.route.id]:B0},fetchers:new Map(j.fetchers)},{flushSync:(_0&&_0.flushSync)===!0})}function N4(m){if(I0.set(m,(I0.get(m)||0)+1),i0.has(m))i0.delete(m);return j.fetchers.get(m)||ZA}function f2(m,t){Y7(m,t?.reason),v5(m,k8(null))}function Z4(m){let t=j.fetchers.get(m);if(n.has(m)&&!(t&&t.state==="loading"&&q0.has(m)))Y7(m);M0.delete(m),q0.delete(m),N0.delete(m),i0.delete(m),$0.delete(m),j.fetchers.delete(m)}function L6(m){let t=(I0.get(m)||0)-1;if(t<=0)I0.delete(m),i0.add(m);else I0.set(m,t);C1({fetchers:new Map(j.fetchers)})}function Y7(m,t){let B0=n.get(m);if(B0)B0.abort(t),n.delete(m)}function I7(m){for(let t of m){let B0=N4(t),_0=k8(B0.data);j.fetchers.set(t,_0)}}function y(){let m=[],t=!1;for(let B0 of N0){let _0=j.fetchers.get(B0);if(G1(_0,`Expected fetcher: ${B0}`),_0.state==="loading")N0.delete(B0),m.push(B0),t=!0}return I7(m),t}function Y0(m){let t=[];for(let[B0,_0]of q0)if(_00}function F0(m,t){let B0=j.blockers.get(m)||sQ;if(H0.get(m)!==t)H0.set(m,t);return B0}function L0(m){j.blockers.delete(m),H0.delete(m)}function k0(m,t){let B0=j.blockers.get(m)||sQ;G1(B0.state==="unblocked"&&t.state==="blocked"||B0.state==="blocked"&&t.state==="blocked"||B0.state==="blocked"&&t.state==="proceeding"||B0.state==="blocked"&&t.state==="unblocked"||B0.state==="proceeding"&&t.state==="unblocked",`Invalid blocker state transition: ${B0.state} -> ${t.state}`);let _0=new Map(j.blockers);_0.set(m,t),C1({blockers:_0})}function Y1({currentLocation:m,nextLocation:t,historyAction:B0}){if(H0.size===0)return;if(H0.size>1)h5(!1,"A router only supports one blocker at a time");let _0=Array.from(H0.entries()),[P0,f0]=_0[_0.length-1],y0=j.blockers.get(P0);if(y0&&y0.state==="proceeding")return;if(f0({currentLocation:m,nextLocation:t,historyAction:B0}))return P0}function x0(m){let t=z6(404,{pathname:m}),B0=U||$,{matches:_0,route:P0}=JU(B0);return{notFoundMatches:_0,route:P0,error:t}}function Q1(m,t,B0){if(P=m,v=t,R=B0||null,!L&&j.navigation===qU){L=!0;let _0=q5(j.location,j.matches);if(_0!=null)C1({restoreScrollPosition:_0})}return()=>{P=null,v=null,R=null}}function j0(m,t){if(R)return R(m,t.map((_0)=>Rj(_0,j.loaderData)))||m.key;return m.key}function O5(m,t){if(P&&v){let B0=j0(m,t);P[B0]=v()}}function q5(m,t){if(P){let B0=j0(m,t),_0=P[B0];if(typeof _0==="number")return _0}return null}function _5(m,t,B0){if(Z.patchRoutesOnNavigation){if(!m)return{active:!0,matches:dK(t,B0,M,!0)||[]};else if(Object.keys(m[0].params).length>0)return{active:!0,matches:dK(t,B0,M,!0)}}return{active:!1,matches:null}}async function e5(m,t,B0,_0){if(!Z.patchRoutesOnNavigation)return{type:"success",matches:m};let P0=m;while(!0){let f0=U==null,y0=U||$,S0=W;try{await Z.patchRoutesOnNavigation({signal:B0,path:t,matches:P0,fetcherKey:_0,patch:(J1,d0)=>{if(B0.aborted)return;Yj(J1,d0,y0,S0,B,!1)}})}catch(J1){return{type:"error",error:J1,partialMatches:P0}}finally{if(f0&&!B0.aborted)$=[...$]}if(B0.aborted)return{type:"aborted"};let c0=x8(y0,t,M),r0=null;if(c0){if(Object.keys(c0[0].params).length===0)return{type:"success",matches:c0};else if(r0=dK(y0,t,M,!0),!(r0&&P0.lengthB0.route.id===t[_0].route.id)}function S5(m){W={},U=aK(m,B,void 0,W)}function j7(m,t,B0=!1){let _0=U==null;if(Yj(m,t,U||$,W,B,B0),_0)$=[...$],C1({})}if(S={get basename(){return M},get future(){return O},get state(){return j},get routes(){return $},get window(){return Y},initialize:L1,subscribe:R0,enableScrollRestoration:Q1,navigate:n5,fetch:P6,revalidate:N5,createHref:(m)=>Z.history.createHref(m),encodeLocation:(m)=>Z.history.encodeLocation(m),getFetcher:N4,resetFetcher:f2,deleteFetcher:L6,dispose:B1,getBlocker:F0,deleteBlocker:L0,patchRoutes:j7,_internalFetchControllers:n,_internalSetRoutes:S5,_internalSetStateDoNotUseOrYouWillBreakYourApp(m){C1(m)}},Z.unstable_instrumentations)S=ea(S,Z.unstable_instrumentations.map((m)=>m.router).filter(Boolean));return S}function Ws(Z){return Z!=null&&(("formData"in Z)&&Z.formData!=null||("body"in Z)&&Z.body!==void 0)}function sF(Z,Y,Q,z,q,B){let W,$;if(q){W=[];for(let M of Y)if(W.push(M),M.route.id===q){$=M;break}}else W=Y,$=Y[Y.length-1];let U=UU(z?z:".",GU(W),y4(Z.pathname,Q)||Z.pathname,B==="path");if(z==null)U.search=Z.search,U.hash=Z.hash;if((z==null||z===""||z===".")&&$){let M=QA(U.search);if($.route.index&&!M)U.search=U.search?U.search.replace(/^\?/,"?index&"):"?index";else if(!$.route.index&&M){let w=new URLSearchParams(U.search),O=w.getAll("index");w.delete("index"),O.filter((F)=>F).forEach((F)=>w.append("index",F));let _=w.toString();U.search=_?`?${_}`:""}}if(Q!=="/")U.pathname=sa({basename:Q,pathname:U.pathname});return f6(U)}function eI(Z,Y,Q){if(!Q||!Ws(Q))return{path:Y};if(Q.formMethod&&!Ds(Q.formMethod))return{path:Y,error:z6(405,{method:Q.formMethod})};let z=()=>({path:Y,error:z6(400,{type:"invalid-body"})}),B=(Q.formMethod||"get").toUpperCase(),W=pj(Y);if(Q.body!==void 0){if(Q.formEncType==="text/plain"){if(!P7(B))return z();let O=typeof Q.body==="string"?Q.body:Q.body instanceof FormData||Q.body instanceof URLSearchParams?Array.from(Q.body.entries()).reduce((_,[F,P])=>`${_}${F}=${P} `,""):String(Q.body);return{path:Y,submission:{formMethod:B,formAction:W,formEncType:Q.formEncType,formData:void 0,json:void 0,text:O}}}else if(Q.formEncType==="application/json"){if(!P7(B))return z();try{let O=typeof Q.body==="string"?JSON.parse(Q.body):Q.body;return{path:Y,submission:{formMethod:B,formAction:W,formEncType:Q.formEncType,formData:void 0,json:O,text:void 0}}}catch(O){return z()}}}G1(typeof FormData==="function","FormData is not available in this environment");let $,U;if(Q.formData)$=tF(Q.formData),U=Q.formData;else if(Q.body instanceof FormData)$=tF(Q.body),U=Q.body;else if(Q.body instanceof URLSearchParams)$=Q.body,U=qj($);else if(Q.body==null)$=new URLSearchParams,U=new FormData;else try{$=new URLSearchParams(Q.body),U=qj($)}catch(O){return z()}let M={formMethod:B,formAction:W,formEncType:Q&&Q.formEncType||"application/x-www-form-urlencoded",formData:U,json:void 0,text:void 0};if(P7(M.formMethod))return{path:Y,submission:M};let w=j3(Y);if(Z&&w.search&&QA(w.search))$.append("index","");return w.search=`?${$}`,{path:f6(w),submission:M}}function Zj(Z,Y,Q,z,q,B,W,$,U,M,w,O,_,F,P,R,v,L,T,C,E){let b=C?j4(C[1])?C[1].error:C[1].data:void 0,S=q.createURL(B.location),j=q.createURL(U),g;if(w&&B.errors){let c=Object.keys(B.errors)[0];g=W.findIndex((Z0)=>Z0.route.id===c)}else if(C&&j4(C[1])){let c=C[0];g=W.findIndex((Z0)=>Z0.route.id===c)-1}let s=C?C[1].statusCode:void 0,k=s&&s>=400,o={currentUrl:S,currentParams:B.matches[0]?.params||{},nextUrl:j,nextParams:W[0].params,...$,actionResult:b,actionStatus:s},X0=oK(W),W0=W.map((c,Z0)=>{let{route:$0}=c,n=null;if(g!=null&&Z0>g)n=!1;else if($0.lazy)n=!0;else if(!YA($0))n=!1;else if(w)n=oF($0,B.loaderData,B.errors);else if($s(B.loaderData,B.matches[Z0],c))n=!0;if(n!==null)return iF(Q,z,Z,X0,c,M,Y,n);let z0=!1;if(typeof E==="boolean")z0=E;else if(k)z0=!1;else if(O)z0=!0;else if(S.pathname+S.search===j.pathname+j.search)z0=!0;else if(S.search!==j.search)z0=!0;else if(Gs(B.matches[Z0],c))z0=!0;let f={...o,defaultShouldRevalidate:z0},q0=lK(c,f);return iF(Q,z,Z,X0,c,M,Y,q0,f,E)}),e=[];return P.forEach((c,Z0)=>{if(w||!W.some((I0)=>I0.route.id===c.routeId)||F.has(Z0))return;let $0=B.fetchers.get(Z0),n=$0&&$0.state!=="idle"&&$0.data===void 0,z0=x8(v,c.path,L);if(!z0){if(T&&n)return;e.push({key:Z0,routeId:c.routeId,path:c.path,matches:null,match:null,request:null,controller:null});return}if(R.has(Z0))return;let f=KU(z0,c.path),q0=new AbortController,N0=oQ(q,c.path,q0.signal),M0=null;if(_.has(Z0))_.delete(Z0),M0=tQ(Q,z,N0,z0,f,M,Y);else if(n){if(O)M0=tQ(Q,z,N0,z0,f,M,Y)}else{let I0;if(typeof E==="boolean")I0=E;else if(k)I0=!1;else I0=O;let i0={...o,defaultShouldRevalidate:I0};if(lK(f,i0))M0=tQ(Q,z,N0,z0,f,M,Y,i0)}if(M0)e.push({key:Z0,routeId:c.routeId,path:c.path,matches:M0,match:f,request:N0,controller:q0})}),{dsMatches:W0,revalidatingFetchers:e}}function YA(Z){return Z.loader!=null||Z.middleware!=null&&Z.middleware.length>0}function oF(Z,Y,Q){if(Z.lazy)return!0;if(!YA(Z))return!1;let z=Y!=null&&Z.id in Y,q=Q!=null&&Q[Z.id]!==void 0;if(!z&&q)return!1;if(typeof Z.loader==="function"&&Z.loader.hydrate===!0)return!0;return!z&&!q}function $s(Z,Y,Q){let z=!Y||Q.route.id!==Y.route.id,q=!Z.hasOwnProperty(Q.route.id);return z||q}function Gs(Z,Y){let Q=Z.route.path;return Z.pathname!==Y.pathname||Q!=null&&Q.endsWith("*")&&Z.params["*"]!==Y.params["*"]}function lK(Z,Y){if(Z.route.shouldRevalidate){let Q=Z.route.shouldRevalidate(Y);if(typeof Q==="boolean")return Q}return Y.defaultShouldRevalidate}function Yj(Z,Y,Q,z,q,B){let W;if(Z){let M=z[Z];if(G1(M,`No route found to patch children into: routeId = ${Z}`),!M.children)M.children=[];W=M.children}else W=Q;let $=[],U=[];if(Y.forEach((M)=>{let w=W.find((O)=>fj(M,O));if(w)U.push({existingRoute:w,newRoute:M});else $.push(M)}),$.length>0){let M=aK($,q,[Z||"_","patch",String(W?.length||"0")],z);W.push(...M)}if(B&&U.length>0)for(let M=0;MY.children?.some((q)=>fj(Q,q)))}var Jj=new WeakMap,hj=({key:Z,route:Y,manifest:Q,mapRouteProperties:z})=>{let q=Q[Y.id];if(G1(q,"No route found in manifest"),!q.lazy||typeof q.lazy!=="object")return;let B=q.lazy[Z];if(!B)return;let W=Jj.get(q);if(!W)W={},Jj.set(q,W);let $=W[Z];if($)return $;let U=(async()=>{let M=ja(Z),O=q[Z]!==void 0&&Z!=="hasErrorBoundary";if(M)h5(!M,"Route property "+Z+" is not a supported lazy route property. This property will be ignored."),W[Z]=Promise.resolve();else if(O)h5(!1,`Route "${q.id}" has a static property "${Z}" defined. The lazy property will be ignored.`);else{let _=await B();if(_!=null)Object.assign(q,{[Z]:_}),Object.assign(q,z(q))}if(typeof q.lazy==="object"){if(q.lazy[Z]=void 0,Object.values(q.lazy).every((_)=>_===void 0))q.lazy=void 0}})();return W[Z]=U,U},Qj=new WeakMap;function Us(Z,Y,Q,z,q){let B=Q[Z.id];if(G1(B,"No route found in manifest"),!Z.lazy)return{lazyRoutePromise:void 0,lazyHandlerPromise:void 0};if(typeof Z.lazy==="function"){let w=Qj.get(B);if(w)return{lazyRoutePromise:w,lazyHandlerPromise:w};let O=(async()=>{G1(typeof Z.lazy==="function","No lazy route function found");let _=await Z.lazy(),F={};for(let P in _){let R=_[P];if(R===void 0)continue;let v=Sa(P),T=B[P]!==void 0&&P!=="hasErrorBoundary";if(v)h5(!v,"Route property "+P+" is not a supported property to be returned from a lazy route function. This property will be ignored.");else if(T)h5(!T,`Route "${B.id}" has a static property "${P}" defined but its lazy function is also returning a value for this property. The lazy route property "${P}" will be ignored.`);else F[P]=R}Object.assign(B,F),Object.assign(B,{...z(B),lazy:void 0})})();return Qj.set(B,O),O.catch(()=>{}),{lazyRoutePromise:O,lazyHandlerPromise:O}}let W=Object.keys(Z.lazy),$=[],U=void 0;for(let w of W){if(q&&q.includes(w))continue;let O=hj({key:w,route:Z,manifest:Q,mapRouteProperties:z});if(O){if($.push(O),w===Y)U=O}}let M=$.length>0?Promise.all($).then(()=>{}):void 0;return M?.catch(()=>{}),U?.catch(()=>{}),{lazyRoutePromise:M,lazyHandlerPromise:U}}async function Xj(Z){let Y=Z.matches.filter((q)=>q.shouldLoad),Q={};return(await Promise.all(Y.map((q)=>q.resolve()))).forEach((q,B)=>{Q[Y[B].route.id]=q}),Q}async function Ms(Z){if(!Z.matches.some((Y)=>Y.route.middleware))return Xj(Z);return gj(Z,()=>Xj(Z))}function gj(Z,Y){return Hs(Z,Y,(z)=>{if(Cs(z))throw z;return z},Rs,Q);function Q(z,q,B){if(B)return Promise.resolve(Object.assign(B.value,{[q]:{type:"error",result:z}}));else{let{matches:W}=Z,$=Math.min(Math.max(W.findIndex((M)=>M.route.id===q),0),Math.max(W.findIndex((M)=>M.shouldCallHandler()),0)),U=XZ(W,W[$].route.id).route.id;return Promise.resolve({[U]:{type:"error",result:z}})}}}async function Hs(Z,Y,Q,z,q){let{matches:B,request:W,params:$,context:U,unstable_pattern:M}=Z,w=B.flatMap((_)=>_.route.middleware?_.route.middleware.map((F)=>[_.route.id,F]):[]);return await mj({request:W,params:$,context:U,unstable_pattern:M},w,Y,Q,z,q)}async function mj(Z,Y,Q,z,q,B,W=0){let{request:$}=Z;if($.signal.aborted)throw $.signal.reason??Error(`Request aborted: ${$.method} ${$.url}`);let U=Y[W];if(!U)return await Q();let[M,w]=U,O,_=async()=>{if(O)throw Error("You may only call `next()` once per middleware");try{return O={value:await mj(Z,Y,Q,z,q,B,W+1)},O.value}catch(F){return O={value:await B(F,M,O)},O.value}};try{let F=await w(Z,_),P=F!=null?z(F):void 0;if(q(P))return P;else if(O)return P??O.value;else return O={value:await _()},O.value}catch(F){return await B(F,M,O)}}function uj(Z,Y,Q,z,q){let B=hj({key:"middleware",route:z.route,manifest:Y,mapRouteProperties:Z}),W=Us(z.route,P7(Q.method)?"action":"loader",Y,Z,q);return{middleware:B,route:W.lazyRoutePromise,handler:W.lazyHandlerPromise}}function iF(Z,Y,Q,z,q,B,W,$,U=null,M){let w=!1,O=uj(Z,Y,Q,q,B);return{...q,_lazyPromises:O,shouldLoad:$,shouldRevalidateArgs:U,shouldCallHandler(_){if(w=!0,!U)return $;if(typeof M==="boolean")return lK(q,{...U,defaultShouldRevalidate:M});if(typeof _==="boolean")return lK(q,{...U,defaultShouldRevalidate:_});return lK(q,U)},resolve(_){let{lazy:F,loader:P,middleware:R}=q.route,v=w||$||_&&!P7(Q.method)&&(F||P),L=R&&R.length>0&&!P&&!F;if(v&&(P7(Q.method)||!L))return Ns({request:Q,unstable_pattern:z,match:q,lazyHandlerPromise:O?.handler,lazyRoutePromise:O?.route,handlerOverride:_,scopedContext:W});return Promise.resolve({type:"data",result:void 0})}}}function tQ(Z,Y,Q,z,q,B,W,$=null){return z.map((U)=>{if(U.route.id!==q.route.id)return{...U,shouldLoad:!1,shouldRevalidateArgs:$,shouldCallHandler:()=>!1,_lazyPromises:uj(Z,Y,Q,U,B),resolve:()=>Promise.resolve({type:"data",result:void 0})};return iF(Z,Y,Q,oK(z),U,B,W,!0,$)})}async function ws(Z,Y,Q,z,q,B){if(Q.some((M)=>M._lazyPromises?.middleware))await Promise.all(Q.map((M)=>M._lazyPromises?.middleware));let W={request:Y,unstable_pattern:oK(Q),params:Q[0].params,context:q,matches:Q},U=await Z({...W,fetcherKey:z,runClientMiddleware:B?()=>{throw Error("You cannot call `runClientMiddleware()` from a static handler `dataStrategy`. Middleware is run outside of `dataStrategy` during SSR in order to bubble up the Response. You can enable middleware via the `respond` API in `query`/`queryRoute`")}:(M)=>{let w=W;return gj(w,()=>{return M({...w,fetcherKey:z,runClientMiddleware:()=>{throw Error("Cannot call `runClientMiddleware()` from within an `runClientMiddleware` handler")}})})}});try{await Promise.all(Q.flatMap((M)=>[M._lazyPromises?.handler,M._lazyPromises?.route]))}catch(M){}return U}async function Ns({request:Z,unstable_pattern:Y,match:Q,lazyHandlerPromise:z,lazyRoutePromise:q,handlerOverride:B,scopedContext:W}){let $,U,M=P7(Z.method),w=M?"action":"loader",O=(_)=>{let F,P=new Promise((L,T)=>F=T);U=()=>F(),Z.signal.addEventListener("abort",U);let R=(L)=>{if(typeof _!=="function")return Promise.reject(Error(`You cannot call the handler for a route which defines a boolean "${w}" [routeId: ${Q.route.id}]`));return _({request:Z,unstable_pattern:Y,params:Q.params,context:W},...L!==void 0?[L]:[])},v=(async()=>{try{return{type:"data",result:await(B?B((T)=>R(T)):R())}}catch(L){return{type:"error",result:L}}})();return Promise.race([v,P])};try{let _=M?Q.route.action:Q.route.loader;if(z||q)if(_){let F,[P]=await Promise.all([O(_).catch((R)=>{F=R}),z,q]);if(F!==void 0)throw F;$=P}else{await z;let F=M?Q.route.action:Q.route.loader;if(F)[$]=await Promise.all([O(F),q]);else if(w==="action"){let P=new URL(Z.url),R=P.pathname+P.search;throw z6(405,{method:Z.method,pathname:R,routeId:Q.route.id})}else return{type:"data",result:void 0}}else if(!_){let F=new URL(Z.url),P=F.pathname+F.search;throw z6(404,{pathname:P})}else $=await O(_)}catch(_){return{type:"error",result:_}}finally{if(U)Z.signal.removeEventListener("abort",U)}return $}async function Os(Z){let Y=Z.headers.get("Content-Type");if(Y&&/\bapplication\/json\b/.test(Y))return Z.body==null?null:Z.json();return Z.text()}async function _s(Z){let{result:Y,type:Q}=Z;if(JA(Y)){let z;try{z=await Os(Y)}catch(q){return{type:"error",error:q}}if(Q==="error")return{type:"error",error:new eQ(Y.status,Y.statusText,z),statusCode:Y.status,headers:Y.headers};return{type:"data",data:z,statusCode:Y.status,headers:Y.headers}}if(Q==="error"){if($j(Y)){if(Y.data instanceof Error)return{type:"error",error:Y.data,statusCode:Y.init?.status,headers:Y.init?.headers?new Headers(Y.init.headers):void 0};return{type:"error",error:Vs(Y),statusCode:I3(Y)?Y.status:void 0,headers:Y.init?.headers?new Headers(Y.init.headers):void 0}}return{type:"error",error:Y,statusCode:I3(Y)?Y.status:void 0}}if($j(Y))return{type:"data",data:Y.data,statusCode:Y.init?.status,headers:Y.init?.headers?new Headers(Y.init.headers):void 0};return{type:"data",data:Y}}function Fs(Z,Y,Q,z,q){let B=Z.headers.get("Location");if(G1(B,"Redirects returned/thrown from loaders/actions must have a Location header"),!$U(B)){let W=z.slice(0,z.findIndex(($)=>$.route.id===Q)+1);B=sF(new URL(Y.url),W,q,B),Z.headers.set("Location",B)}return Z}function zj(Z,Y,Q,z){let q=["about:","blob:","chrome:","chrome-untrusted:","content:","data:","devtools:","file:","filesystem:","javascript:"];if($U(Z)){let B=Z,W=B.startsWith("//")?new URL(Y.protocol+B):new URL(B);if(q.includes(W.protocol))throw Error("Invalid redirect location");let $=y4(W.pathname,Q)!=null;if(W.origin===Y.origin&&$)return W.pathname+W.search+W.hash}try{let B=z.createURL(Z);if(q.includes(B.protocol))throw Error("Invalid redirect location")}catch(B){}return Z}function oQ(Z,Y,Q,z){let q=Z.createURL(pj(Y)).toString(),B={signal:Q};if(z&&P7(z.formMethod)){let{formMethod:W,formEncType:$}=z;if(B.method=W.toUpperCase(),$==="application/json")B.headers=new Headers({"Content-Type":$}),B.body=JSON.stringify(z.json);else if($==="text/plain")B.body=z.text;else if($==="application/x-www-form-urlencoded"&&z.formData)B.body=tF(z.formData);else B.body=z.formData}return new Request(q,B)}function tF(Z){let Y=new URLSearchParams;for(let[Q,z]of Z.entries())Y.append(Q,typeof z==="string"?z:z.name);return Y}function qj(Z){let Y=new FormData;for(let[Q,z]of Z.entries())Y.append(Q,z);return Y}function As(Z,Y,Q,z=!1,q=!1){let B={},W=null,$,U=!1,M={},w=Q&&j4(Q[1])?Q[1].error:void 0;if(Z.forEach((O)=>{if(!(O.route.id in Y))return;let _=O.route.id,F=Y[_];if(G1(!yY(F),"Cannot handle redirect results in processLoaderData"),j4(F)){let P=F.error;if(w!==void 0)P=w,w=void 0;if(W=W||{},q)W[_]=P;else{let R=XZ(Z,_);if(W[R.route.id]==null)W[R.route.id]=P}if(!z)B[_]=kj;if(!U)U=!0,$=I3(F.error)?F.error.status:500;if(F.headers)M[_]=F.headers}else{if(B[_]=F.data,F.statusCode&&F.statusCode!==200&&!U)$=F.statusCode;if(F.headers)M[_]=F.headers}}),w!==void 0&&Q){if(W={[Q[0]]:w},Q[2])B[Q[2]]=void 0}return{loaderData:B,errors:W,statusCode:$||200,loaderHeaders:M}}function Kj(Z,Y,Q,z,q,B){let{loaderData:W,errors:$}=As(Y,Q,z);return q.filter((U)=>!U.matches||U.matches.some((M)=>M.shouldLoad)).forEach((U)=>{let{key:M,match:w,controller:O}=U;if(O&&O.signal.aborted)return;let _=B[M];if(G1(_,"Did not find corresponding fetcher result"),j4(_)){let F=XZ(Z.matches,w?.route.id);if(!($&&$[F.route.id]))$={...$,[F.route.id]:_.error};Z.fetchers.delete(M)}else if(yY(_))G1(!1,"Unhandled fetcher revalidation redirect");else{let F=k8(_.data);Z.fetchers.set(M,F)}}),{loaderData:W,errors:$}}function Bj(Z,Y,Q,z){let q=Object.entries(Y).filter(([,B])=>B!==kj).reduce((B,[W,$])=>{return B[W]=$,B},{});for(let B of Q){let W=B.route.id;if(!Y.hasOwnProperty(W)&&Z.hasOwnProperty(W)&&B.route.loader)q[W]=Z[W];if(z&&z.hasOwnProperty(W))break}return q}function Wj(Z){if(!Z)return{};return j4(Z[1])?{actionData:{}}:{actionData:{[Z[0]]:Z[1].data}}}function XZ(Z,Y){return(Y?Z.slice(0,Z.findIndex((z)=>z.route.id===Y)+1):[...Z]).reverse().find((z)=>z.route.hasErrorBoundary===!0)||Z[0]}function JU(Z){let Y=Z.length===1?Z[0]:Z.find((Q)=>Q.index||!Q.path||Q.path==="/")||{id:"__shim-error-route__"};return{matches:[{params:{},pathname:"",pathnameBase:"",route:Y}],route:Y}}function z6(Z,{pathname:Y,routeId:Q,method:z,type:q,message:B}={}){let W="Unknown Server Error",$="Unknown @remix-run/router error";if(Z===400){if(W="Bad Request",z&&Y&&Q)$=`You made a ${z} request to "${Y}" but did not provide a \`loader\` for route "${Q}", so there is no way to handle the request.`;else if(q==="invalid-body")$="Unable to encode submission body"}else if(Z===403)W="Forbidden",$=`Route "${Q}" does not match URL "${Y}"`;else if(Z===404)W="Not Found",$=`No route matches URL "${Y}"`;else if(Z===405){if(W="Method Not Allowed",z&&Y&&Q)$=`You made a ${z.toUpperCase()} request to "${Y}" but did not provide an \`action\` for route "${Q}", so there is no way to handle the request.`;else if(z)$=`Invalid request method "${z.toUpperCase()}"`}return new eQ(Z||500,W,Error($),!0)}function QU(Z){let Y=Object.entries(Z);for(let Q=Y.length-1;Q>=0;Q--){let[z,q]=Y[Q];if(yY(q))return{key:z,result:q}}}function pj(Z){let Y=typeof Z==="string"?j3(Z):Z;return f6({...Y,hash:""})}function Ps(Z,Y){if(Z.pathname!==Y.pathname||Z.search!==Y.search)return!1;if(Z.hash==="")return Y.hash!=="";else if(Z.hash===Y.hash)return!0;else if(Y.hash!=="")return!0;return!1}function Vs(Z){return new eQ(Z.init?.status??500,Z.init?.statusText??"Internal Server Error",Z.data)}function Rs(Z){return Z!=null&&typeof Z==="object"&&Object.entries(Z).every(([Y,Q])=>typeof Y==="string"&&Ls(Q))}function Ls(Z){return Z!=null&&typeof Z==="object"&&"type"in Z&&"result"in Z&&(Z.type==="data"||Z.type==="error")}function Ts(Z){return JA(Z.result)&&yj.has(Z.result.status)}function j4(Z){return Z.type==="error"}function yY(Z){return(Z&&Z.type)==="redirect"}function $j(Z){return typeof Z==="object"&&Z!=null&&"type"in Z&&"data"in Z&&"init"in Z&&Z.type==="DataWithResponseInit"}function JA(Z){return Z!=null&&typeof Z.status==="number"&&typeof Z.statusText==="string"&&typeof Z.headers==="object"&&typeof Z.body<"u"}function vs(Z){return yj.has(Z)}function Cs(Z){return JA(Z)&&vs(Z.status)&&Z.headers.has("Location")}function Ds(Z){return qs.has(Z.toUpperCase())}function P7(Z){return Xs.has(Z.toUpperCase())}function QA(Z){return new URLSearchParams(Z).getAll("index").some((Y)=>Y==="")}function KU(Z,Y){let Q=typeof Y==="string"?j3(Y).search:Y.search;if(Z[Z.length-1].route.index&&QA(Q||""))return Z[Z.length-1];let z=Dj(Z);return z[z.length-1]}function Gj(Z){let{formMethod:Y,formAction:Q,formEncType:z,text:q,formData:B,json:W}=Z;if(!Y||!Q||!z)return;if(q!=null)return{formMethod:Y,formAction:Q,formEncType:z,formData:void 0,json:void 0,text:q};else if(B!=null)return{formMethod:Y,formAction:Q,formEncType:z,formData:B,json:void 0,text:void 0};else if(W!==void 0)return{formMethod:Y,formAction:Q,formEncType:z,formData:void 0,json:W,text:void 0}}function dF(Z,Y){if(Y)return{state:"loading",location:Z,formMethod:Y.formMethod,formAction:Y.formAction,formEncType:Y.formEncType,formData:Y.formData,json:Y.json,text:Y.text};else return{state:"loading",location:Z,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0}}function bs(Z,Y){return{state:"submitting",location:Z,formMethod:Y.formMethod,formAction:Y.formAction,formEncType:Y.formEncType,formData:Y.formData,json:Y.json,text:Y.text}}function uK(Z,Y){if(Z)return{state:"loading",formMethod:Z.formMethod,formAction:Z.formAction,formEncType:Z.formEncType,formData:Z.formData,json:Z.json,text:Z.text,data:Y};else return{state:"loading",formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0,data:Y}}function Es(Z,Y){return{state:"submitting",formMethod:Z.formMethod,formAction:Z.formAction,formEncType:Z.formEncType,formData:Z.formData,json:Z.json,text:Z.text,data:Y?Y.data:void 0}}function k8(Z){return{state:"idle",formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0,data:Z}}function Is(Z,Y){try{let Q=Z.sessionStorage.getItem(Sj);if(Q){let z=JSON.parse(Q);for(let[q,B]of Object.entries(z||{}))if(B&&Array.isArray(B))Y.set(q,new Set(B||[]))}}catch(Q){}}function js(Z,Y){if(Y.size>0){let Q={};for(let[z,q]of Y)Q[z]=[...q];try{Z.sessionStorage.setItem(Sj,JSON.stringify(Q))}catch(z){h5(!1,`Failed to save applied view transitions in sessionStorage (${z}).`)}}}function Uj(){let Z,Y,Q=new Promise((z,q)=>{Z=async(B)=>{z(B);try{await Q}catch(W){}},Y=async(B)=>{q(B);try{await Q}catch(W){}}});return{promise:Q,resolve:Z,reject:Y}}var qZ=B4.createContext(null);qZ.displayName="DataRouter";var SY=B4.createContext(null);SY.displayName="DataRouterState";var cj=B4.createContext(!1);function ys(){return B4.useContext(cj)}var HU=B4.createContext({isTransitioning:!1});HU.displayName="ViewTransition";var wU=B4.createContext(new Map);wU.displayName="Fetchers";var Ss=B4.createContext(null);Ss.displayName="Await";var V7=B4.createContext(null);V7.displayName="Navigation";var ZX=B4.createContext(null);ZX.displayName="Location";var W4=B4.createContext({outlet:null,matches:[],isDataRoute:!1});W4.displayName="Route";var XA=B4.createContext(null);XA.displayName="RouteError";var nQ=!0,dj="REACT_ROUTER_ERROR",ks="REDIRECT",xs="ROUTE_ERROR_RESPONSE";function fs(Z){if(Z.startsWith(`${dj}:${ks}:{`))try{let Y=JSON.parse(Z.slice(28));if(typeof Y==="object"&&Y&&typeof Y.status==="number"&&typeof Y.statusText==="string"&&typeof Y.location==="string"&&typeof Y.reloadDocument==="boolean"&&typeof Y.replace==="boolean")return Y}catch{}}function hs(Z){if(Z.startsWith(`${dj}:${xs}:{`))try{let Y=JSON.parse(Z.slice(40));if(typeof Y==="object"&&Y&&typeof Y.status==="number"&&typeof Y.statusText==="string")return new eQ(Y.status,Y.statusText,Y.data)}catch{}}function lj(Z,{relative:Y}={}){G1(kY(),"useHref() may be used only in the context of a component.");let{basename:Q,navigator:z}=h0.useContext(V7),{hash:q,pathname:B,search:W}=YX(Z,{relative:Y}),$=B;if(Q!=="/")$=B==="/"?Q:E3([Q,B]);return z.createHref({pathname:$,search:W,hash:q})}function kY(){return h0.useContext(ZX)!=null}function Q2(){return G1(kY(),"useLocation() may be used only in the context of a component."),h0.useContext(ZX).location}var rj="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function aj(Z){if(!h0.useContext(V7).static)h0.useLayoutEffect(Z)}function S4(){let{isDataRoute:Z}=h0.useContext(W4);return Z?os():gs()}function gs(){G1(kY(),"useNavigate() may be used only in the context of a component.");let Z=h0.useContext(qZ),{basename:Y,navigator:Q}=h0.useContext(V7),{matches:z}=h0.useContext(W4),{pathname:q}=Q2(),B=JSON.stringify(GU(z)),W=h0.useRef(!1);return aj(()=>{W.current=!0}),h0.useCallback((U,M={})=>{if(h5(W.current,rj),!W.current)return;if(typeof U==="number"){Q.go(U);return}let w=UU(U,JSON.parse(B),q,M.relative==="path");if(Z==null&&Y!=="/")w.pathname=w.pathname==="/"?Y:E3([Y,w.pathname]);(M.replace?Q.replace:Q.push)(w,M.state,M)},[Y,Q,B,q,Z])}var ms=h0.createContext(null);function sj(Z){let Y=h0.useContext(W4).outlet;return h0.useMemo(()=>Y&&h0.createElement(ms.Provider,{value:Z},Y),[Y,Z])}function K7(){let{matches:Z}=h0.useContext(W4),Y=Z[Z.length-1];return Y?Y.params:{}}function YX(Z,{relative:Y}={}){let{matches:Q}=h0.useContext(W4),{pathname:z}=Q2(),q=JSON.stringify(GU(Q));return h0.useMemo(()=>UU(Z,JSON.parse(q),z,Y==="path"),[Z,q,z,Y])}function us(Z,Y,Q,z,q){G1(kY(),"useRoutes() may be used only in the context of a component.");let{navigator:B}=h0.useContext(V7),{matches:W}=h0.useContext(W4),$=W[W.length-1],U=$?$.params:{},M=$?$.pathname:"/",w=$?$.pathnameBase:"/",O=$&&$.route;if(nQ){let T=O&&O.path||"";tj(M,!O||T.endsWith("*")||T.endsWith("*?"),`You rendered descendant (or called \`useRoutes()\`) at "${M}" (under ) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render. -Please change the parent to .`)}let _=Q2(),F;if(Y){let T=typeof Y==="string"?j3(Y):Y;G1(w==="/"||T.pathname?.startsWith(w),`When overriding the location using \`\` or \`useRoutes(routes, location)\`, the location pathname must begin with the portion of the URL pathname that was matched by all parent routes. The current pathname base is "${w}" but pathname "${T.pathname}" was given in the \`location\` prop.`),F=T}else F=_;let P=F.pathname||"/",R=P;if(w!=="/"){let T=w.replace(/^\//,"").split("/");R="/"+P.replace(/^\//,"").split("/").slice(T.length).join("/")}let v=x8(Z,{pathname:R});if(nQ)h5(O||v!=null,`No routes matched location "${F.pathname}${F.search}${F.hash}" `),h5(v==null||v[v.length-1].route.element!==void 0||v[v.length-1].route.Component!==void 0||v[v.length-1].route.lazy!==void 0,`Matched leaf route at location "${F.pathname}${F.search}${F.hash}" does not have an element or Component. This means it will render an with a null value by default resulting in an "empty" page.`);let L=rs(v&&v.map((T)=>Object.assign({},T,{params:Object.assign({},U,T.params),pathname:E3([w,B.encodeLocation?B.encodeLocation(T.pathname.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:T.pathname]),pathnameBase:T.pathnameBase==="/"?w:E3([w,B.encodeLocation?B.encodeLocation(T.pathnameBase.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:T.pathnameBase])})),W,Q,z,q);if(Y&&L)return h0.createElement(ZX.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",...F},navigationType:"POP"}},L);return L}function ps(){let Z=OU(),Y=I3(Z)?`${Z.status} ${Z.statusText}`:Z instanceof Error?Z.message:JSON.stringify(Z),Q=Z instanceof Error?Z.stack:null,z="rgba(200,200,200, 0.5)",q={padding:"0.5rem",backgroundColor:z},B={padding:"2px 4px",backgroundColor:z},W=null;if(nQ)console.error("Error handled by React Router default ErrorBoundary:",Z),W=h0.createElement(h0.Fragment,null,h0.createElement("p",null,"\uD83D\uDCBF Hey developer \uD83D\uDC4B"),h0.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",h0.createElement("code",{style:B},"ErrorBoundary")," or"," ",h0.createElement("code",{style:B},"errorElement")," prop on your route."));return h0.createElement(h0.Fragment,null,h0.createElement("h2",null,"Unexpected Application Error!"),h0.createElement("h3",{style:{fontStyle:"italic"}},Y),Q?h0.createElement("pre",{style:q},Q):null,W)}var cs=h0.createElement(ps,null),oj=class extends h0.Component{constructor(Z){super(Z);this.state={location:Z.location,revalidation:Z.revalidation,error:Z.error}}static getDerivedStateFromError(Z){return{error:Z}}static getDerivedStateFromProps(Z,Y){if(Y.location!==Z.location||Y.revalidation!=="idle"&&Z.revalidation==="idle")return{error:Z.error,location:Z.location,revalidation:Z.revalidation};return{error:Z.error!==void 0?Z.error:Y.error,location:Y.location,revalidation:Z.revalidation||Y.revalidation}}componentDidCatch(Z,Y){if(this.props.onError)this.props.onError(Z,Y);else console.error("React Router caught the following error during render",Z)}render(){let Z=this.state.error;if(this.context&&typeof Z==="object"&&Z&&"digest"in Z&&typeof Z.digest==="string"){let Q=hs(Z.digest);if(Q)Z=Q}let Y=Z!==void 0?h0.createElement(W4.Provider,{value:this.props.routeContext},h0.createElement(XA.Provider,{value:Z,children:this.props.component})):this.props.children;if(this.context)return h0.createElement(ds,{error:Z},Y);return Y}};oj.contextType=cj;var lF=new WeakMap;function ds({children:Z,error:Y}){let{basename:Q}=h0.useContext(V7);if(typeof Y==="object"&&Y&&"digest"in Y&&typeof Y.digest==="string"){let z=fs(Y.digest);if(z){let q=lF.get(Y);if(q)throw q;let B=Ej(z.location,Q);if(bj&&!lF.get(Y))if(B.isExternal||z.reloadDocument)window.location.href=B.absoluteURL||B.to;else{let W=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(B.to,{replace:z.replace}));throw lF.set(Y,W),W}return h0.createElement("meta",{httpEquiv:"refresh",content:`0;url=${B.absoluteURL||B.to}`})}}return Z}function ls({routeContext:Z,match:Y,children:Q}){let z=h0.useContext(qZ);if(z&&z.static&&z.staticContext&&(Y.route.errorElement||Y.route.ErrorBoundary))z.staticContext._deepestRenderedBoundaryId=Y.route.id;return h0.createElement(W4.Provider,{value:Z},Q)}function rs(Z,Y=[],Q=null,z=null,q=null){if(Z==null){if(!Q)return null;if(Q.errors)Z=Q.matches;else if(Y.length===0&&!Q.initialized&&Q.matches.length>0)Z=Q.matches;else return null}let B=Z,W=Q?.errors;if(W!=null){let w=B.findIndex((O)=>O.route.id&&W?.[O.route.id]!==void 0);G1(w>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(W).join(",")}`),B=B.slice(0,Math.min(B.length,w+1))}let $=!1,U=-1;if(Q)for(let w=0;w=0)B=B.slice(0,U+1);else B=[B[0]];break}}}let M=Q&&z?(w,O)=>{z(w,{location:Q.location,params:Q.matches?.[0]?.params??{},unstable_pattern:oK(Q.matches),errorInfo:O})}:void 0;return B.reduceRight((w,O,_)=>{let F,P=!1,R=null,v=null;if(Q){if(F=W&&O.route.id?W[O.route.id]:void 0,R=O.route.errorElement||cs,$){if(U<0&&_===0)tj("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),P=!0,v=null;else if(U===_)P=!0,v=O.route.hydrateFallbackElement||null}}let L=Y.concat(B.slice(0,_+1)),T=()=>{let C;if(F)C=R;else if(P)C=v;else if(O.route.Component)C=h0.createElement(O.route.Component,null);else if(O.route.element)C=O.route.element;else C=w;return h0.createElement(ls,{match:O,routeContext:{outlet:w,matches:L,isDataRoute:Q!=null},children:C})};return Q&&(O.route.ErrorBoundary||O.route.errorElement||_===0)?h0.createElement(oj,{location:Q.location,revalidation:Q.revalidation,component:R,error:F,children:T(),routeContext:{outlet:null,matches:L,isDataRoute:!0},onError:M}):T()},null)}function zA(Z){return`${Z} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function ij(Z){let Y=h0.useContext(qZ);return G1(Y,zA(Z)),Y}function JX(Z){let Y=h0.useContext(SY);return G1(Y,zA(Z)),Y}function as(Z){let Y=h0.useContext(W4);return G1(Y,zA(Z)),Y}function iK(Z){let Y=as(Z),Q=Y.matches[Y.matches.length-1];return G1(Q.route.id,`${Z} can only be used on routes that contain a unique "id"`),Q.route.id}function ss(){return iK("useRouteId")}function NU(){return JX("useNavigation").navigation}function f8(){let Z=ij("useRevalidator"),Y=JX("useRevalidator"),Q=h0.useCallback(async()=>{await Z.router.revalidate()},[Z.router]);return h0.useMemo(()=>({revalidate:Q,state:Y.revalidation}),[Q,Y.revalidation])}function xY(){let{matches:Z,loaderData:Y}=JX("useMatches");return h0.useMemo(()=>Z.map((Q)=>Rj(Q,Y)),[Z,Y])}function qA(){let Z=JX("useLoaderData"),Y=iK("useLoaderData");return Z.loaderData[Y]}function KA(){let Z=JX("useActionData"),Y=iK("useLoaderData");return Z.actionData?Z.actionData[Y]:void 0}function OU(){let Z=h0.useContext(XA),Y=JX("useRouteError"),Q=iK("useRouteError");if(Z!==void 0)return Z;return Y.errors?.[Q]}function os(){let{router:Z}=ij("useNavigate"),Y=iK("useNavigate"),Q=h0.useRef(!1);return aj(()=>{Q.current=!0}),h0.useCallback(async(q,B={})=>{if(h5(Q.current,rj),!Q.current)return;if(typeof q==="number")await Z.navigate(q);else await Z.navigate(q,{fromRouteId:Y,...B})},[Z,Y])}var Mj={};function tj(Z,Y,Q){if(!Y&&!Mj[Z])Mj[Z]=!0,h5(!1,Q)}var Hj={};function wj(Z,Y){if(!Z&&!Hj[Y])Hj[Y]=!0,console.warn(Y)}var is="useOptimistic",Nj=Z1[is],ts=()=>{return};function ns(Z){if(Nj)return Nj(Z);else return[Z,ts]}function nj(Z){let Y={hasErrorBoundary:Z.hasErrorBoundary||Z.ErrorBoundary!=null||Z.errorElement!=null};if(Z.Component){if(nQ){if(Z.element)h5(!1,"You should not include both `Component` and `element` on your route - `Component` will be used.")}Object.assign(Y,{element:Z1.createElement(Z.Component),Component:void 0})}if(Z.HydrateFallback){if(nQ){if(Z.hydrateFallbackElement)h5(!1,"You should not include both `HydrateFallback` and `hydrateFallbackElement` on your route - `HydrateFallback` will be used.")}Object.assign(Y,{hydrateFallbackElement:Z1.createElement(Z.HydrateFallback),HydrateFallback:void 0})}if(Z.ErrorBoundary){if(nQ){if(Z.errorElement)h5(!1,"You should not include both `ErrorBoundary` and `errorElement` on your route - `ErrorBoundary` will be used.")}Object.assign(Y,{errorElement:Z1.createElement(Z.ErrorBoundary),ErrorBoundary:void 0})}return Y}var ej=["HydrateFallback","hydrateFallbackElement"];var es=class{constructor(){this.status="pending",this.promise=new Promise((Z,Y)=>{this.resolve=(Q)=>{if(this.status==="pending")this.status="resolved",Z(Q)},this.reject=(Q)=>{if(this.status==="pending")this.status="rejected",Y(Q)}})}};function BA({router:Z,flushSync:Y,onError:Q,unstable_useTransitions:z}){z=ys()||z;let[B,W]=Z1.useState(Z.state),[$,U]=ns(B),[M,w]=Z1.useState(),[O,_]=Z1.useState({isTransitioning:!1}),[F,P]=Z1.useState(),[R,v]=Z1.useState(),[L,T]=Z1.useState(),C=Z1.useRef(new Map),E=Z1.useCallback((g,{deletedFetchers:s,newErrors:k,flushSync:o,viewTransitionOpts:X0})=>{if(k&&Q)Object.values(k).forEach((e)=>Q(e,{location:g.location,params:g.matches[0]?.params??{},unstable_pattern:oK(g.matches)}));g.fetchers.forEach((e,c)=>{if(e.data!==void 0)C.current.set(c,e.data)}),s.forEach((e)=>C.current.delete(e)),wj(o===!1||Y!=null,'You provided the `flushSync` option to a router update, but you are not using the `` from `react-router/dom` so `ReactDOM.flushSync()` is unavailable. Please update your app to `import { RouterProvider } from "react-router/dom"` and ensure you have `react-dom` installed as a dependency to use the `flushSync` option.');let W0=Z.window!=null&&Z.window.document!=null&&typeof Z.window.document.startViewTransition==="function";if(wj(X0==null||W0,"You provided the `viewTransition` option to a router update, but you do not appear to be running in a DOM environment as `window.startViewTransition` is not available."),!X0||!W0){if(Y&&o)Y(()=>W(g));else if(z===!1)W(g);else Z1.startTransition(()=>{if(z===!0)U((e)=>Oj(e,g));W(g)});return}if(Y&&o){Y(()=>{if(R)F?.resolve(),R.skipTransition();_({isTransitioning:!0,flushSync:!0,currentLocation:X0.currentLocation,nextLocation:X0.nextLocation})});let e=Z.window.document.startViewTransition(()=>{Y(()=>W(g))});e.finished.finally(()=>{Y(()=>{P(void 0),v(void 0),w(void 0),_({isTransitioning:!1})})}),Y(()=>v(e));return}if(R)F?.resolve(),R.skipTransition(),T({state:g,currentLocation:X0.currentLocation,nextLocation:X0.nextLocation});else w(g),_({isTransitioning:!0,flushSync:!1,currentLocation:X0.currentLocation,nextLocation:X0.nextLocation})},[Z.window,Y,R,F,z,U,Q]);Z1.useLayoutEffect(()=>Z.subscribe(E),[Z,E]),Z1.useEffect(()=>{if(O.isTransitioning&&!O.flushSync)P(new es)},[O]),Z1.useEffect(()=>{if(F&&M&&Z.window){let g=M,s=F.promise,k=Z.window.document.startViewTransition(async()=>{if(z===!1)W(g);else Z1.startTransition(()=>{if(z===!0)U((o)=>Oj(o,g));W(g)});await s});k.finished.finally(()=>{P(void 0),v(void 0),w(void 0),_({isTransitioning:!1})}),v(k)}},[M,F,Z.window,z,U]),Z1.useEffect(()=>{if(F&&M&&$.location.key===M.location.key)F.resolve()},[F,R,$.location,M]),Z1.useEffect(()=>{if(!O.isTransitioning&&L)w(L.state),_({isTransitioning:!0,flushSync:!1,currentLocation:L.currentLocation,nextLocation:L.nextLocation}),T(void 0)},[O.isTransitioning,L]);let b=Z1.useMemo(()=>{return{createHref:Z.createHref,encodeLocation:Z.encodeLocation,go:(g)=>Z.navigate(g),push:(g,s,k)=>Z.navigate(g,{state:s,preventScrollReset:k?.preventScrollReset}),replace:(g,s,k)=>Z.navigate(g,{replace:!0,state:s,preventScrollReset:k?.preventScrollReset})}},[Z]),S=Z.basename||"/",j=Z1.useMemo(()=>({router:Z,navigator:b,static:!1,basename:S,onError:Q}),[Z,b,S,Q]);return Z1.createElement(Z1.Fragment,null,Z1.createElement(qZ.Provider,{value:j},Z1.createElement(SY.Provider,{value:$},Z1.createElement(wU.Provider,{value:C.current},Z1.createElement(HU.Provider,{value:O},Z1.createElement(WA,{basename:S,location:$.location,navigationType:$.historyAction,navigator:b,unstable_useTransitions:z},Z1.createElement(Zo,{routes:Z.routes,future:Z.future,state:$,onError:Q})))))),null)}function Oj(Z,Y){return{...Z,navigation:Y.navigation.state!=="idle"?Y.navigation:Z.navigation,revalidation:Y.revalidation!=="idle"?Y.revalidation:Z.revalidation,actionData:Y.navigation.state!=="submitting"?Y.actionData:Z.actionData,fetchers:Y.fetchers}}var Zo=Z1.memo(Yo);function Yo({routes:Z,future:Y,state:Q,onError:z}){return us(Z,void 0,Q,z,Y)}function tK({to:Z,replace:Y,state:Q,relative:z}){G1(kY()," may be used only in the context of a component.");let{static:q}=Z1.useContext(V7);h5(!q," must not be used on the initial render in a . This is a no-op, but you should modify your code so the is only ever rendered in response to some user interaction or state change.");let{matches:B}=Z1.useContext(W4),{pathname:W}=Q2(),$=S4(),U=UU(Z,GU(B),W,z==="path"),M=JSON.stringify(U);return Z1.useEffect(()=>{$(JSON.parse(M),{replace:Y,state:Q,relative:z})},[$,M,z,Y,Q]),null}function h6(Z){return sj(Z.context)}function WA({basename:Z="/",children:Y=null,location:Q,navigationType:z="POP",navigator:q,static:B=!1,unstable_useTransitions:W}){G1(!kY(),"You cannot render a inside another . You should never have more than one in your app.");let $=Z.replace(/^\/*/,"/"),U=Z1.useMemo(()=>({basename:$,navigator:q,static:B,unstable_useTransitions:W,future:{}}),[$,q,B,W]);if(typeof Q==="string")Q=j3(Q);let{pathname:M="/",search:w="",hash:O="",state:_=null,key:F="default"}=Q,P=Z1.useMemo(()=>{let R=y4(M,$);if(R==null)return null;return{location:{pathname:R,search:w,hash:O,state:_,key:F},navigationType:z}},[$,M,w,O,_,F,z]);if(h5(P!=null,` is not able to match the URL "${M}${w}${O}" because it does not start with the basename, so the won't render anything.`),P==null)return null;return Z1.createElement(V7.Provider,{value:U},Z1.createElement(ZX.Provider,{children:Y,value:P}))}var BU="get",WU="application/x-www-form-urlencoded";function _U(Z){return typeof HTMLElement<"u"&&Z instanceof HTMLElement}function Jo(Z){return _U(Z)&&Z.tagName.toLowerCase()==="button"}function Qo(Z){return _U(Z)&&Z.tagName.toLowerCase()==="form"}function Xo(Z){return _U(Z)&&Z.tagName.toLowerCase()==="input"}function zo(Z){return!!(Z.metaKey||Z.altKey||Z.ctrlKey||Z.shiftKey)}function qo(Z,Y){return Z.button===0&&(!Y||Y==="_self")&&!zo(Z)}var XU=null;function Ko(){if(XU===null)try{new FormData(document.createElement("form"),0),XU=!1}catch(Z){XU=!0}return XU}var Bo=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function rF(Z){if(Z!=null&&!Bo.has(Z))return h5(!1,`"${Z}" is not a valid \`encType\` for \`
\`/\`\` and will default to "${WU}"`),null;return Z}function Wo(Z,Y){let Q,z,q,B,W;if(Qo(Z)){let $=Z.getAttribute("action");z=$?y4($,Y):null,Q=Z.getAttribute("method")||BU,q=rF(Z.getAttribute("enctype"))||WU,B=new FormData(Z)}else if(Jo(Z)||Xo(Z)&&(Z.type==="submit"||Z.type==="image")){let $=Z.form;if($==null)throw Error('Cannot submit a