{"version":3,"file":"2836.6c6ef595e5a31118cc26.js","mappings":"0dAGA,IAAIA,GAAkB,EACtB,IACE,IAAIC,EAAOC,OAAOC,eAAe,CAAC,EAAG,UAAW,CAC9CC,IAAK,WACHJ,GAAkB,CACnB,IAEHK,OAAOC,iBAAiB,cAAe,KAAML,GAC7CI,OAAOE,oBAAoB,cAAe,KAAMN,EACpC,CAAZ,MAAOO,GAAK,C,IAERC,EAAAA,GAEF,WAAYC,GAAI,Y,4FAAA,SACZC,KAAKD,GAAKA,EACVC,KAAKC,UAAY,GACjBD,KAAKE,WAAaA,EAAAA,GAAAA,oBAA+BF,KAAKD,IACtDC,KAAKG,YAAc,KACnBH,KAAKD,GAAGJ,iBAAiB,cAAc,SAACE,GACpC,GAAwB,GAApBA,EAAEO,QAAQC,OAAa,CACvB,IAAIC,EAAQT,EAAEO,QAAQ,GACtB,EAAKD,YAAcG,EAAMC,KAC5B,CACJ,KAAElB,GAAkB,CAAEmB,SAAS,IAChCR,KAAKD,GAAGJ,iBAAiB,aAAa,SAACE,GACnC,GAAwB,MAApB,EAAKM,YAAqB,CAC1B,IAAIM,EAAgBZ,EAAEa,eAAe,GAAGH,MACnCE,EAAgB,EAAKN,YAAe,EAAKF,WAC1C,EAAKE,YAAc,KACnB,EAAKD,WAAWS,QACR,EAAKR,YAAcM,EAAiB,EAAKR,YACjD,EAAKE,YAAc,KACnB,EAAKD,WAAWU,OAEvB,CACJ,KAAEvB,GAAkB,CAAEmB,SAAS,IAChCR,KAAKD,GAAGJ,iBAAiB,YAAY,WACjC,EAAKQ,YAAc,IACtB,KAAEd,GAAkB,CAAEmB,SAAS,GACnC,IAKE,SAASK,EAAWC,GACvBA,EAASC,SAAQ,SAACC,GAEQ,IAAlBA,EAAKC,UACL,IAAInB,EAAckB,EAEzB,GACJ,C","sources":["webpack://nationalspacecentre.web/./wwwroot/app/src/js/bootstrap-carousel-swipe.js"],"sourcesContent":["import { Carousel as bsCarousel } from 'bootstrap';\r\n\r\n// Test via a getter in the options object to see if the passive property is accessed\r\nvar supportsPassive = false;\r\ntry {\r\n var opts = Object.defineProperty({}, 'passive', {\r\n get: function() {\r\n supportsPassive = true;\r\n }\r\n });\r\n window.addEventListener(\"testPassive\", null, opts);\r\n window.removeEventListener(\"testPassive\", null, opts);\r\n} catch (e) {}\r\n\r\nclass CarouselSwipe {\r\n\r\n constructor(el) {\r\n this.el = el;\r\n this.threshold = 60;\r\n this.bsCarousel = bsCarousel.getOrCreateInstance(this.el);\r\n this.touchStartX = null;\r\n this.el.addEventListener('touchstart', (e) => {\r\n if (e.touches.length == 1) {\r\n let touch = e.touches[0];\r\n this.touchStartX = touch.pageX;\r\n }\r\n }, supportsPassive ? { passive: true } : false);\r\n this.el.addEventListener('touchmove', (e) => {\r\n if (this.touchStartX != null) {\r\n let touchCurrentX = e.changedTouches[0].pageX;\r\n if ((touchCurrentX - this.touchStartX) > this.threshold) {\r\n this.touchStartX = null;\r\n this.bsCarousel.prev();\r\n } else if ((this.touchStartX - touchCurrentX) > this.threshold) {\r\n this.touchStartX = null;\r\n this.bsCarousel.next();\r\n }\r\n }\r\n }, supportsPassive ? { passive: true } : false);\r\n this.el.addEventListener('touchend', () => {\r\n this.touchStartX = null;\r\n }, supportsPassive ? { passive: true } : false);\r\n }\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 CarouselSwipe(node);\r\n }\r\n });\r\n}"],"names":["supportsPassive","opts","Object","defineProperty","get","window","addEventListener","removeEventListener","e","CarouselSwipe","el","this","threshold","bsCarousel","touchStartX","touches","length","touch","pageX","passive","touchCurrentX","changedTouches","prev","next","createFrom","wrappers","forEach","node","nodeType"],"sourceRoot":""}