/**
 * @since 6.0.0
 */ export function getHrefFromParents(parents) {
    return parents.reduce((result, parent)=>{
        if ("href" in parent && parent.href) {
            const { href } = parent;
            return result + href;
        }
        return result;
    }, "");
}
/**
 * @since 6.0.0
 */ export function getNavigationGroupId(group, parents) {
    if ("id" in group && typeof group.id === "string" && group.id) {
        return group.id;
    }
    return getHrefFromParents(parents);
}
/**
 * @since 6.0.0
 */ export function getPartsFromPathname(pathname) {
    // remove trailing slashes just in case there aren't rewrites in place
    const href = pathname.replace(/\/{2,}/g, "/").replace(/\/+$/, "");
    const parts = href.split("/");
    const set = new Set();
    let prefix = "";
    for (const part of parts){
        const slashed = `/${part}`;
        prefix = prefix === "/" ? slashed : prefix + slashed;
        set.add(prefix);
    }
    return set;
}

//# sourceMappingURL=utils.js.map