!function(){function e(e){if(!e||e.nodeType!==Node.ELEMENT_NODE||"script"!==e.tagName.toLowerCase())return!1;return"application/ld+json"===e.getAttribute("type")}function r(e){for(let t=e.childNodes.length-1;t>=0;t--){const o=e.childNodes[t];o.nodeType===Node.COMMENT_NODE?e.removeChild(o):o.nodeType===Node.ELEMENT_NODE&&r(o)}}function t(e){if(e.nodeType===Node.ELEMENT_NODE){if("a"===e.tagName.toLowerCase())Array.from(e.attributes).forEach((r=>{"href"!==r.name&&e.removeAttribute(r.name)}));else for(;e.attributes.length>0;)e.removeAttribute(e.attributes[0].name);Array.from(e.childNodes).forEach(t)}}function o(e){e.nodeType===Node.ELEMENT_NODE&&(Array.from(e.childNodes).forEach(o),0!==e.childNodes.length||e.textContent.trim()||e.remove())}function n(e){for(let r=e.childNodes.length-1;r>=0;r--){const t=e.childNodes[r];t.nodeType!==Node.TEXT_NODE||t.textContent.trim()?t.nodeType===Node.ELEMENT_NODE&&n(t):e.removeChild(t)}}function i(i){try{const c=(new DOMParser).parseFromString(i,"text/html");if(!c||!c.documentElement)throw new Error("Failed to parse HTML");const m=c.documentElement;return["style","iframe","svg"].forEach((e=>{m.querySelectorAll(e).forEach((e=>e.remove()))})),m.querySelectorAll("script").forEach((r=>{e(r)||r.remove()})),r(m),t(m),o(m),n(m),m.outerHTML}catch(e){throw new Error("Failed to parse HTML: "+e.message)}}function c(e,r){if(window.__html_trimmer_report_error)try{return void window.__html_trimmer_report_error(e,r,window.location.href,Date.now())}catch(e){}!function(e){try{console.log("FBHtmlTrimmerError:"+e)}catch(e){}}(r)}window.__trimAndExtractHTML=function(){try{const e=document.documentElement.outerHTML;if(!e||0===e.length)return void c("empty_document","Document HTML is empty or null");const r=i(e);if(!r||0===r.length)return void c("empty_result","HTML trimming resulted in empty output");!function(e,r){if(window.__call_iabjs_unified_bridge)try{const t={timestamp:Date.now(),url:window.location.href,originalSize:e?e.length:0,trimmedSize:r?r.length:0,trimmedHtml:r||"",hasError:!1,errorType:null,errorMessage:null};window.__call_iabjs_unified_bridge("TrimmedHtmlExtractor",window.__iabjs_unified_bridge_nonce,t)}catch(e){c("bridge_communication_error",e.message)}}(e,r)}catch(e){console.log("FBHtmlTrimmerProcessError:"+e.message),c("processing_error",e.message||"Unknown error during HTML processing")}},window.__trimAndExtractHTML()}();