Rocky_Mountain_Vending/.pnpm-store/v10/files/54/a926867db610d48319b7c69155cc9f727271f06c6d7d6af9e1bab0e67bcb58c74a0b66178353798ed15efd474bda7953e5fbef81c88e3bd925ec8bd9387272
DMleadgen 46d973904b
Initial commit: Rocky Mountain Vending website
Next.js website for Rocky Mountain Vending company featuring:
- Product catalog with Stripe integration
- Service areas and parts pages
- Admin dashboard with Clerk authentication
- SEO optimized pages with JSON-LD structured data

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-12 16:22:15 -07:00

26 lines
No EOL
1.2 KiB
Text

import { getLocationOrigin } from '../../utils';
import { searchParamsToUrlQuery } from './querystring';
export function parseRelativeUrl(url, base, parseQuery = true) {
const globalBase = new URL(typeof window === 'undefined' ? 'http://n' : getLocationOrigin());
const resolvedBase = base ? new URL(base, globalBase) : url.startsWith('.') ? new URL(typeof window === 'undefined' ? 'http://n' : window.location.href) : globalBase;
const { pathname, searchParams, search, hash, href, origin } = new URL(url, resolvedBase);
if (origin !== globalBase.origin) {
throw Object.defineProperty(new Error(`invariant: invalid relative URL, router received ${url}`), "__NEXT_ERROR_CODE", {
value: "E159",
enumerable: false,
configurable: true
});
}
return {
pathname,
query: parseQuery ? searchParamsToUrlQuery(searchParams) : undefined,
search,
hash,
href: href.slice(origin.length),
// We don't know for relative URLs at this point since we set a custom, internal
// base that isn't surfaced to users.
slashes: undefined
};
}
//# sourceMappingURL=parse-relative-url.js.map