import{r as s,a as z}from"./react-WJwbUUix.js";import"./react-dom-DqYt0kR5.js";import{a as M,N as B,u as G,b as V,c as _,d as N,D as X,e as q}from"./react-router-CAeN0q00.js";import{c as H,s as C,d as O,i as W,a as k}from"./remix-run-Cys2RcPP.js";/**
 * React Router DOM v6.23.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 L(){return L=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var n in a)Object.prototype.hasOwnProperty.call(a,n)&&(e[n]=a[n])}return e},L.apply(this,arguments)}function K(e,t){if(e==null)return{};var a={},n=Object.keys(e),r,i;for(i=0;i<n.length;i++)r=n[i],!(t.indexOf(r)>=0)&&(a[r]=e[r]);return a}function J(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function Q(e,t){return e.button===0&&(!t||t==="_self")&&!J(e)}function U(e){return e===void 0&&(e=""),new URLSearchParams(typeof e=="string"||Array.isArray(e)||e instanceof URLSearchParams?e:Object.keys(e).reduce((t,a)=>{let n=e[a];return t.concat(Array.isArray(n)?n.map(r=>[a,r]):[[a,n]])},[]))}function Y(e,t){let a=U(e);return t&&t.forEach((n,r)=>{a.has(r)||t.getAll(r).forEach(i=>{a.append(r,i)})}),a}const Z=["onClick","relative","reloadDocument","replace","state","target","to","preventScrollReset","unstable_viewTransition"],$=["aria-current","caseSensitive","className","end","style","to","unstable_viewTransition","children"],ee="6";try{window.__reactRouterVersion=ee}catch{}const te=s.createContext({isTransitioning:!1}),ae="startTransition",F=z[ae];function me(e){let{basename:t,children:a,future:n,window:r}=e,i=s.useRef();i.current==null&&(i.current=H({window:r,v5Compat:!0}));let l=i.current,[u,f]=s.useState({action:l.action,location:l.location}),{v7_startTransition:o}=n||{},p=s.useCallback(d=>{o&&F?F(()=>f(d)):f(d)},[f,o]);return s.useLayoutEffect(()=>l.listen(p),[l,p]),s.createElement(M,{basename:t,children:a,location:u.location,navigationType:u.action,navigator:l,future:n})}const ne=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",re=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,ie=s.forwardRef(function(t,a){let{onClick:n,relative:r,reloadDocument:i,replace:l,state:u,target:f,to:o,preventScrollReset:p,unstable_viewTransition:d}=t,w=K(t,Z),{basename:P}=s.useContext(B),v,g=!1;if(typeof o=="string"&&re.test(o)&&(v=o,ne))try{let m=new URL(window.location.href),c=o.startsWith("//")?new URL(m.protocol+o):new URL(o),y=C(c.pathname,P);c.origin===m.origin&&y!=null?o=y+c.search+c.hash:g=!0}catch{}let R=G(o,{relative:r}),S=se(o,{replace:l,state:u,target:f,preventScrollReset:p,relative:r,unstable_viewTransition:d});function h(m){n&&n(m),m.defaultPrevented||S(m)}return s.createElement("a",L({},w,{href:v||R,onClick:g||i?n:h,ref:a,target:f}))}),pe=s.forwardRef(function(t,a){let{"aria-current":n="page",caseSensitive:r=!1,className:i="",end:l=!1,style:u,to:f,unstable_viewTransition:o,children:p}=t,d=K(t,$),w=N(f,{relative:d.relative}),P=_(),v=s.useContext(X),{navigator:g,basename:R}=s.useContext(B),S=v!=null&&le(w)&&o===!0,h=g.encodeLocation?g.encodeLocation(w).pathname:w.pathname,m=P.pathname,c=v&&v.navigation&&v.navigation.location?v.navigation.location.pathname:null;r||(m=m.toLowerCase(),c=c?c.toLowerCase():null,h=h.toLowerCase()),c&&R&&(c=C(c,R)||c);const y=h!=="/"&&h.endsWith("/")?h.length-1:h.length;let b=m===h||!l&&m.startsWith(h)&&m.charAt(y)==="/",A=c!=null&&(c===h||!l&&c.startsWith(h)&&c.charAt(h.length)==="/"),T={isActive:b,isPending:A,isTransitioning:S},D=b?n:void 0,x;typeof i=="function"?x=i(T):x=[i,b?"active":null,A?"pending":null,S?"transitioning":null].filter(Boolean).join(" ");let I=typeof u=="function"?u(T):u;return s.createElement(ie,L({},d,{"aria-current":D,className:x,ref:a,style:I,to:f,unstable_viewTransition:o}),typeof p=="function"?p(T):p)});var E;(function(e){e.UseScrollRestoration="useScrollRestoration",e.UseSubmit="useSubmit",e.UseSubmitFetcher="useSubmitFetcher",e.UseFetcher="useFetcher",e.useViewTransitionState="useViewTransitionState"})(E||(E={}));var j;(function(e){e.UseFetcher="useFetcher",e.UseFetchers="useFetchers",e.UseScrollRestoration="useScrollRestoration"})(j||(j={}));function oe(e){let t=s.useContext(q);return t||W(!1),t}function se(e,t){let{target:a,replace:n,state:r,preventScrollReset:i,relative:l,unstable_viewTransition:u}=t===void 0?{}:t,f=V(),o=_(),p=N(e,{relative:l});return s.useCallback(d=>{if(Q(d,a)){d.preventDefault();let w=n!==void 0?n:O(o)===O(p);f(e,{replace:w,state:r,preventScrollReset:i,relative:l,unstable_viewTransition:u})}},[o,f,p,n,r,a,e,i,l,u])}function de(e){let t=s.useRef(U(e)),a=s.useRef(!1),n=_(),r=s.useMemo(()=>Y(n.search,a.current?null:t.current),[n.search]),i=V(),l=s.useCallback((u,f)=>{const o=U(typeof u=="function"?u(r):u);a.current=!0,i("?"+o,f)},[i,r]);return[r,l]}function le(e,t){t===void 0&&(t={});let a=s.useContext(te);a==null&&W(!1);let{basename:n}=oe(E.useViewTransitionState),r=N(e,{relative:t.relative});if(!a.isTransitioning)return!1;let i=C(a.currentLocation.pathname,n)||a.currentLocation.pathname,l=C(a.nextLocation.pathname,n)||a.nextLocation.pathname;return k(r.pathname,l)!=null||k(r.pathname,i)!=null}export{me as B,ie as L,pe as N,de as u};
