(()=>{document.addEventListener("DOMContentLoaded",(()=>{e();const t=wp.themes=wp.themes||{};t.data="undefined"!=typeof _wpThemeSettings?_wpThemeSettings:"",1===t.data.themes.length&&o(t.data.themes[0].id),document.body.addEventListener("click",(e=>{e.target.matches(".wpr-theme-rollback")&&(e.preventDefault(),window.location.href=e.target.getAttribute("href"))}))}));const e=()=>{const e=new MutationObserver((e=>{for(let a of e)"childList"===a.type&&a.addedNodes.forEach((e=>{if(e.matches&&e.matches(".theme-overlay")&&!t()){const e=new URLSearchParams(window.location.search).get("theme");o(e)}}))})),a=document.querySelector(".wrap");a&&e.observe(a,{childList:!0,subtree:!0})},t=()=>null!==document.querySelector(".wpr-theme-rollback"),o=e=>{const t=a(e);if(null!==t&&t.hasRollback){const o=`<a href="index.php?page=wp-rollback&type=theme&theme_file=${e}&current_version=${t.version}&rollback_name=${encodeURIComponent(t.name)}&_wpnonce=${wprData.rollback_nonce}" class="button wpr-theme-rollback">${wprData.text_rollback_label}</a>`;document.querySelector(".theme-wrap .theme-actions").insertAdjacentHTML("beforeend",o)}else document.querySelector(".theme-wrap .theme-actions").insertAdjacentHTML("beforeend",`<span class="no-rollback" style="position: absolute;left: 23px;bottom: 16px;font-size: 12px;font-style: italic;color: rgb(181, 181, 181);">${wprData.text_not_rollbackable}</span>`)},a=e=>{const t=wp.themes?.data?.themes;return Array.isArray(t)?t.find((t=>t.id===e))||null:(console.error("Invalid theme data"),null)}})();