@icap-ethiopia/esm-ethiohri-phrh
Version:
An OpenMRS seed application for building microfrontends
2 lines • 68.5 kB
JavaScript
/*! For license information please see 282.js.LICENSE.txt */
"use strict";(globalThis.webpackChunk_icap_ethiopia_esm_ethiohri_phrh=globalThis.webpackChunk_icap_ethiopia_esm_ethiohri_phrh||[]).push([[282],{282:(e,t,r)=>{r.r(t),r.d(t,{AbortedDeferredError:()=>K,Await:()=>Bt,BrowserRouter:()=>dr,Form:()=>gr,HashRouter:()=>hr,Link:()=>vr,MemoryRouter:()=>Mt,NavLink:()=>yr,Navigate:()=>jt,NavigationType:()=>n,Outlet:()=>Tt,Route:()=>_t,Router:()=>Ot,RouterProvider:()=>At,Routes:()=>Ft,ScrollRestoration:()=>wr,UNSAFE_DataRouterContext:()=>Ie,UNSAFE_DataRouterStateContext:()=>ze,UNSAFE_LocationContext:()=>$e,UNSAFE_NavigationContext:()=>He,UNSAFE_RouteContext:()=>Ke,UNSAFE_useRouteId:()=>yt,UNSAFE_useScrollRestoration:()=>Or,createBrowserRouter:()=>ir,createHashRouter:()=>lr,createMemoryRouter:()=>qt,createPath:()=>p,createRoutesFromChildren:()=>Ht,createRoutesFromElements:()=>Ht,createSearchParams:()=>Qt,defer:()=>Y,generatePath:()=>M,isRouteErrorResponse:()=>G,json:()=>$,matchPath:()=>j,matchRoutes:()=>w,parsePath:()=>m,redirect:()=>V,renderMatches:()=>$t,resolvePath:()=>O,unstable_HistoryRouter:()=>fr,unstable_useBlocker:()=>kt,unstable_usePrompt:()=>Br,useActionData:()=>xt,useAsyncError:()=>Ct,useAsyncValue:()=>Dt,useBeforeUnload:()=>Fr,useFetcher:()=>Mr,useFetchers:()=>jr,useFormAction:()=>Ar,useHref:()=>Je,useInRouterContext:()=>Ye,useLinkClickHandler:()=>Dr,useLoaderData:()=>Et,useLocation:()=>Ve,useMatch:()=>Ge,useMatches:()=>wt,useNavigate:()=>Ze,useNavigation:()=>gt,useNavigationType:()=>Xe,useOutlet:()=>rt,useOutletContext:()=>tt,useParams:()=>nt,useResolvedPath:()=>ot,useRevalidator:()=>bt,useRouteError:()=>St,useRouteLoaderData:()=>Rt,useRoutes:()=>at,useSearchParams:()=>Cr,useSubmit:()=>kr});var n,o=r(6072);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 n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},a.apply(this,arguments)}!function(e){e.Pop="POP",e.Push="PUSH",e.Replace="REPLACE"}(n||(n={}));const i="popstate";function l(e){void 0===e&&(e={});let t,{initialEntries:r=["/"],initialIndex:o,v5Compat:a=!1}=e;t=r.map(((e,t)=>h(e,"string"==typeof e?null:e.state,0===t?"default":void 0)));let i=c(null==o?t.length-1:o),l=n.Pop,s=null;function c(e){return Math.min(Math.max(e,0),t.length-1)}function u(){return t[i]}function h(e,r,n){void 0===r&&(r=null);let o=f(t?u().pathname:"/",e,r,n);return d("/"===o.pathname.charAt(0),"relative pathnames are not supported in memory history: "+JSON.stringify(e)),o}function v(e){return"string"==typeof e?e:p(e)}return{get index(){return i},get action(){return l},get location(){return u()},createHref:v,createURL:e=>new URL(v(e),"http://localhost"),encodeLocation(e){let t="string"==typeof e?m(e):e;return{pathname:t.pathname||"",search:t.search||"",hash:t.hash||""}},push(e,r){l=n.Push;let o=h(e,r);i+=1,t.splice(i,t.length,o),a&&s&&s({action:l,location:o,delta:1})},replace(e,r){l=n.Replace;let o=h(e,r);t[i]=o,a&&s&&s({action:l,location:o,delta:0})},go(e){l=n.Pop;let r=c(i+e),o=t[r];i=r,s&&s({action:l,location:o,delta:e})},listen:e=>(s=e,()=>{s=null})}}function s(e){return void 0===e&&(e={}),v((function(e,t){let{pathname:r,search:n,hash:o}=e.location;return f("",{pathname:r,search:n,hash:o},t.state&&t.state.usr||null,t.state&&t.state.key||"default")}),(function(e,t){return"string"==typeof t?t:p(t)}),null,e)}function c(e){return void 0===e&&(e={}),v((function(e,t){let{pathname:r="/",search:n="",hash:o=""}=m(e.location.hash.substr(1));return f("",{pathname:r,search:n,hash:o},t.state&&t.state.usr||null,t.state&&t.state.key||"default")}),(function(e,t){let r=e.document.querySelector("base"),n="";if(r&&r.getAttribute("href")){let t=e.location.href,r=t.indexOf("#");n=-1===r?t:t.slice(0,r)}return n+"#"+("string"==typeof t?t:p(t))}),(function(e,t){d("/"===e.pathname.charAt(0),"relative pathnames are not supported in hash history.push("+JSON.stringify(t)+")")}),e)}function u(e,t){if(!1===e||null==e)throw new Error(t)}function d(e,t){if(!e){"undefined"!=typeof console&&console.warn(t);try{throw new Error(t)}catch(e){}}}function h(e,t){return{usr:e.state,key:e.key,idx:t}}function f(e,t,r,n){return void 0===r&&(r=null),a({pathname:"string"==typeof e?e:e.pathname,search:"",hash:""},"string"==typeof t?m(t):t,{state:r,key:t&&t.key||n||Math.random().toString(36).substr(2,8)})}function p(e){let{pathname:t="/",search:r="",hash:n=""}=e;return r&&"?"!==r&&(t+="?"===r.charAt(0)?r:"?"+r),n&&"#"!==n&&(t+="#"===n.charAt(0)?n:"#"+n),t}function m(e){let t={};if(e){let r=e.indexOf("#");r>=0&&(t.hash=e.substr(r),e=e.substr(0,r));let n=e.indexOf("?");n>=0&&(t.search=e.substr(n),e=e.substr(0,n)),e&&(t.pathname=e)}return t}function v(e,t,r,o){void 0===o&&(o={});let{window:l=document.defaultView,v5Compat:s=!1}=o,c=l.history,d=n.Pop,m=null,v=y();function y(){return(c.state||{idx:null}).idx}function g(){d=n.Pop;let e=y(),t=null==e?null:e-v;v=e,m&&m({action:d,location:w.location,delta:t})}function b(e){let t="null"!==l.location.origin?l.location.origin:l.location.href,r="string"==typeof e?e:p(e);return u(t,"No window.location.(origin|href) available to create URL for href: "+r),new URL(r,t)}null==v&&(v=0,c.replaceState(a({},c.state,{idx:v}),""));let w={get action(){return d},get location(){return e(l,c)},listen(e){if(m)throw new Error("A history only accepts one active listener");return l.addEventListener(i,g),m=e,()=>{l.removeEventListener(i,g),m=null}},createHref:e=>t(l,e),createURL:b,encodeLocation(e){let t=b(e);return{pathname:t.pathname,search:t.search,hash:t.hash}},push:function(e,t){d=n.Push;let o=f(w.location,e,t);r&&r(o,e),v=y()+1;let a=h(o,v),i=w.createHref(o);try{c.pushState(a,"",i)}catch(e){if(e instanceof DOMException&&"DataCloneError"===e.name)throw e;l.location.assign(i)}s&&m&&m({action:d,location:w.location,delta:1})},replace:function(e,t){d=n.Replace;let o=f(w.location,e,t);r&&r(o,e),v=y();let a=h(o,v),i=w.createHref(o);c.replaceState(a,"",i),s&&m&&m({action:d,location:w.location,delta:0})},go:e=>c.go(e)};return w}var y;!function(e){e.data="data",e.deferred="deferred",e.redirect="redirect",e.error="error"}(y||(y={}));const g=new Set(["lazy","caseSensitive","path","id","index","children"]);function b(e,t,r,n){return void 0===r&&(r=[]),void 0===n&&(n={}),e.map(((e,o)=>{let i=[...r,o],l="string"==typeof e.id?e.id:i.join("-");if(u(!0!==e.index||!e.children,"Cannot specify children on an index route"),u(!n[l],'Found a route id collision on id "'+l+"\". Route id's must be globally unique within Data Router usages"),function(e){return!0===e.index}(e)){let r=a({},e,t(e),{id:l});return n[l]=r,r}{let r=a({},e,t(e),{id:l,children:void 0});return n[l]=r,e.children&&(r.children=b(e.children,t,i,n)),r}}))}function w(e,t,r){void 0===r&&(r="/");let n=_(("string"==typeof t?m(t):t).pathname||"/",r);if(null==n)return null;let o=E(e);!function(e){e.sort(((e,t)=>e.score!==t.score?t.score-e.score:function(e,t){return e.length===t.length&&e.slice(0,-1).every(((e,r)=>e===t[r]))?e[e.length-1]-t[t.length-1]:0}(e.routesMeta.map((e=>e.childrenIndex)),t.routesMeta.map((e=>e.childrenIndex)))))}(o);let a=null;for(let e=0;null==a&&e<o.length;++e)a=U(o[e],T(n));return a}function E(e,t,r,n){void 0===t&&(t=[]),void 0===r&&(r=[]),void 0===n&&(n="");let o=(e,o,a)=>{let i={relativePath:void 0===a?e.path||"":a,caseSensitive:!0===e.caseSensitive,childrenIndex:o,route:e};i.relativePath.startsWith("/")&&(u(i.relativePath.startsWith(n),'Absolute route path "'+i.relativePath+'" nested under path "'+n+'" is not valid. An absolute child route path must start with the combined path of all its parent routes.'),i.relativePath=i.relativePath.slice(n.length));let l=I([n,i.relativePath]),s=r.concat(i);e.children&&e.children.length>0&&(u(!0!==e.index,'Index routes must not have child routes. Please remove all child routes from route path "'+l+'".'),E(e.children,t,s,l)),(null!=e.path||e.index)&&t.push({path:l,score:A(l,e.index),routesMeta:s})};return e.forEach(((e,t)=>{var r;if(""!==e.path&&null!=(r=e.path)&&r.includes("?"))for(let r of R(e.path))o(e,t,r);else o(e,t)})),t}function R(e){let t=e.split("/");if(0===t.length)return[];let[r,...n]=t,o=r.endsWith("?"),a=r.replace(/\?$/,"");if(0===n.length)return o?[a,""]:[a];let i=R(n.join("/")),l=[];return l.push(...i.map((e=>""===e?a:[a,e].join("/")))),o&&l.push(...i),l.map((t=>e.startsWith("/")&&""===t?"/":t))}const x=/^:\w+$/,S=3,D=2,C=1,P=10,k=-2,L=e=>"*"===e;function A(e,t){let r=e.split("/"),n=r.length;return r.some(L)&&(n+=k),t&&(n+=D),r.filter((e=>!L(e))).reduce(((e,t)=>e+(x.test(t)?S:""===t?C:P)),n)}function U(e,t){let{routesMeta:r}=e,n={},o="/",a=[];for(let e=0;e<r.length;++e){let i=r[e],l=e===r.length-1,s="/"===o?t:t.slice(o.length)||"/",c=j({path:i.relativePath,caseSensitive:i.caseSensitive,end:l},s);if(!c)return null;Object.assign(n,c.params);let u=i.route;a.push({params:n,pathname:I([o,c.pathname]),pathnameBase:z(I([o,c.pathnameBase])),route:u}),"/"!==c.pathnameBase&&(o=I([o,c.pathnameBase]))}return a}function M(e,t){void 0===t&&(t={});let r=e;r.endsWith("*")&&"*"!==r&&!r.endsWith("/*")&&(d(!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 n=r.startsWith("/")?"/":"",o=e=>null==e?"":"string"==typeof e?e:String(e);return n+r.split(/\/+/).map(((e,r,n)=>{if(r===n.length-1&&"*"===e)return o(t["*"]);const a=e.match(/^:(\w+)(\??)$/);if(a){const[,e,r]=a;let n=t[e];return u("?"===r||null!=n,'Missing ":'+e+'" param'),o(n)}return e.replace(/\?$/g,"")})).filter((e=>!!e)).join("/")}function j(e,t){"string"==typeof e&&(e={path:e,caseSensitive:!1,end:!0});let[r,n]=function(e,t,r){void 0===t&&(t=!1),void 0===r&&(r=!0),d("*"===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 n=[],o="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^$?{}|()[\]]/g,"\\$&").replace(/\/:(\w+)/g,((e,t)=>(n.push(t),"/([^\\/]+)")));return e.endsWith("*")?(n.push("*"),o+="*"===e||"/*"===e?"(.*)$":"(?:\\/(.+)|\\/*)$"):r?o+="\\/*$":""!==e&&"/"!==e&&(o+="(?:(?=\\/|$))"),[new RegExp(o,t?void 0:"i"),n]}(e.path,e.caseSensitive,e.end),o=t.match(r);if(!o)return null;let a=o[0],i=a.replace(/(.)\/+$/,"$1"),l=o.slice(1);return{params:n.reduce(((e,t,r)=>{if("*"===t){let e=l[r]||"";i=a.slice(0,a.length-e.length).replace(/(.)\/+$/,"$1")}return e[t]=function(e,t){try{return decodeURIComponent(e)}catch(r){return d(!1,'The value for the URL param "'+t+'" will not be decoded because the string "'+e+'" is a malformed URL segment. This is probably due to a bad percent encoding ('+r+")."),e}}(l[r]||"",t),e}),{}),pathname:a,pathnameBase:i,pattern:e}}function T(e){try{return decodeURI(e)}catch(t){return d(!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 _(e,t){if("/"===t)return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let r=t.endsWith("/")?t.length-1:t.length,n=e.charAt(r);return n&&"/"!==n?null:e.slice(r)||"/"}function O(e,t){void 0===t&&(t="/");let{pathname:r,search:n="",hash:o=""}="string"==typeof e?m(e):e,a=r?r.startsWith("/")?r:function(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("/"):"/"}(r,t):t;return{pathname:a,search:W(n),hash:H(o)}}function F(e,t,r,n){return"Cannot include a '"+e+"' character in a manually specified `to."+t+"` field ["+JSON.stringify(n)+"]. 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 B(e){return e.filter(((e,t)=>0===t||e.route.path&&e.route.path.length>0))}function N(e,t,r,n){let o;void 0===n&&(n=!1),"string"==typeof e?o=m(e):(o=a({},e),u(!o.pathname||!o.pathname.includes("?"),F("?","pathname","search",o)),u(!o.pathname||!o.pathname.includes("#"),F("#","pathname","hash",o)),u(!o.search||!o.search.includes("#"),F("#","search","hash",o)));let i,l=""===e||""===o.pathname,s=l?"/":o.pathname;if(n||null==s)i=r;else{let e=t.length-1;if(s.startsWith("..")){let t=s.split("/");for(;".."===t[0];)t.shift(),e-=1;o.pathname=t.join("/")}i=e>=0?t[e]:"/"}let c=O(o,i),d=s&&"/"!==s&&s.endsWith("/"),h=(l||"."===s)&&r.endsWith("/");return c.pathname.endsWith("/")||!d&&!h||(c.pathname+="/"),c}const I=e=>e.join("/").replace(/\/\/+/g,"/"),z=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),W=e=>e&&"?"!==e?e.startsWith("?")?e:"?"+e:"",H=e=>e&&"#"!==e?e.startsWith("#")?e:"#"+e:"",$=function(e,t){void 0===t&&(t={});let r="number"==typeof t?{status:t}:t,n=new Headers(r.headers);return n.has("Content-Type")||n.set("Content-Type","application/json; charset=utf-8"),new Response(JSON.stringify(e),a({},r,{headers:n}))};class K extends Error{}class q{constructor(e,t){let r;this.pendingKeysSet=new Set,this.subscribers=new Set,this.deferredKeys=[],u(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 n=()=>r(new K("Deferred data aborted"));this.unlistenAbortSignal=()=>this.controller.signal.removeEventListener("abort",n),this.controller.signal.addEventListener("abort",n),this.data=Object.entries(e).reduce(((e,t)=>{let[r,n]=t;return Object.assign(e,{[r]:this.trackPromise(r,n)})}),{}),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,null,t)),(t=>this.onSettle(r,e,t)));return r.catch((()=>{})),Object.defineProperty(r,"_tracked",{get:()=>!0}),r}onSettle(e,t,r,n){return this.controller.signal.aborted&&r instanceof K?(this.unlistenAbortSignal(),Object.defineProperty(e,"_error",{get:()=>r}),Promise.reject(r)):(this.pendingKeysSet.delete(t),this.done&&this.unlistenAbortSignal(),r?(Object.defineProperty(e,"_error",{get:()=>r}),this.emit(!1,t),Promise.reject(r)):(Object.defineProperty(e,"_data",{get:()=>n}),this.emit(!1,t),n))}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((n=>{e.removeEventListener("abort",r),(n||this.done)&&t(n)}))}))}return t}get done(){return 0===this.pendingKeysSet.size}get unwrappedData(){return u(null!==this.data&&this.done,"Can only unwrap data on initialized and settled deferreds"),Object.entries(this.data).reduce(((e,t)=>{let[r,n]=t;return Object.assign(e,{[r]:J(n)})}),{})}get pendingKeys(){return Array.from(this.pendingKeysSet)}}function J(e){if(!function(e){return e instanceof Promise&&!0===e._tracked}(e))return e;if(e._error)throw e._error;return e._data}const Y=function(e,t){return void 0===t&&(t={}),new q(e,"number"==typeof t?{status:t}:t)},V=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 n=new Headers(r.headers);return n.set("Location",e),new Response(null,a({},r,{headers:n}))};class X{constructor(e,t,r,n){void 0===n&&(n=!1),this.status=e,this.statusText=t||"",this.internal=n,r instanceof Error?(this.data=r.toString(),this.error=r):this.data=r}}function G(e){return null!=e&&"number"==typeof e.status&&"string"==typeof e.statusText&&"boolean"==typeof e.internal&&"data"in e}const Q=["post","put","patch","delete"],Z=new Set(Q),ee=["get",...Q],te=new Set(ee),re=new Set([301,302,303,307,308]),ne=new Set([307,308]),oe={state:"idle",location:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0},ae={state:"idle",data:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0},ie={state:"unblocked",proceed:void 0,reset:void 0,location:void 0},le=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,se=e=>({hasErrorBoundary:Boolean(e.hasErrorBoundary)});function ce(e){const t=e.window?e.window:"undefined"!=typeof window?window:void 0,r=void 0!==t&&void 0!==t.document&&void 0!==t.document.createElement,o=!r;let i;if(u(e.routes.length>0,"You must provide a non-empty routes array to createRouter"),e.mapRouteProperties)i=e.mapRouteProperties;else if(e.detectErrorBoundary){let t=e.detectErrorBoundary;i=e=>({hasErrorBoundary:t(e)})}else i=se;let l,s={},c=b(e.routes,i,void 0,s),h=e.basename||"/",p=a({v7_normalizeFormMethod:!1,v7_prependBasename:!1},e.future),m=null,v=new Set,g=null,E=null,R=null,x=null!=e.hydrationData,S=w(c,e.history.location,h),D=null;if(null==S){let t=Se(404,{pathname:e.history.location.pathname}),{matches:r,route:n}=xe(c);S=r,D={[n.id]:t}}let C,P,k=!(S.some((e=>e.route.lazy))||S.some((e=>e.route.loader))&&null==e.hydrationData),L={historyAction:e.history.action,location:e.history.location,matches:S,initialized:k,navigation:oe,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||D,fetchers:new Map,blockers:new Map},A=n.Pop,U=!1,M=!1,j=!1,T=[],O=[],F=new Map,B=0,N=-1,I=new Map,z=new Set,W=new Map,H=new Map,$=new Map,K=!1;function q(e){L=a({},L,e),v.forEach((e=>e(L)))}function J(t,r){var o,i;let s,u=null!=L.actionData&&null!=L.navigation.formMethod&&Ae(L.navigation.formMethod)&&"loading"===L.navigation.state&&!0!==(null==(o=t.state)?void 0:o._isRedirect);s=r.actionData?Object.keys(r.actionData).length>0?r.actionData:null:u?L.actionData:null;let d=r.loaderData?Ee(L.loaderData,r.loaderData,r.matches||[],r.errors):L.loaderData,h=L.blockers;h.size>0&&(h=new Map(h),h.forEach(((e,t)=>h.set(t,ie))));let f=!0===U||null!=L.navigation.formMethod&&Ae(L.navigation.formMethod)&&!0!==(null==(i=t.state)?void 0:i._isRedirect);l&&(c=l,l=void 0),M||A===n.Pop||(A===n.Push?e.history.push(t,t.state):A===n.Replace&&e.history.replace(t,t.state)),q(a({},r,{actionData:s,loaderData:d,historyAction:A,location:t,initialized:!0,navigation:oe,revalidation:"idle",restoreScrollPosition:je(t,r.matches||L.matches),preventScrollReset:f,blockers:h})),A=n.Pop,U=!1,M=!1,j=!1,T=[],O=[]}async function Y(t,r,o){P&&P.abort(),P=null,A=t,M=!0===(o&&o.startUninterruptedRevalidation),function(e,t){if(g&&R){let r=Ce(e,t);g[r]=R()}}(L.location,L.matches),U=!0===(o&&o.preventScrollReset);let u=l||c,d=o&&o.overrideNavigation,f=w(u,r,h);if(!f){let e=Se(404,{pathname:r.pathname}),{matches:t,route:n}=xe(u);return be(),void J(r,{matches:t,loaderData:{},errors:{[n.id]:e}})}if(L.initialized&&!j&&(p=L.location,m=r,p.pathname===m.pathname&&p.search===m.search&&(""===p.hash?""!==m.hash:p.hash===m.hash||""!==m.hash))&&!(o&&o.submission&&Ae(o.submission.formMethod)))return void J(r,{matches:f});var p,m;P=new AbortController;let v,b,E=ye(e.history,r,P.signal,o&&o.submission);if(o&&o.pendingError)b={[Re(f).route.id]:o.pendingError};else if(o&&o.submission&&Ae(o.submission.formMethod)){let e=await async function(e,t,r,o,a){void 0===a&&(a={}),Q();let l,c=function(e,t){return{state:"submitting",location:e,formMethod:t.formMethod,formAction:t.formAction,formEncType:t.formEncType,formData:t.formData,json:t.json,text:t.text}}(t,r);q({navigation:c});let u=Te(o,t);if(u.route.action||u.route.lazy){if(l=await ve("action",e,u,o,s,i,h),e.signal.aborted)return{shortCircuited:!0}}else l={type:y.error,error:Se(405,{method:e.method,pathname:t.pathname,routeId:u.route.id})};if(Le(l)){let e;return e=a&&null!=a.replace?a.replace:l.location===L.location.pathname+L.location.search,await X(L,l,{submission:r,replace:e}),{shortCircuited:!0}}if(ke(l)){let e=Re(o,u.route.id);return!0!==(a&&a.replace)&&(A=n.Push),{pendingActionData:{},pendingActionError:{[e.route.id]:l.error}}}if(Pe(l))throw Se(400,{type:"defer-action"});return{pendingActionData:{[u.route.id]:l.data}}}(E,r,o.submission,f,{replace:o.replace});if(e.shortCircuited)return;v=e.pendingActionData,b=e.pendingActionError,d=Oe(r,o.submission),E=new Request(E.url,{signal:E.signal})}let{shortCircuited:x,loaderData:S,errors:D}=await async function(t,r,n,o,i,s,u,d,f){let p=o||Oe(r,i),m=i||s||_e(p),v=l||c,[y,g]=he(e.history,L,n,m,r,j,T,O,W,z,v,h,d,f);if(be((e=>!(n&&n.some((t=>t.route.id===e)))||y&&y.some((t=>t.route.id===e)))),0===y.length&&0===g.length){let e=ce();return J(r,a({matches:n,loaderData:{},errors:f||null},d?{actionData:d}:{},e?{fetchers:new Map(L.fetchers)}:{})),{shortCircuited:!0}}if(!M){g.forEach((e=>{let t=L.fetchers.get(e.key),r=Fe(void 0,t?t.data:void 0);L.fetchers.set(e.key,r)}));let e=d||L.actionData;q(a({navigation:p},e?0===Object.keys(e).length?{actionData:null}:{actionData:e}:{},g.length>0?{fetchers:new Map(L.fetchers)}:{}))}N=++B,g.forEach((e=>{F.has(e.key)&&te(e.key),e.controller&&F.set(e.key,e.controller)}));let b=()=>g.forEach((e=>te(e.key)));P&&P.signal.addEventListener("abort",b);let{results:w,loaderResults:E,fetcherResults:R}=await G(L.matches,n,y,g,t);if(t.signal.aborted)return{shortCircuited:!0};P&&P.signal.removeEventListener("abort",b),g.forEach((e=>F.delete(e.key)));let x=De(w);if(x)return await X(L,x,{replace:u}),{shortCircuited:!0};let{loaderData:S,errors:D}=we(L,n,y,E,f,g,R,H);H.forEach(((e,t)=>{e.subscribe((r=>{(r||e.done)&&H.delete(t)}))}));let C=ce(),k=fe(N);return a({loaderData:S,errors:D},C||k||g.length>0?{fetchers:new Map(L.fetchers)}:{})}(E,r,f,d,o&&o.submission,o&&o.fetcherSubmission,o&&o.replace,v,b);x||(P=null,J(r,a({matches:f},v?{actionData:v}:{},{loaderData:S,errors:D})))}function V(e){return L.fetchers.get(e)||ae}async function X(o,i,l){let{submission:s,replace:c,isFetchActionRedirect:d}=void 0===l?{}:l;i.revalidate&&(j=!0);let p=f(o.location,i.location,a({_isRedirect:!0},d?{_isFetchActionRedirect:!0}:{}));if(u(p,"Expected a location on the redirect navigation"),le.test(i.location)&&r){let r=e.history.createURL(i.location),n=null==_(r.pathname,h);if(t.location.origin!==r.origin||n)return void(c?t.location.replace(i.location):t.location.assign(i.location))}P=null;let m=!0===c?n.Replace:n.Push,v=s||_e(o.navigation);if(ne.has(i.status)&&v&&Ae(v.formMethod))await Y(m,p,{submission:a({},v,{formAction:i.location}),preventScrollReset:U});else if(d)await Y(m,p,{overrideNavigation:Oe(p),fetcherSubmission:v,preventScrollReset:U});else{let e=Oe(p,v);await Y(m,p,{overrideNavigation:e,preventScrollReset:U})}}async function G(t,r,n,o,a){let l=await Promise.all([...n.map((e=>ve("loader",a,e,r,s,i,h))),...o.map((t=>t.matches&&t.match&&t.controller?ve("loader",ye(e.history,t.path,t.controller.signal),t.match,t.matches,s,i,h):{type:y.error,error:Se(404,{pathname:t.path})}))]),c=l.slice(0,n.length),u=l.slice(n.length);return await Promise.all([Ue(t,n,c,c.map((()=>a.signal)),!1,L.loaderData),Ue(t,o.map((e=>e.match)),u,o.map((e=>e.controller?e.controller.signal:null)),!0)]),{results:l,loaderResults:c,fetcherResults:u}}function Q(){j=!0,T.push(...be()),W.forEach(((e,t)=>{F.has(t)&&(O.push(t),te(t))}))}function Z(e,t,r){let n=Re(L.matches,t);ee(e),q({errors:{[n.route.id]:r},fetchers:new Map(L.fetchers)})}function ee(e){let t=L.fetchers.get(e);!F.has(e)||t&&"loading"===t.state&&I.has(e)||te(e),W.delete(e),I.delete(e),z.delete(e),L.fetchers.delete(e)}function te(e){let t=F.get(e);u(t,"Expected fetch controller: "+e),t.abort(),F.delete(e)}function re(e){for(let t of e){let e=Be(V(t).data);L.fetchers.set(t,e)}}function ce(){let e=[],t=!1;for(let r of z){let n=L.fetchers.get(r);u(n,"Expected fetcher: "+r),"loading"===n.state&&(z.delete(r),e.push(r),t=!0)}return re(e),t}function fe(e){let t=[];for(let[r,n]of I)if(n<e){let e=L.fetchers.get(r);u(e,"Expected fetcher: "+r),"loading"===e.state&&(te(r),I.delete(r),t.push(r))}return re(t),t.length>0}function pe(e){L.blockers.delete(e),$.delete(e)}function me(e,t){let r=L.blockers.get(e)||ie;u("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 n=new Map(L.blockers);n.set(e,t),q({blockers:n})}function ge(e){let{currentLocation:t,nextLocation:r,historyAction:n}=e;if(0===$.size)return;$.size>1&&d(!1,"A router only supports one blocker at a time");let o=Array.from($.entries()),[a,i]=o[o.length-1],l=L.blockers.get(a);return l&&"proceeding"===l.state?void 0:i({currentLocation:t,nextLocation:r,historyAction:n})?a:void 0}function be(e){let t=[];return H.forEach(((r,n)=>{e&&!e(n)||(r.cancel(),t.push(n),H.delete(n))})),t}function Ce(e,t){return E&&E(e,t.map((e=>function(e,t){let{route:r,pathname:n,params:o}=e;return{id:r.id,pathname:n,params:o,data:t[r.id],handle:r.handle}}(e,L.loaderData))))||e.key}function je(e,t){if(g){let r=Ce(e,t),n=g[r];if("number"==typeof n)return n}return null}return C={get basename(){return h},get state(){return L},get routes(){return c},initialize:function(){return m=e.history.listen((t=>{let{action:r,location:n,delta:o}=t;if(K)return void(K=!1);d(0===$.size||null!=o,"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 a=ge({currentLocation:L.location,nextLocation:n,historyAction:r});return a&&null!=o?(K=!0,e.history.go(-1*o),void me(a,{state:"blocked",location:n,proceed(){me(a,{state:"proceeding",proceed:void 0,reset:void 0,location:n}),e.history.go(o)},reset(){let e=new Map(L.blockers);e.set(a,ie),q({blockers:e})}})):Y(r,n)})),L.initialized||Y(n.Pop,L.location),C},subscribe:function(e){return v.add(e),()=>v.delete(e)},enableScrollRestoration:function(e,t,r){if(g=e,R=t,E=r||null,!x&&L.navigation===oe){x=!0;let e=je(L.location,L.matches);null!=e&&q({restoreScrollPosition:e})}return()=>{g=null,R=null,E=null}},navigate:async function t(r,o){if("number"==typeof r)return void e.history.go(r);let i=ue(L.location,L.matches,h,p.v7_prependBasename,r,null==o?void 0:o.fromRouteId,null==o?void 0:o.relative),{path:l,submission:s,error:c}=de(p.v7_normalizeFormMethod,!1,i,o),u=L.location,d=f(L.location,l,o&&o.state);d=a({},d,e.history.encodeLocation(d));let m=o&&null!=o.replace?o.replace:void 0,v=n.Push;!0===m?v=n.Replace:!1===m||null!=s&&Ae(s.formMethod)&&s.formAction===L.location.pathname+L.location.search&&(v=n.Replace);let y=o&&"preventScrollReset"in o?!0===o.preventScrollReset:void 0,g=ge({currentLocation:u,nextLocation:d,historyAction:v});if(!g)return await Y(v,d,{submission:s,pendingError:c,preventScrollReset:y,replace:o&&o.replace});me(g,{state:"blocked",location:d,proceed(){me(g,{state:"proceeding",proceed:void 0,reset:void 0,location:d}),t(r,o)},reset(){let e=new Map(L.blockers);e.set(g,ie),q({blockers:e})}})},fetch:function(t,r,n,d){if(o)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.");F.has(t)&&te(t);let f=l||c,m=ue(L.location,L.matches,h,p.v7_prependBasename,n,r,null==d?void 0:d.relative),v=w(f,m,h);if(!v)return void Z(t,r,Se(404,{pathname:m}));let{path:y,submission:g,error:b}=de(p.v7_normalizeFormMethod,!0,m,d);if(b)return void Z(t,r,b);let E=Te(v,y);U=!0===(d&&d.preventScrollReset),g&&Ae(g.formMethod)?async function(t,r,n,o,d,f){if(Q(),W.delete(t),!o.route.action&&!o.route.lazy){let e=Se(405,{method:f.formMethod,pathname:n,routeId:r});return void Z(t,r,e)}let p=function(e,t){return{state:"submitting",formMethod:e.formMethod,formAction:e.formAction,formEncType:e.formEncType,formData:e.formData,json:e.json,text:e.text,data:t?t.data:void 0," _hasFetcherDoneAnything ":!0}}(f,L.fetchers.get(t));L.fetchers.set(t,p),q({fetchers:new Map(L.fetchers)});let m=new AbortController,v=ye(e.history,n,m.signal,f);F.set(t,m);let y=await ve("action",v,o,d,s,i,h);if(v.signal.aborted)return void(F.get(t)===m&&F.delete(t));if(Le(y)){F.delete(t),z.add(t);let e=Fe(f);return L.fetchers.set(t,e),q({fetchers:new Map(L.fetchers)}),X(L,y,{submission:f,isFetchActionRedirect:!0})}if(ke(y))return void Z(t,r,y.error);if(Pe(y))throw Se(400,{type:"defer-action"});let g=L.navigation.location||L.location,b=ye(e.history,g,m.signal),E=l||c,R="idle"!==L.navigation.state?w(E,L.navigation.location,h):L.matches;u(R,"Didn't find any matches after fetcher action");let x=++B;I.set(t,x);let S=Fe(f,y.data);L.fetchers.set(t,S);let[D,C]=he(e.history,L,R,f,g,j,T,O,W,z,E,h,{[o.route.id]:y.data},void 0);C.filter((e=>e.key!==t)).forEach((e=>{let t=e.key,r=L.fetchers.get(t),n=Fe(void 0,r?r.data:void 0);L.fetchers.set(t,n),F.has(t)&&te(t),e.controller&&F.set(t,e.controller)})),q({fetchers:new Map(L.fetchers)});let k=()=>C.forEach((e=>te(e.key)));m.signal.addEventListener("abort",k);let{results:U,loaderResults:M,fetcherResults:_}=await G(L.matches,R,D,C,b);if(m.signal.aborted)return;m.signal.removeEventListener("abort",k),I.delete(t),F.delete(t),C.forEach((e=>F.delete(e.key)));let $=De(U);if($)return X(L,$);let{loaderData:K,errors:Y}=we(L,L.matches,D,M,void 0,C,_,H);if(L.fetchers.has(t)){let e=Be(y.data);L.fetchers.set(t,e)}let V=fe(x);"loading"===L.navigation.state&&x>N?(u(A,"Expected pending action"),P&&P.abort(),J(L.navigation.location,{matches:R,loaderData:K,errors:Y,fetchers:new Map(L.fetchers)})):(q(a({errors:Y,loaderData:Ee(L.loaderData,K,R,Y)},V||C.length>0?{fetchers:new Map(L.fetchers)}:{})),j=!1)}(t,r,y,E,v,g):(W.set(t,{routeId:r,path:y}),async function(t,r,n,o,a,l){let c=L.fetchers.get(t),d=Fe(l,c?c.data:void 0);L.fetchers.set(t,d),q({fetchers:new Map(L.fetchers)});let f=new AbortController,p=ye(e.history,n,f.signal);F.set(t,f);let m=await ve("loader",p,o,a,s,i,h);if(Pe(m)&&(m=await Me(m,p.signal,!0)||m),F.get(t)===f&&F.delete(t),p.signal.aborted)return;if(Le(m))return z.add(t),void await X(L,m);if(ke(m)){let e=Re(L.matches,r);return L.fetchers.delete(t),void q({fetchers:new Map(L.fetchers),errors:{[e.route.id]:m.error}})}u(!Pe(m),"Unhandled fetcher deferred data");let v=Be(m.data);L.fetchers.set(t,v),q({fetchers:new Map(L.fetchers)})}(t,r,y,E,v,g))},revalidate:function(){Q(),q({revalidation:"loading"}),"submitting"!==L.navigation.state&&("idle"!==L.navigation.state?Y(A||L.historyAction,L.navigation.location,{overrideNavigation:L.navigation}):Y(L.historyAction,L.location,{startUninterruptedRevalidation:!0}))},createHref:t=>e.history.createHref(t),encodeLocation:t=>e.history.encodeLocation(t),getFetcher:V,deleteFetcher:ee,dispose:function(){m&&m(),v.clear(),P&&P.abort(),L.fetchers.forEach(((e,t)=>ee(t))),L.blockers.forEach(((e,t)=>pe(t)))},getBlocker:function(e,t){let r=L.blockers.get(e)||ie;return $.get(e)!==t&&$.set(e,t),r},deleteBlocker:pe,_internalFetchControllers:F,_internalActiveDeferreds:H,_internalSetRoutes:function(e){s={},l=b(e,i,void 0,s)}},C}function ue(e,t,r,n,o,a,i){let l,s;if(null!=a&&"path"!==i){l=[];for(let e of t)if(l.push(e),e.route.id===a){s=e;break}}else l=t,s=t[t.length-1];let c=N(o||".",B(l).map((e=>e.pathnameBase)),_(e.pathname,r)||e.pathname,"path"===i);return null==o&&(c.search=e.search,c.hash=e.hash),null!=o&&""!==o&&"."!==o||!s||!s.route.index||je(c.search)||(c.search=c.search?c.search.replace(/^\?/,"?index&"):"?index"),n&&"/"!==r&&(c.pathname="/"===c.pathname?r:I([r,c.pathname])),p(c)}function de(e,t,r,n){if(!n||!function(e){return null!=e&&("formData"in e&&null!=e.formData||"body"in e&&void 0!==e.body)}(n))return{path:r};if(n.formMethod&&(o=n.formMethod,!te.has(o.toLowerCase())))return{path:r,error:Se(405,{method:n.formMethod})};var o;let a,i,l=()=>({path:r,error:Se(400,{type:"invalid-body"})}),s=n.formMethod||"get",c=e?s.toUpperCase():s.toLowerCase(),d=Ce(r);if(void 0!==n.body){if("text/plain"===n.formEncType){if(!Ae(c))return l();let e="string"==typeof n.body?n.body:n.body instanceof FormData||n.body instanceof URLSearchParams?Array.from(n.body.entries()).reduce(((e,t)=>{let[r,n]=t;return""+e+r+"="+n+"\n"}),""):String(n.body);return{path:r,submission:{formMethod:c,formAction:d,formEncType:n.formEncType,formData:void 0,json:void 0,text:e}}}if("application/json"===n.formEncType){if(!Ae(c))return l();try{let e="string"==typeof n.body?JSON.parse(n.body):n.body;return{path:r,submission:{formMethod:c,formAction:d,formEncType:n.formEncType,formData:void 0,json:e,text:void 0}}}catch(e){return l()}}}if(u("function"==typeof FormData,"FormData is not available in this environment"),n.formData)a=ge(n.formData),i=n.formData;else if(n.body instanceof FormData)a=ge(n.body),i=n.body;else if(n.body instanceof URLSearchParams)a=n.body,i=be(a);else if(null==n.body)a=new URLSearchParams,i=new FormData;else try{a=new URLSearchParams(n.body),i=be(a)}catch(e){return l()}let h={formMethod:c,formAction:d,formEncType:n&&n.formEncType||"application/x-www-form-urlencoded",formData:i,json:void 0,text:void 0};if(Ae(h.formMethod))return{path:r,submission:h};let f=m(r);return t&&f.search&&je(f.search)&&a.append("index",""),f.search="?"+a,{path:p(f),submission:h}}function he(e,t,r,n,o,i,l,s,c,u,d,h,f,p){let m=p?Object.values(p)[0]:f?Object.values(f)[0]:void 0,v=e.createURL(t.location),y=e.createURL(o),g=p?Object.keys(p)[0]:void 0,b=function(e,t){let r=e;if(t){let n=e.findIndex((e=>e.route.id===t));n>=0&&(r=e.slice(0,n))}return r}(r,g).filter(((e,r)=>{if(e.route.lazy)return!0;if(null==e.route.loader)return!1;if(function(e,t,r){let n=!t||r.route.id!==t.route.id,o=void 0===e[r.route.id];return n||o}(t.loaderData,t.matches[r],e)||l.some((t=>t===e.route.id)))return!0;let o=t.matches[r],s=e;return pe(e,a({currentUrl:v,currentParams:o.params,nextUrl:y,nextParams:s.params},n,{actionResult:m,defaultShouldRevalidate:i||v.pathname+v.search===y.pathname+y.search||v.search!==y.search||fe(o,s)}))})),E=[];return c.forEach(((e,o)=>{if(!r.some((t=>t.route.id===e.routeId)))return;let l=w(d,e.path,h);if(!l)return void E.push({key:o,routeId:e.routeId,path:e.path,matches:null,match:null,controller:null});let c=t.fetchers.get(o),f=c&&"idle"!==c.state&&void 0===c.data&&!u.has(o),p=Te(l,e.path);(s.includes(o)||f||pe(p,a({currentUrl:v,currentParams:t.matches[t.matches.length-1].params,nextUrl:y,nextParams:r[r.length-1].params},n,{actionResult:m,defaultShouldRevalidate:i})))&&E.push({key:o,routeId:e.routeId,path:e.path,matches:l,match:p,controller:new AbortController})})),[b,E]}function fe(e,t){let r=e.route.path;return e.pathname!==t.pathname||null!=r&&r.endsWith("*")&&e.params["*"]!==t.params["*"]}function pe(e,t){if(e.route.shouldRevalidate){let r=e.route.shouldRevalidate(t);if("boolean"==typeof r)return r}return t.defaultShouldRevalidate}async function me(e,t,r){if(!e.lazy)return;let n=await e.lazy();if(!e.lazy)return;let o=r[e.id];u(o,"No route found in manifest");let i={};for(let e in n){let t=void 0!==o[e]&&"hasErrorBoundary"!==e;d(!t,'Route "'+o.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||g.has(e)||(i[e]=n[e])}Object.assign(o,i),Object.assign(o,a({},t(o),{lazy:void 0}))}async function ve(e,t,r,n,o,a,i,l){let s,c,d;void 0===l&&(l={});let h=e=>{let n,o=new Promise(((e,t)=>n=t));return d=()=>n(),t.signal.addEventListener("abort",d),Promise.race([e({request:t,params:r.params,context:l.requestContext}),o])};try{let n=r.route[e];if(r.route.lazy)if(n)c=(await Promise.all([h(n),me(r.route,a,o)]))[0];else{if(await me(r.route,a,o),n=r.route[e],!n){if("action"===e){let e=new URL(t.url),n=e.pathname+e.search;throw Se(405,{method:t.method,pathname:n,routeId:r.route.id})}return{type:y.data,data:void 0}}c=await h(n)}else{if(!n){let e=new URL(t.url);throw Se(404,{pathname:e.pathname+e.search})}c=await h(n)}u(void 0!==c,"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){s=y.error,c=e}finally{d&&t.signal.removeEventListener("abort",d)}if(null!=(f=c)&&"number"==typeof f.status&&"string"==typeof f.statusText&&"object"==typeof f.headers&&void 0!==f.body){let e,o=c.status;if(re.has(o)){let e=c.headers.get("Location");if(u(e,"Redirects returned/thrown from loaders/actions must have a Location header"),le.test(e)){if(!l.isStaticRequest){let r=new URL(t.url),n=e.startsWith("//")?new URL(r.protocol+e):new URL(e),o=null!=_(n.pathname,i);n.origin===r.origin&&o&&(e=n.pathname+n.search+n.hash)}}else e=ue(new URL(t.url),n.slice(0,n.indexOf(r)+1),i,!0,e);if(l.isStaticRequest)throw c.headers.set("Location",e),c;return{type:y.redirect,status:o,location:e,revalidate:null!==c.headers.get("X-Remix-Revalidate")}}if(l.isRouteRequest)throw{type:s||y.data,response:c};let a=c.headers.get("Content-Type");return e=a&&/\bapplication\/json\b/.test(a)?await c.json():await c.text(),s===y.error?{type:s,error:new X(o,c.statusText,e),headers:c.headers}:{type:y.data,data:e,statusCode:c.status,headers:c.headers}}var f,p,m;return s===y.error?{type:s,error:c}:function(e){let t=e;return t&&"object"==typeof t&&"object"==typeof t.data&&"function"==typeof t.subscribe&&"function"==typeof t.cancel&&"function"==typeof t.resolveData}(c)?{type:y.deferred,deferredData:c,statusCode:null==(p=c.init)?void 0:p.status,headers:(null==(m=c.init)?void 0:m.headers)&&new Headers(c.init.headers)}:{type:y.data,data:c}}function ye(e,t,r,n){let o=e.createURL(Ce(t)).toString(),a={signal:r};if(n&&Ae(n.formMethod)){let{formMethod:e,formEncType:t}=n;a.method=e.toUpperCase(),"application/json"===t?(a.headers=new Headers({"Content-Type":t}),a.body=JSON.stringify(n.json)):"text/plain"===t?a.body=n.text:"application/x-www-form-urlencoded"===t&&n.formData?a.body=ge(n.formData):a.body=n.formData}return new Request(o,a)}function ge(e){let t=new URLSearchParams;for(let[r,n]of e.entries())t.append(r,"string"==typeof n?n:n.name);return t}function be(e){let t=new FormData;for(let[r,n]of e.entries())t.append(r,n);return t}function we(e,t,r,n,o,i,l,s){let{loaderData:c,errors:d}=function(e,t,r,n,o){let a,i={},l=null,s=!1,c={};return r.forEach(((r,d)=>{let h=t[d].route.id;if(u(!Le(r),"Cannot handle redirect results in processLoaderData"),ke(r)){let t=Re(e,h),o=r.error;n&&(o=Object.values(n)[0],n=void 0),l=l||{},null==l[t.route.id]&&(l[t.route.id]=o),i[h]=void 0,s||(s=!0,a=G(r.error)?r.error.status:500),r.headers&&(c[h]=r.headers)}else Pe(r)?(o.set(h,r.deferredData),i[h]=r.deferredData.data):i[h]=r.data,null==r.statusCode||200===r.statusCode||s||(a=r.statusCode),r.headers&&(c[h]=r.headers)})),n&&(l=n,i[Object.keys(n)[0]]=void 0),{loaderData:i,errors:l,statusCode:a||200,loaderHeaders:c}}(t,r,n,o,s);for(let t=0;t<i.length;t++){let{key:r,match:n,controller:o}=i[t];u(void 0!==l&&void 0!==l[t],"Did not find corresponding fetcher result");let s=l[t];if(!o||!o.signal.aborted)if(ke(s)){let t=Re(e.matches,null==n?void 0:n.route.id);d&&d[t.route.id]||(d=a({},d,{[t.route.id]:s.error})),e.fetchers.delete(r)}else if(Le(s))u(!1,"Unhandled fetcher revalidation redirect");else if(Pe(s))u(!1,"Unhandled fetcher deferred data");else{let t=Be(s.data);e.fetchers.set(r,t)}}return{loaderData:c,errors:d}}function Ee(e,t,r,n){let o=a({},t);for(let a of r){let r=a.route.id;if(t.hasOwnProperty(r)?void 0!==t[r]&&(o[r]=t[r]):void 0!==e[r]&&a.route.loader&&(o[r]=e[r]),n&&n.hasOwnProperty(r))break}return o}function Re(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 xe(e){let t=e.find((e=>e.index||!e.path||"/"===e.path))||{id:"__shim-error-route__"};return{matches:[{params:{},pathname:"",pathnameBase:"",route:t}],route:t}}function Se(e,t){let{pathname:r,routeId:n,method:o,type:a}=void 0===t?{}:t,i="Unknown Server Error",l="Unknown @remix-run/router error";return 400===e?(i="Bad Request",o&&r&&n?l="You made a "+o+' request to "'+r+'" but did not provide a `loader` for route "'+n+'", so there is no way to handle the request.':"defer-action"===a?l="defer() is not supported in actions":"invalid-body"===a&&(l="Unable to encode submission body")):403===e?(i="Forbidden",l='Route "'+n+'" does not match URL "'+r+'"'):404===e?(i="Not Found",l='No route matches URL "'+r+'"'):405===e&&(i="Method Not Allowed",o&&r&&n?l="You made a "+o.toUpperCase()+' request to "'+r+'" but did not provide an `action` for route "'+n+'", so there is no way to handle the request.':o&&(l='Invalid request method "'+o.toUpperCase()+'"')),new X(e||500,i,new Error(l),!0)}function De(e){for(let t=e.length-1;t>=0;t--){let r=e[t];if(Le(r))return r}}function Ce(e){return p(a({},"string"==typeof e?m(e):e,{hash:""}))}function Pe(e){return e.type===y.deferred}function ke(e){return e.type===y.error}function Le(e){return(e&&e.type)===y.redirect}function Ae(e){return Z.has(e.toLowerCase())}async function Ue(e,t,r,n,o,a){for(let i=0;i<r.length;i++){let l=r[i],s=t[i];if(!s)continue;let c=e.find((e=>e.route.id===s.route.id)),d=null!=c&&!fe(c,s)&&void 0!==(a&&a[s.route.id]);if(Pe(l)&&(o||d)){let e=n[i];u(e,"Expected an AbortSignal for revalidating fetcher deferred result"),await Me(l,e,o).then((e=>{e&&(r[i]=e||r[i])}))}}}async function Me(e,t,r){if(void 0===r&&(r=!1),!await e.deferredData.resolveData(t)){if(r)try{return{type:y.data,data:e.deferredData.unwrappedData}}catch(e){return{type:y.error,error:e}}return{type:y.data,data:e.deferredData.data}}}function je(e){return new URLSearchParams(e).getAll("index").some((e=>""===e))}function Te(e,t){let r="string"==typeof t?m(t).search:t.search;if(e[e.length-1].route.index&&je(r||""))return e[e.length-1];let n=B(e);return n[n.length-1]}function _e(e){let{formMethod:t,formAction:r,formEncType:n,text:o,formData:a,json:i}=e;if(t&&r&&n)return null!=o?{formMethod:t,formAction:r,formEncType:n,formData:void 0,json:void 0,text:o}:null!=a?{formMethod:t,formAction:r,formEncType:n,formData:a,json:void 0,text:void 0}:void 0!==i?{formMethod:t,formAction:r,formEncType:n,formData:void 0,json:i,text:void 0}:void 0}function Oe(e,t){return t?{state:"loading",location:e,formMethod:t.formMethod,formAction:t.formAction,formEncType:t.formEncType,formData:t.formData,json:t.json,text:t.text}:{state:"loading",location:e,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0}}function Fe(e,t){return e?{state:"loading",formMethod:e.formMethod,formAction:e.formAction,formEncType:e.formEncType,formData:e.formData,json:e.json,text:e.text,data:t," _hasFetcherDoneAnything ":!0}:{state:"loading",formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0,data:t," _hasFetcherDoneAnything ":!0}}function Be(e){return{state:"idle",formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0,data:e," _hasFetcherDoneAnything ":!0}}function Ne(){return Ne=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Ne.apply(this,arguments)}Symbol("deferred");const Ie=o.createContext(null),ze=o.createContext(null),We=o.createContext(null),He=o.createContext(null),$e=o.createContext(null),Ke=o.createContext({outlet:null,matches:[],isDataRoute:!1}),qe=o.createContext(null);function Je(e,t){let{relative:r}=void 0===t?{}:t;Ye()||u(!1);let{basename:n,navigator:a}=o.useContext(He),{hash:i,pathname:l,search:s}=ot(e,{relative:r}),c=l;return"/"!==n&&(c="/"===l?n:I([n,l])),a.createHref({pathname:c,search:s,hash:i})}function Ye(){return null!=o.useContext($e)}function Ve(){return Ye()||u(!1),o.useContext($e).location}function Xe(){return o.useContext($e).navigationType}function Ge(e){Ye()||u(!1);let{pathname:t}=Ve();return o.useMemo((()=>j(e,t)),[t,e])}function Qe(e){o.useContext(He).static||o.useLayoutEffect(e)}function Ze(){let{isDataRoute:e}=o.useContext(Ke);return e?function(){let{router:e}=pt(ht.UseNavigateStable),t=vt(ft.UseNavigateStable),r=o.useRef(!1);return Qe((()=>{r.current=!0})),o.useCallback((function(n,o){void 0===o&&(o={}),r.current&&("number"==typeof n?e.navigate(n):e.navigate(n,Ne({fromRouteId:t},o)))}),[e,t])}():function(){Ye()||u(!1);let e=o.useContext(Ie),{basename:t,navigator:r}=o.useContext(He),{matches:n}=o.useContext(Ke),{pathname:a}=Ve(),i=JSON.stringify(B(n).map((e=>e.pathnameBase))),l=o.useRef(!1);return Qe((()=>{l.current=!0})),o.useCallback((function(n,o){if(void 0===o&&(o={}),!l.current)return;if("number"==typeof n)return void r.go(n);let s=N(n,JSON.parse(i),a,"path"===o.relative);null==e&&"/"!==t&&(s.pathname="/"===s.pathname?t:I([t,s.pathname])),(o.replace?r.replace:r.push)(s,o.state,o)}),[t,r,i,a,e])}()}const et=o.createContext(null);function tt(){return o.useContext(et)}function rt(e){let t=o.useContext(Ke).outlet;return t?o.createElement(et.Provider,{value:e},t):t}function nt(){let{matches:e}=o.useContext(Ke),t=e[e.length-1];return t?t.params:{}}function ot(e,t){let{relative:r}=void 0===t?{}:t,{matches:n}=o.useContext(Ke),{pathname:a}=Ve(),i=JSON.stringify(B(n).map((e=>e.pathnameBase)));return o.useMemo((()=>N(e,JSON.parse(i),a,"path"===r)),[e,i,a,r])}function at(e,t){return it(e,t)}function it(e,t,r){Ye()||u(!1);let{navigator:a}=o.useContext(He),{matches:i}=o.useContext(Ke),l=i[i.length-1],s=l?l.params:{},c=(l&&l.pathname,l?l.pathnameBase:"/");l&&l.route;let d,h=Ve();if(t){var f;let e="string"==typeof t?m(t):t;"/"===c||(null==(f=e.pathname)?void 0:f.startsWith(c))||u(!1),d=e}else d=h;let p=d.pathname||"/",v=w(e,{pathname:"/"===c?p:p.slice(c.length)||"/"}),y=dt(v&&v.map((e=>Object.assign({},e,{params:Object.assign({},s,e.params),pathname:I([c,a.encodeLocation?a.encodeLocation(e.pathname).pathname:e.pathname]),pathnameBase:"/"===e.pathnameBase?c:I([c,a.encodeLocation?a.encodeLocation(e.pathnameBase).pathname:e.pathnameBase])}))),i,r);return t&&y?o.createElement($e.Provider,{value:{location:Ne({pathname:"/",search:"",hash:"",state:null,key:"default"},d),navigationType:n.Pop}},y):y}function lt(){let e=St(),t=G(e)?e.status+" "+e.statusText:e instanceof Error?e.message:JSON.stringify(e),r=e instanceof Error?e.stack:null,n={padding:"0.5rem",backgroundColor:"rgba(200,200,200, 0.5)"};return o.createElement(o.Fragment,null,o.createElement("h2",null,"Unexpected Application Error!"),o.createElement("h3",{style:{fontStyle:"italic"}},t),r?o.createElement("pre",{style:n},r):null,null)}const st=o.createElement(lt,null);class ct extends o.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,t){return t.location!==e.location||"idle"!==t.revalidation&&"idle"===e.revalidation?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error||t.error,location:t.location,revalidation:e.revalidation||t.revalidation}}componentDidCatch(e,t){console.error("React Router caught the following error during render",e,t)}render(){return this.state.error?o.createElement(Ke.Provider,{value:this.props.routeContext},o.createElement(qe.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function ut(e){let{routeContext:t,match:r,children:n}=e,a=o.useContext(Ie);return a&&a.static&&a.staticContext&&(r.route.errorElement||r.route.ErrorBoundary)&&(a.staticContext._deepestRenderedBoundaryId=r.route.id),o.createElement(Ke.Provider,{value:t},n)}function dt(e,t,r){var n;if(void 0===t&&(t=[]),void 0===r&&(r=null),null==e){var a;if(null==(a=r)||!a.errors)return null;e=r.matches}let i=e,l=null==(n=r)?void 0:n.errors;if(null!=l){let e=i.findIndex((e=>e.route.id&&(null==l?void 0:l[e.route.id])));e>=0||u(!1),i=i.slice(0,Math.min(i.length,e+1))}return i.reduceRight(((e,n,a)=>{let s=n.route.id?null==l?void 0:l[n.route.id]:null,c=null;r&&(c=n.route.errorElement||st);let u=t.concat(i.slice(0,a+1)),d=()=>{let t;return t=s?c:n.route.Component?o.createElement(n.route.Component,null):n.route.element?n.route.element:e,o.createElement(ut,{match:n,routeContext:{outlet:e,matches:u,isDataRoute:null!=r},children:t})};return r&&(n.route.ErrorBoundary||n.route.errorElement||0===a)?o.createElement(ct,{location:r.location,revalidation:r.revalidation,component:c,error:s,children:d(),routeContext:{outlet:null,matches:u,isDataRoute:!0}}):d()}),null)}var ht,ft;function pt(e){let t=o.useContext(Ie);return t||u(!1),t}function mt(e){let t=o.useContext(ze);return t||u(!1),t}function vt(e){let t=function(){let e=o.useContext(Ke);return e||u(!1),e}(),r=t.matches[t.matches.length-1];return r.route.id||u(!1),r.route.id}function yt(){return vt(ft.UseRouteId)}function gt(){return mt(ft.UseNavigation).navigation}function bt(){let e=pt(ht.UseRevalidator),t=mt(ft.UseRevalidator);return{revalidate:e.router.revalidate,state:t.revalidation}}function wt(){let{matches:e,loaderData:t}=mt(ft.UseMatches);return o.useMemo((()=>e.map((e=>{let{pathname:r,params:n}=e;return{id:e.route.id,pathname:r,params:n,data:t[e.route.id],handle:e.route.handle}}))),[e,t])}function Et(){let e=mt(ft.UseLoaderData),t=vt(ft.UseLoaderData);if(!e.errors||null==e.errors[t])return e.loaderData[t];console.error("You cannot `useLoaderData` in an errorElement (routeId: "+t+")")}function Rt(e){return mt(ft.UseRouteLoaderData).loaderData[e]}function xt(){let e=mt(ft.UseActionData);return o.useContext(Ke)||u(!1),Object.values((null==e?void 0:e.actionData)||{})[0]}function St(){var e;let t=o.useContext(qe),r=mt(ft.UseRouteError),n=vt(