(()=>{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=`${wprData.text_rollback_label}`;document.querySelector(".theme-wrap .theme-actions").insertAdjacentHTML("beforeend",o)}else document.querySelector(".theme-wrap .theme-actions").insertAdjacentHTML("beforeend",`${wprData.text_not_rollbackable}`)},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)}})();