1function openAccordionItem(item){if(!(!item||item.classList.contains("is-open"))){item.classList.add("is-open");var btn=item.querySelector(".bushnell-acc__trigger");btn&&btn.setAttribute("aria-expanded","true")}}function resolveTarget(link){const sel=link.dataset.scroll;if(sel)return document.querySelector(sel);try{const hash=new URL(link.href,location.href).hash;if(!hash)return null;const exact=document.querySelector(hash);if(exact)return exact;const suffixMatch=hash.match(/__([^#]+)$/);return suffixMatch?document.querySelector('[id$="__'+suffixMatch[1]+'"]'):null}catch{return null}}class BushnellProductNav{constructor(nav){if(this.nav=nav,this.links=[...nav.querySelectorAll(".bushnell-pnav__link")],this.anchors=this.links.map(link=>resolveTarget(link)).filter(el=>el!==null),this.anchors.length&&(this.observer=new IntersectionObserver(this.onIntersect.bind(this),{rootMargin:"-20% 0px -60% 0px"}),this.anchors.forEach(el=>this.observer&&this.observer.observe(el))),this.links.forEach(link=>{link.addEventListener("click",e=>{const target=resolveTarget(link);if(!target)return;e.preventDefault();const navH=this.nav.offsetHeight,top=target.getBoundingClientRect().top+scrollY-navH-8;window.scrollTo({top,behavior:"smooth"}),target.classList.contains("bushnell-acc__item")&&openAccordionItem(target)})}),nav.classList.contains("bushnell-pnav--sticky")){const sentinel=nav.previousElementSibling;sentinel&&sentinel.classList.contains("bushnell-pnav__sentinel")&&this._initSticky(sentinel)}}_initSticky(sentinel){let navTop=-1;const calcTop=()=>{this.nav.classList.remove("is-stuck"),sentinel.style.height="0",navTop=sentinel.getBoundingClientRect().top+window.scrollY},update=()=>{if(navTop<0)return;const stuck=window.scrollY>=navTop;this.nav.classList.contains("is-stuck")!==stuck&&(this.nav.classList.toggle("is-stuck",stuck),sentinel.style.height=stuck?this.nav.offsetHeight+"px":"0")};requestAnimationFrame(()=>{calcTop(),update()}),window.addEventListener("load",()=>{calcTop(),update()},{once:!0}),window.addEventListener("scroll",update,{passive:!0}),window.addEventListener("resize",()=>{calcTop(),update()},{passive:!0})}onIntersect(entries){entries.forEach(entry=>{if(!entry.isIntersecting)return;const idx=this.anchors.indexOf(entry.target);if(idx===-1)return;this.links.forEach(l=>l.classList.remove("is-active"));const activeLink=this.links[idx];activeLink&&activeLink.classList.add("is-active")})}}function initNavs(){if(document.querySelectorAll(".bushnell-pnav").forEach(el=>{el instanceof HTMLElement&&new BushnellProductNav(el)}),location.hash){var hashTarget=document.querySelector(location.hash);hashTarget&&hashTarget.classList.contains("bushnell-acc__item")&&openAccordionItem(hashTarget)}}document.readyState==="loading"?document.addEventListener("DOMContentLoaded",initNavs):initNavs(); 2//# sourceMappingURL=/cdn/shop/t/127/assets/bushnell-product-nav-bar.js.map?v=79374794353236202171790092425
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.