var FPFramework_GeoIP=function(){function e(){this.handleDownloadDB()}return e.prototype.handleDownloadDB=function(){var e=document.querySelector(".GeoIPUpdateDbButton");if(e){var s=e.nextElementSibling.value;e.addEventListener("click",function(e){var n="",t=e.target.closest(".fpf-fields-wrapper");t&&t.querySelector(".geoip-license-key")&&(n=t.querySelector(".geoip-license-key").value);var a=e.target.getAttribute("data-task"),o=new FormData;o.append("nonce",s),o.append("action","fpf_on_geoip_ajax"),o.append("task",a),o.append("license_key",n);var r=e.target;r.classList.remove("btn-danger"),r.innerHTML=fpf_js_object.FPF_DOWNLOADING_UPDATES_PLEASE_WAIT,r.classList.add("btn-working"),fetch(fpf_js_object.ajax_url,{method:"POST",body:o}).then(function(e){return e.json()}).then(function(e){e?("1"!=e&&"refresh"!=e||(r.innerHTML=fpf_js_object.FPF_DATABASE_UPDATED,r.classList.add("btn-success")),"refresh"==e?location.reload():"1"!=e&&(r.innerHTML=e,r.classList.remove("btn-success"),r.classList.add("btn-danger"))):(r.innerHTML=e,r.classList.add("btn-danger"))}).finally(function(){r.classList.remove("btn-working")}),e.preventDefault()})}},e}();document.addEventListener("DOMContentLoaded",function(e){new FPFramework_GeoIP});

