Socket
Socket
Sign inDemoInstall

@remix-run/router

Package Overview
Dependencies
Maintainers
2
Versions
216
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@remix-run/router - npm Package Compare versions

Comparing version 1.0.4 to 1.0.5-pre.0

13

CHANGELOG.md
# `@remix-run/router`
## 1.0.5-pre.0
### Patch Changes
- Fix URL creation in Cloudflare Pages or other non-browser-environment ([#9682](https://github.com/remix-run/react-router/pull/9682))
- Fix requests sent to revalidating loaders so they reflect a GET request ([#9680](https://github.com/remix-run/react-router/pull/9680))
## 1.0.4

@@ -49,5 +56,5 @@

[rr-docs]: https://reactrouter.com/
[rr-feature-overview]: https://reactrouter.com/en/6.4.0/start/overview
[rr-tutorial]: https://reactrouter.com/en/6.4.0/start/tutorial
[rr-docs]: https://reactrouter.com
[rr-feature-overview]: https://reactrouter.com/start/overview
[rr-tutorial]: https://reactrouter.com/start/tutorial
[remix-router-readme]: https://github.com/remix-run/react-router/blob/main/packages/router/README.md

@@ -218,2 +218,7 @@ /**

/**
* @private
*/
export declare function invariant(value: boolean, message?: string): asserts value;
export declare function invariant<T>(value: T | null | undefined, message?: string): asserts value is T;
/**
* Creates a Location object with a unique key from the given Path

@@ -230,3 +235,3 @@ */

export declare function parsePath(path: string): Partial<Path>;
export declare function createURL(location: Location | string): URL;
export declare function createClientSideURL(location: Location | string): URL;
export interface UrlHistory extends History {

@@ -233,0 +238,0 @@ }

import { convertRoutesToDataRoutes, getPathContributingMatches } from "./utils";
export type { ActionFunction, ActionFunctionArgs, AgnosticDataIndexRouteObject, AgnosticDataNonIndexRouteObject, AgnosticDataRouteMatch, AgnosticDataRouteObject, AgnosticIndexRouteObject, AgnosticNonIndexRouteObject, AgnosticRouteMatch, AgnosticRouteObject, TrackedPromise, FormEncType, FormMethod, JsonFunction, LoaderFunction, LoaderFunctionArgs, ParamParseKey, Params, PathMatch, PathPattern, RedirectFunction, ShouldRevalidateFunction, Submission, } from "./utils";
export { AbortedDeferredError, ErrorResponse, defer, generatePath, getToPathname, invariant, isRouteErrorResponse, joinPaths, json, matchPath, matchRoutes, normalizePathname, redirect, resolvePath, resolveTo, stripBasename, warning, } from "./utils";
export { AbortedDeferredError, ErrorResponse, defer, generatePath, getToPathname, isRouteErrorResponse, joinPaths, json, matchPath, matchRoutes, normalizePathname, redirect, resolvePath, resolveTo, stripBasename, warning, } from "./utils";
export type { BrowserHistory, BrowserHistoryOptions, HashHistory, HashHistoryOptions, History, InitialEntry, Location, MemoryHistory, MemoryHistoryOptions, Path, To, } from "./history";
export { Action, createBrowserHistory, createPath, createHashHistory, createMemoryHistory, parsePath, } from "./history";
export { Action, createBrowserHistory, createPath, createHashHistory, createMemoryHistory, invariant, parsePath, } from "./history";
export * from "./router";
/** @internal */
export { convertRoutesToDataRoutes as UNSAFE_convertRoutesToDataRoutes, getPathContributingMatches as UNSAFE_getPathContributingMatches, };
/**
* @remix-run/router v1.0.4
* @remix-run/router v1.0.5-pre.0
*

@@ -11,3 +11,3 @@ * Copyright (c) Remix Software Inc.

*/
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).RemixRouter={})}(this,(function(e){"use strict";function t(){return t=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},t.apply(this,arguments)}var r;e.Action=void 0,(r=e.Action||(e.Action={})).Pop="POP",r.Push="PUSH",r.Replace="REPLACE";const a="popstate";function n(e,t){if(!e){"undefined"!=typeof console&&console.warn(t);try{throw new Error(t)}catch(e){}}}function o(e){return{usr:e.state,key:e.key}}function i(e,r,a,n){return void 0===a&&(a=null),t({pathname:"string"==typeof e?e:e.pathname,search:"",hash:""},"string"==typeof r?l(r):r,{state:a,key:r&&r.key||n||Math.random().toString(36).substr(2,8)})}function s(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 l(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 d(e){let t="undefined"!=typeof window&&void 0!==window.location&&"null"!==window.location.origin?window.location.origin:"unknown://unknown",r="string"==typeof e?e:s(e);return new URL(r,t)}function c(t,r,n,l){void 0===l&&(l={});let{window:c=document.defaultView,v5Compat:u=!1}=l,h=c.history,f=e.Action.Pop,p=null;function m(){f=e.Action.Pop,p&&p({action:f,location:g.location})}let g={get action(){return f},get location(){return t(c,h)},listen(e){if(p)throw new Error("A history only accepts one active listener");return c.addEventListener(a,m),p=e,()=>{c.removeEventListener(a,m),p=null}},createHref:e=>r(c,e),encodeLocation(e){let t=d("string"==typeof e?e:s(e));return{pathname:t.pathname,search:t.search,hash:t.hash}},push:function(t,r){f=e.Action.Push;let a=i(g.location,t,r);n&&n(a,t);let s=o(a),l=g.createHref(a);try{h.pushState(s,"",l)}catch(e){c.location.assign(l)}u&&p&&p({action:f,location:g.location})},replace:function(t,r){f=e.Action.Replace;let a=i(g.location,t,r);n&&n(a,t);let s=o(a),l=g.createHref(a);h.replaceState(s,"",l),u&&p&&p({action:f,location:g.location})},go:e=>h.go(e)};return g}let u;function h(e,r,a){return void 0===r&&(r=[]),void 0===a&&(a=new Set),e.map(((e,n)=>{let o=[...r,n],i="string"==typeof e.id?e.id:o.join("-");if(E(!0!==e.index||!e.children,"Cannot specify children on an index route"),E(!a.has(i),'Found a route id collision on id "'+i+"\". Route id's must be globally unique within Data Router usages"),a.add(i),function(e){return!0===e.index}(e)){return t({},e,{id:i})}return t({},e,{id:i,children:e.children?h(e.children,o,a):void 0})}))}function f(e,t,r){void 0===r&&(r="/");let a=D(("string"==typeof t?l(t):t).pathname||"/",r);if(null==a)return null;let n=p(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)))))}(n);let o=null;for(let e=0;null==o&&e<n.length;++e)o=y(n[e],b(a));return o}function p(e,t,r,a){return void 0===t&&(t=[]),void 0===r&&(r=[]),void 0===a&&(a=""),e.forEach(((e,n)=>{let o={relativePath:e.path||"",caseSensitive:!0===e.caseSensitive,childrenIndex:n,route:e};o.relativePath.startsWith("/")&&(E(o.relativePath.startsWith(a),'Absolute route path "'+o.relativePath+'" nested under path "'+a+'" is not valid. An absolute child route path must start with the combined path of all its parent routes.'),o.relativePath=o.relativePath.slice(a.length));let i=M([a,o.relativePath]),s=r.concat(o);e.children&&e.children.length>0&&(E(!0!==e.index,'Index routes must not have child routes. Please remove all child routes from route path "'+i+'".'),p(e.children,t,s,i)),(null!=e.path||e.index)&&t.push({path:i,score:v(i,e.index),routesMeta:s})})),t}!function(e){e.data="data",e.deferred="deferred",e.redirect="redirect",e.error="error"}(u||(u={}));const m=/^:\w+$/,g=e=>"*"===e;function v(e,t){let r=e.split("/"),a=r.length;return r.some(g)&&(a+=-2),t&&(a+=2),r.filter((e=>!g(e))).reduce(((e,t)=>e+(m.test(t)?3:""===t?1:10)),a)}function y(e,t){let{routesMeta:r}=e,a={},n="/",o=[];for(let e=0;e<r.length;++e){let i=r[e],s=e===r.length-1,l="/"===n?t:t.slice(n.length)||"/",d=w({path:i.relativePath,caseSensitive:i.caseSensitive,end:s},l);if(!d)return null;Object.assign(a,d.params);let c=i.route;o.push({params:a,pathname:M([n,d.pathname]),pathnameBase:x(M([n,d.pathnameBase])),route:c}),"/"!==d.pathnameBase&&(n=M([n,d.pathnameBase]))}return o}function w(e,t){"string"==typeof e&&(e={path:e,caseSensitive:!1,end:!0});let[r,a]=function(e,t,r){void 0===t&&(t=!1);void 0===r&&(r=!0);R("*"===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,((e,t)=>(a.push(t),"([^\\/]+)")));e.endsWith("*")?(a.push("*"),n+="*"===e||"/*"===e?"(.*)$":"(?:\\/(.+)|\\/*)$"):r?n+="\\/*$":""!==e&&"/"!==e&&(n+="(?:(?=\\/|$))");return[new RegExp(n,t?void 0:"i"),a]}(e.path,e.caseSensitive,e.end),n=t.match(r);if(!n)return null;let o=n[0],i=o.replace(/(.)\/+$/,"$1"),s=n.slice(1);return{params:a.reduce(((e,t,r)=>{if("*"===t){let e=s[r]||"";i=o.slice(0,o.length-e.length).replace(/(.)\/+$/,"$1")}return e[t]=function(e,t){try{return decodeURIComponent(e)}catch(r){return R(!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}}(s[r]||"",t),e}),{}),pathname:o,pathnameBase:i,pattern:e}}function b(e){try{return decodeURI(e)}catch(t){return R(!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 D(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 E(e,t){if(!1===e||null==e)throw new Error(t)}function R(e,t){if(!e){"undefined"!=typeof console&&console.warn(t);try{throw new Error(t)}catch(e){}}}function A(e,t){void 0===t&&(t="/");let{pathname:r,search:a="",hash:n=""}="string"==typeof e?l(e):e,o=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:o,search:L(a),hash:T(n)}}function P(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 S(e){return e.filter(((e,t)=>0===t||e.route.path&&e.route.path.length>0))}function C(e,r,a,n){let o;void 0===n&&(n=!1),"string"==typeof e?o=l(e):(o=t({},e),E(!o.pathname||!o.pathname.includes("?"),P("?","pathname","search",o)),E(!o.pathname||!o.pathname.includes("#"),P("#","pathname","hash",o)),E(!o.search||!o.search.includes("#"),P("#","search","hash",o)));let i,s=""===e||""===o.pathname,d=s?"/":o.pathname;if(n||null==d)i=a;else{let e=r.length-1;if(d.startsWith("..")){let t=d.split("/");for(;".."===t[0];)t.shift(),e-=1;o.pathname=t.join("/")}i=e>=0?r[e]:"/"}let c=A(o,i),u=d&&"/"!==d&&d.endsWith("/"),h=(s||"."===d)&&a.endsWith("/");return c.pathname.endsWith("/")||!u&&!h||(c.pathname+="/"),c}const M=e=>e.join("/").replace(/\/\/+/g,"/"),x=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),L=e=>e&&"?"!==e?e.startsWith("?")?e:"?"+e:"",T=e=>e&&"#"!==e?e.startsWith("#")?e:"#"+e:"";class j extends Error{}class O{constructor(e){let t;this.pendingKeys=new Set,this.subscriber=void 0,E(e&&"object"==typeof e&&!Array.isArray(e),"defer() only accepts plain objects"),this.abortPromise=new Promise(((e,r)=>t=r)),this.controller=new AbortController;let r=()=>t(new j("Deferred data aborted"));this.unlistenAbortSignal=()=>this.controller.signal.removeEventListener("abort",r),this.controller.signal.addEventListener("abort",r),this.data=Object.entries(e).reduce(((e,t)=>{let[r,a]=t;return Object.assign(e,{[r]:this.trackPromise(r,a)})}),{})}trackPromise(e,t){if(!(t instanceof Promise))return t;this.pendingKeys.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,a){if(this.controller.signal.aborted&&r instanceof j)return this.unlistenAbortSignal(),Object.defineProperty(e,"_error",{get:()=>r}),Promise.reject(r);this.pendingKeys.delete(t),this.done&&this.unlistenAbortSignal();const n=this.subscriber;return r?(Object.defineProperty(e,"_error",{get:()=>r}),n&&n(!1),Promise.reject(r)):(Object.defineProperty(e,"_data",{get:()=>a}),n&&n(!1),a)}subscribe(e){this.subscriber=e}cancel(){this.controller.abort(),this.pendingKeys.forEach(((e,t)=>this.pendingKeys.delete(t)));let e=this.subscriber;e&&e(!0)}async resolveData(e){let t=!1;if(!this.done){let r=()=>this.cancel();e.addEventListener("abort",r),t=await new Promise((t=>{this.subscribe((a=>{e.removeEventListener("abort",r),(a||this.done)&&t(a)}))}))}return t}get done(){return 0===this.pendingKeys.size}get unwrappedData(){return E(null!==this.data&&this.done,"Can only unwrap data on initialized and settled deferreds"),Object.entries(this.data).reduce(((e,t)=>{let[r,a]=t;return Object.assign(e,{[r]:U(a)})}),{})}}function U(e){if(!function(e){return e instanceof Promise&&!0===e._tracked}(e))return e;if(e._error)throw e._error;return e._data}class H{constructor(e,t,r,a){void 0===a&&(a=!1),this.status=e,this.statusText=t||"",this.internal=a,r instanceof Error?(this.data=r.toString(),this.error=r):this.data=r}}function _(e){return e instanceof H}const k=["post","put","patch","delete"],I=new Set(k),q=["get",...k],W=new Set(q),$=new Set([301,302,303,307,308]),N=new Set([307,308]),B={state:"idle",location:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0},F={state:"idle",data:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0},z=!("undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement);function K(e,t,r){void 0===r&&(r=!1);let a="string"==typeof e?e:s(e);if(!t||!function(e){return null!=e&&"formData"in e}(t))return{path:a};if(t.formMethod&&!he(t.formMethod))return{path:a,error:oe(405,{method:t.formMethod})};if(t.formMethod&&fe(t.formMethod))return{path:a,submission:{formMethod:t.formMethod,formAction:se(a),formEncType:t&&t.formEncType||"application/x-www-form-urlencoded",formData:t.formData}};let n=l(a);try{let e=Z(t.formData);r&&n.search&&ge(n.search)&&e.append("index",""),n.search="?"+e}catch(e){return{path:a,error:oe(400)}}return{path:s(n)}}function Y(e,t){let r=e;if(t){let a=e.findIndex((e=>e.route.id===t));a>=0&&(r=e.slice(0,a))}return r}function J(e,t,r,a,n,o,i,s,l,d){let c=l?Object.values(l)[0]:s?Object.values(s)[0]:null,u=Y(t,l?Object.keys(l)[0]:void 0).filter(((t,i)=>null!=t.route.loader&&(function(e,t,r){let a=!t||r.route.id!==t.route.id,n=void 0===e[r.route.id];return a||n}(e.loaderData,e.matches[i],t)||o.some((e=>e===t.route.id))||V(e.location,e.matches[i],r,a,t,n,c)))),h=[];return d&&d.forEach(((e,t)=>{let[a,o,s]=e;if(i.includes(t))h.push([t,a,o,s]);else if(n){V(a,o,r,a,o,n,c)&&h.push([t,a,o,s])}})),[u,h]}function G(e,t){let r=e.route.path;return e.pathname!==t.pathname||r&&r.endsWith("*")&&e.params["*"]!==t.params["*"]}function V(e,r,a,n,o,i,s){let l=d(e),c=r.params,u=d(n),h=o.params,f=G(r,o)||l.toString()===u.toString()||l.search!==u.search||i;if(o.route.shouldRevalidate){let e=o.route.shouldRevalidate(t({currentUrl:l,currentParams:c,nextUrl:u,nextParams:h},a,{actionResult:s,defaultShouldRevalidate:f}));if("boolean"==typeof e)return e}return f}async function X(e,t,r,a,n,o,i){let l,c,h;void 0===n&&(n="/"),void 0===o&&(o=!1),void 0===i&&(i=!1);let f=new Promise(((e,t)=>h=t)),p=()=>h();t.signal.addEventListener("abort",p);try{let a=r.route[e];E(a,"Could not find the "+e+' to run on the "'+r.route.id+'" route'),c=await Promise.race([a({request:t,params:r.params}),f]),E(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){l=u.error,c=e}finally{t.signal.removeEventListener("abort",p)}if(c instanceof Response){let e,h=c.status;if($.has(h)){let e=c.headers.get("Location");E(e,"Redirects returned/thrown from loaders/actions must have a Location header");let i=d(e).origin!==d("/").origin;if(!i){let o=C(e,S(a.slice(0,a.indexOf(r)+1)).map((e=>e.pathnameBase)),d(t.url).pathname);if(E(s(o),"Unable to resolve redirect location: "+e),n){let e=o.pathname;o.pathname="/"===e?n:M([n,e])}e=s(o)}if(o)throw c.headers.set("Location",e),c;return{type:u.redirect,status:h,location:e,revalidate:null!==c.headers.get("X-Remix-Revalidate"),external:i}}if(i)throw{type:l||u.data,response:c};let f=c.headers.get("Content-Type");return e=f&&f.startsWith("application/json")?await c.json():await c.text(),l===u.error?{type:l,error:new H(h,c.statusText,e),headers:c.headers}:{type:u.data,data:e,statusCode:c.status,headers:c.headers}}return l===u.error?{type:l,error:c}:c instanceof O?{type:u.deferred,deferredData:c}:{type:u.data,data:c}}function Q(e,t,r){let a=d(se(e)).toString(),n={signal:t};if(r){let{formMethod:e,formEncType:t,formData:a}=r;n.method=e.toUpperCase(),n.body="application/x-www-form-urlencoded"===t?Z(a):a}return new Request(a,n)}function Z(e){let t=new URLSearchParams;for(let[r,a]of e.entries())E("string"==typeof a,'File inputs are not supported with encType "application/x-www-form-urlencoded", please use "multipart/form-data" instead.'),t.append(r,a);return t}function ee(e,t,r,a,n){let o,i={},s=null,l=!1,d={};return r.forEach(((r,c)=>{let u=t[c].route.id;if(E(!ce(r),"Cannot handle redirect results in processLoaderData"),de(r)){let t=ae(e,u),n=r.error;a&&(n=Object.values(a)[0],a=void 0),s=Object.assign(s||{},{[t.route.id]:n}),l||(l=!0,o=_(r.error)?r.error.status:500),r.headers&&(d[u]=r.headers)}else le(r)?(n&&n.set(u,r.deferredData),i[u]=r.deferredData.data):(i[u]=r.data,null==r.statusCode||200===r.statusCode||l||(o=r.statusCode),r.headers&&(d[u]=r.headers))})),a&&(s=a),{loaderData:i,errors:s,statusCode:o||200,loaderHeaders:d}}function te(e,r,a,n,o,i,s,l){let{loaderData:d,errors:c}=ee(r,a,n,o,l);for(let r=0;r<i.length;r++){let[a,,n]=i[r];E(void 0!==s&&void 0!==s[r],"Did not find corresponding fetcher result");let o=s[r];if(de(o)){let r=ae(e.matches,n.route.id);c&&c[r.route.id]||(c=t({},c,{[r.route.id]:o.error})),e.fetchers.delete(a)}else{if(ce(o))throw new Error("Unhandled fetcher revalidation redirect");if(le(o))throw new Error("Unhandled fetcher deferred data");{let t={state:"idle",data:o.data,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0};e.fetchers.set(a,t)}}}return{loaderData:d,errors:c}}function re(e,r,a){let n=t({},r);return a.forEach((t=>{let a=t.route.id;void 0===r[a]&&void 0!==e[a]&&(n[a]=e[a])})),n}function ae(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 ne(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 oe(e,t){let{pathname:r,routeId:a,method:n,message:o}=void 0===t?{}:t,i="Unknown Server Error",s="Unknown @remix-run/router error";return 400===e?(i="Bad Request",s=n&&r&&a?"You made a "+n+' request to "'+r+'" but did not provide a `loader` for route "'+a+'", so there is no way to handle the request.':"Cannot submit binary form data using GET"):403===e?(i="Forbidden",s='Route "'+a+'" does not match URL "'+r+'"'):404===e?(i="Not Found",s='No route matches URL "'+r+'"'):405===e&&(i="Method Not Allowed",n&&r&&a?s="You made a "+n.toUpperCase()+' request to "'+r+'" but did not provide an `action` for route "'+a+'", so there is no way to handle the request.':n&&(s='Invalid request method "'+n.toUpperCase()+'"')),new H(e||500,i,new Error(s),!0)}function ie(e){for(let t=e.length-1;t>=0;t--){let r=e[t];if(ce(r))return r}}function se(e){return s(t({},"string"==typeof e?l(e):e,{hash:""}))}function le(e){return e.type===u.deferred}function de(e){return e.type===u.error}function ce(e){return(e&&e.type)===u.redirect}function ue(e){if(!(e instanceof Response))return!1;let t=e.status,r=e.headers.get("Location");return t>=300&&t<=399&&null!=r}function he(e){return W.has(e)}function fe(e){return I.has(e)}async function pe(e,t,r,a,n,o){for(let i=0;i<r.length;i++){let s=r[i],l=t[i],d=e.find((e=>e.route.id===l.route.id)),c=null!=d&&!G(d,l)&&void 0!==(o&&o[l.route.id]);le(s)&&(n||c)&&await me(s,a,n).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:u.data,data:e.deferredData.unwrappedData}}catch(e){return{type:u.error,error:e}}return{type:u.data,data:e.deferredData.data}}}function ge(e){return new URLSearchParams(e).getAll("index").some((e=>""===e))}function ve(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 ye(e,t){let r="string"==typeof t?l(t).search:t.search;if(e[e.length-1].route.index&&ge(r||""))return e[e.length-1];let a=S(e);return a[a.length-1]}e.AbortedDeferredError=j,e.ErrorResponse=H,e.IDLE_FETCHER=F,e.IDLE_NAVIGATION=B,e.UNSAFE_convertRoutesToDataRoutes=h,e.UNSAFE_getPathContributingMatches=S,e.createBrowserHistory=function(e){return void 0===e&&(e={}),c((function(e,t){let{pathname:r,search:a,hash:n}=e.location;return i("",{pathname:r,search:a,hash:n},t.state&&t.state.usr||null,t.state&&t.state.key||"default")}),(function(e,t){return"string"==typeof t?t:s(t)}),null,e)},e.createHashHistory=function(e){return void 0===e&&(e={}),c((function(e,t){let{pathname:r="/",search:a="",hash:n=""}=l(e.location.hash.substr(1));return i("",{pathname:r,search:a,hash:n},t.state&&t.state.usr||null,t.state&&t.state.key||"default")}),(function(e,t){let r=e.document.querySelector("base"),a="";if(r&&r.getAttribute("href")){let t=e.location.href,r=t.indexOf("#");a=-1===r?t:t.slice(0,r)}return a+"#"+("string"==typeof t?t:s(t))}),(function(e,t){n("/"===e.pathname.charAt(0),"relative pathnames are not supported in hash history.push("+JSON.stringify(t)+")")}),e)},e.createMemoryHistory=function(t){void 0===t&&(t={});let r,{initialEntries:a=["/"],initialIndex:o,v5Compat:d=!1}=t;r=a.map(((e,t)=>m(e,"string"==typeof e?null:e.state,0===t?"default":void 0)));let c=f(null==o?r.length-1:o),u=e.Action.Pop,h=null;function f(e){return Math.min(Math.max(e,0),r.length-1)}function p(){return r[c]}function m(e,t,a){void 0===t&&(t=null);let o=i(r?p().pathname:"/",e,t,a);return n("/"===o.pathname.charAt(0),"relative pathnames are not supported in memory history: "+JSON.stringify(e)),o}return{get index(){return c},get action(){return u},get location(){return p()},createHref:e=>"string"==typeof e?e:s(e),encodeLocation(e){let t="string"==typeof e?l(e):e;return{pathname:t.pathname||"",search:t.search||"",hash:t.hash||""}},push(t,a){u=e.Action.Push;let n=m(t,a);c+=1,r.splice(c,r.length,n),d&&h&&h({action:u,location:n})},replace(t,a){u=e.Action.Replace;let n=m(t,a);r[c]=n,d&&h&&h({action:u,location:n})},go(t){u=e.Action.Pop,c=f(c+t),h&&h({action:u,location:p()})},listen:e=>(h=e,()=>{h=null})}},e.createPath=s,e.createRouter=function(r){E(r.routes.length>0,"You must provide a non-empty routes array to createRouter");let a=h(r.routes),n=null,o=new Set,s=null,l=null,d=null,c=!1,p=f(a,r.history.location,r.basename),m=null;if(null==p){let e=oe(404,{pathname:r.history.location.pathname}),{matches:t,route:n}=ne(a);p=t,m={[n.id]:e}}let g,v,y=!p.some((e=>e.route.loader))||null!=r.hydrationData,w={historyAction:r.history.action,location:r.history.location,matches:p,initialized:y,navigation:B,restoreScrollPosition:null,preventScrollReset:!1,revalidation:"idle",loaderData:r.hydrationData&&r.hydrationData.loaderData||{},actionData:r.hydrationData&&r.hydrationData.actionData||null,errors:r.hydrationData&&r.hydrationData.errors||m,fetchers:new Map},b=e.Action.Pop,D=!1,R=!1,A=!1,P=[],S=[],C=new Map,M=0,x=-1,L=new Map,T=new Set,j=new Map,O=new Map;function U(e){w=t({},w,e),o.forEach((e=>e(w)))}function H(a,n){var o;U(t({},null!=w.actionData&&null!=w.navigation.formMethod&&"loading"===w.navigation.state&&(null==(o=w.navigation.formAction)?void 0:o.split("?")[0])===a.pathname?{}:{actionData:null},n,n.loaderData?{loaderData:re(w.loaderData,n.loaderData,n.matches||[])}:{},{historyAction:b,location:a,initialized:!0,navigation:B,revalidation:"idle",restoreScrollPosition:!w.navigation.formData&&se(a,n.matches||w.matches),preventScrollReset:D})),R||b===e.Action.Pop||(b===e.Action.Push?r.history.push(a,a.state):b===e.Action.Replace&&r.history.replace(a,a.state)),b=e.Action.Pop,D=!1,R=!1,A=!1,P=[],S=[]}async function _(n,o,i){v&&v.abort(),v=null,b=n,R=!0===(i&&i.startUninterruptedRevalidation),function(e,t){if(s&&l&&d){let r=t.map((e=>ve(e,w.loaderData))),a=l(e,r)||e.key;s[a]=d()}}(w.location,w.matches),D=!0===(i&&i.preventScrollReset);let c=i&&i.overrideNavigation,h=f(a,o,r.basename);if(!h){let e=oe(404,{pathname:o.pathname}),{matches:t,route:r}=ne(a);return ee(),void H(o,{matches:t,loaderData:{},errors:{[r.id]:e}})}if(p=w.location,m=o,p.pathname===m.pathname&&p.search===m.search&&p.hash!==m.hash)return void H(o,{matches:h});var p,m;v=new AbortController;let y,L,_=Q(o,v.signal,i&&i.submission);if(i&&i.pendingError)L={[ae(h).route.id]:i.pendingError};else if(i&&i.submission){let r=await async function(r,a,n,o,i){let s;W(),U({navigation:t({state:"submitting",location:a},n)});let l=ye(o,a);if(l.route.action){if(s=await X("action",r,l,o,g.basename),r.signal.aborted)return{shortCircuited:!0}}else s={type:u.error,error:oe(405,{method:r.method,pathname:a.pathname,routeId:l.route.id})};if(ce(s))return await I(w,s,i&&!0===i.replace),{shortCircuited:!0};if(de(s)){let t=ae(o,l.route.id);return!0!==(i&&i.replace)&&(b=e.Action.Push),{pendingActionError:{[t.route.id]:s.error}}}if(le(s))throw new Error("defer() is not supported in actions");return{pendingActionData:{[l.route.id]:s.data}}}(_,o,i.submission,h,{replace:i.replace});if(r.shortCircuited)return;y=r.pendingActionData,L=r.pendingActionError,c=t({state:"loading",location:o},i.submission)}let{shortCircuited:k,loaderData:$,errors:N}=await async function(e,r,a,n,o,i,s,l){let d=n;if(!d){d={state:"loading",location:r,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0}}let[c,u]=J(w,a,o,r,A,P,S,s,l,j);if(ee((e=>!(a&&a.some((t=>t.route.id===e)))||c&&c.some((t=>t.route.id===e)))),0===c.length&&0===u.length)return H(r,{matches:a,loaderData:re(w.loaderData,{},a),errors:l||null,actionData:s||null}),{shortCircuited:!0};R||(u.forEach((e=>{let[t]=e,r=w.fetchers.get(t),a={state:"loading",data:r&&r.data,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0};w.fetchers.set(t,a)})),U(t({navigation:d,actionData:s||w.actionData||null},u.length>0?{fetchers:new Map(w.fetchers)}:{})));x=++M,u.forEach((e=>{let[t]=e;return C.set(t,v)}));let{results:h,loaderResults:f,fetcherResults:p}=await q(w.matches,a,c,u,e);if(e.signal.aborted)return{shortCircuited:!0};u.forEach((e=>{let[t]=e;return C.delete(t)}));let m=ie(h);if(m)return await I(w,m,i),{shortCircuited:!0};let{loaderData:g,errors:y}=te(w,a,c,f,l,u,p,O);O.forEach(((e,t)=>{e.subscribe((r=>{(r||e.done)&&O.delete(t)}))})),function(){let e=[];for(let t of T){let r=w.fetchers.get(t);E(r,"Expected fetcher: "+t),"loading"===r.state&&(T.delete(t),e.push(t))}V(e)}();let b=Z(x);return t({loaderData:g,errors:y},b||u.length>0?{fetchers:new Map(w.fetchers)}:{})}(_,o,h,c,i&&i.submission,i&&i.replace,y,L);k||(v=null,H(o,{matches:h,loaderData:$,errors:N}))}function k(e){return w.fetchers.get(e)||F}async function I(t,r,a){r.revalidate&&(A=!0);let n=i(t.location,r.location);if(E(n,"Expected a location on the redirect navigation"),r.external&&"undefined"!=typeof window&&void 0!==window.location)return void(a?window.location.replace(r.location):window.location.assign(r.location));v=null;let o=!0===a?e.Action.Replace:e.Action.Push,{formMethod:s,formAction:l,formEncType:d,formData:c}=t.navigation;N.has(r.status)&&s&&fe(s)&&d&&c?await _(o,n,{submission:{formMethod:s,formAction:r.location,formEncType:d,formData:c}}):await _(o,n,{overrideNavigation:{state:"loading",location:n,formMethod:s||void 0,formAction:l||void 0,formEncType:d||void 0,formData:c||void 0}})}async function q(e,t,r,a,n){let o=await Promise.all([...r.map((e=>X("loader",n,e,t,g.basename))),...a.map((e=>{let[,t,r,a]=e;return X("loader",Q(t,n.signal),r,a,g.basename)}))]),i=o.slice(0,r.length),s=o.slice(r.length);return await Promise.all([pe(e,r,i,n.signal,!1,w.loaderData),pe(e,a.map((e=>{let[,,t]=e;return t})),s,n.signal,!0)]),{results:o,loaderResults:i,fetcherResults:s}}function W(){A=!0,P.push(...ee()),j.forEach(((e,t)=>{C.has(t)&&(S.push(t),G(t))}))}function $(e,t,r){let a=ae(w.matches,t);Y(e),U({errors:{[a.route.id]:r},fetchers:new Map(w.fetchers)})}function Y(e){C.has(e)&&G(e),j.delete(e),L.delete(e),T.delete(e),w.fetchers.delete(e)}function G(e){let t=C.get(e);E(t,"Expected fetch controller: "+e),t.abort(),C.delete(e)}function V(e){for(let t of e){let e={state:"idle",data:k(t).data,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0};w.fetchers.set(t,e)}}function Z(e){let t=[];for(let[r,a]of L)if(a<e){let e=w.fetchers.get(r);E(e,"Expected fetcher: "+r),"loading"===e.state&&(G(r),L.delete(r),t.push(r))}return V(t),t.length>0}function ee(e){let t=[];return O.forEach(((r,a)=>{e&&!e(a)||(r.cancel(),t.push(a),O.delete(a))})),t}function se(e,t){if(s&&l&&d){let r=t.map((e=>ve(e,w.loaderData))),a=l(e,r)||e.key,n=s[a];if("number"==typeof n)return n}return null}return g={get basename(){return r.basename},get state(){return w},get routes(){return a},initialize:function(){return n=r.history.listen((e=>{let{action:t,location:r}=e;return _(t,r)})),w.initialized||_(e.Action.Pop,w.location),g},subscribe:function(e){return o.add(e),()=>o.delete(e)},enableScrollRestoration:function(e,t,r){if(s=e,d=t,l=r||(e=>e.key),!c&&w.navigation===B){c=!0;let e=se(w.location,w.matches);null!=e&&U({restoreScrollPosition:e})}return()=>{s=null,d=null,l=null}},navigate:async function(a,n){if("number"==typeof a)return void r.history.go(a);let{path:o,submission:s,error:l}=K(a,n),d=i(w.location,o,n&&n.state);d=t({},d,r.history.encodeLocation(d));let c=!0===(n&&n.replace)||null!=s?e.Action.Replace:e.Action.Push,u=n&&"preventScrollReset"in n?!0===n.preventScrollReset:void 0;return await _(c,d,{submission:s,pendingError:l,preventScrollReset:u,replace:n&&n.replace})},fetch:function(e,n,o,i){if(z)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.");C.has(e)&&G(e);let s=f(a,o,r.basename);if(!s)return void $(e,n,oe(404,{pathname:o}));let{path:l,submission:d}=K(o,i,!0),c=ye(s,l);d?async function(e,n,o,i,s,l){if(W(),j.delete(e),!i.route.action){let t=oe(405,{method:l.formMethod,pathname:o,routeId:n});return void $(e,n,t)}let d=w.fetchers.get(e),c=t({state:"submitting"},l,{data:d&&d.data});w.fetchers.set(e,c),U({fetchers:new Map(w.fetchers)});let u=new AbortController,h=Q(o,u.signal,l);C.set(e,u);let p=await X("action",h,i,s,g.basename);if(h.signal.aborted)return void(C.get(e)===u&&C.delete(e));if(ce(p)){C.delete(e),T.add(e);let r=t({state:"loading"},l,{data:void 0});return w.fetchers.set(e,r),U({fetchers:new Map(w.fetchers)}),I(w,p)}if(de(p))return void $(e,n,p.error);le(p)&&E(!1,"defer() is not supported in actions");let m=w.navigation.location||w.location,y=Q(m,u.signal),D="idle"!==w.navigation.state?f(a,w.navigation.location,r.basename):w.matches;E(D,"Didn't find any matches after fetcher action");let R=++M;L.set(e,R);let _=t({state:"loading",data:p.data},l);w.fetchers.set(e,_);let[k,N]=J(w,D,l,m,A,P,S,{[i.route.id]:p.data},void 0,j);N.filter((t=>{let[r]=t;return r!==e})).forEach((e=>{let[t]=e,r=w.fetchers.get(t),a={state:"loading",data:r&&r.data,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0};w.fetchers.set(t,a),C.set(t,u)})),U({fetchers:new Map(w.fetchers)});let{results:B,loaderResults:F,fetcherResults:z}=await q(w.matches,D,k,N,y);if(u.signal.aborted)return;L.delete(e),C.delete(e),N.forEach((e=>{let[t]=e;return C.delete(t)}));let K=ie(B);if(K)return I(w,K);let{loaderData:Y,errors:G}=te(w,w.matches,k,F,void 0,N,z,O),V={state:"idle",data:p.data,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0};w.fetchers.set(e,V);let ee=Z(R);"loading"===w.navigation.state&&R>x?(E(b,"Expected pending action"),v&&v.abort(),H(w.navigation.location,{matches:D,loaderData:Y,errors:G,fetchers:new Map(w.fetchers)})):(U(t({errors:G,loaderData:re(w.loaderData,Y,D)},ee?{fetchers:new Map(w.fetchers)}:{})),A=!1)}(e,n,l,c,s,d):(j.set(e,[l,c,s]),async function(e,t,r,a,n){let o=w.fetchers.get(e),i={state:"loading",formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,data:o&&o.data};w.fetchers.set(e,i),U({fetchers:new Map(w.fetchers)});let s=new AbortController,l=Q(r,s.signal);C.set(e,s);let d=await X("loader",l,a,n,g.basename);le(d)&&(d=await me(d,l.signal,!0)||d);C.get(e)===s&&C.delete(e);if(l.signal.aborted)return;if(ce(d))return void await I(w,d);if(de(d)){let r=ae(w.matches,t);return w.fetchers.delete(e),void U({fetchers:new Map(w.fetchers),errors:{[r.route.id]:d.error}})}E(!le(d),"Unhandled fetcher deferred data");let c={state:"idle",data:d.data,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0};w.fetchers.set(e,c),U({fetchers:new Map(w.fetchers)})}(e,n,l,c,s))},revalidate:function(){W(),U({revalidation:"loading"}),"submitting"!==w.navigation.state&&("idle"!==w.navigation.state?_(b||w.historyAction,w.navigation.location,{overrideNavigation:w.navigation}):_(w.historyAction,w.location,{startUninterruptedRevalidation:!0}))},createHref:e=>r.history.createHref(e),encodeLocation:e=>r.history.encodeLocation(e),getFetcher:k,deleteFetcher:Y,dispose:function(){n&&n(),o.clear(),v&&v.abort(),w.fetchers.forEach(((e,t)=>Y(t)))},_internalFetchControllers:C,_internalActiveDeferreds:O},g},e.defer=function(e){return new O(e)},e.generatePath=function(e,t){return void 0===t&&(t={}),e.replace(/:(\w+)/g,((e,r)=>(E(null!=t[r],'Missing ":'+r+'" param'),t[r]))).replace(/(\/?)\*/,((e,r,a,n)=>null==t["*"]?"/*"===n?"/":"":""+r+t["*"]))},e.getStaticContextFromError=function(e,r,a){return t({},r,{statusCode:500,errors:{[r._deepestRenderedBoundaryId||e[0].id]:a}})},e.getToPathname=function(e){return""===e||""===e.pathname?"/":"string"==typeof e?l(e).pathname:e.pathname},e.invariant=E,e.isRouteErrorResponse=_,e.joinPaths=M,e.json=function(e,r){void 0===r&&(r={});let a="number"==typeof r?{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(e),t({},a,{headers:n}))},e.matchPath=w,e.matchRoutes=f,e.normalizePathname=x,e.parsePath=l,e.redirect=function(e,r){void 0===r&&(r=302);let a=r;"number"==typeof a?a={status:a}:void 0===a.status&&(a.status=302);let n=new Headers(a.headers);return n.set("Location",e),new Response(null,t({},a,{headers:n}))},e.resolvePath=A,e.resolveTo=C,e.stripBasename=D,e.unstable_createStaticHandler=function(e,r){E(e.length>0,"You must provide a non-empty routes array to unstable_createStaticHandler");let a=h(e),n=(r?r.basename:null)||"/";async function o(e,r,a,o){E(e.signal,"query()/queryRoute() requests must contain an AbortController signal");try{if(fe(e.method.toLowerCase())){let i=await async function(e,r,a,o){let i;if(a.route.action){if(i=await X("action",e,a,r,n,!0,o),e.signal.aborted){throw new Error((o?"queryRoute":"query")+"() call aborted")}}else{let t=oe(405,{method:e.method,pathname:d(e.url).pathname,routeId:a.route.id});if(o)throw t;i={type:u.error,error:t}}if(ce(i))throw new Response(null,{status:i.status,headers:{Location:i.location}});if(le(i))throw new Error("defer() is not supported in actions");if(o){if(de(i))throw i.error;return{matches:[a],loaderData:{},actionData:{[a.route.id]:i.data},errors:null,statusCode:200,loaderHeaders:{},actionHeaders:{}}}if(de(i)){let n=ae(r,a.route.id);return t({},await l(e,r,void 0,{[n.route.id]:i.error}),{statusCode:_(i.error)?i.error.status:500,actionData:null,actionHeaders:t({},i.headers?{[a.route.id]:i.headers}:{})})}return t({},await l(e,r),i.statusCode?{statusCode:i.statusCode}:{},{actionData:{[a.route.id]:i.data},actionHeaders:t({},i.headers?{[a.route.id]:i.headers}:{})})}(e,a,o||ye(a,r),null!=o);return i}let i=await l(e,a,o);return i instanceof Response?i:t({},i,{actionData:null,actionHeaders:{}})}catch(e){if((i=e)&&i.response instanceof Response&&(i.type===u.data||u.error)){if(e.type===u.error&&!ue(e.response))throw e.response;return e.response}if(ue(e))return e;throw e}var i}async function l(e,r,a,o){let i=null!=a;if(i&&(null==a||!a.route.loader))throw oe(400,{method:e.method,pathname:d(e.url).pathname,routeId:null==a?void 0:a.route.id});let s=(a?[a]:Y(r,Object.keys(o||{})[0])).filter((e=>e.route.loader));if(0===s.length)return{matches:r,loaderData:{},errors:o||null,statusCode:200,loaderHeaders:{}};let l=await Promise.all([...s.map((t=>X("loader",e,t,r,n,!0,i)))]);if(e.signal.aborted){throw new Error((i?"queryRoute":"query")+"() call aborted")}return l.forEach((e=>{le(e)&&e.deferredData.cancel()})),t({},ee(r,s,l,o),{matches:r})}return{dataRoutes:a,query:async function(e){let r=new URL(e.url),l=e.method.toLowerCase(),d=i("",s(r),null,"default"),c=f(a,d,n);if(!he(l)&&"head"!==l){let e=oe(405,{method:l}),{matches:t,route:r}=ne(a);return{basename:n,location:d,matches:t,loaderData:{},actionData:null,errors:{[r.id]:e},statusCode:e.status,loaderHeaders:{},actionHeaders:{}}}if(!c){let e=oe(404,{pathname:d.pathname}),{matches:t,route:r}=ne(a);return{basename:n,location:d,matches:t,loaderData:{},actionData:null,errors:{[r.id]:e},statusCode:e.status,loaderHeaders:{},actionHeaders:{}}}let u=await o(e,d,c);return u instanceof Response?u:t({location:d,basename:n},u)},queryRoute:async function(e,t){let r=new URL(e.url),l=e.method.toLowerCase(),d=i("",s(r),null,"default"),c=f(a,d,n);if(!he(l)&&"head"!==l)throw oe(405,{method:l});if(!c)throw oe(404,{pathname:d.pathname});let u=t?c.find((e=>e.route.id===t)):ye(c,d);if(t&&!u)throw oe(403,{pathname:d.pathname,routeId:t});if(!u)throw oe(404,{pathname:d.pathname});let h=await o(e,d,c,u);if(h instanceof Response)return h;let p=h.errors?Object.values(h.errors)[0]:void 0;if(void 0!==p)throw p;let m=[h.actionData,h.loaderData].find((e=>e));return Object.values(m||{})[0]}}},e.warning=R,Object.defineProperty(e,"__esModule",{value:!0})}));
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).RemixRouter={})}(this,(function(e){"use strict";function t(){return t=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},t.apply(this,arguments)}var r;e.Action=void 0,(r=e.Action||(e.Action={})).Pop="POP",r.Push="PUSH",r.Replace="REPLACE";const a="popstate";function n(e,t){if(!1===e||null==e)throw new Error(t)}function o(e,t){if(!e){"undefined"!=typeof console&&console.warn(t);try{throw new Error(t)}catch(e){}}}function i(e){return{usr:e.state,key:e.key}}function s(e,r,a,n){return void 0===a&&(a=null),t({pathname:"string"==typeof e?e:e.pathname,search:"",hash:""},"string"==typeof r?d(r):r,{state:a,key:r&&r.key||n||Math.random().toString(36).substr(2,8)})}function l(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 d(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 c(e){let t="undefined"!=typeof window&&void 0!==window.location&&"null"!==window.location.origin?window.location.origin:window.location.href,r="string"==typeof e?e:l(e);return n(t,"No window.location.(origin|href) available to create URL for href: "+r),new URL(r,t)}function u(t,r,n,o){void 0===o&&(o={});let{window:d=document.defaultView,v5Compat:u=!1}=o,h=d.history,f=e.Action.Pop,p=null;function m(){f=e.Action.Pop,p&&p({action:f,location:g.location})}let g={get action(){return f},get location(){return t(d,h)},listen(e){if(p)throw new Error("A history only accepts one active listener");return d.addEventListener(a,m),p=e,()=>{d.removeEventListener(a,m),p=null}},createHref:e=>r(d,e),encodeLocation(e){let t=c("string"==typeof e?e:l(e));return{pathname:t.pathname,search:t.search,hash:t.hash}},push:function(t,r){f=e.Action.Push;let a=s(g.location,t,r);n&&n(a,t);let o=i(a),l=g.createHref(a);try{h.pushState(o,"",l)}catch(e){d.location.assign(l)}u&&p&&p({action:f,location:g.location})},replace:function(t,r){f=e.Action.Replace;let a=s(g.location,t,r);n&&n(a,t);let o=i(a),l=g.createHref(a);h.replaceState(o,"",l),u&&p&&p({action:f,location:g.location})},go:e=>h.go(e)};return g}let h;function f(e,r,a){return void 0===r&&(r=[]),void 0===a&&(a=new Set),e.map(((e,o)=>{let i=[...r,o],s="string"==typeof e.id?e.id:i.join("-");if(n(!0!==e.index||!e.children,"Cannot specify children on an index route"),n(!a.has(s),'Found a route id collision on id "'+s+"\". Route id's must be globally unique within Data Router usages"),a.add(s),function(e){return!0===e.index}(e)){return t({},e,{id:s})}return t({},e,{id:s,children:e.children?f(e.children,i,a):void 0})}))}function p(e,t,r){void 0===r&&(r="/");let a=E(("string"==typeof t?d(t):t).pathname||"/",r);if(null==a)return null;let n=m(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)))))}(n);let o=null;for(let e=0;null==o&&e<n.length;++e)o=w(n[e],D(a));return o}function m(e,t,r,a){return void 0===t&&(t=[]),void 0===r&&(r=[]),void 0===a&&(a=""),e.forEach(((e,o)=>{let i={relativePath:e.path||"",caseSensitive:!0===e.caseSensitive,childrenIndex:o,route:e};i.relativePath.startsWith("/")&&(n(i.relativePath.startsWith(a),'Absolute route path "'+i.relativePath+'" nested under path "'+a+'" is not valid. An absolute child route path must start with the combined path of all its parent routes.'),i.relativePath=i.relativePath.slice(a.length));let s=M([a,i.relativePath]),l=r.concat(i);e.children&&e.children.length>0&&(n(!0!==e.index,'Index routes must not have child routes. Please remove all child routes from route path "'+s+'".'),m(e.children,t,l,s)),(null!=e.path||e.index)&&t.push({path:s,score:y(s,e.index),routesMeta:l})})),t}!function(e){e.data="data",e.deferred="deferred",e.redirect="redirect",e.error="error"}(h||(h={}));const g=/^:\w+$/,v=e=>"*"===e;function y(e,t){let r=e.split("/"),a=r.length;return r.some(v)&&(a+=-2),t&&(a+=2),r.filter((e=>!v(e))).reduce(((e,t)=>e+(g.test(t)?3:""===t?1:10)),a)}function w(e,t){let{routesMeta:r}=e,a={},n="/",o=[];for(let e=0;e<r.length;++e){let i=r[e],s=e===r.length-1,l="/"===n?t:t.slice(n.length)||"/",d=b({path:i.relativePath,caseSensitive:i.caseSensitive,end:s},l);if(!d)return null;Object.assign(a,d.params);let c=i.route;o.push({params:a,pathname:M([n,d.pathname]),pathnameBase:x(M([n,d.pathnameBase])),route:c}),"/"!==d.pathnameBase&&(n=M([n,d.pathnameBase]))}return o}function b(e,t){"string"==typeof e&&(e={path:e,caseSensitive:!1,end:!0});let[r,a]=function(e,t,r){void 0===t&&(t=!1);void 0===r&&(r=!0);R("*"===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,((e,t)=>(a.push(t),"([^\\/]+)")));e.endsWith("*")?(a.push("*"),n+="*"===e||"/*"===e?"(.*)$":"(?:\\/(.+)|\\/*)$"):r?n+="\\/*$":""!==e&&"/"!==e&&(n+="(?:(?=\\/|$))");return[new RegExp(n,t?void 0:"i"),a]}(e.path,e.caseSensitive,e.end),n=t.match(r);if(!n)return null;let o=n[0],i=o.replace(/(.)\/+$/,"$1"),s=n.slice(1);return{params:a.reduce(((e,t,r)=>{if("*"===t){let e=s[r]||"";i=o.slice(0,o.length-e.length).replace(/(.)\/+$/,"$1")}return e[t]=function(e,t){try{return decodeURIComponent(e)}catch(r){return R(!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}}(s[r]||"",t),e}),{}),pathname:o,pathnameBase:i,pattern:e}}function D(e){try{return decodeURI(e)}catch(t){return R(!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(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 R(e,t){if(!e){"undefined"!=typeof console&&console.warn(t);try{throw new Error(t)}catch(e){}}}function A(e,t){void 0===t&&(t="/");let{pathname:r,search:a="",hash:n=""}="string"==typeof e?d(e):e,o=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:o,search:L(a),hash:T(n)}}function P(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 S(e){return e.filter(((e,t)=>0===t||e.route.path&&e.route.path.length>0))}function C(e,r,a,o){let i;void 0===o&&(o=!1),"string"==typeof e?i=d(e):(i=t({},e),n(!i.pathname||!i.pathname.includes("?"),P("?","pathname","search",i)),n(!i.pathname||!i.pathname.includes("#"),P("#","pathname","hash",i)),n(!i.search||!i.search.includes("#"),P("#","search","hash",i)));let s,l=""===e||""===i.pathname,c=l?"/":i.pathname;if(o||null==c)s=a;else{let e=r.length-1;if(c.startsWith("..")){let t=c.split("/");for(;".."===t[0];)t.shift(),e-=1;i.pathname=t.join("/")}s=e>=0?r[e]:"/"}let u=A(i,s),h=c&&"/"!==c&&c.endsWith("/"),f=(l||"."===c)&&a.endsWith("/");return u.pathname.endsWith("/")||!h&&!f||(u.pathname+="/"),u}const M=e=>e.join("/").replace(/\/\/+/g,"/"),x=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),L=e=>e&&"?"!==e?e.startsWith("?")?e:"?"+e:"",T=e=>e&&"#"!==e?e.startsWith("#")?e:"#"+e:"";class j extends Error{}class U{constructor(e){let t;this.pendingKeys=new Set,this.subscriber=void 0,n(e&&"object"==typeof e&&!Array.isArray(e),"defer() only accepts plain objects"),this.abortPromise=new Promise(((e,r)=>t=r)),this.controller=new AbortController;let r=()=>t(new j("Deferred data aborted"));this.unlistenAbortSignal=()=>this.controller.signal.removeEventListener("abort",r),this.controller.signal.addEventListener("abort",r),this.data=Object.entries(e).reduce(((e,t)=>{let[r,a]=t;return Object.assign(e,{[r]:this.trackPromise(r,a)})}),{})}trackPromise(e,t){if(!(t instanceof Promise))return t;this.pendingKeys.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,a){if(this.controller.signal.aborted&&r instanceof j)return this.unlistenAbortSignal(),Object.defineProperty(e,"_error",{get:()=>r}),Promise.reject(r);this.pendingKeys.delete(t),this.done&&this.unlistenAbortSignal();const n=this.subscriber;return r?(Object.defineProperty(e,"_error",{get:()=>r}),n&&n(!1),Promise.reject(r)):(Object.defineProperty(e,"_data",{get:()=>a}),n&&n(!1),a)}subscribe(e){this.subscriber=e}cancel(){this.controller.abort(),this.pendingKeys.forEach(((e,t)=>this.pendingKeys.delete(t)));let e=this.subscriber;e&&e(!0)}async resolveData(e){let t=!1;if(!this.done){let r=()=>this.cancel();e.addEventListener("abort",r),t=await new Promise((t=>{this.subscribe((a=>{e.removeEventListener("abort",r),(a||this.done)&&t(a)}))}))}return t}get done(){return 0===this.pendingKeys.size}get unwrappedData(){return n(null!==this.data&&this.done,"Can only unwrap data on initialized and settled deferreds"),Object.entries(this.data).reduce(((e,t)=>{let[r,a]=t;return Object.assign(e,{[r]:O(a)})}),{})}}function O(e){if(!function(e){return e instanceof Promise&&!0===e._tracked}(e))return e;if(e._error)throw e._error;return e._data}class H{constructor(e,t,r,a){void 0===a&&(a=!1),this.status=e,this.statusText=t||"",this.internal=a,r instanceof Error?(this.data=r.toString(),this.error=r):this.data=r}}function _(e){return e instanceof H}const q=["post","put","patch","delete"],I=new Set(q),k=["get",...q],W=new Set(k),$=new Set([301,302,303,307,308]),N=new Set([307,308]),B={state:"idle",location:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0},F={state:"idle",data:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0},z=!("undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement);function K(e,t,r){void 0===r&&(r=!1);let a="string"==typeof e?e:l(e);if(!t||!function(e){return null!=e&&"formData"in e}(t))return{path:a};if(t.formMethod&&!he(t.formMethod))return{path:a,error:oe(405,{method:t.formMethod})};if(t.formMethod&&fe(t.formMethod))return{path:a,submission:{formMethod:t.formMethod,formAction:se(a),formEncType:t&&t.formEncType||"application/x-www-form-urlencoded",formData:t.formData}};let n=d(a);try{let e=Z(t.formData);r&&n.search&&ge(n.search)&&e.append("index",""),n.search="?"+e}catch(e){return{path:a,error:oe(400)}}return{path:l(n)}}function Y(e,t){let r=e;if(t){let a=e.findIndex((e=>e.route.id===t));a>=0&&(r=e.slice(0,a))}return r}function J(e,t,r,a,n,o,i,s,l,d){let c=l?Object.values(l)[0]:s?Object.values(s)[0]:null,u=Y(t,l?Object.keys(l)[0]:void 0).filter(((t,i)=>null!=t.route.loader&&(function(e,t,r){let a=!t||r.route.id!==t.route.id,n=void 0===e[r.route.id];return a||n}(e.loaderData,e.matches[i],t)||o.some((e=>e===t.route.id))||V(e.location,e.matches[i],r,a,t,n,c)))),h=[];return d&&d.forEach(((e,t)=>{let[a,o,s]=e;if(i.includes(t))h.push([t,a,o,s]);else if(n){V(a,o,r,a,o,n,c)&&h.push([t,a,o,s])}})),[u,h]}function G(e,t){let r=e.route.path;return e.pathname!==t.pathname||r&&r.endsWith("*")&&e.params["*"]!==t.params["*"]}function V(e,r,a,n,o,i,s){let l=c(e),d=r.params,u=c(n),h=o.params,f=G(r,o)||l.toString()===u.toString()||l.search!==u.search||i;if(o.route.shouldRevalidate){let e=o.route.shouldRevalidate(t({currentUrl:l,currentParams:d,nextUrl:u,nextParams:h},a,{actionResult:s,defaultShouldRevalidate:f}));if("boolean"==typeof e)return e}return f}async function X(e,t,r,a,o,i,s){let d,c,u;void 0===o&&(o="/"),void 0===i&&(i=!1),void 0===s&&(s=!1);let f=new Promise(((e,t)=>u=t)),p=()=>u();t.signal.addEventListener("abort",p);try{let a=r.route[e];n(a,"Could not find the "+e+' to run on the "'+r.route.id+'" route'),c=await Promise.race([a({request:t,params:r.params}),f]),n(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){d=h.error,c=e}finally{t.signal.removeEventListener("abort",p)}if(c instanceof Response){let e,u=c.status;if($.has(u)){let e=c.headers.get("Location");n(e,"Redirects returned/thrown from loaders/actions must have a Location header");let s=new URL(t.url),d=s.origin,f=new URL(e,d).origin!==d;if(!f){let t=C(e,S(a.slice(0,a.indexOf(r)+1)).map((e=>e.pathnameBase)),s.pathname);if(n(l(t),"Unable to resolve redirect location: "+e),o){let e=t.pathname;t.pathname="/"===e?o:M([o,e])}e=l(t)}if(i)throw c.headers.set("Location",e),c;return{type:h.redirect,status:u,location:e,revalidate:null!==c.headers.get("X-Remix-Revalidate"),external:f}}if(s)throw{type:d||h.data,response:c};let f=c.headers.get("Content-Type");return e=f&&f.startsWith("application/json")?await c.json():await c.text(),d===h.error?{type:d,error:new H(u,c.statusText,e),headers:c.headers}:{type:h.data,data:e,statusCode:c.status,headers:c.headers}}return d===h.error?{type:d,error:c}:c instanceof U?{type:h.deferred,deferredData:c}:{type:h.data,data:c}}function Q(e,t,r){let a=c(se(e)).toString(),n={signal:t};if(r){let{formMethod:e,formEncType:t,formData:a}=r;n.method=e.toUpperCase(),n.body="application/x-www-form-urlencoded"===t?Z(a):a}return new Request(a,n)}function Z(e){let t=new URLSearchParams;for(let[r,a]of e.entries())n("string"==typeof a,'File inputs are not supported with encType "application/x-www-form-urlencoded", please use "multipart/form-data" instead.'),t.append(r,a);return t}function ee(e,t,r,a,o){let i,s={},l=null,d=!1,c={};return r.forEach(((r,u)=>{let h=t[u].route.id;if(n(!ce(r),"Cannot handle redirect results in processLoaderData"),de(r)){let t=ae(e,h),n=r.error;a&&(n=Object.values(a)[0],a=void 0),l=Object.assign(l||{},{[t.route.id]:n}),d||(d=!0,i=_(r.error)?r.error.status:500),r.headers&&(c[h]=r.headers)}else le(r)?(o&&o.set(h,r.deferredData),s[h]=r.deferredData.data):(s[h]=r.data,null==r.statusCode||200===r.statusCode||d||(i=r.statusCode),r.headers&&(c[h]=r.headers))})),a&&(l=a),{loaderData:s,errors:l,statusCode:i||200,loaderHeaders:c}}function te(e,r,a,o,i,s,l,d){let{loaderData:c,errors:u}=ee(r,a,o,i,d);for(let r=0;r<s.length;r++){let[a,,o]=s[r];n(void 0!==l&&void 0!==l[r],"Did not find corresponding fetcher result");let i=l[r];if(de(i)){let r=ae(e.matches,o.route.id);u&&u[r.route.id]||(u=t({},u,{[r.route.id]:i.error})),e.fetchers.delete(a)}else{if(ce(i))throw new Error("Unhandled fetcher revalidation redirect");if(le(i))throw new Error("Unhandled fetcher deferred data");{let t={state:"idle",data:i.data,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0};e.fetchers.set(a,t)}}}return{loaderData:c,errors:u}}function re(e,r,a){let n=t({},r);return a.forEach((t=>{let a=t.route.id;void 0===r[a]&&void 0!==e[a]&&(n[a]=e[a])})),n}function ae(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 ne(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 oe(e,t){let{pathname:r,routeId:a,method:n,message:o}=void 0===t?{}:t,i="Unknown Server Error",s="Unknown @remix-run/router error";return 400===e?(i="Bad Request",s=n&&r&&a?"You made a "+n+' request to "'+r+'" but did not provide a `loader` for route "'+a+'", so there is no way to handle the request.':"Cannot submit binary form data using GET"):403===e?(i="Forbidden",s='Route "'+a+'" does not match URL "'+r+'"'):404===e?(i="Not Found",s='No route matches URL "'+r+'"'):405===e&&(i="Method Not Allowed",n&&r&&a?s="You made a "+n.toUpperCase()+' request to "'+r+'" but did not provide an `action` for route "'+a+'", so there is no way to handle the request.':n&&(s='Invalid request method "'+n.toUpperCase()+'"')),new H(e||500,i,new Error(s),!0)}function ie(e){for(let t=e.length-1;t>=0;t--){let r=e[t];if(ce(r))return r}}function se(e){return l(t({},"string"==typeof e?d(e):e,{hash:""}))}function le(e){return e.type===h.deferred}function de(e){return e.type===h.error}function ce(e){return(e&&e.type)===h.redirect}function ue(e){if(!(e instanceof Response))return!1;let t=e.status,r=e.headers.get("Location");return t>=300&&t<=399&&null!=r}function he(e){return W.has(e)}function fe(e){return I.has(e)}async function pe(e,t,r,a,n,o){for(let i=0;i<r.length;i++){let s=r[i],l=t[i],d=e.find((e=>e.route.id===l.route.id)),c=null!=d&&!G(d,l)&&void 0!==(o&&o[l.route.id]);le(s)&&(n||c)&&await me(s,a,n).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:h.data,data:e.deferredData.unwrappedData}}catch(e){return{type:h.error,error:e}}return{type:h.data,data:e.deferredData.data}}}function ge(e){return new URLSearchParams(e).getAll("index").some((e=>""===e))}function ve(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 ye(e,t){let r="string"==typeof t?d(t).search:t.search;if(e[e.length-1].route.index&&ge(r||""))return e[e.length-1];let a=S(e);return a[a.length-1]}e.AbortedDeferredError=j,e.ErrorResponse=H,e.IDLE_FETCHER=F,e.IDLE_NAVIGATION=B,e.UNSAFE_convertRoutesToDataRoutes=f,e.UNSAFE_getPathContributingMatches=S,e.createBrowserHistory=function(e){return void 0===e&&(e={}),u((function(e,t){let{pathname:r,search:a,hash:n}=e.location;return s("",{pathname:r,search:a,hash:n},t.state&&t.state.usr||null,t.state&&t.state.key||"default")}),(function(e,t){return"string"==typeof t?t:l(t)}),null,e)},e.createHashHistory=function(e){return void 0===e&&(e={}),u((function(e,t){let{pathname:r="/",search:a="",hash:n=""}=d(e.location.hash.substr(1));return s("",{pathname:r,search:a,hash:n},t.state&&t.state.usr||null,t.state&&t.state.key||"default")}),(function(e,t){let r=e.document.querySelector("base"),a="";if(r&&r.getAttribute("href")){let t=e.location.href,r=t.indexOf("#");a=-1===r?t:t.slice(0,r)}return a+"#"+("string"==typeof t?t:l(t))}),(function(e,t){o("/"===e.pathname.charAt(0),"relative pathnames are not supported in hash history.push("+JSON.stringify(t)+")")}),e)},e.createMemoryHistory=function(t){void 0===t&&(t={});let r,{initialEntries:a=["/"],initialIndex:n,v5Compat:i=!1}=t;r=a.map(((e,t)=>m(e,"string"==typeof e?null:e.state,0===t?"default":void 0)));let c=f(null==n?r.length-1:n),u=e.Action.Pop,h=null;function f(e){return Math.min(Math.max(e,0),r.length-1)}function p(){return r[c]}function m(e,t,a){void 0===t&&(t=null);let n=s(r?p().pathname:"/",e,t,a);return o("/"===n.pathname.charAt(0),"relative pathnames are not supported in memory history: "+JSON.stringify(e)),n}return{get index(){return c},get action(){return u},get location(){return p()},createHref:e=>"string"==typeof e?e:l(e),encodeLocation(e){let t="string"==typeof e?d(e):e;return{pathname:t.pathname||"",search:t.search||"",hash:t.hash||""}},push(t,a){u=e.Action.Push;let n=m(t,a);c+=1,r.splice(c,r.length,n),i&&h&&h({action:u,location:n})},replace(t,a){u=e.Action.Replace;let n=m(t,a);r[c]=n,i&&h&&h({action:u,location:n})},go(t){u=e.Action.Pop,c=f(c+t),h&&h({action:u,location:p()})},listen:e=>(h=e,()=>{h=null})}},e.createPath=l,e.createRouter=function(r){n(r.routes.length>0,"You must provide a non-empty routes array to createRouter");let a=f(r.routes),o=null,i=new Set,l=null,d=null,c=null,u=!1,m=p(a,r.history.location,r.basename),g=null;if(null==m){let e=oe(404,{pathname:r.history.location.pathname}),{matches:t,route:n}=ne(a);m=t,g={[n.id]:e}}let v,y,w=!m.some((e=>e.route.loader))||null!=r.hydrationData,b={historyAction:r.history.action,location:r.history.location,matches:m,initialized:w,navigation:B,restoreScrollPosition:null,preventScrollReset:!1,revalidation:"idle",loaderData:r.hydrationData&&r.hydrationData.loaderData||{},actionData:r.hydrationData&&r.hydrationData.actionData||null,errors:r.hydrationData&&r.hydrationData.errors||g,fetchers:new Map},D=e.Action.Pop,E=!1,R=!1,A=!1,P=[],S=[],C=new Map,M=0,x=-1,L=new Map,T=new Set,j=new Map,U=new Map;function O(e){b=t({},b,e),i.forEach((e=>e(b)))}function H(a,n){var o;O(t({},null!=b.actionData&&null!=b.navigation.formMethod&&"loading"===b.navigation.state&&(null==(o=b.navigation.formAction)?void 0:o.split("?")[0])===a.pathname?{}:{actionData:null},n,n.loaderData?{loaderData:re(b.loaderData,n.loaderData,n.matches||[])}:{},{historyAction:D,location:a,initialized:!0,navigation:B,revalidation:"idle",restoreScrollPosition:!b.navigation.formData&&se(a,n.matches||b.matches),preventScrollReset:E})),R||D===e.Action.Pop||(D===e.Action.Push?r.history.push(a,a.state):D===e.Action.Replace&&r.history.replace(a,a.state)),D=e.Action.Pop,E=!1,R=!1,A=!1,P=[],S=[]}async function _(o,i,s){y&&y.abort(),y=null,D=o,R=!0===(s&&s.startUninterruptedRevalidation),function(e,t){if(l&&d&&c){let r=t.map((e=>ve(e,b.loaderData))),a=d(e,r)||e.key;l[a]=c()}}(b.location,b.matches),E=!0===(s&&s.preventScrollReset);let u=s&&s.overrideNavigation,f=p(a,i,r.basename);if(!f){let e=oe(404,{pathname:i.pathname}),{matches:t,route:r}=ne(a);return ee(),void H(i,{matches:t,loaderData:{},errors:{[r.id]:e}})}if(m=b.location,g=i,m.pathname===g.pathname&&m.search===g.search&&m.hash!==g.hash)return void H(i,{matches:f});var m,g;y=new AbortController;let w,L,_=Q(i,y.signal,s&&s.submission);if(s&&s.pendingError)L={[ae(f).route.id]:s.pendingError};else if(s&&s.submission){let r=await async function(r,a,n,o,i){let s;W(),O({navigation:t({state:"submitting",location:a},n)});let l=ye(o,a);if(l.route.action){if(s=await X("action",r,l,o,v.basename),r.signal.aborted)return{shortCircuited:!0}}else s={type:h.error,error:oe(405,{method:r.method,pathname:a.pathname,routeId:l.route.id})};if(ce(s))return await I(b,s,i&&!0===i.replace),{shortCircuited:!0};if(de(s)){let t=ae(o,l.route.id);return!0!==(i&&i.replace)&&(D=e.Action.Push),{pendingActionError:{[t.route.id]:s.error}}}if(le(s))throw new Error("defer() is not supported in actions");return{pendingActionData:{[l.route.id]:s.data}}}(_,i,s.submission,f,{replace:s.replace});if(r.shortCircuited)return;w=r.pendingActionData,L=r.pendingActionError,u=t({state:"loading",location:i},s.submission),_=new Request(_.url,{signal:_.signal})}let{shortCircuited:q,loaderData:$,errors:N}=await async function(e,r,a,o,i,s,l,d){let c=o;if(!c){c={state:"loading",location:r,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0}}let[u,h]=J(b,a,i,r,A,P,S,l,d,j);if(ee((e=>!(a&&a.some((t=>t.route.id===e)))||u&&u.some((t=>t.route.id===e)))),0===u.length&&0===h.length)return H(r,{matches:a,loaderData:re(b.loaderData,{},a),errors:d||null,actionData:l||null}),{shortCircuited:!0};R||(h.forEach((e=>{let[t]=e,r=b.fetchers.get(t),a={state:"loading",data:r&&r.data,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0};b.fetchers.set(t,a)})),O(t({navigation:c,actionData:l||b.actionData||null},h.length>0?{fetchers:new Map(b.fetchers)}:{})));x=++M,h.forEach((e=>{let[t]=e;return C.set(t,y)}));let{results:f,loaderResults:p,fetcherResults:m}=await k(b.matches,a,u,h,e);if(e.signal.aborted)return{shortCircuited:!0};h.forEach((e=>{let[t]=e;return C.delete(t)}));let g=ie(f);if(g)return await I(b,g,s),{shortCircuited:!0};let{loaderData:v,errors:w}=te(b,a,u,p,d,h,m,U);U.forEach(((e,t)=>{e.subscribe((r=>{(r||e.done)&&U.delete(t)}))})),function(){let e=[];for(let t of T){let r=b.fetchers.get(t);n(r,"Expected fetcher: "+t),"loading"===r.state&&(T.delete(t),e.push(t))}V(e)}();let D=Z(x);return t({loaderData:v,errors:w},D||h.length>0?{fetchers:new Map(b.fetchers)}:{})}(_,i,f,u,s&&s.submission,s&&s.replace,w,L);q||(y=null,H(i,{matches:f,loaderData:$,errors:N}))}function q(e){return b.fetchers.get(e)||F}async function I(t,r,a){r.revalidate&&(A=!0);let o=s(t.location,r.location);if(n(o,"Expected a location on the redirect navigation"),r.external&&"undefined"!=typeof window&&void 0!==window.location)return void(a?window.location.replace(r.location):window.location.assign(r.location));y=null;let i=!0===a?e.Action.Replace:e.Action.Push,{formMethod:l,formAction:d,formEncType:c,formData:u}=t.navigation;N.has(r.status)&&l&&fe(l)&&c&&u?await _(i,o,{submission:{formMethod:l,formAction:r.location,formEncType:c,formData:u}}):await _(i,o,{overrideNavigation:{state:"loading",location:o,formMethod:l||void 0,formAction:d||void 0,formEncType:c||void 0,formData:u||void 0}})}async function k(e,t,r,a,n){let o=await Promise.all([...r.map((e=>X("loader",n,e,t,v.basename))),...a.map((e=>{let[,t,r,a]=e;return X("loader",Q(t,n.signal),r,a,v.basename)}))]),i=o.slice(0,r.length),s=o.slice(r.length);return await Promise.all([pe(e,r,i,n.signal,!1,b.loaderData),pe(e,a.map((e=>{let[,,t]=e;return t})),s,n.signal,!0)]),{results:o,loaderResults:i,fetcherResults:s}}function W(){A=!0,P.push(...ee()),j.forEach(((e,t)=>{C.has(t)&&(S.push(t),G(t))}))}function $(e,t,r){let a=ae(b.matches,t);Y(e),O({errors:{[a.route.id]:r},fetchers:new Map(b.fetchers)})}function Y(e){C.has(e)&&G(e),j.delete(e),L.delete(e),T.delete(e),b.fetchers.delete(e)}function G(e){let t=C.get(e);n(t,"Expected fetch controller: "+e),t.abort(),C.delete(e)}function V(e){for(let t of e){let e={state:"idle",data:q(t).data,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0};b.fetchers.set(t,e)}}function Z(e){let t=[];for(let[r,a]of L)if(a<e){let e=b.fetchers.get(r);n(e,"Expected fetcher: "+r),"loading"===e.state&&(G(r),L.delete(r),t.push(r))}return V(t),t.length>0}function ee(e){let t=[];return U.forEach(((r,a)=>{e&&!e(a)||(r.cancel(),t.push(a),U.delete(a))})),t}function se(e,t){if(l&&d&&c){let r=t.map((e=>ve(e,b.loaderData))),a=d(e,r)||e.key,n=l[a];if("number"==typeof n)return n}return null}return v={get basename(){return r.basename},get state(){return b},get routes(){return a},initialize:function(){return o=r.history.listen((e=>{let{action:t,location:r}=e;return _(t,r)})),b.initialized||_(e.Action.Pop,b.location),v},subscribe:function(e){return i.add(e),()=>i.delete(e)},enableScrollRestoration:function(e,t,r){if(l=e,c=t,d=r||(e=>e.key),!u&&b.navigation===B){u=!0;let e=se(b.location,b.matches);null!=e&&O({restoreScrollPosition:e})}return()=>{l=null,c=null,d=null}},navigate:async function(a,n){if("number"==typeof a)return void r.history.go(a);let{path:o,submission:i,error:l}=K(a,n),d=s(b.location,o,n&&n.state);d=t({},d,r.history.encodeLocation(d));let c=!0===(n&&n.replace)||null!=i?e.Action.Replace:e.Action.Push,u=n&&"preventScrollReset"in n?!0===n.preventScrollReset:void 0;return await _(c,d,{submission:i,pendingError:l,preventScrollReset:u,replace:n&&n.replace})},fetch:function(e,o,i,s){if(z)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.");C.has(e)&&G(e);let l=p(a,i,r.basename);if(!l)return void $(e,o,oe(404,{pathname:i}));let{path:d,submission:c}=K(i,s,!0),u=ye(l,d);c?async function(e,o,i,s,l,d){if(W(),j.delete(e),!s.route.action){let t=oe(405,{method:d.formMethod,pathname:i,routeId:o});return void $(e,o,t)}let c=b.fetchers.get(e),u=t({state:"submitting"},d,{data:c&&c.data});b.fetchers.set(e,u),O({fetchers:new Map(b.fetchers)});let h=new AbortController,f=Q(i,h.signal,d);C.set(e,h);let m=await X("action",f,s,l,v.basename);if(f.signal.aborted)return void(C.get(e)===h&&C.delete(e));if(ce(m)){C.delete(e),T.add(e);let r=t({state:"loading"},d,{data:void 0});return b.fetchers.set(e,r),O({fetchers:new Map(b.fetchers)}),I(b,m)}if(de(m))return void $(e,o,m.error);le(m)&&n(!1,"defer() is not supported in actions");let g=b.navigation.location||b.location,w=Q(g,h.signal),E="idle"!==b.navigation.state?p(a,b.navigation.location,r.basename):b.matches;n(E,"Didn't find any matches after fetcher action");let R=++M;L.set(e,R);let _=t({state:"loading",data:m.data},d);b.fetchers.set(e,_);let[q,N]=J(b,E,d,g,A,P,S,{[s.route.id]:m.data},void 0,j);N.filter((t=>{let[r]=t;return r!==e})).forEach((e=>{let[t]=e,r=b.fetchers.get(t),a={state:"loading",data:r&&r.data,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0};b.fetchers.set(t,a),C.set(t,h)})),O({fetchers:new Map(b.fetchers)});let{results:B,loaderResults:F,fetcherResults:z}=await k(b.matches,E,q,N,w);if(h.signal.aborted)return;L.delete(e),C.delete(e),N.forEach((e=>{let[t]=e;return C.delete(t)}));let K=ie(B);if(K)return I(b,K);let{loaderData:Y,errors:G}=te(b,b.matches,q,F,void 0,N,z,U),V={state:"idle",data:m.data,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0};b.fetchers.set(e,V);let ee=Z(R);"loading"===b.navigation.state&&R>x?(n(D,"Expected pending action"),y&&y.abort(),H(b.navigation.location,{matches:E,loaderData:Y,errors:G,fetchers:new Map(b.fetchers)})):(O(t({errors:G,loaderData:re(b.loaderData,Y,E)},ee?{fetchers:new Map(b.fetchers)}:{})),A=!1)}(e,o,d,u,l,c):(j.set(e,[d,u,l]),async function(e,t,r,a,o){let i=b.fetchers.get(e),s={state:"loading",formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,data:i&&i.data};b.fetchers.set(e,s),O({fetchers:new Map(b.fetchers)});let l=new AbortController,d=Q(r,l.signal);C.set(e,l);let c=await X("loader",d,a,o,v.basename);le(c)&&(c=await me(c,d.signal,!0)||c);C.get(e)===l&&C.delete(e);if(d.signal.aborted)return;if(ce(c))return void await I(b,c);if(de(c)){let r=ae(b.matches,t);return b.fetchers.delete(e),void O({fetchers:new Map(b.fetchers),errors:{[r.route.id]:c.error}})}n(!le(c),"Unhandled fetcher deferred data");let u={state:"idle",data:c.data,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0};b.fetchers.set(e,u),O({fetchers:new Map(b.fetchers)})}(e,o,d,u,l))},revalidate:function(){W(),O({revalidation:"loading"}),"submitting"!==b.navigation.state&&("idle"!==b.navigation.state?_(D||b.historyAction,b.navigation.location,{overrideNavigation:b.navigation}):_(b.historyAction,b.location,{startUninterruptedRevalidation:!0}))},createHref:e=>r.history.createHref(e),encodeLocation:e=>r.history.encodeLocation(e),getFetcher:q,deleteFetcher:Y,dispose:function(){o&&o(),i.clear(),y&&y.abort(),b.fetchers.forEach(((e,t)=>Y(t)))},_internalFetchControllers:C,_internalActiveDeferreds:U},v},e.defer=function(e){return new U(e)},e.generatePath=function(e,t){return void 0===t&&(t={}),e.replace(/:(\w+)/g,((e,r)=>(n(null!=t[r],'Missing ":'+r+'" param'),t[r]))).replace(/(\/?)\*/,((e,r,a,n)=>null==t["*"]?"/*"===n?"/":"":""+r+t["*"]))},e.getStaticContextFromError=function(e,r,a){return t({},r,{statusCode:500,errors:{[r._deepestRenderedBoundaryId||e[0].id]:a}})},e.getToPathname=function(e){return""===e||""===e.pathname?"/":"string"==typeof e?d(e).pathname:e.pathname},e.invariant=n,e.isRouteErrorResponse=_,e.joinPaths=M,e.json=function(e,r){void 0===r&&(r={});let a="number"==typeof r?{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(e),t({},a,{headers:n}))},e.matchPath=b,e.matchRoutes=p,e.normalizePathname=x,e.parsePath=d,e.redirect=function(e,r){void 0===r&&(r=302);let a=r;"number"==typeof a?a={status:a}:void 0===a.status&&(a.status=302);let n=new Headers(a.headers);return n.set("Location",e),new Response(null,t({},a,{headers:n}))},e.resolvePath=A,e.resolveTo=C,e.stripBasename=E,e.unstable_createStaticHandler=function(e,r){n(e.length>0,"You must provide a non-empty routes array to unstable_createStaticHandler");let a=f(e),o=(r?r.basename:null)||"/";async function i(e,r,a,i){n(e.signal,"query()/queryRoute() requests must contain an AbortController signal");try{if(fe(e.method.toLowerCase())){let n=await async function(e,r,a,n){let i;if(a.route.action){if(i=await X("action",e,a,r,o,!0,n),e.signal.aborted){throw new Error((n?"queryRoute":"query")+"() call aborted")}}else{let t=oe(405,{method:e.method,pathname:new URL(e.url).pathname,routeId:a.route.id});if(n)throw t;i={type:h.error,error:t}}if(ce(i))throw new Response(null,{status:i.status,headers:{Location:i.location}});if(le(i))throw new Error("defer() is not supported in actions");if(n){if(de(i))throw i.error;return{matches:[a],loaderData:{},actionData:{[a.route.id]:i.data},errors:null,statusCode:200,loaderHeaders:{},actionHeaders:{}}}if(de(i)){let n=ae(r,a.route.id);return t({},await d(e,r,void 0,{[n.route.id]:i.error}),{statusCode:_(i.error)?i.error.status:500,actionData:null,actionHeaders:t({},i.headers?{[a.route.id]:i.headers}:{})})}let s=new Request(e.url,{signal:e.signal});return t({},await d(s,r),i.statusCode?{statusCode:i.statusCode}:{},{actionData:{[a.route.id]:i.data},actionHeaders:t({},i.headers?{[a.route.id]:i.headers}:{})})}(e,a,i||ye(a,r),null!=i);return n}let n=await d(e,a,i);return n instanceof Response?n:t({},n,{actionData:null,actionHeaders:{}})}catch(e){if((s=e)&&s.response instanceof Response&&(s.type===h.data||h.error)){if(e.type===h.error&&!ue(e.response))throw e.response;return e.response}if(ue(e))return e;throw e}var s}async function d(e,r,a,n){let i=null!=a;if(i&&(null==a||!a.route.loader))throw oe(400,{method:e.method,pathname:new URL(e.url).pathname,routeId:null==a?void 0:a.route.id});let s=(a?[a]:Y(r,Object.keys(n||{})[0])).filter((e=>e.route.loader));if(0===s.length)return{matches:r,loaderData:{},errors:n||null,statusCode:200,loaderHeaders:{}};let l=await Promise.all([...s.map((t=>X("loader",e,t,r,o,!0,i)))]);if(e.signal.aborted){throw new Error((i?"queryRoute":"query")+"() call aborted")}return l.forEach((e=>{le(e)&&e.deferredData.cancel()})),t({},ee(r,s,l,n),{matches:r})}return{dataRoutes:a,query:async function(e){let r=new URL(e.url),n=e.method.toLowerCase(),d=s("",l(r),null,"default"),c=p(a,d,o);if(!he(n)&&"head"!==n){let e=oe(405,{method:n}),{matches:t,route:r}=ne(a);return{basename:o,location:d,matches:t,loaderData:{},actionData:null,errors:{[r.id]:e},statusCode:e.status,loaderHeaders:{},actionHeaders:{}}}if(!c){let e=oe(404,{pathname:d.pathname}),{matches:t,route:r}=ne(a);return{basename:o,location:d,matches:t,loaderData:{},actionData:null,errors:{[r.id]:e},statusCode:e.status,loaderHeaders:{},actionHeaders:{}}}let u=await i(e,d,c);return u instanceof Response?u:t({location:d,basename:o},u)},queryRoute:async function(e,t){let r=new URL(e.url),n=e.method.toLowerCase(),d=s("",l(r),null,"default"),c=p(a,d,o);if(!he(n)&&"head"!==n)throw oe(405,{method:n});if(!c)throw oe(404,{pathname:d.pathname});let u=t?c.find((e=>e.route.id===t)):ye(c,d);if(t&&!u)throw oe(403,{pathname:d.pathname,routeId:t});if(!u)throw oe(404,{pathname:d.pathname});let h=await i(e,d,c,u);if(h instanceof Response)return h;let f=h.errors?Object.values(h.errors)[0]:void 0;if(void 0!==f)throw f;let m=[h.actionData,h.loaderData].find((e=>e));return Object.values(m||{})[0]}}},e.warning=R,Object.defineProperty(e,"__esModule",{value:!0})}));
//# sourceMappingURL=router.umd.min.js.map

@@ -208,3 +208,3 @@ import type { Location, Path, To } from "./history";

*
* @see https://reactrouter.com/docs/en/v6/utils/match-routes
* @see https://reactrouter.com/utils/match-routes
*/

@@ -215,3 +215,3 @@ export declare function matchRoutes<RouteObjectType extends AgnosticRouteObject = AgnosticRouteObject>(routes: RouteObjectType[], locationArg: Partial<Location> | string, basename?: string): AgnosticRouteMatch<string, RouteObjectType>[] | null;

*
* @see https://reactrouter.com/docs/en/v6/utils/generate-path
* @see https://reactrouter.com/utils/generate-path
*/

@@ -266,3 +266,3 @@ export declare function generatePath<Path extends string>(path: Path, params?: {

*
* @see https://reactrouter.com/docs/en/v6/utils/match-path
* @see https://reactrouter.com/utils/match-path
*/

@@ -277,7 +277,2 @@ export declare function matchPath<ParamKey extends ParamParseKey<Path>, Path extends string>(pattern: PathPattern<Path> | Path, pathname: string): PathMatch<ParamKey> | null;

*/
export declare function invariant(value: boolean, message?: string): asserts value;
export declare function invariant<T>(value: T | null | undefined, message?: string): asserts value is T;
/**
* @private
*/
export declare function warning(cond: any, message: string): void;

@@ -287,3 +282,3 @@ /**

*
* @see https://reactrouter.com/docs/en/v6/utils/resolve-path
* @see https://reactrouter.com/utils/resolve-path
*/

@@ -290,0 +285,0 @@ export declare function resolvePath(to: To, fromPathname?: string): Path;

@@ -450,2 +450,16 @@ ////////////////////////////////////////////////////////////////////////////////

/**
* @private
*/
export function invariant(value: boolean, message?: string): asserts value;
export function invariant<T>(
value: T | null | undefined,
message?: string
): asserts value is T;
export function invariant(value: any, message?: string) {
if (value === false || value === null || typeof value === "undefined") {
throw new Error(message);
}
}
function warning(cond: any, message: string) {

@@ -548,3 +562,3 @@ if (!cond) {

export function createURL(location: Location | string): URL {
export function createClientSideURL(location: Location | string): URL {
// window.location.origin is "null" (the literal string value) in Firefox

@@ -558,4 +572,8 @@ // under certain conditions, notably when serving from a local HTML file

? window.location.origin
: "unknown://unknown";
: window.location.href;
let href = typeof location === "string" ? location : createPath(location);
invariant(
base,
`No window.location.(origin|href) available to create URL for href: ${href}`
);
return new URL(href, base);

@@ -649,3 +667,5 @@ }

// Encode a Location the same way window.location would
let url = createURL(typeof to === "string" ? to : createPath(to));
let url = createClientSideURL(
typeof to === "string" ? to : createPath(to)
);
return {

@@ -652,0 +672,0 @@ pathname: url.pathname,

@@ -35,3 +35,2 @@ import { convertRoutesToDataRoutes, getPathContributingMatches } from "./utils";

getToPathname,
invariant,
isRouteErrorResponse,

@@ -63,3 +62,2 @@ joinPaths,

} from "./history";
export {

@@ -71,2 +69,3 @@ Action,

createMemoryHistory,
invariant,
parsePath,

@@ -73,0 +72,0 @@ } from "./history";

{
"name": "@remix-run/router",
"version": "1.0.4",
"version": "1.0.5-pre.0",
"description": "Nested/Data-driven/Framework-agnostic Routing",

@@ -5,0 +5,0 @@ "keywords": [

import type { Location, Path, To } from "./history";
import { parsePath } from "./history";
import { invariant, parsePath } from "./history";

@@ -312,3 +312,3 @@ /**

*
* @see https://reactrouter.com/docs/en/v6/utils/match-routes
* @see https://reactrouter.com/utils/match-routes
*/

@@ -535,3 +535,3 @@ export function matchRoutes<

*
* @see https://reactrouter.com/docs/en/v6/utils/generate-path
* @see https://reactrouter.com/utils/generate-path
*/

@@ -614,3 +614,3 @@ export function generatePath<Path extends string>(

*
* @see https://reactrouter.com/docs/en/v6/utils/match-path
* @see https://reactrouter.com/utils/match-path
*/

@@ -780,16 +780,2 @@ export function matchPath<

*/
export function invariant(value: boolean, message?: string): asserts value;
export function invariant<T>(
value: T | null | undefined,
message?: string
): asserts value is T;
export function invariant(value: any, message?: string) {
if (value === false || value === null || typeof value === "undefined") {
throw new Error(message);
}
}
/**
* @private
*/
export function warning(cond: any, message: string): void {

@@ -815,3 +801,3 @@ if (!cond) {

*
* @see https://reactrouter.com/docs/en/v6/utils/resolve-path
* @see https://reactrouter.com/utils/resolve-path
*/

@@ -818,0 +804,0 @@ export function resolvePath(to: To, fromPathname = "/"): Path {

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc