(()=>{"use strict";const e=window.ReactJSXRuntime,{createHigherOrderComponent:t}=wp.compose,{addFilter:o}=wp.hooks,{useEffect:n,useState:s}=wp.element,{subscribe:r}=wp.data;!function(){function c(e,t={target:"both"}){const o=e.ownerDocument.defaultView.getComputedStyle(e).backgroundColor;if(!o.match(/\d+/g))return;const n=o.match(/\d+/g).map(Number),s=(299*n[0]+587*n[1]+114*n[2])/1e3,r=s>128?"mxs-light-bg":"mxs-dark-bg",c=s<128?"mxs-dark-theme-bg":"mxs-light-theme-bg";if("block"===t.target||"both"===t.target)return"rgba(0, 0, 0, 0)"===o||"transparent"===o?(e.classList.remove("mxs-light-bg","mxs-dark-bg"),e.classList.add("mxs-light-bg"),"mxs-light-bg"):(e.classList.remove("mxs-light-bg","mxs-dark-bg"),e.classList.add(r),r);if("body"===t.target||"both"===t.target){const t=e.ownerDocument.body;return t.classList.remove("mxs-light-theme-bg","mxs-dark-theme-bg"),t.classList.add(c),c}}wp.plugins.registerPlugin("mixin-styles-gb-body-sync",{render:()=>(n(()=>{let e="";const t=()=>{const t=window.document.querySelector('iframe[name="editor-canvas"]'),o=t?t.contentDocument||t.contentWindow.document:null;if(!o||"function"!=typeof o.querySelector)return;const n=o?o.body:document.querySelector(".editor-styles-wrapper");if(n&&c){const t=window.getComputedStyle(n).backgroundColor;t!==e&&(e=t,c(n,{target:"body"}))}};t();const o=r(()=>{requestAnimationFrame(t)});return()=>o()},[]),null)});const a=e=>{const t=(o=0)=>{const n=e.contentDocument||e.contentWindow.document;n&&n.body&&(n&&n.body&&""!==n.body.innerHTML.trim()&&c?c(n.body,{target:"body"}):o<20&&setTimeout(()=>t(o+1),100))};e.addEventListener("load",()=>t(0)),t(0)};new MutationObserver(e=>{for(const t of e)t.addedNodes.forEach(e=>{if(1===e.nodeType){const t=e.matches('iframe[name="style-book-canvas"]')?e:e.querySelector('iframe[name="style-book-canvas"]');t&&a(t)}})}).observe(document.body,{childList:!0,subtree:!0});const i=document.querySelector('iframe[name="style-book-canvas"]');i&&a(i);const d=t(t=>o=>{const{attributes:r,clientId:a}=o,[i,d]=s(""),m=r.className||"",l=r.className||"",u=m.includes("mxs-card")||m.includes("mxs-thin-header")||l.includes("is-style-flat-nav");return n(()=>{if(!u)return;const e=window.document.querySelector('iframe[name="editor-canvas"]'),t=(e?e.contentDocument:document).getElementById(`block-${a}`);t&&requestAnimationFrame(()=>{requestAnimationFrame(()=>{const e=c(t,{target:"block"});e!==i&&d(e)})})},[r.style,r.backgroundColor,a,u]),(0,e.jsx)(t,{...o,className:i})},"withBlockContrast");o("editor.BlockListBlock","mixin-styles-gb/targeted-contrast",d)}()})();