codesesh 1.0.0 → 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. package/README.md +27 -4
  2. package/dist/{chunk-BEF6LLRG.js → chunk-JHX5OLL4.js} +4010 -2248
  3. package/dist/chunk-JHX5OLL4.js.map +1 -0
  4. package/dist/{chunk-TIHF4T3K.js → chunk-OFTTM3UD.js} +80 -16
  5. package/dist/chunk-OFTTM3UD.js.map +1 -0
  6. package/dist/{dist-3F467V44.js → dist-N2PQATP2.js} +40 -4
  7. package/dist/index.js +1818 -454
  8. package/dist/index.js.map +1 -1
  9. package/dist/scan-refresh-worker.js +274 -95
  10. package/dist/scan-refresh-worker.js.map +1 -1
  11. package/dist/search-index-worker.js +112 -50
  12. package/dist/search-index-worker.js.map +1 -1
  13. package/dist/smart-tag-worker.js +5 -3
  14. package/dist/smart-tag-worker.js.map +1 -1
  15. package/dist/web/assets/ErrorBoundary-D11tWzfn.js +1 -0
  16. package/dist/web/assets/OverviewScreen-DriPmCam.js +1 -0
  17. package/dist/web/assets/Projects-BPDIcUBK.js +1 -0
  18. package/dist/web/assets/SearchFilterBar-Bx73B5e9.js +1 -0
  19. package/dist/web/assets/SearchResultsPanel-A6_3TPhW.js +1 -0
  20. package/dist/web/assets/SessionDetail-lQz99ARH.js +54 -0
  21. package/dist/web/assets/agents-BkRP_ww3.js +1 -0
  22. package/dist/web/assets/contract-V6QuD0UY.js +1 -0
  23. package/dist/web/assets/index-B2RqUgZ5.css +1 -0
  24. package/dist/web/assets/index-BgWoUD_4.js +1410 -0
  25. package/dist/web/assets/panel-C-gc79Gz.js +1 -0
  26. package/dist/web/assets/session-indexes-0oT5HSS5.js +4 -0
  27. package/dist/web/assets/utils-DgUgu15E.js +1 -0
  28. package/dist/web/index.html +10 -32
  29. package/dist/web/theme-bootstrap.js +19 -0
  30. package/package.json +10 -10
  31. package/dist/chunk-BEF6LLRG.js.map +0 -1
  32. package/dist/chunk-TIHF4T3K.js.map +0 -1
  33. package/dist/web/assets/ErrorBoundary-BY-N1QzJ.js +0 -1
  34. package/dist/web/assets/OverviewScreen-_ZaVjhxN.js +0 -1
  35. package/dist/web/assets/Projects-q6cEm2dc.js +0 -1
  36. package/dist/web/assets/SearchFilterBar-CrVBpo40.js +0 -1
  37. package/dist/web/assets/SearchResultsPanel-Cg5V8Ia6.js +0 -1
  38. package/dist/web/assets/SessionDetail-BSSuddsZ.js +0 -54
  39. package/dist/web/assets/chunk-62JRHF6Z-BWRsEBnL.js +0 -4
  40. package/dist/web/assets/index-C3KgxGwE.js +0 -1410
  41. package/dist/web/assets/index-DQX42cFQ.css +0 -1
  42. package/dist/web/assets/panel-B7kuE60V.js +0 -1
  43. package/dist/web/assets/session-indexes-DmnjZ_JL.js +0 -1
  44. package/dist/web/assets/utils-t2u9IbNT.js +0 -1
  45. /package/dist/{dist-3F467V44.js.map → dist-N2PQATP2.js.map} +0 -0
