Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./_virtual/_rolldown/runtime.cjs`);let t=require(`node:path`),n=require(`@intlayer/core/localization`),r=require(`@intlayer/core/transpiler`),i=require(`@intlayer/types/locales`);i=e.__toESM(i);const a=i.ENGLISH,o=`https://github.com/aymericzip/intlayer/blob/main/docs`,s=`https://intlayer.org/`,c=e=>Object.keys(e),l=async(e,t=a)=>{let n=await Promise.all(Object.entries(e).map(([e,n])=>[e,n[t]]).map(async([e,t])=>[e,await t]));return Object.fromEntries(n)},u=async(e,t,n=a)=>{if(!e[t])throw Error(`File ${t} not found`);let r=await e[t]?.[n];if(!r){let n=await e[t][a];if(!n)throw Error(`File ${t} not found`);return n}return r},d=(e,i,c=a)=>{let l=(0,r.getMarkdownMetadata)(i),u=(l.slugs??[]).map(String),d=(l.keywords??[]).map(String),f=(0,t.join)(`/`,...u),p=e.slice(1);return{...l,docKey:e,slugs:u,keywords:d,githubUrl:`${o}${p}`.replace(`/en/`,`/${c}/`),relativeUrl:(0,n.getLocalizedUrl)(f,c),url:(0,n.getLocalizedUrl)((0,t.join)(s,f),c)}},f=async(e,t,n=a)=>d(t,await u(e,t,n),n),p=async(e,t=a)=>{let n=await Promise.all(Object.entries(e).map(async([n])=>[n,await f(e,n,t)]));return Object.fromEntries(n)},m=async(e,t,n=a,r=!1)=>{let i=Array.isArray(t)?t:[t],o=await p(e,a),s=Object.values(o).filter(e=>i.every(t=>e.slugs?.includes(t)));return r&&(s=s.filter(e=>e.slugs.length===i.length)),n===a?s:await Promise.all(s.map(async t=>await f(e,t.docKey,n)))},h=async(e,t,n=a,r=!1)=>{let i=Array.isArray(t)?t:[t],o=await p(e,a),s=Object.values(o).filter(e=>i.every(t=>e.slugs?.includes(t)));return r&&(s=s.filter(e=>e.slugs.length===i.length)),await Promise.all(s.map(async t=>await u(e,t.docKey,n)))};exports.GITHUB_URL_PREFIX=o,exports.URL_PREFIX=s,exports.defaultLocale=a,exports.formatMetadata=d,exports.getFile=u,exports.getFileBySlug=h,exports.getFileMetadata=f,exports.getFileMetadataBySlug=m,exports.getFileMetadataRecord=p,exports.getFiles=l,exports.getKeys=c;
//# sourceMappingURL=common.cjs.map