{"version":3,"sources":["components/product/detail/images/_std/product-detail-images.js"],"names":["tagsNames","ProductDetailImages","Component","constructor","el","mainSwiperEl","$find","thumbsSwiperEl","mainSwiper","thumbsSwiper","mainSwiperConfig","slidesPerView","navigation","nextEl","prevEl","lazy","loadPrevNext","elementClass","watchOverflow","tags","forEach","name","init","constructMainSwiper","Swiper","constructThumbSwiper","spaceBetween","freeMode","watchSlidesVisibility","watchSlidesProgress","breakpoints","thumbs","swiper","goToVariantImage","id","slideIndex","Array","from","slides","findIndex","slide","dataset","variant","slideTo","updateTags","classList","add","tag","remove","onVariantChanged","EventBus","getInstance","addEventListener","e","detail"],"mappings":"aAAA,KAAMA,CAAAA,SAAS,CAAG,CAAC,gBAAD,CAAmB,YAAnB,CAAiC,QAAjC,CAA2C,SAA3C,CAAsD,SAAtD,CAAiE,WAAjE,CAA8E,oBAA9E,CAAoG,iBAApG,CAAlB,CACA,KAAMC,CAAAA,mBAAN,QAAkCC,CAAAA,SAAU,CAC3CC,WAAW,CAACC,EAAD,CAAK,CACf,MAAMA,EAAN,EACA,KAAKC,YAAL,CAAoB,KAAKC,KAAL,CAAW,oBAAX,CAApB,CACA,KAAKC,cAAL,CAAsB,KAAKD,KAAL,CAAW,qBAAX,CAAtB,CACA,KAAKE,UAAL,CAAkB,IAAlB,CACA,KAAKC,YAAL,CAAoB,IAApB,CACA,KAAKC,gBAAL,CAAwB,CACvBC,aAAa,CAAE,CADQ,CAEvBC,UAAU,CAAE,CACXC,MAAM,CAAE,2BADG,CAEXC,MAAM,CAAE,2BAFG,CAFW,CAMvBC,IAAI,CAAE,CACLC,YAAY,CAAE,IADT,CAELC,YAAY,CAAE,MAFT,CANiB,CAUvBC,aAAa,CAAE,IAVQ,CAAxB,CAYA,KAAKC,IAAL,CAAY,EAAZ,CACAnB,SAAS,CAACoB,OAAV,CAAkBC,IAAI,EAAI,CACzB,KAAKF,IAAL,CAAUE,IAAV,EAAkB,KAAKf,KAAL,CAAW,OAASe,IAApB,CAClB,CA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CACpB,GAAI,KAAK5B,IAAL,CAAU4B,GAAV,CAAJ,CAAoB,CAChB,KAAK5B,IAAL,CAAU4B,GAAV,EAAeF,SAAf,CAAyBG,MAAzB,CAAgC,UAAhC,CACH,CACJ,CAJL,CAMH,CACP,CAEDC,gBAAgB,CAACP,OAAD,CAAU,CACzB,KAAKE,UAAL,CAAgBF,OAAhB,EACA,KAAKT,gBAAL,CAAsBS,OAAtB,CACA,CAEDpB,IAAI,EAAG,CACN,KAAKf,cAAL,EAAuB,KAAKkB,oBAAL,EAAvB,CACA,KAAKpB,YAAL,EAAqB,KAAKkB,mBAAL,EAArB,CACA2B,QAAQ,CAACC,WAAT,GAAuBC,gBAAvB,CAAwC,uBAAxC,CAAiEC,CAAC,EAAI,KAAKJ,gBAAL,CAAsBI,CAAC,CAACC,MAAxB,CAAtE,CACA,CA9E0C","sourcesContent":["const tagsNames = ['tagRecommended', 'discounted', 'tagNew', 'tagSale', 'tagUsed', 'tagAction', 'tagFreeStorePickup', 'tagFreeDelivery'];\r\nclass ProductDetailImages extends Component {\r\n\tconstructor(el) {\r\n\t\tsuper(el);\r\n\t\tthis.mainSwiperEl = this.$find('[data-swiper-main]');\r\n\t\tthis.thumbsSwiperEl = this.$find('[data-swiper-thumb]');\r\n\t\tthis.mainSwiper = null;\r\n\t\tthis.thumbsSwiper = null;\r\n\t\tthis.mainSwiperConfig = {\r\n\t\t\tslidesPerView: 1,\r\n\t\t\tnavigation: {\r\n\t\t\t\tnextEl: '.ProductDetailImages-next',\r\n\t\t\t\tprevEl: '.ProductDetailImages-prev'\r\n\t\t\t},\r\n\t\t\tlazy: {\r\n\t\t\t\tloadPrevNext: true,\r\n\t\t\t\telementClass: 'lazy'\r\n\t\t\t},\r\n\t\t\twatchOverflow: true\r\n\t\t};\r\n\t\tthis.tags = {};\r\n\t\ttagsNames.forEach(name => {\r\n\t\t\tthis.tags[name] = this.$find('.is-' + name);\r\n\t\t});\r\n\t\tthis.init();\r\n\t}\r\n\r\n\tconstructMainSwiper() {\r\n\t\tthis.mainSwiper = new Swiper(this.mainSwiperEl, this.mainSwiperConfig);\r\n\t}\r\n\r\n\tconstructThumbSwiper() {\r\n\t\tthis.thumbsSwiper = new Swiper(this.thumbsSwiperEl, {\r\n\t\t\tspaceBetween: 10,\r\n\t\t\tslidesPerView: 3,\r\n\t\t\tfreeMode: true,\r\n\t\t\twatchSlidesVisibility: true,\r\n\t\t\twatchSlidesProgress: true,\r\n\t\t\tbreakpoints: {\r\n\t\t\t\t500: {\r\n\t\t\t\t\tslidesPerView: 4,\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t});\r\n\t\tthis.mainSwiperConfig.thumbs = {\r\n\t\t\tswiper: this.thumbsSwiper\r\n\t\t}\r\n\t}\r\n\r\n\tgoToVariantImage({id}) {\r\n\t\tconst slideIndex = Array.from(this.mainSwiper.slides).findIndex(slide => +slide.dataset.variant === +id);\r\n\t\tthis.mainSwiper.slideTo(slideIndex === -1 ? 0 : slideIndex);\r\n\t}\r\n\r\n\tupdateTags(variant) {\r\n\t\ttagsNames.forEach(name => {\r\n\t\t\tif (this.tags[name]) {\r\n\t\t\t\tthis.tags[name].classList.add('u-hidden');\r\n\t\t\t}\r\n\t\t});\r\n\t\tif (variant.tags) {\r\n variant.tags.forEach(tag => {\r\n if (this.tags[tag]) {\r\n this.tags[tag].classList.remove('u-hidden');\r\n }\r\n }\r\n );\r\n }\r\n\t}\r\n\r\n\tonVariantChanged(variant) {\r\n\t\tthis.updateTags(variant);\r\n\t\tthis.goToVariantImage(variant);\r\n\t}\r\n\r\n\tinit() {\r\n\t\tthis.thumbsSwiperEl && this.constructThumbSwiper();\r\n\t\tthis.mainSwiperEl && this.constructMainSwiper();\r\n\t\tEventBus.getInstance().addEventListener('productVariantChanged', e => this.onVariantChanged(e.detail));\r\n\t}\r\n}\r\n"],"file":"product-detail-images.min.js"}