(()=>{var c=class{constructor({clientId:a,...n}={}){this.options={activeClass:"nfd-wb-animated-in",root:null,rootMargin:"0px",threshold:0,...n}}observeElements(a,n=null,t=!1){if(!("IntersectionObserver"in window)||!a?.length||document.documentElement.classList.contains("block-editor-block-preview__content-iframe"))return;function o(s,r){this._mutationCallback(s,r,n)}let i=new IntersectionObserver(this._handleIntersection.bind(this),this.options),f=new MutationObserver(o.bind(this)),d=new MutationObserver(this._handleClassMutation.bind(this));a.forEach(s=>{let r=s;s.classList.contains("nfd-wb-reveal-right")&&(r=s.parentElement),i.observe(r),t&&(d.observe(r,{attributes:!0,attributeFilter:["class"]}),f.observe(r,{attributes:!0,attributeFilter:["class"]}))})}_handleIntersection(a,n){a.forEach(t=>{t.isIntersecting&&(t.target.classList.add(this.options.activeClass),t.target.querySelectorAll(".nfd-wb-animate").forEach(o=>{o.classList.add(this.options.activeClass)}),n.unobserve(t.target))})}_handleClassMutation(a){a.forEach(n=>{if(n?.type==="attributes"){let t=n.target;t.classList.contains("nfd-wb-animate")&&!t.classList.contains("nfd-wb-animated-in")&&!t.hasAttribute("data-replay-animation")&&t.classList.add("nfd-wb-animated-in")}})}_mutationCallback(a,n,t=null){a.forEach(o=>{if(o?.type==="attributes"){let i=o.target;t&&t===i.getAttribute("data-block")&&(i.getAttribute("data-replay-animation")===null&&(i.setAttribute("data-replay-animation",!0),requestAnimationFrame(()=>{i.removeAttribute("data-replay-animation")})),n.disconnect())}})}};var w={"nfd-wb-fade-in-bottom":{from:{opacity:0,transform:"translate3d(0, 90px, 0)"},duration:1200},"nfd-wb-fade-in-bottom-short":{from:{opacity:0,transform:"translate3d(0, 32px, 0)"},duration:600},"nfd-wb-fade-in-top-short":{from:{opacity:0,transform:"translate3d(0, -32px, 0)"},duration:600},"nfd-wb-fade-in-left-short":{from:{opacity:0,transform:"translate3d(-32px, 0, 0)"},duration:600},"nfd-wb-fade-in-right-short":{from:{opacity:0,transform:"translate3d(32px, 0, 0)"},duration:600},"nfd-wb-zoom-in":{from:{opacity:0,transform:"scale3d(0.4, 0.4, 0.4)"},duration:1200},"nfd-wb-zoom-in-short":{from:{opacity:0,transform:"scale3d(0.92, 0.92, 0.92)"},duration:600},"nfd-wb-twist-in":{from:{opacity:0,transform:"translateY(40px) scale(0.8) rotateY(30deg) rotateZ(-12deg)"},duration:1e3},"nfd-wb-reveal-right":{from:{clipPath:"inset(0 100% 0 0)"},to:{clipPath:"inset(0 0 0 0)"},duration:1500,easing:"cubic-bezier(0.4, 0, 0, 1)"}};["DOMContentLoaded","wonder-blocks/toolbar-button-added","wonder-blocks/block-order-changed"].forEach(e=>document.addEventListener(e,()=>l()));document.addEventListener("wonder-blocks/animation-changed",e=>l(e?.detail?.clientId));window.onload=()=>l();document.readyState!=="loading"&&l();var b=!1;function l(e=null){document.documentElement.classList.contains("block-editor-block-preview__content-iframe")||(window.parent!==window?h():y(e))}var m=e=>e.split(/\s+/).find(a=>a in w)||"";function u(e){e.style.transition="none",e.classList.add("nfd-wb-animated-in"),requestAnimationFrame(()=>{e.style.transition=""})}function p(e,a){let n=w[a];n&&e.animate([n.from,n.to||{opacity:1,transform:"none"}],{duration:n.duration,easing:n.easing||"cubic-bezier(0.4, 1, 0.65, 1)"})}function h(){if(document.body&&document.body.classList.add("nfd-wb-editor-animations"),requestAnimationFrame(()=>{document.querySelectorAll(".nfd-wb-animate:not(.nfd-wb-animated-in)").forEach(t=>t.classList.add("nfd-wb-animated-in"))}),b)return;b=!0;let e=t=>{t.querySelectorAll&&t.querySelectorAll(".nfd-wb-animate:not(.nfd-wb-animated-in)").forEach(u),t.classList?.contains("nfd-wb-animate")&&!t.classList.contains("nfd-wb-animated-in")&&u(t)},a=new MutationObserver(t=>{for(let o of t){if(o.type==="childList"){for(let s of o.addedNodes)s.nodeType===1&&e(s);continue}if(o.type!=="attributes"||o.attributeName!=="class")continue;let i=o.target;if(!i.classList.contains("nfd-wb-animate")||i.classList.contains("nfd-wb-animated-in")||i.hasAttribute("data-replay-animation"))continue;let f=m(o.oldValue||""),d=m([...i.classList].join(" "));f!==d&&d?(i.classList.add("nfd-wb-animated-in"),p(i,d)):u(i)}}),n=()=>{if(!document.body){requestAnimationFrame(n);return}document.body.classList.add("nfd-wb-editor-animations"),a.observe(document.body,{attributes:!0,attributeFilter:["class"],attributeOldValue:!0,childList:!0,subtree:!0})};n()}function y(e=null){let a=document.body?.classList.contains("block-editor-page")||!!e,n=a?document.querySelector(".interface-interface-skeleton__content"):null,t=new c({root:n,threshold:0});requestAnimationFrame(()=>{t.observeElements(Array.from(document.getElementsByClassName("nfd-wb-animate")),e,a)})}})();
