@tanstack/react-router 0.0.1-beta.22 → 0.0.1-beta.220

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.
Files changed (108) hide show
  1. package/LICENSE +21 -0
  2. package/build/cjs/CatchBoundary.js +126 -0
  3. package/build/cjs/CatchBoundary.js.map +1 -0
  4. package/build/cjs/Matches.js +235 -0
  5. package/build/cjs/Matches.js.map +1 -0
  6. package/build/cjs/RouterProvider.js +1085 -0
  7. package/build/cjs/RouterProvider.js.map +1 -0
  8. package/build/cjs/_virtual/_rollupPluginBabelHelpers.js +1 -19
  9. package/build/cjs/_virtual/_rollupPluginBabelHelpers.js.map +1 -1
  10. package/build/cjs/awaited.js +45 -0
  11. package/build/cjs/awaited.js.map +1 -0
  12. package/build/cjs/defer.js +39 -0
  13. package/build/cjs/defer.js.map +1 -0
  14. package/build/cjs/fileRoute.js +29 -0
  15. package/build/cjs/fileRoute.js.map +1 -0
  16. package/build/cjs/index.js +135 -0
  17. package/build/cjs/index.js.map +1 -0
  18. package/build/cjs/lazyRouteComponent.js +57 -0
  19. package/build/cjs/lazyRouteComponent.js.map +1 -0
  20. package/build/cjs/link.js +151 -0
  21. package/build/cjs/link.js.map +1 -0
  22. package/build/cjs/path.js +211 -0
  23. package/build/cjs/path.js.map +1 -0
  24. package/build/cjs/qss.js +65 -0
  25. package/build/cjs/qss.js.map +1 -0
  26. package/build/cjs/redirects.js +27 -0
  27. package/build/cjs/redirects.js.map +1 -0
  28. package/build/cjs/route.js +139 -0
  29. package/build/cjs/route.js.map +1 -0
  30. package/build/cjs/router.js +160 -0
  31. package/build/cjs/router.js.map +1 -0
  32. package/build/cjs/scroll-restoration.js +186 -0
  33. package/build/cjs/scroll-restoration.js.map +1 -0
  34. package/build/cjs/searchParams.js +83 -0
  35. package/build/cjs/searchParams.js.map +1 -0
  36. package/build/cjs/useBlocker.js +64 -0
  37. package/build/cjs/useBlocker.js.map +1 -0
  38. package/build/cjs/useNavigate.js +78 -0
  39. package/build/cjs/useNavigate.js.map +1 -0
  40. package/build/cjs/useParams.js +28 -0
  41. package/build/cjs/useParams.js.map +1 -0
  42. package/build/cjs/useSearch.js +27 -0
  43. package/build/cjs/useSearch.js.map +1 -0
  44. package/build/cjs/utils.js +236 -0
  45. package/build/cjs/utils.js.map +1 -0
  46. package/build/esm/index.js +2136 -2564
  47. package/build/esm/index.js.map +1 -1
  48. package/build/stats-html.html +59 -49
  49. package/build/stats-react.json +922 -43
  50. package/build/types/CatchBoundary.d.ts +33 -0
  51. package/build/types/Matches.d.ts +34 -0
  52. package/build/types/RouterProvider.d.ts +87 -0
  53. package/build/types/awaited.d.ts +8 -0
  54. package/build/types/defer.d.ts +19 -0
  55. package/build/types/fileRoute.d.ts +32 -0
  56. package/build/types/history.d.ts +7 -0
  57. package/build/types/index.d.ts +27 -104
  58. package/build/types/injectHtml.d.ts +0 -0
  59. package/build/types/lazyRouteComponent.d.ts +2 -0
  60. package/build/types/link.d.ts +105 -0
  61. package/build/types/location.d.ts +14 -0
  62. package/build/types/path.d.ts +16 -0
  63. package/build/types/qss.d.ts +2 -0
  64. package/build/types/redirects.d.ts +10 -0
  65. package/build/types/route.d.ts +270 -0
  66. package/build/types/routeInfo.d.ts +22 -0
  67. package/build/types/router.d.ts +123 -0
  68. package/build/types/scroll-restoration.d.ts +6 -0
  69. package/build/types/searchParams.d.ts +7 -0
  70. package/build/types/useBlocker.d.ts +8 -0
  71. package/build/types/useNavigate.d.ts +20 -0
  72. package/build/types/useParams.d.ts +7 -0
  73. package/build/types/useSearch.d.ts +7 -0
  74. package/build/types/utils.d.ts +66 -0
  75. package/build/umd/index.development.js +2399 -2484
  76. package/build/umd/index.development.js.map +1 -1
  77. package/build/umd/index.production.js +4 -4
  78. package/build/umd/index.production.js.map +1 -1
  79. package/package.json +9 -10
  80. package/src/CatchBoundary.tsx +98 -0
  81. package/src/Matches.tsx +345 -0
  82. package/src/RouterProvider.tsx +1575 -0
  83. package/src/awaited.tsx +40 -0
  84. package/src/defer.ts +55 -0
  85. package/src/fileRoute.ts +153 -0
  86. package/src/history.ts +8 -0
  87. package/src/index.tsx +28 -693
  88. package/src/injectHtml.ts +28 -0
  89. package/src/lazyRouteComponent.tsx +33 -0
  90. package/src/link.tsx +508 -0
  91. package/src/location.ts +15 -0
  92. package/src/path.ts +256 -0
  93. package/src/qss.ts +53 -0
  94. package/src/redirects.ts +31 -0
  95. package/src/route.ts +837 -0
  96. package/src/routeInfo.ts +68 -0
  97. package/src/router.ts +330 -0
  98. package/src/scroll-restoration.tsx +192 -0
  99. package/src/searchParams.ts +79 -0
  100. package/src/useBlocker.tsx +34 -0
  101. package/src/useNavigate.tsx +109 -0
  102. package/src/useParams.tsx +25 -0
  103. package/src/useSearch.tsx +25 -0
  104. package/src/utils.ts +350 -0
  105. package/build/cjs/react-router/src/index.js +0 -466
  106. package/build/cjs/react-router/src/index.js.map +0 -1
  107. package/build/cjs/router-core/build/esm/index.js +0 -2523
  108. package/build/cjs/router-core/build/esm/index.js.map +0 -1