@@ -1,4 +0,0 @@
1
- import{a as e,n as t}from"./jsx-runtime-B-hcVAMW.js";function n(e,t){let n=new Map,r=new Map,i=(e,t)=>`${e}\0${t}`,a=e=>{let t=i(e.reference.agentName,e.reference.sessionId);r.delete(t),n.set(t,e)},o=e=>{let t=i(e.agentName,e.sessionId);n.delete(t),r.set(t,e)};for(let t of e.changedSessionHeads)a(t);for(let t of e.removedSessionRefs)o(t);for(let e of t.changedSessionHeads)a(e);for(let e of t.removedSessionRefs)o(e);return{type:`sessions-updated`,changedAgents:Array.from(new Set([...e.changedAgents,...t.changedAgents])),newSessions:e.newSessions+t.newSessions,updatedSessions:e.updatedSessions+t.updatedSessions,removedSessions:e.removedSessions+t.removedSessions,totalSessions:t.totalSessions,timestamp:t.timestamp,changedSessionHeads:[...n.values()],removedSessionRefs:[...r.values()]}}function r(e){let t=new Date(e);return new Date(t.getFullYear(),t.getMonth(),t.getDate()).getTime()}function i(e,t){let n=new Date(e);return new Date(n.getFullYear(),n.getMonth(),n.getDate()+t).getTime()}function a(e){let t=new Date(e);return`${String(t.getFullYear()).padStart(4,`0`)}-${String(t.getMonth()+1).padStart(2,`0`)}-${String(t.getDate()).padStart(2,`0`)}`}var o=new Set([`git_remote`,`git_common_dir`,`manifest_path`,`synthetic`,`path`,`loose`]);function s(e){return o.has(e)}function c(e){return`${e.kind}:${e.key}`}function l(e,t){return`${e}\0${t.toLowerCase()}`}function u(e){return{agentName:e.agentName.trim().toLowerCase(),sessionId:e.sessionId}}function d(e){let t=e.indexOf(`/`);if(t<=0||t===e.length-1)return null;let n=e.slice(0,t).trim().toLowerCase();return n?{agentName:n,sessionId:e.slice(t+1)}:null}function f(e){let t=u(e);return`${t.agentName}/${t.sessionId}`}function p(e){return d(e.slug)?.agentName??`unknown`}function m(e){return`/${encodeURIComponent(e.trim().toLowerCase())}`}function h(e){let t=u(e);return`${m(t.agentName)}/${encodeURIComponent(t.sessionId)}`}function g(e){return h({agentName:p(e),sessionId:e.id})}function _(e,t){return(t.time_updated??t.time_created)-(e.time_updated??e.time_created)}function v(e){for(let t=1;t<e.length;t+=1)if(_(e[t-1],e[t])>0)return[...e].sort(_);return[...e]}function y(e,t){return f({agentName:e,sessionId:t})}function b(e,t,n){let r=e.get(t);r?r.push(n):e.set(t,[n])}function x(e){let t=new Map,n=new Map,r=new Map,i=new Map;for(let n of e){let e=y(p(n),n.id);t.has(e)||t.set(e,n)}let a=v(e);for(let e of a){let t=p(e);b(n,t,e);let a=e.project_identity;if(!a?.key)continue;let o=c(a);b(r,o,e),b(i,l(o,t),e)}return{sourceSessions:e,sessionsByActivity:a,byRouteKey:t,byAgent:n,byProjectIdentityKey:r,byProjectAgentKey:i}}function S(e,t,n){let r=new Map;for(let t of e)r.set(y(p(t),t.id),t);for(let e of n)r.delete(y(e.agentName,e.sessionId));for(let e of t)r.set(y(e.reference.agentName,e.reference.sessionId),e.session);return v([...r.values()])}function C(e){return y(p(e),e.id)}function w(e){return e.parent_reference?f(e.parent_reference):null}function T(e){return e.time_updated??e.time_created}function E(e){let t=e.stats,n=t.total_cost??0;return{messageCount:t.message_count,inputTokens:t.total_input_tokens,outputTokens:t.total_output_tokens,cacheReadTokens:t.total_cache_read_tokens??0,cacheCreateTokens:t.total_cache_create_tokens??0,totalTokens:t.total_tokens??t.total_input_tokens+t.total_output_tokens,cost:n,costSource:n>0?t.cost_source??`recorded`:void 0}}function D(e,t){e.messageCount+=t.messageCount,e.inputTokens+=t.inputTokens,e.outputTokens+=t.outputTokens,e.cacheReadTokens+=t.cacheReadTokens,e.cacheCreateTokens+=t.cacheCreateTokens,e.totalTokens+=t.totalTokens,e.cost+=t.cost,t.costSource===`estimated`&&(e.costSource=`estimated`)}function O(e){let t=[],n=[e];for(;n.length>0;){let e=n.pop();t.push(e);for(let t of e.children)n.push(t)}for(let e=t.length-1;e>=0;--e){let n=t[e],r=n.inclusiveStats,i=0;for(let e of n.children)i+=1+e.descendantCount,D(r,e.inclusiveStats);r.cost>0&&r.costSource==null&&(r.costSource=`recorded`),n.descendantCount=i}}function k(e){let t=new Map,n=e.map(e=>({session:e,children:[],descendantCount:0,inclusiveStats:E(e)}));for(let e of n){let n=C(e.session);t.has(n)||t.set(n,e)}let r=new Map;function i(e){let n=[],i=new Set,a=e,o=!0;for(;a!=null;){let e=r.get(a);if(e!=null){o=e;break}if(i.has(a)){o=!1;break}i.add(a),n.push(a);let s=w(t.get(a).session);a=s!=null&&t.has(s)?s:null}for(let e of n)r.set(e,o);return o}let a=new Map,o=[],s=[],c=[];for(let e of n){let n=C(e.session),r=w(e.session),l=r==null?`root`:t.has(r)&&i(n)?`mounted-child`:`orphan`;if(a.set(n,l),l===`mounted-child`){t.get(r).children.push(e);continue}(l===`root`?o:s).push(e),c.push(e)}for(let e of c)O(e);return{roots:o,orphans:s,entries:c,byRouteKey:t,mountStateOf(e){return a.get(C(e))??(e.parent_reference?`orphan`:`root`)}}}function A(e){let t=new Map;for(let n of e){let e=T(n.session),i=a(e),o=t.get(i);o||(o={dayKey:i,dayStart:r(e),nodes:[],mainCount:0,subCount:0},t.set(i,o)),o.nodes.push(n)}let n=[...t.values()];for(let e of n)e.nodes.sort((e,t)=>_(e.session,t.session)),e.mainCount=e.nodes.length,e.subCount=e.nodes.reduce((e,t)=>e+t.descendantCount,0);return n.sort((e,t)=>t.dayStart-e.dayStart)}var j={id:`session-1`,slug:`claudecode/session-1`,title:`Fix flaky search index test`,directory:`/Users/dev/project`,project_identity:{kind:`git_remote`,key:`github.com/example/project`,displayName:`example/project`},time_created:17e11,time_updated:17000036e5,stats:{message_count:12,total_input_tokens:4200,total_output_tokens:1800,total_cost:.042,cost_source:`recorded`,total_tokens:6e3,total_cache_read_tokens:3e3,total_cache_create_tokens:500},model_usage:{"claude-5-sonnet":6e3},smart_tags:[`bugfix`],smart_tags_source_updated_at:17000036e5};j.id,j.id;var M=e(t(),1),ee=`modulepreload`,te=function(e){return`/`+e},N={},ne=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e=document.getElementsByTagName(`link`),i=document.querySelector(`meta[property=csp-nonce]`),a=i?.nonce||i?.getAttribute(`nonce`);function o(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}function s(e){return import.meta.resolve?import.meta.resolve(e):new URL(e,import.meta.url).href}r=o(t.map(t=>{if(t=te(t,n),t=s(t),t in N)return;N[t]=!0;let r=t.endsWith(`.css`);for(let n=e.length-1;n>=0;n--){let i=e[n];if(i.href===t&&(!r||i.rel===`stylesheet`))return}let i=document.createElement(`link`);if(i.rel=r?`stylesheet`:ee,r||(i.as=`script`),i.crossOrigin=``,i.href=t,a&&i.setAttribute(`nonce`,a),document.head.appendChild(i),r)return new Promise((e,n)=>{i.addEventListener(`load`,e),i.addEventListener(`error`,()=>n(Error(`Unable to preload CSS for ${t}`)))})}))}function i(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(let e of t||[])e.status===`rejected`&&i(e.reason);return e().catch(i)})},re=e=>{throw TypeError(e)},P=(e,t,n)=>t.has(e)||re(`Cannot `+n),F=(e,t,n)=>(P(e,t,`read from private field`),n?n.call(e):t.get(e)),ie=(e,t,n)=>t.has(e)?re(`Cannot add the same private member more than once`):t instanceof WeakSet?t.add(e):t.set(e,n),I=(e,t,n,r)=>(P(e,t,`write to private field`),r?r.call(e,n):t.set(e,n),n),L=/^(?:[a-z][a-z0-9+.-]*:|[\\/]{2})/i,R=/^[\\/]{2}/;function ae(e,t){return t+e.replace(/\\/g,`/`)}var oe=`popstate`;function se(e){return typeof e==`object`&&!!e&&`pathname`in e&&`search`in e&&`hash`in e&&`state`in e&&`key`in e}function ce(e={}){function t(e,t){let n=t.state?.masked,{pathname:r,search:i,hash:a}=n||e.location;return ue(``,{pathname:r,search:i,hash:a},t.state&&t.state.usr||null,t.state&&t.state.key||`default`,n?{pathname:e.location.pathname,search:e.location.search,hash:e.location.hash}:void 0)}function n(e,t){return typeof t==`string`?t:H(t)}return de(t,n,null,e)}function z(e,t){if(e===!1||e==null)throw Error(t)}function B(e,t){if(!e){typeof console<`u`&&console.warn(t);try{throw Error(t)}catch{}}}function le(){return Math.random().toString(36).substring(2,10)}function V(e,t){return{usr:e.state,key:e.key,idx:t,masked:e.mask?{pathname:e.pathname,search:e.search,hash:e.hash}:void 0}}function ue(e,t,n=null,r,i){return{pathname:typeof e==`string`?e:e.pathname,search:``,hash:``,...typeof t==`string`?U(t):t,state:n,key:t&&t.key||r||le(),mask:i}}function H({pathname:e=`/`,search:t=``,hash:n=``}){return t&&t!==`?`&&(e+=t.charAt(0)===`?`?t:`?`+t),n&&n!==`#`&&(e+=n.charAt(0)===`#`?n:`#`+n),e}function U(e){let t={};if(e){let n=e.indexOf(`#`);n>=0&&(t.hash=e.substring(n),e=e.substring(0,n));let r=e.indexOf(`?`);r>=0&&(t.search=e.substring(r),e=e.substring(0,r)),e&&(t.pathname=e)}return t}function de(e,t,n,r={}){let{window:i=document.defaultView,v5Compat:a=!1}=r,o=i.history,s=`POP`,c=null,l=u();l??(l=0,o.replaceState({...o.state,idx:l},``));function u(){return(o.state||{idx:null}).idx}function d(){s=`POP`;let e=u(),t=e==null?null:e-l;l=e,c&&c({action:s,location:h.location,delta:t})}function f(e,t){s=`PUSH`;let r=se(e)?e:ue(h.location,e,t);n&&n(r,e),l=u()+1;let d=V(r,l),f=h.createHref(r.mask||r);try{o.pushState(d,``,f)}catch(e){if(e instanceof DOMException&&e.name===`DataCloneError`)throw e;i.location.assign(f)}a&&c&&c({action:s,location:h.location,delta:1})}function p(e,t){s=`REPLACE`;let r=se(e)?e:ue(h.location,e,t);n&&n(r,e),l=u();let i=V(r,l),d=h.createHref(r.mask||r);o.replaceState(i,``,d),a&&c&&c({action:s,location:h.location,delta:0})}function m(e){return fe(i,e)}let h={get action(){return s},get location(){return e(i,o)},listen(e){if(c)throw Error(`A history only accepts one active listener`);return i.addEventListener(oe,d),c=e,()=>{i.removeEventListener(oe,d),c=null}},createHref(e){return t(i,e)},createURL:m,encodeLocation(e){let t=m(e);return{pathname:t.pathname,search:t.search,hash:t.hash}},push:f,replace:p,go(e){return o.go(e)}};return h}function fe(e,t,n=!1){let r=`http://localhost`;e&&(r=e.location.origin===`null`?e.location.href:e.location.origin),z(r,`No window.location.(origin|href) available to create URL`);let i=typeof t==`string`?t:H(t);return i=i.replace(/ $/,`%20`),!n&&R.test(i)&&(i=r+i),new URL(i,r)}function pe(e){return{defaultValue:e}}var W,me=class{constructor(e){if(ie(this,W,new Map),e)for(let[t,n]of e)this.set(t,n)}get(e){if(F(this,W).has(e))return F(this,W).get(e);if(e.defaultValue!==void 0)return e.defaultValue;throw Error(`No value found for context`)}set(e,t){F(this,W).set(e,t)}};W=new WeakMap;var he=new Set([`lazy`,`caseSensitive`,`path`,`id`,`index`,`children`]);function ge(e){return he.has(e)}var _e=new Set([`lazy`,`caseSensitive`,`path`,`id`,`index`,`middleware`,`children`]);function ve(e){return _e.has(e)}function ye(e){return e.index===!0}function be(e,t,n=[],r={},i=!1){return e.map((e,a)=>{let o=[...n,String(a)],s=typeof e.id==`string`?e.id:o.join(`-`);if(z(e.index!==!0||!e.children,`Cannot specify children on an index route`),z(i||!r[s],`Found a route id collision on id "${s}". Route id's must be globally unique within Data Router usages`),ye(e)){let n={...e,id:s};return r[s]=xe(n,t(n)),n}{let n={...e,id:s,children:void 0};return r[s]=xe(n,t(n)),e.children&&(n.children=be(e.children,t,o,r,i)),n}})}function xe(e,t){return Object.assign(e,{...t,...typeof t.lazy==`object`&&t.lazy!=null?{lazy:{...e.lazy,...t.lazy}}:{}})}function Se(e,t,n=`/`){return G(e,t,n,!1)}function G(e,t,n,r,i){let a=J((typeof t==`string`?U(t):t).pathname||`/`,n);if(a==null)return null;let o=i??K(e),s=null,c=ze(a);for(let e=0;s==null&&e<o.length;++e)s=Fe(o[e],c,r);return s}function Ce(e,t){let{route:n,pathname:r,params:i}=e;return{id:n.id,pathname:r,params:i,data:t[n.id],loaderData:t[n.id],handle:n.handle}}function K(e){let t=we(e);return Ee(t),t}function we(e,t=[],n=[],r=``,i=!1){let a=(e,a,o=i,s)=>{let c={relativePath:s===void 0?e.path||``:s,caseSensitive:e.caseSensitive===!0,childrenIndex:a,route:e};if(c.relativePath.startsWith(`/`)){if(!c.relativePath.startsWith(r)&&o)return;z(c.relativePath.startsWith(r),`Absolute route path "${c.relativePath}" nested under path "${r}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),c.relativePath=c.relativePath.slice(r.length)}let l=Y([r,c.relativePath]),u=n.concat(c);e.children&&e.children.length>0&&(z(e.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${l}".`),we(e.children,t,u,l,o)),!(e.path==null&&!e.index)&&t.push({path:l,score:Ne(l,e.index),routesMeta:u.map((e,t)=>{let[n,r]=Re(e.relativePath,e.caseSensitive,t===u.length-1);return{...e,matcher:n,compiledParams:r}})})};return e.forEach((e,t)=>{if(e.path===``||!e.path?.includes(`?`))a(e,t);else for(let n of Te(e.path))a(e,t,!0,n)}),t}function Te(e){let t=e.split(`/`);if(t.length===0)return[];let[n,...r]=t,i=n.endsWith(`?`),a=n.replace(/\?$/,``);if(r.length===0)return i?[a,``]:[a];let o=Te(r.join(`/`)),s=[];return s.push(...o.map(e=>e===``?a:[a,e].join(`/`))),i&&s.push(...o),s.map(t=>e.startsWith(`/`)&&t===``?`/`:t)}function Ee(e){e.sort((e,t)=>e.score===t.score?Pe(e.routesMeta.map(e=>e.childrenIndex),t.routesMeta.map(e=>e.childrenIndex)):t.score-e.score)}var De=/^:[\w-]+$/,Oe=3,ke=2,Ae=1,je=10,Me=-2,q=e=>e===`*`;function Ne(e,t){let n=e.split(`/`),r=n.length;return n.some(q)&&(r+=Me),t&&(r+=ke),n.filter(e=>!q(e)).reduce((e,t)=>e+(De.test(t)?Oe:t===``?Ae:je),r)}function Pe(e,t){return e.length===t.length&&e.slice(0,-1).every((e,n)=>e===t[n])?e[e.length-1]-t[t.length-1]:0}function Fe(e,t,n=!1){let{routesMeta:r}=e,i={},a=`/`,o=[];for(let e=0;e<r.length;++e){let s=r[e],c=e===r.length-1,l=a===`/`?t:t.slice(a.length)||`/`,u={path:s.relativePath,caseSensitive:s.caseSensitive,end:c},d=s.matcher&&s.compiledParams?Le(u,l,s.matcher,s.compiledParams):Ie(u,l),f=s.route;if(!d&&c&&n&&!r[r.length-1].route.index&&(d=Ie({path:s.relativePath,caseSensitive:s.caseSensitive,end:!1},l)),!d)return null;Object.assign(i,d.params),o.push({params:i,pathname:Y([a,d.pathname]),pathnameBase:Xe(Y([a,d.pathnameBase])),route:f}),d.pathnameBase!==`/`&&(a=Y([a,d.pathnameBase]))}return o}function Ie(e,t){typeof e==`string`&&(e={path:e,caseSensitive:!1,end:!0});let[n,r]=Re(e.path,e.caseSensitive,e.end);return Le(e,t,n,r)}function Le(e,t,n,r){let i=t.match(n);if(!i)return null;let a=i[0],o=a.replace(/(.)\/+$/,`$1`),s=i.slice(1);return{params:r.reduce((e,{paramName:t,isOptional:n},r)=>{if(t===`*`){let e=s[r]||``;o=a.slice(0,a.length-e.length).replace(/(.)\/+$/,`$1`)}let i=s[r];return e[t]=n&&!i?void 0:(i||``).replace(/%2F/g,`/`),e},{}),pathname:a,pathnameBase:o,pattern:e}}function Re(e,t=!1,n=!0){B(e===`*`||!e.endsWith(`*`)||e.endsWith(`/*`),`Route path "${e}" will be treated as if it were "${e.replace(/\*$/,`/*`)}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${e.replace(/\*$/,`/*`)}".`);let r=[],i=`^`+e.replace(/\/*\*?$/,``).replace(/^\/*/,`/`).replace(/[\\.*+^${}|()[\]]/g,`\\$&`).replace(/\/:([\w-]+)(\?)?/g,(e,t,n,i,a)=>{if(r.push({paramName:t,isOptional:n!=null}),n){let t=a.charAt(i+e.length);return t&&t!==`/`?`/([^\\/]*)`:`(?:/([^\\/]*))?`}return`/([^\\/]+)`}).replace(/\/([\w-]+)\?(\/|$)/g,`(/$1)?$2`);return e.endsWith(`*`)?(r.push({paramName:`*`}),i+=e===`*`||e===`/*`?`(.*)$`:`(?:\\/(.+)|\\/*)$`):n?i+=`\\/*$`:e!==``&&e!==`/`&&(i+=`(?:(?=\\/|$))`),[new RegExp(i,t?void 0:`i`),r]}function ze(e){try{return e.split(`/`).map(e=>decodeURIComponent(e).replace(/\//g,`%2F`)).join(`/`)}catch(t){return B(!1,`The URL path "${e}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${t}).`),e}}function J(e,t){if(t===`/`)return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let n=t.endsWith(`/`)?t.length-1:t.length,r=e.charAt(n);return r&&r!==`/`?null:e.slice(n)||`/`}function Be({basename:e,pathname:t}){return t===`/`?e:Y([e,t])}var Ve=e=>L.test(e);function He(e,t=`/`){let{pathname:n,search:r=``,hash:i=``}=typeof e==`string`?U(e):e,a;return n?(n=Je(n),a=n.startsWith(`/`)?Ue(n.substring(1),`/`):Ue(n,t)):a=t,{pathname:a,search:Ze(r),hash:Qe(i)}}function Ue(e,t){let n=Ye(t).split(`/`);return e.split(`/`).forEach(e=>{e===`..`?n.length>1&&n.pop():e!==`.`&&n.push(e)}),n.length>1?n.join(`/`):`/`}function We(e,t,n,r){return`Cannot include a '${e}' character in a manually specified \`to.${t}\` field [${JSON.stringify(r)}]. Please separate it out to the \`to.${n}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function Ge(e){return e.filter((e,t)=>t===0||e.route.path&&e.route.path.length>0)}function Ke(e){let t=Ge(e);return t.map((e,n)=>n===t.length-1?e.pathname:e.pathnameBase)}function qe(e,t,n,r=!1){let i;typeof e==`string`?i=U(e):(i={...e},z(!i.pathname||!i.pathname.includes(`?`),We(`?`,`pathname`,`search`,i)),z(!i.pathname||!i.pathname.includes(`#`),We(`#`,`pathname`,`hash`,i)),z(!i.search||!i.search.includes(`#`),We(`#`,`search`,`hash`,i)));let a=e===``||i.pathname===``,o=a?`/`:i.pathname,s;if(o==null)s=n;else{let e=t.length-1;if(!r&&o.startsWith(`..`)){let t=o.split(`/`);for(;t[0]===`..`;)t.shift(),--e;i.pathname=t.join(`/`)}s=e>=0?t[e]:`/`}let c=He(i,s),l=o&&o!==`/`&&o.endsWith(`/`),u=(a||o===`.`)&&n.endsWith(`/`);return!c.pathname.endsWith(`/`)&&(l||u)&&(c.pathname+=`/`),c}var Je=e=>e.replace(/[\\/]{2,}/g,`/`),Y=e=>Je(e.join(`/`)),Ye=e=>e.replace(/\/+$/,``),Xe=e=>Ye(e).replace(/^\/*/,`/`),Ze=e=>!e||e===`?`?``:e.startsWith(`?`)?e:`?`+e,Qe=e=>!e||e===`#`?``:e.startsWith(`#`)?e:`#`+e,$e=[`EvalError`,`RangeError`,`ReferenceError`,`SyntaxError`,`TypeError`,`URIError`],et=class{constructor(e,t,n,r=!1){this.status=e,this.statusText=t||``,this.internal=r,n instanceof Error?(this.data=n.toString(),this.error=n):this.data=n}};function tt(e){return e!=null&&typeof e.status==`number`&&typeof e.statusText==`string`&&typeof e.internal==`boolean`&&`data`in e}function nt(e){return Y(e.map(e=>e.route.path).filter(Boolean))||`/`}var rt=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0;function it(e,t){let n=e;if(typeof n!=`string`||!L.test(n))return{absoluteURL:void 0,isExternal:!1,to:n};let r=n,i=!1;if(rt)try{let e=new URL(window.location.href),r=R.test(n)?new URL(ae(n,e.protocol)):new URL(n),a=J(r.pathname,t);r.origin===e.origin&&a!=null?n=a+r.search+r.hash:i=!0}catch{B(!1,`<Link to="${n}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:r,isExternal:i,to:n}}var at=Symbol(`Uninstrumented`);function ot(e,t){let n={lazy:[],"lazy.loader":[],"lazy.action":[],"lazy.middleware":[],middleware:[],loader:[],action:[]};e.forEach(e=>e({id:t.id,index:t.index,path:t.path,instrument(e){let t=Object.keys(n);for(let r of t)e[r]&&n[r].push(e[r])}}));let r={};if(typeof t.lazy==`function`&&n.lazy.length>0){let e=ct(n.lazy,t.lazy,()=>void 0);e&&(r.lazy=e)}if(typeof t.lazy==`object`){let e=t.lazy;[`middleware`,`loader`,`action`].forEach(t=>{let i=e[t],a=n[`lazy.${t}`];if(typeof i==`function`&&a.length>0){let e=ct(a,i,()=>void 0);e&&(r.lazy=Object.assign(r.lazy||{},{[t]:e}))}})}return[`loader`,`action`].forEach(e=>{let i=t[e];if(typeof i==`function`&&n[e].length>0){let t=i[at]??i,a=ct(n[e],t,(...e)=>ut(e[0]));a&&(e===`loader`&&t.hydrate===!0&&(a.hydrate=!0),a[at]=t,r[e]=a)}}),t.middleware&&t.middleware.length>0&&n.middleware.length>0&&(r.middleware=t.middleware.map(e=>{let t=e[at]??e,r=ct(n.middleware,t,(...e)=>ut(e[0]));return r?(r[at]=t,r):e})),r}function st(e,t){let n={navigate:[],fetch:[]};if(t.forEach(e=>e({instrument(e){let t=Object.keys(e);for(let r of t)e[r]&&n[r].push(e[r])}})),n.navigate.length>0){let t=e.navigate[at]??e.navigate,r=ct(n.navigate,t,(...t)=>{let[n,r]=t;return{to:typeof n==`number`||typeof n==`string`?n:n?H(n):`.`,...dt(e,r??{})}});r&&(r[at]=t,e.navigate=r)}if(n.fetch.length>0){let t=e.fetch[at]??e.fetch,r=ct(n.fetch,t,(...t)=>{let[n,,r,i]=t;return{href:r??`.`,fetcherKey:n,...dt(e,i??{})}});r&&(r[at]=t,e.fetch=r)}return e}function ct(e,t,n){return e.length===0?null:async(...r)=>{let i=await lt(e,n(...r),()=>t(...r),e.length-1);if(i.type===`error`)throw i.value;return i.value}}async function lt(e,t,n,r){let i=e[r],a;if(i){let o,s=async()=>(o?console.error(`You cannot call instrumented handlers more than once`):o=lt(e,t,n,r-1),a=await o,z(a,`Expected a result`),a.type===`error`&&a.value instanceof Error?{status:`error`,error:a.value}:{status:`success`,error:void 0});try{await i(s,t)}catch(e){console.error(`An instrumentation function threw an error:`,e)}o||await s(),await o}else try{a={type:`success`,value:await n()}}catch(e){a={type:`error`,value:e}}return a||{type:`error`,value:Error(`No result assigned in instrumentation chain.`)}}function ut(e){let{request:t,context:n,params:r,pattern:i}=e;return{request:ft(t),params:{...r},pattern:i,context:pt(n)}}function dt(e,t){return{currentUrl:H(e.state.location),...`formMethod`in t?{formMethod:t.formMethod}:{},...`formEncType`in t?{formEncType:t.formEncType}:{},...`formData`in t?{formData:t.formData}:{},...`body`in t?{body:t.body}:{}}}function ft(e){return{method:e.method,url:e.url,headers:{get:(...t)=>e.headers.get(...t)}}}function pt(e){if(ht(e)){let t={...e};return Object.freeze(t),t}return{get:t=>e.get(t)}}var mt=Object.getOwnPropertyNames(Object.prototype).sort().join(`\0`);function ht(e){if(typeof e!=`object`||!e)return!1;let t=Object.getPrototypeOf(e);return t===Object.prototype||t===null||Object.getOwnPropertyNames(t).sort().join(`\0`)===mt}var gt=[`POST`,`PUT`,`PATCH`,`DELETE`],_t=new Set(gt),vt=[`GET`,...gt],yt=new Set(vt),bt=new Set([301,302,303,307,308]),xt=new Set([307,308]),St={state:`idle`,location:void 0,matches:void 0,historyAction:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0},Ct={state:`idle`,data:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0},wt={state:`unblocked`,proceed:void 0,reset:void 0,location:void 0},Tt=e=>({hasErrorBoundary:!!e.hasErrorBoundary}),Et=`remix-router-transitions`,Dt=Symbol(`ResetLoaderData`),Ot,kt,At,jt,Mt=class{constructor(e){ie(this,Ot),ie(this,kt),ie(this,At),ie(this,jt),I(this,Ot,e),I(this,kt,K(e))}get stableRoutes(){return F(this,Ot)}get activeRoutes(){return F(this,At)??F(this,Ot)}get branches(){return F(this,jt)??F(this,kt)}get hasHMRRoutes(){return F(this,At)!=null}setRoutes(e){I(this,Ot,e),I(this,kt,K(e))}setHmrRoutes(e){I(this,At,e),I(this,jt,K(e))}commitHmrRoutes(){F(this,At)&&(I(this,Ot,F(this,At)),I(this,kt,F(this,jt)),I(this,At,void 0),I(this,jt,void 0))}};Ot=new WeakMap,kt=new WeakMap,At=new WeakMap,jt=new WeakMap;function Nt(e){let t=e.window?e.window:typeof window<`u`?window:void 0,n=t!==void 0&&t.document!==void 0&&t.document.createElement!==void 0;z(e.routes.length>0,`You must provide a non-empty routes array to createRouter`);let r=e.hydrationRouteProperties||[],i=e.mapRouteProperties||Tt,a=i;if(e.instrumentations){let t=e.instrumentations;a=e=>({...i(e),...ot(t.map(e=>e.route).filter(Boolean),e)})}let o={},s=new Mt(be(e.routes,a,void 0,o)),c=e.basename||`/`;c.startsWith(`/`)||(c=`/${c}`);let l=e.dataStrategy||Xt,u={...e.future},d=null,f=new Set,p=null,m=null,h=null,g=null,_=e.hydrationData!=null,v=G(s.activeRoutes,e.history.location,c,!1,s.branches),y=!1,b=null,x,S;if(v==null&&!e.patchRoutesOnNavigation){let t=X(404,{pathname:e.history.location.pathname}),{matches:n,route:r}=xn(s.activeRoutes);x=!0,S=!x,v=n,b={[r.id]:t}}else if(v&&!e.hydrationData&&Ke(v,s.activeRoutes,e.history.location.pathname).active&&(v=null),!v){x=!1,S=!x,v=[];let t=Ke(null,s.activeRoutes,e.history.location.pathname);t.active&&t.matches&&(y=!0,v=t.matches)}else if(v.some(e=>e.route.lazy))x=!1,S=!x;else if(!v.some(e=>Rt(e.route)))x=!0,S=!x;else{let t=e.hydrationData?e.hydrationData.loaderData:null,n=e.hydrationData?e.hydrationData.errors:null,r=v;if(n){let e=v.findIndex(e=>n[e.route.id]!==void 0);r=r.slice(0,e+1)}S=!1,x=!0,r.forEach(e=>{let r=zt(e.route,t,n);S||=r.renderFallback,x&&=!r.shouldLoad})}let C,w={historyAction:e.history.action,location:e.history.location,matches:v,initialized:x,renderFallback:S,navigation:St,restoreScrollPosition:e.hydrationData==null&&null,preventScrollReset:!1,revalidation:`idle`,loaderData:e.hydrationData&&e.hydrationData.loaderData||{},actionData:e.hydrationData&&e.hydrationData.actionData||null,errors:e.hydrationData&&e.hydrationData.errors||b,fetchers:new Map,blockers:new Map},T=`POP`,E=null,D=!1,O,k=!1,A=new Map,j=null,M=!1,ee=!1,te=new Set,N=new Map,ne=0,re=-1,P=new Map,F=new Set,ie=new Map,I=new Map,L=new Set,R=new Map,ae,oe=null;function se(){if(d=e.history.listen(({action:t,location:n,delta:r})=>{if(ae){ae(),ae=void 0;return}B(R.size===0||r!=null,"You are trying to use a blocker on a POP navigation to a location that was not created by @remix-run/router. This will fail silently in production. This can happen if you are navigating outside the router via `window.history.pushState`/`window.location.hash` instead of using router navigation APIs. This can also happen if you are using createHashRouter and the user manually changes the URL.");let i=ze({currentLocation:w.location,nextLocation:n,historyAction:t});if(i&&r!=null){let t=new Promise(e=>{ae=e});e.history.go(r*-1),Re(i,{state:`blocked`,location:n,proceed(){Re(i,{state:`proceeding`,proceed:void 0,reset:void 0,location:n}),t.then(()=>e.history.go(r))},reset(){let e=new Map(w.blockers);e.set(i,wt),V({blockers:e})}}),E?.resolve(),E=null;return}return W(t,n)}),n){Un(t,A);let e=()=>Wn(t,A);t.addEventListener(`pagehide`,e),j=()=>t.removeEventListener(`pagehide`,e)}return w.initialized||W(`POP`,w.location,{initialHydration:!0}),C}function ce(){d&&d(),j&&j(),f.clear(),O&&O.abort(),w.fetchers.forEach((e,t)=>je(w.fetchers,t)),w.blockers.forEach((e,t)=>Le(t))}function le(e){if(f.add(e),p){let{newErrors:t}=p;p=null,e(w,{deletedFetchers:[],newErrors:t,viewTransitionOpts:void 0,flushSync:!1})}return()=>f.delete(e)}function V(e,t={}){e.matches&&=e.matches.map(e=>{let t=o[e.route.id],n=e.route;return n.element!==t.element||n.errorElement!==t.errorElement||n.hydrateFallbackElement!==t.hydrateFallbackElement?{...e,route:t}:e}),w={...w,...e};let n=[],r=[];w.fetchers.forEach((e,t)=>{e.state===`idle`&&(L.has(t)?n.push(t):r.push(t))}),L.forEach(e=>{!w.fetchers.has(e)&&!N.has(e)&&n.push(e)}),f.size===0&&(p={newErrors:e.errors??null}),[...f].forEach(r=>r(w,{deletedFetchers:n,newErrors:e.errors??null,viewTransitionOpts:t.viewTransitionOpts,flushSync:t.flushSync===!0})),n.forEach(e=>je(w.fetchers,e)),r.forEach(e=>w.fetchers.delete(e))}function H(t,n,{flushSync:r}={}){let i=w.actionData!=null&&w.navigation.formMethod!=null&&Q(w.navigation.formMethod)&&w.navigation.state===`loading`&&t.state?._isRedirect!==!0,a;a=n.actionData?Object.keys(n.actionData).length>0?n.actionData:null:i?w.actionData:null;let o=n.loaderData?vn(w.loaderData,n.loaderData,n.matches||[],n.errors):w.loaderData,c=w.blockers;c.size>0&&(c=new Map(c),c.forEach((e,t)=>c.set(t,wt)));let l=!M&&Ge(t,n.matches||w.matches),u=D===!0||w.navigation.formMethod!=null&&Q(w.navigation.formMethod)&&t.state?._isRedirect!==!0;s.commitHmrRoutes(),M||T===`POP`||(T===`PUSH`?e.history.push(t,t.state):T===`REPLACE`&&e.history.replace(t,t.state));let d;if(T===`POP`){let e=A.get(w.location.pathname);e&&e.has(t.pathname)?d={currentLocation:w.location,nextLocation:t}:A.has(t.pathname)&&(d={currentLocation:t,nextLocation:w.location})}else if(k){let e=A.get(w.location.pathname);e?e.add(t.pathname):(e=new Set([t.pathname]),A.set(w.location.pathname,e)),d={currentLocation:w.location,nextLocation:t}}V({...n,actionData:a,loaderData:o,historyAction:T,location:t,initialized:!0,renderFallback:!1,navigation:St,revalidation:`idle`,restoreScrollPosition:l,preventScrollReset:u,blockers:c},{viewTransitionOpts:d,flushSync:r===!0}),T=`POP`,D=!1,k=!1,M=!1,ee=!1,E?.resolve(),E=null,oe?.resolve(),oe=null}async function de(t,n){if(E?.resolve(),E=null,typeof t==`number`){E||=Gn();let n=E.promise;return e.history.go(t),n}let{path:r,submission:i,error:a}=It(!1,Ft(w.location,w.matches,c,t,n?.fromRouteId,n?.relative),n),o;n?.mask&&(o={pathname:``,search:``,hash:``,...typeof n.mask==`string`?U(n.mask):{...w.location.mask,...n.mask}});let s=w.location,l=ue(s,r,n&&n.state,void 0,o);l={...l,...e.history.encodeLocation(l)};let u=n&&n.replace!=null?n.replace:void 0,d=`PUSH`;u===!0?d=`REPLACE`:u===!1||i!=null&&Q(i.formMethod)&&i.formAction===w.location.pathname+w.location.search&&(d=`REPLACE`);let f=n&&`preventScrollReset`in n?n.preventScrollReset===!0:void 0,p=(n&&n.flushSync)===!0,m=ze({currentLocation:s,nextLocation:l,historyAction:d});if(m){Re(m,{state:`blocked`,location:l,proceed(){Re(m,{state:`proceeding`,proceed:void 0,reset:void 0,location:l}),de(t,n)},reset(){let e=new Map(w.blockers);e.set(m,wt),V({blockers:e})}});return}await W(d,l,{submission:i,pendingError:a,preventScrollReset:f,replace:n&&n.replace,enableViewTransition:n&&n.viewTransition,flushSync:p,callSiteDefaultShouldRevalidate:n&&n.defaultShouldRevalidate})}function pe(){oe||=Gn(),Ee(),V({revalidation:`loading`});let e=oe.promise;return w.navigation.state===`submitting`?e:w.navigation.state===`idle`?(W(w.historyAction,w.location,{startUninterruptedRevalidation:!0}),e):(W(T||w.historyAction,w.navigation.location,{overrideNavigation:w.navigation,enableViewTransition:k===!0}),e)}async function W(t,n,r){O&&O.abort(),O=null,T=t,M=(r&&r.startUninterruptedRevalidation)===!0,We(w.location,w.matches),D=(r&&r.preventScrollReset)===!0,k=(r&&r.enableViewTransition)===!0;let i=s.activeRoutes,a=r?.initialHydration&&w.matches&&w.matches.length>0&&!y?w.matches:G(i,n,c,!1,s.branches),o=(r&&r.flushSync)===!0;if(a&&w.initialized&&!ee&&wn(w.location,n)&&!(r&&r.submission&&Q(r.submission.formMethod))){H(n,{matches:a},{flushSync:o});return}let l=Ke(a,i,n.pathname);if(l.active&&l.matches&&(a=l.matches),!a){let{error:e,notFoundMatches:t,route:r}=Be(n.pathname);H(n,{matches:t,loaderData:{},errors:{[r.id]:e}},{flushSync:o});return}let u=r&&r.overrideNavigation?{...r.overrideNavigation,matches:a,historyAction:t}:void 0;O=new AbortController;let d=fn(e.history,n,O.signal,r&&r.submission),f=e.getContext?await e.getContext():new me,p;if(r&&r.pendingError)p=[bn(a).route.id,{type:`error`,error:r.pendingError}];else if(r&&r.submission&&Q(r.submission.formMethod)){let i=await he(d,n,r.submission,a,t,f,l.active,r&&r.initialHydration===!0,{replace:r.replace,flushSync:o});if(i.shortCircuited)return;if(i.pendingActionResult){let[e,t]=i.pendingActionResult;if(Z(t)&&tt(t.error)&&t.error.status===404){O=null,H(n,{matches:i.matches,loaderData:{},errors:{[e]:t.error}});return}}a=i.matches||a,p=i.pendingActionResult,u=Rn(n,a,t,r.submission),o=!1,l.active=!1,d=fn(e.history,d.url,d.signal)}let{shortCircuited:m,matches:h,loaderData:g,errors:_,workingFetchers:v}=await ge(d,n,a,t,f,l.active,u,r&&r.submission,r&&r.fetcherSubmission,r&&r.replace,r&&r.initialHydration===!0,o,p,r&&r.callSiteDefaultShouldRevalidate);m||(O=null,H(n,{matches:h||a,...yn(p),loaderData:g,errors:_,...v?{fetchers:v}:{}}))}async function he(t,n,i,l,u,d,f,p,m={}){if(Ee(),V({navigation:zn(n,l,u,i)},{flushSync:m.flushSync===!0}),f){let e=await qe(l,n.pathname,t.signal);if(e.type===`aborted`)return{shortCircuited:!0};if(e.type===`error`){if(e.partialMatches.length===0){let{matches:t,route:n}=xn(s.activeRoutes);return{matches:t,pendingActionResult:[n.id,{type:`error`,error:e.error}]}}let t=bn(e.partialMatches).route.id;return{matches:e.partialMatches,pendingActionResult:[t,{type:`error`,error:e.error}]}}if(e.matches)l=e.matches;else{let{notFoundMatches:e,error:t,route:r}=Be(n.pathname);return{matches:e,pendingActionResult:[r.id,{type:`error`,error:t}]}}}let h,g=In(l,n);if(!g.route.action&&!g.route.lazy)h={type:`error`,error:X(405,{method:t.method,pathname:n.pathname,routeId:g.route.id})};else{let e=await we(t,n,nn(a,o,t,n,l,g,p?[]:r,d),d,null);if(h=e[g.route.id],!h){for(let t of l)if(e[t.route.id]){h=e[t.route.id];break}}if(t.signal.aborted)return{shortCircuited:!0}}if(kn(h)){let n;return n=m&&m.replace!=null?m.replace:dn(h.response.headers.get(`Location`),new URL(t.url),c,e.history)===w.location.pathname+w.location.search,await K(t,h,!0,{submission:i,replace:n}),{shortCircuited:!0}}if(Z(h)){let e=bn(l,g.route.id);return(m&&m.replace)!==!0&&(T=`PUSH`),{matches:l,pendingActionResult:[e.route.id,h,g.route.id]}}return{matches:l,pendingActionResult:[g.route.id,h]}}async function ge(t,n,i,l,u,d,f,p,m,h,g,_,v,y){let b=f||Rn(n,i,l,p),x=p||m||Ln(b),S=!M&&!g;if(d){if(S){let e=_e(v);V({navigation:b,...e===void 0?{}:{actionData:e}},{flushSync:_})}let e=await qe(i,n.pathname,t.signal);if(e.type===`aborted`)return{shortCircuited:!0};if(e.type===`error`){if(e.partialMatches.length===0){let{matches:t,route:n}=xn(s.activeRoutes);return{matches:t,loaderData:{},errors:{[n.id]:e.error}}}let t=bn(e.partialMatches).route.id;return{matches:e.partialMatches,loaderData:{},errors:{[t]:e.error}}}if(e.matches)i=e.matches;else{let{error:e,notFoundMatches:t,route:r}=Be(n.pathname);return{matches:t,loaderData:{},errors:{[r.id]:e}}}}let C=s.activeRoutes,{dsMatches:T,revalidatingFetchers:E}=Lt(t,u,a,o,e.history,w,i,x,n,g?[]:r,g===!0,ee,te,L,ie,F,C,c,e.patchRoutesOnNavigation!=null,s.branches,v,y);if(re=++ne,!e.dataStrategy&&!T.some(e=>e.shouldLoad)&&!T.some(e=>e.route.middleware&&e.route.middleware.length>0)&&E.length===0){let e=new Map(w.fetchers),t=Pe(e);return H(n,{matches:i,loaderData:{},errors:v&&Z(v[1])?{[v[0]]:v[1].error}:null,...yn(v),...t?{fetchers:e}:{}},{flushSync:_}),{shortCircuited:!0}}if(S){let e={};if(!d){e.navigation=b;let t=_e(v);t!==void 0&&(e.actionData=t)}E.length>0&&(e.fetchers=ve(E)),V(e,{flushSync:_})}E.forEach(e=>{q(e.key),e.controller&&N.set(e.key,e.controller)});let D=()=>E.forEach(e=>q(e.key));O&&O.signal.addEventListener(`abort`,D);let{loaderResults:k,fetcherResults:A}=await Te(T,E,t,n,u);if(t.signal.aborted)return{shortCircuited:!0};O&&O.signal.removeEventListener(`abort`,D),E.forEach(e=>N.delete(e.key));let j=Sn(k);if(j)return await K(t,j.result,!0,{replace:h}),{shortCircuited:!0};if(j=Sn(A),j)return F.add(j.key),await K(t,j.result,!0,{replace:h}),{shortCircuited:!0};let P=new Map(w.fetchers),{loaderData:I,errors:R}=_n(w,i,k,v,E,A,P);g&&w.errors&&(R={...w.errors,...R});let ae=Pe(P),oe=Fe(re,P),se=ae||oe||E.length>0;return{matches:i,loaderData:I,errors:R,...se?{workingFetchers:P}:{}}}function _e(e){if(e&&!Z(e[1]))return{[e[0]]:e[1].data};if(w.actionData)return Object.keys(w.actionData).length===0?null:w.actionData}function ve(e){let t=new Map(w.fetchers);return e.forEach(e=>{let n=t.get(e.key),r=Bn(void 0,n?n.data:void 0);t.set(e.key,r)}),t}async function ye(t,n,r,i){q(t);let a=(i&&i.flushSync)===!0,o=s.activeRoutes,l=Ft(w.location,w.matches,c,r,n,i?.relative),u=G(o,l,c,!1,s.branches),d=Ke(u,o,l);if(d.active&&d.matches&&(u=d.matches),!u){Oe(t,n,X(404,{pathname:l}),{flushSync:a});return}let{path:f,submission:p,error:m}=It(!0,l,i);if(m){Oe(t,n,m,{flushSync:a});return}let h=e.getContext?await e.getContext():new me,g=(i&&i.preventScrollReset)===!0;if(p&&Q(p.formMethod)){await xe(t,n,f,u,h,d.active,a,g,p,i&&i.defaultShouldRevalidate);return}ie.set(t,{routeId:n,path:f}),await Se(t,n,f,u,h,d.active,a,g,p)}async function xe(t,n,i,l,u,d,f,p,m,h){Ee(),ie.delete(t),De(t,Vn(m,w.fetchers.get(t)),{flushSync:f});let g=new AbortController,_=fn(e.history,i,g.signal,m);if(d){let e=await qe(l,new URL(_.url).pathname,_.signal,t);if(e.type===`aborted`)return;if(e.type===`error`){Oe(t,n,e.error,{flushSync:f});return}if(e.matches)l=e.matches;else{Oe(t,n,X(404,{pathname:i}),{flushSync:f});return}}let v=In(l,i);if(!v.route.action&&!v.route.lazy){Oe(t,n,X(405,{method:m.formMethod,pathname:i,routeId:n}),{flushSync:f});return}N.set(t,g);let y=ne,b=nn(a,o,_,i,l,v,r,u),x=await we(_,i,b,u,t),S=x[v.route.id];if(!S){for(let e of b)if(x[e.route.id]){S=x[e.route.id];break}}if(_.signal.aborted){N.get(t)===g&&N.delete(t);return}if(L.has(t)){if(kn(S)||Z(S)){De(t,Hn(void 0));return}}else{if(kn(S)){if(N.delete(t),re>y){De(t,Hn(void 0));return}return F.add(t),De(t,Bn(m)),K(_,S,!1,{fetcherSubmission:m,preventScrollReset:p})}if(Z(S)){Oe(t,n,S.error);return}}let C=w.navigation.location||w.location,E=fn(e.history,C,g.signal),D=s.activeRoutes,k=w.navigation.state===`idle`?w.matches:G(D,w.navigation.location,c,!1,s.branches);z(k,`Didn't find any matches after fetcher action`);let A=++ne;P.set(t,A);let{dsMatches:j,revalidatingFetchers:M}=Lt(E,u,a,o,e.history,w,k,m,C,r,!1,ee,te,L,ie,F,D,c,e.patchRoutesOnNavigation!=null,s.branches,[v.route.id,S],h),I=Bn(m,S.data),R=new Map(w.fetchers);R.set(t,I),M.filter(e=>e.key!==t).forEach(e=>{let t=e.key,n=R.get(t),r=Bn(void 0,n?n.data:void 0);R.set(t,r),q(t),e.controller&&N.set(t,e.controller)}),V({fetchers:R});let ae=()=>M.forEach(e=>q(e.key));g.signal.addEventListener(`abort`,ae);let{loaderResults:oe,fetcherResults:se}=await Te(j,M,E,C,u);if(g.signal.aborted)return;g.signal.removeEventListener(`abort`,ae),P.delete(t),N.delete(t),M.forEach(e=>N.delete(e.key));let ce=w.fetchers.has(t),B=e=>{if(!ce)return e;let n=new Map(e.fetchers);return n.set(t,Hn(S.data)),{...e,fetchers:n}},le=Sn(oe);if(le)return w=B(w),K(E,le.result,!1,{preventScrollReset:p});if(le=Sn(se),le)return F.add(le.key),w=B(w),K(E,le.result,!1,{preventScrollReset:p});let ue=new Map(w.fetchers);ce&&ue.set(t,Hn(S.data));let{loaderData:U,errors:de}=_n(w,k,oe,void 0,M,se,ue);Fe(A,ue),w.navigation.state===`loading`&&A>re?(z(T,`Expected pending action`),O&&O.abort(),H(w.navigation.location,{matches:k,loaderData:U,errors:de,fetchers:ue})):(V({errors:de,loaderData:vn(w.loaderData,U,k,de),fetchers:ue}),ee=!1)}async function Se(t,n,i,s,c,l,u,d,f){let p=w.fetchers.get(t);De(t,Bn(f,p?p.data:void 0),{flushSync:u});let m=new AbortController,h=fn(e.history,i,m.signal);if(l){let e=await qe(s,new URL(h.url).pathname,h.signal,t);if(e.type===`aborted`)return;if(e.type===`error`){Oe(t,n,e.error,{flushSync:u});return}if(e.matches)s=e.matches;else{Oe(t,n,X(404,{pathname:i}),{flushSync:u});return}}let g=In(s,i);N.set(t,m);let _=ne,v=await we(h,i,nn(a,o,h,i,s,g,r,c),c,t),y=v[g.route.id];if(!y){for(let e of s)if(v[e.route.id]){y=v[e.route.id];break}}if(N.get(t)===m&&N.delete(t),!h.signal.aborted){if(L.has(t)){De(t,Hn(void 0));return}if(kn(y)){if(re>_){De(t,Hn(void 0));return}F.add(t),await K(h,y,!1,{preventScrollReset:d});return}if(Z(y)){Oe(t,n,y.error);return}De(t,Hn(y.data))}}async function K(r,i,a,{submission:o,fetcherSubmission:s,preventScrollReset:l,replace:u}={}){a||(E?.resolve(),E=null),i.response.headers.has(`X-Remix-Revalidate`)&&(ee=!0);let d=i.response.headers.get(`Location`);z(d,`Expected a Location header on the redirect Response`),d=dn(d,new URL(r.url),c,e.history);let f=ue(w.location,d,{_isRedirect:!0});if(n){let e=!1;if(i.response.headers.has(`X-Remix-Reload-Document`))e=!0;else if(Ve(d)){let n=fe(t,d,!0);e=n.origin!==t.location.origin||J(n.pathname,c)==null}if(e){u?t.location.replace(d):t.location.assign(d);return}}O=null;let p=u===!0||i.response.headers.has(`X-Remix-Replace`)?`REPLACE`:`PUSH`,{formMethod:m,formAction:h,formEncType:g}=w.navigation;!o&&!s&&m&&h&&g&&(o=Ln(w.navigation));let _=o||s;xt.has(i.response.status)&&_&&Q(_.formMethod)?await W(p,f,{submission:{..._,formAction:d},preventScrollReset:l||D,enableViewTransition:a?k:void 0}):await W(p,f,{overrideNavigation:Rn(f,[],p,o),fetcherSubmission:s,preventScrollReset:l||D,enableViewTransition:a?k:void 0})}async function we(e,t,n,r,i){let a,o={};try{a=await rn(l,e,t,n,i,r,!1)}catch(e){return n.filter(e=>e.shouldLoad).forEach(t=>{o[t.route.id]={type:`error`,error:e}}),o}if(e.signal.aborted)return o;if(!Q(e.method))for(let e of n){if(a[e.route.id]?.type===`error`)break;!a.hasOwnProperty(e.route.id)&&!w.loaderData.hasOwnProperty(e.route.id)&&(!w.errors||!w.errors.hasOwnProperty(e.route.id))&&e.shouldCallHandler()&&(a[e.route.id]={type:`error`,result:Error(`No result returned from dataStrategy for route ${e.route.id}`)})}for(let[t,r]of Object.entries(a))if(On(r)){let i=r.result;o[t]={type:`redirect`,response:cn(i,e,t,n,c)}}else o[t]=await sn(r);return o}async function Te(e,t,n,r,i){let a=we(n,r,e,i,null),o=Promise.all(t.map(async e=>{if(e.matches&&e.match&&e.request&&e.controller){let t=(await we(e.request,e.path,e.matches,i,e.key))[e.match.route.id];return{[e.key]:t}}return Promise.resolve({[e.key]:{type:`error`,error:X(404,{pathname:e.path})}})}));return{loaderResults:await a,fetcherResults:(await o).reduce((e,t)=>Object.assign(e,t),{})}}function Ee(){ee=!0,ie.forEach((e,t)=>{N.has(t)&&te.add(t),q(t)})}function De(e,t,n={}){let r=new Map(w.fetchers);r.set(e,t),V({fetchers:r},{flushSync:(n&&n.flushSync)===!0})}function Oe(e,t,n,r={}){let i=bn(w.matches,t),a=new Map(w.fetchers);je(a,e),V({errors:{[i.route.id]:n},fetchers:a},{flushSync:(r&&r.flushSync)===!0})}function ke(e){return I.set(e,(I.get(e)||0)+1),L.has(e)&&L.delete(e),w.fetchers.get(e)||Ct}function Ae(e,t){q(e,t?.reason),De(e,Hn(null))}function je(e,t){let n=w.fetchers.get(t);N.has(t)&&!(n&&n.state===`loading`&&P.has(t))&&q(t),ie.delete(t),P.delete(t),F.delete(t),L.delete(t),te.delete(t),e.delete(t)}function Me(e){let t=(I.get(e)||0)-1;t<=0?(I.delete(e),L.add(e)):I.set(e,t),V({fetchers:new Map(w.fetchers)})}function q(e,t){let n=N.get(e);n&&(n.abort(t),N.delete(e))}function Ne(e,t){for(let n of e){let e=t.get(n);z(e,`Expected fetcher: ${n}`);let r=Hn(e.data);t.set(n,r)}}function Pe(e){let t=[],n=!1;for(let r of F){let i=e.get(r);z(i,`Expected fetcher: ${r}`),i.state===`loading`&&(F.delete(r),t.push(r),n=!0)}return Ne(t,e),n}function Fe(e,t){let n=[];for(let[r,i]of P)if(i<e){let e=t.get(r);z(e,`Expected fetcher: ${r}`),e.state===`loading`&&(q(r),P.delete(r),n.push(r))}return Ne(n,t),n.length>0}function Ie(e,t){let n=w.blockers.get(e)||wt;return R.get(e)!==t&&R.set(e,t),n}function Le(e){w.blockers.delete(e),R.delete(e)}function Re(e,t){let n=w.blockers.get(e)||wt;z(n.state===`unblocked`&&t.state===`blocked`||n.state===`blocked`&&t.state===`blocked`||n.state===`blocked`&&t.state===`proceeding`||n.state===`blocked`&&t.state===`unblocked`||n.state===`proceeding`&&t.state===`unblocked`,`Invalid blocker state transition: ${n.state} -> ${t.state}`);let r=new Map(w.blockers);r.set(e,t),V({blockers:r})}function ze({currentLocation:e,nextLocation:t,historyAction:n}){if(R.size===0)return;R.size>1&&B(!1,`A router only supports one blocker at a time`);let r=Array.from(R.entries()),[i,a]=r[r.length-1],o=w.blockers.get(i);if(!(o&&o.state===`proceeding`)&&a({currentLocation:e,nextLocation:t,historyAction:n}))return i}function Be(e){let t=X(404,{pathname:e}),n=s.activeRoutes,{matches:r,route:i}=xn(n);return{notFoundMatches:r,route:i,error:t}}function He(e,t,n){if(m=e,g=t,h=n||null,!_&&w.navigation===St){_=!0;let e=Ge(w.location,w.matches);e!=null&&V({restoreScrollPosition:e})}return()=>{m=null,g=null,h=null}}function Ue(e,t){return h&&h(e,t.map(e=>Ce(e,w.loaderData)))||e.key}function We(e,t){if(m&&g){let n=Ue(e,t);m[n]=g()}}function Ge(e,t){if(m){let n=Ue(e,t),r=m[n];if(typeof r==`number`)return r}return null}function Ke(t,n,r){if(e.patchRoutesOnNavigation){let e=s.branches;if(!t)return{active:!0,matches:G(n,r,c,!0,e)||[]};if(Object.keys(t[0].params).length>0)return{active:!0,matches:G(n,r,c,!0,e)}}return{active:!1,matches:null}}async function qe(t,n,r,i){if(!e.patchRoutesOnNavigation)return{type:`success`,matches:t};let l=t;for(;;){let t=o;try{await e.patchRoutesOnNavigation({signal:r,path:n,matches:l,fetcherKey:i,patch:(e,n)=>{r.aborted||Ut(e,n,s,t,a,!1)}})}catch(e){return{type:`error`,error:e,partialMatches:l}}if(r.aborted)return{type:`aborted`};let u=s.branches,d=G(s.activeRoutes,n,c,!1,u),f=null;if(d&&(Object.keys(d[0].params).length===0||(f=G(s.activeRoutes,n,c,!0,u),!(f&&l.length<f.length&&Je(l,f.slice(0,l.length))))))return{type:`success`,matches:d};if(f||=G(s.activeRoutes,n,c,!0,u),!f||Je(l,f))return{type:`success`,matches:null};l=f}}function Je(e,t){return e.length===t.length&&e.every((e,n)=>e.route.id===t[n].route.id)}function Y(e){o={},s.setHmrRoutes(be(e,a,void 0,o))}function Ye(e,t,n=!1){Ut(e,t,s,o,a,n),s.hasHMRRoutes||V({})}return C={get basename(){return c},get future(){return u},get state(){return w},get routes(){return s.stableRoutes},get branches(){return s.branches},get manifest(){return o},get window(){return t},initialize:se,subscribe:le,enableScrollRestoration:He,navigate:de,fetch:ye,revalidate:pe,createHref:t=>e.history.createHref(t),encodeLocation:t=>e.history.encodeLocation(t),getFetcher:ke,resetFetcher:Ae,deleteFetcher:Me,dispose:ce,getBlocker:Ie,deleteBlocker:Le,patchRoutes:Ye,_internalFetchControllers:N,_internalSetRoutes:Y,_internalSetStateDoNotUseOrYouWillBreakYourApp(e){V(e)}},e.instrumentations&&(C=st(C,e.instrumentations.map(e=>e.router).filter(Boolean))),C}function Pt(e){return e!=null&&(`formData`in e&&e.formData!=null||`body`in e&&e.body!==void 0)}function Ft(e,t,n,r,i,a){let o,s;if(i){o=[];for(let e of t)if(o.push(e),e.route.id===i){s=e;break}}else o=t,s=t[t.length-1];let c=qe(r||`.`,Ke(o),J(e.pathname,n)||e.pathname,a===`path`);if(r??(c.search=e.search,c.hash=e.hash),(r==null||r===``||r===`.`)&&s){let e=Fn(c.search);if(s.route.index&&!e)c.search=c.search?c.search.replace(/^\?/,`?index&`):`?index`;else if(!s.route.index&&e){let e=new URLSearchParams(c.search),t=e.getAll(`index`);e.delete(`index`),t.filter(e=>e).forEach(t=>e.append(`index`,t));let n=e.toString();c.search=n?`?${n}`:``}}return n!==`/`&&(c.pathname=Be({basename:n,pathname:c.pathname})),H(c)}function It(e,t,n){if(!n||!Pt(n))return{path:t};if(n.formMethod&&!Pn(n.formMethod))return{path:t,error:X(405,{method:n.formMethod})};let r=()=>({path:t,error:X(400,{type:`invalid-body`})}),i=(n.formMethod||`get`).toUpperCase(),a=Cn(t);if(n.body!==void 0){if(n.formEncType===`text/plain`){if(!Q(i))return r();let e=typeof n.body==`string`?n.body:n.body instanceof FormData||n.body instanceof URLSearchParams?Array.from(n.body.entries()).reduce((e,[t,n])=>`${e}${t}=${n}
2
- `,``):String(n.body);return{path:t,submission:{formMethod:i,formAction:a,formEncType:n.formEncType,formData:void 0,json:void 0,text:e}}}if(n.formEncType===`application/json`){if(!Q(i))return r();try{let e=typeof n.body==`string`?JSON.parse(n.body):n.body;return{path:t,submission:{formMethod:i,formAction:a,formEncType:n.formEncType,formData:void 0,json:e,text:void 0}}}catch{return r()}}}z(typeof FormData==`function`,`FormData is not available in this environment`);let o,s;if(n.formData)o=mn(n.formData),s=n.formData;else if(n.body instanceof FormData)o=mn(n.body),s=n.body;else if(n.body instanceof URLSearchParams)o=n.body,s=hn(o);else if(n.body==null)o=new URLSearchParams,s=new FormData;else try{o=new URLSearchParams(n.body),s=hn(o)}catch{return r()}let c={formMethod:i,formAction:a,formEncType:n&&n.formEncType||`application/x-www-form-urlencoded`,formData:s,json:void 0,text:void 0};if(Q(c.formMethod))return{path:t,submission:c};let l=U(t);return e&&l.search&&Fn(l.search)&&o.append(`index`,``),l.search=`?${o}`,{path:H(l),submission:c}}function Lt(e,t,n,r,i,a,o,s,c,l,u,d,f,p,m,h,g,_,v,y,b,x){let S=b?Z(b[1])?b[1].error:b[1].data:void 0,C=i.createURL(a.location),w=i.createURL(c),T;if(u&&a.errors){let e=Object.keys(a.errors)[0];T=o.findIndex(t=>t.route.id===e)}else if(b&&Z(b[1])){let e=b[0];T=o.findIndex(t=>t.route.id===e)-1}let E=b?b[1].statusCode:void 0,D=E&&E>=400,O={currentUrl:C,currentParams:a.matches[0]?.params||{},nextUrl:w,nextParams:o[0].params,...s,actionResult:S,actionStatus:E},k=nt(o),A=o.map((i,o)=>{let{route:s}=i,f=null;if(T!=null&&o>T)f=!1;else if(s.lazy)f=!0;else if(!Rt(s))f=!1;else if(u){let{shouldLoad:e}=zt(s,a.loaderData,a.errors);f=e}else Bt(a.loaderData,a.matches[o],i)&&(f=!0);if(f!==null)return tn(n,r,e,c,k,i,l,t,f);let p=!1;typeof x==`boolean`?p=x:D?p=!1:d||C.pathname+C.search===w.pathname+w.search?p=!0:C.search===w.search?Vt(a.matches[o],i)&&(p=!0):p=!0;let m={...O,defaultShouldRevalidate:p},h=Ht(i,m);return tn(n,r,e,c,k,i,l,t,h,m,x)}),j=[];return m.forEach((e,s)=>{if(u||!o.some(t=>t.route.id===e.routeId)||p.has(s))return;let c=a.fetchers.get(s),m=c&&c.state!==`idle`&&c.data===void 0,b=G(g,e.path,_??`/`,!1,y);if(!b){if(v&&m)return;j.push({key:s,routeId:e.routeId,path:e.path,matches:null,match:null,request:null,controller:null});return}if(h.has(s))return;let S=In(b,e.path),C=new AbortController,w=fn(i,e.path,C.signal),T=null;if(f.has(s))f.delete(s),T=nn(n,r,w,e.path,b,S,l,t);else if(m)d&&(T=nn(n,r,w,e.path,b,S,l,t));else{let i;i=typeof x==`boolean`?x:!D&&d;let a={...O,defaultShouldRevalidate:i};Ht(S,a)&&(T=nn(n,r,w,e.path,b,S,l,t,a))}T&&j.push({key:s,routeId:e.routeId,path:e.path,matches:T,match:S,request:w,controller:C})}),{dsMatches:A,revalidatingFetchers:j}}function Rt(e){return e.loader!=null||e.middleware!=null&&e.middleware.length>0}function zt(e,t,n){if(e.lazy)return{shouldLoad:!0,renderFallback:!0};if(!Rt(e))return{shouldLoad:!1,renderFallback:!1};let r=t!=null&&e.id in t,i=n!=null&&n[e.id]!==void 0;if(!r&&i)return{shouldLoad:!1,renderFallback:!1};if(typeof e.loader==`function`&&e.loader.hydrate===!0)return{shouldLoad:!0,renderFallback:!r};let a=!r&&!i;return{shouldLoad:a,renderFallback:a}}function Bt(e,t,n){let r=!t||n.route.id!==t.route.id,i=!e.hasOwnProperty(n.route.id);return r||i}function Vt(e,t){let n=e.route.path;return e.pathname!==t.pathname||n!=null&&n.endsWith(`*`)&&e.params[`*`]!==t.params[`*`]}function Ht(e,t){if(e.route.shouldRevalidate){let n=e.route.shouldRevalidate(t);if(typeof n==`boolean`)return n}return t.defaultShouldRevalidate}function Ut(e,t,n,r,i,a){let o;if(e){let t=r[e];z(t,`No route found to patch children into: routeId = ${e}`),t.children||=[],o=t.children}else o=n.activeRoutes;let s=[],c=[];if(t.forEach(e=>{let t=o.find(t=>Wt(e,t));t?c.push({existingRoute:t,newRoute:e}):s.push(e)}),s.length>0){let t=be(s,i,[e||`_`,`patch`,String(o?.length||`0`)],r);o.push(...t)}if(a&&c.length>0)for(let e=0;e<c.length;e++){let{existingRoute:t,newRoute:n}=c[e],r=t,[a]=be([n],i,[],{},!0);Object.assign(r,{element:a.element?a.element:r.element,errorElement:a.errorElement?a.errorElement:r.errorElement,hydrateFallbackElement:a.hydrateFallbackElement?a.hydrateFallbackElement:r.hydrateFallbackElement})}n.hasHMRRoutes||n.setRoutes([...n.activeRoutes])}function Wt(e,t){return`id`in e&&`id`in t&&e.id===t.id?!0:e.index!==t.index||e.path!==t.path||e.caseSensitive!==t.caseSensitive?!1:(!e.children||e.children.length===0)&&(!t.children||t.children.length===0)?!0:e.children?.every((e,n)=>t.children?.some(t=>Wt(e,t)))??!1}var Gt=new WeakMap,Kt=({key:e,route:t,manifest:n,mapRouteProperties:r})=>{let i=n[t.id];if(z(i,`No route found in manifest`),!i.lazy||typeof i.lazy!=`object`)return;let a=i.lazy[e];if(!a)return;let o=Gt.get(i);o||(o={},Gt.set(i,o));let s=o[e];if(s)return s;let c=(async()=>{let t=ge(e),n=i[e]!==void 0&&e!==`hasErrorBoundary`;if(t)B(!t,`Route property `+e+` is not a supported lazy route property. This property will be ignored.`),o[e]=Promise.resolve();else if(n)B(!1,`Route "${i.id}" has a static property "${e}" defined. The lazy property will be ignored.`);else{let t=await a();t!=null&&(Object.assign(i,{[e]:t}),Object.assign(i,r(i)))}typeof i.lazy==`object`&&(i.lazy[e]=void 0,Object.values(i.lazy).every(e=>e===void 0)&&(i.lazy=void 0))})();return o[e]=c,c},qt=new WeakMap;function Jt(e,t,n,r,i){let a=n[e.id];if(z(a,`No route found in manifest`),!e.lazy)return{lazyRoutePromise:void 0,lazyHandlerPromise:void 0};if(typeof e.lazy==`function`){let t=qt.get(a);if(t)return{lazyRoutePromise:t,lazyHandlerPromise:t};let n=(async()=>{z(typeof e.lazy==`function`,`No lazy route function found`);let t=await e.lazy(),n={};for(let e in t){let r=t[e];if(r===void 0)continue;let i=ve(e),o=a[e]!==void 0&&e!==`hasErrorBoundary`;i?B(!i,`Route property `+e+` is not a supported property to be returned from a lazy route function. This property will be ignored.`):o?B(!o,`Route "${a.id}" has a static property "${e}" defined but its lazy function is also returning a value for this property. The lazy route property "${e}" will be ignored.`):n[e]=r}Object.assign(a,n),Object.assign(a,{...r(a),lazy:void 0})})();return qt.set(a,n),n.catch(()=>{}),{lazyRoutePromise:n,lazyHandlerPromise:n}}let o=Object.keys(e.lazy),s=[],c;for(let a of o){if(i&&i.includes(a))continue;let o=Kt({key:a,route:e,manifest:n,mapRouteProperties:r});o&&(s.push(o),a===t&&(c=o))}let l=s.length>0?Promise.all(s).then(()=>{}):void 0;return l?.catch(()=>{}),c?.catch(()=>{}),{lazyRoutePromise:l,lazyHandlerPromise:c}}async function Yt(e){let t=e.matches.filter(e=>e.shouldLoad),n={};return(await Promise.all(t.map(e=>e.resolve()))).forEach((e,r)=>{n[t[r].route.id]=e}),n}async function Xt(e){return e.matches.some(e=>e.route.middleware)?Zt(e,()=>Yt(e)):Yt(e)}function Zt(e,t){return Qt(e,t,e=>{if(Nn(e))throw e;return e},En,n);function n(t,n,r){if(r)return Promise.resolve(Object.assign(r.value,{[n]:{type:`error`,result:t}}));{let{matches:r}=e,i=bn(r,r[Math.min(Math.max(r.findIndex(e=>e.route.id===n),0),Math.max(r.findIndex(e=>e.shouldCallHandler()),0))].route.id).route.id;return Promise.resolve({[i]:{type:`error`,result:t}})}}}async function Qt(e,t,n,r,i){let{matches:a,...o}=e;return await $t(o,a.flatMap(e=>e.route.middleware?e.route.middleware.map(t=>[e.route.id,t]):[]),t,n,r,i)}async function $t(e,t,n,r,i,a,o=0){let{request:s}=e;if(s.signal.aborted)throw s.signal.reason??Error(`Request aborted: ${s.method} ${s.url}`);let c=t[o];if(!c)return await n();let[l,u]=c,d,f=async()=>{if(d)throw Error("You may only call `next()` once per middleware");try{return d={value:await $t(e,t,n,r,i,a,o+1)},d.value}catch(e){return d={value:await a(e,l,d)},d.value}};try{let t=await u(e,f),n=t==null?void 0:r(t);return i(n)?n:d?n??d.value:(d={value:await f()},d.value)}catch(e){return await a(e,l,d)}}function en(e,t,n,r,i){let a=Kt({key:`middleware`,route:r.route,manifest:t,mapRouteProperties:e}),o=Jt(r.route,Q(n.method)?`action`:`loader`,t,e,i);return{middleware:a,route:o.lazyRoutePromise,handler:o.lazyHandlerPromise}}function tn(e,t,n,r,i,a,o,s,c,l=null,u){let d=!1,f=en(e,t,n,a,o);return{...a,_lazyPromises:f,shouldLoad:c,shouldRevalidateArgs:l,shouldCallHandler(e){return d=!0,l?typeof u==`boolean`?Ht(a,{...l,defaultShouldRevalidate:u}):typeof e==`boolean`?Ht(a,{...l,defaultShouldRevalidate:e}):Ht(a,l):c},resolve(e){let{lazy:t,loader:o,middleware:l}=a.route,u=d||c||e&&!Q(n.method)&&(t||o),p=l&&l.length>0&&!o&&!t;return u&&(Q(n.method)||!p)?an({request:n,path:r,pattern:i,match:a,lazyHandlerPromise:f?.handler,lazyRoutePromise:f?.route,handlerOverride:e,scopedContext:s}):Promise.resolve({type:`data`,result:void 0})}}}function nn(e,t,n,r,i,a,o,s,c=null){return i.map(l=>l.route.id===a.route.id?tn(e,t,n,r,nt(i),l,o,s,!0,c):{...l,shouldLoad:!1,shouldRevalidateArgs:c,shouldCallHandler:()=>!1,_lazyPromises:en(e,t,n,l,o),resolve:()=>Promise.resolve({type:`data`,result:void 0})})}async function rn(e,t,n,r,i,a,o){r.some(e=>e._lazyPromises?.middleware)&&await Promise.all(r.map(e=>e._lazyPromises?.middleware));let s={request:t,url:pn(t,n),pattern:nt(r),params:r[0].params,context:a,matches:r},c=o?()=>{throw Error("You cannot call `runClientMiddleware()` from a static handler `dataStrategy`. Middleware is run outside of `dataStrategy` during SSR in order to bubble up the Response. You can enable middleware via the `respond` API in `query`/`queryRoute`")}:e=>{let t=s;return Zt(t,()=>e({...t,fetcherKey:i,runClientMiddleware:()=>{throw Error("Cannot call `runClientMiddleware()` from within an `runClientMiddleware` handler")}}))},l=await e({...s,fetcherKey:i,runClientMiddleware:c});try{await Promise.all(r.flatMap(e=>[e._lazyPromises?.handler,e._lazyPromises?.route]))}catch{}return l}async function an({request:e,path:t,pattern:n,match:r,lazyHandlerPromise:i,lazyRoutePromise:a,handlerOverride:o,scopedContext:s}){let c,l,u=Q(e.method),d=u?`action`:`loader`,f=i=>{let a,c=new Promise((e,t)=>a=t);l=()=>a(),e.signal.addEventListener(`abort`,l);let u=a=>typeof i==`function`?i({request:e,url:pn(e,t),pattern:n,params:r.params,context:s},...a===void 0?[]:[a]):Promise.reject(Error(`You cannot call the handler for a route which defines a boolean "${d}" [routeId: ${r.route.id}]`)),f=(async()=>{try{return{type:`data`,result:await(o?o(e=>u(e)):u())}}catch(e){return{type:`error`,result:e}}})();return Promise.race([f,c])};try{let t=u?r.route.action:r.route.loader;if(i||a){if(t){let e,[n]=await Promise.all([f(t).catch(t=>{e=t}),i,a]);if(e!==void 0)throw e;c=n}else{await i;let t=u?r.route.action:r.route.loader;if(t)[c]=await Promise.all([f(t),a]);else if(d===`action`){let t=new URL(e.url),n=t.pathname+t.search;throw X(405,{method:e.method,pathname:n,routeId:r.route.id})}else return{type:`data`,result:void 0}}}else if(t)c=await f(t);else{let t=new URL(e.url);throw X(404,{pathname:t.pathname+t.search})}}catch(e){return{type:`error`,result:e}}finally{l&&e.signal.removeEventListener(`abort`,l)}return c}async function on(e){let t=e.headers.get(`Content-Type`);return t&&/\bapplication\/json\b/.test(t)?e.body==null?null:e.json():e.text()}async function sn(e){let{result:t,type:n}=e;if(jn(t)){let e;try{e=await on(t)}catch(e){return{type:`error`,error:e}}return n===`error`?{type:`error`,error:new et(t.status,t.statusText,e),statusCode:t.status,headers:t.headers}:{type:`data`,data:e,statusCode:t.status,headers:t.headers}}return n===`error`?An(t)?t.data instanceof Error?{type:`error`,error:t.data,statusCode:t.init?.status,headers:t.init?.headers?new Headers(t.init.headers):void 0}:{type:`error`,error:Tn(t),statusCode:tt(t)?t.status:void 0,headers:t.init?.headers?new Headers(t.init.headers):void 0}:{type:`error`,error:t,statusCode:tt(t)?t.status:void 0}:An(t)?{type:`data`,data:t.data,statusCode:t.init?.status,headers:t.init?.headers?new Headers(t.init.headers):void 0}:{type:`data`,data:t}}function cn(e,t,n,r,i){let a=e.headers.get(`Location`);if(z(a,`Redirects returned/thrown from loaders/actions must have a Location header`),!Ve(a)){let o=r.slice(0,r.findIndex(e=>e.route.id===n)+1);a=Ft(new URL(t.url),o,i,a),e.headers.set(`Location`,a)}return e}var ln=[`about:`,`blob:`,`chrome:`,`chrome-untrusted:`,`content:`,`data:`,`devtools:`,`file:`,`filesystem:`,`javascript:`];function un(e){try{return ln.includes(new URL(e).protocol)}catch{return!1}}function dn(e,t,n,r){if(Ve(e)){let r=e,i=R.test(r)?new URL(ae(r,t.protocol)):new URL(r);if(un(i.toString()))throw Error(`Invalid redirect location`);let a=J(i.pathname,n)!=null;if(i.origin===t.origin&&a)return Je(i.pathname)+i.search+i.hash}try{if(un(r.createURL(e).toString()))throw Error(`Invalid redirect location`)}catch{}return e}function fn(e,t,n,r){let i=e.createURL(Cn(t)).toString(),a={signal:n};if(r&&Q(r.formMethod)){let{formMethod:e,formEncType:t}=r;a.method=e.toUpperCase(),t===`application/json`?(a.headers=new Headers({"Content-Type":t}),a.body=JSON.stringify(r.json)):a.body=t===`text/plain`?r.text:t===`application/x-www-form-urlencoded`&&r.formData?mn(r.formData):r.formData}return new Request(i,a)}function pn(e,t){let n=new URL(e.url),r=typeof t==`string`?U(t):t;if(n.pathname=r.pathname||`/`,r.search){let e=new URLSearchParams(r.search),t=e.getAll(`index`);e.delete(`index`);for(let n of t.filter(Boolean))e.append(`index`,n);n.search=e.size?`?${e.toString()}`:``}else n.search=``;return n.hash=r.hash||``,n}function mn(e){let t=new URLSearchParams;for(let[n,r]of e.entries())t.append(n,typeof r==`string`?r:r.name);return t}function hn(e){let t=new FormData;for(let[n,r]of e.entries())t.append(n,r);return t}function gn(e,t,n,r=!1,i=!1){let a={},o=null,s,c=!1,l={},u=n&&Z(n[1])?n[1].error:void 0;return e.forEach(n=>{if(!(n.route.id in t))return;let d=n.route.id,f=t[d];if(z(!kn(f),`Cannot handle redirect results in processLoaderData`),Z(f)){let t=f.error;if(u!==void 0&&(t=u,u=void 0),o||={},i)o[d]=t;else{let n=bn(e,d);o[n.route.id]??(o[n.route.id]=t)}r||(a[d]=Dt),c||(c=!0,s=tt(f.error)?f.error.status:500),f.headers&&(l[d]=f.headers)}else a[d]=f.data,f.statusCode&&f.statusCode!==200&&!c&&(s=f.statusCode),f.headers&&(l[d]=f.headers)}),u!==void 0&&n&&(o={[n[0]]:u},n[2]&&(a[n[2]]=void 0)),{loaderData:a,errors:o,statusCode:s||200,loaderHeaders:l}}function _n(e,t,n,r,i,a,o){let{loaderData:s,errors:c}=gn(t,n,r);return i.filter(e=>!e.matches||e.matches.some(e=>e.shouldLoad)).forEach(t=>{let{key:n,match:r,controller:i}=t;if(i&&i.signal.aborted)return;let s=a[n];if(z(s,`Did not find corresponding fetcher result`),Z(s)){let t=bn(e.matches,r?.route.id);c&&c[t.route.id]||(c={...c,[t.route.id]:s.error}),o.delete(n)}else if(kn(s))z(!1,`Unhandled fetcher revalidation redirect`);else{let e=Hn(s.data);o.set(n,e)}}),{loaderData:s,errors:c}}function vn(e,t,n,r){let i=Object.entries(t).filter(([,e])=>e!==Dt).reduce((e,[t,n])=>(e[t]=n,e),{});for(let a of n){let n=a.route.id;if(!t.hasOwnProperty(n)&&e.hasOwnProperty(n)&&a.route.loader&&(i[n]=e[n]),r&&r.hasOwnProperty(n))break}return i}function yn(e){return e?Z(e[1])?{actionData:{}}:{actionData:{[e[0]]:e[1].data}}:{}}function bn(e,t){return(t?e.slice(0,e.findIndex(e=>e.route.id===t)+1):[...e]).reverse().find(e=>e.route.hasErrorBoundary===!0)||e[0]}function xn(e){let t=e.length===1?e[0]:e.find(e=>e.index||!e.path||e.path===`/`)||{id:`__shim-error-route__`};return{matches:[{params:{},pathname:``,pathnameBase:``,route:t}],route:t}}function X(e,{pathname:t,routeId:n,method:r,type:i,message:a}={}){let o=`Unknown Server Error`,s=`Unknown @remix-run/router error`;return e===400?(o=`Bad Request`,r&&t&&n?s=`You made a ${r} request to "${t}" but did not provide a \`loader\` for route "${n}", so there is no way to handle the request.`:i===`invalid-body`&&(s=`Unable to encode submission body`)):e===403?(o=`Forbidden`,s=`Route "${n}" does not match URL "${t}"`):e===404?(o=`Not Found`,s=`No route matches URL "${t}"`):e===405&&(o=`Method Not Allowed`,r&&t&&n?s=`You made a ${r.toUpperCase()} request to "${t}" but did not provide an \`action\` for route "${n}", so there is no way to handle the request.`:r&&(s=`Invalid request method "${r.toUpperCase()}"`)),new et(e||500,o,Error(s),!0)}function Sn(e){let t=Object.entries(e);for(let e=t.length-1;e>=0;e--){let[n,r]=t[e];if(kn(r))return{key:n,result:r}}}function Cn(e){return H({...typeof e==`string`?U(e):e,hash:``})}function wn(e,t){return e.pathname!==t.pathname||e.search!==t.search?!1:e.hash===``?t.hash!==``:e.hash===t.hash||t.hash!==``}function Tn(e){return new et(e.init?.status??500,e.init?.statusText??`Internal Server Error`,e.data)}function En(e){return typeof e==`object`&&!!e&&Object.entries(e).every(([e,t])=>typeof e==`string`&&Dn(t))}function Dn(e){return typeof e==`object`&&!!e&&`type`in e&&`result`in e&&(e.type===`data`||e.type===`error`)}function On(e){return jn(e.result)&&bt.has(e.result.status)}function Z(e){return e.type===`error`}function kn(e){return(e&&e.type)===`redirect`}function An(e){return typeof e==`object`&&!!e&&`type`in e&&`data`in e&&`init`in e&&e.type===`DataWithResponseInit`}function jn(e){return e!=null&&typeof e.status==`number`&&typeof e.statusText==`string`&&typeof e.headers==`object`&&e.body!==void 0}function Mn(e){return bt.has(e)}function Nn(e){return jn(e)&&Mn(e.status)&&e.headers.has(`Location`)}function Pn(e){return yt.has(e.toUpperCase())}function Q(e){return _t.has(e.toUpperCase())}function Fn(e){return new URLSearchParams(e).getAll(`index`).some(e=>e===``)}function In(e,t){let n=typeof t==`string`?U(t).search:t.search;if(e[e.length-1].route.index&&Fn(n||``))return e[e.length-1];let r=Ge(e);return r[r.length-1]}function Ln(e){let{formMethod:t,formAction:n,formEncType:r,text:i,formData:a,json:o}=e;if(!(!t||!n||!r)){if(i!=null)return{formMethod:t,formAction:n,formEncType:r,formData:void 0,json:void 0,text:i};if(a!=null)return{formMethod:t,formAction:n,formEncType:r,formData:a,json:void 0,text:void 0};if(o!==void 0)return{formMethod:t,formAction:n,formEncType:r,formData:void 0,json:o,text:void 0}}}function Rn(e,t,n,r){return r?{state:`loading`,location:e,matches:t,historyAction:n,formMethod:r.formMethod,formAction:r.formAction,formEncType:r.formEncType,formData:r.formData,json:r.json,text:r.text}:{state:`loading`,location:e,matches:t,historyAction:n,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0}}function zn(e,t,n,r){return{state:`submitting`,location:e,matches:t,historyAction:n,formMethod:r.formMethod,formAction:r.formAction,formEncType:r.formEncType,formData:r.formData,json:r.json,text:r.text}}function Bn(e,t){return e?{state:`loading`,formMethod:e.formMethod,formAction:e.formAction,formEncType:e.formEncType,formData:e.formData,json:e.json,text:e.text,data:t}:{state:`loading`,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0,data:t}}function Vn(e,t){return{state:`submitting`,formMethod:e.formMethod,formAction:e.formAction,formEncType:e.formEncType,formData:e.formData,json:e.json,text:e.text,data:t?t.data:void 0}}function Hn(e){return{state:`idle`,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0,data:e}}function Un(e,t){try{let n=e.sessionStorage.getItem(Et);if(n){let e=JSON.parse(n);for(let[n,r]of Object.entries(e||{}))r&&Array.isArray(r)&&t.set(n,new Set(r||[]))}}catch{}}function Wn(e,t){if(t.size>0){let n={};for(let[e,r]of t)n[e]=[...r];try{e.sessionStorage.setItem(Et,JSON.stringify(n))}catch(e){B(!1,`Failed to save applied view transitions in sessionStorage (${e}).`)}}}function Gn(){let e,t,n=new Promise((r,i)=>{e=async e=>{r(e);try{await n}catch{}},t=async e=>{i(e);try{await n}catch{}}});return{promise:n,resolve:e,reject:t}}var Kn=M.createContext(null);Kn.displayName=`DataRouter`;var qn=M.createContext(null);qn.displayName=`DataRouterState`;var Jn=M.createContext(!1);function Yn(){return M.useContext(Jn)}var Xn=M.createContext({isTransitioning:!1});Xn.displayName=`ViewTransition`;var Zn=M.createContext(new Map);Zn.displayName=`Fetchers`;var Qn=M.createContext(null);Qn.displayName=`Await`;var $=M.createContext(null);$.displayName=`Navigation`;var $n=M.createContext(null);$n.displayName=`Location`;var er=M.createContext({outlet:null,matches:[],isDataRoute:!1});er.displayName=`Route`;var tr=M.createContext(null);tr.displayName=`RouteError`;var nr=`REACT_ROUTER_ERROR`,rr=`REDIRECT`,ir=`ROUTE_ERROR_RESPONSE`;function ar(e){if(e.startsWith(`${nr}:${rr}:{`))try{let t=JSON.parse(e.slice(28));if(typeof t==`object`&&t&&typeof t.status==`number`&&typeof t.statusText==`string`&&typeof t.location==`string`&&typeof t.reloadDocument==`boolean`&&typeof t.replace==`boolean`)return t}catch{}}function or(e){if(e.startsWith(`${nr}:${ir}:{`))try{let t=JSON.parse(e.slice(40));if(typeof t==`object`&&t&&typeof t.status==`number`&&typeof t.statusText==`string`)return new et(t.status,t.statusText,t.data)}catch{}}function sr(e,{relative:t}={}){z(cr(),`useHref() may be used only in the context of a <Router> component.`);let{basename:n,navigator:r}=M.useContext($),{hash:i,pathname:a,search:o}=mr(e,{relative:t}),s=a;return n!==`/`&&(s=a===`/`?n:Y([n,a])),r.createHref({pathname:s,search:o,hash:i})}function cr(){return M.useContext($n)!=null}function lr(){return z(cr(),`useLocation() may be used only in the context of a <Router> component.`),M.useContext($n).location}var ur=`You should call navigate() in a React.useEffect(), not when your component is first rendered.`;function dr(e){M.useContext($).static||M.useLayoutEffect(e)}function fr(){let{isDataRoute:e}=M.useContext(er);return e?jr():pr()}function pr(){z(cr(),`useNavigate() may be used only in the context of a <Router> component.`);let e=M.useContext(Kn),{basename:t,navigator:n}=M.useContext($),{matches:r}=M.useContext(er),{pathname:i}=lr(),a=JSON.stringify(Ke(r)),o=M.useRef(!1);return dr(()=>{o.current=!0}),M.useCallback((r,s={})=>{if(B(o.current,ur),!o.current)return;if(typeof r==`number`){n.go(r);return}let c=qe(r,JSON.parse(a),i,s.relative===`path`);e==null&&t!==`/`&&(c.pathname=c.pathname===`/`?t:Y([t,c.pathname])),(s.replace?n.replace:n.push)(c,s.state,s)},[t,n,a,i,e])}M.createContext(null);function mr(e,{relative:t}={}){let{matches:n}=M.useContext(er),{pathname:r}=lr(),i=JSON.stringify(Ke(n));return M.useMemo(()=>qe(e,JSON.parse(i),r,t===`path`),[e,i,r,t])}function hr(e,t,n){z(cr(),`useRoutes() may be used only in the context of a <Router> component.`);let{navigator:r}=M.useContext($),{matches:i}=M.useContext(er),a=i[i.length-1],o=a?a.params:{},s=a?a.pathname:`/`,c=a?a.pathnameBase:`/`,l=a&&a.route;{let e=l&&l.path||``;Nr(s,!l||e.endsWith(`*`)||e.endsWith(`*?`),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${s}" (under <Route path="${e}">) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render.
3
-
4
- Please change the parent <Route path="${e}"> to <Route path="${e===`/`?`*`:`${e}/*`}">.`)}let u=lr(),d;if(t){let e=typeof t==`string`?U(t):t;z(c===`/`||e.pathname?.startsWith(c),`When overriding the location using \`<Routes location>\` or \`useRoutes(routes, location)\`, the location pathname must begin with the portion of the URL pathname that was matched by all parent routes. The current pathname base is "${c}" but pathname "${e.pathname}" was given in the \`location\` prop.`),d=e}else d=u;let f=d.pathname||`/`,p=f;if(c!==`/`){let e=c.replace(/^\//,``).split(`/`);p=`/`+f.replace(/^\//,``).split(`/`).slice(e.length).join(`/`)}let m=n&&n.state.matches.length?n.state.matches.map(e=>Object.assign(e,{route:n.manifest[e.route.id]||e.route})):Se(e,{pathname:p});B(l||m!=null,`No routes matched location "${d.pathname}${d.search}${d.hash}" `),B(m==null||m[m.length-1].route.element!==void 0||m[m.length-1].route.Component!==void 0||m[m.length-1].route.lazy!==void 0,`Matched leaf route at location "${d.pathname}${d.search}${d.hash}" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.`);let h=Sr(m&&m.map(e=>Object.assign({},e,{params:Object.assign({},o,e.params),pathname:Y([c,r.encodeLocation?r.encodeLocation(e.pathname.replace(/%/g,`%25`).replace(/\?/g,`%3F`).replace(/#/g,`%23`)).pathname:e.pathname]),pathnameBase:e.pathnameBase===`/`?c:Y([c,r.encodeLocation?r.encodeLocation(e.pathnameBase.replace(/%/g,`%25`).replace(/\?/g,`%3F`).replace(/#/g,`%23`)).pathname:e.pathnameBase])})),i,n);return t&&h?M.createElement($n.Provider,{value:{location:{pathname:`/`,search:``,hash:``,state:null,key:`default`,mask:void 0,...d},navigationType:`POP`}},h):h}function gr(){let e=Ar(),t=tt(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:JSON.stringify(e),n=e instanceof Error?e.stack:null,r=`rgba(200,200,200, 0.5)`,i={padding:`0.5rem`,backgroundColor:r},a={padding:`2px 4px`,backgroundColor:r},o=null;return console.error(`Error handled by React Router default ErrorBoundary:`,e),o=M.createElement(M.Fragment,null,M.createElement(`p`,null,`💿 Hey developer 👋`),M.createElement(`p`,null,`You can provide a way better UX than this when your app throws errors by providing your own `,M.createElement(`code`,{style:a},`ErrorBoundary`),` or`,` `,M.createElement(`code`,{style:a},`errorElement`),` prop on your route.`)),M.createElement(M.Fragment,null,M.createElement(`h2`,null,`Unexpected Application Error!`),M.createElement(`h3`,{style:{fontStyle:`italic`}},t),n?M.createElement(`pre`,{style:i},n):null,o)}var _r=M.createElement(gr,null),vr=class extends M.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,t){return t.location!==e.location||t.revalidation!==`idle`&&e.revalidation===`idle`?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error===void 0?t.error:e.error,location:t.location,revalidation:e.revalidation||t.revalidation}}componentDidCatch(e,t){this.props.onError?this.props.onError(e,t):console.error(`React Router caught the following error during render`,e)}render(){let e=this.state.error;if(this.context&&typeof e==`object`&&e&&`digest`in e&&typeof e.digest==`string`){let t=or(e.digest);t&&(e=t)}let t=e===void 0?this.props.children:M.createElement(er.Provider,{value:this.props.routeContext},M.createElement(tr.Provider,{value:e,children:this.props.component}));return this.context?M.createElement(br,{error:e},t):t}};vr.contextType=Jn;var yr=new WeakMap;function br({children:e,error:t}){let{basename:n}=M.useContext($);if(typeof t==`object`&&t&&`digest`in t&&typeof t.digest==`string`){let e=ar(t.digest);if(e){let r=yr.get(t);if(r)throw r;let i=it(e.location,n),a=i.absoluteURL||i.to;if(un(a))throw Error(`Invalid redirect location`);if(rt&&!yr.get(t)){if(i.isExternal||e.reloadDocument)window.location.href=a;else{let n=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(i.to,{replace:e.replace}));throw yr.set(t,n),n}}return M.createElement(`meta`,{httpEquiv:`refresh`,content:`0;url=${a}`})}}return e}function xr({routeContext:e,match:t,children:n}){let r=M.useContext(Kn);return r&&r.static&&r.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(r.staticContext._deepestRenderedBoundaryId=t.route.id),M.createElement(er.Provider,{value:e},n)}function Sr(e,t=[],n){let r=n?.state;if(e==null){if(!r)return null;if(r.errors)e=r.matches;else if(t.length===0&&!r.initialized&&r.matches.length>0)e=r.matches;else return null}let i=e,a=r?.errors;if(a!=null){let e=i.findIndex(e=>e.route.id&&a?.[e.route.id]!==void 0);z(e>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(a).join(`,`)}`),i=i.slice(0,Math.min(i.length,e+1))}let o=!1,s=-1;if(n&&r){o=r.renderFallback;for(let e=0;e<i.length;e++){let t=i[e];if((t.route.HydrateFallback||t.route.hydrateFallbackElement)&&(s=e),t.route.id){let{loaderData:e,errors:a}=r,c=t.route.loader&&!e.hasOwnProperty(t.route.id)&&(!a||a[t.route.id]===void 0);if(t.route.lazy||c){n.isStatic&&(o=!0),i=s>=0?i.slice(0,s+1):[i[0]];break}}}}let c=n?.onError,l=r&&c?(e,t)=>{c(e,{location:r.location,params:r.matches?.[0]?.params??{},pattern:nt(r.matches),errorInfo:t})}:void 0;return i.reduceRight((e,n,c)=>{let u,d=!1,f=null,p=null;r&&(u=a&&n.route.id?a[n.route.id]:void 0,f=n.route.errorElement||_r,o&&(s<0&&c===0?(Nr(`route-fallback`,!1,"No `HydrateFallback` element provided to render during initial hydration"),d=!0,p=null):s===c&&(d=!0,p=n.route.hydrateFallbackElement||null)));let m=t.concat(i.slice(0,c+1)),h=()=>{let t;return t=u?f:d?p:n.route.Component?M.createElement(n.route.Component,null):n.route.element?n.route.element:e,M.createElement(xr,{match:n,routeContext:{outlet:e,matches:m,isDataRoute:r!=null},children:t})};return r&&(n.route.ErrorBoundary||n.route.errorElement||c===0)?M.createElement(vr,{location:r.location,revalidation:r.revalidation,component:f,error:u,children:h(),routeContext:{outlet:null,matches:m,isDataRoute:!0},onError:l}):h()},null)}function Cr(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function wr(e){let t=M.useContext(Kn);return z(t,Cr(e)),t}function Tr(e){let t=M.useContext(qn);return z(t,Cr(e)),t}function Er(e){let t=M.useContext(er);return z(t,Cr(e)),t}function Dr(e){let t=Er(e),n=t.matches[t.matches.length-1];return z(n.route.id,`${e} can only be used on routes that contain a unique "id"`),n.route.id}function Or(){return Dr(`useRouteId`)}function kr(){let{matches:e,loaderData:t}=Tr(`useMatches`);return M.useMemo(()=>e.map(e=>Ce(e,t)),[e,t])}function Ar(){let e=M.useContext(tr),t=Tr(`useRouteError`),n=Dr(`useRouteError`);return e===void 0?t.errors?.[n]:e}function jr(){let{router:e}=wr(`useNavigate`),t=Dr(`useNavigate`),n=M.useRef(!1);return dr(()=>{n.current=!0}),M.useCallback(async(r,i={})=>{B(n.current,ur),n.current&&(typeof r==`number`?await e.navigate(r):await e.navigate(r,{fromRouteId:t,...i}))},[e,t])}var Mr={};function Nr(e,t,n){!t&&!Mr[e]&&(Mr[e]=!0,B(!1,n))}var Pr={};function Fr(e,t){!e&&!Pr[t]&&(Pr[t]=!0,console.warn(t))}var Ir=M.useOptimistic,Lr=()=>void 0;function Rr(e){return Ir?Ir(e):[e,Lr]}function zr(e){let t={hasErrorBoundary:e.hasErrorBoundary||e.ErrorBoundary!=null||e.errorElement!=null};return e.Component&&(e.element&&B(!1,"You should not include both `Component` and `element` on your route - `Component` will be used."),Object.assign(t,{element:M.createElement(e.Component),Component:void 0})),e.HydrateFallback&&(e.hydrateFallbackElement&&B(!1,"You should not include both `HydrateFallback` and `hydrateFallbackElement` on your route - `HydrateFallback` will be used."),Object.assign(t,{hydrateFallbackElement:M.createElement(e.HydrateFallback),HydrateFallback:void 0})),e.ErrorBoundary&&(e.errorElement&&B(!1,"You should not include both `ErrorBoundary` and `errorElement` on your route - `ErrorBoundary` will be used."),Object.assign(t,{errorElement:M.createElement(e.ErrorBoundary),ErrorBoundary:void 0})),t}var Br=[`HydrateFallback`,`hydrateFallbackElement`],Vr=class{constructor(){this.status=`pending`,this.promise=new Promise((e,t)=>{this.resolve=t=>{this.status===`pending`&&(this.status=`resolved`,e(t))},this.reject=e=>{this.status===`pending`&&(this.status=`rejected`,t(e))}})}};function Hr({router:e,flushSync:t,onError:n,useTransitions:r}){r=Yn()||r;let[i,a]=M.useState(e.state),[o,s]=Rr(i),[c,l]=M.useState(),[u,d]=M.useState({isTransitioning:!1}),[f,p]=M.useState(),[m,h]=M.useState(),[g,_]=M.useState(),v=M.useRef(new Map),y=M.useCallback((i,{deletedFetchers:o,newErrors:c,flushSync:u,viewTransitionOpts:g})=>{c&&n&&Object.values(c).forEach(e=>n(e,{location:i.location,params:i.matches[0]?.params??{},pattern:nt(i.matches)})),i.fetchers.forEach((e,t)=>{e.data!==void 0&&v.current.set(t,e.data)}),o.forEach(e=>v.current.delete(e)),Fr(u===!1||t!=null,'You provided the `flushSync` option to a router update, but you are not using the `<RouterProvider>` from `react-router/dom` so `ReactDOM.flushSync()` is unavailable. Please update your app to `import { RouterProvider } from "react-router/dom"` and ensure you have `react-dom` installed as a dependency to use the `flushSync` option.');let y=e.window!=null&&e.window.document!=null&&typeof e.window.document.startViewTransition==`function`;if(Fr(g==null||y,"You provided the `viewTransition` option to a router update, but you do not appear to be running in a DOM environment as `window.startViewTransition` is not available."),!g||!y){t&&u?t(()=>a(i)):r===!1?a(i):M.startTransition(()=>{r===!0&&s(e=>Ur(e,i)),a(i)});return}if(t&&u){t(()=>{m&&(f?.resolve(),m.skipTransition()),d({isTransitioning:!0,flushSync:!0,currentLocation:g.currentLocation,nextLocation:g.nextLocation})});let n=e.window.document.startViewTransition(()=>{t(()=>a(i))});n.finished.finally(()=>{t(()=>{p(void 0),h(void 0),l(void 0),d({isTransitioning:!1})})}),t(()=>h(n));return}m?(f?.resolve(),m.skipTransition(),_({state:i,currentLocation:g.currentLocation,nextLocation:g.nextLocation})):(l(i),d({isTransitioning:!0,flushSync:!1,currentLocation:g.currentLocation,nextLocation:g.nextLocation}))},[e.window,t,m,f,r,s,n]);M.useLayoutEffect(()=>e.subscribe(y),[e,y]),M.useEffect(()=>{u.isTransitioning&&!u.flushSync&&p(new Vr)},[u]),M.useEffect(()=>{if(f&&c&&e.window){let t=c,n=f.promise,i=e.window.document.startViewTransition(async()=>{r===!1?a(t):M.startTransition(()=>{r===!0&&s(e=>Ur(e,t)),a(t)}),await n});i.finished.finally(()=>{p(void 0),h(void 0),l(void 0),d({isTransitioning:!1})}),h(i)}},[c,f,e.window,r,s]),M.useEffect(()=>{f&&c&&o.location.key===c.location.key&&f.resolve()},[f,m,o.location,c]),M.useEffect(()=>{!u.isTransitioning&&g&&(l(g.state),d({isTransitioning:!0,flushSync:!1,currentLocation:g.currentLocation,nextLocation:g.nextLocation}),_(void 0))},[u.isTransitioning,g]);let b=M.useMemo(()=>({createHref:e.createHref,encodeLocation:e.encodeLocation,go:t=>e.navigate(t),push:(t,n,r)=>e.navigate(t,{state:n,preventScrollReset:r?.preventScrollReset}),replace:(t,n,r)=>e.navigate(t,{replace:!0,state:n,preventScrollReset:r?.preventScrollReset})}),[e]),x=e.basename||`/`,S=M.useMemo(()=>({router:e,navigator:b,static:!1,basename:x,onError:n}),[e,b,x,n]);return M.createElement(M.Fragment,null,M.createElement(Kn.Provider,{value:S},M.createElement(qn.Provider,{value:o},M.createElement(Zn.Provider,{value:v.current},M.createElement(Xn.Provider,{value:u},M.createElement(Kr,{basename:x,location:o.location,navigationType:o.historyAction,navigator:b,useTransitions:r},M.createElement(Wr,{routes:e.routes,manifest:e.manifest,future:e.future,state:o,isStatic:!1,onError:n})))))),null)}function Ur(e,t){return{...e,navigation:t.navigation.state===`idle`?e.navigation:t.navigation,revalidation:t.revalidation===`idle`?e.revalidation:t.revalidation,actionData:t.navigation.state===`submitting`?e.actionData:t.actionData,fetchers:t.fetchers}}var Wr=M.memo(Gr);function Gr({routes:e,manifest:t,future:n,state:r,isStatic:i,onError:a}){return hr(e,void 0,{manifest:t,state:r,isStatic:i,onError:a,future:n})}function Kr({basename:e=`/`,children:t=null,location:n,navigationType:r=`POP`,navigator:i,static:a=!1,useTransitions:o}){z(!cr(),`You cannot render a <Router> inside another <Router>. You should never have more than one in your app.`);let s=e.replace(/^\/*/,`/`),c=M.useMemo(()=>({basename:s,navigator:i,static:a,useTransitions:o,future:{}}),[s,i,a,o]);typeof n==`string`&&(n=U(n));let{pathname:l=`/`,search:u=``,hash:d=``,state:f=null,key:p=`default`,mask:m}=n,h=M.useMemo(()=>{let e=J(l,s);return e==null?null:{location:{pathname:e,search:u,hash:d,state:f,key:p,mask:m},navigationType:r}},[s,l,u,d,f,p,r,m]);return B(h!=null,`<Router basename="${s}"> is not able to match the URL "${l}${u}${d}" because it does not start with the basename, so the <Router> won't render anything.`),h==null?null:M.createElement($.Provider,{value:c},M.createElement($n.Provider,{children:t,value:h}))}M.Component;var qr=`get`,Jr=`application/x-www-form-urlencoded`;function Yr(e){return typeof HTMLElement<`u`&&e instanceof HTMLElement}function Xr(e){return Yr(e)&&e.tagName.toLowerCase()===`button`}function Zr(e){return Yr(e)&&e.tagName.toLowerCase()===`form`}function Qr(e){return Yr(e)&&e.tagName.toLowerCase()===`input`}function $r(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function ei(e,t){return e.button===0&&(!t||t===`_self`)&&!$r(e)}function ti(e=``){return new URLSearchParams(typeof e==`string`||Array.isArray(e)||e instanceof URLSearchParams?e:Object.keys(e).reduce((t,n)=>{let r=e[n];return t.concat(Array.isArray(r)?r.map(e=>[n,e]):[[n,r]])},[]))}function ni(e,t){let n=ti(e);return t&&t.forEach((e,r)=>{n.has(r)||t.getAll(r).forEach(e=>{n.append(r,e)})}),n}var ri=null;function ii(){if(ri===null)try{new FormData(document.createElement(`form`),0),ri=!1}catch{ri=!0}return ri}var ai=new Set([`application/x-www-form-urlencoded`,`multipart/form-data`,`text/plain`]);function oi(e){return e!=null&&!ai.has(e)?(B(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${Jr}"`),null):e}function si(e,t){let n,r,i,a,o;if(Zr(e)){let o=e.getAttribute(`action`);r=o?J(o,t):null,n=e.getAttribute(`method`)||qr,i=oi(e.getAttribute(`enctype`))||Jr,a=new FormData(e)}else if(Xr(e)||Qr(e)&&(e.type===`submit`||e.type===`image`)){let o=e.form;if(o==null)throw Error(`Cannot submit a <button> or <input type="submit"> without a <form>`);let s=e.getAttribute(`formaction`)||o.getAttribute(`action`);if(r=s?J(s,t):null,n=e.getAttribute(`formmethod`)||o.getAttribute(`method`)||qr,i=oi(e.getAttribute(`formenctype`))||oi(o.getAttribute(`enctype`))||Jr,a=new FormData(o,e),!ii()){let{name:t,type:n,value:r}=e;if(n===`image`){let e=t?`${t}.`:``;a.append(`${e}x`,`0`),a.append(`${e}y`,`0`)}else t&&a.append(t,r)}}else if(Yr(e))throw Error(`Cannot submit element that is not <form>, <button>, or <input type="submit|image">`);else n=qr,r=null,i=Jr,o=e;return a&&i===`text/plain`&&(o=a,a=void 0),{action:r,method:n.toLowerCase(),encType:i,formData:a,body:o}}Object.getOwnPropertyNames(Object.prototype).sort().join(`\0`);function ci(e,t){if(e===!1||e==null)throw Error(t)}function li(e,t,n,r){let i=typeof e==`string`?new URL(e,typeof window>`u`?`server://singlefetch/`:window.location.origin):e;return i.pathname=n?i.pathname.endsWith(`/`)?`${i.pathname}_.${r}`:`${i.pathname}.${r}`:i.pathname===`/`?`_root.${r}`:t&&J(i.pathname,t)===`/`?`${Ye(t)}/_root.${r}`:`${Ye(i.pathname)}.${r}`,i}async function ui(e,t){if(e.id in t)return t[e.id];try{let n=await ne(()=>import(e.module),[]);return t[e.id]=n,n}catch(t){return console.error(`Error loading route module \`${e.module}\`, reloading page...`),console.error(t),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode,window.location.reload(),new Promise(()=>{})}}function di(e){return e!=null&&typeof e.page==`string`}function fi(e){return e==null?!1:e.href==null?e.rel===`preload`&&typeof e.imageSrcSet==`string`&&typeof e.imageSizes==`string`:typeof e.rel==`string`&&typeof e.href==`string`}async function pi(e,t,n){return vi((await Promise.all(e.map(async e=>{let r=t.routes[e.route.id];if(r){let e=await ui(r,n);return e.links?e.links():[]}return[]}))).flat(1).filter(fi).filter(e=>e.rel===`stylesheet`||e.rel===`preload`).map(e=>e.rel===`stylesheet`?{...e,rel:`prefetch`,as:`style`}:{...e,rel:`prefetch`}))}function mi(e,t,n,r,i,a){let o=(e,t)=>!n[t]||e.route.id!==n[t].route.id,s=(e,t)=>n[t].pathname!==e.pathname||n[t].route.path?.endsWith(`*`)&&n[t].params[`*`]!==e.params[`*`];return a===`assets`?t.filter((e,t)=>o(e,t)||s(e,t)):a===`data`?t.filter((t,a)=>{let c=r.routes[t.route.id];if(!c||!c.hasLoader)return!1;if(o(t,a)||s(t,a))return!0;if(t.route.shouldRevalidate){let r=t.route.shouldRevalidate({currentUrl:new URL(i.pathname+i.search+i.hash,window.origin),currentParams:n[0]?.params||{},nextUrl:new URL(e,window.origin),nextParams:t.params,defaultShouldRevalidate:!0});if(typeof r==`boolean`)return r}return!0}):[]}function hi(e,t,{includeHydrateFallback:n}={}){return gi(e.map(e=>{let r=t.routes[e.route.id];if(!r)return[];let i=[r.module];return r.clientActionModule&&(i=i.concat(r.clientActionModule)),r.clientLoaderModule&&(i=i.concat(r.clientLoaderModule)),n&&r.hydrateFallbackModule&&(i=i.concat(r.hydrateFallbackModule)),r.imports&&(i=i.concat(r.imports)),i}).flat(1))}function gi(e){return[...new Set(e)]}function _i(e){let t={},n=Object.keys(e).sort();for(let r of n)t[r]=e[r];return t}function vi(e,t){let n=new Set,r=new Set(t);return e.reduce((e,i)=>{if(t&&!di(i)&&i.as===`script`&&i.href&&r.has(i.href))return e;let a=JSON.stringify(_i(i));return n.has(a)||(n.add(a),e.push({key:a,link:i})),e},[])}function yi(){let e=M.useContext(Kn);return ci(e,`You must render this element inside a <DataRouterContext.Provider> element`),e}function bi(){let e=M.useContext(qn);return ci(e,`You must render this element inside a <DataRouterStateContext.Provider> element`),e}var xi=M.createContext(void 0);xi.displayName=`FrameworkContext`;function Si(){let e=M.useContext(xi);return ci(e,`You must render this element inside a <HydratedRouter> element`),e}function Ci(e,t){let n=M.useContext(xi),[r,i]=M.useState(!1),[a,o]=M.useState(!1),{onFocus:s,onBlur:c,onMouseEnter:l,onMouseLeave:u,onTouchStart:d}=t,f=M.useRef(null);M.useEffect(()=>{if(e===`render`&&o(!0),e===`viewport`){let e=new IntersectionObserver(e=>{e.forEach(e=>{o(e.isIntersecting)})},{threshold:.5});return f.current&&e.observe(f.current),()=>{e.disconnect()}}},[e]),M.useEffect(()=>{if(r){let e=setTimeout(()=>{o(!0)},100);return()=>{clearTimeout(e)}}},[r]);let p=()=>{i(!0)},m=()=>{i(!1),o(!1)};return n?e===`intent`?[a,f,{onFocus:wi(s,p),onBlur:wi(c,m),onMouseEnter:wi(l,p),onMouseLeave:wi(u,m),onTouchStart:wi(d,p)}]:[a,f,{}]:[!1,f,{}]}function wi(e,t){return n=>{e&&e(n),n.defaultPrevented||t(n)}}function Ti({page:e,...t}){let n=Yn(),{nonce:r}=Si(),{router:i}=yi(),a=M.useMemo(()=>Se(i.routes,e,i.basename),[i.routes,e,i.basename]);return a?(t.nonce==null&&r&&(t={...t,nonce:r}),n?M.createElement(Di,{page:e,matches:a,...t}):M.createElement(Oi,{page:e,matches:a,...t})):null}function Ei(e){let{manifest:t,routeModules:n}=Si(),[r,i]=M.useState([]);return M.useEffect(()=>{let r=!1;return pi(e,t,n).then(e=>{r||i(e)}),()=>{r=!0}},[e,t,n]),r}function Di({page:e,matches:t,...n}){let r=lr(),{future:i}=Si(),{basename:a}=yi(),o=M.useMemo(()=>{if(e===r.pathname+r.search+r.hash)return[];let n=li(e,a,i.v8_trailingSlashAwareDataRequests,`rsc`),o=!1,s=[];for(let e of t)typeof e.route.shouldRevalidate==`function`?o=!0:s.push(e.route.id);return o&&s.length>0&&n.searchParams.set(`_routes`,s.join(`,`)),[n.pathname+n.search]},[a,i.v8_trailingSlashAwareDataRequests,e,r,t]);return M.createElement(M.Fragment,null,o.map(e=>M.createElement(`link`,{key:e,rel:`prefetch`,as:`fetch`,href:e,...n})))}function Oi({page:e,matches:t,...n}){let r=lr(),{future:i,manifest:a,routeModules:o}=Si(),{basename:s}=yi(),{loaderData:c,matches:l}=bi(),u=M.useMemo(()=>mi(e,t,l,a,r,`data`),[e,t,l,a,r]),d=M.useMemo(()=>mi(e,t,l,a,r,`assets`),[e,t,l,a,r]),f=M.useMemo(()=>{if(e===r.pathname+r.search+r.hash)return[];let n=new Set,l=!1;if(t.forEach(e=>{let t=a.routes[e.route.id];!t||!t.hasLoader||(!u.some(t=>t.route.id===e.route.id)&&e.route.id in c&&o[e.route.id]?.shouldRevalidate||t.hasClientLoader?l=!0:n.add(e.route.id))}),n.size===0)return[];let d=li(e,s,i.v8_trailingSlashAwareDataRequests,`data`);return l&&n.size>0&&d.searchParams.set(`_routes`,t.filter(e=>n.has(e.route.id)).map(e=>e.route.id).join(`,`)),[d.pathname+d.search]},[s,i.v8_trailingSlashAwareDataRequests,c,r,a,u,t,e,o]),p=M.useMemo(()=>hi(d,a),[d,a]),m=Ei(d);return M.createElement(M.Fragment,null,f.map(e=>M.createElement(`link`,{key:e,rel:`prefetch`,as:`fetch`,href:e,...n})),p.map(e=>M.createElement(`link`,{key:e,rel:`modulepreload`,href:e,...n})),m.map(({key:e,link:t})=>M.createElement(`link`,{key:e,nonce:n.nonce,...t,crossOrigin:t.crossOrigin??n.crossOrigin})))}function ki(...e){return t=>{e.forEach(e=>{typeof e==`function`?e(t):e!=null&&(e.current=t)})}}M.Component;var Ai=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0;try{Ai&&(window.__reactRouterVersion=`7.18.2`)}catch{}function ji(e,t){return Nt({basename:t?.basename,getContext:t?.getContext,future:t?.future,history:ce({window:t?.window}),hydrationData:t?.hydrationData||Mi(),routes:e,mapRouteProperties:zr,hydrationRouteProperties:Br,dataStrategy:t?.dataStrategy,patchRoutesOnNavigation:t?.patchRoutesOnNavigation,window:t?.window,instrumentations:t?.instrumentations}).initialize()}function Mi(){let e=window?.__staticRouterHydrationData;return e&&e.errors&&(e={...e,errors:Ni(e.errors)}),e}function Ni(e){if(!e)return null;let t=Object.entries(e),n={};for(let[e,r]of t)if(r&&r.__type===`RouteErrorResponse`)n[e]=new et(r.status,r.statusText,r.data,r.internal===!0);else if(r&&r.__type===`Error`){if(typeof r.__subType==`string`&&$e.includes(r.__subType)){let t=window[r.__subType];if(typeof t==`function`)try{let i=new t(r.message);i.stack=``,n[e]=i}catch{}}if(n[e]==null){let t=Error(r.message);t.stack=``,n[e]=t}}else n[e]=r;return n}var Pi=M.forwardRef(function({onClick:e,discover:t=`render`,prefetch:n=`none`,relative:r,reloadDocument:i,replace:a,mask:o,state:s,target:c,to:l,preventScrollReset:u,viewTransition:d,defaultShouldRevalidate:f,...p},m){let{basename:h,navigator:g,useTransitions:_}=M.useContext($),v=typeof l==`string`&&L.test(l),y=it(l,h);l=y.to;let b=sr(l,{relative:r}),x=lr(),S=null;if(o){let e=qe(o,[],x.mask?x.mask.pathname:`/`,!0);h!==`/`&&(e.pathname=e.pathname===`/`?h:Y([h,e.pathname])),S=g.createHref(e)}let[C,w,T]=Ci(n,p),E=zi(l,{replace:a,mask:o,state:s,target:c,preventScrollReset:u,relative:r,viewTransition:d,defaultShouldRevalidate:f,useTransitions:_});function D(t){e&&e(t),t.defaultPrevented||E(t)}let O=!(y.isExternal||i),k=M.createElement(`a`,{...p,...T,href:(O?S:void 0)||y.absoluteURL||b,onClick:O?D:e,ref:ki(m,w),target:c,"data-discover":!v&&t===`render`?`true`:void 0});return C&&!v?M.createElement(M.Fragment,null,k,M.createElement(Ti,{page:b})):k});Pi.displayName=`Link`;var Fi=M.forwardRef(function({"aria-current":e=`page`,caseSensitive:t=!1,className:n=``,end:r=!1,style:i,to:a,viewTransition:o,children:s,...c},l){let u=mr(a,{relative:c.relative}),d=lr(),f=M.useContext(qn),{navigator:p,basename:m}=M.useContext($),h=f!=null&&Gi(u)&&o===!0,g=p.encodeLocation?p.encodeLocation(u).pathname:u.pathname,_=d.pathname,v=f&&f.navigation&&f.navigation.location?f.navigation.location.pathname:null;t||(_=_.toLowerCase(),v=v?v.toLowerCase():null,g=g.toLowerCase()),v&&m&&(v=J(v,m)||v);let y=g!==`/`&&g.endsWith(`/`)?g.length-1:g.length,b=_===g||!r&&_.startsWith(g)&&_.charAt(y)===`/`,x=v!=null&&(v===g||!r&&v.startsWith(g)&&v.charAt(g.length)===`/`),S={isActive:b,isPending:x,isTransitioning:h},C=b?e:void 0,w;w=typeof n==`function`?n(S):[n,b?`active`:null,x?`pending`:null,h?`transitioning`:null].filter(Boolean).join(` `);let T=typeof i==`function`?i(S):i;return M.createElement(Pi,{...c,"aria-current":C,className:w,ref:l,style:T,to:a,viewTransition:o},typeof s==`function`?s(S):s)});Fi.displayName=`NavLink`;var Ii=M.forwardRef(({discover:e=`render`,fetcherKey:t,navigate:n,reloadDocument:r,replace:i,state:a,method:o=qr,action:s,onSubmit:c,relative:l,preventScrollReset:u,viewTransition:d,defaultShouldRevalidate:f,...p},m)=>{let{useTransitions:h}=M.useContext($),g=Ui(),_=Wi(s,{relative:l}),v=o.toLowerCase()===`get`?`get`:`post`,y=typeof s==`string`&&L.test(s);return M.createElement(`form`,{ref:m,method:v,action:_,onSubmit:r?c:e=>{if(c&&c(e),e.defaultPrevented)return;e.preventDefault();let r=e.nativeEvent.submitter,s=r?.getAttribute(`formmethod`)||o,p=()=>g(r||e.currentTarget,{fetcherKey:t,method:s,navigate:n,replace:i,state:a,relative:l,preventScrollReset:u,viewTransition:d,defaultShouldRevalidate:f});h&&n!==!1?M.startTransition(()=>p()):p()},...p,"data-discover":!y&&e===`render`?`true`:void 0})});Ii.displayName=`Form`;function Li(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function Ri(e){let t=M.useContext(Kn);return z(t,Li(e)),t}function zi(e,{target:t,replace:n,mask:r,state:i,preventScrollReset:a,relative:o,viewTransition:s,defaultShouldRevalidate:c,useTransitions:l}={}){let u=fr(),d=lr(),f=mr(e,{relative:o});return M.useCallback(p=>{if(ei(p,t)){p.preventDefault();let t=n===void 0?H(d)===H(f):n,m=()=>u(e,{replace:t,mask:r,state:i,preventScrollReset:a,relative:o,viewTransition:s,defaultShouldRevalidate:c});l?M.startTransition(()=>m()):m()}},[d,u,f,n,r,i,t,e,a,o,s,c,l])}function Bi(e){B(typeof URLSearchParams<`u`,"You cannot use the `useSearchParams` hook in a browser that does not support the URLSearchParams API. If you need to support Internet Explorer 11, we recommend you load a polyfill such as https://github.com/ungap/url-search-params.");let t=M.useRef(ti(e)),n=M.useRef(!1),r=lr(),i=M.useMemo(()=>ni(r.search,n.current?null:t.current),[r.search]),a=fr();return[i,M.useCallback((e,t)=>{let r=ti(typeof e==`function`?e(new URLSearchParams(i)):e);n.current=!0,a(`?`+r,t)},[a,i])]}var Vi=0,Hi=()=>`__${String(++Vi)}__`;function Ui(){let{router:e}=Ri(`useSubmit`),{basename:t}=M.useContext($),n=Or(),r=e.fetch,i=e.navigate;return M.useCallback(async(e,a={})=>{let{action:o,method:s,encType:c,formData:l,body:u}=si(e,t);if(a.navigate===!1){let e=a.fetcherKey||Hi();await r(e,n,a.action||o,{defaultShouldRevalidate:a.defaultShouldRevalidate,preventScrollReset:a.preventScrollReset,formData:l,body:u,formMethod:a.method||s,formEncType:a.encType||c,flushSync:a.flushSync})}else await i(a.action||o,{defaultShouldRevalidate:a.defaultShouldRevalidate,preventScrollReset:a.preventScrollReset,formData:l,body:u,formMethod:a.method||s,formEncType:a.encType||c,replace:a.replace,state:a.state,fromRouteId:n,flushSync:a.flushSync,viewTransition:a.viewTransition})},[r,i,t,n])}function Wi(e,{relative:t}={}){let{basename:n}=M.useContext($),r=M.useContext(er);z(r,`useFormAction must be used inside a RouteContext`);let[i]=r.matches.slice(-1),a={...mr(e||`.`,{relative:t})},o=lr();if(e==null){a.search=o.search;let e=new URLSearchParams(a.search),t=e.getAll(`index`);if(t.some(e=>e===``)){e.delete(`index`),t.filter(e=>e).forEach(t=>e.append(`index`,t));let n=e.toString();a.search=n?`?${n}`:``}}return(!e||e===`.`)&&i.route.index&&(a.search=a.search?a.search.replace(/^\?/,`?index&`):`?index`),n!==`/`&&(a.pathname=a.pathname===`/`?n:Y([n,a.pathname])),H(a)}function Gi(e,{relative:t}={}){let n=M.useContext(Xn);z(n!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:r}=Ri(`useViewTransitionState`),i=mr(e,{relative:t});if(!n.isTransitioning)return!1;let a=J(n.currentLocation.pathname,r)||n.currentLocation.pathname,o=J(n.nextLocation.pathname,r)||n.nextLocation.pathname;return Ie(i.pathname,o)!=null||Ie(i.pathname,a)!=null}export{A as C,h as D,u as E,r as O,g as S,n as T,f as _,tt as a,p as b,fr as c,ne as d,i as f,x as g,k as h,pe as i,a as k,Ar as l,S as m,Hr as n,lr as o,m as p,ji as r,kr as s,Pi as t,Bi as u,l as v,s as w,y as x,c as y};