@tanstack/react-router 0.0.1-beta.18 → 0.0.1-beta.181

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,5 +1,5 @@
1
1
  /**
2
- * react-router
2
+ * @tanstack/react-router/src/index.tsx
3
3
  *
4
4
  * Copyright (c) TanStack
5
5
  *
@@ -8,9 +8,9 @@
8
8
  *
9
9
  * @license MIT
10
10
  */
11
- !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("react"),require("use-sync-external-store/shim"),require("react-lazy-with-preload/lib/index")):"function"==typeof define&&define.amd?define(["exports","react","use-sync-external-store/shim","react-lazy-with-preload/lib/index"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).ReactRouter={},t.React,t.shim,t.index)}(this,(function(t,e,n,a){"use strict";function o(t){if(t&&t.__esModule)return t;var e=Object.create(null);return t&&Object.keys(t).forEach((function(n){if("default"!==n){var a=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(e,n,a.get?a:{enumerable:!0,get:function(){return t[n]}})}})),e.default=t,Object.freeze(e)}var r,i=o(e);function s(){return s=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var a in n)Object.prototype.hasOwnProperty.call(n,a)&&(t[a]=n[a])}return t},s.apply(this,arguments)}function l(t,e){if(null==t)return{};var n,a,o={},r=Object.keys(t);for(a=0;a<r.length;a++)n=r[a],e.indexOf(n)>=0||(o[n]=t[n]);return o}
11
+ !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("use-sync-external-store/shim/with-selector"),require("react")):"function"==typeof define&&define.amd?define(["exports","use-sync-external-store/shim/with-selector","react"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).ReactRouter={},t.withSelector,t.React)}(this,(function(t,e,r){"use strict";function s(t){if(t&&t.__esModule)return t;var e=Object.create(null);return t&&Object.keys(t).forEach((function(r){if("default"!==r){var s=Object.getOwnPropertyDescriptor(t,r);Object.defineProperty(e,r,s.get?s:{enumerable:!0,get:function(){return t[r]}})}})),e.default=t,Object.freeze(e)}var o=s(r);
12
12
  /**
13
- * router-core
13
+ * @tanstack/store/src/index.ts
14
14
  *
15
15
  * Copyright (c) TanStack
16
16
  *
@@ -18,5 +18,26 @@
18
18
  * LICENSE.md file in the root directory of this source tree.
19
19
  *
20
20
  * @license MIT
21
- */function c(){return c=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var a in n)Object.prototype.hasOwnProperty.call(n,a)&&(t[a]=n[a])}return t},c.apply(this,arguments)}!function(t){t.Pop="POP",t.Push="PUSH",t.Replace="REPLACE"}(r||(r={}));var u="beforeunload",h="popstate";function d(t){void 0===t&&(t={});var e=t.window,n=void 0===e?document.defaultView:e,a=n.history;function o(){var t=n.location,e=t.pathname,o=t.search,r=t.hash,i=a.state||{};return[i.idx,{pathname:e,search:o,hash:r,state:i.usr||null,key:i.key||"default"}]}var i=null;n.addEventListener(h,(function(){if(i)b.call(i),i=null;else{var t=r.Pop,e=o(),n=e[0],a=e[1];if(b.length){if(null!=n){var s=d-n;s&&(i={action:t,location:a,retry:function(){S(-1*s)}},S(s))}}else E(t)}}));var s=r.Pop,l=o(),d=l[0],p=l[1],f=v(),b=v();function P(t){return"string"==typeof t?t:y(t)}function w(t,e){return void 0===e&&(e=null),c({pathname:p.pathname,hash:"",search:""},"string"==typeof t?_(t):t,{state:e,key:g()})}function x(t,e){return[{usr:t.state,key:t.key,idx:e},P(t)]}function R(t,e,n){return!b.length||(b.call({action:t,location:e,retry:n}),!1)}function E(t){s=t;var e=o();d=e[0],p=e[1],f.call({action:s,location:p})}function S(t){a.go(t)}null==d&&(d=0,a.replaceState(c({},a.state,{idx:d}),""));var I={get action(){return s},get location(){return p},createHref:P,push:function t(e,o){var i=r.Push,s=w(e,o);if(R(i,s,(function(){t(e,o)}))){var l=x(s,d+1),c=l[0],u=l[1];try{a.pushState(c,"",u)}catch(t){n.location.assign(u)}E(i)}},replace:function t(e,n){var o=r.Replace,i=w(e,n);if(R(o,i,(function(){t(e,n)}))){var s=x(i,d),l=s[0],c=s[1];a.replaceState(l,"",c),E(o)}},go:S,back:function(){S(-1)},forward:function(){S(1)},listen:function(t){return f.push(t)},block:function(t){var e=b.push(t);return 1===b.length&&n.addEventListener(u,m),function(){e(),b.length||n.removeEventListener(u,m)}}};return I}function p(t){void 0===t&&(t={});var e=t,n=e.initialEntries,a=void 0===n?["/"]:n,o=e.initialIndex,i=a.map((function(t){return c({pathname:"/",search:"",hash:"",state:null,key:g()},"string"==typeof t?_(t):t)})),s=f(null==o?i.length-1:o,0,i.length-1),l=r.Pop,u=i[s],h=v(),d=v();function p(t,e){return void 0===e&&(e=null),c({pathname:u.pathname,search:"",hash:""},"string"==typeof t?_(t):t,{state:e,key:g()})}function m(t,e,n){return!d.length||(d.call({action:t,location:e,retry:n}),!1)}function b(t,e){l=t,u=e,h.call({action:l,location:u})}function P(t){var e=f(s+t,0,i.length-1),n=r.Pop,a=i[e];m(n,a,(function(){P(t)}))&&(s=e,b(n,a))}var w={get index(){return s},get action(){return l},get location(){return u},createHref:function(t){return"string"==typeof t?t:y(t)},push:function t(e,n){var a=r.Push,o=p(e,n);m(a,o,(function(){t(e,n)}))&&(s+=1,i.splice(s,i.length,o),b(a,o))},replace:function t(e,n){var a=r.Replace,o=p(e,n);m(a,o,(function(){t(e,n)}))&&(i[s]=o,b(a,o))},go:P,back:function(){P(-1)},forward:function(){P(1)},listen:function(t){return h.push(t)},block:function(t){return d.push(t)}};return w}function f(t,e,n){return Math.min(Math.max(t,e),n)}function m(t){t.preventDefault(),t.returnValue=""}function v(){var t=[];return{get length(){return t.length},push:function(e){return t.push(e),function(){t=t.filter((function(t){return t!==e}))}},call:function(e){t.forEach((function(t){return t&&t(e)}))}}}function g(){return Math.random().toString(36).substr(2,8)}function y(t){var e=t.pathname,n=void 0===e?"/":e,a=t.search,o=void 0===a?"":a,r=t.hash,i=void 0===r?"":r;return o&&"?"!==o&&(n+="?"===o.charAt(0)?o:"?"+o),i&&"#"!==i&&(n+="#"===i.charAt(0)?i:"#"+i),n}function _(t){var e={};if(t){var n=t.indexOf("#");n>=0&&(e.hash=t.substr(n),t=t.substr(0,n));var a=t.indexOf("?");a>=0&&(e.search=t.substr(a),t=t.substr(0,a)),t&&(e.pathname=t)}return e}function b(t,e){if(!t)throw new Error("Invariant failed")}function P(t,e){if(t===e)return t;const n=Array.isArray(t)&&Array.isArray(e);if(n||w(t)&&w(e)){const a=n?t.length:Object.keys(t).length,o=n?e:Object.keys(e),r=o.length,i=n?[]:{};let s=0;for(let a=0;a<r;a++){const r=n?a:o[a];i[r]=P(t[r],e[r]),i[r]===t[r]&&s++}return a===r&&s===a?t:i}return e}function w(t){if(!x(t))return!1;const e=t.constructor;if(void 0===e)return!0;const n=e.prototype;return!!x(n)&&!!n.hasOwnProperty("isPrototypeOf")}function x(t){return"[object Object]"===Object.prototype.toString.call(t)}function R(t){return t[t.length-1]}function E(t,e){if(t){"undefined"!=typeof console&&console.warn(e);try{throw new Error(e)}catch(t){}}return!0}function S(t,e){return"function"==typeof t?t(e):t}function I(t,e){return e.reduce(((e,n)=>(e[n]=t[n],e)),{})}function A(t){return M(t.filter(Boolean).join("/"))}function M(t){return t.replace(/\/{2,}/g,"/")}function L(t){return"/"===t?t:t.replace(/^\/{1,}/,"")}function C(t){return"/"===t?t:t.replace(/\/{1,}$/,"")}function k(t){return C(L(t))}function O(t,e,n){e=e.replace(new RegExp("^"+t),"/"),n=n.replace(new RegExp("^"+t),"/");let a=j(e);const o=j(n);o.forEach(((t,e)=>{if("/"===t.value)e?e===o.length-1&&a.push(t):a=[t];else if(".."===t.value){var n;a.length>1&&"/"===(null==(n=R(a))?void 0:n.value)&&a.pop(),a.pop()}else{if("."===t.value)return;a.push(t)}}));return M(A([t,...a.map((t=>t.value))]))}function j(t){if(!t)return[];const e=[];if("/"===(t=M(t)).slice(0,1)&&(t=t.substring(1),e.push({type:"pathname",value:"/"})),!t)return e;const n=t.split("/").filter(Boolean);return e.push(...n.map((t=>t.startsWith("*")?{type:"wildcard",value:t}:":"===t.charAt(0)?{type:"param",value:t}:{type:"pathname",value:t}))),"/"===t.slice(-1)&&(t=t.substring(1),e.push({type:"pathname",value:"/"})),e}function D(t,e,n){return A(j(t).map((t=>{return"*"!==t.value||n?"param"===t.type?null!=(a=e[t.value.substring(1)])?a:"":t.value:"";var a})))}function F(t,e){const n=T(t,e);if(!e.to||n)return null!=n?n:{}}function T(t,e){var n;const a=j(t),o=j(""+(null!=(n=e.to)?n:"*")),r={};return(()=>{for(let t=0;t<Math.max(a.length,o.length);t++){const n=a[t],i=o[t],s=t===o.length-1,l=t===a.length-1;if(i){if("wildcard"===i.type)return!(null==n||!n.value)&&(r["*"]=A(a.slice(t).map((t=>t.value))),!0);if("pathname"===i.type){if("/"===i.value&&(null==n||!n.value))return!0;if(n)if(e.caseSensitive){if(i.value!==n.value)return!1}else if(i.value.toLowerCase()!==n.value.toLowerCase())return!1}if(!n)return!1;if("param"===i.type){if("/"===(null==n?void 0:n.value))return!1;n.value.startsWith(":")||(r[i.value.substring(1)]=n.value)}}if(s&&!l)return!!e.fuzzy}return!0})()?r:void 0}function N(t,e){var n,a,o,r="";for(n in t)if(void 0!==(o=t[n]))if(Array.isArray(o))for(a=0;a<o.length;a++)r&&(r+="&"),r+=encodeURIComponent(n)+"="+encodeURIComponent(o[a]);else r&&(r+="&"),r+=encodeURIComponent(n)+"="+encodeURIComponent(o);return(e||"")+r}function B(t){if(!t)return"";var e=decodeURIComponent(t);return"false"!==e&&("true"===e||("0"===e.charAt(0)?e:0*+e==0?+e:e))}function z(t){for(var e,n,a={},o=t.split("&");e=o.shift();)void 0!==a[n=(e=e.split("=")).shift()]?a[n]=[].concat(a[n],B(e.shift())):a[n]=B(e.shift());return a}function U(){return U=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var a in n)Object.prototype.hasOwnProperty.call(n,a)&&(t[a]=n[a])}return t},U.apply(this,arguments)}function H(t,e,n,a){const{id:o,routeId:r,path:i,fullPath:s}=t,l=a.state.actions[o]||(a.state.actions[o]={submissions:[],submit:async(t,e)=>{var n;if(!u)return;const o=null==(n=null==e?void 0:e.invalidate)||n;null!=e&&e.multi||(l.submissions=l.submissions.filter((t=>t.isMulti)));const r={submittedAt:Date.now(),status:"pending",submission:t,isMulti:!(null==e||!e.multi)};l.current=r,l.latest=r,l.submissions.push(r),a.notify();try{const e=await(null==u.options.action?void 0:u.options.action(t));return r.data=e,o&&(a.invalidateRoute({to:".",fromCurrent:!0}),await a.reload()),r.status="success",e}catch(t){console.error(t),r.error=t,r.status="error"}finally{a.notify()}}},a.state.actions[o]),c=a.state.loaders[o]||(a.state.loaders[o]={pending:[],fetch:async t=>{if(!u)return;const e={loadedAt:Date.now(),loaderContext:t};c.current=e,c.latest=e,c.pending.push(e),a.notify();try{return await(null==u.options.loader?void 0:u.options.loader(t))}finally{c.pending=c.pending.filter((t=>t!==e)),a.notify()}}},a.state.loaders[o]);let u={routeId:o,routeRouteId:r,routePath:i,fullPath:s,options:e,router:a,childRoutes:void 0,parentRoute:n,action:l,loader:c,buildLink:t=>a.buildLink(U({},t,{from:s})),navigate:t=>a.navigate(U({},t,{from:s})),matchRoute:(t,e)=>a.matchRoute(U({},t,{from:s}),e)};return null==a.options.createRoute||a.options.createRoute({router:a,route:u}),u}const G="__root__",W=["component","errorComponent","pendingComponent"];function q(t,e,n){const a=U({},e,n,{router:t,routeSearch:{},search:{},childMatches:[],status:"idle",routeLoaderData:{},loaderData:{},isFetching:!1,isInvalid:!1,invalidAt:1/0,getIsInvalid:()=>{const t=Date.now();return a.isInvalid||a.invalidAt<t},__:{abortController:new AbortController,latestId:"",resolve:()=>{},notify:()=>{a.__.resolve(),a.router.notify()},validate:()=>{var e,n;const o=null!=(e=null==(n=a.parentMatch)?void 0:n.search)?e:t.location.search;try{var r;const t=a.routeSearch,e="object"==typeof a.options.validateSearch?a.options.validateSearch.parse:a.options.validateSearch;let n=P(t,null!=(r=null==e?void 0:e(o))?r:{});t!==n&&(a.isInvalid=!0),a.routeSearch=n,a.search=P(o,U({},o,n)),W.map((async t=>{const e=a.options[t];"function"!=typeof a.__[t]&&(a.__[t]=e)}))}catch(t){console.error(t);const e=new Error("Invalid search params found",{cause:t});return e.code="INVALID_SEARCH_PARAMS",a.status="error",void(a.error=e)}}},cancel:()=>{var t;null==(t=a.__.abortController)||t.abort()},invalidate:()=>{a.isInvalid=!0},hasLoaders:()=>!(!e.options.loader&&!W.some((t=>{var n;return null==(n=e.options[t])?void 0:n.preload}))),load:async e=>{const n=Date.now(),o=null!=e&&e.preload?Math.max(null==e?void 0:e.maxAge,null==e?void 0:e.gcMaxAge):0;if(null!=e&&e.preload&&o>0){if(t.state.matches.find((t=>t.matchId===a.matchId)))return;t.matchCache[a.matchId]={gc:n+e.gcMaxAge,match:a}}if("success"===a.status&&a.getIsInvalid()||"error"===a.status||"idle"===a.status){const t=null!=e&&e.preload?null==e?void 0:e.maxAge:void 0;await a.fetch({maxAge:t})}},fetch:async e=>{const n=""+Date.now()+Math.random();if(a.__.latestId=n,"idle"===a.status&&(a.status="loading"),a.isInvalid=!1,a.__.loadPromise=new Promise((async o=>{a.isFetching=!0,a.__.resolve=o,a.__.componentsPromise=(async()=>{await Promise.all(W.map((async e=>{var n;const o=a.options[e];null!=(n=a.__[e])&&n.preload&&(a.__[e]=await t.options.loadComponent(o))})))})(),a.__.dataPromise=Promise.resolve().then((async()=>{try{var o,r,i;if(a.options.loader){var s;const t=await a.options.loader({parentLoaderPromise:null==(s=a.parentMatch)?void 0:s.__.dataPromise,params:a.params,search:a.routeSearch,signal:a.__.abortController.signal});if(n!==a.__.latestId)return a.__.loadPromise;a.routeLoaderData=P(a.routeLoaderData,t)}return a.error=void 0,a.status="success",a.updatedAt=Date.now(),a.invalidAt=a.updatedAt+(null!=(o=null!=(r=null!=(i=null==e?void 0:e.maxAge)?i:a.options.loaderMaxAge)?r:t.options.defaultLoaderMaxAge)?o:0),a.routeLoaderData}catch(t){if(n!==a.__.latestId)return a.__.loadPromise;throw a.error=t,a.status="error",a.updatedAt=Date.now(),t}}));try{if(await Promise.all([a.__.componentsPromise,a.__.dataPromise.catch((()=>{}))]),n!==a.__.latestId)return a.__.loadPromise}finally{if(n!==a.__.latestId)return a.__.loadPromise;a.isFetching=!1,a.__.notify()}})),await a.__.loadPromise,n!==a.__.latestId)return a.__.loadPromise;delete a.__.loadPromise}});return a.hasLoaders()||(a.status="success"),a}const K=J(JSON.parse),V=X(JSON.stringify);function J(t){return e=>{"?"===e.substring(0,1)&&(e=e.substring(1));let n=z(e);for(let e in n){const a=n[e];if("string"==typeof a)try{n[e]=t(a)}catch(t){}}return n}}function X(t){return e=>{(e=U({},e))&&Object.keys(e).forEach((n=>{const a=e[n];if(void 0===a||void 0===a)delete e[n];else if(a&&"object"==typeof a&&null!==a)try{e[n]=t(a)}catch(t){}}));const n=N(e).toString();return n?"?"+n:""}}var $;const Q="undefined"==typeof window||!(null!=($=window.document)&&$.createElement);function Y(){return{status:"idle",location:null,matches:[],actions:{},loaders:{},lastUpdated:Date.now(),isFetching:!1,isPreloading:!1}}function Z(t){var e,n;const a=(null==t?void 0:t.history)||(Q?p():d()),o=U({defaultLoaderGcMaxAge:3e5,defaultLoaderMaxAge:0,defaultPreloadMaxAge:2e3,defaultPreloadDelay:50},t,{stringifySearch:null!=(e=null==t?void 0:t.stringifySearch)?e:V,parseSearch:null!=(n=null==t?void 0:t.parseSearch)?n:K});let r={history:a,options:o,listeners:[],basepath:"",routeTree:void 0,routesById:{},location:void 0,allRouteInfo:void 0,navigationPromise:Promise.resolve(),resolveNavigation:()=>{},matchCache:{},state:Y(),reset:()=>{r.state=Y(),r.notify()},startedLoadingAt:Date.now(),subscribe:t=>(r.listeners.push(t),()=>{r.listeners=r.listeners.filter((e=>e!==t))}),getRoute:t=>r.routesById[t],notify:()=>{const t="loading"===r.state.status||r.state.matches.some((t=>t.isFetching)),e=Object.values(r.matchCache).some((t=>t.match.isFetching&&!r.state.matches.find((e=>e.matchId===t.match.matchId))));r.state.isFetching===t&&r.state.isPreloading===e||(r.state=U({},r.state,{isFetching:t,isPreloading:e})),tt(r.state.matches),r.listeners.forEach((t=>t(r)))},dehydrateState:()=>U({},I(r.state,["status","location","lastUpdated"]),{matches:r.state.matches.map((t=>I(t,["matchId","status","routeLoaderData","loaderData","isInvalid","invalidAt"])))}),hydrateState:t=>{const e=r.matchRoutes(r.location.pathname,{strictParseParams:!0});e.forEach(((e,n)=>{const a=t.matches[n];b(a),Object.assign(e,a)})),e.forEach((t=>t.__.validate())),r.state=U({},r.state,t,{matches:e})},mount:()=>{const t=r.__.buildLocation({to:".",search:!0,hash:!0});t.href!==r.location.href&&r.__.commitLocation(t,!0),r.state.matches.length||r.load();const e=r.history.listen((t=>{r.load(r.__.parseLocation(t.location,r.location))}));return!Q&&window.addEventListener&&(window.addEventListener("visibilitychange",r.onFocus,!1),window.addEventListener("focus",r.onFocus,!1)),()=>{e(),!Q&&window.removeEventListener&&(window.removeEventListener("visibilitychange",r.onFocus),window.removeEventListener("focus",r.onFocus))}},onFocus:()=>{r.load()},update:t=>{const e=(null==t?void 0:t.history)!==r.history;r.location&&!e||(null!=t&&t.history&&(r.history=t.history),r.location=r.__.parseLocation(r.history.location),r.state.location=r.location),Object.assign(r.options,t);const{basepath:n,routeConfig:a}=r.options;return r.basepath=M("/"+(null!=n?n:"")),a&&(r.routesById={},r.routeTree=r.__.buildRouteTree(a)),r},cancelMatches:()=>{var t,e;[...r.state.matches,...null!=(t=null==(e=r.state.pending)?void 0:e.matches)?t:[]].forEach((t=>{t.cancel()}))},load:async t=>{const e=Math.random();r.startedLoadingAt=e,t&&(r.location=t),r.cancelMatches();const n=r.matchRoutes(r.location.pathname,{strictParseParams:!0});if("undefined"!=typeof document?r.state=U({},r.state,{pending:{matches:n,location:r.location},status:"loading"}):r.state=U({},r.state,{matches:n,location:r.location,status:"loading"}),r.notify(),await r.loadMatches(n),r.startedLoadingAt!==e)return r.navigationPromise;const a=r.state.matches,o=[],i=[];a.forEach((t=>{n.find((e=>e.matchId===t.matchId))?i.push(t):o.push(t)}));const s=n.filter((t=>!a.find((e=>e.matchId===t.matchId)))),l=Date.now();o.forEach((t=>{var e,n,a,o;null==t.__.onExit||t.__.onExit({params:t.params,search:t.routeSearch}),"error"!==t.status||t.isFetching||(t.status="idle",t.error=void 0);const i=Math.max(null!=(e=null!=(n=t.options.loaderGcMaxAge)?n:r.options.defaultLoaderGcMaxAge)?e:0,null!=(a=null!=(o=t.options.loaderMaxAge)?o:r.options.defaultLoaderMaxAge)?a:0);i>0&&(r.matchCache[t.matchId]={gc:i==1/0?Number.MAX_SAFE_INTEGER:l+i,match:t})})),i.forEach((t=>{null==t.options.onTransition||t.options.onTransition({params:t.params,search:t.routeSearch})})),s.forEach((t=>{t.__.onExit=null==t.options.onMatch?void 0:t.options.onMatch({params:t.params,search:t.search}),delete r.matchCache[t.matchId]})),r.startedLoadingAt===e&&(n.forEach((t=>{t.action&&(t.action.current=void 0,t.action.submissions=[])})),r.state=U({},r.state,{location:r.location,matches:n,pending:void 0,status:"idle"}),r.notify(),r.resolveNavigation())},cleanMatchCache:()=>{const t=Date.now();Object.keys(r.matchCache).forEach((e=>{const n=r.matchCache[e];"loading"!==n.match.status&&(n.gc>0&&n.gc>t||delete r.matchCache[e])}))},loadRoute:async function(t){void 0===t&&(t=r.location);const e=r.buildNext(t),n=r.matchRoutes(e.pathname,{strictParseParams:!0});return await r.loadMatches(n),n},preloadRoute:async function(t,e){var n,a,o,i,s,l;void 0===t&&(t=r.location);const c=r.buildNext(t),u=r.matchRoutes(c.pathname,{strictParseParams:!0});return await r.loadMatches(u,{preload:!0,maxAge:null!=(n=null!=(a=null!=(o=e.maxAge)?o:r.options.defaultPreloadMaxAge)?a:r.options.defaultLoaderMaxAge)?n:0,gcMaxAge:null!=(i=null!=(s=null!=(l=e.gcMaxAge)?l:r.options.defaultPreloadGcMaxAge)?s:r.options.defaultLoaderGcMaxAge)?i:0}),u},matchRoutes:(t,e)=>{var n,a;r.cleanMatchCache();const o=[];if(!r.routeTree)return o;const i=[...r.state.matches,...null!=(n=null==(a=r.state.pending)?void 0:a.matches)?n:[]],s=async n=>{var a,l,c;const u=R(o);let h=null!=(a=null==u?void 0:u.params)?a:{};const d=null!=(l=null==r.options.filterRoutes?void 0:r.options.filterRoutes(n))?l:n;let p=[];const f=(n,a)=>(a.some((a=>{var o,i,s;if(!a.routePath&&null!=(o=a.childRoutes)&&o.length)return f([...p,a],a.childRoutes);const l=!!("/"!==a.routePath||null!=(i=a.childRoutes)&&i.length),c=F(t,{to:a.fullPath,fuzzy:l,caseSensitive:null!=(s=a.options.caseSensitive)?s:r.options.caseSensitive});if(c){let t;try{var u;t=null!=(u=null==a.options.parseParams?void 0:a.options.parseParams(c))?u:c}catch(t){if(null!=e&&e.strictParseParams)throw t}h=U({},h,t)}return c&&(p=[...n,a]),!!p.length})),!!p.length);if(f([],d),!p.length)return;p.forEach((e=>{var n;const a=D(e.routePath,h),s=D(e.routeId,h,!0),l=i.find((t=>t.matchId===s))||(null==(n=r.matchCache[s])?void 0:n.match)||q(r,e,{parentMatch:u,matchId:s,params:h,pathname:A([t,a])});o.push(l)}));const m=R(p);null!=(c=m.childRoutes)&&c.length&&s(m.childRoutes)};return s([r.routeTree]),tt(o),o},loadMatches:async(t,e)=>{const n=t.map((async t=>{t.__.validate(),t.load(e),t.__.loadPromise&&await t.__.loadPromise}));r.notify(),await Promise.all(n)},invalidateRoute:t=>{var e,n;const a=r.buildNext(t),o=r.matchRoutes(a.pathname).map((t=>t.matchId));[...r.state.matches,...null!=(e=null==(n=r.state.pending)?void 0:n.matches)?e:[]].forEach((t=>{o.includes(t.matchId)&&t.invalidate()}))},reload:()=>r.__.navigate({fromCurrent:!0,replace:!0,search:!0}),resolvePath:(t,e)=>O(r.basepath,t,M(e)),matchRoute:(t,e)=>{var n;t=U({},t,{to:t.to?r.resolvePath(null!=(n=t.from)?n:"",t.to):void 0});const a=r.buildNext(t);var o;return null!=e&&e.pending?!(null==(o=r.state.pending)||!o.location)&&!!F(r.state.pending.location.pathname,U({},e,{to:a.pathname})):!!F(r.state.location.pathname,U({},e,{to:a.pathname}))},navigate:async t=>{let{from:e,to:n=".",search:a,hash:o,replace:i,params:s}=t;const l=String(n),c=String(e);let u;try{new URL(""+l),u=!0}catch(t){}return b(!u),r.__.navigate({from:c,to:l,search:a,hash:o,replace:i,params:s})},buildLink:t=>{var e,n;let{from:a,to:o=".",search:i,params:s,hash:l,target:c,replace:u,activeOptions:h,preload:d,preloadMaxAge:p,preloadGcMaxAge:f,preloadDelay:m,disabled:v}=t;try{return new URL(""+o),{type:"external",href:o}}catch(t){}const g={from:a,to:o,search:i,params:s,hash:l,replace:u},y=r.buildNext(g);d=null!=(e=d)?e:r.options.defaultPreload;const _=null!=(n=null!=m?m:r.options.defaultPreloadDelay)?n:0,b=r.state.location.pathname===y.pathname,P=r.state.location.pathname.split("/"),w=y.pathname.split("/").every(((t,e)=>t===P[e])),x=r.state.location.hash===y.hash,R=null!=h&&h.exact?b:w,E=null==h||!h.includeHash||x;return{type:"internal",next:y,handleFocus:t=>{d&&r.preloadRoute(g,{maxAge:p,gcMaxAge:f})},handleClick:t=>{v||function(t){return!!(t.metaKey||t.altKey||t.ctrlKey||t.shiftKey)}(t)||t.defaultPrevented||c&&"_self"!==c||0!==t.button||(t.preventDefault(),!b||i||l||r.invalidateRoute(g),r.__.navigate(g))},handleEnter:t=>{const e=t.target||{};if(d){if(e.preloadTimeout)return;e.preloadTimeout=setTimeout((()=>{e.preloadTimeout=null,r.preloadRoute(g,{maxAge:p,gcMaxAge:f})}),_)}},handleLeave:t=>{const e=t.target||{};e.preloadTimeout&&(clearTimeout(e.preloadTimeout),e.preloadTimeout=null)},isActive:R&&E,disabled:v}},buildNext:t=>{const e=r.__.buildLocation(t),n=r.matchRoutes(e.pathname),a=n.map((t=>{var e;return null!=(e=t.options.preSearchFilters)?e:[]})).flat().filter(Boolean),o=n.map((t=>{var e;return null!=(e=t.options.postSearchFilters)?e:[]})).flat().filter(Boolean);return r.__.buildLocation(U({},t,{__preSearchFilters:a,__postSearchFilters:o}))},__:{buildRouteTree:t=>{const e=(t,n)=>t.map((t=>{const a=H(t,t.options,n,r);if(r.routesById[a.routeId])throw new Error;r.routesById[a.routeId]=a;const o=t.children;return a.childRoutes=null!=o&&o.length?e(o,a):void 0,a}));return e([t])[0]},parseLocation:(t,e)=>{var n;const a=r.options.parseSearch(t.search);return{pathname:t.pathname,searchStr:t.search,search:P(null==e?void 0:e.search,a),hash:null!=(n=t.hash.split("#").reverse()[0])?n:"",href:""+t.pathname+t.search+t.hash,state:t.state,key:t.key}},navigate:t=>{const e=r.buildNext(t);return r.__.commitLocation(e,t.replace)},buildLocation:function(t){var e,n,a,o,i,s,l,c,u;void 0===t&&(t={});const h=t.fromCurrent?r.location.pathname:null!=(e=t.from)?e:r.location.pathname;let d=O(null!=(n=r.basepath)?n:"/",h,""+(null!=(a=t.to)?a:"."));const p=r.matchRoutes(r.location.pathname,{strictParseParams:!0}),f=r.matchRoutes(d),m=U({},null==(o=R(p))?void 0:o.params);let v=!0===(null==(i=t.params)||i)?m:S(t.params,m);v&&f.map((t=>t.options.stringifyParams)).filter(Boolean).forEach((t=>{Object.assign({},v,t(v))})),d=D(d,null!=v?v:{});const g=null!=(s=t.__preSearchFilters)&&s.length?t.__preSearchFilters.reduce(((t,e)=>e(t)),r.location.search):r.location.search,y=!0===t.search?g:t.search?null!=(l=S(t.search,g))?l:{}:null!=(c=t.__preSearchFilters)&&c.length?g:{},_=null!=(u=t.__postSearchFilters)&&u.length?t.__postSearchFilters.reduce(((t,e)=>e(t)),y):y,b=P(r.location.search,_),w=r.options.stringifySearch(b);let x=!0===t.hash?r.location.hash:S(t.hash,r.location.hash);return x=x?"#"+x:"",{pathname:d,search:b,searchStr:w,state:r.location.state,hash:x,href:""+d+w+x,key:t.key}},commitLocation:(t,e)=>{const n=""+Date.now()+Math.random();r.navigateTimeout&&clearTimeout(r.navigateTimeout);let o="replace";e||(o="push");return r.__.parseLocation(a.location).href===t.href&&!t.key&&(o="replace"),"replace"===o?a.replace({pathname:t.pathname,hash:t.hash,search:t.searchStr},U({id:n},t.state)):a.push({pathname:t.pathname,hash:t.hash,search:t.searchStr},{id:n}),r.navigationPromise=new Promise((t=>{const e=r.resolveNavigation;r.resolveNavigation=()=>{e(),t()}})),r.navigationPromise}}};return r.update(t),null==r.options.createRouter||r.options.createRouter(r),r}function tt(t){t.forEach(((e,n)=>{const a=t[n-1];a&&(e.loaderData=P(e.loaderData,U({},a.loaderData,e.routeLoaderData)))}))}const et=["type","children","target","activeProps","inactiveProps","activeOptions","disabled","hash","search","params","to","preload","preloadDelay","preloadMaxAge","replace","style","className","onClick","onFocus","onMouseEnter","onMouseLeave","onTouchStart","onTouchEnd"],nt=["pending","caseSensitive","children"],at=["children","router"],ot=i.createContext(null),rt=i.createContext(null);function it(t){return i.createElement(ot.Provider,t)}const st=t=>{n.useSyncExternalStore((e=>t.subscribe((()=>e()))),(()=>t.state),(()=>t.state))};function lt(){const t=i.useContext(rt);return E(!t,"useRouter must be used inside a <Router> component!"),st(t.router),t.router}function ct(){return i.useContext(ot)}function ut(){var t,e,n;const a=lt(),o=ct().slice(1),r=o[0],s=i.useCallback((()=>null),[]);if(!r)return null;const l=null!=(t=null!=(e=r.__.pendingComponent)?e:a.options.defaultPendingComponent)?t:s,c=null!=(n=r.__.errorComponent)?n:a.options.defaultErrorComponent;return i.createElement(it,{value:o},i.createElement(i.Suspense,{fallback:i.createElement(l,null)},i.createElement(ht,{errorComponent:c},(()=>{if("error"===r.status)throw r.error;var t,e;if("success"===r.status)return i.createElement(null!=(t=null!=(e=r.__.component)?e:a.options.defaultComponent)?t:ut);if(r.__.loadPromise)throw console.log(r.matchId,"suspend"),r.__.loadPromise;b(!1)})())))}class ht extends i.Component{constructor(){super(...arguments),this.state={error:!1}}componentDidCatch(t,e){console.error(t),this.setState({error:t,info:e})}render(){var t;const e=null!=(t=this.props.errorComponent)?t:dt;return this.state.error?i.createElement(e,this.state):this.props.children}}function dt(t){let{error:e}=t;return i.createElement("div",{style:{padding:".5rem",maxWidth:"100%"}},i.createElement("strong",{style:{fontSize:"1.2rem"}},"Something went wrong!"),i.createElement("div",{style:{height:".5rem"}}),i.createElement("div",null,i.createElement("pre",null,e.message?i.createElement("code",{style:{fontSize:".7em",border:"1px solid red",borderRadius:".25rem",padding:".5rem",color:"red"}},e.message):null)))}function pt(t,e){const n=lt();i.useEffect((()=>{if(!e)return;let a=n.history.block((e=>{window.confirm(t)?(a(),e.retry()):n.location.pathname=window.location.pathname}));return a}),[e,location,t])}Object.defineProperty(t,"lazy",{enumerable:!0,get:function(){return a.lazyWithPreload}}),t.DefaultErrorBoundary=dt,t.MatchesProvider=it,t.Outlet=ut,t.Prompt=function(t){let{message:e,when:n,children:a}=t;return pt(e,null==n||n),null!=a?a:null},t.RouterProvider=function(t){let{children:e,router:n}=t,a=l(t,at);return n.update(a),st(n),i.useEffect((()=>n.mount()),[n]),i.createElement(rt.Provider,{value:{router:n}},i.createElement(it,{value:n.state.matches},null!=e?e:i.createElement(ut,null)))},t.cleanPath=M,t.createBrowserHistory=d,t.createHashHistory=function(t){void 0===t&&(t={});var e=t.window,n=void 0===e?document.defaultView:e,a=n.history;function o(){var t=_(n.location.hash.substr(1)),e=t.pathname,o=void 0===e?"/":e,r=t.search,i=void 0===r?"":r,s=t.hash,l=void 0===s?"":s,c=a.state||{};return[c.idx,{pathname:o,search:i,hash:l,state:c.usr||null,key:c.key||"default"}]}var i=null;function s(){if(i)P.call(i),i=null;else{var t=r.Pop,e=o(),n=e[0],a=e[1];if(P.length){if(null!=n){var s=p-n;s&&(i={action:t,location:a,retry:function(){I(-1*s)}},I(s))}}else S(t)}}n.addEventListener(h,s),n.addEventListener("hashchange",(function(){y(o()[1])!==y(f)&&s()}));var l=r.Pop,d=o(),p=d[0],f=d[1],b=v(),P=v();function w(t){return function(){var t=document.querySelector("base"),e="";if(t&&t.getAttribute("href")){var a=n.location.href,o=a.indexOf("#");e=-1===o?a:a.slice(0,o)}return e}()+"#"+("string"==typeof t?t:y(t))}function x(t,e){return void 0===e&&(e=null),c({pathname:f.pathname,hash:"",search:""},"string"==typeof t?_(t):t,{state:e,key:g()})}function R(t,e){return[{usr:t.state,key:t.key,idx:e},w(t)]}function E(t,e,n){return!P.length||(P.call({action:t,location:e,retry:n}),!1)}function S(t){l=t;var e=o();p=e[0],f=e[1],b.call({action:l,location:f})}function I(t){a.go(t)}null==p&&(p=0,a.replaceState(c({},a.state,{idx:p}),""));var A={get action(){return l},get location(){return f},createHref:w,push:function t(e,o){var i=r.Push,s=x(e,o);if(E(i,s,(function(){t(e,o)}))){var l=R(s,p+1),c=l[0],u=l[1];try{a.pushState(c,"",u)}catch(t){n.location.assign(u)}S(i)}},replace:function t(e,n){var o=r.Replace,i=x(e,n);if(E(o,i,(function(){t(e,n)}))){var s=R(i,p),l=s[0],c=s[1];a.replaceState(l,"",c),S(o)}},go:I,back:function(){I(-1)},forward:function(){I(1)},listen:function(t){return b.push(t)},block:function(t){var e=P.push(t);return 1===P.length&&n.addEventListener(u,m),function(){e(),P.length||n.removeEventListener(u,m)}}};return A},t.createMemoryHistory=p,t.createReactRouter=function(t){const e=(t,e)=>({useRoute:function(n){void 0===n&&(n=".");const a=e.resolvePath(t.routeId,n),o=e.getRoute(a);return st(e),b(o),o},linkProps:e=>{var n,a;const{target:o,activeProps:r=(()=>({className:"active"})),inactiveProps:c=(()=>({})),disabled:u,style:h,className:d,onClick:p,onFocus:f,onMouseEnter:m,onMouseLeave:v}=e,g=l(e,et),y=t.buildLink(e);if("external"===y.type){const{href:t}=y;return{href:t}}const{handleClick:_,handleFocus:b,handleEnter:P,handleLeave:w,isActive:x,next:R}=y,E=t=>e=>{e.persist(),t.forEach((t=>{t&&t(e)}))},I=x&&null!=(n=S(r,{}))?n:{},A=x?{}:null!=(a=S(c,{}))?a:{};return s({},I,A,g,{href:u?void 0:R.href,onClick:E([t=>{i.startTransition((()=>{_(t)}))},p]),onFocus:E([b,f]),onMouseEnter:E([P,m]),onMouseLeave:E([w,v]),target:o,style:s({},h,I.style,A.style),className:[d,I.className,A.className].filter(Boolean).join(" ")||void 0},u?{role:"link","aria-disabled":!0}:void 0,{"data-status":x?"active":void 0})},Link:i.forwardRef(((n,a)=>{const o=t.linkProps(n);return st(e),i.createElement("a",s({ref:a},o,{children:"function"==typeof n.children?n.children({isActive:"active"===o["data-status"]}):n.children}))})),MatchRoute:e=>{const{pending:n,caseSensitive:a}=e,o=l(e,nt),r=t.matchRoute(o,{pending:n,caseSensitive:a});return r?"function"==typeof e.children?e.children(r):e.children:null}}),n=Z(s({},t,{createRouter:t=>{const n={useState:()=>(st(t),t.state),useMatch:(e,n)=>{var a,o;st(t),b(e!==G);const r=null==(a=ct())?void 0:a[0],i=t.state.matches.find((t=>t.routeId===e));return(null==(o=null==n?void 0:n.strict)||o)&&(b(i),b(r.routeId==(null==i?void 0:i.routeId),(null==i||i.routeId,r.routeId,null==i||i.routeId,null==i||i.routeId))),i}},a=e(t.getRoute("/"),t);Object.assign(t,n,a)},createRoute:t=>{let{router:n,route:a}=t;const o=e(a,n);Object.assign(a,o)},loadComponent:async t=>(t.preload&&"undefined"!=typeof document&&t.preload(),t)}));return n},t.createRoute=H,t.createRouteConfig=function t(e,n,a,o,r){void 0===e&&(e={}),void 0===a&&(a=!0),a&&(e.path=G),o===G&&(o="");let i=a?G:e.path;i&&"/"!==i&&(i=k(i));const s=i||e.id;let l=A([o,s]);i===G&&(i="/"),l!==G&&(l=A(["/",l]));const c=l===G?"/":C(A([r,i]));return{id:l,routeId:s,path:i,fullPath:c,options:e,children:n,createChildren:n=>t(e,n((e=>t(e,void 0,!1,l,c))),!1,o,r),addChildren:n=>t(e,n,!1,o,r),createRoute:e=>t(e,void 0,!1,l,c)}},t.createRouteMatch=q,t.createRouter=Z,t.decode=z,t.defaultParseSearch=K,t.defaultStringifySearch=V,t.encode=N,t.functionalUpdate=S,t.interpolatePath=D,t.invariant=b,t.joinPaths=A,t.last=R,t.matchByPath=T,t.matchPathname=F,t.parsePathname=j,t.parseSearchWith=J,t.pick=I,t.replaceEqualDeep=P,t.resolvePath=O,t.rootRouteId=G,t.stringifySearchWith=X,t.trimPath=k,t.trimPathLeft=L,t.trimPathRight=C,t.useMatches=ct,t.usePrompt=pt,t.useRouter=lt,t.warning=E,Object.defineProperty(t,"__esModule",{value:!0})}));
21
+ */class n{listeners=new Set;_batching=!1;_flushing=0;_nextPriority=null;constructor(t,e){this.state=t,this.options=e}subscribe=t=>{this.listeners.add(t);const e=this.options?.onSubscribe?.(t,this);return()=>{this.listeners.delete(t),e?.()}};setState=(t,e)=>{const r=this.state;this.state=this.options?.updateFn?this.options.updateFn(r)(t):t(r);const s=e?.priority??this.options?.defaultPriority??"high";null===this._nextPriority||"high"===this._nextPriority?this._nextPriority=s:this._nextPriority=this.options?.defaultPriority??"high",this.options?.onUpdate?.({priority:this._nextPriority}),this._flush()};_flush=()=>{if(this._batching)return;const t=++this._flushing;this.listeners.forEach((e=>{this._flushing===t&&e({priority:this._nextPriority??"high"})}))};batch=t=>{if(this._batching)return t();this._batching=!0,t(),this._batching=!1,this._flush()}}
22
+ /**
23
+ * @tanstack/react-store/src/index.tsx
24
+ *
25
+ * Copyright (c) TanStack
26
+ *
27
+ * This source code is licensed under the MIT license found in the
28
+ * LICENSE.md file in the root directory of this source tree.
29
+ *
30
+ * @license MIT
31
+ */function a(t,r=(t=>t)){return e.useSyncExternalStoreWithSelector(t.subscribe,(()=>t.state),(()=>t.state),r,i)}function i(t,e){if(Object.is(t,e))return!0;if("object"!=typeof t||null===t||"object"!=typeof e||null===e)return!1;const r=Object.keys(t);if(r.length!==Object.keys(e).length)return!1;for(let s=0;s<r.length;s++)if(!Object.prototype.hasOwnProperty.call(e,r[s])||!Object.is(t[r[s]],e[r[s]]))return!1;return!0}function c(t,e){if(!t)throw new Error("Invariant failed")}
32
+ /**
33
+ * @tanstack/router-core/src/index.ts
34
+ *
35
+ * Copyright (c) TanStack
36
+ *
37
+ * This source code is licensed under the MIT license found in the
38
+ * LICENSE.md file in the root directory of this source tree.
39
+ *
40
+ * @license MIT
41
+ */
42
+ const h="pushstate",u="popstate",l="beforeunload",d=t=>(t.preventDefault(),t.returnValue=""),p=()=>{removeEventListener(l,d,{capture:!0})};function f(t){let e=t.getLocation(),r=()=>{},s=new Set,o=[],n=[];const a=()=>{if(o.length)o[0]?.(a,(()=>{o=[],p()}));else{for(;n.length;)n.shift()?.();t.subscriber||c()}},i=t=>{n.push(t),a()},c=()=>{e=t.getLocation(),s.forEach((t=>t()))};return{get location(){return e},subscribe:e=>(0===s.size&&(r="function"==typeof t.subscriber?t.subscriber(c):()=>{}),s.add(e),()=>{s.delete(e),0===s.size&&r()}),push:(e,r)=>{i((()=>{t.pushState(e,r)}))},replace:(e,r)=>{i((()=>{t.replaceState(e,r)}))},go:e=>{i((()=>{t.go(e)}))},back:()=>{i((()=>{t.back()}))},forward:()=>{i((()=>{t.forward()}))},createHref:e=>t.createHref(e),block:t=>(o.push(t),1===o.length&&addEventListener(l,d,{capture:!0}),()=>{o=o.filter((e=>e!==t)),o.length||p()})}}function m(t){const e=t?.getHref??(()=>`${window.location.pathname}${window.location.search}${window.location.hash}`),r=t?.createHref??(t=>t);return f({getLocation:()=>g(e(),history.state),subscriber:t=>{window.addEventListener(h,t),window.addEventListener(u,t);var e=window.history.pushState;window.history.pushState=function(){let r=e.apply(history,arguments);return t(),r};var r=window.history.replaceState;return window.history.replaceState=function(){let e=r.apply(history,arguments);return t(),e},()=>{window.history.pushState=e,window.history.replaceState=r,window.removeEventListener(h,t),window.removeEventListener(u,t)}},pushState:(t,e)=>{window.history.pushState({...e,key:w()},"",r(t))},replaceState:(t,e)=>{window.history.replaceState({...e,key:w()},"",r(t))},back:()=>window.history.back(),forward:()=>window.history.forward(),go:t=>window.history.go(t),createHref:t=>r(t)})}function y(t={initialEntries:["/"]}){const e=t.initialEntries;let r=t.initialIndex??e.length-1,s={};return f({getLocation:()=>g(e[r],s),subscriber:!1,pushState:(t,o)=>{s={...o,key:w()},e.push(t),r++},replaceState:(t,o)=>{s={...o,key:w()},e[r]=t},back:()=>{r--},forward:()=>{r=Math.min(r+1,e.length-1)},go:t=>window.history.go(t),createHref:t=>t})}function g(t,e){let r=t.indexOf("#"),s=t.indexOf("?");return{href:t,pathname:t.substring(0,r>0?s>0?Math.min(r,s):r:s>0?s:t.length),hash:r>-1?t.substring(r):"",search:s>-1?t.slice(s,-1===r?void 0:r):"",state:e}}function w(){return(Math.random()+1).toString(36).substring(7)}function v(t){return t[t.length-1]}function b(t,e){return"function"==typeof t?t(e):t}function S(t,e){return e.reduce(((e,r)=>(e[r]=t[r],e)),{})}function x(t,e){if(t===e)return t;const r=e,s=Array.isArray(t)&&Array.isArray(r);if(s||R(t)&&R(r)){const e=s?t.length:Object.keys(t).length,o=s?r:Object.keys(r),n=o.length,a=s?[]:{};let i=0;for(let e=0;e<n;e++){const n=s?e:o[e];a[n]=x(t[n],r[n]),a[n]===t[n]&&i++}return e===n&&i===e?t:a}return r}function R(t){if(!E(t))return!1;const e=t.constructor;if(void 0===e)return!0;const r=e.prototype;return!!E(r)&&!!r.hasOwnProperty("isPrototypeOf")}function E(t){return"[object Object]"===Object.prototype.toString.call(t)}function _(t,e){return t===e||typeof t==typeof e&&(R(t)&&R(e)?!Object.keys(e).some((r=>!_(t[r],e[r]))):!(!Array.isArray(t)||!Array.isArray(e))&&(t.length===e.length&&t.every(((t,r)=>_(t,e[r])))))}function I(t){return P(t.filter(Boolean).join("/"))}function P(t){return t.replace(/\/{2,}/g,"/")}function M(t){return"/"===t?t:t.replace(/^\/{1,}/,"")}function C(t){return"/"===t?t:t.replace(/\/{1,}$/,"")}function L(t){return C(M(t))}function A(t,e,r){e=e.replace(new RegExp(`^${t}`),"/"),r=r.replace(new RegExp(`^${t}`),"/");let s=O(e);const o=O(r);o.forEach(((t,e)=>{if("/"===t.value)e?e===o.length-1&&s.push(t):s=[t];else if(".."===t.value)s.length>1&&"/"===v(s)?.value&&s.pop(),s.pop();else{if("."===t.value)return;s.push(t)}}));return P(I([t,...s.map((t=>t.value))]))}function O(t){if(!t)return[];const e=[];if("/"===(t=P(t)).slice(0,1)&&(t=t.substring(1),e.push({type:"pathname",value:"/"})),!t)return e;const r=t.split("/").filter(Boolean);return e.push(...r.map((t=>"$"===t||"*"===t?{type:"wildcard",value:t}:"$"===t.charAt(0)?{type:"param",value:t}:{type:"pathname",value:t}))),"/"===t.slice(-1)&&(t=t.substring(1),e.push({type:"pathname",value:"/"})),e}function j(t,e,r=!1){return I(O(t).map((t=>{if("wildcard"===t.type){const s=e[t.value];return r?`${t.value}${s??""}`:s}return"param"===t.type?e[t.value.substring(1)]??"":t.value})))}function D(t,e,r){const s=k(t,e,r);if(!r.to||s)return s??{}}function k(t,e,r){e="/"!=t?e.substring(t.length):e;const s=`${r.to??"$"}`,o=O(e),n=O(s);e.startsWith("/")||o.unshift({type:"pathname",value:"/"}),s.startsWith("/")||n.unshift({type:"pathname",value:"/"});const a={};return(()=>{for(let t=0;t<Math.max(o.length,n.length);t++){const e=o[t],s=n[t],i=t>=o.length-1,c=t>=n.length-1;if(s){if("wildcard"===s.type)return!!e?.value&&(a["*"]=I(o.slice(t).map((t=>t.value))),!0);if("pathname"===s.type){if("/"===s.value&&!e?.value)return!0;if(e)if(r.caseSensitive){if(s.value!==e.value)return!1}else if(s.value.toLowerCase()!==e.value.toLowerCase())return!1}if(!e)return!1;if("param"===s.type){if("/"===e?.value)return!1;"$"!==e.value.charAt(0)&&(a[s.value.substring(1)]=e.value)}}if(!i&&c)return!!r.fuzzy}return!0})()?a:void 0}function B(t,e){var r,s,o,n="";for(r in t)if(void 0!==(o=t[r]))if(Array.isArray(o))for(s=0;s<o.length;s++)n&&(n+="&"),n+=encodeURIComponent(r)+"="+encodeURIComponent(o[s]);else n&&(n+="&"),n+=encodeURIComponent(r)+"="+encodeURIComponent(o);return(e||"")+n}function T(t){if(!t)return"";var e=decodeURIComponent(t);return"false"!==e&&("true"===e||(0*+e==0&&+e+""===e?+e:e))}function $(t){for(var e,r,s={},o=t.split("&");e=o.shift();)void 0!==s[r=(e=e.split("=")).shift()]?s[r]=[].concat(s[r],T(e.shift())):s[r]=T(e.shift());return s}const H="__root__";class N{constructor(t){this.options=t||{},this.isRoot=!t?.getParentRoute,N.__onInit(this)}init=t=>{this.originalIndex=t.originalIndex,this.router=t.router;const e=this.options,r=!e?.path&&!e?.id;this.parentRoute=this.options?.getParentRoute?.(),r?this.path=H:c(this.parentRoute);let s=r?H:e.path;s&&"/"!==s&&(s=L(s));const o=e?.id||s;let n=r?H:I([this.parentRoute.id===H?"":this.parentRoute.id,o]);s===H&&(s="/"),n!==H&&(n=I(["/",n]));const a=n===H?"/":I([this.parentRoute.fullPath,s]);this.path=s,this.id=n,this.fullPath=a,this.to=a};addChildren=t=>(this.children=t,this);update=t=>(Object.assign(this.options,t),this);static __onInit=t=>{}}class F extends N{constructor(t){super(t)}}const W=U(JSON.parse),z=Y(JSON.stringify,JSON.parse);function U(t){return e=>{"?"===e.substring(0,1)&&(e=e.substring(1));let r=$(e);for(let e in r){const s=r[e];if("string"==typeof s)try{r[e]=t(s)}catch(t){}}return r}}function Y(t,e){function r(r){if("object"==typeof r&&null!==r)try{return t(r)}catch(t){}else if("string"==typeof r&&"function"==typeof e)try{return e(r),t(r)}catch(t){}return r}return t=>{(t={...t})&&Object.keys(t).forEach((e=>{const s=t[e];void 0===s||void 0===s?delete t[e]:Array.isArray(s)?t[e]=s.map(r):t[e]=r(s)}));const e=B(t).toString();return e?`?${e}`:""}}const J=["component","errorComponent","pendingComponent"],q="visibilitychange",K="focus",X="Error preloading route! ☝️";const V="undefined"==typeof window||!window.document.createElement;function G(){return{status:"idle",isFetching:!1,resolvedLocation:null,location:null,matchesById:{},matchIds:[],pendingMatchIds:[],matches:[],pendingMatches:[],lastUpdated:Date.now()}}function Q(t){return!!t?.isRedirect}class Z extends Error{}class tt extends Error{}function et(t,e){const r=Date.now();return!!t.invalid||(e?.preload?!(t.preloadMaxAge<0)&&t.updatedAt+t.preloadMaxAge<r:!(t.maxAge<0)&&t.updatedAt+t.maxAge<r)}const rt="window",st="___";let ot,nt={},at=!1;const it="undefined"!=typeof window&&window.sessionStorage,ct=t=>t.key;function ht(t,e){const r=e?.getKey||ct;it&&(ot||(ot=(()=>{const t="tsr-scroll-restoration-v1",e=JSON.parse(window.sessionStorage.getItem(t)||"{}");return{current:e,set:(r,s)=>{e[r]=s,window.sessionStorage.setItem(t,JSON.stringify(ot))}}})()));const{history:s}=window;s.scrollRestoration&&(s.scrollRestoration="manual");const o=e=>{const s=r(t.state.resolvedLocation);nt[s]||(nt[s]=new WeakSet);const o=nt[s];if(o.has(e.target))return;o.add(e.target);const a=[s,e.target===document||e.target===window?rt:n(e.target)].join(st);ot.current[a]||ot.set(a,{scrollX:NaN,scrollY:NaN})},n=t=>{let e,r=[];for(;e=t.parentNode;)r.unshift(`${t.tagName}:nth-child(${[].indexOf.call(e.children,t)+1})`),t=e;return`${r.join(" > ")}`.toLowerCase()};"undefined"!=typeof document&&document.addEventListener("scroll",o,!0);const a=t.subscribe("onBeforeLoad",(t=>{t.pathChanged&&(t=>{const e=r(t);for(const t in ot.current){const r=ot.current[t],[s,o]=t.split(st);if(e===s){if(o===rt)r.scrollX=window.scrollX||0,r.scrollY=window.scrollY||0;else if(o){const t=document.querySelector(o);r.scrollX=t?.scrollLeft||0,r.scrollY=t?.scrollTop||0}ot.set(t,r)}}})(t.from)})),i=t.subscribe("onLoad",(t=>{t.pathChanged&&(at=!0)}));return()=>{document.removeEventListener("scroll",o),a(),i()}}function ut(t,e){if(at){if(!t.resetNextScroll)return;at=!1;const r=(e?.getKey||ct)(t.state.location);let s=!1;for(const t in ot.current){const e=ot.current[t],[o,n]=t.split(st);if(o===r)if(n===rt)s=!0,window.scrollTo(e.scrollX,e.scrollY);else if(n){const t=document.querySelector(n);t&&(t.scrollLeft=e.scrollX,t.scrollTop=e.scrollY)}}s||window.scrollTo(0,0)}}function lt(t){return"object"==typeof t&&null!==t&&!(t instanceof Promise)&&!t.then&&"__deferredState"in t}function dt(){return dt=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(t[s]=r[s])}return t},dt.apply(this,arguments)}function pt(t){const e=vt(),{type:r,children:s,target:n,activeProps:a=(()=>({className:"active"})),inactiveProps:i=(()=>({})),activeOptions:c,disabled:h,hash:u,search:l,params:d,to:p=".",preload:f,preloadDelay:m,replace:y,style:g,className:w,onClick:v,onFocus:S,onMouseEnter:x,onMouseLeave:R,onTouchStart:E,..._}=t,I=e.buildLink(t);if("external"===I.type){const{href:t}=I;return{href:t}}const{handleClick:P,handleFocus:M,handleEnter:C,handleLeave:L,handleTouchStart:A,isActive:O,next:j}=I,D=t=>e=>{e.persist&&e.persist(),t.filter(Boolean).forEach((t=>{e.defaultPrevented||t(e)}))},k=O?b(a,{})??{}:{},B=O?{}:b(i,{})??{};return{...k,...B,..._,href:h?void 0:j.href,onClick:D([v,e=>{(t.startTransition??1)&&(o.startTransition||(t=>t))((()=>{P(e)}))}]),onFocus:D([S,M]),onMouseEnter:D([x,C]),onMouseLeave:D([R,L]),onTouchStart:D([E,A]),target:n,style:{...g,...k.style,...B.style},className:[w,k.className,B.className].filter(Boolean).join(" ")||void 0,...h?{role:"link","aria-disabled":!0}:void 0,"data-status":O?"active":void 0}}N.__onInit=t=>{Object.assign(t,{useMatch:(e={})=>bt({...e,from:t.id}),useLoader:(e={})=>St({...e,from:t.id}),useContext:(e={})=>bt({...e,from:t.id,select:t=>e?.select?e.select(t.context):t.context}),useRouteContext:(e={})=>bt({...e,from:t.id,select:t=>e?.select?e.select(t.routeContext):t.routeContext}),useSearch:(e={})=>xt({...e,from:t.id}),useParams:(e={})=>Rt({...e,from:t.id})})};const ft=o.forwardRef(((t,e)=>{const r=pt(t);return o.createElement("a",dt({ref:e},r,{children:"function"==typeof t.children?t.children({isActive:"active"===r["data-status"]}):t.children}))}));const mt=o.createContext(null),yt=o.createContext(null);function gt(t){return a(vt().__store,t?.select)}function wt(){const t=vt(),e=gt({select:e=>e.pendingMatches.some((e=>!!t.getRoute(e.routeId)?.options.pendingComponent))?e.pendingMatchIds:e.matchIds});return o.createElement(mt.Provider,{value:[void 0,...e]},o.createElement(Lt,{errorComponent:Ot,route:t.getRoute(H),onCatch:()=>{}},o.createElement(_t,null)))}function vt(){return o.useContext(yt)}function bt(t){const e=vt(),r=o.useContext(mt)[0],s=e.getRouteMatch(r)?.routeId,n=gt({select:e=>{const s="pending"===e.status?e.pendingMatches:e.matches;return(t?.from?s.find((e=>e.routeId===t?.from)):s.find((t=>t.id===r))).routeId}});(t?.strict??1)&&c(s==n);return gt({select:e=>{const s="pending"===e.status?e.pendingMatches:e.matches,o=t?.from?s.find((e=>e.routeId===t?.from)):s.find((t=>t.id===r));return c(o,t?.from&&t.from),t?.select?t.select(o):o}})}function St(t){return bt({...t,select:e=>t?.select?t?.select(e.loaderData):e.loaderData})}function xt(t){return bt({...t,select:e=>t?.select?t.select(e.search):e.search})}function Rt(t){return gt({select:e=>{const r=v(e.matches)?.params;return t?.select?t.select(r):r}})}function Et(){const t=vt();return o.useCallback((e=>{const{pending:r,caseSensitive:s,...o}=e;return t.matchRoute(o,{pending:r,caseSensitive:s})}),[])}function _t(){const t=o.useContext(mt).slice(1);return t[0]?o.createElement(Pt,{matchIds:t}):null}const It=()=>null;function Pt({matchIds:t}){const e=vt(),r=t[0],s=e.getRouteMatch(r).routeId,n=e.getRoute(s),a=n.options.pendingComponent??e.options.defaultPendingComponent??It,i=n.options.errorComponent??e.options.defaultErrorComponent??Ot,c=n.options.wrapInSuspense??!n.isRoot?o.Suspense:Ct,h=i?Lt:Ct;return o.createElement(mt.Provider,{value:t},o.createElement(c,{fallback:o.createElement(a,{useMatch:n.useMatch,useContext:n.useContext,useRouteContext:n.useRouteContext,useSearch:n.useSearch,useParams:n.useParams})},o.createElement(h,{key:n.id,errorComponent:i,route:n,onCatch:()=>{}},o.createElement(Mt,{matchId:r,PendingComponent:a}))))}function Mt({matchId:t,PendingComponent:e}){const r=vt(),s=gt({select:e=>S(e.matchesById[t],["status","loadPromise","routeId","error"])}),n=r.getRoute(s.routeId);if("error"===s.status)throw s.error;if("pending"===s.status)return o.createElement(e,{useLoader:n.useLoader,useMatch:n.useMatch,useContext:n.useContext,useRouteContext:n.useRouteContext,useSearch:n.useSearch,useParams:n.useParams});if("success"===s.status){let t=n.options.component??r.options.defaultComponent;return t?o.createElement(t,{useLoader:n.useLoader,useMatch:n.useMatch,useContext:n.useContext,useRouteContext:n.useRouteContext,useSearch:n.useSearch,useParams:n.useParams}):o.createElement(_t,null)}c(!1)}function Ct(t){return o.createElement(o.Fragment,null,t.children)}class Lt extends o.Component{state={error:!1,info:void 0};componentDidCatch(t,e){this.props.onCatch(t,e),this.setState({error:t,info:e})}render(){return o.createElement(At,dt({},this.props,{errorState:this.state,reset:()=>this.setState({})}))}}function At(t){const e=gt({select:t=>t.resolvedLocation.key}),[r,s]=o.useState(t.errorState),n=t.errorComponent??Ot,a=o.useRef("");return o.useEffect((()=>{r&&e!==a.current&&s({}),a.current=e}),[r,e]),o.useEffect((()=>{t.errorState.error&&s(t.errorState)}),[t.errorState.error]),t.errorState.error&&r.error?o.createElement(n,{...r,useMatch:t.route.useMatch,useContext:t.route.useContext,useRouteContext:t.route.useRouteContext,useSearch:t.route.useSearch,useParams:t.route.useParams}):t.children}function Ot({error:t}){const[e,r]=o.useState(!1);return o.createElement("div",{style:{padding:".5rem",maxWidth:"100%"}},o.createElement("div",{style:{display:"flex",alignItems:"center",gap:".5rem"}},o.createElement("strong",{style:{fontSize:"1rem"}},"Something went wrong!"),o.createElement("button",{style:{appearance:"none",fontSize:".6em",border:"1px solid currentColor",padding:".1rem .2rem",fontWeight:"bold",borderRadius:".25rem"},onClick:()=>r((t=>!t))},e?"Hide Error":"Show Error")),o.createElement("div",{style:{height:".25rem"}}),e?o.createElement("div",null,o.createElement("pre",{style:{fontSize:".7em",border:"1px solid red",borderRadius:".25rem",padding:".3rem",color:"red",overflow:"auto"}},t.message?o.createElement("code",null,t.message):null)):null)}function jt(t,e=!0){const r=vt();o.useEffect((()=>{if(!e)return;let s=r.history.block(((e,r)=>{window.confirm(t)&&(s(),e())}));return s}))}const Dt="undefined"!=typeof window?o.useLayoutEffect:o.useEffect;function kt(t){const e=vt();Dt((()=>ht(e,t)),[]),Dt((()=>{ut(e,t)}))}function Bt({promise:t}){const e=vt();let r=t.__deferredState;const s=`__TSR__DEFERRED__${r.uid}`;if(lt(t)&&(r=e.hydrateData(s),(t=Promise.resolve(r.data)).__deferredState=r),"pending"===r.status)throw t;if("error"===r.status)throw r.error;return e.dehydrateData(s,r),[r.data]}t.Await=function(t){const e=Bt(t);return t.children(...e)},t.Block=function({message:t,condition:e,children:r}){return jt(t,e),r??null},t.ErrorComponent=Ot,t.FileRoute=class{constructor(t){this.path=t}createRoute=t=>{const e=new N(t);return e.isRoot=!1,e}},t.Link=ft,t.MatchRoute=function(t){const e=Et()(t);return"function"==typeof t.children?t.children(e):e?t.children:null},t.Navigate=function(t){const e=vt();return o.useLayoutEffect((()=>{e.navigate(t)}),[]),null},t.Outlet=_t,t.PathParamError=tt,t.RootRoute=F,t.Route=N,t.Router=class{#t;resetNextScroll=!1;constructor(t){this.options={defaultPreloadDelay:50,context:void 0,...t,stringifySearch:t?.stringifySearch??z,parseSearch:t?.parseSearch??W},this.__store=new n(G(),{onUpdate:()=>{const t=this.state,e=this.__store.state,r=t.matchesById!==e.matchesById;let s,o;r||(s=t.matchIds.length!==e.matchIds.length||t.matchIds.some(((t,r)=>t!==e.matchIds[r])),o=t.pendingMatchIds.length!==e.pendingMatchIds.length||t.pendingMatchIds.some(((t,r)=>t!==e.pendingMatchIds[r]))),(r||s)&&(e.matches=e.matchIds.map((t=>e.matchesById[t]))),(r||o)&&(e.pendingMatches=e.pendingMatchIds.map((t=>e.matchesById[t]))),e.isFetching=[...e.matches,...e.pendingMatches].some((t=>t.isFetching)),this.state=e},defaultPriority:"low"}),this.state=this.__store.state,this.update(t);const e=this.buildNext({hash:!0,fromCurrent:!0,search:!0,state:!0});this.state.location.href!==e.href&&this.#e({...e,replace:!0})}subscribers=new Set;subscribe=(t,e)=>{const r={eventType:t,fn:e};return this.subscribers.add(r),()=>{this.subscribers.delete(r)}};#r=t=>{this.subscribers.forEach((e=>{e.eventType===t.type&&e.fn(t)}))};reset=()=>{this.__store.setState((t=>Object.assign(t,G())))};mount=()=>("undefined"!=typeof window&&window.addEventListener&&(window.addEventListener(q,this.#s,!1),window.addEventListener(K,this.#s,!1)),this.safeLoad(),()=>{"undefined"!=typeof window&&window.removeEventListener&&(window.removeEventListener(q,this.#s),window.removeEventListener(K,this.#s))});#s=()=>{(this.options.refetchOnWindowFocus??1)&&this.invalidate()};update=t=>{if(this.options={...this.options,...t,context:{...this.options.context,...t?.context}},!this.history||this.options.history&&this.options.history!==this.history){this.#t&&this.#t(),this.history=this.options.history??(V?y():m());const t=this.#o();this.__store.setState((e=>({...e,resolvedLocation:t,location:t}))),this.#t=this.history.subscribe((()=>{this.safeLoad({next:this.#o(this.state.location)})}))}const{basepath:e,routeTree:r}=this.options;return this.basepath=`/${L(e??"")??""}`,r&&r!==this.routeTree&&this.#n(r),this};buildNext=t=>{const e=this.#a(t),r=this.matchRoutes(e.pathname,e.search);return this.#a({...t,__matches:r})};cancelMatches=()=>{this.state.matches.forEach((t=>{this.cancelMatch(t.id)}))};cancelMatch=t=>{this.getRouteMatch(t)?.abortController?.abort()};safeLoad=async t=>{try{return this.load(t)}catch(t){}};latestLoadPromise=Promise.resolve();load=async t=>{const e=new Promise((async(r,s)=>{const o=this.state.resolvedLocation,n=!(!t?.next||o.href===t.next.href);let a;const i=()=>this.latestLoadPromise!==e?this.latestLoadPromise:void 0;let c;this.#r({type:"onBeforeLoad",from:o,to:t?.next??this.state.location,pathChanged:n}),this.__store.batch((()=>{t?.next&&this.__store.setState((e=>({...e,location:t.next}))),c=this.matchRoutes(this.state.location.pathname,this.state.location.search,{throwOnError:t?.throwOnError,debug:!0}),this.__store.setState((t=>({...t,status:"pending",pendingMatchIds:c.map((t=>t.id)),matchesById:this.#i(t.matchesById,c)})))}));try{try{await this.loadMatches(c)}catch(t){}if(a=i())return a;const t=this.state.matchIds.filter((t=>!this.state.pendingMatchIds.includes(t))),e=this.state.pendingMatchIds.filter((t=>!this.state.matchIds.includes(t))),s=this.state.matchIds.filter((t=>this.state.pendingMatchIds.includes(t)));this.__store.setState((t=>({...t,status:"idle",resolvedLocation:t.location,matchIds:t.pendingMatchIds,pendingMatchIds:[]}))),[[t,"onLeave"],[e,"onEnter"],[s,"onTransition"]].forEach((([t,e])=>{t.forEach((t=>{const r=this.getRouteMatch(t);this.getRoute(r.routeId).options[e]?.(r)}))})),this.#r({type:"onLoad",from:o,to:this.state.location,pathChanged:n}),r()}catch(t){if(a=i())return a;s(t)}}));return this.latestLoadPromise=e,this.latestLoadPromise.then((()=>{this.cleanMatches()})),this.latestLoadPromise};#i=(t,e)=>{const r={...t};let s=!1;return e.forEach((t=>{r[t.id]||(s=!0,r[t.id]=t)})),s?r:t};getRoute=t=>{const e=this.routesById[t];return c(e),e};preloadRoute=async(t=this.state.location)=>{const e=this.buildNext(t),r=this.matchRoutes(e.pathname,e.search,{throwOnError:!0});return this.__store.setState((t=>({...t,matchesById:this.#i(t.matchesById,r)}))),await this.loadMatches(r,{preload:!0,maxAge:t.maxAge}),r};cleanMatches=()=>{const t=Date.now(),e=Object.values(this.state.matchesById).filter((e=>{const r=this.getRoute(e.routeId);return!(this.state.matchIds.includes(e.id)||this.state.pendingMatchIds.includes(e.id)||e.preloadMaxAge>-1&&!(e.updatedAt+e.preloadMaxAge<t)||r.options.gcMaxAge&&!(e.updatedAt+r.options.gcMaxAge<t))})).map((t=>t.id));e.length&&this.__store.setState((t=>{const r={...t.matchesById};return e.forEach((t=>{delete r[t]})),{...t,matchesById:r}}))};matchRoutes=(t,e,r)=>{let s={},o=this.flatRoutes.find((e=>{const r=D(this.basepath,C(t),{to:e.fullPath,caseSensitive:e.options.caseSensitive??this.options.caseSensitive});return!!r&&(s=r,!0)}))||this.routesById.__root__,n=[o];for(;o?.parentRoute;)o=o.parentRoute,o&&n.unshift(o);const a=n.map((t=>{let e;if(t.options.parseParams)try{const e=t.options.parseParams(s);Object.assign(s,e)}catch(t){if(e=new tt(t.message,{cause:t}),r?.throwOnError)throw e;return e}})),i=n.map(((t,r)=>{const o=j(t.path,s),n=t.options.key?t.options.key({params:s,search:e})??"":"",i=n?JSON.stringify(n):"",c=j(t.id,s,!0)+i,h=this.getRouteMatch(c);if(h)return{...h};const u=!(!t.options.loader&&!J.some((e=>t.options[e]?.preload)));return{id:c,key:i,routeId:t.id,params:s,pathname:I([this.basepath,o]),updatedAt:Date.now(),maxAge:-1,preloadMaxAge:-1,routeSearch:{},search:{},status:u?"pending":"success",isFetching:!1,invalid:!1,error:void 0,paramsError:a[r],searchError:void 0,loaderData:void 0,loadPromise:Promise.resolve(),routeContext:void 0,context:void 0,abortController:new AbortController,fetchedAt:0}}));return i.forEach(((t,s)=>{const o=i[s-1],n=this.getRoute(t.routeId),a=(()=>{const s={search:o?.search??e,routeSearch:o?.routeSearch??e};try{const e=("object"==typeof n.options.validateSearch?n.options.validateSearch.parse:n.options.validateSearch)?.(s.search)??{},r={...s.search,...e};return{routeSearch:x(t.routeSearch,e),search:x(t.search,r)}}catch(e){if(t.searchError=new Z(e.message,{cause:e}),r?.throwOnError)throw t.searchError;return s}})();Object.assign(t,a)})),i};loadMatches=async(t,e)=>{const r=()=>t.map((t=>this.getRouteMatch(t.id)));let s;e?.preload||r().forEach((t=>{this.setRouteMatch(t.id,(e=>({...e,routeSearch:t.routeSearch,search:t.search,routeContext:t.routeContext,context:t.context,error:t.error,paramsError:t.paramsError,searchError:t.searchError,params:t.params,preloadMaxAge:0})))}));try{for(const[t,o]of r().entries()){const n=r()[t-1],a=this.getRoute(o.routeId),i=(e,r)=>{if(e.routerCode=r,s=s??t,Q(e))throw e;try{a.options.onError?.(e)}catch(t){if(e=t,Q(t))throw t}this.setRouteMatch(o.id,(t=>({...t,error:e,status:"error",updatedAt:Date.now()})))};o.paramsError&&i(o.paramsError,"PARSE_PARAMS"),o.searchError&&i(o.searchError,"VALIDATE_SEARCH");let c=!1;try{const t=await(a.options.beforeLoad?.({...o,preload:!!e?.preload,parentContext:n?.routeContext??{},context:n?.context??this?.options.context??{}}))??{},r={...n?.context??this?.options.context,...t};this.setRouteMatch(o.id,(e=>({...e,context:r,routeContext:t})))}catch(t){i(t,"BEFORE_LOAD"),c=!0}if(c)break}}catch(t){throw e?.preload||this.navigate(t),t}const o=r().slice(0,s),n=[];o.forEach(((t,r)=>{n.push((async()=>{const s=n[r-1],o=this.getRoute(t.routeId);if(t.isFetching||"success"===t.status&&!et(t,{preload:e?.preload}))return this.getRouteMatch(t.id)?.loadPromise;const a=Date.now(),i=()=>{const e=this.getRouteMatch(t.id);return e&&e.fetchedAt!==a?e.loadPromise:void 0},c=t=>!!Q(t)&&(e?.preload||this.navigate(t),!0),h=async()=>{let r;try{const n=Promise.all(J.map((async t=>{const e=o.options[t];e?.preload&&await e.preload()}))),a=o.options.loader?.({...t,preload:!!e?.preload,parentMatchPromise:s}),[c,h]=await Promise.all([n,a]);if(r=i())return await r;this.setRouteMatchData(t.id,(()=>h),e)}catch(e){if(r=i())return await r;if(c(e))return;try{o.options.onError?.(e)}catch(t){if(e=t,c(t))return}this.setRouteMatch(t.id,(t=>({...t,error:e,status:"error",isFetching:!1,updatedAt:Date.now()})))}};let u;this.__store.batch((()=>{this.setRouteMatch(t.id,(t=>({...t,isFetching:!0,fetchedAt:a,invalid:!1}))),u=h(),this.setRouteMatch(t.id,(t=>({...t,loadPromise:u})))})),await u})())})),await Promise.all(n)};resolvePath=(t,e)=>A(this.basepath,t,P(e));navigate=async({from:t,to:e="",search:r,hash:s,replace:o,params:n,resetScroll:a})=>{const i=String(e),h=void 0===t?t:String(t);let u;try{new URL(`${i}`),u=!0}catch(t){}return c(!u),this.#e({from:h,to:i,search:r,hash:s,replace:o,params:n,resetScroll:a})};matchRoute=(t,e)=>{t={...t,to:t.to?this.resolvePath(t.from??"",t.to):void 0};const r=this.buildNext(t);if(e?.pending&&"pending"!==this.state.status)return!1;const s=e?.pending?this.state.location:this.state.resolvedLocation;if(!s)return!1;const o=D(this.basepath,s.pathname,{...e,to:r.pathname});return!!o&&(e?.includeSearch??1?!!_(s.search,r.search)&&o:o)};buildLink=({from:t,to:e=".",search:r,params:s,hash:o,target:n,replace:a,activeOptions:i,preload:c,preloadDelay:h,disabled:u,state:l,resetScroll:d})=>{try{return new URL(`${e}`),{type:"external",href:e}}catch(t){}const p={from:t,to:e,search:r,params:s,hash:o,replace:a,state:l,resetScroll:d},f=this.buildNext(p);c=c??this.options.defaultPreload;const m=h??this.options.defaultPreloadDelay??0,y=this.state.location.pathname.split("/"),g=f.pathname.split("/").every(((t,e)=>t===y[e])),w=i?.exact?this.state.location.pathname===f.pathname:g,v=!i?.includeHash||this.state.location.hash===f.hash,b=!(i?.includeSearch??1)||_(this.state.location.search,f.search);return{type:"internal",next:f,handleFocus:t=>{c&&this.preloadRoute(p).catch((t=>{console.warn(t),console.warn(X)}))},handleClick:t=>{u||function(t){return!!(t.metaKey||t.altKey||t.ctrlKey||t.shiftKey)}(t)||t.defaultPrevented||n&&"_self"!==n||0!==t.button||(t.preventDefault(),this.#e(p))},handleEnter:t=>{const e=t.target||{};if(c){if(e.preloadTimeout)return;e.preloadTimeout=setTimeout((()=>{e.preloadTimeout=null,this.preloadRoute(p).catch((t=>{console.warn(t),console.warn(X)}))}),m)}},handleLeave:t=>{const e=t.target||{};e.preloadTimeout&&(clearTimeout(e.preloadTimeout),e.preloadTimeout=null)},handleTouchStart:t=>{this.preloadRoute(p).catch((t=>{console.warn(t),console.warn(X)}))},isActive:w&&v&&b,disabled:u}};dehydrate=()=>({state:{matchIds:this.state.matchIds,dehydratedMatches:this.state.matches.map((t=>S(t,["fetchedAt","invalid","preloadMaxAge","maxAge","id","loaderData","status","updatedAt"])))}});hydrate=async t=>{let e=t;"undefined"!=typeof document&&(e=window.__TSR_DEHYDRATED__),c(e);const r=e;this.dehydratedData=r.payload,this.options.hydrate?.(r.payload);const s=r.router.state;let o=this.matchRoutes(this.state.location.pathname,this.state.location.search).map((t=>{const e=s.dehydratedMatches.find((e=>e.id===t.id));return c(e,t.id),e?{...t,...e}:t}));this.__store.setState((t=>({...t,matchIds:s.matchIds,matches:o,matchesById:this.#i(t.matchesById,o)})))};injectedHtml=[];injectHtml=async t=>{this.injectedHtml.push(t)};dehydrateData=(t,e)=>{if("undefined"==typeof document){const r="string"==typeof t?t:JSON.stringify(t);return this.injectHtml((async()=>{const t=`__TSR_DEHYDRATED__${r}`,s="function"==typeof e?await e():e;return`<script id='${t}' suppressHydrationWarning>window["__TSR_DEHYDRATED__${o=r,o.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(/"/g,'\\"')}"] = ${JSON.stringify(s)}\n ;(() => {\n var el = document.getElementById('${t}')\n el.parentElement.removeChild(el)\n })()\n <\/script>`;var o})),()=>this.hydrateData(t)}return()=>{}};hydrateData=t=>{if("undefined"!=typeof document){const e="string"==typeof t?t:JSON.stringify(t);return window[`__TSR_DEHYDRATED__${e}`]}};#n=t=>{this.routeTree=t,this.routesById={},this.routesByPath={},this.flatRoutes=[];const e=t=>{t.forEach(((t,r)=>{t.init({originalIndex:r,router:this});if(c(!this.routesById[t.id],String(t.id)),this.routesById[t.id]=t,!t.isRoot&&t.path){const e=C(t.fullPath);this.routesByPath[e]&&!t.fullPath.endsWith("/")||(this.routesByPath[e]=t)}const s=t.children;s?.length&&e(s)}))};e([t]),this.flatRoutes=Object.values(this.routesByPath).map(((t,e)=>{const r=L(t.fullPath),s=O(r);for(;s.length>1&&"/"===s[0]?.value;)s.shift();const o=s.map((t=>"param"===t.type?.5:"wildcard"===t.type?.25:1));return{child:t,trimmed:r,parsed:s,index:e,score:o}})).sort(((t,e)=>{let r="/"===t.trimmed?1:"/"===e.trimmed?-1:0;if(0!==r)return r;const s=Math.min(t.score.length,e.score.length);if(t.score.length!==e.score.length)return e.score.length-t.score.length;for(let r=0;r<s;r++)if(t.score[r]!==e.score[r])return e.score[r]-t.score[r];for(let r=0;r<s;r++)if(t.parsed[r].value!==e.parsed[r].value)return t.parsed[r].value>e.parsed[r].value?1:-1;return t.trimmed!==e.trimmed?t.trimmed>e.trimmed?1:-1:t.index-e.index})).map(((t,e)=>(t.child.rank=e,t.child)))};#o=t=>{let{pathname:e,search:r,hash:s,state:o}=this.history.location;const n=this.options.parseSearch(r);return{pathname:e,searchStr:r,search:x(t?.search,n),hash:s.split("#").reverse()[0]??"",href:`${e}${r}${s}`,state:o,key:o?.key||"__init__"}};#a=(t={})=>{t.fromCurrent=t.fromCurrent??""===t.to;const e=t.fromCurrent?this.state.location.pathname:t.from??this.state.location.pathname;let r=A(this.basepath??"/",e,`${t.to??""}`);const s={...v(this.matchRoutes(this.state.location.pathname,this.state.location.search))?.params};let o=!0===(t.params??!0)?s:b(t.params,s);o&&t.__matches?.map((t=>this.getRoute(t.routeId).options.stringifyParams)).filter(Boolean).forEach((t=>{o={...o,...t(o)}})),r=j(r,o??{});const n=t.__matches?.map((t=>this.getRoute(t.routeId).options.preSearchFilters??[])).flat().filter(Boolean)??[],a=t.__matches?.map((t=>this.getRoute(t.routeId).options.postSearchFilters??[])).flat().filter(Boolean)??[],i=n?.length?n?.reduce(((t,e)=>e(t)),this.state.location.search):this.state.location.search,c=!0===t.search?i:t.search?b(t.search,i)??{}:n?.length?i:{},h=a?.length?a.reduce(((t,e)=>e(t)),c):c,u=x(this.state.location.search,h),l=this.options.stringifySearch(u),d=!0===t.hash?this.state.location.hash:b(t.hash,this.state.location.hash),p=d?`#${d}`:"";return{pathname:r,search:u,searchStr:l,state:!0===t.state?this.state.location.state:b(t.state,this.state.location.state),hash:d,href:this.history.createHref(`${r}${l}${p}`),key:t.key}};#e=async t=>{const e=this.buildNext(t),r=""+Date.now()+Math.random();this.navigateTimeout&&clearTimeout(this.navigateTimeout);let s="replace";t.replace||(s="push");this.state.location.href===e.href&&!e.key&&(s="replace");const o=`${e.pathname}${e.searchStr}${e.hash?`#${e.hash}`:""}`;return this.history["push"===s?"push":"replace"](o,{id:r,...e.state}),this.resetNextScroll=t.resetScroll??!0,this.latestLoadPromise};getRouteMatch=t=>this.state.matchesById[t];setRouteMatch=(t,e)=>{this.__store.setState((r=>(r.matchesById[t]||console.warn(`No match found with id: ${t}`),{...r,matchesById:{...r.matchesById,[t]:e(r.matchesById[t])}})))};setRouteMatchData=(t,e,r)=>{const s=this.getRouteMatch(t);if(!s)return;const o=this.getRoute(s.routeId),n=r?.updatedAt??Date.now(),a=r?.maxAge??o.options.preloadMaxAge??this.options.defaultPreloadMaxAge??5e3,i=r?.maxAge??o.options.maxAge??this.options.defaultMaxAge??-1;this.setRouteMatch(t,(t=>({...t,error:void 0,status:"success",isFetching:!1,updatedAt:n,loaderData:b(e,t.loaderData),preloadMaxAge:a,maxAge:i})))};invalidate=async t=>{if(t?.matchId){this.setRouteMatch(t.matchId,(t=>({...t,invalid:!0})));const e=this.state.matches.findIndex((e=>e.id===t.matchId)),r=this.state.matches[e+1];if(r)return this.invalidate({matchId:r.id,reload:!1})}else this.__store.batch((()=>{Object.values(this.state.matchesById).forEach((t=>{this.setRouteMatch(t.id,(t=>({...t,invalid:!0})))}))}));if(t?.reload??1)return this.navigate({fromCurrent:!0,replace:!0,search:!0})}},t.RouterContext=class{constructor(){}createRootRoute=t=>new F(t)},t.RouterProvider=function({router:t,...e}){t.update(e),o.useEffect((()=>{let e;return o.startTransition((()=>{e=t.mount()})),e}),[t]);const r=t.options.Wrap||o.Fragment;return o.createElement(r,null,o.createElement(yt.Provider,{value:t},o.createElement(wt,null)))},t.ScrollRestoration=function(t){return kt(t),null},t.SearchParamError=Z,t.cleanPath=P,t.componentTypes=J,t.createBrowserHistory=m,t.createHashHistory=function(){return m({getHref:()=>window.location.hash.substring(1),createHref:t=>`#${t}`})},t.createMemoryHistory=y,t.decode=$,t.defaultParseSearch=W,t.defaultStringifySearch=z,t.defer=function(t){const e=t;if(!e.__deferredState){e.__deferredState={uid:Math.random().toString(36).slice(2),status:"pending"};const t=e.__deferredState;e.then((e=>{t.status="success",t.data=e})).catch((e=>{t.status="error",t.error=e}))}return e},t.encode=B,t.functionalUpdate=b,t.interpolatePath=j,t.invariant=c,t.isDehydratedDeferred=lt,t.isMatchInvalid=et,t.isPlainObject=R,t.isRedirect=Q,t.joinPaths=I,t.last=v,t.lazyFn=function(t,e){return async(...r)=>(await t())[e||"default"](...r)},t.lazyRouteComponent=function(t,e){let r;const s=()=>(r||(r=t()),r),n=o.lazy((async()=>({default:(await s())[e??"default"]})));return n.preload=s,n},t.matchByPath=k,t.matchIdsContext=mt,t.matchPathname=D,t.parsePathname=O,t.parseSearchWith=U,t.partialDeepEqual=_,t.pick=S,t.redirect=function(t){return t.isRedirect=!0,t},t.replaceEqualDeep=x,t.resolvePath=A,t.restoreScrollPositions=ut,t.rootRouteId=H,t.routerContext=yt,t.shallow=function(t,e){if(Object.is(t,e))return!0;if("object"!=typeof t||null===t||"object"!=typeof e||null===e)return!1;const r=Object.keys(t);if(r.length!==Object.keys(e).length)return!1;for(let s=0;s<r.length;s++)if(!Object.prototype.hasOwnProperty.call(e,r[s])||!Object.is(t[r[s]],e[r[s]]))return!1;return!0},t.stringifySearchWith=Y,t.trimPath=L,t.trimPathLeft=M,t.trimPathRight=C,t.useAwaited=Bt,t.useBlocker=jt,t.useDehydrate=function(){const t=vt();return o.useCallback((function(e,r){return t.dehydrateData(e,r)}),[])},t.useHydrate=function(){const t=vt();return function(e){return t.hydrateData(e)}},t.useInjectHtml=function(){const t=vt();return o.useCallback((e=>{t.injectHtml(e)}),[])},t.useLinkProps=pt,t.useLoader=St,t.useMatch=bt,t.useMatchRoute=Et,t.useMatches=function(t){const e=o.useContext(mt);return gt({select:r=>{const s=r.matches.slice(r.matches.findIndex((t=>t.id===e[0])));return t?.select?t.select(s):s}})},t.useNavigate=function(t){const e=vt();return o.useCallback((r=>e.navigate({...t,...r})),[])},t.useParams=Rt,t.useRouteContext=function(t){return bt({...t,select:e=>t?.select?t.select(e.routeContext):e.routeContext})},t.useRouter=vt,t.useRouterContext=function(t){return bt({...t,select:e=>t?.select?t.select(e.context):e.context})},t.useRouterState=gt,t.useScrollRestoration=kt,t.useSearch=xt,t.useStore=a,t.warning=function(t,e){},t.watchScrollPositions=ht,Object.defineProperty(t,"__esModule",{value:!0})}));
22
43
  //# sourceMappingURL=index.production.js.map