import{parseTsxFrontMatter as i}from"../helpers/parse-tsx-frontmatter.js";import{ensureFrontmatterThemeCompatibility as f}from"../../ensure-frontmatter-theme-compatibility.js";const d=async(n,{fs:o})=>{const e=await o.read(n),t=await i(e);if(!t)return;const r=p(t);return await f(r,n,o)};function p(n){const o=JSON.parse(JSON.stringify(n));function e(t){switch(typeof t){case"string":{const r=t.match(/^frontmatterTranslate\(['"]([^'"]+)['"],\s*['"]([^'"]*)['"]\)$/);if(r){const[,s,a]=r,c=a.replace(/\\'/g,"'");return{__translationKey:s,__defaultValue:c}}return t}case"object":{if(!t)return t;if(Array.isArray(t))return t.map(e);const r={};for(const[s,a]of Object.entries(t))r[s]=e(a);return r}default:return t}}return e(o)}export{p as processFrontmatterTranslations,d as reactFrontmatterLoader};
