// #region Imports
import { html } from '../../../../Dom/Html';
// #endregion
/**
 * The template of the `TextFormatElement`.
 *
 * @public
 */
export function textFormatElementTemplate(e) {
    // Process the text to identify placeholders
    const format = /(\{\d+\})/;
    const parts = e.text.split(format);
    const formattedParts = parts.map((part) => {
        if (format.test(part)) {
            // Replace the placeholder with the corresponding template
            const templateIndex = parseInt(part.replace(/[{}]/g, ''), 10);
            const template = e.getTemplateByIndex(templateIndex);
            return template ? html `${template}` : html.nothing;
        }
        return html `${part}`;
    });
    return html `
        ${formattedParts}
        <slot hidden></slot> <!-- Templates are projected here -->
    `;
}
//# sourceMappingURL=TextFormatElementTemplate.js.map