(()=>{chrome.runtime.onInstalled.addListener((r=>{"install"===r.reason&&chrome.tabs.create({url:"https://font-tester.foxcraft.tech/thank-you-premium"})}));let r=!1;function e(){const r=document.getElementById("font-selector-root"),e=document.getElementById("font-tester-script");r&&r.remove(),e&&e.remove()}chrome.action.onClicked.addListener((t=>{r?chrome.scripting.executeScript({target:{tabId:t.id},function:e},(()=>{chrome.runtime.lastError?console.error(chrome.runtime.lastError.message):r=!1})):chrome.scripting.executeScript({target:{tabId:t.id},files:["content.js"]},(e=>{chrome.runtime.lastError?console.error(chrome.runtime.lastError.message):r=!0}))})),chrome.runtime.onMessage.addListener(((t,s,o)=>{if("saveSettings"===t.action){const r=t.settings;return chrome.storage.local.set({settings:r},(()=>{chrome.runtime.lastError?(console.error("Error saving settings:",chrome.runtime.lastError),o({success:!1,error:chrome.runtime.lastError.message})):o({success:!0})})),!0}if("getSettings"===t.action)return chrome.storage.local.get("settings",(r=>{chrome.runtime.lastError?(console.error("Error retrieving settings:",chrome.runtime.lastError),o({success:!1,error:chrome.runtime.lastError.message})):o({success:!0,settings:r.settings})})),!0;if("saveFonts"===t.action){const r=t.fonts;return chrome.storage.local.set({fonts:r},(()=>{chrome.runtime.lastError?(console.error("Error saving fonts:",chrome.runtime.lastError),o({success:!1,error:chrome.runtime.lastError.message})):o({success:!0})})),!0}if("getFonts"===t.action)return chrome.storage.local.get("fonts",(r=>{chrome.runtime.lastError?o({success:!1,error:chrome.runtime?.lastError?.message}):o({success:!0,fonts:r.fonts})})),!0;"widgetClosed"===t.action&&(r=!1,chrome.scripting.executeScript({target:{tabId:s.tab?.id},function:e},(()=>{chrome.runtime.lastError?console.error(chrome.runtime.lastError.message):r=!1})))})),chrome.runtime.setUninstallURL("https://tally.so/r/mKLXVX")})();