@ottocode/web-ui 0.1.201 → 0.1.203

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- import{r as b,j as _,_ as yn,b as vn,R as Mt,a as Os,c as Pn}from"./react-C7bPzU82.js";var vt=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(t){return this.listeners.add(t),this.onSubscribe(),()=>{this.listeners.delete(t),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},Sn={setTimeout:(t,e)=>setTimeout(t,e),clearTimeout:t=>clearTimeout(t),setInterval:(t,e)=>setInterval(t,e),clearInterval:t=>clearInterval(t)},wn=class{#t=Sn;#e=!1;setTimeoutProvider(t){this.#t=t}setTimeout(t,e){return this.#t.setTimeout(t,e)}clearTimeout(t){this.#t.clearTimeout(t)}setInterval(t,e){return this.#t.setInterval(t,e)}clearInterval(t){this.#t.clearInterval(t)}},nt=new wn;function Rn(t){setTimeout(t,0)}var ct=typeof window>"u"||"Deno"in globalThis;function A(){}function bn(t,e){return typeof t=="function"?t(e):t}function me(t){return typeof t=="number"&&t>=0&&t!==1/0}function Es(t,e){return Math.max(t+(e||0)-Date.now(),0)}function tt(t,e){return typeof t=="function"?t(e):t}function B(t,e){return typeof t=="function"?t(e):t}function Ye(t,e){const{type:s="all",exact:n,fetchStatus:r,predicate:i,queryKey:a,stale:o}=t;if(a){if(n){if(e.queryHash!==xe(a,e.options))return!1}else if(!Ot(e.queryKey,a))return!1}if(s!=="all"){const c=e.isActive();if(s==="active"&&!c||s==="inactive"&&c)return!1}return!(typeof o=="boolean"&&e.isStale()!==o||r&&r!==e.state.fetchStatus||i&&!i(e))}function Xe(t,e){const{exact:s,status:n,predicate:r,mutationKey:i}=t;if(i){if(!e.options.mutationKey)return!1;if(s){if(ut(e.options.mutationKey)!==ut(i))return!1}else if(!Ot(e.options.mutationKey,i))return!1}return!(n&&e.state.status!==n||r&&!r(e))}function xe(t,e){return(e?.queryKeyHashFn||ut)(t)}function ut(t){return JSON.stringify(t,(e,s)=>ge(s)?Object.keys(s).sort().reduce((n,r)=>(n[r]=s[r],n),{}):s)}function Ot(t,e){return t===e?!0:typeof t!=typeof e?!1:t&&e&&typeof t=="object"&&typeof e=="object"?Object.keys(e).every(s=>Ot(t[s],e[s])):!1}var xn=Object.prototype.hasOwnProperty;function Is(t,e,s=0){if(t===e)return t;if(s>500)return e;const n=Ze(t)&&Ze(e);if(!n&&!(ge(t)&&ge(e)))return e;const i=(n?t:Object.keys(t)).length,a=n?e:Object.keys(e),o=a.length,c=n?new Array(o):{};let u=0;for(let l=0;l<o;l++){const d=n?l:a[l],h=t[d],f=e[d];if(h===f){c[d]=h,(n?l<i:xn.call(t,d))&&u++;continue}if(h===null||f===null||typeof h!="object"||typeof f!="object"){c[d]=f;continue}const p=Is(h,f,s+1);c[d]=p,p===h&&u++}return i===o&&u===i?t:c}function Qt(t,e){if(!e||Object.keys(t).length!==Object.keys(e).length)return!1;for(const s in t)if(t[s]!==e[s])return!1;return!0}function Ze(t){return Array.isArray(t)&&t.length===Object.keys(t).length}function ge(t){if(!ts(t))return!1;const e=t.constructor;if(e===void 0)return!0;const s=e.prototype;return!(!ts(s)||!s.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(t)!==Object.prototype)}function ts(t){return Object.prototype.toString.call(t)==="[object Object]"}function _n(t){return new Promise(e=>{nt.setTimeout(e,t)})}function ye(t,e,s){return typeof s.structuralSharing=="function"?s.structuralSharing(t,e):s.structuralSharing!==!1?Is(t,e):e}function Cn(t,e,s=0){const n=[...t,e];return s&&n.length>s?n.slice(1):n}function Ln(t,e,s=0){const n=[e,...t];return s&&n.length>s?n.slice(0,-1):n}var _e=Symbol();function ks(t,e){return!t.queryFn&&e?.initialPromise?()=>e.initialPromise:!t.queryFn||t.queryFn===_e?()=>Promise.reject(new Error(`Missing queryFn: '${t.queryHash}'`)):t.queryFn}function Ce(t,e){return typeof t=="function"?t(...e):!!t}function Mn(t,e,s){let n=!1,r;return Object.defineProperty(t,"signal",{enumerable:!0,get:()=>(r??=e(),n||(n=!0,r.aborted?s():r.addEventListener("abort",s,{once:!0})),r)}),t}var On=class extends vt{#t;#e;#s;constructor(){super(),this.#s=t=>{if(!ct&&window.addEventListener){const e=()=>t();return window.addEventListener("visibilitychange",e,!1),()=>{window.removeEventListener("visibilitychange",e)}}}}onSubscribe(){this.#e||this.setEventListener(this.#s)}onUnsubscribe(){this.hasListeners()||(this.#e?.(),this.#e=void 0)}setEventListener(t){this.#s=t,this.#e?.(),this.#e=t(e=>{typeof e=="boolean"?this.setFocused(e):this.onFocus()})}setFocused(t){this.#t!==t&&(this.#t=t,this.onFocus())}onFocus(){const t=this.isFocused();this.listeners.forEach(e=>{e(t)})}isFocused(){return typeof this.#t=="boolean"?this.#t:globalThis.document?.visibilityState!=="hidden"}},Le=new On;function ve(){let t,e;const s=new Promise((r,i)=>{t=r,e=i});s.status="pending",s.catch(()=>{});function n(r){Object.assign(s,r),delete s.resolve,delete s.reject}return s.resolve=r=>{n({status:"fulfilled",value:r}),t(r)},s.reject=r=>{n({status:"rejected",reason:r}),e(r)},s}var En=Rn;function In(){let t=[],e=0,s=o=>{o()},n=o=>{o()},r=En;const i=o=>{e?t.push(o):r(()=>{s(o)})},a=()=>{const o=t;t=[],o.length&&r(()=>{n(()=>{o.forEach(c=>{s(c)})})})};return{batch:o=>{let c;e++;try{c=o()}finally{e--,e||a()}return c},batchCalls:o=>(...c)=>{i(()=>{o(...c)})},schedule:i,setNotifyFunction:o=>{s=o},setBatchNotifyFunction:o=>{n=o},setScheduler:o=>{r=o}}}var F=In(),kn=class extends vt{#t=!0;#e;#s;constructor(){super(),this.#s=t=>{if(!ct&&window.addEventListener){const e=()=>t(!0),s=()=>t(!1);return window.addEventListener("online",e,!1),window.addEventListener("offline",s,!1),()=>{window.removeEventListener("online",e),window.removeEventListener("offline",s)}}}}onSubscribe(){this.#e||this.setEventListener(this.#s)}onUnsubscribe(){this.hasListeners()||(this.#e?.(),this.#e=void 0)}setEventListener(t){this.#s=t,this.#e?.(),this.#e=t(this.setOnline.bind(this))}setOnline(t){this.#t!==t&&(this.#t=t,this.listeners.forEach(s=>{s(t)}))}isOnline(){return this.#t}},Kt=new kn;function Tn(t){return Math.min(1e3*2**t,3e4)}function Ts(t){return(t??"online")==="online"?Kt.isOnline():!0}var Pe=class extends Error{constructor(t){super("CancelledError"),this.revert=t?.revert,this.silent=t?.silent}};function Fs(t){let e=!1,s=0,n;const r=ve(),i=()=>r.status!=="pending",a=m=>{if(!i()){const g=new Pe(m);h(g),t.onCancel?.(g)}},o=()=>{e=!0},c=()=>{e=!1},u=()=>Le.isFocused()&&(t.networkMode==="always"||Kt.isOnline())&&t.canRun(),l=()=>Ts(t.networkMode)&&t.canRun(),d=m=>{i()||(n?.(),r.resolve(m))},h=m=>{i()||(n?.(),r.reject(m))},f=()=>new Promise(m=>{n=g=>{(i()||u())&&m(g)},t.onPause?.()}).then(()=>{n=void 0,i()||t.onContinue?.()}),p=()=>{if(i())return;let m;const g=s===0?t.initialPromise:void 0;try{m=g??t.fn()}catch(P){m=Promise.reject(P)}Promise.resolve(m).then(d).catch(P=>{if(i())return;const S=t.retry??(ct?0:3),w=t.retryDelay??Tn,v=typeof w=="function"?w(s,P):w,C=S===!0||typeof S=="number"&&s<S||typeof S=="function"&&S(s,P);if(e||!C){h(P);return}s++,t.onFail?.(s,P),_n(v).then(()=>u()?void 0:f()).then(()=>{e?h(P):p()})})};return{promise:r,status:()=>r.status,cancel:a,continue:()=>(n?.(),r),cancelRetry:o,continueRetry:c,canStart:l,start:()=>(l()?p():f().then(p),r)}}var As=class{#t;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),me(this.gcTime)&&(this.#t=nt.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(t){this.gcTime=Math.max(this.gcTime||0,t??(ct?1/0:300*1e3))}clearGcTimeout(){this.#t&&(nt.clearTimeout(this.#t),this.#t=void 0)}},Fn=class extends As{#t;#e;#s;#r;#n;#o;#a;constructor(t){super(),this.#a=!1,this.#o=t.defaultOptions,this.setOptions(t.options),this.observers=[],this.#r=t.client,this.#s=this.#r.getQueryCache(),this.queryKey=t.queryKey,this.queryHash=t.queryHash,this.#t=ss(this.options),this.state=t.state??this.#t,this.scheduleGc()}get meta(){return this.options.meta}get promise(){return this.#n?.promise}setOptions(t){if(this.options={...this.#o,...t},this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const e=ss(this.options);e.data!==void 0&&(this.setState(es(e.data,e.dataUpdatedAt)),this.#t=e)}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&this.#s.remove(this)}setData(t,e){const s=ye(this.state.data,t,this.options);return this.#i({data:s,type:"success",dataUpdatedAt:e?.updatedAt,manual:e?.manual}),s}setState(t,e){this.#i({type:"setState",state:t,setStateOptions:e})}cancel(t){const e=this.#n?.promise;return this.#n?.cancel(t),e?e.then(A).catch(A):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(this.#t)}isActive(){return this.observers.some(t=>B(t.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===_e||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStatic(){return this.getObserversCount()>0?this.observers.some(t=>tt(t.options.staleTime,this)==="static"):!1}isStale(){return this.getObserversCount()>0?this.observers.some(t=>t.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(t=0){return this.state.data===void 0?!0:t==="static"?!1:this.state.isInvalidated?!0:!Es(this.state.dataUpdatedAt,t)}onFocus(){this.observers.find(e=>e.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:!1}),this.#n?.continue()}onOnline(){this.observers.find(e=>e.shouldFetchOnReconnect())?.refetch({cancelRefetch:!1}),this.#n?.continue()}addObserver(t){this.observers.includes(t)||(this.observers.push(t),this.clearGcTimeout(),this.#s.notify({type:"observerAdded",query:this,observer:t}))}removeObserver(t){this.observers.includes(t)&&(this.observers=this.observers.filter(e=>e!==t),this.observers.length||(this.#n&&(this.#a?this.#n.cancel({revert:!0}):this.#n.cancelRetry()),this.scheduleGc()),this.#s.notify({type:"observerRemoved",query:this,observer:t}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||this.#i({type:"invalidate"})}async fetch(t,e){if(this.state.fetchStatus!=="idle"&&this.#n?.status()!=="rejected"){if(this.state.data!==void 0&&e?.cancelRefetch)this.cancel({silent:!0});else if(this.#n)return this.#n.continueRetry(),this.#n.promise}if(t&&this.setOptions(t),!this.options.queryFn){const o=this.observers.find(c=>c.options.queryFn);o&&this.setOptions(o.options)}const s=new AbortController,n=o=>{Object.defineProperty(o,"signal",{enumerable:!0,get:()=>(this.#a=!0,s.signal)})},r=()=>{const o=ks(this.options,e),u=(()=>{const l={client:this.#r,queryKey:this.queryKey,meta:this.meta};return n(l),l})();return this.#a=!1,this.options.persister?this.options.persister(o,u,this):o(u)},a=(()=>{const o={fetchOptions:e,options:this.options,queryKey:this.queryKey,client:this.#r,state:this.state,fetchFn:r};return n(o),o})();this.options.behavior?.onFetch(a,this),this.#e=this.state,(this.state.fetchStatus==="idle"||this.state.fetchMeta!==a.fetchOptions?.meta)&&this.#i({type:"fetch",meta:a.fetchOptions?.meta}),this.#n=Fs({initialPromise:e?.initialPromise,fn:a.fetchFn,onCancel:o=>{o instanceof Pe&&o.revert&&this.setState({...this.#e,fetchStatus:"idle"}),s.abort()},onFail:(o,c)=>{this.#i({type:"failed",failureCount:o,error:c})},onPause:()=>{this.#i({type:"pause"})},onContinue:()=>{this.#i({type:"continue"})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>!0});try{const o=await this.#n.start();if(o===void 0)throw new Error(`${this.queryHash} data is undefined`);return this.setData(o),this.#s.config.onSuccess?.(o,this),this.#s.config.onSettled?.(o,this.state.error,this),o}catch(o){if(o instanceof Pe){if(o.silent)return this.#n.promise;if(o.revert){if(this.state.data===void 0)throw o;return this.state.data}}throw this.#i({type:"error",error:o}),this.#s.config.onError?.(o,this),this.#s.config.onSettled?.(this.state.data,o,this),o}finally{this.scheduleGc()}}#i(t){const e=s=>{switch(t.type){case"failed":return{...s,fetchFailureCount:t.failureCount,fetchFailureReason:t.error};case"pause":return{...s,fetchStatus:"paused"};case"continue":return{...s,fetchStatus:"fetching"};case"fetch":return{...s,...Ds(s.data,this.options),fetchMeta:t.meta??null};case"success":const n={...s,...es(t.data,t.dataUpdatedAt),dataUpdateCount:s.dataUpdateCount+1,...!t.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return this.#e=t.manual?n:void 0,n;case"error":const r=t.error;return{...s,error:r,errorUpdateCount:s.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:s.fetchFailureCount+1,fetchFailureReason:r,fetchStatus:"idle",status:"error",isInvalidated:!0};case"invalidate":return{...s,isInvalidated:!0};case"setState":return{...s,...t.state}}};this.state=e(this.state),F.batch(()=>{this.observers.forEach(s=>{s.onQueryUpdate()}),this.#s.notify({query:this,type:"updated",action:t})})}};function Ds(t,e){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:Ts(e.networkMode)?"fetching":"paused",...t===void 0&&{error:null,status:"pending"}}}function es(t,e){return{data:t,dataUpdatedAt:e??Date.now(),error:null,isInvalidated:!1,status:"success"}}function ss(t){const e=typeof t.initialData=="function"?t.initialData():t.initialData,s=e!==void 0,n=s?typeof t.initialDataUpdatedAt=="function"?t.initialDataUpdatedAt():t.initialDataUpdatedAt:0;return{data:e,dataUpdateCount:0,dataUpdatedAt:s?n??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:s?"success":"pending",fetchStatus:"idle"}}var js=class extends vt{constructor(t,e){super(),this.options=e,this.#t=t,this.#i=null,this.#a=ve(),this.bindMethods(),this.setOptions(e)}#t;#e=void 0;#s=void 0;#r=void 0;#n;#o;#a;#i;#m;#d;#f;#u;#l;#c;#p=new Set;bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(this.#e.addObserver(this),ns(this.#e,this.options)?this.#h():this.updateResult(),this.#P())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return Se(this.#e,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return Se(this.#e,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#S(),this.#w(),this.#e.removeObserver(this)}setOptions(t){const e=this.options,s=this.#e;if(this.options=this.#t.defaultQueryOptions(t),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof B(this.options.enabled,this.#e)!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");this.#R(),this.#e.setOptions(this.options),e._defaulted&&!Qt(this.options,e)&&this.#t.getQueryCache().notify({type:"observerOptionsUpdated",query:this.#e,observer:this});const n=this.hasListeners();n&&rs(this.#e,s,this.options,e)&&this.#h(),this.updateResult(),n&&(this.#e!==s||B(this.options.enabled,this.#e)!==B(e.enabled,this.#e)||tt(this.options.staleTime,this.#e)!==tt(e.staleTime,this.#e))&&this.#g();const r=this.#y();n&&(this.#e!==s||B(this.options.enabled,this.#e)!==B(e.enabled,this.#e)||r!==this.#c)&&this.#v(r)}getOptimisticResult(t){const e=this.#t.getQueryCache().build(this.#t,t),s=this.createResult(e,t);return Dn(this,s)&&(this.#r=s,this.#o=this.options,this.#n=this.#e.state),s}getCurrentResult(){return this.#r}trackResult(t,e){return new Proxy(t,{get:(s,n)=>(this.trackProp(n),e?.(n),n==="promise"&&(this.trackProp("data"),!this.options.experimental_prefetchInRender&&this.#a.status==="pending"&&this.#a.reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(s,n))})}trackProp(t){this.#p.add(t)}getCurrentQuery(){return this.#e}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){const e=this.#t.defaultQueryOptions(t),s=this.#t.getQueryCache().build(this.#t,e);return s.fetch().then(()=>this.createResult(s,e))}fetch(t){return this.#h({...t,cancelRefetch:t.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#r))}#h(t){this.#R();let e=this.#e.fetch(this.options,t);return t?.throwOnError||(e=e.catch(A)),e}#g(){this.#S();const t=tt(this.options.staleTime,this.#e);if(ct||this.#r.isStale||!me(t))return;const s=Es(this.#r.dataUpdatedAt,t)+1;this.#u=nt.setTimeout(()=>{this.#r.isStale||this.updateResult()},s)}#y(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(this.#e):this.options.refetchInterval)??!1}#v(t){this.#w(),this.#c=t,!(ct||B(this.options.enabled,this.#e)===!1||!me(this.#c)||this.#c===0)&&(this.#l=nt.setInterval(()=>{(this.options.refetchIntervalInBackground||Le.isFocused())&&this.#h()},this.#c))}#P(){this.#g(),this.#v(this.#y())}#S(){this.#u&&(nt.clearTimeout(this.#u),this.#u=void 0)}#w(){this.#l&&(nt.clearInterval(this.#l),this.#l=void 0)}createResult(t,e){const s=this.#e,n=this.options,r=this.#r,i=this.#n,a=this.#o,c=t!==s?t.state:this.#s,{state:u}=t;let l={...u},d=!1,h;if(e._optimisticResults){const y=this.hasListeners(),R=!y&&ns(t,e),M=y&&rs(t,s,e,n);(R||M)&&(l={...l,...Ds(u.data,t.options)}),e._optimisticResults==="isRestoring"&&(l.fetchStatus="idle")}let{error:f,errorUpdatedAt:p,status:m}=l;h=l.data;let g=!1;if(e.placeholderData!==void 0&&h===void 0&&m==="pending"){let y;r?.isPlaceholderData&&e.placeholderData===a?.placeholderData?(y=r.data,g=!0):y=typeof e.placeholderData=="function"?e.placeholderData(this.#f?.state.data,this.#f):e.placeholderData,y!==void 0&&(m="success",h=ye(r?.data,y,e),d=!0)}if(e.select&&h!==void 0&&!g)if(r&&h===i?.data&&e.select===this.#m)h=this.#d;else try{this.#m=e.select,h=e.select(h),h=ye(r?.data,h,e),this.#d=h,this.#i=null}catch(y){this.#i=y}this.#i&&(f=this.#i,h=this.#d,p=Date.now(),m="error");const P=l.fetchStatus==="fetching",S=m==="pending",w=m==="error",v=S&&P,C=h!==void 0,x={status:m,fetchStatus:l.fetchStatus,isPending:S,isSuccess:m==="success",isError:w,isInitialLoading:v,isLoading:v,data:h,dataUpdatedAt:l.dataUpdatedAt,error:f,errorUpdatedAt:p,failureCount:l.fetchFailureCount,failureReason:l.fetchFailureReason,errorUpdateCount:l.errorUpdateCount,isFetched:l.dataUpdateCount>0||l.errorUpdateCount>0,isFetchedAfterMount:l.dataUpdateCount>c.dataUpdateCount||l.errorUpdateCount>c.errorUpdateCount,isFetching:P,isRefetching:P&&!S,isLoadingError:w&&!C,isPaused:l.fetchStatus==="paused",isPlaceholderData:d,isRefetchError:w&&C,isStale:Me(t,e),refetch:this.refetch,promise:this.#a,isEnabled:B(e.enabled,t)!==!1};if(this.options.experimental_prefetchInRender){const y=x.data!==void 0,R=x.status==="error"&&!y,M=I=>{R?I.reject(x.error):y&&I.resolve(x.data)},O=()=>{const I=this.#a=x.promise=ve();M(I)},E=this.#a;switch(E.status){case"pending":t.queryHash===s.queryHash&&M(E);break;case"fulfilled":(R||x.data!==E.value)&&O();break;case"rejected":(!R||x.error!==E.reason)&&O();break}}return x}updateResult(){const t=this.#r,e=this.createResult(this.#e,this.options);if(this.#n=this.#e.state,this.#o=this.options,this.#n.data!==void 0&&(this.#f=this.#e),Qt(e,t))return;this.#r=e;const s=()=>{if(!t)return!0;const{notifyOnChangeProps:n}=this.options,r=typeof n=="function"?n():n;if(r==="all"||!r&&!this.#p.size)return!0;const i=new Set(r??this.#p);return this.options.throwOnError&&i.add("error"),Object.keys(this.#r).some(a=>{const o=a;return this.#r[o]!==t[o]&&i.has(o)})};this.#b({listeners:s()})}#R(){const t=this.#t.getQueryCache().build(this.#t,this.options);if(t===this.#e)return;const e=this.#e;this.#e=t,this.#s=t.state,this.hasListeners()&&(e?.removeObserver(this),t.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#P()}#b(t){F.batch(()=>{t.listeners&&this.listeners.forEach(e=>{e(this.#r)}),this.#t.getQueryCache().notify({query:this.#e,type:"observerResultsUpdated"})})}};function An(t,e){return B(e.enabled,t)!==!1&&t.state.data===void 0&&!(t.state.status==="error"&&e.retryOnMount===!1)}function ns(t,e){return An(t,e)||t.state.data!==void 0&&Se(t,e,e.refetchOnMount)}function Se(t,e,s){if(B(e.enabled,t)!==!1&&tt(e.staleTime,t)!=="static"){const n=typeof s=="function"?s(t):s;return n==="always"||n!==!1&&Me(t,e)}return!1}function rs(t,e,s,n){return(t!==e||B(n.enabled,t)===!1)&&(!s.suspense||t.state.status!=="error")&&Me(t,s)}function Me(t,e){return B(e.enabled,t)!==!1&&t.isStaleByTime(tt(e.staleTime,t))}function Dn(t,e){return!Qt(t.getCurrentResult(),e)}function $t(t){return{onFetch:(e,s)=>{const n=e.options,r=e.fetchOptions?.meta?.fetchMore?.direction,i=e.state.data?.pages||[],a=e.state.data?.pageParams||[];let o={pages:[],pageParams:[]},c=0;const u=async()=>{let l=!1;const d=p=>{Mn(p,()=>e.signal,()=>l=!0)},h=ks(e.options,e.fetchOptions),f=async(p,m,g)=>{if(l)return Promise.reject();if(m==null&&p.pages.length)return Promise.resolve(p);const S=(()=>{const L={client:e.client,queryKey:e.queryKey,pageParam:m,direction:g?"backward":"forward",meta:e.options.meta};return d(L),L})(),w=await h(S),{maxPages:v}=e.options,C=g?Ln:Cn;return{pages:C(p.pages,w,v),pageParams:C(p.pageParams,m,v)}};if(r&&i.length){const p=r==="backward",m=p?Us:we,g={pages:i,pageParams:a},P=m(n,g);o=await f(g,P,p)}else{const p=t??i.length;do{const m=c===0?a[0]??n.initialPageParam:we(n,o);if(c>0&&m==null)break;o=await f(o,m),c++}while(c<p)}return o};e.options.persister?e.fetchFn=()=>e.options.persister?.(u,{client:e.client,queryKey:e.queryKey,meta:e.options.meta,signal:e.signal},s):e.fetchFn=u}}}function we(t,{pages:e,pageParams:s}){const n=e.length-1;return e.length>0?t.getNextPageParam(e[n],e,s[n],s):void 0}function Us(t,{pages:e,pageParams:s}){return e.length>0?t.getPreviousPageParam?.(e[0],e,s[0],s):void 0}function jn(t,e){return e?we(t,e)!=null:!1}function Un(t,e){return!e||!t.getPreviousPageParam?!1:Us(t,e)!=null}var Bn=class extends js{constructor(t,e){super(t,e)}bindMethods(){super.bindMethods(),this.fetchNextPage=this.fetchNextPage.bind(this),this.fetchPreviousPage=this.fetchPreviousPage.bind(this)}setOptions(t){super.setOptions({...t,behavior:$t()})}getOptimisticResult(t){return t.behavior=$t(),super.getOptimisticResult(t)}fetchNextPage(t){return this.fetch({...t,meta:{fetchMore:{direction:"forward"}}})}fetchPreviousPage(t){return this.fetch({...t,meta:{fetchMore:{direction:"backward"}}})}createResult(t,e){const{state:s}=t,n=super.createResult(t,e),{isFetching:r,isRefetching:i,isError:a,isRefetchError:o}=n,c=s.fetchMeta?.fetchMore?.direction,u=a&&c==="forward",l=r&&c==="forward",d=a&&c==="backward",h=r&&c==="backward";return{...n,fetchNextPage:this.fetchNextPage,fetchPreviousPage:this.fetchPreviousPage,hasNextPage:jn(e,s.data),hasPreviousPage:Un(e,s.data),isFetchNextPageError:u,isFetchingNextPage:l,isFetchPreviousPageError:d,isFetchingPreviousPage:h,isRefetchError:o&&!u&&!d,isRefetching:i&&!l&&!h}}},Nn=class extends As{#t;#e;#s;#r;constructor(t){super(),this.#t=t.client,this.mutationId=t.mutationId,this.#s=t.mutationCache,this.#e=[],this.state=t.state||Bs(),this.setOptions(t.options),this.scheduleGc()}setOptions(t){this.options=t,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(t){this.#e.includes(t)||(this.#e.push(t),this.clearGcTimeout(),this.#s.notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){this.#e=this.#e.filter(e=>e!==t),this.scheduleGc(),this.#s.notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){this.#e.length||(this.state.status==="pending"?this.scheduleGc():this.#s.remove(this))}continue(){return this.#r?.continue()??this.execute(this.state.variables)}async execute(t){const e=()=>{this.#n({type:"continue"})},s={client:this.#t,meta:this.options.meta,mutationKey:this.options.mutationKey};this.#r=Fs({fn:()=>this.options.mutationFn?this.options.mutationFn(t,s):Promise.reject(new Error("No mutationFn found")),onFail:(i,a)=>{this.#n({type:"failed",failureCount:i,error:a})},onPause:()=>{this.#n({type:"pause"})},onContinue:e,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#s.canRun(this)});const n=this.state.status==="pending",r=!this.#r.canStart();try{if(n)e();else{this.#n({type:"pending",variables:t,isPaused:r}),this.#s.config.onMutate&&await this.#s.config.onMutate(t,this,s);const a=await this.options.onMutate?.(t,s);a!==this.state.context&&this.#n({type:"pending",context:a,variables:t,isPaused:r})}const i=await this.#r.start();return await this.#s.config.onSuccess?.(i,t,this.state.context,this,s),await this.options.onSuccess?.(i,t,this.state.context,s),await this.#s.config.onSettled?.(i,null,this.state.variables,this.state.context,this,s),await this.options.onSettled?.(i,null,t,this.state.context,s),this.#n({type:"success",data:i}),i}catch(i){try{await this.#s.config.onError?.(i,t,this.state.context,this,s)}catch(a){Promise.reject(a)}try{await this.options.onError?.(i,t,this.state.context,s)}catch(a){Promise.reject(a)}try{await this.#s.config.onSettled?.(void 0,i,this.state.variables,this.state.context,this,s)}catch(a){Promise.reject(a)}try{await this.options.onSettled?.(void 0,i,t,this.state.context,s)}catch(a){Promise.reject(a)}throw this.#n({type:"error",error:i}),i}finally{this.#s.runNext(this)}}#n(t){const e=s=>{switch(t.type){case"failed":return{...s,failureCount:t.failureCount,failureReason:t.error};case"pause":return{...s,isPaused:!0};case"continue":return{...s,isPaused:!1};case"pending":return{...s,context:t.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:t.isPaused,status:"pending",variables:t.variables,submittedAt:Date.now()};case"success":return{...s,data:t.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...s,data:void 0,error:t.error,failureCount:s.failureCount+1,failureReason:t.error,isPaused:!1,status:"error"}}};this.state=e(this.state),F.batch(()=>{this.#e.forEach(s=>{s.onMutationUpdate(t)}),this.#s.notify({mutation:this,type:"updated",action:t})})}};function Bs(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var Qn=class extends vt{constructor(t={}){super(),this.config=t,this.#t=new Set,this.#e=new Map,this.#s=0}#t;#e;#s;build(t,e,s){const n=new Nn({client:t,mutationCache:this,mutationId:++this.#s,options:t.defaultMutationOptions(e),state:s});return this.add(n),n}add(t){this.#t.add(t);const e=At(t);if(typeof e=="string"){const s=this.#e.get(e);s?s.push(t):this.#e.set(e,[t])}this.notify({type:"added",mutation:t})}remove(t){if(this.#t.delete(t)){const e=At(t);if(typeof e=="string"){const s=this.#e.get(e);if(s)if(s.length>1){const n=s.indexOf(t);n!==-1&&s.splice(n,1)}else s[0]===t&&this.#e.delete(e)}}this.notify({type:"removed",mutation:t})}canRun(t){const e=At(t);if(typeof e=="string"){const n=this.#e.get(e)?.find(r=>r.state.status==="pending");return!n||n===t}else return!0}runNext(t){const e=At(t);return typeof e=="string"?this.#e.get(e)?.find(n=>n!==t&&n.state.isPaused)?.continue()??Promise.resolve():Promise.resolve()}clear(){F.batch(()=>{this.#t.forEach(t=>{this.notify({type:"removed",mutation:t})}),this.#t.clear(),this.#e.clear()})}getAll(){return Array.from(this.#t)}find(t){const e={exact:!0,...t};return this.getAll().find(s=>Xe(e,s))}findAll(t={}){return this.getAll().filter(e=>Xe(t,e))}notify(t){F.batch(()=>{this.listeners.forEach(e=>{e(t)})})}resumePausedMutations(){const t=this.getAll().filter(e=>e.state.isPaused);return F.batch(()=>Promise.all(t.map(e=>e.continue().catch(A))))}};function At(t){return t.options.scope?.id}var Kn=class extends vt{#t;#e=void 0;#s;#r;constructor(t,e){super(),this.#t=t,this.setOptions(e),this.bindMethods(),this.#n()}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(t){const e=this.options;this.options=this.#t.defaultMutationOptions(t),Qt(this.options,e)||this.#t.getMutationCache().notify({type:"observerOptionsUpdated",mutation:this.#s,observer:this}),e?.mutationKey&&this.options.mutationKey&&ut(e.mutationKey)!==ut(this.options.mutationKey)?this.reset():this.#s?.state.status==="pending"&&this.#s.setOptions(this.options)}onUnsubscribe(){this.hasListeners()||this.#s?.removeObserver(this)}onMutationUpdate(t){this.#n(),this.#o(t)}getCurrentResult(){return this.#e}reset(){this.#s?.removeObserver(this),this.#s=void 0,this.#n(),this.#o()}mutate(t,e){return this.#r=e,this.#s?.removeObserver(this),this.#s=this.#t.getMutationCache().build(this.#t,this.options),this.#s.addObserver(this),this.#s.execute(t)}#n(){const t=this.#s?.state??Bs();this.#e={...t,isPending:t.status==="pending",isSuccess:t.status==="success",isError:t.status==="error",isIdle:t.status==="idle",mutate:this.mutate,reset:this.reset}}#o(t){F.batch(()=>{if(this.#r&&this.hasListeners()){const e=this.#e.variables,s=this.#e.context,n={client:this.#t,meta:this.options.meta,mutationKey:this.options.mutationKey};if(t?.type==="success"){try{this.#r.onSuccess?.(t.data,e,s,n)}catch(r){Promise.reject(r)}try{this.#r.onSettled?.(t.data,null,e,s,n)}catch(r){Promise.reject(r)}}else if(t?.type==="error"){try{this.#r.onError?.(t.error,e,s,n)}catch(r){Promise.reject(r)}try{this.#r.onSettled?.(void 0,t.error,e,s,n)}catch(r){Promise.reject(r)}}}this.listeners.forEach(e=>{e(this.#e)})})}},$n=class extends vt{constructor(t={}){super(),this.config=t,this.#t=new Map}#t;build(t,e,s){const n=e.queryKey,r=e.queryHash??xe(n,e);let i=this.get(r);return i||(i=new Fn({client:t,queryKey:n,queryHash:r,options:t.defaultQueryOptions(e),state:s,defaultOptions:t.getQueryDefaults(n)}),this.add(i)),i}add(t){this.#t.has(t.queryHash)||(this.#t.set(t.queryHash,t),this.notify({type:"added",query:t}))}remove(t){const e=this.#t.get(t.queryHash);e&&(t.destroy(),e===t&&this.#t.delete(t.queryHash),this.notify({type:"removed",query:t}))}clear(){F.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}get(t){return this.#t.get(t)}getAll(){return[...this.#t.values()]}find(t){const e={exact:!0,...t};return this.getAll().find(s=>Ye(e,s))}findAll(t={}){const e=this.getAll();return Object.keys(t).length>0?e.filter(s=>Ye(t,s)):e}notify(t){F.batch(()=>{this.listeners.forEach(e=>{e(t)})})}onFocus(){F.batch(()=>{this.getAll().forEach(t=>{t.onFocus()})})}onOnline(){F.batch(()=>{this.getAll().forEach(t=>{t.onOnline()})})}},Ni=class{#t;#e;#s;#r;#n;#o;#a;#i;constructor(t={}){this.#t=t.queryCache||new $n,this.#e=t.mutationCache||new Qn,this.#s=t.defaultOptions||{},this.#r=new Map,this.#n=new Map,this.#o=0}mount(){this.#o++,this.#o===1&&(this.#a=Le.subscribe(async t=>{t&&(await this.resumePausedMutations(),this.#t.onFocus())}),this.#i=Kt.subscribe(async t=>{t&&(await this.resumePausedMutations(),this.#t.onOnline())}))}unmount(){this.#o--,this.#o===0&&(this.#a?.(),this.#a=void 0,this.#i?.(),this.#i=void 0)}isFetching(t){return this.#t.findAll({...t,fetchStatus:"fetching"}).length}isMutating(t){return this.#e.findAll({...t,status:"pending"}).length}getQueryData(t){const e=this.defaultQueryOptions({queryKey:t});return this.#t.get(e.queryHash)?.state.data}ensureQueryData(t){const e=this.defaultQueryOptions(t),s=this.#t.build(this,e),n=s.state.data;return n===void 0?this.fetchQuery(t):(t.revalidateIfStale&&s.isStaleByTime(tt(e.staleTime,s))&&this.prefetchQuery(e),Promise.resolve(n))}getQueriesData(t){return this.#t.findAll(t).map(({queryKey:e,state:s})=>{const n=s.data;return[e,n]})}setQueryData(t,e,s){const n=this.defaultQueryOptions({queryKey:t}),i=this.#t.get(n.queryHash)?.state.data,a=bn(e,i);if(a!==void 0)return this.#t.build(this,n).setData(a,{...s,manual:!0})}setQueriesData(t,e,s){return F.batch(()=>this.#t.findAll(t).map(({queryKey:n})=>[n,this.setQueryData(n,e,s)]))}getQueryState(t){const e=this.defaultQueryOptions({queryKey:t});return this.#t.get(e.queryHash)?.state}removeQueries(t){const e=this.#t;F.batch(()=>{e.findAll(t).forEach(s=>{e.remove(s)})})}resetQueries(t,e){const s=this.#t;return F.batch(()=>(s.findAll(t).forEach(n=>{n.reset()}),this.refetchQueries({type:"active",...t},e)))}cancelQueries(t,e={}){const s={revert:!0,...e},n=F.batch(()=>this.#t.findAll(t).map(r=>r.cancel(s)));return Promise.all(n).then(A).catch(A)}invalidateQueries(t,e={}){return F.batch(()=>(this.#t.findAll(t).forEach(s=>{s.invalidate()}),t?.refetchType==="none"?Promise.resolve():this.refetchQueries({...t,type:t?.refetchType??t?.type??"active"},e)))}refetchQueries(t,e={}){const s={...e,cancelRefetch:e.cancelRefetch??!0},n=F.batch(()=>this.#t.findAll(t).filter(r=>!r.isDisabled()&&!r.isStatic()).map(r=>{let i=r.fetch(void 0,s);return s.throwOnError||(i=i.catch(A)),r.state.fetchStatus==="paused"?Promise.resolve():i}));return Promise.all(n).then(A)}fetchQuery(t){const e=this.defaultQueryOptions(t);e.retry===void 0&&(e.retry=!1);const s=this.#t.build(this,e);return s.isStaleByTime(tt(e.staleTime,s))?s.fetch(e):Promise.resolve(s.state.data)}prefetchQuery(t){return this.fetchQuery(t).then(A).catch(A)}fetchInfiniteQuery(t){return t.behavior=$t(t.pages),this.fetchQuery(t)}prefetchInfiniteQuery(t){return this.fetchInfiniteQuery(t).then(A).catch(A)}ensureInfiniteQueryData(t){return t.behavior=$t(t.pages),this.ensureQueryData(t)}resumePausedMutations(){return Kt.isOnline()?this.#e.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#t}getMutationCache(){return this.#e}getDefaultOptions(){return this.#s}setDefaultOptions(t){this.#s=t}setQueryDefaults(t,e){this.#r.set(ut(t),{queryKey:t,defaultOptions:e})}getQueryDefaults(t){const e=[...this.#r.values()],s={};return e.forEach(n=>{Ot(t,n.queryKey)&&Object.assign(s,n.defaultOptions)}),s}setMutationDefaults(t,e){this.#n.set(ut(t),{mutationKey:t,defaultOptions:e})}getMutationDefaults(t){const e=[...this.#n.values()],s={};return e.forEach(n=>{Ot(t,n.mutationKey)&&Object.assign(s,n.defaultOptions)}),s}defaultQueryOptions(t){if(t._defaulted)return t;const e={...this.#s.queries,...this.getQueryDefaults(t.queryKey),...t,_defaulted:!0};return e.queryHash||(e.queryHash=xe(e.queryKey,e)),e.refetchOnReconnect===void 0&&(e.refetchOnReconnect=e.networkMode!=="always"),e.throwOnError===void 0&&(e.throwOnError=!!e.suspense),!e.networkMode&&e.persister&&(e.networkMode="offlineFirst"),e.queryFn===_e&&(e.enabled=!1),e}defaultMutationOptions(t){return t?._defaulted?t:{...this.#s.mutations,...t?.mutationKey&&this.getMutationDefaults(t.mutationKey),...t,_defaulted:!0}}clear(){this.#t.clear(),this.#e.clear()}},Ns=b.createContext(void 0),Qs=t=>{const e=b.useContext(Ns);if(!e)throw new Error("No QueryClient set, use QueryClientProvider to set one");return e},Qi=({client:t,children:e})=>(b.useEffect(()=>(t.mount(),()=>{t.unmount()}),[t]),_.jsx(Ns.Provider,{value:t,children:e})),Ks=b.createContext(!1),qn=()=>b.useContext(Ks);Ks.Provider;function Hn(){let t=!1;return{clearReset:()=>{t=!1},reset:()=>{t=!0},isReset:()=>t}}var Wn=b.createContext(Hn()),zn=()=>b.useContext(Wn),Vn=(t,e,s)=>{const n=s?.state.error&&typeof t.throwOnError=="function"?Ce(t.throwOnError,[s.state.error,s]):t.throwOnError;(t.suspense||t.experimental_prefetchInRender||n)&&(e.isReset()||(t.retryOnMount=!1))},Gn=t=>{b.useEffect(()=>{t.clearReset()},[t])},Jn=({result:t,errorResetBoundary:e,throwOnError:s,query:n,suspense:r})=>t.isError&&!e.isReset()&&!t.isFetching&&n&&(r&&t.data===void 0||Ce(s,[t.error,n])),Yn=t=>{if(t.suspense){const s=r=>r==="static"?r:Math.max(r??1e3,1e3),n=t.staleTime;t.staleTime=typeof n=="function"?(...r)=>s(n(...r)):s(n),typeof t.gcTime=="number"&&(t.gcTime=Math.max(t.gcTime,1e3))}},Xn=(t,e)=>t.isLoading&&t.isFetching&&!e,Zn=(t,e)=>t?.suspense&&e.isPending,is=(t,e,s)=>e.fetchOptimistic(t).catch(()=>{s.clearReset()});function $s(t,e,s){const n=qn(),r=zn(),i=Qs(),a=i.defaultQueryOptions(t);i.getDefaultOptions().queries?._experimental_beforeQuery?.(a);const o=i.getQueryCache().get(a.queryHash);a._optimisticResults=n?"isRestoring":"optimistic",Yn(a),Vn(a,r,o),Gn(r);const c=!i.getQueryCache().get(a.queryHash),[u]=b.useState(()=>new e(i,a)),l=u.getOptimisticResult(a),d=!n&&t.subscribed!==!1;if(b.useSyncExternalStore(b.useCallback(h=>{const f=d?u.subscribe(F.batchCalls(h)):A;return u.updateResult(),f},[u,d]),()=>u.getCurrentResult(),()=>u.getCurrentResult()),b.useEffect(()=>{u.setOptions(a)},[a,u]),Zn(a,l))throw is(a,u,r);if(Jn({result:l,errorResetBoundary:r,throwOnError:a.throwOnError,query:o,suspense:a.suspense}))throw l.error;return i.getDefaultOptions().queries?._experimental_afterQuery?.(a,l),a.experimental_prefetchInRender&&!ct&&Xn(l,n)&&(c?is(a,u,r):o?.promise)?.catch(A).finally(()=>{u.updateResult()}),a.notifyOnChangeProps?l:u.trackResult(l)}function Ki(t,e){return $s(t,js)}function $i(t,e){const s=Qs(),[n]=b.useState(()=>new Kn(s,t));b.useEffect(()=>{n.setOptions(t)},[n,t]);const r=b.useSyncExternalStore(b.useCallback(a=>n.subscribe(F.batchCalls(a)),[n]),()=>n.getCurrentResult(),()=>n.getCurrentResult()),i=b.useCallback((a,o)=>{n.mutate(a,o).catch(A)},[n]);if(r.error&&Ce(n.options.throwOnError,[r.error]))throw r.error;return{...r,mutate:i,mutateAsync:r.mutate}}function qi(t,e){return $s(t,Bn)}function tr(t){return typeof t=="function"}class er{constructor(e,s){this.listeners=new Set,this.subscribe=n=>{var r,i;this.listeners.add(n);const a=(i=(r=this.options)==null?void 0:r.onSubscribe)==null?void 0:i.call(r,n,this);return()=>{this.listeners.delete(n),a?.()}},this.prevState=e,this.state=e,this.options=s}setState(e){var s,n,r;this.prevState=this.state,(s=this.options)!=null&&s.updateFn?this.state=this.options.updateFn(this.prevState)(e):tr(e)?this.state=e(this.prevState):this.state=e,(r=(n=this.options)==null?void 0:n.onUpdate)==null||r.call(n),yn(this)}}const et="__TSR_index",os="popstate",as="beforeunload";function sr(t){let e=t.getLocation();const s=new Set,n=a=>{e=t.getLocation(),s.forEach(o=>o({location:e,action:a}))},r=a=>{t.notifyOnIndexChange??!0?n(a):e=t.getLocation()},i=async({task:a,navigateOpts:o,...c})=>{if(o?.ignoreBlocker??!1){a();return}const l=t.getBlockers?.()??[],d=c.type==="PUSH"||c.type==="REPLACE";if(typeof document<"u"&&l.length&&d)for(const h of l){const f=qt(c.path,c.state);if(await h.blockerFn({currentLocation:e,nextLocation:f,action:c.type})){t.onBlocked?.();return}}a()};return{get location(){return e},get length(){return t.getLength()},subscribers:s,subscribe:a=>(s.add(a),()=>{s.delete(a)}),push:(a,o,c)=>{const u=e.state[et];o=cs(u+1,o),i({task:()=>{t.pushState(a,o),n({type:"PUSH"})},navigateOpts:c,type:"PUSH",path:a,state:o})},replace:(a,o,c)=>{const u=e.state[et];o=cs(u,o),i({task:()=>{t.replaceState(a,o),n({type:"REPLACE"})},navigateOpts:c,type:"REPLACE",path:a,state:o})},go:(a,o)=>{i({task:()=>{t.go(a),r({type:"GO",index:a})},navigateOpts:o,type:"GO"})},back:a=>{i({task:()=>{t.back(a?.ignoreBlocker??!1),r({type:"BACK"})},navigateOpts:a,type:"BACK"})},forward:a=>{i({task:()=>{t.forward(a?.ignoreBlocker??!1),r({type:"FORWARD"})},navigateOpts:a,type:"FORWARD"})},canGoBack:()=>e.state[et]!==0,createHref:a=>t.createHref(a),block:a=>{if(!t.setBlockers)return()=>{};const o=t.getBlockers?.()??[];return t.setBlockers([...o,a]),()=>{const c=t.getBlockers?.()??[];t.setBlockers?.(c.filter(u=>u!==a))}},flush:()=>t.flush?.(),destroy:()=>t.destroy?.(),notify:n}}function cs(t,e){e||(e={});const s=Oe();return{...e,key:s,__TSR_key:s,[et]:t}}function nr(t){const e=typeof document<"u"?window:void 0,s=e.history.pushState,n=e.history.replaceState;let r=[];const i=()=>r,a=y=>r=y,o=(y=>y),c=(()=>qt(`${e.location.pathname}${e.location.search}${e.location.hash}`,e.history.state));if(!e.history.state?.__TSR_key&&!e.history.state?.key){const y=Oe();e.history.replaceState({[et]:0,key:y,__TSR_key:y},"")}let u=c(),l,d=!1,h=!1,f=!1,p=!1;const m=()=>u;let g,P;const S=()=>{g&&(x._ignoreSubscribers=!0,(g.isPush?e.history.pushState:e.history.replaceState)(g.state,"",g.href),x._ignoreSubscribers=!1,g=void 0,P=void 0,l=void 0)},w=(y,R,M)=>{const O=o(R);P||(l=u),u=qt(R,M),g={href:O,state:M,isPush:g?.isPush||y==="push"},P||(P=Promise.resolve().then(()=>S()))},v=y=>{u=c(),x.notify({type:y})},C=async()=>{if(h){h=!1;return}const y=c(),R=y.state[et]-u.state[et],M=R===1,O=R===-1,E=!M&&!O||d;d=!1;const I=E?"GO":O?"BACK":"FORWARD",k=E?{type:"GO",index:R}:{type:O?"BACK":"FORWARD"};if(f)f=!1;else{const J=i();if(typeof document<"u"&&J.length){for(const H of J)if(await H.blockerFn({currentLocation:u,nextLocation:y,action:I})){h=!0,e.history.go(1),x.notify(k);return}}}u=c(),x.notify(k)},L=y=>{if(p){p=!1;return}let R=!1;const M=i();if(typeof document<"u"&&M.length)for(const O of M){const E=O.enableBeforeUnload??!0;if(E===!0){R=!0;break}if(typeof E=="function"&&E()===!0){R=!0;break}}if(R)return y.preventDefault(),y.returnValue=""},x=sr({getLocation:m,getLength:()=>e.history.length,pushState:(y,R)=>w("push",y,R),replaceState:(y,R)=>w("replace",y,R),back:y=>(y&&(f=!0),p=!0,e.history.back()),forward:y=>{y&&(f=!0),p=!0,e.history.forward()},go:y=>{d=!0,e.history.go(y)},createHref:y=>o(y),flush:S,destroy:()=>{e.history.pushState=s,e.history.replaceState=n,e.removeEventListener(as,L,{capture:!0}),e.removeEventListener(os,C)},onBlocked:()=>{l&&u!==l&&(u=l)},getBlockers:i,setBlockers:a,notifyOnIndexChange:!1});return e.addEventListener(as,L,{capture:!0}),e.addEventListener(os,C),e.history.pushState=function(...y){const R=s.apply(e.history,y);return x._ignoreSubscribers||v("PUSH"),R},e.history.replaceState=function(...y){const R=n.apply(e.history,y);return x._ignoreSubscribers||v("REPLACE"),R},x}function rr(t){let e=t.replace(/[\x00-\x1f\x7f]/g,"");return e.startsWith("//")&&(e="/"+e.replace(/^\/+/,"")),e}function qt(t,e){const s=rr(t),n=s.indexOf("#"),r=s.indexOf("?"),i=Oe();return{href:s,pathname:s.substring(0,n>0?r>0?Math.min(n,r):n:r>0?r:s.length),hash:n>-1?s.substring(n):"",search:r>-1?s.slice(r,n===-1?void 0:n):"",state:e||{[et]:0,key:i,__TSR_key:i}}}function Oe(){return(Math.random()+1).toString(36).substring(7)}const ir=!1;function Lt(t){let e;return vn(()=>{e=t()}),e}function Et(t){return t[t.length-1]}function or(t){return typeof t=="function"}function X(t,e){return or(t)?t(e):t}const ar=Object.prototype.hasOwnProperty,us=Object.prototype.propertyIsEnumerable;function j(t,e,s=0){if(t===e)return t;if(s>500)return e;const n=e,r=ds(t)&&ds(n);if(!r&&!(Ht(t)&&Ht(n)))return n;const i=r?t:ls(t);if(!i)return n;const a=r?n:ls(n);if(!a)return n;const o=i.length,c=a.length,u=r?new Array(c):{};let l=0;for(let d=0;d<c;d++){const h=r?d:a[d],f=t[h],p=n[h];if(f===p){u[h]=f,(r?d<o:ar.call(t,h))&&l++;continue}if(f===null||p===null||typeof f!="object"||typeof p!="object"){u[h]=p;continue}const m=j(f,p,s+1);u[h]=m,m===f&&l++}return o===c&&l===o?t:u}function ls(t){const e=Object.getOwnPropertyNames(t);for(const r of e)if(!us.call(t,r))return!1;const s=Object.getOwnPropertySymbols(t);if(s.length===0)return e;const n=e;for(const r of s){if(!us.call(t,r))return!1;n.push(r)}return n}function Ht(t){if(!hs(t))return!1;const e=t.constructor;if(typeof e>"u")return!0;const s=e.prototype;return!(!hs(s)||!s.hasOwnProperty("isPrototypeOf"))}function hs(t){return Object.prototype.toString.call(t)==="[object Object]"}function ds(t){return Array.isArray(t)&&t.length===Object.keys(t).length}function ot(t,e,s){if(t===e)return!0;if(typeof t!=typeof e)return!1;if(Array.isArray(t)&&Array.isArray(e)){if(t.length!==e.length)return!1;for(let n=0,r=t.length;n<r;n++)if(!ot(t[n],e[n],s))return!1;return!0}if(Ht(t)&&Ht(e)){const n=s?.ignoreUndefined??!0;if(s?.partial){for(const a in e)if((!n||e[a]!==void 0)&&!ot(t[a],e[a],s))return!1;return!0}let r=0;if(!n)r=Object.keys(t).length;else for(const a in t)t[a]!==void 0&&r++;let i=0;for(const a in e)if((!n||e[a]!==void 0)&&(i++,i>r||!ot(t[a],e[a],s)))return!1;return r===i}return!1}function gt(t){let e,s;const n=new Promise((r,i)=>{e=r,s=i});return n.status="pending",n.resolve=r=>{n.status="resolved",n.value=r,e(r),t?.(r)},n.reject=r=>{n.status="rejected",s(r)},n}function pt(t){return!!(t&&typeof t=="object"&&typeof t.then=="function")}function cr(t){return t.replace(/[\x00-\x1f\x7f]/g,"")}function fs(t){let e;try{e=decodeURI(t)}catch{e=t.replaceAll(/%[0-9A-F]{2}/gi,s=>{try{return decodeURI(s)}catch{return s}})}return cr(e)}const qs=["http:","https:","mailto:","tel:"];function Wt(t){if(!t)return!1;try{const e=new URL(t);return!qs.includes(e.protocol)}catch{return!1}}function Rt(t){if(!t)return{path:t,handledProtocolRelativeURL:!1};if(!/[%\\\x00-\x1f\x7f]/.test(t)&&!t.startsWith("//"))return{path:t,handledProtocolRelativeURL:!1};const e=/%25|%5C/gi;let s=0,n="",r;for(;(r=e.exec(t))!==null;)n+=fs(t.slice(s,r.index))+r[0],s=e.lastIndex;n=n+fs(s?t.slice(s):t);let i=!1;return n.startsWith("//")&&(i=!0,n="/"+n.replace(/^\/+/,"")),{path:n,handledProtocolRelativeURL:i}}function ur(t){return/\s|[^\u0000-\u007F]/.test(t)?t.replace(/\s|[^\u0000-\u007F]/gu,encodeURIComponent):t}var lr="Invariant failed";function G(t,e){if(!t)throw new Error(lr)}function zt(t){const e=new Map;let s,n;const r=i=>{i.next&&(i.prev?(i.prev.next=i.next,i.next.prev=i.prev,i.next=void 0,n&&(n.next=i,i.prev=n)):(i.next.prev=void 0,s=i.next,i.next=void 0,n&&(i.prev=n,n.next=i)),n=i)};return{get(i){const a=e.get(i);if(a)return r(a),a.value},set(i,a){if(e.size>=t&&s){const c=s;e.delete(c.key),c.next&&(s=c.next,c.next.prev=void 0),c===n&&(n=void 0)}const o=e.get(i);if(o)o.value=a,r(o);else{const c={key:i,value:a,prev:n};n&&(n.next=c),n=c,s||(s=c),e.set(i,c)}},clear(){e.clear(),s=void 0,n=void 0}}}const yt=0,lt=1,ht=2,It=3,rt=4,Hs=5;function hr(t){const e=t.indexOf("{");if(e===-1)return null;const s=t.indexOf("}",e);return s===-1||e+1>=t.length?null:[e,s]}function Ee(t,e,s=new Uint16Array(6)){const n=t.indexOf("/",e),r=n===-1?t.length:n,i=t.substring(e,r);if(!i||!i.includes("$"))return s[0]=yt,s[1]=e,s[2]=e,s[3]=r,s[4]=r,s[5]=r,s;if(i==="$"){const o=t.length;return s[0]=ht,s[1]=e,s[2]=e,s[3]=o,s[4]=o,s[5]=o,s}if(i.charCodeAt(0)===36)return s[0]=lt,s[1]=e,s[2]=e+1,s[3]=r,s[4]=r,s[5]=r,s;const a=hr(i);if(a){const[o,c]=a,u=i.charCodeAt(o+1);if(u===45){if(o+2<i.length&&i.charCodeAt(o+2)===36){const l=o+3,d=c;if(l<d)return s[0]=It,s[1]=e+o,s[2]=e+l,s[3]=e+d,s[4]=e+c+1,s[5]=r,s}}else if(u===36){const l=o+1,d=o+2;return d===c?(s[0]=ht,s[1]=e+o,s[2]=e+l,s[3]=e+d,s[4]=e+c+1,s[5]=t.length,s):(s[0]=lt,s[1]=e+o,s[2]=e+d,s[3]=e+c,s[4]=e+c+1,s[5]=r,s)}}return s[0]=yt,s[1]=e,s[2]=e,s[3]=r,s[4]=r,s[5]=r,s}function Yt(t,e,s,n,r,i,a){a?.(s);let o=n;{const c=s.fullPath??s.from,u=c.length,l=s.options?.caseSensitive??t,d=!!(s.options?.params?.parse&&s.options?.skipRouteOnParseError?.params);for(;o<u;){const f=Ee(c,o,e);let p;const m=o,g=f[5];switch(o=g+1,i++,f[0]){case yt:{const S=c.substring(f[2],f[3]);if(l){const w=r.static?.get(S);if(w)p=w;else{r.static??=new Map;const v=it(s.fullPath??s.from);v.parent=r,v.depth=i,p=v,r.static.set(S,v)}}else{const w=S.toLowerCase(),v=r.staticInsensitive?.get(w);if(v)p=v;else{r.staticInsensitive??=new Map;const C=it(s.fullPath??s.from);C.parent=r,C.depth=i,p=C,r.staticInsensitive.set(w,C)}}break}case lt:{const S=c.substring(m,f[1]),w=c.substring(f[4],g),v=l&&!!(S||w),C=S?v?S:S.toLowerCase():void 0,L=w?v?w:w.toLowerCase():void 0,x=!d&&r.dynamic?.find(y=>!y.skipOnParamError&&y.caseSensitive===v&&y.prefix===C&&y.suffix===L);if(x)p=x;else{const y=ne(lt,s.fullPath??s.from,v,C,L);p=y,y.depth=i,y.parent=r,r.dynamic??=[],r.dynamic.push(y)}break}case It:{const S=c.substring(m,f[1]),w=c.substring(f[4],g),v=l&&!!(S||w),C=S?v?S:S.toLowerCase():void 0,L=w?v?w:w.toLowerCase():void 0,x=!d&&r.optional?.find(y=>!y.skipOnParamError&&y.caseSensitive===v&&y.prefix===C&&y.suffix===L);if(x)p=x;else{const y=ne(It,s.fullPath??s.from,v,C,L);p=y,y.parent=r,y.depth=i,r.optional??=[],r.optional.push(y)}break}case ht:{const S=c.substring(m,f[1]),w=c.substring(f[4],g),v=l&&!!(S||w),C=S?v?S:S.toLowerCase():void 0,L=w?v?w:w.toLowerCase():void 0,x=ne(ht,s.fullPath??s.from,v,C,L);p=x,x.parent=r,x.depth=i,r.wildcard??=[],r.wildcard.push(x)}}r=p}if(d&&s.children&&!s.isRoot&&s.id&&s.id.charCodeAt(s.id.lastIndexOf("/")+1)===95){const f=it(s.fullPath??s.from);f.kind=Hs,f.parent=r,i++,f.depth=i,r.pathless??=[],r.pathless.push(f),r=f}const h=(s.path||!s.children)&&!s.isRoot;if(h&&c.endsWith("/")){const f=it(s.fullPath??s.from);f.kind=rt,f.parent=r,i++,f.depth=i,r.index=f,r=f}r.parse=s.options?.params?.parse??null,r.skipOnParamError=d,r.parsingPriority=s.options?.skipRouteOnParseError?.priority??0,h&&!r.route&&(r.route=s,r.fullPath=s.fullPath??s.from)}if(s.children)for(const c of s.children)Yt(t,e,c,o,r,i,a)}function se(t,e){if(t.skipOnParamError&&!e.skipOnParamError)return-1;if(!t.skipOnParamError&&e.skipOnParamError)return 1;if(t.skipOnParamError&&e.skipOnParamError&&(t.parsingPriority||e.parsingPriority))return e.parsingPriority-t.parsingPriority;if(t.prefix&&e.prefix&&t.prefix!==e.prefix){if(t.prefix.startsWith(e.prefix))return-1;if(e.prefix.startsWith(t.prefix))return 1}if(t.suffix&&e.suffix&&t.suffix!==e.suffix){if(t.suffix.endsWith(e.suffix))return-1;if(e.suffix.endsWith(t.suffix))return 1}return t.prefix&&!e.prefix?-1:!t.prefix&&e.prefix?1:t.suffix&&!e.suffix?-1:!t.suffix&&e.suffix?1:t.caseSensitive&&!e.caseSensitive?-1:!t.caseSensitive&&e.caseSensitive?1:0}function Y(t){if(t.pathless)for(const e of t.pathless)Y(e);if(t.static)for(const e of t.static.values())Y(e);if(t.staticInsensitive)for(const e of t.staticInsensitive.values())Y(e);if(t.dynamic?.length){t.dynamic.sort(se);for(const e of t.dynamic)Y(e)}if(t.optional?.length){t.optional.sort(se);for(const e of t.optional)Y(e)}if(t.wildcard?.length){t.wildcard.sort(se);for(const e of t.wildcard)Y(e)}}function it(t){return{kind:yt,depth:0,pathless:null,index:null,static:null,staticInsensitive:null,dynamic:null,optional:null,wildcard:null,route:null,fullPath:t,parent:null,parse:null,skipOnParamError:!1,parsingPriority:0}}function ne(t,e,s,n,r){return{kind:t,depth:0,pathless:null,index:null,static:null,staticInsensitive:null,dynamic:null,optional:null,wildcard:null,route:null,fullPath:e,parent:null,parse:null,skipOnParamError:!1,parsingPriority:0,caseSensitive:s,prefix:n,suffix:r}}function dr(t,e){const s=it("/"),n=new Uint16Array(6);for(const r of t)Yt(!1,n,r,1,s,0);Y(s),e.masksTree=s,e.flatCache=zt(1e3)}function fr(t,e){t||="/";const s=e.flatCache.get(t);if(s)return s;const n=Ie(t,e.masksTree);return e.flatCache.set(t,n),n}function pr(t,e,s,n,r){t||="/",n||="/";const i=e?`case\0${t}`:t;let a=r.singleCache.get(i);if(!a){a=it("/");const o=new Uint16Array(6);Yt(e,o,{from:t},1,a,0),r.singleCache.set(i,a)}return Ie(n,a,s)}function mr(t,e,s=!1){const n=s?t:`nofuzz\0${t}`,r=e.matchCache.get(n);if(r!==void 0)return r;t||="/";let i;try{i=Ie(t,e.segmentTree,s)}catch(a){if(a instanceof URIError)i=null;else throw a}return i&&(i.branch=vr(i.route)),e.matchCache.set(n,i),i}function gr(t){return t==="/"?t:t.replace(/\/{1,}$/,"")}function yr(t,e=!1,s){const n=it(t.fullPath),r=new Uint16Array(6),i={},a={};let o=0;return Yt(e,r,t,1,n,0,u=>{if(s?.(u,o),G(!(u.id in i),`Duplicate routes found with id: ${String(u.id)}`),i[u.id]=u,o!==0&&u.path){const l=gr(u.fullPath);(!a[l]||u.fullPath.endsWith("/"))&&(a[l]=u)}o++}),Y(n),{processedTree:{segmentTree:n,singleCache:zt(1e3),matchCache:zt(1e3),flatCache:null,masksTree:null},routesById:i,routesByPath:a}}function Ie(t,e,s=!1){const n=t.split("/"),r=Sr(t,n,e,s);if(!r)return null;const[i]=Ws(t,n,r);return{route:r.node.route,rawParams:i,parsedParams:r.parsedParams}}function Ws(t,e,s){const n=Pr(s.node);let r=null;const i={};let a=s.extract?.part??0,o=s.extract?.node??0,c=s.extract?.path??0,u=s.extract?.segment??0;for(;o<n.length;a++,o++,c++,u++){const l=n[o];if(l.kind===rt)break;if(l.kind===Hs){u--,a--,c--;continue}const d=e[a],h=c;if(d&&(c+=d.length),l.kind===lt){r??=s.node.fullPath.split("/");const f=r[u],p=l.prefix?.length??0;if(f.charCodeAt(p)===123){const g=l.suffix?.length??0,P=f.substring(p+2,f.length-g-1),S=d.substring(p,d.length-g);i[P]=decodeURIComponent(S)}else{const g=f.substring(1);i[g]=decodeURIComponent(d)}}else if(l.kind===It){if(s.skipped&1<<o){a--,c=h-1;continue}r??=s.node.fullPath.split("/");const f=r[u],p=l.prefix?.length??0,m=l.suffix?.length??0,g=f.substring(p+3,f.length-m-1),P=l.suffix||l.prefix?d.substring(p,d.length-m):d;P&&(i[g]=decodeURIComponent(P))}else if(l.kind===ht){const f=l,p=t.substring(h+(f.prefix?.length??0),t.length-(f.suffix?.length??0)),m=decodeURIComponent(p);i["*"]=m,i._splat=m;break}}return s.rawParams&&Object.assign(i,s.rawParams),[i,{part:a,node:o,path:c,segment:u}]}function vr(t){const e=[t];for(;t.parentRoute;)t=t.parentRoute,e.push(t);return e.reverse(),e}function Pr(t){const e=Array(t.depth+1);do e[t.depth]=t,t=t.parent;while(t);return e}function Sr(t,e,s,n){if(t==="/"&&s.index)return{node:s.index,skipped:0};const r=!Et(e),i=r&&t!=="/",a=e.length-(r?1:0),o=[{node:s,index:1,skipped:0,depth:1,statics:1,dynamics:0,optionals:0}];let c=null,u=null,l=null;for(;o.length;){const d=o.pop(),{node:h,index:f,skipped:p,depth:m,statics:g,dynamics:P,optionals:S}=d;let{extract:w,rawParams:v,parsedParams:C}=d;if(h.skipOnParamError){if(!re(t,e,d))continue;v=d.rawParams,w=d.extract,C=d.parsedParams}n&&h.route&&h.kind!==rt&&bt(u,d)&&(u=d);const L=f===a;if(L&&(h.route&&!i&&bt(l,d)&&(l=d),!h.optional&&!h.wildcard&&!h.index&&!h.pathless))continue;const x=L?void 0:e[f];let y;if(L&&h.index){const R={node:h.index,index:f,skipped:p,depth:m+1,statics:g,dynamics:P,optionals:S,extract:w,rawParams:v,parsedParams:C};let M=!0;if(h.index.skipOnParamError&&(re(t,e,R)||(M=!1)),M){if(g===a&&!P&&!S&&!p)return R;bt(l,R)&&(l=R)}}if(h.wildcard&&bt(c,d))for(const R of h.wildcard){const{prefix:M,suffix:O}=R;if(M&&(L||!(R.caseSensitive?x:y??=x.toLowerCase()).startsWith(M)))continue;if(O){if(L)continue;const I=e.slice(f).join("/").slice(-O.length);if((R.caseSensitive?I:I.toLowerCase())!==O)continue}const E={node:R,index:a,skipped:p,depth:m,statics:g,dynamics:P,optionals:S,extract:w,rawParams:v,parsedParams:C};if(!(R.skipOnParamError&&!re(t,e,E))){c=E;break}}if(h.optional){const R=p|1<<m,M=m+1;for(let O=h.optional.length-1;O>=0;O--){const E=h.optional[O];o.push({node:E,index:f,skipped:R,depth:M,statics:g,dynamics:P,optionals:S,extract:w,rawParams:v,parsedParams:C})}if(!L)for(let O=h.optional.length-1;O>=0;O--){const E=h.optional[O],{prefix:I,suffix:k}=E;if(I||k){const J=E.caseSensitive?x:y??=x.toLowerCase();if(I&&!J.startsWith(I)||k&&!J.endsWith(k))continue}o.push({node:E,index:f+1,skipped:p,depth:M,statics:g,dynamics:P,optionals:S+1,extract:w,rawParams:v,parsedParams:C})}}if(!L&&h.dynamic&&x)for(let R=h.dynamic.length-1;R>=0;R--){const M=h.dynamic[R],{prefix:O,suffix:E}=M;if(O||E){const I=M.caseSensitive?x:y??=x.toLowerCase();if(O&&!I.startsWith(O)||E&&!I.endsWith(E))continue}o.push({node:M,index:f+1,skipped:p,depth:m+1,statics:g,dynamics:P+1,optionals:S,extract:w,rawParams:v,parsedParams:C})}if(!L&&h.staticInsensitive){const R=h.staticInsensitive.get(y??=x.toLowerCase());R&&o.push({node:R,index:f+1,skipped:p,depth:m+1,statics:g+1,dynamics:P,optionals:S,extract:w,rawParams:v,parsedParams:C})}if(!L&&h.static){const R=h.static.get(x);R&&o.push({node:R,index:f+1,skipped:p,depth:m+1,statics:g+1,dynamics:P,optionals:S,extract:w,rawParams:v,parsedParams:C})}if(h.pathless){const R=m+1;for(let M=h.pathless.length-1;M>=0;M--){const O=h.pathless[M];o.push({node:O,index:f,skipped:p,depth:R,statics:g,dynamics:P,optionals:S,extract:w,rawParams:v,parsedParams:C})}}}if(l&&c)return bt(c,l)?l:c;if(l)return l;if(c)return c;if(n&&u){let d=u.index;for(let f=0;f<u.index;f++)d+=e[f].length;const h=d===t.length?"/":t.slice(d);return u.rawParams??={},u.rawParams["**"]=decodeURIComponent(h),u}return null}function re(t,e,s){try{const[n,r]=Ws(t,e,s);s.rawParams=n,s.extract=r;const i=s.node.parse(n);return s.parsedParams=Object.assign({},s.parsedParams,i),!0}catch{return null}}function bt(t,e){return t?e.statics>t.statics||e.statics===t.statics&&(e.dynamics>t.dynamics||e.dynamics===t.dynamics&&(e.optionals>t.optionals||e.optionals===t.optionals&&((e.node.kind===rt)>(t.node.kind===rt)||e.node.kind===rt==(t.node.kind===rt)&&e.depth>t.depth))):!0}function Ut(t){return ke(t.filter(e=>e!==void 0).join("/"))}function ke(t){return t.replace(/\/{2,}/g,"/")}function zs(t){return t==="/"?t:t.replace(/^\/{1,}/,"")}function V(t){const e=t.length;return e>1&&t[e-1]==="/"?t.replace(/\/{1,}$/,""):t}function Vs(t){return V(zs(t))}function Vt(t,e){return t?.endsWith("/")&&t!=="/"&&t!==`${e}/`?t.slice(0,-1):t}function wr(t,e,s){return Vt(t,s)===Vt(e,s)}function Rr({base:t,to:e,trailingSlash:s="never",cache:n}){const r=e.startsWith("/"),i=!r&&e===".";let a;if(n){a=r?e:i?t:t+"\0"+e;const d=n.get(a);if(d)return d}let o;if(i)o=t.split("/");else if(r)o=e.split("/");else{for(o=t.split("/");o.length>1&&Et(o)==="";)o.pop();const d=e.split("/");for(let h=0,f=d.length;h<f;h++){const p=d[h];p===""?h?h===f-1&&o.push(p):o=[p]:p===".."?o.pop():p==="."||o.push(p)}}o.length>1&&(Et(o)===""?s==="never"&&o.pop():s==="always"&&o.push(""));let c,u="";for(let d=0;d<o.length;d++){d>0&&(u+="/");const h=o[d];if(!h)continue;c=Ee(h,0,c);const f=c[0];if(f===yt){u+=h;continue}const p=c[5],m=h.substring(0,c[1]),g=h.substring(c[4],p),P=h.substring(c[2],c[3]);f===lt?u+=m||g?`${m}{$${P}}${g}`:`$${P}`:f===ht?u+=m||g?`${m}{$}${g}`:"$":u+=`${m}{-$${P}}${g}`}u=ke(u);const l=u||"/";return a&&n&&n.set(a,l),l}function br(t){const e=new Map(t.map(r=>[encodeURIComponent(r),r])),s=Array.from(e.keys()).map(r=>r.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")).join("|"),n=new RegExp(s,"g");return r=>r.replace(n,i=>e.get(i)??i)}function ie(t,e,s){const n=e[t];return typeof n!="string"?n:t==="_splat"?/^[a-zA-Z0-9\-._~!/]*$/.test(n)?n:n.split("/").map(r=>ps(r,s)).join("/"):ps(n,s)}function oe({path:t,params:e,decoder:s,...n}){let r=!1;const i={};if(!t||t==="/")return{interpolatedPath:"/",usedParams:i,isMissingParams:r};if(!t.includes("$"))return{interpolatedPath:t,usedParams:i,isMissingParams:r};const a=t.length;let o=0,c,u="";for(;o<a;){const d=o;c=Ee(t,d,c);const h=c[5];if(o=h+1,d===h)continue;const f=c[0];if(f===yt){u+="/"+t.substring(d,h);continue}if(f===ht){const p=e._splat;i._splat=p,i["*"]=p;const m=t.substring(d,c[1]),g=t.substring(c[4],h);if(!p){r=!0,(m||g)&&(u+="/"+m+g);continue}const P=ie("_splat",e,s);u+="/"+m+P+g;continue}if(f===lt){const p=t.substring(c[2],c[3]);!r&&!(p in e)&&(r=!0),i[p]=e[p];const m=t.substring(d,c[1]),g=t.substring(c[4],h),P=ie(p,e,s)??"undefined";u+="/"+m+P+g;continue}if(f===It){const p=t.substring(c[2],c[3]),m=e[p];if(m==null)continue;i[p]=m;const g=t.substring(d,c[1]),P=t.substring(c[4],h),S=ie(p,e,s)??"";u+="/"+g+S+P;continue}}return t.endsWith("/")&&(u+="/"),{usedParams:i,interpolatedPath:u||"/",isMissingParams:r}}function ps(t,e){const s=encodeURIComponent(t);return e?.(s)??s}function U(t){return!!t?.isNotFound}function xr(){try{if(typeof window<"u"&&typeof window.sessionStorage=="object")return window.sessionStorage}catch{}}const Re="tsr-scroll-restoration-v1_3",_r=(t,e)=>{let s;return(...n)=>{s||(s=setTimeout(()=>{t(...n),s=null},e))}};function Cr(){const t=xr();if(!t)return null;const e=t.getItem(Re);let s=e?JSON.parse(e):{};return{state:s,set:n=>{s=X(n,s)||s;try{t.setItem(Re,JSON.stringify(s))}catch{console.warn("[ts-router] Could not persist scroll restoration state to sessionStorage.")}}}}const Dt=Cr(),Lr=t=>t.state.__TSR_key||t.href;function Mr(t){const e=[];let s;for(;s=t.parentNode;)e.push(`${t.tagName}:nth-child(${Array.prototype.indexOf.call(s.children,t)+1})`),t=s;return`${e.reverse().join(" > ")}`.toLowerCase()}let Gt=!1;function Or({storageKey:t,key:e,behavior:s,shouldScrollRestoration:n,scrollToTopSelectors:r,location:i}){let a;try{a=JSON.parse(sessionStorage.getItem(t)||"{}")}catch(u){console.error(u);return}const o=e||window.history.state?.__TSR_key,c=a[o];Gt=!0;t:{if(n&&c&&Object.keys(c).length>0){for(const d in c){const h=c[d];if(d==="window")window.scrollTo({top:h.scrollY,left:h.scrollX,behavior:s});else if(d){const f=document.querySelector(d);f&&(f.scrollLeft=h.scrollX,f.scrollTop=h.scrollY)}}break t}const u=(i??window.location).hash.split("#",2)[1];if(u){const d=window.history.state?.__hashScrollIntoViewOptions??!0;if(d){const h=document.getElementById(u);h&&h.scrollIntoView(d)}break t}const l={top:0,left:0,behavior:s};if(window.scrollTo(l),r)for(const d of r){if(d==="window")continue;const h=typeof d=="function"?d():document.querySelector(d);h&&h.scrollTo(l)}}Gt=!1}function Er(t,e){if(!Dt||((t.options.scrollRestoration??!1)&&(t.isScrollRestoring=!0),t.isScrollRestorationSetup||!Dt))return;t.isScrollRestorationSetup=!0,Gt=!1;const n=t.options.getScrollRestorationKey||Lr;window.history.scrollRestoration="manual";const r=i=>{if(Gt||!t.isScrollRestoring)return;let a="";if(i.target===document||i.target===window)a="window";else{const c=i.target.getAttribute("data-scroll-restoration-id");c?a=`[data-scroll-restoration-id="${c}"]`:a=Mr(i.target)}const o=n(t.state.location);Dt.set(c=>{const u=c[o]||={},l=u[a]||={};if(a==="window")l.scrollX=window.scrollX||0,l.scrollY=window.scrollY||0;else if(a){const d=document.querySelector(a);d&&(l.scrollX=d.scrollLeft||0,l.scrollY=d.scrollTop||0)}return c})};typeof document<"u"&&document.addEventListener("scroll",_r(r,100),!0),t.subscribe("onRendered",i=>{const a=n(i.toLocation);if(!t.resetNextScroll){t.resetNextScroll=!0;return}typeof t.options.scrollRestoration=="function"&&!t.options.scrollRestoration({location:t.latestLocation})||(Or({storageKey:Re,key:a,behavior:t.options.scrollRestorationBehavior,shouldScrollRestoration:t.isScrollRestoring,scrollToTopSelectors:t.options.scrollToTopSelectors,location:t.history.location}),t.isScrollRestoring&&Dt.set(o=>(o[a]||={},o)))})}function Ir(t){if(typeof document<"u"&&document.querySelector){const e=t.state.location.state.__hashScrollIntoViewOptions??!0;if(e&&t.state.location.hash!==""){const s=document.getElementById(t.state.location.hash);s&&s.scrollIntoView(e)}}}function kr(t,e=String){const s=new URLSearchParams;for(const n in t){const r=t[n];r!==void 0&&s.set(n,e(r))}return s.toString()}function ae(t){return t?t==="false"?!1:t==="true"?!0:+t*0===0&&+t+""===t?+t:t:""}function Tr(t){const e=new URLSearchParams(t),s={};for(const[n,r]of e.entries()){const i=s[n];i==null?s[n]=ae(r):Array.isArray(i)?i.push(ae(r)):s[n]=[i,ae(r)]}return s}const Fr=Dr(JSON.parse),Ar=jr(JSON.stringify,JSON.parse);function Dr(t){return e=>{e[0]==="?"&&(e=e.substring(1));const s=Tr(e);for(const n in s){const r=s[n];if(typeof r=="string")try{s[n]=t(r)}catch{}}return s}}function jr(t,e){const s=typeof e=="function";function n(r){if(typeof r=="object"&&r!==null)try{return t(r)}catch{}else if(s&&typeof r=="string")try{return e(r),t(r)}catch{}return r}return r=>{const i=kr(r,n);return i?`?${i}`:""}}const N="__root__";function Ur(t){if(t.statusCode=t.statusCode||t.code||307,!t._builtLocation&&typeof t.href=="string"&&Wt(t.href))throw new Error(`Redirect blocked: unsafe protocol in href "${t.href}". Only ${qs.join(", ")} protocols are allowed.`);if(!t._builtLocation&&!t.reloadDocument&&typeof t.href=="string")try{new URL(t.href),t.reloadDocument=!0}catch{}const e=new Headers(t.headers);t.href&&e.get("Location")===null&&e.set("Location",t.href);const s=new Response(null,{status:t.statusCode,headers:e});if(s.options=t,t.throw)throw s;return s}function Q(t){return t instanceof Response&&!!t.options}const Bt=t=>{if(!t.rendered)return t.rendered=!0,t.onReady?.()},Xt=(t,e)=>!!(t.preload&&!t.router.state.matches.some(s=>s.id===e)),mt=(t,e,s=!0)=>{const n={...t.router.options.context??{}},r=s?e:e-1;for(let i=0;i<=r;i++){const a=t.matches[i];if(!a)continue;const o=t.router.getMatch(a.id);o&&Object.assign(n,o.__routeContext,o.__beforeLoadContext)}return n},Gs=(t,e)=>{const s=t.router.routesById[e.routeId??""]??t.router.routeTree;!s.options.notFoundComponent&&t.router.options?.defaultNotFoundComponent&&(s.options.notFoundComponent=t.router.options.defaultNotFoundComponent),G(s.options.notFoundComponent);const n=t.matches.find(r=>r.routeId===s.id);G(n,"Could not find match for route: "+s.id),t.updateMatch(n.id,r=>({...r,status:"notFound",error:e,isFetching:!1})),e.routerCode==="BEFORE_LOAD"&&s.parentRoute&&(e.routeId=s.parentRoute.id,Gs(t,e))},Z=(t,e,s)=>{if(!(!Q(s)&&!U(s))){if(Q(s)&&s.redirectHandled&&!s.options.reloadDocument)throw s;if(e){e._nonReactive.beforeLoadPromise?.resolve(),e._nonReactive.loaderPromise?.resolve(),e._nonReactive.beforeLoadPromise=void 0,e._nonReactive.loaderPromise=void 0;const n=Q(s)?"redirected":"notFound";e._nonReactive.error=s,t.updateMatch(e.id,r=>({...r,status:n,context:mt(t,e.index),isFetching:!1,error:s})),U(s)&&!s.routeId&&(s.routeId=e.routeId),e._nonReactive.loadPromise?.resolve()}throw Q(s)?(t.rendered=!0,s.options._fromLocation=t.location,s.redirectHandled=!0,s=t.router.resolveRedirect(s),s):(Gs(t,s),s)}},Js=(t,e)=>!!t.router.getMatch(e)._nonReactive.dehydrated,xt=(t,e,s,n)=>{const{id:r,routeId:i}=t.matches[e],a=t.router.looseRoutesById[i];if(s instanceof Promise)throw s;s.routerCode=n,t.firstBadMatchIndex??=e,Z(t,t.router.getMatch(r),s);try{a.options.onError?.(s)}catch(o){s=o,Z(t,t.router.getMatch(r),s)}t.updateMatch(r,o=>(o._nonReactive.beforeLoadPromise?.resolve(),o._nonReactive.beforeLoadPromise=void 0,o._nonReactive.loadPromise?.resolve(),{...o,error:s,status:"error",isFetching:!1,updatedAt:Date.now(),abortController:new AbortController}))},Ys=(t,e,s,n)=>{if(n._nonReactive.pendingTimeout!==void 0)return;const r=s.options.pendingMs??t.router.options.defaultPendingMs;if(!!(t.onReady&&!Xt(t,e)&&(s.options.loader||s.options.beforeLoad||tn(s))&&typeof r=="number"&&r!==1/0&&(s.options.pendingComponent??t.router.options?.defaultPendingComponent))){const a=setTimeout(()=>{Bt(t)},r);n._nonReactive.pendingTimeout=a}},Br=(t,e,s)=>{const n=t.router.getMatch(e);if(!n._nonReactive.beforeLoadPromise&&!n._nonReactive.loaderPromise)return;Ys(t,e,s,n);const r=()=>{const i=t.router.getMatch(e);i.preload&&(i.status==="redirected"||i.status==="notFound")&&Z(t,i,i.error)};return n._nonReactive.beforeLoadPromise?n._nonReactive.beforeLoadPromise.then(r):r()},Nr=(t,e,s,n)=>{const r=t.router.getMatch(e),i=r._nonReactive.loadPromise;r._nonReactive.loadPromise=gt(()=>{i?.resolve()});const{paramsError:a,searchError:o}=r;a&&xt(t,s,a,"PARSE_PARAMS"),o&&xt(t,s,o,"VALIDATE_SEARCH"),Ys(t,e,n,r);const c=new AbortController;let u=!1;const l=()=>{u||(u=!0,t.updateMatch(e,v=>({...v,isFetching:"beforeLoad",fetchCount:v.fetchCount+1,abortController:c})))},d=()=>{r._nonReactive.beforeLoadPromise?.resolve(),r._nonReactive.beforeLoadPromise=void 0,t.updateMatch(e,v=>({...v,isFetching:!1}))};if(!n.options.beforeLoad){Lt(()=>{l(),d()});return}r._nonReactive.beforeLoadPromise=gt();const h={...mt(t,s,!1),...r.__routeContext},{search:f,params:p,cause:m}=r,g=Xt(t,e),P={search:f,abortController:c,params:p,preload:g,context:h,location:t.location,navigate:v=>t.router.navigate({...v,_fromLocation:t.location}),buildLocation:t.router.buildLocation,cause:g?"preload":m,matches:t.matches,routeId:n.id,...t.router.options.additionalContext},S=v=>{if(v===void 0){Lt(()=>{l(),d()});return}(Q(v)||U(v))&&(l(),xt(t,s,v,"BEFORE_LOAD")),Lt(()=>{l(),t.updateMatch(e,C=>({...C,__beforeLoadContext:v})),d()})};let w;try{if(w=n.options.beforeLoad(P),pt(w))return l(),w.catch(v=>{xt(t,s,v,"BEFORE_LOAD")}).then(S)}catch(v){l(),xt(t,s,v,"BEFORE_LOAD")}S(w)},Qr=(t,e)=>{const{id:s,routeId:n}=t.matches[e],r=t.router.looseRoutesById[n],i=()=>o(),a=()=>Nr(t,s,e,r),o=()=>{if(Js(t,s))return;const c=Br(t,s,r);return pt(c)?c.then(a):a()};return i()},Kr=(t,e,s)=>{const n=t.router.getMatch(e);if(!n||!s.options.head&&!s.options.scripts&&!s.options.headers)return;const r={ssr:t.router.options.ssr,matches:t.matches,match:n,params:n.params,loaderData:n.loaderData};return Promise.all([s.options.head?.(r),s.options.scripts?.(r),s.options.headers?.(r)]).then(([i,a,o])=>{const c=i?.meta,u=i?.links,l=i?.scripts,d=i?.styles;return{meta:c,links:u,headScripts:l,headers:o,scripts:a,styles:d}})},Xs=(t,e,s,n)=>{const r=t.matchPromises[s-1],{params:i,loaderDeps:a,abortController:o,cause:c}=t.router.getMatch(e),u=mt(t,s),l=Xt(t,e);return{params:i,deps:a,preload:!!l,parentMatchPromise:r,abortController:o,context:u,location:t.location,navigate:d=>t.router.navigate({...d,_fromLocation:t.location}),cause:l?"preload":c,route:n,...t.router.options.additionalContext}},ms=async(t,e,s,n)=>{try{const r=t.router.getMatch(e);try{(!(ir??t.router.isServer)||r.ssr===!0)&&Zs(n);const i=n.options.loader?.(Xs(t,e,s,n)),a=n.options.loader&&pt(i);if((a||n._lazyPromise||n._componentsPromise||n.options.head||n.options.scripts||n.options.headers||r._nonReactive.minPendingPromise)&&t.updateMatch(e,u=>({...u,isFetching:"loader"})),n.options.loader){const u=a?await i:i;Z(t,t.router.getMatch(e),u),u!==void 0&&t.updateMatch(e,l=>({...l,loaderData:u}))}n._lazyPromise&&await n._lazyPromise;const c=r._nonReactive.minPendingPromise;c&&await c,n._componentsPromise&&await n._componentsPromise,t.updateMatch(e,u=>({...u,error:void 0,context:mt(t,s),status:"success",isFetching:!1,updatedAt:Date.now()}))}catch(i){let a=i;if(a?.name==="AbortError"){if(r.abortController.signal.aborted){r._nonReactive.loaderPromise?.resolve(),r._nonReactive.loaderPromise=void 0;return}t.updateMatch(e,c=>({...c,status:c.status==="pending"?"success":c.status,isFetching:!1,context:mt(t,s)}));return}const o=r._nonReactive.minPendingPromise;o&&await o,U(i)&&await n.options.notFoundComponent?.preload?.(),Z(t,t.router.getMatch(e),i);try{n.options.onError?.(i)}catch(c){a=c,Z(t,t.router.getMatch(e),c)}t.updateMatch(e,c=>({...c,error:a,context:mt(t,s),status:"error",isFetching:!1}))}}catch(r){const i=t.router.getMatch(e);i&&(i._nonReactive.loaderPromise=void 0),Z(t,i,r)}},$r=async(t,e)=>{async function s(l,d,h,f){const p=Date.now()-d.updatedAt,m=l?f.options.preloadStaleTime??t.router.options.defaultPreloadStaleTime??3e4:f.options.staleTime??t.router.options.defaultStaleTime??0,g=f.options.shouldReload,P=typeof g=="function"?g(Xs(t,n,e,f)):g,{status:S,invalid:w}=h;i=S==="success"&&(w||(P??p>m)),l&&f.options.preload===!1||(i&&!t.sync?(a=!0,(async()=>{try{await ms(t,n,e,f);const v=t.router.getMatch(n);v._nonReactive.loaderPromise?.resolve(),v._nonReactive.loadPromise?.resolve(),v._nonReactive.loaderPromise=void 0}catch(v){Q(v)&&await t.router.navigate(v.options)}})()):(S!=="success"||i&&t.sync)&&await ms(t,n,e,f))}const{id:n,routeId:r}=t.matches[e];let i=!1,a=!1;const o=t.router.looseRoutesById[r];if(!Js(t,n)){const l=t.router.getMatch(n),d=Xt(t,n);if(l._nonReactive.loaderPromise){if(l.status==="success"&&!t.sync&&!l.preload)return l;await l._nonReactive.loaderPromise;const h=t.router.getMatch(n),f=h._nonReactive.error||h.error;f&&Z(t,h,f),h.status==="pending"&&await s(d,l,h,o)}else{const h=d&&!t.router.state.matches.some(p=>p.id===n),f=t.router.getMatch(n);f._nonReactive.loaderPromise=gt(),h!==f.preload&&t.updateMatch(n,p=>({...p,preload:h})),await s(d,l,f,o)}}const c=t.router.getMatch(n);a||(c._nonReactive.loaderPromise?.resolve(),c._nonReactive.loadPromise?.resolve()),clearTimeout(c._nonReactive.pendingTimeout),c._nonReactive.pendingTimeout=void 0,a||(c._nonReactive.loaderPromise=void 0),c._nonReactive.dehydrated=void 0;const u=a?c.isFetching:!1;return u!==c.isFetching||c.invalid!==!1?(t.updateMatch(n,l=>({...l,isFetching:u,invalid:!1})),t.router.getMatch(n)):c};async function gs(t){const e=Object.assign(t,{matchPromises:[]});e.router.state.matches.some(s=>s._forcePending)&&Bt(e);try{for(let o=0;o<e.matches.length;o++){const c=Qr(e,o);pt(c)&&await c}const s=e.firstBadMatchIndex??e.matches.length;for(let o=0;o<s;o++)e.matchPromises.push($r(e,o));const r=(await Promise.allSettled(e.matchPromises)).filter(o=>o.status==="rejected").map(o=>o.reason);let i;for(const o of r){if(Q(o))throw o;!i&&U(o)&&(i=o)}for(const o of e.matches){const{id:c,routeId:u}=o,l=e.router.looseRoutesById[u];try{const d=Kr(e,c,l);if(d){const h=await d;e.updateMatch(c,f=>({...f,...h}))}}catch(d){console.error(`Error executing head for route ${u}:`,d)}}if(i)throw i;const a=Bt(e);pt(a)&&await a}catch(s){if(U(s)&&!e.preload){const n=Bt(e);throw pt(n)&&await n,s}if(Q(s))throw s}return e.matches}async function Zs(t){if(!t._lazyLoaded&&t._lazyPromise===void 0&&(t.lazyFn?t._lazyPromise=t.lazyFn().then(e=>{const{id:s,...n}=e.options;Object.assign(t.options,n),t._lazyLoaded=!0,t._lazyPromise=void 0}):t._lazyLoaded=!0),!t._componentsLoaded&&t._componentsPromise===void 0){const e=()=>{const s=[];for(const n of en){const r=t.options[n]?.preload;r&&s.push(r())}if(s.length)return Promise.all(s).then(()=>{t._componentsLoaded=!0,t._componentsPromise=void 0});t._componentsLoaded=!0,t._componentsPromise=void 0};t._componentsPromise=t._lazyPromise?t._lazyPromise.then(e):e()}return t._componentsPromise}function tn(t){for(const e of en)if(t.options[e]?.preload)return!0;return!1}const en=["component","errorComponent","pendingComponent","notFoundComponent"];function qr(t){return{input:({url:e})=>{for(const s of t)e=be(s,e);return e},output:({url:e})=>{for(let s=t.length-1;s>=0;s--)e=sn(t[s],e);return e}}}function Hr(t){const e=Vs(t.basepath),s=`/${e}`,n=`${s}/`,r=t.caseSensitive?s:s.toLowerCase(),i=t.caseSensitive?n:n.toLowerCase();return{input:({url:a})=>{const o=t.caseSensitive?a.pathname:a.pathname.toLowerCase();return o===r?a.pathname="/":o.startsWith(i)&&(a.pathname=a.pathname.slice(s.length)),a},output:({url:a})=>(a.pathname=Ut(["/",e,a.pathname]),a)}}function be(t,e){const s=t?.input?.({url:e});if(s){if(typeof s=="string")return new URL(s);if(s instanceof URL)return s}return e}function sn(t,e){const s=t?.output?.({url:e});if(s){if(typeof s=="string")return new URL(s);if(s instanceof URL)return s}return e}function at(t){const e=t.resolvedLocation,s=t.location,n=e?.pathname!==s.pathname,r=e?.href!==s.href,i=e?.hash!==s.hash;return{fromLocation:e,toLocation:s,pathChanged:n,hrefChanged:r,hashChanged:i}}class Wr{constructor(e){this.tempLocationKey=`${Math.round(Math.random()*1e7)}`,this.resetNextScroll=!0,this.shouldViewTransition=void 0,this.isViewTransitionTypesSupported=void 0,this.subscribers=new Set,this.isScrollRestoring=!1,this.isScrollRestorationSetup=!1,this.startTransition=s=>s(),this.update=s=>{s.notFoundRoute&&console.warn("The notFoundRoute API is deprecated and will be removed in the next major version. See https://tanstack.com/router/v1/docs/framework/react/guide/not-found-errors#migrating-from-notfoundroute for more info.");const n=this.options,r=this.basepath??n?.basepath??"/",i=this.basepath===void 0,a=n?.rewrite;if(this.options={...n,...s},this.isServer=this.options.isServer??typeof document>"u",this.options.pathParamsAllowedCharacters&&(this.pathParamsDecoder=br(this.options.pathParamsAllowedCharacters)),(!this.history||this.options.history&&this.options.history!==this.history)&&(this.options.history?this.history=this.options.history:this.history=nr()),this.origin=this.options.origin,this.origin||(window?.origin&&window.origin!=="null"?this.origin=window.origin:this.origin="http://localhost"),this.history&&this.updateLatestLocation(),this.options.routeTree!==this.routeTree){this.routeTree=this.options.routeTree;let h;this.resolvePathCache=zt(1e3),h=this.buildRouteTree(),this.setRoutes(h)}!this.__store&&this.latestLocation&&(this.__store=new er(Vr(this.latestLocation),{onUpdate:()=>{this.__store.state={...this.state,cachedMatches:this.state.cachedMatches.filter(h=>!["redirected"].includes(h.status))}}}),Er(this));let o=!1;const c=this.options.basepath??"/",u=this.options.rewrite;if(i||r!==c||a!==u){this.basepath=c;const h=[],f=Vs(c);f&&f!=="/"&&h.push(Hr({basepath:c})),u&&h.push(u),this.rewrite=h.length===0?void 0:h.length===1?h[0]:qr(h),this.history&&this.updateLatestLocation(),o=!0}o&&this.__store&&(this.__store.state={...this.state,location:this.latestLocation}),typeof window<"u"&&"CSS"in window&&typeof window.CSS?.supports=="function"&&(this.isViewTransitionTypesSupported=window.CSS.supports("selector(:active-view-transition-type(a)"))},this.updateLatestLocation=()=>{this.latestLocation=this.parseLocation(this.history.location,this.latestLocation)},this.buildRouteTree=()=>{const s=yr(this.routeTree,this.options.caseSensitive,(n,r)=>{n.init({originalIndex:r})});return this.options.routeMasks&&dr(this.options.routeMasks,s.processedTree),s},this.subscribe=(s,n)=>{const r={eventType:s,fn:n};return this.subscribers.add(r),()=>{this.subscribers.delete(r)}},this.emit=s=>{this.subscribers.forEach(n=>{n.eventType===s.type&&n.fn(s)})},this.parseLocation=(s,n)=>{const r=({pathname:c,search:u,hash:l,href:d,state:h})=>{if(!this.rewrite&&!/[ \x00-\x1f\x7f\u0080-\uffff]/.test(c)){const S=this.options.parseSearch(u),w=this.options.stringifySearch(S);return{href:c+w+l,publicHref:d,pathname:Rt(c).path,external:!1,searchStr:w,search:j(n?.search,S),hash:Rt(l.slice(1)).path,state:j(n?.state,h)}}const f=new URL(d,this.origin),p=be(this.rewrite,f),m=this.options.parseSearch(p.search),g=this.options.stringifySearch(m);return p.search=g,{href:p.href.replace(p.origin,""),publicHref:d,pathname:Rt(p.pathname).path,external:!!this.rewrite&&p.origin!==this.origin,searchStr:g,search:j(n?.search,m),hash:Rt(p.hash.slice(1)).path,state:j(n?.state,h)}},i=r(s),{__tempLocation:a,__tempKey:o}=i.state;if(a&&(!o||o===this.tempLocationKey)){const c=r(a);return c.state.key=i.state.key,c.state.__TSR_key=i.state.__TSR_key,delete c.state.__tempLocation,{...c,maskedLocation:i}}return i},this.resolvePathWithBase=(s,n)=>Rr({base:s,to:ke(n),trailingSlash:this.options.trailingSlash,cache:this.resolvePathCache}),this.matchRoutes=(s,n,r)=>typeof s=="string"?this.matchRoutesInternal({pathname:s,search:n},r):this.matchRoutesInternal(s,n),this.getMatchedRoutes=s=>Gr({pathname:s,routesById:this.routesById,processedTree:this.processedTree}),this.cancelMatch=s=>{const n=this.getMatch(s);n&&(n.abortController.abort(),clearTimeout(n._nonReactive.pendingTimeout),n._nonReactive.pendingTimeout=void 0)},this.cancelMatches=()=>{const s=this.state.matches.filter(i=>i.status==="pending"),n=this.state.matches.filter(i=>i.isFetching==="loader");new Set([...this.state.pendingMatches??[],...s,...n]).forEach(i=>{this.cancelMatch(i.id)})},this.buildLocation=s=>{const n=(i={})=>{const a=i._fromLocation||this.pendingBuiltLocation||this.latestLocation,o=this.matchRoutesLightweight(a);i.from;const c=i.unsafeRelative==="path"?a.pathname:i.from??o.fullPath,u=this.resolvePathWithBase(c,"."),l=o.search,d={...o.params},h=i.to?this.resolvePathWithBase(u,`${i.to}`):this.resolvePathWithBase(u,"."),f=i.params===!1||i.params===null?{}:(i.params??!0)===!0?d:Object.assign(d,X(i.params,d)),p=oe({path:h,params:f,decoder:this.pathParamsDecoder,server:this.isServer}).interpolatedPath,m=this.getMatchedRoutes(p);let g=m.matchedRoutes;(m.foundRoute?m.foundRoute.path!=="/"&&m.routeParams["**"]:V(p))&&this.options.notFoundRoute&&(g=[...g,this.options.notFoundRoute]);let S=!1;if(Object.keys(f).length>0)for(const I of g){const k=I.options.params?.stringify??I.options.stringifyParams;k&&(S=!0,Object.assign(f,k(f)))}const w=s.leaveParams?h:Rt(S?oe({path:h,params:f,decoder:this.pathParamsDecoder,server:this.isServer}).interpolatedPath:p).path;let v=l;if(s._includeValidateSearch&&this.options.search?.strict){const I={};g.forEach(k=>{if(k.options.validateSearch)try{Object.assign(I,Nt(k.options.validateSearch,{...I,...v}))}catch{}}),v=I}v=Jr({search:v,dest:i,destRoutes:g,_includeValidateSearch:s._includeValidateSearch}),v=j(l,v);const C=this.options.stringifySearch(v),L=i.hash===!0?a.hash:i.hash?X(i.hash,a.hash):void 0,x=L?`#${L}`:"";let y=i.state===!0?a.state:i.state?X(i.state,a.state):{};y=j(a.state,y);const R=`${w}${C}${x}`;let M,O,E=!1;if(this.rewrite){const I=new URL(R,this.origin),k=sn(this.rewrite,I);M=I.href.replace(I.origin,""),k.origin!==this.origin?(O=k.href,E=!0):O=k.pathname+k.search+k.hash}else M=ur(R),O=M;return{publicHref:O,href:M,pathname:w,search:v,searchStr:C,state:y,hash:L??"",external:E,unmaskOnReload:i.unmaskOnReload}},r=(i={},a)=>{const o=n(i);let c=a?n(a):void 0;if(!c){const u={};if(this.options.routeMasks){const l=fr(o.pathname,this.processedTree);if(l){Object.assign(u,l.rawParams);const{from:d,params:h,...f}=l.route,p=h===!1||h===null?{}:(h??!0)===!0?u:Object.assign(u,X(h,u));a={from:s.from,...f,params:p},c=n(a)}}}return c&&(o.maskedLocation=c),o};return s.mask?r(s,{from:s.from,...s.mask}):r(s)},this.commitLocation=async({viewTransition:s,ignoreBlocker:n,...r})=>{const i=()=>{const c=["key","__TSR_key","__TSR_index","__hashScrollIntoViewOptions"];c.forEach(l=>{r.state[l]=this.latestLocation.state[l]});const u=ot(r.state,this.latestLocation.state);return c.forEach(l=>{delete r.state[l]}),u},a=V(this.latestLocation.href)===V(r.href),o=this.commitLocationPromise;if(this.commitLocationPromise=gt(()=>{o?.resolve()}),a&&i())this.load();else{let{maskedLocation:c,hashScrollIntoView:u,...l}=r;c&&(l={...c,state:{...c.state,__tempKey:void 0,__tempLocation:{...l,search:l.searchStr,state:{...l.state,__tempKey:void 0,__tempLocation:void 0,__TSR_key:void 0,key:void 0}}}},(l.unmaskOnReload??this.options.unmaskOnReload??!1)&&(l.state.__tempKey=this.tempLocationKey)),l.state.__hashScrollIntoViewOptions=u??this.options.defaultHashScrollIntoView??!0,this.shouldViewTransition=s,this.history[r.replace?"replace":"push"](l.publicHref,l.state,{ignoreBlocker:n})}return this.resetNextScroll=r.resetScroll??!0,this.history.subscribers.size||this.load(),this.commitLocationPromise},this.buildAndCommitLocation=({replace:s,resetScroll:n,hashScrollIntoView:r,viewTransition:i,ignoreBlocker:a,href:o,...c}={})=>{if(o){const d=this.history.location.state.__TSR_index,h=qt(o,{__TSR_index:s?d:d+1}),f=new URL(h.pathname,this.origin),p=be(this.rewrite,f);c.to=p.pathname,c.search=this.options.parseSearch(h.search),c.hash=h.hash.slice(1)}const u=this.buildLocation({...c,_includeValidateSearch:!0});this.pendingBuiltLocation=u;const l=this.commitLocation({...u,viewTransition:i,replace:s,resetScroll:n,hashScrollIntoView:r,ignoreBlocker:a});return Promise.resolve().then(()=>{this.pendingBuiltLocation===u&&(this.pendingBuiltLocation=void 0)}),l},this.navigate=async({to:s,reloadDocument:n,href:r,publicHref:i,...a})=>{let o=!1;if(r)try{new URL(`${r}`),o=!0}catch{}if(o&&!n&&(n=!0),n){if(s!==void 0||!r){const u=this.buildLocation({to:s,...a});r=r??u.publicHref,i=i??u.publicHref}const c=!o&&i?i:r;if(Wt(c))return Promise.resolve();if(!a.ignoreBlocker){const l=this.history.getBlockers?.()??[];for(const d of l)if(d?.blockerFn&&await d.blockerFn({currentLocation:this.latestLocation,nextLocation:this.latestLocation,action:"PUSH"}))return Promise.resolve()}return a.replace?window.location.replace(c):window.location.href=c,Promise.resolve()}return this.buildAndCommitLocation({...a,href:r,to:s,_isNavigate:!0})},this.beforeLoad=()=>{this.cancelMatches(),this.updateLatestLocation();const s=this.matchRoutes(this.latestLocation);this.__store.setState(n=>({...n,status:"pending",statusCode:200,isLoading:!0,location:this.latestLocation,pendingMatches:s,cachedMatches:n.cachedMatches.filter(r=>!s.some(i=>i.id===r.id))}))},this.load=async s=>{let n,r,i;for(i=new Promise(o=>{this.startTransition(async()=>{try{this.beforeLoad();const c=this.latestLocation,u=this.state.resolvedLocation;this.state.redirect||this.emit({type:"onBeforeNavigate",...at({resolvedLocation:u,location:c})}),this.emit({type:"onBeforeLoad",...at({resolvedLocation:u,location:c})}),await gs({router:this,sync:s?.sync,matches:this.state.pendingMatches,location:c,updateMatch:this.updateMatch,onReady:async()=>{this.startTransition(()=>{this.startViewTransition(async()=>{let l=[],d=[],h=[];Lt(()=>{this.__store.setState(f=>{const p=f.matches,m=f.pendingMatches||f.matches;return l=p.filter(g=>!m.some(P=>P.id===g.id)),d=m.filter(g=>!p.some(P=>P.id===g.id)),h=m.filter(g=>p.some(P=>P.id===g.id)),{...f,isLoading:!1,loadedAt:Date.now(),matches:m,pendingMatches:void 0,cachedMatches:[...f.cachedMatches,...l.filter(g=>g.status!=="error"&&g.status!=="notFound")]}}),this.clearExpiredCache()}),[[l,"onLeave"],[d,"onEnter"],[h,"onStay"]].forEach(([f,p])=>{f.forEach(m=>{this.looseRoutesById[m.routeId].options[p]?.(m)})})})})}})}catch(c){Q(c)?(n=c,this.navigate({...n.options,replace:!0,ignoreBlocker:!0})):U(c)&&(r=c),this.__store.setState(u=>({...u,statusCode:n?n.status:r?404:u.matches.some(l=>l.status==="error")?500:200,redirect:n}))}this.latestLoadPromise===i&&(this.commitLocationPromise?.resolve(),this.latestLoadPromise=void 0,this.commitLocationPromise=void 0),o()})}),this.latestLoadPromise=i,await i;this.latestLoadPromise&&i!==this.latestLoadPromise;)await this.latestLoadPromise;let a;this.hasNotFoundMatch()?a=404:this.__store.state.matches.some(o=>o.status==="error")&&(a=500),a!==void 0&&this.__store.setState(o=>({...o,statusCode:a}))},this.startViewTransition=s=>{const n=this.shouldViewTransition??this.options.defaultViewTransition;if(this.shouldViewTransition=void 0,n&&typeof document<"u"&&"startViewTransition"in document&&typeof document.startViewTransition=="function"){let r;if(typeof n=="object"&&this.isViewTransitionTypesSupported){const i=this.latestLocation,a=this.state.resolvedLocation,o=typeof n.types=="function"?n.types(at({resolvedLocation:a,location:i})):n.types;if(o===!1){s();return}r={update:s,types:o}}else r=s;document.startViewTransition(r)}else s()},this.updateMatch=(s,n)=>{this.startTransition(()=>{const r=this.state.pendingMatches?.some(i=>i.id===s)?"pendingMatches":this.state.matches.some(i=>i.id===s)?"matches":this.state.cachedMatches.some(i=>i.id===s)?"cachedMatches":"";r&&this.__store.setState(i=>({...i,[r]:i[r]?.map(a=>a.id===s?n(a):a)}))})},this.getMatch=s=>{const n=r=>r.id===s;return this.state.cachedMatches.find(n)??this.state.pendingMatches?.find(n)??this.state.matches.find(n)},this.invalidate=s=>{const n=r=>s?.filter?.(r)??!0?{...r,invalid:!0,...s?.forcePending||r.status==="error"||r.status==="notFound"?{status:"pending",error:void 0}:void 0}:r;return this.__store.setState(r=>({...r,matches:r.matches.map(n),cachedMatches:r.cachedMatches.map(n),pendingMatches:r.pendingMatches?.map(n)})),this.shouldViewTransition=!1,this.load({sync:s?.sync})},this.getParsedLocationHref=s=>s.publicHref||"/",this.resolveRedirect=s=>{const n=s.headers.get("Location");if(!s.options.href||s.options._builtLocation){const r=s.options._builtLocation??this.buildLocation(s.options),i=this.getParsedLocationHref(r);s.options.href=i,s.headers.set("Location",i)}else if(n)try{const r=new URL(n);if(this.origin&&r.origin===this.origin){const i=r.pathname+r.search+r.hash;s.options.href=i,s.headers.set("Location",i)}}catch{}return s.headers.get("Location")||s.headers.set("Location",s.options.href),s},this.clearCache=s=>{const n=s?.filter;n!==void 0?this.__store.setState(r=>({...r,cachedMatches:r.cachedMatches.filter(i=>!n(i))})):this.__store.setState(r=>({...r,cachedMatches:[]}))},this.clearExpiredCache=()=>{const s=n=>{const r=this.looseRoutesById[n.routeId];if(!r.options.loader)return!0;const i=(n.preload?r.options.preloadGcTime??this.options.defaultPreloadGcTime:r.options.gcTime??this.options.defaultGcTime)??300*1e3;return n.status==="error"?!0:Date.now()-n.updatedAt>=i};this.clearCache({filter:s})},this.loadRouteChunk=Zs,this.preloadRoute=async s=>{const n=this.buildLocation(s);let r=this.matchRoutes(n,{throwOnError:!0,preload:!0,dest:s});const i=new Set([...this.state.matches,...this.state.pendingMatches??[]].map(o=>o.id)),a=new Set([...i,...this.state.cachedMatches.map(o=>o.id)]);Lt(()=>{r.forEach(o=>{a.has(o.id)||this.__store.setState(c=>({...c,cachedMatches:[...c.cachedMatches,o]}))})});try{return r=await gs({router:this,matches:r,location:n,preload:!0,updateMatch:(o,c)=>{i.has(o)?r=r.map(u=>u.id===o?c(u):u):this.updateMatch(o,c)}}),r}catch(o){if(Q(o))return o.options.reloadDocument?void 0:await this.preloadRoute({...o.options,_fromLocation:n});U(o)||console.error(o);return}},this.matchRoute=(s,n)=>{const r={...s,to:s.to?this.resolvePathWithBase(s.from||"",s.to):void 0,params:s.params||{},leaveParams:!0},i=this.buildLocation(r);if(n?.pending&&this.state.status!=="pending")return!1;const o=(n?.pending===void 0?!this.state.isLoading:n.pending)?this.latestLocation:this.state.resolvedLocation||this.state.location,c=pr(i.pathname,n?.caseSensitive??!1,n?.fuzzy??!1,o.pathname,this.processedTree);return!c||s.params&&!ot(c.rawParams,s.params,{partial:!0})?!1:n?.includeSearch??!0?ot(o.search,i.search,{partial:!0})?c.rawParams:!1:c.rawParams},this.hasNotFoundMatch=()=>this.__store.state.matches.some(s=>s.status==="notFound"||s.globalNotFound),this.update({defaultPreloadDelay:50,defaultPendingMs:1e3,defaultPendingMinMs:500,context:void 0,...e,caseSensitive:e.caseSensitive??!1,notFoundMode:e.notFoundMode??"fuzzy",stringifySearch:e.stringifySearch??Ar,parseSearch:e.parseSearch??Fr}),typeof document<"u"&&(self.__TSR_ROUTER__=this)}isShell(){return!!this.options.isShell}isPrerendering(){return!!this.options.isPrerendering}get state(){return this.__store.state}setRoutes({routesById:e,routesByPath:s,processedTree:n}){this.routesById=e,this.routesByPath=s,this.processedTree=n;const r=this.options.notFoundRoute;r&&(r.init({originalIndex:99999999999}),this.routesById[r.id]=r)}get looseRoutesById(){return this.routesById}getParentContext(e){return e?.id?e.context??this.options.context??void 0:this.options.context??void 0}matchRoutesInternal(e,s){const n=this.getMatchedRoutes(e.pathname),{foundRoute:r,routeParams:i,parsedParams:a}=n;let{matchedRoutes:o}=n,c=!1;(r?r.path!=="/"&&i["**"]:V(e.pathname))&&(this.options.notFoundRoute?o=[...o,this.options.notFoundRoute]:c=!0);const u=c?Xr(this.options.notFoundMode,o):void 0,l=new Array(o.length),d=new Map(this.state.matches.map(h=>[h.routeId,h]));for(let h=0;h<o.length;h++){const f=o[h],p=l[h-1];let m,g,P;{const k=p?.search??e.search,J=p?._strictSearch??void 0;try{const H=Nt(f.options.validateSearch,{...k})??void 0;m={...k,...H},g={...J,...H},P=void 0}catch(H){let Pt=H;if(H instanceof Jt||(Pt=new Jt(H.message,{cause:H})),s?.throwOnError)throw Pt;m=k,g={},P=Pt}}const S=f.options.loaderDeps?.({search:m})??"",w=S?JSON.stringify(S):"",{interpolatedPath:v,usedParams:C}=oe({path:f.fullPath,params:i,decoder:this.pathParamsDecoder,server:this.isServer}),L=f.id+v+w,x=this.getMatch(L),y=d.get(f.id),R=x?._strictParams??C;let M;if(!x)try{ys(f,C,a,R)}catch(k){if(U(k)||Q(k)?M=k:M=new zr(k.message,{cause:k}),s?.throwOnError)throw M}Object.assign(i,R);const O=y?"stay":"enter";let E;if(x)E={...x,cause:O,params:y?.params??i,_strictParams:R,search:j(y?y.search:x.search,m),_strictSearch:g};else{const k=f.options.loader||f.options.beforeLoad||f.lazyFn||tn(f)?"pending":"success";E={id:L,ssr:f.options.ssr,index:h,routeId:f.id,params:y?.params??i,_strictParams:R,pathname:v,updatedAt:Date.now(),search:y?j(y.search,m):m,_strictSearch:g,searchError:void 0,status:k,isFetching:!1,error:void 0,paramsError:M,__routeContext:void 0,_nonReactive:{loadPromise:gt()},__beforeLoadContext:void 0,context:{},abortController:new AbortController,fetchCount:0,cause:O,loaderDeps:y?j(y.loaderDeps,S):S,invalid:!1,preload:!1,links:void 0,scripts:void 0,headScripts:void 0,meta:void 0,staticData:f.options.staticData||{},fullPath:f.fullPath}}s?.preload||(E.globalNotFound=u===f.id),E.searchError=P;const I=this.getParentContext(p);E.context={...I,...E.__routeContext,...E.__beforeLoadContext},l[h]=E}for(let h=0;h<l.length;h++){const f=l[h],p=this.looseRoutesById[f.routeId],m=this.getMatch(f.id),g=d.get(f.routeId);if(f.params=g?j(g.params,i):i,!m){const P=l[h-1],S=this.getParentContext(P);if(p.options.context){const w={deps:f.loaderDeps,params:f.params,context:S??{},location:e,navigate:v=>this.navigate({...v,_fromLocation:e}),buildLocation:this.buildLocation,cause:f.cause,abortController:f.abortController,preload:!!f.preload,matches:l,routeId:p.id};f.__routeContext=p.options.context(w)??void 0}f.context={...S,...f.__routeContext,...f.__beforeLoadContext}}}return l}matchRoutesLightweight(e){const{matchedRoutes:s,routeParams:n,parsedParams:r}=this.getMatchedRoutes(e.pathname),i=Et(s),a={...e.search};for(const l of s)try{Object.assign(a,Nt(l.options.validateSearch,a))}catch{}const o=Et(this.state.matches),c=o&&o.routeId===i.id&&e.pathname===this.state.location.pathname;let u;if(c)u=o.params;else{const l={...n};for(const d of s)try{ys(d,n,r??{},l)}catch{}u=l}return{matchedRoutes:s,fullPath:i.fullPath,search:a,params:u}}}class Jt extends Error{}class zr extends Error{}function Vr(t){return{loadedAt:0,isLoading:!1,isTransitioning:!1,status:"idle",resolvedLocation:void 0,location:t,matches:[],pendingMatches:[],cachedMatches:[],statusCode:200}}function Nt(t,e){if(t==null)return{};if("~standard"in t){const s=t["~standard"].validate(e);if(s instanceof Promise)throw new Jt("Async validation not supported");if(s.issues)throw new Jt(JSON.stringify(s.issues,void 0,2),{cause:s});return s.value}return"parse"in t?t.parse(e):typeof t=="function"?t(e):{}}function Gr({pathname:t,routesById:e,processedTree:s}){const n={},r=V(t);let i,a;const o=mr(r,s,!0);return o&&(i=o.route,Object.assign(n,o.rawParams),a=Object.assign({},o.parsedParams)),{matchedRoutes:o?.branch||[e[N]],routeParams:n,foundRoute:i,parsedParams:a}}function Jr({search:t,dest:e,destRoutes:s,_includeValidateSearch:n}){return Yr(s)(t,e,n??!1)}function Yr(t){const e={dest:null,_includeValidateSearch:!1,middlewares:[]};for(const r of t){if("search"in r.options)r.options.search?.middlewares&&e.middlewares.push(...r.options.search.middlewares);else if(r.options.preSearchFilters||r.options.postSearchFilters){const i=({search:a,next:o})=>{let c=a;"preSearchFilters"in r.options&&r.options.preSearchFilters&&(c=r.options.preSearchFilters.reduce((l,d)=>d(l),a));const u=o(c);return"postSearchFilters"in r.options&&r.options.postSearchFilters?r.options.postSearchFilters.reduce((l,d)=>d(l),u):u};e.middlewares.push(i)}if(r.options.validateSearch){const i=({search:a,next:o})=>{const c=o(a);if(!e._includeValidateSearch)return c;try{return{...c,...Nt(r.options.validateSearch,c)??void 0}}catch{return c}};e.middlewares.push(i)}}const s=({search:r})=>{const i=e.dest;return i.search?i.search===!0?r:X(i.search,r):{}};e.middlewares.push(s);const n=(r,i,a)=>{if(r>=a.length)return i;const o=a[r];return o({search:i,next:u=>n(r+1,u,a)})};return function(i,a,o){return e.dest=a,e._includeValidateSearch=o,n(0,i,e.middlewares)}}function Xr(t,e){if(t!=="root")for(let s=e.length-1;s>=0;s--){const n=e[s];if(n.children)return n.id}return N}function ys(t,e,s,n){const r=t.options.params?.parse??t.options.parseParams;if(r)if(t.options.skipRouteOnParseError)for(const i in e)i in s&&(n[i]=s[i]);else{const i=r(n);Object.assign(n,i)}}const Zr="Error preloading route! ☝️";class nn{constructor(e){if(this.init=s=>{this.originalIndex=s.originalIndex;const n=this.options,r=!n?.path&&!n?.id;this.parentRoute=this.options.getParentRoute?.(),r?this._path=N:this.parentRoute||G(!1);let i=r?N:n?.path;i&&i!=="/"&&(i=zs(i));const a=n?.id||i;let o=r?N:Ut([this.parentRoute.id===N?"":this.parentRoute.id,a]);i===N&&(i="/"),o!==N&&(o=Ut(["/",o]));const c=o===N?"/":Ut([this.parentRoute.fullPath,i]);this._path=i,this._id=o,this._fullPath=c,this._to=V(c)},this.addChildren=s=>this._addFileChildren(s),this._addFileChildren=s=>(Array.isArray(s)&&(this.children=s),typeof s=="object"&&s!==null&&(this.children=Object.values(s)),this),this._addFileTypes=()=>this,this.updateLoader=s=>(Object.assign(this.options,s),this),this.update=s=>(Object.assign(this.options,s),this),this.lazy=s=>(this.lazyFn=s,this),this.redirect=s=>Ur({from:this.fullPath,...s}),this.options=e||{},this.isRoot=!e?.getParentRoute,e?.id&&e?.path)throw new Error("Route cannot have both an 'id' and a 'path' option.")}get to(){return this._to}get id(){return this._id}get path(){return this._path}get fullPath(){return this._fullPath}}class ti extends nn{constructor(e){super(e)}}const jt=typeof window<"u"?b.useLayoutEffect:b.useEffect;function ce(t){const e=b.useRef({value:t,prev:null}),s=e.current.value;return t!==s&&(e.current={value:t,prev:s}),e.current.prev}function ei(t,e,s={},n={}){b.useEffect(()=>{if(!t.current||n.disabled||typeof IntersectionObserver!="function")return;const r=new IntersectionObserver(([i])=>{e(i)},s);return r.observe(t.current),()=>{r.disconnect()}},[e,s,n.disabled,t])}function si(t){const e=b.useRef(null);return b.useImperativeHandle(t,()=>e.current,[]),e}function Te(t){const e=t.errorComponent??Fe;return _.jsx(ni,{getResetKey:t.getResetKey,onCatch:t.onCatch,children:({error:s,reset:n})=>s?b.createElement(e,{error:s,reset:n}):t.children})}class ni extends b.Component{constructor(){super(...arguments),this.state={error:null}}static getDerivedStateFromProps(e){return{resetKey:e.getResetKey()}}static getDerivedStateFromError(e){return{error:e}}reset(){this.setState({error:null})}componentDidUpdate(e,s){s.error&&s.resetKey!==this.state.resetKey&&this.reset()}componentDidCatch(e,s){this.props.onCatch&&this.props.onCatch(e,s)}render(){return this.props.children({error:this.state.resetKey!==this.props.getResetKey()?null:this.state.error,reset:()=>{this.reset()}})}}function Fe({error:t}){const[e,s]=b.useState(!1);return _.jsxs("div",{style:{padding:".5rem",maxWidth:"100%"},children:[_.jsxs("div",{style:{display:"flex",alignItems:"center",gap:".5rem"},children:[_.jsx("strong",{style:{fontSize:"1rem"},children:"Something went wrong!"}),_.jsx("button",{style:{appearance:"none",fontSize:".6em",border:"1px solid currentColor",padding:".1rem .2rem",fontWeight:"bold",borderRadius:".25rem"},onClick:()=>s(n=>!n),children:e?"Hide Error":"Show Error"})]}),_.jsx("div",{style:{height:".25rem"}}),e?_.jsx("div",{children:_.jsx("pre",{style:{fontSize:".7em",border:"1px solid red",borderRadius:".25rem",padding:".3rem",color:"red",overflow:"auto"},children:t.message?_.jsx("code",{children:t.message}):null})}):null]})}function ri({children:t,fallback:e=null}){return rn()?_.jsx(Mt.Fragment,{children:t}):_.jsx(Mt.Fragment,{children:e})}function rn(){return Mt.useSyncExternalStore(ii,()=>!0,()=>!1)}function ii(){return()=>{}}var ue={exports:{}},le={},he={exports:{}},de={};var vs;function oi(){if(vs)return de;vs=1;var t=Os();function e(d,h){return d===h&&(d!==0||1/d===1/h)||d!==d&&h!==h}var s=typeof Object.is=="function"?Object.is:e,n=t.useState,r=t.useEffect,i=t.useLayoutEffect,a=t.useDebugValue;function o(d,h){var f=h(),p=n({inst:{value:f,getSnapshot:h}}),m=p[0].inst,g=p[1];return i(function(){m.value=f,m.getSnapshot=h,c(m)&&g({inst:m})},[d,f,h]),r(function(){return c(m)&&g({inst:m}),d(function(){c(m)&&g({inst:m})})},[d]),a(f),f}function c(d){var h=d.getSnapshot;d=d.value;try{var f=h();return!s(d,f)}catch{return!0}}function u(d,h){return h()}var l=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?u:o;return de.useSyncExternalStore=t.useSyncExternalStore!==void 0?t.useSyncExternalStore:l,de}var Ps;function ai(){return Ps||(Ps=1,he.exports=oi()),he.exports}var Ss;function ci(){if(Ss)return le;Ss=1;var t=Os(),e=ai();function s(u,l){return u===l&&(u!==0||1/u===1/l)||u!==u&&l!==l}var n=typeof Object.is=="function"?Object.is:s,r=e.useSyncExternalStore,i=t.useRef,a=t.useEffect,o=t.useMemo,c=t.useDebugValue;return le.useSyncExternalStoreWithSelector=function(u,l,d,h,f){var p=i(null);if(p.current===null){var m={hasValue:!1,value:null};p.current=m}else m=p.current;p=o(function(){function P(L){if(!S){if(S=!0,w=L,L=h(L),f!==void 0&&m.hasValue){var x=m.value;if(f(x,L))return v=x}return v=L}if(x=v,n(w,L))return x;var y=h(L);return f!==void 0&&f(x,y)?(w=L,x):(w=L,v=y)}var S=!1,w,v,C=d===void 0?null:d;return[function(){return P(l())},C===null?void 0:function(){return P(C())}]},[l,d,h,f]);var g=r(u,p[0],p[1]);return a(function(){m.hasValue=!0,m.value=g},[g]),c(g),g},le}var ws;function ui(){return ws||(ws=1,ue.exports=ci()),ue.exports}var li=ui();function hi(t,e=n=>n,s={}){const n=s.equal??di;return li.useSyncExternalStoreWithSelector(t.subscribe,()=>t.state,()=>t.state,e,n)}function di(t,e){if(Object.is(t,e))return!0;if(typeof t!="object"||t===null||typeof e!="object"||e===null)return!1;if(t instanceof Map&&e instanceof Map){if(t.size!==e.size)return!1;for(const[n,r]of t)if(!e.has(n)||!Object.is(r,e.get(n)))return!1;return!0}if(t instanceof Set&&e instanceof Set){if(t.size!==e.size)return!1;for(const n of t)if(!e.has(n))return!1;return!0}if(t instanceof Date&&e instanceof Date)return t.getTime()===e.getTime();const s=Rs(t);if(s.length!==Rs(e).length)return!1;for(let n=0;n<s.length;n++)if(!Object.prototype.hasOwnProperty.call(e,s[n])||!Object.is(t[s[n]],e[s[n]]))return!1;return!0}function Rs(t){return Object.keys(t).concat(Object.getOwnPropertySymbols(t))}const fe=b.createContext(null);function on(){return typeof document>"u"?fe:window.__TSR_ROUTER_CONTEXT__?window.__TSR_ROUTER_CONTEXT__:(window.__TSR_ROUTER_CONTEXT__=fe,fe)}function $(t){const e=b.useContext(on());return t?.warn,e}function K(t){const e=$({warn:t?.router===void 0}),s=t?.router||e,n=b.useRef(void 0);return hi(s.__store,r=>{if(t?.select){if(t.structuralSharing??s.options.defaultStructuralSharing){const i=j(n.current,t.select(r));return n.current=i,i}return t.select(r)}return r})}const Zt=b.createContext(void 0),fi=b.createContext(void 0);function z(t){const e=b.useContext(t.from?fi:Zt);return K({select:n=>{const r=n.matches.find(i=>t.from?t.from===i.routeId:i.id===e);if(G(!((t.shouldThrow??!0)&&!r),`Could not find ${t.from?`an active match from "${t.from}"`:"a nearest match!"}`),r!==void 0)return t.select?t.select(r):r},structuralSharing:t.structuralSharing})}function Ae(t){return z({from:t.from,strict:t.strict,structuralSharing:t.structuralSharing,select:e=>t.select?t.select(e.loaderData):e.loaderData})}function De(t){const{select:e,...s}=t;return z({...s,select:n=>e?e(n.loaderDeps):n.loaderDeps})}function je(t){return z({from:t.from,shouldThrow:t.shouldThrow,structuralSharing:t.structuralSharing,strict:t.strict,select:e=>{const s=t.strict===!1?e.params:e._strictParams;return t.select?t.select(s):s}})}function Ue(t){return z({from:t.from,strict:t.strict,shouldThrow:t.shouldThrow,structuralSharing:t.structuralSharing,select:e=>t.select?t.select(e.search):e.search})}function Be(t){const e=$();return b.useCallback(s=>e.navigate({...s,from:s.from??t?.from}),[t?.from,e])}function pi(t,e){const s=$(),n=si(e),{activeProps:r,inactiveProps:i,activeOptions:a,to:o,preload:c,preloadDelay:u,hashScrollIntoView:l,replace:d,startTransition:h,resetScroll:f,viewTransition:p,children:m,target:g,disabled:P,style:S,className:w,onClick:v,onFocus:C,onMouseEnter:L,onMouseLeave:x,onTouchStart:y,ignoreBlocker:R,params:M,search:O,hash:E,state:I,mask:k,reloadDocument:J,unsafeRelative:H,from:Pt,_fromLocation:Ui,...Ne}=t,Qe=rn(),ln=K({select:T=>T.location.search,structuralSharing:!0}),Ke=t.from,St=b.useMemo(()=>({...t,from:Ke}),[s,ln,Ke,t._fromLocation,t.hash,t.to,t.search,t.params,t.state,t.mask,t.unsafeRelative]),W=b.useMemo(()=>s.buildLocation({...St}),[s,St]),$e=W.maskedLocation?W.maskedLocation.publicHref:W.publicHref,qe=W.maskedLocation?W.maskedLocation.external:W.external,wt=b.useMemo(()=>Si($e,qe,s.history,P),[P,qe,$e,s.history]),kt=b.useMemo(()=>{if(wt?.external)return Wt(wt.href)?void 0:wt.href;if(!wi(o)&&!(typeof o!="string"||o.indexOf(":")===-1))try{return new URL(o),Wt(o)?void 0:o}catch{}},[o,wt]),te=K({select:T=>{if(kt)return!1;if(a?.exact){if(!wr(T.location.pathname,W.pathname,s.basepath))return!1}else{const D=Vt(T.location.pathname,s.basepath),q=Vt(W.pathname,s.basepath);if(!(D.startsWith(q)&&(D.length===q.length||D[q.length]==="/")))return!1}return(a?.includeSearch??!0)&&!ot(T.location.search,W.search,{partial:!a?.exact,ignoreUndefined:!a?.explicitUndefined})?!1:a?.includeHash?Qe&&T.location.hash===W.hash:!0}}),Tt=te?X(r,{})??mi:pe,Ft=te?pe:X(i,{})??pe,He=[w,Tt.className,Ft.className].filter(Boolean).join(" "),We=(S||Tt.style||Ft.style)&&{...S,...Tt.style,...Ft.style},[hn,ze]=b.useState(!1),Ve=b.useRef(!1),dt=t.reloadDocument||kt?!1:c??s.options.defaultPreload,ee=u??s.options.defaultPreloadDelay??0,st=b.useCallback(()=>{s.preloadRoute({...St}).catch(T=>{console.warn(T),console.warn(Zr)})},[s,St]),dn=b.useCallback(T=>{T?.isIntersecting&&st()},[st]);ei(n,dn,Pi,{disabled:!!P||dt!=="viewport"}),b.useEffect(()=>{Ve.current||!P&&dt==="render"&&(st(),Ve.current=!0)},[P,st,dt]);const fn=T=>{const D=T.currentTarget.getAttribute("target"),q=g!==void 0?g:D;if(!P&&!Ri(T)&&!T.defaultPrevented&&(!q||q==="_self")&&T.button===0){T.preventDefault(),Pn.flushSync(()=>{ze(!0)});const Je=s.subscribe("onResolved",()=>{Je(),ze(!1)});s.navigate({...St,replace:d,resetScroll:f,hashScrollIntoView:l,startTransition:h,viewTransition:p,ignoreBlocker:R})}};if(kt)return{...Ne,ref:n,href:kt,...m&&{children:m},...g&&{target:g},...P&&{disabled:P},...S&&{style:S},...w&&{className:w},...v&&{onClick:v},...C&&{onFocus:C},...L&&{onMouseEnter:L},...x&&{onMouseLeave:x},...y&&{onTouchStart:y}};const Ge=T=>{P||dt&&st()},pn=Ge,mn=T=>{if(!(P||!dt))if(!ee)st();else{const D=T.target;if(_t.has(D))return;const q=setTimeout(()=>{_t.delete(D),st()},ee);_t.set(D,q)}},gn=T=>{if(P||!dt||!ee)return;const D=T.target,q=_t.get(D);q&&(clearTimeout(q),_t.delete(D))};return{...Ne,...Tt,...Ft,href:wt?.href,ref:n,onClick:Ct([v,fn]),onFocus:Ct([C,Ge]),onMouseEnter:Ct([L,mn]),onMouseLeave:Ct([x,gn]),onTouchStart:Ct([y,pn]),disabled:!!P,target:g,...We&&{style:We},...He&&{className:He},...P&&gi,...te&&yi,...Qe&&hn&&vi}}const pe={},mi={className:"active"},gi={role:"link","aria-disabled":!0},yi={"data-status":"active","aria-current":"page"},vi={"data-transitioning":"transitioning"},_t=new WeakMap,Pi={rootMargin:"100px"},Ct=t=>e=>{for(const s of t)if(s){if(e.defaultPrevented)return;s(e)}};function Si(t,e,s,n){if(!n)return e?{href:t,external:!0}:{href:s.createHref(t)||"/",external:!1}}function wi(t){if(typeof t!="string")return!1;const e=t.charCodeAt(0);return e===47?t.charCodeAt(1)!==47:e===46}const an=b.forwardRef((t,e)=>{const{_asChild:s,...n}=t,{type:r,...i}=pi(n,e),a=typeof n.children=="function"?n.children({isActive:i["data-status"]==="active"}):n.children;if(!s){const{disabled:o,...c}=i;return b.createElement("a",c,a)}return b.createElement(s,i,a)});function Ri(t){return!!(t.metaKey||t.altKey||t.ctrlKey||t.shiftKey)}class bi extends nn{constructor(e){super(e),this.useMatch=s=>z({select:s?.select,from:this.id,structuralSharing:s?.structuralSharing}),this.useRouteContext=s=>z({...s,from:this.id,select:n=>s?.select?s.select(n.context):n.context}),this.useSearch=s=>Ue({select:s?.select,structuralSharing:s?.structuralSharing,from:this.id}),this.useParams=s=>je({select:s?.select,structuralSharing:s?.structuralSharing,from:this.id}),this.useLoaderDeps=s=>De({...s,from:this.id}),this.useLoaderData=s=>Ae({...s,from:this.id}),this.useNavigate=()=>Be({from:this.fullPath}),this.Link=Mt.forwardRef((s,n)=>_.jsx(an,{ref:n,from:this.fullPath,...s})),this.$$typeof=Symbol.for("react.memo")}}function xi(t){return new bi(t)}class _i extends ti{constructor(e){super(e),this.useMatch=s=>z({select:s?.select,from:this.id,structuralSharing:s?.structuralSharing}),this.useRouteContext=s=>z({...s,from:this.id,select:n=>s?.select?s.select(n.context):n.context}),this.useSearch=s=>Ue({select:s?.select,structuralSharing:s?.structuralSharing,from:this.id}),this.useParams=s=>je({select:s?.select,structuralSharing:s?.structuralSharing,from:this.id}),this.useLoaderDeps=s=>De({...s,from:this.id}),this.useLoaderData=s=>Ae({...s,from:this.id}),this.useNavigate=()=>Be({from:this.fullPath}),this.Link=Mt.forwardRef((s,n)=>_.jsx(an,{ref:n,from:this.fullPath,...s})),this.$$typeof=Symbol.for("react.memo")}}function Hi(t){return new _i(t)}function bs(t){return typeof t=="object"?new xs(t,{silent:!0}).createRoute(t):new xs(t,{silent:!0}).createRoute}class xs{constructor(e,s){this.path=e,this.createRoute=n=>{this.silent;const r=xi(n);return r.isRoot=!1,r},this.silent=s?.silent}}class _s{constructor(e){this.useMatch=s=>z({select:s?.select,from:this.options.id,structuralSharing:s?.structuralSharing}),this.useRouteContext=s=>z({from:this.options.id,select:n=>s?.select?s.select(n.context):n.context}),this.useSearch=s=>Ue({select:s?.select,structuralSharing:s?.structuralSharing,from:this.options.id}),this.useParams=s=>je({select:s?.select,structuralSharing:s?.structuralSharing,from:this.options.id}),this.useLoaderDeps=s=>De({...s,from:this.options.id}),this.useLoaderData=s=>Ae({...s,from:this.options.id}),this.useNavigate=()=>{const s=$();return Be({from:s.routesById[this.options.id].fullPath})},this.options=e,this.$$typeof=Symbol.for("react.memo")}}function Cs(t){return typeof t=="object"?new _s(t):e=>new _s({id:t,...e})}function Ci(){const t=$(),e=b.useRef({router:t,mounted:!1}),[s,n]=b.useState(!1),{hasPendingMatches:r,isLoading:i}=K({select:d=>({isLoading:d.isLoading,hasPendingMatches:d.matches.some(h=>h.status==="pending")}),structuralSharing:!0}),a=ce(i),o=i||s||r,c=ce(o),u=i||r,l=ce(u);return t.startTransition=d=>{n(!0),b.startTransition(()=>{d(),n(!1)})},b.useEffect(()=>{const d=t.history.subscribe(t.load),h=t.buildLocation({to:t.latestLocation.pathname,search:!0,params:!0,hash:!0,state:!0,_includeValidateSearch:!0});return V(t.latestLocation.publicHref)!==V(h.publicHref)&&t.commitLocation({...h,replace:!0}),()=>{d()}},[t,t.history]),jt(()=>{if(typeof window<"u"&&t.ssr||e.current.router===t&&e.current.mounted)return;e.current={router:t,mounted:!0},(async()=>{try{await t.load()}catch(h){console.error(h)}})()},[t]),jt(()=>{a&&!i&&t.emit({type:"onLoad",...at(t.state)})},[a,t,i]),jt(()=>{l&&!u&&t.emit({type:"onBeforeRouteMount",...at(t.state)})},[u,l,t]),jt(()=>{if(c&&!o){const d=at(t.state);t.emit({type:"onResolved",...d}),t.__store.setState(h=>({...h,status:"idle",resolvedLocation:h.location})),d.hrefChanged&&Ir(t)}},[o,c,t]),null}function Li(t){const e=K({select:s=>`not-found-${s.location.pathname}-${s.status}`});return _.jsx(Te,{getResetKey:()=>e,onCatch:(s,n)=>{if(U(s))t.onCatch?.(s,n);else throw s},errorComponent:({error:s})=>{if(U(s))return t.fallback?.(s);throw s},children:t.children})}function Mi(){return _.jsx("p",{children:"Not Found"})}function ft(t){return _.jsx(_.Fragment,{children:t.children})}function cn(t,e,s){return e.options.notFoundComponent?_.jsx(e.options.notFoundComponent,{...s}):t.options.defaultNotFoundComponent?_.jsx(t.options.defaultNotFoundComponent,{...s}):_.jsx(Mi,{})}function Oi(){return $().isScrollRestoring,null}const un=b.memo(function({matchId:e}){const s=$(),n=K({select:m=>{const g=m.matches.findIndex(S=>S.id===e),P=m.matches[g];return G(P),{routeId:P.routeId,ssr:P.ssr,_displayPending:P._displayPending,resetKey:m.loadedAt,parentRouteId:m.matches[g-1]?.routeId}},structuralSharing:!0}),r=s.routesById[n.routeId],i=r.options.pendingComponent??s.options.defaultPendingComponent,a=i?_.jsx(i,{}):null,o=r.options.errorComponent??s.options.defaultErrorComponent,c=r.options.onCatch??s.options.defaultOnCatch,u=r.isRoot?r.options.notFoundComponent??s.options.notFoundRoute?.options.component:r.options.notFoundComponent,l=n.ssr===!1||n.ssr==="data-only",d=(!r.isRoot||r.options.wrapInSuspense||l)&&(r.options.wrapInSuspense??i??(r.options.errorComponent?.preload||l))?b.Suspense:ft,h=o?Te:ft,f=u?Li:ft,p=r.isRoot?r.options.shellComponent??ft:ft;return _.jsxs(p,{children:[_.jsx(Zt.Provider,{value:e,children:_.jsx(d,{fallback:a,children:_.jsx(h,{getResetKey:()=>n.resetKey,errorComponent:o||Fe,onCatch:(m,g)=>{if(U(m))throw m;c?.(m,g)},children:_.jsx(f,{fallback:m=>{if(!u||m.routeId&&m.routeId!==n.routeId||!m.routeId&&!r.isRoot)throw m;return b.createElement(u,m)},children:l||n._displayPending?_.jsx(ri,{fallback:a,children:_.jsx(Ls,{matchId:e})}):_.jsx(Ls,{matchId:e})})})})}),n.parentRouteId===N&&s.options.scrollRestoration?_.jsxs(_.Fragment,{children:[_.jsx(Ei,{}),_.jsx(Oi,{})]}):null]})});function Ei(){const t=$(),e=b.useRef(void 0);return _.jsx("script",{suppressHydrationWarning:!0,ref:s=>{s&&(e.current===void 0||e.current.href!==t.latestLocation.href)&&(t.emit({type:"onRendered",...at(t.state)}),e.current=t.latestLocation)}},t.latestLocation.state.__TSR_key)}const Ls=b.memo(function({matchId:e}){const s=$(),{match:n,key:r,routeId:i}=K({select:c=>{const u=c.matches.find(p=>p.id===e),l=u.routeId,h=(s.routesById[l].options.remountDeps??s.options.defaultRemountDeps)?.({routeId:l,loaderDeps:u.loaderDeps,params:u._strictParams,search:u._strictSearch});return{key:h?JSON.stringify(h):void 0,routeId:l,match:{id:u.id,status:u.status,error:u.error,invalid:u.invalid,_forcePending:u._forcePending,_displayPending:u._displayPending}}},structuralSharing:!0}),a=s.routesById[i],o=b.useMemo(()=>{const c=a.options.component??s.options.defaultComponent;return c?_.jsx(c,{},r):_.jsx(Ii,{})},[r,a.options.component,s.options.defaultComponent]);if(n._displayPending)throw s.getMatch(n.id)?._nonReactive.displayPendingPromise;if(n._forcePending)throw s.getMatch(n.id)?._nonReactive.minPendingPromise;if(n.status==="pending"){const c=a.options.pendingMinMs??s.options.defaultPendingMinMs;if(c){const u=s.getMatch(n.id);if(u&&!u._nonReactive.minPendingPromise){const l=gt();u._nonReactive.minPendingPromise=l,setTimeout(()=>{l.resolve(),u._nonReactive.minPendingPromise=void 0},c)}}throw s.getMatch(n.id)?._nonReactive.loadPromise}if(n.status==="notFound")return G(U(n.error)),cn(s,a,n.error);if(n.status==="redirected")throw G(Q(n.error)),s.getMatch(n.id)?._nonReactive.loadPromise;if(n.status==="error")throw n.error;return o}),Ii=b.memo(function(){const e=$(),s=b.useContext(Zt),n=K({select:u=>u.matches.find(l=>l.id===s)?.routeId}),r=e.routesById[n],i=K({select:u=>{const d=u.matches.find(h=>h.id===s);return G(d),d.globalNotFound}}),a=K({select:u=>{const l=u.matches,d=l.findIndex(h=>h.id===s);return l[d+1]?.id}}),o=e.options.defaultPendingComponent?_.jsx(e.options.defaultPendingComponent,{}):null;if(i)return cn(e,r,void 0);if(!a)return null;const c=_.jsx(un,{matchId:a});return n===N?_.jsx(b.Suspense,{fallback:o,children:c}):c});function ki(){const t=$(),s=t.routesById[N].options.pendingComponent??t.options.defaultPendingComponent,n=s?_.jsx(s,{}):null,r=typeof document<"u"&&t.ssr?ft:b.Suspense,i=_.jsxs(r,{fallback:n,children:[_.jsx(Ci,{}),_.jsx(Ti,{})]});return t.options.InnerWrap?_.jsx(t.options.InnerWrap,{children:i}):i}function Ti(){const t=$(),e=K({select:r=>r.matches[0]?.id}),s=K({select:r=>r.loadedAt}),n=e?_.jsx(un,{matchId:e}):null;return _.jsx(Zt.Provider,{value:e,children:t.options.disableGlobalCatchBoundary?n:_.jsx(Te,{getResetKey:()=>s,errorComponent:Fe,onCatch:r=>{r.message||r.toString()},children:n})})}const Wi=t=>new Fi(t);class Fi extends Wr{constructor(e){super(e)}}typeof globalThis<"u"?(globalThis.createFileRoute=bs,globalThis.createLazyFileRoute=Cs):typeof window<"u"&&(window.createFileRoute=bs,window.createLazyFileRoute=Cs);function Ai({router:t,children:e,...s}){Object.keys(s).length>0&&t.update({...t.options,...s,context:{...t.options.context,...s.context}});const n=on(),r=_.jsx(n.Provider,{value:t,children:e});return t.options.Wrap?_.jsx(t.options.Wrap,{children:r}):r}function zi({router:t,...e}){return _.jsx(Ai,{router:t,...e,children:_.jsx(ki,{})})}const Di="modulepreload",ji=function(t){return"/"+t},Ms={},Vi=function(e,s,n){let r=Promise.resolve();if(s&&s.length>0){let c=function(u){return Promise.all(u.map(l=>Promise.resolve(l).then(d=>({status:"fulfilled",value:d}),d=>({status:"rejected",reason:d}))))};document.getElementsByTagName("link");const a=document.querySelector("meta[property=csp-nonce]"),o=a?.nonce||a?.getAttribute("nonce");r=c(s.map(u=>{if(u=ji(u),u in Ms)return;Ms[u]=!0;const l=u.endsWith(".css"),d=l?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${u}"]${d}`))return;const h=document.createElement("link");if(h.rel=l?"stylesheet":Di,l||(h.as="script"),h.crossOrigin="",h.href=u,o&&h.setAttribute("nonce",o),document.head.appendChild(h),l)return new Promise((f,p)=>{h.addEventListener("load",f),h.addEventListener("error",()=>p(new Error(`Unable to preload CSS for ${u}`)))})}))}function i(a){const o=new Event("vite:preloadError",{cancelable:!0});if(o.payload=a,window.dispatchEvent(o),!o.defaultPrevented)throw a}return r.then(a=>{for(const o of a||[])o.status==="rejected"&&i(o.reason);return e().catch(i)})};export{Ii as O,Ni as Q,zi as R,Vi as _,Qs as a,$i as b,qi as c,Hi as d,bs as e,Be as f,Wi as g,Qi as h,Ur as r,Ki as u};
1
+ import{r as b,j as _,_ as yn,b as vn,R as Mt,a as Os,c as Pn}from"./react-C7bPzU82.js";var vt=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(t){return this.listeners.add(t),this.onSubscribe(),()=>{this.listeners.delete(t),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},Sn={setTimeout:(t,e)=>setTimeout(t,e),clearTimeout:t=>clearTimeout(t),setInterval:(t,e)=>setInterval(t,e),clearInterval:t=>clearInterval(t)},wn=class{#t=Sn;#e=!1;setTimeoutProvider(t){this.#t=t}setTimeout(t,e){return this.#t.setTimeout(t,e)}clearTimeout(t){this.#t.clearTimeout(t)}setInterval(t,e){return this.#t.setInterval(t,e)}clearInterval(t){this.#t.clearInterval(t)}},nt=new wn;function Rn(t){setTimeout(t,0)}var ct=typeof window>"u"||"Deno"in globalThis;function A(){}function bn(t,e){return typeof t=="function"?t(e):t}function me(t){return typeof t=="number"&&t>=0&&t!==1/0}function Es(t,e){return Math.max(t+(e||0)-Date.now(),0)}function tt(t,e){return typeof t=="function"?t(e):t}function B(t,e){return typeof t=="function"?t(e):t}function Ye(t,e){const{type:s="all",exact:n,fetchStatus:r,predicate:i,queryKey:a,stale:o}=t;if(a){if(n){if(e.queryHash!==xe(a,e.options))return!1}else if(!Ot(e.queryKey,a))return!1}if(s!=="all"){const c=e.isActive();if(s==="active"&&!c||s==="inactive"&&c)return!1}return!(typeof o=="boolean"&&e.isStale()!==o||r&&r!==e.state.fetchStatus||i&&!i(e))}function Xe(t,e){const{exact:s,status:n,predicate:r,mutationKey:i}=t;if(i){if(!e.options.mutationKey)return!1;if(s){if(ut(e.options.mutationKey)!==ut(i))return!1}else if(!Ot(e.options.mutationKey,i))return!1}return!(n&&e.state.status!==n||r&&!r(e))}function xe(t,e){return(e?.queryKeyHashFn||ut)(t)}function ut(t){return JSON.stringify(t,(e,s)=>ge(s)?Object.keys(s).sort().reduce((n,r)=>(n[r]=s[r],n),{}):s)}function Ot(t,e){return t===e?!0:typeof t!=typeof e?!1:t&&e&&typeof t=="object"&&typeof e=="object"?Object.keys(e).every(s=>Ot(t[s],e[s])):!1}var xn=Object.prototype.hasOwnProperty;function ks(t,e,s=0){if(t===e)return t;if(s>500)return e;const n=Ze(t)&&Ze(e);if(!n&&!(ge(t)&&ge(e)))return e;const i=(n?t:Object.keys(t)).length,a=n?e:Object.keys(e),o=a.length,c=n?new Array(o):{};let u=0;for(let l=0;l<o;l++){const d=n?l:a[l],h=t[d],f=e[d];if(h===f){c[d]=h,(n?l<i:xn.call(t,d))&&u++;continue}if(h===null||f===null||typeof h!="object"||typeof f!="object"){c[d]=f;continue}const p=ks(h,f,s+1);c[d]=p,p===h&&u++}return i===o&&u===i?t:c}function Qt(t,e){if(!e||Object.keys(t).length!==Object.keys(e).length)return!1;for(const s in t)if(t[s]!==e[s])return!1;return!0}function Ze(t){return Array.isArray(t)&&t.length===Object.keys(t).length}function ge(t){if(!ts(t))return!1;const e=t.constructor;if(e===void 0)return!0;const s=e.prototype;return!(!ts(s)||!s.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(t)!==Object.prototype)}function ts(t){return Object.prototype.toString.call(t)==="[object Object]"}function _n(t){return new Promise(e=>{nt.setTimeout(e,t)})}function ye(t,e,s){return typeof s.structuralSharing=="function"?s.structuralSharing(t,e):s.structuralSharing!==!1?ks(t,e):e}function Cn(t,e,s=0){const n=[...t,e];return s&&n.length>s?n.slice(1):n}function Ln(t,e,s=0){const n=[e,...t];return s&&n.length>s?n.slice(0,-1):n}var _e=Symbol();function Is(t,e){return!t.queryFn&&e?.initialPromise?()=>e.initialPromise:!t.queryFn||t.queryFn===_e?()=>Promise.reject(new Error(`Missing queryFn: '${t.queryHash}'`)):t.queryFn}function Ce(t,e){return typeof t=="function"?t(...e):!!t}function Mn(t,e,s){let n=!1,r;return Object.defineProperty(t,"signal",{enumerable:!0,get:()=>(r??=e(),n||(n=!0,r.aborted?s():r.addEventListener("abort",s,{once:!0})),r)}),t}var On=class extends vt{#t;#e;#s;constructor(){super(),this.#s=t=>{if(!ct&&window.addEventListener){const e=()=>t();return window.addEventListener("visibilitychange",e,!1),()=>{window.removeEventListener("visibilitychange",e)}}}}onSubscribe(){this.#e||this.setEventListener(this.#s)}onUnsubscribe(){this.hasListeners()||(this.#e?.(),this.#e=void 0)}setEventListener(t){this.#s=t,this.#e?.(),this.#e=t(e=>{typeof e=="boolean"?this.setFocused(e):this.onFocus()})}setFocused(t){this.#t!==t&&(this.#t=t,this.onFocus())}onFocus(){const t=this.isFocused();this.listeners.forEach(e=>{e(t)})}isFocused(){return typeof this.#t=="boolean"?this.#t:globalThis.document?.visibilityState!=="hidden"}},Le=new On;function ve(){let t,e;const s=new Promise((r,i)=>{t=r,e=i});s.status="pending",s.catch(()=>{});function n(r){Object.assign(s,r),delete s.resolve,delete s.reject}return s.resolve=r=>{n({status:"fulfilled",value:r}),t(r)},s.reject=r=>{n({status:"rejected",reason:r}),e(r)},s}var En=Rn;function kn(){let t=[],e=0,s=o=>{o()},n=o=>{o()},r=En;const i=o=>{e?t.push(o):r(()=>{s(o)})},a=()=>{const o=t;t=[],o.length&&r(()=>{n(()=>{o.forEach(c=>{s(c)})})})};return{batch:o=>{let c;e++;try{c=o()}finally{e--,e||a()}return c},batchCalls:o=>(...c)=>{i(()=>{o(...c)})},schedule:i,setNotifyFunction:o=>{s=o},setBatchNotifyFunction:o=>{n=o},setScheduler:o=>{r=o}}}var F=kn(),In=class extends vt{#t=!0;#e;#s;constructor(){super(),this.#s=t=>{if(!ct&&window.addEventListener){const e=()=>t(!0),s=()=>t(!1);return window.addEventListener("online",e,!1),window.addEventListener("offline",s,!1),()=>{window.removeEventListener("online",e),window.removeEventListener("offline",s)}}}}onSubscribe(){this.#e||this.setEventListener(this.#s)}onUnsubscribe(){this.hasListeners()||(this.#e?.(),this.#e=void 0)}setEventListener(t){this.#s=t,this.#e?.(),this.#e=t(this.setOnline.bind(this))}setOnline(t){this.#t!==t&&(this.#t=t,this.listeners.forEach(s=>{s(t)}))}isOnline(){return this.#t}},Kt=new In;function Tn(t){return Math.min(1e3*2**t,3e4)}function Ts(t){return(t??"online")==="online"?Kt.isOnline():!0}var Pe=class extends Error{constructor(t){super("CancelledError"),this.revert=t?.revert,this.silent=t?.silent}};function Fs(t){let e=!1,s=0,n;const r=ve(),i=()=>r.status!=="pending",a=m=>{if(!i()){const g=new Pe(m);h(g),t.onCancel?.(g)}},o=()=>{e=!0},c=()=>{e=!1},u=()=>Le.isFocused()&&(t.networkMode==="always"||Kt.isOnline())&&t.canRun(),l=()=>Ts(t.networkMode)&&t.canRun(),d=m=>{i()||(n?.(),r.resolve(m))},h=m=>{i()||(n?.(),r.reject(m))},f=()=>new Promise(m=>{n=g=>{(i()||u())&&m(g)},t.onPause?.()}).then(()=>{n=void 0,i()||t.onContinue?.()}),p=()=>{if(i())return;let m;const g=s===0?t.initialPromise:void 0;try{m=g??t.fn()}catch(P){m=Promise.reject(P)}Promise.resolve(m).then(d).catch(P=>{if(i())return;const S=t.retry??(ct?0:3),w=t.retryDelay??Tn,v=typeof w=="function"?w(s,P):w,C=S===!0||typeof S=="number"&&s<S||typeof S=="function"&&S(s,P);if(e||!C){h(P);return}s++,t.onFail?.(s,P),_n(v).then(()=>u()?void 0:f()).then(()=>{e?h(P):p()})})};return{promise:r,status:()=>r.status,cancel:a,continue:()=>(n?.(),r),cancelRetry:o,continueRetry:c,canStart:l,start:()=>(l()?p():f().then(p),r)}}var As=class{#t;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),me(this.gcTime)&&(this.#t=nt.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(t){this.gcTime=Math.max(this.gcTime||0,t??(ct?1/0:300*1e3))}clearGcTimeout(){this.#t&&(nt.clearTimeout(this.#t),this.#t=void 0)}},Fn=class extends As{#t;#e;#s;#r;#n;#o;#a;constructor(t){super(),this.#a=!1,this.#o=t.defaultOptions,this.setOptions(t.options),this.observers=[],this.#r=t.client,this.#s=this.#r.getQueryCache(),this.queryKey=t.queryKey,this.queryHash=t.queryHash,this.#t=ss(this.options),this.state=t.state??this.#t,this.scheduleGc()}get meta(){return this.options.meta}get promise(){return this.#n?.promise}setOptions(t){if(this.options={...this.#o,...t},this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const e=ss(this.options);e.data!==void 0&&(this.setState(es(e.data,e.dataUpdatedAt)),this.#t=e)}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&this.#s.remove(this)}setData(t,e){const s=ye(this.state.data,t,this.options);return this.#i({data:s,type:"success",dataUpdatedAt:e?.updatedAt,manual:e?.manual}),s}setState(t,e){this.#i({type:"setState",state:t,setStateOptions:e})}cancel(t){const e=this.#n?.promise;return this.#n?.cancel(t),e?e.then(A).catch(A):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(this.#t)}isActive(){return this.observers.some(t=>B(t.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===_e||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStatic(){return this.getObserversCount()>0?this.observers.some(t=>tt(t.options.staleTime,this)==="static"):!1}isStale(){return this.getObserversCount()>0?this.observers.some(t=>t.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(t=0){return this.state.data===void 0?!0:t==="static"?!1:this.state.isInvalidated?!0:!Es(this.state.dataUpdatedAt,t)}onFocus(){this.observers.find(e=>e.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:!1}),this.#n?.continue()}onOnline(){this.observers.find(e=>e.shouldFetchOnReconnect())?.refetch({cancelRefetch:!1}),this.#n?.continue()}addObserver(t){this.observers.includes(t)||(this.observers.push(t),this.clearGcTimeout(),this.#s.notify({type:"observerAdded",query:this,observer:t}))}removeObserver(t){this.observers.includes(t)&&(this.observers=this.observers.filter(e=>e!==t),this.observers.length||(this.#n&&(this.#a?this.#n.cancel({revert:!0}):this.#n.cancelRetry()),this.scheduleGc()),this.#s.notify({type:"observerRemoved",query:this,observer:t}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||this.#i({type:"invalidate"})}async fetch(t,e){if(this.state.fetchStatus!=="idle"&&this.#n?.status()!=="rejected"){if(this.state.data!==void 0&&e?.cancelRefetch)this.cancel({silent:!0});else if(this.#n)return this.#n.continueRetry(),this.#n.promise}if(t&&this.setOptions(t),!this.options.queryFn){const o=this.observers.find(c=>c.options.queryFn);o&&this.setOptions(o.options)}const s=new AbortController,n=o=>{Object.defineProperty(o,"signal",{enumerable:!0,get:()=>(this.#a=!0,s.signal)})},r=()=>{const o=Is(this.options,e),u=(()=>{const l={client:this.#r,queryKey:this.queryKey,meta:this.meta};return n(l),l})();return this.#a=!1,this.options.persister?this.options.persister(o,u,this):o(u)},a=(()=>{const o={fetchOptions:e,options:this.options,queryKey:this.queryKey,client:this.#r,state:this.state,fetchFn:r};return n(o),o})();this.options.behavior?.onFetch(a,this),this.#e=this.state,(this.state.fetchStatus==="idle"||this.state.fetchMeta!==a.fetchOptions?.meta)&&this.#i({type:"fetch",meta:a.fetchOptions?.meta}),this.#n=Fs({initialPromise:e?.initialPromise,fn:a.fetchFn,onCancel:o=>{o instanceof Pe&&o.revert&&this.setState({...this.#e,fetchStatus:"idle"}),s.abort()},onFail:(o,c)=>{this.#i({type:"failed",failureCount:o,error:c})},onPause:()=>{this.#i({type:"pause"})},onContinue:()=>{this.#i({type:"continue"})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>!0});try{const o=await this.#n.start();if(o===void 0)throw new Error(`${this.queryHash} data is undefined`);return this.setData(o),this.#s.config.onSuccess?.(o,this),this.#s.config.onSettled?.(o,this.state.error,this),o}catch(o){if(o instanceof Pe){if(o.silent)return this.#n.promise;if(o.revert){if(this.state.data===void 0)throw o;return this.state.data}}throw this.#i({type:"error",error:o}),this.#s.config.onError?.(o,this),this.#s.config.onSettled?.(this.state.data,o,this),o}finally{this.scheduleGc()}}#i(t){const e=s=>{switch(t.type){case"failed":return{...s,fetchFailureCount:t.failureCount,fetchFailureReason:t.error};case"pause":return{...s,fetchStatus:"paused"};case"continue":return{...s,fetchStatus:"fetching"};case"fetch":return{...s,...Ds(s.data,this.options),fetchMeta:t.meta??null};case"success":const n={...s,...es(t.data,t.dataUpdatedAt),dataUpdateCount:s.dataUpdateCount+1,...!t.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return this.#e=t.manual?n:void 0,n;case"error":const r=t.error;return{...s,error:r,errorUpdateCount:s.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:s.fetchFailureCount+1,fetchFailureReason:r,fetchStatus:"idle",status:"error",isInvalidated:!0};case"invalidate":return{...s,isInvalidated:!0};case"setState":return{...s,...t.state}}};this.state=e(this.state),F.batch(()=>{this.observers.forEach(s=>{s.onQueryUpdate()}),this.#s.notify({query:this,type:"updated",action:t})})}};function Ds(t,e){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:Ts(e.networkMode)?"fetching":"paused",...t===void 0&&{error:null,status:"pending"}}}function es(t,e){return{data:t,dataUpdatedAt:e??Date.now(),error:null,isInvalidated:!1,status:"success"}}function ss(t){const e=typeof t.initialData=="function"?t.initialData():t.initialData,s=e!==void 0,n=s?typeof t.initialDataUpdatedAt=="function"?t.initialDataUpdatedAt():t.initialDataUpdatedAt:0;return{data:e,dataUpdateCount:0,dataUpdatedAt:s?n??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:s?"success":"pending",fetchStatus:"idle"}}var js=class extends vt{constructor(t,e){super(),this.options=e,this.#t=t,this.#i=null,this.#a=ve(),this.bindMethods(),this.setOptions(e)}#t;#e=void 0;#s=void 0;#r=void 0;#n;#o;#a;#i;#m;#d;#f;#u;#l;#c;#p=new Set;bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(this.#e.addObserver(this),ns(this.#e,this.options)?this.#h():this.updateResult(),this.#P())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return Se(this.#e,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return Se(this.#e,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#S(),this.#w(),this.#e.removeObserver(this)}setOptions(t){const e=this.options,s=this.#e;if(this.options=this.#t.defaultQueryOptions(t),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof B(this.options.enabled,this.#e)!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");this.#R(),this.#e.setOptions(this.options),e._defaulted&&!Qt(this.options,e)&&this.#t.getQueryCache().notify({type:"observerOptionsUpdated",query:this.#e,observer:this});const n=this.hasListeners();n&&rs(this.#e,s,this.options,e)&&this.#h(),this.updateResult(),n&&(this.#e!==s||B(this.options.enabled,this.#e)!==B(e.enabled,this.#e)||tt(this.options.staleTime,this.#e)!==tt(e.staleTime,this.#e))&&this.#g();const r=this.#y();n&&(this.#e!==s||B(this.options.enabled,this.#e)!==B(e.enabled,this.#e)||r!==this.#c)&&this.#v(r)}getOptimisticResult(t){const e=this.#t.getQueryCache().build(this.#t,t),s=this.createResult(e,t);return Dn(this,s)&&(this.#r=s,this.#o=this.options,this.#n=this.#e.state),s}getCurrentResult(){return this.#r}trackResult(t,e){return new Proxy(t,{get:(s,n)=>(this.trackProp(n),e?.(n),n==="promise"&&(this.trackProp("data"),!this.options.experimental_prefetchInRender&&this.#a.status==="pending"&&this.#a.reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(s,n))})}trackProp(t){this.#p.add(t)}getCurrentQuery(){return this.#e}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){const e=this.#t.defaultQueryOptions(t),s=this.#t.getQueryCache().build(this.#t,e);return s.fetch().then(()=>this.createResult(s,e))}fetch(t){return this.#h({...t,cancelRefetch:t.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#r))}#h(t){this.#R();let e=this.#e.fetch(this.options,t);return t?.throwOnError||(e=e.catch(A)),e}#g(){this.#S();const t=tt(this.options.staleTime,this.#e);if(ct||this.#r.isStale||!me(t))return;const s=Es(this.#r.dataUpdatedAt,t)+1;this.#u=nt.setTimeout(()=>{this.#r.isStale||this.updateResult()},s)}#y(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(this.#e):this.options.refetchInterval)??!1}#v(t){this.#w(),this.#c=t,!(ct||B(this.options.enabled,this.#e)===!1||!me(this.#c)||this.#c===0)&&(this.#l=nt.setInterval(()=>{(this.options.refetchIntervalInBackground||Le.isFocused())&&this.#h()},this.#c))}#P(){this.#g(),this.#v(this.#y())}#S(){this.#u&&(nt.clearTimeout(this.#u),this.#u=void 0)}#w(){this.#l&&(nt.clearInterval(this.#l),this.#l=void 0)}createResult(t,e){const s=this.#e,n=this.options,r=this.#r,i=this.#n,a=this.#o,c=t!==s?t.state:this.#s,{state:u}=t;let l={...u},d=!1,h;if(e._optimisticResults){const y=this.hasListeners(),R=!y&&ns(t,e),M=y&&rs(t,s,e,n);(R||M)&&(l={...l,...Ds(u.data,t.options)}),e._optimisticResults==="isRestoring"&&(l.fetchStatus="idle")}let{error:f,errorUpdatedAt:p,status:m}=l;h=l.data;let g=!1;if(e.placeholderData!==void 0&&h===void 0&&m==="pending"){let y;r?.isPlaceholderData&&e.placeholderData===a?.placeholderData?(y=r.data,g=!0):y=typeof e.placeholderData=="function"?e.placeholderData(this.#f?.state.data,this.#f):e.placeholderData,y!==void 0&&(m="success",h=ye(r?.data,y,e),d=!0)}if(e.select&&h!==void 0&&!g)if(r&&h===i?.data&&e.select===this.#m)h=this.#d;else try{this.#m=e.select,h=e.select(h),h=ye(r?.data,h,e),this.#d=h,this.#i=null}catch(y){this.#i=y}this.#i&&(f=this.#i,h=this.#d,p=Date.now(),m="error");const P=l.fetchStatus==="fetching",S=m==="pending",w=m==="error",v=S&&P,C=h!==void 0,x={status:m,fetchStatus:l.fetchStatus,isPending:S,isSuccess:m==="success",isError:w,isInitialLoading:v,isLoading:v,data:h,dataUpdatedAt:l.dataUpdatedAt,error:f,errorUpdatedAt:p,failureCount:l.fetchFailureCount,failureReason:l.fetchFailureReason,errorUpdateCount:l.errorUpdateCount,isFetched:l.dataUpdateCount>0||l.errorUpdateCount>0,isFetchedAfterMount:l.dataUpdateCount>c.dataUpdateCount||l.errorUpdateCount>c.errorUpdateCount,isFetching:P,isRefetching:P&&!S,isLoadingError:w&&!C,isPaused:l.fetchStatus==="paused",isPlaceholderData:d,isRefetchError:w&&C,isStale:Me(t,e),refetch:this.refetch,promise:this.#a,isEnabled:B(e.enabled,t)!==!1};if(this.options.experimental_prefetchInRender){const y=x.data!==void 0,R=x.status==="error"&&!y,M=k=>{R?k.reject(x.error):y&&k.resolve(x.data)},O=()=>{const k=this.#a=x.promise=ve();M(k)},E=this.#a;switch(E.status){case"pending":t.queryHash===s.queryHash&&M(E);break;case"fulfilled":(R||x.data!==E.value)&&O();break;case"rejected":(!R||x.error!==E.reason)&&O();break}}return x}updateResult(){const t=this.#r,e=this.createResult(this.#e,this.options);if(this.#n=this.#e.state,this.#o=this.options,this.#n.data!==void 0&&(this.#f=this.#e),Qt(e,t))return;this.#r=e;const s=()=>{if(!t)return!0;const{notifyOnChangeProps:n}=this.options,r=typeof n=="function"?n():n;if(r==="all"||!r&&!this.#p.size)return!0;const i=new Set(r??this.#p);return this.options.throwOnError&&i.add("error"),Object.keys(this.#r).some(a=>{const o=a;return this.#r[o]!==t[o]&&i.has(o)})};this.#b({listeners:s()})}#R(){const t=this.#t.getQueryCache().build(this.#t,this.options);if(t===this.#e)return;const e=this.#e;this.#e=t,this.#s=t.state,this.hasListeners()&&(e?.removeObserver(this),t.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#P()}#b(t){F.batch(()=>{t.listeners&&this.listeners.forEach(e=>{e(this.#r)}),this.#t.getQueryCache().notify({query:this.#e,type:"observerResultsUpdated"})})}};function An(t,e){return B(e.enabled,t)!==!1&&t.state.data===void 0&&!(t.state.status==="error"&&e.retryOnMount===!1)}function ns(t,e){return An(t,e)||t.state.data!==void 0&&Se(t,e,e.refetchOnMount)}function Se(t,e,s){if(B(e.enabled,t)!==!1&&tt(e.staleTime,t)!=="static"){const n=typeof s=="function"?s(t):s;return n==="always"||n!==!1&&Me(t,e)}return!1}function rs(t,e,s,n){return(t!==e||B(n.enabled,t)===!1)&&(!s.suspense||t.state.status!=="error")&&Me(t,s)}function Me(t,e){return B(e.enabled,t)!==!1&&t.isStaleByTime(tt(e.staleTime,t))}function Dn(t,e){return!Qt(t.getCurrentResult(),e)}function $t(t){return{onFetch:(e,s)=>{const n=e.options,r=e.fetchOptions?.meta?.fetchMore?.direction,i=e.state.data?.pages||[],a=e.state.data?.pageParams||[];let o={pages:[],pageParams:[]},c=0;const u=async()=>{let l=!1;const d=p=>{Mn(p,()=>e.signal,()=>l=!0)},h=Is(e.options,e.fetchOptions),f=async(p,m,g)=>{if(l)return Promise.reject();if(m==null&&p.pages.length)return Promise.resolve(p);const S=(()=>{const L={client:e.client,queryKey:e.queryKey,pageParam:m,direction:g?"backward":"forward",meta:e.options.meta};return d(L),L})(),w=await h(S),{maxPages:v}=e.options,C=g?Ln:Cn;return{pages:C(p.pages,w,v),pageParams:C(p.pageParams,m,v)}};if(r&&i.length){const p=r==="backward",m=p?Us:we,g={pages:i,pageParams:a},P=m(n,g);o=await f(g,P,p)}else{const p=t??i.length;do{const m=c===0?a[0]??n.initialPageParam:we(n,o);if(c>0&&m==null)break;o=await f(o,m),c++}while(c<p)}return o};e.options.persister?e.fetchFn=()=>e.options.persister?.(u,{client:e.client,queryKey:e.queryKey,meta:e.options.meta,signal:e.signal},s):e.fetchFn=u}}}function we(t,{pages:e,pageParams:s}){const n=e.length-1;return e.length>0?t.getNextPageParam(e[n],e,s[n],s):void 0}function Us(t,{pages:e,pageParams:s}){return e.length>0?t.getPreviousPageParam?.(e[0],e,s[0],s):void 0}function jn(t,e){return e?we(t,e)!=null:!1}function Un(t,e){return!e||!t.getPreviousPageParam?!1:Us(t,e)!=null}var Bn=class extends js{constructor(t,e){super(t,e)}bindMethods(){super.bindMethods(),this.fetchNextPage=this.fetchNextPage.bind(this),this.fetchPreviousPage=this.fetchPreviousPage.bind(this)}setOptions(t){super.setOptions({...t,behavior:$t()})}getOptimisticResult(t){return t.behavior=$t(),super.getOptimisticResult(t)}fetchNextPage(t){return this.fetch({...t,meta:{fetchMore:{direction:"forward"}}})}fetchPreviousPage(t){return this.fetch({...t,meta:{fetchMore:{direction:"backward"}}})}createResult(t,e){const{state:s}=t,n=super.createResult(t,e),{isFetching:r,isRefetching:i,isError:a,isRefetchError:o}=n,c=s.fetchMeta?.fetchMore?.direction,u=a&&c==="forward",l=r&&c==="forward",d=a&&c==="backward",h=r&&c==="backward";return{...n,fetchNextPage:this.fetchNextPage,fetchPreviousPage:this.fetchPreviousPage,hasNextPage:jn(e,s.data),hasPreviousPage:Un(e,s.data),isFetchNextPageError:u,isFetchingNextPage:l,isFetchPreviousPageError:d,isFetchingPreviousPage:h,isRefetchError:o&&!u&&!d,isRefetching:i&&!l&&!h}}},Nn=class extends As{#t;#e;#s;#r;constructor(t){super(),this.#t=t.client,this.mutationId=t.mutationId,this.#s=t.mutationCache,this.#e=[],this.state=t.state||Bs(),this.setOptions(t.options),this.scheduleGc()}setOptions(t){this.options=t,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(t){this.#e.includes(t)||(this.#e.push(t),this.clearGcTimeout(),this.#s.notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){this.#e=this.#e.filter(e=>e!==t),this.scheduleGc(),this.#s.notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){this.#e.length||(this.state.status==="pending"?this.scheduleGc():this.#s.remove(this))}continue(){return this.#r?.continue()??this.execute(this.state.variables)}async execute(t){const e=()=>{this.#n({type:"continue"})},s={client:this.#t,meta:this.options.meta,mutationKey:this.options.mutationKey};this.#r=Fs({fn:()=>this.options.mutationFn?this.options.mutationFn(t,s):Promise.reject(new Error("No mutationFn found")),onFail:(i,a)=>{this.#n({type:"failed",failureCount:i,error:a})},onPause:()=>{this.#n({type:"pause"})},onContinue:e,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#s.canRun(this)});const n=this.state.status==="pending",r=!this.#r.canStart();try{if(n)e();else{this.#n({type:"pending",variables:t,isPaused:r}),this.#s.config.onMutate&&await this.#s.config.onMutate(t,this,s);const a=await this.options.onMutate?.(t,s);a!==this.state.context&&this.#n({type:"pending",context:a,variables:t,isPaused:r})}const i=await this.#r.start();return await this.#s.config.onSuccess?.(i,t,this.state.context,this,s),await this.options.onSuccess?.(i,t,this.state.context,s),await this.#s.config.onSettled?.(i,null,this.state.variables,this.state.context,this,s),await this.options.onSettled?.(i,null,t,this.state.context,s),this.#n({type:"success",data:i}),i}catch(i){try{await this.#s.config.onError?.(i,t,this.state.context,this,s)}catch(a){Promise.reject(a)}try{await this.options.onError?.(i,t,this.state.context,s)}catch(a){Promise.reject(a)}try{await this.#s.config.onSettled?.(void 0,i,this.state.variables,this.state.context,this,s)}catch(a){Promise.reject(a)}try{await this.options.onSettled?.(void 0,i,t,this.state.context,s)}catch(a){Promise.reject(a)}throw this.#n({type:"error",error:i}),i}finally{this.#s.runNext(this)}}#n(t){const e=s=>{switch(t.type){case"failed":return{...s,failureCount:t.failureCount,failureReason:t.error};case"pause":return{...s,isPaused:!0};case"continue":return{...s,isPaused:!1};case"pending":return{...s,context:t.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:t.isPaused,status:"pending",variables:t.variables,submittedAt:Date.now()};case"success":return{...s,data:t.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...s,data:void 0,error:t.error,failureCount:s.failureCount+1,failureReason:t.error,isPaused:!1,status:"error"}}};this.state=e(this.state),F.batch(()=>{this.#e.forEach(s=>{s.onMutationUpdate(t)}),this.#s.notify({mutation:this,type:"updated",action:t})})}};function Bs(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var Qn=class extends vt{constructor(t={}){super(),this.config=t,this.#t=new Set,this.#e=new Map,this.#s=0}#t;#e;#s;build(t,e,s){const n=new Nn({client:t,mutationCache:this,mutationId:++this.#s,options:t.defaultMutationOptions(e),state:s});return this.add(n),n}add(t){this.#t.add(t);const e=At(t);if(typeof e=="string"){const s=this.#e.get(e);s?s.push(t):this.#e.set(e,[t])}this.notify({type:"added",mutation:t})}remove(t){if(this.#t.delete(t)){const e=At(t);if(typeof e=="string"){const s=this.#e.get(e);if(s)if(s.length>1){const n=s.indexOf(t);n!==-1&&s.splice(n,1)}else s[0]===t&&this.#e.delete(e)}}this.notify({type:"removed",mutation:t})}canRun(t){const e=At(t);if(typeof e=="string"){const n=this.#e.get(e)?.find(r=>r.state.status==="pending");return!n||n===t}else return!0}runNext(t){const e=At(t);return typeof e=="string"?this.#e.get(e)?.find(n=>n!==t&&n.state.isPaused)?.continue()??Promise.resolve():Promise.resolve()}clear(){F.batch(()=>{this.#t.forEach(t=>{this.notify({type:"removed",mutation:t})}),this.#t.clear(),this.#e.clear()})}getAll(){return Array.from(this.#t)}find(t){const e={exact:!0,...t};return this.getAll().find(s=>Xe(e,s))}findAll(t={}){return this.getAll().filter(e=>Xe(t,e))}notify(t){F.batch(()=>{this.listeners.forEach(e=>{e(t)})})}resumePausedMutations(){const t=this.getAll().filter(e=>e.state.isPaused);return F.batch(()=>Promise.all(t.map(e=>e.continue().catch(A))))}};function At(t){return t.options.scope?.id}var Kn=class extends vt{#t;#e=void 0;#s;#r;constructor(t,e){super(),this.#t=t,this.setOptions(e),this.bindMethods(),this.#n()}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(t){const e=this.options;this.options=this.#t.defaultMutationOptions(t),Qt(this.options,e)||this.#t.getMutationCache().notify({type:"observerOptionsUpdated",mutation:this.#s,observer:this}),e?.mutationKey&&this.options.mutationKey&&ut(e.mutationKey)!==ut(this.options.mutationKey)?this.reset():this.#s?.state.status==="pending"&&this.#s.setOptions(this.options)}onUnsubscribe(){this.hasListeners()||this.#s?.removeObserver(this)}onMutationUpdate(t){this.#n(),this.#o(t)}getCurrentResult(){return this.#e}reset(){this.#s?.removeObserver(this),this.#s=void 0,this.#n(),this.#o()}mutate(t,e){return this.#r=e,this.#s?.removeObserver(this),this.#s=this.#t.getMutationCache().build(this.#t,this.options),this.#s.addObserver(this),this.#s.execute(t)}#n(){const t=this.#s?.state??Bs();this.#e={...t,isPending:t.status==="pending",isSuccess:t.status==="success",isError:t.status==="error",isIdle:t.status==="idle",mutate:this.mutate,reset:this.reset}}#o(t){F.batch(()=>{if(this.#r&&this.hasListeners()){const e=this.#e.variables,s=this.#e.context,n={client:this.#t,meta:this.options.meta,mutationKey:this.options.mutationKey};if(t?.type==="success"){try{this.#r.onSuccess?.(t.data,e,s,n)}catch(r){Promise.reject(r)}try{this.#r.onSettled?.(t.data,null,e,s,n)}catch(r){Promise.reject(r)}}else if(t?.type==="error"){try{this.#r.onError?.(t.error,e,s,n)}catch(r){Promise.reject(r)}try{this.#r.onSettled?.(void 0,t.error,e,s,n)}catch(r){Promise.reject(r)}}}this.listeners.forEach(e=>{e(this.#e)})})}},$n=class extends vt{constructor(t={}){super(),this.config=t,this.#t=new Map}#t;build(t,e,s){const n=e.queryKey,r=e.queryHash??xe(n,e);let i=this.get(r);return i||(i=new Fn({client:t,queryKey:n,queryHash:r,options:t.defaultQueryOptions(e),state:s,defaultOptions:t.getQueryDefaults(n)}),this.add(i)),i}add(t){this.#t.has(t.queryHash)||(this.#t.set(t.queryHash,t),this.notify({type:"added",query:t}))}remove(t){const e=this.#t.get(t.queryHash);e&&(t.destroy(),e===t&&this.#t.delete(t.queryHash),this.notify({type:"removed",query:t}))}clear(){F.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}get(t){return this.#t.get(t)}getAll(){return[...this.#t.values()]}find(t){const e={exact:!0,...t};return this.getAll().find(s=>Ye(e,s))}findAll(t={}){const e=this.getAll();return Object.keys(t).length>0?e.filter(s=>Ye(t,s)):e}notify(t){F.batch(()=>{this.listeners.forEach(e=>{e(t)})})}onFocus(){F.batch(()=>{this.getAll().forEach(t=>{t.onFocus()})})}onOnline(){F.batch(()=>{this.getAll().forEach(t=>{t.onOnline()})})}},Ni=class{#t;#e;#s;#r;#n;#o;#a;#i;constructor(t={}){this.#t=t.queryCache||new $n,this.#e=t.mutationCache||new Qn,this.#s=t.defaultOptions||{},this.#r=new Map,this.#n=new Map,this.#o=0}mount(){this.#o++,this.#o===1&&(this.#a=Le.subscribe(async t=>{t&&(await this.resumePausedMutations(),this.#t.onFocus())}),this.#i=Kt.subscribe(async t=>{t&&(await this.resumePausedMutations(),this.#t.onOnline())}))}unmount(){this.#o--,this.#o===0&&(this.#a?.(),this.#a=void 0,this.#i?.(),this.#i=void 0)}isFetching(t){return this.#t.findAll({...t,fetchStatus:"fetching"}).length}isMutating(t){return this.#e.findAll({...t,status:"pending"}).length}getQueryData(t){const e=this.defaultQueryOptions({queryKey:t});return this.#t.get(e.queryHash)?.state.data}ensureQueryData(t){const e=this.defaultQueryOptions(t),s=this.#t.build(this,e),n=s.state.data;return n===void 0?this.fetchQuery(t):(t.revalidateIfStale&&s.isStaleByTime(tt(e.staleTime,s))&&this.prefetchQuery(e),Promise.resolve(n))}getQueriesData(t){return this.#t.findAll(t).map(({queryKey:e,state:s})=>{const n=s.data;return[e,n]})}setQueryData(t,e,s){const n=this.defaultQueryOptions({queryKey:t}),i=this.#t.get(n.queryHash)?.state.data,a=bn(e,i);if(a!==void 0)return this.#t.build(this,n).setData(a,{...s,manual:!0})}setQueriesData(t,e,s){return F.batch(()=>this.#t.findAll(t).map(({queryKey:n})=>[n,this.setQueryData(n,e,s)]))}getQueryState(t){const e=this.defaultQueryOptions({queryKey:t});return this.#t.get(e.queryHash)?.state}removeQueries(t){const e=this.#t;F.batch(()=>{e.findAll(t).forEach(s=>{e.remove(s)})})}resetQueries(t,e){const s=this.#t;return F.batch(()=>(s.findAll(t).forEach(n=>{n.reset()}),this.refetchQueries({type:"active",...t},e)))}cancelQueries(t,e={}){const s={revert:!0,...e},n=F.batch(()=>this.#t.findAll(t).map(r=>r.cancel(s)));return Promise.all(n).then(A).catch(A)}invalidateQueries(t,e={}){return F.batch(()=>(this.#t.findAll(t).forEach(s=>{s.invalidate()}),t?.refetchType==="none"?Promise.resolve():this.refetchQueries({...t,type:t?.refetchType??t?.type??"active"},e)))}refetchQueries(t,e={}){const s={...e,cancelRefetch:e.cancelRefetch??!0},n=F.batch(()=>this.#t.findAll(t).filter(r=>!r.isDisabled()&&!r.isStatic()).map(r=>{let i=r.fetch(void 0,s);return s.throwOnError||(i=i.catch(A)),r.state.fetchStatus==="paused"?Promise.resolve():i}));return Promise.all(n).then(A)}fetchQuery(t){const e=this.defaultQueryOptions(t);e.retry===void 0&&(e.retry=!1);const s=this.#t.build(this,e);return s.isStaleByTime(tt(e.staleTime,s))?s.fetch(e):Promise.resolve(s.state.data)}prefetchQuery(t){return this.fetchQuery(t).then(A).catch(A)}fetchInfiniteQuery(t){return t.behavior=$t(t.pages),this.fetchQuery(t)}prefetchInfiniteQuery(t){return this.fetchInfiniteQuery(t).then(A).catch(A)}ensureInfiniteQueryData(t){return t.behavior=$t(t.pages),this.ensureQueryData(t)}resumePausedMutations(){return Kt.isOnline()?this.#e.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#t}getMutationCache(){return this.#e}getDefaultOptions(){return this.#s}setDefaultOptions(t){this.#s=t}setQueryDefaults(t,e){this.#r.set(ut(t),{queryKey:t,defaultOptions:e})}getQueryDefaults(t){const e=[...this.#r.values()],s={};return e.forEach(n=>{Ot(t,n.queryKey)&&Object.assign(s,n.defaultOptions)}),s}setMutationDefaults(t,e){this.#n.set(ut(t),{mutationKey:t,defaultOptions:e})}getMutationDefaults(t){const e=[...this.#n.values()],s={};return e.forEach(n=>{Ot(t,n.mutationKey)&&Object.assign(s,n.defaultOptions)}),s}defaultQueryOptions(t){if(t._defaulted)return t;const e={...this.#s.queries,...this.getQueryDefaults(t.queryKey),...t,_defaulted:!0};return e.queryHash||(e.queryHash=xe(e.queryKey,e)),e.refetchOnReconnect===void 0&&(e.refetchOnReconnect=e.networkMode!=="always"),e.throwOnError===void 0&&(e.throwOnError=!!e.suspense),!e.networkMode&&e.persister&&(e.networkMode="offlineFirst"),e.queryFn===_e&&(e.enabled=!1),e}defaultMutationOptions(t){return t?._defaulted?t:{...this.#s.mutations,...t?.mutationKey&&this.getMutationDefaults(t.mutationKey),...t,_defaulted:!0}}clear(){this.#t.clear(),this.#e.clear()}},Ns=b.createContext(void 0),Qs=t=>{const e=b.useContext(Ns);if(!e)throw new Error("No QueryClient set, use QueryClientProvider to set one");return e},Qi=({client:t,children:e})=>(b.useEffect(()=>(t.mount(),()=>{t.unmount()}),[t]),_.jsx(Ns.Provider,{value:t,children:e})),Ks=b.createContext(!1),qn=()=>b.useContext(Ks);Ks.Provider;function Hn(){let t=!1;return{clearReset:()=>{t=!1},reset:()=>{t=!0},isReset:()=>t}}var Wn=b.createContext(Hn()),zn=()=>b.useContext(Wn),Vn=(t,e,s)=>{const n=s?.state.error&&typeof t.throwOnError=="function"?Ce(t.throwOnError,[s.state.error,s]):t.throwOnError;(t.suspense||t.experimental_prefetchInRender||n)&&(e.isReset()||(t.retryOnMount=!1))},Gn=t=>{b.useEffect(()=>{t.clearReset()},[t])},Jn=({result:t,errorResetBoundary:e,throwOnError:s,query:n,suspense:r})=>t.isError&&!e.isReset()&&!t.isFetching&&n&&(r&&t.data===void 0||Ce(s,[t.error,n])),Yn=t=>{if(t.suspense){const s=r=>r==="static"?r:Math.max(r??1e3,1e3),n=t.staleTime;t.staleTime=typeof n=="function"?(...r)=>s(n(...r)):s(n),typeof t.gcTime=="number"&&(t.gcTime=Math.max(t.gcTime,1e3))}},Xn=(t,e)=>t.isLoading&&t.isFetching&&!e,Zn=(t,e)=>t?.suspense&&e.isPending,is=(t,e,s)=>e.fetchOptimistic(t).catch(()=>{s.clearReset()});function $s(t,e,s){const n=qn(),r=zn(),i=Qs(),a=i.defaultQueryOptions(t);i.getDefaultOptions().queries?._experimental_beforeQuery?.(a);const o=i.getQueryCache().get(a.queryHash);a._optimisticResults=n?"isRestoring":"optimistic",Yn(a),Vn(a,r,o),Gn(r);const c=!i.getQueryCache().get(a.queryHash),[u]=b.useState(()=>new e(i,a)),l=u.getOptimisticResult(a),d=!n&&t.subscribed!==!1;if(b.useSyncExternalStore(b.useCallback(h=>{const f=d?u.subscribe(F.batchCalls(h)):A;return u.updateResult(),f},[u,d]),()=>u.getCurrentResult(),()=>u.getCurrentResult()),b.useEffect(()=>{u.setOptions(a)},[a,u]),Zn(a,l))throw is(a,u,r);if(Jn({result:l,errorResetBoundary:r,throwOnError:a.throwOnError,query:o,suspense:a.suspense}))throw l.error;return i.getDefaultOptions().queries?._experimental_afterQuery?.(a,l),a.experimental_prefetchInRender&&!ct&&Xn(l,n)&&(c?is(a,u,r):o?.promise)?.catch(A).finally(()=>{u.updateResult()}),a.notifyOnChangeProps?l:u.trackResult(l)}function Ki(t,e){return $s(t,js)}function $i(t,e){const s=Qs(),[n]=b.useState(()=>new Kn(s,t));b.useEffect(()=>{n.setOptions(t)},[n,t]);const r=b.useSyncExternalStore(b.useCallback(a=>n.subscribe(F.batchCalls(a)),[n]),()=>n.getCurrentResult(),()=>n.getCurrentResult()),i=b.useCallback((a,o)=>{n.mutate(a,o).catch(A)},[n]);if(r.error&&Ce(n.options.throwOnError,[r.error]))throw r.error;return{...r,mutate:i,mutateAsync:r.mutate}}function qi(t,e){return $s(t,Bn)}function tr(t){return typeof t=="function"}class er{constructor(e,s){this.listeners=new Set,this.subscribe=n=>{var r,i;this.listeners.add(n);const a=(i=(r=this.options)==null?void 0:r.onSubscribe)==null?void 0:i.call(r,n,this);return()=>{this.listeners.delete(n),a?.()}},this.prevState=e,this.state=e,this.options=s}setState(e){var s,n,r;this.prevState=this.state,(s=this.options)!=null&&s.updateFn?this.state=this.options.updateFn(this.prevState)(e):tr(e)?this.state=e(this.prevState):this.state=e,(r=(n=this.options)==null?void 0:n.onUpdate)==null||r.call(n),yn(this)}}const et="__TSR_index",os="popstate",as="beforeunload";function sr(t){let e=t.getLocation();const s=new Set,n=a=>{e=t.getLocation(),s.forEach(o=>o({location:e,action:a}))},r=a=>{t.notifyOnIndexChange??!0?n(a):e=t.getLocation()},i=async({task:a,navigateOpts:o,...c})=>{if(o?.ignoreBlocker??!1){a();return}const l=t.getBlockers?.()??[],d=c.type==="PUSH"||c.type==="REPLACE";if(typeof document<"u"&&l.length&&d)for(const h of l){const f=qt(c.path,c.state);if(await h.blockerFn({currentLocation:e,nextLocation:f,action:c.type})){t.onBlocked?.();return}}a()};return{get location(){return e},get length(){return t.getLength()},subscribers:s,subscribe:a=>(s.add(a),()=>{s.delete(a)}),push:(a,o,c)=>{const u=e.state[et];o=cs(u+1,o),i({task:()=>{t.pushState(a,o),n({type:"PUSH"})},navigateOpts:c,type:"PUSH",path:a,state:o})},replace:(a,o,c)=>{const u=e.state[et];o=cs(u,o),i({task:()=>{t.replaceState(a,o),n({type:"REPLACE"})},navigateOpts:c,type:"REPLACE",path:a,state:o})},go:(a,o)=>{i({task:()=>{t.go(a),r({type:"GO",index:a})},navigateOpts:o,type:"GO"})},back:a=>{i({task:()=>{t.back(a?.ignoreBlocker??!1),r({type:"BACK"})},navigateOpts:a,type:"BACK"})},forward:a=>{i({task:()=>{t.forward(a?.ignoreBlocker??!1),r({type:"FORWARD"})},navigateOpts:a,type:"FORWARD"})},canGoBack:()=>e.state[et]!==0,createHref:a=>t.createHref(a),block:a=>{if(!t.setBlockers)return()=>{};const o=t.getBlockers?.()??[];return t.setBlockers([...o,a]),()=>{const c=t.getBlockers?.()??[];t.setBlockers?.(c.filter(u=>u!==a))}},flush:()=>t.flush?.(),destroy:()=>t.destroy?.(),notify:n}}function cs(t,e){e||(e={});const s=Oe();return{...e,key:s,__TSR_key:s,[et]:t}}function nr(t){const e=typeof document<"u"?window:void 0,s=e.history.pushState,n=e.history.replaceState;let r=[];const i=()=>r,a=y=>r=y,o=(y=>y),c=(()=>qt(`${e.location.pathname}${e.location.search}${e.location.hash}`,e.history.state));if(!e.history.state?.__TSR_key&&!e.history.state?.key){const y=Oe();e.history.replaceState({[et]:0,key:y,__TSR_key:y},"")}let u=c(),l,d=!1,h=!1,f=!1,p=!1;const m=()=>u;let g,P;const S=()=>{g&&(x._ignoreSubscribers=!0,(g.isPush?e.history.pushState:e.history.replaceState)(g.state,"",g.href),x._ignoreSubscribers=!1,g=void 0,P=void 0,l=void 0)},w=(y,R,M)=>{const O=o(R);P||(l=u),u=qt(R,M),g={href:O,state:M,isPush:g?.isPush||y==="push"},P||(P=Promise.resolve().then(()=>S()))},v=y=>{u=c(),x.notify({type:y})},C=async()=>{if(h){h=!1;return}const y=c(),R=y.state[et]-u.state[et],M=R===1,O=R===-1,E=!M&&!O||d;d=!1;const k=E?"GO":O?"BACK":"FORWARD",I=E?{type:"GO",index:R}:{type:O?"BACK":"FORWARD"};if(f)f=!1;else{const J=i();if(typeof document<"u"&&J.length){for(const H of J)if(await H.blockerFn({currentLocation:u,nextLocation:y,action:k})){h=!0,e.history.go(1),x.notify(I);return}}}u=c(),x.notify(I)},L=y=>{if(p){p=!1;return}let R=!1;const M=i();if(typeof document<"u"&&M.length)for(const O of M){const E=O.enableBeforeUnload??!0;if(E===!0){R=!0;break}if(typeof E=="function"&&E()===!0){R=!0;break}}if(R)return y.preventDefault(),y.returnValue=""},x=sr({getLocation:m,getLength:()=>e.history.length,pushState:(y,R)=>w("push",y,R),replaceState:(y,R)=>w("replace",y,R),back:y=>(y&&(f=!0),p=!0,e.history.back()),forward:y=>{y&&(f=!0),p=!0,e.history.forward()},go:y=>{d=!0,e.history.go(y)},createHref:y=>o(y),flush:S,destroy:()=>{e.history.pushState=s,e.history.replaceState=n,e.removeEventListener(as,L,{capture:!0}),e.removeEventListener(os,C)},onBlocked:()=>{l&&u!==l&&(u=l)},getBlockers:i,setBlockers:a,notifyOnIndexChange:!1});return e.addEventListener(as,L,{capture:!0}),e.addEventListener(os,C),e.history.pushState=function(...y){const R=s.apply(e.history,y);return x._ignoreSubscribers||v("PUSH"),R},e.history.replaceState=function(...y){const R=n.apply(e.history,y);return x._ignoreSubscribers||v("REPLACE"),R},x}function rr(t){let e=t.replace(/[\x00-\x1f\x7f]/g,"");return e.startsWith("//")&&(e="/"+e.replace(/^\/+/,"")),e}function qt(t,e){const s=rr(t),n=s.indexOf("#"),r=s.indexOf("?"),i=Oe();return{href:s,pathname:s.substring(0,n>0?r>0?Math.min(n,r):n:r>0?r:s.length),hash:n>-1?s.substring(n):"",search:r>-1?s.slice(r,n===-1?void 0:n):"",state:e||{[et]:0,key:i,__TSR_key:i}}}function Oe(){return(Math.random()+1).toString(36).substring(7)}const ir=!1;function Lt(t){let e;return vn(()=>{e=t()}),e}function Et(t){return t[t.length-1]}function or(t){return typeof t=="function"}function X(t,e){return or(t)?t(e):t}const ar=Object.prototype.hasOwnProperty,us=Object.prototype.propertyIsEnumerable;function j(t,e,s=0){if(t===e)return t;if(s>500)return e;const n=e,r=ds(t)&&ds(n);if(!r&&!(Ht(t)&&Ht(n)))return n;const i=r?t:ls(t);if(!i)return n;const a=r?n:ls(n);if(!a)return n;const o=i.length,c=a.length,u=r?new Array(c):{};let l=0;for(let d=0;d<c;d++){const h=r?d:a[d],f=t[h],p=n[h];if(f===p){u[h]=f,(r?d<o:ar.call(t,h))&&l++;continue}if(f===null||p===null||typeof f!="object"||typeof p!="object"){u[h]=p;continue}const m=j(f,p,s+1);u[h]=m,m===f&&l++}return o===c&&l===o?t:u}function ls(t){const e=Object.getOwnPropertyNames(t);for(const r of e)if(!us.call(t,r))return!1;const s=Object.getOwnPropertySymbols(t);if(s.length===0)return e;const n=e;for(const r of s){if(!us.call(t,r))return!1;n.push(r)}return n}function Ht(t){if(!hs(t))return!1;const e=t.constructor;if(typeof e>"u")return!0;const s=e.prototype;return!(!hs(s)||!s.hasOwnProperty("isPrototypeOf"))}function hs(t){return Object.prototype.toString.call(t)==="[object Object]"}function ds(t){return Array.isArray(t)&&t.length===Object.keys(t).length}function ot(t,e,s){if(t===e)return!0;if(typeof t!=typeof e)return!1;if(Array.isArray(t)&&Array.isArray(e)){if(t.length!==e.length)return!1;for(let n=0,r=t.length;n<r;n++)if(!ot(t[n],e[n],s))return!1;return!0}if(Ht(t)&&Ht(e)){const n=s?.ignoreUndefined??!0;if(s?.partial){for(const a in e)if((!n||e[a]!==void 0)&&!ot(t[a],e[a],s))return!1;return!0}let r=0;if(!n)r=Object.keys(t).length;else for(const a in t)t[a]!==void 0&&r++;let i=0;for(const a in e)if((!n||e[a]!==void 0)&&(i++,i>r||!ot(t[a],e[a],s)))return!1;return r===i}return!1}function gt(t){let e,s;const n=new Promise((r,i)=>{e=r,s=i});return n.status="pending",n.resolve=r=>{n.status="resolved",n.value=r,e(r),t?.(r)},n.reject=r=>{n.status="rejected",s(r)},n}function pt(t){return!!(t&&typeof t=="object"&&typeof t.then=="function")}function cr(t){return t.replace(/[\x00-\x1f\x7f]/g,"")}function fs(t){let e;try{e=decodeURI(t)}catch{e=t.replaceAll(/%[0-9A-F]{2}/gi,s=>{try{return decodeURI(s)}catch{return s}})}return cr(e)}const qs=["http:","https:","mailto:","tel:"];function Wt(t){if(!t)return!1;try{const e=new URL(t);return!qs.includes(e.protocol)}catch{return!1}}function Rt(t){if(!t)return{path:t,handledProtocolRelativeURL:!1};if(!/[%\\\x00-\x1f\x7f]/.test(t)&&!t.startsWith("//"))return{path:t,handledProtocolRelativeURL:!1};const e=/%25|%5C/gi;let s=0,n="",r;for(;(r=e.exec(t))!==null;)n+=fs(t.slice(s,r.index))+r[0],s=e.lastIndex;n=n+fs(s?t.slice(s):t);let i=!1;return n.startsWith("//")&&(i=!0,n="/"+n.replace(/^\/+/,"")),{path:n,handledProtocolRelativeURL:i}}function ur(t){return/\s|[^\u0000-\u007F]/.test(t)?t.replace(/\s|[^\u0000-\u007F]/gu,encodeURIComponent):t}var lr="Invariant failed";function G(t,e){if(!t)throw new Error(lr)}function zt(t){const e=new Map;let s,n;const r=i=>{i.next&&(i.prev?(i.prev.next=i.next,i.next.prev=i.prev,i.next=void 0,n&&(n.next=i,i.prev=n)):(i.next.prev=void 0,s=i.next,i.next=void 0,n&&(i.prev=n,n.next=i)),n=i)};return{get(i){const a=e.get(i);if(a)return r(a),a.value},set(i,a){if(e.size>=t&&s){const c=s;e.delete(c.key),c.next&&(s=c.next,c.next.prev=void 0),c===n&&(n=void 0)}const o=e.get(i);if(o)o.value=a,r(o);else{const c={key:i,value:a,prev:n};n&&(n.next=c),n=c,s||(s=c),e.set(i,c)}},clear(){e.clear(),s=void 0,n=void 0}}}const yt=0,lt=1,ht=2,kt=3,rt=4,Hs=5;function hr(t){const e=t.indexOf("{");if(e===-1)return null;const s=t.indexOf("}",e);return s===-1||e+1>=t.length?null:[e,s]}function Ee(t,e,s=new Uint16Array(6)){const n=t.indexOf("/",e),r=n===-1?t.length:n,i=t.substring(e,r);if(!i||!i.includes("$"))return s[0]=yt,s[1]=e,s[2]=e,s[3]=r,s[4]=r,s[5]=r,s;if(i==="$"){const o=t.length;return s[0]=ht,s[1]=e,s[2]=e,s[3]=o,s[4]=o,s[5]=o,s}if(i.charCodeAt(0)===36)return s[0]=lt,s[1]=e,s[2]=e+1,s[3]=r,s[4]=r,s[5]=r,s;const a=hr(i);if(a){const[o,c]=a,u=i.charCodeAt(o+1);if(u===45){if(o+2<i.length&&i.charCodeAt(o+2)===36){const l=o+3,d=c;if(l<d)return s[0]=kt,s[1]=e+o,s[2]=e+l,s[3]=e+d,s[4]=e+c+1,s[5]=r,s}}else if(u===36){const l=o+1,d=o+2;return d===c?(s[0]=ht,s[1]=e+o,s[2]=e+l,s[3]=e+d,s[4]=e+c+1,s[5]=t.length,s):(s[0]=lt,s[1]=e+o,s[2]=e+d,s[3]=e+c,s[4]=e+c+1,s[5]=r,s)}}return s[0]=yt,s[1]=e,s[2]=e,s[3]=r,s[4]=r,s[5]=r,s}function Yt(t,e,s,n,r,i,a){a?.(s);let o=n;{const c=s.fullPath??s.from,u=c.length,l=s.options?.caseSensitive??t,d=!!(s.options?.params?.parse&&s.options?.skipRouteOnParseError?.params);for(;o<u;){const f=Ee(c,o,e);let p;const m=o,g=f[5];switch(o=g+1,i++,f[0]){case yt:{const S=c.substring(f[2],f[3]);if(l){const w=r.static?.get(S);if(w)p=w;else{r.static??=new Map;const v=it(s.fullPath??s.from);v.parent=r,v.depth=i,p=v,r.static.set(S,v)}}else{const w=S.toLowerCase(),v=r.staticInsensitive?.get(w);if(v)p=v;else{r.staticInsensitive??=new Map;const C=it(s.fullPath??s.from);C.parent=r,C.depth=i,p=C,r.staticInsensitive.set(w,C)}}break}case lt:{const S=c.substring(m,f[1]),w=c.substring(f[4],g),v=l&&!!(S||w),C=S?v?S:S.toLowerCase():void 0,L=w?v?w:w.toLowerCase():void 0,x=!d&&r.dynamic?.find(y=>!y.skipOnParamError&&y.caseSensitive===v&&y.prefix===C&&y.suffix===L);if(x)p=x;else{const y=ne(lt,s.fullPath??s.from,v,C,L);p=y,y.depth=i,y.parent=r,r.dynamic??=[],r.dynamic.push(y)}break}case kt:{const S=c.substring(m,f[1]),w=c.substring(f[4],g),v=l&&!!(S||w),C=S?v?S:S.toLowerCase():void 0,L=w?v?w:w.toLowerCase():void 0,x=!d&&r.optional?.find(y=>!y.skipOnParamError&&y.caseSensitive===v&&y.prefix===C&&y.suffix===L);if(x)p=x;else{const y=ne(kt,s.fullPath??s.from,v,C,L);p=y,y.parent=r,y.depth=i,r.optional??=[],r.optional.push(y)}break}case ht:{const S=c.substring(m,f[1]),w=c.substring(f[4],g),v=l&&!!(S||w),C=S?v?S:S.toLowerCase():void 0,L=w?v?w:w.toLowerCase():void 0,x=ne(ht,s.fullPath??s.from,v,C,L);p=x,x.parent=r,x.depth=i,r.wildcard??=[],r.wildcard.push(x)}}r=p}if(d&&s.children&&!s.isRoot&&s.id&&s.id.charCodeAt(s.id.lastIndexOf("/")+1)===95){const f=it(s.fullPath??s.from);f.kind=Hs,f.parent=r,i++,f.depth=i,r.pathless??=[],r.pathless.push(f),r=f}const h=(s.path||!s.children)&&!s.isRoot;if(h&&c.endsWith("/")){const f=it(s.fullPath??s.from);f.kind=rt,f.parent=r,i++,f.depth=i,r.index=f,r=f}r.parse=s.options?.params?.parse??null,r.skipOnParamError=d,r.parsingPriority=s.options?.skipRouteOnParseError?.priority??0,h&&!r.route&&(r.route=s,r.fullPath=s.fullPath??s.from)}if(s.children)for(const c of s.children)Yt(t,e,c,o,r,i,a)}function se(t,e){if(t.skipOnParamError&&!e.skipOnParamError)return-1;if(!t.skipOnParamError&&e.skipOnParamError)return 1;if(t.skipOnParamError&&e.skipOnParamError&&(t.parsingPriority||e.parsingPriority))return e.parsingPriority-t.parsingPriority;if(t.prefix&&e.prefix&&t.prefix!==e.prefix){if(t.prefix.startsWith(e.prefix))return-1;if(e.prefix.startsWith(t.prefix))return 1}if(t.suffix&&e.suffix&&t.suffix!==e.suffix){if(t.suffix.endsWith(e.suffix))return-1;if(e.suffix.endsWith(t.suffix))return 1}return t.prefix&&!e.prefix?-1:!t.prefix&&e.prefix?1:t.suffix&&!e.suffix?-1:!t.suffix&&e.suffix?1:t.caseSensitive&&!e.caseSensitive?-1:!t.caseSensitive&&e.caseSensitive?1:0}function Y(t){if(t.pathless)for(const e of t.pathless)Y(e);if(t.static)for(const e of t.static.values())Y(e);if(t.staticInsensitive)for(const e of t.staticInsensitive.values())Y(e);if(t.dynamic?.length){t.dynamic.sort(se);for(const e of t.dynamic)Y(e)}if(t.optional?.length){t.optional.sort(se);for(const e of t.optional)Y(e)}if(t.wildcard?.length){t.wildcard.sort(se);for(const e of t.wildcard)Y(e)}}function it(t){return{kind:yt,depth:0,pathless:null,index:null,static:null,staticInsensitive:null,dynamic:null,optional:null,wildcard:null,route:null,fullPath:t,parent:null,parse:null,skipOnParamError:!1,parsingPriority:0}}function ne(t,e,s,n,r){return{kind:t,depth:0,pathless:null,index:null,static:null,staticInsensitive:null,dynamic:null,optional:null,wildcard:null,route:null,fullPath:e,parent:null,parse:null,skipOnParamError:!1,parsingPriority:0,caseSensitive:s,prefix:n,suffix:r}}function dr(t,e){const s=it("/"),n=new Uint16Array(6);for(const r of t)Yt(!1,n,r,1,s,0);Y(s),e.masksTree=s,e.flatCache=zt(1e3)}function fr(t,e){t||="/";const s=e.flatCache.get(t);if(s)return s;const n=ke(t,e.masksTree);return e.flatCache.set(t,n),n}function pr(t,e,s,n,r){t||="/",n||="/";const i=e?`case\0${t}`:t;let a=r.singleCache.get(i);if(!a){a=it("/");const o=new Uint16Array(6);Yt(e,o,{from:t},1,a,0),r.singleCache.set(i,a)}return ke(n,a,s)}function mr(t,e,s=!1){const n=s?t:`nofuzz\0${t}`,r=e.matchCache.get(n);if(r!==void 0)return r;t||="/";let i;try{i=ke(t,e.segmentTree,s)}catch(a){if(a instanceof URIError)i=null;else throw a}return i&&(i.branch=vr(i.route)),e.matchCache.set(n,i),i}function gr(t){return t==="/"?t:t.replace(/\/{1,}$/,"")}function yr(t,e=!1,s){const n=it(t.fullPath),r=new Uint16Array(6),i={},a={};let o=0;return Yt(e,r,t,1,n,0,u=>{if(s?.(u,o),G(!(u.id in i),`Duplicate routes found with id: ${String(u.id)}`),i[u.id]=u,o!==0&&u.path){const l=gr(u.fullPath);(!a[l]||u.fullPath.endsWith("/"))&&(a[l]=u)}o++}),Y(n),{processedTree:{segmentTree:n,singleCache:zt(1e3),matchCache:zt(1e3),flatCache:null,masksTree:null},routesById:i,routesByPath:a}}function ke(t,e,s=!1){const n=t.split("/"),r=Sr(t,n,e,s);if(!r)return null;const[i]=Ws(t,n,r);return{route:r.node.route,rawParams:i,parsedParams:r.parsedParams}}function Ws(t,e,s){const n=Pr(s.node);let r=null;const i={};let a=s.extract?.part??0,o=s.extract?.node??0,c=s.extract?.path??0,u=s.extract?.segment??0;for(;o<n.length;a++,o++,c++,u++){const l=n[o];if(l.kind===rt)break;if(l.kind===Hs){u--,a--,c--;continue}const d=e[a],h=c;if(d&&(c+=d.length),l.kind===lt){r??=s.node.fullPath.split("/");const f=r[u],p=l.prefix?.length??0;if(f.charCodeAt(p)===123){const g=l.suffix?.length??0,P=f.substring(p+2,f.length-g-1),S=d.substring(p,d.length-g);i[P]=decodeURIComponent(S)}else{const g=f.substring(1);i[g]=decodeURIComponent(d)}}else if(l.kind===kt){if(s.skipped&1<<o){a--,c=h-1;continue}r??=s.node.fullPath.split("/");const f=r[u],p=l.prefix?.length??0,m=l.suffix?.length??0,g=f.substring(p+3,f.length-m-1),P=l.suffix||l.prefix?d.substring(p,d.length-m):d;P&&(i[g]=decodeURIComponent(P))}else if(l.kind===ht){const f=l,p=t.substring(h+(f.prefix?.length??0),t.length-(f.suffix?.length??0)),m=decodeURIComponent(p);i["*"]=m,i._splat=m;break}}return s.rawParams&&Object.assign(i,s.rawParams),[i,{part:a,node:o,path:c,segment:u}]}function vr(t){const e=[t];for(;t.parentRoute;)t=t.parentRoute,e.push(t);return e.reverse(),e}function Pr(t){const e=Array(t.depth+1);do e[t.depth]=t,t=t.parent;while(t);return e}function Sr(t,e,s,n){if(t==="/"&&s.index)return{node:s.index,skipped:0};const r=!Et(e),i=r&&t!=="/",a=e.length-(r?1:0),o=[{node:s,index:1,skipped:0,depth:1,statics:1,dynamics:0,optionals:0}];let c=null,u=null,l=null;for(;o.length;){const d=o.pop(),{node:h,index:f,skipped:p,depth:m,statics:g,dynamics:P,optionals:S}=d;let{extract:w,rawParams:v,parsedParams:C}=d;if(h.skipOnParamError){if(!re(t,e,d))continue;v=d.rawParams,w=d.extract,C=d.parsedParams}n&&h.route&&h.kind!==rt&&bt(u,d)&&(u=d);const L=f===a;if(L&&(h.route&&!i&&bt(l,d)&&(l=d),!h.optional&&!h.wildcard&&!h.index&&!h.pathless))continue;const x=L?void 0:e[f];let y;if(L&&h.index){const R={node:h.index,index:f,skipped:p,depth:m+1,statics:g,dynamics:P,optionals:S,extract:w,rawParams:v,parsedParams:C};let M=!0;if(h.index.skipOnParamError&&(re(t,e,R)||(M=!1)),M){if(g===a&&!P&&!S&&!p)return R;bt(l,R)&&(l=R)}}if(h.wildcard&&bt(c,d))for(const R of h.wildcard){const{prefix:M,suffix:O}=R;if(M&&(L||!(R.caseSensitive?x:y??=x.toLowerCase()).startsWith(M)))continue;if(O){if(L)continue;const k=e.slice(f).join("/").slice(-O.length);if((R.caseSensitive?k:k.toLowerCase())!==O)continue}const E={node:R,index:a,skipped:p,depth:m,statics:g,dynamics:P,optionals:S,extract:w,rawParams:v,parsedParams:C};if(!(R.skipOnParamError&&!re(t,e,E))){c=E;break}}if(h.optional){const R=p|1<<m,M=m+1;for(let O=h.optional.length-1;O>=0;O--){const E=h.optional[O];o.push({node:E,index:f,skipped:R,depth:M,statics:g,dynamics:P,optionals:S,extract:w,rawParams:v,parsedParams:C})}if(!L)for(let O=h.optional.length-1;O>=0;O--){const E=h.optional[O],{prefix:k,suffix:I}=E;if(k||I){const J=E.caseSensitive?x:y??=x.toLowerCase();if(k&&!J.startsWith(k)||I&&!J.endsWith(I))continue}o.push({node:E,index:f+1,skipped:p,depth:M,statics:g,dynamics:P,optionals:S+1,extract:w,rawParams:v,parsedParams:C})}}if(!L&&h.dynamic&&x)for(let R=h.dynamic.length-1;R>=0;R--){const M=h.dynamic[R],{prefix:O,suffix:E}=M;if(O||E){const k=M.caseSensitive?x:y??=x.toLowerCase();if(O&&!k.startsWith(O)||E&&!k.endsWith(E))continue}o.push({node:M,index:f+1,skipped:p,depth:m+1,statics:g,dynamics:P+1,optionals:S,extract:w,rawParams:v,parsedParams:C})}if(!L&&h.staticInsensitive){const R=h.staticInsensitive.get(y??=x.toLowerCase());R&&o.push({node:R,index:f+1,skipped:p,depth:m+1,statics:g+1,dynamics:P,optionals:S,extract:w,rawParams:v,parsedParams:C})}if(!L&&h.static){const R=h.static.get(x);R&&o.push({node:R,index:f+1,skipped:p,depth:m+1,statics:g+1,dynamics:P,optionals:S,extract:w,rawParams:v,parsedParams:C})}if(h.pathless){const R=m+1;for(let M=h.pathless.length-1;M>=0;M--){const O=h.pathless[M];o.push({node:O,index:f,skipped:p,depth:R,statics:g,dynamics:P,optionals:S,extract:w,rawParams:v,parsedParams:C})}}}if(l&&c)return bt(c,l)?l:c;if(l)return l;if(c)return c;if(n&&u){let d=u.index;for(let f=0;f<u.index;f++)d+=e[f].length;const h=d===t.length?"/":t.slice(d);return u.rawParams??={},u.rawParams["**"]=decodeURIComponent(h),u}return null}function re(t,e,s){try{const[n,r]=Ws(t,e,s);s.rawParams=n,s.extract=r;const i=s.node.parse(n);return s.parsedParams=Object.assign({},s.parsedParams,i),!0}catch{return null}}function bt(t,e){return t?e.statics>t.statics||e.statics===t.statics&&(e.dynamics>t.dynamics||e.dynamics===t.dynamics&&(e.optionals>t.optionals||e.optionals===t.optionals&&((e.node.kind===rt)>(t.node.kind===rt)||e.node.kind===rt==(t.node.kind===rt)&&e.depth>t.depth))):!0}function Ut(t){return Ie(t.filter(e=>e!==void 0).join("/"))}function Ie(t){return t.replace(/\/{2,}/g,"/")}function zs(t){return t==="/"?t:t.replace(/^\/{1,}/,"")}function V(t){const e=t.length;return e>1&&t[e-1]==="/"?t.replace(/\/{1,}$/,""):t}function Vs(t){return V(zs(t))}function Vt(t,e){return t?.endsWith("/")&&t!=="/"&&t!==`${e}/`?t.slice(0,-1):t}function wr(t,e,s){return Vt(t,s)===Vt(e,s)}function Rr({base:t,to:e,trailingSlash:s="never",cache:n}){const r=e.startsWith("/"),i=!r&&e===".";let a;if(n){a=r?e:i?t:t+"\0"+e;const d=n.get(a);if(d)return d}let o;if(i)o=t.split("/");else if(r)o=e.split("/");else{for(o=t.split("/");o.length>1&&Et(o)==="";)o.pop();const d=e.split("/");for(let h=0,f=d.length;h<f;h++){const p=d[h];p===""?h?h===f-1&&o.push(p):o=[p]:p===".."?o.pop():p==="."||o.push(p)}}o.length>1&&(Et(o)===""?s==="never"&&o.pop():s==="always"&&o.push(""));let c,u="";for(let d=0;d<o.length;d++){d>0&&(u+="/");const h=o[d];if(!h)continue;c=Ee(h,0,c);const f=c[0];if(f===yt){u+=h;continue}const p=c[5],m=h.substring(0,c[1]),g=h.substring(c[4],p),P=h.substring(c[2],c[3]);f===lt?u+=m||g?`${m}{$${P}}${g}`:`$${P}`:f===ht?u+=m||g?`${m}{$}${g}`:"$":u+=`${m}{-$${P}}${g}`}u=Ie(u);const l=u||"/";return a&&n&&n.set(a,l),l}function br(t){const e=new Map(t.map(r=>[encodeURIComponent(r),r])),s=Array.from(e.keys()).map(r=>r.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")).join("|"),n=new RegExp(s,"g");return r=>r.replace(n,i=>e.get(i)??i)}function ie(t,e,s){const n=e[t];return typeof n!="string"?n:t==="_splat"?/^[a-zA-Z0-9\-._~!/]*$/.test(n)?n:n.split("/").map(r=>ps(r,s)).join("/"):ps(n,s)}function oe({path:t,params:e,decoder:s,...n}){let r=!1;const i={};if(!t||t==="/")return{interpolatedPath:"/",usedParams:i,isMissingParams:r};if(!t.includes("$"))return{interpolatedPath:t,usedParams:i,isMissingParams:r};const a=t.length;let o=0,c,u="";for(;o<a;){const d=o;c=Ee(t,d,c);const h=c[5];if(o=h+1,d===h)continue;const f=c[0];if(f===yt){u+="/"+t.substring(d,h);continue}if(f===ht){const p=e._splat;i._splat=p,i["*"]=p;const m=t.substring(d,c[1]),g=t.substring(c[4],h);if(!p){r=!0,(m||g)&&(u+="/"+m+g);continue}const P=ie("_splat",e,s);u+="/"+m+P+g;continue}if(f===lt){const p=t.substring(c[2],c[3]);!r&&!(p in e)&&(r=!0),i[p]=e[p];const m=t.substring(d,c[1]),g=t.substring(c[4],h),P=ie(p,e,s)??"undefined";u+="/"+m+P+g;continue}if(f===kt){const p=t.substring(c[2],c[3]),m=e[p];if(m==null)continue;i[p]=m;const g=t.substring(d,c[1]),P=t.substring(c[4],h),S=ie(p,e,s)??"";u+="/"+g+S+P;continue}}return t.endsWith("/")&&(u+="/"),{usedParams:i,interpolatedPath:u||"/",isMissingParams:r}}function ps(t,e){const s=encodeURIComponent(t);return e?.(s)??s}function U(t){return!!t?.isNotFound}function xr(){try{if(typeof window<"u"&&typeof window.sessionStorage=="object")return window.sessionStorage}catch{}}const Re="tsr-scroll-restoration-v1_3",_r=(t,e)=>{let s;return(...n)=>{s||(s=setTimeout(()=>{t(...n),s=null},e))}};function Cr(){const t=xr();if(!t)return null;const e=t.getItem(Re);let s=e?JSON.parse(e):{};return{state:s,set:n=>{s=X(n,s)||s;try{t.setItem(Re,JSON.stringify(s))}catch{console.warn("[ts-router] Could not persist scroll restoration state to sessionStorage.")}}}}const Dt=Cr(),Lr=t=>t.state.__TSR_key||t.href;function Mr(t){const e=[];let s;for(;s=t.parentNode;)e.push(`${t.tagName}:nth-child(${Array.prototype.indexOf.call(s.children,t)+1})`),t=s;return`${e.reverse().join(" > ")}`.toLowerCase()}let Gt=!1;function Or({storageKey:t,key:e,behavior:s,shouldScrollRestoration:n,scrollToTopSelectors:r,location:i}){let a;try{a=JSON.parse(sessionStorage.getItem(t)||"{}")}catch(u){console.error(u);return}const o=e||window.history.state?.__TSR_key,c=a[o];Gt=!0;t:{if(n&&c&&Object.keys(c).length>0){for(const d in c){const h=c[d];if(d==="window")window.scrollTo({top:h.scrollY,left:h.scrollX,behavior:s});else if(d){const f=document.querySelector(d);f&&(f.scrollLeft=h.scrollX,f.scrollTop=h.scrollY)}}break t}const u=(i??window.location).hash.split("#",2)[1];if(u){const d=window.history.state?.__hashScrollIntoViewOptions??!0;if(d){const h=document.getElementById(u);h&&h.scrollIntoView(d)}break t}const l={top:0,left:0,behavior:s};if(window.scrollTo(l),r)for(const d of r){if(d==="window")continue;const h=typeof d=="function"?d():document.querySelector(d);h&&h.scrollTo(l)}}Gt=!1}function Er(t,e){if(!Dt||((t.options.scrollRestoration??!1)&&(t.isScrollRestoring=!0),t.isScrollRestorationSetup||!Dt))return;t.isScrollRestorationSetup=!0,Gt=!1;const n=t.options.getScrollRestorationKey||Lr;window.history.scrollRestoration="manual";const r=i=>{if(Gt||!t.isScrollRestoring)return;let a="";if(i.target===document||i.target===window)a="window";else{const c=i.target.getAttribute("data-scroll-restoration-id");c?a=`[data-scroll-restoration-id="${c}"]`:a=Mr(i.target)}const o=n(t.state.location);Dt.set(c=>{const u=c[o]||={},l=u[a]||={};if(a==="window")l.scrollX=window.scrollX||0,l.scrollY=window.scrollY||0;else if(a){const d=document.querySelector(a);d&&(l.scrollX=d.scrollLeft||0,l.scrollY=d.scrollTop||0)}return c})};typeof document<"u"&&document.addEventListener("scroll",_r(r,100),!0),t.subscribe("onRendered",i=>{const a=n(i.toLocation);if(!t.resetNextScroll){t.resetNextScroll=!0;return}typeof t.options.scrollRestoration=="function"&&!t.options.scrollRestoration({location:t.latestLocation})||(Or({storageKey:Re,key:a,behavior:t.options.scrollRestorationBehavior,shouldScrollRestoration:t.isScrollRestoring,scrollToTopSelectors:t.options.scrollToTopSelectors,location:t.history.location}),t.isScrollRestoring&&Dt.set(o=>(o[a]||={},o)))})}function kr(t){if(typeof document<"u"&&document.querySelector){const e=t.state.location.state.__hashScrollIntoViewOptions??!0;if(e&&t.state.location.hash!==""){const s=document.getElementById(t.state.location.hash);s&&s.scrollIntoView(e)}}}function Ir(t,e=String){const s=new URLSearchParams;for(const n in t){const r=t[n];r!==void 0&&s.set(n,e(r))}return s.toString()}function ae(t){return t?t==="false"?!1:t==="true"?!0:+t*0===0&&+t+""===t?+t:t:""}function Tr(t){const e=new URLSearchParams(t),s={};for(const[n,r]of e.entries()){const i=s[n];i==null?s[n]=ae(r):Array.isArray(i)?i.push(ae(r)):s[n]=[i,ae(r)]}return s}const Fr=Dr(JSON.parse),Ar=jr(JSON.stringify,JSON.parse);function Dr(t){return e=>{e[0]==="?"&&(e=e.substring(1));const s=Tr(e);for(const n in s){const r=s[n];if(typeof r=="string")try{s[n]=t(r)}catch{}}return s}}function jr(t,e){const s=typeof e=="function";function n(r){if(typeof r=="object"&&r!==null)try{return t(r)}catch{}else if(s&&typeof r=="string")try{return e(r),t(r)}catch{}return r}return r=>{const i=Ir(r,n);return i?`?${i}`:""}}const N="__root__";function Ur(t){if(t.statusCode=t.statusCode||t.code||307,!t._builtLocation&&typeof t.href=="string"&&Wt(t.href))throw new Error(`Redirect blocked: unsafe protocol in href "${t.href}". Only ${qs.join(", ")} protocols are allowed.`);if(!t._builtLocation&&!t.reloadDocument&&typeof t.href=="string")try{new URL(t.href),t.reloadDocument=!0}catch{}const e=new Headers(t.headers);t.href&&e.get("Location")===null&&e.set("Location",t.href);const s=new Response(null,{status:t.statusCode,headers:e});if(s.options=t,t.throw)throw s;return s}function Q(t){return t instanceof Response&&!!t.options}const Bt=t=>{if(!t.rendered)return t.rendered=!0,t.onReady?.()},Xt=(t,e)=>!!(t.preload&&!t.router.state.matches.some(s=>s.id===e)),mt=(t,e,s=!0)=>{const n={...t.router.options.context??{}},r=s?e:e-1;for(let i=0;i<=r;i++){const a=t.matches[i];if(!a)continue;const o=t.router.getMatch(a.id);o&&Object.assign(n,o.__routeContext,o.__beforeLoadContext)}return n},Gs=(t,e,s)=>{const n=t.router.routesById[e.routeId??""]??t.router.routeTree;!n.options.notFoundComponent&&t.router.options?.defaultNotFoundComponent&&(n.options.notFoundComponent=t.router.options.defaultNotFoundComponent);const r=s==="BEFORE_LOAD"&&n.parentRoute;r||G(n.options.notFoundComponent);const i=t.matches.find(a=>a.routeId===n.id);G(i,"Could not find match for route: "+n.id),t.updateMatch(i.id,a=>({...a,status:"notFound",error:e,isFetching:!1})),r&&(e.routeId=n.parentRoute.id,Gs(t,e,s))},Z=(t,e,s,n)=>{if(!(!Q(s)&&!U(s))){if(Q(s)&&s.redirectHandled&&!s.options.reloadDocument)throw s;if(e){e._nonReactive.beforeLoadPromise?.resolve(),e._nonReactive.loaderPromise?.resolve(),e._nonReactive.beforeLoadPromise=void 0,e._nonReactive.loaderPromise=void 0;const r=Q(s)?"redirected":"notFound";e._nonReactive.error=s,t.updateMatch(e.id,i=>({...i,status:r,context:mt(t,e.index),isFetching:!1,error:s})),U(s)&&!s.routeId&&(s.routeId=e.routeId),e._nonReactive.loadPromise?.resolve()}throw Q(s)?(t.rendered=!0,s.options._fromLocation=t.location,s.redirectHandled=!0,s=t.router.resolveRedirect(s),s):(Gs(t,s,n),s)}},Js=(t,e)=>!!t.router.getMatch(e)._nonReactive.dehydrated,xt=(t,e,s,n)=>{const{id:r,routeId:i}=t.matches[e],a=t.router.looseRoutesById[i];if(s instanceof Promise)throw s;s.routerCode=n,t.firstBadMatchIndex??=e,Z(t,t.router.getMatch(r),s,n);try{a.options.onError?.(s)}catch(o){s=o,Z(t,t.router.getMatch(r),s,n)}t.updateMatch(r,o=>(o._nonReactive.beforeLoadPromise?.resolve(),o._nonReactive.beforeLoadPromise=void 0,o._nonReactive.loadPromise?.resolve(),{...o,error:s,status:"error",isFetching:!1,updatedAt:Date.now(),abortController:new AbortController}))},Ys=(t,e,s,n)=>{if(n._nonReactive.pendingTimeout!==void 0)return;const r=s.options.pendingMs??t.router.options.defaultPendingMs;if(!!(t.onReady&&!Xt(t,e)&&(s.options.loader||s.options.beforeLoad||tn(s))&&typeof r=="number"&&r!==1/0&&(s.options.pendingComponent??t.router.options?.defaultPendingComponent))){const a=setTimeout(()=>{Bt(t)},r);n._nonReactive.pendingTimeout=a}},Br=(t,e,s)=>{const n=t.router.getMatch(e);if(!n._nonReactive.beforeLoadPromise&&!n._nonReactive.loaderPromise)return;Ys(t,e,s,n);const r=()=>{const i=t.router.getMatch(e);i.preload&&(i.status==="redirected"||i.status==="notFound")&&Z(t,i,i.error)};return n._nonReactive.beforeLoadPromise?n._nonReactive.beforeLoadPromise.then(r):r()},Nr=(t,e,s,n)=>{const r=t.router.getMatch(e),i=r._nonReactive.loadPromise;r._nonReactive.loadPromise=gt(()=>{i?.resolve()});const{paramsError:a,searchError:o}=r;a&&xt(t,s,a,"PARSE_PARAMS"),o&&xt(t,s,o,"VALIDATE_SEARCH"),Ys(t,e,n,r);const c=new AbortController;let u=!1;const l=()=>{u||(u=!0,t.updateMatch(e,v=>({...v,isFetching:"beforeLoad",fetchCount:v.fetchCount+1,abortController:c})))},d=()=>{r._nonReactive.beforeLoadPromise?.resolve(),r._nonReactive.beforeLoadPromise=void 0,t.updateMatch(e,v=>({...v,isFetching:!1}))};if(!n.options.beforeLoad){Lt(()=>{l(),d()});return}r._nonReactive.beforeLoadPromise=gt();const h={...mt(t,s,!1),...r.__routeContext},{search:f,params:p,cause:m}=r,g=Xt(t,e),P={search:f,abortController:c,params:p,preload:g,context:h,location:t.location,navigate:v=>t.router.navigate({...v,_fromLocation:t.location}),buildLocation:t.router.buildLocation,cause:g?"preload":m,matches:t.matches,routeId:n.id,...t.router.options.additionalContext},S=v=>{if(v===void 0){Lt(()=>{l(),d()});return}(Q(v)||U(v))&&(l(),xt(t,s,v,"BEFORE_LOAD")),Lt(()=>{l(),t.updateMatch(e,C=>({...C,__beforeLoadContext:v})),d()})};let w;try{if(w=n.options.beforeLoad(P),pt(w))return l(),w.catch(v=>{xt(t,s,v,"BEFORE_LOAD")}).then(S)}catch(v){l(),xt(t,s,v,"BEFORE_LOAD")}S(w)},Qr=(t,e)=>{const{id:s,routeId:n}=t.matches[e],r=t.router.looseRoutesById[n],i=()=>o(),a=()=>Nr(t,s,e,r),o=()=>{if(Js(t,s))return;const c=Br(t,s,r);return pt(c)?c.then(a):a()};return i()},Kr=(t,e,s)=>{const n=t.router.getMatch(e);if(!n||!s.options.head&&!s.options.scripts&&!s.options.headers)return;const r={ssr:t.router.options.ssr,matches:t.matches,match:n,params:n.params,loaderData:n.loaderData};return Promise.all([s.options.head?.(r),s.options.scripts?.(r),s.options.headers?.(r)]).then(([i,a,o])=>{const c=i?.meta,u=i?.links,l=i?.scripts,d=i?.styles;return{meta:c,links:u,headScripts:l,headers:o,scripts:a,styles:d}})},Xs=(t,e,s,n)=>{const r=t.matchPromises[s-1],{params:i,loaderDeps:a,abortController:o,cause:c}=t.router.getMatch(e),u=mt(t,s),l=Xt(t,e);return{params:i,deps:a,preload:!!l,parentMatchPromise:r,abortController:o,context:u,location:t.location,navigate:d=>t.router.navigate({...d,_fromLocation:t.location}),cause:l?"preload":c,route:n,...t.router.options.additionalContext}},ms=async(t,e,s,n)=>{try{const r=t.router.getMatch(e);try{(!(ir??t.router.isServer)||r.ssr===!0)&&Zs(n);const i=n.options.loader?.(Xs(t,e,s,n)),a=n.options.loader&&pt(i);if((a||n._lazyPromise||n._componentsPromise||n.options.head||n.options.scripts||n.options.headers||r._nonReactive.minPendingPromise)&&t.updateMatch(e,u=>({...u,isFetching:"loader"})),n.options.loader){const u=a?await i:i;Z(t,t.router.getMatch(e),u),u!==void 0&&t.updateMatch(e,l=>({...l,loaderData:u}))}n._lazyPromise&&await n._lazyPromise;const c=r._nonReactive.minPendingPromise;c&&await c,n._componentsPromise&&await n._componentsPromise,t.updateMatch(e,u=>({...u,error:void 0,context:mt(t,s),status:"success",isFetching:!1,updatedAt:Date.now()}))}catch(i){let a=i;if(a?.name==="AbortError"){if(r.abortController.signal.aborted){r._nonReactive.loaderPromise?.resolve(),r._nonReactive.loaderPromise=void 0;return}t.updateMatch(e,c=>({...c,status:c.status==="pending"?"success":c.status,isFetching:!1,context:mt(t,s)}));return}const o=r._nonReactive.minPendingPromise;o&&await o,U(i)&&await n.options.notFoundComponent?.preload?.(),Z(t,t.router.getMatch(e),i);try{n.options.onError?.(i)}catch(c){a=c,Z(t,t.router.getMatch(e),c)}t.updateMatch(e,c=>({...c,error:a,context:mt(t,s),status:"error",isFetching:!1}))}}catch(r){const i=t.router.getMatch(e);i&&(i._nonReactive.loaderPromise=void 0),Z(t,i,r)}},$r=async(t,e)=>{async function s(l,d,h,f){const p=Date.now()-d.updatedAt,m=l?f.options.preloadStaleTime??t.router.options.defaultPreloadStaleTime??3e4:f.options.staleTime??t.router.options.defaultStaleTime??0,g=f.options.shouldReload,P=typeof g=="function"?g(Xs(t,n,e,f)):g,{status:S,invalid:w}=h;i=S==="success"&&(w||(P??p>m)),l&&f.options.preload===!1||(i&&!t.sync?(a=!0,(async()=>{try{await ms(t,n,e,f);const v=t.router.getMatch(n);v._nonReactive.loaderPromise?.resolve(),v._nonReactive.loadPromise?.resolve(),v._nonReactive.loaderPromise=void 0}catch(v){Q(v)&&await t.router.navigate(v.options)}})()):(S!=="success"||i&&t.sync)&&await ms(t,n,e,f))}const{id:n,routeId:r}=t.matches[e];let i=!1,a=!1;const o=t.router.looseRoutesById[r];if(!Js(t,n)){const l=t.router.getMatch(n),d=Xt(t,n);if(l._nonReactive.loaderPromise){if(l.status==="success"&&!t.sync&&!l.preload)return l;await l._nonReactive.loaderPromise;const h=t.router.getMatch(n),f=h._nonReactive.error||h.error;f&&Z(t,h,f),h.status==="pending"&&await s(d,l,h,o)}else{const h=d&&!t.router.state.matches.some(p=>p.id===n),f=t.router.getMatch(n);f._nonReactive.loaderPromise=gt(),h!==f.preload&&t.updateMatch(n,p=>({...p,preload:h})),await s(d,l,f,o)}}const c=t.router.getMatch(n);a||(c._nonReactive.loaderPromise?.resolve(),c._nonReactive.loadPromise?.resolve()),clearTimeout(c._nonReactive.pendingTimeout),c._nonReactive.pendingTimeout=void 0,a||(c._nonReactive.loaderPromise=void 0),c._nonReactive.dehydrated=void 0;const u=a?c.isFetching:!1;return u!==c.isFetching||c.invalid!==!1?(t.updateMatch(n,l=>({...l,isFetching:u,invalid:!1})),t.router.getMatch(n)):c};async function gs(t){const e=Object.assign(t,{matchPromises:[]});e.router.state.matches.some(s=>s._forcePending)&&Bt(e);try{for(let o=0;o<e.matches.length;o++){const c=Qr(e,o);pt(c)&&await c}const s=e.firstBadMatchIndex??e.matches.length;for(let o=0;o<s;o++)e.matchPromises.push($r(e,o));const r=(await Promise.allSettled(e.matchPromises)).filter(o=>o.status==="rejected").map(o=>o.reason);let i;for(const o of r){if(Q(o))throw o;!i&&U(o)&&(i=o)}for(const o of e.matches){const{id:c,routeId:u}=o,l=e.router.looseRoutesById[u];try{const d=Kr(e,c,l);if(d){const h=await d;e.updateMatch(c,f=>({...f,...h}))}}catch(d){console.error(`Error executing head for route ${u}:`,d)}}if(i)throw i;const a=Bt(e);pt(a)&&await a}catch(s){if(U(s)&&!e.preload){const n=Bt(e);throw pt(n)&&await n,s}if(Q(s))throw s}return e.matches}async function Zs(t){if(!t._lazyLoaded&&t._lazyPromise===void 0&&(t.lazyFn?t._lazyPromise=t.lazyFn().then(e=>{const{id:s,...n}=e.options;Object.assign(t.options,n),t._lazyLoaded=!0,t._lazyPromise=void 0}):t._lazyLoaded=!0),!t._componentsLoaded&&t._componentsPromise===void 0){const e=()=>{const s=[];for(const n of en){const r=t.options[n]?.preload;r&&s.push(r())}if(s.length)return Promise.all(s).then(()=>{t._componentsLoaded=!0,t._componentsPromise=void 0});t._componentsLoaded=!0,t._componentsPromise=void 0};t._componentsPromise=t._lazyPromise?t._lazyPromise.then(e):e()}return t._componentsPromise}function tn(t){for(const e of en)if(t.options[e]?.preload)return!0;return!1}const en=["component","errorComponent","pendingComponent","notFoundComponent"];function qr(t){return{input:({url:e})=>{for(const s of t)e=be(s,e);return e},output:({url:e})=>{for(let s=t.length-1;s>=0;s--)e=sn(t[s],e);return e}}}function Hr(t){const e=Vs(t.basepath),s=`/${e}`,n=`${s}/`,r=t.caseSensitive?s:s.toLowerCase(),i=t.caseSensitive?n:n.toLowerCase();return{input:({url:a})=>{const o=t.caseSensitive?a.pathname:a.pathname.toLowerCase();return o===r?a.pathname="/":o.startsWith(i)&&(a.pathname=a.pathname.slice(s.length)),a},output:({url:a})=>(a.pathname=Ut(["/",e,a.pathname]),a)}}function be(t,e){const s=t?.input?.({url:e});if(s){if(typeof s=="string")return new URL(s);if(s instanceof URL)return s}return e}function sn(t,e){const s=t?.output?.({url:e});if(s){if(typeof s=="string")return new URL(s);if(s instanceof URL)return s}return e}function at(t){const e=t.resolvedLocation,s=t.location,n=e?.pathname!==s.pathname,r=e?.href!==s.href,i=e?.hash!==s.hash;return{fromLocation:e,toLocation:s,pathChanged:n,hrefChanged:r,hashChanged:i}}class Wr{constructor(e){this.tempLocationKey=`${Math.round(Math.random()*1e7)}`,this.resetNextScroll=!0,this.shouldViewTransition=void 0,this.isViewTransitionTypesSupported=void 0,this.subscribers=new Set,this.isScrollRestoring=!1,this.isScrollRestorationSetup=!1,this.startTransition=s=>s(),this.update=s=>{s.notFoundRoute&&console.warn("The notFoundRoute API is deprecated and will be removed in the next major version. See https://tanstack.com/router/v1/docs/framework/react/guide/not-found-errors#migrating-from-notfoundroute for more info.");const n=this.options,r=this.basepath??n?.basepath??"/",i=this.basepath===void 0,a=n?.rewrite;if(this.options={...n,...s},this.isServer=this.options.isServer??typeof document>"u",this.options.pathParamsAllowedCharacters&&(this.pathParamsDecoder=br(this.options.pathParamsAllowedCharacters)),(!this.history||this.options.history&&this.options.history!==this.history)&&(this.options.history?this.history=this.options.history:this.history=nr()),this.origin=this.options.origin,this.origin||(window?.origin&&window.origin!=="null"?this.origin=window.origin:this.origin="http://localhost"),this.history&&this.updateLatestLocation(),this.options.routeTree!==this.routeTree){this.routeTree=this.options.routeTree;let h;this.resolvePathCache=zt(1e3),h=this.buildRouteTree(),this.setRoutes(h)}!this.__store&&this.latestLocation&&(this.__store=new er(Vr(this.latestLocation),{onUpdate:()=>{this.__store.state={...this.state,cachedMatches:this.state.cachedMatches.filter(h=>!["redirected"].includes(h.status))}}}),Er(this));let o=!1;const c=this.options.basepath??"/",u=this.options.rewrite;if(i||r!==c||a!==u){this.basepath=c;const h=[],f=Vs(c);f&&f!=="/"&&h.push(Hr({basepath:c})),u&&h.push(u),this.rewrite=h.length===0?void 0:h.length===1?h[0]:qr(h),this.history&&this.updateLatestLocation(),o=!0}o&&this.__store&&(this.__store.state={...this.state,location:this.latestLocation}),typeof window<"u"&&"CSS"in window&&typeof window.CSS?.supports=="function"&&(this.isViewTransitionTypesSupported=window.CSS.supports("selector(:active-view-transition-type(a)"))},this.updateLatestLocation=()=>{this.latestLocation=this.parseLocation(this.history.location,this.latestLocation)},this.buildRouteTree=()=>{const s=yr(this.routeTree,this.options.caseSensitive,(n,r)=>{n.init({originalIndex:r})});return this.options.routeMasks&&dr(this.options.routeMasks,s.processedTree),s},this.subscribe=(s,n)=>{const r={eventType:s,fn:n};return this.subscribers.add(r),()=>{this.subscribers.delete(r)}},this.emit=s=>{this.subscribers.forEach(n=>{n.eventType===s.type&&n.fn(s)})},this.parseLocation=(s,n)=>{const r=({pathname:c,search:u,hash:l,href:d,state:h})=>{if(!this.rewrite&&!/[ \x00-\x1f\x7f\u0080-\uffff]/.test(c)){const S=this.options.parseSearch(u),w=this.options.stringifySearch(S);return{href:c+w+l,publicHref:d,pathname:Rt(c).path,external:!1,searchStr:w,search:j(n?.search,S),hash:Rt(l.slice(1)).path,state:j(n?.state,h)}}const f=new URL(d,this.origin),p=be(this.rewrite,f),m=this.options.parseSearch(p.search),g=this.options.stringifySearch(m);return p.search=g,{href:p.href.replace(p.origin,""),publicHref:d,pathname:Rt(p.pathname).path,external:!!this.rewrite&&p.origin!==this.origin,searchStr:g,search:j(n?.search,m),hash:Rt(p.hash.slice(1)).path,state:j(n?.state,h)}},i=r(s),{__tempLocation:a,__tempKey:o}=i.state;if(a&&(!o||o===this.tempLocationKey)){const c=r(a);return c.state.key=i.state.key,c.state.__TSR_key=i.state.__TSR_key,delete c.state.__tempLocation,{...c,maskedLocation:i}}return i},this.resolvePathWithBase=(s,n)=>Rr({base:s,to:Ie(n),trailingSlash:this.options.trailingSlash,cache:this.resolvePathCache}),this.matchRoutes=(s,n,r)=>typeof s=="string"?this.matchRoutesInternal({pathname:s,search:n},r):this.matchRoutesInternal(s,n),this.getMatchedRoutes=s=>Gr({pathname:s,routesById:this.routesById,processedTree:this.processedTree}),this.cancelMatch=s=>{const n=this.getMatch(s);n&&(n.abortController.abort(),clearTimeout(n._nonReactive.pendingTimeout),n._nonReactive.pendingTimeout=void 0)},this.cancelMatches=()=>{const s=this.state.matches.filter(i=>i.status==="pending"),n=this.state.matches.filter(i=>i.isFetching==="loader");new Set([...this.state.pendingMatches??[],...s,...n]).forEach(i=>{this.cancelMatch(i.id)})},this.buildLocation=s=>{const n=(i={})=>{const a=i._fromLocation||this.pendingBuiltLocation||this.latestLocation,o=this.matchRoutesLightweight(a);i.from;const c=i.unsafeRelative==="path"?a.pathname:i.from??o.fullPath,u=this.resolvePathWithBase(c,"."),l=o.search,d={...o.params},h=i.to?this.resolvePathWithBase(u,`${i.to}`):this.resolvePathWithBase(u,"."),f=i.params===!1||i.params===null?{}:(i.params??!0)===!0?d:Object.assign(d,X(i.params,d)),p=oe({path:h,params:f,decoder:this.pathParamsDecoder,server:this.isServer}).interpolatedPath,m=this.getMatchedRoutes(p);let g=m.matchedRoutes;(m.foundRoute?m.foundRoute.path!=="/"&&m.routeParams["**"]:V(p))&&this.options.notFoundRoute&&(g=[...g,this.options.notFoundRoute]);let S=!1;if(Object.keys(f).length>0)for(const k of g){const I=k.options.params?.stringify??k.options.stringifyParams;I&&(S=!0,Object.assign(f,I(f)))}const w=s.leaveParams?h:Rt(S?oe({path:h,params:f,decoder:this.pathParamsDecoder,server:this.isServer}).interpolatedPath:p).path;let v=l;if(s._includeValidateSearch&&this.options.search?.strict){const k={};g.forEach(I=>{if(I.options.validateSearch)try{Object.assign(k,Nt(I.options.validateSearch,{...k,...v}))}catch{}}),v=k}v=Jr({search:v,dest:i,destRoutes:g,_includeValidateSearch:s._includeValidateSearch}),v=j(l,v);const C=this.options.stringifySearch(v),L=i.hash===!0?a.hash:i.hash?X(i.hash,a.hash):void 0,x=L?`#${L}`:"";let y=i.state===!0?a.state:i.state?X(i.state,a.state):{};y=j(a.state,y);const R=`${w}${C}${x}`;let M,O,E=!1;if(this.rewrite){const k=new URL(R,this.origin),I=sn(this.rewrite,k);M=k.href.replace(k.origin,""),I.origin!==this.origin?(O=I.href,E=!0):O=I.pathname+I.search+I.hash}else M=ur(R),O=M;return{publicHref:O,href:M,pathname:w,search:v,searchStr:C,state:y,hash:L??"",external:E,unmaskOnReload:i.unmaskOnReload}},r=(i={},a)=>{const o=n(i);let c=a?n(a):void 0;if(!c){const u={};if(this.options.routeMasks){const l=fr(o.pathname,this.processedTree);if(l){Object.assign(u,l.rawParams);const{from:d,params:h,...f}=l.route,p=h===!1||h===null?{}:(h??!0)===!0?u:Object.assign(u,X(h,u));a={from:s.from,...f,params:p},c=n(a)}}}return c&&(o.maskedLocation=c),o};return s.mask?r(s,{from:s.from,...s.mask}):r(s)},this.commitLocation=async({viewTransition:s,ignoreBlocker:n,...r})=>{const i=()=>{const c=["key","__TSR_key","__TSR_index","__hashScrollIntoViewOptions"];c.forEach(l=>{r.state[l]=this.latestLocation.state[l]});const u=ot(r.state,this.latestLocation.state);return c.forEach(l=>{delete r.state[l]}),u},a=V(this.latestLocation.href)===V(r.href),o=this.commitLocationPromise;if(this.commitLocationPromise=gt(()=>{o?.resolve()}),a&&i())this.load();else{let{maskedLocation:c,hashScrollIntoView:u,...l}=r;c&&(l={...c,state:{...c.state,__tempKey:void 0,__tempLocation:{...l,search:l.searchStr,state:{...l.state,__tempKey:void 0,__tempLocation:void 0,__TSR_key:void 0,key:void 0}}}},(l.unmaskOnReload??this.options.unmaskOnReload??!1)&&(l.state.__tempKey=this.tempLocationKey)),l.state.__hashScrollIntoViewOptions=u??this.options.defaultHashScrollIntoView??!0,this.shouldViewTransition=s,this.history[r.replace?"replace":"push"](l.publicHref,l.state,{ignoreBlocker:n})}return this.resetNextScroll=r.resetScroll??!0,this.history.subscribers.size||this.load(),this.commitLocationPromise},this.buildAndCommitLocation=({replace:s,resetScroll:n,hashScrollIntoView:r,viewTransition:i,ignoreBlocker:a,href:o,...c}={})=>{if(o){const d=this.history.location.state.__TSR_index,h=qt(o,{__TSR_index:s?d:d+1}),f=new URL(h.pathname,this.origin),p=be(this.rewrite,f);c.to=p.pathname,c.search=this.options.parseSearch(h.search),c.hash=h.hash.slice(1)}const u=this.buildLocation({...c,_includeValidateSearch:!0});this.pendingBuiltLocation=u;const l=this.commitLocation({...u,viewTransition:i,replace:s,resetScroll:n,hashScrollIntoView:r,ignoreBlocker:a});return Promise.resolve().then(()=>{this.pendingBuiltLocation===u&&(this.pendingBuiltLocation=void 0)}),l},this.navigate=async({to:s,reloadDocument:n,href:r,publicHref:i,...a})=>{let o=!1;if(r)try{new URL(`${r}`),o=!0}catch{}if(o&&!n&&(n=!0),n){if(s!==void 0||!r){const u=this.buildLocation({to:s,...a});r=r??u.publicHref,i=i??u.publicHref}const c=!o&&i?i:r;if(Wt(c))return Promise.resolve();if(!a.ignoreBlocker){const l=this.history.getBlockers?.()??[];for(const d of l)if(d?.blockerFn&&await d.blockerFn({currentLocation:this.latestLocation,nextLocation:this.latestLocation,action:"PUSH"}))return Promise.resolve()}return a.replace?window.location.replace(c):window.location.href=c,Promise.resolve()}return this.buildAndCommitLocation({...a,href:r,to:s,_isNavigate:!0})},this.beforeLoad=()=>{this.cancelMatches(),this.updateLatestLocation();const s=this.matchRoutes(this.latestLocation);this.__store.setState(n=>({...n,status:"pending",statusCode:200,isLoading:!0,location:this.latestLocation,pendingMatches:s,cachedMatches:n.cachedMatches.filter(r=>!s.some(i=>i.id===r.id))}))},this.load=async s=>{let n,r,i;for(i=new Promise(o=>{this.startTransition(async()=>{try{this.beforeLoad();const c=this.latestLocation,u=this.state.resolvedLocation;this.state.redirect||this.emit({type:"onBeforeNavigate",...at({resolvedLocation:u,location:c})}),this.emit({type:"onBeforeLoad",...at({resolvedLocation:u,location:c})}),await gs({router:this,sync:s?.sync,matches:this.state.pendingMatches,location:c,updateMatch:this.updateMatch,onReady:async()=>{this.startTransition(()=>{this.startViewTransition(async()=>{let l=[],d=[],h=[];Lt(()=>{this.__store.setState(f=>{const p=f.matches,m=f.pendingMatches||f.matches;return l=p.filter(g=>!m.some(P=>P.id===g.id)),d=m.filter(g=>!p.some(P=>P.id===g.id)),h=m.filter(g=>p.some(P=>P.id===g.id)),{...f,isLoading:!1,loadedAt:Date.now(),matches:m,pendingMatches:void 0,cachedMatches:[...f.cachedMatches,...l.filter(g=>g.status!=="error"&&g.status!=="notFound")]}}),this.clearExpiredCache()}),[[l,"onLeave"],[d,"onEnter"],[h,"onStay"]].forEach(([f,p])=>{f.forEach(m=>{this.looseRoutesById[m.routeId].options[p]?.(m)})})})})}})}catch(c){Q(c)?(n=c,this.navigate({...n.options,replace:!0,ignoreBlocker:!0})):U(c)&&(r=c),this.__store.setState(u=>({...u,statusCode:n?n.status:r?404:u.matches.some(l=>l.status==="error")?500:200,redirect:n}))}this.latestLoadPromise===i&&(this.commitLocationPromise?.resolve(),this.latestLoadPromise=void 0,this.commitLocationPromise=void 0),o()})}),this.latestLoadPromise=i,await i;this.latestLoadPromise&&i!==this.latestLoadPromise;)await this.latestLoadPromise;let a;this.hasNotFoundMatch()?a=404:this.__store.state.matches.some(o=>o.status==="error")&&(a=500),a!==void 0&&this.__store.setState(o=>({...o,statusCode:a}))},this.startViewTransition=s=>{const n=this.shouldViewTransition??this.options.defaultViewTransition;if(this.shouldViewTransition=void 0,n&&typeof document<"u"&&"startViewTransition"in document&&typeof document.startViewTransition=="function"){let r;if(typeof n=="object"&&this.isViewTransitionTypesSupported){const i=this.latestLocation,a=this.state.resolvedLocation,o=typeof n.types=="function"?n.types(at({resolvedLocation:a,location:i})):n.types;if(o===!1){s();return}r={update:s,types:o}}else r=s;document.startViewTransition(r)}else s()},this.updateMatch=(s,n)=>{this.startTransition(()=>{const r=this.state.pendingMatches?.some(i=>i.id===s)?"pendingMatches":this.state.matches.some(i=>i.id===s)?"matches":this.state.cachedMatches.some(i=>i.id===s)?"cachedMatches":"";r&&this.__store.setState(i=>({...i,[r]:i[r]?.map(a=>a.id===s?n(a):a)}))})},this.getMatch=s=>{const n=r=>r.id===s;return this.state.cachedMatches.find(n)??this.state.pendingMatches?.find(n)??this.state.matches.find(n)},this.invalidate=s=>{const n=r=>s?.filter?.(r)??!0?{...r,invalid:!0,...s?.forcePending||r.status==="error"||r.status==="notFound"?{status:"pending",error:void 0}:void 0}:r;return this.__store.setState(r=>({...r,matches:r.matches.map(n),cachedMatches:r.cachedMatches.map(n),pendingMatches:r.pendingMatches?.map(n)})),this.shouldViewTransition=!1,this.load({sync:s?.sync})},this.getParsedLocationHref=s=>s.publicHref||"/",this.resolveRedirect=s=>{const n=s.headers.get("Location");if(!s.options.href||s.options._builtLocation){const r=s.options._builtLocation??this.buildLocation(s.options),i=this.getParsedLocationHref(r);s.options.href=i,s.headers.set("Location",i)}else if(n)try{const r=new URL(n);if(this.origin&&r.origin===this.origin){const i=r.pathname+r.search+r.hash;s.options.href=i,s.headers.set("Location",i)}}catch{}return s.headers.get("Location")||s.headers.set("Location",s.options.href),s},this.clearCache=s=>{const n=s?.filter;n!==void 0?this.__store.setState(r=>({...r,cachedMatches:r.cachedMatches.filter(i=>!n(i))})):this.__store.setState(r=>({...r,cachedMatches:[]}))},this.clearExpiredCache=()=>{const s=n=>{const r=this.looseRoutesById[n.routeId];if(!r.options.loader)return!0;const i=(n.preload?r.options.preloadGcTime??this.options.defaultPreloadGcTime:r.options.gcTime??this.options.defaultGcTime)??300*1e3;return n.status==="error"?!0:Date.now()-n.updatedAt>=i};this.clearCache({filter:s})},this.loadRouteChunk=Zs,this.preloadRoute=async s=>{const n=this.buildLocation(s);let r=this.matchRoutes(n,{throwOnError:!0,preload:!0,dest:s});const i=new Set([...this.state.matches,...this.state.pendingMatches??[]].map(o=>o.id)),a=new Set([...i,...this.state.cachedMatches.map(o=>o.id)]);Lt(()=>{r.forEach(o=>{a.has(o.id)||this.__store.setState(c=>({...c,cachedMatches:[...c.cachedMatches,o]}))})});try{return r=await gs({router:this,matches:r,location:n,preload:!0,updateMatch:(o,c)=>{i.has(o)?r=r.map(u=>u.id===o?c(u):u):this.updateMatch(o,c)}}),r}catch(o){if(Q(o))return o.options.reloadDocument?void 0:await this.preloadRoute({...o.options,_fromLocation:n});U(o)||console.error(o);return}},this.matchRoute=(s,n)=>{const r={...s,to:s.to?this.resolvePathWithBase(s.from||"",s.to):void 0,params:s.params||{},leaveParams:!0},i=this.buildLocation(r);if(n?.pending&&this.state.status!=="pending")return!1;const o=(n?.pending===void 0?!this.state.isLoading:n.pending)?this.latestLocation:this.state.resolvedLocation||this.state.location,c=pr(i.pathname,n?.caseSensitive??!1,n?.fuzzy??!1,o.pathname,this.processedTree);return!c||s.params&&!ot(c.rawParams,s.params,{partial:!0})?!1:n?.includeSearch??!0?ot(o.search,i.search,{partial:!0})?c.rawParams:!1:c.rawParams},this.hasNotFoundMatch=()=>this.__store.state.matches.some(s=>s.status==="notFound"||s.globalNotFound),this.update({defaultPreloadDelay:50,defaultPendingMs:1e3,defaultPendingMinMs:500,context:void 0,...e,caseSensitive:e.caseSensitive??!1,notFoundMode:e.notFoundMode??"fuzzy",stringifySearch:e.stringifySearch??Ar,parseSearch:e.parseSearch??Fr}),typeof document<"u"&&(self.__TSR_ROUTER__=this)}isShell(){return!!this.options.isShell}isPrerendering(){return!!this.options.isPrerendering}get state(){return this.__store.state}setRoutes({routesById:e,routesByPath:s,processedTree:n}){this.routesById=e,this.routesByPath=s,this.processedTree=n;const r=this.options.notFoundRoute;r&&(r.init({originalIndex:99999999999}),this.routesById[r.id]=r)}get looseRoutesById(){return this.routesById}getParentContext(e){return e?.id?e.context??this.options.context??void 0:this.options.context??void 0}matchRoutesInternal(e,s){const n=this.getMatchedRoutes(e.pathname),{foundRoute:r,routeParams:i,parsedParams:a}=n;let{matchedRoutes:o}=n,c=!1;(r?r.path!=="/"&&i["**"]:V(e.pathname))&&(this.options.notFoundRoute?o=[...o,this.options.notFoundRoute]:c=!0);const u=c?Xr(this.options.notFoundMode,o):void 0,l=new Array(o.length),d=new Map(this.state.matches.map(h=>[h.routeId,h]));for(let h=0;h<o.length;h++){const f=o[h],p=l[h-1];let m,g,P;{const I=p?.search??e.search,J=p?._strictSearch??void 0;try{const H=Nt(f.options.validateSearch,{...I})??void 0;m={...I,...H},g={...J,...H},P=void 0}catch(H){let Pt=H;if(H instanceof Jt||(Pt=new Jt(H.message,{cause:H})),s?.throwOnError)throw Pt;m=I,g={},P=Pt}}const S=f.options.loaderDeps?.({search:m})??"",w=S?JSON.stringify(S):"",{interpolatedPath:v,usedParams:C}=oe({path:f.fullPath,params:i,decoder:this.pathParamsDecoder,server:this.isServer}),L=f.id+v+w,x=this.getMatch(L),y=d.get(f.id),R=x?._strictParams??C;let M;if(!x)try{ys(f,C,a,R)}catch(I){if(U(I)||Q(I)?M=I:M=new zr(I.message,{cause:I}),s?.throwOnError)throw M}Object.assign(i,R);const O=y?"stay":"enter";let E;if(x)E={...x,cause:O,params:y?.params??i,_strictParams:R,search:j(y?y.search:x.search,m),_strictSearch:g};else{const I=f.options.loader||f.options.beforeLoad||f.lazyFn||tn(f)?"pending":"success";E={id:L,ssr:f.options.ssr,index:h,routeId:f.id,params:y?.params??i,_strictParams:R,pathname:v,updatedAt:Date.now(),search:y?j(y.search,m):m,_strictSearch:g,searchError:void 0,status:I,isFetching:!1,error:void 0,paramsError:M,__routeContext:void 0,_nonReactive:{loadPromise:gt()},__beforeLoadContext:void 0,context:{},abortController:new AbortController,fetchCount:0,cause:O,loaderDeps:y?j(y.loaderDeps,S):S,invalid:!1,preload:!1,links:void 0,scripts:void 0,headScripts:void 0,meta:void 0,staticData:f.options.staticData||{},fullPath:f.fullPath}}s?.preload||(E.globalNotFound=u===f.id),E.searchError=P;const k=this.getParentContext(p);E.context={...k,...E.__routeContext,...E.__beforeLoadContext},l[h]=E}for(let h=0;h<l.length;h++){const f=l[h],p=this.looseRoutesById[f.routeId],m=this.getMatch(f.id),g=d.get(f.routeId);if(f.params=g?j(g.params,i):i,!m){const P=l[h-1],S=this.getParentContext(P);if(p.options.context){const w={deps:f.loaderDeps,params:f.params,context:S??{},location:e,navigate:v=>this.navigate({...v,_fromLocation:e}),buildLocation:this.buildLocation,cause:f.cause,abortController:f.abortController,preload:!!f.preload,matches:l,routeId:p.id};f.__routeContext=p.options.context(w)??void 0}f.context={...S,...f.__routeContext,...f.__beforeLoadContext}}}return l}matchRoutesLightweight(e){const{matchedRoutes:s,routeParams:n,parsedParams:r}=this.getMatchedRoutes(e.pathname),i=Et(s),a={...e.search};for(const l of s)try{Object.assign(a,Nt(l.options.validateSearch,a))}catch{}const o=Et(this.state.matches),c=o&&o.routeId===i.id&&e.pathname===this.state.location.pathname;let u;if(c)u=o.params;else{const l={...n};for(const d of s)try{ys(d,n,r??{},l)}catch{}u=l}return{matchedRoutes:s,fullPath:i.fullPath,search:a,params:u}}}class Jt extends Error{}class zr extends Error{}function Vr(t){return{loadedAt:0,isLoading:!1,isTransitioning:!1,status:"idle",resolvedLocation:void 0,location:t,matches:[],pendingMatches:[],cachedMatches:[],statusCode:200}}function Nt(t,e){if(t==null)return{};if("~standard"in t){const s=t["~standard"].validate(e);if(s instanceof Promise)throw new Jt("Async validation not supported");if(s.issues)throw new Jt(JSON.stringify(s.issues,void 0,2),{cause:s});return s.value}return"parse"in t?t.parse(e):typeof t=="function"?t(e):{}}function Gr({pathname:t,routesById:e,processedTree:s}){const n={},r=V(t);let i,a;const o=mr(r,s,!0);return o&&(i=o.route,Object.assign(n,o.rawParams),a=Object.assign({},o.parsedParams)),{matchedRoutes:o?.branch||[e[N]],routeParams:n,foundRoute:i,parsedParams:a}}function Jr({search:t,dest:e,destRoutes:s,_includeValidateSearch:n}){return Yr(s)(t,e,n??!1)}function Yr(t){const e={dest:null,_includeValidateSearch:!1,middlewares:[]};for(const r of t){if("search"in r.options)r.options.search?.middlewares&&e.middlewares.push(...r.options.search.middlewares);else if(r.options.preSearchFilters||r.options.postSearchFilters){const i=({search:a,next:o})=>{let c=a;"preSearchFilters"in r.options&&r.options.preSearchFilters&&(c=r.options.preSearchFilters.reduce((l,d)=>d(l),a));const u=o(c);return"postSearchFilters"in r.options&&r.options.postSearchFilters?r.options.postSearchFilters.reduce((l,d)=>d(l),u):u};e.middlewares.push(i)}if(r.options.validateSearch){const i=({search:a,next:o})=>{const c=o(a);if(!e._includeValidateSearch)return c;try{return{...c,...Nt(r.options.validateSearch,c)??void 0}}catch{return c}};e.middlewares.push(i)}}const s=({search:r})=>{const i=e.dest;return i.search?i.search===!0?r:X(i.search,r):{}};e.middlewares.push(s);const n=(r,i,a)=>{if(r>=a.length)return i;const o=a[r];return o({search:i,next:u=>n(r+1,u,a)})};return function(i,a,o){return e.dest=a,e._includeValidateSearch=o,n(0,i,e.middlewares)}}function Xr(t,e){if(t!=="root")for(let s=e.length-1;s>=0;s--){const n=e[s];if(n.children)return n.id}return N}function ys(t,e,s,n){const r=t.options.params?.parse??t.options.parseParams;if(r)if(t.options.skipRouteOnParseError)for(const i in e)i in s&&(n[i]=s[i]);else{const i=r(n);Object.assign(n,i)}}const Zr="Error preloading route! ☝️";class nn{constructor(e){if(this.init=s=>{this.originalIndex=s.originalIndex;const n=this.options,r=!n?.path&&!n?.id;this.parentRoute=this.options.getParentRoute?.(),r?this._path=N:this.parentRoute||G(!1);let i=r?N:n?.path;i&&i!=="/"&&(i=zs(i));const a=n?.id||i;let o=r?N:Ut([this.parentRoute.id===N?"":this.parentRoute.id,a]);i===N&&(i="/"),o!==N&&(o=Ut(["/",o]));const c=o===N?"/":Ut([this.parentRoute.fullPath,i]);this._path=i,this._id=o,this._fullPath=c,this._to=V(c)},this.addChildren=s=>this._addFileChildren(s),this._addFileChildren=s=>(Array.isArray(s)&&(this.children=s),typeof s=="object"&&s!==null&&(this.children=Object.values(s)),this),this._addFileTypes=()=>this,this.updateLoader=s=>(Object.assign(this.options,s),this),this.update=s=>(Object.assign(this.options,s),this),this.lazy=s=>(this.lazyFn=s,this),this.redirect=s=>Ur({from:this.fullPath,...s}),this.options=e||{},this.isRoot=!e?.getParentRoute,e?.id&&e?.path)throw new Error("Route cannot have both an 'id' and a 'path' option.")}get to(){return this._to}get id(){return this._id}get path(){return this._path}get fullPath(){return this._fullPath}}class ti extends nn{constructor(e){super(e)}}const jt=typeof window<"u"?b.useLayoutEffect:b.useEffect;function ce(t){const e=b.useRef({value:t,prev:null}),s=e.current.value;return t!==s&&(e.current={value:t,prev:s}),e.current.prev}function ei(t,e,s={},n={}){b.useEffect(()=>{if(!t.current||n.disabled||typeof IntersectionObserver!="function")return;const r=new IntersectionObserver(([i])=>{e(i)},s);return r.observe(t.current),()=>{r.disconnect()}},[e,s,n.disabled,t])}function si(t){const e=b.useRef(null);return b.useImperativeHandle(t,()=>e.current,[]),e}function Te(t){const e=t.errorComponent??Fe;return _.jsx(ni,{getResetKey:t.getResetKey,onCatch:t.onCatch,children:({error:s,reset:n})=>s?b.createElement(e,{error:s,reset:n}):t.children})}class ni extends b.Component{constructor(){super(...arguments),this.state={error:null}}static getDerivedStateFromProps(e){return{resetKey:e.getResetKey()}}static getDerivedStateFromError(e){return{error:e}}reset(){this.setState({error:null})}componentDidUpdate(e,s){s.error&&s.resetKey!==this.state.resetKey&&this.reset()}componentDidCatch(e,s){this.props.onCatch&&this.props.onCatch(e,s)}render(){return this.props.children({error:this.state.resetKey!==this.props.getResetKey()?null:this.state.error,reset:()=>{this.reset()}})}}function Fe({error:t}){const[e,s]=b.useState(!1);return _.jsxs("div",{style:{padding:".5rem",maxWidth:"100%"},children:[_.jsxs("div",{style:{display:"flex",alignItems:"center",gap:".5rem"},children:[_.jsx("strong",{style:{fontSize:"1rem"},children:"Something went wrong!"}),_.jsx("button",{style:{appearance:"none",fontSize:".6em",border:"1px solid currentColor",padding:".1rem .2rem",fontWeight:"bold",borderRadius:".25rem"},onClick:()=>s(n=>!n),children:e?"Hide Error":"Show Error"})]}),_.jsx("div",{style:{height:".25rem"}}),e?_.jsx("div",{children:_.jsx("pre",{style:{fontSize:".7em",border:"1px solid red",borderRadius:".25rem",padding:".3rem",color:"red",overflow:"auto"},children:t.message?_.jsx("code",{children:t.message}):null})}):null]})}function ri({children:t,fallback:e=null}){return rn()?_.jsx(Mt.Fragment,{children:t}):_.jsx(Mt.Fragment,{children:e})}function rn(){return Mt.useSyncExternalStore(ii,()=>!0,()=>!1)}function ii(){return()=>{}}var ue={exports:{}},le={},he={exports:{}},de={};var vs;function oi(){if(vs)return de;vs=1;var t=Os();function e(d,h){return d===h&&(d!==0||1/d===1/h)||d!==d&&h!==h}var s=typeof Object.is=="function"?Object.is:e,n=t.useState,r=t.useEffect,i=t.useLayoutEffect,a=t.useDebugValue;function o(d,h){var f=h(),p=n({inst:{value:f,getSnapshot:h}}),m=p[0].inst,g=p[1];return i(function(){m.value=f,m.getSnapshot=h,c(m)&&g({inst:m})},[d,f,h]),r(function(){return c(m)&&g({inst:m}),d(function(){c(m)&&g({inst:m})})},[d]),a(f),f}function c(d){var h=d.getSnapshot;d=d.value;try{var f=h();return!s(d,f)}catch{return!0}}function u(d,h){return h()}var l=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?u:o;return de.useSyncExternalStore=t.useSyncExternalStore!==void 0?t.useSyncExternalStore:l,de}var Ps;function ai(){return Ps||(Ps=1,he.exports=oi()),he.exports}var Ss;function ci(){if(Ss)return le;Ss=1;var t=Os(),e=ai();function s(u,l){return u===l&&(u!==0||1/u===1/l)||u!==u&&l!==l}var n=typeof Object.is=="function"?Object.is:s,r=e.useSyncExternalStore,i=t.useRef,a=t.useEffect,o=t.useMemo,c=t.useDebugValue;return le.useSyncExternalStoreWithSelector=function(u,l,d,h,f){var p=i(null);if(p.current===null){var m={hasValue:!1,value:null};p.current=m}else m=p.current;p=o(function(){function P(L){if(!S){if(S=!0,w=L,L=h(L),f!==void 0&&m.hasValue){var x=m.value;if(f(x,L))return v=x}return v=L}if(x=v,n(w,L))return x;var y=h(L);return f!==void 0&&f(x,y)?(w=L,x):(w=L,v=y)}var S=!1,w,v,C=d===void 0?null:d;return[function(){return P(l())},C===null?void 0:function(){return P(C())}]},[l,d,h,f]);var g=r(u,p[0],p[1]);return a(function(){m.hasValue=!0,m.value=g},[g]),c(g),g},le}var ws;function ui(){return ws||(ws=1,ue.exports=ci()),ue.exports}var li=ui();function hi(t,e=n=>n,s={}){const n=s.equal??di;return li.useSyncExternalStoreWithSelector(t.subscribe,()=>t.state,()=>t.state,e,n)}function di(t,e){if(Object.is(t,e))return!0;if(typeof t!="object"||t===null||typeof e!="object"||e===null)return!1;if(t instanceof Map&&e instanceof Map){if(t.size!==e.size)return!1;for(const[n,r]of t)if(!e.has(n)||!Object.is(r,e.get(n)))return!1;return!0}if(t instanceof Set&&e instanceof Set){if(t.size!==e.size)return!1;for(const n of t)if(!e.has(n))return!1;return!0}if(t instanceof Date&&e instanceof Date)return t.getTime()===e.getTime();const s=Rs(t);if(s.length!==Rs(e).length)return!1;for(let n=0;n<s.length;n++)if(!Object.prototype.hasOwnProperty.call(e,s[n])||!Object.is(t[s[n]],e[s[n]]))return!1;return!0}function Rs(t){return Object.keys(t).concat(Object.getOwnPropertySymbols(t))}const fe=b.createContext(null);function on(){return typeof document>"u"?fe:window.__TSR_ROUTER_CONTEXT__?window.__TSR_ROUTER_CONTEXT__:(window.__TSR_ROUTER_CONTEXT__=fe,fe)}function $(t){const e=b.useContext(on());return t?.warn,e}function K(t){const e=$({warn:t?.router===void 0}),s=t?.router||e,n=b.useRef(void 0);return hi(s.__store,r=>{if(t?.select){if(t.structuralSharing??s.options.defaultStructuralSharing){const i=j(n.current,t.select(r));return n.current=i,i}return t.select(r)}return r})}const Zt=b.createContext(void 0),fi=b.createContext(void 0);function z(t){const e=b.useContext(t.from?fi:Zt);return K({select:n=>{const r=n.matches.find(i=>t.from?t.from===i.routeId:i.id===e);if(G(!((t.shouldThrow??!0)&&!r),`Could not find ${t.from?`an active match from "${t.from}"`:"a nearest match!"}`),r!==void 0)return t.select?t.select(r):r},structuralSharing:t.structuralSharing})}function Ae(t){return z({from:t.from,strict:t.strict,structuralSharing:t.structuralSharing,select:e=>t.select?t.select(e.loaderData):e.loaderData})}function De(t){const{select:e,...s}=t;return z({...s,select:n=>e?e(n.loaderDeps):n.loaderDeps})}function je(t){return z({from:t.from,shouldThrow:t.shouldThrow,structuralSharing:t.structuralSharing,strict:t.strict,select:e=>{const s=t.strict===!1?e.params:e._strictParams;return t.select?t.select(s):s}})}function Ue(t){return z({from:t.from,strict:t.strict,shouldThrow:t.shouldThrow,structuralSharing:t.structuralSharing,select:e=>t.select?t.select(e.search):e.search})}function Be(t){const e=$();return b.useCallback(s=>e.navigate({...s,from:s.from??t?.from}),[t?.from,e])}function pi(t,e){const s=$(),n=si(e),{activeProps:r,inactiveProps:i,activeOptions:a,to:o,preload:c,preloadDelay:u,hashScrollIntoView:l,replace:d,startTransition:h,resetScroll:f,viewTransition:p,children:m,target:g,disabled:P,style:S,className:w,onClick:v,onFocus:C,onMouseEnter:L,onMouseLeave:x,onTouchStart:y,ignoreBlocker:R,params:M,search:O,hash:E,state:k,mask:I,reloadDocument:J,unsafeRelative:H,from:Pt,_fromLocation:Ui,...Ne}=t,Qe=rn(),ln=K({select:T=>T.location.search,structuralSharing:!0}),Ke=t.from,St=b.useMemo(()=>({...t,from:Ke}),[s,ln,Ke,t._fromLocation,t.hash,t.to,t.search,t.params,t.state,t.mask,t.unsafeRelative]),W=b.useMemo(()=>s.buildLocation({...St}),[s,St]),$e=W.maskedLocation?W.maskedLocation.publicHref:W.publicHref,qe=W.maskedLocation?W.maskedLocation.external:W.external,wt=b.useMemo(()=>Si($e,qe,s.history,P),[P,qe,$e,s.history]),It=b.useMemo(()=>{if(wt?.external)return Wt(wt.href)?void 0:wt.href;if(!wi(o)&&!(typeof o!="string"||o.indexOf(":")===-1))try{return new URL(o),Wt(o)?void 0:o}catch{}},[o,wt]),te=K({select:T=>{if(It)return!1;if(a?.exact){if(!wr(T.location.pathname,W.pathname,s.basepath))return!1}else{const D=Vt(T.location.pathname,s.basepath),q=Vt(W.pathname,s.basepath);if(!(D.startsWith(q)&&(D.length===q.length||D[q.length]==="/")))return!1}return(a?.includeSearch??!0)&&!ot(T.location.search,W.search,{partial:!a?.exact,ignoreUndefined:!a?.explicitUndefined})?!1:a?.includeHash?Qe&&T.location.hash===W.hash:!0}}),Tt=te?X(r,{})??mi:pe,Ft=te?pe:X(i,{})??pe,He=[w,Tt.className,Ft.className].filter(Boolean).join(" "),We=(S||Tt.style||Ft.style)&&{...S,...Tt.style,...Ft.style},[hn,ze]=b.useState(!1),Ve=b.useRef(!1),dt=t.reloadDocument||It?!1:c??s.options.defaultPreload,ee=u??s.options.defaultPreloadDelay??0,st=b.useCallback(()=>{s.preloadRoute({...St}).catch(T=>{console.warn(T),console.warn(Zr)})},[s,St]),dn=b.useCallback(T=>{T?.isIntersecting&&st()},[st]);ei(n,dn,Pi,{disabled:!!P||dt!=="viewport"}),b.useEffect(()=>{Ve.current||!P&&dt==="render"&&(st(),Ve.current=!0)},[P,st,dt]);const fn=T=>{const D=T.currentTarget.getAttribute("target"),q=g!==void 0?g:D;if(!P&&!Ri(T)&&!T.defaultPrevented&&(!q||q==="_self")&&T.button===0){T.preventDefault(),Pn.flushSync(()=>{ze(!0)});const Je=s.subscribe("onResolved",()=>{Je(),ze(!1)});s.navigate({...St,replace:d,resetScroll:f,hashScrollIntoView:l,startTransition:h,viewTransition:p,ignoreBlocker:R})}};if(It)return{...Ne,ref:n,href:It,...m&&{children:m},...g&&{target:g},...P&&{disabled:P},...S&&{style:S},...w&&{className:w},...v&&{onClick:v},...C&&{onFocus:C},...L&&{onMouseEnter:L},...x&&{onMouseLeave:x},...y&&{onTouchStart:y}};const Ge=T=>{P||dt&&st()},pn=Ge,mn=T=>{if(!(P||!dt))if(!ee)st();else{const D=T.target;if(_t.has(D))return;const q=setTimeout(()=>{_t.delete(D),st()},ee);_t.set(D,q)}},gn=T=>{if(P||!dt||!ee)return;const D=T.target,q=_t.get(D);q&&(clearTimeout(q),_t.delete(D))};return{...Ne,...Tt,...Ft,href:wt?.href,ref:n,onClick:Ct([v,fn]),onFocus:Ct([C,Ge]),onMouseEnter:Ct([L,mn]),onMouseLeave:Ct([x,gn]),onTouchStart:Ct([y,pn]),disabled:!!P,target:g,...We&&{style:We},...He&&{className:He},...P&&gi,...te&&yi,...Qe&&hn&&vi}}const pe={},mi={className:"active"},gi={role:"link","aria-disabled":!0},yi={"data-status":"active","aria-current":"page"},vi={"data-transitioning":"transitioning"},_t=new WeakMap,Pi={rootMargin:"100px"},Ct=t=>e=>{for(const s of t)if(s){if(e.defaultPrevented)return;s(e)}};function Si(t,e,s,n){if(!n)return e?{href:t,external:!0}:{href:s.createHref(t)||"/",external:!1}}function wi(t){if(typeof t!="string")return!1;const e=t.charCodeAt(0);return e===47?t.charCodeAt(1)!==47:e===46}const an=b.forwardRef((t,e)=>{const{_asChild:s,...n}=t,{type:r,...i}=pi(n,e),a=typeof n.children=="function"?n.children({isActive:i["data-status"]==="active"}):n.children;if(!s){const{disabled:o,...c}=i;return b.createElement("a",c,a)}return b.createElement(s,i,a)});function Ri(t){return!!(t.metaKey||t.altKey||t.ctrlKey||t.shiftKey)}class bi extends nn{constructor(e){super(e),this.useMatch=s=>z({select:s?.select,from:this.id,structuralSharing:s?.structuralSharing}),this.useRouteContext=s=>z({...s,from:this.id,select:n=>s?.select?s.select(n.context):n.context}),this.useSearch=s=>Ue({select:s?.select,structuralSharing:s?.structuralSharing,from:this.id}),this.useParams=s=>je({select:s?.select,structuralSharing:s?.structuralSharing,from:this.id}),this.useLoaderDeps=s=>De({...s,from:this.id}),this.useLoaderData=s=>Ae({...s,from:this.id}),this.useNavigate=()=>Be({from:this.fullPath}),this.Link=Mt.forwardRef((s,n)=>_.jsx(an,{ref:n,from:this.fullPath,...s})),this.$$typeof=Symbol.for("react.memo")}}function xi(t){return new bi(t)}class _i extends ti{constructor(e){super(e),this.useMatch=s=>z({select:s?.select,from:this.id,structuralSharing:s?.structuralSharing}),this.useRouteContext=s=>z({...s,from:this.id,select:n=>s?.select?s.select(n.context):n.context}),this.useSearch=s=>Ue({select:s?.select,structuralSharing:s?.structuralSharing,from:this.id}),this.useParams=s=>je({select:s?.select,structuralSharing:s?.structuralSharing,from:this.id}),this.useLoaderDeps=s=>De({...s,from:this.id}),this.useLoaderData=s=>Ae({...s,from:this.id}),this.useNavigate=()=>Be({from:this.fullPath}),this.Link=Mt.forwardRef((s,n)=>_.jsx(an,{ref:n,from:this.fullPath,...s})),this.$$typeof=Symbol.for("react.memo")}}function Hi(t){return new _i(t)}function bs(t){return typeof t=="object"?new xs(t,{silent:!0}).createRoute(t):new xs(t,{silent:!0}).createRoute}class xs{constructor(e,s){this.path=e,this.createRoute=n=>{this.silent;const r=xi(n);return r.isRoot=!1,r},this.silent=s?.silent}}class _s{constructor(e){this.useMatch=s=>z({select:s?.select,from:this.options.id,structuralSharing:s?.structuralSharing}),this.useRouteContext=s=>z({from:this.options.id,select:n=>s?.select?s.select(n.context):n.context}),this.useSearch=s=>Ue({select:s?.select,structuralSharing:s?.structuralSharing,from:this.options.id}),this.useParams=s=>je({select:s?.select,structuralSharing:s?.structuralSharing,from:this.options.id}),this.useLoaderDeps=s=>De({...s,from:this.options.id}),this.useLoaderData=s=>Ae({...s,from:this.options.id}),this.useNavigate=()=>{const s=$();return Be({from:s.routesById[this.options.id].fullPath})},this.options=e,this.$$typeof=Symbol.for("react.memo")}}function Cs(t){return typeof t=="object"?new _s(t):e=>new _s({id:t,...e})}function Ci(){const t=$(),e=b.useRef({router:t,mounted:!1}),[s,n]=b.useState(!1),{hasPendingMatches:r,isLoading:i}=K({select:d=>({isLoading:d.isLoading,hasPendingMatches:d.matches.some(h=>h.status==="pending")}),structuralSharing:!0}),a=ce(i),o=i||s||r,c=ce(o),u=i||r,l=ce(u);return t.startTransition=d=>{n(!0),b.startTransition(()=>{d(),n(!1)})},b.useEffect(()=>{const d=t.history.subscribe(t.load),h=t.buildLocation({to:t.latestLocation.pathname,search:!0,params:!0,hash:!0,state:!0,_includeValidateSearch:!0});return V(t.latestLocation.publicHref)!==V(h.publicHref)&&t.commitLocation({...h,replace:!0}),()=>{d()}},[t,t.history]),jt(()=>{if(typeof window<"u"&&t.ssr||e.current.router===t&&e.current.mounted)return;e.current={router:t,mounted:!0},(async()=>{try{await t.load()}catch(h){console.error(h)}})()},[t]),jt(()=>{a&&!i&&t.emit({type:"onLoad",...at(t.state)})},[a,t,i]),jt(()=>{l&&!u&&t.emit({type:"onBeforeRouteMount",...at(t.state)})},[u,l,t]),jt(()=>{if(c&&!o){const d=at(t.state);t.emit({type:"onResolved",...d}),t.__store.setState(h=>({...h,status:"idle",resolvedLocation:h.location})),d.hrefChanged&&kr(t)}},[o,c,t]),null}function Li(t){const e=K({select:s=>`not-found-${s.location.pathname}-${s.status}`});return _.jsx(Te,{getResetKey:()=>e,onCatch:(s,n)=>{if(U(s))t.onCatch?.(s,n);else throw s},errorComponent:({error:s})=>{if(U(s))return t.fallback?.(s);throw s},children:t.children})}function Mi(){return _.jsx("p",{children:"Not Found"})}function ft(t){return _.jsx(_.Fragment,{children:t.children})}function cn(t,e,s){return e.options.notFoundComponent?_.jsx(e.options.notFoundComponent,{...s}):t.options.defaultNotFoundComponent?_.jsx(t.options.defaultNotFoundComponent,{...s}):_.jsx(Mi,{})}function Oi(){return $().isScrollRestoring,null}const un=b.memo(function({matchId:e}){const s=$(),n=K({select:m=>{const g=m.matches.findIndex(S=>S.id===e),P=m.matches[g];return G(P),{routeId:P.routeId,ssr:P.ssr,_displayPending:P._displayPending,resetKey:m.loadedAt,parentRouteId:m.matches[g-1]?.routeId}},structuralSharing:!0}),r=s.routesById[n.routeId],i=r.options.pendingComponent??s.options.defaultPendingComponent,a=i?_.jsx(i,{}):null,o=r.options.errorComponent??s.options.defaultErrorComponent,c=r.options.onCatch??s.options.defaultOnCatch,u=r.isRoot?r.options.notFoundComponent??s.options.notFoundRoute?.options.component:r.options.notFoundComponent,l=n.ssr===!1||n.ssr==="data-only",d=(!r.isRoot||r.options.wrapInSuspense||l)&&(r.options.wrapInSuspense??i??(r.options.errorComponent?.preload||l))?b.Suspense:ft,h=o?Te:ft,f=u?Li:ft,p=r.isRoot?r.options.shellComponent??ft:ft;return _.jsxs(p,{children:[_.jsx(Zt.Provider,{value:e,children:_.jsx(d,{fallback:a,children:_.jsx(h,{getResetKey:()=>n.resetKey,errorComponent:o||Fe,onCatch:(m,g)=>{if(U(m))throw m;c?.(m,g)},children:_.jsx(f,{fallback:m=>{if(!u||m.routeId&&m.routeId!==n.routeId||!m.routeId&&!r.isRoot)throw m;return b.createElement(u,m)},children:l||n._displayPending?_.jsx(ri,{fallback:a,children:_.jsx(Ls,{matchId:e})}):_.jsx(Ls,{matchId:e})})})})}),n.parentRouteId===N&&s.options.scrollRestoration?_.jsxs(_.Fragment,{children:[_.jsx(Ei,{}),_.jsx(Oi,{})]}):null]})});function Ei(){const t=$(),e=b.useRef(void 0);return _.jsx("script",{suppressHydrationWarning:!0,ref:s=>{s&&(e.current===void 0||e.current.href!==t.latestLocation.href)&&(t.emit({type:"onRendered",...at(t.state)}),e.current=t.latestLocation)}},t.latestLocation.state.__TSR_key)}const Ls=b.memo(function({matchId:e}){const s=$(),{match:n,key:r,routeId:i}=K({select:c=>{const u=c.matches.find(p=>p.id===e),l=u.routeId,h=(s.routesById[l].options.remountDeps??s.options.defaultRemountDeps)?.({routeId:l,loaderDeps:u.loaderDeps,params:u._strictParams,search:u._strictSearch});return{key:h?JSON.stringify(h):void 0,routeId:l,match:{id:u.id,status:u.status,error:u.error,invalid:u.invalid,_forcePending:u._forcePending,_displayPending:u._displayPending}}},structuralSharing:!0}),a=s.routesById[i],o=b.useMemo(()=>{const c=a.options.component??s.options.defaultComponent;return c?_.jsx(c,{},r):_.jsx(ki,{})},[r,a.options.component,s.options.defaultComponent]);if(n._displayPending)throw s.getMatch(n.id)?._nonReactive.displayPendingPromise;if(n._forcePending)throw s.getMatch(n.id)?._nonReactive.minPendingPromise;if(n.status==="pending"){const c=a.options.pendingMinMs??s.options.defaultPendingMinMs;if(c){const u=s.getMatch(n.id);if(u&&!u._nonReactive.minPendingPromise){const l=gt();u._nonReactive.minPendingPromise=l,setTimeout(()=>{l.resolve(),u._nonReactive.minPendingPromise=void 0},c)}}throw s.getMatch(n.id)?._nonReactive.loadPromise}if(n.status==="notFound")return G(U(n.error)),cn(s,a,n.error);if(n.status==="redirected")throw G(Q(n.error)),s.getMatch(n.id)?._nonReactive.loadPromise;if(n.status==="error")throw n.error;return o}),ki=b.memo(function(){const e=$(),s=b.useContext(Zt),n=K({select:u=>u.matches.find(l=>l.id===s)?.routeId}),r=e.routesById[n],i=K({select:u=>{const d=u.matches.find(h=>h.id===s);return G(d),d.globalNotFound}}),a=K({select:u=>{const l=u.matches,d=l.findIndex(h=>h.id===s);return l[d+1]?.id}}),o=e.options.defaultPendingComponent?_.jsx(e.options.defaultPendingComponent,{}):null;if(i)return cn(e,r,void 0);if(!a)return null;const c=_.jsx(un,{matchId:a});return n===N?_.jsx(b.Suspense,{fallback:o,children:c}):c});function Ii(){const t=$(),s=t.routesById[N].options.pendingComponent??t.options.defaultPendingComponent,n=s?_.jsx(s,{}):null,r=typeof document<"u"&&t.ssr?ft:b.Suspense,i=_.jsxs(r,{fallback:n,children:[_.jsx(Ci,{}),_.jsx(Ti,{})]});return t.options.InnerWrap?_.jsx(t.options.InnerWrap,{children:i}):i}function Ti(){const t=$(),e=K({select:r=>r.matches[0]?.id}),s=K({select:r=>r.loadedAt}),n=e?_.jsx(un,{matchId:e}):null;return _.jsx(Zt.Provider,{value:e,children:t.options.disableGlobalCatchBoundary?n:_.jsx(Te,{getResetKey:()=>s,errorComponent:Fe,onCatch:r=>{r.message||r.toString()},children:n})})}const Wi=t=>new Fi(t);class Fi extends Wr{constructor(e){super(e)}}typeof globalThis<"u"?(globalThis.createFileRoute=bs,globalThis.createLazyFileRoute=Cs):typeof window<"u"&&(window.createFileRoute=bs,window.createLazyFileRoute=Cs);function Ai({router:t,children:e,...s}){Object.keys(s).length>0&&t.update({...t.options,...s,context:{...t.options.context,...s.context}});const n=on(),r=_.jsx(n.Provider,{value:t,children:e});return t.options.Wrap?_.jsx(t.options.Wrap,{children:r}):r}function zi({router:t,...e}){return _.jsx(Ai,{router:t,...e,children:_.jsx(Ii,{})})}const Di="modulepreload",ji=function(t){return"/"+t},Ms={},Vi=function(e,s,n){let r=Promise.resolve();if(s&&s.length>0){let c=function(u){return Promise.all(u.map(l=>Promise.resolve(l).then(d=>({status:"fulfilled",value:d}),d=>({status:"rejected",reason:d}))))};document.getElementsByTagName("link");const a=document.querySelector("meta[property=csp-nonce]"),o=a?.nonce||a?.getAttribute("nonce");r=c(s.map(u=>{if(u=ji(u),u in Ms)return;Ms[u]=!0;const l=u.endsWith(".css"),d=l?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${u}"]${d}`))return;const h=document.createElement("link");if(h.rel=l?"stylesheet":Di,l||(h.as="script"),h.crossOrigin="",h.href=u,o&&h.setAttribute("nonce",o),document.head.appendChild(h),l)return new Promise((f,p)=>{h.addEventListener("load",f),h.addEventListener("error",()=>p(new Error(`Unable to preload CSS for ${u}`)))})}))}function i(a){const o=new Event("vite:preloadError",{cancelable:!0});if(o.payload=a,window.dispatchEvent(o),!o.defaultPrevented)throw a}return r.then(a=>{for(const o of a||[])o.status==="rejected"&&i(o.reason);return e().catch(i)})};export{ki as O,Ni as Q,zi as R,Vi as _,Qs as a,$i as b,qi as c,Hi as d,bs as e,Be as f,Wi as g,Qi as h,Ur as r,Ki as u};