nx
Version:
1 lines • 2.93 MB
JavaScript
(self.webpackChunk_nx_graph_client=self.webpackChunk_nx_graph_client||[]).push([[792],{1914(e,t,n){"use strict";var r=n(1945),a=n(3824);const i=(0,r.O)({predictableActionArguments:!0,preserveActionOrder:!0,id:"project-view",initial:"idle",context:{project:null,sourceMap:null},states:{idle:{},loaded:{}},on:{loadData:[{target:"loaded",actions:[(0,a.kp)((e,t)=>{e.project=t.project,e.sourceMap=t.sourceMap,e.connectedToCloud=t.connectedToCloud,e.errors=t.errors,e.disabledTaskSyncGenerators=t.disabledTaskSyncGenerators})]}]}});var o=n(1588),s=function(){return s=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var a in t=arguments[n])Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a]);return e},s.apply(this,arguments)};var l=n(942),c=n(3257),u=n(9531),d=n(8844),p=n.n(d);function h(e){return"function"==typeof e?e():e}function m(e,t){try{return JSON.stringify(e,t)}catch(n){return p()(e,t)}}function f(e,t,n){var r,a,i={};try{for(var o=function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}(t),l=o.next();!l.done;l=o.next()){var c=l.value;i[c]=e[c]}}catch(d){r={error:d}}finally{try{l&&!l.done&&(a=o.return)&&a.call(o)}finally{if(r)throw r.error}}var u=JSON.parse(m(i,n));return m(s(s({},e),u))}function g(e,t){e.machine,e.configuration,e.history;var n=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var a=0;for(r=Object.getOwnPropertySymbols(e);a<r.length;a++)t.indexOf(r[a])<0&&Object.prototype.propertyIsEnumerable.call(e,r[a])&&(n[r[a]]=e[r[a]])}return n}(e,["machine","configuration","history"]);return f(n,["context","event","_event"],t)}function _(e,t){return f(e.definition,["context"],t)}var v=new Map;var y,b={url:"https://stately.ai/viz?inspect",iframe:function(){return document.querySelector("iframe[data-xstate]")},devTools:function(){var e,t,n=(e=new Set,t=new Set,{services:e,register:function(n){e.add(n),v.set(n.sessionId,n),t.forEach(function(e){return e(n)}),n.onStop(function(){e.delete(n),v.delete(n.sessionId)})},unregister:function(t){e.delete(t),v.delete(t.sessionId)},onRegister:function(n){return t.add(n),e.forEach(function(e){return n(e)}),{unsubscribe:function(){t.delete(n)}}}});return globalThis.__xstate__=n,n},serialize:void 0},E=new Set;function S(){return S=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},S.apply(this,arguments)}!function(e){e.Pop="POP",e.Push="PUSH",e.Replace="REPLACE"}(y||(y={}));const C="popstate";function T(e,t){if(!1===e||null==e)throw new Error(t)}function x(e,t){if(!e){"undefined"!=typeof console&&console.warn(t);try{throw new Error(t)}catch(n){}}}function w(e,t){return{usr:e.state,key:e.key,idx:t}}function N(e,t,n,r){return void 0===n&&(n=null),S({pathname:"string"==typeof e?e:e.pathname,search:"",hash:""},"string"==typeof t?I(t):t,{state:n,key:t&&t.key||r||Math.random().toString(36).substr(2,8)})}function O(e){let{pathname:t="/",search:n="",hash:r=""}=e;return n&&"?"!==n&&(t+="?"===n.charAt(0)?n:"?"+n),r&&"#"!==r&&(t+="#"===r.charAt(0)?r:"#"+r),t}function I(e){let t={};if(e){let n=e.indexOf("#");n>=0&&(t.hash=e.substr(n),e=e.substr(0,n));let r=e.indexOf("?");r>=0&&(t.search=e.substr(r),e=e.substr(0,r)),e&&(t.pathname=e)}return t}function A(e,t,n,r){void 0===r&&(r={});let{window:a=document.defaultView,v5Compat:i=!1}=r,o=a.history,s=y.Pop,l=null,c=u();function u(){return(o.state||{idx:null}).idx}function d(){s=y.Pop;let e=u(),t=null==e?null:e-c;c=e,l&&l({action:s,location:h.location,delta:t})}function p(e){let t="null"!==a.location.origin?a.location.origin:a.location.href,n="string"==typeof e?e:O(e);return n=n.replace(/ $/,"%20"),T(t,"No window.location.(origin|href) available to create URL for href: "+n),new URL(n,t)}null==c&&(c=0,o.replaceState(S({},o.state,{idx:c}),""));let h={get action(){return s},get location(){return e(a,o)},listen(e){if(l)throw new Error("A history only accepts one active listener");return a.addEventListener(C,d),l=e,()=>{a.removeEventListener(C,d),l=null}},createHref:e=>t(a,e),createURL:p,encodeLocation(e){let t=p(e);return{pathname:t.pathname,search:t.search,hash:t.hash}},push:function(e,t){s=y.Push;let r=N(h.location,e,t);n&&n(r,e),c=u()+1;let d=w(r,c),p=h.createHref(r);try{o.pushState(d,"",p)}catch(m){if(m instanceof DOMException&&"DataCloneError"===m.name)throw m;a.location.assign(p)}i&&l&&l({action:s,location:h.location,delta:1})},replace:function(e,t){s=y.Replace;let r=N(h.location,e,t);n&&n(r,e),c=u();let a=w(r,c),d=h.createHref(r);o.replaceState(a,"",d),i&&l&&l({action:s,location:h.location,delta:0})},go:e=>o.go(e)};return h}var D;!function(e){e.data="data",e.deferred="deferred",e.redirect="redirect",e.error="error"}(D||(D={}));const M=new Set(["lazy","caseSensitive","path","id","index","children"]);function k(e,t,n,r){return void 0===n&&(n=[]),void 0===r&&(r={}),e.map((e,a)=>{let i=[...n,String(a)],o="string"==typeof e.id?e.id:i.join("-");if(T(!0!==e.index||!e.children,"Cannot specify children on an index route"),T(!r[o],'Found a route id collision on id "'+o+"\". Route id's must be globally unique within Data Router usages"),function(e){return!0===e.index}(e)){let n=S({},e,t(e),{id:o});return r[o]=n,n}{let n=S({},e,t(e),{id:o,children:void 0});return r[o]=n,e.children&&(n.children=k(e.children,t,i,r)),n}})}function L(e,t,n){return void 0===n&&(n="/"),P(e,t,n,!1)}function P(e,t,n,r){let a=q(("string"==typeof t?I(t):t).pathname||"/",n);if(null==a)return null;let i=B(e);!function(e){e.sort((e,t)=>e.score!==t.score?t.score-e.score:function(e,t){let n=e.length===t.length&&e.slice(0,-1).every((e,n)=>e===t[n]);return n?e[e.length-1]-t[t.length-1]:0}(e.routesMeta.map(e=>e.childrenIndex),t.routesMeta.map(e=>e.childrenIndex)))}(i);let o=null;for(let s=0;null==o&&s<i.length;++s){let e=Y(a);o=H(i[s],e,r)}return o}function F(e,t){let{route:n,pathname:r,params:a}=e;return{id:n.id,pathname:r,params:a,data:t[n.id],handle:n.handle}}function B(e,t,n,r){void 0===t&&(t=[]),void 0===n&&(n=[]),void 0===r&&(r="");let a=(e,a,i)=>{let o={relativePath:void 0===i?e.path||"":i,caseSensitive:!0===e.caseSensitive,childrenIndex:a,route:e};o.relativePath.startsWith("/")&&(T(o.relativePath.startsWith(r),'Absolute route path "'+o.relativePath+'" nested under path "'+r+'" is not valid. An absolute child route path must start with the combined path of all its parent routes.'),o.relativePath=o.relativePath.slice(r.length));let s=te([r,o.relativePath]),l=n.concat(o);e.children&&e.children.length>0&&(T(!0!==e.index,'Index routes must not have child routes. Please remove all child routes from route path "'+s+'".'),B(e.children,t,l,s)),(null!=e.path||e.index)&&t.push({path:s,score:z(s,e.index),routesMeta:l})};return e.forEach((e,t)=>{var n;if(""!==e.path&&null!=(n=e.path)&&n.includes("?"))for(let r of U(e.path))a(e,t,r);else a(e,t)}),t}function U(e){let t=e.split("/");if(0===t.length)return[];let[n,...r]=t,a=n.endsWith("?"),i=n.replace(/\?$/,"");if(0===r.length)return a?[i,""]:[i];let o=U(r.join("/")),s=[];return s.push(...o.map(e=>""===e?i:[i,e].join("/"))),a&&s.push(...o),s.map(t=>e.startsWith("/")&&""===t?"/":t)}const G=/^:[\w-]+$/,j=e=>"*"===e;function z(e,t){let n=e.split("/"),r=n.length;return n.some(j)&&(r+=-2),t&&(r+=2),n.filter(e=>!j(e)).reduce((e,t)=>e+(G.test(t)?3:""===t?1:10),r)}function H(e,t,n){void 0===n&&(n=!1);let{routesMeta:r}=e,a={},i="/",o=[];for(let s=0;s<r.length;++s){let e=r[s],l=s===r.length-1,c="/"===i?t:t.slice(i.length)||"/",u=V({path:e.relativePath,caseSensitive:e.caseSensitive,end:l},c),d=e.route;if(!u&&l&&n&&!r[r.length-1].route.index&&(u=V({path:e.relativePath,caseSensitive:e.caseSensitive,end:!1},c)),!u)return null;Object.assign(a,u.params),o.push({params:a,pathname:te([i,u.pathname]),pathnameBase:ne(te([i,u.pathnameBase])),route:d}),"/"!==u.pathnameBase&&(i=te([i,u.pathnameBase]))}return o}function V(e,t){"string"==typeof e&&(e={path:e,caseSensitive:!1,end:!0});let[n,r]=function(e,t,n){void 0===t&&(t=!1);void 0===n&&(n=!0);x("*"===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=[],a="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(e,t,n)=>(r.push({paramName:t,isOptional:null!=n}),n?"/?([^\\/]+)?":"/([^\\/]+)"));e.endsWith("*")?(r.push({paramName:"*"}),a+="*"===e||"/*"===e?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?a+="\\/*$":""!==e&&"/"!==e&&(a+="(?:(?=\\/|$))");let i=new RegExp(a,t?void 0:"i");return[i,r]}(e.path,e.caseSensitive,e.end),a=t.match(n);if(!a)return null;let i=a[0],o=i.replace(/(.)\/+$/,"$1"),s=a.slice(1),l=r.reduce((e,t,n)=>{let{paramName:r,isOptional:a}=t;if("*"===r){let e=s[n]||"";o=i.slice(0,i.length-e.length).replace(/(.)\/+$/,"$1")}const l=s[n];return e[r]=a&&!l?void 0:(l||"").replace(/%2F/g,"/"),e},{});return{params:l,pathname:i,pathnameBase:o,pattern:e}}function Y(e){try{return e.split("/").map(e=>decodeURIComponent(e).replace(/\//g,"%2F")).join("/")}catch(t){return x(!1,'The URL path "'+e+'" could not be decoded because it is is a malformed URL segment. This is probably due to a bad percent encoding ('+t+")."),e}}function q(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)||"/"}const $=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;function K(e,t){void 0===t&&(t="/");let n,{pathname:r,search:a="",hash:i=""}="string"==typeof e?I(e):e;if(r)if(o=r,$.test(o))n=r;else{if(r.includes("//")){let e=r;r=r.replace(/\/\/+/g,"/"),x(!1,"Pathnames cannot have embedded double slashes - normalizing "+e+" -> "+r)}n=r.startsWith("/")?X(r.substring(1),"/"):X(r,t)}else n=t;var o;return{pathname:n,search:re(a),hash:ae(i)}}function X(e,t){let n=t.replace(/\/+$/,"").split("/");return e.split("/").forEach(e=>{".."===e?n.length>1&&n.pop():"."!==e&&n.push(e)}),n.length>1?n.join("/"):"/"}function Q(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 Z(e){return e.filter((e,t)=>0===t||e.route.path&&e.route.path.length>0)}function J(e,t){let n=Z(e);return t?n.map((e,t)=>t===n.length-1?e.pathname:e.pathnameBase):n.map(e=>e.pathnameBase)}function ee(e,t,n,r){let a;void 0===r&&(r=!1),"string"==typeof e?a=I(e):(a=S({},e),T(!a.pathname||!a.pathname.includes("?"),Q("?","pathname","search",a)),T(!a.pathname||!a.pathname.includes("#"),Q("#","pathname","hash",a)),T(!a.search||!a.search.includes("#"),Q("#","search","hash",a)));let i,o=""===e||""===a.pathname,s=o?"/":a.pathname;if(null==s)i=n;else{let e=t.length-1;if(!r&&s.startsWith("..")){let t=s.split("/");for(;".."===t[0];)t.shift(),e-=1;a.pathname=t.join("/")}i=e>=0?t[e]:"/"}let l=K(a,i),c=s&&"/"!==s&&s.endsWith("/"),u=(o||"."===s)&&n.endsWith("/");return l.pathname.endsWith("/")||!c&&!u||(l.pathname+="/"),l}const te=e=>e.join("/").replace(/\/\/+/g,"/"),ne=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),re=e=>e&&"?"!==e?e.startsWith("?")?e:"?"+e:"",ae=e=>e&&"#"!==e?e.startsWith("#")?e:"#"+e:"";Error;const se=function(e,t){void 0===t&&(t=302);let n=t;"number"==typeof n?n={status:n}:void 0===n.status&&(n.status=302);let r=new Headers(n.headers);return r.set("Location",e),new Response(null,S({},n,{headers:r}))};class ErrorResponseImpl{constructor(e,t,n,r){void 0===r&&(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 le(e){return null!=e&&"number"==typeof e.status&&"string"==typeof e.statusText&&"boolean"==typeof e.internal&&"data"in e}const ue=["post","put","patch","delete"],de=new Set(ue),pe=["get",...ue],he=new Set(pe),me=new Set([301,302,303,307,308]),fe=new Set([307,308]),ge={state:"idle",location:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0},_e={state:"idle",data:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0},ve={state:"unblocked",proceed:void 0,reset:void 0,location:void 0},ye=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,be=e=>({hasErrorBoundary:Boolean(e.hasErrorBoundary)}),Ee="remix-router-transitions";function Se(e){const t=e.window?e.window:"undefined"!=typeof window?window:void 0,n=void 0!==t&&void 0!==t.document&&void 0!==t.document.createElement,r=!n;let a;if(T(e.routes.length>0,"You must provide a non-empty routes array to createRouter"),e.mapRouteProperties)a=e.mapRouteProperties;else if(e.detectErrorBoundary){let t=e.detectErrorBoundary;a=e=>({hasErrorBoundary:t(e)})}else a=be;let i,o,s,l={},c=k(e.routes,a,void 0,l),u=e.basename||"/",d=e.dataStrategy||De,p=e.patchRoutesOnNavigation,h=S({v7_fetcherPersist:!1,v7_normalizeFormMethod:!1,v7_partialHydration:!1,v7_prependBasename:!1,v7_relativeSplatPath:!1,v7_skipActionErrorRevalidation:!1},e.future),m=null,f=new Set,g=null,_=null,v=null,b=null!=e.hydrationData,E=L(c,e.history.location,u),C=!1,w=null;if(null==E&&!p){let t=qe(404,{pathname:e.history.location.pathname}),{matches:n,route:r}=Ye(c);E=n,w={[r.id]:t}}if(E&&!e.hydrationData){ft(E,c,e.history.location.pathname).active&&(E=null)}if(E)if(E.some(e=>e.route.lazy))o=!1;else if(E.some(e=>e.route.loader))if(h.v7_partialHydration){let t=e.hydrationData?e.hydrationData.loaderData:null,n=e.hydrationData?e.hydrationData.errors:null;if(n){let e=E.findIndex(e=>void 0!==n[e.route.id]);o=E.slice(0,e+1).every(e=>!Ne(e.route,t,n))}else o=E.every(e=>!Ne(e.route,t,n))}else o=null!=e.hydrationData;else o=!0;else if(o=!1,E=[],h.v7_partialHydration){let t=ft(null,c,e.history.location.pathname);t.active&&t.matches&&(C=!0,E=t.matches)}let O,I,A={historyAction:e.history.action,location:e.history.location,matches:E,initialized:o,navigation:ge,restoreScrollPosition:null==e.hydrationData&&null,preventScrollReset:!1,revalidation:"idle",loaderData:e.hydrationData&&e.hydrationData.loaderData||{},actionData:e.hydrationData&&e.hydrationData.actionData||null,errors:e.hydrationData&&e.hydrationData.errors||w,fetchers:new Map,blockers:new Map},M=y.Pop,B=!1,U=!1,G=new Map,j=null,z=!1,H=!1,V=[],Y=new Set,$=new Map,K=0,X=-1,Q=new Map,Z=new Set,J=new Map,ee=new Map,te=new Set,ne=new Map,re=new Map;function ae(e,t){void 0===t&&(t={}),A=S({},A,e);let n=[],r=[];h.v7_fetcherPersist&&A.fetchers.forEach((e,t)=>{"idle"===e.state&&(te.has(t)?r.push(t):n.push(t))}),te.forEach(e=>{A.fetchers.has(e)||$.has(e)||r.push(e)}),[...f].forEach(e=>e(A,{deletedFetchers:r,viewTransitionOpts:t.viewTransitionOpts,flushSync:!0===t.flushSync})),h.v7_fetcherPersist?(n.forEach(e=>A.fetchers.delete(e)),r.forEach(e=>Ae(e))):r.forEach(e=>te.delete(e))}function se(t,n,r){var a,o;let s,{flushSync:l}=void 0===r?{}:r,u=null!=A.actionData&&null!=A.navigation.formMethod&&nt(A.navigation.formMethod)&&"loading"===A.navigation.state&&!0!==(null==(a=t.state)?void 0:a._isRedirect);s=n.actionData?Object.keys(n.actionData).length>0?n.actionData:null:u?A.actionData:null;let d=n.loaderData?ze(A.loaderData,n.loaderData,n.matches||[],n.errors):A.loaderData,p=A.blockers;p.size>0&&(p=new Map(p),p.forEach((e,t)=>p.set(t,ve)));let h,m=!0===B||null!=A.navigation.formMethod&&nt(A.navigation.formMethod)&&!0!==(null==(o=t.state)?void 0:o._isRedirect);if(i&&(c=i,i=void 0),z||M===y.Pop||(M===y.Push?e.history.push(t,t.state):M===y.Replace&&e.history.replace(t,t.state)),M===y.Pop){let e=G.get(A.location.pathname);e&&e.has(t.pathname)?h={currentLocation:A.location,nextLocation:t}:G.has(t.pathname)&&(h={currentLocation:t,nextLocation:A.location})}else if(U){let e=G.get(A.location.pathname);e?e.add(t.pathname):(e=new Set([t.pathname]),G.set(A.location.pathname,e)),h={currentLocation:A.location,nextLocation:t}}ae(S({},n,{actionData:s,loaderData:d,historyAction:M,location:t,initialized:!0,navigation:ge,revalidation:"idle",restoreScrollPosition:mt(t,n.matches||A.matches),preventScrollReset:m,blockers:p}),{viewTransitionOpts:h,flushSync:!0===l}),M=y.Pop,B=!1,U=!1,z=!1,H=!1,V=[]}async function ue(t,n,r){O&&O.abort(),O=null,M=t,z=!0===(r&&r.startUninterruptedRevalidation),function(e,t){if(g&&v){let n=ht(e,t);g[n]=v()}}(A.location,A.matches),B=!0===(r&&r.preventScrollReset),U=!0===(r&&r.enableViewTransition);let a=i||c,o=r&&r.overrideNavigation,s=null!=r&&r.initialHydration&&A.matches&&A.matches.length>0&&!C?A.matches:L(a,n,u),l=!0===(r&&r.flushSync);if(s&&A.initialized&&!H&&function(e,t){if(e.pathname!==t.pathname||e.search!==t.search)return!1;if(""===e.hash)return""!==t.hash;if(e.hash===t.hash)return!0;if(""!==t.hash)return!0;return!1}(A.location,n)&&!(r&&r.submission&&nt(r.submission.formMethod)))return void se(n,{matches:s},{flushSync:l});let d=ft(s,a,n.pathname);if(d.active&&d.matches&&(s=d.matches),!s){let{error:e,notFoundMatches:t,route:r}=ot(n.pathname);return void se(n,{matches:t,loaderData:{},errors:{[r.id]:e}},{flushSync:l})}O=new AbortController;let p,m=Fe(e.history,n,O.signal,r&&r.submission);if(r&&r.pendingError)p=[Ve(s).route.id,{type:D.error,error:r.pendingError}];else if(r&&r.submission&&nt(r.submission.formMethod)){let t=await async function(t,n,r,a,i,o){void 0===o&&(o={});Se();let s,l=function(e,t){let n={state:"submitting",location:e,formMethod:t.formMethod,formAction:t.formAction,formEncType:t.formEncType,formData:t.formData,json:t.json,text:t.text};return n}(n,r);if(ae({navigation:l},{flushSync:!0===o.flushSync}),i){let e=await gt(a,n.pathname,t.signal);if("aborted"===e.type)return{shortCircuited:!0};if("error"===e.type){let t=Ve(e.partialMatches).route.id;return{matches:e.partialMatches,pendingActionResult:[t,{type:D.error,error:e.error}]}}if(!e.matches){let{notFoundMatches:e,error:t,route:r}=ot(n.pathname);return{matches:e,pendingActionResult:[r.id,{type:D.error,error:t}]}}a=e.matches}let c=st(a,n);if(c.route.action||c.route.lazy){if(s=(await he("action",A,t,[c],a,null))[c.route.id],t.signal.aborted)return{shortCircuited:!0}}else s={type:D.error,error:qe(405,{method:t.method,pathname:n.pathname,routeId:c.route.id})};if(Ze(s)){let n;if(o&&null!=o.replace)n=o.replace;else{n=Pe(s.response.headers.get("Location"),new URL(t.url),u,e.history)===A.location.pathname+A.location.search}return await pe(t,s,!0,{submission:r,replace:n}),{shortCircuited:!0}}if(Xe(s))throw qe(400,{type:"defer-action"});if(Qe(s)){let e=Ve(a,c.route.id);return!0!==(o&&o.replace)&&(M=y.Push),{matches:a,pendingActionResult:[e.route.id,s]}}return{matches:a,pendingActionResult:[c.route.id,s]}}(m,n,r.submission,s,d.active,{replace:r.replace,flushSync:l});if(t.shortCircuited)return;if(t.pendingActionResult){let[e,r]=t.pendingActionResult;if(Qe(r)&&le(r.error)&&404===r.error.status)return O=null,void se(n,{matches:t.matches,loaderData:{},errors:{[e]:r.error}})}s=t.matches||s,p=t.pendingActionResult,o=ct(n,r.submission),l=!1,d.active=!1,m=Fe(e.history,m.url,m.signal)}let{shortCircuited:f,matches:_,loaderData:b,errors:E}=await async function(t,n,r,a,o,s,l,d,p,m,f){let g=o||ct(n,s),_=s||l||lt(g),v=!(z||h.v7_partialHydration&&p);if(a){if(v){let e=de(f);ae(S({navigation:g},void 0!==e?{actionData:e}:{}),{flushSync:m})}let e=await gt(r,n.pathname,t.signal);if("aborted"===e.type)return{shortCircuited:!0};if("error"===e.type){let t=Ve(e.partialMatches).route.id;return{matches:e.partialMatches,loaderData:{},errors:{[t]:e.error}}}if(!e.matches){let{error:e,notFoundMatches:t,route:r}=ot(n.pathname);return{matches:t,loaderData:{},errors:{[r.id]:e}}}r=e.matches}let y=i||c,[b,E]=we(e.history,A,r,_,n,h.v7_partialHydration&&!0===p,h.v7_skipActionErrorRevalidation,H,V,Y,te,J,Z,y,u,f);if(pt(e=>!(r&&r.some(t=>t.route.id===e))||b&&b.some(t=>t.route.id===e)),X=++K,0===b.length&&0===E.length){let e=Ge();return se(n,S({matches:r,loaderData:{},errors:f&&Qe(f[1])?{[f[0]]:f[1].error}:null},He(f),e?{fetchers:new Map(A.fetchers)}:{}),{flushSync:m}),{shortCircuited:!0}}if(v){let e={};if(!a){e.navigation=g;let t=de(f);void 0!==t&&(e.actionData=t)}E.length>0&&(e.fetchers=function(e){return e.forEach(e=>{let t=A.fetchers.get(e.key),n=ut(void 0,t?t.data:void 0);A.fetchers.set(e.key,n)}),new Map(A.fetchers)}(E)),ae(e,{flushSync:m})}E.forEach(e=>{Be(e.key),e.controller&&$.set(e.key,e.controller)});let C=()=>E.forEach(e=>Be(e.key));O&&O.signal.addEventListener("abort",C);let{loaderResults:T,fetcherResults:x}=await me(A,r,b,E,t);if(t.signal.aborted)return{shortCircuited:!0};O&&O.signal.removeEventListener("abort",C);E.forEach(e=>$.delete(e.key));let w=We(T);if(w)return await pe(t,w.result,!0,{replace:d}),{shortCircuited:!0};if(w=We(x),w)return Z.add(w.key),await pe(t,w.result,!0,{replace:d}),{shortCircuited:!0};let{loaderData:N,errors:I}=je(A,r,T,f,E,x,ne);ne.forEach((e,t)=>{e.subscribe(n=>{(n||e.done)&&ne.delete(t)})}),h.v7_partialHydration&&p&&A.errors&&(I=S({},A.errors,I));let D=Ge(),M=$e(X),k=D||M||E.length>0;return S({matches:r,loaderData:N,errors:I},k?{fetchers:new Map(A.fetchers)}:{})}(m,n,s,d.active,o,r&&r.submission,r&&r.fetcherSubmission,r&&r.replace,r&&!0===r.initialHydration,l,p);f||(O=null,se(n,S({matches:_||s},He(p),{loaderData:b,errors:E})))}function de(e){return e&&!Qe(e[1])?{[e[0]]:e[1].data}:A.actionData?0===Object.keys(A.actionData).length?null:A.actionData:void 0}async function pe(r,a,i,o){let{submission:s,fetcherSubmission:l,preventScrollReset:c,replace:d}=void 0===o?{}:o;a.response.headers.has("X-Remix-Revalidate")&&(H=!0);let p=a.response.headers.get("Location");T(p,"Expected a Location header on the redirect Response"),p=Pe(p,new URL(r.url),u,e.history);let h=N(A.location,p,{_isRedirect:!0});if(n){let n=!1;if(a.response.headers.has("X-Remix-Reload-Document"))n=!0;else if(ye.test(p)){const r=e.history.createURL(p);n=r.origin!==t.location.origin||null==q(r.pathname,u)}if(n)return void(d?t.location.replace(p):t.location.assign(p))}O=null;let m=!0===d||a.response.headers.has("X-Remix-Replace")?y.Replace:y.Push,{formMethod:f,formAction:g,formEncType:_}=A.navigation;!s&&!l&&f&&g&&_&&(s=lt(A.navigation));let v=s||l;if(fe.has(a.response.status)&&v&&nt(v.formMethod))await ue(m,h,{submission:S({},v,{formAction:p}),preventScrollReset:c||B,enableViewTransition:i?U:void 0});else{let e=ct(h,s);await ue(m,h,{overrideNavigation:e,fetcherSubmission:l,preventScrollReset:c||B,enableViewTransition:i?U:void 0})}}async function he(e,t,n,r,i,o){let s,c={};try{s=await Me(d,e,t,n,r,i,o,l,a)}catch(p){return r.forEach(e=>{c[e.route.id]={type:D.error,error:p}}),c}for(let[a,l]of Object.entries(s))if(Ke(l)){let e=l.result;c[a]={type:D.redirect,response:Le(e,n,a,i,u,h.v7_relativeSplatPath)}}else c[a]=await ke(l);return c}async function me(t,n,r,a,i){let o=t.matches,s=he("loader",t,i,r,n,null),l=Promise.all(a.map(async n=>{if(n.matches&&n.match&&n.controller){let r=(await he("loader",t,Fe(e.history,n.path,n.controller.signal),[n.match],n.matches,n.key))[n.match.route.id];return{[n.key]:r}}return Promise.resolve({[n.key]:{type:D.error,error:qe(404,{pathname:n.path})}})})),c=await s,u=(await l).reduce((e,t)=>Object.assign(e,t),{});return await Promise.all([rt(n,c,i.signal,o,t.loaderData),at(n,u,a)]),{loaderResults:c,fetcherResults:u}}function Se(){H=!0,V.push(...pt()),J.forEach((e,t)=>{$.has(t)&&Y.add(t),Be(t)})}function xe(e,t,n){void 0===n&&(n={}),A.fetchers.set(e,t),ae({fetchers:new Map(A.fetchers)},{flushSync:!0===(n&&n.flushSync)})}function Re(e,t,n,r){void 0===r&&(r={});let a=Ve(A.matches,t);Ae(e),ae({errors:{[a.route.id]:n},fetchers:new Map(A.fetchers)},{flushSync:!0===(r&&r.flushSync)})}function Oe(e){return ee.set(e,(ee.get(e)||0)+1),te.has(e)&&te.delete(e),A.fetchers.get(e)||_e}function Ae(e){let t=A.fetchers.get(e);!$.has(e)||t&&"loading"===t.state&&Q.has(e)||Be(e),J.delete(e),Q.delete(e),Z.delete(e),h.v7_fetcherPersist&&te.delete(e),Y.delete(e),A.fetchers.delete(e)}function Be(e){let t=$.get(e);t&&(t.abort(),$.delete(e))}function Ue(e){for(let t of e){let e=dt(Oe(t).data);A.fetchers.set(t,e)}}function Ge(){let e=[],t=!1;for(let n of Z){let r=A.fetchers.get(n);T(r,"Expected fetcher: "+n),"loading"===r.state&&(Z.delete(n),e.push(n),t=!0)}return Ue(e),t}function $e(e){let t=[];for(let[n,r]of Q)if(r<e){let e=A.fetchers.get(n);T(e,"Expected fetcher: "+n),"loading"===e.state&&(Be(n),Q.delete(n),t.push(n))}return Ue(t),t.length>0}function Je(e){A.blockers.delete(e),re.delete(e)}function et(e,t){let n=A.blockers.get(e)||ve;T("unblocked"===n.state&&"blocked"===t.state||"blocked"===n.state&&"blocked"===t.state||"blocked"===n.state&&"proceeding"===t.state||"blocked"===n.state&&"unblocked"===t.state||"proceeding"===n.state&&"unblocked"===t.state,"Invalid blocker state transition: "+n.state+" -> "+t.state);let r=new Map(A.blockers);r.set(e,t),ae({blockers:r})}function tt(e){let{currentLocation:t,nextLocation:n,historyAction:r}=e;if(0===re.size)return;re.size>1&&x(!1,"A router only supports one blocker at a time");let a=Array.from(re.entries()),[i,o]=a[a.length-1],s=A.blockers.get(i);return s&&"proceeding"===s.state?void 0:o({currentLocation:t,nextLocation:n,historyAction:r})?i:void 0}function ot(e){let t=qe(404,{pathname:e}),n=i||c,{matches:r,route:a}=Ye(n);return pt(),{notFoundMatches:r,route:a,error:t}}function pt(e){let t=[];return ne.forEach((n,r)=>{e&&!e(r)||(n.cancel(),t.push(r),ne.delete(r))}),t}function ht(e,t){if(_){let n=_(e,t.map(e=>F(e,A.loaderData)));return n||e.key}return e.key}function mt(e,t){if(g){let n=ht(e,t),r=g[n];if("number"==typeof r)return r}return null}function ft(e,t,n){if(p){if(!e){return{active:!0,matches:P(t,n,u,!0)||[]}}if(Object.keys(e[0].params).length>0){return{active:!0,matches:P(t,n,u,!0)}}}return{active:!1,matches:null}}async function gt(e,t,n,r){if(!p)return{type:"success",matches:e};let o=e;for(;;){let e=null==i,d=i||c,h=l;try{await p({signal:n,path:t,matches:o,fetcherKey:r,patch:(e,t)=>{n.aborted||Ie(e,t,d,h,a)}})}catch(s){return{type:"error",error:s,partialMatches:o}}finally{e&&!n.aborted&&(c=[...c])}if(n.aborted)return{type:"aborted"};let m=L(d,t,u);if(m)return{type:"success",matches:m};let f=P(d,t,u,!0);if(!f||o.length===f.length&&o.every((e,t)=>e.route.id===f[t].route.id))return{type:"success",matches:null};o=f}}return s={get basename(){return u},get future(){return h},get state(){return A},get routes(){return c},get window(){return t},initialize:function(){if(m=e.history.listen(t=>{let{action:n,location:r,delta:a}=t;if(I)return I(),void(I=void 0);x(0===re.size||null!=a,"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=tt({currentLocation:A.location,nextLocation:r,historyAction:n});if(i&&null!=a){let t=new Promise(e=>{I=e});return e.history.go(-1*a),void et(i,{state:"blocked",location:r,proceed(){et(i,{state:"proceeding",proceed:void 0,reset:void 0,location:r}),t.then(()=>e.history.go(a))},reset(){let e=new Map(A.blockers);e.set(i,ve),ae({blockers:e})}})}return ue(n,r)}),n){!function(e,t){try{let n=e.sessionStorage.getItem(Ee);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(n){}}(t,G);let e=()=>function(e,t){if(t.size>0){let r={};for(let[e,n]of t)r[e]=[...n];try{e.sessionStorage.setItem(Ee,JSON.stringify(r))}catch(n){x(!1,"Failed to save applied view transitions in sessionStorage ("+n+").")}}}(t,G);t.addEventListener("pagehide",e),j=()=>t.removeEventListener("pagehide",e)}return A.initialized||ue(y.Pop,A.location,{initialHydration:!0}),s},subscribe:function(e){return f.add(e),()=>f.delete(e)},enableScrollRestoration:function(e,t,n){if(g=e,v=t,_=n||null,!b&&A.navigation===ge){b=!0;let e=mt(A.location,A.matches);null!=e&&ae({restoreScrollPosition:e})}return()=>{g=null,v=null,_=null}},navigate:async function t(n,r){if("number"==typeof n)return void e.history.go(n);let a=Ce(A.location,A.matches,u,h.v7_prependBasename,n,h.v7_relativeSplatPath,null==r?void 0:r.fromRouteId,null==r?void 0:r.relative),{path:i,submission:o,error:s}=Te(h.v7_normalizeFormMethod,!1,a,r),l=A.location,c=N(A.location,i,r&&r.state);c=S({},c,e.history.encodeLocation(c));let d=r&&null!=r.replace?r.replace:void 0,p=y.Push;!0===d?p=y.Replace:!1===d||null!=o&&nt(o.formMethod)&&o.formAction===A.location.pathname+A.location.search&&(p=y.Replace);let m=r&&"preventScrollReset"in r?!0===r.preventScrollReset:void 0,f=!0===(r&&r.flushSync),g=tt({currentLocation:l,nextLocation:c,historyAction:p});if(!g)return await ue(p,c,{submission:o,pendingError:s,preventScrollReset:m,replace:r&&r.replace,enableViewTransition:r&&r.viewTransition,flushSync:f});et(g,{state:"blocked",location:c,proceed(){et(g,{state:"proceeding",proceed:void 0,reset:void 0,location:c}),t(n,r)},reset(){let e=new Map(A.blockers);e.set(g,ve),ae({blockers:e})}})},fetch:function(t,n,a,o){if(r)throw new Error("router.fetch() was called during the server render, but it shouldn't be. You are likely calling a useFetcher() method in the body of your component. Try moving it to a useEffect or a callback.");Be(t);let s=!0===(o&&o.flushSync),l=i||c,d=Ce(A.location,A.matches,u,h.v7_prependBasename,a,h.v7_relativeSplatPath,n,null==o?void 0:o.relative),p=L(l,d,u),m=ft(p,l,d);if(m.active&&m.matches&&(p=m.matches),!p)return void Re(t,n,qe(404,{pathname:d}),{flushSync:s});let{path:f,submission:g,error:_}=Te(h.v7_normalizeFormMethod,!0,d,o);if(_)return void Re(t,n,_,{flushSync:s});let v=st(p,f),y=!0===(o&&o.preventScrollReset);g&&nt(g.formMethod)?async function(t,n,r,a,o,s,l,d,p){function m(e){if(!e.route.action&&!e.route.lazy){let e=qe(405,{method:p.formMethod,pathname:r,routeId:n});return Re(t,n,e,{flushSync:l}),!0}return!1}if(Se(),J.delete(t),!s&&m(a))return;let f=A.fetchers.get(t);xe(t,function(e,t){let n={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};return n}(p,f),{flushSync:l});let g=new AbortController,_=Fe(e.history,r,g.signal,p);if(s){let e=await gt(o,new URL(_.url).pathname,_.signal,t);if("aborted"===e.type)return;if("error"===e.type)return void Re(t,n,e.error,{flushSync:l});if(!e.matches)return void Re(t,n,qe(404,{pathname:r}),{flushSync:l});if(m(a=st(o=e.matches,r)))return}$.set(t,g);let v=K,y=await he("action",A,_,[a],o,t),b=y[a.route.id];if(_.signal.aborted)return void($.get(t)===g&&$.delete(t));if(h.v7_fetcherPersist&&te.has(t)){if(Ze(b)||Qe(b))return void xe(t,dt(void 0))}else{if(Ze(b))return $.delete(t),X>v?void xe(t,dt(void 0)):(Z.add(t),xe(t,ut(p)),pe(_,b,!1,{fetcherSubmission:p,preventScrollReset:d}));if(Qe(b))return void Re(t,n,b.error)}if(Xe(b))throw qe(400,{type:"defer-action"});let E=A.navigation.location||A.location,S=Fe(e.history,E,g.signal),C=i||c,x="idle"!==A.navigation.state?L(C,A.navigation.location,u):A.matches;T(x,"Didn't find any matches after fetcher action");let w=++K;Q.set(t,w);let N=ut(p,b.data);A.fetchers.set(t,N);let[I,D]=we(e.history,A,x,p,E,!1,h.v7_skipActionErrorRevalidation,H,V,Y,te,J,Z,C,u,[a.route.id,b]);D.filter(e=>e.key!==t).forEach(e=>{let t=e.key,n=A.fetchers.get(t),r=ut(void 0,n?n.data:void 0);A.fetchers.set(t,r),Be(t),e.controller&&$.set(t,e.controller)}),ae({fetchers:new Map(A.fetchers)});let k=()=>D.forEach(e=>Be(e.key));g.signal.addEventListener("abort",k);let{loaderResults:P,fetcherResults:F}=await me(A,x,I,D,S);if(g.signal.aborted)return;g.signal.removeEventListener("abort",k),Q.delete(t),$.delete(t),D.forEach(e=>$.delete(e.key));let B=We(P);if(B)return pe(S,B.result,!1,{preventScrollReset:d});if(B=We(F),B)return Z.add(B.key),pe(S,B.result,!1,{preventScrollReset:d});let{loaderData:U,errors:G}=je(A,x,P,void 0,D,F,ne);if(A.fetchers.has(t)){let e=dt(b.data);A.fetchers.set(t,e)}$e(w),"loading"===A.navigation.state&&w>X?(T(M,"Expected pending action"),O&&O.abort(),se(A.navigation.location,{matches:x,loaderData:U,errors:G,fetchers:new Map(A.fetchers)})):(ae({errors:G,loaderData:ze(A.loaderData,U,x,G),fetchers:new Map(A.fetchers)}),H=!1)}(t,n,f,v,p,m.active,s,y,g):(J.set(t,{routeId:n,path:f}),async function(t,n,r,a,i,o,s,l,c){let u=A.fetchers.get(t);xe(t,ut(c,u?u.data:void 0),{flushSync:s});let d=new AbortController,p=Fe(e.history,r,d.signal);if(o){let e=await gt(i,new URL(p.url).pathname,p.signal,t);if("aborted"===e.type)return;if("error"===e.type)return void Re(t,n,e.error,{flushSync:s});if(!e.matches)return void Re(t,n,qe(404,{pathname:r}),{flushSync:s});a=st(i=e.matches,r)}$.set(t,d);let h=K,m=await he("loader",A,p,[a],i,t),f=m[a.route.id];Xe(f)&&(f=await it(f,p.signal,!0)||f);$.get(t)===d&&$.delete(t);if(p.signal.aborted)return;if(te.has(t))return void xe(t,dt(void 0));if(Ze(f))return X>h?void xe(t,dt(void 0)):(Z.add(t),void(await pe(p,f,!1,{preventScrollReset:l})));if(Qe(f))return void Re(t,n,f.error);T(!Xe(f),"Unhandled fetcher deferred data"),xe(t,dt(f.data))}(t,n,f,v,p,m.active,s,y,g))},revalidate:function(){Se(),ae({revalidation:"loading"}),"submitting"!==A.navigation.state&&("idle"!==A.navigation.state?ue(M||A.historyAction,A.navigation.location,{overrideNavigation:A.navigation,enableViewTransition:!0===U}):ue(A.historyAction,A.location,{startUninterruptedRevalidation:!0}))},createHref:t=>e.history.createHref(t),encodeLocation:t=>e.history.encodeLocation(t),getFetcher:Oe,deleteFetcher:function(e){let t=(ee.get(e)||0)-1;t<=0?(ee.delete(e),te.add(e),h.v7_fetcherPersist||Ae(e)):ee.set(e,t),ae({fetchers:new Map(A.fetchers)})},dispose:function(){m&&m(),j&&j(),f.clear(),O&&O.abort(),A.fetchers.forEach((e,t)=>Ae(t)),A.blockers.forEach((e,t)=>Je(t))},getBlocker:function(e,t){let n=A.blockers.get(e)||ve;return re.get(e)!==t&&re.set(e,t),n},deleteBlocker:Je,patchRoutes:function(e,t){let n=null==i;Ie(e,t,i||c,l,a),n&&(c=[...c],ae({}))},_internalFetchControllers:$,_internalActiveDeferreds:ne,_internalSetRoutes:function(e){l={},i=k(e,a,void 0,l)}},s}Symbol("deferred");function Ce(e,t,n,r,a,i,o,s){let l,c;if(o){l=[];for(let e of t)if(l.push(e),e.route.id===o){c=e;break}}else l=t,c=t[t.length-1];let u=ee(a||".",J(l,i),q(e.pathname,n)||e.pathname,"path"===s);if(null==a&&(u.search=e.search,u.hash=e.hash),(null==a||""===a||"."===a)&&c){let e=ot(u.search);if(c.route.index&&!e)u.search=u.search?u.search.replace(/^\?/,"?index&"):"?index";else if(!c.route.index&&e){let e=new URLSearchParams(u.search),t=e.getAll("index");e.delete("index"),t.filter(e=>e).forEach(t=>e.append("index",t));let n=e.toString();u.search=n?"?"+n:""}}return r&&"/"!==n&&(u.pathname="/"===u.pathname?n:te([n,u.pathname])),O(u)}function Te(e,t,n,r){if(!r||!function(e){return null!=e&&("formData"in e&&null!=e.formData||"body"in e&&void 0!==e.body)}(r))return{path:n};if(r.formMethod&&!tt(r.formMethod))return{path:n,error:qe(405,{method:r.formMethod})};let a,i,o=()=>({path:n,error:qe(400,{type:"invalid-body"})}),s=r.formMethod||"get",l=e?s.toUpperCase():s.toLowerCase(),c=$e(n);if(void 0!==r.body){if("text/plain"===r.formEncType){if(!nt(l))return o();let e="string"==typeof r.body?r.body:r.body instanceof FormData||r.body instanceof URLSearchParams?Array.from(r.body.entries()).reduce((e,t)=>{let[n,r]=t;return""+e+n+"="+r+"\n"},""):String(r.body);return{path:n,submission:{formMethod:l,formAction:c,formEncType:r.formEncType,formData:void 0,json:void 0,text:e}}}if("application/json"===r.formEncType){if(!nt(l))return o();try{let e="string"==typeof r.body?JSON.parse(r.body):r.body;return{path:n,submission:{formMethod:l,formAction:c,formEncType:r.formEncType,formData:void 0,json:e,text:void 0}}}catch(p){return o()}}}if(T("function"==typeof FormData,"FormData is not available in this environment"),r.formData)a=Be(r.formData),i=r.formData;else if(r.body instanceof FormData)a=Be(r.body),i=r.body;else if(r.body instanceof URLSearchParams)a=r.body,i=Ue(a);else if(null==r.body)a=new URLSearchParams,i=new FormData;else try{a=new URLSearchParams(r.body),i=Ue(a)}catch(p){return o()}let u={formMethod:l,formAction:c,formEncType:r&&r.formEncType||"application/x-www-form-urlencoded",formData:i,json:void 0,text:void 0};if(nt(u.formMethod))return{path:n,submission:u};let d=I(n);return t&&d.search&&ot(d.search)&&a.append("index",""),d.search="?"+a,{path:O(d),submission:u}}function xe(e,t,n){void 0===n&&(n=!1);let r=e.findIndex(e=>e.route.id===t);return r>=0?e.slice(0,n?r+1:r):e}function we(e,t,n,r,a,i,o,s,l,c,u,d,p,h,m,f){let g=f?Qe(f[1])?f[1].error:f[1].data:void 0,_=e.createURL(t.location),v=e.createURL(a),y=n;i&&t.errors?y=xe(n,Object.keys(t.errors)[0],!0):f&&Qe(f[1])&&(y=xe(n,f[0]));let b=f?f[1].statusCode:void 0,E=o&&b&&b>=400,C=y.filter((e,n)=>{let{route:a}=e;if(a.lazy)return!0;if(null==a.loader)return!1;if(i)return Ne(a,t.loaderData,t.errors);if(function(e,t,n){let r=!t||n.route.id!==t.route.id,a=void 0===e[n.route.id];return r||a}(t.loaderData,t.matches[n],e)||l.some(t=>t===e.route.id))return!0;let o=t.matches[n],c=e;return Oe(e,S({currentUrl:_,currentParams:o.params,nextUrl:v,nextParams:c.params},r,{actionResult:g,actionStatus:b,defaultShouldRevalidate:!E&&(s||_.pathname+_.search===v.pathname+v.search||_.search!==v.search||Re(o,c))}))}),T=[];return d.forEach((e,a)=>{if(i||!n.some(t=>t.route.id===e.routeId)||u.has(a))return;let o=L(h,e.path,m);if(!o)return void T.push({key:a,routeId:e.routeId,path:e.path,matches:null,match:null,controller:null});let l=t.fetchers.get(a),d=st(o,e.path),f=!1;p.has(a)?f=!1:c.has(a)?(c.delete(a),f=!0):f=l&&"idle"!==l.state&&void 0===l.data?s:Oe(d,S({currentUrl:_,currentParams:t.matches[t.matches.length-1].params,nextUrl:v,nextParams:n[n.length-1].params},r,{actionResult:g,actionStatus:b,defaultShouldRevalidate:!E&&s})),f&&T.push({key:a,routeId:e.routeId,path:e.path,matches:o,match:d,controller:new AbortController})}),[C,T]}function Ne(e,t,n){if(e.lazy)return!0;if(!e.loader)return!1;let r=null!=t&&void 0!==t[e.id],a=null!=n&&void 0!==n[e.id];return!(!r&&a)&&("function"==typeof e.loader&&!0===e.loader.hydrate||!r&&!a)}function Re(e,t){let n=e.route.path;return e.pathname!==t.pathname||null!=n&&n.endsWith("*")&&e.params["*"]!==t.params["*"]}function Oe(e,t){if(e.route.shouldRevalidate){let n=e.route.shouldRevalidate(t);if("boolean"==typeof n)return n}return t.defaultShouldRevalidate}function Ie(e,t,n,r,a){var i;let o;if(e){let t=r[e];T(t,"No route found to patch children into: routeId = "+e),t.children||(t.children=[]),o=t.children}else o=n;let s=k(t.filter(e=>!o.some(t=>Ae(e,t))),a,[e||"_","patch",String((null==(i=o)?void 0:i.length)||"0")],r);o.push(...s)}function Ae(e,t){return"id"in e&&"id"in t&&e.id===t.id||e.index===t.index&&e.path===t.path&&e.caseSensitive===t.caseSensitive&&(!(e.children&&0!==e.children.length||t.children&&0!==t.children.length)||e.children.every((e,n)=>{var r;return null==(r=t.children)?void 0:r.some(t=>Ae(e,t))}))}async function De(e){let{matches:t}=e,n=t.filter(e=>e.shouldLoad),r=await Promise.all(n.map(e=>e.resolve()));return r.reduce((e,t,r)=>Object.assign(e,{[n[r].route.id]:t}),{})}async function Me(e,t,n,r,a,i,o,s,l,c){let u=i.map(e=>e.route.lazy?async function(e,t,n){if(!e.lazy)return;let r=await e.lazy();if(!e.lazy)return;let a=n[e.id];T(a,"No route found in manifest");let i={};for(let o in r){let e=void 0!==a[o]&&"hasErrorBoundary"!==o;x(!e,'Route "'+a.id+'" has a static property "'+o+'" defined but its lazy function is also returning a value for this property. The lazy route property "'+o+'" will be ignored.'),e||M.has(o)||(i[o]=r[o])}Object.assign(a,i),Object.assign(a,S({},t(a),{lazy:void 0}))}(e.route,l,s):void 0),d=i.map((e,n)=>{let i=u[n],o=a.some(t=>t.route.id===e.route.id);return S({},e,{shouldLoad:o,resolve:async n=>(n&&"GET"===r.method&&(e.route.lazy||e.route.loader)&&(o=!0),o?async function(e,t,n,r,a,i){let o,s,l=r=>{let o,l=new Promise((e,t)=>o=t);s=()=>o(),t.signal.addEventListener("abort",s);let c=a=>"function"!=typeof r?Promise.reject(new Error('You cannot call the handler for a route which defines a boolean "'+e+'" [routeId: '+n.route.id+"]")):r({request:t,params:n.params,context:i},...void 0!==a?[a]:[]),u=(async()=>{try{return{type:"data",result:await(a?a(e=>c(e)):c())}}catch(e){return{type:"error",result:e}}})();return Promise.race([u,l])};try{let a=n.route[e];if(r)if(a){let e,[t]=await Promise.all([l(a).catch(t=>{e=t}),r]);if(void 0!==e)throw e;o=t}else{if(await r,a=n.route[e],!a){if("action"===e){let e=new URL(t.url),r=e.pathname+e.search;throw qe(405,{method:t.method,pathname:r,routeId:n.route.id})}return{type:D.data,result:void 0}}o=await l(a)}else{if(!a){let e=new URL(t.url);throw qe(404,{pathname:e.pathname+e.search})}o=await l(a)}T(void 0!==o.result,"You defined "+("action"===e?"an action":"a loader")+' for route "'+n.route.id+"\" but didn't return anything from your `"+e+"` function. Please return a value or `null`.")}catch(c){return{type:D.error,result:c}}finally{s&&t.signal.removeEventListener("abort",s)}return o}(t,r,e,i,n,c):Promise.resolve({type:D.data,result:void 0}))})}),p=await e({matches:d,request:r,params:i[0].params,fetcherKey:o,context:c});try{await Promise.all(u)}catch(h){}return p}async function ke(e){let{result:t,type:n}=e;if(et(t)){let e;try{let n=t.headers.get("Content-Type");e=n&&/\bapplication\/json\b/.test(n)?null==t.body?null:await t.json():await t.text()}catch(d){return{type:D.error,error:d}}return n===D.error?{type:D.error,error:new ErrorResponseImpl(t.status,t.statusText,e),statusCode:t.status,headers:t.headers}:{type:D.data,data:e,statusCode:t.status,headers:t.headers}}var r,a,i,o,s,l,c,u;return n===D.error?Je(t)?t.data instanceof Error?{type:D.error,error:t.data,statusCode:null==(i=t.init)?void 0:i.status,headers:null!=(o=t.init)&&o.headers?new Headers(t.init.headers):void 0}:{type:D.error,error:new ErrorResponseImpl((null==(r=t.init)?void 0:r.status)||500,void 0,t.data),statusCode:le(t)?t.status:void 0,headers:null!=(a=t.init)&&a.headers?new Headers(t.init.headers):void 0}:{type:D.error,error:t,statusCode:le(t)?t.status:void 0}:function(e){let t=e;return t&&"object"==typeof t&&"object"==typeof t.data&&"function"==typeof t.subscribe&&"function"==typeof t.cancel&&"function"==typeof t.resolveData}(t)?{type:D.deferred,deferredData:t,statusCode:null==(s=t.init)?void 0:s.status,headers:(null==(l=t.init)?void 0:l.headers)&&new Headers(t.init.headers)}:Je(t)?{type:D.data,data:t.data,statusCode:null==(c=t.init)?void 0:c.status,headers:null!=(u=t.init)&&u.headers?new Headers(t.init.headers):void 0}:{type:D.data,data:t}}function Le(e,t,n,r,a,i){let o=e.headers.get("Location");if(T(o,"Redirects returned/thrown from loaders/actions must have a Location header"),!ye.test(o)){let s=r.slice(0,r.findIndex(e=>e.route.id===n)+1);o=Ce(new URL(t.url),s,a,!0,o,i),e.headers.set("Location",o)}return e}function Pe(e,t,n,r){let a=["about:","blob:","chrome:","chrome-untrusted:","content:","data:","devtools:","file:","filesystem:","javascript:"];if(ye.test(e)){let r=e,i=r.startsWith("//")?new URL(t.protocol+r):new URL(r);if(a.includes(i.protocol))throw new Error("Invalid redirect location");let o=null!=q(i.pathname,n);if(i.origin===t.origin&&o)return i.pathname+i.search+i.hash}try{let t=r.createURL(e);if(a.includes(t.protocol))throw new Error("Invalid redirect location")}catch(i){}return e}function Fe(e,t,n,r){let a=e.createURL($e(t)).toString(),i={signal:n};if(r&&nt(r.formMethod)){let{formMethod:e,formEncType:t}=r;i.method=e.toUpperCase(),"application/json"===t?(i.headers=new Headers({"Content-Type":t}),i.body=JSON.stringify(r.json)):"text/plain"===t?i.body=r.text:"application/x-www-form-urlencoded"===t&&r.formData?i.body=Be(r.formData):i.body=r.formData}return new Request(a,i)}function Be(e){let t=new URLSearchParams;for(let[n,r]of e.entries())t.append(n,"string"==typeof r?r:r.name);return t}function Ue(e){let t=new FormData;for(let[n,r]of e.entries())t.append(n,r);return t}function Ge(e,t,n,r,a){let i,o={},s=null,l=!1,c={},u=n&&Qe(n[1])?n[1].error:void 0;return e.forEach(n=>{if(!(n.route.id in t))return;let d=n.route.id,p=t[d];if(T(!Ze(p),"Cannot handle redirect results in processLoaderData"),Qe(p)){let t=p.error;if(void 0!==u&&(t=u,u=void 0),s=s||{},a)s[d]=t;else{let n=Ve(e,d);null==s[n.route.id]&&(s[n.route.id]=t)}o[d]=void 0,l||(l=!0,i=le(p.error)?p.error.status:500),p.headers&&(c[d]=p.headers)}else Xe(p)?(r.set(d,p.deferredData),o[d]=p.deferredData.data,null==p.statusCode||200===p.statusCode||l||(i=p.statusCode),p.headers&&(c[d]=p.headers)):(o[d]=p.data,p.statusCode&&200!==p.statusCode&&!l&&(i=p.statusCode),p.headers&&(c[d]=p.headers))}),void 0!==u&&n&&(s={[n[0]]:u},o[n[0]]=void 0),{loaderData:o,errors:s,statusCode:i||200,loaderHeaders:c}}function je(e,t,n,r,a,i,o){let{loaderData:s,errors:l}=Ge(t,n,r,o,!1);return a.forEach(t=>{let{key:n,match:r,controller:a}=t,o=i[n];if(T(o,"Did not find corresponding fetcher result"),!a||!a.signal.aborted)if(Qe(o)){let t=Ve(e.matches,null==r?void 0:r.route.id);l&&l[t.route.id]||(l=S({},l,{[t.route.id]:o.error})),e.fetchers.delete(n)}else if(Ze(o))T(!1,"Unhandled fetcher revalidation redirect");else if(Xe(o))T(!1,"Unhandled fetcher deferred data");else{let t=dt(o.data);e.fetchers.set(n,t)}}),{loaderData:s,errors:l}}function ze(e,t,n,r){let a=S({},t);for(let i of n){let n=i.route.id;if(t.hasOwnProperty(n)?void 0!==t[n]&&(a[n]=t[n]):void 0!==e[n]&&i.route.loader&&(a[n]=e[n]),r&&r.hasOwnProperty(n))break}return a}function He(e){return e?Qe(e[1])?{actionData:{}}:{actionData:{[e[0]]:e[1].data}}:{}}function Ve(e,t){let n=t?e.slice(0,e.findIndex(e=>e.route.id===t)+1):[...e];return n.reverse().find(e=>!0===e.route.hasErrorBoundary)||e[0]}function Ye(e){let t=1===e.length?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 qe(e,t){let{pathname:n,routeId:r,method:a,type:i,message:o}=void 0===t?{}:t,s="Unknown Server Error",l="Unknown @remix-run/router error";return 400===e?(s="Bad Request",a&&n&&r?l="You made a "+a+' request to "'+n+'" but did not provide a `loader` for route "'+r+'", so there is no way to handle the request.':"defer-action"===i?l="defer() is not supported in actions":"invalid-body"===i&&(l="Unable to encode submission body")):403===e?(s="Forbidden",l='Route "'+r+'" does not match URL "'+n+'"'):404===e?(s="Not Found",l='No route matches URL "'+n+'"'):405===e&&(s="Method Not Allowed",a&&n&&r?l="You made a "+a.toUpperCase()+' request to "'+n+'" but did not provide an `action` for route "'+r+'", so there is no way to handle the request.':a&&(l='Invalid request method "'+a.toUpperCase()+'"')),new ErrorResponseImpl(e||500,s,new Error(l),!0)}function We(e){let t=Object.entries(e);for(let n=t.length-1;n>=0;n--){let[e,r]=t[n];if(Ze(r))return{key:e,result:r}}}function $e(e){return O(S({},"string"==typeof e?I(e):e,{hash:""}))}function Ke(e){return et(e.result)&&me.has(e.result.status)}function Xe(e){return e.type===D.deferred}function Qe(e){return e.type===D.error}function Ze(e){return(e&&e.type)===D.redirect}function Je(e){return"object"==typeof e&&null!=e&&"type"in e&&"data"in e&&"init"in e&&"DataWithResponseInit"===e.type}function et(e){return null!=e&&"number"==typeof e.status&&"string"==typeof e.statusText&&"object"==typeof e.headers&&void 0!==e.body}function tt(e){return he.has(e.toLowerCase())}function nt(e){return de.has(e.toLowerCase())}async function rt(e,t,n,r,a){let i=Object.entries(t);for(let o=0;o<i.length;o++){let[s,l]=i[o],c=e.find(e=>(null==e?void 0:e.route.id)===s);if(!c)continue;let u=r.find(e=>e.route.id===c.route.id),d=null!=u&&!Re(u,c)&&void 0!==(a&&a[c.route.id]);Xe(l)&&d&&await it(l,n,!1).then(e=>{e&&(t[s]=e)})}}async function at(e,t,n){for(let r=0;r<n.length;r++){let{key:a,routeId:i,controller:o}=n[r],s=t[a],l=e.find(e=>(null==e?void 0:e.route.id)===i);l&&(Xe(s)&&(T(o,"Expected an AbortController for revalidating fetcher deferred result"),await it(s,o.signal,!0).then(e=>{e&&(t[a]=e)})))}}async function it(e,t,n){if(void 0===n&&(n=!1),!(await e.deferredData.resolveData(t))){if(n)try{return{type:D.data,data:e.deferredData.unwrappedData}}catch(r){return{type:D.error,error:r}}return{type:D.data,data:e.deferredData.data}}}function ot(e){return new URLSearchParams(e).getAll("index").some(e=>""===e)}function st(e,t){let n="string"==typeof t?I(t).search:t.search;if(e[e.length-1].route.index&&ot(n||""))return e[e.length-1];let r=Z(e);return r[r.length-1]}function lt(e){let{formMethod:t,formAction:n,formEncType:r,text:a,formData:i,json:o}=e;if(t&&n&&r)return null!=a?{formMethod:t,formAction:n,formEncType:r,formData:void 0,json:void 0,text:a}:null!=i?{formMethod:t,formAction:n,formEncType:r,formData:i,json:void 0,text:void 0}:void 0!==o?{formMethod:t,formAction:n,formEncType:r,formData:void 0,json:o,text:void 0}:void 0}function ct(e,t){if(t){return{state:"loading",location:e,formMethod:t.formMethod,formAction:t.formAction,formEncType:t.formEncType,formData:t.formData,json:t.json,text:t.text}}return{state:"loading",location:e,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0}}function ut(e,t){if(e){return{state:"loading",formMethod:e.formMethod,formAction:e.formAction,formEncType:e.formEncType,formData:e.formData,json:e.json,text:e.text,data:t}}return{state:"loading",formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0,data:t}}function dt(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 pt(){return pt=Object.assig