react-router 0.0.0-experimental-bcda00aaf → 0.0.0-experimental-a26b992a1

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.
Files changed (84) hide show
  1. package/CHANGELOG.md +0 -7
  2. package/README.md +1 -10
  3. package/dist/dom-export.d.ts +3 -0
  4. package/dist/dom-export.mjs +205 -0
  5. package/dist/dom-export.mjs.map +1 -0
  6. package/dist/index.d.ts +79 -29
  7. package/dist/index.mjs +11702 -0
  8. package/dist/index.mjs.map +1 -0
  9. package/dist/lib/components.d.ts +249 -34
  10. package/dist/lib/context.d.ts +18 -5
  11. package/dist/lib/dom/dom.d.ts +123 -0
  12. package/dist/lib/dom/global.d.ts +40 -0
  13. package/dist/lib/dom/lib.d.ts +940 -0
  14. package/dist/lib/dom/server.d.ts +41 -0
  15. package/dist/lib/dom/ssr/components.d.ts +123 -0
  16. package/dist/lib/dom/ssr/data.d.ts +7 -0
  17. package/dist/lib/dom/ssr/entry.d.ts +47 -0
  18. package/dist/lib/dom/ssr/errorBoundaries.d.ts +36 -0
  19. package/dist/lib/dom/ssr/errors.d.ts +2 -0
  20. package/dist/lib/dom/ssr/fallback.d.ts +2 -0
  21. package/dist/lib/dom/ssr/fog-of-war.d.ts +28 -0
  22. package/dist/lib/dom/ssr/invariant.d.ts +2 -0
  23. package/dist/lib/dom/ssr/links.d.ts +25 -0
  24. package/dist/lib/dom/ssr/markup.d.ts +5 -0
  25. package/dist/lib/dom/ssr/routeModules.d.ts +141 -0
  26. package/dist/lib/dom/ssr/routes-test-stub.d.ts +59 -0
  27. package/dist/lib/dom/ssr/routes.d.ts +32 -0
  28. package/dist/lib/dom/ssr/server.d.ts +16 -0
  29. package/dist/lib/dom/ssr/single-fetch.d.ts +37 -0
  30. package/dist/lib/dom-export/dom-router-provider.d.ts +5 -0
  31. package/dist/lib/dom-export/hydrated-router.d.ts +5 -0
  32. package/dist/lib/hooks.d.ts +284 -55
  33. package/dist/lib/router/history.d.ts +253 -0
  34. package/dist/lib/router/links.d.ts +104 -0
  35. package/dist/lib/router/router.d.ts +540 -0
  36. package/dist/lib/router/utils.d.ts +505 -0
  37. package/dist/lib/server-runtime/build.d.ts +38 -0
  38. package/dist/lib/server-runtime/cookies.d.ts +62 -0
  39. package/dist/lib/server-runtime/crypto.d.ts +2 -0
  40. package/dist/lib/server-runtime/data.d.ts +28 -0
  41. package/dist/lib/server-runtime/dev.d.ts +8 -0
  42. package/dist/lib/server-runtime/entry.d.ts +3 -0
  43. package/dist/lib/server-runtime/errors.d.ts +51 -0
  44. package/dist/lib/server-runtime/formData.d.ts +15 -0
  45. package/dist/lib/server-runtime/headers.d.ts +3 -0
  46. package/dist/lib/server-runtime/invariant.d.ts +2 -0
  47. package/dist/lib/server-runtime/jsonify.d.ts +33 -0
  48. package/dist/lib/server-runtime/markup.d.ts +1 -0
  49. package/dist/lib/server-runtime/mode.d.ts +9 -0
  50. package/dist/lib/server-runtime/responses.d.ts +37 -0
  51. package/dist/lib/server-runtime/routeMatching.d.ts +8 -0
  52. package/dist/lib/server-runtime/routeModules.d.ts +212 -0
  53. package/dist/lib/server-runtime/routes.d.ts +31 -0
  54. package/dist/lib/server-runtime/server.d.ts +5 -0
  55. package/dist/lib/server-runtime/serverHandoff.d.ts +11 -0
  56. package/dist/lib/server-runtime/sessions/cookieStorage.d.ts +19 -0
  57. package/dist/lib/server-runtime/sessions/memoryStorage.d.ts +17 -0
  58. package/dist/lib/server-runtime/sessions.d.ts +140 -0
  59. package/dist/lib/server-runtime/single-fetch.d.ts +30 -0
  60. package/dist/lib/server-runtime/typecheck.d.ts +4 -0
  61. package/dist/lib/server-runtime/upload/errors.d.ts +5 -0
  62. package/dist/lib/server-runtime/upload/memoryUploadHandler.d.ts +21 -0
  63. package/dist/lib/server-runtime/warnings.d.ts +1 -0
  64. package/dist/main-dom-export.js +19 -0
  65. package/dist/main.js +1 -1
  66. package/dist/react-router-dom.development.js +199 -0
  67. package/dist/react-router-dom.development.js.map +1 -0
  68. package/dist/react-router-dom.production.min.js +12 -0
  69. package/dist/react-router-dom.production.min.js.map +1 -0
  70. package/dist/react-router.development.js +12343 -1134
  71. package/dist/react-router.development.js.map +1 -1
  72. package/dist/react-router.production.min.js +2 -2
  73. package/dist/react-router.production.min.js.map +1 -1
  74. package/dist/umd/react-router-dom.development.js +241 -0
  75. package/dist/umd/react-router-dom.development.js.map +1 -0
  76. package/dist/umd/react-router-dom.production.min.js +12 -0
  77. package/dist/umd/react-router-dom.production.min.js.map +1 -0
  78. package/dist/umd/react-router.development.js +12667 -1284
  79. package/dist/umd/react-router.development.js.map +1 -1
  80. package/dist/umd/react-router.production.min.js +2 -2
  81. package/dist/umd/react-router.production.min.js.map +1 -1
  82. package/package.json +32 -6
  83. package/dist/index.js +0 -1471
  84. package/dist/index.js.map +0 -1
@@ -1,5 +1,5 @@
1
1
  /**
2
- * React Router v0.0.0-experimental-bcda00aaf
2
+ * React Router v0.0.0-experimental-a26b992a1
3
3
  *
4
4
  * Copyright (c) Remix Software Inc.
5
5
  *
@@ -8,5 +8,5 @@
8
8
  *
9
9
  * @license MIT
10
10
  */
