import{r as l,R as _,_ as O,u as D,j as T,a as c,g as V}from"./index.js";function C(e,{threshold:t=0,root:r=null,rootMargin:u="0%",freezeOnceVisible:g=!0}){const[n,p]=l.exports.useState(),o=(n==null?void 0:n.isIntersecting)&&g,a=([s])=>{p(s)};return l.exports.useEffect(()=>{const s=e==null?void 0:e.current;if(!!!window.IntersectionObserver||o||!s)return;const E={threshold:t,root:r,rootMargin:u},v=new IntersectionObserver(a,E);return v.observe(s),()=>v.disconnect()},[e==null?void 0:e.current,t,r,u,o]),n}const L=_.lazy(()=>O(()=>import("./ModalPortal.js"),["ModalPortal.js","index.js","animate.es.js","styled-components.browser.esm.js","useBlockScroll.js","useWindowSize.js"])),W=_.lazy(()=>O(()=>import("./Gallery.js"),["Gallery.js","index.js","styled-components.browser.esm.js"])),$=_.lazy(()=>O(()=>import("./Card.js"),["Card.js","Image.js","index.js","styled-components.browser.esm.js","User.js","animate.es.js","translationUtils.js","useElementSize.js"])),q=({shortId:e,postId:t,cardId:r,productId:u,members:g,brand:n,category:p,country:o,market:a,marketCurrency:s,hidePrices:f})=>{const[E,v,d,A,S]=D(i=>[i.set,i.getGallery,i.getSinglePostGallery,i.getCard,i.triggerEvent]),x=l.exports.useRef(),b=C(x,{}),y=!!(b!=null&&b.isIntersecting),G=()=>{if(e){const i=document.querySelector(`#cevoid-container[data-gallery="${e}"]`).clientWidth,P=V(i);E(z=>{z.device=P}),v({shortId:e,productId:u,members:g,brand:n,category:p,country:o,device:P,market:a,marketCurrency:s,hidePrices:f})}t&&d({postId:t,country:o,market:a}),r&&A({cardId:r,country:o,market:a,marketCurrency:s,hidePrices:f})},j=!!(e||t),w=!!r;return l.exports.useEffect(()=>{G()},[e,t,r]),l.exports.useEffect(()=>{y&&j&&S("gallery.view"),y&&w&&S("card.view")},[y]),T("div",{children:[c("div",{ref:x}),(e||t)&&c(W,{shortId:e,postId:t}),r&&c($,{cardId:r}),c(_.Suspense,{fallback:c("div",{}),children:c(L,{})})]})};var B=Object.freeze(Object.defineProperty({__proto__:null,default:q},Symbol.toStringTag,{value:"Module"}));export{B as A,C as u};