const t=[];let e=null;const s=()=>{t.forEach(t=>t.disconnect()),t.length=0,e&&(window.removeEventListener("resize",e),e=null);document.querySelectorAll(".scrollcheck-x").forEach(s=>{const l=s.closest(".moments-tags-wrapper"),n=l?.querySelector(".at-slide-hover"),i=()=>{const t=s.scrollWidth>s.clientWidth;n&&(n.style.display=t?"inline-flex":"none")},c=()=>{const t=s.querySelector(".tag-item.active");if(!t)return;const e=s.getBoundingClientRect(),l=t.getBoundingClientRect();if(l.right>e.right){const t=l.right-e.right;s.scrollLeft+=t+20}else if(l.left<e.left){const t=e.left-l.left;s.scrollLeft-=t+20}};s.addEventListener("wheel",t=>{0!==t.deltaY&&(t.preventDefault(),s.scrollLeft+=t.deltaY)},{passive:!1});let o=0,r=0;s.addEventListener("touchstart",t=>{o=t.touches[0].clientX,r=t.touches[0].clientY},{passive:!0}),s.addEventListener("touchmove",t=>{const e=t.touches[0].clientX,l=t.touches[0].clientY,n=o-e,i=r-l;Math.abs(n)>Math.abs(i)&&(t.preventDefault(),s.scrollLeft+=n,o=e,r=l)},{passive:!1}),i(),c(),e=i,window.addEventListener("resize",i);const a=new MutationObserver(t=>{t.forEach(t=>{if("attributes"===t.type&&"class"===t.attributeName){const e=t.target;e.classList.contains("tag-item")&&e.classList.contains("active")&&setTimeout(()=>c(),100)}})});s.querySelectorAll(".tag-item").forEach(t=>{a.observe(t,{attributes:!0,attributeFilter:["class"]})}),t.push(a)})};export{s as i};
