import{r as n}from"./react-WWJ_A68P.js";import{i as g,g as O,r as M,j as N,m as _,A,p as w,s as S,c as z,a as $}from"./@remix-run-DhIrJP8L.js";/** * React Router v6.26.1 * * 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 R(){return R=Object.assign?Object.assign.bind():function(e){for(var t=1;t{d.current=!0}),n.useCallback(function(f,s){if(s===void 0&&(s={}),!d.current)return;if(typeof f=="number"){a.go(f);return}let l=M(f,JSON.parse(o),u,s.relative==="path");e==null&&t!=="/"&&(l.pathname=l.pathname==="/"?t:N([t,l.pathname])),(s.replace?a.replace:a.push)(l,s.state,s)},[t,a,o,u,e])}const Q=n.createContext(null);function se(e){let t=n.useContext(p).outlet;return t&&n.createElement(Q.Provider,{value:e},t)}function ue(){let{matches:e}=n.useContext(p),t=e[e.length-1];return t?t.params:{}}function V(e,t){let{relative:r}=t===void 0?{}:t,{future:a}=n.useContext(E),{matches:i}=n.useContext(p),{pathname:u}=B(),o=JSON.stringify(O(i,a.v7_relativeSplatPath));return n.useMemo(()=>M(e,JSON.parse(o),u,r==="path"),[e,o,u,r])}function ce(e,t,r,a){P()||g(!1);let{navigator:i}=n.useContext(E),{matches:u}=n.useContext(p),o=u[u.length-1],d=o?o.params:{};o&&o.pathname;let c=o?o.pathnameBase:"/";o&&o.route;let f=B(),s;s=f;let l=s.pathname||"/",m=l;if(c!=="/"){let v=c.replace(/^\//,"").split("/");m="/"+l.replace(/^\//,"").split("/").slice(v.length).join("/")}let h=_(e,{pathname:m});return H(h&&h.map(v=>Object.assign({},v,{params:Object.assign({},d,v.params),pathname:N([c,i.encodeLocation?i.encodeLocation(v.pathname).pathname:v.pathname]),pathnameBase:v.pathnameBase==="/"?c:N([c,i.encodeLocation?i.encodeLocation(v.pathnameBase).pathname:v.pathnameBase])})),u,r,a)}function W(){let e=re(),t=$(e)?e.status+" "+e.statusText:e instanceof Error?e.message:JSON.stringify(e),r=e instanceof Error?e.stack:null,i={padding:"0.5rem",backgroundColor:"rgba(200,200,200, 0.5)"};return n.createElement(n.Fragment,null,n.createElement("h2",null,"Unexpected Application Error!"),n.createElement("h3",{style:{fontStyle:"italic"}},t),r?n.createElement("pre",{style:i},r):null,null)}const X=n.createElement(W,null);class Y extends n.Component{constructor(t){super(t),this.state={location:t.location,revalidation:t.revalidation,error:t.error}}static getDerivedStateFromError(t){return{error:t}}static getDerivedStateFromProps(t,r){return r.location!==t.location||r.revalidation!=="idle"&&t.revalidation==="idle"?{error:t.error,location:t.location,revalidation:t.revalidation}:{error:t.error!==void 0?t.error:r.error,location:r.location,revalidation:t.revalidation||r.revalidation}}componentDidCatch(t,r){console.error("React Router caught the following error during render",t,r)}render(){return this.state.error!==void 0?n.createElement(p.Provider,{value:this.props.routeContext},n.createElement(L.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function Z(e){let{routeContext:t,match:r,children:a}=e,i=n.useContext(j);return i&&i.static&&i.staticContext&&(r.route.errorElement||r.route.ErrorBoundary)&&(i.staticContext._deepestRenderedBoundaryId=r.route.id),n.createElement(p.Provider,{value:t},a)}function H(e,t,r,a){var i;if(t===void 0&&(t=[]),r===void 0&&(r=null),a===void 0&&(a=null),e==null){var u;if(!r)return null;if(r.errors)e=r.matches;else if((u=a)!=null&&u.v7_partialHydration&&t.length===0&&!r.initialized&&r.matches.length>0)e=r.matches;else return null}let o=e,d=(i=r)==null?void 0:i.errors;if(d!=null){let s=o.findIndex(l=>l.route.id&&(d==null?void 0:d[l.route.id])!==void 0);s>=0||g(!1),o=o.slice(0,Math.min(o.length,s+1))}let c=!1,f=-1;if(r&&a&&a.v7_partialHydration)for(let s=0;s=0?o=o.slice(0,f+1):o=[o[0]];break}}}return o.reduceRight((s,l,m)=>{let h,C=!1,v=null,x=null;r&&(h=d&&l.route.id?d[l.route.id]:void 0,v=l.route.errorElement||X,c&&(f<0&&m===0?(C=!0,x=null):f===m&&(C=!0,x=l.route.hydrateFallbackElement||null)));let F=t.concat(o.slice(0,m+1)),I=()=>{let y;return h?y=v:C?y=x:l.route.Component?y=n.createElement(l.route.Component,null):l.route.element?y=l.route.element:y=s,n.createElement(Z,{match:l,routeContext:{outlet:s,matches:F,isDataRoute:r!=null},children:y})};return r&&(l.route.ErrorBoundary||l.route.errorElement||m===0)?n.createElement(Y,{location:r.location,revalidation:r.revalidation,component:v,error:h,children:I(),routeContext:{outlet:null,matches:F,isDataRoute:!0}}):I()},null)}var J=function(e){return e.UseBlocker="useBlocker",e.UseRevalidator="useRevalidator",e.UseNavigateStable="useNavigate",e}(J||{}),b=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}(b||{});function ee(e){let t=n.useContext(j);return t||g(!1),t}function k(e){let t=n.useContext(q);return t||g(!1),t}function te(e){let t=n.useContext(p);return t||g(!1),t}function T(e){let t=te(),r=t.matches[t.matches.length-1];return r.route.id||g(!1),r.route.id}function de(){return k(b.UseNavigation).navigation}function fe(){let{matches:e,loaderData:t}=k(b.UseMatches);return n.useMemo(()=>e.map(r=>z(r,t)),[e,t])}function re(){var e;let t=n.useContext(L),r=k(b.UseRouteError),a=T(b.UseRouteError);return t!==void 0?t:(e=r.errors)==null?void 0:e[a]}function ne(){let{router:e}=ee(J.UseNavigateStable),t=T(b.UseNavigateStable),r=n.useRef(!1);return D(()=>{r.current=!0}),n.useCallback(function(i,u){u===void 0&&(u={}),r.current&&(typeof i=="number"?e.navigate(i):e.navigate(i,R({fromRouteId:t},u)))},[e,t])}function ve(e){let{to:t,replace:r,state:a,relative:i}=e;P()||g(!1);let{future:u,static:o}=n.useContext(E),{matches:d}=n.useContext(p),{pathname:c}=B(),f=G(),s=M(t,O(d,u.v7_relativeSplatPath),c,i==="path"),l=JSON.stringify(s);return n.useEffect(()=>f(JSON.parse(l),{replace:r,state:a,relative:i}),[f,l,i,r,a]),null}function me(e){let{basename:t="/",children:r=null,location:a,navigationType:i=A.Pop,navigator:u,static:o=!1,future:d}=e;P()&&g(!1);let c=t.replace(/^\/*/,"/"),f=n.useMemo(()=>({basename:c,navigator:u,static:o,future:R({v7_relativeSplatPath:!1},d)}),[c,d,u,o]);typeof a=="string"&&(a=w(a));let{pathname:s="/",search:l="",hash:m="",state:h=null,key:C="default"}=a,v=n.useMemo(()=>{let x=S(s,c);return x==null?null:{location:{pathname:x,search:l,hash:m,state:h,key:C},navigationType:i}},[c,s,l,m,h,C,i]);return v==null?null:n.createElement(E.Provider,{value:f},n.createElement(U.Provider,{children:r,value:v}))}new Promise(()=>{});function he(e){let t={hasErrorBoundary:e.ErrorBoundary!=null||e.errorElement!=null};return e.Component&&Object.assign(t,{element:n.createElement(e.Component),Component:void 0}),e.HydrateFallback&&Object.assign(t,{hydrateFallbackElement:n.createElement(e.HydrateFallback),HydrateFallback:void 0}),e.ErrorBoundary&&Object.assign(t,{errorElement:n.createElement(e.ErrorBoundary),ErrorBoundary:void 0}),t}export{j as D,E as N,me as R,G as a,q as b,ce as c,oe as d,V as e,fe as f,de as g,se as h,ue as i,ve as j,ie as k,he as m,B as u};