| 1 |
(()=>{"use strict";var e={n:t=>{var n=t&&t.__esModule?()=>t.default:()=>t;return e.d(n,{a:n}),n},d:(t,n)=>{for(var o in n)e.o(n,o)&&!e.o(t,o)&&Object.defineProperty(t,o,{enumerable:!0,get:n[o]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t)};const t=window.wp.domReady;function n(e){if("true"===e.dataset.marqueeInit)return;const t=e.querySelector(".gutenify-marquee-viewport"),n=t?t.querySelector(".gutenify-marquee-track"):null;if(!n)return;const o=Array.from(n.children);if(!o.length)return;e.dataset.marqueeInit="true";const r=e.dataset.direction||"left",a=Math.min(1e3,Math.max(1,parseFloat(e.dataset.speed)||60)),s=e.dataset.hoverAction||"pause",i="false"!==e.dataset.pauseOnFocus,d="bounce"===e.dataset.playback?"bounce":"loop",l="ignore"!==e.dataset.reducedMotion,c="up"===r||"down"===r,u="right"===r||"down"===r,f=window.matchMedia("(prefers-reduced-motion: reduce)");let h=[],m=0,p=0,w=-1,v=0,g=a,y=null,b=0,E=!0,L=!1,q=!1,M=!1,A=null;const O=()=>c?t.clientHeight:t.clientWidth,F=()=>{n.style.transform=c?`translate3d(0, ${p}px, 0)`:`translate3d(${p}px, 0, 0)`},I=()=>{if(h.forEach((e=>e.remove())),h=[],n.style.transform="",p=0,m=0,w=-1,!L){if("loop"===d){const e=(()=>{const e=o[0],t=o[o.length-1],n=c?e.offsetTop:e.offsetLeft;return(c?t.offsetTop+t.offsetHeight:t.offsetLeft+t.offsetWidth)-n})();if(e<=0)return;m=e+(parseFloat(window.getComputedStyle(n).gap)||0);const t=Math.max(1,Math.ceil((O()+m)/m));for(let e=0;e<t;e++)o.forEach((e=>{const t=e.cloneNode(!0);t.classList.add("gutenify-marquee-clone"),t.setAttribute("aria-hidden","true"),t.setAttribute("inert",""),t.removeAttribute("id"),h.push(t),n.appendChild(t)}));p=u?-m:0}else{const e=(c?n.scrollHeight:n.scrollWidth)-O();e>0&&u&&(p=-e,w=1)}F()}},S=e=>{y=null;const t=b?Math.min((e-b)/1e3,.1):0;if(b=e,v+=(g-v)*Math.min(1,6*t),0===g&&Math.abs(v)<.4&&(v=0),"loop"===d&&m>0)p+=(u?1:-1)*v*t,!u&&p<=-m&&(p+=m),u&&p>=0&&(p-=m);else if("bounce"===d){const e=(c?n.scrollHeight:n.scrollWidth)-O();e>0?(p+=w*v*t,p<=-e?(p=-e,w=1):p>=0&&(p=0,w=-1)):p=0}F(),T()},T=()=>{y||!E||L||(y=window.requestAnimationFrame(S))},x=()=>{y&&(window.cancelAnimationFrame(y),y=null),b=0},H=()=>{let e=a;q&&("pause"===s?e=0:"slow"===s&&(e=.3*a)),M&&i&&(e=0),g=e},W=()=>{L=l&&f.matches,e.classList.toggle("is-static",L),x(),I(),T()},z=()=>{window.clearTimeout(A),A=window.setTimeout((()=>{x(),I(),T()}),150)};if(e.addEventListener("mouseenter",(()=>{q=!0,H()})),e.addEventListener("mouseleave",(()=>{q=!1,H()})),e.addEventListener("focusin",(()=>{M=!0,H()})),e.addEventListener("focusout",(t=>{e.contains(t.relatedTarget)||(M=!1,H())})),"IntersectionObserver"in window&&new IntersectionObserver((e=>{e.forEach((e=>{E=e.isIntersecting,E?(b=0,T()):x()}))})).observe(e),"ResizeObserver"in window){let e=!0;new ResizeObserver((()=>{e?e=!1:z()})).observe(t)}else window.addEventListener("resize",z);o.forEach((e=>{e.querySelectorAll("img").forEach((e=>{e.complete||e.addEventListener("load",z,{once:!0})}))})),"function"==typeof f.addEventListener&&f.addEventListener("change",W),H(),W()}e.n(t)()((()=>{document.querySelectorAll(".gutenify-marquee").forEach(n)}))})(); |