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