function Ke(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)})}async function Ne(){try{const e="undefined"!=typeof browser&&browser.storage?browser.storage.sync:chrome.storage.sync,t=t=>new Promise(n=>{const o=e.get(t,e=>{chrome.runtime.lastError?(void 0,n(t)):n(e)});o&&"function"==typeof o.then&&o.then(n).catch(()=>n(t))}),n=await t({autop:!1,pKey:"",noNotify:!1})||{autop:!1,pKey:"",noNotify:!1},o=document.getElementById("autoplay"),a=document.getElementById("prokey"),r=document.getElementById("notification");o&&(o.checked=!0===n.autop),a&&(a.value=n.pKey||""),r&&(r.checked=!0===n.noNotify)}catch(e){void 0}ze()}function ze(){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",Ne),document.querySelector("form").addEventListener("submit",Ke);