// source --> https://steuerberater-heinen.de/wp-content/plugins/host-google-fonts-pro/assets/js/omgf-pro-frontend.min.js?ver=1776110859 
document.addEventListener("omgf_frontend_loaded",e=>{e=e&&e.detail?e.detail:{};let t=Array.isArray(e.missing_preloads)?e.missing_preloads:[],n=Array.isArray(e.unused_fonts)?e.unused_fonts:[],i=e.status||null,o={menu_item:document.getElementById("wp-admin-bar-omgf"),sub_menu_item:document.getElementById("wp-admin-bar-omgf-pro-smart-optimize"),sub_menu_item_link:document.querySelector("#wp-admin-bar-omgf-pro-smart-optimize a"),init:function(){"warning"===i&&null!==this.sub_menu_item_link&&this.sub_menu_item_link.classList.add("omgf-pro-warning"),"info"===i&&null!==this.sub_menu_item_link&&this.sub_menu_item_link.classList.add("info"),"reload"===i&&document.location.reload(),"1"===omgf_pro_frontend_i18n.smart_optimize_enabled&&"success"===i&&this.runSmartOptimize(t,n),this.sub_menu_item_link?.addEventListener("click",this.showModal)},runSmartOptimize:function(e,t){fetch(omgf_pro_frontend_i18n.smart_optimize_endpoint,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":omgf_pro_frontend_i18n.nonce},body:JSON.stringify({path:window.location.pathname,missing_preloads:e,unused_fonts:t})}).then(async e=>{var t=await e.json().catch(()=>null);if(!e.ok||t?.code)throw new Error(t?.message||"Smart Optimize failed with status "+e.status);t?.first_run&&null!==o.menu_item&&(o.menu_item.classList.remove("success","info","warning","alert"),document.location.reload())}).catch(e=>console.error("OMGF Pro - Smart Optimize error:",e))},showModal:function(e){e.preventDefault();let t=this.href;var e=document.getElementsByTagName("head")[0],n=document.createElement("link");n.rel="stylesheet",n.href=omgf_pro_frontend_i18n.smart_optimize_stylesheet_url,e.appendChild(n);let i=document.createElement("div");i.id="omgf-pro-optimize-notice";var e=document.createElement("div"),n=(e.id="omgf-pro-optimize-notice-box",document.createElement("h2")),o=(n.textContent=omgf_pro_frontend_i18n.optimize_notice_title||"",document.createElement("p")),m=(o.textContent=omgf_pro_frontend_i18n.optimize_notice_text||"",document.createElement("button"));m.id="omgf-pro-optimize-notice-button",m.textContent=omgf_pro_frontend_i18n.optimize_notice_button_text||"",e.appendChild(n),e.appendChild(o),e.appendChild(m),i.appendChild(e),document.body.appendChild(i),i.addEventListener("click",e=>{e.target===i&&(i.classList.add("fade-out"),setTimeout(()=>i.remove(),300))}),document.getElementById("omgf-pro-optimize-notice-button").addEventListener("click",()=>{window.location.href=t})}};o.init()});