diff --git a/exam/dist/assets/index-Bv9g1hLV.js b/exam/dist/assets/index-Bv9g1hLV.js new file mode 100644 index 0000000..0d85ba0 --- /dev/null +++ b/exam/dist/assets/index-Bv9g1hLV.js @@ -0,0 +1,617 @@ +var Td=e=>{throw TypeError(e)};var ha=(e,t,n)=>t.has(e)||Td("Cannot "+n);var P=(e,t,n)=>(ha(e,t,"read from private field"),n?n.call(e):t.get(e)),J=(e,t,n)=>t.has(e)?Td("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),U=(e,t,n,r)=>(ha(e,t,"write to private field"),r?r.call(e,n):t.set(e,n),n),Ie=(e,t,n)=>(ha(e,t,"access private method"),n);var Mi=(e,t,n,r)=>({set _(o){U(e,t,o,n)},get _(){return P(e,t,r)}});function Hy(e,t){for(var n=0;nr[o]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const o of document.querySelectorAll('link[rel="modulepreload"]'))r(o);new MutationObserver(o=>{for(const i of o)if(i.type==="childList")for(const s of i.addedNodes)s.tagName==="LINK"&&s.rel==="modulepreload"&&r(s)}).observe(document,{childList:!0,subtree:!0});function n(o){const i={};return o.integrity&&(i.integrity=o.integrity),o.referrerPolicy&&(i.referrerPolicy=o.referrerPolicy),o.crossOrigin==="use-credentials"?i.credentials="include":o.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function r(o){if(o.ep)return;o.ep=!0;const i=n(o);fetch(o.href,i)}})();function th(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function Wn(e){if(e.__esModule)return e;var t=e.default;if(typeof t=="function"){var n=function r(){return this instanceof r?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};n.prototype=t.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(e).forEach(function(r){var o=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(n,r,o.get?o:{enumerable:!0,get:function(){return e[r]}})}),n}var nh={exports:{}},ol={},rh={exports:{}},H={};/** + * @license React + * react.production.min.js + * + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */var wi=Symbol.for("react.element"),Vy=Symbol.for("react.portal"),Ky=Symbol.for("react.fragment"),Gy=Symbol.for("react.strict_mode"),Qy=Symbol.for("react.profiler"),qy=Symbol.for("react.provider"),Yy=Symbol.for("react.context"),Xy=Symbol.for("react.forward_ref"),Jy=Symbol.for("react.suspense"),Zy=Symbol.for("react.memo"),ev=Symbol.for("react.lazy"),Md=Symbol.iterator;function tv(e){return e===null||typeof e!="object"?null:(e=Md&&e[Md]||e["@@iterator"],typeof e=="function"?e:null)}var oh={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},ih=Object.assign,sh={};function ho(e,t,n){this.props=e,this.context=t,this.refs=sh,this.updater=n||oh}ho.prototype.isReactComponent={};ho.prototype.setState=function(e,t){if(typeof e!="object"&&typeof e!="function"&&e!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,t,"setState")};ho.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function lh(){}lh.prototype=ho.prototype;function ac(e,t,n){this.props=e,this.context=t,this.refs=sh,this.updater=n||oh}var uc=ac.prototype=new lh;uc.constructor=ac;ih(uc,ho.prototype);uc.isPureReactComponent=!0;var Ld=Array.isArray,ah=Object.prototype.hasOwnProperty,cc={current:null},uh={key:!0,ref:!0,__self:!0,__source:!0};function ch(e,t,n){var r,o={},i=null,s=null;if(t!=null)for(r in t.ref!==void 0&&(s=t.ref),t.key!==void 0&&(i=""+t.key),t)ah.call(t,r)&&!uh.hasOwnProperty(r)&&(o[r]=t[r]);var l=arguments.length-2;if(l===1)o.children=n;else if(1{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},sl=typeof window>"u"||"Deno"in globalThis;function Mt(){}function fv(e,t){return typeof e=="function"?e(t):e}function pv(e){return typeof e=="number"&&e>=0&&e!==1/0}function hv(e,t){return Math.max(e+(t||0)-Date.now(),0)}function Id(e,t){return typeof e=="function"?e(t):e}function mv(e,t){return typeof e=="function"?e(t):e}function Nd(e,t){const{type:n="all",exact:r,fetchStatus:o,predicate:i,queryKey:s,stale:l}=e;if(s){if(r){if(t.queryHash!==fc(s,t.options))return!1}else if(!Yo(t.queryKey,s))return!1}if(n!=="all"){const a=t.isActive();if(n==="active"&&!a||n==="inactive"&&a)return!1}return!(typeof l=="boolean"&&t.isStale()!==l||o&&o!==t.state.fetchStatus||i&&!i(t))}function Dd(e,t){const{exact:n,status:r,predicate:o,mutationKey:i}=e;if(i){if(!t.options.mutationKey)return!1;if(n){if(qo(t.options.mutationKey)!==qo(i))return!1}else if(!Yo(t.options.mutationKey,i))return!1}return!(r&&t.state.status!==r||o&&!o(t))}function fc(e,t){return((t==null?void 0:t.queryKeyHashFn)||qo)(e)}function qo(e){return JSON.stringify(e,(t,n)=>tu(n)?Object.keys(n).sort().reduce((r,o)=>(r[o]=n[o],r),{}):n)}function Yo(e,t){return e===t?!0:typeof e!=typeof t?!1:e&&t&&typeof e=="object"&&typeof t=="object"?!Object.keys(t).some(n=>!Yo(e[n],t[n])):!1}function ph(e,t){if(e===t)return e;const n=Ad(e)&&Ad(t);if(n||tu(e)&&tu(t)){const r=n?e:Object.keys(e),o=r.length,i=n?t:Object.keys(t),s=i.length,l=n?[]:{};let a=0;for(let u=0;u{setTimeout(t,e)})}function vv(e,t,n){return typeof n.structuralSharing=="function"?n.structuralSharing(e,t):n.structuralSharing!==!1?ph(e,t):t}function gv(e,t,n=0){const r=[...e,t];return n&&r.length>n?r.slice(1):r}function xv(e,t,n=0){const r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var hh=Symbol();function mh(e,t){return!e.queryFn&&(t!=null&&t.initialPromise)?()=>t.initialPromise:!e.queryFn||e.queryFn===hh?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}var nr,_n,Vr,Gp,Sv=(Gp=class extends il{constructor(){super();J(this,nr);J(this,_n);J(this,Vr);U(this,Vr,t=>{if(!sl&&window.addEventListener){const n=()=>t();return window.addEventListener("visibilitychange",n,!1),()=>{window.removeEventListener("visibilitychange",n)}}})}onSubscribe(){P(this,_n)||this.setEventListener(P(this,Vr))}onUnsubscribe(){var t;this.hasListeners()||((t=P(this,_n))==null||t.call(this),U(this,_n,void 0))}setEventListener(t){var n;U(this,Vr,t),(n=P(this,_n))==null||n.call(this),U(this,_n,t(r=>{typeof r=="boolean"?this.setFocused(r):this.onFocus()}))}setFocused(t){P(this,nr)!==t&&(U(this,nr,t),this.onFocus())}onFocus(){const t=this.isFocused();this.listeners.forEach(n=>{n(t)})}isFocused(){var t;return typeof P(this,nr)=="boolean"?P(this,nr):((t=globalThis.document)==null?void 0:t.visibilityState)!=="hidden"}},nr=new WeakMap,_n=new WeakMap,Vr=new WeakMap,Gp),yh=new Sv,Kr,Pn,Gr,Qp,wv=(Qp=class extends il{constructor(){super();J(this,Kr,!0);J(this,Pn);J(this,Gr);U(this,Gr,t=>{if(!sl&&window.addEventListener){const n=()=>t(!0),r=()=>t(!1);return window.addEventListener("online",n,!1),window.addEventListener("offline",r,!1),()=>{window.removeEventListener("online",n),window.removeEventListener("offline",r)}}})}onSubscribe(){P(this,Pn)||this.setEventListener(P(this,Gr))}onUnsubscribe(){var t;this.hasListeners()||((t=P(this,Pn))==null||t.call(this),U(this,Pn,void 0))}setEventListener(t){var n;U(this,Gr,t),(n=P(this,Pn))==null||n.call(this),U(this,Pn,t(this.setOnline.bind(this)))}setOnline(t){P(this,Kr)!==t&&(U(this,Kr,t),this.listeners.forEach(r=>{r(t)}))}isOnline(){return P(this,Kr)}},Kr=new WeakMap,Pn=new WeakMap,Gr=new WeakMap,Qp),_s=new wv;function kv(e){return Math.min(1e3*2**e,3e4)}function vh(e){return(e??"online")==="online"?_s.isOnline():!0}var gh=class{constructor(e){this.revert=e==null?void 0:e.revert,this.silent=e==null?void 0:e.silent}};function ya(e){return e instanceof gh}function xh(e){let t=!1,n=0,r=!1,o,i,s;const l=new Promise((h,m)=>{i=h,s=m}),a=h=>{var m;r||(x(new gh(h)),(m=e.abort)==null||m.call(e))},u=()=>{t=!0},c=()=>{t=!1},d=()=>yh.isFocused()&&(e.networkMode==="always"||_s.isOnline())&&e.canRun(),f=()=>vh(e.networkMode)&&e.canRun(),y=h=>{var m;r||(r=!0,(m=e.onSuccess)==null||m.call(e,h),o==null||o(),i(h))},x=h=>{var m;r||(r=!0,(m=e.onError)==null||m.call(e,h),o==null||o(),s(h))},v=()=>new Promise(h=>{var m;o=g=>{(r||d())&&h(g)},(m=e.onPause)==null||m.call(e)}).then(()=>{var h;o=void 0,r||(h=e.onContinue)==null||h.call(e)}),k=()=>{if(r)return;let h;const m=n===0?e.initialPromise:void 0;try{h=m??e.fn()}catch(g){h=Promise.reject(g)}Promise.resolve(h).then(y).catch(g=>{var w;if(r)return;const S=e.retry??(sl?0:3),C=e.retryDelay??kv,_=typeof C=="function"?C(n,g):C,E=S===!0||typeof S=="number"&&nd()?void 0:v()).then(()=>{t?x(g):k()})})};return{promise:l,cancel:a,continue:()=>(o==null||o(),l),cancelRetry:u,continueRetry:c,canStart:f,start:()=>(f()?k():v().then(k),l)}}function Cv(){let e=[],t=0,n=f=>{f()},r=f=>{f()},o=f=>setTimeout(f,0);const i=f=>{o=f},s=f=>{let y;t++;try{y=f()}finally{t--,t||u()}return y},l=f=>{t?e.push(f):o(()=>{n(f)})},a=f=>(...y)=>{l(()=>{f(...y)})},u=()=>{const f=e;e=[],f.length&&o(()=>{r(()=>{f.forEach(y=>{n(y)})})})};return{batch:s,batchCalls:a,schedule:l,setNotifyFunction:f=>{n=f},setBatchNotifyFunction:f=>{r=f},setScheduler:i}}var qe=Cv(),rr,qp,Sh=(qp=class{constructor(){J(this,rr)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),pv(this.gcTime)&&U(this,rr,setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(sl?1/0:5*60*1e3))}clearGcTimeout(){P(this,rr)&&(clearTimeout(P(this,rr)),U(this,rr,void 0))}},rr=new WeakMap,qp),Qr,qr,gt,Be,xi,or,zt,on,Yp,Ev=(Yp=class extends Sh{constructor(t){super();J(this,zt);J(this,Qr);J(this,qr);J(this,gt);J(this,Be);J(this,xi);J(this,or);U(this,or,!1),U(this,xi,t.defaultOptions),this.setOptions(t.options),this.observers=[],U(this,gt,t.cache),this.queryKey=t.queryKey,this.queryHash=t.queryHash,U(this,Qr,t.state||Pv(this.options)),this.state=P(this,Qr),this.scheduleGc()}get meta(){return this.options.meta}get promise(){var t;return(t=P(this,Be))==null?void 0:t.promise}setOptions(t){this.options={...P(this,xi),...t},this.updateGcTime(this.options.gcTime)}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&P(this,gt).remove(this)}setData(t,n){const r=vv(this.state.data,t,this.options);return Ie(this,zt,on).call(this,{data:r,type:"success",dataUpdatedAt:n==null?void 0:n.updatedAt,manual:n==null?void 0:n.manual}),r}setState(t,n){Ie(this,zt,on).call(this,{type:"setState",state:t,setStateOptions:n})}cancel(t){var r,o;const n=(r=P(this,Be))==null?void 0:r.promise;return(o=P(this,Be))==null||o.cancel(t),n?n.then(Mt).catch(Mt):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(P(this,Qr))}isActive(){return this.observers.some(t=>mv(t.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0&&!this.isActive()}isStale(){return this.state.isInvalidated?!0:this.getObserversCount()>0?this.observers.some(t=>t.getCurrentResult().isStale):this.state.data===void 0}isStaleByTime(t=0){return this.state.isInvalidated||this.state.data===void 0||!hv(this.state.dataUpdatedAt,t)}onFocus(){var n;const t=this.observers.find(r=>r.shouldFetchOnWindowFocus());t==null||t.refetch({cancelRefetch:!1}),(n=P(this,Be))==null||n.continue()}onOnline(){var n;const t=this.observers.find(r=>r.shouldFetchOnReconnect());t==null||t.refetch({cancelRefetch:!1}),(n=P(this,Be))==null||n.continue()}addObserver(t){this.observers.includes(t)||(this.observers.push(t),this.clearGcTimeout(),P(this,gt).notify({type:"observerAdded",query:this,observer:t}))}removeObserver(t){this.observers.includes(t)&&(this.observers=this.observers.filter(n=>n!==t),this.observers.length||(P(this,Be)&&(P(this,or)?P(this,Be).cancel({revert:!0}):P(this,Be).cancelRetry()),this.scheduleGc()),P(this,gt).notify({type:"observerRemoved",query:this,observer:t}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||Ie(this,zt,on).call(this,{type:"invalidate"})}fetch(t,n){var a,u,c;if(this.state.fetchStatus!=="idle"){if(this.state.data!==void 0&&(n!=null&&n.cancelRefetch))this.cancel({silent:!0});else if(P(this,Be))return P(this,Be).continueRetry(),P(this,Be).promise}if(t&&this.setOptions(t),!this.options.queryFn){const d=this.observers.find(f=>f.options.queryFn);d&&this.setOptions(d.options)}const r=new AbortController,o=d=>{Object.defineProperty(d,"signal",{enumerable:!0,get:()=>(U(this,or,!0),r.signal)})},i=()=>{const d=mh(this.options,n),f={queryKey:this.queryKey,meta:this.meta};return o(f),U(this,or,!1),this.options.persister?this.options.persister(d,f,this):d(f)},s={fetchOptions:n,options:this.options,queryKey:this.queryKey,state:this.state,fetchFn:i};o(s),(a=this.options.behavior)==null||a.onFetch(s,this),U(this,qr,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((u=s.fetchOptions)==null?void 0:u.meta))&&Ie(this,zt,on).call(this,{type:"fetch",meta:(c=s.fetchOptions)==null?void 0:c.meta});const l=d=>{var f,y,x,v;ya(d)&&d.silent||Ie(this,zt,on).call(this,{type:"error",error:d}),ya(d)||((y=(f=P(this,gt).config).onError)==null||y.call(f,d,this),(v=(x=P(this,gt).config).onSettled)==null||v.call(x,this.state.data,d,this)),this.isFetchingOptimistic||this.scheduleGc(),this.isFetchingOptimistic=!1};return U(this,Be,xh({initialPromise:n==null?void 0:n.initialPromise,fn:s.fetchFn,abort:r.abort.bind(r),onSuccess:d=>{var f,y,x,v;if(d===void 0){l(new Error(`${this.queryHash} data is undefined`));return}this.setData(d),(y=(f=P(this,gt).config).onSuccess)==null||y.call(f,d,this),(v=(x=P(this,gt).config).onSettled)==null||v.call(x,d,this.state.error,this),this.isFetchingOptimistic||this.scheduleGc(),this.isFetchingOptimistic=!1},onError:l,onFail:(d,f)=>{Ie(this,zt,on).call(this,{type:"failed",failureCount:d,error:f})},onPause:()=>{Ie(this,zt,on).call(this,{type:"pause"})},onContinue:()=>{Ie(this,zt,on).call(this,{type:"continue"})},retry:s.options.retry,retryDelay:s.options.retryDelay,networkMode:s.options.networkMode,canRun:()=>!0})),P(this,Be).start()}},Qr=new WeakMap,qr=new WeakMap,gt=new WeakMap,Be=new WeakMap,xi=new WeakMap,or=new WeakMap,zt=new WeakSet,on=function(t){const n=r=>{switch(t.type){case"failed":return{...r,fetchFailureCount:t.failureCount,fetchFailureReason:t.error};case"pause":return{...r,fetchStatus:"paused"};case"continue":return{...r,fetchStatus:"fetching"};case"fetch":return{...r,..._v(r.data,this.options),fetchMeta:t.meta??null};case"success":return{...r,data:t.data,dataUpdateCount:r.dataUpdateCount+1,dataUpdatedAt:t.dataUpdatedAt??Date.now(),error:null,isInvalidated:!1,status:"success",...!t.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};case"error":const o=t.error;return ya(o)&&o.revert&&P(this,qr)?{...P(this,qr),fetchStatus:"idle"}:{...r,error:o,errorUpdateCount:r.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:r.fetchFailureCount+1,fetchFailureReason:o,fetchStatus:"idle",status:"error"};case"invalidate":return{...r,isInvalidated:!0};case"setState":return{...r,...t.state}}};this.state=n(this.state),qe.batch(()=>{this.observers.forEach(r=>{r.onQueryUpdate()}),P(this,gt).notify({query:this,type:"updated",action:t})})},Yp);function _v(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:vh(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function Pv(e){const t=typeof e.initialData=="function"?e.initialData():e.initialData,n=t!==void 0,r=n?typeof e.initialDataUpdatedAt=="function"?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:n?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?"success":"pending",fetchStatus:"idle"}}var Kt,Xp,$v=(Xp=class extends il{constructor(t={}){super();J(this,Kt);this.config=t,U(this,Kt,new Map)}build(t,n,r){const o=n.queryKey,i=n.queryHash??fc(o,n);let s=this.get(i);return s||(s=new Ev({cache:this,queryKey:o,queryHash:i,options:t.defaultQueryOptions(n),state:r,defaultOptions:t.getQueryDefaults(o)}),this.add(s)),s}add(t){P(this,Kt).has(t.queryHash)||(P(this,Kt).set(t.queryHash,t),this.notify({type:"added",query:t}))}remove(t){const n=P(this,Kt).get(t.queryHash);n&&(t.destroy(),n===t&&P(this,Kt).delete(t.queryHash),this.notify({type:"removed",query:t}))}clear(){qe.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}get(t){return P(this,Kt).get(t)}getAll(){return[...P(this,Kt).values()]}find(t){const n={exact:!0,...t};return this.getAll().find(r=>Nd(n,r))}findAll(t={}){const n=this.getAll();return Object.keys(t).length>0?n.filter(r=>Nd(t,r)):n}notify(t){qe.batch(()=>{this.listeners.forEach(n=>{n(t)})})}onFocus(){qe.batch(()=>{this.getAll().forEach(t=>{t.onFocus()})})}onOnline(){qe.batch(()=>{this.getAll().forEach(t=>{t.onOnline()})})}},Kt=new WeakMap,Xp),Gt,Ke,ir,Qt,xn,Jp,Rv=(Jp=class extends Sh{constructor(t){super();J(this,Qt);J(this,Gt);J(this,Ke);J(this,ir);this.mutationId=t.mutationId,U(this,Ke,t.mutationCache),U(this,Gt,[]),this.state=t.state||jv(),this.setOptions(t.options),this.scheduleGc()}setOptions(t){this.options=t,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(t){P(this,Gt).includes(t)||(P(this,Gt).push(t),this.clearGcTimeout(),P(this,Ke).notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){U(this,Gt,P(this,Gt).filter(n=>n!==t)),this.scheduleGc(),P(this,Ke).notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){P(this,Gt).length||(this.state.status==="pending"?this.scheduleGc():P(this,Ke).remove(this))}continue(){var t;return((t=P(this,ir))==null?void 0:t.continue())??this.execute(this.state.variables)}async execute(t){var o,i,s,l,a,u,c,d,f,y,x,v,k,h,m,g,S,C,_,E;U(this,ir,xh({fn:()=>this.options.mutationFn?this.options.mutationFn(t):Promise.reject(new Error("No mutationFn found")),onFail:(w,b)=>{Ie(this,Qt,xn).call(this,{type:"failed",failureCount:w,error:b})},onPause:()=>{Ie(this,Qt,xn).call(this,{type:"pause"})},onContinue:()=>{Ie(this,Qt,xn).call(this,{type:"continue"})},retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>P(this,Ke).canRun(this)}));const n=this.state.status==="pending",r=!P(this,ir).canStart();try{if(!n){Ie(this,Qt,xn).call(this,{type:"pending",variables:t,isPaused:r}),await((i=(o=P(this,Ke).config).onMutate)==null?void 0:i.call(o,t,this));const b=await((l=(s=this.options).onMutate)==null?void 0:l.call(s,t));b!==this.state.context&&Ie(this,Qt,xn).call(this,{type:"pending",context:b,variables:t,isPaused:r})}const w=await P(this,ir).start();return await((u=(a=P(this,Ke).config).onSuccess)==null?void 0:u.call(a,w,t,this.state.context,this)),await((d=(c=this.options).onSuccess)==null?void 0:d.call(c,w,t,this.state.context)),await((y=(f=P(this,Ke).config).onSettled)==null?void 0:y.call(f,w,null,this.state.variables,this.state.context,this)),await((v=(x=this.options).onSettled)==null?void 0:v.call(x,w,null,t,this.state.context)),Ie(this,Qt,xn).call(this,{type:"success",data:w}),w}catch(w){try{throw await((h=(k=P(this,Ke).config).onError)==null?void 0:h.call(k,w,t,this.state.context,this)),await((g=(m=this.options).onError)==null?void 0:g.call(m,w,t,this.state.context)),await((C=(S=P(this,Ke).config).onSettled)==null?void 0:C.call(S,void 0,w,this.state.variables,this.state.context,this)),await((E=(_=this.options).onSettled)==null?void 0:E.call(_,void 0,w,t,this.state.context)),w}finally{Ie(this,Qt,xn).call(this,{type:"error",error:w})}}finally{P(this,Ke).runNext(this)}}},Gt=new WeakMap,Ke=new WeakMap,ir=new WeakMap,Qt=new WeakSet,xn=function(t){const n=r=>{switch(t.type){case"failed":return{...r,failureCount:t.failureCount,failureReason:t.error};case"pause":return{...r,isPaused:!0};case"continue":return{...r,isPaused:!1};case"pending":return{...r,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{...r,data:t.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...r,data:void 0,error:t.error,failureCount:r.failureCount+1,failureReason:t.error,isPaused:!1,status:"error"}}};this.state=n(this.state),qe.batch(()=>{P(this,Gt).forEach(r=>{r.onMutationUpdate(t)}),P(this,Ke).notify({mutation:this,type:"updated",action:t})})},Jp);function jv(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var at,Si,Zp,bv=(Zp=class extends il{constructor(t={}){super();J(this,at);J(this,Si);this.config=t,U(this,at,new Map),U(this,Si,Date.now())}build(t,n,r){const o=new Rv({mutationCache:this,mutationId:++Mi(this,Si)._,options:t.defaultMutationOptions(n),state:r});return this.add(o),o}add(t){const n=zi(t),r=P(this,at).get(n)??[];r.push(t),P(this,at).set(n,r),this.notify({type:"added",mutation:t})}remove(t){var r;const n=zi(t);if(P(this,at).has(n)){const o=(r=P(this,at).get(n))==null?void 0:r.filter(i=>i!==t);o&&(o.length===0?P(this,at).delete(n):P(this,at).set(n,o))}this.notify({type:"removed",mutation:t})}canRun(t){var r;const n=(r=P(this,at).get(zi(t)))==null?void 0:r.find(o=>o.state.status==="pending");return!n||n===t}runNext(t){var r;const n=(r=P(this,at).get(zi(t)))==null?void 0:r.find(o=>o!==t&&o.state.isPaused);return(n==null?void 0:n.continue())??Promise.resolve()}clear(){qe.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}getAll(){return[...P(this,at).values()].flat()}find(t){const n={exact:!0,...t};return this.getAll().find(r=>Dd(n,r))}findAll(t={}){return this.getAll().filter(n=>Dd(t,n))}notify(t){qe.batch(()=>{this.listeners.forEach(n=>{n(t)})})}resumePausedMutations(){const t=this.getAll().filter(n=>n.state.isPaused);return qe.batch(()=>Promise.all(t.map(n=>n.continue().catch(Mt))))}},at=new WeakMap,Si=new WeakMap,Zp);function zi(e){var t;return((t=e.options.scope)==null?void 0:t.id)??String(e.mutationId)}function Ov(e){return{onFetch:(t,n)=>{const r=async()=>{var x,v,k,h,m;const o=t.options,i=(k=(v=(x=t.fetchOptions)==null?void 0:x.meta)==null?void 0:v.fetchMore)==null?void 0:k.direction,s=((h=t.state.data)==null?void 0:h.pages)||[],l=((m=t.state.data)==null?void 0:m.pageParams)||[],a={pages:[],pageParams:[]};let u=!1;const c=g=>{Object.defineProperty(g,"signal",{enumerable:!0,get:()=>(t.signal.aborted?u=!0:t.signal.addEventListener("abort",()=>{u=!0}),t.signal)})},d=mh(t.options,t.fetchOptions),f=async(g,S,C)=>{if(u)return Promise.reject();if(S==null&&g.pages.length)return Promise.resolve(g);const _={queryKey:t.queryKey,pageParam:S,direction:C?"backward":"forward",meta:t.options.meta};c(_);const E=await d(_),{maxPages:w}=t.options,b=C?xv:gv;return{pages:b(g.pages,E,w),pageParams:b(g.pageParams,S,w)}};let y;if(i&&s.length){const g=i==="backward",S=g?Tv:Ud,C={pages:s,pageParams:l},_=S(o,C);y=await f(C,_,g)}else{y=await f(a,l[0]??o.initialPageParam);const g=e??s.length;for(let S=1;S{var o,i;return(i=(o=t.options).persister)==null?void 0:i.call(o,r,{queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n)}:t.fetchFn=r}}}function Ud(e,{pages:t,pageParams:n}){const r=t.length-1;return t.length>0?e.getNextPageParam(t[r],t,n[r],n):void 0}function Tv(e,{pages:t,pageParams:n}){var r;return t.length>0?(r=e.getPreviousPageParam)==null?void 0:r.call(e,t[0],t,n[0],n):void 0}var xe,$n,Rn,Yr,Xr,jn,Jr,Zr,eh,Mv=(eh=class{constructor(e={}){J(this,xe);J(this,$n);J(this,Rn);J(this,Yr);J(this,Xr);J(this,jn);J(this,Jr);J(this,Zr);U(this,xe,e.queryCache||new $v),U(this,$n,e.mutationCache||new bv),U(this,Rn,e.defaultOptions||{}),U(this,Yr,new Map),U(this,Xr,new Map),U(this,jn,0)}mount(){Mi(this,jn)._++,P(this,jn)===1&&(U(this,Jr,yh.subscribe(async e=>{e&&(await this.resumePausedMutations(),P(this,xe).onFocus())})),U(this,Zr,_s.subscribe(async e=>{e&&(await this.resumePausedMutations(),P(this,xe).onOnline())})))}unmount(){var e,t;Mi(this,jn)._--,P(this,jn)===0&&((e=P(this,Jr))==null||e.call(this),U(this,Jr,void 0),(t=P(this,Zr))==null||t.call(this),U(this,Zr,void 0))}isFetching(e){return P(this,xe).findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return P(this,$n).findAll({...e,status:"pending"}).length}getQueryData(e){var n;const t=this.defaultQueryOptions({queryKey:e});return(n=P(this,xe).get(t.queryHash))==null?void 0:n.state.data}ensureQueryData(e){const t=this.getQueryData(e.queryKey);if(t===void 0)return this.fetchQuery(e);{const n=this.defaultQueryOptions(e),r=P(this,xe).build(this,n);return e.revalidateIfStale&&r.isStaleByTime(Id(n.staleTime,r))&&this.prefetchQuery(n),Promise.resolve(t)}}getQueriesData(e){return P(this,xe).findAll(e).map(({queryKey:t,state:n})=>{const r=n.data;return[t,r]})}setQueryData(e,t,n){const r=this.defaultQueryOptions({queryKey:e}),o=P(this,xe).get(r.queryHash),i=o==null?void 0:o.state.data,s=fv(t,i);if(s!==void 0)return P(this,xe).build(this,r).setData(s,{...n,manual:!0})}setQueriesData(e,t,n){return qe.batch(()=>P(this,xe).findAll(e).map(({queryKey:r})=>[r,this.setQueryData(r,t,n)]))}getQueryState(e){var n;const t=this.defaultQueryOptions({queryKey:e});return(n=P(this,xe).get(t.queryHash))==null?void 0:n.state}removeQueries(e){const t=P(this,xe);qe.batch(()=>{t.findAll(e).forEach(n=>{t.remove(n)})})}resetQueries(e,t){const n=P(this,xe),r={type:"active",...e};return qe.batch(()=>(n.findAll(e).forEach(o=>{o.reset()}),this.refetchQueries(r,t)))}cancelQueries(e={},t={}){const n={revert:!0,...t},r=qe.batch(()=>P(this,xe).findAll(e).map(o=>o.cancel(n)));return Promise.all(r).then(Mt).catch(Mt)}invalidateQueries(e={},t={}){return qe.batch(()=>{if(P(this,xe).findAll(e).forEach(r=>{r.invalidate()}),e.refetchType==="none")return Promise.resolve();const n={...e,type:e.refetchType??e.type??"active"};return this.refetchQueries(n,t)})}refetchQueries(e={},t){const n={...t,cancelRefetch:(t==null?void 0:t.cancelRefetch)??!0},r=qe.batch(()=>P(this,xe).findAll(e).filter(o=>!o.isDisabled()).map(o=>{let i=o.fetch(void 0,n);return n.throwOnError||(i=i.catch(Mt)),o.state.fetchStatus==="paused"?Promise.resolve():i}));return Promise.all(r).then(Mt)}fetchQuery(e){const t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);const n=P(this,xe).build(this,t);return n.isStaleByTime(Id(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(Mt).catch(Mt)}fetchInfiniteQuery(e){return e.behavior=Ov(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(Mt).catch(Mt)}resumePausedMutations(){return _s.isOnline()?P(this,$n).resumePausedMutations():Promise.resolve()}getQueryCache(){return P(this,xe)}getMutationCache(){return P(this,$n)}getDefaultOptions(){return P(this,Rn)}setDefaultOptions(e){U(this,Rn,e)}setQueryDefaults(e,t){P(this,Yr).set(qo(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...P(this,Yr).values()];let n={};return t.forEach(r=>{Yo(e,r.queryKey)&&(n={...n,...r.defaultOptions})}),n}setMutationDefaults(e,t){P(this,Xr).set(qo(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...P(this,Xr).values()];let n={};return t.forEach(r=>{Yo(e,r.mutationKey)&&(n={...n,...r.defaultOptions})}),n}defaultQueryOptions(e){if(e._defaulted)return e;const t={...P(this,Rn).queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=fc(t.queryKey,t)),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!=="always"),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode="offlineFirst"),t.enabled!==!0&&t.queryFn===hh&&(t.enabled=!1),t}defaultMutationOptions(e){return e!=null&&e._defaulted?e:{...P(this,Rn).mutations,...(e==null?void 0:e.mutationKey)&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){P(this,xe).clear(),P(this,$n).clear()}},xe=new WeakMap,$n=new WeakMap,Rn=new WeakMap,Yr=new WeakMap,Xr=new WeakMap,jn=new WeakMap,Jr=new WeakMap,Zr=new WeakMap,eh),Lv=R.createContext(void 0),zv=({client:e,children:t})=>(R.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),p.jsx(Lv.Provider,{value:e,children:t}));const Wd="pushstate",Hd="popstate",wh="beforeunload",kh=e=>(e.preventDefault(),e.returnValue=""),Fv=()=>{removeEventListener(wh,kh,{capture:!0})};function Ch(e){let t=e.getLocation();const n=new Set;let r=[];const o=()=>{t=e.getLocation(),n.forEach(s=>s())},i=async(s,l)=>{var a;if(!((l==null?void 0:l.ignoreBlocker)??!1)&&typeof document<"u"&&r.length){for(const c of r)if(!await c()){(a=e.onBlocked)==null||a.call(e,o);return}}s()};return{get location(){return t},subscribers:n,subscribe:s=>(n.add(s),()=>{n.delete(s)}),push:(s,l,a)=>{l=Io(l),i(()=>{e.pushState(s,l),o()},a)},replace:(s,l,a)=>{l=Io(l),i(()=>{e.replaceState(s,l),o()},a)},go:(s,l)=>{i(()=>{e.go(s),o()},l)},back:s=>{i(()=>{e.back(),o()},s)},forward:s=>{i(()=>{e.forward(),o()},s)},createHref:s=>e.createHref(s),block:s=>(r.push(s),r.length===1&&addEventListener(wh,kh,{capture:!0}),()=>{r=r.filter(l=>l!==s),r.length||Fv()}),flush:()=>{var s;return(s=e.flush)==null?void 0:s.call(e)},destroy:()=>{var s;return(s=e.destroy)==null?void 0:s.call(e)},notify:o}}function Io(e){return e||(e={}),{...e,key:Eh()}}function Iv(e){const t=typeof document<"u"?window:void 0,n=t.history.pushState,r=t.history.replaceState,o=v=>v,i=()=>nu(`${t.location.pathname}${t.location.search}${t.location.hash}`,t.history.state);let s=i(),l;const a=()=>s;let u,c;const d=()=>{if(!u)return;(u.isPush?n:r).call(t.history,u.state,"",u.href),u=void 0,c=void 0,l=void 0},f=(v,k,h)=>{const m=o(k);c||(l=s),s=nu(k,h),u={href:m,state:h,isPush:(u==null?void 0:u.isPush)||v==="push"},c||(c=Promise.resolve().then(()=>d()))},y=()=>{s=i(),x.notify()},x=Ch({getLocation:a,pushState:(v,k)=>f("push",v,k),replaceState:(v,k)=>f("replace",v,k),back:()=>t.history.back(),forward:()=>t.history.forward(),go:v=>t.history.go(v),createHref:v=>o(v),flush:d,destroy:()=>{t.history.pushState=n,t.history.replaceState=r,t.removeEventListener(Wd,y),t.removeEventListener(Hd,y)},onBlocked:v=>{l&&s!==l&&(s=l,v())}});return t.addEventListener(Wd,y),t.addEventListener(Hd,y),t.history.pushState=function(...v){const k=n.apply(t.history,v);return y(),k},t.history.replaceState=function(...v){const k=r.apply(t.history,v);return y(),k},x}function Nv(e={initialEntries:["/"]}){const t=e.initialEntries;let n=e.initialIndex??t.length-1,r={key:Eh()};return Ch({getLocation:()=>nu(t[n],r),pushState:(i,s)=>{r=s,t.splice,n{r=s,t[n]=i},back:()=>{r=Io(r),n=Math.max(n-1,0)},forward:()=>{r=Io(r),n=Math.min(n+1,t.length-1)},go:i=>{r=Io(r),n=Math.min(Math.max(n+i,0),t.length-1)},createHref:i=>i})}function nu(e,t){const n=e.indexOf("#"),r=e.indexOf("?");return{href:e,pathname:e.substring(0,n>0?r>0?Math.min(n,r):n:r>0?r:e.length),hash:n>-1?e.substring(n):"",search:r>-1?e.slice(r,n===-1?void 0:n):"",state:t||{}}}function Eh(){return(Math.random()+1).toString(36).substring(7)}var Dv="Invariant failed";function Qe(e,t){if(!e)throw new Error(Dv)}const va=R.createContext(null);function _h(){return typeof document>"u"?va:window.__TSR_ROUTER_CONTEXT__?window.__TSR_ROUTER_CONTEXT__:(window.__TSR_ROUTER_CONTEXT__=va,va)}function yn(e){const t=R.useContext(_h());return e==null||e.warn,t}var Ph={exports:{}},$h={},Rh={exports:{}},jh={};/** + * @license React + * use-sync-external-store-shim.production.min.js + * + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */var eo=R;function Av(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var Bv=typeof Object.is=="function"?Object.is:Av,Uv=eo.useState,Wv=eo.useEffect,Hv=eo.useLayoutEffect,Vv=eo.useDebugValue;function Kv(e,t){var n=t(),r=Uv({inst:{value:n,getSnapshot:t}}),o=r[0].inst,i=r[1];return Hv(function(){o.value=n,o.getSnapshot=t,ga(o)&&i({inst:o})},[e,n,t]),Wv(function(){return ga(o)&&i({inst:o}),e(function(){ga(o)&&i({inst:o})})},[e]),Vv(n),n}function ga(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!Bv(e,n)}catch{return!0}}function Gv(e,t){return t()}var Qv=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?Gv:Kv;jh.useSyncExternalStore=eo.useSyncExternalStore!==void 0?eo.useSyncExternalStore:Qv;Rh.exports=jh;var qv=Rh.exports;/** + * @license React + * use-sync-external-store-shim/with-selector.production.min.js + * + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */var ll=R,Yv=qv;function Xv(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var Jv=typeof Object.is=="function"?Object.is:Xv,Zv=Yv.useSyncExternalStore,eg=ll.useRef,tg=ll.useEffect,ng=ll.useMemo,rg=ll.useDebugValue;$h.useSyncExternalStoreWithSelector=function(e,t,n,r,o){var i=eg(null);if(i.current===null){var s={hasValue:!1,value:null};i.current=s}else s=i.current;i=ng(function(){function a(y){if(!u){if(u=!0,c=y,y=r(y),o!==void 0&&s.hasValue){var x=s.value;if(o(x,y))return d=x}return d=y}if(x=d,Jv(c,y))return x;var v=r(y);return o!==void 0&&o(x,v)?x:(c=y,d=v)}var u=!1,c,d,f=n===void 0?null:n;return[function(){return a(t())},f===null?void 0:function(){return a(f())}]},[t,n,r,o]);var l=Zv(e,i[0],i[1]);return tg(function(){s.hasValue=!0,s.value=l},[l]),rg(l),l};Ph.exports=$h;var og=Ph.exports;class ig{constructor(t,n){this.listeners=new Set,this._batching=!1,this._flushing=0,this.subscribe=r=>{var o,i;this.listeners.add(r);const s=(i=(o=this.options)==null?void 0:o.onSubscribe)==null?void 0:i.call(o,r,this);return()=>{this.listeners.delete(r),s==null||s()}},this.setState=r=>{var o,i,s;const l=this.state;this.state=(o=this.options)!=null&&o.updateFn?this.options.updateFn(l)(r):r(l),(s=(i=this.options)==null?void 0:i.onUpdate)==null||s.call(i),this._flush()},this._flush=()=>{if(this._batching)return;const r=++this._flushing;this.listeners.forEach(o=>{this._flushing===r&&o()})},this.batch=r=>{if(this._batching)return r();this._batching=!0,r(),this._batching=!1,this._flush()},this.state=t,this.options=n}}function sg(e,t=n=>n){return og.useSyncExternalStoreWithSelector(e.subscribe,()=>e.state,()=>e.state,t,lg)}function lg(e,t){if(Object.is(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;const n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(let r=0;r{t.substring(0,1)==="?"&&(t=t.substring(1));const n=ug(t);for(const r in n){const o=n[r];if(typeof o=="string")try{n[r]=e(o)}catch{}}return n}}function pg(e,t){function n(r){if(typeof r=="object"&&r!==null)try{return e(r)}catch{}else if(typeof r=="string"&&typeof t=="function")try{return t(r),e(r)}catch{}return r}return r=>{r={...r},Object.keys(r).forEach(i=>{const s=r[i];typeof s>"u"||s===void 0?delete r[i]:r[i]=n(s)});const o=ag(r).toString();return o?`?${o}`:""}}function Ps(e){return e[e.length-1]}function hg(e){return typeof e=="function"}function kr(e,t){return hg(e)?e(t):e}function No(e,t){return t.reduce((n,r)=>(n[r]=e[r],n),{})}function Wt(e,t){if(e===t)return e;const n=t,r=Gd(e)&&Gd(n);if(r||$s(e)&&$s(n)){const o=r?e:Object.keys(e),i=o.length,s=r?n:Object.keys(n),l=s.length,a=r?[]:{};let u=0;for(let c=0;c"u")return!0;const n=t.prototype;return!(!Kd(n)||!n.hasOwnProperty("isPrototypeOf"))}function Kd(e){return Object.prototype.toString.call(e)==="[object Object]"}function Gd(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function Fr(e,t,n=!1){if(e===t)return!0;if(typeof e!=typeof t)return!1;if($s(e)&&$s(t)){const r=Object.keys(e).filter(i=>e[i]!==void 0),o=Object.keys(t).filter(i=>t[i]!==void 0);return!n&&r.length!==o.length?!1:!o.some(i=>!(i in e)||!Fr(e[i],t[i],n))}return Array.isArray(e)&&Array.isArray(t)?e.length!==t.length?!1:!e.some((r,o)=>!Fr(r,t[o],n)):!1}const xa=typeof window<"u"?R.useLayoutEffect:R.useEffect;function wr(e){let t,n;const r=new Promise((o,i)=>{t=o,n=i});return r.status="pending",r.resolve=o=>{r.status="resolved",r.value=o,t(o),e==null||e(o)},r.reject=o=>{r.status="rejected",n(o)},r}function Qd(e){const t=R.useRef({value:e,prev:null}),n=t.current.value;return e!==n&&(t.current={value:e,prev:n}),t.current.prev}function Tn(e){return al(e.filter(Boolean).join("/"))}function al(e){return e.replace(/\/{2,}/g,"/")}function pc(e){return e==="/"?e:e.replace(/^\/{1,}/,"")}function Xn(e){return e==="/"?e:e.replace(/\/{1,}$/,"")}function ru(e){return Xn(pc(e))}function Rs(e,t){return e.endsWith("/")&&e!=="/"&&e!==`${t}/`?e.slice(0,-1):e}function mg(e,t,n){return Rs(e,n)===Rs(t,n)}function yg({basepath:e,base:t,to:n,trailingSlash:r="never"}){var o,i;t=t.replace(new RegExp(`^${e}`),"/"),n=n.replace(new RegExp(`^${e}`),"/");let s=to(t);const l=to(n);s.length>1&&((o=Ps(s))==null?void 0:o.value)==="/"&&s.pop(),l.forEach((u,c)=>{u.value==="/"?c?c===l.length-1&&s.push(u):s=[u]:u.value===".."?s.pop():u.value==="."||s.push(u)}),s.length>1&&(((i=Ps(s))==null?void 0:i.value)==="/"?r==="never"&&s.pop():r==="always"&&s.push({type:"pathname",value:"/"}));const a=Tn([e,...s.map(u=>u.value)]);return al(a)}function to(e){if(!e)return[];e=al(e);const t=[];if(e.slice(0,1)==="/"&&(e=e.substring(1),t.push({type:"pathname",value:"/"})),!e)return t;const n=e.split("/").filter(Boolean);return t.push(...n.map(r=>r==="$"||r==="*"?{type:"wildcard",value:r}:r.charAt(0)==="$"?{type:"param",value:r}:{type:"pathname",value:decodeURIComponent(r)})),e.slice(-1)==="/"&&(e=e.substring(1),t.push({type:"pathname",value:"/"})),t}function Sa({path:e,params:t,leaveWildcards:n,leaveParams:r}){const o=to(e),i={};for(const[s,l]of Object.entries(t)){const a=typeof l=="string";["*","_splat"].includes(s)?i[s]=a?encodeURI(l):l:i[s]=a?encodeURIComponent(l):l}return Tn(o.map(s=>{if(s.type==="wildcard"){const l=i._splat;return n?`${s.value}${l??""}`:l}if(s.type==="param"){if(r){const l=i[s.value];return`${s.value}${l??""}`}return i[s.value.substring(1)]??"undefined"}return s.value}))}function Fi(e,t,n){const r=vg(e,t,n);if(!(n.to&&!r))return r??{}}function qd(e,t){switch(!0){case e==="/":return t;case t===e:return"";case t.length{for(let a=0;a=o.length-1,f=a>=i.length-1;if(c){if(c.type==="wildcard"){if(u!=null&&u.value){const y=decodeURI(Tn(o.slice(a).map(x=>x.value)));return s["*"]=y,s._splat=y,!0}return!1}if(c.type==="pathname"){if(c.value==="/"&&!(u!=null&&u.value))return!0;if(u){if(n.caseSensitive){if(c.value!==u.value)return!1}else if(c.value.toLowerCase()!==u.value.toLowerCase())return!1}}if(!u)return!1;if(c.type==="param"){if(u.value==="/")return!1;u.value.charAt(0)!=="$"&&(s[c.value.substring(1)]=decodeURIComponent(u.value))}}if(!d&&f)return s["**"]=Tn(o.slice(a+1).map(y=>y.value)),!!n.fuzzy&&(c==null?void 0:c.value)!=="/"}return!0})()?s:void 0}function Gn(e){return!!(e!=null&&e.isRedirect)}function Yd(e){return!!(e!=null&&e.isRedirect)&&e.href}function hc(e){const t=e.errorComponent??ul;return p.jsx(gg,{getResetKey:e.getResetKey,onCatch:e.onCatch,children:({error:n,reset:r})=>n?R.createElement(t,{error:n,reset:r}):e.children})}class gg extends R.Component{constructor(){super(...arguments),this.state={error:null}}static getDerivedStateFromProps(t){return{resetKey:t.getResetKey()}}static getDerivedStateFromError(t){return{error:t}}reset(){this.setState({error:null})}componentDidUpdate(t,n){n.error&&n.resetKey!==this.state.resetKey&&this.reset()}componentDidCatch(t,n){this.props.onCatch&&this.props.onCatch(t,n)}render(){return this.props.children({error:this.state.resetKey!==this.props.getResetKey()?null:this.state.error,reset:()=>{this.reset()}})}}function ul({error:e}){const[t,n]=R.useState(!1);return p.jsxs("div",{style:{padding:".5rem",maxWidth:"100%"},children:[p.jsxs("div",{style:{display:"flex",alignItems:"center",gap:".5rem"},children:[p.jsx("strong",{style:{fontSize:"1rem"},children:"Something went wrong!"}),p.jsx("button",{style:{appearance:"none",fontSize:".6em",border:"1px solid currentColor",padding:".1rem .2rem",fontWeight:"bold",borderRadius:".25rem"},onClick:()=>n(r=>!r),children:t?"Hide Error":"Show Error"})]}),p.jsx("div",{style:{height:".25rem"}}),t?p.jsx("div",{children:p.jsx("pre",{style:{fontSize:".7em",border:"1px solid red",borderRadius:".25rem",padding:".3rem",color:"red",overflow:"auto"},children:e.message?p.jsx("code",{children:e.message}):null})}):null]})}function Le(e){const t=yn({warn:(e==null?void 0:e.router)===void 0});return sg(((e==null?void 0:e.router)||t).__store,e==null?void 0:e.select)}function Vt(e){return!!(e!=null&&e.isNotFound)}function xg(e){const t=Le({select:n=>`not-found-${n.location.pathname}-${n.status}`});return p.jsx(hc,{getResetKey:()=>t,onCatch:(n,r)=>{var o;if(Vt(n))(o=e.onCatch)==null||o.call(e,n,r);else throw n},errorComponent:({error:n})=>{var r;return(r=e.fallback)==null?void 0:r.call(e,n)},children:e.children})}function Sg(){return p.jsx("p",{children:"Not Found"})}const wg=["component","errorComponent","pendingComponent","notFoundComponent"];function kg(e){return new Cg(e)}class Cg{constructor(t){this.tempLocationKey=`${Math.round(Math.random()*1e7)}`,this.resetNextScroll=!0,this.shouldViewTransition=void 0,this.subscribers=new Set,this.startReactTransition=n=>n(),this.update=n=>{n.notFoundRoute&&console.warn("The notFoundRoute API is deprecated and will be removed in the next major version. See https://tanstack.com/router/v1/docs/guide/not-found-errors#migrating-from-notfoundroute for more info.");const r=this.options;this.options={...this.options,...n},this.isServer=this.options.isServer??typeof document>"u",(!this.basepath||n.basepath&&n.basepath!==r.basepath)&&(n.basepath===void 0||n.basepath===""||n.basepath==="/"?this.basepath="/":this.basepath=`/${ru(n.basepath)}`),(!this.history||this.options.history&&this.options.history!==this.history)&&(this.history=this.options.history??(this.isServer?Nv({initialEntries:[this.basepath||"/"]}):Iv()),this.latestLocation=this.parseLocation()),this.options.routeTree!==this.routeTree&&(this.routeTree=this.options.routeTree,this.buildRouteTree()),this.__store||(this.__store=new ig(Pg(this.latestLocation),{onUpdate:()=>{this.__store.state={...this.state,cachedMatches:this.state.cachedMatches.filter(o=>!["redirected"].includes(o.status))}}}))},this.buildRouteTree=()=>{this.routesById={},this.routesByPath={};const n=this.options.notFoundRoute;n&&(n.init({originalIndex:99999999999}),this.routesById[n.id]=n);const r=s=>{s.forEach((l,a)=>{l.init({originalIndex:a});const u=this.routesById[l.id];if(Qe(!u,`Duplicate routes found with id: ${String(l.id)}`),this.routesById[l.id]=l,!l.isRoot&&l.path){const d=Xn(l.fullPath);(!this.routesByPath[d]||l.fullPath.endsWith("/"))&&(this.routesByPath[d]=l)}const c=l.children;c!=null&&c.length&&r(c)})};r([this.routeTree]);const o=[];Object.values(this.routesById).forEach((s,l)=>{var a;if(s.isRoot||!s.path)return;const u=pc(s.fullPath),c=to(u);for(;c.length>1&&((a=c[0])==null?void 0:a.value)==="/";)c.shift();const d=c.map(f=>f.value==="/"?.75:f.type==="param"?.5:f.type==="wildcard"?.25:1);o.push({child:s,trimmed:u,parsed:c,index:l,scores:d})}),this.flatRoutes=o.sort((s,l)=>{const a=Math.min(s.scores.length,l.scores.length);for(let u=0;ul.parsed[u].value?1:-1;return s.index-l.index}).map((s,l)=>(s.child.rank=l,s.child))},this.subscribe=(n,r)=>{const o={eventType:n,fn:r};return this.subscribers.add(o),()=>{this.subscribers.delete(o)}},this.emit=n=>{this.subscribers.forEach(r=>{r.eventType===n.type&&r.fn(n)})},this.parseLocation=n=>{const r=({pathname:l,search:a,hash:u,state:c})=>{const d=this.options.parseSearch(a),f=this.options.stringifySearch(d);return{pathname:l,searchStr:f,search:Wt(n==null?void 0:n.search,d),hash:u.split("#").reverse()[0]??"",href:`${l}${f}${u}`,state:Wt(n==null?void 0:n.state,c)}},o=r(this.history.location),{__tempLocation:i,__tempKey:s}=o.state;if(i&&(!s||s===this.tempLocationKey)){const l=r(i);return l.state.key=o.state.key,delete l.state.__tempLocation,{...l,maskedLocation:o}}return o},this.resolvePathWithBase=(n,r)=>yg({basepath:this.basepath,base:n,to:al(r),trailingSlash:this.options.trailingSlash}),this.matchRoutes=(n,r,o)=>{let i={};const s=this.flatRoutes.find(y=>{const x=Fi(this.basepath,Xn(n),{to:y.fullPath,caseSensitive:y.options.caseSensitive??this.options.caseSensitive,fuzzy:!0});return x?(i=x,!0):!1});let l=s||this.routesById[Ue];const a=[l];let u=!1;for((s?s.path!=="/"&&i["**"]:Xn(n))&&(this.options.notFoundRoute?a.push(this.options.notFoundRoute):u=!0);l.parentRoute;)l=l.parentRoute,a.unshift(l);const c=(()=>{if(u){if(this.options.notFoundMode!=="root")for(let y=a.length-1;y>=0;y--){const x=a[y];if(x.children)return x.id}return Ue}})(),d=a.map(y=>{var x;let v;const k=((x=y.options.params)==null?void 0:x.parse)??y.options.parseParams;if(k)try{const h=k(i);Object.assign(i,h)}catch(h){if(v=new _g(h.message,{cause:h}),o!=null&&o.throwOnError)throw v;return v}}),f=[];return a.forEach((y,x)=>{var v,k,h,m,g,S,C,_,E,w;const b=f[x-1],[O,z]=(()=>{const T=(b==null?void 0:b.search)??r;try{const L=typeof y.options.validateSearch=="object"?y.options.validateSearch.parse:y.options.validateSearch,A=(L==null?void 0:L(T))??{};return[{...T,...A},void 0]}catch(L){const A=new Eg(L.message,{cause:L});if(o!=null&&o.throwOnError)throw A;return[T,A]}})(),F=((k=(v=y.options).loaderDeps)==null?void 0:k.call(v,{search:O}))??"",I=F?JSON.stringify(F):"",W=Sa({path:y.fullPath,params:i}),G=Sa({path:y.id,params:i,leaveWildcards:!0})+I,N=this.getMatch(G),re=this.state.matches.find(T=>T.id===G)?"stay":"enter";let $;if(N)$={...N,cause:re,params:i};else{const T=y.options.loader||y.options.beforeLoad||y.lazyFn?"pending":"success";$={id:G,index:x,routeId:y.id,params:i,pathname:Tn([this.basepath,W]),updatedAt:Date.now(),search:{},searchError:void 0,status:T,isFetching:!1,error:void 0,paramsError:d[x],routeContext:void 0,context:void 0,abortController:new AbortController,fetchCount:0,cause:re,loaderDeps:F,invalid:!1,preload:!1,links:(m=(h=y.options).links)==null?void 0:m.call(h),scripts:(S=(g=y.options).scripts)==null?void 0:S.call(g),staticData:y.options.staticData||{},loadPromise:wr()}}$.status==="success"&&($.meta=(_=(C=y.options).meta)==null?void 0:_.call(C,{matches:f,match:$,params:$.params,loaderData:$.loaderData}),$.headers=(w=(E=y.options).headers)==null?void 0:w.call(E,{loaderData:$.loaderData})),o!=null&&o.preload||($.globalNotFound=c===y.id),$.search=Wt($.search,O),$.searchError=z,f.push($)}),f},this.cancelMatch=n=>{const r=this.getMatch(n);r&&(r.abortController.abort(),clearTimeout(r.pendingTimeout))},this.cancelMatches=()=>{var n;(n=this.state.pendingMatches)==null||n.forEach(r=>{this.cancelMatch(r.id)})},this.buildLocation=n=>{const r=(i={},s)=>{var l,a,u;const c=i._fromLocation!=null?this.matchRoutes(i._fromLocation.pathname,i.fromSearch||i._fromLocation.search):this.state.matches,d=i.from!=null?c.find(I=>Fi(this.basepath,Xn(I.pathname),{to:i.from,caseSensitive:!1,fuzzy:!1})):void 0,f=(d==null?void 0:d.pathname)||this.latestLocation.pathname;Qe(i.from==null||d!=null,"Could not find match for from: "+i.from);const y=((l=Ps(c))==null?void 0:l.search)||this.latestLocation.search,x=s==null?void 0:s.filter(I=>c.find(W=>W.routeId===I.routeId)),v=this.routesById[(a=x==null?void 0:x.find(I=>I.pathname===f))==null?void 0:a.routeId];let k=i.to?this.resolvePathWithBase(f,`${i.to}`):this.resolvePathWithBase(f,(v==null?void 0:v.to)??f);const h={...(u=Ps(c))==null?void 0:u.params};let m=(i.params??!0)===!0?h:{...h,...kr(i.params,h)};Object.keys(m).length>0&&(s==null||s.map(I=>{var W;const G=this.looseRoutesById[I.routeId];return((W=G==null?void 0:G.options.params)==null?void 0:W.stringify)??G.options.stringifyParams}).filter(Boolean).forEach(I=>{m={...m,...I(m)}})),k=Sa({path:k,params:m??{},leaveWildcards:!1,leaveParams:n.leaveParams});const g=(x==null?void 0:x.map(I=>this.looseRoutesById[I.routeId].options.preSearchFilters??[]).flat().filter(Boolean))??[],S=(x==null?void 0:x.map(I=>this.looseRoutesById[I.routeId].options.postSearchFilters??[]).flat().filter(Boolean))??[],C=g.length?g.reduce((I,W)=>W(I),y):y,_=i.search===!0?C:i.search?kr(i.search,C):g.length?C:{},E=S.length?S.reduce((I,W)=>W(I),_):_,w=Wt(y,E),b=this.options.stringifySearch(w),O=i.hash===!0?this.latestLocation.hash:i.hash?kr(i.hash,this.latestLocation.hash):void 0,z=O?`#${O}`:"";let F=i.state===!0?this.latestLocation.state:i.state?kr(i.state,this.latestLocation.state):{};return F=Wt(this.latestLocation.state,F),{pathname:k,search:w,searchStr:b,state:F,hash:O??"",href:`${k}${b}${z}`,unmaskOnReload:i.unmaskOnReload}},o=(i={},s)=>{var l;const a=r(i);let u=s?r(s):void 0;if(!u){let x={};const v=(l=this.options.routeMasks)==null?void 0:l.find(k=>{const h=Fi(this.basepath,a.pathname,{to:k.from,caseSensitive:!1,fuzzy:!1});return h?(x=h,!0):!1});if(v){const{from:k,...h}=v;s={...No(n,["from"]),...h,params:x},u=r(s)}}const c=this.matchRoutes(a.pathname,a.search),d=u?this.matchRoutes(u.pathname,u.search):void 0,f=u?r(s,d):void 0,y=r(i,c);return f&&(y.maskedLocation=f),y};return n.mask?o(n,{...No(n,["from"]),...n.mask}):o(n)},this.commitLocation=({viewTransition:n,ignoreBlocker:r,...o})=>{const i=()=>{o.state.key=this.latestLocation.state.key;const a=Fr(o.state,this.latestLocation.state);return delete o.state.key,a},s=this.latestLocation.href===o.href,l=this.commitLocationPromise;if(this.commitLocationPromise=wr(()=>{l==null||l.resolve()}),s&&i())this.load();else{let{maskedLocation:a,...u}=o;a&&(u={...a,state:{...a.state,__tempKey:void 0,__tempLocation:{...u,search:u.searchStr,state:{...u.state,__tempKey:void 0,__tempLocation:void 0,key:void 0}}}},(u.unmaskOnReload??this.options.unmaskOnReload??!1)&&(u.state.__tempKey=this.tempLocationKey)),this.shouldViewTransition=n,this.history[o.replace?"replace":"push"](u.href,u.state,{ignoreBlocker:r})}return this.resetNextScroll=o.resetScroll??!0,this.history.subscribers.size||this.load(),this.commitLocationPromise},this.buildAndCommitLocation=({replace:n,resetScroll:r,viewTransition:o,ignoreBlocker:i,...s}={})=>{const l=this.buildLocation(s);return this.commitLocation({...l,viewTransition:o,replace:n,resetScroll:r,ignoreBlocker:i})},this.navigate=({from:n,to:r,__isRedirect:o,...i})=>{const s=String(r);let l;try{new URL(`${s}`),l=!0}catch{}return Qe(!l),this.buildAndCommitLocation({...i,from:n,to:r})},this.load=async()=>{this.latestLocation=this.parseLocation(this.latestLocation),this.__store.setState(i=>({...i,loadedAt:Date.now()}));let n,r;const o=new Promise(i=>{this.startReactTransition(async()=>{var s;try{const l=this.latestLocation,a=this.state.resolvedLocation,u=a.href!==l.href;this.cancelMatches();let c;this.__store.batch(()=>{c=this.matchRoutes(l.pathname,l.search),this.__store.setState(d=>({...d,status:"pending",isLoading:!0,location:l,pendingMatches:c,cachedMatches:d.cachedMatches.filter(f=>!c.find(y=>y.id===f.id))}))}),this.state.redirect||this.emit({type:"onBeforeNavigate",fromLocation:a,toLocation:l,pathChanged:u}),this.emit({type:"onBeforeLoad",fromLocation:a,toLocation:l,pathChanged:u}),await this.loadMatches({matches:c,location:l,onReady:async()=>{this.startViewTransition(async()=>{let d,f,y;this.__store.batch(()=>{this.__store.setState(x=>{const v=x.matches,k=x.pendingMatches||x.matches;return d=v.filter(h=>!k.find(m=>m.id===h.id)),f=k.filter(h=>!v.find(m=>m.id===h.id)),y=v.filter(h=>k.find(m=>m.id===h.id)),{...x,isLoading:!1,matches:k,pendingMatches:void 0,cachedMatches:[...x.cachedMatches,...d.filter(h=>h.status!=="error")]}}),this.cleanCache()}),[[d,"onLeave"],[f,"onEnter"],[y,"onStay"]].forEach(([x,v])=>{x.forEach(k=>{var h,m;(m=(h=this.looseRoutesById[k.routeId].options)[v])==null||m.call(h,k)})})})}})}catch(l){Yd(l)?(n=l,this.isServer||this.navigate({...l,replace:!0,__isRedirect:!0})):Vt(l)&&(r=l),this.__store.setState(a=>({...a,statusCode:n?n.statusCode:r?404:a.matches.some(u=>u.status==="error")?500:200,redirect:n}))}this.latestLoadPromise===o&&((s=this.commitLocationPromise)==null||s.resolve(),this.latestLoadPromise=void 0,this.commitLocationPromise=void 0),i()})});for(this.latestLoadPromise=o,await o;this.latestLoadPromise&&o!==this.latestLoadPromise;)await this.latestLoadPromise},this.startViewTransition=n=>{var r,o;const i=this.shouldViewTransition??this.options.defaultViewTransition;delete this.shouldViewTransition,(o=(r=i&&typeof document<"u"?document:void 0)==null?void 0:r.startViewTransition)!=null&&o.call(r,n)||n()},this.updateMatch=(n,r)=>{var o;let i;const s=(o=this.state.pendingMatches)==null?void 0:o.find(u=>u.id===n),l=this.state.matches.find(u=>u.id===n),a=s?"pendingMatches":l?"matches":"cachedMatches";return this.__store.setState(u=>{var c;return{...u,[a]:(c=u[a])==null?void 0:c.map(d=>d.id===n?i=r(d):d)}}),i},this.getMatch=n=>[...this.state.cachedMatches,...this.state.pendingMatches??[],...this.state.matches].find(r=>r.id===n),this.loadMatches=async({location:n,matches:r,preload:o,onReady:i,updateMatch:s=this.updateMatch})=>{let l,a=!1;const u=async()=>{a||(a=!0,await(i==null?void 0:i()))};!this.isServer&&!this.state.matches.length&&u();const c=(d,f)=>{var y,x,v;if(Yd(f))throw f;if(Gn(f)||Vt(f)){if(s(d.id,k=>({...k,status:Gn(f)?"redirected":Vt(f)?"notFound":"error",isFetching:!1,error:f,beforeLoadPromise:void 0,loaderPromise:void 0})),f.routeId||(f.routeId=d.routeId),(y=d.beforeLoadPromise)==null||y.resolve(),(x=d.loaderPromise)==null||x.resolve(),(v=d.loadPromise)==null||v.resolve(),Gn(f))throw a=!0,f=this.resolveRedirect({...f,_fromLocation:n}),f;if(Vt(f))throw this._handleNotFound(r,f,{updateMatch:s}),f}};try{await new Promise((d,f)=>{(async()=>{var y,x,v;try{const k=(g,S,C)=>{var _,E;const{id:w,routeId:b}=r[g],O=this.looseRoutesById[b];if(S instanceof Promise)throw S;S.routerCode=C,l=l??g,c(this.getMatch(w),S);try{(E=(_=O.options).onError)==null||E.call(_,S)}catch(z){S=z,c(this.getMatch(w),S)}s(w,z=>{var F;return(F=z.beforeLoadPromise)==null||F.resolve(),{...z,error:S,status:"error",isFetching:!1,updatedAt:Date.now(),abortController:new AbortController,beforeLoadPromise:void 0}})};for(const[g,{id:S,routeId:C}]of r.entries()){const _=this.getMatch(S);if(_.beforeLoadPromise||_.loaderPromise)await _.beforeLoadPromise;else{try{s(S,Q=>({...Q,loadPromise:wr(()=>{var oe;(oe=Q.loadPromise)==null||oe.resolve()}),beforeLoadPromise:wr()}));const E=this.looseRoutesById[C],w=new AbortController,b=(y=r[g-1])==null?void 0:y.id,O=()=>b?this.getMatch(b).context??this.options.context??{}:this.options.context??{},z=E.options.pendingMs??this.options.defaultPendingMs,F=!!(i&&!this.isServer&&!o&&(E.options.loader||E.options.beforeLoad)&&typeof z=="number"&&z!==1/0&&(E.options.pendingComponent??this.options.defaultPendingComponent));let I;F&&(I=setTimeout(()=>{try{u()}catch{}},z));const{paramsError:W,searchError:G}=this.getMatch(S);W&&k(g,W,"PARSE_PARAMS"),G&&k(g,G,"VALIDATE_SEARCH");const N=O();s(S,Q=>({...Q,isFetching:"beforeLoad",fetchCount:Q.fetchCount+1,routeContext:Wt(Q.routeContext,N),context:Wt(Q.context,N),abortController:w,pendingTimeout:I}));const{search:re,params:$,routeContext:T,cause:L}=this.getMatch(S),A={search:re,abortController:w,params:$,preload:!!o,context:T,location:n,navigate:Q=>this.navigate({...Q,_fromLocation:n}),buildLocation:this.buildLocation,cause:o?"preload":L},V=await((v=(x=E.options).beforeLoad)==null?void 0:v.call(x,A))??{};(Gn(V)||Vt(V))&&k(g,V,"BEFORE_LOAD"),s(S,Q=>{const oe={...Q.routeContext,...V};return{...Q,routeContext:Wt(Q.routeContext,oe),context:Wt(Q.context,oe),abortController:w}})}catch(E){k(g,E,"BEFORE_LOAD")}s(S,E=>{var w;return(w=E.beforeLoadPromise)==null||w.resolve(),{...E,beforeLoadPromise:void 0,isFetching:!1}})}}const h=r.slice(0,l),m=[];h.forEach(({id:g,routeId:S},C)=>{m.push((async()=>{const{loaderPromise:_}=this.getMatch(g);if(_)await _;else{const E=m[C-1],w=this.looseRoutesById[S],b=()=>{const{params:T,loaderDeps:L,abortController:A,context:V,cause:Q}=this.getMatch(g);return{params:T,deps:L,preload:!!o,parentMatchPromise:E,abortController:A,context:V,location:n,navigate:oe=>this.navigate({...oe,_fromLocation:n}),cause:o?"preload":Q,route:w}},O=Date.now()-this.getMatch(g).updatedAt,z=o?w.options.preloadStaleTime??this.options.defaultPreloadStaleTime??3e4:w.options.staleTime??this.options.defaultStaleTime??0,F=w.options.shouldReload,I=typeof F=="function"?F(b()):F;s(g,T=>({...T,loaderPromise:wr(),preload:!!o&&!this.state.matches.find(L=>L.id===g)}));const W=async()=>{var T,L,A,V,Q,oe,lt,Ee;try{const Ve=async()=>{const Ze=this.getMatch(g);Ze.minPendingPromise&&await Ze.minPendingPromise};try{w._lazyPromise=w._lazyPromise||(w.lazyFn?w.lazyFn().then(ie=>{Object.assign(w.options,ie.options)}):Promise.resolve());const Ze=this.getMatch(g).componentsPromise||w._lazyPromise.then(()=>Promise.all(wg.map(async ie=>{const nn=w.options[ie];nn!=null&&nn.preload&&await nn.preload()})));s(g,ie=>({...ie,isFetching:"loader",componentsPromise:Ze})),await w._lazyPromise;let me=await((L=(T=w.options).loader)==null?void 0:L.call(T,b()));this.serializeLoaderData&&(me=this.serializeLoaderData(me,{router:this,match:this.getMatch(g)})),c(this.getMatch(g),me),await Ve();const Ot=(V=(A=w.options).meta)==null?void 0:V.call(A,{matches:r,match:this.getMatch(g),params:this.getMatch(g).params,loaderData:me}),ye=(oe=(Q=w.options).headers)==null?void 0:oe.call(Q,{loaderData:me});s(g,ie=>({...ie,error:void 0,status:"success",isFetching:!1,updatedAt:Date.now(),loaderData:me,meta:Ot,headers:ye}))}catch(Ze){let me=Ze;await Ve(),c(this.getMatch(g),Ze);try{(Ee=(lt=w.options).onError)==null||Ee.call(lt,Ze)}catch(Ot){me=Ot,c(this.getMatch(g),Ot)}s(g,Ot=>({...Ot,error:me,status:"error",isFetching:!1}))}await this.getMatch(g).componentsPromise}catch(Ve){c(this.getMatch(g),Ve)}},{status:G,invalid:N}=this.getMatch(g);G==="success"&&(N||(I??O>z))?(async()=>{try{await W()}catch{}})():G!=="success"&&await W();const{loaderPromise:re,loadPromise:$}=this.getMatch(g);re==null||re.resolve(),$==null||$.resolve()}s(g,E=>({...E,isFetching:!1,loaderPromise:void 0}))})())}),await Promise.all(m),d()}catch(k){f(k)}})()}),await u()}catch(d){if(Gn(d)||Vt(d))throw Vt(d)&&!o&&await u(),d}return r},this.invalidate=()=>{const n=r=>({...r,invalid:!0,...r.status==="error"?{status:"pending",error:void 0}:{}});return this.__store.setState(r=>{var o;return{...r,matches:r.matches.map(n),cachedMatches:r.cachedMatches.map(n),pendingMatches:(o=r.pendingMatches)==null?void 0:o.map(n)}}),this.load()},this.resolveRedirect=n=>{const r=n;return r.href||(r.href=this.buildLocation(r).href),r},this.cleanCache=()=>{this.__store.setState(n=>({...n,cachedMatches:n.cachedMatches.filter(r=>{const o=this.looseRoutesById[r.routeId];if(!o.options.loader)return!1;const i=(r.preload?o.options.preloadGcTime??this.options.defaultPreloadGcTime:o.options.gcTime??this.options.defaultGcTime)??5*60*1e3;return r.status!=="error"&&Date.now()-r.updatedAt{const r=this.buildLocation(n);let o=this.matchRoutes(r.pathname,r.search,{throwOnError:!0,preload:!0});const i=Object.fromEntries([...this.state.matches,...this.state.pendingMatches??[],...this.state.cachedMatches].map(l=>[l.id,!0]));this.__store.batch(()=>{o.forEach(l=>{i[l.id]||this.__store.setState(a=>({...a,cachedMatches:[...a.cachedMatches,l]}))})});const s=new Set([...this.state.matches,...this.state.pendingMatches??[]].map(l=>l.id));try{return o=await this.loadMatches({matches:o,location:r,preload:!0,updateMatch:(l,a)=>{s.has(l)?o=o.map(u=>u.id===l?a(u):u):this.updateMatch(l,a)}}),o}catch(l){if(Gn(l))return await this.preloadRoute({...l,_fromLocation:r});console.error(l);return}},this.matchRoute=(n,r)=>{const o={...n,to:n.to?this.resolvePathWithBase(n.from||"",n.to):void 0,params:n.params||{},leaveParams:!0},i=this.buildLocation(o);if(r!=null&&r.pending&&this.state.status!=="pending")return!1;const l=((r==null?void 0:r.pending)===void 0?!this.state.isLoading:r.pending)?this.latestLocation:this.state.resolvedLocation,a=Fi(this.basepath,l.pathname,{...r,to:i.pathname});return!a||n.params&&!Fr(a,n.params,!0)?!1:a&&((r==null?void 0:r.includeSearch)??!0)?Fr(l.search,i.search,!0)?a:!1:a},this.dehydrate=()=>{var n;const r=((n=this.options.errorSerializer)==null?void 0:n.serialize)??$g;return{state:{dehydratedMatches:this.state.matches.map(o=>({...No(o,["id","status","updatedAt"]),error:o.error?{data:r(o.error),__isServerError:!0}:void 0}))},manifest:this.manifest}},this.hydrate=()=>{var n,r,o;let i;typeof document<"u"&&(i=this.options.transformer.parse((n=window.__TSR__)==null?void 0:n.dehydrated)),Qe(i),this.dehydratedData=i.payload,(o=(r=this.options).hydrate)==null||o.call(r,i.payload);const s=i.router.state,l=this.matchRoutes(this.state.location.pathname,this.state.location.search).map(a=>{const u=s.dehydratedMatches.find(c=>c.id===a.id);return Qe(u,`Could not find a client-side match for dehydrated match with id: ${a.id}!`),{...a,...u}});this.__store.setState(a=>({...a,matches:l})),this.manifest=i.router.manifest},this.injectedHtml=[],this.injectHtml=n=>{const r=()=>(this.injectedHtml=this.injectedHtml.filter(o=>o!==r),n);this.injectedHtml.push(r)},this.streamedKeys=new Set,this.getStreamedValue=n=>{var r;if(this.isServer)return;const o=(r=window.__TSR__)==null?void 0:r.streamedValues[n];if(o)return o.parsed||(o.parsed=this.options.transformer.parse(o.value)),o.parsed},this.streamValue=(n,r)=>{var o;this.streamedKeys.has(n),this.streamedKeys.add(n);const i=`__TSR__.streamedValues['${n}'] = { value: ${(o=this.serializer)==null?void 0:o.call(this,this.options.transformer.stringify(r))}}`;this.injectHtml(` +
diff --git a/exam/react/.nvmrc b/exam/react/.nvmrc new file mode 100644 index 0000000..3f430af --- /dev/null +++ b/exam/react/.nvmrc @@ -0,0 +1 @@ +v18 diff --git a/exam/react/package.json b/exam/react/package.json index 4b41e7e..e5e16e7 100644 --- a/exam/react/package.json +++ b/exam/react/package.json @@ -13,12 +13,18 @@ "@emotion/react": "^11.13.0", "@emotion/styled": "^11.13.0", "@mui/material": "^5.16.4", + "@tanstack/react-query": "^5.51.11", "@tanstack/react-router": "^1.45.8", + "@types/node": "^20.14.12", "react": "^18.3.1", - "react-dom": "^18.3.1" + "react-dom": "^18.3.1", + "zustand": "^4.5.4" }, "devDependencies": { + "@redux-devtools/extension": "^3.3.0", + "@tanstack/eslint-plugin-query": "^5.51.12", "@tanstack/router-devtools": "^1.45.8", + "@tanstack/react-query-devtools": "^5.51.11", "@tanstack/router-plugin": "^1.45.8", "@types/react": "^18.3.3", "@types/react-dom": "^18.3.0", diff --git a/exam/react/pnpm-lock.yaml b/exam/react/pnpm-lock.yaml index 600f186..0a43c54 100644 --- a/exam/react/pnpm-lock.yaml +++ b/exam/react/pnpm-lock.yaml @@ -17,22 +17,40 @@ importers: '@mui/material': specifier: ^5.16.4 version: 5.16.4(@emotion/react@11.13.0(@types/react@18.3.3)(react@18.3.1))(@emotion/styled@11.13.0(@emotion/react@11.13.0(@types/react@18.3.3)(react@18.3.1))(@types/react@18.3.3)(react@18.3.1))(@types/react@18.3.3)(react-dom@18.3.1(react@18.3.1))(react@18.3.1) + '@tanstack/react-query': + specifier: ^5.51.11 + version: 5.51.11(react@18.3.1) + '@tanstack/react-query-devtools': + specifier: ^5.51.11 + version: 5.51.11(@tanstack/react-query@5.51.11(react@18.3.1))(react@18.3.1) '@tanstack/react-router': specifier: ^1.45.8 version: 1.45.8(react-dom@18.3.1(react@18.3.1))(react@18.3.1) + '@types/node': + specifier: ^20.14.12 + version: 20.14.12 react: specifier: ^18.3.1 version: 18.3.1 react-dom: specifier: ^18.3.1 version: 18.3.1(react@18.3.1) + zustand: + specifier: ^4.5.4 + version: 4.5.4(@types/react@18.3.3)(react@18.3.1) devDependencies: + '@redux-devtools/extension': + specifier: ^3.3.0 + version: 3.3.0(redux@5.0.1) + '@tanstack/eslint-plugin-query': + specifier: ^5.51.12 + version: 5.51.12(eslint@8.57.0)(typescript@5.5.3) '@tanstack/router-devtools': specifier: ^1.45.8 version: 1.45.8(@tanstack/react-router@1.45.8(react-dom@18.3.1(react@18.3.1))(react@18.3.1))(csstype@3.1.3)(react-dom@18.3.1(react@18.3.1))(react@18.3.1) '@tanstack/router-plugin': specifier: ^1.45.8 - version: 1.45.8(vite@5.3.4) + version: 1.45.8(vite@5.3.4(@types/node@20.14.12)) '@types/react': specifier: ^18.3.3 version: 18.3.3 @@ -47,7 +65,7 @@ importers: version: 7.16.1(eslint@8.57.0)(typescript@5.5.3) '@vitejs/plugin-react': specifier: ^4.3.1 - version: 4.3.1(vite@5.3.4) + version: 4.3.1(vite@5.3.4(@types/node@20.14.12)) eslint: specifier: ^8.57.0 version: 8.57.0 @@ -68,7 +86,7 @@ importers: version: 5.5.3 vite: specifier: ^5.3.4 - version: 5.3.4 + version: 5.3.4(@types/node@20.14.12) packages: @@ -528,6 +546,11 @@ packages: '@popperjs/core@2.11.8': resolution: {integrity: sha512-P1st0aksCrn9sGZhp8GMYwBnQsbvAWsZAX44oXNNvLHGqAOcoVxmjZiohstwQ7SqKnbR47akdNi+uleWD8+g6A==} + '@redux-devtools/extension@3.3.0': + resolution: {integrity: sha512-X34S/rC8S/M1BIrkYD1mJ5f8vlH0BDqxXrs96cvxSBo4FhMdbhU+GUGsmNYov1xjSyLMHgo8NYrUG8bNX7525g==} + peerDependencies: + redux: ^3.1.0 || ^4.0.0 || ^5.0.0 + '@rollup/rollup-android-arm-eabi@4.18.1': resolution: {integrity: sha512-lncuC4aHicncmbORnx+dUaAgzee9cm/PbIqgWz1PpXuwc+sa1Ct83tnqUDy/GFKleLiN7ZIeytM6KJ4cAn1SxA==} cpu: [arm] @@ -608,10 +631,32 @@ packages: cpu: [x64] os: [win32] + '@tanstack/eslint-plugin-query@5.51.12': + resolution: {integrity: sha512-vzUXXIVzDP2c6wVSJ+1imPGaKQ2ILuWnta64FJc/JnQ5WunfO17bQJSk6uKDbzTQG/YKgPYBMG3C9qFA4b7Ayg==} + peerDependencies: + eslint: ^8 || ^9 + '@tanstack/history@1.45.3': resolution: {integrity: sha512-n4XXInV9irIq0obRvINIkESkGk280Q+xkIIbswmM0z9nAu2wsIRZNvlmPrtYh6bgNWtItOWWoihFUjLTW8g6Jg==} engines: {node: '>=12'} + '@tanstack/query-core@5.51.9': + resolution: {integrity: sha512-HsAwaY5J19MD18ykZDS3aVVh+bAt0i7m6uQlFC2b77DLV9djo+xEN7MWQAQQTR8IM+7r/zbozTQ7P0xr0bHuew==} + + '@tanstack/query-devtools@5.51.9': + resolution: {integrity: sha512-FQqJynaEDuwQxoFLP3/i10HQwNYh4wxgs0NeSoL24BLWvpUdstgHqUm2zgwRov8Tmh5kjndPIWaXenwl0D47EA==} + + '@tanstack/react-query-devtools@5.51.11': + resolution: {integrity: sha512-8nQRbhdtvl/J9bO+bk/kPQesCOtDgk+oI4AmZJDnkf5OfKTJL3J4tTe+fhuXph7KP4DUOS+ge9o9TGt0OgWFHw==} + peerDependencies: + '@tanstack/react-query': ^5.51.11 + react: ^18 || ^19 + + '@tanstack/react-query@5.51.11': + resolution: {integrity: sha512-4Kq2x0XpDlpvSnaLG+8pHNH60zEc3mBvb3B2tOMDjcPCi/o+Du3p/9qpPLwJOTliVxxPJAP27fuIhLrsRdCr7A==} + peerDependencies: + react: ^18.0.0 + '@tanstack/react-router@1.45.8': resolution: {integrity: sha512-hLJOKDK5lGHteoMjpF6COQrlhsl4C6GyBCzmSJHFcoh26GBa7tv/94li0H1a3deJpzMNpSvmSXrQDpxj9h9bNA==} engines: {node: '>=12'} @@ -670,6 +715,9 @@ packages: '@types/estree@1.0.5': resolution: {integrity: sha512-/kYRxGDLWzHOB7q+wtSUQlFrtcdUccpfy+X+9iMBpHK8QLLhx2wIPYuS5DYtR9Wa/YlZAbIovy7qVdB1Aq6Lyw==} + '@types/node@20.14.12': + resolution: {integrity: sha512-r7wNXakLeSsGT0H1AU863vS2wa5wBOK4bWMjZz2wj+8nBx+m5PeIn0k8AloSLpRuiwdRQZwarZqHE4FNArPuJQ==} + '@types/parse-json@4.0.2': resolution: {integrity: sha512-dISoDXWWQwUquiKsyZ4Ng+HX2KsPL7LyHKHQwgGFEA3IaKac4Obd+h2a/a6waisAoepJlBcx9paWqjA8/HVjCw==} @@ -710,6 +758,10 @@ packages: resolution: {integrity: sha512-nYpyv6ALte18gbMz323RM+vpFpTjfNdyakbf3nsLvF43uF9KeNC289SUEW3QLZ1xPtyINJ1dIsZOuWuSRIWygw==} engines: {node: ^18.18.0 || >=20.0.0} + '@typescript-eslint/scope-manager@8.0.0-alpha.30': + resolution: {integrity: sha512-FGW/iPWGyPFamAVZ60oCAthMqQrqafUGebF8UKuq/ha+e9SVG6YhJoRzurlQXOVf8dHfOhJ0ADMXyFnMc53clg==} + engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} + '@typescript-eslint/type-utils@7.16.1': resolution: {integrity: sha512-rbu/H2MWXN4SkjIIyWcmYBjlp55VT+1G3duFOIukTNFxr9PI35pLc2ydwAfejCEitCv4uztA07q0QWanOHC7dA==} engines: {node: ^18.18.0 || >=20.0.0} @@ -724,6 +776,10 @@ packages: resolution: {integrity: sha512-AQn9XqCzUXd4bAVEsAXM/Izk11Wx2u4H3BAfQVhSfzfDOm/wAON9nP7J5rpkCxts7E5TELmN845xTUCQrD1xIQ==} engines: {node: ^18.18.0 || >=20.0.0} + '@typescript-eslint/types@8.0.0-alpha.30': + resolution: {integrity: sha512-4WzLlw27SO9pK9UFj/Hu7WGo8WveT0SEiIpFVsV2WwtQmLps6kouwtVCB8GJPZKJyurhZhcqCoQVQFmpv441Vg==} + engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} + '@typescript-eslint/typescript-estree@7.16.1': resolution: {integrity: sha512-0vFPk8tMjj6apaAZ1HlwM8w7jbghC8jc1aRNJG5vN8Ym5miyhTQGMqU++kuBFDNKe9NcPeZ6x0zfSzV8xC1UlQ==} engines: {node: ^18.18.0 || >=20.0.0} @@ -733,16 +789,35 @@ packages: typescript: optional: true + '@typescript-eslint/typescript-estree@8.0.0-alpha.30': + resolution: {integrity: sha512-WSXbc9ZcXI+7yC+6q95u77i8FXz6HOLsw3ST+vMUlFy1lFbXyFL/3e6HDKQCm2Clt0krnoCPiTGvIn+GkYPn4Q==} + engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} + peerDependencies: + typescript: '*' + peerDependenciesMeta: + typescript: + optional: true + '@typescript-eslint/utils@7.16.1': resolution: {integrity: sha512-WrFM8nzCowV0he0RlkotGDujx78xudsxnGMBHI88l5J8wEhED6yBwaSLP99ygfrzAjsQvcYQ94quDwI0d7E1fA==} engines: {node: ^18.18.0 || >=20.0.0} peerDependencies: eslint: ^8.56.0 + '@typescript-eslint/utils@8.0.0-alpha.30': + resolution: {integrity: sha512-rfhqfLqFyXhHNDwMnHiVGxl/Z2q/3guQ1jLlGQ0hi9Rb7inmwz42crM+NnLPR+2vEnwyw1P/g7fnQgQ3qvFx4g==} + engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} + peerDependencies: + eslint: ^8.57.0 || ^9.0.0 + '@typescript-eslint/visitor-keys@7.16.1': resolution: {integrity: sha512-Qlzzx4sE4u3FsHTPQAAQFJFNOuqtuY0LFrZHwQ8IHK705XxBiWOFkfKRWu6niB7hwfgnwIpO4jTC75ozW1PHWg==} engines: {node: ^18.18.0 || >=20.0.0} + '@typescript-eslint/visitor-keys@8.0.0-alpha.30': + resolution: {integrity: sha512-XZuNurZxBqmr6ZIRIwWFq7j5RZd6ZlkId/HZEWyfciK+CWoyOxSF9Pv2VXH9Rlu2ZG2PfbhLz2Veszl4Pfn7yA==} + engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} + '@ungap/structured-clone@1.2.0': resolution: {integrity: sha512-zuVdFrMJiuCDQUMCzQaD6KL28MjnqqN8XnAqiEq9PNm/hCPTSGfrXCOfwj1ow4LFb/tNymJPwsNbVePc1xFqrQ==} @@ -1067,6 +1142,9 @@ packages: resolution: {integrity: sha512-5Fytz/IraMjqpwfd34ke28PTVMjZjJG2MPn5t7OE4eUCUNf8BAa7b5WUS9/Qvr6mwOQS7Mk6vdsMno5he+T8Xw==} engines: {node: '>= 4'} + immutable@4.3.7: + resolution: {integrity: sha512-1hqclzwYwjRDFLjcFxOM5AYkkG0rpFPpr1RLPMEuGczoS7YA8gLhy8SWXYRAA/XwfEHpfo3cw5JGioS32fnMRw==} + import-fresh@3.3.0: resolution: {integrity: sha512-veYYhQa+D1QBKznvhUHxb8faxlrwUnxseDAbAp457E0wLNio2bOSKnjYDhMj+YiAq61xrMGhQk9iXVk5FzgQMw==} engines: {node: '>=6'} @@ -1316,6 +1394,9 @@ packages: resolution: {integrity: sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==} engines: {node: '>=8.10.0'} + redux@5.0.1: + resolution: {integrity: sha512-M9/ELqF6fy8FwmkpnF0S3YKOqMyoWJ4+CS5Efg2ct3oY9daQvd/Pc71FpGZsVsbl3Cpb+IIcjBDUnnyBdQbq4w==} + regenerator-runtime@0.14.1: resolution: {integrity: sha512-dYnhHh0nJoMfnkZs6GmmhFknAGRrLznOu5nc9ML+EJxGvrx6H7teuevqVqCuPcPK//3eDrrjQhehXVx9cnkGdw==} @@ -1435,6 +1516,9 @@ packages: engines: {node: '>=14.17'} hasBin: true + undici-types@5.26.5: + resolution: {integrity: sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==} + unplugin@1.11.0: resolution: {integrity: sha512-3r7VWZ/webh0SGgJScpWl2/MRCZK5d3ZYFcNaeci/GQ7Teop7zf0Nl2pUuz7G21BwPd9pcUPOC5KmJ2L3WgC5g==} engines: {node: '>=14.0.0'} @@ -1448,6 +1532,11 @@ packages: uri-js@4.4.1: resolution: {integrity: sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==} + use-sync-external-store@1.2.0: + resolution: {integrity: sha512-eEgnFxGQ1Ife9bzYs6VLi8/4X6CObHMw9Qr9tPY43iKwsPw8xE8+EFsf/2cFZ5S3esXgpWgtSCtLNS41F+sKPA==} + peerDependencies: + react: ^16.8.0 || ^17.0.0 || ^18.0.0 + use-sync-external-store@1.2.2: resolution: {integrity: sha512-PElTlVMwpblvbNqQ82d2n6RjStvdSoNe9FG28kNfz3WiXilJm4DdNkEzRhCZuIDwY8U08WVihhGR5iRqAwfDiw==} peerDependencies: @@ -1514,6 +1603,21 @@ packages: zod@3.23.8: resolution: {integrity: sha512-XBx9AXhXktjUqnepgTiE5flcKIYWi/rme0Eaj+5Y0lftuGBq+jyRu/md4WnuxqgP1ubdpNCsYEYPxrzVHD8d6g==} + zustand@4.5.4: + resolution: {integrity: sha512-/BPMyLKJPtFEvVL0E9E9BTUM63MNyhPGlvxk1XjrfWTUlV+BR8jufjsovHzrtR6YNcBEcL7cMHovL1n9xHawEg==} + engines: {node: '>=12.7.0'} + peerDependencies: + '@types/react': '>=16.8' + immer: '>=9.0.6' + react: '>=16.8' + peerDependenciesMeta: + '@types/react': + optional: true + immer: + optional: true + react: + optional: true + snapshots: '@ampproject/remapping@2.3.0': @@ -1972,6 +2076,12 @@ snapshots: '@popperjs/core@2.11.8': {} + '@redux-devtools/extension@3.3.0(redux@5.0.1)': + dependencies: + '@babel/runtime': 7.24.8 + immutable: 4.3.7 + redux: 5.0.1 + '@rollup/rollup-android-arm-eabi@4.18.1': optional: true @@ -2020,8 +2130,31 @@ snapshots: '@rollup/rollup-win32-x64-msvc@4.18.1': optional: true + '@tanstack/eslint-plugin-query@5.51.12(eslint@8.57.0)(typescript@5.5.3)': + dependencies: + '@typescript-eslint/utils': 8.0.0-alpha.30(eslint@8.57.0)(typescript@5.5.3) + eslint: 8.57.0 + transitivePeerDependencies: + - supports-color + - typescript + '@tanstack/history@1.45.3': {} + '@tanstack/query-core@5.51.9': {} + + '@tanstack/query-devtools@5.51.9': {} + + '@tanstack/react-query-devtools@5.51.11(@tanstack/react-query@5.51.11(react@18.3.1))(react@18.3.1)': + dependencies: + '@tanstack/query-devtools': 5.51.9 + '@tanstack/react-query': 5.51.11(react@18.3.1) + react: 18.3.1 + + '@tanstack/react-query@5.51.11(react@18.3.1)': + dependencies: + '@tanstack/query-core': 5.51.9 + react: 18.3.1 + '@tanstack/react-router@1.45.8(react-dom@18.3.1(react@18.3.1))(react@18.3.1)': dependencies: '@tanstack/history': 1.45.3 @@ -2053,7 +2186,7 @@ snapshots: prettier: 3.3.3 zod: 3.23.8 - '@tanstack/router-plugin@1.45.8(vite@5.3.4)': + '@tanstack/router-plugin@1.45.8(vite@5.3.4(@types/node@20.14.12))': dependencies: '@babel/core': 7.24.9 '@babel/generator': 7.24.10 @@ -2073,7 +2206,7 @@ snapshots: unplugin: 1.11.0 zod: 3.23.8 optionalDependencies: - vite: 5.3.4 + vite: 5.3.4(@types/node@20.14.12) transitivePeerDependencies: - supports-color @@ -2102,6 +2235,10 @@ snapshots: '@types/estree@1.0.5': {} + '@types/node@20.14.12': + dependencies: + undici-types: 5.26.5 + '@types/parse-json@4.0.2': {} '@types/prop-types@15.7.12': {} @@ -2155,6 +2292,11 @@ snapshots: '@typescript-eslint/types': 7.16.1 '@typescript-eslint/visitor-keys': 7.16.1 + '@typescript-eslint/scope-manager@8.0.0-alpha.30': + dependencies: + '@typescript-eslint/types': 8.0.0-alpha.30 + '@typescript-eslint/visitor-keys': 8.0.0-alpha.30 + '@typescript-eslint/type-utils@7.16.1(eslint@8.57.0)(typescript@5.5.3)': dependencies: '@typescript-eslint/typescript-estree': 7.16.1(typescript@5.5.3) @@ -2169,6 +2311,8 @@ snapshots: '@typescript-eslint/types@7.16.1': {} + '@typescript-eslint/types@8.0.0-alpha.30': {} + '@typescript-eslint/typescript-estree@7.16.1(typescript@5.5.3)': dependencies: '@typescript-eslint/types': 7.16.1 @@ -2184,6 +2328,21 @@ snapshots: transitivePeerDependencies: - supports-color + '@typescript-eslint/typescript-estree@8.0.0-alpha.30(typescript@5.5.3)': + dependencies: + '@typescript-eslint/types': 8.0.0-alpha.30 + '@typescript-eslint/visitor-keys': 8.0.0-alpha.30 + debug: 4.3.5 + globby: 11.1.0 + is-glob: 4.0.3 + minimatch: 9.0.5 + semver: 7.6.3 + ts-api-utils: 1.3.0(typescript@5.5.3) + optionalDependencies: + typescript: 5.5.3 + transitivePeerDependencies: + - supports-color + '@typescript-eslint/utils@7.16.1(eslint@8.57.0)(typescript@5.5.3)': dependencies: '@eslint-community/eslint-utils': 4.4.0(eslint@8.57.0) @@ -2195,21 +2354,37 @@ snapshots: - supports-color - typescript + '@typescript-eslint/utils@8.0.0-alpha.30(eslint@8.57.0)(typescript@5.5.3)': + dependencies: + '@eslint-community/eslint-utils': 4.4.0(eslint@8.57.0) + '@typescript-eslint/scope-manager': 8.0.0-alpha.30 + '@typescript-eslint/types': 8.0.0-alpha.30 + '@typescript-eslint/typescript-estree': 8.0.0-alpha.30(typescript@5.5.3) + eslint: 8.57.0 + transitivePeerDependencies: + - supports-color + - typescript + '@typescript-eslint/visitor-keys@7.16.1': dependencies: '@typescript-eslint/types': 7.16.1 eslint-visitor-keys: 3.4.3 + '@typescript-eslint/visitor-keys@8.0.0-alpha.30': + dependencies: + '@typescript-eslint/types': 8.0.0-alpha.30 + eslint-visitor-keys: 3.4.3 + '@ungap/structured-clone@1.2.0': {} - '@vitejs/plugin-react@4.3.1(vite@5.3.4)': + '@vitejs/plugin-react@4.3.1(vite@5.3.4(@types/node@20.14.12))': dependencies: '@babel/core': 7.24.9 '@babel/plugin-transform-react-jsx-self': 7.24.7(@babel/core@7.24.9) '@babel/plugin-transform-react-jsx-source': 7.24.7(@babel/core@7.24.9) '@types/babel__core': 7.20.5 react-refresh: 0.14.2 - vite: 5.3.4 + vite: 5.3.4(@types/node@20.14.12) transitivePeerDependencies: - supports-color @@ -2582,6 +2757,8 @@ snapshots: ignore@5.3.1: {} + immutable@4.3.7: {} + import-fresh@3.3.0: dependencies: parent-module: 1.0.1 @@ -2788,6 +2965,8 @@ snapshots: dependencies: picomatch: 2.3.1 + redux@5.0.1: {} + regenerator-runtime@0.14.1: {} resolve-from@4.0.0: {} @@ -2892,6 +3071,8 @@ snapshots: typescript@5.5.3: {} + undici-types@5.26.5: {} + unplugin@1.11.0: dependencies: acorn: 8.12.1 @@ -2909,16 +3090,21 @@ snapshots: dependencies: punycode: 2.3.1 + use-sync-external-store@1.2.0(react@18.3.1): + dependencies: + react: 18.3.1 + use-sync-external-store@1.2.2(react@18.3.1): dependencies: react: 18.3.1 - vite@5.3.4: + vite@5.3.4(@types/node@20.14.12): dependencies: esbuild: 0.21.5 postcss: 8.4.39 rollup: 4.18.1 optionalDependencies: + '@types/node': 20.14.12 fsevents: 2.3.3 webpack-sources@3.2.3: {} @@ -2940,3 +3126,10 @@ snapshots: yocto-queue@0.1.0: {} zod@3.23.8: {} + + zustand@4.5.4(@types/react@18.3.3)(react@18.3.1): + dependencies: + use-sync-external-store: 1.2.0(react@18.3.1) + optionalDependencies: + '@types/react': 18.3.3 + react: 18.3.1 diff --git a/exam/react/src/api/Api.ts b/exam/react/src/api/Api.ts new file mode 100644 index 0000000..5005cf3 --- /dev/null +++ b/exam/react/src/api/Api.ts @@ -0,0 +1,61 @@ +import { User } from '../types/User'; + +const BASE = 'https://khofmann.userpage.fu-berlin.de/phpCourse/exam/api/'; + +let instance: ApiImpl; + +class ApiImpl { + private token: string = ''; + + constructor() { + if (instance) { + throw new Error('New instance cannot be created!!'); + } + + instance = this; + } + + public logIn = async (email: string, password: string): Promise => { + const { user, token } = await (await this.post('login', { email, password })).json(); + this.token = token; + + return user; + }; + + public logOut = async (): Promise => { + return await (await this.postAuth('logout')).json(); + }; + + private post = async ( + endpoint: string, + body: Record | undefined = undefined, + headers: HeadersInit | undefined = undefined + ) => { + const response = await fetch(`${BASE}${endpoint}`, { + mode: 'cors', + method: 'post', + headers, + body: JSON.stringify(body), + }); + if (response.ok) return response; + throw await response.json(); + }; + + private postAuth = async ( + endpoint: string, + body: Record | undefined = undefined, + headers: HeadersInit | undefined = undefined + ) => { + const response = await fetch(`${BASE}${endpoint}`, { + mode: 'cors', + method: 'post', + headers: { token: this.token, ...headers }, + body: JSON.stringify(body), + }); + if (response.ok) return response; + throw await response.json(); + }; +} + +const Api = new ApiImpl(); +export default Api; diff --git a/exam/react/src/main.tsx b/exam/react/src/main.tsx index a38c8a2..1055140 100644 --- a/exam/react/src/main.tsx +++ b/exam/react/src/main.tsx @@ -1,12 +1,27 @@ +import { QueryClient, QueryClientProvider } from '@tanstack/react-query'; import { RouterProvider, createRouter } from '@tanstack/react-router'; import { StrictMode } from 'react'; import ReactDOM from 'react-dom/client'; // Import the generated route tree +import { ReactQueryDevtools } from '@tanstack/react-query-devtools'; import { routeTree } from './routeTree.gen'; +// Query Client +const queryClient = new QueryClient(); + // Create a new router instance -const router = createRouter({ routeTree }); +const router = createRouter({ + routeTree, + context: { + queryClient, + }, + defaultPreload: 'intent', + // Since we're using React Query, we don't want loader calls to ever be stale + // This will ensure that the loader is always called when the route is preloaded or visited + defaultPreloadStaleTime: 0, + basepath: process.env.NODE_ENV === 'development' ? 'phpCourse/exam/dist' : '/phpCourse/exam', +}); // Register the router instance for type safety declare module '@tanstack/react-router' { @@ -21,7 +36,10 @@ if (!rootElement.innerHTML) { const root = ReactDOM.createRoot(rootElement); root.render( - + + + + ); } diff --git a/exam/react/src/routeTree.gen.ts b/exam/react/src/routeTree.gen.ts index 84b8c10..5ecc21f 100644 --- a/exam/react/src/routeTree.gen.ts +++ b/exam/react/src/routeTree.gen.ts @@ -11,18 +11,32 @@ // Import Routes import { Route as rootRoute } from './routes/__root' +import { Route as IndexImport } from './routes/index' // Create/Update Routes +const IndexRoute = IndexImport.update({ + path: '/', + getParentRoute: () => rootRoute, +} as any) + // Populate the FileRoutesByPath interface declare module '@tanstack/react-router' { - interface FileRoutesByPath {} + interface FileRoutesByPath { + '/': { + id: '/' + path: '/' + fullPath: '/' + preLoaderRoute: typeof IndexImport + parentRoute: typeof rootRoute + } + } } // Create and export the route tree -export const routeTree = rootRoute.addChildren({}) +export const routeTree = rootRoute.addChildren({ IndexRoute }) /* prettier-ignore-end */ @@ -31,7 +45,12 @@ export const routeTree = rootRoute.addChildren({}) "routes": { "__root__": { "filePath": "__root.tsx", - "children": [] + "children": [ + "/" + ] + }, + "/": { + "filePath": "index.tsx" } } } diff --git a/exam/react/src/routes/__root.tsx b/exam/react/src/routes/__root.tsx index 1a62b76..c1a48e9 100644 --- a/exam/react/src/routes/__root.tsx +++ b/exam/react/src/routes/__root.tsx @@ -1,9 +1,19 @@ -import { createRootRoute, Outlet } from '@tanstack/react-router'; +import { QueryClient } from '@tanstack/react-query'; +import { createRootRouteWithContext, Link, Outlet } from '@tanstack/react-router'; import { TanStackRouterDevtools } from '@tanstack/router-devtools'; -export const Route = createRootRoute({ +export const Route = createRootRouteWithContext<{ queryClient: QueryClient }>()({ component: () => ( <> + + Home + diff --git a/exam/react/src/routes/index.tsx b/exam/react/src/routes/index.tsx new file mode 100644 index 0000000..880d72e --- /dev/null +++ b/exam/react/src/routes/index.tsx @@ -0,0 +1,40 @@ +import { Button } from '@mui/material'; +import { createFileRoute } from '@tanstack/react-router'; +import Api from '../api/Api'; +import useGuestBookStore from '../store/store'; + +export const Route = createFileRoute('/')({ + component: Home, +}); + +function Home() { + const setUser = useGuestBookStore((state) => state.setUser); + + return ( + <> + + + + ); +} diff --git a/exam/react/src/store/store.ts b/exam/react/src/store/store.ts new file mode 100644 index 0000000..9a04d5d --- /dev/null +++ b/exam/react/src/store/store.ts @@ -0,0 +1,18 @@ +import type {} from '@redux-devtools/extension'; // required for devtools typing +import { create } from 'zustand'; +import { devtools } from 'zustand/middleware'; +import { User } from '../types/User'; + +interface GuestBookState { + user: User | undefined; + setUser: (user: User | undefined) => void; +} + +const useGuestBookStore = create()( + devtools((set) => ({ + user: undefined, + setUser: (user: User | undefined) => set(() => ({ user })), + })) +); + +export default useGuestBookStore; diff --git a/exam/react/src/types/Responses.ts b/exam/react/src/types/Responses.ts new file mode 100644 index 0000000..306f19f --- /dev/null +++ b/exam/react/src/types/Responses.ts @@ -0,0 +1,6 @@ +import { User } from './User'; + +export interface LoginResponse { + token: string; + user: User; +} diff --git a/exam/react/src/types/Timestamp.ts b/exam/react/src/types/Timestamp.ts new file mode 100644 index 0000000..66169e4 --- /dev/null +++ b/exam/react/src/types/Timestamp.ts @@ -0,0 +1,5 @@ +export interface Timestamp { + date: string; + timezone_type: number; + timezone: string; +} diff --git a/exam/react/src/types/User.ts b/exam/react/src/types/User.ts new file mode 100644 index 0000000..b37c5ab --- /dev/null +++ b/exam/react/src/types/User.ts @@ -0,0 +1,12 @@ +import { Timestamp } from './Timestamp'; + +export interface User { + id: number; + username: string; + status: number; + email: string; + image: string; + isAdmin: boolean; + memberSince: Timestamp; + postCount: number; +}