import{r as i,R as ie,a as oe}from"./index-Byq8LWV4.js";import{N as k,u as se,R as le,i as V,a as K,b as O,j as ue,c as H,s as P,D as ee,d as G,e as ce,f as fe,g as de,h as te,k as me,l as he,m as X}from"./index-9Ru_LlP9.js";/**
 * React Router DOM v6.23.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 _(){return _=Object.assign?Object.assign.bind():function(e){for(var a=1;a<arguments.length;a++){var t=arguments[a];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])}return e},_.apply(this,arguments)}function J(e,a){if(e==null)return{};var t={},r=Object.keys(e),n,o;for(o=0;o<r.length;o++)n=r[o],!(a.indexOf(n)>=0)&&(t[n]=e[n]);return t}const M="get",j="application/x-www-form-urlencoded";function W(e){return e!=null&&typeof e.tagName=="string"}function pe(e){return W(e)&&e.tagName.toLowerCase()==="button"}function ve(e){return W(e)&&e.tagName.toLowerCase()==="form"}function we(e){return W(e)&&e.tagName.toLowerCase()==="input"}function Se(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function ye(e,a){return e.button===0&&(!a||a==="_self")&&!Se(e)}function Y(e){return e===void 0&&(e=""),new URLSearchParams(typeof e=="string"||Array.isArray(e)||e instanceof URLSearchParams?e:Object.keys(e).reduce((a,t)=>{let r=e[t];return a.concat(Array.isArray(r)?r.map(n=>[t,n]):[[t,r]])},[]))}function ge(e,a){let t=Y(e);return a&&a.forEach((r,n)=>{t.has(n)||a.getAll(n).forEach(o=>{t.append(n,o)})}),t}let D=null;function be(){if(D===null)try{new FormData(document.createElement("form"),0),D=!1}catch{D=!0}return D}const Re=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function B(e){return e!=null&&!Re.has(e)?null:e}function Te(e,a){let t,r,n,o,s;if(ve(e)){let l=e.getAttribute("action");r=l?P(l,a):null,t=e.getAttribute("method")||M,n=B(e.getAttribute("enctype"))||j,o=new FormData(e)}else if(pe(e)||we(e)&&(e.type==="submit"||e.type==="image")){let l=e.form;if(l==null)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let f=e.getAttribute("formaction")||l.getAttribute("action");if(r=f?P(f,a):null,t=e.getAttribute("formmethod")||l.getAttribute("method")||M,n=B(e.getAttribute("formenctype"))||B(l.getAttribute("enctype"))||j,o=new FormData(l,e),!be()){let{name:c,type:u,value:w}=e;if(u==="image"){let m=c?c+".":"";o.append(m+"x","0"),o.append(m+"y","0")}else c&&o.append(c,w)}}else{if(W(e))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');t=M,r=null,n=j,s=e}return o&&n==="text/plain"&&(s=o,o=void 0),{action:r,method:t.toLowerCase(),encType:n,formData:o,body:s}}const Le=["onClick","relative","reloadDocument","replace","state","target","to","preventScrollReset","unstable_viewTransition"],Ee=["aria-current","caseSensitive","className","end","style","to","unstable_viewTransition","children"],xe=["fetcherKey","navigate","reloadDocument","replace","state","method","action","onSubmit","relative","preventScrollReset","unstable_viewTransition"],Ce="6";try{window.__reactRouterVersion=Ce}catch{}const ne=i.createContext({isTransitioning:!1}),Pe=i.createContext(new Map),_e="startTransition",Q=ie[_e],Ae="flushSync",Z=oe[Ae];function Fe(e){Q?Q(e):e()}function U(e){Z?Z(e):e()}class Ue{constructor(){this.status="pending",this.promise=new Promise((a,t)=>{this.resolve=r=>{this.status==="pending"&&(this.status="resolved",a(r))},this.reject=r=>{this.status==="pending"&&(this.status="rejected",t(r))}})}}function Je(e){let{fallbackElement:a,router:t,future:r}=e,[n,o]=i.useState(t.state),[s,l]=i.useState(),[f,c]=i.useState({isTransitioning:!1}),[u,w]=i.useState(),[m,y]=i.useState(),[S,T]=i.useState(),b=i.useRef(new Map),{v7_startTransition:L}=r||{},d=i.useCallback(v=>{L?Fe(v):v()},[L]),p=i.useCallback((v,R)=>{let{deletedFetchers:g,unstable_flushSync:A,unstable_viewTransitionOpts:E}=R;g.forEach(C=>b.current.delete(C)),v.fetchers.forEach((C,re)=>{C.data!==void 0&&b.current.set(re,C.data)});let ae=t.window==null||t.window.document==null||typeof t.window.document.startViewTransition!="function";if(!E||ae){A?U(()=>o(v)):d(()=>o(v));return}if(A){U(()=>{m&&(u&&u.resolve(),m.skipTransition()),c({isTransitioning:!0,flushSync:!0,currentLocation:E.currentLocation,nextLocation:E.nextLocation})});let C=t.window.document.startViewTransition(()=>{U(()=>o(v))});C.finished.finally(()=>{U(()=>{w(void 0),y(void 0),l(void 0),c({isTransitioning:!1})})}),U(()=>y(C));return}m?(u&&u.resolve(),m.skipTransition(),T({state:v,currentLocation:E.currentLocation,nextLocation:E.nextLocation})):(l(v),c({isTransitioning:!0,flushSync:!1,currentLocation:E.currentLocation,nextLocation:E.nextLocation}))},[t.window,m,u,b,d]);i.useLayoutEffect(()=>t.subscribe(p),[t,p]),i.useEffect(()=>{f.isTransitioning&&!f.flushSync&&w(new Ue)},[f]),i.useEffect(()=>{if(u&&s&&t.window){let v=s,R=u.promise,g=t.window.document.startViewTransition(async()=>{d(()=>o(v)),await R});g.finished.finally(()=>{w(void 0),y(void 0),l(void 0),c({isTransitioning:!1})}),y(g)}},[d,s,u,t.window]),i.useEffect(()=>{u&&s&&n.location.key===s.location.key&&u.resolve()},[u,m,n.location,s]),i.useEffect(()=>{!f.isTransitioning&&S&&(l(S.state),c({isTransitioning:!0,flushSync:!1,currentLocation:S.currentLocation,nextLocation:S.nextLocation}),T(void 0))},[f.isTransitioning,S]),i.useEffect(()=>{},[]);let h=i.useMemo(()=>({createHref:t.createHref,encodeLocation:t.encodeLocation,go:v=>t.navigate(v),push:(v,R,g)=>t.navigate(v,{state:R,preventScrollReset:g==null?void 0:g.preventScrollReset}),replace:(v,R,g)=>t.navigate(v,{replace:!0,state:R,preventScrollReset:g==null?void 0:g.preventScrollReset})}),[t]),x=t.basename||"/",F=i.useMemo(()=>({router:t,navigator:h,static:!1,basename:x}),[t,h,x]);return i.createElement(i.Fragment,null,i.createElement(ee.Provider,{value:F},i.createElement(G.Provider,{value:n},i.createElement(Pe.Provider,{value:b.current},i.createElement(ne.Provider,{value:f},i.createElement(ce,{basename:x,location:n.location,navigationType:n.historyAction,navigator:h,future:{v7_relativeSplatPath:t.future.v7_relativeSplatPath}},n.initialized||t.future.v7_partialHydration?i.createElement(Ne,{routes:t.routes,future:t.future,state:n}):a))))),null)}function Ne(e){let{routes:a,future:t,state:r}=e;return fe(a,void 0,r,t)}const ke=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",Oe=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,De=i.forwardRef(function(a,t){let{onClick:r,relative:n,reloadDocument:o,replace:s,state:l,target:f,to:c,preventScrollReset:u,unstable_viewTransition:w}=a,m=J(a,Le),{basename:y}=i.useContext(k),S,T=!1;if(typeof c=="string"&&Oe.test(c)&&(S=c,ke))try{let p=new URL(window.location.href),h=c.startsWith("//")?new URL(p.protocol+c):new URL(c),x=P(h.pathname,y);h.origin===p.origin&&x!=null?c=x+h.search+h.hash:T=!0}catch{}let b=de(c,{relative:n}),L=Me(c,{replace:s,state:l,target:f,preventScrollReset:u,relative:n,unstable_viewTransition:w});function d(p){r&&r(p),p.defaultPrevented||L(p)}return i.createElement("a",_({},m,{href:S||b,onClick:T||o?r:d,ref:t,target:f}))}),qe=i.forwardRef(function(a,t){let{"aria-current":r="page",caseSensitive:n=!1,className:o="",end:s=!1,style:l,to:f,unstable_viewTransition:c,children:u}=a,w=J(a,Ee),m=K(f,{relative:w.relative}),y=O(),S=i.useContext(G),{navigator:T,basename:b}=i.useContext(k),L=S!=null&&Ye(m)&&c===!0,d=T.encodeLocation?T.encodeLocation(m).pathname:m.pathname,p=y.pathname,h=S&&S.navigation&&S.navigation.location?S.navigation.location.pathname:null;n||(p=p.toLowerCase(),h=h?h.toLowerCase():null,d=d.toLowerCase()),h&&b&&(h=P(h,b)||h);const x=d!=="/"&&d.endsWith("/")?d.length-1:d.length;let F=p===d||!s&&p.startsWith(d)&&p.charAt(x)==="/",v=h!=null&&(h===d||!s&&h.startsWith(d)&&h.charAt(d.length)==="/"),R={isActive:F,isPending:v,isTransitioning:L},g=F?r:void 0,A;typeof o=="function"?A=o(R):A=[o,F?"active":null,v?"pending":null,L?"transitioning":null].filter(Boolean).join(" ");let E=typeof l=="function"?l(R):l;return i.createElement(De,_({},w,{"aria-current":g,className:A,ref:t,style:E,to:f,unstable_viewTransition:c}),typeof u=="function"?u(R):u)}),Xe=i.forwardRef((e,a)=>{let{fetcherKey:t,navigate:r,reloadDocument:n,replace:o,state:s,method:l=M,action:f,onSubmit:c,relative:u,preventScrollReset:w,unstable_viewTransition:m}=e,y=J(e,xe),S=je(),T=Be(f,{relative:u}),b=l.toLowerCase()==="get"?"get":"post",L=d=>{if(c&&c(d),d.defaultPrevented)return;d.preventDefault();let p=d.nativeEvent.submitter,h=(p==null?void 0:p.getAttribute("formmethod"))||l;S(p||d.currentTarget,{fetcherKey:t,method:h,navigate:r,replace:o,state:s,relative:u,preventScrollReset:w,unstable_viewTransition:m})};return i.createElement("form",_({ref:a,method:b,action:T,onSubmit:n?c:L},y))});var N;(function(e){e.UseScrollRestoration="useScrollRestoration",e.UseSubmit="useSubmit",e.UseSubmitFetcher="useSubmitFetcher",e.UseFetcher="useFetcher",e.useViewTransitionState="useViewTransitionState"})(N||(N={}));var z;(function(e){e.UseFetcher="useFetcher",e.UseFetchers="useFetchers",e.UseScrollRestoration="useScrollRestoration"})(z||(z={}));function q(e){let a=i.useContext(ee);return a||V(!1),a}function Ie(e){let a=i.useContext(G);return a||V(!1),a}function Me(e,a){let{target:t,replace:r,state:n,preventScrollReset:o,relative:s,unstable_viewTransition:l}=a===void 0?{}:a,f=te(),c=O(),u=K(e,{relative:s});return i.useCallback(w=>{if(ye(w,t)){w.preventDefault();let m=r!==void 0?r:H(c)===H(u);f(e,{replace:m,state:n,preventScrollReset:o,relative:s,unstable_viewTransition:l})}},[c,f,u,r,n,t,e,o,s,l])}function Qe(e){let a=i.useRef(Y(e)),t=i.useRef(!1),r=O(),n=i.useMemo(()=>ge(r.search,t.current?null:a.current),[r.search]),o=te(),s=i.useCallback((l,f)=>{const c=Y(typeof l=="function"?l(n):l);t.current=!0,o("?"+c,f)},[o,n]);return[n,s]}function Ve(){if(typeof document>"u")throw new Error("You are calling submit during the server render. Try calling submit within a `useEffect` or callback instead.")}let Ke=0,We=()=>"__"+String(++Ke)+"__";function je(){let{router:e}=q(N.UseSubmit),{basename:a}=i.useContext(k),t=se();return i.useCallback(function(r,n){n===void 0&&(n={}),Ve();let{action:o,method:s,encType:l,formData:f,body:c}=Te(r,a);if(n.navigate===!1){let u=n.fetcherKey||We();e.fetch(u,t,n.action||o,{preventScrollReset:n.preventScrollReset,formData:f,body:c,formMethod:n.method||s,formEncType:n.encType||l,unstable_flushSync:n.unstable_flushSync})}else e.navigate(n.action||o,{preventScrollReset:n.preventScrollReset,formData:f,body:c,formMethod:n.method||s,formEncType:n.encType||l,replace:n.replace,state:n.state,fromRouteId:t,unstable_flushSync:n.unstable_flushSync,unstable_viewTransition:n.unstable_viewTransition})},[e,a,t])}function Be(e,a){let{relative:t}=a===void 0?{}:a,{basename:r}=i.useContext(k),n=i.useContext(le);n||V(!1);let[o]=n.matches.slice(-1),s=_({},K(e||".",{relative:t})),l=O();if(e==null){s.search=l.search;let f=new URLSearchParams(s.search);f.has("index")&&f.get("index")===""&&(f.delete("index"),s.search=f.toString()?"?"+f.toString():"")}return(!e||e===".")&&o.route.index&&(s.search=s.search?s.search.replace(/^\?/,"?index&"):"?index"),r!=="/"&&(s.pathname=s.pathname==="/"?r:ue([r,s.pathname])),H(s)}const $="react-router-scroll-positions";let I={};function Ze(e){let{getKey:a,storageKey:t}=e===void 0?{}:e,{router:r}=q(N.UseScrollRestoration),{restoreScrollPosition:n,preventScrollReset:o}=Ie(z.UseScrollRestoration),{basename:s}=i.useContext(k),l=O(),f=me(),c=he();i.useEffect(()=>(window.history.scrollRestoration="manual",()=>{window.history.scrollRestoration="auto"}),[]),He(i.useCallback(()=>{if(c.state==="idle"){let u=(a?a(l,f):null)||l.key;I[u]=window.scrollY}try{sessionStorage.setItem(t||$,JSON.stringify(I))}catch{}window.history.scrollRestoration="auto"},[t,a,c.state,l,f])),typeof document<"u"&&(i.useLayoutEffect(()=>{try{let u=sessionStorage.getItem(t||$);u&&(I=JSON.parse(u))}catch{}},[t]),i.useLayoutEffect(()=>{let u=a&&s!=="/"?(m,y)=>a(_({},m,{pathname:P(m.pathname,s)||m.pathname}),y):a,w=r==null?void 0:r.enableScrollRestoration(I,()=>window.scrollY,u);return()=>w&&w()},[r,s,a]),i.useLayoutEffect(()=>{if(n!==!1){if(typeof n=="number"){window.scrollTo(0,n);return}if(l.hash){let u=document.getElementById(decodeURIComponent(l.hash.slice(1)));if(u){u.scrollIntoView();return}}o!==!0&&window.scrollTo(0,0)}},[l,n,o]))}function He(e,a){let{capture:t}={};i.useEffect(()=>{let r=t!=null?{capture:t}:void 0;return window.addEventListener("pagehide",e,r),()=>{window.removeEventListener("pagehide",e,r)}},[e,t])}function Ye(e,a){a===void 0&&(a={});let t=i.useContext(ne);t==null&&V(!1);let{basename:r}=q(N.useViewTransitionState),n=K(e,{relative:a.relative});if(!t.isTransitioning)return!1;let o=P(t.currentLocation.pathname,r)||t.currentLocation.pathname,s=P(t.nextLocation.pathname,r)||t.nextLocation.pathname;return X(n.pathname,s)!=null||X(n.pathname,o)!=null}export{Xe as F,De as L,qe as N,Je as R,je as a,Ze as b,Qe as u};
