@tanstack/react-router 0.0.1-beta.4 → 0.0.1-beta.45

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.
@@ -8,7 +8,7 @@
8
8
  *
9
9
  * @license MIT
10
10
  */
11
- !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("react"),require("use-sync-external-store/shim")):"function"==typeof define&&define.amd?define(["exports","react","use-sync-external-store/shim"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).ReactRouter={},e.React,e.shim)}(this,(function(e,t,n){"use strict";function a(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(n){if("default"!==n){var a=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,a.get?a:{enumerable:!0,get:function(){return e[n]}})}})),t.default=e,Object.freeze(t)}var r,o=a(t);function i(){return i=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var a in n)Object.prototype.hasOwnProperty.call(n,a)&&(e[a]=n[a])}return e},i.apply(this,arguments)}function s(e,t){if(null==e)return{};var n,a,r={},o=Object.keys(e);for(a=0;a<o.length;a++)n=o[a],t.indexOf(n)>=0||(r[n]=e[n]);return r}
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,r){"use strict";function n(t){if(t&&t.__esModule)return t;var e=Object.create(null);return t&&Object.keys(t).forEach((function(r){if("default"!==r){var n=Object.getOwnPropertyDescriptor(t,r);Object.defineProperty(e,r,n.get?n:{enumerable:!0,get:function(){return t[r]}})}})),e.default=t,Object.freeze(e)}var o=n(e);function a(){return a=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},a.apply(this,arguments)}var s,i=void 0,c=null,l=0,u=null,h=class{value;fn;observers=null;sources=null;state;effect;cleanups=null;alwaysUpdate=!1;constructor(t,e){0!=e?(this.fn=t,this.value=void 0,this.state=2,s?s.push(this):console.error("Memos and effects must be wrapped in a createRoot"),this.effect=2==e,this.effect&&this.update()):(this.fn=void 0,this.value=t,this.state=0,this.effect=!1)}get(){return i&&(!c&&i.sources&&i.sources[l]==this?l++:c?c.push(this):c=[this]),this.fn&&this.updateIfNecessary(),this.value}set(t){const e=!u,r="function"==typeof t?t(this.value):t;if((this.value!==r||this.alwaysUpdate)&&this.observers)for(let t=0;t<this.observers.length;t++)this.observers[t].stale(2);return this.value=r,e&&d(),r}stale(t){if(this.state<t&&(0===this.state&&this.effect&&(u?u.push(this):u=[this]),this.state=t,this.observers))for(let t=0;t<this.observers.length;t++)this.observers[t].stale(1)}update(){const t=this.value,e=i,r=c,n=l;i=this,c=null,l=0;try{if(this.cleanups&&(this.cleanups.forEach((t=>t())),this.cleanups=null),this.value=this.fn(),c){if(this.removeParentObservers(l),this.sources&&l>0){this.sources.length=l+c.length;for(let t=0;t<c.length;t++)this.sources[l+t]=c[t]}else this.sources=c;for(let t=l;t<this.sources.length;t++){const e=this.sources[t];e.observers?e.observers.push(this):e.observers=[this]}}else this.sources&&l<this.sources.length&&(this.removeParentObservers(l),this.sources.length=l)}finally{c=r,i=e,l=n}if((t!==this.value||this.alwaysUpdate)&&this.observers)for(let t=0;t<this.observers.length;t++)this.observers[t].state=2;this.state=0}updateIfNecessary(){if(1===this.state)for(const t of this.sources)if(t.updateIfNecessary(),2===this.state)break;2===this.state&&this.update(),this.state=0}removeParentObservers(t){if(this.sources)for(let e=t;e<this.sources.length;e++){const t=this.sources[e],r=t.observers.findIndex((t=>t===this));t.observers[r]=t.observers[t.observers.length-1],t.observers.pop()}}destroy(){this.cleanups&&(this.cleanups.forEach((t=>t())),this.cleanups=null),this.removeParentObservers(0)}};function d(){if(u){for(let t=0;t<u.length;t++)u[t].get();u=null}}function f(t){const e=new h(t,2);return e.get.bind(e)}function p(t){let e=[];return s=e,t(),s=null,()=>{e&&(e.forEach((t=>t.destroy())),e=null)}}function m(t){u=[];let e=t();return d(),e}function v(t){const e=i;i=void 0;try{return t()}finally{i=e}}var g=Symbol("store-raw"),y=Symbol("track"),b=Symbol("store-proxy"),w=Symbol("store-node");function P(t){let e=t[b];if(!e&&(Object.defineProperty(t,b,{value:e=new Proxy(t,I)}),!Array.isArray(t))){const r=Object.keys(t),n=Object.getOwnPropertyDescriptors(t);for(let o=0,a=r.length;o<a;o++){const a=r[o];if(n[a].get){const r=n[a].get.bind(e);Object.defineProperty(t,a,{enumerable:n[a].enumerable,get:r})}}}return e}function E(t){let e;return null!=t&&"object"==typeof t&&(t[b]||!(e=Object.getPrototypeOf(t))||e===Object.prototype||Array.isArray(t))}function _(t,e=new Set){let r,n,o,a;if(r=null!=t&&t[g])return r;if(!E(t)||e.has(t))return t;if(Array.isArray(t)){Object.isFrozen(t)?t=t.slice(0):e.add(t);for(let r=0,a=t.length;r<a;r++)o=t[r],(n=_(o,e))!==o&&(t[r]=n)}else{Object.isFrozen(t)?t=Object.assign({},t):e.add(t);const r=Object.keys(t),s=Object.getOwnPropertyDescriptors(t);for(let i=0,c=r.length;i<c;i++)a=r[i],s[a].get||(o=t[a],(n=_(o,e))!==o&&(t[a]=n))}return t}function M(t){let e=t[w];return e||Object.defineProperty(t,w,{value:e={}}),e}function L(t,e,r){return t[e]||(t[e]=x(r))}function S(t){if(i){const e=M(t);(e._||(e._=x())).get()}}function x(t){const e=new h(t,0);return e.alwaysUpdate=!0,e}var R,A=!1,I={get(t,e,r){if(e===g)return t;if(e===b)return r;if(e===y)return S(t),r;const n=M(t),o=n.hasOwnProperty(e);let a=o?n[e].get():t[e];if(e===w||"__proto__"===e)return a;if(!o){const r=Object.getOwnPropertyDescriptor(t,e);!i||"function"==typeof a&&!t.hasOwnProperty(e)||r&&r.get||(a=L(n,e,a).get())}return E(a)?P(a):a},has(t,e){return e===g||e===b||e===y||e===w||"__proto__"===e||(this.get(t,e,t),e in t)},set:(t,e,r)=>(A&&O(t,e,_(r)),!0),deleteProperty:(t,e)=>(A&&O(t,e,void 0,!0),!0),ownKeys:function(t){return S(t),Reflect.ownKeys(t)},getOwnPropertyDescriptor:function(t,e){const r=Reflect.getOwnPropertyDescriptor(t,e);return r&&!r.get&&r.configurable&&e!==b&&e!==w?(delete r.value,delete r.writable,r.get=()=>t[b][e],r):r}};function O(t,e,r,n=!1){if(!n&&t[e]===r)return;const o=t[e],a=t.length;n?delete t[e]:t[e]=r;const s=M(t);let i;(i=L(s,e,o))&&i.set((()=>r)),Array.isArray(t)&&t.length!==a&&(i=L(s,"length",a))&&i.set(t.length),(i=s._)&&i.set()}function C(t){const e=P(_(t));return[e,t=>{m((()=>{try{A=!0,t(e)}finally{A=!1}}))}]}function k(){return k=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},k.apply(this,arguments)}!function(t){t.Pop="POP",t.Push="PUSH",t.Replace="REPLACE"}(R||(R={}));var j="beforeunload",D="popstate";function F(t){void 0===t&&(t={});var e=t.window,r=void 0===e?document.defaultView:e,n=r.history;function o(){var t=r.location,e=t.pathname,o=t.search,a=t.hash,s=n.state||{};return[s.idx,{pathname:e,search:o,hash:a,state:s.usr||null,key:s.key||"default"}]}var a=null;r.addEventListener(D,(function(){if(a)h.call(a),a=null;else{var t=R.Pop,e=o(),r=e[0],n=e[1];if(h.length){if(null!=r){var s=c-r;s&&(a={action:t,location:n,retry:function(){g(-1*s)}},g(s))}}else v(t)}}));var s=R.Pop,i=o(),c=i[0],l=i[1],u=U(),h=U();function d(t){return"string"==typeof t?t:z(t)}function f(t,e){return void 0===e&&(e=null),k({pathname:l.pathname,hash:"",search:""},"string"==typeof t?H(t):t,{state:e,key:B()})}function p(t,e){return[{usr:t.state,key:t.key,idx:e},d(t)]}function m(t,e,r){return!h.length||(h.call({action:t,location:e,retry:r}),!1)}function v(t){s=t;var e=o();c=e[0],l=e[1],u.call({action:s,location:l})}function g(t){n.go(t)}null==c&&(c=0,n.replaceState(k({},n.state,{idx:c}),""));var y={get action(){return s},get location(){return l},createHref:d,push:function t(e,o){var a=R.Push,s=f(e,o);if(m(a,s,(function(){t(e,o)}))){var i=p(s,c+1),l=i[0],u=i[1];try{n.pushState(l,"",u)}catch(t){r.location.assign(u)}v(a)}},replace:function t(e,r){var o=R.Replace,a=f(e,r);if(m(o,a,(function(){t(e,r)}))){var s=p(a,c),i=s[0],l=s[1];n.replaceState(i,"",l),v(o)}},go:g,back:function(){g(-1)},forward:function(){g(1)},listen:function(t){return u.push(t)},block:function(t){var e=h.push(t);return 1===h.length&&r.addEventListener(j,$),function(){e(),h.length||r.removeEventListener(j,$)}}};return y}function N(t){void 0===t&&(t={});var e=t,r=e.initialEntries,n=void 0===r?["/"]:r,o=e.initialIndex,a=n.map((function(t){return k({pathname:"/",search:"",hash:"",state:null,key:B()},"string"==typeof t?H(t):t)})),s=T(null==o?a.length-1:o,0,a.length-1),i=R.Pop,c=a[s],l=U(),u=U();function h(t,e){return void 0===e&&(e=null),k({pathname:c.pathname,search:"",hash:""},"string"==typeof t?H(t):t,{state:e,key:B()})}function d(t,e,r){return!u.length||(u.call({action:t,location:e,retry:r}),!1)}function f(t,e){i=t,c=e,l.call({action:i,location:c})}function p(t){var e=T(s+t,0,a.length-1),r=R.Pop,n=a[e];d(r,n,(function(){p(t)}))&&(s=e,f(r,n))}var m={get index(){return s},get action(){return i},get location(){return c},createHref:function(t){return"string"==typeof t?t:z(t)},push:function t(e,r){var n=R.Push,o=h(e,r);d(n,o,(function(){t(e,r)}))&&(s+=1,a.splice(s,a.length,o),f(n,o))},replace:function t(e,r){var n=R.Replace,o=h(e,r);d(n,o,(function(){t(e,r)}))&&(a[s]=o,f(n,o))},go:p,back:function(){p(-1)},forward:function(){p(1)},listen:function(t){return l.push(t)},block:function(t){return u.push(t)}};return m}function T(t,e,r){return Math.min(Math.max(t,e),r)}function $(t){t.preventDefault(),t.returnValue=""}function U(){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 B(){return Math.random().toString(36).substr(2,8)}function z(t){var e=t.pathname,r=void 0===e?"/":e,n=t.search,o=void 0===n?"":n,a=t.hash,s=void 0===a?"":a;return o&&"?"!==o&&(r+="?"===o.charAt(0)?o:"?"+o),s&&"#"!==s&&(r+="#"===s.charAt(0)?s:"#"+s),r}function H(t){var e={};if(t){var r=t.indexOf("#");r>=0&&(e.hash=t.substr(r),t=t.substr(0,r));var n=t.indexOf("?");n>=0&&(e.search=t.substr(n),t=t.substr(0,n)),t&&(e.pathname=t)}return e}function G(t,e){if(!t)throw new Error("Invariant failed")}
12
12
  /**
13
13
  * router-core
14
14
  *
@@ -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(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var a in n)Object.prototype.hasOwnProperty.call(n,a)&&(e[a]=n[a])}return e},l.apply(this,arguments)}!function(e){e.Pop="POP",e.Push="PUSH",e.Replace="REPLACE"}(r||(r={}));var c="beforeunload",u="popstate";function d(e){void 0===e&&(e={});var t=e.window,n=void 0===t?document.defaultView:t,a=n.history;function o(){var e=n.location,t=e.pathname,r=e.search,o=e.hash,i=a.state||{};return[i.idx,{pathname:t,search:r,hash:o,state:i.usr||null,key:i.key||"default"}]}var i=null;n.addEventListener(u,(function(){if(i)P.call(i),i=null;else{var e=r.Pop,t=o(),n=t[0],a=t[1];if(P.length){if(null!=n){var s=h-n;s&&(i={action:e,location:a,retry:function(){M(-1*s)}},M(s))}}else R(e)}}));var s=r.Pop,d=o(),h=d[0],f=d[1],_=m(),P=m();function b(e){return"string"==typeof e?e:g(e)}function w(e,t){return void 0===t&&(t=null),l({pathname:f.pathname,hash:"",search:""},"string"==typeof e?y(e):e,{state:t,key:v()})}function E(e,t){return[{usr:e.state,key:e.key,idx:t},b(e)]}function x(e,t,n){return!P.length||(P.call({action:e,location:t,retry:n}),!1)}function R(e){s=e;var t=o();h=t[0],f=t[1],_.call({action:s,location:f})}function M(e){a.go(e)}null==h&&(h=0,a.replaceState(l({},a.state,{idx:h}),""));var A={get action(){return s},get location(){return f},createHref:b,push:function e(t,o){var i=r.Push,s=w(t,o);if(x(i,s,(function(){e(t,o)}))){var l=E(s,h+1),c=l[0],u=l[1];try{a.pushState(c,"",u)}catch(e){n.location.assign(u)}R(i)}},replace:function e(t,n){var o=r.Replace,i=w(t,n);if(x(o,i,(function(){e(t,n)}))){var s=E(i,h),l=s[0],c=s[1];a.replaceState(l,"",c),R(o)}},go:M,back:function(){M(-1)},forward:function(){M(1)},listen:function(e){return _.push(e)},block:function(e){var t=P.push(e);return 1===P.length&&n.addEventListener(c,p),function(){t(),P.length||n.removeEventListener(c,p)}}};return A}function h(e){void 0===e&&(e={});var t=e,n=t.initialEntries,a=void 0===n?["/"]:n,o=t.initialIndex,i=a.map((function(e){return l({pathname:"/",search:"",hash:"",state:null,key:v()},"string"==typeof e?y(e):e)})),s=f(null==o?i.length-1:o,0,i.length-1),c=r.Pop,u=i[s],d=m(),h=m();function p(e,t){return void 0===t&&(t=null),l({pathname:u.pathname,search:"",hash:""},"string"==typeof e?y(e):e,{state:t,key:v()})}function _(e,t,n){return!h.length||(h.call({action:e,location:t,retry:n}),!1)}function P(e,t){c=e,u=t,d.call({action:c,location:u})}function b(e){var t=f(s+e,0,i.length-1),n=r.Pop,a=i[t];_(n,a,(function(){b(e)}))&&(s=t,P(n,a))}var w={get index(){return s},get action(){return c},get location(){return u},createHref:function(e){return"string"==typeof e?e:g(e)},push:function e(t,n){var a=r.Push,o=p(t,n);_(a,o,(function(){e(t,n)}))&&(s+=1,i.splice(s,i.length,o),P(a,o))},replace:function e(t,n){var a=r.Replace,o=p(t,n);_(a,o,(function(){e(t,n)}))&&(i[s]=o,P(a,o))},go:b,back:function(){b(-1)},forward:function(){b(1)},listen:function(e){return d.push(e)},block:function(e){return h.push(e)}};return w}function f(e,t,n){return Math.min(Math.max(e,t),n)}function p(e){e.preventDefault(),e.returnValue=""}function m(){var e=[];return{get length(){return e.length},push:function(t){return e.push(t),function(){e=e.filter((function(e){return e!==t}))}},call:function(t){e.forEach((function(e){return e&&e(t)}))}}}function v(){return Math.random().toString(36).substr(2,8)}function g(e){var t=e.pathname,n=void 0===t?"/":t,a=e.search,r=void 0===a?"":a,o=e.hash,i=void 0===o?"":o;return r&&"?"!==r&&(n+="?"===r.charAt(0)?r:"?"+r),i&&"#"!==i&&(n+="#"===i.charAt(0)?i:"#"+i),n}function y(e){var t={};if(e){var n=e.indexOf("#");n>=0&&(t.hash=e.substr(n),e=e.substr(0,n));var a=e.indexOf("?");a>=0&&(t.search=e.substr(a),e=e.substr(0,a)),e&&(t.pathname=e)}return t}function _(e,t){if(!e)throw new Error("Invariant failed")}function P(e,t){if(e===t)return e;const n=Array.isArray(e)&&Array.isArray(t);if(n||b(e)&&b(t)){const a=n?e.length:Object.keys(e).length,r=n?t:Object.keys(t),o=r.length,i=n?[]:{};let s=0;for(let a=0;a<o;a++){const o=n?a:r[a];i[o]=P(e[o],t[o]),i[o]===e[o]&&s++}return a===o&&s===a?e:i}return t}function b(e){if(!w(e))return!1;const t=e.constructor;if(void 0===t)return!0;const n=t.prototype;return!!w(n)&&!!n.hasOwnProperty("isPrototypeOf")}function w(e){return"[object Object]"===Object.prototype.toString.call(e)}function E(e){return e[e.length-1]}function x(e,t){if(e){"undefined"!=typeof console&&console.warn(t);try{throw new Error(t)}catch(e){}}return!0}function R(e,t){return"function"==typeof e?e(t):e}function M(e){return A(e.filter(Boolean).join("/"))}function A(e){return e.replace(/\/{2,}/g,"/")}function S(e){return"/"===e?e:e.replace(/^\/{1,}/,"")}function I(e){return"/"===e?e:e.replace(/\/{1,}$/,"")}function L(e){return I(S(e))}function C(e,t,n){t=t.replace(new RegExp("^"+e),"/"),n=n.replace(new RegExp("^"+e),"/");let a=k(t);const r=k(n);r.forEach(((e,t)=>{if("/"===e.value)t?t===r.length-1&&a.push(e):a=[e];else if(".."===e.value){var n;a.length>1&&"/"===(null==(n=E(a))?void 0:n.value)&&a.pop(),a.pop()}else{if("."===e.value)return;a.push(e)}}));return A(M([e,...a.map((e=>e.value))]))}function k(e){if(!e)return[];const t=[];if("/"===(e=A(e)).slice(0,1)&&(e=e.substring(1),t.push({type:"pathname",value:"/"})),!e)return t;const n=e.split("/").filter(Boolean);return t.push(...n.map((e=>e.startsWith("*")?{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 O(e,t,n){return M(k(e).map((e=>{return"*"!==e.value||n?"param"===e.type?null!=(a=t[e.value.substring(1)])?a:"":e.value:"";var a})))}function j(e,t){const n=D(e,t);if(!t.to||n)return null!=n?n:{}}function D(e,t){var n;const a=k(e),r=k(""+(null!=(n=t.to)?n:"*")),o={};return(()=>{for(let e=0;e<Math.max(a.length,r.length);e++){const n=a[e],i=r[e],s=e===r.length-1,l=e===a.length-1;if(i){if("wildcard"===i.type)return!(null==n||!n.value)&&(o["*"]=M(a.slice(e).map((e=>e.value))),!0);if("pathname"===i.type){if("/"===i.value&&(null==n||!n.value))return!0;if(n)if(t.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(":")||(o[i.value.substring(1)]=n.value)}}if(s&&!l)return!!t.fuzzy}return!0})()?o:void 0}function T(e,t){var n,a,r,o="";for(n in e)if(void 0!==(r=e[n]))if(Array.isArray(r))for(a=0;a<r.length;a++)o&&(o+="&"),o+=encodeURIComponent(n)+"="+encodeURIComponent(r[a]);else o&&(o+="&"),o+=encodeURIComponent(n)+"="+encodeURIComponent(r);return(t||"")+o}function F(e){if(!e)return"";var t=decodeURIComponent(e);return"false"!==t&&("true"===t||("0"===t.charAt(0)?t:0*+t==0?+t:t))}function N(e){for(var t,n,a={},r=e.split("&");t=r.shift();)void 0!==a[n=(t=t.split("=")).shift()]?a[n]=[].concat(a[n],F(t.shift())):a[n]=F(t.shift());return a}function B(){return B=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var a in n)Object.prototype.hasOwnProperty.call(n,a)&&(e[a]=n[a])}return e},B.apply(this,arguments)}function H(e,t,n,a){const{id:r,routeId:o,path:i,fullPath:s}=e,l=a.state.actions[r]||(a.state.actions[r]={pending:[],submit:async(e,t)=>{var n;if(!u)return;const r=null==(n=null==t?void 0:t.invalidate)||n,o={submittedAt:Date.now(),status:"pending",submission:e};l.current=o,l.latest=o,l.pending.push(o),a.state=B({},a.state,{currentAction:o,latestAction:o}),a.notify();try{const t=await(null==u.options.action?void 0:u.options.action(e));return o.data=t,r&&(a.invalidateRoute({to:".",fromCurrent:!0}),await a.reload()),o.status="success",t}catch(e){console.error(e),o.error=e,o.status="error"}finally{l.pending=l.pending.filter((e=>e!==o)),a.removeActionQueue.push({action:l,actionState:o}),a.notify()}}},a.state.actions[r]),c=a.state.loaders[r]||(a.state.loaders[r]={pending:[],fetch:async e=>{if(!u)return;const t={loadedAt:Date.now(),loaderContext:e};c.current=t,c.latest=t,c.pending.push(t),a.notify();try{return await(null==u.options.loader?void 0:u.options.loader(e))}finally{c.pending=c.pending.filter((e=>e!==t)),a.notify()}}},a.state.loaders[r]);let u={routeId:r,routeRouteId:o,routePath:i,fullPath:s,options:t,router:a,childRoutes:void 0,parentRoute:n,action:l,loader:c,buildLink:e=>a.buildLink(B({},e,{from:s})),navigate:e=>a.navigate(B({},e,{from:s})),matchRoute:(e,t)=>a.matchRoute(B({},e,{from:s}),t)};return null==a.options.createRoute||a.options.createRoute({router:a,route:u}),u}function U(e){e.forEach(((t,n)=>{const a=e[n-1];a&&(t.loaderData=P(t.loaderData,B({},a.loaderData,t.routeLoaderData)))}))}const z="__root__",G=["element","errorElement","catchElement","pendingElement"];function W(e,t,n){const a=B({},t,n,{router:e,routeSearch:{},search:{},childMatches:[],status:"idle",routeLoaderData:{},loaderData:{},isPending:!1,isFetching:!1,isInvalid:!1,invalidAt:1/0,getIsInvalid:()=>{const e=Date.now();return a.isInvalid||a.invalidAt<e},__:{abortController:new AbortController,latestId:"",resolve:()=>{},notify:()=>{a.__.resolve(),a.router.notify()},startPending:()=>{var t,n;const r=null!=(t=a.options.pendingMs)?t:e.options.defaultPendingMs,o=null!=(n=a.options.pendingMinMs)?n:e.options.defaultPendingMinMs;a.__.pendingTimeout||"loading"!==a.status||void 0===r||(a.__.pendingTimeout=setTimeout((()=>{a.isPending=!0,a.__.resolve(),void 0!==o&&(a.__.pendingMinPromise=new Promise((e=>a.__.pendingMinTimeout=setTimeout(e,o))))}),r))},cancelPending:()=>{a.isPending=!1,clearTimeout(a.__.pendingTimeout),clearTimeout(a.__.pendingMinTimeout),delete a.__.pendingMinPromise},validate:()=>{var t,n;const r=null!=(t=null==(n=a.parentMatch)?void 0:n.search)?t:e.location.search;try{const e=a.routeSearch,t="object"==typeof a.options.validateSearch?a.options.validateSearch.parse:a.options.validateSearch;let n=P(e,null==t?void 0:t(r));e!==n&&(a.isInvalid=!0),a.routeSearch=n,a.search=P(r,B({},r,n))}catch(e){console.error(e);const t=new Error("Invalid search params found",{cause:e});return t.code="INVALID_SEARCH_PARAMS",a.status="error",void(a.error=t)}}},cancel:()=>{var e;null==(e=a.__.abortController)||e.abort(),a.__.cancelPending()},invalidate:()=>{a.isInvalid=!0},hasLoaders:()=>!(!t.options.loader&&!G.some((e=>"function"==typeof t.options[e]))),load:async t=>{const n=Date.now(),r=null!=t&&t.preload?Math.max(null==t?void 0:t.maxAge,null==t?void 0:t.gcMaxAge):0;if(null!=t&&t.preload&&r>0){if(e.state.matches.find((e=>e.matchId===a.matchId)))return;e.matchCache[a.matchId]={gc:n+t.gcMaxAge,match:a}}if("success"===a.status&&a.getIsInvalid()||"error"===a.status||"idle"===a.status){const e=null!=t&&t.preload?null==t?void 0:t.maxAge:void 0;a.fetch({maxAge:e})}},fetch:async t=>{const n=""+Date.now()+Math.random();return a.__.latestId=n,"idle"===a.status&&(a.status="loading"),a.isInvalid=!1,a.__.loadPromise=new Promise((async r=>{a.isFetching=!0,a.__.resolve=r;const o=(async()=>{a.__.elementsPromise=(async()=>{await Promise.all(G.map((async t=>{const n=a.options[t];a.__[t]||(a.__[t]=await e.options.createElement(n))})))})(),a.__.dataPromise=Promise.resolve().then((async()=>{try{var r,o,i;if(a.options.loader){const e=await a.options.loader({params:a.params,search:a.routeSearch,signal:a.__.abortController.signal});if(n!==a.__.latestId)return a.__.loaderPromise;a.routeLoaderData=P(a.routeLoaderData,e)}a.error=void 0,a.status="success",a.updatedAt=Date.now(),a.invalidAt=a.updatedAt+(null!=(r=null!=(o=null!=(i=null==t?void 0:t.maxAge)?i:a.options.loaderMaxAge)?o:e.options.defaultLoaderMaxAge)?r:0)}catch(e){if(n!==a.__.latestId)return a.__.loaderPromise;a.error=e,a.status="error",a.updatedAt=Date.now()}}));try{if(await Promise.all([a.__.elementsPromise,a.__.dataPromise]),n!==a.__.latestId)return a.__.loaderPromise;a.__.pendingMinPromise&&(await a.__.pendingMinPromise,delete a.__.pendingMinPromise)}finally{if(n!==a.__.latestId)return a.__.loaderPromise;a.__.cancelPending(),a.isPending=!1,a.isFetching=!1,a.__.notify()}})();if(a.__.loaderPromise=o,await o,n!==a.__.latestId)return a.__.loaderPromise;delete a.__.loaderPromise})),await a.__.loadPromise}});return a.hasLoaders()||(a.status="success"),a}const q=Q(JSON.parse),K=V(JSON.stringify);function Q(e){return t=>{"?"===t.substring(0,1)&&(t=t.substring(1));let n=N(t);for(let t in n){const a=n[t];if("string"==typeof a)try{n[t]=e(a)}catch(e){}}return n}}function V(e){return t=>{(t=B({},t))&&Object.keys(t).forEach((n=>{const a=t[n];if(void 0===a||void 0===a)delete t[n];else if(a&&"object"==typeof a&&null!==a)try{t[n]=e(a)}catch(e){}}));const n=T(t).toString();return n?"?"+n:""}}var J;const X="undefined"==typeof window||!(null!=(J=window.document)&&J.createElement);function Y(e){var t,n;const a=(null==e?void 0:e.history)||(X?h():d()),r=B({defaultLoaderGcMaxAge:3e5,defaultLoaderMaxAge:0,defaultPreloadMaxAge:2e3,defaultPreloadDelay:50},e,{stringifySearch:null!=(t=null==e?void 0:e.stringifySearch)?t:K,parseSearch:null!=(n=null==e?void 0:e.parseSearch)?n:q});let o={history:a,options:r,listeners:[],removeActionQueue:[],basepath:"",routeTree:void 0,routesById:{},location:void 0,allRouteInfo:void 0,navigationPromise:Promise.resolve(),resolveNavigation:()=>{},matchCache:{},state:{status:"idle",location:null,matches:[],actions:{},loaders:{},loaderData:{},lastUpdated:Date.now(),isFetching:!1,isPreloading:!1},startedLoadingAt:Date.now(),subscribe:e=>(o.listeners.push(e),()=>{o.listeners=o.listeners.filter((t=>t!==e))}),getRoute:e=>o.routesById[e],notify:()=>{o.state=B({},o.state,{isFetching:"loading"===o.state.status||o.state.matches.some((e=>e.isFetching)),isPreloading:Object.values(o.matchCache).some((e=>e.match.isFetching&&!o.state.matches.find((t=>t.matchId===e.match.matchId))))}),U(o.state.matches),o.listeners.forEach((e=>e(o)))},mount:()=>{const e=o.__.buildLocation({to:".",search:!0,hash:!0});e.href!==o.location.href?o.__.commitLocation(e,!0):o.loadLocation();const t=a.listen((e=>{o.loadLocation(o.__.parseLocation(e.location,o.location))}));return!X&&window.addEventListener&&(window.addEventListener("visibilitychange",o.onFocus,!1),window.addEventListener("focus",o.onFocus,!1)),()=>{t(),window.removeEventListener("visibilitychange",o.onFocus),window.removeEventListener("focus",o.onFocus)}},onFocus:()=>{o.loadLocation()},update:e=>{Object.assign(o.options,e);const{basepath:t,routeConfig:n}=o.options;return o.basepath=A("/"+(null!=t?t:"")),n&&(o.routesById={},o.routeTree=o.__.buildRouteTree(n)),o},cancelMatches:()=>{var e,t;[...o.state.matches,...null!=(e=null==(t=o.state.pending)?void 0:t.matches)?e:[]].forEach((e=>{e.cancel()}))},loadLocation:async e=>{const t=Math.random();o.startedLoadingAt=t,e&&(o.location=e),o.removeActionQueue.forEach((e=>{let{action:t,actionState:n}=e;o.state.currentAction===n&&(o.state.currentAction=void 0),t.current===n&&(t.current=void 0)})),o.removeActionQueue=[],o.cancelMatches();const n=o.matchRoutes(location.pathname,{strictParseParams:!0});if(o.state=B({},o.state,{pending:{matches:n,location:o.location},status:"loading"}),o.notify(),await o.loadMatches(n,{withPending:!0}),o.startedLoadingAt!==t)return o.navigationPromise;const a=o.state.matches,r=[],i=[];a.forEach((e=>{n.find((t=>t.matchId===e.matchId))?i.push(e):r.push(e)}));const s=Date.now();r.forEach((e=>{var t,n,a,r;null==e.__.onExit||e.__.onExit({params:e.params,search:e.routeSearch}),"error"!==e.status||e.isFetching||(e.status="idle",e.error=void 0);const i=Math.max(null!=(t=null!=(n=e.options.loaderGcMaxAge)?n:o.options.defaultLoaderGcMaxAge)?t:0,null!=(a=null!=(r=e.options.loaderMaxAge)?r:o.options.defaultLoaderMaxAge)?a:0);i>0&&(o.matchCache[e.matchId]={gc:i==1/0?Number.MAX_SAFE_INTEGER:s+i,match:e})})),i.forEach((e=>{null==e.options.onTransition||e.options.onTransition({params:e.params,search:e.routeSearch})}));n.filter((e=>!a.find((t=>t.matchId===e.matchId)))).forEach((e=>{e.__.onExit=null==e.options.onMatch?void 0:e.options.onMatch({params:e.params,search:e.search}),delete o.matchCache[e.matchId]})),n.some((e=>"loading"===e.status))&&(o.notify(),await Promise.all(n.map((e=>e.__.loaderPromise||Promise.resolve())))),o.startedLoadingAt===t&&(o.state=B({},o.state,{location:o.location,matches:n,pending:void 0,status:"idle"}),o.notify(),o.resolveNavigation())},cleanMatchCache:()=>{const e=Date.now();Object.keys(o.matchCache).forEach((t=>{const n=o.matchCache[t];"loading"!==n.match.status&&(n.gc>0&&n.gc>e||delete o.matchCache[t])}))},loadRoute:async function(e){void 0===e&&(e=o.location);const t=o.buildNext(e),n=o.matchRoutes(t.pathname,{strictParseParams:!0});return await o.loadMatches(n),n},preloadRoute:async function(e,t){var n,a,r,i,s,l;void 0===e&&(e=o.location);const c=o.buildNext(e),u=o.matchRoutes(c.pathname,{strictParseParams:!0});return await o.loadMatches(u,{preload:!0,maxAge:null!=(n=null!=(a=null!=(r=t.maxAge)?r:o.options.defaultPreloadMaxAge)?a:o.options.defaultLoaderMaxAge)?n:0,gcMaxAge:null!=(i=null!=(s=null!=(l=t.gcMaxAge)?l:o.options.defaultPreloadGcMaxAge)?s:o.options.defaultLoaderGcMaxAge)?i:0}),u},matchRoutes:(e,t)=>{var n,a;o.cleanMatchCache();const r=[];if(!o.routeTree)return r;const i=[...o.state.matches,...null!=(n=null==(a=o.state.pending)?void 0:a.matches)?n:[]],s=async n=>{var a,l,c;const u=E(r);let d=null!=(a=null==u?void 0:u.params)?a:{};const h=null!=(l=null==o.options.filterRoutes?void 0:o.options.filterRoutes(n))?l:n;let f=[];const p=(n,a)=>(a.some((a=>{var r,i,s;if(!a.routePath&&null!=(r=a.childRoutes)&&r.length)return p([...f,a],a.childRoutes);const l=!!("/"!==a.routePath||null!=(i=a.childRoutes)&&i.length),c=j(e,{to:a.fullPath,fuzzy:l,caseSensitive:null!=(s=a.options.caseSensitive)?s:o.options.caseSensitive});if(c){let e;try{var u;e=null!=(u=null==a.options.parseParams?void 0:a.options.parseParams(c))?u:c}catch(e){if(null!=t&&t.strictParseParams)throw e}d=B({},d,e)}return c&&(f=[...n,a]),!!f.length})),!!f.length);if(p([],h),!f.length)return;f.forEach((t=>{var n;const a=O(t.routePath,d),s=O(t.routeId,d,!0),l=i.find((e=>e.matchId===s))||(null==(n=o.matchCache[s])?void 0:n.match)||W(o,t,{matchId:s,params:d,pathname:M([e,a])});r.push(l)}));const m=E(f);null!=(c=m.childRoutes)&&c.length&&s(m.childRoutes)};return s([o.routeTree]),U(r),r},loadMatches:async(e,t)=>{const n=e.map((async e=>{e.__.validate(),e.load(t),"loading"===e.status&&(null!=t&&t.withPending&&e.__.startPending(),await e.__.loadPromise)}));o.notify(),await Promise.all(n)},invalidateRoute:e=>{var t,n;const a=o.buildNext(e),r=o.matchRoutes(a.pathname).map((e=>e.matchId));[...o.state.matches,...null!=(t=null==(n=o.state.pending)?void 0:n.matches)?t:[]].forEach((e=>{r.includes(e.matchId)&&e.invalidate()}))},reload:()=>o.__.navigate({fromCurrent:!0,replace:!0,search:!0}),resolvePath:(e,t)=>C(o.basepath,e,A(t)),matchRoute:(e,t)=>{var n;e=B({},e,{to:e.to?o.resolvePath(null!=(n=e.from)?n:"",e.to):void 0});const a=o.buildNext(e);var r;return null!=t&&t.pending?!(null==(r=o.state.pending)||!r.location)&&!!j(o.state.pending.location.pathname,B({},t,{to:a.pathname})):!!j(o.state.location.pathname,B({},t,{to:a.pathname}))},navigate:async e=>{let{from:t,to:n=".",search:a,hash:r,replace:i,params:s}=e;const l=String(n),c=String(t);let u;try{new URL(""+l),u=!0}catch(e){}return _(!u),o.__.navigate({from:c,to:l,search:a,hash:r,replace:i,params:s})},buildLink:e=>{var t,n;let{from:a,to:r=".",search:i,params:s,hash:l,target:c,replace:u,activeOptions:d,preload:h,preloadMaxAge:f,preloadGcMaxAge:p,preloadDelay:m,disabled:v}=e;try{return new URL(""+r),{type:"external",href:r}}catch(e){}const g={from:a,to:r,search:i,params:s,hash:l,replace:u},y=o.buildNext(g);h=null!=(t=h)?t:o.options.defaultPreload;const _=null!=(n=null!=m?m:o.options.defaultPreloadDelay)?n:0,P=o.state.location.pathname===y.pathname,b=o.state.location.pathname.split("/"),w=y.pathname.split("/").every(((e,t)=>e===b[t])),E=o.state.location.hash===y.hash,x=null!=d&&d.exact?P:w,R=null==d||!d.includeHash||E;return{type:"internal",next:y,handleFocus:e=>{h&&o.preloadRoute(g,{maxAge:f,gcMaxAge:p})},handleClick:e=>{v||function(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}(e)||e.defaultPrevented||c&&"_self"!==c||0!==e.button||(e.preventDefault(),!P||i||l||o.invalidateRoute(g),o.__.navigate(g))},handleEnter:e=>{const t=e.target||{};if(h){if(t.preloadTimeout)return;t.preloadTimeout=setTimeout((()=>{t.preloadTimeout=null,o.preloadRoute(g,{maxAge:f,gcMaxAge:p})}),_)}},handleLeave:e=>{const t=e.target||{};t.preloadTimeout&&(clearTimeout(t.preloadTimeout),t.preloadTimeout=null)},isActive:x&&R,disabled:v}},buildNext:e=>{const t=o.__.buildLocation(e),n=o.matchRoutes(t.pathname),a=n.map((e=>{var t;return null!=(t=e.options.preSearchFilters)?t:[]})).flat().filter(Boolean),r=n.map((e=>{var t;return null!=(t=e.options.postSearchFilters)?t:[]})).flat().filter(Boolean);return o.__.buildLocation(B({},e,{__preSearchFilters:a,__postSearchFilters:r}))},__:{buildRouteTree:e=>{const t=(e,n)=>e.map((e=>{const a=H(e,e.options,n,o);if(o.routesById[a.routeId])throw new Error;o.routesById[a.routeId]=a;const r=e.children;return a.childRoutes=null!=r&&r.length?t(r,a):void 0,a}));return t([e])[0]},parseLocation:(e,t)=>{var n;const a=o.options.parseSearch(e.search);return{pathname:e.pathname,searchStr:e.search,search:P(null==t?void 0:t.search,a),hash:null!=(n=e.hash.split("#").reverse()[0])?n:"",href:""+e.pathname+e.search+e.hash,state:e.state,key:e.key}},navigate:e=>{const t=o.buildNext(e);return o.__.commitLocation(t,e.replace)},buildLocation:function(e){var t,n,a,r,i,s,l,c,u;void 0===e&&(e={});const d=e.fromCurrent?o.location.pathname:null!=(t=e.from)?t:o.location.pathname;let h=C(null!=(n=o.basepath)?n:"/",d,""+(null!=(a=e.to)?a:"."));const f=o.matchRoutes(o.location.pathname,{strictParseParams:!0}),p=o.matchRoutes(h),m=B({},null==(r=E(f))?void 0:r.params);let v=!0===(null==(i=e.params)||i)?m:R(e.params,m);v&&p.map((e=>e.options.stringifyParams)).filter(Boolean).forEach((e=>{Object.assign({},v,e(v))})),h=O(h,null!=v?v:{});const g=null!=(s=e.__preSearchFilters)&&s.length?e.__preSearchFilters.reduce(((e,t)=>t(e)),o.location.search):o.location.search,y=!0===e.search?g:e.search?null!=(l=R(e.search,g))?l:{}:null!=(c=e.__preSearchFilters)&&c.length?g:{},_=null!=(u=e.__postSearchFilters)&&u.length?e.__postSearchFilters.reduce(((e,t)=>t(e)),y):y,b=P(o.location.search,_),w=o.options.stringifySearch(b);let x=!0===e.hash?o.location.hash:R(e.hash,o.location.hash);return x=x?"#"+x:"",{pathname:h,search:b,searchStr:w,state:o.location.state,hash:x,href:""+h+w+x,key:e.key}},commitLocation:(e,t)=>{const n=""+Date.now()+Math.random();o.navigateTimeout&&clearTimeout(o.navigateTimeout);let r="replace";t||(r="push");return o.__.parseLocation(a.location).href===e.href&&!e.key&&(r="replace"),"replace"===r?a.replace({pathname:e.pathname,hash:e.hash,search:e.searchStr},{id:n}):a.push({pathname:e.pathname,hash:e.hash,search:e.searchStr},{id:n}),o.navigationPromise=new Promise((e=>{const t=o.resolveNavigation;o.resolveNavigation=()=>{t(),e()}})),o.navigationPromise}}};return o.location=o.__.parseLocation(a.location),o.state.location=o.location,o.update(e),null==o.options.createRouter||o.options.createRouter(o),o}const $=["type","children","target","activeProps","inactiveProps","activeOptions","disabled","hash","search","params","to","preload","preloadDelay","preloadMaxAge","replace","style","className","onClick","onFocus","onMouseEnter","onMouseLeave","onTouchStart","onTouchEnd"],Z=["pending","caseSensitive","children"],ee=["children","router"],te=o.createContext(null),ne=o.createContext(null),ae=Boolean("undefined"!=typeof window&&window.document&&window.document.createElement)?o.useLayoutEffect:o.useEffect;function re(e){return o.createElement(te.Provider,e)}const oe=e=>{n.useSyncExternalStore((t=>e.subscribe((()=>t()))),(()=>e.state),(()=>e.state))};function ie(){const e=o.useContext(ne);return x(!e,"useRouter must be used inside a <Router> component!"),oe(e.router),e.router}function se(){return o.useContext(te)}function le(){var e;const t=ie(),[,...n]=se(),a=n[0];if(!a)return null;const r=(()=>{var e,n;if(!a)return null;const r=null!=(e=a.__.errorElement)?e:t.options.defaultErrorElement;if("error"===a.status){if(r)return r;if(a.options.useErrorBoundary||t.options.useErrorBoundary)throw a.error;return o.createElement(ue,{error:a.error})}if("loading"===a.status||"idle"===a.status){if(a.isPending){var i;const e=null!=(i=a.__.pendingElement)?i:t.options.defaultPendingElement;var s;if(a.options.pendingMs||e)return null!=(s=e)?s:null}return null}return null!=(n=a.__.element)?n:t.options.defaultElement})(),i=null!=(e=null==a?void 0:a.options.catchElement)?e:t.options.defaultCatchElement;return o.createElement(re,{value:n,key:a.matchId},o.createElement(ce,{catchElement:i},r))}class ce extends o.Component{constructor(){super(...arguments),this.state={error:!1},this.reset=()=>{this.setState({error:!1,info:!1})}}componentDidCatch(e,t){console.error(e),this.setState({error:e,info:t})}render(){var e;const t=null!=(e=this.props.catchElement)?e:ue;return this.state.error?"function"==typeof t?t(this.state):t:this.props.children}}function ue(e){let{error:t}=e;return o.createElement("div",{style:{padding:".5rem",maxWidth:"100%"}},o.createElement("strong",{style:{fontSize:"1.2rem"}},"Something went wrong!"),o.createElement("div",{style:{height:".5rem"}}),o.createElement("div",null,o.createElement("pre",null,t.message?o.createElement("code",{style:{fontSize:".7em",border:"1px solid red",borderRadius:".25rem",padding:".5rem",color:"red"}},t.message):null)),o.createElement("div",{style:{height:"1rem"}}),o.createElement("div",{style:{fontSize:".8em",borderLeft:"3px solid rgba(127, 127, 127, 1)",paddingLeft:".5rem",opacity:.5}},"If you are the owner of this website, it's highly recommended that you configure your own custom Catch/Error boundaries for the router. You can optionally configure a boundary for each route."))}function de(e,t){const n=ie();o.useEffect((()=>{if(!t)return;let a=n.history.block((t=>{window.confirm(e)?(a(),t.retry()):n.location.pathname=window.location.pathname}));return a}),[t,location,e])}e.DefaultErrorBoundary=ue,e.MatchesProvider=re,e.Outlet=le,e.Prompt=function(e){let{message:t,when:n,children:a}=e;return de(t,null==n||n),null!=a?a:null},e.RouterProvider=function(e){let{children:t,router:n}=e,a=s(e,ee);return n.update(a),oe(n),ae((()=>n.mount()),[n]),o.createElement(ne.Provider,{value:{router:n}},o.createElement(re,{value:n.state.matches},null!=t?t:o.createElement(le,null)))},e.cascadeLoaderData=U,e.cleanPath=A,e.createBrowserHistory=d,e.createHashHistory=function(e){void 0===e&&(e={});var t=e.window,n=void 0===t?document.defaultView:t,a=n.history;function o(){var e=y(n.location.hash.substr(1)),t=e.pathname,r=void 0===t?"/":t,o=e.search,i=void 0===o?"":o,s=e.hash,l=void 0===s?"":s,c=a.state||{};return[c.idx,{pathname:r,search:i,hash:l,state:c.usr||null,key:c.key||"default"}]}var i=null;function s(){if(i)b.call(i),i=null;else{var e=r.Pop,t=o(),n=t[0],a=t[1];if(b.length){if(null!=n){var s=f-n;s&&(i={action:e,location:a,retry:function(){A(-1*s)}},A(s))}}else M(e)}}n.addEventListener(u,s),n.addEventListener("hashchange",(function(){g(o()[1])!==g(_)&&s()}));var d=r.Pop,h=o(),f=h[0],_=h[1],P=m(),b=m();function w(e){return function(){var e=document.querySelector("base"),t="";if(e&&e.getAttribute("href")){var a=n.location.href,r=a.indexOf("#");t=-1===r?a:a.slice(0,r)}return t}()+"#"+("string"==typeof e?e:g(e))}function E(e,t){return void 0===t&&(t=null),l({pathname:_.pathname,hash:"",search:""},"string"==typeof e?y(e):e,{state:t,key:v()})}function x(e,t){return[{usr:e.state,key:e.key,idx:t},w(e)]}function R(e,t,n){return!b.length||(b.call({action:e,location:t,retry:n}),!1)}function M(e){d=e;var t=o();f=t[0],_=t[1],P.call({action:d,location:_})}function A(e){a.go(e)}null==f&&(f=0,a.replaceState(l({},a.state,{idx:f}),""));var S={get action(){return d},get location(){return _},createHref:w,push:function e(t,o){var i=r.Push,s=E(t,o);if(R(i,s,(function(){e(t,o)}))){var l=x(s,f+1),c=l[0],u=l[1];try{a.pushState(c,"",u)}catch(e){n.location.assign(u)}M(i)}},replace:function e(t,n){var o=r.Replace,i=E(t,n);if(R(o,i,(function(){e(t,n)}))){var s=x(i,f),l=s[0],c=s[1];a.replaceState(l,"",c),M(o)}},go:A,back:function(){A(-1)},forward:function(){A(1)},listen:function(e){return P.push(e)},block:function(e){var t=b.push(e);return 1===b.length&&n.addEventListener(c,p),function(){t(),b.length||n.removeEventListener(c,p)}}};return S},e.createMemoryHistory=h,e.createReactRouter=function(e){const t=(e,t)=>({useRoute:function(n){void 0===n&&(n=".");const a=t.resolvePath(e.routeId,n),r=t.getRoute(a);return oe(t),_(r),r},linkProps:t=>{var n,a;const{target:r,activeProps:o=(()=>({className:"active"})),inactiveProps:l=(()=>({})),disabled:c,style:u,className:d,onClick:h,onFocus:f,onMouseEnter:p,onMouseLeave:m}=t,v=s(t,$),g=e.buildLink(t);if("external"===g.type){const{href:e}=g;return{href:e}}const{handleClick:y,handleFocus:_,handleEnter:P,handleLeave:b,isActive:w,next:E}=g,x=e=>t=>{t.persist(),e.forEach((e=>{e&&e(t)}))},M=w&&null!=(n=R(o,{}))?n:{},A=w?{}:null!=(a=R(l,{}))?a:{};return i({},M,A,v,{href:c?void 0:E.href,onClick:x([y,h]),onFocus:x([_,f]),onMouseEnter:x([P,p]),onMouseLeave:x([b,m]),target:r,style:i({},u,M.style,A.style),className:[d,M.className,A.className].filter(Boolean).join(" ")||void 0},c?{role:"link","aria-disabled":!0}:void 0,{"data-status":w?"active":void 0})},Link:o.forwardRef(((n,a)=>{const r=e.linkProps(n);return oe(t),o.createElement("a",i({ref:a},r,{children:"function"==typeof n.children?n.children({isActive:"active"===r["data-status"]}):n.children}))})),MatchRoute:t=>{const{pending:n,caseSensitive:a}=t,r=s(t,Z),o=e.matchRoute(r,{pending:n,caseSensitive:a});return o?"function"==typeof t.children?t.children(o):t.children:null}});return Y(i({},e,{createRouter:e=>{const n={useState:()=>(oe(e),e.state),useMatch:t=>{oe(e),_(t!==z);const n=null==(a=se())?void 0:a[0];var a;const r=e.state.matches.find((e=>e.routeId===t));return _(r),_(n.routeId==(null==r?void 0:r.routeId),(null==r||r.routeId,n.routeId,null==r||r.routeId)),r||_("Match not found!"),r}},a=t(e.getRoute("/"),e);Object.assign(e,n,a)},createRoute:e=>{let{router:n,route:a}=e;const r=t(a,n);Object.assign(a,r)},createElement:async e=>{if("function"==typeof e){const t=await e();return"object"==typeof t&&t.default?o.createElement(t.default):t}return e}}))},e.createRoute=H,e.createRouteConfig=function e(t,n,a,r,o){void 0===t&&(t={}),void 0===a&&(a=!0),a&&(t.path=z),r===z&&(r="");let i=a?z:t.path;i&&"/"!==i&&(i=L(i));const s=i||t.id;let l=M([r,s]);i===z&&(i="/"),l!==z&&(l=M(["/",l]));const c=l===z?"/":I(M([o,i]));return{id:l,routeId:s,path:i,fullPath:c,options:t,children:n,createChildren:n=>e(t,n((t=>e(t,void 0,!1,l,c))),!1,r,o),addChildren:n=>e(t,n,!1,r,o),createRoute:t=>e(t,void 0,!1,l,c)}},e.createRouteMatch=W,e.createRouter=Y,e.decode=N,e.defaultParseSearch=q,e.defaultStringifySearch=K,e.encode=T,e.functionalUpdate=R,e.interpolatePath=O,e.invariant=_,e.joinPaths=M,e.last=E,e.matchByPath=D,e.matchPathname=j,e.parsePathname=k,e.parseSearchWith=Q,e.replaceEqualDeep=P,e.resolvePath=C,e.rootRouteId=z,e.stringifySearchWith=V,e.trimPath=L,e.trimPathLeft=S,e.trimPathRight=I,e.usePrompt=de,e.warning=x,Object.defineProperty(e,"__esModule",{value:!0})}));
21
+ */function K(t){return t[t.length-1]}function W(t,e){if(t){"undefined"!=typeof console&&console.warn(e);try{throw new Error(e)}catch{}}return!0}function V(t,e){return"function"==typeof t?t(e):t}function q(t,e){return e.reduce(((e,r)=>(e[r]=t[r],e)),{})}function J(t){return X(t.filter(Boolean).join("/"))}function X(t){return t.replace(/\/{2,}/g,"/")}function Q(t){return"/"===t?t:t.replace(/^\/{1,}/,"")}function Y(t){return"/"===t?t:t.replace(/\/{1,}$/,"")}function Z(t){return Y(Q(t))}function tt(t,e,r){e=e.replace(new RegExp(`^${t}`),"/"),r=r.replace(new RegExp(`^${t}`),"/");let n=et(e);const o=et(r);o.forEach(((t,e)=>{if("/"===t.value)e?e===o.length-1&&n.push(t):n=[t];else if(".."===t.value){var r;n.length>1&&"/"===(null==(r=K(n))?void 0:r.value)&&n.pop(),n.pop()}else{if("."===t.value)return;n.push(t)}}));return X(J([t,...n.map((t=>t.value))]))}function et(t){if(!t)return[];const e=[];if("/"===(t=X(t)).slice(0,1)&&(t=t.substring(1),e.push({type:"pathname",value:"/"})),!t)return e;const r=t.split("/").filter(Boolean);return e.push(...r.map((t=>t.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 rt(t,e,r){return J(et(t).map((t=>"*"!==t.value||r?"param"===t.type?e[t.value.substring(1)]??"":t.value:"")))}function nt(t,e,r){const n=ot(t,e,r);if(!r.to||n)return n??{}}function ot(t,e,r){if(!e.startsWith(t))return;const n=et(e="/"!=t?e.substring(t.length):e),o=et(`${r.to??"*"}`),a={};return(()=>{for(let t=0;t<Math.max(n.length,o.length);t++){const e=n[t],s=o[t],i=t===o.length-1,c=t===n.length-1;if(s){if("wildcard"===s.type)return!(null==e||!e.value)&&(a["*"]=J(n.slice(t).map((t=>t.value))),!0);if("pathname"===s.type){if("/"===s.value&&(null==e||!e.value))return!0;if(e)if(r.caseSensitive){if(s.value!==e.value)return!1}else if(s.value.toLowerCase()!==e.value.toLowerCase())return!1}if(!e)return!1;if("param"===s.type){if("/"===(null==e?void 0:e.value))return!1;"$"!==e.value.charAt(0)&&(a[s.value.substring(1)]=e.value)}}if(i&&!c)return!!r.fuzzy}return!0})()?a:void 0}function at(t,e){var r,n,o,a="";for(r in t)if(void 0!==(o=t[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(e||"")+a}function st(t){if(!t)return"";var e=decodeURIComponent(t);return"false"!==e&&("true"===e||("0"===e.charAt(0)?e:0*+e==0?+e:e))}function it(t){for(var e,r,n={},o=t.split("&");e=o.shift();)void 0!==n[r=(e=e.split("=")).shift()]?n[r]=[].concat(n[r],st(e.shift())):n[r]=st(e.shift());return n}function ct(t,e,r,n,o){const{id:a,routeId:s,path:i,fullPath:c}=t;let l={routeInfo:void 0,routeId:a,routeRouteId:s,originalIndex:r,routePath:i,fullPath:c,options:e,router:o,childRoutes:void 0,parentRoute:n,get action(){let t=o.store.actions[a]||(o.setStore((e=>{e.actions[a]={submissions:[],submit:async(e,r)=>{if(!l)return;const n=(null==r?void 0:r.invalidate)??!0,[s,i]=C({submittedAt:Date.now(),status:"pending",submission:e,isMulti:!(null==r||!r.multi)});o.setStore((e=>{null!=r&&r.multi||(e.actions[a].submissions=t.submissions.filter((t=>t.isMulti))),e.actions[a].current=s,e.actions[a].latest=s,e.actions[a].submissions.push(s)}));try{const t=await(null==l.options.action?void 0:l.options.action(e));return i((e=>{e.data=t})),n&&(o.invalidateRoute({to:".",fromCurrent:!0}),await o.reload()),i((t=>{t.status="success"})),t}catch(t){console.error(t),i((e=>{e.error=t,e.status="error"}))}}}})),o.store.actions[a]);return t},get loader(){return o.store.loaders[a]||(o.setStore((t=>{t.loaders[a]={pending:[],fetch:async t=>{if(!l)return;const e={loadedAt:Date.now(),loaderContext:t};o.setStore((t=>{t.loaders[a].current=e,t.loaders[a].latest=e,t.loaders[a].pending.push(e)}));try{return await(null==l.options.loader?void 0:l.options.loader(t))}finally{o.setStore((t=>{t.loaders[a].pending=t.loaders[a].pending.filter((t=>t!==e))}))}}}})),o.store.loaders[a])}};return null==o.options.createRoute||o.options.createRoute({router:o,route:l}),l}const lt="__root__",ut=function(t,e,r,n,o){void 0===t&&(t={}),void 0===r&&(r=!0),r&&(t.path=lt),n===lt&&(n="");let a=r?lt:t.path;a&&"/"!==a&&(a=Z(a));const s=a||t.id;let i=J([n,s]);a===lt&&(a="/"),i!==lt&&(i=J(["/",i]));const c=i===lt?"/":Y(J([o,a]));return{id:i,routeId:s,path:a,fullPath:c,options:t,children:e,addChildren:e=>ut(t,e,!1,n,o),createRoute:t=>ut(t,void 0,!1,i,c),generate:()=>{G(!1)}}};function ht(t,e,r){const n=new Map;return function t(e,r){if(e===r)return e;if(n.has(r))return n.get(r);const o=Array.isArray(e),a=Array.isArray(r),s=dt(e),i=dt(r),c=o&&a;if(c||s&&i){const o=c?e.length:Object.keys(e).length,a=c?r:Object.keys(r),s=a.length,i=c?[]:{};let l=0;for(let t=0;t<s;t++){const r=c?t:a[t];i[r]===e[r]&&l++}if(o===s&&l===o)return n.set(r,e),e;n.set(r,i);for(let n=0;n<s;n++){const o=c?n:a[n];"function"==typeof a[n]?i[o]=e[o]:i[o]=t(e[o],r[o]),i[o]===e[o]&&l++}return i}if(a){const e=[];n.set(r,e);for(let n=0;n<r.length;n++)e[n]=t(void 0,r[n]);return e}if(i){const e={};n.set(r,e);const o=Object.keys(r);for(let n=0;n<o.length;n++){const a=o[n];e[a]=t(void 0,r[a])}return e}return r}(t,e)}function dt(t){if(!ft(t))return!1;const e=t.constructor;if(void 0===e)return!0;const r=e.prototype;return!!ft(r)&&!!r.hasOwnProperty("isPrototypeOf")}function ft(t){return"[object Object]"===Object.prototype.toString.call(t)}const pt=["component","errorComponent","pendingComponent"];function mt(t,e,r){let n,o,a="",s=()=>{};function i(){l((t=>{var e;t.loaderData=ht(t.loaderData,{...null==(e=c.parentMatch)?void 0:e.store.loaderData,...t.routeLoaderData})}))}const[c,l]=C({routeSearch:{},search:{},status:"idle",routeLoaderData:{},loaderData:{},isFetching:!1,invalid:!1,invalidAt:1/0,get isInvalid(){const t=Date.now();return this.invalid||this.invalidAt<t}}),u={...e,...r,store:c,router:t,childMatches:[],__:{setParentMatch:t=>{m((()=>{l((e=>{e.parentMatch=t})),i()}))},abortController:new AbortController,validate:()=>{var e;const r=(null==(e=c.parentMatch)?void 0:e.store.search)??t.store.currentLocation.search;try{const t=c.routeSearch,e="object"==typeof u.options.validateSearch?u.options.validateSearch.parse:u.options.validateSearch;let n=ht(t,(null==e?void 0:e(r))??{});m((()=>{t!==n&&l((t=>t.invalid=!0)),l((t=>{t.routeSearch=n,t.search=ht(r,{...r,...n})}))})),pt.map((async t=>{const e=u.options[t];"function"!=typeof u.__[t]&&(u.__[t]=e)}))}catch(t){console.error(t);const e=new Error("Invalid search params found",{cause:t});return e.code="INVALID_SEARCH_PARAMS",void l((t=>{t.status="error",t.error=e}))}}},cancel:()=>{var t;null==(t=u.__.abortController)||t.abort()},invalidate:()=>{l((t=>t.invalid=!0))},hasLoaders:()=>!(!e.options.loader&&!pt.some((t=>{var r;return null==(r=e.options[t])?void 0:r.preload}))),load:async e=>{const r=Date.now(),n=null!=e&&e.preload?Math.max(null==e?void 0:e.maxAge,null==e?void 0:e.gcMaxAge):0;if(null!=e&&e.preload&&n>0){if(t.store.currentMatches.find((t=>t.matchId===u.matchId)))return;t.store.matchCache[u.matchId]={gc:r+e.gcMaxAge,match:u}}if("success"===c.status&&c.isInvalid||"error"===c.status||"idle"===c.status){const t=null!=e&&e.preload?null==e?void 0:e.maxAge:void 0;await u.fetch({maxAge:t})}},fetch:async e=>{const r=""+Date.now()+Math.random();a=r;const h=async()=>{if(r!==a)return new Promise((()=>{}))};m((()=>{"idle"===c.status&&l((t=>t.status="loading")),l((t=>t.invalid=!1))})),u.__.loadPromise=new Promise((async r=>{l((t=>t.isFetching=!0)),s=r,n=(async()=>{await Promise.all(pt.map((async e=>{var r;const n=u.options[e];null!=(r=u.__[e])&&r.preload&&(u.__[e]=await t.options.loadComponent(n))})))})(),o=Promise.resolve().then((async()=>{try{if(u.options.loader){const e=await t.loadMatchData(u);await h(),r=e,m((()=>{l((t=>{t.routeLoaderData=ht(t.routeLoaderData,r)})),i()}))}return l((r=>{r.error=void 0,r.status="success",r.updatedAt=Date.now(),r.invalidAt=r.updatedAt+((null==e?void 0:e.maxAge)??u.options.loaderMaxAge??t.options.defaultLoaderMaxAge??0)})),c.routeLoaderData}catch(t){throw await h(),l((e=>{e.error=t,e.status="error",e.updatedAt=Date.now()})),t}var r}));const a=async()=>{await h(),l((t=>t.isFetching=!1)),delete u.__.loadPromise,s()};try{await Promise.all([n,o.catch((()=>{}))]),a()}catch{a()}})),await u.__.loadPromise,await h()}};return u.hasLoaders()||l((t=>t.status="success")),u}const vt=yt(JSON.parse),gt=bt(JSON.stringify);function yt(t){return e=>{"?"===e.substring(0,1)&&(e=e.substring(1));let r=it(e);for(let e in r){const n=r[e];if("string"==typeof n)try{r[e]=t(n)}catch(t){}}return r}}function bt(t){return e=>{(e={...e})&&Object.keys(e).forEach((r=>{const n=e[r];if(void 0===n||void 0===n)delete e[r];else if(n&&"object"==typeof n&&null!==n)try{e[r]=t(n)}catch(t){}}));const r=at(e).toString();return r?`?${r}`:""}}var wt;const Pt="undefined"==typeof window||!(null!=(wt=window.document)&&wt.createElement);function Et(){return{status:"idle",latestLocation:null,currentLocation:null,currentMatches:[],actions:{},loaders:{},lastUpdated:Date.now(),matchCache:{},get isFetching(){return"loading"===this.status||this.currentMatches.some((t=>t.store.isFetching))},get isPreloading(){return Object.values(this.matchCache).some((t=>t.match.store.isFetching&&!this.currentMatches.find((e=>e.matchId===t.match.matchId))))}}}function _t(t){const e={defaultLoaderGcMaxAge:3e5,defaultLoaderMaxAge:0,defaultPreloadMaxAge:2e3,defaultPreloadDelay:50,context:void 0,...t,stringifySearch:(null==t?void 0:t.stringifySearch)??gt,parseSearch:(null==t?void 0:t.parseSearch)??vt},[r,n]=C(Et());let o,a=Date.now(),s=()=>{};function i(){h.load()}function c(t,e){const r=h.options.parseSearch(t.search);return{pathname:t.pathname,searchStr:t.search,search:ht(null==e?void 0:e.search,r),hash:t.hash.split("#").reverse()[0]??"",href:`${t.pathname}${t.search}${t.hash}`,state:t.state,key:t.key}}function l(t){return function(t,e){const r=""+Date.now()+Math.random();let n="replace";e||(n="push");c(h.history.location).href!==t.href||t.key||(n="replace");return h.history[n]({pathname:t.pathname,hash:t.hash,search:t.searchStr},{id:r,...t.state}),o=new Promise((t=>{const e=s;s=()=>{e(),t()}}))}(h.buildNext(t),t.replace)}function u(t){var e,n,o,a;void 0===t&&(t={});const s=t.fromCurrent?r.latestLocation.pathname:t.from??r.latestLocation.pathname;let i=tt(h.basepath??"/",s,`${t.to??"."}`);const c=h.matchRoutes(r.latestLocation.pathname,{strictParseParams:!0}),l=h.matchRoutes(i),u={...null==(e=K(c))?void 0:e.params};let d=!0===(t.params??!0)?u:V(t.params,u);d&&l.map((t=>t.options.stringifyParams)).filter(Boolean).forEach((t=>{Object.assign({},d,t(d))})),i=rt(i,d??{});const f=null!=(n=t.__preSearchFilters)&&n.length?t.__preSearchFilters.reduce(((t,e)=>e(t)),r.latestLocation.search):r.latestLocation.search,p=!0===t.search?f:t.search?V(t.search,f)??{}:null!=(o=t.__preSearchFilters)&&o.length?f:{},m=null!=(a=t.__postSearchFilters)&&a.length?t.__postSearchFilters.reduce(((t,e)=>e(t)),p):p,v=ht(r.latestLocation.search,m),g=h.options.stringifySearch(v);let y=!0===t.hash?r.latestLocation.hash:V(t.hash,r.latestLocation.hash);return y=y?`#${y}`:"",{pathname:i,search:v,searchStr:g,state:r.latestLocation.state,hash:y,href:`${i}${g}${y}`,key:t.key}}const h={types:void 0,history:(null==t?void 0:t.history)||(Pt?N():F()),store:r,setStore:n,options:e,basepath:"",routeTree:void 0,routesById:{},reset:()=>{n((t=>Object.assign(t,Et())))},getRoute:t=>h.routesById[t],dehydrate:()=>({store:{...q(r,["latestLocation","currentLocation","status","lastUpdated"]),currentMatches:r.currentMatches.map((t=>({matchId:t.matchId,store:q(t.store,["status","routeLoaderData","isInvalid","invalidAt"])})))},context:h.options.context}),hydrate:t=>{n((e=>{h.options.context=t.context;const r=h.matchRoutes(t.store.latestLocation.pathname,{strictParseParams:!0});r.forEach(((e,r)=>{const n=t.store.currentMatches[r];G(n&&n.matchId===e.matchId),Object.assign(e,n)})),r.forEach((t=>t.__.validate())),Object.assign(e,{...t.store,currentMatches:r})}))},mount:()=>{if(!Pt){r.currentMatches.length||h.load();const t=h.history.listen((t=>{h.load(c(t.location,r.latestLocation))}));return window.addEventListener&&(window.addEventListener("visibilitychange",i,!1),window.addEventListener("focus",i,!1)),()=>{t(),window.removeEventListener&&(window.removeEventListener("visibilitychange",i),window.removeEventListener("focus",i))}}return()=>{}},update:t=>{const e=(null==t?void 0:t.history)!==h.history;r.latestLocation&&!e||(null!=t&&t.history&&(h.history=t.history),n((t=>{t.latestLocation=c(h.history.location),t.currentLocation=t.latestLocation}))),Object.assign(h.options,t);const{basepath:o,routeConfig:a}=h.options;return h.basepath=`/${Z(o??"")??""}`,a&&(h.routesById={},h.routeTree=function(t){const e=(t,r)=>t.map(((t,n)=>{const o=ct(t,t.options,n,r,h);if(h.routesById[o.routeId])throw new Error;h.routesById[o.routeId]=o;const a=t.children;return o.childRoutes=null!=a&&a.length?e(a,o):void 0,o}));return e([t])[0]}(a)),h},cancelMatches:()=>{[...r.currentMatches,...r.pendingMatches||[]].forEach((t=>{t.cancel()}))},load:async t=>{let e=Date.now();const i=e;let c;a=i,h.cancelMatches(),m((()=>{t&&n((e=>{e.latestLocation=t})),c=h.matchRoutes(r.latestLocation.pathname,{strictParseParams:!0}),console.log("set loading",c),n((t=>{t.status="loading",t.pendingMatches=c,t.pendingLocation=r.latestLocation}))}));try{await h.loadMatches(c)}catch(t){console.log(t),G(!1)}if(a!==i)return o;const l=r.currentMatches,u=[],d=[];l.forEach((t=>{c.find((e=>e.matchId===t.matchId))?d.push(t):u.push(t)}));const f=c.filter((t=>!l.find((e=>e.matchId===t.matchId))));e=Date.now(),u.forEach((t=>{null==t.__.onExit||t.__.onExit({params:t.params,search:t.store.routeSearch}),"error"!==t.store.status||t.store.isFetching||(t.store.status="idle",t.store.error=void 0);const n=Math.max(t.options.loaderGcMaxAge??h.options.defaultLoaderGcMaxAge??0,t.options.loaderMaxAge??h.options.defaultLoaderMaxAge??0);n>0&&(r.matchCache[t.matchId]={gc:n==1/0?Number.MAX_SAFE_INTEGER:e+n,match:t})})),d.forEach((t=>{null==t.options.onTransition||t.options.onTransition({params:t.params,search:t.store.routeSearch})})),f.forEach((t=>{t.__.onExit=null==t.options.onLoaded?void 0:t.options.onLoaded({params:t.params,search:t.store.search}),delete r.matchCache[t.matchId]})),a===i&&(c.forEach((t=>{t.action&&(t.action.current=void 0,t.action.submissions=[])})),n((t=>{console.log("set",c),Object.assign(t,{status:"idle",currentLocation:r.latestLocation,currentMatches:c,pendingLocation:void 0,pendingMatches:void 0})})),s())},cleanMatchCache:()=>{const t=Date.now();n((e=>{Object.keys(e.matchCache).forEach((r=>{const n=e.matchCache[r];"loading"!==n.match.store.status&&(n.gc>0&&n.gc>t||delete e.matchCache[r])}))}))},loadRoute:async function(t){void 0===t&&(t=r.latestLocation);const e=h.buildNext(t),n=h.matchRoutes(e.pathname,{strictParseParams:!0});return await h.loadMatches(n),n},preloadRoute:async function(t,e){void 0===t&&(t=r.latestLocation);const n=h.buildNext(t),o=h.matchRoutes(n.pathname,{strictParseParams:!0});return await h.loadMatches(o,{preload:!0,maxAge:e.maxAge??h.options.defaultPreloadMaxAge??h.options.defaultLoaderMaxAge??0,gcMaxAge:e.gcMaxAge??h.options.defaultPreloadGcMaxAge??h.options.defaultLoaderGcMaxAge??0}),o},matchRoutes:(t,e)=>{h.cleanMatchCache();const n=[];if(!h.routeTree)return n;const o=[...r.currentMatches,...r.pendingMatches??[]],a=async s=>{var i;const c=K(n);let l=(null==c?void 0:c.params)??{};const u=(null==h.options.filterRoutes?void 0:h.options.filterRoutes(s))??s;let d=[];const f=(r,n)=>(n.some((n=>{var o,a;if(!n.routePath&&null!=(o=n.childRoutes)&&o.length)return f([...d,n],n.childRoutes);const s=!!("/"!==n.routePath||null!=(a=n.childRoutes)&&a.length),i=nt(h.basepath,t,{to:n.fullPath,fuzzy:s,caseSensitive:n.options.caseSensitive??h.options.caseSensitive});if(i){let t;try{t=(null==n.options.parseParams?void 0:n.options.parseParams(i))??i}catch(t){if(null!=e&&e.strictParseParams)throw t}l={...l,...t}}return i&&(d=[...r,n]),!!d.length})),!!d.length);if(f([],u),!d.length)return;d.forEach((t=>{var e;const a=rt(t.routePath,l),s=rt(t.routeId,l,!0),i=o.find((t=>t.matchId===s))||(null==(e=r.matchCache[s])?void 0:e.match)||mt(h,t,{parentMatch:c,matchId:s,params:l,pathname:J([h.basepath,a])});n.push(i)}));const p=K(d);null!=(i=p.childRoutes)&&i.length&&a(p.childRoutes)};return a([h.routeTree]),function(t){t.forEach(((e,r)=>{const n=t[r-1];n?e.__.setParentMatch(n):e.__.setParentMatch(void 0)}))}(n),n},loadMatches:async(t,e)=>{t.forEach((async t=>{t.__.validate()})),await Promise.all(t.map((async t=>{try{await(null==t.options.beforeLoad?void 0:t.options.beforeLoad({router:h,match:t}))}catch(r){throw null!=e&&e.preload||null==t.options.onLoadError||t.options.onLoadError(r),r}})));const r=t.map((async t=>{var r;const n=t.store.search;null!=(r=n.__data)&&r.matchId&&n.__data.matchId!==t.matchId||(t.load(e),"success"!==t.store.status&&t.__.loadPromise&&await t.__.loadPromise)}));await Promise.all(r)},loadMatchData:async t=>{if(Pt||!h.options.useServerData)return await(null==t.options.loader?void 0:t.options.loader({params:t.params,search:t.store.routeSearch,signal:t.__.abortController.signal}))||{};{const e=h.buildNext({to:".",search:e=>({...e??{},__data:{matchId:t.matchId}})}),r=await fetch(e.href,{method:"GET"});if(r.ok)return r.json();throw new Error("Failed to fetch match data")}},invalidateRoute:t=>{const e=h.buildNext(t),n=h.matchRoutes(e.pathname).map((t=>t.matchId));[...r.currentMatches,...r.pendingMatches??[]].forEach((t=>{n.includes(t.matchId)&&t.invalidate()}))},reload:()=>l({fromCurrent:!0,replace:!0,search:!0}),resolvePath:(t,e)=>tt(h.basepath,t,X(e)),matchRoute:(t,e)=>{t={...t,to:t.to?h.resolvePath(t.from??"",t.to):void 0};const n=h.buildNext(t);return null!=e&&e.pending?!!r.pendingLocation&&!!nt(h.basepath,r.pendingLocation.pathname,{...e,to:n.pathname}):nt(h.basepath,r.currentLocation.pathname,{...e,to:n.pathname})},navigate:async t=>{let{from:e,to:r=".",search:n,hash:o,replace:a,params:s}=t;const i=String(r),c=String(e);let u;try{new URL(`${i}`),u=!0}catch(t){}return G(!u),l({from:c,to:i,search:n,hash:o,replace:a,params:s})},buildLink:t=>{let{from:e,to:n=".",search:o,params:a,hash:s,target:i,replace:c,activeOptions:u,preload:d,preloadMaxAge:f,preloadGcMaxAge:p,preloadDelay:m,disabled:v}=t;try{return new URL(`${n}`),{type:"external",href:n}}catch(t){}const g={from:e,to:n,search:o,params:a,hash:s,replace:c},y=h.buildNext(g);d=d??h.options.defaultPreload;const b=m??h.options.defaultPreloadDelay??0,w=r.currentLocation.pathname===y.pathname,P=r.currentLocation.pathname.split("/"),E=y.pathname.split("/").every(((t,e)=>t===P[e])),_=r.currentLocation.hash===y.hash,M=null!=u&&u.exact?w:E,L=null==u||!u.includeHash||_;return{type:"internal",next:y,handleFocus:t=>{d&&h.preloadRoute(g,{maxAge:f,gcMaxAge:p}).catch((t=>{console.log(t),console.warn("Error preloading route! ☝️")}))},handleClick:t=>{v||function(t){return!!(t.metaKey||t.altKey||t.ctrlKey||t.shiftKey)}(t)||t.defaultPrevented||i&&"_self"!==i||0!==t.button||(t.preventDefault(),!w||o||s||h.invalidateRoute(g),l(g))},handleEnter:t=>{const e=t.target||{};if(d){if(e.preloadTimeout)return;e.preloadTimeout=setTimeout((()=>{e.preloadTimeout=null,h.preloadRoute(g,{maxAge:f,gcMaxAge:p}).catch((t=>{console.log(t),console.warn("Error preloading route! ☝️")}))}),b)}},handleLeave:t=>{const e=t.target||{};e.preloadTimeout&&(clearTimeout(e.preloadTimeout),e.preloadTimeout=null)},isActive:M&&L,disabled:v}},buildNext:t=>{const e=u(t),r=h.matchRoutes(e.pathname),n=r.map((t=>t.options.preSearchFilters??[])).flat().filter(Boolean),o=r.map((t=>t.options.postSearchFilters??[])).flat().filter(Boolean);return u({...t,__preSearchFilters:n,__postSearchFilters:o})}};return h.update(t),null==h.options.createRouter||h.options.createRouter(h),h}function Mt(t){const e=Ct(),{type:r,children:n,target:a,activeProps:s=(()=>({className:"active"})),inactiveProps:i=(()=>({})),activeOptions:c,disabled:l,hash:u,search:h,params:d,to:f,preload:p,preloadDelay:m,preloadMaxAge:v,replace:g,style:y,className:b,onClick:w,onFocus:P,onMouseEnter:E,onMouseLeave:_,onTouchStart:M,onTouchEnd:L,...S}=t,x=e.buildLink(t);if("external"===x.type){const{href:t}=x;return{href:t}}const{handleClick:R,handleFocus:A,handleEnter:I,handleLeave:O,isActive:C,next:k}=x,j=t=>e=>{e.persist&&e.persist(),t.filter(Boolean).forEach((t=>{e.defaultPrevented||t(e)}))},D=C?V(s,{})??{}:{},F=C?{}:V(i,{})??{};return{...D,...F,...S,href:l?void 0:k.href,onClick:j([w,t=>{o.startTransition?o.startTransition((()=>{R(t)})):R(t)}]),onFocus:j([P,A]),onMouseEnter:j([E,I]),onMouseLeave:j([_,O]),target:a,style:{...y,...D.style,...F.style},className:[b,D.className,F.className].filter(Boolean).join(" ")||void 0,...l?{role:"link","aria-disabled":!0}:void 0,"data-status":C?"active":void 0}}const Lt=o.forwardRef(((t,e)=>{const r=Mt(t);return o.createElement("a",a({ref:e},r,{children:"function"==typeof t.children?t.children({isActive:"active"===r["data-status"]}):t.children}))})),St=o.createContext(null),xt=o.createContext(null),Rt={},At=(t,e)=>{const n=o.useRef(Rt),a=()=>e?e(v((()=>t()))):t();n.current===Rt&&(n.current=ht(void 0,a()));const s=o.useCallback((()=>n.current),[]),i=o.useCallback((t=>p((()=>{f((()=>{n.current=_(ht(n.current,a())),t()}))}))),[]);return r.useSyncExternalStore(i,s,s)},[It,Ot]=C({foo:"foo",bar:{baz:"baz"}});function Ct(){const t=o.useContext(xt);return W(!t,"useRouter must be used inside a <Router> component!"),t.router}function kt(){return o.useContext(St)}function jt(t){const e=Ct(),r=kt()[0],n=null!=t&&t.from?e.store.currentMatches.find((e=>e.routeId===(null==t?void 0:t.from))):r;return G(n,null!=t&&t.from&&t.from),((null==t?void 0:t.strict)??1)&&G(r.routeId==(null==n?void 0:n.routeId),(null==n||n.routeId,r.routeId,null==n||n.routeId,null==n||n.routeId)),At((()=>n.store)),n}function Dt(t){const e=Ct().getRoute(t);return G(e),e}function Ft(){const t=Ct();return e=>{const{pending:r,caseSensitive:n,...o}=e;return t.matchRoute(o,{pending:r,caseSensitive:n})}}function Nt(){const t=Ct(),e=kt().slice(1),r=e[0],n=o.useCallback((()=>null),[]);At((()=>null==r?void 0:r.store));const a=o.useCallback((e=>{if("error"===e.match.store.status)throw e.match.store.error;if("success"===e.match.store.status)return o.createElement(e.match.__.component??t.options.defaultComponent??Nt);if("loading"===e.match.store.status)throw e.match.__.loadPromise;G(!1)}),[]);if(!r)return null;const s=r.__.pendingComponent??t.options.defaultPendingComponent??n,i=r.__.errorComponent??t.options.defaultErrorComponent;return o.createElement(St.Provider,{value:e},o.createElement(o.Suspense,{fallback:o.createElement(s,null)},o.createElement(Tt,{key:r.routeId,errorComponent:i,match:r},o.createElement(a,{match:r}))))}p((()=>{let t;f((()=>{console.log("effect");const e=ht(t,It);console.log(e),t=v((()=>e))}))})),Ot((t=>{t.foo="1"})),Ot((t=>{t.bar.baz="2"}));class Tt extends o.Component{state={error:!1,info:void 0};componentDidCatch(t,e){console.error(`Error in route match: ${this.props.match.matchId}`),console.error(t),this.setState({error:t,info:e})}render(){return o.createElement($t,a({},this.props,{errorState:this.state,reset:()=>this.setState({})}))}}function $t(t){const[e,r]=o.useState(t.errorState),n=Ct(),a=t.errorComponent??Ut;return o.useEffect((()=>{if(e){let t=n.store.currentLocation.key;return p((()=>f((()=>{n.store.currentLocation.key!==t&&(t=n.store.currentLocation.key,r({}))}))))}}),[e]),o.useEffect((()=>{t.errorState.error&&r(t.errorState),t.reset()}),[t.errorState.error]),t.errorState.error?o.createElement(a,e):t.children}function Ut(t){let{error:e}=t;return o.createElement("div",{style:{padding:".5rem",maxWidth:"100%"}},o.createElement("strong",{style:{fontSize:"1.2rem"}},"Something went wrong!"),o.createElement("div",{style:{height:".5rem"}}),o.createElement("div",null,o.createElement("pre",null,e.message?o.createElement("code",{style:{fontSize:".7em",border:"1px solid red",borderRadius:".25rem",padding:".5rem",color:"red"}},e.message):null)))}function Bt(t,e){const r=Ct();o.useEffect((()=>{if(!e)return;let n=r.history.block((e=>{window.confirm(t)?(n(),e.retry()):r.store.currentLocation.pathname=window.location.pathname}));return n}),[e,t])}t.DefaultErrorBoundary=Ut,t.Link=Lt,t.MatchRoute=function(t){const e=Ft()(t);return e?o.createElement("function"==typeof t.children?t.children(e):t.children,t):null},t.Outlet=Nt,t.Prompt=function(t){let{message:e,when:r,children:n}=t;return Bt(e,r??!0),n??null},t.RouterProvider=function(t){let{router:e,...r}=t;e.update(r);const[,,n]=At((()=>e.store),(t=>[t.status,t.pendingMatches,t.currentMatches]));return o.useEffect(e.mount,[e]),console.log("current",n),o.createElement(o.Fragment,null,o.createElement(xt.Provider,{value:{router:e}},o.createElement(St.Provider,{value:[void 0,...n]},o.createElement(Nt,null))))},t.__useStoreValue=At,t.batch=m,t.cleanPath=X,t.createBrowserHistory=F,t.createEffect=f,t.createHashHistory=function(t){void 0===t&&(t={});var e=t.window,r=void 0===e?document.defaultView:e,n=r.history;function o(){var t=H(r.location.hash.substr(1)),e=t.pathname,o=void 0===e?"/":e,a=t.search,s=void 0===a?"":a,i=t.hash,c=void 0===i?"":i,l=n.state||{};return[l.idx,{pathname:o,search:s,hash:c,state:l.usr||null,key:l.key||"default"}]}var a=null;function s(){if(a)d.call(a),a=null;else{var t=R.Pop,e=o(),r=e[0],n=e[1];if(d.length){if(null!=r){var s=l-r;s&&(a={action:t,location:n,retry:function(){y(-1*s)}},y(s))}}else g(t)}}r.addEventListener(D,s),r.addEventListener("hashchange",(function(){z(o()[1])!==z(u)&&s()}));var i=R.Pop,c=o(),l=c[0],u=c[1],h=U(),d=U();function f(t){return function(){var t=document.querySelector("base"),e="";if(t&&t.getAttribute("href")){var n=r.location.href,o=n.indexOf("#");e=-1===o?n:n.slice(0,o)}return e}()+"#"+("string"==typeof t?t:z(t))}function p(t,e){return void 0===e&&(e=null),k({pathname:u.pathname,hash:"",search:""},"string"==typeof t?H(t):t,{state:e,key:B()})}function m(t,e){return[{usr:t.state,key:t.key,idx:e},f(t)]}function v(t,e,r){return!d.length||(d.call({action:t,location:e,retry:r}),!1)}function g(t){i=t;var e=o();l=e[0],u=e[1],h.call({action:i,location:u})}function y(t){n.go(t)}null==l&&(l=0,n.replaceState(k({},n.state,{idx:l}),""));var b={get action(){return i},get location(){return u},createHref:f,push:function t(e,o){var a=R.Push,s=p(e,o);if(v(a,s,(function(){t(e,o)}))){var i=m(s,l+1),c=i[0],u=i[1];try{n.pushState(c,"",u)}catch(t){r.location.assign(u)}g(a)}},replace:function t(e,r){var o=R.Replace,a=p(e,r);if(v(o,a,(function(){t(e,r)}))){var s=m(a,l),i=s[0],c=s[1];n.replaceState(i,"",c),g(o)}},go:y,back:function(){y(-1)},forward:function(){y(1)},listen:function(t){return h.push(t)},block:function(t){var e=d.push(t);return 1===d.length&&r.addEventListener(j,$),function(){e(),d.length||r.removeEventListener(j,$)}}};return b},t.createMemo=function(t){const e=new h(t,1);return e.get.bind(e)},t.createMemoryHistory=N,t.createReactRouter=function(t){return _t({...t,loadComponent:async t=>(t.preload&&await t.preload(),t)})},t.createRoot=p,t.createRoute=ct,t.createRouteConfig=ut,t.createRouteMatch=mt,t.createRouter=_t,t.createSignal=function(t,e){const r=new h(t,0);return void 0!==e?.equals&&(r.alwaysUpdate=!0),[r.get.bind(r),r.set.bind(r)]},t.createStore=C,t.decode=it,t.defaultParseSearch=vt,t.defaultStringifySearch=gt,t.encode=at,t.functionalUpdate=V,t.interpolatePath=rt,t.invariant=G,t.isWrappable=E,t.joinPaths=J,t.last=K,t.lazy=function(t){const e=o.lazy(t);return e.preload=async()=>{await t()},e},t.matchByPath=ot,t.matchPathname=nt,t.matchesContext=St,t.onCleanup=function(t){i?i.cleanups?i.cleanups.push(t):i.cleanups=[t]:console.error("onCleanup must be called from within a memo or effect")},t.parsePathname=et,t.parseSearchWith=yt,t.pick=q,t.resolvePath=tt,t.rootRouteId=lt,t.routerContext=xt,t.sharedClone=ht,t.stringifySearchWith=bt,t.trimPath=Z,t.trimPathLeft=Q,t.trimPathRight=Y,t.untrack=v,t.unwrap=_,t.useAction=function(t){const e=Dt(t.from).action;return At((()=>e)),e},t.useLinkProps=Mt,t.useLoaderData=function(t){const e=jt(t);return At((()=>null==e?void 0:e.store.loaderData),null==t?void 0:t.select)},t.useMatch=jt,t.useMatchRoute=Ft,t.useMatches=kt,t.useNavigate=function(t){return e=>Ct().navigate({...t,...e})},t.useParams=function(t){const e=Ct();return At((()=>{var t;return null==(t=K(e.store.currentMatches))?void 0:t.params}),null==t?void 0:t.select)},t.usePrompt=Bt,t.useRoute=Dt,t.useRouter=Ct,t.useRouterStore=function(t){const e=Ct();return At((()=>e.store),t)},t.useSearch=function(t){const e=jt(t);return At((()=>null==e?void 0:e.store.search),null==t?void 0:t.select)},t.warning=W,Object.defineProperty(t,"__esModule",{value:!0})}));
22
22
  //# sourceMappingURL=index.production.js.map