(()=>{"use strict";var t={15:(t,e)=>{function i(t){return i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},i(t)}function r(t,e){for(var i=0;i{i.r(e),i.d(e,{Slider:()=>o});var r=class{constructor(t){this.buttonPrev=t.config.target.querySelector(".button-prev"),this.buttonNext=t.config.target.querySelector(".button-next"),this.buttonPrev&&this.buttonNext&&(this.buttonPrev.addEventListener("click",(()=>t.prevItem())),this.buttonNext.addEventListener("click",(()=>t.nextItem())))}updateNavigation(t,e){this.buttonPrev&&this.buttonNext&&(this.buttonPrev.disabled=!t,this.buttonNext.disabled=!e)}},s=class{constructor(t){this.slider=t,this.paginationContainer=this.slider.config.target.querySelector(".scroll-slider-pagination"),null!==this.paginationContainer&&window.addEventListener("resize",(()=>this.handleResize()),{passive:!0})}renderPagination(){if(null===this.paginationContainer)return;let t;this.paginationContainer.innerHTML="",this.numBullets=this.calculateTotalBullets();for(let e=0;e{this.slider.currentItem=e,this.slider.scrollToCurrentItem()})),this.paginationContainer.appendChild(t);this.paginationItems=this.paginationContainer.querySelectorAll(".bullet")}calculateTotalBullets(){const t=this.slider.totalItems-(this.slider.itemsPerView-1);return-1===this.slider.config.itemsPerView?t-Math.floor(this.slider.wrapper.offsetWidth/this.slider.itemSize):t}updatePagination(t){var e;null==(e=this.paginationItems)||e.forEach(((e,i)=>{i===t?e.classList.add("active"):e.classList.remove("active")}))}handleResize(){if(null===this.paginationContainer)return;const t=this.calculateTotalBullets();this.numBullets!==t&&(this.numBullets=t,this.renderPagination())}},n=class{constructor(t){this.slider=t,this.breakpointKeys=Object.keys(this.slider.config.breakpoints).sort(((t,e)=>parseInt(t,10)-parseInt(e,10))),window.addEventListener("resize",(()=>this.handleBreakpoints()),{passive:!0}),this.handleBreakpoints()}getCurrentBreakpoint(){const t=window.innerWidth;let e="";for(let i=this.breakpointKeys.length-1;i>=0;i-=1)if(parseInt(this.breakpointKeys[i],10)<=t){e=this.breakpointKeys[i];break}return this.slider.config.breakpoints?this.slider.config.breakpoints[e]:void 0}handleBreakpoints(){const t=this.getCurrentBreakpoint(),e=void 0!==t?Math.abs(t.itemsPerView):Math.abs(this.slider.config.itemsPerView);this.slider.itemsPerView!==e&&(this.slider.itemsPerView=e,this.slider.pagination.renderPagination())}},o=class{constructor(t){this.config=t,this.overflow=!1,this.currentItem=0,this.isScrolling=0,this.itemsPerView=Math.abs(this.config.itemsPerView),this.container=this.config.target.querySelector(".scroll-slider"),this.wrapper=this.container.querySelector(".scroll-slider-wrapper"),this.items=this.container.querySelectorAll(".scroll-slider-wrapper > *"),this.totalItems=this.items.length,this.itemSize=this.items[0].offsetWidth+this.getRowGap(),this.navigation=new r(this),this.pagination=new s(this),this.pagination.renderPagination(),this.config.loop&&this.navigation.updateNavigation(!0,!0),this.config.breakpoints&&new n(this),this.wrapper.addEventListener("scroll",(()=>this.handleScroll()),{passive:!0}),window.addEventListener("resize",(()=>this.handleResize()),{passive:!0}),this.handleResize()}getRowGap(){let t=getComputedStyle(this.wrapper).rowGap;return"normal"===t?0:parseInt(t)}scrollToCurrentItem(t="smooth"){this.pagination.updatePagination(this.currentItem),this.wrapper.scrollTo({left:this.items[this.currentItem].offsetLeft,top:0,behavior:t})}prevItem(){this.currentItem--,this.currentItem<0&&(this.currentItem=this.config.loop?this.totalItems-1:0),this.scrollToCurrentItem()}nextItem(){this.currentItem++;const t=this.totalItems-(this.itemsPerView-1)-1;this.currentItem>t&&(this.currentItem=this.config.loop?0:t),this.scrollToCurrentItem()}handleScroll(){if(!this.config.loop){const t=!this.isScrollStart(),e=!this.isScrollEnd();this.navigation.updateNavigation(t,e)}window.clearTimeout(this.isScrolling),this.isScrolling=window.setTimeout((()=>{this.currentItem=this.calculateCurrentItem(),this.pagination.updatePagination(this.currentItem)}),66)}isScrollStart(){return 0===this.wrapper.scrollLeft}isScrollEnd(){return Math.round(this.wrapper.scrollLeft)>=Math.round(this.wrapper.scrollWidth-this.wrapper.clientWidth)}calculateCurrentItem(){return Math.round(this.wrapper.scrollLeft/this.itemSize)}handleResize(){this.overflow=this.wrapper.scrollWidth>this.wrapper.clientWidth,this.itemSize=this.items[0].offsetWidth+this.getRowGap(),this.overflow?this.container.classList.add("scroll-enabled"):(this.container.classList.remove("scroll-enabled"),this.currentItem=0,this.scrollToCurrentItem("auto")),this.handleScroll()}}}},e={};function i(r){var s=e[r];if(void 0!==s)return s.exports;var n=e[r]={exports:{}};return t[r](n,n.exports,i),n.exports}i.d=(t,e)=>{for(var r in e)i.o(e,r)&&!i.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:e[r]})},i.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),i.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var r,s;r=i(15),s=i(906),document.querySelectorAll(".psg-slider").forEach((function(t){new s.Slider({target:t,itemsPerView:1,loop:"true"===t.dataset.loop,breakpoints:"1"!==t.dataset.itemsDesktop?{768:{itemsPerView:parseInt(t.dataset.itemsDesktop,10)}}:void 0})})),new r.Utils})(); //# sourceMappingURL=slider.js.map