import{$u as e,Qu as t,nd as n}from"./messages-GNZRoNCJ.js";import{t as r}from"./useRouter-DP_QL4bS.js";import{n as i}from"./useStore-DcoP6GEY.js";import{d as a,f as o,s}from"./ClientOnly-CB70y-7P.js";import{a as c,n as l,r as u}from"./redirect-dE0wk0WH.js";import{t as d}from"./link-BzoLXRYo.js";import{n as f,t as p}from"./useSearch-DpIpdTY2.js";import{t as m}from"./useNavigate-ARcBwEET.js";var h=class{get to(){return this._to}get id(){return this._id}get path(){return this._path}get fullPath(){return this._fullPath}constructor(e){if(this.init=e=>{this.originalIndex=e.originalIndex;let t=this.options,n=!t?.path&&!t?.id;this.parentRoute=this.options.getParentRoute?.(),n?this._path=u:this.parentRoute||i();let r=n?u:t?.path;r&&r!==`/`&&(r=a(r));let c=t?.id||r,l=n?u:s([this.parentRoute.id===`__root__`?``:this.parentRoute.id,c]);r===`__root__`&&(r=`/`),l!==`__root__`&&(l=s([`/`,l]));let d=l===`__root__`?`/`:s([this.parentRoute.fullPath,r]);this._path=r,this._id=l,this._fullPath=d,this._to=o(d)},this.addChildren=e=>this._addFileChildren(e),this._addFileChildren=e=>(Array.isArray(e)&&(this.children=e),typeof e==`object`&&e&&(this.children=Object.values(e)),this),this._addFileTypes=()=>this,this.updateLoader=e=>(Object.assign(this.options,e),this),this.update=e=>(Object.assign(this.options,e),this),this.lazy=e=>(this.lazyFn=e,this),this.redirect=e=>l({from:this.fullPath,...e}),this.options=e||{},this.isRoot=!e?.getParentRoute,e?.id&&e?.path)throw Error(`Route cannot have both an 'id' and a 'path' option.`)}},g=class{constructor({id:e}){this.notFound=e=>c({routeId:this.id,...e}),this.redirect=e=>l({from:this.id,...e}),this.id=e}},_=class extends h{constructor(e){super(e)}};function v(e){return f({from:e.from,strict:e.strict,structuralSharing:e.structuralSharing,select:t=>e.select?e.select(t.loaderData):t.loaderData})}function y(e){let{select:t,...n}=e;return f({...n,select:e=>t?t(e.loaderDeps):e.loaderDeps})}function b(e){return f({from:e.from,shouldThrow:e.shouldThrow,structuralSharing:e.structuralSharing,strict:e.strict,select:t=>{let n=e.strict===!1?t.params:t._strictParams;return e.select?e.select(n):n}})}function x(e){return f({...e,select:t=>e.select?e.select(t.context):t.context})}var S=n(e(),1),C=t();function w(e){return new T({id:e})}var T=class extends g{constructor({id:e}){super({id:e}),this.useMatch=e=>f({select:e?.select,from:this.id,structuralSharing:e?.structuralSharing}),this.useRouteContext=e=>x({...e,from:this.id}),this.useSearch=e=>p({select:e?.select,structuralSharing:e?.structuralSharing,from:this.id}),this.useParams=e=>b({select:e?.select,structuralSharing:e?.structuralSharing,from:this.id}),this.useLoaderDeps=e=>y({...e,from:this.id,strict:!1}),this.useLoaderData=e=>v({...e,from:this.id,strict:!1}),this.useNavigate=()=>m({from:r().routesById[this.id].fullPath}),this.notFound=e=>c({routeId:this.id,...e}),this.Link=S.forwardRef((e,t)=>{let n=r().routesById[this.id].fullPath;return(0,C.jsx)(d,{ref:t,from:n,...e})})}},E=class extends h{constructor(e){super(e),this.useMatch=e=>f({select:e?.select,from:this.id,structuralSharing:e?.structuralSharing}),this.useRouteContext=e=>x({...e,from:this.id}),this.useSearch=e=>p({select:e?.select,structuralSharing:e?.structuralSharing,from:this.id}),this.useParams=e=>b({select:e?.select,structuralSharing:e?.structuralSharing,from:this.id}),this.useLoaderDeps=e=>y({...e,from:this.id}),this.useLoaderData=e=>v({...e,from:this.id}),this.useNavigate=()=>m({from:this.fullPath}),this.Link=S.forwardRef((e,t)=>(0,C.jsx)(d,{ref:t,from:this.fullPath,...e}))}};function D(e){return new E(e)}function O(){return e=>A(e)}var k=class extends _{constructor(e){super(e),this.useMatch=e=>f({select:e?.select,from:this.id,structuralSharing:e?.structuralSharing}),this.useRouteContext=e=>x({...e,from:this.id}),this.useSearch=e=>p({select:e?.select,structuralSharing:e?.structuralSharing,from:this.id}),this.useParams=e=>b({select:e?.select,structuralSharing:e?.structuralSharing,from:this.id}),this.useLoaderDeps=e=>y({...e,from:this.id}),this.useLoaderData=e=>v({...e,from:this.id}),this.useNavigate=()=>m({from:this.fullPath}),this.Link=S.forwardRef((e,t)=>(0,C.jsx)(d,{ref:t,from:this.fullPath,...e}))}};function A(e){return new k(e)}export{D as n,w as r,O as t};