(()=>{"use strict";var e={n:n=>{var t=n&&n.__esModule?()=>n.default:()=>n;return e.d(t,{a:t}),t},d:(n,t)=>{for(var o in t)e.o(t,o)&&!e.o(n,o)&&Object.defineProperty(n,o,{enumerable:!0,get:t[o]})},o:(e,n)=>Object.prototype.hasOwnProperty.call(e,n)};const n=window.wp.domReady,t=advancedAds;e.n(n)()(function(){(function(){const e=document.getElementById("alternative-version");e&&e.addEventListener("submit",n=>{n.preventDefault(),function(e){const n=document.getElementById("plugin-version"),o=document.getElementById("install-version"),a=o?o.parentElement.querySelector(".spinner"):null;n&&(n.disabled=!0),o&&(o.disabled=!0),a&&(a.style.visibility="visible"),e.append("action","advads_install_alternate_version"),fetch(t.endpoints.ajaxUrl,{method:"POST",body:e}).then(e=>e.json()).then(e=>{e.data&&e.data.redirect&&(document.location.href=e.data.redirect)}).catch(e=>{console.error(e)}).finally(()=>{n&&(n.disabled=!1),o&&(o.disabled=!1),a&&(a.style.visibility="hidden")})}(new FormData(e))});const n=document.getElementById("plugin-version");n&&!n.value&&function(){const e=document.getElementById("version-control-nonce");fetch(t.endpoints.ajaxUrl,{method:"POST",body:new URLSearchParams({action:"advads_get_usable_versions",nonce:e?e.value:""})}).then(e=>e.json()).then(e=>{const n=[],t=document.getElementById("plugin-version");e.data.order.forEach((t,o)=>{const a=document.createElement("option");a.value=`${t}|${e.data.versions[t]}`,a.textContent=t,0===o&&(a.selected=!0),n.push(a)}),t.innerHTML="",n.forEach(e=>t.appendChild(e)),t.disabled=!1;const o=document.getElementById("install-version");o&&(o.disabled=!1)}).catch(e=>{console.error(e)})}()})(),function(){const e=window.location.hash;if(e){const n=document.getElementById(e.replace("#",""));n&&n.click()}}()})})();