@@ -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")):"function"==typeof define&&define.amd?define(["exports","react","use-sync-external-store/shim"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).ReactRouter={},t.React,t.shim)}(this,(function(t,e,n){"use strict";function a(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 o,r=a(e);function i(){return i=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},i.apply(this,arguments)}function s(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(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("react")):"function"==typeof define&&define.amd?define(["exports","react"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).ReactRouter={},e.React)}(this,(function(e,t){"use strict";function r(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(r){if("default"!==r){var n=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,n.get?n:{enumerable:!0,get:function(){return e[r]}})}})),t.default=e,Object.freeze(t)}var n=r(t);
12
12
  /**
13
- * router-core
13
+ * @tanstack/history/src/index.ts
14
14
  *
15
15
  * Copyright (c) TanStack
16
16
  *
@@ -18,5 +18,5 @@
18
18
  * LICENSE.md file in the root directory of this source tree.
19
19
  *
20
20
  * @license MIT
21
- */function l(){return l=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},l.apply(this,arguments)}!function(t){t.Pop="POP",t.Push="PUSH",t.Replace="REPLACE"}(o||(o={}));var c="beforeunload",u="popstate";function h(t){void 0===t&&(t={});var e=t.window,n=void 0===e?document.defaultView:e,a=n.history;function r(){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(u,(function(){if(i)b.call(i),i=null;else{var t=o.Pop,e=r(),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 x(t)}}));var s=o.Pop,h=r(),d=h[0],f=h[1],_=m(),b=m();function P(t){return"string"==typeof t?t:g(t)}function w(t,e){return void 0===e&&(e=null),l({pathname:f.pathname,hash:"",search:""},"string"==typeof t?y(t):t,{state:e,key:v()})}function R(t,e){return[{usr:t.state,key:t.key,idx:e},P(t)]}function E(t,e,n){return!b.length||(b.call({action:t,location:e,retry:n}),!1)}function x(t){s=t;var e=r();d=e[0],f=e[1],_.call({action:s,location:f})}function S(t){a.go(t)}null==d&&(d=0,a.replaceState(l({},a.state,{idx:d}),""));var M={get action(){return s},get location(){return f},createHref:P,push:function t(e,r){var i=o.Push,s=w(e,r);if(E(i,s,(function(){t(e,r)}))){var l=R(s,d+1),c=l[0],u=l[1];try{a.pushState(c,"",u)}catch(t){n.location.assign(u)}x(i)}},replace:function t(e,n){var r=o.Replace,i=w(e,n);if(E(r,i,(function(){t(e,n)}))){var s=R(i,d),l=s[0],c=s[1];a.replaceState(l,"",c),x(r)}},go:S,back:function(){S(-1)},forward:function(){S(1)},listen:function(t){return _.push(t)},block:function(t){var e=b.push(t);return 1===b.length&&n.addEventListener(c,p),function(){e(),b.length||n.removeEventListener(c,p)}}};return M}function d(t){void 0===t&&(t={});var e=t,n=e.initialEntries,a=void 0===n?["/"]:n,r=e.initialIndex,i=a.map((function(t){return l({pathname:"/",search:"",hash:"",state:null,key:v()},"string"==typeof t?y(t):t)})),s=f(null==r?i.length-1:r,0,i.length-1),c=o.Pop,u=i[s],h=m(),d=m();function p(t,e){return void 0===e&&(e=null),l({pathname:u.pathname,search:"",hash:""},"string"==typeof t?y(t):t,{state:e,key:v()})}function _(t,e,n){return!d.length||(d.call({action:t,location:e,retry:n}),!1)}function b(t,e){c=t,u=e,h.call({action:c,location:u})}function P(t){var e=f(s+t,0,i.length-1),n=o.Pop,a=i[e];_(n,a,(function(){P(t)}))&&(s=e,b(n,a))}var w={get index(){return s},get action(){return c},get location(){return u},createHref:function(t){return"string"==typeof t?t:g(t)},push:function t(e,n){var a=o.Push,r=p(e,n);_(a,r,(function(){t(e,n)}))&&(s+=1,i.splice(s,i.length,r),b(a,r))},replace:function t(e,n){var a=o.Replace,r=p(e,n);_(a,r,(function(){t(e,n)}))&&(i[s]=r,b(a,r))},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 p(t){t.preventDefault(),t.returnValue=""}function m(){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 v(){return Math.random().toString(36).substr(2,8)}function g(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 y(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 _(t,e){if(!t)throw new Error("Invariant failed")}function b(t,e){if(t===e)return t;const n=Array.isArray(t)&&Array.isArray(e);if(n||P(t)&&P(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]=b(t[r],e[r]),i[r]===t[r]&&s++}return a===r&&s===a?t:i}return e}function P(t){if(!w(t))return!1;const e=t.constructor;if(void 0===e)return!0;const n=e.prototype;return!!w(n)&&!!n.hasOwnProperty("isPrototypeOf")}function w(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 x(t,e){return"function"==typeof t?t(e):t}function S(t,e){return e.reduce(((e,n)=>(e[n]=t[n],e)),{})}function M(t){return I(t.filter(Boolean).join("/"))}function I(t){return t.replace(/\/{2,}/g,"/")}function A(t){return"/"===t?t:t.replace(/^\/{1,}/,"")}function L(t){return"/"===t?t:t.replace(/\/{1,}$/,"")}function C(t){return L(A(t))}function k(t,e,n){e=e.replace(new RegExp("^"+t),"/"),n=n.replace(new RegExp("^"+t),"/");let a=O(e);const o=O(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 I(M([t,...a.map((t=>t.value))]))}function O(t){if(!t)return[];const e=[];if("/"===(t=I(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 M(O(t).map((t=>{return"*"!==t.value||n?"param"===t.type?null!=(a=e[t.value.substring(1)])?a:"":t.value:"";var a})))}function j(t,e){const n=F(t,e);if(!e.to||n)return null!=n?n:{}}function F(t,e){var n;const a=O(t),o=O(""+(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["*"]=M(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 T(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 N(t){if(!t)return"";var e=decodeURIComponent(t);return"false"!==e&&("true"===e||("0"===e.charAt(0)?e:0*+e==0?+e:e))}function B(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],N(e.shift())):a[n]=N(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 z="__root__",G=["component","errorComponent","pendingComponent"];function W(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=b(t,null!=(r=null==e?void 0:e(o))?r:{});t!==n&&(a.isInvalid=!0),a.routeSearch=n,a.search=b(o,U({},o,n)),G.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&&!G.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();a.__.latestId=n;const o=async()=>{if(n!==a.__.latestId)return new Promise((()=>{}))};"idle"===a.status&&(a.status="loading"),a.isInvalid=!1,a.__.loadPromise=new Promise((async n=>{a.isFetching=!0,a.__.resolve=n,a.__.componentsPromise=(async()=>{await Promise.all(G.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 n,r,i;if(a.options.loader){const e=await t.loadMatchData(a);await o(),a.routeLoaderData=b(a.routeLoaderData,e)}return a.error=void 0,a.status="success",a.updatedAt=Date.now(),a.invalidAt=a.updatedAt+(null!=(n=null!=(r=null!=(i=null==e?void 0:e.maxAge)?i:a.options.loaderMaxAge)?r:t.options.defaultLoaderMaxAge)?n:0),a.routeLoaderData}catch(t){throw await o(),a.error=t,a.status="error",a.updatedAt=Date.now(),t}}));const r=async()=>{await o(),a.isFetching=!1,delete a.__.loadPromise,a.__.notify()};try{await Promise.all([a.__.componentsPromise,a.__.dataPromise.catch((()=>{}))]),r()}catch(t){r()}})),await a.__.loadPromise,await o()}});return a.hasLoaders()||(a.status="success"),a}const q=V(JSON.parse),K=J(JSON.stringify);function V(t){return e=>{"?"===e.substring(0,1)&&(e=e.substring(1));let n=B(e);for(let e in n){const a=n[e];if("string"==typeof a)try{n[e]=t(a)}catch(t){}}return n}}function J(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=T(e).toString();return n?"?"+n:""}}var X;const $="undefined"==typeof window||!(null!=(X=window.document)&&X.createElement);function Q(){return{status:"idle",location:null,matches:[],actions:{},loaders:{},lastUpdated:Date.now(),isFetching:!1,isPreloading:!1}}function Y(t){var e,n;const a=(null==t?void 0:t.history)||($?d():h()),o=U({defaultLoaderGcMaxAge:3e5,defaultLoaderMaxAge:0,defaultPreloadMaxAge:2e3,defaultPreloadDelay:50},t,{stringifySearch:null!=(e=null==t?void 0:t.stringifySearch)?e:K,parseSearch:null!=(n=null==t?void 0:t.parseSearch)?n:q});let r={types:void 0,history:a,options:o,listeners:[],basepath:"",routeTree:void 0,routesById:{},location:void 0,navigationPromise:Promise.resolve(),resolveNavigation:()=>{},matchCache:{},state:Q(),reset:()=>{r.state=Q(),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})),Z(r.state.matches),r.listeners.forEach((t=>t(r)))},dehydrateState:()=>U({},S(r.state,["status","location","lastUpdated"]),{matches:r.state.matches.map((t=>S(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];_(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!$&&window.addEventListener&&(window.addEventListener("visibilitychange",r.onFocus,!1),window.addEventListener("focus",r.onFocus,!1)),()=>{e(),!$&&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=I("/"+(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 f=[];const p=(n,a)=>(a.some((a=>{var o,i,s;if(!a.routePath&&null!=(o=a.childRoutes)&&o.length)return p([...f,a],a.childRoutes);const l=!!("/"!==a.routePath||null!=(i=a.childRoutes)&&i.length),c=j(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&&(f=[...n,a]),!!f.length})),!!f.length);if(p([],d),!f.length)return;f.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)||W(r,e,{parentMatch:u,matchId:s,params:h,pathname:M([t,a])});o.push(l)}));const m=R(f);null!=(c=m.childRoutes)&&c.length&&s(m.childRoutes)};return s([r.routeTree]),Z(o),o},loadMatches:async(t,e)=>{const n=t.map((async t=>{t.__.validate(),t.load(e);const n=t.search;n.__data&&n.__data.matchId!==t.matchId||t.__.loadPromise&&await t.__.loadPromise}));r.notify(),await Promise.all(n)},loadMatchData:async t=>{var e;if($||!r.options.useServerData)return null!=(e=await(null==t.options.loader?void 0:t.options.loader({params:t.params,search:t.routeSearch,signal:t.__.abortController.signal})))?e:{};{const e=r.buildNext({to:".",search:e=>U({},null!=e?e:{},{__data:{matchId:t.matchId}})}),n=await fetch(e.href,{method:"GET"});if(n.ok)return n.json();throw new Error("Failed to fetch match data")}},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)=>k(r.basepath,t,I(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)&&!!j(r.state.pending.location.pathname,U({},e,{to:a.pathname})):!!j(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 _(!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:f,preloadGcMaxAge:p,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])),R=r.state.location.hash===y.hash,E=null!=h&&h.exact?b:w,x=null==h||!h.includeHash||R;return{type:"internal",next:y,handleFocus:t=>{d&&r.preloadRoute(g,{maxAge:f,gcMaxAge:p})},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:f,gcMaxAge:p})}),_)}},handleLeave:t=>{const e=t.target||{};e.preloadTimeout&&(clearTimeout(e.preloadTimeout),e.preloadTimeout=null)},isActive:E&&x,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:b(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=k(null!=(n=r.basepath)?n:"/",h,""+(null!=(a=t.to)?a:"."));const f=r.matchRoutes(r.location.pathname,{strictParseParams:!0}),p=r.matchRoutes(d),m=U({},null==(o=R(f))?void 0:o.params);let v=!0===(null==(i=t.params)||i)?m:x(t.params,m);v&&p.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=x(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,P=b(r.location.search,_),w=r.options.stringifySearch(P);let E=!0===t.hash?r.location.hash:x(t.hash,r.location.hash);return E=E?"#"+E:"",{pathname:d,search:P,searchStr:w,state:r.location.state,hash:E,href:""+d+w+E,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 Z(t){t.forEach(((e,n)=>{const a=t[n-1];a&&(e.loaderData=b(e.loaderData,U({},a.loaderData,e.routeLoaderData)))}))}const tt=["type","children","target","activeProps","inactiveProps","activeOptions","disabled","hash","search","params","to","preload","preloadDelay","preloadMaxAge","replace","style","className","onClick","onFocus","onMouseEnter","onMouseLeave","onTouchStart","onTouchEnd"],et=["pending","caseSensitive","children"],nt=["children","router"];const at=r.createContext(null),ot=r.createContext(null);function rt(t){return r.createElement(at.Provider,t)}const it=t=>{n.useSyncExternalStore((e=>t.subscribe((()=>e()))),(()=>t.state),(()=>t.state))};function st(){const t=r.useContext(ot);return E(!t,"useRouter must be used inside a <Router> component!"),it(t.router),t.router}function lt(){return r.useContext(at)}function ct(){var t,e,n;const a=st(),o=lt().slice(1),i=o[0],s=r.useCallback((()=>null),[]);if(!i)return null;const l=null!=(t=null!=(e=i.__.pendingComponent)?e:a.options.defaultPendingComponent)?t:s,c=null!=(n=i.__.errorComponent)?n:a.options.defaultErrorComponent;return r.createElement(rt,{value:o},r.createElement(r.Suspense,{fallback:r.createElement(l,null)},r.createElement(ut,{errorComponent:c},(()=>{if("error"===i.status)throw i.error;var t,e;if("success"===i.status)return r.createElement(null!=(t=null!=(e=i.__.component)?e:a.options.defaultComponent)?t:ct);throw console.log(i.matchId,"suspend"),i.__.loadPromise})())))}class ut extends r.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:ht;return this.state.error?r.createElement(e,this.state):this.props.children}}function ht(t){let{error:e}=t;return r.createElement("div",{style:{padding:".5rem",maxWidth:"100%"}},r.createElement("strong",{style:{fontSize:"1.2rem"}},"Something went wrong!"),r.createElement("div",{style:{height:".5rem"}}),r.createElement("div",null,r.createElement("pre",null,e.message?r.createElement("code",{style:{fontSize:".7em",border:"1px solid red",borderRadius:".25rem",padding:".5rem",color:"red"}},e.message):null)))}function dt(t,e){const n=st();r.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])}t.DefaultErrorBoundary=ht,t.Link=function(t){const e=st();return r.createElement(e.Link,t)},t.MatchRoute=function(t){const e=st();return r.createElement(e.MatchRoute,t)},t.MatchesProvider=rt,t.Outlet=ct,t.Prompt=function(t){let{message:e,when:n,children:a}=t;return dt(e,null==n||n),null!=a?a:null},t.RouterProvider=function(t){let{children:e,router:n}=t,a=s(t,nt);return n.update(a),it(n),r.useEffect((()=>(console.log("hello"),n.mount())),[n]),r.createElement(ot.Provider,{value:{router:n}},r.createElement(rt,{value:n.state.matches},null!=e?e:r.createElement(ct,null)))},t.cleanPath=I,t.createBrowserHistory=h,t.createHashHistory=function(t){void 0===t&&(t={});var e=t.window,n=void 0===e?document.defaultView:e,a=n.history;function r(){var t=y(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=o.Pop,e=r(),n=e[0],a=e[1];if(P.length){if(null!=n){var s=f-n;s&&(i={action:t,location:a,retry:function(){M(-1*s)}},M(s))}}else S(t)}}n.addEventListener(u,s),n.addEventListener("hashchange",(function(){g(r()[1])!==g(_)&&s()}));var h=o.Pop,d=r(),f=d[0],_=d[1],b=m(),P=m();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:g(t))}function R(t,e){return void 0===e&&(e=null),l({pathname:_.pathname,hash:"",search:""},"string"==typeof t?y(t):t,{state:e,key:v()})}function E(t,e){return[{usr:t.state,key:t.key,idx:e},w(t)]}function x(t,e,n){return!P.length||(P.call({action:t,location:e,retry:n}),!1)}function S(t){h=t;var e=r();f=e[0],_=e[1],b.call({action:h,location:_})}function M(t){a.go(t)}null==f&&(f=0,a.replaceState(l({},a.state,{idx:f}),""));var I={get action(){return h},get location(){return _},createHref:w,push:function t(e,r){var i=o.Push,s=R(e,r);if(x(i,s,(function(){t(e,r)}))){var l=E(s,f+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 r=o.Replace,i=R(e,n);if(x(r,i,(function(){t(e,n)}))){var s=E(i,f),l=s[0],c=s[1];a.replaceState(l,"",c),S(r)}},go:M,back:function(){M(-1)},forward:function(){M(1)},listen:function(t){return b.push(t)},block:function(t){var e=P.push(t);return 1===P.length&&n.addEventListener(c,p),function(){e(),P.length||n.removeEventListener(c,p)}}};return I},t.createMemoryHistory=d,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 it(e),_(o),o},linkProps:e=>{var n,a;const{target:o,activeProps:l=(()=>({className:"active"})),inactiveProps:c=(()=>({})),disabled:u,style:h,className:d,onClick:f,onFocus:p,onMouseEnter:m,onMouseLeave:v}=e,g=s(e,tt),y=t.buildLink(e);if("external"===y.type){const{href:t}=y;return{href:t}}const{handleClick:_,handleFocus:b,handleEnter:P,handleLeave:w,isActive:R,next:E}=y,S=t=>e=>{e.persist(),t.forEach((t=>{t&&t(e)}))},M=R&&null!=(n=x(l,{}))?n:{},I=R?{}:null!=(a=x(c,{}))?a:{};return i({},M,I,g,{href:u?void 0:E.href,onClick:S([t=>{r.startTransition((()=>{_(t)}))},f]),onFocus:S([b,p]),onMouseEnter:S([P,m]),onMouseLeave:S([w,v]),target:o,style:i({},h,M.style,I.style),className:[d,M.className,I.className].filter(Boolean).join(" ")||void 0},u?{role:"link","aria-disabled":!0}:void 0,{"data-status":R?"active":void 0})},Link:r.forwardRef(((n,a)=>{const o=t.linkProps(n);return it(e),r.createElement("a",i({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=s(e,et),r=t.matchRoute(o,{pending:n,caseSensitive:a});return r?"function"==typeof e.children?e.children(r):e.children:null}}),n=Y(i({},t,{createRouter:t=>{const n={useState:()=>(it(t),t.state),useMatch:(e,n)=>{var a,o;it(t),_(e!==z);const r=null==(a=lt())?void 0:a[0],i=t.state.matches.find((t=>t.routeId===e));return(null==(o=null==n?void 0:n.strict)||o)&&(_(i),_(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(z),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=z),o===z&&(o="");let i=a?z:e.path;i&&"/"!==i&&(i=C(i));const s=i||e.id;let l=M([o,s]);i===z&&(i="/"),l!==z&&(l=M(["/",l]));const c=l===z?"/":L(M([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=W,t.createRouter=Y,t.decode=B,t.defaultParseSearch=q,t.defaultStringifySearch=K,t.encode=T,t.functionalUpdate=x,t.interpolatePath=D,t.invariant=_,t.joinPaths=M,t.last=R,t.lazy=function(t){const e=r.lazy(t);let n,a;const o=r.forwardRef(((t,n)=>{const o=r.useRef(a||e);return r.createElement(o.current,i({},n?{ref:n}:{},t))}));return o.preload=()=>(n||(n=t().then((t=>(a=t.default,a)))),n),o},t.linkProps=function(t){return st().linkProps(t)},t.matchByPath=F,t.matchPathname=j,t.matchesContext=at,t.parsePathname=O,t.parseSearchWith=V,t.pick=S,t.replaceEqualDeep=b,t.resolvePath=k,t.rootRouteId=z,t.routerContext=ot,t.stringifySearchWith=J,t.trimPath=C,t.trimPathLeft=A,t.trimPathRight=L,t.useMatch=function(t,e){return st().useMatch(t,e)},t.useMatches=lt,t.useNearestMatch=function(){var t;const e=null==(t=lt())?void 0:t[0];return _(e),e},t.usePrompt=dt,t.useRoute=function(t){return st().useRoute(t)},t.useRouter=st,t.warning=E,Object.defineProperty(t,"__esModule",{value:!0})}));
21
+ */const o="pushstate",a="popstate",s="beforeunload",c=e=>(e.preventDefault(),e.returnValue=""),i=()=>{removeEventListener(s,c,{capture:!0})};function u(e){let t=e.getLocation(),r=new Set,n=[],o=[];const a=()=>{t=e.getLocation(),r.forEach((e=>e()))},u=()=>{if(n.length)n[0]?.(u,(()=>{n=[],i()}));else for(;o.length;)o.shift()?.()},h=e=>{o.push(e),u()};return{get location(){return t},subscribe:e=>(r.add(e),()=>{r.delete(e)}),push:(t,r)=>{r=l(r),h((()=>{e.pushState(t,r,a)}))},replace:(t,r)=>{r=l(r),h((()=>{e.replaceState(t,r,a)}))},go:t=>{h((()=>{e.go(t)}))},back:()=>{h((()=>{e.back()}))},forward:()=>{h((()=>{e.forward()}))},createHref:t=>e.createHref(t),block:e=>(n.push(e),1===n.length&&addEventListener(s,c,{capture:!0}),()=>{n=n.filter((t=>t!==e)),n.length||i()}),flush:()=>e.flush?.(),destroy:()=>e.destroy?.(),notify:a}}function l(e){return e||(e={}),{...e,key:f()}}function h(e){const t=e?.getHref??(()=>`${window.location.pathname}${window.location.search}${window.location.hash}`),r=e?.createHref??(e=>e);let n=d(t(),window.history.state);let s,c,i=!0;const l=()=>{i=!1,(()=>{s&&(window.history[s.isPush?"pushState":"replaceState"](s.state,"",s.href),s=void 0,c=void 0)})(),i=!0},h=(e,t,o,a)=>{const i=r(t);n=d(i,o),s={href:i,state:o,isPush:s?.isPush||"push"===e},a(),c||(c=Promise.resolve().then((()=>l())))},f=()=>{n=d(t(),window.history.state),y.notify()};var p=window.history.pushState,m=window.history.replaceState;const y=u({getLocation:()=>n,pushState:(e,t,r)=>h("push",e,t,r),replaceState:(e,t,r)=>h("replace",e,t,r),back:()=>window.history.back(),forward:()=>window.history.forward(),go:e=>window.history.go(e),createHref:e=>r(e),flush:l,destroy:()=>{window.history.pushState=p,window.history.replaceState=m,window.removeEventListener(o,f),window.removeEventListener(a,f)}});return window.addEventListener(o,f),window.addEventListener(a,f),window.history.pushState=function(){let e=p.apply(window.history,arguments);return i&&y.notify(),e},window.history.replaceState=function(){let e=m.apply(window.history,arguments);return i&&y.notify(),e},y}function d(e,t){let r=e.indexOf("#"),n=e.indexOf("?");return{href:e,pathname:e.substring(0,r>0?n>0?Math.min(r,n):r:n>0?n:e.length),hash:r>-1?e.substring(r):"",search:n>-1?e.slice(n,-1===r?void 0:r):"",state:t||{}}}function f(){return(Math.random()+1).toString(36).substring(7)}function p(e,t){if(!e)throw new Error("Invariant failed")}function m(e,t){}function y(e){const t=e.errorComponent??v;return n.createElement(g,{resetKey:e.resetKey,onCatch:e.onCatch,children:({error:r})=>r?n.createElement(t,{error:r}):e.children})}class g extends n.Component{state={error:null};static getDerivedStateFromError(e){return{error:e}}componentDidUpdate(e,t){t.error&&e.resetKey!==this.props.resetKey&&this.setState({error:null})}componentDidCatch(e){console.error(e),this.props.onCatch?.(e)}render(){return this.props.children(this.state)}}function v({error:e}){const[t,r]=n.useState(!1);return n.createElement("div",{style:{padding:".5rem",maxWidth:"100%"}},n.createElement("div",{style:{display:"flex",alignItems:"center",gap:".5rem"}},n.createElement("strong",{style:{fontSize:"1rem"}},"Something went wrong!"),n.createElement("button",{style:{appearance:"none",fontSize:".6em",border:"1px solid currentColor",padding:".1rem .2rem",fontWeight:"bold",borderRadius:".25rem"},onClick:()=>r((e=>!e))},t?"Hide Error":"Show Error")),n.createElement("div",{style:{height:".25rem"}}),t?n.createElement("div",null,n.createElement("pre",{style:{fontSize:".7em",border:"1px solid red",borderRadius:".25rem",padding:".3rem",color:"red",overflow:"auto"}},e.message?n.createElement("code",null,e.message):null)):null)}const w="undefined"==typeof document;function S(e){return e[e.length-1]}function E(e,t){return"function"==typeof e?e(t):e}function b(e,t){return t.reduce(((t,r)=>(t[r]=e[r],t)),{})}function R(e,t){if(e===t)return e;const r=t,n=Array.isArray(e)&&Array.isArray(r);if(n||_(e)&&_(r)){const t=n?e.length:Object.keys(e).length,o=n?r:Object.keys(r),a=o.length,s=n?[]:{};let c=0;for(let t=0;t<a;t++){const a=n?t:o[t];s[a]=R(e[a],r[a]),s[a]===e[a]&&c++}return t===a&&c===t?e:s}return r}function _(e){if(!C(e))return!1;const t=e.constructor;if(void 0===t)return!0;const r=t.prototype;return!!C(r)&&!!r.hasOwnProperty("isPrototypeOf")}function C(e){return"[object Object]"===Object.prototype.toString.call(e)}function P(e,t,r=!1){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(_(e)&&_(t)){const n=Object.keys(e),o=Object.keys(t);return!(!r&&n.length!==o.length)&&!o.some((n=>!(n in e)||!P(e[n],t[n],r)))}return!(!Array.isArray(e)||!Array.isArray(t))&&!e.some(((e,n)=>!P(e,t[n],r)))}function x(e){const t=n.useRef(e);t.current=e;return n.useRef(((...e)=>t.current(...e))).current}const L="undefined"!=typeof window?n.useLayoutEffect:n.useEffect;function k(e){return e.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(/"/g,'\\"')}function O(e){return T(e.filter(Boolean).join("/"))}function T(e){return e.replace(/\/{2,}/g,"/")}function D(e){return"/"===e?e:e.replace(/^\/{1,}/,"")}function I(e){return"/"===e?e:e.replace(/\/{1,}$/,"")}function j(e){return I(D(e))}function M(e,t,r){t=t.replace(new RegExp(`^${e}`),"/"),r=r.replace(new RegExp(`^${e}`),"/");let n=$(t);const o=$(r);o.forEach(((e,t)=>{if("/"===e.value)t?t===o.length-1&&n.push(e):n=[e];else if(".."===e.value)n.length>1&&"/"===S(n)?.value&&n.pop(),n.pop();else{if("."===e.value)return;n.push(e)}}));return T(O([e,...n.map((e=>e.value))]))}function $(e){if(!e)return[];const t=[];if("/"===(e=T(e)).slice(0,1)&&(e=e.substring(1),t.push({type:"pathname",value:"/"})),!e)return t;const r=e.split("/").filter(Boolean);return t.push(...r.map((e=>"$"===e||"*"===e?{type:"wildcard",value:e}:"$"===e.charAt(0)?{type:"param",value:e}:{type:"pathname",value:e}))),"/"===e.slice(-1)&&(e=e.substring(1),t.push({type:"pathname",value:"/"})),t}function A(e,t,r=!1){return O($(e).map((e=>{if("wildcard"===e.type){const n=t[e.value];return r?`${e.value}${n??""}`:n}return"param"===e.type?t[e.value.substring(1)]??"":e.value})))}function N(e,t,r){const n=H(e,t,r);if(!r.to||n)return n??{}}function H(e,t,r){t="/"!=e?t.substring(e.length):t;const n=`${r.to??"$"}`,o=$(t),a=$(n);t.startsWith("/")||o.unshift({type:"pathname",value:"/"}),n.startsWith("/")||a.unshift({type:"pathname",value:"/"});const s={};return(()=>{for(let e=0;e<Math.max(o.length,a.length);e++){const t=o[e],n=a[e],c=e>=o.length-1,i=e>=a.length-1;if(n){if("wildcard"===n.type)return!!t?.value&&(s["*"]=O(o.slice(e).map((e=>e.value))),!0);if("pathname"===n.type){if("/"===n.value&&!t?.value)return!0;if(t)if(r.caseSensitive){if(n.value!==t.value)return!1}else if(n.value.toLowerCase()!==t.value.toLowerCase())return!1}if(!t)return!1;if("param"===n.type){if("/"===t?.value)return!1;"$"!==t.value.charAt(0)&&(s[n.value.substring(1)]=t.value)}}if(!c&&i)return!!r.fuzzy}return!0})()?s:void 0}function B(e){return ye({select:t=>{const r=S(t.matches)?.params;return e?.select?e.select(r):r}})}function F(e){return Q({...e,select:t=>e?.select?e.select(t.search):t.search})}const K="__root__";class z{constructor(e){this.options=e||{},this.isRoot=!e?.getParentRoute,z.__onInit(this)}init=e=>{this.originalIndex=e.originalIndex;const t=this.options,r=!t?.path&&!t?.id;this.parentRoute=this.options?.getParentRoute?.(),r?this.path=K:p(this.parentRoute);let n=r?K:t.path;n&&"/"!==n&&(n=j(n));const o=t?.id||n;let a=r?K:O([this.parentRoute.id===K?"":this.parentRoute.id,o]);n===K&&(n="/"),a!==K&&(a=O(["/",a]));const s=a===K?"/":O([this.parentRoute.fullPath,n]);this.path=n,this.id=a,this.fullPath=s,this.to=s};addChildren=e=>(this.children=e,this);update=e=>(Object.assign(this.options,e),this);static __onInit=e=>{};useMatch=e=>Q({...e,from:this.id});useRouteContext=e=>Q({...e,from:this.id,select:t=>e?.select?e.select(t.context):t.context});useSearch=e=>F({...e,from:this.id});useParams=e=>B({...e,from:this.id});useLoaderData=e=>ee({...e,from:this.id})}class U extends z{constructor(e){super(e)}}function W(){const{routesById:e,state:t}=ge(),{matches:r}=t,o=ye().location.state.key,a=e.__root__,s=n.useCallback((e=>n.createElement(v,{...e,useMatch:a.useMatch,useRouteContext:a.useRouteContext,useSearch:a.useSearch,useParams:a.useParams})),[a]);return n.createElement(Z.Provider,{value:r},n.createElement(y,{resetKey:o,errorComponent:s,onCatch:()=>{}},r.length?n.createElement(X,{matches:r}):null))}const J=()=>null;function Y(e){return n.createElement(n.Fragment,null,e.children)}function X({matches:e}){const{options:t,routesById:r}=ge(),o=e[0],a=o?.routeId,s=r[a],c=ye().location.state?.key,i=s.options.pendingComponent??t.defaultPendingComponent??J,u=s.options.errorComponent??t.defaultErrorComponent??v,l=s.options.wrapInSuspense?n.Suspense:Y,h=u?n.useCallback((e=>n.createElement(u,{...e,useMatch:s.useMatch,useRouteContext:s.useRouteContext,useSearch:s.useSearch,useParams:s.useParams})),[s]):void 0;return n.createElement(Z.Provider,{value:e},n.createElement(l,{fallback:n.createElement(i,{useMatch:s.useMatch,useRouteContext:s.useRouteContext,useSearch:s.useSearch,useParams:s.useParams})},h?n.createElement(y,{resetKey:c,errorComponent:h,onCatch:()=>{o.id}},n.createElement(q,{match:o})):n.createElement(Y,null,n.createElement(q,{match:o}))))}function q({match:e}){const{options:t,routesById:r}=ge(),o=r[e.routeId];if("error"===e.status)throw e.error;if("pending"===e.status)throw e.loadPromise;if("success"===e.status){let e=o.options.component??t.defaultComponent;return e?n.createElement(e,{useMatch:o.useMatch,useRouteContext:o.useRouteContext,useSearch:o.useSearch,useParams:o.useParams,useLoaderData:o.useLoaderData}):n.createElement(V,null)}p(!1)}function V(){const e=n.useContext(Z).slice(1);return e[0]?n.createElement(X,{matches:e}):null}function G(){const{matchRoute:e}=ge();return n.useCallback((t=>{const{pending:r,caseSensitive:n,...o}=t;return e(o,{pending:r,caseSensitive:n})}),[])}function Q(e){const t=n.useContext(Z)[0],r=t?.routeId,o=ye({select:r=>(e?.from?r.matches.find((t=>t.routeId===e?.from)):r.matches.find((e=>e.id===t.id))).routeId});(e?.strict??1)&&p(r==o);return ye({select:r=>{const n=e?.from?r.matches.find((t=>t.routeId===e?.from)):r.matches.find((e=>e.id===t.id));return p(n,e?.from&&e.from),e?.select?e.select(n):n}})}const Z=n.createContext(null);function ee(e){const t=Q({...e,select:void 0});return"function"==typeof e.select?e.select(t?.loaderData):t?.loaderData}function te(e){return!!e?.isRedirect}function re(e,t){var r,n,o,a="";for(r in e)if(void 0!==(o=e[r]))if(Array.isArray(o))for(n=0;n<o.length;n++)a&&(a+="&"),a+=encodeURIComponent(r)+"="+encodeURIComponent(o[n]);else a&&(a+="&"),a+=encodeURIComponent(r)+"="+encodeURIComponent(o);return(t||"")+a}function ne(e){if(!e)return"";var t=decodeURIComponent(e);return"false"!==t&&("true"===t||(0*+t==0&&+t+""===t?+t:t))}function oe(e){for(var t,r,n={},o=e.split("&");t=o.shift();)void 0!==n[r=(t=t.split("=")).shift()]?n[r]=[].concat(n[r],ne(t.shift())):n[r]=ne(t.shift());return n}const ae=ce(JSON.parse),se=ie(JSON.stringify,JSON.parse);function ce(e){return t=>{"?"===t.substring(0,1)&&(t=t.substring(1));let r=oe(t);for(let t in r){const n=r[t];if("string"==typeof n)try{r[t]=e(n)}catch(e){}}return r}}function ie(e,t){return r=>{(r={...r})&&Object.keys(r).forEach((n=>{const o=r[n];void 0===o||void 0===o?delete r[n]:r[n]=function(r){if("object"==typeof r&&null!==r)try{return e(r)}catch(e){}else if("string"==typeof r&&"function"==typeof t)try{return t(r),e(r)}catch(e){}return r}(o)}));const n=re(r).toString();return n?`?${n}`:""}}const ue=["component","errorComponent","pendingComponent"];const le=n.createContext(null);"undefined"!=typeof document&&(window.__TSR_ROUTER_CONTEXT__=le);const he="Error preloading route! ☝️";class de extends Error{}class fe extends Error{}function pe(e){return{status:"idle",resolvedLocation:e,location:e,matches:[],pendingMatches:[],lastUpdated:Date.now()}}function me(e,t){return[...e.pendingMatches,...e.matches].find((e=>e.id===t))}function ye(e){const{state:t}=ge();return e?.select?e.select(t):t}function ge(){const e=window.__TSR_ROUTER_CONTEXT__||le;return n.useContext(e)}function ve(e){return"object"==typeof e&&null!==e&&!(e instanceof Promise)&&!e.then&&"__deferredState"in e}function we({promise:e}){const t=ge();let r=e.__deferredState;const n=`__TSR__DEFERRED__${r.uid}`;if(ve(e)&&(r=t.hydrateData(n),(e=Promise.resolve(r.data)).__deferredState=r),"pending"===r.status)throw e;if("error"===r.status)throw r.error;return t.dehydrateData(n,r),[r.data]}function Se(){return Se=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Se.apply(this,arguments)}function Ee(e){const{buildLink:t}=ge(),r=Q({strict:!1}),{type:n,children:o,target:a,activeProps:s=(()=>({className:"active"})),inactiveProps:c=(()=>({})),activeOptions:i,disabled:u,hash:l,search:h,params:d,to:f,state:p,mask:m,preload:y,preloadDelay:g,replace:v,startTransition:w,resetScroll:S,style:b,className:R,onClick:_,onFocus:C,onMouseEnter:P,onMouseLeave:x,onTouchStart:L,...k}=e,O=t({from:e.to?r.pathname:void 0,...e});if("external"===O.type){const{href:e}=O;return{href:e}}const{handleClick:T,handleFocus:D,handleEnter:I,handleLeave:j,handleTouchStart:M,isActive:$,next:A}=O,N=e=>t=>{t.persist&&t.persist(),e.filter(Boolean).forEach((e=>{t.defaultPrevented||e(t)}))},H=$?E(s,{})??{}:{},B=$?{}:E(c,{})??{};return{...H,...B,...k,href:u?void 0:A.maskedLocation?A.maskedLocation.href:A.href,onClick:N([_,T]),onFocus:N([C,D]),onMouseEnter:N([P,I]),onMouseLeave:N([x,j]),onTouchStart:N([L,M]),target:a,style:{...b,...H.style,...B.style},className:[R,H.className,B.className].filter(Boolean).join(" ")||void 0,...u?{role:"link","aria-disabled":!0}:void 0,"data-status":$?"active":void 0}}const be=n.forwardRef(((e,t)=>{const r=Ee(e);return n.createElement("a",Se({ref:t},r,{children:"function"==typeof e.children?e.children({isActive:"active"===r["data-status"]}):e.children}))})),Re="undefined"!=typeof window?n.useLayoutEffect:n.useEffect,_e="window";let Ce,Pe=new WeakSet;const xe="undefined"!=typeof window&&window.sessionStorage,Le=e=>e.state.key;function ke(e){const{state:t,subscribe:r,resetNextScrollRef:n}=ge();Re((()=>{const t=e?.getKey||Le;xe&&(Ce||(Ce=(()=>{const e="tsr-scroll-restoration-v2";return{state:JSON.parse(window.sessionStorage.getItem(e)||"null")||{cached:{},next:{}},set:t=>{Ce.state=E(t,Ce.state),window.sessionStorage.setItem(e,JSON.stringify(Ce.state))}}})()));const{history:o}=window;o.scrollRestoration&&(o.scrollRestoration="manual");const a=e=>{if(Pe.has(e.target))return;Pe.add(e.target);const t=e.target===document||e.target===window?_e:s(e.target);Ce.state.next[t]||Ce.set((e=>({...e,next:{...e.next,[t]:{scrollX:NaN,scrollY:NaN}}})))},s=e=>{let t,r=[];for(;t=e.parentNode;)r.unshift(`${e.tagName}:nth-child(${[].indexOf.call(t.children,e)+1})`),e=t;return`${r.join(" > ")}`.toLowerCase()};"undefined"!=typeof document&&document.addEventListener("scroll",a,!0);const c=r("onBeforeLoad",(e=>{if(e.pathChanged){const r=t(e.fromLocation);for(const e in Ce.state.next){const t=Ce.state.next[e];if(e===_e)t.scrollX=window.scrollX||0,t.scrollY=window.scrollY||0;else if(e){const r=document.querySelector(e);t.scrollX=r?.scrollLeft||0,t.scrollY=r?.scrollTop||0}Ce.set((n=>{const o={...n.next};return delete o[e],{...n,next:o,cached:{...n.cached,[[r,e].join("___")]:t}}}))}}})),i=r("onResolved",(t=>{if(t.pathChanged){if(!n.current)return;n.current=!0;const r=(e?.getKey||Le)(t.toLocation);let o=!1;for(const e in Ce.state.cached){const t=Ce.state.cached[e],[n,a]=e.split("___");if(n===r)if(a===_e)o=!0,window.scrollTo(t.scrollX,t.scrollY);else if(a){const e=document.querySelector(a);e&&(e.scrollLeft=t.scrollX,e.scrollTop=t.scrollY)}}o||window.scrollTo(0,0),Ce.set((e=>({...e,next:{}}))),Pe=new WeakSet}}));return()=>{document.removeEventListener("scroll",a),c(),i()}}),[])}function Oe(e,t=!0){const{history:r}=ge();n.useEffect((()=>{if(!t)return;let n=r.block(((t,r)=>{window.confirm(e)&&(n(),t())}));return n}))}e.Await=function(e){const t=we(e);return e.children(...t)},e.Block=function({message:e,condition:t,children:r}){return Oe(e,t),r??null},e.CatchBoundary=y,e.CatchBoundaryImpl=g,e.ErrorComponent=v,e.FileRoute=class{constructor(e){this.path=e}createRoute=e=>{const t=new z(e);return t.isRoot=!1,t}},e.Link=be,e.Match=X,e.MatchRoute=function(e){const t=G()(e);return"function"==typeof e.children?e.children(t):t?e.children:null},e.Matches=W,e.Navigate=function(e){const{navigate:t}=ge(),r=Q({strict:!1});return L((()=>{t({from:e.to?r.pathname:void 0,...e})}),[]),null},e.Outlet=V,e.PathParamError=fe,e.RootRoute=U,e.Route=z,e.Router=class{constructor(e){this.options={defaultPreloadDelay:50,context:void 0,...e,stringifySearch:e?.stringifySearch??se,parseSearch:e?.parseSearch??ae},this.routeTree=this.options.routeTree}subscribers=new Set;subscribe=(e,t)=>{const r={eventType:e,fn:t};return this.subscribers.add(r),()=>{this.subscribers.delete(r)}};emit=e=>{this.subscribers.forEach((t=>{t.eventType===e.type&&t.fn(e)}))}},e.RouterProvider=function({router:e,...t}){const r={...e.options,...t,context:{...e.options.context,...t?.context}},o=n.useState((()=>r.history??h()))[0],a=n.useRef(`${Math.round(1e7*Math.random())}`),s=n.useRef(!0),c=n.useRef(null),i=n.useRef(Promise.resolve()),u=e=>i.current!==e?i.current:void 0,l=x((e=>{const t=({pathname:t,search:n,hash:o,state:a})=>{const s=r.parseSearch(n);return{pathname:t,searchStr:n,search:R(e?.search,s),hash:o.split("#").reverse()[0]??"",href:`${t}${n}${o}`,state:R(e?.state,a)}},n=t(o.location);let{__tempLocation:s,__tempKey:c}=n.state;if(s&&(!c||c===a.current)){const e=t(s);return e.state.key=n.state.key,delete e.state.__tempLocation,{...e,maskedLocation:n}}return n})),d=n.useRef(l()),[f,m]=n.useState((()=>pe(d.current))),[y,g]=n.useTransition(),v=n.useRef([]),w=n.useMemo((()=>({...f,status:y?"pending":"idle",location:y?d.current:f.location,pendingMatches:v.current})),[f,y]);n.useLayoutEffect((()=>{y||w.resolvedLocation===w.location||(e.emit({type:"onResolved",fromLocation:w.resolvedLocation,toLocation:w.location,pathChanged:w.location.href!==w.resolvedLocation?.href}),v.current=[],m((e=>({...e,resolvedLocation:e.location}))))}));const _=`/${j(r.basepath??"")??""}`,C=x(((e,t)=>M(_,e,T(t)))),[L,D]=n.useMemo((()=>{const t={},r={},n=e=>{e.forEach(((e,o)=>{e.init({originalIndex:o});if(p(!t[e.id],String(e.id)),t[e.id]=e,!e.isRoot&&e.path){const t=I(e.fullPath);r[t]&&!e.fullPath.endsWith("/")||(r[t]=e)}const a=e.children;a?.length&&n(a)}))};return n([e.routeTree]),[t,r]}),[]),H=L,B=n.useMemo((()=>Object.values(D).map(((e,t)=>{const r=j(e.fullPath),n=$(r);for(;n.length>1&&"/"===n[0]?.value;)n.shift();const o=n.map((e=>"param"===e.type?.5:"wildcard"===e.type?.25:1));return{child:e,trimmed:r,parsed:n,index:t,score:o}})).sort(((e,t)=>{let r="/"===e.trimmed?1:"/"===t.trimmed?-1:0;if(0!==r)return r;const n=Math.min(e.score.length,t.score.length);if(e.score.length!==t.score.length)return t.score.length-e.score.length;for(let r=0;r<n;r++)if(e.score[r]!==t.score[r])return t.score[r]-e.score[r];for(let r=0;r<n;r++)if(e.parsed[r].value!==t.parsed[r].value)return e.parsed[r].value>t.parsed[r].value?1:-1;return e.trimmed!==t.trimmed?e.trimmed>t.trimmed?1:-1:e.index-t.index})).map(((e,t)=>(e.child.rank=t,e.child)))),[D]),F=x(((e,t,n)=>{let o={},a=B.find((t=>{const n=N(_,I(e),{to:t.fullPath,caseSensitive:t.options.caseSensitive??r.caseSensitive,fuzzy:!1});return!!n&&(o=n,!0)}))||L.__root__,s=[a];for(;a?.parentRoute;)a=a.parentRoute,a&&s.unshift(a);const c=s.map((e=>{let t;if(e.options.parseParams)try{const t=e.options.parseParams(o);Object.assign(o,t)}catch(e){if(t=new fe(e.message,{cause:e}),n?.throwOnError)throw t;return t}})),i=s.map(((e,t)=>{const r=A(e.path,o),n=A(e.id,o,!0),a=me(w,n);if(a)return{...a};const s=!(!e.options.loader&&!ue.some((t=>e.options[t]?.preload)));return{id:n,routeId:e.id,params:o,pathname:O([_,r]),updatedAt:Date.now(),routeSearch:{},search:{},status:s?"pending":"success",isFetching:!1,invalid:!1,error:void 0,paramsError:c[t],searchError:void 0,loadPromise:Promise.resolve(),context:void 0,abortController:new AbortController,shouldReloadDeps:void 0,fetchedAt:0}}));return i.forEach(((e,r)=>{const o=i[r-1],a=H[e.routeId],s=(()=>{const r={search:o?.search??t,routeSearch:o?.routeSearch??t};try{let t=("object"==typeof a.options.validateSearch?a.options.validateSearch.parse:a.options.validateSearch)?.(r.search)??{},n={...r.search,...t};return t=R(e.routeSearch,t),n=R(e.search,n),{routeSearch:t,search:n,searchDidChange:e.routeSearch!==t}}catch(t){if(e.searchError=new de(t.message,{cause:t}),n?.throwOnError)throw e.searchError;return r}})();Object.assign(e,s)})),i})),K=x((e=>{me(w,e)?.abortController?.abort()})),z=x((e=>{e.matches.forEach((e=>{K(e.id)}))})),U=x((e=>{const t=(e={},t)=>{const n=d.current,a=e.from??n.pathname;let s=C(a,`${e.to??""}`);const c=F(a,n.search),i=t?.filter((e=>c?.find((t=>t.routeId===e.routeId)))),u={...S(c)?.params};let l=!0===(e.params??!0)?u:E(e.params,u);l&&t?.map((e=>H[e.routeId].options.stringifyParams)).filter(Boolean).forEach((e=>{l={...l,...e(l)}})),s=A(s,l??{});const h=i?.map((e=>H[e.routeId].options.preSearchFilters??[])).flat().filter(Boolean)??[],f=i?.map((e=>H[e.routeId].options.postSearchFilters??[])).flat().filter(Boolean)??[],p=h?.length?h?.reduce(((e,t)=>t(e)),n.search):n.search,m=!0===e.search?p:e.search?E(e.search,p)??{}:h?.length?p:{},y=f?.length?f.reduce(((e,t)=>t(e)),m):m,g=R(n.search,y),v=r.stringifySearch(g),w=!0===e.hash?n.hash:e.hash?E(e.hash,n.hash):n.hash,b=w?`#${w}`:"";let _=!0===e.state?n.state:e.state?E(e.state,n.state):n.state;return _=R(n.state,_),{pathname:s,search:g,searchStr:v,state:_,hash:w,href:o.createHref(`${s}${v}${b}`),unmaskOnReload:e.unmaskOnReload}},n=(e={},n)=>{let o=t(e),a=n?t(n):void 0;if(!a){let e={},s=r.routeMasks?.find((t=>{const r=N(_,o.pathname,{to:t.from,caseSensitive:!1,fuzzy:!1});return!!r&&(e=r,!0)}));s&&(s={...s,from:A(s.from,e)},a=t(n=s))}const s=F(o.pathname,o.search),c=a?F(a.pathname,a.search):void 0,i=a?t(n,c):void 0,u=t(e,s);return i&&(u.maskedLocation=i),u};return e.mask?n(e,{...b(e,["from"]),...e.mask}):n(e)})),J=x((async({startTransition:e,...t})=>{c.current&&clearTimeout(c.current);if(!(d.current.href===t.href)||!t.replace){let{maskedLocation:n,...s}=t;n&&(s={...n,state:{...n.state,__tempKey:void 0,__tempLocation:{...s,search:s.searchStr,state:{...s.state,__tempKey:void 0,__tempLocation:void 0,key:void 0}}}},(s.unmaskOnReload??r.unmaskOnReload)&&(s.state.__tempKey=a.current));const c=()=>{o[t.replace?"replace":"push"](s.href,s.state)};e??1?g(c):c()}return s.current=t.resetScroll??!0,i.current})),Y=x((({replace:e,resetScroll:t,startTransition:r,...n}={})=>{const o=U(n);return J({...o,startTransition:r,replace:e,resetScroll:t})})),X=x((({from:e,to:t="",...r})=>{const n=String(t),o=void 0===e?e:String(e);let a;try{new URL(`${n}`),a=!0}catch(e){}return p(!a),Y({...r,from:o,to:n})})),q=x((async({checkLatest:e,matches:t,preload:n})=>{let o,a;try{for(let[e,o]of t.entries()){const s=t[e-1],c=H[o.routeId],i=(r,n)=>{if(r.routerCode=n,a=a??e,te(r))throw r;try{c.options.onError?.(r)}catch(e){if(r=e,te(e))throw e}t[e]=o={...o,error:r,status:"error",updatedAt:Date.now()}};try{o.paramsError&&i(o.paramsError,"PARSE_PARAMS"),o.searchError&&i(o.searchError,"VALIDATE_SEARCH");const a=s?.context??r.context??{},u=await(c.options.beforeLoad?.({search:o.search,abortController:o.abortController,params:o.params,preload:!!n,context:a,location:w.location,navigate:e=>X({...e,from:o.pathname}),buildLocation:U}))??{},l={...a,...u};t[e]=o={...o,context:R(o.context,l)}}catch(e){i(e,"BEFORE_LOAD");break}}}catch(e){if(te(e))return n||X(e),t;throw e}const s=t.slice(0,a),c=[];return s.forEach(((r,a)=>{c.push((async()=>{const s=c[a-1],i=H[r.routeId],u=e=>!!te(e)&&(n||X(e),!0);let l;if(t[a]=r={...r,fetchedAt:Date.now(),invalid:!1},r.isFetching)l=me(w,r.id)?.loadPromise;else{const e=w.matches.find((e=>e.id===r.id))?"stay":"enter",o={params:r.params,search:r.search,preload:!!n,parentMatchPromise:s,abortController:r.abortController,context:r.context,location:w.location,navigate:e=>X({...e,from:r.pathname}),cause:e};let c=!0;if("enter"!==e){let e="function"==typeof i.options.shouldReload?i.options.shouldReload?.(o):!!(i.options.shouldReload??1);"object"==typeof e?(c=!P(e,r.shouldReloadDeps),r.shouldReloadDeps=e):c=!!e}if(c){t[a]=r={...r,isFetching:!0};const e=Promise.all(ue.map((async e=>{const t=i.options[e];t?.preload&&await t.preload()}))),n=i.options.loader?.(o);l=Promise.all([e,n]).then((e=>e[1]))}else l=Promise.resolve(r.loaderData)}t[a]=r={...r,loadPromise:l},n||m((e=>({...e,matches:e.matches.map((e=>e.id===r.id?r:e))})));try{const n=await l;if(o=e())return await o;t[a]=r={...r,error:void 0,status:"success",isFetching:!1,updatedAt:Date.now(),loaderData:n,loadPromise:void 0}}catch(n){if(o=e())return await o;if(u(n))return;try{i.options.onError?.(n)}catch(e){if(n=e,u(e))return}t[a]=r={...r,error:n,status:"error",isFetching:!1,updatedAt:Date.now()}}n||m((e=>({...e,matches:e.matches.map((e=>e.id===r.id?r:e))})))})())})),await Promise.all(c),t})),V=x((async()=>{const t=new Promise((async(r,n)=>{const o=d.current,a=w.resolvedLocation,s=a.href!==o.href;let c;z(w),e.emit({type:"onBeforeLoad",fromLocation:a,toLocation:o,pathChanged:s});let i=F(o.pathname,o.search,{debug:!0});v.current=i;const l=w.matches;m((e=>({...e,status:"pending",location:o,matches:i})));try{try{await q({matches:i,checkLatest:()=>u(t)})}catch(e){}if(c=u(t))return c;const n=l.filter((e=>!v.current.includes(e))),h=v.current.filter((e=>!l.includes(e)));[[n,"onLeave"],[h,"onEnter"],[l.filter((e=>v.current.includes(e))),"onTransition"]].forEach((([e,t])=>{e.forEach((e=>{H[e.routeId].options[t]?.(e)}))})),e.emit({type:"onLoad",fromLocation:a,toLocation:o,pathChanged:s}),r()}catch(e){if(c=u(t))return c;n(e)}}));return i.current=t,i.current})),G=x((async(e=w.location)=>{let t=U(e),r=F(t.pathname,t.search,{throwOnError:!0});return await q({matches:r,preload:!0,checkLatest:()=>{}}),[S(r),r]})),Q=x((e=>{const{to:t,preload:n,preloadDelay:o,activeOptions:a,disabled:s,target:c,replace:i,resetScroll:u,startTransition:l}=e;try{return new URL(`${t}`),{type:"external",href:t}}catch(e){}const h=e,f=U(h),p=n??r.defaultPreload,m=o??r.defaultPreloadDelay??0,y=d.current.pathname.split("/"),g=f.pathname.split("/").every(((e,t)=>e===y[t])),v=a?.exact?d.current.pathname===f.pathname:g,w=!a?.includeHash||d.current.hash===f.hash,S=!(a?.includeSearch??1)||P(d.current.search,f.search,!0);return{type:"internal",next:f,handleFocus:e=>{p&&G(h).catch((e=>{console.warn(e),console.warn(he)}))},handleClick:e=>{s||function(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}(e)||e.defaultPrevented||c&&"_self"!==c||0!==e.button||(e.preventDefault(),J({...f,replace:i,resetScroll:u,startTransition:l}))},handleEnter:e=>{const t=e.target||{};if(p){if(t.preloadTimeout)return;t.preloadTimeout=setTimeout((()=>{t.preloadTimeout=null,G(h).catch((e=>{console.warn(e),console.warn(he)}))}),m)}},handleLeave:e=>{const t=e.target||{};t.preloadTimeout&&(clearTimeout(t.preloadTimeout),t.preloadTimeout=null)},handleTouchStart:e=>{G(h).catch((e=>{console.warn(e),console.warn(he)}))},isActive:v&&w&&S,disabled:s}}));n.useLayoutEffect((()=>{const e=o.subscribe((()=>{d.current=l(d.current),w.location!==d.current&&g((()=>{try{V()}catch(e){console.error(e)}}))})),t=U({search:!0,params:!0,hash:!0,state:!0});return w.location.href!==t.href&&J({...t,replace:!0}),()=>{e()}}),[o]);const Z=x(((e,t)=>{e={...e,to:e.to?C(e.from||"",e.to):void 0};const r=U(e);if(t?.pending&&"pending"!==w.status)return!1;const n=t?.pending?d.current:w.resolvedLocation;if(!n)return!1;const o=N(_,n.pathname,{...t,to:r.pathname});return!!o&&(o&&(t?.includeSearch??1)?!!P(n.search,r.search,!0)&&o:o)})),ee=n.useRef([]),re=x((async e=>{ee.current.push(e)})),ne=x(((e,t)=>{if("undefined"==typeof document){const r="string"==typeof e?e:JSON.stringify(e);return re((async()=>{const e=`__TSR_DEHYDRATED__${r}`,n="function"==typeof t?await t():t;return`<script id='${e}' suppressHydrationWarning>window["__TSR_DEHYDRATED__${k(r)}"] = ${JSON.stringify(n)}\n ;(() => {\n var el = document.getElementById('${e}')\n el.parentElement.removeChild(el)\n })()\n <\/script>`})),()=>oe(e)}return()=>{}})),oe=x((e=>{if("undefined"!=typeof document){const t="string"==typeof e?e:JSON.stringify(e);return window[`__TSR_DEHYDRATED__${t}`]}}));n.useLayoutEffect((()=>{g((()=>{try{V()}catch(e){console.error(e)}}))}),[]);const ae={routeTree:e.routeTree,navigate:X,buildLink:Q,state:w,matchRoute:Z,routesById:L,options:r,history:o,load:V,buildLocation:U,subscribe:e.subscribe,resetNextScrollRef:s,injectedHtmlRef:ee,injectHtml:re,dehydrateData:ne,hydrateData:oe};return n.createElement(le.Provider,{value:ae},n.createElement(W,null))},e.ScrollRestoration=function(e){return ke(e),null},e.SearchParamError=de,e.cleanPath=T,e.componentTypes=ue,e.createBrowserHistory=h,e.createHashHistory=function(){return h({getHref:()=>window.location.hash.substring(1),createHref:e=>`#${e}`})},e.createMemoryHistory=function(e={initialEntries:["/"]}){const t=e.initialEntries;let r=e.initialIndex??t.length-1,n={key:f()};return u({getLocation:()=>d(t[r],n),pushState:(e,o)=>{n=o,t.push(e),r++},replaceState:(e,o)=>{n=o,t[r]=e},back:()=>{r--},forward:()=>{r=Math.min(r+1,t.length-1)},go:e=>window.history.go(e),createHref:e=>e})},e.createRouteMask=function(e){return e},e.decode=oe,e.deepEqual=P,e.defaultParseSearch=ae,e.defaultStringifySearch=se,e.defer=function(e){const t=e;if(!t.__deferredState){t.__deferredState={uid:Math.random().toString(36).slice(2),status:"pending"};const e=t.__deferredState;t.then((t=>{e.status="success",e.data=t})).catch((t=>{e.status="error",e.error=t}))}return t},e.encode=re,e.escapeJSON=k,e.functionalUpdate=E,e.getInitialRouterState=pe,e.getRouteMatch=me,e.interpolatePath=A,e.invariant=p,e.isDehydratedDeferred=ve,e.isPlainObject=_,e.isRedirect=te,e.isServer=w,e.joinPaths=O,e.last=S,e.lazyFn=function(e,t){return async(...r)=>(await e())[t||"default"](...r)},e.lazyRouteComponent=function(e,t){let r;const o=()=>(r||(r=e()),r),a=n.lazy((async()=>({default:(await o())[t??"default"]})));return a.preload=o,a},e.matchByPath=H,e.matchPathname=N,e.matchesContext=Z,e.parsePathname=$,e.parseSearchWith=ce,e.pick=b,e.redirect=function(e){return e.isRedirect=!0,e},e.replaceEqualDeep=R,e.resolvePath=M,e.rootRouteId=K,e.rootRouteWithContext=function(){return e=>new U(e)},e.routerContext=le,e.shallow=function(e,t){if(Object.is(e,t))return!0;if("object"!=typeof e||null===e||"object"!=typeof t||null===t)return!1;const r=Object.keys(e);if(r.length!==Object.keys(t).length)return!1;for(let n=0;n<r.length;n++)if(!Object.prototype.hasOwnProperty.call(t,r[n])||!Object.is(e[r[n]],t[r[n]]))return!1;return!0},e.stringifySearchWith=ie,e.trimPath=j,e.trimPathLeft=D,e.trimPathRight=I,e.typedNavigate=function(e){return e},e.useAwaited=we,e.useBlocker=Oe,e.useLayoutEffect=L,e.useLinkProps=Ee,e.useLoaderData=ee,e.useMatch=Q,e.useMatchRoute=G,e.useMatches=function(e){const t=n.useContext(Z);return ye({select:r=>{const n=r.matches.slice(r.matches.findIndex((e=>e.id===t[0]?.id)));return e?.select?e.select(n):n}})},e.useNavigate=function(e){const{navigate:t}=ge(),r=Q({strict:!1});return n.useCallback((n=>t({from:n?.to?r.pathname:void 0,...e,...n})),[])},e.useParams=B,e.useRouteContext=function(e){return Q({...e,select:t=>e?.select?e.select(t.context):t.context})},e.useRouter=ge,e.useRouterState=ye,e.useScrollRestoration=ke,e.useSearch=F,e.useStableCallback=x,e.warning=m,Object.defineProperty(e,"__esModule",{value:!0})}));
22
22
  //# sourceMappingURL=index.production.js.map