UNPKG

@techdocs/cli

Version:

Utility CLI for managing TechDocs sites in Backstage.

11 lines • 58.4 kB
"use strict";(()=>{(self.webpackChunktechdocs_cli_embedded_app=self.webpackChunktechdocs_cli_embedded_app||[]).push([[4538],{21613:(ja,vr,wr)=>{wr.d(vr,{AO:()=>le,Gh:()=>_t,HS:()=>Te,Oi:()=>z,Rr:()=>ne,o1:()=>jt,pX:()=>Ce,pb:()=>Ne,rc:()=>$,sC:()=>br,tH:()=>st,tW:()=>Ar,ue:()=>fe,yD:()=>Ot,zR:()=>Dr});/** * @remix-run/router v1.21.1 * * Copyright (c) Remix Software Inc. * * This source code is licensed under the MIT license found in the * LICENSE.md file in the root directory of this source tree. * * @license MIT */function A(){return A=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},A.apply(this,arguments)}var $;(function(e){e.Pop="POP",e.Push="PUSH",e.Replace="REPLACE"})($||($={}));const Et="popstate";function br(e){e===void 0&&(e={});let{initialEntries:t=["/"],initialIndex:r,v5Compat:a=!1}=e,n;n=t.map((h,v)=>y(h,typeof h=="string"?null:h.state,v===0?"default":void 0));let s=d(r??n.length-1),o=$.Pop,c=null;function d(h){return Math.min(Math.max(h,0),n.length-1)}function m(){return n[s]}function y(h,v,w){v===void 0&&(v=null);let L=ue(n?m().pathname:"/",h,v,w);return de(L.pathname.charAt(0)==="/","relative pathnames are not supported in memory history: "+JSON.stringify(h)),L}function g(h){return typeof h=="string"?h:le(h)}return{get index(){return s},get action(){return o},get location(){return m()},createHref:g,createURL(h){return new URL(g(h),"http://localhost")},encodeLocation(h){let v=typeof h=="string"?ne(h):h;return{pathname:v.pathname||"",search:v.search||"",hash:v.hash||""}},push(h,v){o=$.Push;let w=y(h,v);s+=1,n.splice(s,n.length,w),a&&c&&c({action:o,location:w,delta:1})},replace(h,v){o=$.Replace;let w=y(h,v);n[s]=w,a&&c&&c({action:o,location:w,delta:0})},go(h){o=$.Pop;let v=d(s+h),w=n[v];s=v,c&&c({action:o,location:w,delta:h})},listen(h){return c=h,()=>{c=null}}}}function Dr(e){e===void 0&&(e={});function t(a,n){let{pathname:s,search:o,hash:c}=a.location;return ue("",{pathname:s,search:o,hash:c},n.state&&n.state.usr||null,n.state&&n.state.key||"default")}function r(a,n){return typeof n=="string"?n:le(n)}return xt(t,r,null,e)}function Fa(e){e===void 0&&(e={});function t(n,s){let{pathname:o="/",search:c="",hash:d=""}=ne(n.location.hash.substr(1));return!o.startsWith("/")&&!o.startsWith(".")&&(o="/"+o),ue("",{pathname:o,search:c,hash:d},s.state&&s.state.usr||null,s.state&&s.state.key||"default")}function r(n,s){let o=n.document.querySelector("base"),c="";if(o&&o.getAttribute("href")){let d=n.location.href,m=d.indexOf("#");c=m===-1?d:d.slice(0,m)}return c+"#"+(typeof s=="string"?s:le(s))}function a(n,s){de(n.pathname.charAt(0)==="/","relative pathnames are not supported in hash history.push("+JSON.stringify(s)+")")}return xt(t,r,a,e)}function z(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function de(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function Rr(){return Math.random().toString(36).substr(2,8)}function Pt(e,t){return{usr:e.state,key:e.key,idx:t}}function ue(e,t,r,a){return r===void 0&&(r=null),A({pathname:typeof e=="string"?e:e.pathname,search:"",hash:""},typeof t=="string"?ne(t):t,{state:r,key:t&&t.key||a||Rr()})}function le(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 ne(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 xt(e,t,r,a){a===void 0&&(a={});let{window:n=document.defaultView,v5Compat:s=!1}=a,o=n.history,c=$.Pop,d=null,m=y();m==null&&(m=0,o.replaceState(A({},o.state,{idx:m}),""));function y(){return(o.state||{idx:null}).idx}function g(){c=$.Pop;let L=y(),O=L==null?null:L-m;m=L,d&&d({action:c,location:w.location,delta:O})}function S(L,O){c=$.Push;let x=ue(w.location,L,O);r&&r(x,L),m=y()+1;let F=Pt(x,m),b=w.createHref(x);try{o.pushState(F,"",b)}catch(k){if(k instanceof DOMException&&k.name==="DataCloneError")throw k;n.location.assign(b)}s&&d&&d({action:c,location:w.location,delta:1})}function h(L,O){c=$.Replace;let x=ue(w.location,L,O);r&&r(x,L),m=y();let F=Pt(x,m),b=w.createHref(x);o.replaceState(F,"",b),s&&d&&d({action:c,location:w.location,delta:0})}function v(L){let O=n.location.origin!=="null"?n.location.origin:n.location.href,x=typeof L=="string"?L:le(L);return x=x.replace(/ $/,"%20"),z(O,"No window.location.(origin|href) available to create URL for href: "+x),new URL(x,O)}let w={get action(){return c},get location(){return e(n,o)},listen(L){if(d)throw new Error("A history only accepts one active listener");return n.addEventListener(Et,g),d=L,()=>{n.removeEventListener(Et,g),d=null}},createHref(L){return t(n,L)},createURL:v,encodeLocation(L){let O=v(L);return{pathname:O.pathname,search:O.search,hash:O.hash}},push:S,replace:h,go(L){return o.go(L)}};return w}var H;(function(e){e.data="data",e.deferred="deferred",e.redirect="redirect",e.error="error"})(H||(H={}));const Sr=new Set(["lazy","caseSensitive","path","id","index","children"]);function Er(e){return e.index===!0}function He(e,t,r,a){return r===void 0&&(r=[]),a===void 0&&(a={}),e.map((n,s)=>{let o=[...r,String(s)],c=typeof n.id=="string"?n.id:o.join("-");if(z(n.index!==!0||!n.children,"Cannot specify children on an index route"),z(!a[c],'Found a route id collision on id "'+c+`". Route id's must be globally unique within Data Router usages`),Er(n)){let d=A({},n,t(n),{id:c});return a[c]=d,d}else{let d=A({},n,t(n),{id:c,children:void 0});return a[c]=d,n.children&&(d.children=He(n.children,t,o,a)),d}})}function fe(e,t,r){return r===void 0&&(r="/"),Je(e,t,r,!1)}function Je(e,t,r,a){let n=typeof t=="string"?ne(t):t,s=Ne(n.pathname||"/",r);if(s==null)return null;let o=Lt(e);xr(o);let c=null;for(let d=0;c==null&&d<o.length;++d){let m=Hr(s);c=Ur(o[d],m,a)}return c}function Pr(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}}function Lt(e,t,r,a){t===void 0&&(t=[]),r===void 0&&(r=[]),a===void 0&&(a="");let n=(s,o,c)=>{let d={relativePath:c===void 0?s.path||"":c,caseSensitive:s.caseSensitive===!0,childrenIndex:o,route:s};d.relativePath.startsWith("/")&&(z(d.relativePath.startsWith(a),'Absolute route path "'+d.relativePath+'" nested under path '+('"'+a+'" is not valid. An absolute child route path ')+"must start with the combined path of all its parent routes."),d.relativePath=d.relativePath.slice(a.length));let m=Te([a,d.relativePath]),y=r.concat(d);s.children&&s.children.length>0&&(z(s.index!==!0,"Index routes must not have child routes. Please remove "+('all child routes from route path "'+m+'".')),Lt(s.children,t,y,m)),!(s.path==null&&!s.index)&&t.push({path:m,score:Or(m,s.index),routesMeta:y})};return e.forEach((s,o)=>{var c;if(s.path===""||!((c=s.path)!=null&&c.includes("?")))n(s,o);else for(let d of Mt(s.path))n(s,o,d)}),t}function Mt(e){let t=e.split("/");if(t.length===0)return[];let[r,...a]=t,n=r.endsWith("?"),s=r.replace(/\?$/,"");if(a.length===0)return n?[s,""]:[s];let o=Mt(a.join("/")),c=[];return c.push(...o.map(d=>d===""?s:[s,d].join("/"))),n&&c.push(...o),c.map(d=>e.startsWith("/")&&d===""?"/":d)}function xr(e){e.sort((t,r)=>t.score!==r.score?r.score-t.score:_r(t.routesMeta.map(a=>a.childrenIndex),r.routesMeta.map(a=>a.childrenIndex)))}const Lr=/^:[\w-]+$/,Mr=3,Tr=2,Cr=1,jr=10,Fr=-2,Tt=e=>e==="*";function Or(e,t){let r=e.split("/"),a=r.length;return r.some(Tt)&&(a+=Fr),t&&(a+=Tr),r.filter(n=>!Tt(n)).reduce((n,s)=>n+(Lr.test(s)?Mr:s===""?Cr:jr),a)}function _r(e,t){return e.length===t.length&&e.slice(0,-1).every((a,n)=>a===t[n])?e[e.length-1]-t[t.length-1]:0}function Ur(e,t,r){r===void 0&&(r=!1);let{routesMeta:a}=e,n={},s="/",o=[];for(let c=0;c<a.length;++c){let d=a[c],m=c===a.length-1,y=s==="/"?t:t.slice(s.length)||"/",g=Ct({path:d.relativePath,caseSensitive:d.caseSensitive,end:m},y),S=d.route;if(!g&&m&&r&&!a[a.length-1].route.index&&(g=Ct({path:d.relativePath,caseSensitive:d.caseSensitive,end:!1},y)),!g)return null;Object.assign(n,g.params),o.push({params:n,pathname:Te([s,g.pathname]),pathnameBase:zr(Te([s,g.pathnameBase])),route:S}),g.pathnameBase!=="/"&&(s=Te([s,g.pathnameBase]))}return o}function Ar(e,t){t===void 0&&(t={});let r=e;r.endsWith("*")&&r!=="*"&&!r.endsWith("/*")&&(de(!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(/\*$/,"/*"));const a=r.startsWith("/")?"/":"",n=o=>o==null?"":typeof o=="string"?o:String(o),s=r.split(/\/+/).map((o,c,d)=>{if(c===d.length-1&&o==="*")return n(t["*"]);const y=o.match(/^:([\w-]+)(\??)$/);if(y){const[,g,S]=y;let h=t[g];return z(S==="?"||h!=null,'Missing ":'+g+'" param'),n(h)}return o.replace(/\?$/g,"")}).filter(o=>!!o);return a+s.join("/")}function Ct(e,t){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[r,a]=Ir(e.path,e.caseSensitive,e.end),n=t.match(r);if(!n)return null;let s=n[0],o=s.replace(/(.)\/+$/,"$1"),c=n.slice(1);return{params:a.reduce((m,y,g)=>{let{paramName:S,isOptional:h}=y;if(S==="*"){let w=c[g]||"";o=s.slice(0,s.length-w.length).replace(/(.)\/+$/,"$1")}const v=c[g];return h&&!v?m[S]=void 0:m[S]=(v||"").replace(/%2F/g,"/"),m},{}),pathname:s,pathnameBase:o,pattern:e}}function Ir(e,t,r){t===void 0&&(t=!1),r===void 0&&(r=!0),de(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 a=[],n="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(o,c,d)=>(a.push({paramName:c,isOptional:d!=null}),d?"/?([^\\/]+)?":"/([^\\/]+)"));return e.endsWith("*")?(a.push({paramName:"*"}),n+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):r?n+="\\/*$":e!==""&&e!=="/"&&(n+="(?:(?=\\/|$))"),[new RegExp(n,t?void 0:"i"),a]}function Hr(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return de(!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 Ne(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)||"/"}function jt(e,t){t===void 0&&(t="/");let{pathname:r,search:a="",hash:n=""}=typeof e=="string"?ne(e):e;return{pathname:r?r.startsWith("/")?r:Nr(r,t):t,search:Br(a),hash:Wr(n)}}function Nr(e,t){let r=t.replace(/\/+$/,"").split("/");return e.split("/").forEach(n=>{n===".."?r.length>1&&r.pop():n!=="."&&r.push(n)}),r.length>1?r.join("/"):"/"}function lt(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 Ft(e){return e.filter((t,r)=>r===0||t.route.path&&t.route.path.length>0)}function Ot(e,t){let r=Ft(e);return t?r.map((a,n)=>n===r.length-1?a.pathname:a.pathnameBase):r.map(a=>a.pathnameBase)}function _t(e,t,r,a){a===void 0&&(a=!1);let n;typeof e=="string"?n=ne(e):(n=A({},e),z(!n.pathname||!n.pathname.includes("?"),lt("?","pathname","search",n)),z(!n.pathname||!n.pathname.includes("#"),lt("#","pathname","hash",n)),z(!n.search||!n.search.includes("#"),lt("#","search","hash",n)));let s=e===""||n.pathname==="",o=s?"/":n.pathname,c;if(o==null)c=r;else{let g=t.length-1;if(!a&&o.startsWith("..")){let S=o.split("/");for(;S[0]==="..";)S.shift(),g-=1;n.pathname=S.join("/")}c=g>=0?t[g]:"/"}let d=jt(n,c),m=o&&o!=="/"&&o.endsWith("/"),y=(s||o===".")&&r.endsWith("/");return!d.pathname.endsWith("/")&&(m||y)&&(d.pathname+="/"),d}function Oa(e){return e===""||e.pathname===""?"/":typeof e=="string"?ne(e).pathname:e.pathname}const Te=e=>e.join("/").replace(/\/\/+/g,"/"),zr=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),Br=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,Wr=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e,_a=function(t,r){r===void 0&&(r={});let a=typeof r=="number"?{status:r}:r,n=new Headers(a.headers);return n.has("Content-Type")||n.set("Content-Type","application/json; charset=utf-8"),new Response(JSON.stringify(t),A({},a,{headers:n}))};class kr{constructor(t,r){this.type="DataWithResponseInit",this.data=t,this.init=r||null}}function Ua(e,t){return new kr(e,typeof t=="number"?{status:t}:t)}class st extends Error{}class Kr{constructor(t,r){this.pendingKeysSet=new Set,this.subscribers=new Set,this.deferredKeys=[],z(t&&typeof t=="object"&&!Array.isArray(t),"defer() only accepts plain objects");let a;this.abortPromise=new Promise((s,o)=>a=o),this.controller=new AbortController;let n=()=>a(new st("Deferred data aborted"));this.unlistenAbortSignal=()=>this.controller.signal.removeEventListener("abort",n),this.controller.signal.addEventListener("abort",n),this.data=Object.entries(t).reduce((s,o)=>{let[c,d]=o;return Object.assign(s,{[c]:this.trackPromise(c,d)})},{}),this.done&&this.unlistenAbortSignal(),this.init=r}trackPromise(t,r){if(!(r instanceof Promise))return r;this.deferredKeys.push(t),this.pendingKeysSet.add(t);let a=Promise.race([r,this.abortPromise]).then(n=>this.onSettle(a,t,void 0,n),n=>this.onSettle(a,t,n));return a.catch(()=>{}),Object.defineProperty(a,"_tracked",{get:()=>!0}),a}onSettle(t,r,a,n){if(this.controller.signal.aborted&&a instanceof st)return this.unlistenAbortSignal(),Object.defineProperty(t,"_error",{get:()=>a}),Promise.reject(a);if(this.pendingKeysSet.delete(r),this.done&&this.unlistenAbortSignal(),a===void 0&&n===void 0){let s=new Error('Deferred data for key "'+r+'" resolved/rejected with `undefined`, you must resolve/reject with a value or `null`.');return Object.defineProperty(t,"_error",{get:()=>s}),this.emit(!1,r),Promise.reject(s)}return n===void 0?(Object.defineProperty(t,"_error",{get:()=>a}),this.emit(!1,r),Promise.reject(a)):(Object.defineProperty(t,"_data",{get:()=>n}),this.emit(!1,r),n)}emit(t,r){this.subscribers.forEach(a=>a(t,r))}subscribe(t){return this.subscribers.add(t),()=>this.subscribers.delete(t)}cancel(){this.controller.abort(),this.pendingKeysSet.forEach((t,r)=>this.pendingKeysSet.delete(r)),this.emit(!0)}async resolveData(t){let r=!1;if(!this.done){let a=()=>this.cancel();t.addEventListener("abort",a),r=await new Promise(n=>{this.subscribe(s=>{t.removeEventListener("abort",a),(s||this.done)&&n(s)})})}return r}get done(){return this.pendingKeysSet.size===0}get unwrappedData(){return z(this.data!==null&&this.done,"Can only unwrap data on initialized and settled deferreds"),Object.entries(this.data).reduce((t,r)=>{let[a,n]=r;return Object.assign(t,{[a]:Vr(n)})},{})}get pendingKeys(){return Array.from(this.pendingKeysSet)}}function $r(e){return e instanceof Promise&&e._tracked===!0}function Vr(e){if(!$r(e))return e;if(e._error)throw e._error;return e._data}const Aa=function(t,r){r===void 0&&(r={});let a=typeof r=="number"?{status:r}:r;return new Kr(t,a)},Ut=function(t,r){r===void 0&&(r=302);let a=r;typeof a=="number"?a={status:a}:typeof a.status>"u"&&(a.status=302);let n=new Headers(a.headers);return n.set("Location",t),new Response(null,A({},a,{headers:n}))},Ia=(e,t)=>{let r=Ut(e,t);return r.headers.set("X-Remix-Reload-Document","true"),r},Ha=(e,t)=>{let r=Ut(e,t);return r.headers.set("X-Remix-Replace","true"),r};class dt{constructor(t,r,a,n){n===void 0&&(n=!1),this.status=t,this.statusText=r||"",this.internal=n,a instanceof Error?(this.data=a.toString(),this.error=a):this.data=a}}function Ce(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}const At=["post","put","patch","delete"],Yr=new Set(At),Jr=["get",...At],Xr=new Set(Jr),Gr=new Set([301,302,303,307,308]),Qr=new Set([307,308]),ut={state:"idle",location:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0},Zr={state:"idle",data:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0},ze={state:"unblocked",proceed:void 0,reset:void 0,location:void 0},ft=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,It=e=>({hasErrorBoundary:!!e.hasErrorBoundary}),Ht="remix-router-transitions";function Na(e){const t=e.window?e.window:typeof window<"u"?window:void 0,r=typeof t<"u"&&typeof t.document<"u"&&typeof t.document.createElement<"u",a=!r;z(e.routes.length>0,"You must provide a non-empty routes array to createRouter");let n;if(e.mapRouteProperties)n=e.mapRouteProperties;else if(e.detectErrorBoundary){let i=e.detectErrorBoundary;n=l=>({hasErrorBoundary:i(l)})}else n=It;let s={},o=He(e.routes,n,void 0,s),c,d=e.basename||"/",m=e.dataStrategy||Vt,y=e.patchRoutesOnNavigation,g=A({v7_fetcherPersist:!1,v7_normalizeFormMethod:!1,v7_partialHydration:!1,v7_prependBasename:!1,v7_relativeSplatPath:!1,v7_skipActionErrorRevalidation:!1},e.future),S=null,h=new Set,v=null,w=null,L=null,O=e.hydrationData!=null,x=fe(o,e.history.location,d),F=null;if(x==null&&!y){let i=V(404,{pathname:e.history.location.pathname}),{matches:l,route:u}=Xe(o);x=l,F={[u.id]:i}}x&&!e.hydrationData&&at(x,o,e.history.location.pathname).active&&(x=null);let b;if(x)if(x.some(i=>i.route.lazy))b=!1;else if(!x.some(i=>i.route.loader))b=!0;else if(g.v7_partialHydration){let i=e.hydrationData?e.hydrationData.loaderData:null,l=e.hydrationData?e.hydrationData.errors:null;if(l){let u=x.findIndex(p=>l[p.route.id]!==void 0);b=x.slice(0,u+1).every(p=>!pt(p.route,i,l))}else b=x.every(u=>!pt(u.route,i,l))}else b=e.hydrationData!=null;else if(b=!1,x=[],g.v7_partialHydration){let i=at(null,o,e.history.location.pathname);i.active&&i.matches&&(x=i.matches)}let k,f={historyAction:e.history.action,location:e.history.location,matches:x,initialized:b,navigation:ut,restoreScrollPosition:e.hydrationData!=null?!1:null,preventScrollReset:!1,revalidation:"idle",loaderData:e.hydrationData&&e.hydrationData.loaderData||{},actionData:e.hydrationData&&e.hydrationData.actionData||null,errors:e.hydrationData&&e.hydrationData.errors||F,fetchers:new Map,blockers:new Map},C=$.Pop,I=!1,_,G=!1,Y=new Map,ie=null,ae=!1,he=!1,Qe=[],Ze=new Set,Z=new Map,qe=0,We=-1,Fe=new Map,pe=new Set,Oe=new Map,ke=new Map,oe=new Set,Ee=new Map,Pe=new Map,et;function pa(){if(S=e.history.listen(i=>{let{action:l,location:u,delta:p}=i;if(et){et(),et=void 0;return}de(Pe.size===0||p!=null,"You are trying to use a blocker on a POP navigation to a location that was not created by @remix-run/router. This will fail silently in production. This can happen if you are navigating outside the router via `window.history.pushState`/`window.location.hash` instead of using router navigation APIs. This can also happen if you are using createHashRouter and the user manually changes the URL.");let D=pr({currentLocation:f.location,nextLocation:u,historyAction:l});if(D&&p!=null){let M=new Promise(j=>{et=j});e.history.go(p*-1),rt(D,{state:"blocked",location:u,proceed(){rt(D,{state:"proceeding",proceed:void 0,reset:void 0,location:u}),M.then(()=>e.history.go(p))},reset(){let j=new Map(f.blockers);j.set(D,ze),te({blockers:j})}});return}return xe(l,u)}),r){ca(t,Y);let i=()=>ha(t,Y);t.addEventListener("pagehide",i),ie=()=>t.removeEventListener("pagehide",i)}return f.initialized||xe($.Pop,f.location,{initialHydration:!0}),k}function ma(){S&&S(),ie&&ie(),h.clear(),_&&_.abort(),f.fetchers.forEach((i,l)=>tt(l)),f.blockers.forEach((i,l)=>hr(l))}function ya(i){return h.add(i),()=>h.delete(i)}function te(i,l){l===void 0&&(l={}),f=A({},f,i);let u=[],p=[];g.v7_fetcherPersist&&f.fetchers.forEach((D,M)=>{D.state==="idle"&&(oe.has(M)?p.push(M):u.push(M))}),oe.forEach(D=>{!f.fetchers.has(D)&&!Z.has(D)&&p.push(D)}),[...h].forEach(D=>D(f,{deletedFetchers:p,viewTransitionOpts:l.viewTransitionOpts,flushSync:l.flushSync===!0})),g.v7_fetcherPersist?(u.forEach(D=>f.fetchers.delete(D)),p.forEach(D=>tt(D))):p.forEach(D=>oe.delete(D))}function _e(i,l,u){var p,D;let{flushSync:M}=u===void 0?{}:u,j=f.actionData!=null&&f.navigation.formMethod!=null&&re(f.navigation.formMethod)&&f.navigation.state==="loading"&&((p=i.state)==null?void 0:p._isRedirect)!==!0,E;l.actionData?Object.keys(l.actionData).length>0?E=l.actionData:E=null:j?E=f.actionData:E=null;let P=l.loaderData?er(f.loaderData,l.loaderData,l.matches||[],l.errors):f.loaderData,R=f.blockers;R.size>0&&(R=new Map(R),R.forEach((N,ee)=>R.set(ee,ze)));let T=I===!0||f.navigation.formMethod!=null&&re(f.navigation.formMethod)&&((D=i.state)==null?void 0:D._isRedirect)!==!0;c&&(o=c,c=void 0),ae||C===$.Pop||(C===$.Push?e.history.push(i,i.state):C===$.Replace&&e.history.replace(i,i.state));let U;if(C===$.Pop){let N=Y.get(f.location.pathname);N&&N.has(i.pathname)?U={currentLocation:f.location,nextLocation:i}:Y.has(i.pathname)&&(U={currentLocation:i,nextLocation:f.location})}else if(G){let N=Y.get(f.location.pathname);N?N.add(i.pathname):(N=new Set([i.pathname]),Y.set(f.location.pathname,N)),U={currentLocation:f.location,nextLocation:i}}te(A({},l,{actionData:E,loaderData:P,historyAction:C,location:i,initialized:!0,navigation:ut,revalidation:"idle",restoreScrollPosition:yr(i,l.matches||f.matches),preventScrollReset:T,blockers:R}),{viewTransitionOpts:U,flushSync:M===!0}),C=$.Pop,I=!1,G=!1,ae=!1,he=!1,Qe=[]}async function or(i,l){if(typeof i=="number"){e.history.go(i);return}let u=ct(f.location,f.matches,d,g.v7_prependBasename,i,g.v7_relativeSplatPath,l?.fromRouteId,l?.relative),{path:p,submission:D,error:M}=zt(g.v7_normalizeFormMethod,!1,u,l),j=f.location,E=ue(f.location,p,l&&l.state);E=A({},E,e.history.encodeLocation(E));let P=l&&l.replace!=null?l.replace:void 0,R=$.Push;P===!0?R=$.Replace:P===!1||D!=null&&re(D.formMethod)&&D.formAction===f.location.pathname+f.location.search&&(R=$.Replace);let T=l&&"preventScrollReset"in l?l.preventScrollReset===!0:void 0,U=(l&&l.flushSync)===!0,N=pr({currentLocation:j,nextLocation:E,historyAction:R});if(N){rt(N,{state:"blocked",location:E,proceed(){rt(N,{state:"proceeding",proceed:void 0,reset:void 0,location:E}),or(i,l)},reset(){let ee=new Map(f.blockers);ee.set(N,ze),te({blockers:ee})}});return}return await xe(R,E,{submission:D,pendingError:M,preventScrollReset:T,replace:l&&l.replace,enableViewTransition:l&&l.viewTransition,flushSync:U})}function ga(){if(bt(),te({revalidation:"loading"}),f.navigation.state!=="submitting"){if(f.navigation.state==="idle"){xe(f.historyAction,f.location,{startUninterruptedRevalidation:!0});return}xe(C||f.historyAction,f.navigation.location,{overrideNavigation:f.navigation,enableViewTransition:G===!0})}}async function xe(i,l,u){_&&_.abort(),_=null,C=i,ae=(u&&u.startUninterruptedRevalidation)===!0,La(f.location,f.matches),I=(u&&u.preventScrollReset)===!0,G=(u&&u.enableViewTransition)===!0;let p=c||o,D=u&&u.overrideNavigation,M=fe(p,l,d),j=(u&&u.flushSync)===!0,E=at(M,p,l.pathname);if(E.active&&E.matches&&(M=E.matches),!M){let{error:K,notFoundMatches:W,route:J}=Dt(l.pathname);_e(l,{matches:W,loaderData:{},errors:{[J.id]:K}},{flushSync:j});return}if(f.initialized&&!he&&na(f.location,l)&&!(u&&u.submission&&re(u.submission.formMethod))){_e(l,{matches:M},{flushSync:j});return}_=new AbortController;let P=je(e.history,l,_.signal,u&&u.submission),R;if(u&&u.pendingError)R=[ge(M).route.id,{type:H.error,error:u.pendingError}];else if(u&&u.submission&&re(u.submission.formMethod)){let K=await va(P,l,u.submission,M,E.active,{replace:u.replace,flushSync:j});if(K.shortCircuited)return;if(K.pendingActionResult){let[W,J]=K.pendingActionResult;if(q(J)&&Ce(J.error)&&J.error.status===404){_=null,_e(l,{matches:K.matches,loaderData:{},errors:{[W]:J.error}});return}}M=K.matches||M,R=K.pendingActionResult,D=wt(l,u.submission),j=!1,E.active=!1,P=je(e.history,P.url,P.signal)}let{shortCircuited:T,matches:U,loaderData:N,errors:ee}=await wa(P,l,M,E.active,D,u&&u.submission,u&&u.fetcherSubmission,u&&u.replace,u&&u.initialHydration===!0,j,R);T||(_=null,_e(l,A({matches:U||M},tr(R),{loaderData:N,errors:ee})))}async function va(i,l,u,p,D,M){M===void 0&&(M={}),bt();let j=ua(l,u);if(te({navigation:j},{flushSync:M.flushSync===!0}),D){let R=await nt(p,l.pathname,i.signal);if(R.type==="aborted")return{shortCircuited:!0};if(R.type==="error"){let T=ge(R.partialMatches).route.id;return{matches:R.partialMatches,pendingActionResult:[T,{type:H.error,error:R.error}]}}else if(R.matches)p=R.matches;else{let{notFoundMatches:T,error:U,route:N}=Dt(l.pathname);return{matches:T,pendingActionResult:[N.id,{type:H.error,error:U}]}}}let E,P=Se(p,l);if(!P.route.action&&!P.route.lazy)E={type:H.error,error:V(405,{method:i.method,pathname:l.pathname,routeId:P.route.id})};else if(E=(await Ke("action",f,i,[P],p,null))[P.route.id],i.signal.aborted)return{shortCircuited:!0};if(ve(E)){let R;return M&&M.replace!=null?R=M.replace:R=Gt(E.response.headers.get("Location"),new URL(i.url),d)===f.location.pathname+f.location.search,await Le(i,E,!0,{submission:u,replace:R}),{shortCircuited:!0}}if(ce(E))throw V(400,{type:"defer-action"});if(q(E)){let R=ge(p,P.route.id);return(M&&M.replace)!==!0&&(C=$.Push),{matches:p,pendingActionResult:[R.route.id,E]}}return{matches:p,pendingActionResult:[P.route.id,E]}}async function wa(i,l,u,p,D,M,j,E,P,R,T){let U=D||wt(l,M),N=M||j||ir(U),ee=!ae&&(!g.v7_partialHydration||!P);if(p){if(ee){let X=lr(T);te(A({navigation:U},X!==void 0?{actionData:X}:{}),{flushSync:R})}let B=await nt(u,l.pathname,i.signal);if(B.type==="aborted")return{shortCircuited:!0};if(B.type==="error"){let X=ge(B.partialMatches).route.id;return{matches:B.partialMatches,loaderData:{},errors:{[X]:B.error}}}else if(B.matches)u=B.matches;else{let{error:X,notFoundMatches:Ae,route:Ye}=Dt(l.pathname);return{matches:Ae,loaderData:{},errors:{[Ye.id]:X}}}}let K=c||o,[W,J]=Bt(e.history,f,u,N,l,g.v7_partialHydration&&P===!0,g.v7_skipActionErrorRevalidation,he,Qe,Ze,oe,Oe,pe,K,d,T);if(Rt(B=>!(u&&u.some(X=>X.route.id===B))||W&&W.some(X=>X.route.id===B)),We=++qe,W.length===0&&J.length===0){let B=fr();return _e(l,A({matches:u,loaderData:{},errors:T&&q(T[1])?{[T[0]]:T[1].error}:null},tr(T),B?{fetchers:new Map(f.fetchers)}:{}),{flushSync:R}),{shortCircuited:!0}}if(ee){let B={};if(!p){B.navigation=U;let X=lr(T);X!==void 0&&(B.actionData=X)}J.length>0&&(B.fetchers=ba(J)),te(B,{flushSync:R})}J.forEach(B=>{Re(B.key),B.controller&&Z.set(B.key,B.controller)});let Ue=()=>J.forEach(B=>Re(B.key));_&&_.signal.addEventListener("abort",Ue);let{loaderResults:$e,fetcherResults:ye}=await sr(f,u,W,J,i);if(i.signal.aborted)return{shortCircuited:!0};_&&_.signal.removeEventListener("abort",Ue),J.forEach(B=>Z.delete(B.key));let se=Ge($e);if(se)return await Le(i,se.result,!0,{replace:E}),{shortCircuited:!0};if(se=Ge(ye),se)return pe.add(se.key),await Le(i,se.result,!0,{replace:E}),{shortCircuited:!0};let{loaderData:St,errors:Ve}=qt(f,u,$e,T,J,ye,Ee);Ee.forEach((B,X)=>{B.subscribe(Ae=>{(Ae||B.done)&&Ee.delete(X)})}),g.v7_partialHydration&&P&&f.errors&&(Ve=A({},f.errors,Ve));let Me=fr(),it=cr(We),ot=Me||it||J.length>0;return A({matches:u,loaderData:St,errors:Ve},ot?{fetchers:new Map(f.fetchers)}:{})}function lr(i){if(i&&!q(i[1]))return{[i[0]]:i[1].data};if(f.actionData)return Object.keys(f.actionData).length===0?null:f.actionData}function ba(i){return i.forEach(l=>{let u=f.fetchers.get(l.key),p=Be(void 0,u?u.data:void 0);f.fetchers.set(l.key,p)}),new Map(f.fetchers)}function Da(i,l,u,p){if(a)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.");Re(i);let D=(p&&p.flushSync)===!0,M=c||o,j=ct(f.location,f.matches,d,g.v7_prependBasename,u,g.v7_relativeSplatPath,l,p?.relative),E=fe(M,j,d),P=at(E,M,j);if(P.active&&P.matches&&(E=P.matches),!E){me(i,l,V(404,{pathname:j}),{flushSync:D});return}let{path:R,submission:T,error:U}=zt(g.v7_normalizeFormMethod,!0,j,p);if(U){me(i,l,U,{flushSync:D});return}let N=Se(E,R),ee=(p&&p.preventScrollReset)===!0;if(T&&re(T.formMethod)){Ra(i,l,R,N,E,P.active,D,ee,T);return}Oe.set(i,{routeId:l,path:R}),Sa(i,l,R,N,E,P.active,D,ee,T)}async function Ra(i,l,u,p,D,M,j,E,P){bt(),Oe.delete(i);function R(Q){if(!Q.route.action&&!Q.route.lazy){let Ie=V(405,{method:P.formMethod,pathname:u,routeId:l});return me(i,l,Ie,{flushSync:j}),!0}return!1}if(!M&&R(p))return;let T=f.fetchers.get(i);De(i,fa(P,T),{flushSync:j});let U=new AbortController,N=je(e.history,u,U.signal,P);if(M){let Q=await nt(D,u,N.signal);if(Q.type==="aborted")return;if(Q.type==="error"){me(i,l,Q.error,{flushSync:j});return}else if(Q.matches){if(D=Q.matches,p=Se(D,u),R(p))return}else{me(i,l,V(404,{pathname:u}),{flushSync:j});return}}Z.set(i,U);let ee=qe,W=(await Ke("action",f,N,[p],D,i))[p.route.id];if(N.signal.aborted){Z.get(i)===U&&Z.delete(i);return}if(g.v7_fetcherPersist&&oe.has(i)){if(ve(W)||q(W)){De(i,be(void 0));return}}else{if(ve(W))if(Z.delete(i),We>ee){De(i,be(void 0));return}else return pe.add(i),De(i,Be(P)),Le(N,W,!1,{fetcherSubmission:P,preventScrollReset:E});if(q(W)){me(i,l,W.error);return}}if(ce(W))throw V(400,{type:"defer-action"});let J=f.navigation.location||f.location,Ue=je(e.history,J,U.signal),$e=c||o,ye=f.navigation.state!=="idle"?fe($e,f.navigation.location,d):f.matches;z(ye,"Didn't find any matches after fetcher action");let se=++qe;Fe.set(i,se);let St=Be(P,W.data);f.fetchers.set(i,St);let[Ve,Me]=Bt(e.history,f,ye,P,J,!1,g.v7_skipActionErrorRevalidation,he,Qe,Ze,oe,Oe,pe,$e,d,[p.route.id,W]);Me.filter(Q=>Q.key!==i).forEach(Q=>{let Ie=Q.key,gr=f.fetchers.get(Ie),Ca=Be(void 0,gr?gr.data:void 0);f.fetchers.set(Ie,Ca),Re(Ie),Q.controller&&Z.set(Ie,Q.controller)}),te({fetchers:new Map(f.fetchers)});let it=()=>Me.forEach(Q=>Re(Q.key));U.signal.addEventListener("abort",it);let{loaderResults:ot,fetcherResults:B}=await sr(f,ye,Ve,Me,Ue);if(U.signal.aborted)return;U.signal.removeEventListener("abort",it),Fe.delete(i),Z.delete(i),Me.forEach(Q=>Z.delete(Q.key));let X=Ge(ot);if(X)return Le(Ue,X.result,!1,{preventScrollReset:E});if(X=Ge(B),X)return pe.add(X.key),Le(Ue,X.result,!1,{preventScrollReset:E});let{loaderData:Ae,errors:Ye}=qt(f,ye,ot,void 0,Me,B,Ee);if(f.fetchers.has(i)){let Q=be(W.data);f.fetchers.set(i,Q)}cr(se),f.navigation.state==="loading"&&se>We?(z(C,"Expected pending action"),_&&_.abort(),_e(f.navigation.location,{matches:ye,loaderData:Ae,errors:Ye,fetchers:new Map(f.fetchers)})):(te({errors:Ye,loaderData:er(f.loaderData,Ae,ye,Ye),fetchers:new Map(f.fetchers)}),he=!1)}async function Sa(i,l,u,p,D,M,j,E,P){let R=f.fetchers.get(i);De(i,Be(P,R?R.data:void 0),{flushSync:j});let T=new AbortController,U=je(e.history,u,T.signal);if(M){let W=await nt(D,u,U.signal);if(W.type==="aborted")return;if(W.type==="error"){me(i,l,W.error,{flushSync:j});return}else if(W.matches)D=W.matches,p=Se(D,u);else{me(i,l,V(404,{pathname:u}),{flushSync:j});return}}Z.set(i,T);let N=qe,K=(await Ke("loader",f,U,[p],D,i))[p.route.id];if(ce(K)&&(K=await gt(K,U.signal,!0)||K),Z.get(i)===T&&Z.delete(i),!U.signal.aborted){if(oe.has(i)){De(i,be(void 0));return}if(ve(K))if(We>N){De(i,be(void 0));return}else{pe.add(i),await Le(U,K,!1,{preventScrollReset:E});return}if(q(K)){me(i,l,K.error);return}z(!ce(K),"Unhandled fetcher deferred data"),De(i,be(K.data))}}async function Le(i,l,u,p){let{submission:D,fetcherSubmission:M,preventScrollReset:j,replace:E}=p===void 0?{}:p;l.response.headers.has("X-Remix-Revalidate")&&(he=!0);let P=l.response.headers.get("Location");z(P,"Expected a Location header on the redirect Response"),P=Gt(P,new URL(i.url),d);let R=ue(f.location,P,{_isRedirect:!0});if(r){let W=!1;if(l.response.headers.has("X-Remix-Reload-Document"))W=!0;else if(ft.test(P)){const J=e.history.createURL(P);W=J.origin!==t.location.origin||Ne(J.pathname,d)==null}if(W){E?t.location.replace(P):t.location.assign(P);return}}_=null;let T=E===!0||l.response.headers.has("X-Remix-Replace")?$.Replace:$.Push,{formMethod:U,formAction:N,formEncType:ee}=f.navigation;!D&&!M&&U&&N&&ee&&(D=ir(f.navigation));let K=D||M;if(Qr.has(l.response.status)&&K&&re(K.formMethod))await xe(T,R,{submission:A({},K,{formAction:P}),preventScrollReset:j||I,enableViewTransition:u?G:void 0});else{let W=wt(R,D);await xe(T,R,{overrideNavigation:W,fetcherSubmission:M,preventScrollReset:j||I,enableViewTransition:u?G:void 0})}}async function Ke(i,l,u,p,D,M){let j,E={};try{j=await Yt(m,i,l,u,p,D,M,s,n)}catch(P){return p.forEach(R=>{E[R.route.id]={type:H.error,error:P}}),E}for(let[P,R]of Object.entries(j))if(ar(R)){let T=R.result;E[P]={type:H.redirect,response:Xt(T,u,P,D,d,g.v7_relativeSplatPath)}}else E[P]=await Jt(R);return E}async function sr(i,l,u,p,D){let M=i.matches,j=Ke("loader",i,D,u,l,null),E=Promise.all(p.map(async T=>{if(T.matches&&T.match&&T.controller){let N=(await Ke("loader",i,je(e.history,T.path,T.controller.signal),[T.match],T.matches,T.key))[T.match.route.id];return{[T.key]:N}}else return Promise.resolve({[T.key]:{type:H.error,error:V(404,{pathname:T.path})}})})),P=await j,R=(await E).reduce((T,U)=>Object.assign(T,U),{});return await Promise.all([sa(l,P,D.signal,M,i.loaderData),da(l,R,p)]),{loaderResults:P,fetcherResults:R}}function bt(){he=!0,Qe.push(...Rt()),Oe.forEach((i,l)=>{Z.has(l)&&Ze.add(l),Re(l)})}function De(i,l,u){u===void 0&&(u={}),f.fetchers.set(i,l),te({fetchers:new Map(f.fetchers)},{flushSync:(u&&u.flushSync)===!0})}function me(i,l,u,p){p===void 0&&(p={});let D=ge(f.matches,l);tt(i),te({errors:{[D.route.id]:u},fetchers:new Map(f.fetchers)},{flushSync:(p&&p.flushSync)===!0})}function dr(i){return ke.set(i,(ke.get(i)||0)+1),oe.has(i)&&oe.delete(i),f.fetchers.get(i)||Zr}function tt(i){let l=f.fetchers.get(i);Z.has(i)&&!(l&&l.state==="loading"&&Fe.has(i))&&Re(i),Oe.delete(i),Fe.delete(i),pe.delete(i),g.v7_fetcherPersist&&oe.delete(i),Ze.delete(i),f.fetchers.delete(i)}function Ea(i){let l=(ke.get(i)||0)-1;l<=0?(ke.delete(i),oe.add(i),g.v7_fetcherPersist||tt(i)):ke.set(i,l),te({fetchers:new Map(f.fetchers)})}function Re(i){let l=Z.get(i);l&&(l.abort(),Z.delete(i))}function ur(i){for(let l of i){let u=dr(l),p=be(u.data);f.fetchers.set(l,p)}}function fr(){let i=[],l=!1;for(let u of pe){let p=f.fetchers.get(u);z(p,"Expected fetcher: "+u),p.state==="loading"&&(pe.delete(u),i.push(u),l=!0)}return ur(i),l}function cr(i){let l=[];for(let[u,p]of Fe)if(p<i){let D=f.fetchers.get(u);z(D,"Expected fetcher: "+u),D.state==="loading"&&(Re(u),Fe.delete(u),l.push(u))}return ur(l),l.length>0}function Pa(i,l){let u=f.blockers.get(i)||ze;return Pe.get(i)!==l&&Pe.set(i,l),u}function hr(i){f.blockers.delete(i),Pe.delete(i)}function rt(i,l){let u=f.blockers.get(i)||ze;z(u.state==="unblocked"&&l.state==="blocked"||u.state==="blocked"&&l.state==="blocked"||u.state==="blocked"&&l.state==="proceeding"||u.state==="blocked"&&l.state==="unblocked"||u.state==="proceeding"&&l.state==="unblocked","Invalid blocker state transition: "+u.state+" -> "+l.state);let p=new Map(f.blockers);p.set(i,l),te({blockers:p})}function pr(i){let{currentLocation:l,nextLocation:u,historyAction:p}=i;if(Pe.size===0)return;Pe.size>1&&de(!1,"A router only supports one blocker at a time");let D=Array.from(Pe.entries()),[M,j]=D[D.length-1],E=f.blockers.get(M);if(!(E&&E.state==="proceeding")&&j({currentLocation:l,nextLocation:u,historyAction:p}))return M}function Dt(i){let l=V(404,{pathname:i}),u=c||o,{matches:p,route:D}=Xe(u);return Rt(),{notFoundMatches:p,route:D,error:l}}function Rt(i){let l=[];return Ee.forEach((u,p)=>{(!i||i(p))&&(u.cancel(),l.push(p),Ee.delete(p))}),l}function xa(i,l,u){if(v=i,L=l,w=u||null,!O&&f.navigation===ut){O=!0;let p=yr(f.location,f.matches);p!=null&&te({restoreScrollPosition:p})}return()=>{v=null,L=null,w=null}}function mr(i,l){return w&&w(i,l.map(p=>Pr(p,f.loaderData)))||i.key}function La(i,l){if(v&&L){let u=mr(i,l);v[u]=L()}}function yr(i,l){if(v){let u=mr(i,l),p=v[u];if(typeof p=="number")return p}return null}function at(i,l,u){if(y)if(i){if(Object.keys(i[0].params).length>0)return{active:!0,matches:Je(l,u,d,!0)}}else return{active:!0,matches:Je(l,u,d,!0)||[]};return{active:!1,matches:null}}async function nt(i,l,u){if(!y)return{type:"success",matches:i};let p=i;for(;;){let D=c==null,M=c||o,j=s;try{await y({path:l,matches:p,patch:(R,T)=>{u.aborted||Kt(R,T,M,j,n)}})}catch(R){return{type:"error",error:R,partialMatches:p}}finally{D&&!u.aborted&&(o=[...o])}if(u.aborted)return{type:"aborted"};let E=fe(M,l,d);if(E)return{type:"success",matches:E};let P=Je(M,l,d,!0);if(!P||p.length===P.length&&p.every((R,T)=>R.route.id===P[T].route.id))return{type:"success",matches:null};p=P}}function Ma(i){s={},c=He(i,n,void 0,s)}function Ta(i,l){let u=c==null;Kt(i,l,c||o,s,n),u&&(o=[...o],te({}))}return k={get basename(){return d},get future(){return g},get state(){return f},get routes(){return o},get window(){return t},initialize:pa,subscribe:ya,enableScrollRestoration:xa,navigate:or,fetch:Da,revalidate:ga,createHref:i=>e.history.createHref(i),encodeLocation:i=>e.history.encodeLocation(i),getFetcher:dr,deleteFetcher:Ea,dispose:ma,getBlocker:Pa,deleteBlocker:hr,patchRoutes:Ta,_internalFetchControllers:Z,_internalActiveDeferreds:Ee,_internalSetRoutes:Ma},k}const qr=Symbol("deferred");function za(e,t){z(e.length>0,"You must provide a non-empty routes array to createStaticHandler");let r={},a=(t?t.basename:null)||"/",n;if(t!=null&&t.mapRouteProperties)n=t.mapRouteProperties;else if(t!=null&&t.detectErrorBoundary){let h=t.detectErrorBoundary;n=v=>({hasErrorBoundary:h(v)})}else n=It;let s=A({v7_relativeSplatPath:!1,v7_throwAbortReason:!1},t?t.future:null),o=He(e,n,void 0,r);async function c(h,v){let{requestContext:w,skipLoaderErrorBubbling:L,dataStrategy:O}=v===void 0?{}:v,x=new URL(h.url),F=h.method,b=ue("",le(x),null,"default"),k=fe(o,b,a);if(!yt(F)&&F!=="HEAD"){let C=V(405,{method:F}),{matches:I,route:_}=Xe(o);return{basename:a,location:b,matches:I,loaderData:{},actionData:null,errors:{[_.id]:C},statusCode:C.status,loaderHeaders:{},actionHeaders:{},activeDeferreds:null}}else if(!k){let C=V(404,{pathname:b.pathname}),{matches:I,route:_}=Xe(o);return{basename:a,location:b,matches:I,loaderData:{},actionData:null,errors:{[_.id]:C},statusCode:C.status,loaderHeaders:{},actionHeaders:{},activeDeferreds:null}}let f=await m(h,b,k,w,O||null,L===!0,null);return we(f)?f:A({location:b,basename:a},f)}async function d(h,v){let{routeId:w,requestContext:L,dataStrategy:O}=v===void 0?{}:v,x=new URL(h.url),F=h.method,b=ue("",le(x),null,"default"),k=fe(o,b,a);if(!yt(F)&&F!=="HEAD"&&F!=="OPTIONS")throw V(405,{method:F});if(!k)throw V(404,{pathname:b.pathname});let f=w?k.find(G=>G.route.id===w):Se(k,b);if(w&&!f)throw V(403,{pathname:b.pathname,routeId:w});if(!f)throw V(404,{pathname:b.pathname});let C=await m(h,b,k,L,O||null,!1,f);if(we(C))return C;let I=C.errors?Object.values(C.errors)[0]:void 0;if(I!==void 0)throw I;if(C.actionData)return Object.values(C.actionData)[0];if(C.loaderData){var _;let G=Object.values(C.loaderData)[0];return(_=C.activeDeferreds)!=null&&_[f.route.id]&&(G[qr]=C.activeDeferreds[f.route.id]),G}}async function m(h,v,w,L,O,x,F){z(h.signal,"query()/queryRoute() requests must contain an AbortController signal");try{if(re(h.method.toLowerCase()))return await y(h,w,F||Se(w,v),L,O,x,F!=null);let b=await g(h,w,L,O,x,F);return we(b)?b:A({},b,{actionData:null,actionHeaders:{}})}catch(b){if(ia(b)&&we(b.result)){if(b.type===H.error)throw b.result;return b.result}if(la(b))return b;throw b}}async function y(h,v,w,L,O,x,F){let b;if(!w.route.action&&!w.route.lazy){let C=V(405,{method:h.method,pathname:new URL(h.url).pathname,routeId:w.route.id});if(F)throw C;b={type:H.error,error:C}}else b=(await S("action",h,[w],v,F,L,O))[w.route.id],h.signal.aborted&&Nt(h,F,s);if(ve(b))throw new Response(null,{status:b.response.status,headers:{Location:b.response.headers.get("Location")}});if(ce(b)){let C=V(400,{type:"defer-action"});if(F)throw C;b={type:H.error,error:C}}if(F){if(q(b))throw b.error;return{matches:[w],loaderData:{},actionData:{[w.route.id]:b.data},errors:null,statusCode:200,loaderHeaders:{},actionHeaders:{},activeDeferreds:null}}let k=new Request(h.url,{headers:h.headers,redirect:h.redirect,signal:h.signal});if(q(b)){let C=x?w:ge(v,w.route.id),I=await g(k,v,L,O,x,null,[C.route.id,b]);return A({},I,{statusCode:Ce(b.error)?b.error.status:b.statusCode!=null?b.statusCode:500,actionData:null,actionHeaders:A({},b.headers?{[w.route.id]:b.headers}:{})})}let f=await g(k,v,L,O,x,null);return A({},f,{actionData:{[w.route.id]:b.data}},b.statusCode?{statusCode:b.statusCode}:{},{actionHeaders:b.headers?{[w.route.id]:b.headers}:{}})}async function g(h,v,w,L,O,x,F){let b=x!=null;if(b&&!(x!=null&&x.route.loader)&&!(x!=null&&x.route.lazy))throw V(400,{method:h.method,pathname:new URL(h.url).pathname,routeId:x?.route.id});let f=(x?[x]:F&&q(F[1])?ht(v,F[0]):v).filter(Y=>Y.route.loader||Y.route.lazy);if(f.length===0)return{matches:v,loaderData:v.reduce((Y,ie)=>Object.assign(Y,{[ie.route.id]:null}),{}),errors:F&&q(F[1])?{[F[0]]:F[1].error}:null,statusCode:200,loaderHeaders:{},activeDeferreds:null};let C=await S("loader",h,f,v,b,w,L);h.signal.aborted&&Nt(h,b,s);let I=new Map,_=Zt(v,C,F,I,O),G=new Set(f.map(Y=>Y.route.id));return v.forEach(Y=>{G.has(Y.route.id)||(_.loaderData[Y.route.id]=null)}),A({},_,{matches:v,activeDeferreds:I.size>0?Object.fromEntries(I.entries()):null})}async function S(h,v,w,L,O,x,F){let b=await Yt(F||Vt,h,null,v,w,L,null,r,n,x),k={};return await Promise.all(L.map(async f=>{if(!(f.route.id in b))return;let C=b[f.route.id];if(ar(C)){let I=C.result;throw Xt(I,v,f.route.id,L,a,s.v7_relativeSplatPath)}if(we(C.result)&&O)throw C;k[f.route.id]=await Jt(C)})),k}return{dataRoutes:o,query:c,queryRoute:d}}function Ba(e,t,r){return A({},t,{statusCode:Ce(r)?r.status:500,errors:{[t._deepestRenderedBoundaryId||e[0].id]:r}})}function Nt(e,t,r){if(r.v7_throwAbortReason&&e.signal.reason!==void 0)throw e.signal.reason;let a=t?"queryRoute":"query";throw new Error(a+"() call aborted: "+e.method+" "+e.url)}function ea(e){return e!=null&&("formData"in e&&e.formData!=null||"body"in e&&e.body!==void 0)}function ct(e,t,r,a,n,s,o,c){let d,m;if(o){d=[];for(let g of t)if(d.push(g),g.route.id===o){m=g;break}}else d=t,m=t[t.length-1];let y=_t(n||".",Ot(d,s),Ne(e.pathname,r)||e.pathname,c==="path");if(n==null&&(y.search=e.search,y.hash=e.hash),(n==null||n===""||n===".")&&m){let g=vt(y.search);if(m.route.index&&!g)y.search=y.search?y.search.replace(/^\?/,"?index&"):"?index";else if(!m.route.index&&g){let S=new URLSearchParams(y.search),h=S.getAll("index");S.delete("index"),h.filter(w=>w).forEach(w=>S.append("index",w));let v=S.toString();y.search=v?"?"+v:""}}return a&&r!=="/"&&(y.pathname=y.pathname==="/"?r:Te([r,y.pathname])),le(y)}function zt(e,t,r,a){if(!a||!ea(a))return{path:r};if(a.formMethod&&!yt(a.formMethod))return{path:r,error:V(405,{method:a.formMethod})};let n=()=>({path:r,error:V(400,{type:"invalid-body"})}),s=a.formMethod||"get",o=e?s.toUpperCase():s.toLowerCase(),c=rr(r);if(a.body!==void 0){if(a.formEncType==="text/plain"){if(!re(o))return n();let S=typeof a.body=="string"?a.body:a.body instanceof FormData||a.body instanceof URLSearchParams?Array.from(a.body.entries()).reduce((h,v)=>{let[w,L]=v;return""+h+w+"="+L+` `},""):String(a.body);return{path:r,submission:{formMethod:o,formAction:c,formEncType:a.formEncType,formData:void 0,json:void 0,text:S}}}else if(a.formEncType==="application/json"){if(!re(o))return n();try{let S=typeof a.body=="string"?JSON.parse(a.body):a.body;return{path:r,submission:{formMethod:o,formAction:c,formEncType:a.formEncType,formData:void 0,json:S,text:void 0}}}catch{return n()}}}z(typeof FormData=="function","FormData is not available in this environment");let d,m;if(a.formData)d=mt(a.formData),m=a.formData;else if(a.body instanceof FormData)d=mt(a.body),m=a.body;else if(a.body instanceof URLSearchParams)d=a.body,m=Qt(d);else if(a.body==null)d=new URLSearchParams,m=new FormData;else try{d=new URLSearchParams(a.body),m=Qt(d)}catch{return n()}let y={formMethod:o,formAction:c,formEncType:a&&a.formEncType||"application/x-www-form-urlencoded",formData:m,json:void 0,text:void 0};if(re(y.formMethod))return{path:r,submission:y};let g=ne(r);return t&&g.search&&vt(g.search)&&d.append("index",""),g.search="?"+d,{path:le(g),submission:y}}function ht(e,t,r){r===void 0&&(r=!1);let a=e.findIndex(n=>n.route.id===t);return a>=0?e.slice(0,r?a+1:a):e}function Bt(e,t,r,a,n,s,o,c,d,m,y,g,S,h,v,w){let L=w?q(w[1])?w[1].error:w[1].data:void 0,O=e.createURL(t.location),x=e.createURL(n),F=r;s&&t.errors?F=ht(r,Object.keys(t.errors)[0],!0):w&&q(w[1])&&(F=ht(r,w[0]));let b=w?w[1].statusCode:void 0,k=o&&b&&b>=400,f=F.filter((I,_)=>{let{route:G}=I;if(G.lazy)return!0;if(G.loader==null)return!1;if(s)return pt(G,t.loaderData,t.errors);if(ta(t.loaderData,t.matches[_],I)||d.some(ae=>ae===I.route.id))return!0;let Y=t.matches[_],ie=I;return kt(I,A({currentUrl:O,currentParams:Y.params,nextUrl:x,nextParams:ie.params},a,{actionResult:L,actionStatus:b,defaultShouldRevalidate:k?!1:c||O.pathname+O.search===x.pathname+x.search||O.search!==x.search||Wt(Y,ie)}))}),C=[];return g.forEach((I,_)=>{if(s||!r.some(he=>he.route.id===I.routeId)||y.has(_))return;let G=fe(h,I.path,v);if(!G){C.push({key:_,routeId:I.routeId,path:I.path,matches:null,match:null,controller:null});return}let Y=t.fetchers.get(_),ie=Se(G,I.path),ae=!1;S.has(_)?ae=!1:m.has(_)?(m.delete(_),ae=!0):Y&&Y.state!=="idle"&&Y.data===void 0?ae=c:ae=kt(ie,A({currentUrl:O,currentParams:t.matches[t.matches.length-1].params,nextUrl:x,nextParams:r[r.length-1].params},a,{actionResult:L,actionStatus:b,defaultShouldRevalidate:k?!1:c})),ae&&C.push({key:_,routeId:I.routeId,path:I.path,matches:G,match:ie,controller:new AbortController})}),[f,C]}function pt(e,t,r){if(e.lazy)return!0;if(!e.loader)return!1;let a=t!=null&&t[e.id]!==void 0,n=r!=null&&r[e.id]!==void 0;return!a&&n?!1:typeof e.loader=="function"&&e.loader.hydrate===!0?!0:!a&&!n}function ta(e,t,r){let a=!t||r.route.id!==t.route.id,n=e[r.route.id]===void 0;return a||n}function Wt(e,t){let r=e.route.path;return e.pathname!==t.pathname||r!=null&&r.endsWith("*")&&e.params["*"]!==t.params["*"]}function kt(e,t){if(e.route.shouldRevalidate){let r=e.route.shouldRevalidate(t);if(typeof r=="boolean")return r}return t.defaultShouldRevalidate}function Kt(e,t,r,a,n){var s;let o;if(e){let m=a[e];z(m,"No route found to patch children into: routeId = "+e),m.children||(m.children=[]),o=m.children}else o=r;let c=t.filter(m=>!o.some(y=>$t(m,y))),d=He(c,n,[e||"_","patch",String(((s=o)==null?void 0:s.length)||"0")],a);o.push(...d)}function $t(e,t){return"id"in e&&"id"in t&&e.id===t.id?!0:e.index===t.index&&e.path===t.path&&e.caseSensitive===t.caseSensitive?(!e.children||e.children.length===0)&&(!t.children||t.children.length===0)?!0:e.children.every((r,a)=>{var n;return(n=t.children)==null?void 0:n.some(s=>$t(r,s))}):!1}async function ra(e,t,r){if(!e.lazy)return;let a=await e.lazy();if(!e.lazy)return;let n=r[e.id];z(n,"No route found in manifest");let s={};for(let o in a){let d=n[o]!==void 0&&o!=="hasErrorBoundary";de(!d,'Route "'+n.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.')),!d&&!Sr.has(o)&&(s[o]=a[o])}Object.assign(n,s),Object.assign(n,A({},t(n),{lazy:void 0}))}async function Vt(e){let{matches:t}=e,r=t.filter(n=>n.shouldLoad);return(await Promise.all(r.map(n=>n.resolve()))).reduce((n,s,o)=>Object.assign(n,{[r[o].route.id]:s}),{})}async function Yt(e,t,r,a,n,s,o,c,d,m){let y=s.map(h=>h.route.lazy?ra(h.route,d,c):void 0),g=s.map((h,v)=>{let w=y[v],L=n.some(x=>x.route.id===h.route.id);return A({},h,{shouldLoad:L,resolve:async x=>(x&&a.method==="GET"&&(h.route.lazy||h.route.loader)&&(L=!0),L?aa(t,a,h,w,x,m):Promise.resolve({type:H.data,result:void 0}))})}),S=await e({matches:g,request:a,params:s[0].params,fetcherKey:o,context:m});try{await Promise.all(y)}catch{}return S}async function aa(e,t,r,a,n,s){let o,c,d=m=>{let y,g=new Promise((v,w)=>y=w);c=()=>y(),t.signal.addEventListener("abort",c);let S=v=>typeof m!="function"?Promise.reject(new Error("You cannot call the handler for a route which defines a boolean "+('"'+e+'" [routeId: '+r.route.id+"]"))):m({request:t,params:r.params,context:s},...v!==void 0?[v]:[]),h=(async()=>{try{return{type:"data",result:await(n?n(w=>S(w)):S())}}catch(v){return{type:"error",result:v}}})();return Promise.race([h,g])};try{let m=r.route[e];if(a)if(m){let y,[g]=await Promise.all([d(m).catch(S=>{y=S}),a]);if(y!==void 0)throw y;o=g}else if(await a,m=r.route[e],m)o=await d(m);else if(e==="action"){let y=new URL(t.url),g=y.pathname+y.search;throw V(405,{method:t.method,pathname:g,routeId:r.route.id})}else return{type:H.data,result:void 0};else if(m)o=await d(m);else{let y=new URL(t.url),g=y.pathname+y.search;throw V(404,{pathname:g})}z(o.result!==void 0,"You defined "+(e==="action"?"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(m){return{type:H.error,result:m}}finally{c&&t.signal.removeEventListener("abort",c)}return o}async function Jt(e){let{result:t,type:r}=e;if(we(t)){let m;try{let y=t.headers.get("Content-Type");y&&/\bapplication\/json\b/.test(y)?t.body==null?m=null:m=await t.json():m=await t.text()}catch(y){return{type:H.error,error:y}}return r===H.error?{type:H.error,error:new dt(t.status,t.statusText,m),statusCode:t.status,headers:t.headers}:{type:H.data,data:m,statusCode:t.status,headers:t.headers}}if(r===H.error){if(nr(t)){var a;if(t.data instanceof Error){var n;return{type:H.error,error:t.data,statusCode:(n=t.init)==null?void 0:n.status}}t=new dt(((a=t.init)==null?void 0:a.status)||500,void 0,t.data)}return{type:H.er