Socket
Socket
Sign inDemoInstall

@tanstack/router

Package Overview
Dependencies
Maintainers
2
Versions
104
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@tanstack/router - npm Package Compare versions

Comparing version 0.0.1-beta.117 to 0.0.1-beta.118

9

build/cjs/react.js

@@ -181,3 +181,4 @@ /**

const routerContext = /*#__PURE__*/React__namespace.createContext(null);
const useDeferredValue = React__namespace.useDeferredValue || (d => d);
// const useDeferredValue = React.useDeferredValue || ((d) => d)
const useDeferredValue = d => d;
function RouterProvider({

@@ -251,8 +252,10 @@ router,

const router = useRouterContext();
reactStore.useStore(router.__store, d => {
return reactStore.useStore(router.__store, d => {
const params = utils.last(d.matches)?.params;
return opts?.track?.(params) ?? params;
});
return utils.last(router.state.matches)?.params;
// return last(router.state.matches)?.params as any
}
function useNavigate(defaultOpts) {

@@ -259,0 +262,0 @@ const router = useRouterContext();

@@ -106,3 +106,3 @@ /**

...s,
currentLocation: parsedLocation,
resolvedLocation: parsedLocation,
location: parsedLocation

@@ -229,3 +229,3 @@ }));

status: 'idle',
currentLocation: s.location,
resolvedLocation: s.location,
matches

@@ -448,3 +448,3 @@ }));

}
const baseLocation = opts?.pending ? this.state.location : this.state.currentLocation;
const baseLocation = opts?.pending ? this.state.location : this.state.resolvedLocation;
if (!baseLocation) {

@@ -600,3 +600,3 @@ return false;

matches: s.matches,
currentLocation: ctx.router.state.location
resolvedLocation: ctx.router.state.location
};

@@ -830,3 +830,3 @@ });

status: 'idle',
currentLocation: null,
resolvedLocation: null,
location: null,

@@ -833,0 +833,0 @@ matches: [],

@@ -14,7 +14,7 @@ {

"name": "tiny-invariant@1.3.1/node_modules/tiny-invariant/dist/esm/tiny-invariant.js",
"uid": "6e14-49"
"uid": "e526-49"
},
{
"name": "tiny-warning@1.0.3/node_modules/tiny-warning/dist/tiny-warning.esm.js",
"uid": "6e14-51"
"uid": "e526-51"
}

@@ -30,39 +30,39 @@ ]

{
"uid": "6e14-53",
"uid": "e526-53",
"name": "history.ts"
},
{
"uid": "6e14-55",
"uid": "e526-55",
"name": "utils.ts"
},
{
"uid": "6e14-57",
"uid": "e526-57",
"name": "path.ts"
},
{
"uid": "6e14-59",
"uid": "e526-59",
"name": "qss.ts"
},
{
"uid": "6e14-67",
"uid": "e526-67",
"name": "react.tsx"
},
{
"uid": "6e14-69",
"uid": "e526-69",
"name": "route.ts"
},
{
"uid": "6e14-71",
"uid": "e526-71",
"name": "searchParams.ts"
},
{
"uid": "6e14-73",
"uid": "e526-73",
"name": "router.ts"
},
{
"uid": "6e14-75",
"uid": "e526-75",
"name": "routeMatch.ts"
},
{
"uid": "6e14-77",
"uid": "e526-77",
"name": "index.ts"

@@ -74,7 +74,7 @@ }

"name": "store/build/esm/index.js",
"uid": "6e14-63"
"uid": "e526-63"
},
{
"name": "react-store/build/esm/index.js",
"uid": "6e14-65"
"uid": "e526-65"
}

@@ -84,3 +84,3 @@ ]

{
"uid": "6e14-61",
"uid": "e526-61",
"name": "\u0000rollupPluginBabelHelpers.js"

@@ -94,98 +94,98 @@ }

"nodeParts": {
"6e14-49": {
"e526-49": {
"renderedLength": 199,
"gzipLength": 134,
"brotliLength": 0,
"mainUid": "6e14-48"
"mainUid": "e526-48"
},
"6e14-51": {
"e526-51": {
"renderedLength": 48,
"gzipLength": 65,
"brotliLength": 0,
"mainUid": "6e14-50"
"mainUid": "e526-50"
},
"6e14-53": {
"e526-53": {
"renderedLength": 5643,
"gzipLength": 1404,
"brotliLength": 0,
"mainUid": "6e14-52"
"mainUid": "e526-52"
},
"6e14-55": {
"e526-55": {
"renderedLength": 2821,
"gzipLength": 990,
"brotliLength": 0,
"mainUid": "6e14-54"
"mainUid": "e526-54"
},
"6e14-57": {
"e526-57": {
"renderedLength": 6028,
"gzipLength": 1423,
"brotliLength": 0,
"mainUid": "6e14-56"
"mainUid": "e526-56"
},
"6e14-59": {
"e526-59": {
"renderedLength": 1395,
"gzipLength": 558,
"brotliLength": 0,
"mainUid": "6e14-58"
"mainUid": "e526-58"
},
"6e14-61": {
"e526-61": {
"renderedLength": 457,
"gzipLength": 241,
"brotliLength": 0,
"mainUid": "6e14-60"
"mainUid": "e526-60"
},
"6e14-63": {
"e526-63": {
"renderedLength": 1459,
"gzipLength": 543,
"brotliLength": 0,
"mainUid": "6e14-62"
"mainUid": "e526-62"
},
"6e14-65": {
"renderedLength": 1066,
"gzipLength": 481,
"e526-65": {
"renderedLength": 1590,
"gzipLength": 640,
"brotliLength": 0,
"mainUid": "6e14-64"
"mainUid": "e526-64"
},
"6e14-67": {
"renderedLength": 14227,
"gzipLength": 3360,
"e526-67": {
"renderedLength": 14275,
"gzipLength": 3391,
"brotliLength": 0,
"mainUid": "6e14-66"
"mainUid": "e526-66"
},
"6e14-69": {
"e526-69": {
"renderedLength": 3556,
"gzipLength": 903,
"brotliLength": 0,
"mainUid": "6e14-68"
"mainUid": "e526-68"
},
"6e14-71": {
"e526-71": {
"renderedLength": 1387,
"gzipLength": 483,
"brotliLength": 0,
"mainUid": "6e14-70"
"mainUid": "e526-70"
},
"6e14-73": {
"renderedLength": 27716,
"gzipLength": 6699,
"e526-73": {
"renderedLength": 27721,
"gzipLength": 6697,
"brotliLength": 0,
"mainUid": "6e14-72"
"mainUid": "e526-72"
},
"6e14-75": {
"e526-75": {
"renderedLength": 8914,
"gzipLength": 1932,
"brotliLength": 0,
"mainUid": "6e14-74"
"mainUid": "e526-74"
},
"6e14-77": {
"e526-77": {
"renderedLength": 0,
"gzipLength": 0,
"brotliLength": 0,
"mainUid": "6e14-76"
"mainUid": "e526-76"
}
},
"nodeMetas": {
"6e14-48": {
"e526-48": {
"id": "/node_modules/.pnpm/tiny-invariant@1.3.1/node_modules/tiny-invariant/dist/esm/tiny-invariant.js",
"moduleParts": {
"index.production.js": "6e14-49"
"index.production.js": "e526-49"
},

@@ -195,19 +195,19 @@ "imported": [],

{
"uid": "6e14-76"
"uid": "e526-76"
},
{
"uid": "6e14-68"
"uid": "e526-68"
},
{
"uid": "6e14-72"
"uid": "e526-72"
},
{
"uid": "6e14-66"
"uid": "e526-66"
}
]
},
"6e14-50": {
"e526-50": {
"id": "/node_modules/.pnpm/tiny-warning@1.0.3/node_modules/tiny-warning/dist/tiny-warning.esm.js",
"moduleParts": {
"index.production.js": "6e14-51"
"index.production.js": "e526-51"
},

@@ -217,13 +217,13 @@ "imported": [],

{
"uid": "6e14-76"
"uid": "e526-76"
},
{
"uid": "6e14-66"
"uid": "e526-66"
}
]
},
"6e14-52": {
"e526-52": {
"id": "/packages/router/src/history.ts",
"moduleParts": {
"index.production.js": "6e14-53"
"index.production.js": "e526-53"
},

@@ -233,13 +233,13 @@ "imported": [],

{
"uid": "6e14-76"
"uid": "e526-76"
},
{
"uid": "6e14-72"
"uid": "e526-72"
}
]
},
"6e14-54": {
"e526-54": {
"id": "/packages/router/src/utils.ts",
"moduleParts": {
"index.production.js": "6e14-55"
"index.production.js": "e526-55"
},

@@ -249,26 +249,26 @@ "imported": [],

{
"uid": "6e14-76"
"uid": "e526-76"
},
{
"uid": "6e14-56"
"uid": "e526-56"
},
{
"uid": "6e14-74"
"uid": "e526-74"
},
{
"uid": "6e14-72"
"uid": "e526-72"
},
{
"uid": "6e14-66"
"uid": "e526-66"
}
]
},
"6e14-56": {
"e526-56": {
"id": "/packages/router/src/path.ts",
"moduleParts": {
"index.production.js": "6e14-57"
"index.production.js": "e526-57"
},
"imported": [
{
"uid": "6e14-54"
"uid": "e526-54"
}

@@ -278,16 +278,16 @@ ],

{
"uid": "6e14-76"
"uid": "e526-76"
},
{
"uid": "6e14-68"
"uid": "e526-68"
},
{
"uid": "6e14-72"
"uid": "e526-72"
}
]
},
"6e14-58": {
"e526-58": {
"id": "/packages/router/src/qss.ts",
"moduleParts": {
"index.production.js": "6e14-59"
"index.production.js": "e526-59"
},

@@ -297,13 +297,13 @@ "imported": [],

{
"uid": "6e14-76"
"uid": "e526-76"
},
{
"uid": "6e14-70"
"uid": "e526-70"
}
]
},
"6e14-60": {
"e526-60": {
"id": "\u0000rollupPluginBabelHelpers.js",
"moduleParts": {
"index.production.js": "6e14-61"
"index.production.js": "e526-61"
},

@@ -313,10 +313,10 @@ "imported": [],

{
"uid": "6e14-66"
"uid": "e526-66"
}
]
},
"6e14-62": {
"e526-62": {
"id": "/packages/store/build/esm/index.js",
"moduleParts": {
"index.production.js": "6e14-63"
"index.production.js": "e526-63"
},

@@ -326,17 +326,17 @@ "imported": [],

{
"uid": "6e14-64"
"uid": "e526-64"
}
]
},
"6e14-64": {
"e526-64": {
"id": "/packages/react-store/build/esm/index.js",
"moduleParts": {
"index.production.js": "6e14-65"
"index.production.js": "e526-65"
},
"imported": [
{
"uid": "6e14-81"
"uid": "e526-81"
},
{
"uid": "6e14-62"
"uid": "e526-62"
}

@@ -346,35 +346,35 @@ ],

{
"uid": "6e14-74"
"uid": "e526-74"
},
{
"uid": "6e14-72"
"uid": "e526-72"
},
{
"uid": "6e14-66"
"uid": "e526-66"
}
]
},
"6e14-66": {
"e526-66": {
"id": "/packages/router/src/react.tsx",
"moduleParts": {
"index.production.js": "6e14-67"
"index.production.js": "e526-67"
},
"imported": [
{
"uid": "6e14-60"
"uid": "e526-60"
},
{
"uid": "6e14-80"
"uid": "e526-80"
},
{
"uid": "6e14-64"
"uid": "e526-64"
},
{
"uid": "6e14-48"
"uid": "e526-48"
},
{
"uid": "6e14-50"
"uid": "e526-50"
},
{
"uid": "6e14-54"
"uid": "e526-54"
}

@@ -384,23 +384,23 @@ ],

{
"uid": "6e14-76"
"uid": "e526-76"
},
{
"uid": "6e14-68"
"uid": "e526-68"
}
]
},
"6e14-68": {
"e526-68": {
"id": "/packages/router/src/route.ts",
"moduleParts": {
"index.production.js": "6e14-69"
"index.production.js": "e526-69"
},
"imported": [
{
"uid": "6e14-48"
"uid": "e526-48"
},
{
"uid": "6e14-56"
"uid": "e526-56"
},
{
"uid": "6e14-66"
"uid": "e526-66"
}

@@ -410,14 +410,14 @@ ],

{
"uid": "6e14-76"
"uid": "e526-76"
}
]
},
"6e14-70": {
"e526-70": {
"id": "/packages/router/src/searchParams.ts",
"moduleParts": {
"index.production.js": "6e14-71"
"index.production.js": "e526-71"
},
"imported": [
{
"uid": "6e14-58"
"uid": "e526-58"
}

@@ -427,35 +427,35 @@ ],

{
"uid": "6e14-76"
"uid": "e526-76"
},
{
"uid": "6e14-72"
"uid": "e526-72"
}
]
},
"6e14-72": {
"e526-72": {
"id": "/packages/router/src/router.ts",
"moduleParts": {
"index.production.js": "6e14-73"
"index.production.js": "e526-73"
},
"imported": [
{
"uid": "6e14-64"
"uid": "e526-64"
},
{
"uid": "6e14-48"
"uid": "e526-48"
},
{
"uid": "6e14-56"
"uid": "e526-56"
},
{
"uid": "6e14-74"
"uid": "e526-74"
},
{
"uid": "6e14-70"
"uid": "e526-70"
},
{
"uid": "6e14-54"
"uid": "e526-54"
},
{
"uid": "6e14-52"
"uid": "e526-52"
}

@@ -465,23 +465,23 @@ ],

{
"uid": "6e14-76"
"uid": "e526-76"
},
{
"uid": "6e14-74"
"uid": "e526-74"
}
]
},
"6e14-74": {
"e526-74": {
"id": "/packages/router/src/routeMatch.ts",
"moduleParts": {
"index.production.js": "6e14-75"
"index.production.js": "e526-75"
},
"imported": [
{
"uid": "6e14-64"
"uid": "e526-64"
},
{
"uid": "6e14-72"
"uid": "e526-72"
},
{
"uid": "6e14-54"
"uid": "e526-54"
}

@@ -491,53 +491,53 @@ ],

{
"uid": "6e14-76"
"uid": "e526-76"
},
{
"uid": "6e14-72"
"uid": "e526-72"
}
]
},
"6e14-76": {
"e526-76": {
"id": "/packages/router/src/index.ts",
"moduleParts": {
"index.production.js": "6e14-77"
"index.production.js": "e526-77"
},
"imported": [
{
"uid": "6e14-48"
"uid": "e526-48"
},
{
"uid": "6e14-50"
"uid": "e526-50"
},
{
"uid": "6e14-52"
"uid": "e526-52"
},
{
"uid": "6e14-78"
"uid": "e526-78"
},
{
"uid": "6e14-56"
"uid": "e526-56"
},
{
"uid": "6e14-58"
"uid": "e526-58"
},
{
"uid": "6e14-68"
"uid": "e526-68"
},
{
"uid": "6e14-79"
"uid": "e526-79"
},
{
"uid": "6e14-74"
"uid": "e526-74"
},
{
"uid": "6e14-72"
"uid": "e526-72"
},
{
"uid": "6e14-70"
"uid": "e526-70"
},
{
"uid": "6e14-54"
"uid": "e526-54"
},
{
"uid": "6e14-66"
"uid": "e526-66"
}

@@ -548,3 +548,3 @@ ],

},
"6e14-78": {
"e526-78": {
"id": "/packages/router/src/link.ts",

@@ -555,7 +555,7 @@ "moduleParts": {},

{
"uid": "6e14-76"
"uid": "e526-76"
}
]
},
"6e14-79": {
"e526-79": {
"id": "/packages/router/src/routeInfo.ts",

@@ -566,7 +566,7 @@ "moduleParts": {},

{
"uid": "6e14-76"
"uid": "e526-76"
}
]
},
"6e14-80": {
"e526-80": {
"id": "react",

@@ -577,3 +577,3 @@ "moduleParts": {},

{
"uid": "6e14-66"
"uid": "e526-66"
}

@@ -583,3 +583,3 @@ ],

},
"6e14-81": {
"e526-81": {
"id": "use-sync-external-store/shim/with-selector",

@@ -590,3 +590,3 @@ "moduleParts": {},

{
"uid": "6e14-64"
"uid": "e526-64"
}

@@ -593,0 +593,0 @@ ],

@@ -92,3 +92,3 @@ /// <reference types="react" />

location: ParsedLocation<TRoutesInfo['fullSearchSchema'], TState>;
currentLocation: ParsedLocation<TRoutesInfo['fullSearchSchema'], TState>;
resolvedLocation: ParsedLocation<TRoutesInfo['fullSearchSchema'], TState>;
lastUpdated: number;

@@ -95,0 +95,0 @@ }

@@ -31,3 +31,3 @@ /**

* @license MIT
*/function H(t,e=(t=>t)){return r.useSyncExternalStoreWithSelector(t.subscribe,(()=>t.state),(()=>t.state),e,N)}function N(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 o=0;o<r.length;o++)if(!Object.prototype.hasOwnProperty.call(e,r[o])||!Object.is(t[r[o]],e[r[o]]))return!1;return!0}function B(t){const e=J(),{type:r,children:o,target:s,activeProps:n=(()=>({className:"active"})),inactiveProps:i=(()=>({})),activeOptions:c,disabled:h,hash:u,search:l,params:d,to:p=".",preload:f,preloadDelay:m,replace:y,style:v,className:_,onClick:w,onFocus:b,onMouseEnter:S,onMouseLeave:P,onTouchStart:E,...x}=t,R=e.buildLink(t);if("external"===R.type){const{href:t}=R;return{href:t}}const{handleClick:C,handleFocus:L,handleEnter:k,handleLeave:j,handleTouchStart:O,isActive:D,next:M}=R,A=t=>e=>{e.persist&&e.persist(),t.filter(Boolean).forEach((t=>{e.defaultPrevented||t(e)}))},$=D?g(n,{})??{}:{},T=D?{}:g(i,{})??{};return{...$,...T,...x,href:h?void 0:M.href,onClick:A([w,t=>{a.startTransition?a.startTransition((()=>{C(t)})):C(t)}]),onFocus:A([b,L]),onMouseEnter:A([S,k]),onMouseLeave:A([P,j]),onTouchStart:A([E,O]),target:s,style:{...v,...$.style,...T.style},className:[_,$.className,T.className].filter(Boolean).join(" ")||void 0,...h?{role:"link","aria-disabled":!0}:void 0,"data-status":D?"active":void 0}}const F=a.forwardRef(((t,e)=>{const r=B(t);return a.createElement("a",T({ref:e},r,{children:"function"==typeof t.children?t.children({isActive:"active"===r["data-status"]}):t.children}))}));const U=a.createContext(null),z=a.createContext(null),W=a.useDeferredValue||(t=>t);function J(){const t=a.useContext(z);return H(t.router.__store),t.router}function K(t){const e=J();return H(e.__store,t),e}function q(){return a.useContext(U)}function V(t){const e=J(),r=q()[0],o=W(e.state.matches),a=t?.from?o.find((e=>e.route.id===t?.from)):r;return s(a,t?.from&&t.from),(t?.strict??1)&&s(r.route.id==a?.route.id,(a?.route.id,r.route.id,a?.route.id,a?.route.id)),H(a.__store,(e=>t?.track?.(a)??a)),a}function Y(t){const{track:e,...r}=t,o=V(r);return H(o.__store,(e=>t?.track?.(e.loader)??e.loader)),o.state.loader}function G(t){const{track:e,...r}=t??{},o=V(r);return H(o.__store,(e=>t?.track?.(e.search)??e.search)),o.state.search}function Q(t){const e=J();return H(e.__store,(e=>{const r=y(e.matches)?.params;return t?.track?.(r)??r})),y(e.state.matches)?.params}function X(){const t=J();return a.useCallback((e=>{const{pending:r,caseSensitive:o,...a}=e;return t.matchRoute(a,{pending:r,caseSensitive:o})}),[])}function Z(){const t=q().slice(1),e=t[0];return e?a.createElement(tt,{matches:t,match:e}):null}function tt({matches:t,match:e}){const r=J();H(e.__store,(t=>[t.status,t.error]));const o=a.useCallback((()=>null),[]),s=e.pendingComponent??r.options.defaultPendingComponent??o,n=e.errorComponent??r.options.defaultErrorComponent,i=e.route.options.wrapInSuspense??!e.route.isRoot?a.Suspense:rt,c=n?ot:rt;return a.createElement(U.Provider,{value:t},a.createElement(i,{fallback:a.createElement(s,null)},a.createElement(c,{key:e.route.id,errorComponent:n,onCatch:()=>{e.id}},a.createElement(et,{match:e}))))}function et(t){const e=J();if("error"===t.match.state.status)throw t.match.state.error;if("pending"===t.match.state.status)throw t.match.__loadPromise;if("success"===t.match.state.status)return a.createElement(t.match.component??e.options.defaultComponent??Z,{useLoader:t.match.route.useLoader,useMatch:t.match.route.useMatch,useContext:t.match.route.useContext,useSearch:t.match.route.useSearch,useParams:t.match.route.useParams});s(!1)}function rt(t){return a.createElement(a.Fragment,null,t.children)}class ot extends a.Component{state={error:!1,info:void 0};componentDidCatch(t,e){this.props.onCatch(t,e),console.error(t),this.setState({error:t,info:e})}render(){return a.createElement(at,T({},this.props,{errorState:this.state,reset:()=>this.setState({})}))}}function at(t){const[e,r]=a.useState(t.errorState),o=J(),s=t.errorComponent??st,n=a.useRef("");return a.useEffect((()=>{e&&(o.state.location.key,n.current),n.current=o.state.location.key}),[e,o.state.location.key]),a.useEffect((()=>{t.errorState.error}),[t.errorState.error]),t.errorState.error&&e.error?a.createElement(s,e):t.children}function st({error:t}){return a.createElement("div",{style:{padding:".5rem",maxWidth:"100%"}},a.createElement("strong",{style:{fontSize:"1.2rem"}},"Something went wrong!"),a.createElement("div",{style:{height:".5rem"}}),a.createElement("div",null,a.createElement("pre",{style:{fontSize:".7em",border:"1px solid red",borderRadius:".25rem",padding:".5rem",color:"red",overflow:"auto"}},t.message?a.createElement("code",null,t.message):null)))}function nt(t,e=!0){const r=K();a.useEffect((()=>{if(!e)return;let o=r.history.block(((e,r)=>{window.confirm(t)&&(o(),e())}));return o}))}const it="__root__";class ct{constructor(t){this.options=t||{},this.isRoot=!t?.getParentRoute}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=it:s(this.parentRoute);let o=r?it:e.path;o&&"/"!==o&&(o=C(o));const a=e?.id||o;let n=r?it:P([this.parentRoute.id===it?"":this.parentRoute.id,a]);o===it&&(o="/"),n!==it&&(n=P(["/",n]));const i=n===it?"/":P([this.parentRoute.fullPath,o]);this.path=o,this.id=n,this.fullPath=i,this.to=i};addChildren=t=>(this.children=t,this);useMatch=t=>V({...t,from:this.id});useLoader=t=>Y({...t,from:this.id});useContext=t=>V({...t,from:this.id}).context;useSearch=t=>G({...t,from:this.id});useParams=t=>Q({...t,from:this.id})}class ht extends ct{constructor(t){super(t)}static withRouterContext=()=>t=>new ht(t)}const ut=dt(JSON.parse),lt=pt(JSON.stringify);function dt(t){return e=>{"?"===e.substring(0,1)&&(e=e.substring(1));let r=$(e);for(let e in r){const o=r[e];if("string"==typeof o)try{r[e]=t(o)}catch(t){}}return r}}function pt(t){return e=>{(e={...e})&&Object.keys(e).forEach((r=>{const o=e[r];if(void 0===o||void 0===o)delete e[r];else if(o&&"object"==typeof o&&null!==o)try{e[r]=t(o)}catch(t){}}));const r=M(e).toString();return r?`?${r}`:""}}const ft=async({router:t,routeMatch:e})=>{const r=t.buildNext({to:".",search:t=>({...t??{},__data:{matchId:e.id}})}),o=await fetch(r.href,{method:"GET",signal:e.abortController.signal});if(o.ok)return o.json();throw new Error("Failed to fetch match data")};const mt="undefined"==typeof window||!window.document.createElement;function yt(){return{status:"idle",currentLocation:null,location:null,matches:[],lastUpdated:Date.now()}}function gt(t){return!!t?.isRedirect}const vt=["component","errorComponent","pendingComponent"];class _t{abortController=new AbortController;constructor(t,e,r){Object.assign(this,{route:e,router:t,id:r.id,pathname:r.pathname,params:r.params,__store:new I({updatedAt:0,routeSearch:{},search:{},status:"pending",loader:void 0},{onUpdate:()=>{this.state=this.__store.state}})}),this.state=this.__store.state,vt.map((async t=>{const e=this.route.options[t];this[t]=e})),this.__loadPromise=new Promise((t=>{this.__loadPromiseResolve=t})),"pending"!==this.state.status||this.#t()||(this.__store.setState((t=>({...t,status:"success"}))),this.__loadPromiseResolve?.())}#t=()=>!(!this.route.options.loader&&!vt.some((t=>this.route.options[t]?.preload)));__commit=()=>{const{routeSearch:t,search:e,context:r,routeContext:o}=this.#e({location:this.router.state.location});this.context=r,this.routeContext=o,this.__store.setState((r=>({...r,routeSearch:_(r.routeSearch,t),search:_(r.search,e)})))};cancel=()=>{this.abortController?.abort()};#r=t=>{const e=this.parentMatch?this.parentMatch.#r(t):{search:t.location.search,routeSearch:t.location.search};try{const t=("object"==typeof this.route.options.validateSearch?this.route.options.validateSearch.parse:this.route.options.validateSearch)?.(e.search)??{};return{routeSearch:t,search:{...e.search,...t}}}catch(t){if(gt(t))throw t;(this.route.options.onValidateSearchError??this.route.options.onError)?.(t);const e=new Error("Invalid search params found",{cause:t});throw e.code="INVALID_SEARCH_PARAMS",e}};#e=t=>{const{search:e,routeSearch:r}=this.#r(t);try{const t=this.route.options.getContext?.({parentContext:this.parentMatch?.routeContext??{},context:this.parentMatch?.context??this.router?.options.context??{},params:this.params,search:e})||{};return{routeSearch:r,search:e,context:{...this.parentMatch?.context??this.router?.options.context,...t},routeContext:t}}catch(t){throw this.route.options.onError?.(t),t}};__load=async t=>{let e;this.parentMatch=t.parentMatch;try{e=this.#e(t)}catch(e){return gt(e)?void(t?.preload||this.router.navigate(e)):void this.__store.setState((t=>({...t,status:"error",error:e})))}const{routeSearch:r,search:o,context:a,routeContext:s}=e,n={params:this.params,routeSearch:r,search:o,signal:this.abortController.signal,preload:!!t?.preload,routeContext:s,context:a};return this.__loadPromise=Promise.resolve().then((async()=>{const e=""+Date.now()+Math.random();this.#o=e;const r=()=>e!==this.#o?this.__loadPromise:void 0;let o;const a=(async()=>{await Promise.all(vt.map((async t=>{const e=this.route.options[t];e?.preload&&await e.preload()})))})(),s=Promise.resolve().then((()=>{if(this.route.options.loader)return this.route.options.loader(n)}));try{const[e,n]=await Promise.all([a,s]);if(o=r())return await o;t.preload||this.__store.setState((t=>({...t,error:void 0,status:"success",updatedAt:Date.now(),loader:n})))}catch(e){if(gt(e))return void(t?.preload||this.router.navigate(e));const r=this.route.options.onLoadError??this.route.options.onError;try{r?.(e)}catch(e){return gt(e)?void(t?.preload||this.router.navigate(e)):void this.__store.setState((t=>({...t,error:e,status:"error",updatedAt:Date.now()})))}this.__store.setState((t=>({...t,error:e,status:"error",updatedAt:Date.now()})))}finally{this.__loadPromiseResolve?.(),delete this.__loadPromise}})),this.__loadPromise};#o=""}t.Block=function({message:t,condition:e,children:r}){return nt(t,e),r??null},t.ErrorComponent=st,t.Link=F,t.MatchRoute=function(t){const e=X()(t);return e?"function"==typeof t.children?t.children(e):e?t.children:null:null},t.Navigate=function(t){const e=J();return a.useLayoutEffect((()=>{e.navigate(t)}),[]),null},t.Outlet=Z,t.RootRoute=ht,t.Route=ct,t.RouteMatch=_t,t.Router=class{#a;startedLoadingAt=Date.now();resolveNavigation=()=>{};constructor(t){this.options={defaultPreloadDelay:50,context:void 0,...t,stringifySearch:t?.stringifySearch??lt,parseSearch:t?.parseSearch??ut,fetchServerDataFn:t?.fetchServerDataFn??ft},this.__store=new I(yt(),{onUpdate:()=>{this.state=this.__store.state}}),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.#s({...e,replace:!0})}reset=()=>{this.__store.setState((t=>Object.assign(t,yt())))};mount=()=>(mt||this.state.matches.length||this.safeLoad(),()=>{});update=t=>{if(Object.assign(this.options,t),this.context=this.options.context,!this.history||this.options.history&&this.options.history!==this.history){this.#a&&this.#a(),this.history=this.options.history??(mt?p():d());const t=this.#n();this.__store.setState((e=>({...e,currentLocation:t,location:t}))),this.#a=this.history.listen((()=>{this.safeLoad({next:this.#n(this.state.location)})}))}const{basepath:e,routeTree:r}=this.options;return this.basepath=`/${C(e??"")??""}`,r&&r!==this.routeTree&&this.#i(r),this};buildNext=t=>{const e=this.#c(t),r=this.matchRoutes(e.pathname,e.search);return this.#c({...t,__matches:r})};cancelMatches=()=>{[...this.state.matches].forEach((t=>{t.cancel()}))};safeLoad=t=>{this.load(t).catch((t=>{console.warn(t),s(!1)}))};load=async t=>{this.#h();let e=Date.now();const r=e;let o;if(this.startedLoadingAt=r,this.cancelMatches(),this.__store.batch((()=>{t?.next&&this.__store.setState((e=>({...e,location:t.next}))),o=this.matchRoutes(this.state.location.pathname,this.state.location.search,{strictParseParams:!0,debug:!0}),this.__store.setState((t=>({...t,status:"pending",matches:o})))})),o.forEach((t=>{t.__commit()})),await this.loadMatches(o,this.state.location),this.startedLoadingAt!==r)return this.navigationPromise;const a=this.state.matches,s=[],n=[];a.forEach((t=>{o.find((e=>e.id===t.id))?n.push(t):s.push(t)}));const i=o.filter((t=>!a.find((e=>e.id===t.id))));e=Date.now(),s.forEach((t=>{t.__onExit?.({params:t.params,search:t.state.routeSearch}),"error"===t.state.status&&this.__store.setState((t=>({...t,status:"idle",error:void 0})))})),n.forEach((t=>{t.route.options.onTransition?.({params:t.params,search:t.state.routeSearch})})),i.forEach((t=>{t.__onExit=t.route.options.onLoaded?.({params:t.params,search:t.state.search})}));const c=this.state.location;this.__store.setState((t=>({...t,status:"idle",currentLocation:t.location,matches:o}))),c.href!==this.state.location.href&&this.options.onRouteChange?.(),this.resolveNavigation()};getRoute=t=>{const e=this.routesById[t];return s(e),e};loadRoute=async(t=this.state.location)=>{const e=this.buildNext(t),r=this.matchRoutes(e.pathname,e.search,{strictParseParams:!0});return await this.loadMatches(r,e),r};preloadRoute=async(t=this.state.location)=>{const e=this.buildNext(t),r=this.matchRoutes(e.pathname,e.search,{strictParseParams:!0});return await this.loadMatches(r,e,{preload:!0}),r};matchRoutes=(t,e,r)=>{if(!this.flatRoutes.length)return[];let o={},a=this.flatRoutes.find((e=>{const r=O(this.basepath,t,{to:e.fullPath,caseSensitive:e.options.caseSensitive??this.options.caseSensitive});return!!r&&(o=r,!0)}));if(!a)return[];let s=[a];for(;a?.parentRoute;)a=a.parentRoute,a&&s.unshift(a);let n={};const i=[...this.state.matches];return s.map((t=>{let a;try{a=t.options.parseParams?.(o)??o}catch(t){if(r?.strictParseParams)throw t}Object.assign(n,a);const s=j(t.path,n),c=j(t.id,n,!0)+(t.options.getKey?.({params:n,search:e})??""),h=i.find((t=>t.id===c));return h||new _t(this,t,{id:c,params:n,pathname:P([this.basepath,s])})})).filter(((t,e,r)=>r.findIndex((e=>e.id===t.id))===e))};loadMatches=async(t,e,r)=>{let o;try{await Promise.all(t.map((async(t,e)=>{try{await(t.route.options.beforeLoad?.({router:this,match:t}))}catch(r){if(gt(r))throw r;o=o??e;const a=t.route.options.onBeforeLoadError??t.route.options.onError;try{a?.(r)}catch(e){if(gt(e))throw e;return void t.__store.setState((t=>({...t,error:e,status:"error",updatedAt:Date.now()})))}t.__store.setState((t=>({...t,error:r,status:"error",updatedAt:Date.now()})))}})))}catch(t){if(gt(t))return void(r?.preload||this.navigate(t));throw t}const a=t.slice(0,o),s=a.map((async(t,o)=>{const s=a[o-1];t.__load({preload:r?.preload,location:e,parentMatch:s}),await t.__loadPromise,s&&await s.__loadPromise}));await Promise.all(s)};reload=()=>{this.navigate({fromCurrent:!0,replace:!0,search:!0})};resolvePath=(t,e)=>L(this.basepath,t,E(e));navigate=async({from:t,to:e="",search:r,hash:o,replace:a,params:n})=>{const i=String(e),c=void 0===t?t:String(t);let h;try{new URL(`${i}`),h=!0}catch(t){}return s(!h),this.#s({from:c,to:i,search:r,hash:o,replace:a,params:n})};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 o=e?.pending?this.state.location:this.state.currentLocation;if(!o)return!1;const a=O(this.basepath,o.pathname,{...e,to:r.pathname});return!!a&&(e?.includeSearch??1?!!S(o.search,r.search)&&a:a)};buildLink=({from:t,to:e=".",search:r,params:o,hash:a,target:s,replace:n,activeOptions:i,preload:c,preloadDelay:h,disabled:u})=>{try{return new URL(`${e}`),{type:"external",href:e}}catch(t){}const l={from:t,to:e,search:r,params:o,hash:a,replace:n},d=this.buildNext(l);c=c??this.options.defaultPreload;const p=h??this.options.defaultPreloadDelay??0,f=this.state.location.pathname.split("/"),m=d.pathname.split("/").every(((t,e)=>t===f[e])),y=i?.exact?this.state.location.pathname===d.pathname:m,g=!i?.includeHash||this.state.location.hash===d.hash,v=!(i?.includeSearch??1)||S(this.state.location.search,d.search);return{type:"internal",next:d,handleFocus:t=>{c&&this.preloadRoute(l).catch((t=>{console.warn(t),console.warn("Error preloading route! ☝️")}))},handleClick:t=>{u||function(t){return!!(t.metaKey||t.altKey||t.ctrlKey||t.shiftKey)}(t)||t.defaultPrevented||s&&"_self"!==s||0!==t.button||(t.preventDefault(),this.#s(l))},handleEnter:t=>{const e=t.target||{};if(c){if(e.preloadTimeout)return;e.preloadTimeout=setTimeout((()=>{e.preloadTimeout=null,this.preloadRoute(l).catch((t=>{console.warn(t),console.warn("Error preloading route! ☝️")}))}),p)}},handleLeave:t=>{const e=t.target||{};e.preloadTimeout&&(clearTimeout(e.preloadTimeout),e.preloadTimeout=null)},handleTouchStart:t=>{this.preloadRoute(l).catch((t=>{console.warn(t),console.warn("Error preloading route! ☝️")}))},isActive:y&&g&&v,disabled:u}};dehydrate=()=>({state:{...v(this.state,["location","status","lastUpdated"])}});hydrate=async t=>{let e=t;"undefined"!=typeof document&&(e=window.__TSR_DEHYDRATED__),s(e);const r=e;this.options.hydrate?.(r.payload),this.__store.setState((t=>({...t,...r.router.state,matches:t.matches,currentLocation:r.router.state.location}))),await this.load()};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="function"==typeof e?await e():e;return`<script>window["__TSR__DEHYRATED__${o=r,o.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(/"/g,'\\"')}"] = ${JSON.stringify(t)}<\/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__DEHYRATED__${e}`]}};#i=t=>{this.routeTree=t,this.routesById={},this.routesByPath={},this.flatRoutes=[];const e=t=>{t.forEach(((t,r)=>{t.init({originalIndex:r,router:this});if(s(!this.routesById[t.id],String(t.id)),this.routesById[t.id]=t,!t.isRoot&&t.path){const e=R(t.fullPath);this.routesByPath[e]&&!t.fullPath.endsWith("/")||(this.routesByPath[e]=t)}const o=t.children;o?.length&&e(o)}))};e([t]),this.flatRoutes=Object.values(this.routesByPath).map(((t,e)=>{const r=C(t.fullPath),o=k(r);for(;o.length>1&&"/"===o[0]?.value;)o.shift();const a=o.map((t=>"param"===t.type?.5:"wildcard"===t.type?.25:1));return{child:t,trimmed:r,parsed:o,index:e,score:a}})).sort(((t,e)=>{let r="/"===t.trimmed?1:"/"===e.trimmed?-1:0;if(0!==r)return r;const o=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<o;r++)if(t.score[r]!==e.score[r])return e.score[r]-t.score[r];for(let r=0;r<o;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)))};#n=t=>{let{pathname:e,search:r,hash:o,state:a}=this.history.location;const s=this.options.parseSearch(r);return{pathname:e,searchStr:r,search:_(t?.search,s),hash:o.split("#").reverse()[0]??"",href:`${e}${r}${o}`,state:a,key:a?.key||"__init__"}};#c=(t={})=>{t.fromCurrent=t.fromCurrent??""===t.to;const e=t.fromCurrent?this.state.location.pathname:t.from??this.state.location.pathname;let r=L(this.basepath??"/",e,`${t.to??""}`);const o={...y(this.matchRoutes(this.state.location.pathname,this.state.location.search,{strictParseParams:!0}))?.params};let a=!0===(t.params??!0)?o:g(t.params,o);a&&t.__matches?.map((t=>t.route.options.stringifyParams)).filter(Boolean).forEach((t=>{a={...a,...t(a)}})),r=j(r,a??{});const s=t.__matches?.map((t=>t.route.options.preSearchFilters??[])).flat().filter(Boolean)??[],n=t.__matches?.map((t=>t.route.options.postSearchFilters??[])).flat().filter(Boolean)??[],i=s?.length?s?.reduce(((t,e)=>e(t)),this.state.location.search):this.state.location.search,c=!0===t.search?i:t.search?g(t.search,i)??{}:s?.length?i:{},h=n?.length?n.reduce(((t,e)=>e(t)),c):c,u=_(this.state.location.search,h),l=this.options.stringifySearch(u),d=!0===t.hash?this.state.location.hash:g(t.hash,this.state.location.hash),p=d?`#${d}`:"";return{pathname:r,search:u,searchStr:l,state:!0===t.state?this.state.location.state:g(t.state,this.state.location.state),hash:d,href:this.history.createHref(`${r}${l}${p}`),key:t.key}};#s=async t=>{const e=this.buildNext(t),r=""+Date.now()+Math.random();this.navigateTimeout&&clearTimeout(this.navigateTimeout);let o="replace";t.replace||(o="push");this.state.location.href===e.href&&!e.key&&(o="replace");const a=`${e.pathname}${e.searchStr}${e.hash?`#${e.hash}`:""}`;return this.history["push"===o?"push":"replace"](a,{id:r,...e.state}),this.#h()};#h=()=>{const t=this.resolveNavigation;return this.navigationPromise=new Promise((e=>{this.resolveNavigation=()=>{e(),t()}})),this.navigationPromise}},t.RouterProvider=function({router:t,...e}){t.update(e);const r=W(H(t.__store,(t=>t.matches)));return a.useEffect(t.mount,[t]),a.createElement(z.Provider,{value:{router:t}},a.createElement(U.Provider,{value:[void 0,...r]},a.createElement(ot,{errorComponent:st,onCatch:()=>{}},a.createElement(Z,null))))},t.cleanPath=E,t.createBrowserHistory=d,t.createHashHistory=function(){return d({getHref:()=>window.location.hash.substring(1),createHref:t=>`#${t}`})},t.createMemoryHistory=p,t.decode=$,t.defaultFetchServerDataFn=ft,t.defaultParseSearch=ut,t.defaultStringifySearch=lt,t.encode=M,t.functionalUpdate=g,t.interpolatePath=j,t.invariant=s,t.isPlainObject=w,t.isRedirect=gt,t.joinPaths=P,t.last=y,t.lazy=function(t,e="default"){const r=a.lazy((async()=>({default:(await t())[e]})));return r.preload=async()=>{await t()},r},t.matchByPath=D,t.matchPathname=O,t.matchesContext=U,t.parsePathname=k,t.parseSearchWith=dt,t.partialDeepEqual=S,t.pick=v,t.redirect=function(t){return t.isRedirect=!0,t},t.replaceEqualDeep=_,t.resolvePath=L,t.rootRouteId=it,t.routerContext=z,t.stringifySearchWith=pt,t.trimPath=C,t.trimPathLeft=x,t.trimPathRight=R,t.useBlocker=nt,t.useDehydrate=function(){const t=J();return a.useCallback((function(e,r){return t.dehydrateData(e,r)}),[])},t.useHydrate=function(){const t=J();return function(e){return t.hydrateData(e)}},t.useInjectHtml=function(){const t=J();return a.useCallback((e=>{t.injectHtml(e)}),[])},t.useLinkProps=B,t.useLoader=Y,t.useMatch=V,t.useMatchRoute=X,t.useMatches=q,t.useNavigate=function(t){const e=J();return a.useCallback((r=>e.navigate({...t,...r})),[])},t.useParams=Q,t.useRouter=K,t.useRouterContext=J,t.useSearch=G,t.useStore=H,t.warning=n,Object.defineProperty(t,"__esModule",{value:!0})}));
*/function H(t,e=(t=>t)){return r.useSyncExternalStoreWithSelector(t.subscribe,(()=>t.state),(()=>t.state),e,N)}function N(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 o=0;o<r.length;o++)if(!Object.prototype.hasOwnProperty.call(e,r[o])||!Object.is(t[r[o]],e[r[o]]))return!1;return!0}function B(t){const e=W(),{type:r,children:o,target:s,activeProps:n=(()=>({className:"active"})),inactiveProps:i=(()=>({})),activeOptions:c,disabled:h,hash:u,search:l,params:d,to:p=".",preload:f,preloadDelay:m,replace:y,style:v,className:_,onClick:w,onFocus:b,onMouseEnter:S,onMouseLeave:P,onTouchStart:E,...x}=t,R=e.buildLink(t);if("external"===R.type){const{href:t}=R;return{href:t}}const{handleClick:C,handleFocus:L,handleEnter:k,handleLeave:j,handleTouchStart:O,isActive:D,next:M}=R,A=t=>e=>{e.persist&&e.persist(),t.filter(Boolean).forEach((t=>{e.defaultPrevented||t(e)}))},$=D?g(n,{})??{}:{},T=D?{}:g(i,{})??{};return{...$,...T,...x,href:h?void 0:M.href,onClick:A([w,t=>{a.startTransition?a.startTransition((()=>{C(t)})):C(t)}]),onFocus:A([b,L]),onMouseEnter:A([S,k]),onMouseLeave:A([P,j]),onTouchStart:A([E,O]),target:s,style:{...v,...$.style,...T.style},className:[_,$.className,T.className].filter(Boolean).join(" ")||void 0,...h?{role:"link","aria-disabled":!0}:void 0,"data-status":D?"active":void 0}}const F=a.forwardRef(((t,e)=>{const r=B(t);return a.createElement("a",T({ref:e},r,{children:"function"==typeof t.children?t.children({isActive:"active"===r["data-status"]}):t.children}))}));const U=a.createContext(null),z=a.createContext(null);function W(){const t=a.useContext(z);return H(t.router.__store),t.router}function J(t){const e=W();return H(e.__store,t),e}function K(){return a.useContext(U)}function q(t){const e=W(),r=K()[0],o=e.state.matches,a=t?.from?o.find((e=>e.route.id===t?.from)):r;return s(a,t?.from&&t.from),(t?.strict??1)&&s(r.route.id==a?.route.id,(a?.route.id,r.route.id,a?.route.id,a?.route.id)),H(a.__store,(e=>t?.track?.(a)??a)),a}function V(t){const{track:e,...r}=t,o=q(r);return H(o.__store,(e=>t?.track?.(e.loader)??e.loader)),o.state.loader}function Y(t){const{track:e,...r}=t??{},o=q(r);return H(o.__store,(e=>t?.track?.(e.search)??e.search)),o.state.search}function G(t){return H(W().__store,(e=>{const r=y(e.matches)?.params;return t?.track?.(r)??r}))}function Q(){const t=W();return a.useCallback((e=>{const{pending:r,caseSensitive:o,...a}=e;return t.matchRoute(a,{pending:r,caseSensitive:o})}),[])}function X(){const t=K().slice(1),e=t[0];return e?a.createElement(Z,{matches:t,match:e}):null}function Z({matches:t,match:e}){const r=W();H(e.__store,(t=>[t.status,t.error]));const o=a.useCallback((()=>null),[]),s=e.pendingComponent??r.options.defaultPendingComponent??o,n=e.errorComponent??r.options.defaultErrorComponent,i=e.route.options.wrapInSuspense??!e.route.isRoot?a.Suspense:et,c=n?rt:et;return a.createElement(U.Provider,{value:t},a.createElement(i,{fallback:a.createElement(s,null)},a.createElement(c,{key:e.route.id,errorComponent:n,onCatch:()=>{e.id}},a.createElement(tt,{match:e}))))}function tt(t){const e=W();if("error"===t.match.state.status)throw t.match.state.error;if("pending"===t.match.state.status)throw t.match.__loadPromise;if("success"===t.match.state.status)return a.createElement(t.match.component??e.options.defaultComponent??X,{useLoader:t.match.route.useLoader,useMatch:t.match.route.useMatch,useContext:t.match.route.useContext,useSearch:t.match.route.useSearch,useParams:t.match.route.useParams});s(!1)}function et(t){return a.createElement(a.Fragment,null,t.children)}class rt extends a.Component{state={error:!1,info:void 0};componentDidCatch(t,e){this.props.onCatch(t,e),console.error(t),this.setState({error:t,info:e})}render(){return a.createElement(ot,T({},this.props,{errorState:this.state,reset:()=>this.setState({})}))}}function ot(t){const[e,r]=a.useState(t.errorState),o=W(),s=t.errorComponent??at,n=a.useRef("");return a.useEffect((()=>{e&&(o.state.location.key,n.current),n.current=o.state.location.key}),[e,o.state.location.key]),a.useEffect((()=>{t.errorState.error}),[t.errorState.error]),t.errorState.error&&e.error?a.createElement(s,e):t.children}function at({error:t}){return a.createElement("div",{style:{padding:".5rem",maxWidth:"100%"}},a.createElement("strong",{style:{fontSize:"1.2rem"}},"Something went wrong!"),a.createElement("div",{style:{height:".5rem"}}),a.createElement("div",null,a.createElement("pre",{style:{fontSize:".7em",border:"1px solid red",borderRadius:".25rem",padding:".5rem",color:"red",overflow:"auto"}},t.message?a.createElement("code",null,t.message):null)))}function st(t,e=!0){const r=J();a.useEffect((()=>{if(!e)return;let o=r.history.block(((e,r)=>{window.confirm(t)&&(o(),e())}));return o}))}const nt="__root__";class it{constructor(t){this.options=t||{},this.isRoot=!t?.getParentRoute}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=nt:s(this.parentRoute);let o=r?nt:e.path;o&&"/"!==o&&(o=C(o));const a=e?.id||o;let n=r?nt:P([this.parentRoute.id===nt?"":this.parentRoute.id,a]);o===nt&&(o="/"),n!==nt&&(n=P(["/",n]));const i=n===nt?"/":P([this.parentRoute.fullPath,o]);this.path=o,this.id=n,this.fullPath=i,this.to=i};addChildren=t=>(this.children=t,this);useMatch=t=>q({...t,from:this.id});useLoader=t=>V({...t,from:this.id});useContext=t=>q({...t,from:this.id}).context;useSearch=t=>Y({...t,from:this.id});useParams=t=>G({...t,from:this.id})}class ct extends it{constructor(t){super(t)}static withRouterContext=()=>t=>new ct(t)}const ht=lt(JSON.parse),ut=dt(JSON.stringify);function lt(t){return e=>{"?"===e.substring(0,1)&&(e=e.substring(1));let r=$(e);for(let e in r){const o=r[e];if("string"==typeof o)try{r[e]=t(o)}catch(t){}}return r}}function dt(t){return e=>{(e={...e})&&Object.keys(e).forEach((r=>{const o=e[r];if(void 0===o||void 0===o)delete e[r];else if(o&&"object"==typeof o&&null!==o)try{e[r]=t(o)}catch(t){}}));const r=M(e).toString();return r?`?${r}`:""}}const pt=async({router:t,routeMatch:e})=>{const r=t.buildNext({to:".",search:t=>({...t??{},__data:{matchId:e.id}})}),o=await fetch(r.href,{method:"GET",signal:e.abortController.signal});if(o.ok)return o.json();throw new Error("Failed to fetch match data")};const ft="undefined"==typeof window||!window.document.createElement;function mt(){return{status:"idle",resolvedLocation:null,location:null,matches:[],lastUpdated:Date.now()}}function yt(t){return!!t?.isRedirect}const gt=["component","errorComponent","pendingComponent"];class vt{abortController=new AbortController;constructor(t,e,r){Object.assign(this,{route:e,router:t,id:r.id,pathname:r.pathname,params:r.params,__store:new I({updatedAt:0,routeSearch:{},search:{},status:"pending",loader:void 0},{onUpdate:()=>{this.state=this.__store.state}})}),this.state=this.__store.state,gt.map((async t=>{const e=this.route.options[t];this[t]=e})),this.__loadPromise=new Promise((t=>{this.__loadPromiseResolve=t})),"pending"!==this.state.status||this.#t()||(this.__store.setState((t=>({...t,status:"success"}))),this.__loadPromiseResolve?.())}#t=()=>!(!this.route.options.loader&&!gt.some((t=>this.route.options[t]?.preload)));__commit=()=>{const{routeSearch:t,search:e,context:r,routeContext:o}=this.#e({location:this.router.state.location});this.context=r,this.routeContext=o,this.__store.setState((r=>({...r,routeSearch:_(r.routeSearch,t),search:_(r.search,e)})))};cancel=()=>{this.abortController?.abort()};#r=t=>{const e=this.parentMatch?this.parentMatch.#r(t):{search:t.location.search,routeSearch:t.location.search};try{const t=("object"==typeof this.route.options.validateSearch?this.route.options.validateSearch.parse:this.route.options.validateSearch)?.(e.search)??{};return{routeSearch:t,search:{...e.search,...t}}}catch(t){if(yt(t))throw t;(this.route.options.onValidateSearchError??this.route.options.onError)?.(t);const e=new Error("Invalid search params found",{cause:t});throw e.code="INVALID_SEARCH_PARAMS",e}};#e=t=>{const{search:e,routeSearch:r}=this.#r(t);try{const t=this.route.options.getContext?.({parentContext:this.parentMatch?.routeContext??{},context:this.parentMatch?.context??this.router?.options.context??{},params:this.params,search:e})||{};return{routeSearch:r,search:e,context:{...this.parentMatch?.context??this.router?.options.context,...t},routeContext:t}}catch(t){throw this.route.options.onError?.(t),t}};__load=async t=>{let e;this.parentMatch=t.parentMatch;try{e=this.#e(t)}catch(e){return yt(e)?void(t?.preload||this.router.navigate(e)):void this.__store.setState((t=>({...t,status:"error",error:e})))}const{routeSearch:r,search:o,context:a,routeContext:s}=e,n={params:this.params,routeSearch:r,search:o,signal:this.abortController.signal,preload:!!t?.preload,routeContext:s,context:a};return this.__loadPromise=Promise.resolve().then((async()=>{const e=""+Date.now()+Math.random();this.#o=e;const r=()=>e!==this.#o?this.__loadPromise:void 0;let o;const a=(async()=>{await Promise.all(gt.map((async t=>{const e=this.route.options[t];e?.preload&&await e.preload()})))})(),s=Promise.resolve().then((()=>{if(this.route.options.loader)return this.route.options.loader(n)}));try{const[e,n]=await Promise.all([a,s]);if(o=r())return await o;t.preload||this.__store.setState((t=>({...t,error:void 0,status:"success",updatedAt:Date.now(),loader:n})))}catch(e){if(yt(e))return void(t?.preload||this.router.navigate(e));const r=this.route.options.onLoadError??this.route.options.onError;try{r?.(e)}catch(e){return yt(e)?void(t?.preload||this.router.navigate(e)):void this.__store.setState((t=>({...t,error:e,status:"error",updatedAt:Date.now()})))}this.__store.setState((t=>({...t,error:e,status:"error",updatedAt:Date.now()})))}finally{this.__loadPromiseResolve?.(),delete this.__loadPromise}})),this.__loadPromise};#o=""}t.Block=function({message:t,condition:e,children:r}){return st(t,e),r??null},t.ErrorComponent=at,t.Link=F,t.MatchRoute=function(t){const e=Q()(t);return e?"function"==typeof t.children?t.children(e):e?t.children:null:null},t.Navigate=function(t){const e=W();return a.useLayoutEffect((()=>{e.navigate(t)}),[]),null},t.Outlet=X,t.RootRoute=ct,t.Route=it,t.RouteMatch=vt,t.Router=class{#a;startedLoadingAt=Date.now();resolveNavigation=()=>{};constructor(t){this.options={defaultPreloadDelay:50,context:void 0,...t,stringifySearch:t?.stringifySearch??ut,parseSearch:t?.parseSearch??ht,fetchServerDataFn:t?.fetchServerDataFn??pt},this.__store=new I(mt(),{onUpdate:()=>{this.state=this.__store.state}}),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.#s({...e,replace:!0})}reset=()=>{this.__store.setState((t=>Object.assign(t,mt())))};mount=()=>(ft||this.state.matches.length||this.safeLoad(),()=>{});update=t=>{if(Object.assign(this.options,t),this.context=this.options.context,!this.history||this.options.history&&this.options.history!==this.history){this.#a&&this.#a(),this.history=this.options.history??(ft?p():d());const t=this.#n();this.__store.setState((e=>({...e,resolvedLocation:t,location:t}))),this.#a=this.history.listen((()=>{this.safeLoad({next:this.#n(this.state.location)})}))}const{basepath:e,routeTree:r}=this.options;return this.basepath=`/${C(e??"")??""}`,r&&r!==this.routeTree&&this.#i(r),this};buildNext=t=>{const e=this.#c(t),r=this.matchRoutes(e.pathname,e.search);return this.#c({...t,__matches:r})};cancelMatches=()=>{[...this.state.matches].forEach((t=>{t.cancel()}))};safeLoad=t=>{this.load(t).catch((t=>{console.warn(t),s(!1)}))};load=async t=>{this.#h();let e=Date.now();const r=e;let o;if(this.startedLoadingAt=r,this.cancelMatches(),this.__store.batch((()=>{t?.next&&this.__store.setState((e=>({...e,location:t.next}))),o=this.matchRoutes(this.state.location.pathname,this.state.location.search,{strictParseParams:!0,debug:!0}),this.__store.setState((t=>({...t,status:"pending",matches:o})))})),o.forEach((t=>{t.__commit()})),await this.loadMatches(o,this.state.location),this.startedLoadingAt!==r)return this.navigationPromise;const a=this.state.matches,s=[],n=[];a.forEach((t=>{o.find((e=>e.id===t.id))?n.push(t):s.push(t)}));const i=o.filter((t=>!a.find((e=>e.id===t.id))));e=Date.now(),s.forEach((t=>{t.__onExit?.({params:t.params,search:t.state.routeSearch}),"error"===t.state.status&&this.__store.setState((t=>({...t,status:"idle",error:void 0})))})),n.forEach((t=>{t.route.options.onTransition?.({params:t.params,search:t.state.routeSearch})})),i.forEach((t=>{t.__onExit=t.route.options.onLoaded?.({params:t.params,search:t.state.search})}));const c=this.state.location;this.__store.setState((t=>({...t,status:"idle",resolvedLocation:t.location,matches:o}))),c.href!==this.state.location.href&&this.options.onRouteChange?.(),this.resolveNavigation()};getRoute=t=>{const e=this.routesById[t];return s(e),e};loadRoute=async(t=this.state.location)=>{const e=this.buildNext(t),r=this.matchRoutes(e.pathname,e.search,{strictParseParams:!0});return await this.loadMatches(r,e),r};preloadRoute=async(t=this.state.location)=>{const e=this.buildNext(t),r=this.matchRoutes(e.pathname,e.search,{strictParseParams:!0});return await this.loadMatches(r,e,{preload:!0}),r};matchRoutes=(t,e,r)=>{if(!this.flatRoutes.length)return[];let o={},a=this.flatRoutes.find((e=>{const r=O(this.basepath,t,{to:e.fullPath,caseSensitive:e.options.caseSensitive??this.options.caseSensitive});return!!r&&(o=r,!0)}));if(!a)return[];let s=[a];for(;a?.parentRoute;)a=a.parentRoute,a&&s.unshift(a);let n={};const i=[...this.state.matches];return s.map((t=>{let a;try{a=t.options.parseParams?.(o)??o}catch(t){if(r?.strictParseParams)throw t}Object.assign(n,a);const s=j(t.path,n),c=j(t.id,n,!0)+(t.options.getKey?.({params:n,search:e})??""),h=i.find((t=>t.id===c));return h||new vt(this,t,{id:c,params:n,pathname:P([this.basepath,s])})})).filter(((t,e,r)=>r.findIndex((e=>e.id===t.id))===e))};loadMatches=async(t,e,r)=>{let o;try{await Promise.all(t.map((async(t,e)=>{try{await(t.route.options.beforeLoad?.({router:this,match:t}))}catch(r){if(yt(r))throw r;o=o??e;const a=t.route.options.onBeforeLoadError??t.route.options.onError;try{a?.(r)}catch(e){if(yt(e))throw e;return void t.__store.setState((t=>({...t,error:e,status:"error",updatedAt:Date.now()})))}t.__store.setState((t=>({...t,error:r,status:"error",updatedAt:Date.now()})))}})))}catch(t){if(yt(t))return void(r?.preload||this.navigate(t));throw t}const a=t.slice(0,o),s=a.map((async(t,o)=>{const s=a[o-1];t.__load({preload:r?.preload,location:e,parentMatch:s}),await t.__loadPromise,s&&await s.__loadPromise}));await Promise.all(s)};reload=()=>{this.navigate({fromCurrent:!0,replace:!0,search:!0})};resolvePath=(t,e)=>L(this.basepath,t,E(e));navigate=async({from:t,to:e="",search:r,hash:o,replace:a,params:n})=>{const i=String(e),c=void 0===t?t:String(t);let h;try{new URL(`${i}`),h=!0}catch(t){}return s(!h),this.#s({from:c,to:i,search:r,hash:o,replace:a,params:n})};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 o=e?.pending?this.state.location:this.state.resolvedLocation;if(!o)return!1;const a=O(this.basepath,o.pathname,{...e,to:r.pathname});return!!a&&(e?.includeSearch??1?!!S(o.search,r.search)&&a:a)};buildLink=({from:t,to:e=".",search:r,params:o,hash:a,target:s,replace:n,activeOptions:i,preload:c,preloadDelay:h,disabled:u})=>{try{return new URL(`${e}`),{type:"external",href:e}}catch(t){}const l={from:t,to:e,search:r,params:o,hash:a,replace:n},d=this.buildNext(l);c=c??this.options.defaultPreload;const p=h??this.options.defaultPreloadDelay??0,f=this.state.location.pathname.split("/"),m=d.pathname.split("/").every(((t,e)=>t===f[e])),y=i?.exact?this.state.location.pathname===d.pathname:m,g=!i?.includeHash||this.state.location.hash===d.hash,v=!(i?.includeSearch??1)||S(this.state.location.search,d.search);return{type:"internal",next:d,handleFocus:t=>{c&&this.preloadRoute(l).catch((t=>{console.warn(t),console.warn("Error preloading route! ☝️")}))},handleClick:t=>{u||function(t){return!!(t.metaKey||t.altKey||t.ctrlKey||t.shiftKey)}(t)||t.defaultPrevented||s&&"_self"!==s||0!==t.button||(t.preventDefault(),this.#s(l))},handleEnter:t=>{const e=t.target||{};if(c){if(e.preloadTimeout)return;e.preloadTimeout=setTimeout((()=>{e.preloadTimeout=null,this.preloadRoute(l).catch((t=>{console.warn(t),console.warn("Error preloading route! ☝️")}))}),p)}},handleLeave:t=>{const e=t.target||{};e.preloadTimeout&&(clearTimeout(e.preloadTimeout),e.preloadTimeout=null)},handleTouchStart:t=>{this.preloadRoute(l).catch((t=>{console.warn(t),console.warn("Error preloading route! ☝️")}))},isActive:y&&g&&v,disabled:u}};dehydrate=()=>({state:{...v(this.state,["location","status","lastUpdated"])}});hydrate=async t=>{let e=t;"undefined"!=typeof document&&(e=window.__TSR_DEHYDRATED__),s(e);const r=e;this.options.hydrate?.(r.payload),this.__store.setState((t=>({...t,...r.router.state,matches:t.matches,resolvedLocation:r.router.state.location}))),await this.load()};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="function"==typeof e?await e():e;return`<script>window["__TSR__DEHYRATED__${o=r,o.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(/"/g,'\\"')}"] = ${JSON.stringify(t)}<\/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__DEHYRATED__${e}`]}};#i=t=>{this.routeTree=t,this.routesById={},this.routesByPath={},this.flatRoutes=[];const e=t=>{t.forEach(((t,r)=>{t.init({originalIndex:r,router:this});if(s(!this.routesById[t.id],String(t.id)),this.routesById[t.id]=t,!t.isRoot&&t.path){const e=R(t.fullPath);this.routesByPath[e]&&!t.fullPath.endsWith("/")||(this.routesByPath[e]=t)}const o=t.children;o?.length&&e(o)}))};e([t]),this.flatRoutes=Object.values(this.routesByPath).map(((t,e)=>{const r=C(t.fullPath),o=k(r);for(;o.length>1&&"/"===o[0]?.value;)o.shift();const a=o.map((t=>"param"===t.type?.5:"wildcard"===t.type?.25:1));return{child:t,trimmed:r,parsed:o,index:e,score:a}})).sort(((t,e)=>{let r="/"===t.trimmed?1:"/"===e.trimmed?-1:0;if(0!==r)return r;const o=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<o;r++)if(t.score[r]!==e.score[r])return e.score[r]-t.score[r];for(let r=0;r<o;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)))};#n=t=>{let{pathname:e,search:r,hash:o,state:a}=this.history.location;const s=this.options.parseSearch(r);return{pathname:e,searchStr:r,search:_(t?.search,s),hash:o.split("#").reverse()[0]??"",href:`${e}${r}${o}`,state:a,key:a?.key||"__init__"}};#c=(t={})=>{t.fromCurrent=t.fromCurrent??""===t.to;const e=t.fromCurrent?this.state.location.pathname:t.from??this.state.location.pathname;let r=L(this.basepath??"/",e,`${t.to??""}`);const o={...y(this.matchRoutes(this.state.location.pathname,this.state.location.search,{strictParseParams:!0}))?.params};let a=!0===(t.params??!0)?o:g(t.params,o);a&&t.__matches?.map((t=>t.route.options.stringifyParams)).filter(Boolean).forEach((t=>{a={...a,...t(a)}})),r=j(r,a??{});const s=t.__matches?.map((t=>t.route.options.preSearchFilters??[])).flat().filter(Boolean)??[],n=t.__matches?.map((t=>t.route.options.postSearchFilters??[])).flat().filter(Boolean)??[],i=s?.length?s?.reduce(((t,e)=>e(t)),this.state.location.search):this.state.location.search,c=!0===t.search?i:t.search?g(t.search,i)??{}:s?.length?i:{},h=n?.length?n.reduce(((t,e)=>e(t)),c):c,u=_(this.state.location.search,h),l=this.options.stringifySearch(u),d=!0===t.hash?this.state.location.hash:g(t.hash,this.state.location.hash),p=d?`#${d}`:"";return{pathname:r,search:u,searchStr:l,state:!0===t.state?this.state.location.state:g(t.state,this.state.location.state),hash:d,href:this.history.createHref(`${r}${l}${p}`),key:t.key}};#s=async t=>{const e=this.buildNext(t),r=""+Date.now()+Math.random();this.navigateTimeout&&clearTimeout(this.navigateTimeout);let o="replace";t.replace||(o="push");this.state.location.href===e.href&&!e.key&&(o="replace");const a=`${e.pathname}${e.searchStr}${e.hash?`#${e.hash}`:""}`;return this.history["push"===o?"push":"replace"](a,{id:r,...e.state}),this.#h()};#h=()=>{const t=this.resolveNavigation;return this.navigationPromise=new Promise((e=>{this.resolveNavigation=()=>{e(),t()}})),this.navigationPromise}},t.RouterProvider=function({router:t,...e}){t.update(e);const r=H(t.__store,(t=>t.matches));return a.useEffect(t.mount,[t]),a.createElement(z.Provider,{value:{router:t}},a.createElement(U.Provider,{value:[void 0,...r]},a.createElement(rt,{errorComponent:at,onCatch:()=>{}},a.createElement(X,null))))},t.cleanPath=E,t.createBrowserHistory=d,t.createHashHistory=function(){return d({getHref:()=>window.location.hash.substring(1),createHref:t=>`#${t}`})},t.createMemoryHistory=p,t.decode=$,t.defaultFetchServerDataFn=pt,t.defaultParseSearch=ht,t.defaultStringifySearch=ut,t.encode=M,t.functionalUpdate=g,t.interpolatePath=j,t.invariant=s,t.isPlainObject=w,t.isRedirect=yt,t.joinPaths=P,t.last=y,t.lazy=function(t,e="default"){const r=a.lazy((async()=>({default:(await t())[e]})));return r.preload=async()=>{await t()},r},t.matchByPath=D,t.matchPathname=O,t.matchesContext=U,t.parsePathname=k,t.parseSearchWith=lt,t.partialDeepEqual=S,t.pick=v,t.redirect=function(t){return t.isRedirect=!0,t},t.replaceEqualDeep=_,t.resolvePath=L,t.rootRouteId=nt,t.routerContext=z,t.stringifySearchWith=dt,t.trimPath=C,t.trimPathLeft=x,t.trimPathRight=R,t.useBlocker=st,t.useDehydrate=function(){const t=W();return a.useCallback((function(e,r){return t.dehydrateData(e,r)}),[])},t.useHydrate=function(){const t=W();return function(e){return t.hydrateData(e)}},t.useInjectHtml=function(){const t=W();return a.useCallback((e=>{t.injectHtml(e)}),[])},t.useLinkProps=B,t.useLoader=V,t.useMatch=q,t.useMatchRoute=Q,t.useMatches=K,t.useNavigate=function(t){const e=W();return a.useCallback((r=>e.navigate({...t,...r})),[])},t.useParams=G,t.useRouter=J,t.useRouterContext=W,t.useSearch=Y,t.useStore=H,t.warning=n,Object.defineProperty(t,"__esModule",{value:!0})}));
//# sourceMappingURL=index.production.js.map
{
"name": "@tanstack/router",
"author": "Tanner Linsley",
"version": "0.0.1-beta.117",
"version": "0.0.1-beta.118",
"license": "MIT",

@@ -46,3 +46,3 @@ "repository": "tanstack/router",

"@gisatcz/cross-package-react-context": "^0.2.0",
"@tanstack/react-store": "0.0.1-beta.113"
"@tanstack/react-store": "0.0.1-beta.118"
},

@@ -49,0 +49,0 @@ "scripts": {

@@ -165,3 +165,3 @@ import { Store } from '@tanstack/react-store'

location: ParsedLocation<TRoutesInfo['fullSearchSchema'], TState>
currentLocation: ParsedLocation<TRoutesInfo['fullSearchSchema'], TState>
resolvedLocation: ParsedLocation<TRoutesInfo['fullSearchSchema'], TState>
lastUpdated: number

@@ -361,3 +361,3 @@ }

...s,
currentLocation: parsedLocation,
resolvedLocation: parsedLocation,
location: parsedLocation,

@@ -512,3 +512,3 @@ }))

status: 'idle',
currentLocation: s.location,
resolvedLocation: s.location,
matches,

@@ -808,3 +808,3 @@ }))

? this.state.location
: this.state.currentLocation
: this.state.resolvedLocation

@@ -1000,3 +1000,3 @@ if (!baseLocation) {

matches: s.matches,
currentLocation: ctx.router.state.location,
resolvedLocation: ctx.router.state.location,
}

@@ -1328,3 +1328,3 @@ })

status: 'idle',
currentLocation: null!,
resolvedLocation: null!,
location: null!,

@@ -1331,0 +1331,0 @@ matches: [],

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc