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AAC,EAAEA,CAAC,GAAG,IAAI,CAACxB,WAAW,EAAEwB,CAAC,EAAE,EAAE,IAAI,CAAC3B,KAAK,CAAC2B,CAAC,CAAC,CAACL,SAAS,CAACQ,MAAM,CAAC,aAAa,CAAC;IAC3F;EAAC;AAAA,KAGL;AACO,SAASG,UAAUA,CAACC,QAAQ,EAAE;EACjCA,QAAQ,CAACC,OAAO,CAAC,UAACC,IAAI,EAAK;IACvB;IACA,IAAIA,IAAI,CAACC,QAAQ,KAAK,CAAC,EAAE;MACrB,IAAI9C,YAAY,CAAC6C,IAAI,CAAC;IAC1B;EACJ,CAAC,CAAC;AACN","sources":["webpack://WebpackConfig.Web/./app/src/js/list-carousel.js"],"sourcesContent":["import { ResizeObserver as Polyfill } from '@juggle/resize-observer';\r\nconst ResizeObserver = window.ResizeObserver || Polyfill;\r\n\r\nclass ListCarousel {\r\n\r\n constructor(el) {\r\n this.el = el;\r\n this.widthLimit = el.dataset.crossfadeBelow !== '' ? parseInt(el.dataset.crossfadeBelow) : 0;\r\n this.running = false;\r\n this.items = [...el.querySelectorAll('li')];\r\n this.itemsLength = this.items.length;\r\n this.activeIndex = -1;\r\n this.timeout = null;\r\n this.paused = false;\r\n this.resizeRequested = false;\r\n this.resizeTimeout = null;\r\n\r\n if(this.widthLimit > 0) {\r\n\r\n // add resize observer\r\n this.ro = new ResizeObserver(() => {\r\n if(!this.resizeRequested) {\r\n this.resizeRequested = true;\r\n this.resizeTimeout = setTimeout(() => {\r\n this.resize();\r\n this.resizeRequested = false;\r\n this.resizeTimeout = null;\r\n }, 100);\r\n }\r\n });\r\n this.ro.observe(this.el); // Watch dimension changes wrapping element\r\n\r\n }\r\n\r\n // pause carousel on mouseover\r\n this.el.onmouseover = () => {\r\n this.paused = true;\r\n clearTimeout(this.timeout);\r\n }\r\n this.el.onmouseout = () => {\r\n this.paused = false;\r\n if(this.running) {\r\n this.timeout = setTimeout(() => {\r\n this.next();\r\n }, 4000);\r\n }\r\n }\r\n }\r\n\r\n resize() {\r\n this.el.classList.add('carousel-resizing');\r\n window.requestAnimationFrame (() => {\r\n let active = this.el.offsetWidth < this.widthLimit;\r\n for(let x = 0; x < this.itemsLength; x++) {\r\n this.items[x].classList.toggle('fade', active);\r\n this.items[x].removeAttribute('hidden');\r\n }\r\n window.requestAnimationFrame (() => {\r\n this.el.classList.remove('carousel-resizing');\r\n // start / stop\r\n if(active) {\r\n if(!this.running) this.next();\r\n } else {\r\n // turn off and show all list items\r\n if(this.running) this.disable();\r\n }\r\n });\r\n });\r\n }\r\n\r\n next() {\r\n if(!this.paused) {\r\n this.el.classList.add('carousel-active');\r\n this.running = true;\r\n this.activeIndex++;\r\n if(this.activeIndex >= this.itemsLength) this.activeIndex = 0;\r\n for(let x = 0; x < this.itemsLength; x++) this.items[x].classList.toggle('item-active', x == this.activeIndex);\r\n this.timeout = setTimeout(() => {\r\n this.next();\r\n }, 4000);\r\n }\r\n }\r\n\r\n disable() {\r\n clearTimeout(this.timeout);\r\n this.timeout = null;\r\n this.running = false;\r\n this.el.classList.remove('carousel-active');\r\n for(let x = 0; x < this.itemsLength; x++) this.items[x].classList.remove('item-active');\r\n }\r\n}\r\n\r\n// export the default function to create\r\nexport function createFrom(wrappers) {\r\n wrappers.forEach((node) => {\r\n // if node is an element\r\n if (node.nodeType === 1) {\r\n new ListCarousel(node);\r\n }\r\n });\r\n}\r\n"],"names":["ResizeObserver","Polyfill","window","ListCarousel","el","_this","_classCallCheck","widthLimit","dataset","crossfadeBelow","parseInt","running","items","_toConsumableArray","querySelectorAll","itemsLength","length","activeIndex","timeout","paused","resizeRequested","resizeTimeout","ro","setTimeout","resize","observe","onmouseover","clearTimeout","onmouseout","next","_createClass","key","value","_this2","classList","add","requestAnimationFrame","active","offsetWidth","x","toggle","removeAttribute","remove","disable","_this3","createFrom","wrappers","forEach","node","nodeType"],"sourceRoot":""}