(()=>{"use strict";class t{static ACTIVE_CLASS_NAME="jp-plugin-deactivation--active";constructor(t){this.pluginSlug=t,this.deactivateButton=document.getElementById(`deactivate-${this.pluginSlug}`),this.deactivateButton||(this.deactivateButton=document.getElementById(`deactivate-${this.pluginSlug}-dev`)),this.deactivateButton&&(this.dialog=document.getElementById(`jp-plugin-deactivation-${this.pluginSlug}`),this.observeDialogActions(),this.attachEventListeners())}showDialog(){this.dialog.classList.add(t.ACTIVE_CLASS_NAME)}hideDialog(){this.dialog.classList.remove(t.ACTIVE_CLASS_NAME)}observeDialogActions(){this.dialog.querySelectorAll('[data-jp-plugin-deactivation-action="close"]').forEach(t=>{t.addEventListener("click",()=>{this.hideDialog()})});this.dialog.querySelectorAll('[data-jp-plugin-deactivation-action="deactivate"]').forEach(t=>{t.addEventListener("click",()=>{this.deactivate()})})}attachEventListeners(){this.deactivateButton.addEventListener("click",t=>{t.preventDefault(),this.showDialog()})}deactivate(){this.deactivateButton&&(window.location.href=this.deactivateButton.href,this.hideDialog())}}if("JetpackPluginDeactivationData"in window){const i=window.JetpackPluginDeactivationData;document.addEventListener("DOMContentLoaded",function(){i.instances||(i.instances={});for(const e of i.slugs)i.instances[e]=new t(e)})}})();