­ ­ ­ ­ ­ ­ ­ ­ ­ ­ ­ ­ ­ ­ ­ ­ ­ ­ !function(t){"use strict";class i{constructor(i,s,e){this.$scope=i,this.$instance=s,this.$itemsList=t(".jet-scroll-navigation__item",s),this.settings=t.extend({speed:500,offset:0,sectionSwitch:!1,sectionSwitchOnMobile:!0,scroll_threshold:50},e),this.sections={},this.currentSection=null,this.isScrolling=!1,this.$window=t(window)}init(){this.setSectionsData(),this.currentSection&&this.activateSection(this.currentSection),this.bindEvents(),this.initObservers()}bindEvents(){const i=this;this.$itemsList.on("click.jetScrollNavigation",function(){const s=t(this).data("anchor");i.scrollToSection(s)}),this.$window.on("resize.jetScrollNavigation",JetElementsTools.debounce(50,()=>i.setSectionsData())),this.settings.sectionSwitch&&this.enableWheelControl()}setSectionsData(){const i=this;this.sections={},this.$itemsList.each(function(){const s=t(this),e=s.data("anchor"),n="yes"===s.data("invert"),o=t("#"+e);o.length&&(i.sections[e]={selector:o,offset:Math.round(o.offset().top),height:o.outerHeight(),invert:n})}),this.currentSection||(this.currentSection=Object.keys(this.sections)[0]||null)}initObservers(){const i=this,s=Object.keys(this.sections).sort((t,s)=>i.sections[t].offset-i.sections[s].offset);t(window).on("scroll.jetScrollNavigation",()=>{if(this.isScrolling)return;const e=t(window).scrollTop(),n=t(window).height();for(let t=0;t=c-1&&e=o&&i.activateSection(s[s.length-1])})}activateSection(i){this.sections[i]&&(this.currentSection=i,this.$itemsList.removeClass("active invert"),t('[data-anchor="'+i+'"]',this.$instance).addClass("active"),this.sections[i].invert&&this.$itemsList.addClass("invert"),this.settings.sectionIdVisibility||(history.replaceState?history.replaceState(null,null,"#"+i):location.hash=i))}scrollToSection(t){if(!this.sections[t]||this.isScrolling)return;const i=this.sections[t].offset-this.settings.offset;this.isScrolling=!0,this.activateSection(t),window.scrollTo({top:i,behavior:"smooth"});const s=setInterval(()=>{const t=window.scrollY||window.pageYOffset,e=document.body.scrollHeight-window.innerHeight;(Math.abs(t-i)<2||t>=e||t<=0)&&(clearInterval(s),this.isScrolling=!1)},50)}enableWheelControl(){const t=this,i=JetElementsTools.mobileAndTabletcheck();if(i||window.addEventListener("wheel",function(i){t.onWheel(i)},{passive:!1}),i&&this.settings.sectionSwitchOnMobile){let i=0;window.addEventListener("touchstart",function(t){i=t.changedTouches[0].clientY},{passive:!0}),window.addEventListener("touchend",function(s){const e=s.changedTouches[0].clientY-i;if(Math.abs(e)0?"up":"down";t.switchDirection(n)},{passive:!0})}}onWheel(t){if(!this.$scope.is(":visible")||this.isScrolling)return;t.preventDefault();const i=t.deltaY<0?"up":"down";this.switchDirection(i)}switchDirection(i){if(!this.currentSection)return;const s=t('[data-anchor="'+this.currentSection+'"]',this.$instance),e="up"===i?s.prev():s.next();if(e.length)e.trigger("click.jetScrollNavigation");else{const t=window.scrollY||window.pageYOffset,s=document.body.scrollHeight-window.innerHeight;if("up"===i&&t>0){window.scrollTo({top:0,behavior:"smooth"});const t=Object.keys(this.sections)[0];this.activateSection(t)}if("down"===i&&t