document.addEventListener("DOMContentLoaded",(()=>{const e=document.querySelector(".theme-overlay");let t=wp.themes=wp.themes||{};t.data="undefined"!=typeof _wpThemeSettings?_wpThemeSettings:"";const o=e=>{const t=(e=>{const t=wp.themes.data.themes;for(let o=0,n=t.length;o<n;o++)if(t[o].id===e)return t[o];return null})(e),o=document.querySelector(".theme-wrap");if(null!==t&&void 0!==t.hasRollback&&!1!==t.hasRollback){const n=document.querySelector(".theme-overlay").classList.contains("active"),l='<a href="'+encodeURI("admin.php?page="+WPMastertoolkitPluginThemeRollbackThemes.optionId+"&type=theme&theme_file="+e+"&current_version="+t.version+"&rollback_name="+t.name+"&_wpnonce="+WPMastertoolkitPluginThemeRollbackThemes.nonce)+'" style="position:absolute;right: '+(!0===n?"5px":"80px")+'; bottom: 5px;" class="button-secondary wpmastertoolkit-theme-rollback">'+WPMastertoolkitPluginThemeRollbackThemes.i10n.rollbackLabel+"</a>";if(o){const e=o.querySelector(".theme-actions");e&&e.insertAdjacentHTML("beforeend",l)}}else if(o){const e=o.querySelector(".theme-actions");e&&e.insertAdjacentHTML("beforeend",'<span class="no-rollback" style="position: absolute;left: 23px;bottom: 16px;font-size: 12px;font-style: italic;color: rgb(181, 181, 181);">'+WPMastertoolkitPluginThemeRollbackThemes.i10n.notRollbackable+"</span>")}};1===t.data.themes.length&&o(t.data.themes[0].id),e&&new MutationObserver((e=>{const t=(e=>{e=e.replace(/[\[]/,"\\[").replace(/[\]]/,"\\]");const t=new RegExp("[\\?&]"+e+"=([^&#]*)").exec(location.search);return null===t?"":decodeURIComponent(t[1].replace(/\+/g," "))})("theme");if(document.querySelectorAll(".wpmastertoolkit-theme-rollback").length>0)return!1;o(t)})).observe(e,{childList:!0,attributes:!0}),document.body.addEventListener("click",(e=>{e.target.classList.contains("wpmastertoolkit-theme-rollback")&&(window.location=e.target.getAttribute("href"))}))}));