class HtmlBodySerializer { constructor() {} /** * Checks if an element is visible in the live DOM. * @param {HTMLElement} element - The element to check. * @returns {boolean} True if the element is visible, false otherwise. */ isVisible(element) { const style = window.getComputedStyle(element); return ( style.display !== 'none' && style.visibility !== 'hidden' && style.opacity !== '0' ); } /** * Recursively serializes an element and its children while excluding unwanted elements. * @param {HTMLElement} element - The element to serialize. * @returns {string} The serialized HTML of the element. */ serializeElement(element) { if ( element.tagName === 'SCRIPT' || element.tagName === 'STYLE' || element.tagName === 'IFRAME' || element.tagName === 'SVG' || element.tagName === 'PATH' || element.id === 'footer' || element.id === 'iframe-sw-chat' ) { return ''; // Exclude