import styles from './progress-workspace.module.css'; const surface = styles.surface; if (!surface) throw new Error('Fotogenic AI: Progress workspace styles are unavailable.'); const selector = '.fotogenic-ai-progress-workspace'; const decorate = (root: ParentNode): void => { if (root instanceof HTMLElement && root.matches(selector)) root.classList.add(surface); root.querySelectorAll(selector).forEach((workspace) => workspace.classList.add(surface)); }; const initialize = (): void => { decorate(document); const observer = new MutationObserver((records) => { records.forEach((record) => { record.addedNodes.forEach((node) => { if (node instanceof HTMLElement) decorate(node); }); }); }); observer.observe(document.documentElement, { childList: true, subtree: true }); }; if (document.readyState === 'loading') { document.addEventListener('DOMContentLoaded', initialize, { once: true }); } else { initialize(); } export { initialize as initializeProgressWorkspace };