import{i as e,t}from"./jsx-runtime-Cx0BB4qO.js";import{l as n,s as r}from"./i18n-Q0H8XEpu.js";import{b as i,d as a,g as o,h as s,m as c,n as l,p as u,r as d,t as f,w as p,x as m}from"./link-CnWt-AWM.js";import{t as h}from"./useSelector-CGiUpIuK.js";import{t as g}from"./useNavigate-D3_xtixf.js";import{i as _}from"./topics-DXkJAC3Q.js";var v=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,this._branch=void 0;let t=this.options,n=!t?.path&&!t?.id;this.parentRoute=this.options.getParentRoute?.(),n?this._path=a:this.parentRoute||u();let r=n?a:t?.path;r&&r!==`/`&&(r=s(r));let i=t?.id||r,l=n?a:c((this.parentRoute.id===`__root__`?``:this.parentRoute.id)+`/`+(i??``));r===`__root__`&&(r=`/`);let d=l===`__root__`?`/`:r===void 0?this.parentRoute.fullPath:c(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=>p({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.`)}},y=class extends v{constructor(e){super(e)}},b=e(n(),1),x=b.use,S=b.useLayoutEffect,C={};function w(e,t){let n=b.useRef();return r=>{let i=e?.select?e.select(r):r;return e?.structuralSharing??t.options.defaultStructuralSharing?n.current=m(n.current,i):i}}function T(e){let t=r(),n=b.useContext(e.from?l:d),i=e.from??n,a=t.stores.getMatchStore(i),o=w(e,t),s=h(a,e=>e?o(e):C);if(s!==C)return s;(e.shouldThrow??!0)&&u()}function E(e){return T({from:e.from,strict:e.strict,structuralSharing:e.structuralSharing,select:t=>e.select?e.select(t.loaderData):t.loaderData})}function D(e){let{select:t,...n}=e;return T({...n,select:e=>t?t(e.loaderDeps):e.loaderDeps})}function O(e){return T({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 k(e){return T({from:e.from,strict:e.strict,shouldThrow:e.shouldThrow,structuralSharing:e.structuralSharing,select:t=>e.select?e.select(t.search):t.search})}function A(e){return T({...e,select:t=>e.select?e.select(t.context):t.context})}var j=t(),M=class extends v{constructor(e){super(e),this.useMatch=e=>T({...e,from:this.id}),this.useRouteContext=e=>A({...e,from:this.id}),this.useSearch=e=>k({...e,from:this.id}),this.useParams=e=>O({...e,from:this.id}),this.useLoaderDeps=e=>D({...e,from:this.id}),this.useLoaderData=e=>E({...e,from:this.id}),this.useNavigate=()=>g({from:this.fullPath}),this.Link=b.forwardRef((e,t)=>(0,j.jsx)(f,{ref:t,from:this.fullPath,...e}))}};function N(e){return new M(e)}function P(){return e=>I(e)}var F=class extends y{constructor(e){super(e),this.useMatch=e=>T({...e,from:this.id}),this.useRouteContext=e=>A({...e,from:this.id}),this.useSearch=e=>k({...e,from:this.id}),this.useParams=e=>O({...e,from:this.id}),this.useLoaderDeps=e=>D({...e,from:this.id}),this.useLoaderData=e=>E({...e,from:this.id}),this.useNavigate=()=>g({from:this.fullPath}),this.Link=b.forwardRef((e,t)=>(0,j.jsx)(f,{ref:t,from:this.fullPath,...e}))}};function I(e){return new F(e)}function L(e){return e=>{let t=N(e);return t.isRoot=!1,t}}function R(e,t){let n,r,a,o=()=>(n||=(a=void 0,e().then(e=>{n=void 0,s.preload=void 0,r=e[t??`default`]}).catch(e=>{n=void 0,a=e})),n),s=function(e){if(a){if(i(a)&&typeof sessionStorage<`u`){let e=`tanstack_router_reload:${a.message}`;if(!sessionStorage.getItem(e))throw sessionStorage.setItem(e,`1`),window.location.reload(),new Promise(()=>{})}throw a}if(!r)if(x)x(o());else throw o();return b.createElement(r,e)};return s.preload=o,s}var z=`modulepreload`,B=function(e){return`/`+e},V={},H=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e=document.getElementsByTagName(`link`),i=document.querySelector(`meta[property=csp-nonce]`),a=i?.nonce||i?.getAttribute(`nonce`);function o(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}function s(e){return import.meta.resolve?import.meta.resolve(e):new URL(e,import.meta.url).href}r=o(t.map(t=>{if(t=B(t,n),t=s(t),t in V)return;V[t]=!0;let r=t.endsWith(`.css`);for(let n=e.length-1;n>=0;n--){let i=e[n];if(i.href===t&&(!r||i.rel===`stylesheet`))return}let i=document.createElement(`link`);if(i.rel=r?`stylesheet`:z,r||(i.as=`script`),i.crossOrigin=``,i.href=t,a&&i.setAttribute(`nonce`,a),document.head.appendChild(i),r)return new Promise((e,n)=>{i.addEventListener(`load`,e),i.addEventListener(`error`,()=>n(Error(`Unable to preload CSS for ${t}`)))})}))}function i(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(let e of t||[])e.status===`rejected`&&i(e.reason);return e().catch(i)})};function U(e){let t={},n=e.topic;typeof n==`string`&&_(n)&&(t.topic=n);let r=Number(e.stage);[1,2,3].includes(r)&&(t.stage=r);let i=Number(e.points);return(i===10||i===20)&&(t.points=i),t}function W(e,t){return(t.topic==null||e.topic===t.topic)&&(t.stage==null||e.stage===t.stage)&&(t.points==null||e.points===t.points)}export{L as a,S as c,R as i,U as n,P as o,H as r,x as s,W as t};