import{__exports as e}from"../../../../../../../_virtual/resolve-rewrites.js_commonjs-exports";import"./path-match.js";import"./prepare-destination.js";import"../../../../client/normalize-trailing-slash.js";import"../../i18n/normalize-locale-path.js";import"./parse-relative-url.js";import"../router.js";import{__exports as t}from"../../../../../../../_virtual/path-match.js_commonjs-exports";import{__exports as r}from"../../../../../../../_virtual/prepare-destination.js_commonjs-exports";import{__exports as o}from"../../../../../../../_virtual/normalize-trailing-slash.js_commonjs-exports";import{__exports as a}from"../../../../../../../_virtual/normalize-locale-path.js_commonjs-exports";import{__exports as s}from"../../../../../../../_virtual/parse-relative-url.js_commonjs-exports";import{__exports as i}from"../../../../../../../_virtual/router2.js_commonjs-exports";e.__esModule=!0,e.default=function(e,t,r,o,a,s){let i,n=!1,l=(0,u.parseRelativeUrl)(e),_=(0,m.removePathTrailingSlash)((0,c.normalizeLocalePath)((0,f.delBasePath)(l.pathname),s).pathname);const d=r=>{let u=h(r.source)(l.pathname);if(r.has&&u){const e=(0,p.matchHas)({headers:{host:document.location.hostname},cookies:document.cookie.split("; ").reduce(((e,t)=>{const[r,...o]=t.split("=");return e[r]=o.join("="),e}),{})},r.has,l.query);e?Object.assign(u,e):u=!1}if(u){if(!r.destination)return!0;const h=(0,p.default)(r.destination,u,o,!0);if(l=h.parsedDestination,e=h.newUrl,Object.assign(o,h.parsedDestination.query),_=(0,m.removePathTrailingSlash)((0,c.normalizeLocalePath)((0,f.delBasePath)(e),s).pathname),t.includes(_))return n=!0,i=_,!0;if(i=a(_),i!==e&&t.includes(i))return n=!0,!0}};let j=!1;for(let e=0;e<r.beforeFiles.length;e++)d(r.beforeFiles[e]);if(n=t.includes(_),!n){if(!j)for(let e=0;e<r.afterFiles.length;e++)if(d(r.afterFiles[e])){j=!0;break}if(j||(i=a(_),n=t.includes(i),j=n),!j)for(let e=0;e<r.fallback.length;e++)if(d(r.fallback[e])){j=!0;break}}return{asPath:e,parsedAs:l,matchedPage:n,resolvedHref:i}};var n,l=(n=t)&&n.__esModule?n:{default:n},p=function(e){if(e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var t=_();if(t&&t.has(e))return t.get(e);var r={},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var a in e)if(Object.prototype.hasOwnProperty.call(e,a)){var s=o?Object.getOwnPropertyDescriptor(e,a):null;s&&(s.get||s.set)?Object.defineProperty(r,a,s):r[a]=e[a]}r.default=e,t&&t.set(e,r);return r}(r),m=o,c=a,u=s,f=i;function _(){if("function"!=typeof WeakMap)return null;var e=new WeakMap;return _=function(){return e},e}const h=(0,l.default)(!0);
//# sourceMappingURL=resolve-rewrites.js.map
