import a from"path";import{DEFAULT_LOCALE_PLACEHOLDER as s}from"../../constants/index.js";import{normalizeRouteSlug as m}from"../../shared/utils.js";import{getLocaleFromRelativePath as f}from"../fs/utils/get-locale-from-relative-path.js";import{isL10nPath as p}from"../fs/utils/is-l10n-path.js";import{removeL10nPrefix as u}from"../fs/utils/remove-l10n-prefix.js";import{logger as l}from"../utils/index.js";import{resolveSidebarId as c}from"./sidebars/index.js";function E(e,o){return(Array.isArray(e)?e:e?[e]:[]).map(r=>d(r,o))}function d(e,o){const t=f(o).toLowerCase(),r=m(e);return t!==s?`/${t}${r}`:r}function b(e){const o=e.endsWith(".page.tsx")?".page.tsx":a.posix.extname(e),t=a.posix.basename(e,o);return{baseName:t,isIndexFile:t==="index"}}async function w(e,o,t,r){if(t?.slug||!p(e))return t?.slug;const n=u(e);if(!await r.fs.exists(n))return;const{data:i}=await r.cache.load(n,o);return i?.frontmatter?.slug}async function I(e,o,t){const r=typeof e=="string",n=r?e:e.path;return r&&l.warn("The 'sidebar' property in the front matter of %rp is deprecated. Use 'sidebar.path' instead.",o),n?c(o,n,t):null}export{w as findFrontmatterSlugs,I as getSidebarSharedDataId,b as parseBaseName,E as resolveFrontmatterSlugs};
