import{r as l,i as V,E as C,A as G,D as K,a as Q,f as Z,m as q,g as ee,h as te,k as re,j as oe}from"./index-ukWRVZhT.js";import{S as ne,i as $,l as ie,p as I,R as ae,f as le,r as se}from"./components-BgKv_YmS.js";/**
 * @remix-run/react v2.6.0
 *
 * Copyright (c) Remix Software Inc.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE.md file in the root directory of this source tree.
 *
 * @license MIT
 */class de extends l.Component{constructor(r){super(r),this.state={error:r.error||null,location:r.location}}static getDerivedStateFromError(r){return{error:r}}static getDerivedStateFromProps(r,t){return t.location!==r.location?{error:r.error||null,location:r.location}:{error:r.error||t.error,location:t.location}}render(){return this.state.error?l.createElement(X,{error:this.state.error}):this.props.children}}function X({error:e}){if(console.error(e),V(e))return l.createElement(H,{title:"Unhandled Thrown Response!"},l.createElement("h1",{style:{fontFamily:"system-ui, sans-serif",padding:"2rem"}},e.status," ",e.statusText));let r;if(e instanceof Error)r=e;else{let t=e==null?"Unknown Error":typeof e=="object"&&"toString"in e?e.toString():JSON.stringify(e);r=new Error(t)}return l.createElement(H,{title:"Application Error!"},l.createElement("main",{style:{fontFamily:"system-ui, sans-serif",padding:"2rem"}},l.createElement("h1",{style:{fontSize:"24px"}},"Application Error"),l.createElement("pre",{style:{padding:"2rem",background:"hsla(10, 50%, 50%, 0.1)",color:"red",overflow:"auto"}},r.stack)))}function H({title:e,children:r}){return l.createElement("html",{lang:"en"},l.createElement("head",null,l.createElement("meta",{charSet:"utf-8"}),l.createElement("meta",{name:"viewport",content:"width=device-width,initial-scale=1,viewport-fit=cover"}),l.createElement("title",null,e)),l.createElement("body",null,r,l.createElement("script",{dangerouslySetInnerHTML:{__html:`
              console.log(
                "💿 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."
              );
            `}})))}/**
 * @remix-run/react v2.6.0
 *
 * Copyright (c) Remix Software Inc.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE.md file in the root directory of this source tree.
 *
 * @license MIT
 */function ue(e){if(!e)return null;let r=Object.entries(e),t={};for(let[i,n]of r)if(n&&n.__type==="RouteErrorResponse")t[i]=new C(n.status,n.statusText,n.data,n.internal===!0);else if(n&&n.__type==="Error"){if(n.__subType){let d=window[n.__subType];if(typeof d=="function")try{let u=new d(n.message);u.stack=n.stack,t[i]=u}catch{}}if(t[i]==null){let d=new Error(n.message);d.stack=n.stack,t[i]=d}}else t[i]=n;return t}/**
 * @remix-run/react v2.6.0
 *
 * Copyright (c) Remix Software Inc.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE.md file in the root directory of this source tree.
 *
 * @license MIT
 */function ce(e){return e.headers.get("X-Remix-Catch")!=null}function fe(e){return e.headers.get("X-Remix-Error")!=null}function me(e){return z(e)&&e.status>=400&&e.headers.get("X-Remix-Error")==null&&e.headers.get("X-Remix-Catch")==null&&e.headers.get("X-Remix-Response")==null}function we(e){return e.headers.get("X-Remix-Redirect")!=null}function he(e){var r;return!!((r=e.headers.get("Content-Type"))!==null&&r!==void 0&&r.match(/text\/remix-deferred/))}function z(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.headers=="object"&&typeof e.body<"u"}function _e(e){let r=e;return r&&typeof r=="object"&&typeof r.data=="object"&&typeof r.subscribe=="function"&&typeof r.cancel=="function"&&typeof r.resolveData=="function"}async function U(e,r,t=0){let i=new URL(e.url);i.searchParams.set("_data",r);let n={signal:e.signal};if(e.method!=="GET"){n.method=e.method;let a=e.headers.get("Content-Type");a&&/\bapplication\/json\b/.test(a)?(n.headers={"Content-Type":a},n.body=JSON.stringify(await e.json())):a&&/\btext\/plain\b/.test(a)?(n.headers={"Content-Type":a},n.body=await e.text()):a&&/\bapplication\/x-www-form-urlencoded\b/.test(a)?n.body=new URLSearchParams(await e.text()):n.body=await e.formData()}t>0&&await new Promise(a=>setTimeout(a,5**t*10));let d=window.__remixRevalidation,u=await fetch(i.href,n).catch(a=>{if(typeof d=="number"&&d===window.__remixRevalidation&&(a==null?void 0:a.name)==="TypeError"&&t<3)return U(e,r,t+1);throw a});if(fe(u)){let a=await u.json(),o=new Error(a.message);return o.stack=a.stack,o}if(me(u)){let a=await u.text(),o=new Error(a);return o.stack=void 0,o}return u}const Re="__deferred_promise:";async function ye(e){if(!e)throw new Error("parseDeferredReadableStream requires stream argument");let r,t={};try{let i=pe(e),d=(await i.next()).value;if(!d)throw new Error("no critical data");let u=JSON.parse(d);if(typeof u=="object"&&u!==null)for(let[a,o]of Object.entries(u))typeof o!="string"||!o.startsWith(Re)||(r=r||{},r[a]=new Promise((s,_)=>{t[a]={resolve:c=>{s(c),delete t[a]},reject:c=>{_(c),delete t[a]}}}));return(async()=>{try{for await(let a of i){let[o,...s]=a.split(":"),_=s.join(":"),c=JSON.parse(_);if(o==="data")for(let[h,f]of Object.entries(c))t[h]&&t[h].resolve(f);else if(o==="error")for(let[h,f]of Object.entries(c)){let x=new Error(f.message);x.stack=f.stack,t[h]&&t[h].reject(x)}}for(let[a,o]of Object.entries(t))o.reject(new G(`Deferred ${a} will never be resolved`))}catch(a){for(let o of Object.values(t))o.reject(a)}})(),new K({...u,...r})}catch(i){for(let n of Object.values(t))n.reject(i);throw i}}async function*pe(e){let r=e.getReader(),t=[],i=[],n=!1,d=new TextEncoder,u=new TextDecoder,a=async()=>{if(i.length>0)return i.shift();for(;!n&&i.length===0;){let s=await r.read();if(s.done){n=!0;break}t.push(s.value);try{let c=u.decode(O(...t)).split(`

`);if(c.length>=2&&(i.push(...c.slice(0,-1)),t=[d.encode(c.slice(-1).join(`

`))]),i.length>0)break}catch{continue}}return i.length>0||t.length>0&&(i=u.decode(O(...t)).split(`

`).filter(_=>_),t=[]),i.shift()},o=await a();for(;o;)yield o,o=await a()}function O(...e){let r=new Uint8Array(e.reduce((i,n)=>i+n.length,0)),t=0;for(let i of e)r.set(i,t),t+=i.length;return r}/**
 * @remix-run/react v2.6.0
 *
 * Copyright (c) Remix Software Inc.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE.md file in the root directory of this source tree.
 *
 * @license MIT
 */function ve(){return l.createElement("html",{lang:"en"},l.createElement("head",null,l.createElement("meta",{charSet:"utf-8"}),l.createElement("meta",{name:"viewport",content:"width=device-width,initial-scale=1,viewport-fit=cover"})),l.createElement("body",null,l.createElement(ne,null),l.createElement("script",{dangerouslySetInnerHTML:{__html:`
              console.log(
                "💿 Hey developer 👋. You can provide a way better UX than this " +
                "when your app is running \`clientLoader\` functions on hydration. " +
                "Check out https://remix.run/route/hydrate-fallback for more information."
              );
            `}})," "))}/**
 * @remix-run/react v2.6.0
 *
 * Copyright (c) Remix Software Inc.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE.md file in the root directory of this source tree.
 *
 * @license MIT
 */function N(e){let r={};return Object.values(e).forEach(t=>{let i=t.parentId||"";r[i]||(r[i]=[]),r[i].push(t)}),r}function xe(e,r,t,i,n,d){return D(r,t,i,n,d,"",N(r),e)}function b(e,r,t){if(t){let u=`You cannot call ${e==="action"?"serverAction()":"serverLoader()"} in SPA Mode (routeId: "${r.id}")`;throw console.error(u),new C(400,"Bad Request",new Error(u),!0)}let n=`You are trying to call ${e==="action"?"serverAction()":"serverLoader()"} on a route that does not have a server ${e} (routeId: "${r.id}")`;if(e==="loader"&&!r.hasLoader||e==="action"&&!r.hasAction)throw console.error(n),new C(400,"Bad Request",new Error(n),!0)}function j(e,r){let t=e==="clientAction"?"a":"an",i=`Route "${r}" does not have ${t} ${e}, but you are trying to submit to it. To fix this, please add ${t} \`${e}\` function to the route`;throw console.error(i),new C(405,"Method Not Allowed",new Error(i),!0)}function D(e,r,t,i,n,d="",u=N(e),a){return(u[d]||[]).map(o=>{let s=r[o.id];async function _(m){return o.hasLoader?T(m,o):null}async function c(m){if(!o.hasAction)throw j("action",o.id);return T(m,o)}async function h(m){let w=r[o.id],p=w?I(o,w):Promise.resolve();try{return m()}finally{await p}}let f={id:o.id,index:o.index,path:o.path};if(s){var x,M,k;Object.assign(f,{...f,Component:J(s),HydrateFallback:s.HydrateFallback&&(!n||o.id==="root")?s.HydrateFallback:o.id==="root"?ve:void 0,ErrorBoundary:s.ErrorBoundary?s.ErrorBoundary:o.id==="root"?()=>l.createElement(X,{error:Q()}):void 0,handle:s.handle,shouldRevalidate:a?B(o.id,s.shouldRevalidate,a):s.shouldRevalidate});let m=t==null||(x=t.loaderData)===null||x===void 0?void 0:x[o.id],w=t==null||(M=t.errors)===null||M===void 0?void 0:M[o.id],p=a==null&&(((k=s.clientLoader)===null||k===void 0?void 0:k.hydrate)===!0||!o.hasLoader);f.loader=async({request:R,params:v})=>{try{return await h(async()=>($(s,"No `routeModule` available for critical-route loader"),s.clientLoader?s.clientLoader({request:R,params:v,async serverLoader(){if(b("loader",o,n),p){if(w!==void 0)throw w;return m}let P=await _(R);return await g(P)}}):n?null:_(R)))}finally{p=!1}},f.loader.hydrate=W(o,s,n),f.action=({request:R,params:v})=>h(async()=>{if($(s,"No `routeModule` available for critical-route action"),!s.clientAction){if(n)throw j("clientAction",o.id);return c(R)}return s.clientAction({request:R,params:v,async serverAction(){b("action",o,n);let E=await c(R);return await g(E)}})})}else o.hasClientLoader||(f.loader=({request:m})=>h(()=>n?Promise.resolve(null):_(m))),o.hasClientAction||(f.action=({request:m})=>h(()=>{if(n)throw j("clientAction",o.id);return c(m)})),f.lazy=async()=>{let m=await Ee(o,r),w={...m};if(m.clientLoader){let p=m.clientLoader;w.loader=R=>p({...R,async serverLoader(){b("loader",o,n);let v=await _(R.request);return await g(v)}})}if(m.clientAction){let p=m.clientAction;w.action=R=>p({...R,async serverAction(){b("action",o,n);let v=await c(R.request);return await g(v)}})}return a&&(w.shouldRevalidate=B(o.id,m.shouldRevalidate,a)),{...w.loader?{loader:w.loader}:{},...w.action?{action:w.action}:{},hasErrorBoundary:w.hasErrorBoundary,shouldRevalidate:w.shouldRevalidate,handle:w.handle,Component:w.Component,ErrorBoundary:w.ErrorBoundary}};let S=D(e,r,t,i,n,o.id,u,a);return S.length>0&&(f.children=S),f})}function B(e,r,t){let i=!1;return n=>i?r?r(n):n.defaultShouldRevalidate:(i=!0,t.has(e))}async function Ee(e,r){let t=await ie(e,r);return await I(e,t),{Component:J(t),ErrorBoundary:t.ErrorBoundary,clientAction:t.clientAction,clientLoader:t.clientLoader,handle:t.handle,links:t.links,meta:t.meta,shouldRevalidate:t.shouldRevalidate}}async function T(e,r){let t=await U(e,r.id);if(t instanceof Error)throw t;if(we(t))throw be(t);if(ce(t))throw t;return he(t)&&t.body?await ye(t.body):t}function g(e){if(_e(e))return e.data;if(z(e)){let r=e.headers.get("Content-Type");return r&&/\bapplication\/json\b/.test(r)?e.json():e.text()}return e}function be(e){let r=parseInt(e.headers.get("X-Remix-Status"),10)||302,t=e.headers.get("X-Remix-Redirect"),i={},n=e.headers.get("X-Remix-Revalidate");n&&(i["X-Remix-Revalidate"]=n);let d=e.headers.get("X-Remix-Reload-Document");return d&&(i["X-Remix-Reload-Document"]=d),Z(t,{status:r,headers:i})}function J(e){if(e.default==null)return;if(!(typeof e.default=="object"&&Object.keys(e.default).length===0))return e.default}function W(e,r,t){return t&&e.id!=="root"||r.clientLoader!=null&&(r.clientLoader.hydrate===!0||e.hasLoader!==!0)}let y,A=!1;let L,Le=new Promise(e=>{L=e}).catch(()=>{}),ge=()=>{};function Ce(e){if(!y){let d=window.__remixContext.url,u=window.location.pathname;if(d!==u&&!window.__remixContext.isSpaMode){let s=`Initial URL (${d}) does not match URL at time of hydration (${u}), reloading page...`;return console.error(s),window.location.reload(),l.createElement(l.Fragment,null)}let a=D(window.__remixManifest.routes,window.__remixRouteModules,window.__remixContext.state,window.__remixContext.future,window.__remixContext.isSpaMode),o;if(!window.__remixContext.isSpaMode){o={...window.__remixContext.state,loaderData:{...window.__remixContext.state.loaderData}};let s=q(a,window.location);if(s)for(let _ of s){let c=_.route.id,h=window.__remixRouteModules[c],f=window.__remixManifest.routes[c];h&&W(f,h,window.__remixContext.isSpaMode)&&(h.HydrateFallback||!f.hasLoader)?o.loaderData[c]=void 0:f&&!f.hasLoader&&(o.loaderData[c]=null)}o&&o.errors&&(o.errors=ue(o.errors))}y=ee({routes:a,history:te(),future:{v7_normalizeFormMethod:!0,v7_fetcherPersist:window.__remixContext.future.v3_fetcherPersist,v7_partialHydration:!0,v7_prependBasename:!0,v7_relativeSplatPath:window.__remixContext.future.v3_relativeSplatPath},hydrationData:o,mapRouteProperties:re}),y.state.initialized&&(A=!0,y.initialize()),y.createRoutesForHMR=xe,window.__remixRouter=y,L&&L(y)}let[r,t]=l.useReducer(ge,window.__remixContext.criticalCss);window.__remixClearCriticalCss=t;let[i,n]=l.useState(y.state.location);return l.useLayoutEffect(()=>{A||(A=!0,y.initialize())},[]),l.useLayoutEffect(()=>y.subscribe(d=>{d.location!==i&&n(d.location)}),[i]),l.createElement(ae.Provider,{value:{manifest:window.__remixManifest,routeModules:window.__remixRouteModules,future:window.__remixContext.future,criticalCss:r,isSpaMode:window.__remixContext.isSpaMode}},l.createElement(de,{location:i},l.createElement(le,{router:y,fallbackElement:null,future:{v7_startTransition:!0}})))}var Y,F=se;F.createRoot,Y=F.hydrateRoot;Y(document,oe.jsx(Ce,{}));
//# sourceMappingURL=entry.client-CRE9I3xP.js.map
