// Planu — HTML wrapper for project proposal documents
import { getProposalThemeCSS } from './proposal-themes.js';
import { getCdnUrl } from '../../../config/version-defaults.js';
/**
 * Wrap body content in a full self-contained HTML document for the proposal.
 * Includes inline CSS (theme), print styles, and responsive layout.
 */
export function wrapProposalHtml(title, bodyContent, theme = 'light', lang = 'en', includeMermaid) {
    const escapedTitle = title
        .replace(/&/g, '&amp;')
        .replace(/</g, '&lt;')
        .replace(/>/g, '&gt;')
        .replace(/"/g, '&quot;');
    const css = getProposalThemeCSS(theme);
    const mermaidScripts = includeMermaid
        ? `\n  <script src="${getCdnUrl('mermaid')}/mermaid.min.js"></script>\n  <script>mermaid.initialize({startOnLoad:true, theme:'default'});</script>`
        : '';
    return `<!DOCTYPE html>
<html lang="${escapeAttr(lang)}">
<head>
  <meta charset="UTF-8"/>
  <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
  <meta name="generator" content="Planu — Spec Driven Development"/>
  <title>${escapedTitle}</title>
  <style>${css}</style>${mermaidScripts}
</head>
<body>
${bodyContent}
</body>
</html>`;
}
function escapeAttr(str) {
    return str.replace(/"/g, '&quot;').replace(/</g, '&lt;').replace(/>/g, '&gt;');
}
//# sourceMappingURL=proposal-html-wrapper.js.map