function E(e){e.preventDefault();var t=document.getElementById("autoplay").checked,n=document.getElementById("prokey").value,noNotify=document.getElementById("notification").checked;chrome.storage.sync.set({autop:t,pKey:n,noNotify},function(){var e=document.getElementById("status");e.textContent="Options saved.",setTimeout(function(){e.textContent=""},1750)})}function I(){chrome.storage.sync.get({autop:!1,pKey:"",noNotify:!1},function(e){console.log("Options: No stored items found, using defaults"),e||(e={autop:!1,pKey:"",noNotify:!1});const t=document.getElementById("autoplay"),n=document.getElementById("prokey"),o=document.getElementById("notification");t&&(t.checked=!0===e.autop),n&&(n.value=e.pKey||""),o&&(o.checked=!0===e.noNotify)}),B()}function B(){const e=document.getElementById("prokey");e.addEventListener("focus",e=>{e.target.value===e.target.getAttribute("placeholder")&&(e.target.value=""),e.target.select()});const t=document.getElementById("status");e.addEventListener("blur",e=>{!function(e){return/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/.test(String(e).toLowerCase())}(e.target.value)||""===e.target.value.trim()?(e.target.classList.add("is-invalid"),t.innerText="Invalid email address"):(e.target.classList.remove("is-invalid"),t.innerText="")})}document.addEventListener("DOMContentLoaded",I),document.querySelector("form").addEventListener("submit",E);