(()=>{"use strict";(window.WPConsentConnect||function(n,t,o){jconfirm.defaults={closeIcon:!1,backgroundDismiss:!1,escapeKey:!0,animationBounce:1,useBootstrap:!1,theme:"modern",boxWidth:"560px",type:"blue",animateFromElement:!1,scrollToPreviousElement:!1};var e={$connectBtn:o("#wpconsent-settings-connect-btn"),$connectKey:o("#wpconsent-settings-upgrade-license-key")},c="<div class='excl-mark'>!</div>",s={init:function(){console.log("WPConsentConnect: init"),o(s.ready)},ready:function(){s.events()},events:function(){s.connectBtnClick()},connectBtnClick:function(){e.$connectBtn.on("click",(function(){s.gotoUpgradeUrl()}))},proAlreadyInstalled:function(n){const e=s.l18n.icons.checkmark;o.confirm({title:e+wpconsent.almost_done,content:n.data.message,type:"blue",buttons:{confirm:{text:wpconsent.plugin_activate_btn,btnClass:"wpconsent-btn-confirm",action:function(){t.location.reload()}}}})},gotoUpgradeUrl:function(){var n={action:"wpconsent_connect_url",key:e.$connectKey.val(),_wpnonce:wpconsent.nonce};o.post(ajaxurl,n).done((function(n){if(n.success)return n.data.reload?void s.proAlreadyInstalled(n):void(t.location.href=n.data.url);o.confirm({title:c+wpconsent.oops,closeIcon:!1,content:n.data.message,type:"blue",buttons:{ok:{text:wpconsent.ok,btnClass:"wpconsent-btn-confirm",action:function(){}}}})})).fail((function(n){s.failAlert(n)}))},failAlert:function(n){o.confirm({title:c+wpconsent.oops,content:wpconsent.server_error+"<br>"+n.status+" "+n.statusText+" "+n.responseText,type:"blue",buttons:{ok:{text:wpconsent.ok,btnClass:"wpconsent-btn-confirm",action:function(){}}}})}};return s}(document,window,jQuery)).init()})();