@remix-run/router 1.23.2 → 1.23.3

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