//#region src/routing.ts
function parseLocalePath(pathname, locales) {
	const parts = pathname.replace(/^\/+/, "").split("/");
	if (parts[0] && locales.includes(parts[0])) return {
		locale: parts[0],
		rest: "/" + parts.slice(1).join("/")
	};
	return {
		locale: null,
		rest: pathname
	};
}
function buildLocalePath(locale, rest, defaultLocale) {
	const clean = "/" + rest.replace(/^\/+/, "");
	if (locale === defaultLocale) return clean;
	return "/" + locale + (clean === "/" ? "" : clean);
}
//#endregion
export { buildLocalePath, parseLocalePath };
