import 'reflect-metadata';
import { LoggerInterface } from '@worktif/utils';
import type { SeoMetaData } from '../../entities/seo-engine/seo-engine.dynamo.types';
import type { RuntimeWebResponse } from '../../types/ssr.types';
/**
 * HtmlTemplateService is responsible for rendering complete HTML documents
 * from structured RuntimeWebResponse objects. It uses the embedded HTML template
 * from the user's public/index.html file, which is loaded at build time.
 *
 * This service implements Layer 2 of the serverless rendering pipeline architecture, taking the
 * React-rendered application content (Layer 1) and injecting it into the
 * developer's custom HTML template with proper SEO metadata.
 *
 * Key responsibilities:
 * - Use embedded HTML template from public/index.html
 * - Replace %PUBLIC_URL% placeholders with CloudFront URLs
 * - Generate dynamic SEO meta tags from SeoMetaData
 * - Inject React application content into the template
 * - Inject main JavaScript bundle script tag
 * - Escape HTML to prevent XSS vulnerabilities
 * - Maintain backward compatibility with existing serverless rendering pipeline
 */
export declare class HtmlTemplateService implements LoggerInterface {
    /**
     * Logger instance for the HTML template service.
     */
    loggerInstance: import("@aws-lambda-powertools/logger").Logger;
    /**
     * Constructor for HtmlTemplateService.
     * Initializes the template configuration with HTML template.
     */
    constructor();
    /**
     * Renders a complete HTML document from a RuntimeWebResponse.
     *
     * This method uses the embedded HTML template from public/index.html and:
     * 1. Replaces {{STATIC_URL}} placeholders with CloudFront URLs
     * 2. Intelligently merges SEO meta tags from database into existing template tags
     * 3. Injects the React-rendered application content
     * 4. Injects the main JavaScript bundle script tag
     *
     * Error handling:
     * - Missing CloudFront URL: Throws error with clear message
     * - HTML processing errors: Logs error and returns unprocessed template as fallback
     * - SEO metadata errors: Logs warning and continues with template defaults
     *
     * @param {RuntimeWebResponse} response - The structured serverless rendering response containing status, HTML, and SEO data.
     * @param {string} staticAssetsBaseUrl - The CloudFront base URL for static assets (e.g., "https://d123.cloudfront.net").
     * @param template
     * @param customMainJsUrl
     * @return {string} Complete HTML5 document as a string.
     * @throws {Error} If staticAssetsBaseUrl is not provided or empty.
     */
    renderHtmlDocument(response: RuntimeWebResponse, staticAssetsBaseUrl: string, template: string, customMainJsUrl?: string): string;
    /**
     * Injects the main JavaScript bundle script tag into the HTML.
     *
     * This method injects a <script> tag with the CloudFront URL for the main JavaScript bundle.
     * The script tag is injected immediately before the </body> closing tag if present.
     * If no </body> tag exists, the script tag is appended to the end of the HTML.
     *
     * Script attributes:
     * - src: CloudFront URL for the main JavaScript bundle
     * - type: "module" (for ES modules)
     * - defer: true (script execution deferred until HTML parsing complete)
     *
     * @param {string} html - The HTML template.
     * @param {string} scriptUrl - The CloudFront URL for the main JavaScript bundle.
     * @return {string} The HTML with the injected script tag.
     * @private
     */
    private injectScriptTag;
    /**
     * Renders static head content with CloudFront URLs for all assets.
     *
     * Generates HTML strings for:
     * - charset, viewport, theme-color meta tags
     * - favicon (via CloudFront)
     * - apple-touch-icon (via CloudFront)
     * - manifest.json (via CloudFront)
     *
     * @param {string} staticAssetsBaseUrl - The CloudFront base URL for static assets.
     * @return {string} HTML string containing all static head tags with CloudFront URLs.
     */
    renderStaticHead(staticAssetsBaseUrl: string): string;
    /**
     * Renders dynamic head tags from SEO metadata.
     *
     * Generates HTML strings for:
     * - <title> tag
     * - <meta name="description"> tag
     * - <meta name="keywords"> tag
     * - <link rel="canonical"> tag
     * - <meta name="robots"> tag
     * - Open Graph tags (og:title, og:description, og:image)
     * - Twitter Card tags (twitter:card, twitter:title, twitter:description, twitter:image)
     *
     * All values are escaped to prevent XSS vulnerabilities. Optional fields that are
     * empty or undefined are omitted entirely rather than rendering empty tags.
     *
     * @param {SeoMetaData} seo - The SEO metadata to convert into HTML meta tags.
     * @return {string} HTML string containing all SEO meta tags, properly escaped and formatted.
     */
    renderHeadTags(seo: SeoMetaData): string;
    /**
     * Replaces all {{STATIC_URL}} and %PUBLIC_URL% placeholders with the CloudFront URL.
     *
     * This method handles placeholders in both attribute values and text content.
     * Supports both placeholder formats for backward compatibility:
     * - {{STATIC_URL}} - New format recommended in documentation
     * - %PUBLIC_URL% - Legacy format from Create React App convention
     *
     * If no placeholders exist in the HTML, the HTML is returned unchanged.
     *
     * @param {string} html - The HTML template containing placeholders.
     * @param {string} staticUrl - The CloudFront base URL to replace placeholders with.
     * @return {string} The HTML with all placeholders replaced.
     * @private
     */
    private replaceStaticUrl;
    /**
     * Merges SEO meta tags from DynamoDB into the HTML template.
     *
     * This method implements intelligent tag merging:
     * - Matches by name attribute: Replaces content value only
     * - Matches by property attribute: Replaces content value only (Open Graph)
     * - No match: Appends new tag to </head>
     * - Preserves all other attributes (id, class, data-*)
     * - Preserves unmatched meta tags in template
     *
     * @param {string} html - The HTML template.
     * @param {SeoMetaData} seo - The SEO metadata from DynamoDB.
     * @return {string} The HTML with merged SEO tags.
     * @private
     */
    private mergeSeoTags;
    /**
     * Escapes special regex characters in a string.
     *
     * @param {string} str - The string to escape.
     * @return {string} The escaped string safe for use in regex.
     * @private
     */
    private escapeRegex;
    /**
     * Escapes HTML special characters to prevent XSS attacks.
     *
     * Converts the following characters to their HTML entity equivalents:
     * - & → &amp;
     * - < → &lt;
     * - > → &gt;
     * - " → &quot;
     * - ' → &#039;
     *
     * This ensures that user-provided SEO metadata cannot inject malicious scripts
     * or break the HTML structure.
     *
     * @param {string} text - The text to escape.
     * @return {string} The escaped text safe for inclusion in HTML.
     * @private
     */
    private escapeHtml;
}
