{"version":3,"file":"Slider.js","names":["defineDs","Swiper","DOMUtils","swipers","swiperActiveClass","handler","forEach","swiper","shouldInitialize","swiperElements","target","querySelectorAll","$element","style","display","Array","isArray","sw","refresh","settings","classList","add","destroy","undefined","remove","init","window","addEventListener","addSlider","push","prototype","update","scrollbar","updateSize","ready"],"sources":["DanskeSpil/Domain/AvalonComponents/Scripts/Slider.js"],"sourcesContent":["defineDs('DanskeSpil/Domain/AvalonComponents/Scripts/Slider',\r\n ['DanskeSpil/Domain/AvalonComponents/Scripts/Libraries/Swiper',\r\n 'Shared/Framework/Mithril/Scripts/Helpers/DOMUtils'],\r\n function (Swiper, DOMUtils) {\r\n\r\n var swipers = [];\r\n var swiperActiveClass = 'swiper-active';\r\n\r\n /**\r\n * Determine if we should add slider functionality to each or the configurations added\r\n */\r\n var handler = function () {\r\n swipers.forEach(function (swiper) {\r\n\r\n if ((swiper.shouldInitialize && swiper.shouldInitialize())) {\r\n\r\n // Show the scrollbar container element when we have a slider\r\n const swiperElements = swiper.target.querySelectorAll('.swiper-scrollbar, .swiper-pagination');\r\n swiperElements.forEach(($element) => {\r\n $element.style.display = '';\r\n });\r\n\r\n if (swiper.swiper) {\r\n if (Array.isArray(swiper.swiper)) {\r\n swiper.swiper.forEach(function (sw) {\r\n sw.refresh();\r\n });\r\n } else {\r\n swiper.swiper.refresh();\r\n }\r\n } else {\r\n swiper.swiper = new Swiper(swiper.target, swiper.settings);\r\n }\r\n\r\n swiper.target.classList.add(swiperActiveClass);\r\n\r\n } else {\r\n if (swiper.swiper) {\r\n if (Array.isArray(swiper.swiper)) {\r\n swiper.swiper.forEach(function (sw) {\r\n sw.destroy(true, true);\r\n });\r\n } else {\r\n swiper.swiper.destroy(true, true);\r\n }\r\n swiper.swiper = undefined;\r\n\r\n swiper.target.classList.remove(swiperActiveClass);\r\n }\r\n\r\n // Hide the scrollbar container element when we have no slider\r\n const swiperElements = swiper.target.querySelectorAll('.swiper-scrollbar, .swiper-pagination');\r\n swiperElements.forEach(($element) => {\r\n $element.style.display = 'none';\r\n });\r\n }\r\n });\r\n };\r\n\r\n var init = function () {\r\n window.addEventListener('resize', handler, false);\r\n };\r\n\r\n var addSlider = function (swiper) {\r\n if (swiper.target) {\r\n swipers.push(swiper);\r\n handler();\r\n }\r\n };\r\n\r\n Swiper.prototype.refresh = function () {\r\n this.update();\r\n this.scrollbar.updateSize();\r\n };\r\n\r\n DOMUtils.ready(init);\r\n\r\n return {\r\n addSlider: addSlider,\r\n handler: handler\r\n };\r\n });\r\n"],"mappings":"AAAAA,QAAQ,CAAC,mDAAmD,EAC1D,CAAC,6DAA6D,EAC5D,mDAAmD,CAAC,EACtD,UAAUC,MAAM,EAAEC,QAAQ,EAAE;EAE1B,IAAIC,OAAO,GAAG,EAAE;EAChB,IAAIC,iBAAiB,GAAG,eAAe;;EAEvC;AACJ;AACA;EACI,IAAIC,OAAO,GAAG,SAAAA,CAAA,EAAY;IACxBF,OAAO,CAACG,OAAO,CAAC,UAAUC,MAAM,EAAE;MAEhC,IAAKA,MAAM,CAACC,gBAAgB,IAAID,MAAM,CAACC,gBAAgB,CAAC,CAAC,EAAG;QAE1D;QACA,IAAMC,cAAc,GAAGF,MAAM,CAACG,MAAM,CAACC,gBAAgB,CAAC,uCAAuC,CAAC;QAC9FF,cAAc,CAACH,OAAO,CAAEM,QAAQ,IAAK;UACnCA,QAAQ,CAACC,KAAK,CAACC,OAAO,GAAG,EAAE;QAC7B,CAAC,CAAC;QAEF,IAAIP,MAAM,CAACA,MAAM,EAAE;UACjB,IAAIQ,KAAK,CAACC,OAAO,CAACT,MAAM,CAACA,MAAM,CAAC,EAAE;YAChCA,MAAM,CAACA,MAAM,CAACD,OAAO,CAAC,UAAUW,EAAE,EAAE;cAClCA,EAAE,CAACC,OAAO,CAAC,CAAC;YACd,CAAC,CAAC;UACJ,CAAC,MAAM;YACLX,MAAM,CAACA,MAAM,CAACW,OAAO,CAAC,CAAC;UACzB;QACF,CAAC,MAAM;UACLX,MAAM,CAAC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