@techdocs/cli
Version:
Utility CLI for managing TechDocs sites in Backstage.
1 lines • 52.8 kB
JavaScript
"use strict";(self.webpackChunktechdocs_cli_embedded_app=self.webpackChunktechdocs_cli_embedded_app||[]).push([["183"],{21613(e,t,r){var a,n,o,i;function s(){return(s=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var a in r)Object.prototype.hasOwnProperty.call(r,a)&&(e[a]=r[a])}return e}).apply(this,arguments)}r.d(t,{AO:()=>v,B6:()=>L,G3:()=>ea,Gh:()=>U,HC:()=>V,HS:()=>z,HW:()=>er,Oi:()=>h,Pq:()=>$,RO:()=>k,Rr:()=>y,Sk:()=>K,TM:()=>u,V2:()=>q,VV:()=>J,aE:()=>es,o1:()=>A,pX:()=>Y,pb:()=>j,rc:()=>a,ro:()=>R,sC:()=>d,tH:()=>B,tW:()=>x,ue:()=>S,v6:()=>N,yD:()=>T,zR:()=>c}),(o=a||(a={})).Pop="POP",o.Push="PUSH",o.Replace="REPLACE";let l="popstate";function d(e){let t;void 0===e&&(e={});let{initialEntries:r=["/"],initialIndex:n,v5Compat:o=!1}=e;t=r.map((e,t)=>c(e,"string"==typeof e?null:e.state,0===t?"default":void 0));let i=d(null==n?t.length-1:n),s=a.Pop,l=null;function d(e){return Math.min(Math.max(e,0),t.length-1)}function c(e,r,a){void 0===r&&(r=null);let n=m(t?t[i].pathname:"/",e,r,a);return f("/"===n.pathname.charAt(0),"relative pathnames are not supported in memory history: "+JSON.stringify(e)),n}function u(e){return"string"==typeof e?e:v(e)}return{get index(){return i},get action(){return s},get location(){return t[i]},createHref:u,createURL:e=>new URL(u(e),"http://localhost"),encodeLocation(e){let t="string"==typeof e?y(e):e;return{pathname:t.pathname||"",search:t.search||"",hash:t.hash||""}},push(e,r){s=a.Push;let n=c(e,r);i+=1,t.splice(i,t.length,n),o&&l&&l({action:s,location:n,delta:1})},replace(e,r){s=a.Replace;let n=c(e,r);t[i]=n,o&&l&&l({action:s,location:n,delta:0})},go(e){s=a.Pop;let r=d(i+e),n=t[r];i=r,l&&l({action:s,location:n,delta:e})},listen:e=>(l=e,()=>{l=null})}}function c(e){return void 0===e&&(e={}),g(function(e,t){let{pathname:r,search:a,hash:n}=e.location;return m("",{pathname:r,search:a,hash:n},t.state&&t.state.usr||null,t.state&&t.state.key||"default")},function(e,t){return"string"==typeof t?t:v(t)},null,e)}function u(e){return void 0===e&&(e={}),g(function(e,t){let{pathname:r="/",search:a="",hash:n=""}=y(e.location.hash.substr(1));return r.startsWith("/")||r.startsWith(".")||(r="/"+r),m("",{pathname:r,search:a,hash:n},t.state&&t.state.usr||null,t.state&&t.state.key||"default")},function(e,t){let r=e.document.querySelector("base"),a="";if(r&&r.getAttribute("href")){let t=e.location.href,r=t.indexOf("#");a=-1===r?t:t.slice(0,r)}return a+"#"+("string"==typeof t?t:v(t))},function(e,t){f("/"===e.pathname.charAt(0),"relative pathnames are not supported in hash history.push("+JSON.stringify(t)+")")},e)}function h(e,t){if(!1===e||null==e)throw Error(t)}function f(e,t){if(!e){"u">typeof console&&console.warn(t);try{throw Error(t)}catch(e){}}}function p(e,t){return{usr:e.state,key:e.key,idx:t}}function m(e,t,r,a){return void 0===r&&(r=null),s({pathname:"string"==typeof e?e:e.pathname,search:"",hash:""},"string"==typeof t?y(t):t,{state:r,key:t&&t.key||a||Math.random().toString(36).substr(2,8)})}function v(e){let{pathname:t="/",search:r="",hash:a=""}=e;return r&&"?"!==r&&(t+="?"===r.charAt(0)?r:"?"+r),a&&"#"!==a&&(t+="#"===a.charAt(0)?a:"#"+a),t}function y(e){let t={};if(e){let r=e.indexOf("#");r>=0&&(t.hash=e.substr(r),e=e.substr(0,r));let a=e.indexOf("?");a>=0&&(t.search=e.substr(a),e=e.substr(0,a)),e&&(t.pathname=e)}return t}function g(e,t,r,n){void 0===n&&(n={});let{window:o=document.defaultView,v5Compat:i=!1}=n,d=o.history,c=a.Pop,u=null,f=y();function y(){return(d.state||{idx:null}).idx}function g(){c=a.Pop;let e=y(),t=null==e?null:e-f;f=e,u&&u({action:c,location:w.location,delta:t})}function b(e){let t="null"!==o.location.origin?o.location.origin:o.location.href,r="string"==typeof e?e:v(e);return h(t,"No window.location.(origin|href) available to create URL for href: "+(r=r.replace(/ $/,"%20"))),new URL(r,t)}null==f&&(f=0,d.replaceState(s({},d.state,{idx:f}),""));let w={get action(){return c},get location(){return e(o,d)},listen(e){if(u)throw Error("A history only accepts one active listener");return o.addEventListener(l,g),u=e,()=>{o.removeEventListener(l,g),u=null}},createHref:e=>t(o,e),createURL:b,encodeLocation(e){let t=b(e);return{pathname:t.pathname,search:t.search,hash:t.hash}},push:function(e,t){c=a.Push;let n=m(w.location,e,t);r&&r(n,e);let s=p(n,f=y()+1),l=w.createHref(n);try{d.pushState(s,"",l)}catch(e){if(e instanceof DOMException&&"DataCloneError"===e.name)throw e;o.location.assign(l)}i&&u&&u({action:c,location:w.location,delta:1})},replace:function(e,t){c=a.Replace;let n=m(w.location,e,t);r&&r(n,e);let o=p(n,f=y()),s=w.createHref(n);d.replaceState(o,"",s),i&&u&&u({action:c,location:w.location,delta:0})},go:e=>d.go(e)};return w}(i=n||(n={})).data="data",i.deferred="deferred",i.redirect="redirect",i.error="error";let b=new Set(["lazy","caseSensitive","path","id","index","children"]);function w(e,t,r,a){return void 0===r&&(r=[]),void 0===a&&(a={}),e.map((e,n)=>{let o=[...r,String(n)],i="string"==typeof e.id?e.id:o.join("-");if(h(!0!==e.index||!e.children,"Cannot specify children on an index route"),h(!a[i],'Found a route id collision on id "'+i+"\". Route id's must be globally unique within Data Router usages"),!0===e.index){let r=s({},e,t(e),{id:i});return a[i]=r,r}{let r=s({},e,t(e),{id:i,children:void 0});return a[i]=r,e.children&&(r.children=w(e.children,t,o,a)),r}})}function S(e,t,r){return void 0===r&&(r="/"),E(e,t,r,!1)}function E(e,t,r,a){let n=j(("string"==typeof t?y(t):t).pathname||"/",r);if(null==n)return null;let o=function e(t,r,a,n){void 0===r&&(r=[]),void 0===a&&(a=[]),void 0===n&&(n="");let o=(t,o,i)=>{var s,l;let d,c,u={relativePath:void 0===i?t.path||"":i,caseSensitive:!0===t.caseSensitive,childrenIndex:o,route:t};u.relativePath.startsWith("/")&&(h(u.relativePath.startsWith(n),'Absolute route path "'+u.relativePath+'" nested under path "'+n+'" is not valid. An absolute child route path must start with the combined path of all its parent routes.'),u.relativePath=u.relativePath.slice(n.length));let f=z([n,u.relativePath]),p=a.concat(u);t.children&&t.children.length>0&&(h(!0!==t.index,'Index routes must not have child routes. Please remove all child routes from route path "'+f+'".'),e(t.children,r,p,f)),(null!=t.path||t.index)&&r.push({path:f,score:(s=f,l=t.index,c=(d=s.split("/")).length,d.some(P)&&(c+=-2),l&&(c+=2),d.filter(e=>!P(e)).reduce((e,t)=>e+(D.test(t)?3:""===t?1:10),c)),routesMeta:p})};return t.forEach((e,t)=>{var r;if(""!==e.path&&null!=(r=e.path)&&r.includes("?"))for(let r of function e(t){let r=t.split("/");if(0===r.length)return[];let[a,...n]=r,o=a.endsWith("?"),i=a.replace(/\?$/,"");if(0===n.length)return o?[i,""]:[i];let s=e(n.join("/")),l=[];return l.push(...s.map(e=>""===e?i:[i,e].join("/"))),o&&l.push(...s),l.map(e=>t.startsWith("/")&&""===e?"/":e)}(e.path))o(e,t,r);else o(e,t)}),r}(e);o.sort((e,t)=>{var r,a;return e.score!==t.score?t.score-e.score:(r=e.routesMeta.map(e=>e.childrenIndex),a=t.routesMeta.map(e=>e.childrenIndex),r.length===a.length&&r.slice(0,-1).every((e,t)=>e===a[t])?r[r.length-1]-a[a.length-1]:0)});let i=null;for(let e=0;null==i&&e<o.length;++e){let t=k(n);i=function(e,t,r){void 0===r&&(r=!1);let{routesMeta:a}=e,n={},o="/",i=[];for(let e=0;e<a.length;++e){let s=a[e],l=e===a.length-1,d="/"===o?t:t.slice(o.length)||"/",c=L({path:s.relativePath,caseSensitive:s.caseSensitive,end:l},d),u=s.route;if(!c&&l&&r&&!a[a.length-1].route.index&&(c=L({path:s.relativePath,caseSensitive:s.caseSensitive,end:!1},d)),!c)return null;Object.assign(n,c.params),i.push({params:n,pathname:z([o,c.pathname]),pathnameBase:I(z([o,c.pathnameBase])),route:u}),"/"!==c.pathnameBase&&(o=z([o,c.pathnameBase]))}return i}(o[e],t,a)}return i}function R(e,t){let{route:r,pathname:a,params:n}=e;return{id:r.id,pathname:a,params:n,data:t[r.id],handle:r.handle}}let D=/^:[\w-]+$/,P=e=>"*"===e;function x(e,t){void 0===t&&(t={});let r=e;r.endsWith("*")&&"*"!==r&&!r.endsWith("/*")&&(f(!1,'Route path "'+r+'" will be treated as if it were "'+r.replace(/\*$/,"/*")+'" because the `*` character must always follow a `/` in the pattern. To get rid of this warning, please change the route path to "'+r.replace(/\*$/,"/*")+'".'),r=r.replace(/\*$/,"/*"));let a=r.startsWith("/")?"/":"",n=e=>null==e?"":"string"==typeof e?e:String(e);return a+r.split(/\/+/).map((e,r,a)=>{if(r===a.length-1&&"*"===e)return n(t["*"]);let o=e.match(/^:([\w-]+)(\??)$/);if(o){let[,e,r]=o,a=t[e];return h("?"===r||null!=a,'Missing ":'+e+'" param'),n(a)}return e.replace(/\?$/g,"")}).filter(e=>!!e).join("/")}function L(e,t){var r,a,n;let o,i;"string"==typeof e&&(e={path:e,caseSensitive:!1,end:!0});let[s,l]=(r=e.path,a=e.caseSensitive,n=e.end,void 0===a&&(a=!1),void 0===n&&(n=!0),f("*"===r||!r.endsWith("*")||r.endsWith("/*"),'Route path "'+r+'" will be treated as if it were "'+r.replace(/\*$/,"/*")+'" because the `*` character must always follow a `/` in the pattern. To get rid of this warning, please change the route path to "'+r.replace(/\*$/,"/*")+'".'),o=[],i="^"+r.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(e,t,r)=>(o.push({paramName:t,isOptional:null!=r}),r?"/?([^\\/]+)?":"/([^\\/]+)")),r.endsWith("*")?(o.push({paramName:"*"}),i+="*"===r||"/*"===r?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?i+="\\/*$":""!==r&&"/"!==r&&(i+="(?:(?=\\/|$))"),[new RegExp(i,a?void 0:"i"),o]),d=t.match(s);if(!d)return null;let c=d[0],u=c.replace(/(.)\/+$/,"$1"),h=d.slice(1);return{params:l.reduce((e,t,r)=>{let{paramName:a,isOptional:n}=t;if("*"===a){let e=h[r]||"";u=c.slice(0,c.length-e.length).replace(/(.)\/+$/,"$1")}let o=h[r];return n&&!o?e[a]=void 0:e[a]=(o||"").replace(/%2F/g,"/"),e},{}),pathname:c,pathnameBase:u,pattern:e}}function k(e){try{return e.split("/").map(e=>decodeURIComponent(e).replace(/\//g,"%2F")).join("/")}catch(t){return f(!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 j(e,t){if("/"===t)return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let r=t.endsWith("/")?t.length-1:t.length,a=e.charAt(r);return a&&"/"!==a?null:e.slice(r)||"/"}let M=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;function A(e,t){let r;void 0===t&&(t="/");let{pathname:a,search:n="",hash:o=""}="string"==typeof e?y(e):e;if(a){let e;(e=a,M.test(e))?r=a:(a.includes("//")&&f(!1,"Pathnames cannot have embedded double slashes - normalizing "+a+" -> "+(a=a.replace(/\/\/+/g,"/"))),r=a.startsWith("/")?C(a.substring(1),"/"):C(a,t))}else r=t;return{pathname:r,search:H(n),hash:W(o)}}function C(e,t){let r=t.replace(/\/+$/,"").split("/");return e.split("/").forEach(e=>{".."===e?r.length>1&&r.pop():"."!==e&&r.push(e)}),r.length>1?r.join("/"):"/"}function _(e,t,r,a){return"Cannot include a '"+e+"' character in a manually specified "+("`to."+t+"` field [")+JSON.stringify(a)+"]. Please separate it out to the `to."+r+'` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.'}function O(e){return e.filter((e,t)=>0===t||e.route.path&&e.route.path.length>0)}function T(e,t){let r=O(e);return t?r.map((e,t)=>t===r.length-1?e.pathname:e.pathnameBase):r.map(e=>e.pathnameBase)}function U(e,t,r,a){let n,o;void 0===a&&(a=!1),"string"==typeof e?n=y(e):(h(!(n=s({},e)).pathname||!n.pathname.includes("?"),_("?","pathname","search",n)),h(!n.pathname||!n.pathname.includes("#"),_("#","pathname","hash",n)),h(!n.search||!n.search.includes("#"),_("#","search","hash",n)));let i=""===e||""===n.pathname,l=i?"/":n.pathname;if(null==l)o=r;else{let e=t.length-1;if(!a&&l.startsWith("..")){let t=l.split("/");for(;".."===t[0];)t.shift(),e-=1;n.pathname=t.join("/")}o=e>=0?t[e]:"/"}let d=A(n,o),c=l&&"/"!==l&&l.endsWith("/"),u=(i||"."===l)&&r.endsWith("/");return!d.pathname.endsWith("/")&&(c||u)&&(d.pathname+="/"),d}let z=e=>e.join("/").replace(/\/\/+/g,"/"),I=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),H=e=>e&&"?"!==e?e.startsWith("?")?e:"?"+e:"",W=e=>e&&"#"!==e?e.startsWith("#")?e:"#"+e:"",$=function(e,t){void 0===t&&(t={});let r="number"==typeof t?{status:t}:t,a=new Headers(r.headers);return a.has("Content-Type")||a.set("Content-Type","application/json; charset=utf-8"),new Response(JSON.stringify(e),s({},r,{headers:a}))};class B extends Error{}class F{constructor(e,t){let r;this.pendingKeysSet=new Set,this.subscribers=new Set,this.deferredKeys=[],h(e&&"object"==typeof e&&!Array.isArray(e),"defer() only accepts plain objects"),this.abortPromise=new Promise((e,t)=>r=t),this.controller=new AbortController;let a=()=>r(new B("Deferred data aborted"));this.unlistenAbortSignal=()=>this.controller.signal.removeEventListener("abort",a),this.controller.signal.addEventListener("abort",a),this.data=Object.entries(e).reduce((e,t)=>{let[r,a]=t;return Object.assign(e,{[r]:this.trackPromise(r,a)})},{}),this.done&&this.unlistenAbortSignal(),this.init=t}trackPromise(e,t){if(!(t instanceof Promise))return t;this.deferredKeys.push(e),this.pendingKeysSet.add(e);let r=Promise.race([t,this.abortPromise]).then(t=>this.onSettle(r,e,void 0,t),t=>this.onSettle(r,e,t));return r.catch(()=>{}),Object.defineProperty(r,"_tracked",{get:()=>!0}),r}onSettle(e,t,r,a){if(this.controller.signal.aborted&&r instanceof B)return this.unlistenAbortSignal(),Object.defineProperty(e,"_error",{get:()=>r}),Promise.reject(r);if(this.pendingKeysSet.delete(t),this.done&&this.unlistenAbortSignal(),void 0===r&&void 0===a){let r=Error('Deferred data for key "'+t+'" resolved/rejected with `undefined`, you must resolve/reject with a value or `null`.');return Object.defineProperty(e,"_error",{get:()=>r}),this.emit(!1,t),Promise.reject(r)}return void 0===a?(Object.defineProperty(e,"_error",{get:()=>r}),this.emit(!1,t),Promise.reject(r)):(Object.defineProperty(e,"_data",{get:()=>a}),this.emit(!1,t),a)}emit(e,t){this.subscribers.forEach(r=>r(e,t))}subscribe(e){return this.subscribers.add(e),()=>this.subscribers.delete(e)}cancel(){this.controller.abort(),this.pendingKeysSet.forEach((e,t)=>this.pendingKeysSet.delete(t)),this.emit(!0)}async resolveData(e){let t=!1;if(!this.done){let r=()=>this.cancel();e.addEventListener("abort",r),t=await new Promise(t=>{this.subscribe(a=>{e.removeEventListener("abort",r),(a||this.done)&&t(a)})})}return t}get done(){return 0===this.pendingKeysSet.size}get unwrappedData(){return h(null!==this.data&&this.done,"Can only unwrap data on initialized and settled deferreds"),Object.entries(this.data).reduce((e,t)=>{let[r,a]=t;return Object.assign(e,{[r]:function(e){if(!(e instanceof Promise&&!0===e._tracked))return e;if(e._error)throw e._error;return e._data}(a)})},{})}get pendingKeys(){return Array.from(this.pendingKeysSet)}}let N=function(e,t){return void 0===t&&(t={}),new F(e,"number"==typeof t?{status:t}:t)},q=function(e,t){void 0===t&&(t=302);let r=t;"number"==typeof r?r={status:r}:void 0===r.status&&(r.status=302);let a=new Headers(r.headers);return a.set("Location",e),new Response(null,s({},r,{headers:a}))},K=(e,t)=>{let r=q(e,t);return r.headers.set("X-Remix-Reload-Document","true"),r},V=(e,t)=>{let r=q(e,t);return r.headers.set("X-Remix-Replace","true"),r};class J{constructor(e,t,r,a){void 0===a&&(a=!1),this.status=e,this.statusText=t||"",this.internal=a,r instanceof Error?(this.data=r.toString(),this.error=r):this.data=r}}function Y(e){return null!=e&&"number"==typeof e.status&&"string"==typeof e.statusText&&"boolean"==typeof e.internal&&"data"in e}let X=["post","put","patch","delete"],G=new Set(X),Q=new Set(["get",...X]),Z=new Set([301,302,303,307,308]),ee=new Set([307,308]),et={state:"idle",location:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0},er={state:"idle",data:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0},ea={state:"unblocked",proceed:void 0,reset:void 0,location:void 0},en=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,eo=e=>({hasErrorBoundary:!!e.hasErrorBoundary}),ei="remix-router-transitions";function es(e){let t,r,o,i,l,d,c=e.window?e.window:"u">typeof window?window:void 0,u=void 0!==c&&void 0!==c.document&&void 0!==c.document.createElement,p=!u;if(h(e.routes.length>0,"You must provide a non-empty routes array to createRouter"),e.mapRouteProperties)t=e.mapRouteProperties;else if(e.detectErrorBoundary){let r=e.detectErrorBoundary;t=e=>({hasErrorBoundary:r(e)})}else t=eo;let v={},y=w(e.routes,t,void 0,v),g=e.basename||"/",b=e.dataStrategy||ey,D=e.patchRoutesOnNavigation,P=s({v7_fetcherPersist:!1,v7_normalizeFormMethod:!1,v7_partialHydration:!1,v7_prependBasename:!1,v7_relativeSplatPath:!1,v7_skipActionErrorRevalidation:!1},e.future),x=null,L=new Set,k=null,M=null,A=null,C=null!=e.hydrationData,_=S(y,e.history.location,g),O=!1,T=null;if(null==_&&!D){let t=eM(404,{pathname:e.history.location.pathname}),{matches:r,route:a}=ej(y);_=r,T={[a.id]:t}}if(_&&!e.hydrationData&&to(_,y,e.history.location.pathname).active&&(_=null),_)if(_.some(e=>e.route.lazy))o=!1;else if(_.some(e=>e.route.loader))if(P.v7_partialHydration){let t=e.hydrationData?e.hydrationData.loaderData:null,r=e.hydrationData?e.hydrationData.errors:null;if(r){let e=_.findIndex(e=>void 0!==r[e.route.id]);o=_.slice(0,e+1).every(e=>!eh(e.route,t,r))}else o=_.every(e=>!eh(e.route,t,r))}else o=null!=e.hydrationData;else o=!0;else if(o=!1,_=[],P.v7_partialHydration){let t=to(null,y,e.history.location.pathname);t.active&&t.matches&&(O=!0,_=t.matches)}let U={historyAction:e.history.action,location:e.history.location,matches:_,initialized:o,navigation:et,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||T,fetchers:new Map,blockers:new Map},z=a.Pop,I=!1,H=!1,W=new Map,$=null,B=!1,F=!1,N=[],q=new Set,K=new Map,V=0,J=-1,X=new Map,G=new Set,Q=new Map,es=new Map,ec=new Set,ef=new Map,ep=new Map;function ev(e,t){void 0===t&&(t={}),U=s({},U,e);let r=[],a=[];P.v7_fetcherPersist&&U.fetchers.forEach((e,t)=>{"idle"===e.state&&(ec.has(t)?a.push(t):r.push(t))}),ec.forEach(e=>{U.fetchers.has(e)||K.has(e)||a.push(e)}),[...L].forEach(e=>e(U,{deletedFetchers:a,viewTransitionOpts:t.viewTransitionOpts,flushSync:!0===t.flushSync})),P.v7_fetcherPersist?(r.forEach(e=>U.fetchers.delete(e)),a.forEach(e=>e7(e))):a.forEach(e=>ec.delete(e))}function eb(t,n,o){var i,l;let d,c,{flushSync:u}=void 0===o?{}:o,h=null!=U.actionData&&null!=U.navigation.formMethod&&eI(U.navigation.formMethod)&&"loading"===U.navigation.state&&(null==(i=t.state)?void 0:i._isRedirect)!==!0;d=n.actionData?Object.keys(n.actionData).length>0?n.actionData:null:h?U.actionData:null;let f=n.loaderData?ex(U.loaderData,n.loaderData,n.matches||[],n.errors):U.loaderData,p=U.blockers;p.size>0&&(p=new Map(p)).forEach((e,t)=>p.set(t,ea));let m=!0===I||null!=U.navigation.formMethod&&eI(U.navigation.formMethod)&&(null==(l=t.state)?void 0:l._isRedirect)!==!0;if(r&&(y=r,r=void 0),B||z===a.Pop||(z===a.Push?e.history.push(t,t.state):z===a.Replace&&e.history.replace(t,t.state)),z===a.Pop){let e=W.get(U.location.pathname);e&&e.has(t.pathname)?c={currentLocation:U.location,nextLocation:t}:W.has(t.pathname)&&(c={currentLocation:t,nextLocation:U.location})}else if(H){let e=W.get(U.location.pathname);e?e.add(t.pathname):(e=new Set([t.pathname]),W.set(U.location.pathname,e)),c={currentLocation:U.location,nextLocation:t}}ev(s({},n,{actionData:d,loaderData:f,historyAction:z,location:t,initialized:!0,navigation:et,revalidation:"idle",restoreScrollPosition:tn(t,n.matches||U.matches),preventScrollReset:m,blockers:p}),{viewTransitionOpts:c,flushSync:!0===u}),z=a.Pop,I=!1,H=!1,B=!1,F=!1,N=[]}async function eR(t,r){if("number"==typeof t)return void e.history.go(t);let n=el(U.location,U.matches,g,P.v7_prependBasename,t,P.v7_relativeSplatPath,null==r?void 0:r.fromRouteId,null==r?void 0:r.relative),{path:o,submission:i,error:l}=ed(P.v7_normalizeFormMethod,!1,n,r),d=U.location,c=m(U.location,o,r&&r.state);c=s({},c,e.history.encodeLocation(c));let u=r&&null!=r.replace?r.replace:void 0,h=a.Push;!0===u?h=a.Replace:!1===u||null!=i&&eI(i.formMethod)&&i.formAction===U.location.pathname+U.location.search&&(h=a.Replace);let f=r&&"preventScrollReset"in r?!0===r.preventScrollReset:void 0,p=!0===(r&&r.flushSync),v=te({currentLocation:d,nextLocation:c,historyAction:h});return v?void e9(v,{state:"blocked",location:c,proceed(){e9(v,{state:"proceeding",proceed:void 0,reset:void 0,location:c}),eR(t,r)},reset(){let e=new Map(U.blockers);e.set(v,ea),ev({blockers:e})}}):await eD(h,c,{submission:i,pendingError:l,preventScrollReset:f,replace:r&&r.replace,enableViewTransition:r&&r.viewTransition,flushSync:p})}async function eD(t,a,o){var i,d,c,u;let h;l&&l.abort(),l=null,z=t,B=!0===(o&&o.startUninterruptedRevalidation),i=U.location,d=U.matches,k&&A&&(k[ta(i,d)]=A()),I=!0===(o&&o.preventScrollReset),H=!0===(o&&o.enableViewTransition);let f=r||y,p=o&&o.overrideNavigation,m=null!=o&&o.initialHydration&&U.matches&&U.matches.length>0&&!O?U.matches:S(f,a,g),v=!0===(o&&o.flushSync);if(m&&U.initialized&&!F&&(c=U.location,u=a,c.pathname===u.pathname&&c.search===u.search&&(""===c.hash?""!==u.hash:c.hash===u.hash||""!==u.hash||!1))&&!(o&&o.submission&&eI(o.submission.formMethod)))return void eb(a,{matches:m},{flushSync:v});let b=to(m,f,a.pathname);if(b.active&&b.matches&&(m=b.matches),!m){let{error:e,notFoundMatches:t,route:r}=tt(a.pathname);eb(a,{matches:t,loaderData:{},errors:{[r.id]:e}},{flushSync:v});return}l=new AbortController;let w=eE(e.history,a,l.signal,o&&o.submission);if(o&&o.pendingError)h=[ek(m).route.id,{type:n.error,error:o.pendingError}];else if(o&&o.submission&&eI(o.submission.formMethod)){let t=await eC(w,a,o.submission,m,b.active,{replace:o.replace,flushSync:v});if(t.shortCircuited)return;if(t.pendingActionResult){let[e,r]=t.pendingActionResult;if(eO(r)&&Y(r.error)&&404===r.error.status){l=null,eb(a,{matches:t.matches,loaderData:{},errors:{[e]:r.error}});return}}m=t.matches||m,h=t.pendingActionResult,p=eq(a,o.submission),v=!1,b.active=!1,w=eE(e.history,w.url,w.signal)}let{shortCircuited:E,matches:R,loaderData:D,errors:P}=await eU(w,a,m,b.active,p,o&&o.submission,o&&o.fetcherSubmission,o&&o.replace,o&&!0===o.initialHydration,v,h);E||(l=null,eb(a,s({matches:R||m},eL(h),{loaderData:D,errors:P})))}async function eC(t,r,o,i,s,l){var d;let c;if(void 0===l&&(l={}),eZ(),ev({navigation:{state:"submitting",location:r,formMethod:(d=o).formMethod,formAction:d.formAction,formEncType:d.formEncType,formData:d.formData,json:d.json,text:d.text}},{flushSync:!0===l.flushSync}),s){let e=await ti(i,r.pathname,t.signal);if("aborted"===e.type)return{shortCircuited:!0};if("error"===e.type){let t=ek(e.partialMatches).route.id;return{matches:e.partialMatches,pendingActionResult:[t,{type:n.error,error:e.error}]}}if(e.matches)i=e.matches;else{let{notFoundMatches:e,error:t,route:a}=tt(r.pathname);return{matches:e,pendingActionResult:[a.id,{type:n.error,error:t}]}}}let u=eF(i,r);if(u.route.action||u.route.lazy){if(c=(await eG("action",U,t,[u],i,null))[u.route.id],t.signal.aborted)return{shortCircuited:!0}}else c={type:n.error,error:eM(405,{method:t.method,pathname:r.pathname,routeId:u.route.id})};if(eT(c)){let r;return r=l&&null!=l.replace?l.replace:eS(c.response.headers.get("Location"),new URL(t.url),g,e.history)===U.location.pathname+U.location.search,await eX(t,c,!0,{submission:o,replace:r}),{shortCircuited:!0}}if(e_(c))throw eM(400,{type:"defer-action"});if(eO(c)){let e=ek(i,u.route.id);return!0!==(l&&l.replace)&&(z=a.Push),{matches:i,pendingActionResult:[e.route.id,c]}}return{matches:i,pendingActionResult:[u.route.id,c]}}async function eU(t,a,n,o,i,d,c,u,h,f,p){let m=i||eq(a,d),v=d||c||eN(m),b=!B&&(!P.v7_partialHydration||!h);if(o){if(b){let e=eB(p);ev(s({navigation:m},void 0!==e?{actionData:e}:{}),{flushSync:f})}let e=await ti(n,a.pathname,t.signal);if("aborted"===e.type)return{shortCircuited:!0};if("error"===e.type){let t=ek(e.partialMatches).route.id;return{matches:e.partialMatches,loaderData:{},errors:{[t]:e.error}}}if(e.matches)n=e.matches;else{let{error:e,notFoundMatches:t,route:r}=tt(a.pathname);return{matches:t,loaderData:{},errors:{[r.id]:e}}}}let w=r||y,[S,E]=eu(e.history,U,n,v,a,P.v7_partialHydration&&!0===h,P.v7_skipActionErrorRevalidation,F,N,q,ec,Q,G,w,g,p);if(tr(e=>!(n&&n.some(t=>t.route.id===e))||S&&S.some(t=>t.route.id===e)),J=++V,0===S.length&&0===E.length){let e=e5();return eb(a,s({matches:n,loaderData:{},errors:p&&eO(p[1])?{[p[0]]:p[1].error}:null},eL(p),e?{fetchers:new Map(U.fetchers)}:{}),{flushSync:f}),{shortCircuited:!0}}if(b){let e={};if(!o){e.navigation=m;let t=eB(p);void 0!==t&&(e.actionData=t)}E.length>0&&(E.forEach(e=>{let t=U.fetchers.get(e.key),r=eK(void 0,t?t.data:void 0);U.fetchers.set(e.key,r)}),e.fetchers=new Map(U.fetchers)),ev(e,{flushSync:f})}E.forEach(e=>{e3(e.key),e.controller&&K.set(e.key,e.controller)});let R=()=>E.forEach(e=>e3(e.key));l&&l.signal.addEventListener("abort",R);let{loaderResults:D,fetcherResults:x}=await eQ(U,n,S,E,t);if(t.signal.aborted)return{shortCircuited:!0};l&&l.signal.removeEventListener("abort",R),E.forEach(e=>K.delete(e.key));let L=eA(D);if(L)return await eX(t,L.result,!0,{replace:u}),{shortCircuited:!0};if(L=eA(x))return G.add(L.key),await eX(t,L.result,!0,{replace:u}),{shortCircuited:!0};let{loaderData:k,errors:j}=eP(U,n,D,p,E,x,ef);ef.forEach((e,t)=>{e.subscribe(r=>{(r||e.done)&&ef.delete(t)})}),P.v7_partialHydration&&h&&U.errors&&(j=s({},U.errors,j));let M=e5(),A=e8(J),C=M||A||E.length>0;return s({matches:n,loaderData:k,errors:j},C?{fetchers:new Map(U.fetchers)}:{})}function eB(e){if(e&&!eO(e[1]))return{[e[0]]:e[1].data};if(U.actionData)if(0===Object.keys(U.actionData).length)return null;else return U.actionData}async function eJ(t,a,n,o,i,s,d,c,u){var f,p;function m(e){if(!e.route.action&&!e.route.lazy){let e=eM(405,{method:u.formMethod,pathname:n,routeId:a});return e1(t,a,e,{flushSync:d}),!0}return!1}if(eZ(),Q.delete(t),!s&&m(o))return;let v=U.fetchers.get(t);e0(t,(f=u,p=v,{state:"submitting",formMethod:f.formMethod,formAction:f.formAction,formEncType:f.formEncType,formData:f.formData,json:f.json,text:f.text,data:p?p.data:void 0}),{flushSync:d});let b=new AbortController,w=eE(e.history,n,b.signal,u);if(s){let e=await ti(i,new URL(w.url).pathname,w.signal,t);if("aborted"===e.type)return;if("error"===e.type)return void e1(t,a,e.error,{flushSync:d});if(!e.matches)return void e1(t,a,eM(404,{pathname:n}),{flushSync:d});if(m(o=eF(i=e.matches,n)))return}K.set(t,b);let E=V,R=(await eG("action",U,w,[o],i,t))[o.route.id];if(w.signal.aborted){K.get(t)===b&&K.delete(t);return}if(P.v7_fetcherPersist&&ec.has(t)){if(eT(R)||eO(R))return void e0(t,eV(void 0))}else{if(eT(R))return(K.delete(t),J>E)?void e0(t,eV(void 0)):(G.add(t),e0(t,eK(u)),eX(w,R,!1,{fetcherSubmission:u,preventScrollReset:c}));if(eO(R))return void e1(t,a,R.error)}if(e_(R))throw eM(400,{type:"defer-action"});let D=U.navigation.location||U.location,x=eE(e.history,D,b.signal),L=r||y,k="idle"!==U.navigation.state?S(L,U.navigation.location,g):U.matches;h(k,"Didn't find any matches after fetcher action");let j=++V;X.set(t,j);let M=eK(u,R.data);U.fetchers.set(t,M);let[A,C]=eu(e.history,U,k,u,D,!1,P.v7_skipActionErrorRevalidation,F,N,q,ec,Q,G,L,g,[o.route.id,R]);C.filter(e=>e.key!==t).forEach(e=>{let t=e.key,r=U.fetchers.get(t),a=eK(void 0,r?r.data:void 0);U.fetchers.set(t,a),e3(t),e.controller&&K.set(t,e.controller)}),ev({fetchers:new Map(U.fetchers)});let _=()=>C.forEach(e=>e3(e.key));b.signal.addEventListener("abort",_);let{loaderResults:O,fetcherResults:T}=await eQ(U,k,A,C,x);if(b.signal.aborted)return;b.signal.removeEventListener("abort",_),X.delete(t),K.delete(t),C.forEach(e=>K.delete(e.key));let I=eA(O);if(I)return eX(x,I.result,!1,{preventScrollReset:c});if(I=eA(T))return G.add(I.key),eX(x,I.result,!1,{preventScrollReset:c});let{loaderData:H,errors:W}=eP(U,k,O,void 0,C,T,ef);if(U.fetchers.has(t)){let e=eV(R.data);U.fetchers.set(t,e)}e8(j),"loading"===U.navigation.state&&j>J?(h(z,"Expected pending action"),l&&l.abort(),eb(U.navigation.location,{matches:k,loaderData:H,errors:W,fetchers:new Map(U.fetchers)})):(ev({errors:W,loaderData:ex(U.loaderData,H,k,W),fetchers:new Map(U.fetchers)}),F=!1)}async function eY(t,r,a,n,o,i,s,l,d){let c=U.fetchers.get(t);e0(t,eK(d,c?c.data:void 0),{flushSync:s});let u=new AbortController,f=eE(e.history,a,u.signal);if(i){let e=await ti(o,new URL(f.url).pathname,f.signal,t);if("aborted"===e.type)return;if("error"===e.type)return void e1(t,r,e.error,{flushSync:s});if(!e.matches)return void e1(t,r,eM(404,{pathname:a}),{flushSync:s});n=eF(o=e.matches,a)}K.set(t,u);let p=V,m=(await eG("loader",U,f,[n],o,t))[n.route.id];if(e_(m)&&(m=await e$(m,f.signal,!0)||m),K.get(t)===u&&K.delete(t),!f.signal.aborted){if(ec.has(t))return void e0(t,eV(void 0));if(eT(m))if(J>p)return void e0(t,eV(void 0));else{G.add(t),await eX(f,m,!1,{preventScrollReset:l});return}if(eO(m))return void e1(t,r,m.error);h(!e_(m),"Unhandled fetcher deferred data"),e0(t,eV(m.data))}}async function eX(t,r,n,o){let{submission:i,fetcherSubmission:d,preventScrollReset:f,replace:p}=void 0===o?{}:o;r.response.headers.has("X-Remix-Revalidate")&&(F=!0);let v=r.response.headers.get("Location");h(v,"Expected a Location header on the redirect Response"),v=eS(v,new URL(t.url),g,e.history);let y=m(U.location,v,{_isRedirect:!0});if(u){let t=!1;if(r.response.headers.has("X-Remix-Reload-Document"))t=!0;else if(en.test(v)){let r=e.history.createURL(v);t=r.origin!==c.location.origin||null==j(r.pathname,g)}if(t)return void(p?c.location.replace(v):c.location.assign(v))}l=null;let b=!0===p||r.response.headers.has("X-Remix-Replace")?a.Replace:a.Push,{formMethod:w,formAction:S,formEncType:E}=U.navigation;!i&&!d&&w&&S&&E&&(i=eN(U.navigation));let R=i||d;if(ee.has(r.response.status)&&R&&eI(R.formMethod))await eD(b,y,{submission:s({},R,{formAction:v}),preventScrollReset:f||I,enableViewTransition:n?H:void 0});else{let e=eq(y,i);await eD(b,y,{overrideNavigation:e,fetcherSubmission:d,preventScrollReset:f||I,enableViewTransition:n?H:void 0})}}async function eG(e,r,a,o,i,s){let l,d={};try{l=await eg(b,e,r,a,o,i,s,v,t)}catch(e){return o.forEach(t=>{d[t.route.id]={type:n.error,error:e}}),d}for(let[e,t]of Object.entries(l)){var c;if(ez((c=t).result)&&Z.has(c.result.status)){let r=t.result;d[e]={type:n.redirect,response:function(e,t,r,a,n,o){let i=e.headers.get("Location");if(h(i,"Redirects returned/thrown from loaders/actions must have a Location header"),!en.test(i)){let s=a.slice(0,a.findIndex(e=>e.route.id===r)+1);i=el(new URL(t.url),s,n,!0,i,o),e.headers.set("Location",i)}return e}(r,a,e,i,g,P.v7_relativeSplatPath)}}else d[e]=await ew(t)}return d}async function eQ(t,r,a,o,i){let s=t.matches,l=eG("loader",t,i,a,r,null),d=Promise.all(o.map(async r=>{if(!r.matches||!r.match||!r.controller)return Promise.resolve({[r.key]:{type:n.error,error:eM(404,{pathname:r.path})}});{let a=(await eG("loader",t,eE(e.history,r.path,r.controller.signal),[r.match],r.matches,r.key))[r.match.route.id];return{[r.key]:a}}})),c=await l,u=(await d).reduce((e,t)=>Object.assign(e,t),{});return await Promise.all([eH(r,c,i.signal,s,t.loaderData),eW(r,u,o)]),{loaderResults:c,fetcherResults:u}}function eZ(){F=!0,N.push(...tr()),Q.forEach((e,t)=>{K.has(t)&&q.add(t),e3(t)})}function e0(e,t,r){void 0===r&&(r={}),U.fetchers.set(e,t),ev({fetchers:new Map(U.fetchers)},{flushSync:!0===(r&&r.flushSync)})}function e1(e,t,r,a){void 0===a&&(a={});let n=ek(U.matches,t);e7(e),ev({errors:{[n.route.id]:r},fetchers:new Map(U.fetchers)},{flushSync:!0===(a&&a.flushSync)})}function e4(e){return es.set(e,(es.get(e)||0)+1),ec.has(e)&&ec.delete(e),U.fetchers.get(e)||er}function e7(e){let t=U.fetchers.get(e);K.has(e)&&!(t&&"loading"===t.state&&X.has(e))&&e3(e),Q.delete(e),X.delete(e),G.delete(e),P.v7_fetcherPersist&&ec.delete(e),q.delete(e),U.fetchers.delete(e)}function e3(e){let t=K.get(e);t&&(t.abort(),K.delete(e))}function e2(e){for(let t of e){let e=eV(e4(t).data);U.fetchers.set(t,e)}}function e5(){let e=[],t=!1;for(let r of G){let a=U.fetchers.get(r);h(a,"Expected fetcher: "+r),"loading"===a.state&&(G.delete(r),e.push(r),t=!0)}return e2(e),t}function e8(e){let t=[];for(let[r,a]of X)if(a<e){let e=U.fetchers.get(r);h(e,"Expected fetcher: "+r),"loading"===e.state&&(e3(r),X.delete(r),t.push(r))}return e2(t),t.length>0}function e6(e){U.blockers.delete(e),ep.delete(e)}function e9(e,t){let r=U.blockers.get(e)||ea;h("unblocked"===r.state&&"blocked"===t.state||"blocked"===r.state&&"blocked"===t.state||"blocked"===r.state&&"proceeding"===t.state||"blocked"===r.state&&"unblocked"===t.state||"proceeding"===r.state&&"unblocked"===t.state,"Invalid blocker state transition: "+r.state+" -> "+t.state);let a=new Map(U.blockers);a.set(e,t),ev({blockers:a})}function te(e){let{currentLocation:t,nextLocation:r,historyAction:a}=e;if(0===ep.size)return;ep.size>1&&f(!1,"A router only supports one blocker at a time");let n=Array.from(ep.entries()),[o,i]=n[n.length-1],s=U.blockers.get(o);if((!s||"proceeding"!==s.state)&&i({currentLocation:t,nextLocation:r,historyAction:a}))return o}function tt(e){let t=eM(404,{pathname:e}),{matches:a,route:n}=ej(r||y);return tr(),{notFoundMatches:a,route:n,error:t}}function tr(e){let t=[];return ef.forEach((r,a)=>{(!e||e(a))&&(r.cancel(),t.push(a),ef.delete(a))}),t}function ta(e,t){return M&&M(e,t.map(e=>R(e,U.loaderData)))||e.key}function tn(e,t){if(k){let r=k[ta(e,t)];if("number"==typeof r)return r}return null}function to(e,t,r){if(D){if(!e)return{active:!0,matches:E(t,r,g,!0)||[]};else if(Object.keys(e[0].params).length>0)return{active:!0,matches:E(t,r,g,!0)}}return{active:!1,matches:null}}async function ti(e,a,n,o){if(!D)return{type:"success",matches:e};let i=e;for(;;){let e=null==r,s=r||y,l=v;try{await D({signal:n,path:a,matches:i,fetcherKey:o,patch:(e,r)=>{n.aborted||em(e,r,s,l,t)}})}catch(e){return{type:"error",error:e,partialMatches:i}}finally{e&&!n.aborted&&(y=[...y])}if(n.aborted)return{type:"aborted"};let d=S(s,a,g);if(d)return{type:"success",matches:d};let c=E(s,a,g,!0);if(!c||i.length===c.length&&i.every((e,t)=>e.route.id===c[t].route.id))return{type:"success",matches:null};i=c}}return i={get basename(){return g},get future(){return P},get state(){return U},get routes(){return y},get window(){return c},initialize:function(){if(x=e.history.listen(t=>{let{action:r,location:a,delta:n}=t;if(d){d(),d=void 0;return}f(0===ep.size||null!=n,"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 o=te({currentLocation:U.location,nextLocation:a,historyAction:r});if(o&&null!=n){let t=new Promise(e=>{d=e});e.history.go(-1*n),e9(o,{state:"blocked",location:a,proceed(){e9(o,{state:"proceeding",proceed:void 0,reset:void 0,location:a}),t.then(()=>e.history.go(n))},reset(){let e=new Map(U.blockers);e.set(o,ea),ev({blockers:e})}});return}return eD(r,a)}),u){var t=c,r=W;try{let e=t.sessionStorage.getItem(ei);if(e){let t=JSON.parse(e);for(let[e,a]of Object.entries(t||{}))a&&Array.isArray(a)&&r.set(e,new Set(a||[]))}}catch(e){}let e=()=>(function(e,t){if(t.size>0){let r={};for(let[e,a]of t)r[e]=[...a];try{e.sessionStorage.setItem(ei,JSON.stringify(r))}catch(e){f(!1,"Failed to save applied view transitions in sessionStorage ("+e+").")}}})(c,W);c.addEventListener("pagehide",e),$=()=>c.removeEventListener("pagehide",e)}return U.initialized||eD(a.Pop,U.location,{initialHydration:!0}),i},subscribe:function(e){return L.add(e),()=>L.delete(e)},enableScrollRestoration:function(e,t,r){if(k=e,A=t,M=r||null,!C&&U.navigation===et){C=!0;let e=tn(U.location,U.matches);null!=e&&ev({restoreScrollPosition:e})}return()=>{k=null,A=null,M=null}},navigate:eR,fetch:function(e,t,a,n){if(p)throw 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.");e3(e);let o=!0===(n&&n.flushSync),i=r||y,s=el(U.location,U.matches,g,P.v7_prependBasename,a,P.v7_relativeSplatPath,t,null==n?void 0:n.relative),l=S(i,s,g),d=to(l,i,s);if(d.active&&d.matches&&(l=d.matches),!l)return void e1(e,t,eM(404,{pathname:s}),{flushSync:o});let{path:c,submission:u,error:h}=ed(P.v7_normalizeFormMethod,!0,s,n);if(h)return void e1(e,t,h,{flushSync:o});let f=eF(l,c),m=!0===(n&&n.preventScrollReset);u&&eI(u.formMethod)?eJ(e,t,c,f,l,d.active,o,m,u):(Q.set(e,{routeId:t,path:c}),eY(e,t,c,f,l,d.active,o,m,u))},revalidate:function(){if(eZ(),ev({revalidation:"loading"}),"submitting"!==U.navigation.state){if("idle"===U.navigation.state)return void eD(U.historyAction,U.location,{startUninterruptedRevalidation:!0});eD(z||U.historyAction,U.navigation.location,{overrideNavigation:U.navigation,enableViewTransition:!0===H})}},createHref:t=>e.history.createHref(t),encodeLocation:t=>e.history.encodeLocation(t),getFetcher:e4,deleteFetcher:function(e){let t=(es.get(e)||0)-1;t<=0?(es.delete(e),ec.add(e),P.v7_fetcherPersist||e7(e)):es.set(e,t),ev({fetchers:new Map(U.fetchers)})},dispose:function(){x&&x(),$&&$(),L.clear(),l&&l.abort(),U.fetchers.forEach((e,t)=>e7(t)),U.blockers.forEach((e,t)=>e6(t))},getBlocker:function(e,t){let r=U.blockers.get(e)||ea;return ep.get(e)!==t&&ep.set(e,t),r},deleteBlocker:e6,patchRoutes:function(e,a){let n=null==r;em(e,a,r||y,v,t),n&&(y=[...y],ev({}))},_internalFetchControllers:K,_internalActiveDeferreds:ef,_internalSetRoutes:function(e){r=w(e,t,void 0,v={})}}}function el(e,t,r,a,n,o,i,s){let l,d;if(i){for(let e of(l=[],t))if(l.push(e),e.route.id===i){d=e;break}}else l=t,d=t[t.length-1];let c=U(n||".",T(l,o),j(e.pathname,r)||e.pathname,"path"===s);if(null==n&&(c.search=e.search,c.hash=e.hash),(null==n||""===n||"."===n)&&d){let e=eB(c.search);if(d.route.index&&!e)c.search=c.search?c.search.replace(/^\?/,"?index&"):"?index";else if(!d.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 r=e.toString();c.search=r?"?"+r:""}}return a&&"/"!==r&&(c.pathname="/"===c.pathname?r:z([r,c.pathname])),v(c)}function ed(e,t,r,a){var n;let o,i;if(!a||!(null!=a&&("formData"in a&&null!=a.formData||"body"in a&&void 0!==a.body)))return{path:r};if(a.formMethod&&(n=a.formMethod,!Q.has(n.toLowerCase())))return{path:r,error:eM(405,{method:a.formMethod})};let s=()=>({path:r,error:eM(400,{type:"invalid-body"})}),l=a.formMethod||"get",d=e?l.toUpperCase():l.toLowerCase(),c=eC(r);if(void 0!==a.body){if("text/plain"===a.formEncType){if(!eI(d))return s();let e="string"==typeof a.body?a.body:a.body instanceof FormData||a.body instanceof URLSearchParams?Array.from(a.body.entries()).reduce((e,t)=>{let[r,a]=t;return""+e+r+"="+a+"\n"},""):String(a.body);return{path:r,submission:{formMethod:d,formAction:c,formEncType:a.formEncType,formData:void 0,json:void 0,text:e}}}else if("application/json"===a.formEncType){if(!eI(d))return s();try{let e="string"==typeof a.body?JSON.parse(a.body):a.body;return{path:r,submission:{formMethod:d,formAction:c,formEncType:a.formEncType,formData:void 0,json:e,text:void 0}}}catch(e){return s()}}}if(h("function"==typeof FormData,"FormData is not available in this environment"),a.formData)o=eR(a.formData),i=a.formData;else if(a.body instanceof FormData)o=eR(a.body),i=a.body;else if(a.body instanceof URLSearchParams)i=eD(o=a.body);else if(null==a.body)o=new URLSearchParams,i=new FormData;else try{o=new URLSearchParams(a.body),i=eD(o)}catch(e){return s()}let u={formMethod:d,formAction:c,formEncType:a&&a.formEncType||"application/x-www-form-urlencoded",formData:i,json:void 0,text:void 0};if(eI(u.formMethod))return{path:r,submission:u};let f=y(r);return t&&f.search&&eB(f.search)&&o.append("index",""),f.search="?"+o,{path:v(f),submission:u}}function ec(e,t,r){void 0===r&&(r=!1);let a=e.findIndex(e=>e.route.id===t);return a>=0?e.slice(0,r?a+1:a):e}function eu(e,t,r,a,n,o,i,l,d,c,u,h,f,p,m,v){let y=v?eO(v[1])?v[1].error:v[1].data:void 0,g=e.createURL(t.location),b=e.createURL(n),w=r;o&&t.errors?w=ec(r,Object.keys(t.errors)[0],!0):v&&eO(v[1])&&(w=ec(r,v[0]));let E=v?v[1].statusCode:void 0,R=i&&E&&E>=400,D=w.filter((e,r)=>{var n,i,c;let u,h,{route:f}=e;if(f.lazy)return!0;if(null==f.loader)return!1;if(o)return eh(f,t.loaderData,t.errors);if(n=t.loaderData,i=t.matches[r],c=e,u=!i||c.route.id!==i.route.id,h=void 0===n[c.route.id],u||h||d.some(t=>t===e.route.id))return!0;let p=t.matches[r];return ep(e,s({currentUrl:g,currentParams:p.params,nextUrl:b,nextParams:e.params},a,{actionResult:y,actionStatus:E,defaultShouldRevalidate:!R&&(l||g.pathname+g.search===b.pathname+b.search||g.search!==b.search||ef(p,e))}))}),P=[];return h.forEach((e,n)=>{if(o||!r.some(t=>t.route.id===e.routeId)||u.has(n))return;let i=S(p,e.path,m);if(!i)return void P.push({key:n,routeId:e.routeId,path:e.path,matches:null,match:null,controller:null});let d=t.fetchers.get(n),h=eF(i,e.path),v=!1;f.has(n)?v=!1:c.has(n)?(c.delete(n),v=!0):v=d&&"idle"!==d.state&&void 0===d.data?l:ep(h,s({currentUrl:g,currentParams:t.matches[t.matches.length-1].params,nextUrl:b,nextParams:r[r.length-1].params},a,{actionResult:y,actionStatus:E,defaultShouldRevalidate:!R&&l})),v&&P.push({key:n,routeId:e.routeId,path:e.path,matches:i,match:h,controller:new AbortController})}),[D,P]}function eh(e,t,r){if(e.lazy)return!0;if(!e.loader)return!1;let a=null!=t&&void 0!==t[e.id],n=null!=r&&void 0!==r[e.id];return(!!a||!n)&&("function"==typeof e.loader&&!0===e.loader.hydrate||!a&&!n)}function ef(e,t){let r=e.route.path;return e.pathname!==t.pathname||null!=r&&r.endsWith("*")&&e.params["*"]!==t.params["*"]}function ep(e,t){if(e.route.shouldRevalidate){let r=e.route.shouldRevalidate(t);if("boolean"==typeof r)return r}return t.defaultShouldRevalidate}function em(e,t,r,a,n){var o;let i;if(e){let t=a[e];h(t,"No route found to patch children into: routeId = "+e),t.children||(t.children=[]),i=t.children}else i=r;let s=w(t.filter(e=>!i.some(t=>(function e(t,r){return"id"in t&&"id"in r&&t.id===r.id||t.index===r.index&&t.path===r.path&&t.caseSensitive===r.caseSensitive&&((!t.children||0===t.children.length)&&(!r.children||0===r.children.length)||t.children.every((t,a)=>{var n;return null==(n=r.children)?void 0:n.some(r=>e(t,r))}))})(e,t))),n,[e||"_","patch",String((null==(o=i)?void 0:o.length)||"0")],a);i.push(...s)}async function ev(e,t,r){if(!e.lazy)return;let a=await e.lazy();if(!e.lazy)return;let n=r[e.id];h(n,"No route found in manifest");let o={};for(let e in a){let t=void 0!==n[e]&&"hasErrorBoundary"!==e;f(!t,'Route "'+n.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.'),t||b.has(e)||(o[e]=a[e])}Object.assign(n,o),Object.assign(n,s({},t(n),{lazy:void 0}))}async function ey(e){let{matches:t}=e,r=t.filter(e=>e.shouldLoad);return(await Promise.all(r.map(e=>e.resolve()))).reduce((e,t,a)=>Object.assign(e,{[r[a].route.id]:t}),{})}async function eg(e,t,r,a,o,i,l,d,c,u){let h=i.map(e=>e.route.lazy?ev(e.route,c,d):void 0),f=i.map((e,r)=>{let i=h[r],l=o.some(t=>t.route.id===e.route.id),d=async r=>(r&&"GET"===a.method&&(e.route.lazy||e.route.loader)&&(l=!0),l?eb(t,a,e,i,r,u):Promise.resolve({type:n.data,result:void 0}));return s({},e,{shouldLoad:l,resolve:d})}),p=await e({matches:f,request:a,params:i[0].params,fetcherKey:l,context:u});try{await Promise.all(h)}catch(e){}return p}async function eb(e,t,r,a,o,i){let s,l,d=a=>{let n,s=new Promise((e,t)=>n=t);l=()=>n(),t.signal.addEventListener("abort",l);let d=n=>"function"!=typeof a?Promise.reject(Error("You cannot call the handler for a route which defines a boolean "+('"'+e+'" [routeId: ')+r.route.id+"]")):a({request:t,params:r.params,context:i},...void 0!==n?[n]:[]);return Promise.race([(async()=>{try{let e=await (o?o(e=>d(e)):d());return{type:"data",result:e}}catch(e){return{type:"error",result:e}}})(),s])};try{let o=r.route[e];if(a)if(o){let e,[t]=await Promise.all([d(o).catch(t=>{e=t}),a]);if(void 0!==e)throw e;s=t}else if(await a,o=r.route[e])s=await d(o);else{if("action"!==e)return{type:n.data,result:void 0};let a=new URL(t.url),o=a.pathname+a.search;throw eM(405,{method:t.method,pathname:o,routeId:r.route.id})}else if(o)s=await d(o);else{let e=new URL(t.url),r=e.pathname+e.search;throw eM(404,{pathname:r})}h(void 0!==s.result,"You defined "+("action"===e?"an action":"a loader")+" for route "+('"'+r.route.id+"\" but didn't return anything from your `")+e+"` function. Please return a value or `null`.")}catch(e){return{type:n.error,result:e}}finally{l&&t.signal.removeEventListener("abort",l)}return s}async function ew(e){var t,r,a,o,i,s,l,d,c;let{result:u,type:h}=e;if(ez(u)){let e;try{let t=u.headers.get("Content-Type");e=t&&/\bapplication\/json\b/.test(t)?null==u.body?null:await u.json():await u.text()}catch(e){return{type:n.error,error:e}}return h===n.error?{type:n.error,error:new J(u.status,u.statusText,e),statusCode:u.status,headers:u.headers}:{type:n.data,data:e,statusCode:u.status,headers:u.headers}}if(h===n.error)return eU(u)?u.data instanceof Error?{type:n.error,error:u.data,statusCode:null==(a=u.init)?void 0:a.status,headers:null!=(o=u.init)&&o.headers?new Headers(u.init.headers):void 0}:{type:n.error,error:new J((null==(t=u.init)?void 0:t.status)||500,void 0,u.data),statusCode:Y(u)?u.status:void 0,headers:null!=(r=u.init)&&r.headers?new Headers(u.init.headers):void 0}:{type:n.error,error:u,statusCode:Y(u)?u.status:void 0};return(c=u)&&"object"==typeof c&&"object"==typeof c.data&&"function"==typeof c.subscribe&&"function"==typeof c.cancel&&"function"==typeof c.resolveData?{type:n.deferred,deferredData:u,statusCode:null==(i=u.init)?void 0:i.status,headers:(null==(s=u.init)?void 0:s.headers)&&new Headers(u.init.headers)}:eU(u)?{type:n.data,data:u.data,statusCode:null==(l=u.init)?void 0:l.status,headers:null!=(d=u.init)&&d.headers?new Headers(u.init.headers):void 0}:{type:n.data,data:u}}function eS(e,t,r,a){let n=["about:","blob:","chrome:","chrome-untrusted:","content:","data:","devtools:","file:","filesystem:","javascript:"];if(en.test(e)){let a=new URL(e.startsWith("//")?t.protocol+e:e);if(n.includes(a.protocol))throw Error("Invalid redirect location");let o=null!=j(a.pathname,r);if(a.origin===t.origin&&o)return a.pathname+a.search+a.hash}try{let t=a.createURL(e);if(n.includes(t.protocol))throw Error("Invalid redirect location")}catch(e){}return e}function eE(e,t,r,a){let n=e.createURL(eC(t)).toString(),o={signal:r};if(a&&eI(a.formMethod)){let{formMethod:e,formEncType:t}=a;o.method=e.toUpperCase(),"application/json"===t?(o.headers=new Headers({"Content-Type":t}),o.body=JSON.stringify(a.json)):"text/plain"===t?o.body=a.text:"application/x-www-form-urlencoded"===t&&a.formData?o.body=eR(a.formData):o.body=a.formData}return new Request(n,o)}function eR(e){let t=new URLSearchParams;for(let[r,a]of e.entries())t.append(r,"string"==typeof a?a:a.name);return t}function eD(e){let t=new FormData;for(let[r,a]of e.entries())t.append(r,a);return t}function eP(e,t,r,a,n,o,i){let l,d,c,u,f,p,{loaderData:m,errors:v}=(d={},c=null,u=!1,f={},p=a&&eO(a[1])?a[1].error:void 0,t.forEach(e=>{if(!(e.route.id in r))return;let a=e.route.id,n=r[a];if(h(!eT(n),"Cannot handle redirect results in processLoaderData"),eO(n)){let e=n.error;void 0!==p&&(e=p,p=void 0),c=c||{},1;{let r=ek(t,a);null==c[r.route.id]&&(c[r.route.id]=e)}d[a]=void 0,u||(u=!0,l=Y(n.error)?n.error.status:500),n.headers&&(f[a]=n.headers)}else e_(n)?(i.set(a,n.deferredData),d[a]=n.deferredData.data,null==n.statusCode||200===n.statusCode||u||(l=n.statusCode)):(d[a]=n.data,n.statusCode&&200!==n.statusCode&&!u&&(l=n.statusCode)),n.headers&&(f[a]=n.headers)}),void 0!==p&&a&&(c={[a[0]]:p},d[a[0]]=void 0),{loaderData:d,errors:c,statusCode:l||200,loaderHeaders:f});return n.forEach(t=>{let{key:r,match:a,controller:n}=t,i=o[r];if(h(i,"Did not find corresponding fetcher result"),!n||!n.signal.aborted)if(eO(i)){let t=ek(e.matches,null==a?void 0:a.route.id);v&&v[t.route.id]||(v=s({},v,{[t.route.id]:i.error})),e.fetchers.delete(r)}else if(eT(i))h(!1,"Unhandled fetcher revalidation redirect");else if(e_(i))h(!1,"Unhandled fetcher deferred data");else{let t=eV(i.data);e.fetchers.set(r,t)}}),{loaderData:m,errors:v}}function ex(e,t,r,a){let n=s({},t);for(let o of r){let r=o.route.id;if(t.hasOwnProperty(r)?void 0!==t[r]&&(n[r]=t[r]):void 0!==e[r]&&o.route.loader&&(n[r]=e[r]),a&&a.hasOwnProperty(r))break}return n}function eL(e){return e?eO(e[1])?{actionData:{}}:{actionData:{[e[0]]:e[1].data}}:{}}function ek(e,t){return(t?e.slice(0,e.findIndex(e=>e.route.id===t)+1):[...e]).reverse().find(e=>!0===e.route.hasErrorBoundary)||e[0]}function ej(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 eM(e,t){let{pathname:r,routeId:a,method:n,type:o,message:i}=void 0===t?{}:t,s="Unknown Server Error",l="Unknown @remix-run/router error";return 400===e?(s="Bad Request",n&&r&&a?l="You made a "+n+' request to "'+r+'" but did not provide a `loader` for route "'+a+'", so there is no way to handle the request.':"defer-action"===o?l="defer() is not supported in actions":"invalid-body"===o&&(l="Unable to encode submission body")):403===e?(s="Forbidden",l='Route "'+a+'" does not match URL "'+r+'"'):404===e?(s="Not Found",l='No route matches URL "'+r+'"'):405===e&&(s="Method Not Allowed",n&&r&&a?l="You made a "+n.toUpperCase()+' request to "'+r+'" but did not provide an `action` for route "'+a+'", so there is no way to handle the request.':n&&(l='Invalid request method "'+n.toUpperCase()+'"')),new J(e||500,s,Error(l),!0)}function eA(e){let t=Object.entries(e);for(let e=t.length-1;e>=0;e--){