"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.normalizeRouteRegex = exports.pageToRoute = void 0;
const route_regex_1 = require("./route-regex");
function pageToRoute(page) {
    const routeRegex = route_regex_1.getRouteRegex(page);
    return {
        page,
        regex: normalizeRouteRegex(routeRegex.re.source),
        routeKeys: routeRegex.routeKeys,
        namedRegex: routeRegex.namedRegex,
    };
}
exports.pageToRoute = pageToRoute;
function normalizeRouteRegex(regex) {
    // clean up un-necessary escaping from regex.source which turns / into \\/
    return regex.replace(/\\\//g, '/');
}
exports.normalizeRouteRegex = normalizeRouteRegex;
