{"version":3,"file":"ClickSound.DRS5IUXB.mjs","names":["useRef"],"sources":["https:/framerusercontent.com/modules/l01VE24nTKUCiSx3gPNz/ew8Jyjqsp9NnQNuUzibd/ClickSound.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import{useEffect,useRef}from\"react\";export function withClickSound(Component){return props=>{const ref=useRef(null);const getVideo=()=>ref.current?.querySelector(\"video\");// Mute automatically when the video scrolls out of view\nuseEffect(()=>{const el=ref.current;if(!el)return;const observer=new IntersectionObserver(([entry])=>{const video=getVideo();if(video&&!entry.isIntersecting)video.muted=true;});observer.observe(el);return()=>observer.disconnect();},[]);const handleClick=e=>{props.onClick?.(e);const video=getVideo();if(!video)return;const turnOn=video.muted;// Only one video with sound at a time\ndocument.querySelectorAll(\"video\").forEach(v=>v.muted=true);if(turnOn){video.muted=false;video.volume=1;video.play().catch(()=>{});}};return /*#__PURE__*/_jsx(Component,{...props,ref:ref,onClick:handleClick});};}\nexport const __FramerMetadata__ = {\"exports\":{\"withClickSound\":{\"type\":\"reactHoc\",\"name\":\"withClickSound\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./ClickSound.map"],"mappings":"yHAA+E,SAAgB,EAAe,EAAU,CAAC,MAAO,IAAO,CAAC,IAAM,EAAIA,EAAO,IAAI,EAAQ,MAAa,EAAI,SAAS,cAAc,OAAO,EACpN,MAAc,CAAC,IAAM,EAAG,EAAI,QAAQ,GAAG,CAAC,EAAG,OAAO,IAAM,EAAS,IAAI,sBAAsB,CAAC,KAAS,CAAC,IAAM,EAAM,EAAS,EAAK,GAAO,CAAC,EAAM,iBAAe,EAAM,MAAM,GAAK,CAAC,EAAuB,OAArB,EAAS,QAAQ,CAAE,MAAY,EAAS,WAAW,CAAE,EAAE,CAAC,CAAC,EAAE,IAAM,EAAY,GAAG,CAAC,EAAM,UAAU,CAAC,EAAE,IAAM,EAAM,EAAS,EAAE,GAAG,CAAC,EAAM,OAAO,IAAM,EAAO,EAAM,MAChV,SAAS,iBAAiB,OAAO,CAAC,CAAC,QAAQ,GAAG,EAAE,MAAM,EAAI,EAAK,IAAQ,EAAM,MAAM,GAAM,EAAM,OAAO,EAAE,EAAM,KAAK,CAAC,CAAC,UAAU,CAAC,CAAC,EAAG,EAAE,OAAoB,EAAK,EAAU,CAAC,GAAG,EAAU,MAAI,QAAQ,CAAW,CAAC,CAAE,CAAE,iBAFzK,IAAoC"}