11
- import*as e from"react";import{UNSAFE_invariant as t,joinPaths as r,matchPath as n,UNSAFE_decodePath as a,UNSAFE_getResolveToMatches as o,resolveTo as i,parsePath as l,matchRoutes as u,Action as s,UNSAFE_convertRouteMatchToUiMatch as c,stripBasename as d,IDLE_BLOCKER as p,isRouteErrorResponse as m,createMemoryHistory as h,AbortedDeferredError as f,createRouter as v}from"@remix-run/router";export{AbortedDeferredError,Action as NavigationType,createPath,defer,generatePath,isRouteErrorResponse,json,matchPath,matchRoutes,parsePath,redirect,redirectDocument,replace,resolvePath}from"@remix-run/router";const g=e.createContext(null),E=e.createContext(null),y=e.createContext(null),x=e.createContext(null),C=e.createContext(null),b=e.createContext({outlet:null,matches:[],isDataRoute:!1}),R=e.createContext(null);function S(n,{relative:a}={}){P()||t(!1);let{basename:o,navigator:i}=e.useContext(x),{hash:l,pathname:u,search:s}=A(n,{relative:a}),c=u;return"/"!==o&&(c="/"===u?o:r([o,u])),i.createHref({pathname:c,search:s,hash:l})}function P(){return null!=e.useContext(C)}function U(){return P()||t(!1),e.useContext(C).location}function _(){return e.useContext(C).navigationType}function k(r){P()||t(!1);let{pathname:o}=U();return e.useMemo((()=>n(r,a(o))),[o,r])}function D(t){e.useContext(x).static||e.useLayoutEffect(t)}function N(){let{isDataRoute:n}=e.useContext(b);return n?function(){let{router:t}=V(z.UseNavigateStable),r=Y($.UseNavigateStable),n=e.useRef(!1);return D((()=>{n.current=!0})),e.useCallback(((e,a={})=>{n.current&&("number"==typeof e?t.navigate(e):t.navigate(e,{fromRouteId:r,...a}))}),[t,r])}():function(){P()||t(!1);let n=e.useContext(g),{basename:a,future:l,navigator:u}=e.useContext(x),{matches:s}=e.useContext(b),{pathname:c}=U(),d=JSON.stringify(o(s,l.v7_relativeSplatPath)),p=e.useRef(!1);return D((()=>{p.current=!0})),e.useCallback(((e,t={})=>{if(!p.current)return;if("number"==typeof e)return void u.go(e);let o=i(e,JSON.parse(d),c,"path"===t.relative);null==n&&"/"!==a&&(o.pathname="/"===o.pathname?a:r([a,o.pathname])),(t.replace?u.replace:u.push)(o,t.state,t)}),[a,u,d,c,n])}()}const B=e.createContext(null);function F(){return e.useContext(B)}function L(t){let r=e.useContext(b).outlet;return r?e.createElement(B.Provider,{value:t},r):r}function O(){let{matches:t}=e.useContext(b),r=t[t.length-1];return r?r.params:{}}function A(t,{relative:r}={}){let{future:n}=e.useContext(x),{matches:a}=e.useContext(b),{pathname:l}=U(),u=JSON.stringify(o(a,n.v7_relativeSplatPath));return e.useMemo((()=>i(t,JSON.parse(u),l,"path"===r)),[t,u,l,r])}function j(e,t){return I(e,t)}function I(n,a,o,i){P()||t(!1);let{navigator:c}=e.useContext(x),{matches:d}=e.useContext(b),p=d[d.length-1],m=p?p.params:{};!p||p.pathname;let h=p?p.pathnameBase:"/";p&&p.route;let f,v=U();if(a){let e="string"==typeof a?l(a):a;"/"===h||e.pathname?.startsWith(h)||t(!1),f=e}else f=v;let g=f.pathname||"/",E=g;if("/"!==h){let e=h.replace(/^\//,"").split("/");E="/"+g.replace(/^\//,"").split("/").slice(e.length).join("/")}let y=o&&"/"===h?o.matches:u(n,{pathname:E}),R=J(y&&y.map((e=>Object.assign({},e,{params:Object.assign({},m,e.params),pathname:r([h,c.encodeLocation?c.encodeLocation(e.pathname).pathname:e.pathname]),pathnameBase:"/"===e.pathnameBase?h:r([h,c.encodeLocation?c.encodeLocation(e.pathnameBase).pathname:e.pathnameBase])}))),d,o,i);return a&&R?e.createElement(C.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",...f},navigationType:s.Pop}},R):R}function M(){let t=te(),r=m(t)?`${t.status} ${t.statusText}`:t instanceof Error?t.message:JSON.stringify(t),n=t instanceof Error?t.stack:null,a={padding:"0.5rem",backgroundColor:"rgba(200,200,200, 0.5)"};return e.createElement(e.Fragment,null,e.createElement("h2",null,"Unexpected Application Error!"),e.createElement("h3",{style:{fontStyle:"italic"}},r),n?e.createElement("pre",{style:a},n):null,null)}const T=e.createElement(M,null);class H extends e.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,t){return t.location!==e.location||"idle"!==t.revalidation&&"idle"===e.revalidation?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:void 0!==e.error?e.error:t.error,location:t.location,revalidation:e.revalidation||t.revalidation}}componentDidCatch(e,t){console.error("React Router caught the following error during render",e,t)}render(){return void 0!==this.state.error?e.createElement(b.Provider,{value:this.props.routeContext},e.createElement(R.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function w({routeContext:t,match:r,children:n}){let a=e.useContext(g);return a&&a.static&&a.staticContext&&(r.route.errorElement||r.route.ErrorBoundary)&&(a.staticContext._deepestRenderedBoundaryId=r.route.id),e.createElement(b.Provider,{value:t},n)}function J(r,n=[],a=null,o=null){if(null==r){if(!a)return null;if(a.errors)r=a.matches;else{if(!(o?.v7_partialHydration&&0===n.length&&!a.initialized&&a.matches.length>0))return null;r=a.matches}}let i=r,l=a?.errors;if(null!=l){let e=i.findIndex((e=>e.route.id&&void 0!==l?.[e.route.id]));e>=0||t(!1),i=i.slice(0,Math.min(i.length,e+1))}let u=!1,s=-1;if(a&&o&&o.v7_partialHydration)for(let e=0;e<i.length;e++){let t=i[e];if((t.route.HydrateFallback||t.route.hydrateFallbackElement)&&(s=e),t.route.id){let{loaderData:e,errors:r}=a,n=t.route.loader&&void 0===e[t.route.id]&&(!r||void 0===r[t.route.id]);if(t.route.lazy||n){u=!0,i=s>=0?i.slice(0,s+1):[i[0]];break}}}return i.reduceRight(((t,r,o)=>{let c,d=!1,p=null,m=null;var h;a&&(c=l&&r.route.id?l[r.route.id]:void 0,p=r.route.errorElement||T,u&&(s<0&&0===o?(h="route-fallback",!1||ie[h]||(ie[h]=!0),d=!0,m=null):s===o&&(d=!0,m=r.route.hydrateFallbackElement||null)));let f=n.concat(i.slice(0,o+1)),v=()=>{let n;return n=c?p:d?m:r.route.Component?e.createElement(r.route.Component,null):r.route.element?r.route.element:t,e.createElement(w,{match:r,routeContext:{outlet:t,matches:f,isDataRoute:null!=a},children:n})};return a&&(r.route.ErrorBoundary||r.route.errorElement||0===o)?e.createElement(H,{location:a.location,revalidation:a.revalidation,component:p,error:c,children:v(),routeContext:{outlet:null,matches:f,isDataRoute:!0}}):v()}),null)}var z=function(e){return e.UseBlocker="useBlocker",e.UseRevalidator="useRevalidator",e.UseNavigateStable="useNavigate",e}(z||{}),$=function(e){return e.UseBlocker="useBlocker",e.UseLoaderData="useLoaderData",e.UseActionData="useActionData",e.UseRouteError="useRouteError",e.UseNavigation="useNavigation",e.UseRouteLoaderData="useRouteLoaderData",e.UseMatches="useMatches",e.UseRevalidator="useRevalidator",e.UseNavigateStable="useNavigate",e.UseRouteId="useRouteId",e}($||{});function V(r){let n=e.useContext(g);return n||t(!1),n}function W(r){let n=e.useContext(E);return n||t(!1),n}function Y(r){let n=function(r){let n=e.useContext(b);return n||t(!1),n}(),a=n.matches[n.matches.length-1];return a.route.id||t(!1),a.route.id}function q(){return Y($.UseRouteId)}function G(){return W($.UseNavigation).navigation}function K(){let t=V(z.UseRevalidator),r=W($.UseRevalidator);return e.useMemo((()=>({revalidate:t.router.revalidate,state:r.revalidation})),[t.router.revalidate,r.revalidation])}function Q(){let{matches:t,loaderData:r}=W($.UseMatches);return e.useMemo((()=>t.map((e=>c(e,r)))),[t,r])}function X(){let e=W($.UseLoaderData),t=Y($.UseLoaderData);if(!e.errors||null==e.errors[t])return e.loaderData[t];console.error(`You cannot \`useLoaderData\` in an errorElement (routeId: ${t})`)}function Z(e){return W($.UseRouteLoaderData).loaderData[e]}function ee(){let e=W($.UseActionData),t=Y($.UseLoaderData);return e.actionData?e.actionData[t]:void 0}function te(){let t=e.useContext(R),r=W($.UseRouteError),n=Y($.UseRouteError);return void 0!==t?t:r.errors?.[n]}function re(){return e.useContext(y)?._data}function ne(){return e.useContext(y)?._error}let ae=0;function oe(t){let{router:r,basename:n}=V(z.UseBlocker),a=W($.UseBlocker),[o,i]=e.useState(""),l=e.useCallback((e=>{if("function"!=typeof t)return!!t;if("/"===n)return t(e);let{currentLocation:r,nextLocation:a,historyAction:o}=e;return t({currentLocation:{...r,pathname:d(r.pathname,n)||r.pathname},nextLocation:{...a,pathname:d(a.pathname,n)||a.pathname},historyAction:o})}),[n,t]);return e.useEffect((()=>{let e=String(++ae);return i(e),()=>r.deleteBlocker(e)}),[r]),e.useEffect((()=>{""!==o&&r.getBlocker(o,l)}),[r,o,l]),o&&a.blockers.has(o)?a.blockers.get(o):p}const ie={};const le=e.startTransition;function ue({fallbackElement:t,router:r,future:n}){let[a,o]=e.useState(r.state),{v7_startTransition:i}=n||{},l=e.useCallback((e=>{i&&le?le((()=>o(e))):o(e)}),[o,i]);e.useLayoutEffect((()=>r.subscribe(l)),[r,l]),e.useEffect((()=>{}),[]);let u=e.useMemo((()=>({createHref:r.createHref,encodeLocation:r.encodeLocation,go:e=>r.navigate(e),push:(e,t,n)=>r.navigate(e,{state:t,preventScrollReset:n?.preventScrollReset}),replace:(e,t,n)=>r.navigate(e,{replace:!0,state:t,preventScrollReset:n?.preventScrollReset})})),[r]),s=r.basename||"/",c=e.useMemo((()=>({router:r,navigator:u,static:!1,basename:s})),[r,u,s]);return e.createElement(e.Fragment,null,e.createElement(g.Provider,{value:c},e.createElement(E.Provider,{value:a},e.createElement(he,{basename:s,location:a.location,navigationType:a.historyAction,navigator:u,future:{v7_relativeSplatPath:r.future.v7_relativeSplatPath}},a.initialized||r.future.v7_partialHydration?e.createElement(se,{routes:r.routes,future:r.future,state:a}):t))),null)}function se({routes:e,future:t,state:r}){return I(e,void 0,r,t)}function ce({basename:t,children:r,initialEntries:n,initialIndex:a,future:o}){let i=e.useRef();null==i.current&&(i.current=h({initialEntries:n,initialIndex:a,v5Compat:!0}));let l=i.current,[u,s]=e.useState({action:l.action,location:l.location}),{v7_startTransition:c}=o||{},d=e.useCallback((e=>{c&&le?le((()=>s(e))):s(e)}),[s,c]);return e.useLayoutEffect((()=>l.listen(d)),[l,d]),e.createElement(he,{basename:t,children:r,location:u.location,navigationType:u.action,navigator:l,future:o})}function de({to:r,replace:n,state:a,relative:l}){P()||t(!1);let{future:u,static:s}=e.useContext(x),{matches:c}=e.useContext(b),{pathname:d}=U(),p=N(),m=i(r,o(c,u.v7_relativeSplatPath),d,"path"===l),h=JSON.stringify(m);return e.useEffect((()=>p(JSON.parse(h),{replace:n,state:a,relative:l})),[p,h,l,n,a]),null}function pe(e){return L(e.context)}function me(e){t(!1)}function he({basename:r="/",children:n=null,location:a,navigationType:o=s.Pop,navigator:i,static:u=!1,future:c}){P()&&t(!1);let p=r.replace(/^\/*/,"/"),m=e.useMemo((()=>({basename:p,navigator:i,static:u,future:{v7_relativeSplatPath:!1,...c}})),[p,c,i,u]);"string"==typeof a&&(a=l(a));let{pathname:h="/",search:f="",hash:v="",state:g=null,key:E="default"}=a,y=e.useMemo((()=>{let e=d(h,p);return null==e?null:{location:{pathname:e,search:f,hash:v,state:g,key:E},navigationType:o}}),[p,h,f,v,g,E,o]);return null==y?null:e.createElement(x.Provider,{value:m},e.createElement(C.Provider,{children:n,value:y}))}function fe({children:e,location:t}){return j(Ce(e),t)}function ve({children:t,errorElement:r,resolve:n}){return e.createElement(ye,{resolve:n,errorElement:r},e.createElement(xe,null,t))}var ge=function(e){return e[e.pending=0]="pending",e[e.success=1]="success",e[e.error=2]="error",e}(ge||{});const Ee=new Promise((()=>{}));class ye extends e.Component{constructor(e){super(e),this.state={error:null}}static getDerivedStateFromError(e){return{error:e}}componentDidCatch(e,t){console.error("<Await> caught the following error during render",e,t)}render(){let{children:t,errorElement:r,resolve:n}=this.props,a=null,o=ge.pending;if(n instanceof Promise)if(this.state.error){o=ge.error;let e=this.state.error;a=Promise.reject().catch((()=>{})),Object.defineProperty(a,"_tracked",{get:()=>!0}),Object.defineProperty(a,"_error",{get:()=>e})}else n._tracked?(a=n,o="_error"in a?ge.error:"_data"in a?ge.success:ge.pending):(o=ge.pending,Object.defineProperty(n,"_tracked",{get:()=>!0}),a=n.then((e=>Object.defineProperty(n,"_data",{get:()=>e})),(e=>Object.defineProperty(n,"_error",{get:()=>e}))));else o=ge.success,a=Promise.resolve(),Object.defineProperty(a,"_tracked",{get:()=>!0}),Object.defineProperty(a,"_data",{get:()=>n});if(o===ge.error&&a._error instanceof f)throw Ee;if(o===ge.error&&!r)throw a._error;if(o===ge.error)return e.createElement(y.Provider,{value:a,children:r});if(o===ge.success)return e.createElement(y.Provider,{value:a,children:t});throw a}}function xe({children:t}){let r=re(),n="function"==typeof t?t(r):t;return e.createElement(e.Fragment,null,n)}function Ce(r,n=[]){let a=[];return e.Children.forEach(r,((r,o)=>{if(!e.isValidElement(r))return;let i=[...n,o];if(r.type===e.Fragment)return void a.push.apply(a,Ce(r.props.children,i));r.type!==me&&t(!1),r.props.index&&r.props.children&&t(!1);let l={id:r.props.id||i.join("-"),caseSensitive:r.props.caseSensitive,element:r.props.element,Component:r.props.Component,index:r.props.index,path:r.props.path,loader:r.props.loader,action:r.props.action,errorElement:r.props.errorElement,ErrorBoundary:r.props.ErrorBoundary,hasErrorBoundary:null!=r.props.ErrorBoundary||null!=r.props.errorElement,shouldRevalidate:r.props.shouldRevalidate,handle:r.props.handle,lazy:r.props.lazy};r.props.children&&(l.children=Ce(r.props.children,i)),a.push(l)})),a}function be(e){return J(e)}function Re(t){let r={hasErrorBoundary:null!=t.ErrorBoundary||null!=t.errorElement};return t.Component&&Object.assign(r,{element:e.createElement(t.Component),Component:void 0}),t.HydrateFallback&&Object.assign(r,{hydrateFallbackElement:e.createElement(t.HydrateFallback),HydrateFallback:void 0}),t.ErrorBoundary&&Object.assign(r,{errorElement:e.createElement(t.ErrorBoundary),ErrorBoundary:void 0}),r}function Se(e,t){return v({basename:t?.basename,future:{...t?.future,v7_prependBasename:!0},history:h({initialEntries:t?.initialEntries,initialIndex:t?.initialIndex}),hydrationData:t?.hydrationData,routes:e,mapRouteProperties:Re,dataStrategy:t?.dataStrategy,patchRoutesOnNavigation:t?.patchRoutesOnNavigation}).initialize()}export{ve as Await,ce as MemoryRouter,de as Navigate,pe as Outlet,me as Route,he as Router,ue as RouterProvider,fe as Routes,g as UNSAFE_DataRouterContext,E as UNSAFE_DataRouterStateContext,C as UNSAFE_LocationContext,x as UNSAFE_NavigationContext,b as UNSAFE_RouteContext,Re as UNSAFE_mapRouteProperties,q as UNSAFE_useRouteId,I as UNSAFE_useRoutesImpl,Se as createMemoryRouter,Ce as createRoutesFromChildren,Ce as createRoutesFromElements,be as renderMatches,ee as useActionData,ne as useAsyncError,re as useAsyncValue,oe as useBlocker,S as useHref,P as useInRouterContext,X as useLoaderData,U as useLocation,k as useMatch,Q as useMatches,N as useNavigate,G as useNavigation,_ as useNavigationType,L as useOutlet,F as useOutletContext,O as useParams,A as useResolvedPath,K as useRevalidator,te as useRouteError,Z as useRouteLoaderData,j as useRoutes};
11
+ import*as e from"react";import{decode as t,encode as r}from"turbo-stream";import{parse as n,serialize as a}from"cookie";import{streamMultipart as o}from"@web3-storage/multipart-parser";import{splitCookiesString as i}from"set-cookie-parser";let s=function(e){return e.Pop="POP",e.Push="PUSH",e.Replace="REPLACE",e}({});function l(e={}){let t,{initialEntries:r=["/"],initialIndex:n,v5Compat:a=!1}=e;t=r.map(((e,t)=>d(e,"string"==typeof e?null:e.state,0===t?"default":void 0)));let o=u(null==n?t.length-1:n),i=s.Pop,l=null;function u(e){return Math.min(Math.max(e,0),t.length-1)}function c(){return t[o]}function d(e,r=null,n){return f(t?c().pathname:"/",e,r,n)}function h(e){return"string"==typeof e?e:m(e)}return{get index(){return o},get action(){return i},get location(){return c()},createHref:h,createURL:e=>new URL(h(e),"http://localhost"),encodeLocation(e){let t="string"==typeof e?p(e):e;return{pathname:t.pathname||"",search:t.search||"",hash:t.hash||""}},push(e,r){i=s.Push;let n=d(e,r);o+=1,t.splice(o,t.length,n),a&&l&&l({action:i,location:n,delta:1})},replace(e,r){i=s.Replace;let n=d(e,r);t[o]=n,a&&l&&l({action:i,location:n,delta:0})},go(e){i=s.Pop;let r=u(o+e),n=t[r];o=r,l&&l({action:i,location:n,delta:e})},listen:e=>(l=e,()=>{l=null})}}function u(e={}){return y((function(e,t){let{pathname:r,search:n,hash:a}=e.location;return f("",{pathname:r,search:n,hash:a},t.state&&t.state.usr||null,t.state&&t.state.key||"default")}),(function(e,t){return"string"==typeof t?t:m(t)}),null,e)}function c(e={}){return y((function(e,t){let{pathname:r="/",search:n="",hash:a=""}=p(e.location.hash.substr(1));return r.startsWith("/")||r.startsWith(".")||(r="/"+r),f("",{pathname:r,search:n,hash:a},t.state&&t.state.usr||null,t.state&&t.state.key||"default")}),(function(e,t){let r=e.document.querySelector("base"),n="";if(r&&r.getAttribute("href")){let t=e.location.href,r=t.indexOf("#");n=-1===r?t:t.slice(0,r)}return n+"#"+("string"==typeof t?t:m(t))}),(function(e,t){}),e)}function d(e,t){if(!1===e||null==e)throw new Error(t)}function h(e,t){return{usr:e.state,key:e.key,idx:t}}function f(e,t,r=null,n){return{pathname:"string"==typeof e?e:e.pathname,search:"",hash:"",..."string"==typeof t?p(t):t,state:r,key:t&&t.key||n||Math.random().toString(36).substr(2,8)}}function m({pathname:e="/",search:t="",hash:r=""}){return t&&"?"!==t&&(e+="?"===t.charAt(0)?t:"?"+t),r&&"#"!==r&&(e+="#"===r.charAt(0)?r:"#"+r),e}function p(e){let t={};if(e){let r=e.indexOf("#");r>=0&&(t.hash=e.substr(r),e=e.substr(0,r));let n=e.indexOf("?");n>=0&&(t.search=e.substr(n),e=e.substr(0,n)),e&&(t.pathname=e)}return t}function y(e,t,r,n={}){let{window:a=document.defaultView,v5Compat:o=!1}=n,i=a.history,l=s.Pop,u=null,c=p();function p(){return(i.state||{idx:null}).idx}function y(){l=s.Pop;let e=p(),t=null==e?null:e-c;c=e,u&&u({action:l,location:v.location,delta:t})}function g(e){let t="null"!==a.location.origin?a.location.origin:a.location.href,r="string"==typeof e?e:m(e);return r=r.replace(/ $/,"%20"),t||d(!1),new URL(r,t)}null==c&&(c=0,i.replaceState({...i.state,idx:c},""));let v={get action(){return l},get location(){return e(a,i)},listen(e){if(u)throw new Error("A history only accepts one active listener");return a.addEventListener("popstate",y),u=e,()=>{a.removeEventListener("popstate",y),u=null}},createHref:e=>t(a,e),createURL:g,encodeLocation(e){let t=g(e);return{pathname:t.pathname,search:t.search,hash:t.hash}},push:function(e,t){l=s.Push;let n=f(v.location,e,t);r&&r(n,e),c=p()+1;let d=h(n,c),m=v.createHref(n);try{i.pushState(d,"",m)}catch(y){if(y instanceof DOMException&&"DataCloneError"===y.name)throw y;a.location.assign(m)}o&&u&&u({action:l,location:v.location,delta:1})},replace:function(e,t){l=s.Replace;let n=f(v.location,e,t);r&&r(n,e),c=p();let a=h(n,c),d=v.createHref(n);i.replaceState(a,"",d),o&&u&&u({action:l,location:v.location,delta:0})},go:e=>i.go(e)};return v}let g=function(e){return e.data="data",e.redirect="redirect",e.error="error",e}({});const v=new Set(["lazy","caseSensitive","path","id","index","children"]);function w(e,t,r=[],n={}){return e.map(((e,a)=>{let o=[...r,String(a)],i="string"==typeof e.id?e.id:o.join("-");if(!0===e.index&&e.children&&d(!1),n[i]&&d(!1),function(e){return!0===e.index}(e)){let r={...e,...t(e),id:i};return n[i]=r,r}{let r={...e,...t(e),id:i,children:void 0};return n[i]=r,e.children&&(r.children=w(e.children,t,o,n)),r}}))}function b(e,t,r="/"){return E(e,t,r,!1)}function E(e,t,r,n){let a=_(("string"==typeof t?p(t):t).pathname||"/",r);if(null==a)return null;let o=x(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 s=0;null==i&&s<o.length;++s){let e=A(a);i=L(o[s],e,n)}return i}function S(e,t){let{route:r,pathname:n,params:a}=e;return{id:r.id,pathname:n,params:a,data:t[r.id],handle:r.handle}}function x(e,t=[],r=[],n=""){let a=(e,a,o)=>{let i={relativePath:void 0===o?e.path||"":o,caseSensitive:!0===e.caseSensitive,childrenIndex:a,route:e};i.relativePath.startsWith("/")&&(i.relativePath.startsWith(n)||d(!1),i.relativePath=i.relativePath.slice(n.length));let s=F([n,i.relativePath]),l=r.concat(i);e.children&&e.children.length>0&&(!0===e.index&&d(!1),x(e.children,t,l,s)),(null!=e.path||e.index)&&t.push({path:s,score:D(s,e.index),routesMeta:l})};return e.forEach(((e,t)=>{if(""!==e.path&&e.path?.includes("?"))for(let r of R(e.path))a(e,t,r);else a(e,t)})),t}function R(e){let t=e.split("/");if(0===t.length)return[];let[r,...n]=t,a=r.endsWith("?"),o=r.replace(/\?$/,"");if(0===n.length)return a?[o,""]:[o];let i=R(n.join("/")),s=[];return s.push(...i.map((e=>""===e?o:[o,e].join("/")))),a&&s.push(...i),s.map((t=>e.startsWith("/")&&""===t?"/":t))}const C=/^:[\w-]+$/,k=e=>"*"===e;function D(e,t){let r=e.split("/"),n=r.length;return r.some(k)&&(n+=-2),t&&(n+=2),r.filter((e=>!k(e))).reduce(((e,t)=>e+(C.test(t)?3:""===t?1:10)),n)}function L(e,t,r=!1){let{routesMeta:n}=e,a={},o="/",i=[];for(let s=0;s<n.length;++s){let e=n[s],l=s===n.length-1,u="/"===o?t:t.slice(o.length)||"/",c=M({path:e.relativePath,caseSensitive:e.caseSensitive,end:l},u),d=e.route;if(!c&&l&&r&&!n[n.length-1].route.index&&(c=M({path:e.relativePath,caseSensitive:e.caseSensitive,end:!1},u)),!c)return null;Object.assign(a,c.params),i.push({params:a,pathname:F([o,c.pathname]),pathnameBase:N(F([o,c.pathnameBase])),route:d}),"/"!==c.pathnameBase&&(o=F([o,c.pathnameBase]))}return i}function T(e,t={}){let r=e;r.endsWith("*")&&"*"!==r&&!r.endsWith("/*")&&(r=r.replace(/\*$/,"/*"));const n=r.startsWith("/")?"/":"",a=e=>null==e?"":"string"==typeof e?e:String(e);return n+r.split(/\/+/).map(((e,r,n)=>{if(r===n.length-1&&"*"===e){return a(t["*"])}const o=e.match(/^:([\w-]+)(\??)$/);if(o){const[,e,r]=o;let n=t[e];return"?"!==r&&null==n&&d(!1),a(n)}return e.replace(/\?$/g,"")})).filter((e=>!!e)).join("/")}function M(e,t){"string"==typeof e&&(e={path:e,caseSensitive:!1,end:!0});let[r,n]=function(e,t=!1,r=!0){let n=[],a="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,((e,t,r)=>(n.push({paramName:t,isOptional:null!=r}),r?"/?([^\\/]+)?":"/([^\\/]+)")));e.endsWith("*")?(n.push({paramName:"*"}),a+="*"===e||"/*"===e?"(.*)$":"(?:\\/(.+)|\\/*)$"):r?a+="\\/*$":""!==e&&"/"!==e&&(a+="(?:(?=\\/|$))");return[new RegExp(a,t?void 0:"i"),n]}(e.path,e.caseSensitive,e.end),a=t.match(r);if(!a)return null;let o=a[0],i=o.replace(/(.)\/+$/,"$1"),s=a.slice(1);return{params:n.reduce(((e,{paramName:t,isOptional:r},n)=>{if("*"===t){let e=s[n]||"";i=o.slice(0,o.length-e.length).replace(/(.)\/+$/,"$1")}const a=s[n];return e[t]=r&&!a?void 0:(a||"").replace(/%2F/g,"/"),e}),{}),pathname:o,pathnameBase:i,pattern:e}}function A(e){try{return e.split("/").map((e=>decodeURIComponent(e).replace(/\//g,"%2F"))).join("/")}catch(t){return e}}function _(e,t){if("/"===t)return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let r=t.endsWith("/")?t.length-1:t.length,n=e.charAt(r);return n&&"/"!==n?null:e.slice(r)||"/"}function O(e,t="/"){let{pathname:r,search:n="",hash:a=""}="string"==typeof e?p(e):e,o=r?r.startsWith("/")?r:function(e,t){let r=t.replace(/\/+$/,"").split("/");return e.split("/").forEach((e=>{".."===e?r.length>1&&r.pop():"."!==e&&r.push(e)})),r.length>1?r.join("/"):"/"}(r,t):t;return{pathname:o,search:H(n),hash:$(a)}}function P(e){return e.filter(((e,t)=>0===t||e.route.path&&e.route.path.length>0))}function U(e){let t=P(e);return t.map(((e,r)=>r===t.length-1?e.pathname:e.pathnameBase))}function j(e,t,r,n=!1){let a;"string"==typeof e?a=p(e):(a={...e},a.pathname&&a.pathname.includes("?")&&d(!1),a.pathname&&a.pathname.includes("#")&&d(!1),a.search&&a.search.includes("#")&&d(!1));let o,i=""===e||""===a.pathname,s=i?"/":a.pathname;if(null==s)o=r;else{let e=t.length-1;if(!n&&s.startsWith("..")){let t=s.split("/");for(;".."===t[0];)t.shift(),e-=1;a.pathname=t.join("/")}o=e>=0?t[e]:"/"}let l=O(a,o),u=s&&"/"!==s&&s.endsWith("/"),c=(i||"."===s)&&r.endsWith("/");return l.pathname.endsWith("/")||!u&&!c||(l.pathname+="/"),l}const F=e=>e.join("/").replace(/\/\/+/g,"/"),N=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),H=e=>e&&"?"!==e?e.startsWith("?")?e:"?"+e:"",$=e=>e&&"#"!==e?e.startsWith("#")?e:"#"+e:"",I=(e,t={})=>{let r="number"==typeof t?{status:t}:t,n=new Headers(r.headers);return n.has("Content-Type")||n.set("Content-Type","application/json; charset=utf-8"),new Response(JSON.stringify(e),{...r,headers:n})};class B{type="DataWithResponseInit";constructor(e,t){this.data=e,this.init=t||null}}function z(e,t){return new B(e,"number"==typeof t?{status:t}:t)}const q=(e,t=302)=>{let r=t;"number"==typeof r?r={status:r}:void 0===r.status&&(r.status=302);let n=new Headers(r.headers);return n.set("Location",e),new Response(null,{...r,headers:n})},J=(e,t)=>{let r=q(e,t);return r.headers.set("X-Remix-Reload-Document","true"),r},W=(e,t)=>{let r=q(e,t);return r.headers.set("X-Remix-Replace","true"),r};class Y{constructor(e,t,r,n=!1){this.status=e,this.statusText=t||"",this.internal=n,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 K=["POST","PUT","PATCH","DELETE"],X=new Set(K),G=["GET",...K],Q=new Set(G),Z=new Set([301,302,303,307,308]),ee=new Set([307,308]),te={state:"idle",location:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0},re={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},ae=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,oe=e=>({hasErrorBoundary:Boolean(e.hasErrorBoundary)});function ie(e){const t=e.window?e.window:"undefined"!=typeof window?window:void 0,r=void 0!==t&&void 0!==t.document&&void 0!==t.document.createElement;e.routes.length>0||d(!1);let n,a,o,i=e.mapRouteProperties||oe,l={},u=w(e.routes,i,void 0,l),c=e.basename||"/",h=e.dataStrategy||ge,m=e.patchRoutesOnNavigation,p={...e.future},y=null,v=new Set,x=null,R=null,C=null,k=null!=e.hydrationData,D=b(u,e.history.location,c),L=null;if(null==D&&!m){let t=Ae(404,{pathname:e.history.location.pathname}),{matches:r,route:n}=Me(u);D=r,L={[n.id]:t}}if(D&&!e.hydrationData){rt(D,u,e.history.location.pathname).active&&(D=null)}if(D)if(D.some((e=>e.route.lazy)))a=!1;else if(D.some((e=>e.route.loader))){let t=e.hydrationData?e.hydrationData.loaderData:null,r=e.hydrationData?e.hydrationData.errors:null,n=e=>!e.route.loader||("function"!=typeof e.route.loader||!0!==e.route.loader.hydrate)&&(t&&void 0!==t[e.route.id]||r&&void 0!==r[e.route.id]);if(r){let e=D.findIndex((e=>void 0!==r[e.route.id]));a=D.slice(0,e+1).every(n)}else a=D.every(n)}else a=!0;else{a=!1,D=[];let t=rt(null,u,e.history.location.pathname);t.active&&t.matches&&(D=t.matches)}let T,M,A={historyAction:e.history.action,location:e.history.location,matches:D,initialized:a,navigation:te,restoreScrollPosition:null==e.hydrationData&&null,preventScrollReset:!1,revalidation:"idle",loaderData:e.hydrationData&&e.hydrationData.loaderData||{},actionData:e.hydrationData&&e.hydrationData.actionData||null,errors:e.hydrationData&&e.hydrationData.errors||L,fetchers:new Map,blockers:new Map},O=s.Pop,P=!1,U=!1,j=new Map,F=null,N=!1,H=!1,$=new Set,I=new Map,B=0,z=-1,q=new Map,J=new Set,W=new Map,Y=new Map,K=new Set,X=new Map,G=new Map,Q=null;function Z(e,t={}){A={...A,...e};let r=[],n=[];A.fetchers.forEach(((e,t)=>{"idle"===e.state&&(K.has(t)?r.push(t):n.push(t))})),[...v].forEach((e=>e(A,{deletedFetchers:r,viewTransitionOpts:t.viewTransitionOpts,flushSync:!0===t.flushSync}))),r.forEach((e=>Fe(e))),n.forEach((e=>A.fetchers.delete(e)))}function ie(t,r,{flushSync:a}={}){let o,i=null!=A.actionData&&null!=A.navigation.formMethod&&$e(A.navigation.formMethod)&&"loading"===A.navigation.state&&!0!==t.state?._isRedirect;o=r.actionData?Object.keys(r.actionData).length>0?r.actionData:null:i?A.actionData:null;let l=r.loaderData?De(A.loaderData,r.loaderData,r.matches||[],r.errors):A.loaderData,c=A.blockers;c.size>0&&(c=new Map(c),c.forEach(((e,t)=>c.set(t,ne))));let d,h=!0===P||null!=A.navigation.formMethod&&$e(A.navigation.formMethod)&&!0!==t.state?._isRedirect;if(n&&(u=n,n=void 0),N||O===s.Pop||(O===s.Push?e.history.push(t,t.state):O===s.Replace&&e.history.replace(t,t.state)),O===s.Pop){let e=j.get(A.location.pathname);e&&e.has(t.pathname)?d={currentLocation:A.location,nextLocation:t}:j.has(t.pathname)&&(d={currentLocation:t,nextLocation:A.location})}else if(U){let e=j.get(A.location.pathname);e?e.add(t.pathname):(e=new Set([t.pathname]),j.set(A.location.pathname,e)),d={currentLocation:A.location,nextLocation:t}}Z({...r,actionData:o,loaderData:l,historyAction:O,location:t,initialized:!0,navigation:te,revalidation:"idle",restoreScrollPosition:tt(t,r.matches||A.matches),preventScrollReset:h,blockers:c},{viewTransitionOpts:d,flushSync:!0===a}),O=s.Pop,P=!1,U=!1,N=!1,H=!1,Q?.resolve(),Q=null}async function se(t,r,a){T&&T.abort(),T=null,O=t,N=!0===(a&&a.startUninterruptedRevalidation),function(e,t){if(x&&C){let r=et(e,t);x[r]=C()}}(A.location,A.matches),P=!0===(a&&a.preventScrollReset),U=!0===(a&&a.enableViewTransition);let o=n||u,i=a&&a.overrideNavigation,l=b(o,r,c),d=!0===(a&&a.flushSync),h=rt(l,o,r.pathname);if(h.active&&h.matches&&(l=h.matches),!l){let{error:e,notFoundMatches:t,route:n}=Qe(r.pathname);return void ie(r,{matches:t,loaderData:{},errors:{[n.id]:e}},{flushSync:d})}if(A.initialized&&!H&&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}(A.location,r)&&!(a&&a.submission&&$e(a.submission.formMethod)))return void ie(r,{matches:l},{flushSync:d});T=new AbortController;let f,m=Se(e.history,r,T.signal,a&&a.submission);if(a&&a.pendingError)f=[Te(l).route.id,{type:g.error,error:a.pendingError}];else if(a&&a.submission&&$e(a.submission.formMethod)){let t=await async function(e,t,r,n,a,o={}){let i;if(xe(),Z({navigation:Je(t,r)},{flushSync:!0===o.flushSync}),a){let r=await nt(n,t.pathname,e.signal);if("aborted"===r.type)return{shortCircuited:!0};if("error"===r.type){let{boundaryId:e,error:n}=Ze(t.pathname,r);return{matches:r.partialMatches,pendingActionResult:[e,{type:g.error,error:n}]}}if(!r.matches){let{notFoundMatches:e,error:r,route:n}=Qe(t.pathname);return{matches:e,pendingActionResult:[n.id,{type:g.error,error:r}]}}n=r.matches}let l=Be(n,t);if(l.route.action||l.route.lazy){if(i=(await fe("action",A,e,[l],n,null))[l.route.id],e.signal.aborted)return{shortCircuited:!0}}else i={type:g.error,error:Ae(405,{method:e.method,pathname:t.pathname,routeId:l.route.id})};if(je(i)){let t;if(o&&null!=o.replace)t=o.replace;else{t=Ee(i.response.headers.get("Location"),new URL(e.url),c)===A.location.pathname+A.location.search}return await de(e,i,!0,{submission:r,replace:t}),{shortCircuited:!0}}if(Ue(i)){let e=Te(n,l.route.id);return!0!==(o&&o.replace)&&(O=s.Push),{matches:n,pendingActionResult:[e.route.id,i]}}return{matches:n,pendingActionResult:[l.route.id,i]}}(m,r,a.submission,l,h.active,{replace:a.replace,flushSync:d});if(t.shortCircuited)return;if(t.pendingActionResult){let[e,n]=t.pendingActionResult;if(Ue(n)&&V(n.error)&&404===n.error.status)return T=null,void ie(r,{matches:t.matches,loaderData:{},errors:{[e]:n.error}})}l=t.matches||l,f=t.pendingActionResult,i=qe(r,a.submission),d=!1,h.active=!1,m=Se(e.history,m.url,m.signal)}let{shortCircuited:p,matches:y,loaderData:v,errors:w}=await async function(t,r,a,o,i,s,l,d,h,f,m){let p=i||qe(r,s),y=s||l||ze(p),g=!N&&!h;if(o){if(g){let e=le(m);Z({navigation:p,...void 0!==e?{actionData:e}:{}},{flushSync:f})}let e=await nt(a,r.pathname,t.signal);if("aborted"===e.type)return{shortCircuited:!0};if("error"===e.type){let{boundaryId:t,error:n}=Ze(r.pathname,e);return{matches:e.partialMatches,loaderData:{},errors:{[t]:n}}}if(!e.matches){let{error:e,notFoundMatches:t,route:n}=Qe(r.pathname);return{matches:t,loaderData:{},errors:{[n.id]:e}}}a=e.matches}let v=n||u,[w,b]=he(e.history,A,a,y,r,!0===h,H,$,K,W,J,v,c,m);if(z=++B,0===w.length&&0===b.length){let e=Ie();return ie(r,{matches:a,loaderData:{},errors:m&&Ue(m[1])?{[m[0]]:m[1].error}:null,...Le(m),...e?{fetchers:new Map(A.fetchers)}:{}},{flushSync:f}),{shortCircuited:!0}}if(g){let e={};if(!o){e.navigation=p;let t=le(m);void 0!==t&&(e.actionData=t)}b.length>0&&(e.fetchers=function(e){return e.forEach((e=>{let t=A.fetchers.get(e.key),r=We(void 0,t?t.data:void 0);A.fetchers.set(e.key,r)})),new Map(A.fetchers)}(b)),Z(e,{flushSync:f})}b.forEach((e=>{I.has(e.key)&&Ne(e.key),e.controller&&I.set(e.key,e.controller)}));let E=()=>b.forEach((e=>Ne(e.key)));T&&T.signal.addEventListener("abort",E);let{loaderResults:S,fetcherResults:x}=await me(A,a,w,b,t);if(t.signal.aborted)return{shortCircuited:!0};T&&T.signal.removeEventListener("abort",E);b.forEach((e=>I.delete(e.key)));let R=_e(S);if(R)return await de(t,R.result,!0,{replace:d}),{shortCircuited:!0};if(R=_e(x),R)return J.add(R.key),await de(t,R.result,!0,{replace:d}),{shortCircuited:!0};let{loaderData:C,errors:k}=ke(A,a,w,S,m,b,x);h&&A.errors&&Object.entries(A.errors).filter((([e])=>!w.some((t=>t.route.id===e)))).forEach((([e,t])=>{k=Object.assign(k||{},{[e]:t})}));let D=Ie(),L=Ve(z),M=D||L||b.length>0;return{matches:a,loaderData:C,errors:k,...M?{fetchers:new Map(A.fetchers)}:{}}}(m,r,l,h.active,i,a&&a.submission,a&&a.fetcherSubmission,a&&a.replace,a&&!0===a.initialHydration,d,f);p||(T=null,ie(r,{matches:y||l,...Le(f),loaderData:v,errors:w}))}function le(e){return e&&!Ue(e[1])?{[e[0]]:e[1].data}:A.actionData?0===Object.keys(A.actionData).length?null:A.actionData:void 0}async function de(n,a,o,{submission:i,fetcherSubmission:l,replace:u}={}){a.response.headers.has("X-Remix-Revalidate")&&(H=!0);let h=a.response.headers.get("Location");h||d(!1),h=Ee(h,new URL(n.url),c);let m=f(A.location,h,{_isRedirect:!0});if(r){let r=!1;if(a.response.headers.has("X-Remix-Reload-Document"))r=!0;else if(ae.test(h)){const n=e.history.createURL(h);r=n.origin!==t.location.origin||null==_(n.pathname,c)}if(r)return void(u?t.location.replace(h):t.location.assign(h))}T=null;let p=!0===u||a.response.headers.has("X-Remix-Replace")?s.Replace:s.Push,{formMethod:y,formAction:g,formEncType:v}=A.navigation;!i&&!l&&y&&g&&v&&(i=ze(A.navigation));let w=i||l;if(ee.has(a.response.status)&&w&&$e(w.formMethod))await se(p,m,{submission:{...w,formAction:h},preventScrollReset:P,enableViewTransition:o?U:void 0});else{let e=qe(m,i);await se(p,m,{overrideNavigation:e,fetcherSubmission:l,preventScrollReset:P,enableViewTransition:o?U:void 0})}}async function fe(e,t,r,n,a,o){let s,u={};try{s=await ve(h,e,t,r,n,a,o,l,i)}catch(d){return n.forEach((e=>{u[e.route.id]={type:g.error,error:d}})),u}for(let[i,l]of Object.entries(s))if(Pe(l)){let e=l.result;u[i]={type:g.redirect,response:be(e,r,i,a,c)}}else u[i]=await we(l);return u}async function me(t,r,n,a,o){t.matches;let i=fe("loader",t,o,n,r,null),s=Promise.all(a.map((async r=>{if(r.matches&&r.match&&r.controller){let n=(await fe("loader",t,Se(e.history,r.path,r.controller.signal),[r.match],r.matches,r.key))[r.match.route.id];return{[r.key]:n}}return Promise.resolve({[r.key]:{type:g.error,error:Ae(404,{pathname:r.path})}})})));return{loaderResults:await i,fetcherResults:(await s).reduce(((e,t)=>Object.assign(e,t)),{})}}function xe(){H=!0,W.forEach(((e,t)=>{I.has(t)&&($.add(t),Ne(t))}))}function Re(e,t,r={}){A.fetchers.set(e,t),Z({fetchers:new Map(A.fetchers)},{flushSync:!0===(r&&r.flushSync)})}function Ce(e,t,r,n={}){let a=Te(A.matches,t);Fe(e),Z({errors:{[a.route.id]:r},fetchers:new Map(A.fetchers)},{flushSync:!0===(n&&n.flushSync)})}function Oe(e){return Y.set(e,(Y.get(e)||0)+1),K.has(e)&&K.delete(e),A.fetchers.get(e)||re}function Fe(e){let t=A.fetchers.get(e);!I.has(e)||t&&"loading"===t.state&&q.has(e)||Ne(e),W.delete(e),q.delete(e),J.delete(e),K.delete(e),$.delete(e),A.fetchers.delete(e)}function Ne(e){let t=I.get(e);t||d(!1),t.abort(),I.delete(e)}function He(e){for(let t of e){let e=Ye(Oe(t).data);A.fetchers.set(t,e)}}function Ie(){let e=[],t=!1;for(let r of J){let n=A.fetchers.get(r);n||d(!1),"loading"===n.state&&(J.delete(r),e.push(r),t=!0)}return He(e),t}function Ve(e){let t=[];for(let[r,n]of q)if(n<e){let e=A.fetchers.get(r);e||d(!1),"loading"===e.state&&(Ne(r),q.delete(r),t.push(r))}return He(t),t.length>0}function Ke(e){A.blockers.delete(e),X.delete(e)}function Xe(e,t){let r=A.blockers.get(e)||ne;"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||d(!1);let n=new Map(A.blockers);n.set(e,t),Z({blockers:n})}function Ge({currentLocation:e,nextLocation:t,historyAction:r}){if(0===X.size)return;X.size;let n=Array.from(X.entries()),[a,o]=n[n.length-1],i=A.blockers.get(a);return i&&"proceeding"===i.state?void 0:o({currentLocation:e,nextLocation:t,historyAction:r})?a:void 0}function Qe(e){let t=Ae(404,{pathname:e}),r=n||u,{matches:a,route:o}=Me(r);return{notFoundMatches:a,route:o,error:t}}function Ze(e,t){return{boundaryId:Te(t.partialMatches).route.id,error:Ae(400,{type:"route-discovery",pathname:e,message:null!=t.error&&"message"in t.error?t.error:String(t.error)})}}function et(e,t){if(R){return R(e,t.map((e=>S(e,A.loaderData))))||e.key}return e.key}function tt(e,t){if(x){let r=et(e,t),n=x[r];if("number"==typeof n)return n}return null}function rt(e,t,r){if(m){if(!e){return{active:!0,matches:E(t,r,c,!0)||[]}}if(Object.keys(e[0].params).length>0){return{active:!0,matches:E(t,r,c,!0)}}}return{active:!1,matches:null}}async function nt(e,t,r){let a=e;for(;;){let e=null==n,s=n||u;try{await pe(m,t,a,s,l,i,G,r)}catch(o){return{type:"error",error:o,partialMatches:a}}finally{e&&(u=[...u])}if(r.aborted)return{type:"aborted"};let d=b(s,t,c);if(d)return{type:"success",matches:d};let h=E(s,t,c,!0);if(!h||a.length===h.length&&a.every(((e,t)=>e.route.id===h[t].route.id)))return{type:"success",matches:null};a=h}}return o={get basename(){return c},get future(){return p},get state(){return A},get routes(){return u},get window(){return t},initialize:function(){if(y=e.history.listen((({action:t,location:r,delta:n})=>{if(M)return M(),void(M=void 0);let a=Ge({currentLocation:A.location,nextLocation:r,historyAction:t});if(a&&null!=n){let t=new Promise((e=>{M=e}));return e.history.go(-1*n),void Xe(a,{state:"blocked",location:r,proceed(){Xe(a,{state:"proceeding",proceed:void 0,reset:void 0,location:r}),t.then((()=>e.history.go(n)))},reset(){let e=new Map(A.blockers);e.set(a,ne),Z({blockers:e})}})}return se(t,r)})),r){!function(e,t){try{let r=e.sessionStorage.getItem("remix-router-transitions");if(r){let e=JSON.parse(r);for(let[r,n]of Object.entries(e||{}))n&&Array.isArray(n)&&t.set(r,new Set(n||[]))}}catch(r){}}(t,j);let e=()=>function(e,t){if(t.size>0){let n={};for(let[e,r]of t)n[e]=[...r];try{e.sessionStorage.setItem("remix-router-transitions",JSON.stringify(n))}catch(r){}}}(t,j);t.addEventListener("pagehide",e),F=()=>t.removeEventListener("pagehide",e)}return A.initialized||se(s.Pop,A.location,{initialHydration:!0}),o},subscribe:function(e){return v.add(e),()=>v.delete(e)},enableScrollRestoration:function(e,t,r){if(x=e,C=t,R=r||null,!k&&A.navigation===te){k=!0;let e=tt(A.location,A.matches);null!=e&&Z({restoreScrollPosition:e})}return()=>{x=null,C=null,R=null}},navigate:async function t(r,n){if("number"==typeof r)return void e.history.go(r);let a=ue(A.location,A.matches,c,r,n?.fromRouteId,n?.relative),{path:o,submission:i,error:l}=ce(!1,a,n),u=A.location,d=f(A.location,o,n&&n.state);d={...d,...e.history.encodeLocation(d)};let h=n&&null!=n.replace?n.replace:void 0,m=s.Push;!0===h?m=s.Replace:!1===h||null!=i&&$e(i.formMethod)&&i.formAction===A.location.pathname+A.location.search&&(m=s.Replace);let p=n&&"preventScrollReset"in n?!0===n.preventScrollReset:void 0,y=!0===(n&&n.flushSync),g=Ge({currentLocation:u,nextLocation:d,historyAction:m});g?Xe(g,{state:"blocked",location:d,proceed(){Xe(g,{state:"proceeding",proceed:void 0,reset:void 0,location:d}),t(r,n)},reset(){let e=new Map(A.blockers);e.set(g,ne),Z({blockers:e})}}):await se(m,d,{submission:i,pendingError:l,preventScrollReset:p,replace:n&&n.replace,enableViewTransition:n&&n.viewTransition,flushSync:y})},fetch:async function(t,r,a,o){I.has(t)&&Ne(t);let i=!0===(o&&o.flushSync),s=n||u,l=ue(A.location,A.matches,c,a,r,o?.relative),h=b(s,l,c),f=rt(h,s,l);if(f.active&&f.matches&&(h=f.matches),!h)return void Ce(t,r,Ae(404,{pathname:l}),{flushSync:i});let{path:m,submission:p,error:y}=ce(!0,l,o);if(y)return void Ce(t,r,y,{flushSync:i});let g=Be(h,m);P=!0===(o&&o.preventScrollReset),p&&$e(p.formMethod)?await async function(t,r,a,o,i,s,l,h){function f(e){if(!e.route.action&&!e.route.lazy){let e=Ae(405,{method:h.formMethod,pathname:a,routeId:r});return Ce(t,r,e,{flushSync:l}),!0}return!1}if(xe(),W.delete(t),!s&&f(o))return;let m=A.fetchers.get(t);Re(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}}(h,m),{flushSync:l});let p=new AbortController,y=Se(e.history,a,p.signal,h);if(s){let e=await nt(i,a,y.signal);if("aborted"===e.type)return;if("error"===e.type){let{error:n}=Ze(a,e);return void Ce(t,r,n,{flushSync:l})}if(!e.matches)return void Ce(t,r,Ae(404,{pathname:a}),{flushSync:l});if(f(o=Be(i=e.matches,a)))return}I.set(t,p);let g=B,v=(await fe("action",A,y,[o],i,t))[o.route.id];if(y.signal.aborted)return void(I.get(t)===p&&I.delete(t));if(K.has(t)){if(je(v)||Ue(v))return void Re(t,Ye(void 0))}else{if(je(v))return I.delete(t),z>g?void Re(t,Ye(void 0)):(J.add(t),Re(t,We(h)),de(y,v,!1,{fetcherSubmission:h}));if(Ue(v))return void Ce(t,r,v.error)}let w=A.navigation.location||A.location,E=Se(e.history,w,p.signal),S=n||u,x="idle"!==A.navigation.state?b(S,A.navigation.location,c):A.matches;x||d(!1);let R=++B;q.set(t,R);let C=We(h,v.data);A.fetchers.set(t,C);let[k,D]=he(e.history,A,x,h,w,!1,H,$,K,W,J,S,c,[o.route.id,v]);D.filter((e=>e.key!==t)).forEach((e=>{let t=e.key,r=A.fetchers.get(t),n=We(void 0,r?r.data:void 0);A.fetchers.set(t,n),I.has(t)&&Ne(t),e.controller&&I.set(t,e.controller)})),Z({fetchers:new Map(A.fetchers)});let L=()=>D.forEach((e=>Ne(e.key)));p.signal.addEventListener("abort",L);let{loaderResults:M,fetcherResults:_}=await me(A,x,k,D,E);if(p.signal.aborted)return;p.signal.removeEventListener("abort",L),q.delete(t),I.delete(t),D.forEach((e=>I.delete(e.key)));let P=_e(M);if(P)return de(E,P.result,!1);if(P=_e(_),P)return J.add(P.key),de(E,P.result,!1);let{loaderData:U,errors:j}=ke(A,x,k,M,void 0,D,_);if(A.fetchers.has(t)){let e=Ye(v.data);A.fetchers.set(t,e)}Ve(R),"loading"===A.navigation.state&&R>z?(O||d(!1),T&&T.abort(),ie(A.navigation.location,{matches:x,loaderData:U,errors:j,fetchers:new Map(A.fetchers)})):(Z({errors:j,loaderData:De(A.loaderData,U,x,j),fetchers:new Map(A.fetchers)}),H=!1)}(t,r,m,g,h,f.active,i,p):(W.set(t,{routeId:r,path:m}),await async function(t,r,n,a,o,i,s,l){let u=A.fetchers.get(t);Re(t,We(l,u?u.data:void 0),{flushSync:s});let c=new AbortController,d=Se(e.history,n,c.signal);if(i){let e=await nt(o,n,d.signal);if("aborted"===e.type)return;if("error"===e.type){let{error:a}=Ze(n,e);return void Ce(t,r,a,{flushSync:s})}if(!e.matches)return void Ce(t,r,Ae(404,{pathname:n}),{flushSync:s});a=Be(o=e.matches,n)}I.set(t,c);let h=B,f=(await fe("loader",A,d,[a],o,t))[a.route.id];I.get(t)===c&&I.delete(t);if(d.signal.aborted)return;if(K.has(t))return void Re(t,Ye(void 0));if(je(f))return z>h?void Re(t,Ye(void 0)):(J.add(t),void(await de(d,f,!1)));if(Ue(f))return void Ce(t,r,f.error);Re(t,Ye(f.data))}(t,r,m,g,h,f.active,i,p))},revalidate:function(){Q||(Q=function(){let e,t,r=new Promise(((n,a)=>{e=async e=>{n(e);try{await r}catch(t){}},t=async e=>{a(e);try{await r}catch(t){}}}));return{promise:r,resolve:e,reject:t}}()),xe(),Z({revalidation:"loading"});let e=Q.promise;return"submitting"===A.navigation.state?e:"idle"===A.navigation.state?(se(A.historyAction,A.location,{startUninterruptedRevalidation:!0}),e):(se(O||A.historyAction,A.navigation.location,{overrideNavigation:A.navigation,enableViewTransition:!0===U}),e)},createHref:t=>e.history.createHref(t),encodeLocation:t=>e.history.encodeLocation(t),getFetcher:Oe,deleteFetcher:function(e){let t=(Y.get(e)||0)-1;t<=0?(Y.delete(e),K.add(e)):Y.set(e,t),Z({fetchers:new Map(A.fetchers)})},dispose:function(){y&&y(),F&&F(),v.clear(),T&&T.abort(),A.fetchers.forEach(((e,t)=>Fe(t))),A.blockers.forEach(((e,t)=>Ke(t)))},getBlocker:function(e,t){let r=A.blockers.get(e)||ne;return X.get(e)!==t&&X.set(e,t),r},deleteBlocker:Ke,patchRoutes:function(e,t){let r=null==n;ye(e,t,n||u,l,i),r&&(u=[...u],Z({}))},_internalFetchControllers:I,_internalSetRoutes:function(e){l={},n=w(e,i,void 0,l)}},o}function se(e,t){e.length>0||d(!1);let r={},n=(t?t.basename:null)||"/",a=t?.mapRouteProperties||oe,o=w(e,a,void 0,r);async function i(e,t,r,n,a,o,i){e.signal||d(!1);try{if($e(e.method)){let u=await async function(e,t,r,n,a,o,i){let u;if(r.route.action||r.route.lazy){u=(await l("action",e,[r],t,i,n,a))[r.route.id],e.signal.aborted&&le(e,i)}else{let t=Ae(405,{method:e.method,pathname:new URL(e.url).pathname,routeId:r.route.id});if(i)throw t;u={type:g.error,error:t}}if(je(u))throw new Response(null,{status:u.response.status,headers:{Location:u.response.headers.get("Location")}});if(i){if(Ue(u))throw u.error;return{matches:[r],loaderData:{},actionData:{[r.route.id]:u.data},errors:null,statusCode:200,loaderHeaders:{},actionHeaders:{}}}let c=new Request(e.url,{headers:e.headers,redirect:e.redirect,signal:e.signal});if(Ue(u)){let e=o?r:Te(t,r.route.id);return{...await s(c,t,n,a,o,null,[e.route.id,u]),statusCode:V(u.error)?u.error.status:null!=u.statusCode?u.statusCode:500,actionData:null,actionHeaders:{...u.headers?{[r.route.id]:u.headers}:{}}}}return{...await s(c,t,n,a,o,null),actionData:{[r.route.id]:u.data},...u.statusCode?{statusCode:u.statusCode}:{},actionHeaders:u.headers?{[r.route.id]:u.headers}:{}}}(e,r,i||Be(r,t),n,a,o,null!=i);return u}let u=await s(e,r,n,a,o,i);return Ne(u)?u:{...u,actionData:null,actionHeaders:{}}}catch(u){if(function(e){return null!=e&&"object"==typeof e&&"type"in e&&"result"in e&&(e.type===g.data||e.type===g.error)}(u)&&Ne(u.result)){if(u.type===g.error)throw u.result;return u.result}if(function(e){if(!Ne(e))return!1;let t=e.status,r=e.headers.get("Location");return t>=300&&t<=399&&null!=r}(u))return u;throw u}}async function s(e,t,r,n,a,o,i){let s=null!=o;if(s&&!o?.route.loader&&!o?.route.lazy)throw Ae(400,{method:e.method,pathname:new URL(e.url).pathname,routeId:o?.route.id});let u=(o?[o]:i&&Ue(i[1])?de(t,i[0]):t).filter((e=>e.route.loader||e.route.lazy));if(0===u.length)return{matches:t,loaderData:t.reduce(((e,t)=>Object.assign(e,{[t.route.id]:null})),{}),errors:i&&Ue(i[1])?{[i[0]]:i[1].error}:null,statusCode:200,loaderHeaders:{}};let c=await l("loader",e,u,t,s,r,n);e.signal.aborted&&le(e,s);let d=Ce(t,c,i,a),h=new Set(u.map((e=>e.route.id)));return t.forEach((e=>{h.has(e.route.id)||(d.loaderData[e.route.id]=null)})),{...d,matches:t}}async function l(e,t,o,i,s,l,u){let c=await ve(u||ge,e,null,t,o,i,null,r,a,l),d={};return await Promise.all(i.map((async e=>{if(!(e.route.id in c))return;let r=c[e.route.id];if(Pe(r)){throw be(r.result,t,e.route.id,i,n)}if(Ne(r.result)&&s)throw r;d[e.route.id]=await we(r)}))),d}return{dataRoutes:o,query:async function(e,{requestContext:t,skipLoaderErrorBubbling:r,dataStrategy:a}={}){let s=new URL(e.url),l=e.method,u=f("",m(s),null,"default"),c=b(o,u,n);if(!He(l)&&"HEAD"!==l){let e=Ae(405,{method:l}),{matches:t,route:r}=Me(o);return{basename:n,location:u,matches:t,loaderData:{},actionData:null,errors:{[r.id]:e},statusCode:e.status,loaderHeaders:{},actionHeaders:{}}}if(!c){let e=Ae(404,{pathname:u.pathname}),{matches:t,route:r}=Me(o);return{basename:n,location:u,matches:t,loaderData:{},actionData:null,errors:{[r.id]:e},statusCode:e.status,loaderHeaders:{},actionHeaders:{}}}let d=await i(e,u,c,t,a||null,!0===r,null);return Ne(d)?d:{location:u,basename:n,...d}},queryRoute:async function(e,{routeId:t,requestContext:r,dataStrategy:a}={}){let s=new URL(e.url),l=e.method,u=f("",m(s),null,"default"),c=b(o,u,n);if(!He(l)&&"HEAD"!==l&&"OPTIONS"!==l)throw Ae(405,{method:l});if(!c)throw Ae(404,{pathname:u.pathname});let d=t?c.find((e=>e.route.id===t)):Be(c,u);if(t&&!d)throw Ae(403,{pathname:u.pathname,routeId:t});if(!d)throw Ae(404,{pathname:u.pathname});let h=await i(e,u,c,r,a||null,!1,d);if(Ne(h))return h;let p=h.errors?Object.values(h.errors)[0]:void 0;if(void 0!==p)throw p;return h.actionData?Object.values(h.actionData)[0]:h.loaderData?Object.values(h.loaderData)[0]:void 0}}}function le(e,t){if(void 0!==e.signal.reason)throw e.signal.reason;throw new Error(`${t?"queryRoute":"query"}() call aborted without an \`AbortSignal.reason\`: ${e.method} ${e.url}`)}function ue(e,t,r,n,a,o){let i,s;if(a){i=[];for(let e of t)if(i.push(e),e.route.id===a){s=e;break}}else i=t,s=t[t.length-1];let l=j(n||".",U(i),_(e.pathname,r)||e.pathname,"path"===o);return null==n&&(l.search=e.search,l.hash=e.hash),null!=n&&""!==n&&"."!==n||!s||!s.route.index||Ie(l.search)||(l.search=l.search?l.search.replace(/^\?/,"?index&"):"?index"),"/"!==r&&(l.pathname="/"===l.pathname?r:F([r,l.pathname])),m(l)}function ce(e,t,r){if(!r||!function(e){return null!=e&&("formData"in e&&null!=e.formData||"body"in e&&void 0!==e.body)}(r))return{path:t};if(r.formMethod&&!He(r.formMethod))return{path:t,error:Ae(405,{method:r.formMethod})};let n,a,o=()=>({path:t,error:Ae(400,{type:"invalid-body"})}),i=(r.formMethod||"get").toUpperCase(),s=Oe(t);if(void 0!==r.body){if("text/plain"===r.formEncType){if(!$e(i))return o();let e="string"==typeof r.body?r.body:r.body instanceof FormData||r.body instanceof URLSearchParams?Array.from(r.body.entries()).reduce(((e,[t,r])=>`${e}${t}=${r}\n`),""):String(r.body);return{path:t,submission:{formMethod:i,formAction:s,formEncType:r.formEncType,formData:void 0,json:void 0,text:e}}}if("application/json"===r.formEncType){if(!$e(i))return o();try{let e="string"==typeof r.body?JSON.parse(r.body):r.body;return{path:t,submission:{formMethod:i,formAction:s,formEncType:r.formEncType,formData:void 0,json:e,text:void 0}}}catch(c){return o()}}}if("function"!=typeof FormData&&d(!1),r.formData)n=xe(r.formData),a=r.formData;else if(r.body instanceof FormData)n=xe(r.body),a=r.body;else if(r.body instanceof URLSearchParams)n=r.body,a=Re(n);else if(null==r.body)n=new URLSearchParams,a=new FormData;else try{n=new URLSearchParams(r.body),a=Re(n)}catch(c){return o()}let l={formMethod:i,formAction:s,formEncType:r&&r.formEncType||"application/x-www-form-urlencoded",formData:a,json:void 0,text:void 0};if($e(l.formMethod))return{path:t,submission:l};let u=p(t);return e&&u.search&&Ie(u.search)&&n.append("index",""),u.search=`?${n}`,{path:m(u),submission:l}}function de(e,t){let r=e;if(t){let n=e.findIndex((e=>e.route.id===t));n>=0&&(r=e.slice(0,n))}return r}function he(e,t,r,n,a,o,i,s,l,u,c,d,h,f){let m=f?Ue(f[1])?f[1].error:f[1].data:void 0,p=e.createURL(t.location),y=e.createURL(a),g=f&&Ue(f[1])?f[0]:void 0,v=g?de(r,g):r,w=f?f[1].statusCode:void 0,E=w&&w>=400,S=v.filter(((e,r)=>{let{route:a}=e;if(a.lazy)return!0;if(null==a.loader)return!1;if(o)return!("function"==typeof a.loader&&!a.loader.hydrate)||void 0===t.loaderData[a.id]&&(!t.errors||void 0===t.errors[a.id]);if(function(e,t,r){let n=!t||r.route.id!==t.route.id,a=void 0===e[r.route.id];return n||a}(t.loaderData,t.matches[r],e))return!0;let s=t.matches[r],l=e;return me(e,{currentUrl:p,currentParams:s.params,nextUrl:y,nextParams:l.params,...n,actionResult:m,actionStatus:w,defaultShouldRevalidate:!E&&(i||p.pathname+p.search===y.pathname+y.search||p.search!==y.search||fe(s,l))})})),x=[];return u.forEach(((e,a)=>{if(o||!r.some((t=>t.route.id===e.routeId))||l.has(a))return;let u=b(d,e.path,h);if(!u)return void x.push({key:a,routeId:e.routeId,path:e.path,matches:null,match:null,controller:null});let f=t.fetchers.get(a),g=Be(u,e.path),v=!1;c.has(a)?v=!1:s.has(a)?(s.delete(a),v=!0):v=f&&"idle"!==f.state&&void 0===f.data?i:me(g,{currentUrl:p,currentParams:t.matches[t.matches.length-1].params,nextUrl:y,nextParams:r[r.length-1].params,...n,actionResult:m,actionStatus:w,defaultShouldRevalidate:!E&&i}),v&&x.push({key:a,routeId:e.routeId,path:e.path,matches:u,match:g,controller:new AbortController})})),[S,x]}function fe(e,t){let r=e.route.path;return e.pathname!==t.pathname||null!=r&&r.endsWith("*")&&e.params["*"]!==t.params["*"]}function me(e,t){if(e.route.shouldRevalidate){let r=e.route.shouldRevalidate(t);if("boolean"==typeof r)return r}return t.defaultShouldRevalidate}async function pe(e,t,r,n,a,o,i,s){let l=[t,...r.map((e=>e.route.id))].join("-");try{let c=i.get(l);c||(c=e({path:t,matches:r,patch:(e,t)=>{s.aborted||ye(e,t,n,a,o)}}),i.set(l,c)),c&&("object"==typeof(u=c)&&null!=u&&"then"in u)&&await c}finally{i.delete(l)}var u}function ye(e,t,r,n,a){let o;if(e){let t=n[e];t||d(!1),t.children||(t.children=[]),o=t.children}else o=r;let i=w(t.filter((e=>!o.some((t=>e.index===t.index&&e.path===t.path&&e.caseSensitive===t.caseSensitive)))),a,[e||"_","patch",String(o?.length||"0")],n);o.push(...i)}async function ge({matches:e}){let t=e.filter((e=>e.shouldLoad));return(await Promise.all(t.map((e=>e.resolve())))).reduce(((e,r,n)=>Object.assign(e,{[t[n].route.id]:r})),{})}async function ve(e,t,r,n,a,o,i,s,l,u){let c=o.map((e=>e.route.lazy?async function(e,t,r){if(!e.lazy)return;let n=await e.lazy();if(!e.lazy)return;let a=r[e.id];a||d(!1);let o={};for(let i in n)void 0!==a[i]&&"hasErrorBoundary"!==i||v.has(i)||(o[i]=n[i]);Object.assign(a,o),Object.assign(a,{...t(a),lazy:void 0})}(e.route,l,s):void 0)),h=o.map(((e,r)=>{let o=c[r],i=a.some((t=>t.route.id===e.route.id));return{...e,shouldLoad:i,resolve:async r=>(r&&"GET"===n.method&&(e.route.lazy||e.route.loader)&&(i=!0),i?async function(e,t,r,n,a,o){let i,s,l=n=>{let i,l=new Promise(((e,t)=>i=t));s=()=>i(),t.signal.addEventListener("abort",s);let u=a=>"function"!=typeof n?Promise.reject(new Error(`You cannot call the handler for a route which defines a boolean "${e}" [routeId: ${r.route.id}]`)):n({request:t,params:r.params,context:o},...void 0!==a?[a]:[]),c=(async()=>{try{return{type:"data",result:await(a?a((e=>u(e))):u())}}catch(e){return{type:"error",result:e}}})();return Promise.race([c,l])};try{let a=r.route[e];if(n)if(a){let e,[t]=await Promise.all([l(a).catch((t=>{e=t})),n]);if(void 0!==e)throw e;i=t}else{if(await n,a=r.route[e],!a){if("action"===e){let e=new URL(t.url),n=e.pathname+e.search;throw Ae(405,{method:t.method,pathname:n,routeId:r.route.id})}return{type:g.data,result:void 0}}i=await l(a)}else{if(!a){let e=new URL(t.url);throw Ae(404,{pathname:e.pathname+e.search})}i=await l(a)}}catch(u){return{type:g.error,result:u}}finally{s&&t.signal.removeEventListener("abort",s)}return i}(t,n,e,o,r,u):Promise.resolve({type:g.data,result:void 0}))}})),f=await e({matches:h,request:n,params:o[0].params,fetcherKey:i,context:u});try{await Promise.all(c)}catch(m){}return f}async function we(e){let{result:t,type:r}=e;if(Ne(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(n){return{type:g.error,error:n}}return r===g.error?{type:g.error,error:new Y(t.status,t.statusText,e),statusCode:t.status,headers:t.headers}:{type:g.data,data:e,statusCode:t.status,headers:t.headers}}if(r===g.error){if(Fe(t)){if(t.data instanceof Error)return{type:g.error,error:t.data,statusCode:t.init?.status};t=new Y(t.init?.status||500,void 0,t.data)}return{type:g.error,error:t,statusCode:V(t)?t.status:void 0}}return Fe(t)?{type:g.data,data:t.data,statusCode:t.init?.status,headers:t.init?.headers?new Headers(t.init.headers):void 0}:{type:g.data,data:t}}function be(e,t,r,n,a){let o=e.headers.get("Location");if(o||d(!1),!ae.test(o)){let i=n.slice(0,n.findIndex((e=>e.route.id===r))+1);o=ue(new URL(t.url),i,a,o),e.headers.set("Location",o)}return e}function Ee(e,t,r){if(ae.test(e)){let n=e,a=n.startsWith("//")?new URL(t.protocol+n):new URL(n),o=null!=_(a.pathname,r);if(a.origin===t.origin&&o)return a.pathname+a.search+a.hash}return e}function Se(e,t,r,n){let a=e.createURL(Oe(t)).toString(),o={signal:r};if(n&&$e(n.formMethod)){let{formMethod:e,formEncType:t}=n;o.method=e.toUpperCase(),"application/json"===t?(o.headers=new Headers({"Content-Type":t}),o.body=JSON.stringify(n.json)):"text/plain"===t?o.body=n.text:"application/x-www-form-urlencoded"===t&&n.formData?o.body=xe(n.formData):o.body=n.formData}return new Request(a,o)}function xe(e){let t=new URLSearchParams;for(let[r,n]of e.entries())t.append(r,"string"==typeof n?n:n.name);return t}function Re(e){let t=new FormData;for(let[r,n]of e.entries())t.append(r,n);return t}function Ce(e,t,r,n){let a,o={},i=null,s=!1,l={},u=r&&Ue(r[1])?r[1].error:void 0;return e.forEach((r=>{if(!(r.route.id in t))return;let c=r.route.id,h=t[c];if(je(h)&&d(!1),Ue(h)){let t=h.error;if(void 0!==u&&(t=u,u=void 0),i=i||{},n)i[c]=t;else{let r=Te(e,c);null==i[r.route.id]&&(i[r.route.id]=t)}o[c]=void 0,s||(s=!0,a=V(h.error)?h.error.status:500),h.headers&&(l[c]=h.headers)}else o[c]=h.data,h.statusCode&&200!==h.statusCode&&!s&&(a=h.statusCode),h.headers&&(l[c]=h.headers)})),void 0!==u&&r&&(i={[r[0]]:u},o[r[0]]=void 0),{loaderData:o,errors:i,statusCode:a||200,loaderHeaders:l}}function ke(e,t,r,n,a,o,i){let{loaderData:s,errors:l}=Ce(t,n,a,!1);return o.forEach((t=>{let{key:r,match:n,controller:a}=t,o=i[r];if(o||d(!1),!a||!a.signal.aborted)if(Ue(o)){let t=Te(e.matches,n?.route.id);l&&l[t.route.id]||(l={...l,[t.route.id]:o.error}),e.fetchers.delete(r)}else if(je(o))d(!1);else{let t=Ye(o.data);e.fetchers.set(r,t)}})),{loaderData:s,errors:l}}function De(e,t,r,n){let a={...t};for(let o of r){let r=o.route.id;if(t.hasOwnProperty(r)?void 0!==t[r]&&(a[r]=t[r]):void 0!==e[r]&&o.route.loader&&(a[r]=e[r]),n&&n.hasOwnProperty(r))break}return a}function Le(e){return e?Ue(e[1])?{actionData:{}}:{actionData:{[e[0]]:e[1].data}}:{}}function Te(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 Me(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 Ae(e,{pathname:t,routeId:r,method:n,type:a,message:o}={}){let i="Unknown Server Error",s="Unknown @remix-run/router error";return 400===e?(i="Bad Request","route-discovery"===a?s=`Unable to match URL "${t}" - the \`patchRoutesOnNavigation()\` function threw the following error:\n${o}`:n&&t&&r?s=`You made a ${n} request to "${t}" but did not provide a \`loader\` for route "${r}", so there is no way to handle the request.`:"invalid-body"===a&&(s="Unable to encode submission body")):403===e?(i="Forbidden",s=`Route "${r}" does not match URL "${t}"`):404===e?(i="Not Found",s=`No route matches URL "${t}"`):405===e&&(i="Method Not Allowed",n&&t&&r?s=`You made a ${n.toUpperCase()} request to "${t}" but did not provide an \`action\` for route "${r}", so there is no way to handle the request.`:n&&(s=`Invalid request method "${n.toUpperCase()}"`)),new Y(e||500,i,new Error(s),!0)}function _e(e){let t=Object.entries(e);for(let r=t.length-1;r>=0;r--){let[e,n]=t[r];if(je(n))return{key:e,result:n}}}function Oe(e){return m({..."string"==typeof e?p(e):e,hash:""})}function Pe(e){return Ne(e.result)&&Z.has(e.result.status)}function Ue(e){return e.type===g.error}function je(e){return(e&&e.type)===g.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){return null!=e&&"number"==typeof e.status&&"string"==typeof e.statusText&&"object"==typeof e.headers&&void 0!==e.body}function He(e){return Q.has(e.toUpperCase())}function $e(e){return X.has(e.toUpperCase())}function Ie(e){return new URLSearchParams(e).getAll("index").some((e=>""===e))}function Be(e,t){let r="string"==typeof t?p(t).search:t.search;if(e[e.length-1].route.index&&Ie(r||""))return e[e.length-1];let n=P(e);return n[n.length-1]}function ze(e){let{formMethod:t,formAction:r,formEncType:n,text:a,formData:o,json:i}=e;if(t&&r&&n)return null!=a?{formMethod:t,formAction:r,formEncType:n,formData:void 0,json:void 0,text:a}:null!=o?{formMethod:t,formAction:r,formEncType:n,formData:o,json:void 0,text:void 0}:void 0!==i?{formMethod:t,formAction:r,formEncType:n,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 Je(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 We(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 Ye(e){return{state:"idle",formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0,data:e}}const Ve=e.createContext(null);Ve.displayName="DataRouter";const Ke=e.createContext(null);Ke.displayName="DataRouterState";const Xe=e.createContext({isTransitioning:!1});Xe.displayName="ViewTransition";const Ge=e.createContext(new Map);Ge.displayName="Fetchers";const Qe=e.createContext(null);Qe.displayName="Await";const Ze=e.createContext(null);Ze.displayName="Navigation";const et=e.createContext(null);et.displayName="Location";const tt=e.createContext({outlet:null,matches:[],isDataRoute:!1});tt.displayName="Route";const rt=e.createContext(null);function nt(t,{relative:r}={}){at()||d(!1);let{basename:n,navigator:a}=e.useContext(Ze),{hash:o,pathname:i,search:s}=mt(t,{relative:r}),l=i;return"/"!==n&&(l="/"===i?n:F([n,i])),a.createHref({pathname:l,search:s,hash:o})}function at(){return null!=e.useContext(et)}function ot(){return at()||d(!1),e.useContext(et).location}function it(){return e.useContext(et).navigationType}function st(t){at()||d(!1);let{pathname:r}=ot();return e.useMemo((()=>M(t,A(r))),[r,t])}function lt(t){e.useContext(Ze).static||e.useLayoutEffect(t)}function ut(){let{isDataRoute:t}=e.useContext(tt);return t?function(){let{router:t}=Rt(St.UseNavigateStable),r=kt(xt.UseNavigateStable),n=e.useRef(!1);return lt((()=>{n.current=!0})),e.useCallback((async(e,a={})=>{n.current&&("number"==typeof e?t.navigate(e):await t.navigate(e,{fromRouteId:r,...a}))}),[t,r])}():function(){at()||d(!1);let t=e.useContext(Ve),{basename:r,navigator:n}=e.useContext(Ze),{matches:a}=e.useContext(tt),{pathname:o}=ot(),i=JSON.stringify(U(a)),s=e.useRef(!1);return lt((()=>{s.current=!0})),e.useCallback(((e,a={})=>{if(!s.current)return;if("number"==typeof e)return void n.go(e);let l=j(e,JSON.parse(i),o,"path"===a.relative);null==t&&"/"!==r&&(l.pathname="/"===l.pathname?r:F([r,l.pathname])),(a.replace?n.replace:n.push)(l,a.state,a)}),[r,n,i,o,t])}()}rt.displayName="RouteError";const ct=e.createContext(null);function dt(){return e.useContext(ct)}function ht(t){let r=e.useContext(tt).outlet;return r?e.createElement(ct.Provider,{value:t},r):r}function ft(){let{matches:t}=e.useContext(tt),r=t[t.length-1];return r?r.params:{}}function mt(t,{relative:r}={}){let{matches:n}=e.useContext(tt),{pathname:a}=ot(),o=JSON.stringify(U(n));return e.useMemo((()=>j(t,JSON.parse(o),a,"path"===r)),[t,o,a,r])}function pt(e,t){return yt(e,t)}function yt(t,r,n,a){at()||d(!1);let{navigator:o}=e.useContext(Ze),{matches:i}=e.useContext(tt),l=i[i.length-1],u=l?l.params:{},c=l?l.pathname:"/",h=l?l.pathnameBase:"/",f=l&&l.route;{let e=f&&f.path||"";Ht(c,!f||e.endsWith("*"))}let m,y=ot();if(r){let e="string"==typeof r?p(r):r;"/"===h||e.pathname?.startsWith(h)||d(!1),m=e}else m=y;let g=m.pathname||"/",v=g;if("/"!==h){let e=h.replace(/^\//,"").split("/");v="/"+g.replace(/^\//,"").split("/").slice(e.length).join("/")}let w=b(t,{pathname:v}),E=Et(w&&w.map((e=>Object.assign({},e,{params:Object.assign({},u,e.params),pathname:F([h,o.encodeLocation?o.encodeLocation(e.pathname).pathname:e.pathname]),pathnameBase:"/"===e.pathnameBase?h:F([h,o.encodeLocation?o.encodeLocation(e.pathnameBase).pathname:e.pathnameBase])}))),i,n,a);return r&&E?e.createElement(et.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",...m},navigationType:s.Pop}},E):E}function gt(){let t=Ot(),r=V(t)?`${t.status} ${t.statusText}`:t instanceof Error?t.message:JSON.stringify(t),n=t instanceof Error?t.stack:null,a="rgba(200,200,200, 0.5)",o={padding:"0.5rem",backgroundColor:a},i={padding:"2px 4px",backgroundColor:a},s=null;return console.error("Error handled by React Router default ErrorBoundary:",t),s=e.createElement(e.Fragment,null,e.createElement("p",null,"💿 Hey developer 👋"),e.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",e.createElement("code",{style:i},"ErrorBoundary")," or"," ",e.createElement("code",{style:i},"errorElement")," prop on your route.")),e.createElement(e.Fragment,null,e.createElement("h2",null,"Unexpected Application Error!"),e.createElement("h3",{style:{fontStyle:"italic"}},r),n?e.createElement("pre",{style:o},n):null,s)}const vt=e.createElement(gt,null);class wt extends e.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,t){return t.location!==e.location||"idle"!==t.revalidation&&"idle"===e.revalidation?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:void 0!==e.error?e.error:t.error,location:t.location,revalidation:e.revalidation||t.revalidation}}componentDidCatch(e,t){console.error("React Router caught the following error during render",e,t)}render(){return void 0!==this.state.error?e.createElement(tt.Provider,{value:this.props.routeContext},e.createElement(rt.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function bt({routeContext:t,match:r,children:n}){let a=e.useContext(Ve);return a&&a.static&&a.staticContext&&(r.route.errorElement||r.route.ErrorBoundary)&&(a.staticContext._deepestRenderedBoundaryId=r.route.id),e.createElement(tt.Provider,{value:t},n)}function Et(t,r=[],n=null,a=null){if(null==t){if(!n)return null;if(n.errors)t=n.matches;else{if(0!==r.length||n.initialized||!(n.matches.length>0))return null;t=n.matches}}let o=t,i=n?.errors;if(null!=i){let e=o.findIndex((e=>e.route.id&&void 0!==i?.[e.route.id]));e>=0||d(!1),o=o.slice(0,Math.min(o.length,e+1))}let s=!1,l=-1;if(n)for(let e=0;e<o.length;e++){let t=o[e];if((t.route.HydrateFallback||t.route.hydrateFallbackElement)&&(l=e),t.route.id){let{loaderData:e,errors:r}=n,a=t.route.loader&&void 0===e[t.route.id]&&(!r||void 0===r[t.route.id]);if(t.route.lazy||a){s=!0,o=l>=0?o.slice(0,l+1):[o[0]];break}}}return o.reduceRight(((t,a,u)=>{let c,d=!1,h=null,f=null;n&&(c=i&&a.route.id?i[a.route.id]:void 0,h=a.route.errorElement||vt,s&&(l<0&&0===u?(Ht("route-fallback",!1),d=!0,f=null):l===u&&(d=!0,f=a.route.hydrateFallbackElement||null)));let m=r.concat(o.slice(0,u+1)),p=()=>{let r;return r=c?h:d?f:a.route.Component?e.createElement(a.route.Component,null):a.route.element?a.route.element:t,e.createElement(bt,{match:a,routeContext:{outlet:t,matches:m,isDataRoute:null!=n},children:r})};return n&&(a.route.ErrorBoundary||a.route.errorElement||0===u)?e.createElement(wt,{location:n.location,revalidation:n.revalidation,component:h,error:c,children:p(),routeContext:{outlet:null,matches:m,isDataRoute:!0}}):p()}),null)}var St=function(e){return e.UseBlocker="useBlocker",e.UseRevalidator="useRevalidator",e.UseNavigateStable="useNavigate",e}(St||{}),xt=function(e){return e.UseBlocker="useBlocker",e.UseLoaderData="useLoaderData",e.UseActionData="useActionData",e.UseRouteError="useRouteError",e.UseNavigation="useNavigation",e.UseRouteLoaderData="useRouteLoaderData",e.UseMatches="useMatches",e.UseRevalidator="useRevalidator",e.UseNavigateStable="useNavigate",e.UseRouteId="useRouteId",e}(xt||{});function Rt(t){let r=e.useContext(Ve);return r||d(!1),r}function Ct(t){let r=e.useContext(Ke);return r||d(!1),r}function kt(t){let r=function(t){let r=e.useContext(tt);return r||d(!1),r}(),n=r.matches[r.matches.length-1];return n.route.id||d(!1),n.route.id}function Dt(){return Ct(xt.UseNavigation).navigation}function Lt(){let t=Rt(St.UseRevalidator),r=Ct(xt.UseRevalidator);return e.useMemo((()=>({async revalidate(){await t.router.revalidate()},state:r.revalidation})),[t.router,r.revalidation])}function Tt(){let{matches:t,loaderData:r}=Ct(xt.UseMatches);return e.useMemo((()=>t.map((e=>S(e,r)))),[t,r])}function Mt(){let e=Ct(xt.UseLoaderData),t=kt(xt.UseLoaderData);return e.loaderData[t]}function At(e){return Ct(xt.UseRouteLoaderData).loaderData[e]}function _t(){let e=Ct(xt.UseActionData),t=kt(xt.UseLoaderData);return e.actionData?e.actionData[t]:void 0}function Ot(){let t=e.useContext(rt),r=Ct(xt.UseRouteError),n=kt(xt.UseRouteError);return void 0!==t?t:r.errors?.[n]}function Pt(){return e.useContext(Qe)?._data}function Ut(){return e.useContext(Qe)?._error}let jt=0;function Ft(t){let{router:r,basename:n}=Rt(St.UseBlocker),a=Ct(xt.UseBlocker),[o,i]=e.useState(""),s=e.useCallback((e=>{if("function"!=typeof t)return!!t;if("/"===n)return t(e);let{currentLocation:r,nextLocation:a,historyAction:o}=e;return t({currentLocation:{...r,pathname:_(r.pathname,n)||r.pathname},nextLocation:{...a,pathname:_(a.pathname,n)||a.pathname},historyAction:o})}),[n,t]);return e.useEffect((()=>{let e=String(++jt);return i(e),()=>r.deleteBlocker(e)}),[r]),e.useEffect((()=>{""!==o&&r.getBlocker(o,s)}),[r,o,s]),o&&a.blockers.has(o)?a.blockers.get(o):ne}const Nt={};function Ht(e,t,r){t||Nt[e]||(Nt[e]=!0)}const $t={};function It(e,t){e||$t[t]||($t[t]=!0,console.warn(t))}function Bt(t){let r={hasErrorBoundary:t.hasErrorBoundary||null!=t.ErrorBoundary||null!=t.errorElement};return t.Component&&(t.element,Object.assign(r,{element:e.createElement(t.Component),Component:void 0})),t.HydrateFallback&&(t.hydrateFallbackElement,Object.assign(r,{hydrateFallbackElement:e.createElement(t.HydrateFallback),HydrateFallback:void 0})),t.ErrorBoundary&&(t.errorElement,Object.assign(r,{errorElement:e.createElement(t.ErrorBoundary),ErrorBoundary:void 0})),r}function zt(e,t){return ie({basename:t?.basename,future:t?.future,history:l({initialEntries:t?.initialEntries,initialIndex:t?.initialIndex}),hydrationData:t?.hydrationData,routes:e,mapRouteProperties:Bt,dataStrategy:t?.dataStrategy,patchRoutesOnNavigation:t?.patchRoutesOnNavigation}).initialize()}class qt{status="pending";constructor(){this.promise=new Promise(((e,t)=>{this.resolve=t=>{"pending"===this.status&&(this.status="resolved",e(t))},this.reject=e=>{"pending"===this.status&&(this.status="rejected",t(e))}}))}}function Jt({router:t,flushSync:r}){let[n,a]=e.useState(t.state),[o,i]=e.useState(),[s,l]=e.useState({isTransitioning:!1}),[u,c]=e.useState(),[d,h]=e.useState(),[f,m]=e.useState(),p=e.useRef(new Map),y=e.useCallback(((n,{deletedFetchers:o,flushSync:s,viewTransitionOpts:f})=>{o.forEach((e=>p.current.delete(e))),n.fetchers.forEach(((e,t)=>{void 0!==e.data&&p.current.set(t,e.data)})),It(!1===s||null!=r,'You provided the `flushSync` option to a router update, but you are not using the `<RouterProvider>` from `react-router/dom` so `ReactDOM.flushSync()` is unavailable. Please update your app to `import { RouterProvider } from "react-router/dom"` and ensure you have `react-dom` installed as a dependency to use the `flushSync` option.');let y=null!=t.window&&null!=t.window.document&&"function"==typeof t.window.document.startViewTransition;if(It(null==f||y,"You provided the `viewTransition` option to a router update, but you do not appear to be running in a DOM environment as `window.startViewTransition` is not available."),f&&y){if(r&&s){r((()=>{d&&(u&&u.resolve(),d.skipTransition()),l({isTransitioning:!0,flushSync:!0,currentLocation:f.currentLocation,nextLocation:f.nextLocation})}));let e=t.window.document.startViewTransition((()=>{r((()=>a(n)))}));return e.finished.finally((()=>{r((()=>{c(void 0),h(void 0),i(void 0),l({isTransitioning:!1})}))})),void r((()=>h(e)))}d?(u&&u.resolve(),d.skipTransition(),m({state:n,currentLocation:f.currentLocation,nextLocation:f.nextLocation})):(i(n),l({isTransitioning:!0,flushSync:!1,currentLocation:f.currentLocation,nextLocation:f.nextLocation}))}else r&&s?r((()=>a(n))):e.startTransition((()=>a(n)))}),[t.window,r,d,u]);e.useLayoutEffect((()=>t.subscribe(y)),[t,y]),e.useEffect((()=>{s.isTransitioning&&!s.flushSync&&c(new qt)}),[s]),e.useEffect((()=>{if(u&&o&&t.window){let r=o,n=u.promise,s=t.window.document.startViewTransition((async()=>{e.startTransition((()=>a(r))),await n}));s.finished.finally((()=>{c(void 0),h(void 0),i(void 0),l({isTransitioning:!1})})),h(s)}}),[o,u,t.window]),e.useEffect((()=>{u&&o&&n.location.key===o.location.key&&u.resolve()}),[u,d,n.location,o]),e.useEffect((()=>{!s.isTransitioning&&f&&(i(f.state),l({isTransitioning:!0,flushSync:!1,currentLocation:f.currentLocation,nextLocation:f.nextLocation}),m(void 0))}),[s.isTransitioning,f]);let g=e.useMemo((()=>({createHref:t.createHref,encodeLocation:t.encodeLocation,go:e=>t.navigate(e),push:(e,r,n)=>t.navigate(e,{state:r,preventScrollReset:n?.preventScrollReset}),replace:(e,r,n)=>t.navigate(e,{replace:!0,state:r,preventScrollReset:n?.preventScrollReset})})),[t]),v=t.basename||"/",w=e.useMemo((()=>({router:t,navigator:g,static:!1,basename:v})),[t,g,v]);return e.createElement(e.Fragment,null,e.createElement(Ve.Provider,{value:w},e.createElement(Ke.Provider,{value:n},e.createElement(Ge.Provider,{value:p.current},e.createElement(Xe.Provider,{value:s},e.createElement(Qt,{basename:v,location:n.location,navigationType:n.historyAction,navigator:g},e.createElement(Wt,{routes:t.routes,future:t.future,state:n})))))),null)}const Wt=e.memo(Yt);function Yt({routes:e,future:t,state:r}){return yt(e,void 0,r,t)}function Vt({basename:t,children:r,initialEntries:n,initialIndex:a}){let o=e.useRef();null==o.current&&(o.current=l({initialEntries:n,initialIndex:a,v5Compat:!0}));let i=o.current,[s,u]=e.useState({action:i.action,location:i.location}),c=e.useCallback((t=>{e.startTransition((()=>u(t)))}),[u]);return e.useLayoutEffect((()=>i.listen(c)),[i,c]),e.createElement(Qt,{basename:t,children:r,location:s.location,navigationType:s.action,navigator:i})}function Kt({to:t,replace:r,state:n,relative:a}){at()||d(!1),e.useContext(Ze);let{matches:o}=e.useContext(tt),{pathname:i}=ot(),s=ut(),l=j(t,U(o),i,"path"===a),u=JSON.stringify(l);return e.useEffect((()=>{s(JSON.parse(u),{replace:r,state:n,relative:a})}),[s,u,a,r,n]),null}function Xt(e){return ht(e.context)}function Gt(e){d(!1)}function Qt({basename:t="/",children:r=null,location:n,navigationType:a=s.Pop,navigator:o,static:i=!1}){at()&&d(!1);let l=t.replace(/^\/*/,"/"),u=e.useMemo((()=>({basename:l,navigator:o,static:i,future:{}})),[l,o,i]);"string"==typeof n&&(n=p(n));let{pathname:c="/",search:h="",hash:f="",state:m=null,key:y="default"}=n,g=e.useMemo((()=>{let e=_(c,l);return null==e?null:{location:{pathname:e,search:h,hash:f,state:m,key:y},navigationType:a}}),[l,c,h,f,m,y,a]);return null==g?null:e.createElement(Ze.Provider,{value:u},e.createElement(et.Provider,{children:r,value:g}))}function Zt({children:e,location:t}){return pt(ar(e),t)}function er({children:t,errorElement:r,resolve:n}){return e.createElement(rr,{resolve:n,errorElement:r},e.createElement(nr,null,t))}var tr=function(e){return e[e.pending=0]="pending",e[e.success=1]="success",e[e.error=2]="error",e}(tr||{});class rr extends e.Component{constructor(e){super(e),this.state={error:null}}static getDerivedStateFromError(e){return{error:e}}componentDidCatch(e,t){console.error("<Await> caught the following error during render",e,t)}render(){let{children:t,errorElement:r,resolve:n}=this.props,a=null,o=tr.pending;if(n instanceof Promise)if(this.state.error){o=tr.error;let e=this.state.error;a=Promise.reject().catch((()=>{})),Object.defineProperty(a,"_tracked",{get:()=>!0}),Object.defineProperty(a,"_error",{get:()=>e})}else n._tracked?(a=n,o="_error"in a?tr.error:"_data"in a?tr.success:tr.pending):(o=tr.pending,Object.defineProperty(n,"_tracked",{get:()=>!0}),a=n.then((e=>Object.defineProperty(n,"_data",{get:()=>e})),(e=>Object.defineProperty(n,"_error",{get:()=>e}))));else o=tr.success,a=Promise.resolve(),Object.defineProperty(a,"_tracked",{get:()=>!0}),Object.defineProperty(a,"_data",{get:()=>n});if(o===tr.error&&!r)throw a._error;if(o===tr.error)return e.createElement(Qe.Provider,{value:a,children:r});if(o===tr.success)return e.createElement(Qe.Provider,{value:a,children:t});throw a}}function nr({children:t}){let r=Pt(),n="function"==typeof t?t(r):t;return e.createElement(e.Fragment,null,n)}function ar(t,r=[]){let n=[];return e.Children.forEach(t,((t,a)=>{if(!e.isValidElement(t))return;let o=[...r,a];if(t.type===e.Fragment)return void n.push.apply(n,ar(t.props.children,o));t.type!==Gt&&d(!1),t.props.index&&t.props.children&&d(!1);let i={id:t.props.id||o.join("-"),caseSensitive:t.props.caseSensitive,element:t.props.element,Component:t.props.Component,index:t.props.index,path:t.props.path,loader:t.props.loader,action:t.props.action,hydrateFallbackElement:t.props.hydrateFallbackElement,HydrateFallback:t.props.HydrateFallback,errorElement:t.props.errorElement,ErrorBoundary:t.props.ErrorBoundary,hasErrorBoundary:!0===t.props.hasErrorBoundary||null!=t.props.ErrorBoundary||null!=t.props.errorElement,shouldRevalidate:t.props.shouldRevalidate,handle:t.props.handle,lazy:t.props.lazy};t.props.children&&(i.children=ar(t.props.children,o)),n.push(i)})),n}function or(e){return Et(e)}const ir="application/x-www-form-urlencoded";function sr(e){return null!=e&&"string"==typeof e.tagName}function lr(e=""){return new URLSearchParams("string"==typeof e||Array.isArray(e)||e instanceof URLSearchParams?e:Object.keys(e).reduce(((t,r)=>{let n=e[r];return t.concat(Array.isArray(n)?n.map((e=>[r,e])):[[r,n]])}),[]))}let ur=null;const cr=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function dr(e){return null==e||cr.has(e)?e:null}function hr(e,t){let r,n,a,o,i;if(sr(s=e)&&"form"===s.tagName.toLowerCase()){let i=e.getAttribute("action");n=i?_(i,t):null,r=e.getAttribute("method")||"get",a=dr(e.getAttribute("enctype"))||ir,o=new FormData(e)}else if(function(e){return sr(e)&&"button"===e.tagName.toLowerCase()}(e)||function(e){return sr(e)&&"input"===e.tagName.toLowerCase()}(e)&&("submit"===e.type||"image"===e.type)){let i=e.form;if(null==i)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let s=e.getAttribute("formaction")||i.getAttribute("action");if(n=s?_(s,t):null,r=e.getAttribute("formmethod")||i.getAttribute("method")||"get",a=dr(e.getAttribute("formenctype"))||dr(i.getAttribute("enctype"))||ir,o=new FormData(i,e),!function(){if(null===ur)try{new FormData(document.createElement("form"),0),ur=!1}catch(e){ur=!0}return ur}()){let{name:t,type:r,value:n}=e;if("image"===r){let e=t?`${t}.`:"";o.append(`${e}x`,"0"),o.append(`${e}y`,"0")}else t&&o.append(t,n)}}else{if(sr(e))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');r="get",n=null,a=ir,i=e}var s;return o&&"text/plain"===a&&(i=o,o=void 0),{action:n,method:r.toLowerCase(),encType:a,formData:o,body:i}}function fr(e,t){if(!1===e||null==e)throw new Error(t)}async function mr(e,t){if(e.id in t)return t[e.id];try{let r=await import(e.module);return t[e.id]=r,r}catch(r){if(console.error(`Error loading route module \`${e.module}\`, reloading page...`),console.error(r),window.__remixContext&&window.__remixContext.isSpaMode&&void 0!==import.meta.hot)throw r;return window.location.reload(),new Promise((()=>{}))}}function pr(e,t,r){let n=e.map((e=>{let n=t[e.route.id],a=r.routes[e.route.id];return[a.css?a.css.map((e=>({rel:"stylesheet",href:e}))):[],n?.links?.()||[]]})).flat(2),a=function(e,t){return Er(e.map((e=>{let r=t.routes[e.route.id],n=[r.module];return r.imports&&(n=n.concat(r.imports)),n})).flat(1))}(e,r);return Sr(n,a)}async function yr(e,t){if(!e.css&&!t.links||!function(){if(void 0!==xr)return xr;let e=document.createElement("link");return xr=e.relList.supports("preload"),e=null,xr}())return;let r=[];if(e.css&&r.push(...e.css.map((e=>({rel:"stylesheet",href:e})))),t.links&&r.push(...t.links()),0===r.length)return;let n=[];for(let o of r)vr(o)||"stylesheet"!==o.rel||n.push({...o,rel:"preload",as:"style"});let a=n.filter((e=>(!e.media||window.matchMedia(e.media).matches)&&!document.querySelector(`link[rel="stylesheet"][href="${e.href}"]`)));await Promise.all(a.map(gr))}async function gr(e){return new Promise((t=>{let r=document.createElement("link");function n(){document.head.contains(r)&&document.head.removeChild(r)}Object.assign(r,e),r.onload=()=>{n(),t()},r.onerror=()=>{n(),t()},document.head.appendChild(r)}))}function vr(e){return null!=e&&"string"==typeof e.page}function wr(e){return null!=e&&(null==e.href?"preload"===e.rel&&"string"==typeof e.imageSrcSet&&"string"==typeof e.imageSizes:"string"==typeof e.rel&&"string"==typeof e.href)}function br(e,t,r,n,a,o){let i=function(e){let t=p(e);void 0===t.search&&(t.search="");return t}(e),s=(e,t)=>!r[t]||e.route.id!==r[t].route.id,l=(e,t)=>r[t].pathname!==e.pathname||r[t].route.path?.endsWith("*")&&r[t].params["*"]!==e.params["*"];return"data"===o&&a.search!==i.search?t.filter(((t,o)=>{if(!n.routes[t.route.id].hasLoader)return!1;if(s(t,o)||l(t,o))return!0;if(t.route.shouldRevalidate){let n=t.route.shouldRevalidate({currentUrl:new URL(a.pathname+a.search+a.hash,window.origin),currentParams:r[0]?.params||{},nextUrl:new URL(e,window.origin),nextParams:t.params,defaultShouldRevalidate:!0});if("boolean"==typeof n)return n}return!0})):t.filter(((e,t)=>{let r=n.routes[e.route.id];return("assets"===o||r.hasLoader)&&(s(e,t)||l(e,t))}))}function Er(e){return[...new Set(e)]}function Sr(e,t){let r=new Set,n=new Set(t);return e.reduce(((e,a)=>{if(t&&!vr(a)&&"script"===a.as&&a.href&&n.has(a.href))return e;let o=JSON.stringify(function(e){let t={},r=Object.keys(e).sort();for(let n of r)t[n]=e[n];return t}(a));return r.has(o)||(r.add(o),e.push({key:o,link:a})),e}),[])}let xr;const Rr={"&":"\\u0026",">":"\\u003e","<":"\\u003c","\u2028":"\\u2028","\u2029":"\\u2029"},Cr=/[&><\u2028\u2029]/g;function kr(e){return{__html:e}}async function Dr(e){let t={signal:e.signal};if("GET"!==e.method){t.method=e.method;let r=e.headers.get("Content-Type");r&&/\bapplication\/json\b/.test(r)?(t.headers={"Content-Type":r},t.body=JSON.stringify(await e.json())):r&&/\btext\/plain\b/.test(r)?(t.headers={"Content-Type":r},t.body=await e.text()):r&&/\bapplication\/x-www-form-urlencoded\b/.test(r)?t.body=new URLSearchParams(await e.text()):t.body=await e.formData()}return t}const Lr=Symbol("SingleFetchRedirect");function Tr({context:t,identifier:r,reader:n,textDecoder:a,nonce:o}){if(!t.renderMeta||!t.renderMeta.didRenderScripts)return null;t.renderMeta.streamCache||(t.renderMeta.streamCache={});let{streamCache:i}=t.renderMeta,s=i[r];if(s||(s=i[r]=n.read().then((e=>{i[r].result={done:e.done,value:a.decode(e.value,{stream:!0})}})).catch((e=>{i[r].error=e}))),s.error)throw s.error;if(void 0===s.result)throw s;let{done:l,value:u}=s.result,c=u?e.createElement("script",{nonce:o,dangerouslySetInnerHTML:{__html:`window.__remixContext.streamController.enqueue(${d=JSON.stringify(u),d.replace(Cr,(e=>Rr[e]))});`}}):null;var d;return l?e.createElement(e.Fragment,null,c,e.createElement("script",{nonce:o,dangerouslySetInnerHTML:{__html:"window.__remixContext.streamController.close();"}})):e.createElement(e.Fragment,null,c,e.createElement(e.Suspense,null,e.createElement(Tr,{context:t,identifier:r+1,reader:n,textDecoder:a,nonce:o})))}function Mr(e,t,r){return async({request:n,matches:a,fetcherKey:o})=>"GET"!==n.method?async function(e,t){let r=t.find((e=>e.shouldLoad));r||fr(!1);let n,a=await r.resolve((async t=>{let a=await t((async()=>{let t=Or(e.url),a=await Dr(e),{data:o,status:i}=await Pr(t,a);return n=i,Fr(o,r.route.id)}));return a}));if(o=a.result,null!=o&&"number"==typeof o.status&&"string"==typeof o.statusText&&"object"==typeof o.headers&&void 0!==o.body||V(a.result))return{[r.route.id]:a};var o;return{[r.route.id]:{type:a.type,result:z(a.result,n)}}}(n,a):o?async function(e,t){let r=t.find((e=>e.shouldLoad));r||fr(!1);let n=await r.resolve((async t=>Ar(t,_r(Or(e.url)),await Dr(e),r.route.id)));return{[r.route.id]:n}}(n,a):async function(e,t,r,n,a){let o=new Set,i=!1,s=a.map((()=>Nr())),l=Promise.all(s.map((e=>e.promise))),u=Nr(),c=_r(Or(n.url)),d=await Dr(n),h={},f=Promise.all(a.map((async(n,a)=>n.resolve((async l=>{if(s[a].resolve(),!n.shouldLoad){if(!r.state.initialized)return;if(n.route.id in r.state.loaderData&&e.routes[n.route.id].hasLoader&&t[n.route.id]?.shouldRevalidate)return void(i=!0)}if(e.routes[n.route.id].hasClientLoader){e.routes[n.route.id].hasLoader&&(i=!0);try{let e=await Ar(l,c,d,n.route.id);h[n.route.id]={type:"data",result:e}}catch(f){h[n.route.id]={type:"error",result:f}}}else{e.routes[n.route.id].hasLoader&&o.add(n.route.id);try{let e=await l((async()=>jr(await u.promise,n.route.id)));h[n.route.id]={type:"data",result:e}}catch(f){h[n.route.id]={type:"error",result:f}}}})))));if(await l,r.state.initialized&&0!==o.size||window.__remixHdrActive)try{i&&o.size>0&&c.searchParams.set("_routes",a.filter((e=>o.has(e.route.id))).map((e=>e.route.id)).join(","));let e=await Pr(c,d);u.resolve(e.data)}catch(m){u.reject(m)}else u.resolve({});return await f,h}(e,t,r(),n,a)}function Ar(e,t,r,n){return e((async()=>{let e=new URL(t);e.searchParams.set("_routes",n);let{data:a}=await Pr(e,r);return jr(a,n)}))}function _r(e){let t=e.searchParams.getAll("index");e.searchParams.delete("index");let r=[];for(let n of t)n&&r.push(n);for(let n of r)e.searchParams.append("index",n);return e}function Or(e){let t="string"==typeof e?new URL(e,"undefined"==typeof window?"server://singlefetch/":window.location.origin):e;return"/"===t.pathname?t.pathname="_root.data":t.pathname=`${t.pathname.replace(/\/$/,"")}.data`,t}async function Pr(e,t){let r=await fetch(e,t);r.body||fr(!1);try{let e=await Ur(r.body,window);return{status:r.status,data:e.value}}catch(n){throw new Error("Unable to decode turbo-stream response")}}function Ur(e,r){return t(e,{plugins:[(e,...t)=>{if("SanitizedError"===e){let[e,n,a]=t,o=Error;e&&e in r&&"function"==typeof r[e]&&(o=r[e]);let i=new o(n);return i.stack=a,{value:i}}if("ErrorResponse"===e){let[e,r,n]=t;return{value:new Y(r,n,e)}}return"SingleFetchRedirect"===e?{value:{[Lr]:t[0]}}:"SingleFetchClassInstance"===e?{value:t[0]}:"SingleFetchFallback"===e?{value:void 0}:void 0}]})}function jr(e,t){let r=e[Lr];return r?Fr(r,t):void 0!==e[t]?Fr(e[t],t):null}function Fr(e,t){if("error"in e)throw e.error;if("redirect"in e){let t={};return e.revalidate&&(t["X-Remix-Revalidate"]="yes"),e.reload&&(t["X-Remix-Reload-Document"]="yes"),e.replace&&(t["X-Remix-Replace"]="yes"),q(e.redirect,{status:e.status,headers:t})}if("data"in e)return e.data;throw new Error(`No response found for routeId "${t}"`)}function Nr(){let e,t,r=new Promise(((n,a)=>{e=async e=>{n(e);try{await r}catch(t){}},t=async e=>{a(e);try{await r}catch(t){}}}));return{promise:r,resolve:e,reject:t}}class Hr extends e.Component{constructor(e){super(e),this.state={error:e.error||null,location:e.location}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,t){return t.location!==e.location?{error:e.error||null,location:e.location}:{error:e.error||t.error,location:t.location}}render(){return this.state.error?e.createElement($r,{error:this.state.error,isOutsideRemixApp:!0}):this.props.children}}function $r({error:t,isOutsideRemixApp:r}){console.error(t);let n,a=e.createElement("script",{dangerouslySetInnerHTML:{__html:'\n console.log(\n "💿 Hey developer 👋. You can provide a way better UX than this when your app throws errors. Check out https://remix.run/guides/errors for more information."\n );\n '}});if(V(t))return e.createElement(Ir,{title:"Unhandled Thrown Response!"},e.createElement("h1",{style:{fontSize:"24px"}},t.status," ",t.statusText),a);if(t instanceof Error)n=t;else{let e=null==t?"Unknown Error":"object"==typeof t&&"toString"in t?t.toString():JSON.stringify(t);n=new Error(e)}return e.createElement(Ir,{title:"Application Error!",isOutsideRemixApp:r},e.createElement("h1",{style:{fontSize:"24px"}},"Application Error"),e.createElement("pre",{style:{padding:"2rem",background:"hsla(10, 50%, 50%, 0.1)",color:"red",overflow:"auto"}},n.stack),a)}function Ir({title:t,renderScripts:r,isOutsideRemixApp:n,children:a}){let{routeModules:o}=un();return o.root?.Layout&&!n?a:e.createElement("html",{lang:"en"},e.createElement("head",null,e.createElement("meta",{charSet:"utf-8"}),e.createElement("meta",{name:"viewport",content:"width=device-width,initial-scale=1,viewport-fit=cover"}),e.createElement("title",null,t)),e.createElement("body",null,e.createElement("main",{style:{fontFamily:"system-ui, sans-serif",padding:"2rem"}},a,r?e.createElement(vn,null):null)))}function Br(){return e.createElement(Ir,{title:"Loading...",renderScripts:!0},e.createElement("script",{dangerouslySetInnerHTML:{__html:'\n console.log(\n "💿 Hey developer 👋. You can provide a way better UX than this " +\n "when your app is loading JS modules and/or running `clientLoader` " +\n "functions. Check out https://remix.run/route/hydrate-fallback " +\n "for more information."\n );\n '}}))}function zr(e){let t={};return Object.values(e).forEach((e=>{let r=e.parentId||"";t[r]||(t[r]=[]),t[r].push(e)})),t}function qr(t,r,n){let a=Gr(r),o=!r.HydrateFallback||n&&"root"!==t.id?"root"===t.id?Br:void 0:r.HydrateFallback,i=r.ErrorBoundary?r.ErrorBoundary:"root"===t.id?()=>e.createElement($r,{error:Ot()}):void 0;return"root"===t.id&&r.Layout?{...a?{element:e.createElement(r.Layout,null,e.createElement(a,null))}:{Component:a},...i?{errorElement:e.createElement(r.Layout,null,e.createElement(i,null))}:{ErrorBoundary:i},...o?{hydrateFallbackElement:e.createElement(r.Layout,null,e.createElement(o,null))}:{HydrateFallback:o}}:{Component:a,ErrorBoundary:i,HydrateFallback:o}}function Jr(e,t,r,n,a="",o=zr(e),i=Promise.resolve({Component:()=>null})){return(o[a]||[]).map((a=>{let s=t[a.id];s||fr(!1);let l={...qr(a,s,n),caseSensitive:a.caseSensitive,id:a.id,index:a.index,path:a.path,handle:s.handle,lazy:n?()=>i:void 0,loader:a.hasLoader||a.hasClientLoader?()=>null:void 0},u=Jr(e,t,r,n,a.id,o,i);return u.length>0&&(l.children=u),l}))}function Wr(e,t,r,n,a,o){return Kr(t,r,n,o,"",zr(t),e)}function Yr(e,t,r){if(r){let r=`You cannot call ${"action"===e?"serverAction()":"serverLoader()"} in SPA Mode (routeId: "${t.id}")`;throw console.error(r),new Y(400,"Bad Request",new Error(r),!0)}let n=`You are trying to call ${"action"===e?"serverAction()":"serverLoader()"} on a route that does not have a server ${e} (routeId: "${t.id}")`;if("loader"===e&&!t.hasLoader||"action"===e&&!t.hasAction)throw console.error(n),new Y(400,"Bad Request",new Error(n),!0)}function Vr(e,t){let r="clientAction"===e?"a":"an",n=`Route "${t}" does not have ${r} ${e}, but you are trying to submit to it. To fix this, please add ${r} \`${e}\` function to the route`;throw console.error(n),new Y(405,"Method Not Allowed",new Error(n),!0)}function Kr(e,t,r,n,a="",o=zr(e),i){return(o[a]||[]).map((a=>{let s=t[a.id];function l(e){return"function"!=typeof e&&fr(!1),e()}function u(e){return a.hasLoader?l(e):Promise.resolve(null)}function c(e){if(!a.hasAction)throw Vr("action",a.id);return l(e)}async function d(e){let r=t[a.id],n=r?yr(a,r):Promise.resolve();try{return e()}finally{await n}}let h={id:a.id,index:a.index,path:a.path};if(s){Object.assign(h,{...h,...qr(a,s,n),handle:s.handle,shouldRevalidate:i?Xr(a.id,s.shouldRevalidate,i):s.shouldRevalidate});let e=r?.loaderData?.[a.id],t=r?.errors?.[a.id],o=null==i&&(!0===s.clientLoader?.hydrate||!a.hasLoader);h.loader=async({request:r,params:i},l)=>{try{return await d((async()=>(s||fr(!1),s.clientLoader?s.clientLoader({request:r,params:i,async serverLoader(){if(Yr("loader",a,n),o){if(void 0!==t)throw t;return e}return u(l)}}):n?null:u(l))))}finally{o=!1}},h.loader.hydrate=Qr(a,s,n),h.action=({request:e,params:t},r)=>d((async()=>{if(s||fr(!1),!s.clientAction){if(n)throw Vr("clientAction",a.id);return c(r)}return s.clientAction({request:e,params:t,serverAction:async()=>(Yr("action",a,n),c(r))})}))}else a.hasClientLoader||(h.loader=({request:e},t)=>d((()=>n?Promise.resolve(null):u(t)))),a.hasClientAction||(h.action=({request:e},t)=>d((()=>{if(n)throw Vr("clientAction",a.id);return c(t)}))),h.lazy=async()=>{let e=await async function(e,t){let r=await mr(e,t);return await yr(e,r),{Component:Gr(r),ErrorBoundary:r.ErrorBoundary,clientAction:r.clientAction,clientLoader:r.clientLoader,handle:r.handle,links:r.links,meta:r.meta,shouldRevalidate:r.shouldRevalidate}}(a,t),r={...e};if(e.clientLoader){let t=e.clientLoader;r.loader=(e,r)=>t({...e,serverLoader:async()=>(Yr("loader",a,n),u(r))})}if(e.clientAction){let t=e.clientAction;r.action=(e,r)=>t({...e,serverAction:async()=>(Yr("action",a,n),c(r))})}return i&&(r.shouldRevalidate=Xr(a.id,e.shouldRevalidate,i)),{...r.loader?{loader:r.loader}:{},...r.action?{action:r.action}:{},hasErrorBoundary:r.hasErrorBoundary,shouldRevalidate:r.shouldRevalidate,handle:r.handle,Component:r.Component,ErrorBoundary:r.ErrorBoundary}};let f=Kr(e,t,r,n,a.id,o,i);return f.length>0&&(h.children=f),h}))}function Xr(e,t,r){let n=!1;return a=>n?t?t(a):a.defaultShouldRevalidate:(n=!0,r.has(e))}function Gr(e){if(null==e.default)return;return"object"==typeof e.default&&0===Object.keys(e.default).length?void 0:e.default}function Qr(e,t,r){return r&&"root"!==e.id||null!=t.clientLoader&&(!0===t.clientLoader.hydrate||!0!==e.hasLoader)}const Zr=new Set,en=new Set;function tn(e){return!e}function rn(e,t,r,n){if(tn(r))return async({path:a,patch:o})=>{en.has(a)||await an([a],e,t,r,n,o)}}function nn(t,r,n,a){e.useEffect((()=>{if(!tn(a)||!0===navigator.connection?.saveData)return;function e(e){let t="FORM"===e.tagName?e.getAttribute("action"):e.getAttribute("href");if(!t)return;let r=new URL(t,window.location.origin);en.has(r.pathname)||Zr.add(r.pathname)}async function o(){let e=Array.from(Zr.keys()).filter((e=>!en.has(e)||(Zr.delete(e),!1)));if(0!==e.length)try{await an(e,r,n,a,t.basename,t.patchRoutes)}catch(o){console.error("Failed to fetch manifest patches",o)}}document.body.querySelectorAll("a[data-discover], form[data-discover]").forEach((t=>e(t))),o();let i=function(e,t){let r;return(...n)=>{window.clearTimeout(r),r=window.setTimeout((()=>e(...n)),t)}}(o,100);let s=new MutationObserver((t=>{let r=new Set;t.forEach((e=>{[e.target,...e.addedNodes].forEach((e=>{(function(e){return e.nodeType===Node.ELEMENT_NODE})(e)&&(("A"===e.tagName&&e.getAttribute("data-discover")||"FORM"===e.tagName&&e.getAttribute("data-discover"))&&r.add(e),"A"!==e.tagName&&e.querySelectorAll("a[data-discover], form[data-discover]").forEach((e=>r.add(e))))}))})),r.forEach((t=>e(t))),i()}));return s.observe(document.documentElement,{subtree:!0,childList:!0,attributes:!0,attributeFilter:["data-discover","href","action"]}),()=>s.disconnect()}),[a,r,n,t])}async function an(e,t,r,n,a,o){let i=`${null!=a?a:"/"}/__manifest`.replace(/\/+/g,"/"),s=new URL(i,window.location.origin);if(e.sort().forEach((e=>s.searchParams.append("p",e))),s.searchParams.set("version",t.version),s.toString().length>7680)return void Zr.clear();let l=await fetch(s);if(!l.ok)throw new Error(`${l.status} ${l.statusText}`);if(l.status>=400)throw new Error(await l.text());let u=await l.json(),c=new Set(Object.keys(t.routes)),d=Object.values(u).reduce(((e,t)=>c.has(t.id)?e:Object.assign(e,{[t.id]:t})),{});Object.assign(t.routes,d),e.forEach((e=>function(e,t){if(t.size>=1e3){let e=t.values().next().value;t.delete(e)}t.add(e)}(e,en)));let h=new Set;Object.values(d).forEach((e=>{e.parentId&&d[e.parentId]||h.add(e.parentId)})),h.forEach((e=>o(e||null,Kr(d,r,null,n,e))))}function on(){let t=e.useContext(Ve);return t||fr(!1),t}function sn(){let t=e.useContext(Ke);return t||fr(!1),t}const ln=e.createContext(void 0);function un(){let t=e.useContext(ln);return t||fr(!1),t}function cn(e,t){return r=>{e&&e(r),r.defaultPrevented||t(r)}}function dn(e,t,r){if(r&&!gn)return[e[0]];if(t){let r=e.findIndex((e=>void 0!==t[e.route.id]));return e.slice(0,r+1)}return e}function hn(){let{isSpaMode:t,manifest:r,routeModules:n,criticalCss:a}=un(),{errors:o,matches:i}=sn(),s=dn(i,o,t),l=e.useMemo((()=>pr(s,n,r)),[s,n,r]);return e.createElement(e.Fragment,null,a?e.createElement("style",{dangerouslySetInnerHTML:{__html:a}}):null,l.map((({key:t,link:r})=>vr(r)?e.createElement(fn,Object.assign({key:t},r)):e.createElement("link",Object.assign({key:t},r)))))}function fn({page:t,...r}){let{router:n}=on(),a=e.useMemo((()=>b(n.routes,t,n.basename)),[n.routes,t,n.basename]);return a?e.createElement(pn,Object.assign({page:t,matches:a},r)):(console.warn(`Tried to prefetch ${t} but no routes matched.`),null)}function mn(t){let{manifest:r,routeModules:n}=un(),[a,o]=e.useState([]);return e.useEffect((()=>{let e=!1;return async function(e,t,r){return Sr((await Promise.all(e.map((async e=>{let n=await mr(t.routes[e.route.id],r);return n.links?n.links():[]})))).flat(1).filter(wr).filter((e=>"stylesheet"===e.rel||"preload"===e.rel)).map((e=>"stylesheet"===e.rel?{...e,rel:"prefetch",as:"style"}:{...e,rel:"prefetch"})))}(t,r,n).then((t=>{e||o(t)})),()=>{e=!0}}),[t,r,n]),a}function pn({page:t,matches:r,...n}){let a=ot(),{manifest:o,routeModules:i}=un(),{loaderData:s,matches:l}=sn(),u=e.useMemo((()=>br(t,r,l,o,a,"data")),[t,r,l,o,a]),c=e.useMemo((()=>br(t,r,l,o,a,"assets")),[t,r,l,o,a]),d=e.useMemo((()=>{if(t===a.pathname+a.search+a.hash)return[];let e=new Set,n=!1;if(r.forEach((t=>{o.routes[t.route.id].hasLoader&&(!u.some((e=>e.route.id===t.route.id))&&t.route.id in s&&i[t.route.id]?.shouldRevalidate||o.routes[t.route.id].hasClientLoader?n=!0:e.add(t.route.id))})),0===e.size)return[];let l=Or(t);return n&&e.size>0&&l.searchParams.set("_routes",r.filter((t=>e.has(t.route.id))).map((e=>e.route.id)).join(",")),[l.pathname+l.search]}),[s,a,o,u,r,t,i]),h=e.useMemo((()=>function(e,t){return Er(e.map((e=>{let r=t.routes[e.route.id],n=[r.module];return r.imports&&(n=n.concat(r.imports)),n})).flat(1))}(c,o)),[c,o]),f=mn(c);return e.createElement(e.Fragment,null,d.map((t=>e.createElement("link",Object.assign({key:t,rel:"prefetch",as:"fetch",href:t},n)))),h.map((t=>e.createElement("link",Object.assign({key:t,rel:"modulepreload",href:t},n)))),f.map((({key:t,link:r})=>e.createElement("link",Object.assign({key:t},r)))))}function yn(){let{isSpaMode:t,routeModules:r}=un(),{errors:n,matches:a,loaderData:o}=sn(),i=ot(),s=dn(a,n,t),l=null;n&&(l=n[s[s.length-1].route.id]);let u=[],c=null,d=[];for(let e=0;e<s.length;e++){let t=s[e],n=t.route.id,a=o[n],h=t.params,f=r[n],m=[],p={id:n,data:a,meta:[],params:t.params,pathname:t.pathname,handle:t.route.handle,error:l};if(d[e]=p,f?.meta?m="function"==typeof f.meta?f.meta({data:a,params:h,location:i,matches:d,error:l}):Array.isArray(f.meta)?[...f.meta]:f.meta:c&&(m=[...c]),m=m||[],!Array.isArray(m))throw new Error("The route at "+t.route.path+" returns an invalid value. All route meta functions must return an array of meta objects.\n\nTo reference the meta function API, see https://remix.run/route/meta");p.meta=m,d[e]=p,u=[...m],c=u}return e.createElement(e.Fragment,null,u.flat().map((t=>{if(!t)return null;if("tagName"in t){let{tagName:r,...n}=t;if(!function(e){return"string"==typeof e&&/^(meta|link)$/.test(e)}(r))return console.warn(`A meta object uses an invalid tagName: ${r}. Expected either 'link' or 'meta'`),null;let a=r;return e.createElement(a,Object.assign({key:JSON.stringify(n)},n))}if("title"in t)return e.createElement("title",{key:"title"},String(t.title));if("charset"in t&&(t.charSet??=t.charset,delete t.charset),"charSet"in t&&null!=t.charSet)return"string"==typeof t.charSet?e.createElement("meta",{key:"charSet",charSet:t.charSet}):null;if("script:ld+json"in t)try{let r=JSON.stringify(t["script:ld+json"]);return e.createElement("script",{key:`script:ld+json:${r}`,type:"application/ld+json",dangerouslySetInnerHTML:{__html:r}})}catch(r){return null}return e.createElement("meta",Object.assign({key:JSON.stringify(t)},t))})))}ln.displayName="FrameworkContext";let gn=!1;function vn(t){let{manifest:r,serverHandoffString:n,isSpaMode:a,renderMeta:o}=un(),{router:i,static:s,staticContext:l}=on(),{matches:u}=sn(),c=tn(a);o&&(o.didRenderScripts=!0);let d=dn(u,null,a);e.useEffect((()=>{gn=!0}),[]);let h=e.useMemo((()=>{let a=l?`window.__remixContext = ${n};window.__remixContext.stream = new ReadableStream({start(controller){window.__remixContext.streamController = controller;}}).pipeThrough(new TextEncoderStream());`:" ",o=s?`${r.hmr?.runtime?`import ${JSON.stringify(r.hmr.runtime)};`:""}${c?"":`import ${JSON.stringify(r.url)}`};\n${d.map(((e,t)=>`import * as route${t} from ${JSON.stringify(r.routes[e.route.id].module)};`)).join("\n")}\n ${c?`window.__remixManifest = ${JSON.stringify(function(e,t){let r=new Set(t.state.matches.map((e=>e.route.id))),n=t.state.location.pathname.split("/").filter(Boolean),a=["/"];for(n.pop();n.length>0;)a.push(`/${n.join("/")}`),n.pop();a.forEach((e=>{let n=b(t.routes,e,t.basename);n&&n.forEach((e=>r.add(e.route.id)))}));let o=[...r].reduce(((t,r)=>Object.assign(t,{[r]:e.routes[r]})),{});return{...e,routes:o}}(r,i),null,2)};`:""}\n window.__remixRouteModules = {${d.map(((e,t)=>`${JSON.stringify(e.route.id)}:route${t}`)).join(",")}};\n\nimport(${JSON.stringify(r.entry.module)});`:" ";return e.createElement(e.Fragment,null,e.createElement("script",Object.assign({},t,{suppressHydrationWarning:!0,dangerouslySetInnerHTML:kr(a),type:void 0})),e.createElement("script",Object.assign({},t,{suppressHydrationWarning:!0,dangerouslySetInnerHTML:kr(o),type:"module",async:!0})))}),[]),f=d.map((e=>{let t=r.routes[e.route.id];return(t.imports||[]).concat([t.module])})).flat(1),m=gn?[]:r.entry.imports.concat(f);return gn?null:e.createElement(e.Fragment,null,c?null:e.createElement("link",{rel:"modulepreload",href:r.url,crossOrigin:t.crossOrigin}),e.createElement("link",{rel:"modulepreload",href:r.entry.module,crossOrigin:t.crossOrigin}),(p=m,[...new Set(p)]).map((r=>e.createElement("link",{key:r,rel:"modulepreload",href:r,crossOrigin:t.crossOrigin}))),h);var p}function wn(...e){return t=>{e.forEach((e=>{"function"==typeof e?e(t):null!=e&&(e.current=t)}))}}const bn="undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement;try{bn&&(window.__reactRouterVersion="0")}catch(io){}function En(e,t){return ie({basename:t?.basename,future:t?.future,history:u({window:t?.window}),hydrationData:t?.hydrationData||xn(),routes:e,mapRouteProperties:Bt,dataStrategy:t?.dataStrategy,patchRoutesOnNavigation:t?.patchRoutesOnNavigation,window:t?.window}).initialize()}function Sn(e,t){return ie({basename:t?.basename,future:t?.future,history:c({window:t?.window}),hydrationData:t?.hydrationData||xn(),routes:e,mapRouteProperties:Bt,dataStrategy:t?.dataStrategy,patchRoutesOnNavigation:t?.patchRoutesOnNavigation,window:t?.window}).initialize()}function xn(){let e=window?.__staticRouterHydrationData;return e&&e.errors&&(e={...e,errors:Rn(e.errors)}),e}function Rn(e){if(!e)return null;let t=Object.entries(e),r={};for(let[n,a]of t)if(a&&"RouteErrorResponse"===a.__type)r[n]=new Y(a.status,a.statusText,a.data,!0===a.internal);else if(a&&"Error"===a.__type){if(a.__subType){let e=window[a.__subType];if("function"==typeof e)try{let t=new e(a.message);t.stack="",r[n]=t}catch(io){}}if(null==r[n]){let e=new Error(a.message);e.stack="",r[n]=e}}else r[n]=a;return r}function Cn({basename:t,children:r,window:n}){let a=e.useRef();null==a.current&&(a.current=u({window:n,v5Compat:!0}));let o=a.current,[i,s]=e.useState({action:o.action,location:o.location}),l=e.useCallback((t=>{e.startTransition((()=>s(t)))}),[s]);return e.useLayoutEffect((()=>o.listen(l)),[o,l]),e.createElement(Qt,{basename:t,children:r,location:i.location,navigationType:i.action,navigator:o})}function kn({basename:t,children:r,window:n}){let a=e.useRef();null==a.current&&(a.current=c({window:n,v5Compat:!0}));let o=a.current,[i,s]=e.useState({action:o.action,location:o.location}),l=e.useCallback((t=>{e.startTransition((()=>s(t)))}),[s]);return e.useLayoutEffect((()=>o.listen(l)),[o,l]),e.createElement(Qt,{basename:t,children:r,location:i.location,navigationType:i.action,navigator:o})}function Dn({basename:t,children:r,history:n}){let[a,o]=e.useState({action:n.action,location:n.location}),i=e.useCallback((t=>{e.startTransition((()=>o(t)))}),[o]);return e.useLayoutEffect((()=>n.listen(i)),[n,i]),e.createElement(Qt,{basename:t,children:r,location:a.location,navigationType:a.action,navigator:n})}Dn.displayName="unstable_HistoryRouter";const Ln=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,Tn=e.forwardRef((function({onClick:t,discover:r="render",prefetch:n="none",relative:a,reloadDocument:o,replace:i,state:s,target:l,to:u,preventScrollReset:c,viewTransition:d,...h},f){let m,{basename:p}=e.useContext(Ze),y="string"==typeof u&&Ln.test(u),g=!1;if("string"==typeof u&&y&&(m=u,bn))try{let e=new URL(window.location.href),t=u.startsWith("//")?new URL(e.protocol+u):new URL(u),r=_(t.pathname,p);t.origin===e.origin&&null!=r?u=r+t.search+t.hash:g=!0}catch(io){}let v=nt(u,{relative:a}),[w,b,E]=function(t,r){let n=e.useContext(ln),[a,o]=e.useState(!1),[i,s]=e.useState(!1),{onFocus:l,onBlur:u,onMouseEnter:c,onMouseLeave:d,onTouchStart:h}=r,f=e.useRef(null);e.useEffect((()=>{if("render"===t&&s(!0),"viewport"===t){let e=new IntersectionObserver((e=>{e.forEach((e=>{s(e.isIntersecting)}))}),{threshold:.5});return f.current&&e.observe(f.current),()=>{e.disconnect()}}}),[t]),e.useEffect((()=>{if(a){let e=setTimeout((()=>{s(!0)}),100);return()=>{clearTimeout(e)}}}),[a]);let m=()=>{o(!0)},p=()=>{o(!1),s(!1)};return n?"intent"!==t?[i,f,{}]:[i,f,{onFocus:cn(l,m),onBlur:cn(u,p),onMouseEnter:cn(c,m),onMouseLeave:cn(d,p),onTouchStart:cn(h,m)}]:[!1,f,{}]}(n,h),S=Fn(u,{replace:i,state:s,target:l,preventScrollReset:c,relative:a,viewTransition:d});let x=e.createElement("a",Object.assign({},h,E,{href:m||v,onClick:g||o?t:function(e){t&&t(e),e.defaultPrevented||S(e)},ref:wn(f,b),target:l,"data-discover":y||"render"!==r?void 0:"true"}));return w&&!y?e.createElement(e.Fragment,null,x,e.createElement(fn,{page:v})):x}));Tn.displayName="Link";const Mn=e.forwardRef((function({"aria-current":t="page",caseSensitive:r=!1,className:n="",end:a=!1,style:o,to:i,viewTransition:s,children:l,...u},c){let d=mt(i,{relative:u.relative}),h=ot(),f=e.useContext(Ke),{navigator:m,basename:p}=e.useContext(Ze),y=null!=f&&Xn(d)&&!0===s,g=m.encodeLocation?m.encodeLocation(d).pathname:d.pathname,v=h.pathname,w=f&&f.navigation&&f.navigation.location?f.navigation.location.pathname:null;r||(v=v.toLowerCase(),w=w?w.toLowerCase():null,g=g.toLowerCase()),w&&p&&(w=_(w,p)||w);const b="/"!==g&&g.endsWith("/")?g.length-1:g.length;let E,S=v===g||!a&&v.startsWith(g)&&"/"===v.charAt(b),x=null!=w&&(w===g||!a&&w.startsWith(g)&&"/"===w.charAt(g.length)),R={isActive:S,isPending:x,isTransitioning:y},C=S?t:void 0;E="function"==typeof n?n(R):[n,S?"active":null,x?"pending":null,y?"transitioning":null].filter(Boolean).join(" ");let k="function"==typeof o?o(R):o;return e.createElement(Tn,Object.assign({},u,{"aria-current":C,className:E,ref:c,style:k,to:i,viewTransition:s}),"function"==typeof l?l(R):l)}));Mn.displayName="NavLink";const An=e.forwardRef((({discover:t="render",fetcherKey:r,navigate:n,reloadDocument:a,replace:o,state:i,method:s="get",action:l,onSubmit:u,relative:c,preventScrollReset:d,viewTransition:h,...f},m)=>{let p=$n(),y=In(l,{relative:c}),g="get"===s.toLowerCase()?"get":"post",v="string"==typeof l&&Ln.test(l);return e.createElement("form",Object.assign({ref:m,method:g,action:y,onSubmit:a?u:e=>{if(u&&u(e),e.defaultPrevented)return;e.preventDefault();let t=e.nativeEvent.submitter,a=t?.getAttribute("formmethod")||s;p(t||e.currentTarget,{fetcherKey:r,method:a,navigate:n,replace:o,state:i,relative:c,preventScrollReset:d,viewTransition:h})}},f,{"data-discover":v||"render"!==t?void 0:"true"}))}));function _n({getKey:t,storageKey:r,...n}){let a=e.useContext(ln),{basename:o}=e.useContext(Ze),i=ot(),s=Tt();Yn({getKey:t,storageKey:r});let l=e.useMemo((()=>{if(!a||!t)return null;let e=Wn(i,s,o,t);return e!==i.key?e:null}),[]);if(!a||a.isSpaMode)return null;let u=((e,t)=>{if(!window.history.state||!window.history.state.key){let e=Math.random().toString(32).slice(2);window.history.replaceState({key:e},"")}try{let r=JSON.parse(sessionStorage.getItem(e)||"{}")[t||window.history.state.key];"number"==typeof r&&window.scrollTo(0,r)}catch(r){console.error(r),sessionStorage.removeItem(e)}}).toString();return e.createElement("script",Object.assign({},n,{suppressHydrationWarning:!0,dangerouslySetInnerHTML:{__html:`(${u})(${JSON.stringify(r||qn)}, ${JSON.stringify(l)})`}}))}An.displayName="Form",_n.displayName="ScrollRestoration";var On=function(e){return e.UseScrollRestoration="useScrollRestoration",e.UseSubmit="useSubmit",e.UseSubmitFetcher="useSubmitFetcher",e.UseFetcher="useFetcher",e.useViewTransitionState="useViewTransitionState",e}(On||{}),Pn=function(e){return e.UseFetcher="useFetcher",e.UseFetchers="useFetchers",e.UseScrollRestoration="useScrollRestoration",e}(Pn||{});function Un(t){let r=e.useContext(Ve);return r||d(!1),r}function jn(t){let r=e.useContext(Ke);return r||d(!1),r}function Fn(t,{target:r,replace:n,state:a,preventScrollReset:o,relative:i,viewTransition:s}={}){let l=ut(),u=ot(),c=mt(t,{relative:i});return e.useCallback((e=>{if(function(e,t){return!(0!==e.button||t&&"_self"!==t||function(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}(e))}(e,r)){e.preventDefault();let r=void 0!==n?n:m(u)===m(c);l(t,{replace:r,state:a,preventScrollReset:o,relative:i,viewTransition:s})}}),[u,l,c,n,a,r,t,o,i,s])}function Nn(t){let r=e.useRef(lr(t)),n=e.useRef(!1),a=ot(),o=e.useMemo((()=>function(e,t){let r=lr(e);return t&&t.forEach(((e,n)=>{r.has(n)||t.getAll(n).forEach((e=>{r.append(n,e)}))})),r}(a.search,n.current?null:r.current)),[a.search]),i=ut(),s=e.useCallback(((e,t)=>{const r=lr("function"==typeof e?e(o):e);n.current=!0,i("?"+r,t)}),[i,o]);return[o,s]}let Hn=0;function $n(){let{router:t}=Un(On.UseSubmit),{basename:r}=e.useContext(Ze),n=kt(xt.UseRouteId);return e.useCallback((async(e,a={})=>{let{action:o,method:i,encType:s,formData:l,body:u}=hr(e,r);if(!1===a.navigate){let e=a.fetcherKey||`__${String(++Hn)}__`;await t.fetch(e,n,a.action||o,{preventScrollReset:a.preventScrollReset,formData:l,body:u,formMethod:a.method||i,formEncType:a.encType||s,flushSync:a.flushSync})}else await t.navigate(a.action||o,{preventScrollReset:a.preventScrollReset,formData:l,body:u,formMethod:a.method||i,formEncType:a.encType||s,replace:a.replace,state:a.state,fromRouteId:n,flushSync:a.flushSync,viewTransition:a.viewTransition})}),[t,r,n])}function In(t,{relative:r}={}){let{basename:n}=e.useContext(Ze),a=e.useContext(tt);a||d(!1);let[o]=a.matches.slice(-1),i={...mt(t||".",{relative:r})},s=ot();if(null==t){i.search=s.search;let e=new URLSearchParams(i.search);e.has("index")&&""===e.get("index")&&(e.delete("index"),i.search=e.toString()?`?${e.toString()}`:"")}return t&&"."!==t||!o.route.index||(i.search=i.search?i.search.replace(/^\?/,"?index&"):"?index"),"/"!==n&&(i.pathname="/"===i.pathname?n:F([n,i.pathname])),m(i)}function Bn({key:t}={}){let{router:r}=Un(On.UseFetcher),n=jn(Pn.UseFetcher),a=e.useContext(Ge),o=e.useContext(tt),i=o.matches[o.matches.length-1]?.route.id;a||d(!1),o||d(!1),null==i&&d(!1);let s=e.useId(),[l,u]=e.useState(t||s);t&&t!==l&&u(t),e.useEffect((()=>(r.getFetcher(l),()=>r.deleteFetcher(l))),[r,l]);let c=e.useCallback((async(e,t)=>{i||d(!1),await r.fetch(l,i,e,t)}),[l,i,r]),h=$n(),f=e.useCallback((async(e,t)=>{await h(e,{...t,navigate:!1,fetcherKey:l})}),[l,h]),m=e.useMemo((()=>{let t=e.forwardRef(((t,r)=>e.createElement(An,Object.assign({},t,{navigate:!1,fetcherKey:l,ref:r}))));return t.displayName="fetcher.Form",t}),[l]),p=n.fetchers.get(l)||re,y=a.get(l);return e.useMemo((()=>({Form:m,submit:f,load:c,...p,data:y})),[m,f,c,p,y])}function zn(){let e=jn(Pn.UseFetchers);return Array.from(e.fetchers.entries()).map((([e,t])=>({...t,key:e})))}const qn="react-router-scroll-positions";let Jn={};function Wn(e,t,r,n){let a=null;return n&&(a=n("/"!==r?{...e,pathname:_(e.pathname,r)||e.pathname}:e,t)),null==a&&(a=e.key),a}function Yn({getKey:t,storageKey:r}={}){let{router:n}=Un(On.UseScrollRestoration),{restoreScrollPosition:a,preventScrollReset:o}=jn(Pn.UseScrollRestoration),{basename:i}=e.useContext(Ze),s=ot(),l=Tt(),u=Dt();e.useEffect((()=>(window.history.scrollRestoration="manual",()=>{window.history.scrollRestoration="auto"})),[]),function(t,r){let{capture:n}=r||{};e.useEffect((()=>{let e=null!=n?{capture:n}:void 0;return window.addEventListener("pagehide",t,e),()=>{window.removeEventListener("pagehide",t,e)}}),[t,n])}(e.useCallback((()=>{if("idle"===u.state){let e=Wn(s,l,i,t);Jn[e]=window.scrollY}try{sessionStorage.setItem(r||qn,JSON.stringify(Jn))}catch(e){}window.history.scrollRestoration="auto"}),[u.state,t,i,s,l,r])),"undefined"!=typeof document&&(e.useLayoutEffect((()=>{try{let e=sessionStorage.getItem(r||qn);e&&(Jn=JSON.parse(e))}catch(io){}}),[r]),e.useLayoutEffect((()=>{let e=n?.enableScrollRestoration(Jn,(()=>window.scrollY),t?(e,r)=>Wn(e,r,i,t):void 0);return()=>e&&e()}),[n,i,t]),e.useLayoutEffect((()=>{if(!1!==a)if("number"!=typeof a){if(s.hash){let e=document.getElementById(decodeURIComponent(s.hash.slice(1)));if(e)return void e.scrollIntoView()}!0!==o&&window.scrollTo(0,0)}else window.scrollTo(0,a)}),[s,a,o]))}function Vn(t,r){let{capture:n}=r||{};e.useEffect((()=>{let e=null!=n?{capture:n}:void 0;return window.addEventListener("beforeunload",t,e),()=>{window.removeEventListener("beforeunload",t,e)}}),[t,n])}function Kn({when:t,message:r}){let n=Ft(t);e.useEffect((()=>{if("blocked"===n.state){window.confirm(r)?setTimeout(n.proceed,0):n.reset()}}),[n,r]),e.useEffect((()=>{"blocked"!==n.state||t||n.reset()}),[n,t])}function Xn(t,r={}){let n=e.useContext(Xe);null==n&&d(!1);let{basename:a}=Un(On.useViewTransitionState),o=mt(t,{relative:r.relative});if(!n.isTransitioning)return!1;let i=_(n.currentLocation.pathname,a)||n.currentLocation.pathname,s=_(n.nextLocation.pathname,a)||n.nextLocation.pathname;return null!=M(o.pathname,s)||null!=M(o.pathname,i)}function Gn({basename:t,children:r,location:n="/"}){"string"==typeof n&&(n=p(n));let a=s.Pop,o={pathname:n.pathname||"/",search:n.search||"",hash:n.hash||"",state:null!=n.state?n.state:null,key:n.key||"default"},i=ta();return e.createElement(Qt,{basename:t,children:r,location:o,navigationType:a,navigator:i,static:!0})}function Qn({context:t,router:r,hydrate:n=!0,nonce:a}){r&&t||d(!1);let o={router:r,navigator:ta(),static:!0,staticContext:t,basename:t.basename||"/"},i=new Map,s="";if(!1!==n){let e={loaderData:t.loaderData,actionData:t.actionData,errors:ea(t.errors)};s=`window.__staticRouterHydrationData = JSON.parse(${JSON.stringify(JSON.stringify(e)).replace(la,(e=>sa[e]))});`}let{state:l}=o.router;return e.createElement(e.Fragment,null,e.createElement(Ve.Provider,{value:o},e.createElement(Ke.Provider,{value:l},e.createElement(Ge.Provider,{value:i},e.createElement(Xe.Provider,{value:{isTransitioning:!1}},e.createElement(Qt,{basename:o.basename,location:l.location,navigationType:l.historyAction,navigator:o.navigator,static:o.static},e.createElement(Zn,{routes:r.routes,future:r.future,state:l})))))),s?e.createElement("script",{suppressHydrationWarning:!0,nonce:a,dangerouslySetInnerHTML:{__html:s}}):null)}function Zn({routes:e,future:t,state:r}){return yt(e,void 0,r,t)}function ea(e){if(!e)return null;let t=Object.entries(e),r={};for(let[n,a]of t)V(a)?r[n]={...a,__type:"RouteErrorResponse"}:a instanceof Error?r[n]={message:a.message,__type:"Error",..."Error"!==a.name?{__subType:a.name}:{}}:r[n]=a;return r}function ta(){return{createHref:aa,encodeLocation:oa,push(e){throw new Error(`You cannot use navigator.push() on the server because it is a stateless environment. This error was probably triggered when you did a \`navigate(${JSON.stringify(e)})\` somewhere in your app.`)},replace(e){throw new Error(`You cannot use navigator.replace() on the server because it is a stateless environment. This error was probably triggered when you did a \`navigate(${JSON.stringify(e)}, { replace: true })\` somewhere in your app.`)},go(e){throw new Error(`You cannot use navigator.go() on the server because it is a stateless environment. This error was probably triggered when you did a \`navigate(${e})\` somewhere in your app.`)},back(){throw new Error("You cannot use navigator.back() on the server because it is a stateless environment.")},forward(){throw new Error("You cannot use navigator.forward() on the server because it is a stateless environment.")}}}function ra(e,t){return se(e,{...t,mapRouteProperties:Bt})}function na(e,t,r={}){let n={},a=w(e,Bt,void 0,n),o=t.matches.map((e=>{let t=n[e.route.id]||e.route;return{...e,route:t}})),i=e=>`You cannot use router.${e}() on the server because it is a stateless environment`;return{get basename(){return t.basename},get future(){return{...r?.future}},get state(){return{historyAction:s.Pop,location:t.location,matches:o,loaderData:t.loaderData,actionData:t.actionData,errors:t.errors,initialized:!0,navigation:te,restoreScrollPosition:null,preventScrollReset:!1,revalidation:"idle",fetchers:new Map,blockers:new Map}},get routes(){return a},get window(){},initialize(){throw i("initialize")},subscribe(){throw i("subscribe")},enableScrollRestoration(){throw i("enableScrollRestoration")},navigate(){throw i("navigate")},fetch(){throw i("fetch")},revalidate(){throw i("revalidate")},createHref:aa,encodeLocation:oa,getFetcher:()=>re,deleteFetcher(){throw i("deleteFetcher")},dispose(){throw i("dispose")},getBlocker:()=>ne,deleteBlocker(){throw i("deleteBlocker")},patchRoutes(){throw i("patchRoutes")},_internalFetchControllers:new Map,_internalSetRoutes(){throw i("_internalSetRoutes")}}}function aa(e){return"string"==typeof e?e:m(e)}function oa(e){let t="string"==typeof e?e:m(e);t=t.replace(/ $/,"%20");let r=ia.test(t)?new URL(t):new URL(t,"http://localhost");return{pathname:r.pathname,search:r.search,hash:r.hash}}const ia=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,sa={"&":"\\u0026",">":"\\u003e","<":"\\u003c","\u2028":"\\u2028","\u2029":"\\u2029"},la=/[&><\u2028\u2029]/g;function ua({context:t,url:r,abortDelay:n,nonce:a}){"string"==typeof r&&(r=new URL(r));let{manifest:o,routeModules:i,criticalCss:s,serverHandoffString:l}=t,u=Jr(o.routes,i,t.future,t.isSpaMode);t.staticHandlerContext.loaderData={...t.staticHandlerContext.loaderData};for(let e of t.staticHandlerContext.matches){let r=e.route.id,n=i[r],a=t.manifest.routes[r];n&&Qr(a,n,t.isSpaMode)&&(n.HydrateFallback||!a.hasLoader)&&(t.staticHandlerContext.loaderData[r]=void 0)}let c=na(u,t.staticHandlerContext);return e.createElement(e.Fragment,null,e.createElement(ln.Provider,{value:{manifest:o,routeModules:i,criticalCss:s,serverHandoffString:l,future:t.future,isSpaMode:t.isSpaMode,serializeError:t.serializeError,abortDelay:n,renderMeta:t.renderMeta}},e.createElement(Hr,{location:c.state.location},e.createElement(Qn,{router:c,context:t.staticHandlerContext,hydrate:!1}))),t.serverHandoffStream?e.createElement(e.Suspense,null,e.createElement(Tr,{context:t,identifier:0,reader:t.serverHandoffStream.getReader(),textDecoder:new TextDecoder,nonce:a})):null)}function ca(t,r={}){return function({initialEntries:n,initialIndex:a,hydrationData:o,future:i}){let s=e.useRef(),l=e.useRef();if(null==s.current){l.current={future:{},manifest:{routes:{},entry:{imports:[],module:""},url:"",version:""},routeModules:{},isSpaMode:!1};let e=da(w(t,(e=>e)),r,l.current.manifest,l.current.routeModules);s.current=zt(e,{initialEntries:n,initialIndex:a,hydrationData:o})}return e.createElement(ln.Provider,{value:l.current},e.createElement(Jt,{router:s.current}))}}function da(e,t,r,n,a){return e.map((e=>{if(!e.id)throw new Error("Expected a route.id in @remix-run/testing processRoutes() function");let{loader:o,action:i}=e,s={id:e.id,path:e.path,index:e.index,Component:e.Component,HydrateFallback:e.HydrateFallback,ErrorBoundary:e.ErrorBoundary,action:i?e=>i({...e,context:t}):void 0,loader:o?e=>o({...e,context:t}):void 0,handle:e.handle,shouldRevalidate:e.shouldRevalidate},l={id:e.id,path:e.path,index:e.index,parentId:a,hasAction:null!=e.action,hasLoader:null!=e.loader,hasClientAction:!1,hasClientLoader:!1,hasErrorBoundary:null!=e.ErrorBoundary,module:"build/stub-path-to-module.js"};return r.routes[s.id]=l,n[e.id]={default:e.Component||Xt,ErrorBoundary:e.ErrorBoundary||void 0,handle:e.handle,links:e.links,meta:e.meta,shouldRevalidate:e.shouldRevalidate},e.children&&(s.children=da(e.children,t,r,n,s.id)),s}))}const ha=new TextEncoder,fa=async(e,t)=>{let r=e.lastIndexOf("."),n=e.slice(0,r),a=e.slice(r+1),o=ha.encode(n),i=await ma(t,["verify"]),s=function(e){let t=new Uint8Array(e.length);for(let r=0;r<e.length;r++)t[r]=e.charCodeAt(r);return t}(atob(a));return!!(await crypto.subtle.verify("HMAC",i,s,o))&&n},ma=async(e,t)=>crypto.subtle.importKey("raw",ha.encode(e),{name:"HMAC",hash:"SHA-256"},!1,t);const pa=(e,t={})=>{let{secrets:r=[],...o}={path:"/",sameSite:"lax",...t};return function(e,t){It(!t,`The "${e}" cookie has an "expires" property set. This will cause the expires value to not be updated when the session is committed. Instead, you should set the expires value when serializing the cookie. You can use \`commitSession(session, { expires })\` if using a session storage object, or \`cookie.serialize("value", { expires })\` if you're using the cookie directly.`)}(e,o.expires),{get name(){return e},get isSigned(){return r.length>0},get expires(){return void 0!==o.maxAge?new Date(Date.now()+1e3*o.maxAge):o.expires},async parse(t,a){if(!t)return null;let i=n(t,{...o,...a});return e in i?""===i[e]?"":await async function(e,t){if(t.length>0){for(let r of t){let t=await fa(e,r);if(!1!==t)return ga(t)}return null}return ga(e)}(i[e],r):null},serialize:async(t,n)=>a(e,""===t?"":await async function(e,t){let r=function(e){return btoa(function(e){let t,r,n=e.toString(),a="",o=0;for(;o<n.length;){if(t=n.charAt(o++),"%"===t)if("u"===n.charAt(o)){if(r=n.slice(o+1,o+5),/^[\da-f]{4}$/i.exec(r)){a+=String.fromCharCode(parseInt(r,16)),o+=5;continue}}else if(r=n.slice(o,o+2),/^[\da-f]{2}$/i.exec(r)){a+=String.fromCharCode(parseInt(r,16)),o+=2;continue}a+=t}return a}(encodeURIComponent(JSON.stringify(e))))}(e);t.length>0&&(r=await(async(e,t)=>{let r=ha.encode(e),n=await ma(t,["sign"]),a=await crypto.subtle.sign("HMAC",n,r);return e+"."+btoa(String.fromCharCode(...new Uint8Array(a))).replace(/=+$/,"")})(r,t[0]));return r}(t,r),{...o,...n})}},ya=e=>null!=e&&"string"==typeof e.name&&"boolean"==typeof e.isSigned&&"function"==typeof e.parse&&"function"==typeof e.serialize;function ga(e){try{return JSON.parse(decodeURIComponent(function(e){let t,r,n=e.toString(),a="",o=0;for(;o<n.length;)t=n.charAt(o++),/[\w*+\-./@]/.exec(t)?a+=t:(r=t.charCodeAt(0),a+=r<256?"%"+va(r,2):"%u"+va(r,4).toUpperCase());return a}(atob(e))))}catch(t){return{}}}function va(e,t){let r=e.toString(16);for(;r.length<t;)r="0"+r;return r}function wa(...e){return async t=>{for(let r of e){let e=await r(t);if(null!=e)return e}}}async function ba(e,t){let r=e.headers.get("Content-Type")||"",[n,a]=r.split(/\s*;\s*boundary=/);if(!e.body||!a||"multipart/form-data"!==n)throw new TypeError("Could not parse content as FormData.");let i=new FormData,s=o(e.body,a);for await(let o of s){if(o.done)break;"string"==typeof o.filename&&(o.filename=o.filename.split(/[/\\]/).pop());let e=await t(o);null!=e&&i.append(o.name,e)}return i}function Ea(e){return Object.keys(e).reduce(((t,r)=>(t[r]=e[r].module,t)),{})}let Sa=function(e){return e.Development="development",e.Production="production",e.Test="test",e}({});function xa(e,t){if(e instanceof Error&&t!==Sa.Development){let e=new Error("Unexpected Server Error");return e.stack=void 0,e}return e}function Ra(e,t){return Object.entries(e).reduce(((e,[r,n])=>Object.assign(e,{[r]:xa(n,t)})),{})}function Ca(e,t){let r=xa(e,t);return{message:r.message,stack:r.stack}}function ka(e,t){if(!e)return null;let r=Object.entries(e),n={};for(let[a,o]of r)if(V(o))n[a]={...o,__type:"RouteErrorResponse"};else if(o instanceof Error){let e=xa(o,t);n[a]={message:e.message,stack:e.stack,__type:"Error",..."Error"!==e.name?{__subType:e.name}:{}}}else n[a]=o;return n}function Da(e,t,r){let n=b(e,t,r);return n?n.map((e=>({params:e.params,pathname:e.pathname,route:e.route}))):null}function La(e){let t=new URL(e.url),r=t.searchParams.getAll("index");t.searchParams.delete("index");let n=[];for(let o of r)o&&n.push(o);for(let o of n)t.searchParams.append("index",o);let a={method:e.method,body:e.body,headers:e.headers,signal:e.signal};return a.body&&(a.duplex="half"),new Request(t.href,a)}function Ta(e){let t=new URL(e.url);t.searchParams.delete("_routes");let r={method:e.method,body:e.body,headers:e.headers,signal:e.signal};return r.body&&(r.duplex="half"),new Request(t.href,r)}function Ma(e){let t={};return Object.values(e).forEach((e=>{let r=e.parentId||"";t[r]||(t[r]=[]),t[r].push(e)})),t}function Aa(e,t="",r=Ma(e)){return(r[t]||[]).map((t=>({...t,children:Aa(e,t.id,r)})))}function _a(e,t,r="",n=Ma(e)){return(n[r]||[]).map((r=>{let a={hasErrorBoundary:"root"===r.id||null!=r.module.ErrorBoundary,id:r.id,path:r.path,loader:r.module.loader?(e,t)=>async function({loadContext:e,loader:t,params:r,request:n,routeId:a}){let o=await t({request:Ta(La(n)),context:e,params:r});if(void 0===o)throw new Error(`You defined a loader for route "${a}" but didn't return anything from your \`loader\` function. Please return a value or \`null\`.`);return o}({request:e.request,params:e.params,loadContext:e.context,loader:r.module.loader,routeId:r.id}):void 0,action:r.module.action?(e,t)=>async function({loadContext:e,action:t,params:r,request:n,routeId:a}){let o=await t({request:Ta(La(n)),context:e,params:r});if(void 0===o)throw new Error(`You defined an action for route "${a}" but didn't return anything from your \`action\` function. Please return a value or \`null\`.`);return o}({request:e.request,params:e.params,loadContext:e.context,action:r.module.action,routeId:r.id}):void 0,handle:r.module.handle};return r.index?{index:!0,...a}:{caseSensitive:r.caseSensitive,children:_a(e,t,r.id,n),...a}}))}function Oa(e){return null!=e&&"number"==typeof e.status&&"string"==typeof e.statusText&&"object"==typeof e.headers&&void 0!==e.body}const Pa=new Set([301,302,303,307,308]);function Ua(e){return Pa.has(e)}const ja={"&":"\\u0026",">":"\\u003e","<":"\\u003c","\u2028":"\\u2028","\u2029":"\\u2029"},Fa=/[&><\u2028\u2029]/g;function Na(e){return JSON.stringify(e).replace(Fa,(e=>ja[e]))}function Ha(e){globalThis.__remix_devServerHooks=e}function $a(){return globalThis.__remix_devServerHooks}function Ia(e,t){let r,n=t.errors?t.matches.findIndex((e=>t.errors[e.route.id])):-1,a=n>=0?t.matches.slice(0,n+1):t.matches;if(n>=0){let{actionHeaders:e,actionData:a,loaderHeaders:o,loaderData:i}=t;t.matches.slice(n).some((t=>{let n=t.route.id;return!e[n]||a&&void 0!==a[n]?o[n]&&void 0===i[n]&&(r=o[n]):r=e[n],null!=r}))}return a.reduce(((n,o,i)=>{let{id:s}=o.route,l=e.routes[s].module,u=t.loaderHeaders[s]||new Headers,c=t.actionHeaders[s]||new Headers,d=null!=r&&i===a.length-1,h=d&&r!==u&&r!==c;if(null==l.headers){let e=new Headers(n);return h&&Ba(r,e),Ba(c,e),Ba(u,e),e}let f=new Headers(l.headers?"function"==typeof l.headers?l.headers({loaderHeaders:u,parentHeaders:n,actionHeaders:c,errorHeaders:d?r:void 0}):l.headers:void 0);return h&&Ba(r,f),Ba(c,f),Ba(u,f),Ba(n,f),f}),new Headers)}function Ba(e,t){let r=e.get("Set-Cookie");if(r){i(r).forEach((e=>{t.append("Set-Cookie",e)}))}}function za({isActionDataRequest:e,loadRouteIds:t}={}){return async({request:r,matches:n})=>{if(e&&"GET"===r.method)return{};let a=t?n.filter((e=>t.includes(e.route.id))):n;return(await Promise.all(a.map((e=>e.resolve())))).reduce(((e,t,r)=>Object.assign(e,{[a[r].route.id]:t})),{})}}function qa(e,t,r){let n=t.get("Location");return r&&(n=_(n,r)||n),{redirect:n,status:e,revalidate:t.has("X-Remix-Revalidate")||t.has("Set-Cookie"),reload:t.has("X-Remix-Reload-Document"),replace:t.has("X-Remix-Replace")}}function Ja(e,t,n,a){let o=new AbortController,i=setTimeout((()=>o.abort(new Error("Server Timeout"))),"number"==typeof n?n:4950);return t.addEventListener("abort",(()=>clearTimeout(i))),r(e,{signal:o.signal,plugins:[e=>{if(e instanceof Error){let{name:t,message:r,stack:n}=a===Sa.Production?xa(e,a):e;return["SanitizedError",t,r,n]}if(e instanceof Y){let{data:t,status:r,statusText:n}=e;return["ErrorResponse",t,r,n]}if(e&&"object"==typeof e&&Lr in e)return["SingleFetchRedirect",e[Lr]]}],postPlugins:[e=>{if(e&&"object"==typeof e)return["SingleFetchClassInstance",Object.fromEntries(Object.entries(e))]},()=>["SingleFetchFallback"]]})}function Wa(e,t){if(!1===e||null==e)throw console.error("The following error is a bug in Remix; please open an issue! https://github.com/remix-run/remix/issues/new"),new Error(t)}function Ya(e,t){let r=Aa(e.routes),n=_a(e.routes,e.future),a=(o=t)===Sa.Development||o===Sa.Production||o===Sa.Test?t:Sa.Production;var o;let i=se(n,{basename:e.basename}),s=e.entry.module.handleError||((e,{request:t})=>{a===Sa.Test||t.signal.aborted||console.error(V(e)&&e.error?e.error:e)});return{routes:r,dataRoutes:n,serverMode:a,staticHandler:i,errorHandler:s}}const Va=(e,t)=>{let r,n,a,o,i;return async function(s,l={}){if(r="function"==typeof e?await e():e,"function"==typeof e){let e=Ya(r,t);n=e.routes,a=e.serverMode,o=e.staticHandler,i=e.errorHandler}else if(!(n&&a&&o&&i)){let e=Ya(r,t);n=e.routes,a=e.serverMode,o=e.staticHandler,i=e.errorHandler}let u=new URL(s.url),c={},d=e=>{t===Sa.Development&&$a()?.processRequestError?.(e),i(e,{context:l,params:c,request:s})},h=`${r.basename??"/"}/__manifest`.replace(/\/+/g,"/");if(u.pathname===h)try{let e=await async function(e,t,r){let n={};if(r.searchParams.has("p")){for(let a of r.searchParams.getAll("p")){let r=Da(t,a,e.basename);if(r)for(let t of r){let r=t.route.id;n[r]=e.assets.routes[r]}}return((e,t={})=>I(e,t))(n,{headers:{"Cache-Control":"public, max-age=31536000, immutable"}})}return new Response("Invalid Request",{status:400})}(r,n,u);return e}catch(io){return d(io),new Response("Unknown Server Error",{status:500})}let f,m=Da(n,u.pathname,r.basename);if(m&&m.length>0&&Object.assign(c,m[0].params),u.pathname.endsWith(".data")){let e=new URL(s.url);e.pathname=e.pathname.replace(/\.data$/,"").replace(/^\/_root$/,"/");let t=Da(n,e.pathname,r.basename);if(f=await async function(e,t,r,n,a,o,i){let{result:s,headers:l,status:u}="GET"!==n.method?await async function(e,t,r,n,a,o,i){try{let s=new Request(a,{method:n.method,body:n.body,headers:n.headers,signal:n.signal,...n.body?{duplex:"half"}:void 0}),l=await r.query(s,{requestContext:o,skipLoaderErrorBubbling:!0,dataStrategy:za({isActionDataRequest:!0})});if(Oa(l))return{result:qa(l.status,l.headers,e.basename),headers:l.headers,status:202};let u,c=l,d=Ia(e,c);return Ua(c.statusCode)&&d.has("Location")?{result:qa(c.statusCode,d,e.basename),headers:d,status:202}:(c.errors&&(Object.values(c.errors).forEach((e=>{V(e)&&!e.error||i(e)})),c.errors=Ra(c.errors,t)),u=c.errors?{error:Object.values(c.errors)[0]}:{data:Object.values(c.actionData||{})[0]},{result:u,headers:d,status:c.statusCode})}catch(s){return i(s),{result:{error:s},headers:new Headers,status:500}}}(t,e,r,n,a,o,i):await async function(e,t,r,n,a,o,i){try{let s=new Request(a,{headers:n.headers,signal:n.signal}),l=new URL(n.url).searchParams.get("_routes")?.split(",")||void 0,u=await r.query(s,{requestContext:o,skipLoaderErrorBubbling:!0,dataStrategy:za({loadRouteIds:l})});if(Oa(u))return{result:{[Lr]:qa(u.status,u.headers,e.basename)},headers:u.headers,status:202};let c=u,d=Ia(e,c);if(Ua(c.statusCode)&&d.has("Location"))return{result:{[Lr]:qa(c.statusCode,d,e.basename)},headers:d,status:202};c.errors&&(Object.values(c.errors).forEach((e=>{V(e)&&!e.error||i(e)})),c.errors=Ra(c.errors,t));let h={};return(l?c.matches.filter((e=>e.route.loader&&l.includes(e.route.id))):c.matches).forEach((e=>{let t=c.loaderData?.[e.route.id],r=c.errors?.[e.route.id];void 0!==r?h[e.route.id]={error:r}:void 0!==t&&(h[e.route.id]={data:t})})),{result:h,headers:d,status:c.statusCode}}catch(s){return i(s),{result:{root:{error:s}},headers:new Headers,status:500}}}(t,e,r,n,a,o,i),c=new Headers(l);if(c.set("X-Remix-Response","yes"),304===u)return new Response(null,{status:304,headers:c});return c.set("Content-Type","text/x-script"),new Response(Ja(s,n.signal,t.entry.module.streamTimeout,e),{status:u||200,headers:c})}(a,r,o,s,e,l,d),r.entry.module.handleDataRequest&&(f=await r.entry.module.handleDataRequest(f,{context:l,params:t?t[0].params:{},request:s}),function(e){return Ua(e.status)}(f))){let e=qa(f.status,f.headers,r.basename);"GET"===s.method&&(e={[Lr]:e});let t=new Headers(f.headers);return t.set("Content-Type","text/x-script"),new Response(Ja(e,s.signal,r.entry.module.streamTimeout,a),{status:202,headers:t})}}else if(m&&null==m[m.length-1].route.module.default&&null==m[m.length-1].route.module.ErrorBoundary)f=await async function(e,t,r,n,a,o,i){try{let e=await r.queryRoute(a,{routeId:n,requestContext:o});return Oa(e)||Wa(!1),e}catch(s){return Oa(s)?(s.headers.set("X-Remix-Catch","yes"),s):V(s)?(s&&i(s),function(e,t){return I(Ca(e.error||new Error("Unexpected Server Error"),t),{status:e.status,statusText:e.statusText,headers:{"X-Remix-Error":"yes"}})}(s,e)):(i(s),Ka(s,e))}}(a,0,o,m.slice(-1)[0].route.id,s,l,d);else{let e=t===Sa.Development?await($a()?.getCriticalCss?.(r,u.pathname)):void 0;f=await async function(e,t,r,n,a,o,i){let s;try{s=await r.query(n,{requestContext:a})}catch(h){return o(h),new Response(null,{status:500})}if(Oa(s))return s;let l=Ia(t,s);if(304===s.statusCode)return new Response(null,{status:304,headers:l});s.errors&&(Object.values(s.errors).forEach((e=>{V(e)&&!e.error||o(e)})),s.errors=Ra(s.errors,e));let u={loaderData:s.loaderData,actionData:s.actionData,errors:ka(s.errors,e)},c={manifest:t.assets,routeModules:Ea(t.routes),staticHandlerContext:s,criticalCss:i,serverHandoffString:Na({basename:t.basename,criticalCss:i,future:t.future,isSpaMode:t.isSpaMode}),serverHandoffStream:Ja(u,n.signal,t.entry.module.streamTimeout,e),renderMeta:{},future:t.future,isSpaMode:t.isSpaMode,serializeError:t=>Ca(t,e)},d=t.entry.module.default;try{return await d(n,s.statusCode,l,c,a)}catch(h){o(h);let i=h;if(Oa(h))try{let e=await function(e){let t=e.headers.get("Content-Type");return t&&/\bapplication\/json\b/.test(t)?null==e.body?null:e.json():e.text()}(h);i=new Y(h.status,h.statusText,e)}catch(io){}s=function(e,t,r){return{...t,statusCode:V(r)?r.status:500,errors:{[t._deepestRenderedBoundaryId||e[0].id]:r}}}(r.dataRoutes,s,i),s.errors&&(s.errors=Ra(s.errors,e));let u={loaderData:s.loaderData,actionData:s.actionData,errors:ka(s.errors,e)};c={...c,staticHandlerContext:s,serverHandoffString:Na({basename:t.basename,future:t.future,isSpaMode:t.isSpaMode}),serverHandoffStream:Ja(u,n.signal,t.entry.module.streamTimeout,e),renderMeta:{}};try{return await d(n,s.statusCode,l,c,a)}catch(h){return o(h),Ka(h,e)}}}(a,r,o,s,l,d,e)}return"HEAD"===s.method?new Response(null,{headers:f.headers,status:f.status,statusText:f.statusText}):f}};function Ka(e,t){let r="Unexpected Server Error";return t!==Sa.Production&&(r+=`\n\n${String(e)}`),new Response(r,{status:500,headers:{"Content-Type":"text/plain"}})}function Xa(e){return`__flash_${e}__`}const Ga=(e={},t="")=>{let r=new Map(Object.entries(e));return{get id(){return t},get data(){return Object.fromEntries(r)},has:e=>r.has(e)||r.has(Xa(e)),get(e){if(r.has(e))return r.get(e);let t=Xa(e);if(r.has(t)){let e=r.get(t);return r.delete(t),e}},set(e,t){r.set(e,t)},flash(e,t){r.set(Xa(e),t)},unset(e){r.delete(e)}}},Qa=e=>null!=e&&"string"==typeof e.id&&void 0!==e.data&&"function"==typeof e.has&&"function"==typeof e.get&&"function"==typeof e.set&&"function"==typeof e.flash&&"function"==typeof e.unset;function Za({cookie:e,createData:t,readData:r,updateData:n,deleteData:a}){let o=ya(e)?e:pa(e?.name||"__session",e);return eo(o),{async getSession(e,t){let n=e&&await o.parse(e,t),a=n&&await r(n);return Ga(a||{},n||"")},async commitSession(e,r){let{id:a,data:i}=e,s=null!=r?.maxAge?new Date(Date.now()+1e3*r.maxAge):null!=r?.expires?r.expires:o.expires;return a?await n(a,i,s):a=await t(i,s),o.serialize(a,r)},destroySession:async(e,t)=>(await a(e.id),o.serialize("",{...t,maxAge:void 0,expires:new Date(0)}))}}function eo(e){It(e.isSigned,`The "${e.name}" cookie is not signed, but session cookies should be signed to prevent tampering on the client before they are sent back to the server. See https://remix.run/utils/cookies#signing-cookies for more information.`)}function to({cookie:e}={}){let t=ya(e)?e:pa(e?.name||"__session",e);return eo(t),{getSession:async(e,r)=>Ga(e&&await t.parse(e,r)||{}),async commitSession(e,r){let n=await t.serialize(e.data,r);if(n.length>4096)throw new Error("Cookie length will exceed browser maximum. Length: "+n.length);return n},destroySession:async(e,r)=>t.serialize("",{...r,maxAge:void 0,expires:new Date(0)})}}function ro({cookie:e}={}){let t=new Map;return Za({cookie:e,async createData(e,r){let n=Math.random().toString(36).substring(2,10);return t.set(n,{data:e,expires:r}),n},async readData(e){if(t.has(e)){let{data:r,expires:n}=t.get(e);if(!n||n>new Date)return r;n&&t.delete(e)}return null},async updateData(e,r,n){t.set(e,{data:r,expires:n})},async deleteData(e){t.delete(e)}})}class no extends Error{constructor(e,t){super(`Field "${e}" exceeded upload size of ${t} bytes.`),this.field=e,this.maxBytes=t}}function ao({filter:e,maxPartSize:t=3e6}={}){return async({filename:r,contentType:n,name:a,data:o})=>{if(e&&!(await e({filename:r,contentType:n,name:a})))return;let i=0,s=[];for await(let e of o){if(i+=e.byteLength,i>t)throw new no(a,t);s.push(e)}return"string"==typeof r?new File(s,r,{type:n}):await new Blob(s,{type:n}).text()}}function oo(e){if(!e)return null;let t=Object.entries(e),r={};for(let[n,a]of t)if(a&&"RouteErrorResponse"===a.__type)r[n]=new Y(a.status,a.statusText,a.data,!0===a.internal);else if(a&&"Error"===a.__type){if(a.__subType){let e=window[a.__subType];if("function"==typeof e)try{let t=new e(a.message);t.stack=a.stack,r[n]=t}catch(io){}}if(null==r[n]){let e=new Error(a.message);e.stack=a.stack,r[n]=e}}else r[n]=a;return r}export{er as Await,Cn as BrowserRouter,An as Form,kn as HashRouter,ne as IDLE_BLOCKER,re as IDLE_FETCHER,te as IDLE_NAVIGATION,Tn as Link,hn as Links,no as MaxPartSizeExceededError,Vt as MemoryRouter,yn as Meta,Mn as NavLink,Kt as Navigate,s as NavigationType,Xt as Outlet,fn as PrefetchPageLinks,Gt as Route,Qt as Router,Jt as RouterProvider,Zt as Routes,vn as Scripts,_n as ScrollRestoration,ua as ServerRouter,Gn as StaticRouter,Qn as StaticRouterProvider,Ve as UNSAFE_DataRouterContext,Ke as UNSAFE_DataRouterStateContext,Y as UNSAFE_ErrorResponseImpl,Ge as UNSAFE_FetchersContext,ln as UNSAFE_FrameworkContext,et as UNSAFE_LocationContext,Ze as UNSAFE_NavigationContext,Hr as UNSAFE_RemixErrorBoundary,tt as UNSAFE_RouteContext,Sa as UNSAFE_ServerMode,Lr as UNSAFE_SingleFetchRedirectSymbol,Xe as UNSAFE_ViewTransitionContext,u as UNSAFE_createBrowserHistory,Kr as UNSAFE_createClientRoutes,Wr as UNSAFE_createClientRoutesWithHMRRevalidationOptOut,ie as UNSAFE_createRouter,Ur as UNSAFE_decodeViaTurboStream,oo as UNSAFE_deserializeErrors,rn as UNSAFE_getPatchRoutesOnNavigationFunction,Mr as UNSAFE_getSingleFetchDataStrategy,d as UNSAFE_invariant,Bt as UNSAFE_mapRouteProperties,Qr as UNSAFE_shouldHydrateRouteLoader,nn as UNSAFE_useFogOFWarDiscovery,Yn as UNSAFE_useScrollRestoration,En as createBrowserRouter,pa as createCookie,to as createCookieSessionStorage,Sn as createHashRouter,zt as createMemoryRouter,ro as createMemorySessionStorage,m as createPath,Va as createRequestHandler,ar as createRoutesFromChildren,ar as createRoutesFromElements,ca as createRoutesStub,lr as createSearchParams,Ga as createSession,Za as createSessionStorage,ra as createStaticHandler,na as createStaticRouter,z as data,T as generatePath,ya as isCookie,V as isRouteErrorResponse,Qa as isSession,I as json,M as matchPath,b as matchRoutes,p as parsePath,q as redirect,J as redirectDocument,or as renderMatches,W as replace,O as resolvePath,Dn as unstable_HistoryRouter,wa as unstable_composeUploadHandlers,ao as unstable_createMemoryUploadHandler,ba as unstable_parseMultipartFormData,Ha as unstable_setDevServerHooks,Kn as unstable_usePrompt,_t as useActionData,Ut as useAsyncError,Pt as useAsyncValue,Vn as useBeforeUnload,Ft as useBlocker,Bn as useFetcher,zn as useFetchers,In as useFormAction,nt as useHref,at as useInRouterContext,Fn as useLinkClickHandler,Mt as useLoaderData,ot as useLocation,st as useMatch,Tt as useMatches,ut as useNavigate,Dt as useNavigation,it as useNavigationType,ht as useOutlet,dt as useOutletContext,ft as useParams,mt as useResolvedPath,Lt as useRevalidator,Ot as useRouteError,At as useRouteLoaderData,pt as useRoutes,Nn as useSearchParams,$n as useSubmit,Xn as useViewTransitionState};
12
12
  //# sourceMappingURL=react-router.production.min.js.map