(()=>{"use strict";!function(a){const d=a("#the-list").find('[data-plugin="'+superbaddonssettings_g.plugin+'"] span.deactivate a'),e=a(".superbaddons-admindashboard-modal-content .superbaddons-feedback-input input[type=radio]"),s=a("#superbaddons-feedback-text");let n=!1;e.on("change",(function(){"other"==this.value?(s.prop("disabled",!1),s.show()):(s.prop("disabled",!0),s.hide()),n=a(this).data("temp")||!1})),d.on("click",(function(o){o.preventDefault(),(a=>{const d=jQuery(".superbaddons-admindashboard-modal-wrapper"),e=d.find(".superbaddons-admindashboard-modal-overlay"),s=d.find(".superbaddons-admindashboard-modal-close-button"),n=d.find(".superbaddons-admindashboard-modal-confirm-btn"),o=d.find(".superbaddons-admindashboard-modal-cancel-btn"),t=d.find(".superbaddons-admindashboard-modal-ok-btn"),r=d.find(".superbaddons-admindashboard-modal-title"),i=d.find(".superbaddons-admindashboard-modal-content"),l=d.find(".superbaddons-admindashboard-modal-header-spinner"),c=d.find(".superbaddons-admindashboard-modal-footer"),p=d.find(".superbaddons-element-separator"),b=a.title||!1,u=a.copyable||!1,m=a.content||!1,h=a.confirmCallback||!1,f=a.cancelCallback||!1,w=a.okCallback||!1,g=a.awaitConfirmCallback||!1,y=a.stopCloseOnConfirm||!1,k=a.preventClosing||!1,v=a.isLoader||!1,_=(a=!1)=>{n.off(),o.off(),s.off(),e.off(),t.off(),jQuery(window).off("keydown.superbaddons-admin-modal"),a?d.hide():d.fadeOut("fast")};((a,b,m,h,f,w,g,k)=>{if(g?(s.off(),e.off(),jQuery(window).off("keydown.superbaddons-admin-modal"),s.hide()):(jQuery(window).on("keydown.superbaddons-admin-modal",(a=>{27==(a.keyCode||a.which)&&_()})),s.on("click",(()=>{_()})),e.on("click",(()=>{_()}))),k)return l.show(),r.hide(),c.hide(),s.hide(),p.hide(),i.text(b),void d.fadeIn("fast");if(l.hide(),c.show(),r.show(),g||s.show(),p.show(),a&&r.text(a),b)if(Array.isArray(b))i.text(""),b.map((a=>{const d=jQuery("<div class='superbaddons-admindashboard-modal-content-item'></div>"),e=jQuery("<div class='superbaddons-admindashboard-modal-content-item-title'></div>"),s=jQuery("<div class='superbaddons-admindashboard-modal-content-item-content'></div>"),n=jQuery("<img class='superbaddons-admindashboard-modal-content-item-icon' />");superbaddonssettings_g&&(n.attr("src",a.shared?superbaddonssettings_g.modal.view_logs.icon_shared:superbaddonssettings_g.modal.view_logs.icon_unshared),n.attr("title",a.shared?superbaddonssettings_g.modal.view_logs.shared_title:superbaddonssettings_g.modal.view_logs.unshared_title));const o=new Date(1e3*a.time),t=o.toLocaleDateString()+" "+o.toLocaleTimeString();e.text(t+" (v."+a.version+"): "+a.title),e.prepend(n),s.text(a.stack),d.append(e),d.append(s),i.append(d)}));else if(u){i.text("");const a=jQuery('<textarea class="superbaddons-admindashboard-modal-copyable-item" onclick="this.focus();this.select()" readonly="readonly"></textarea>'),d=jQuery('<div class="superbaddons-element-text-sm superbaddons-admindashboard-modal-copyable-explainer"></div>');d.text(u),a.text(b),i.append(a),i.append(d)}else i.text(b);m?(n.show(),o.show(),t.hide(),n.on("click",(async()=>{w?await m():m(),y||_()}))):(n.hide(),o.hide(),t.show(),t.on("click",(()=>{f&&f(),y||_()}))),h?o.on("click",(()=>{h(),_()})):o.on("click",(()=>{_()})),d.fadeIn("fast")})(b,m,h,f,w,g,k,v)})({awaitConfirmCallback:!0,confirmCallback:async function(){if(n)return location.href=d.attr("href"),!0;const o=a(".superbaddons-admindashboard-modal input, .superbaddons-admindashboard-modal button");if(o.prop("disabled",!0),a(".superbaddons-admindashboard-modal-footer .superbaddons-spinner-wrapper").show(),e.filter(":checked").length){await(async(a,d,e,s="")=>{const n={"X-WP-Nonce":d};let o=null,t=!1;s instanceof FormData?(t=!0,o=s,o.append("action",e)):(o="action="+e+s,n["Content-Type"]="application/x-www-form-urlencoded;charset=UTF-8");const r=await fetch(a,{method:"POST",credentials:"same-origin",headers:n,body:o});return 200!==r.status?{success:!1,text:"Unknown error occurred. Please contact support if the issue persists."}:r.json()})(superbaddonssettings_g.rest.base+superbaddonssettings_g.rest.namespace+superbaddonssettings_g.rest.routes.settings,superbaddonssettings_g.rest.nonce,"submit_feedback","&spbaddons_reason="+e.filter(":checked").val()+"&spbaddons_other="+s.val())}return o.prop("disabled",!1),a(".superbaddons-admindashboard-modal-footer .superbaddons-spinner-wrapper").hide(),location.href=d.attr("href"),!0},cancelCallback:async function(){return location.href=d.attr("href"),!0}})}))}(jQuery)})();