{"version":3,"file":"7580.257130c17dff4ef70d01.js","mappings":"wLAIA,MAEaA,EAAe,CACxBC,kBAH4BC,OAAOC,WAAW,oCAGHC,SAGlCC,EAAW,CACpBC,GAAI,EACJC,GAAI,EACJC,MAAQC,IACJJ,EAASC,GAAKG,CAAG,EAErBC,MAAQD,IACJJ,EAASE,GAAKE,CAAG,GAIZE,EAAiB,CAC1BC,cAAc,EACdC,gBAAkBC,IACdH,EAAeC,aAAeE,CAAI,EAEtCC,eAAe,EACfC,iBAAmBF,IACfH,EAAeI,cAAgBD,CAAI,GAI9BG,EAAe,CACxBC,QAAQ,EACRC,UAAYL,IACRG,EAAaC,OAASJ,CAAI,E,kEC3BlC,MAAMM,EAAiB,GACvB,IAAI,IAAIC,EAAI,EAAGA,GAAK,EAAGA,GAAK,IAAKD,EAAeE,KAAKD,GAErD,MAAME,EAEFC,WAAAA,CAAYC,EAAIC,GACT1B,EAAAA,GAAaC,kBACZwB,EAAGE,UAAUC,OAAO,cAEpBC,KAAKJ,GAAKA,EACVI,KAAKC,QAAUD,KAAKJ,GAAGM,cAAc,4BACrCF,KAAKH,MAAQA,EACbG,KAAKG,SAAW,IAAIC,sBAAsBC,IACtCA,EAAQC,SAASC,IACVA,EAAMC,gBAAgBR,KAAKS,OAAOF,EAAM,GAC7C,GACJ,CAACG,UAAWnB,IAEdoB,YAAW,KACPX,KAAKG,SAASS,QAAQZ,KAAKJ,GAAG,GAChC,KAEV,CAEAa,MAAAA,CAAOF,GACH,MAAMM,EAAQN,EAAMO,kBAChBC,EAAKR,EAAMS,kBACZH,EAAQ,IAAME,EAAGE,QAAgC,GAArB5C,OAAO6C,eAClClB,KAAKC,QAAQH,UAAUqB,IAAI,WAC3BnB,KAAKG,SAASiB,UAAUpB,KAAKJ,IAErC,EAKG,SAASyB,EAAWC,GACvBA,EAAShB,SAASiB,IAEQ,IAAlBA,EAAKC,UACL,IAAI9B,EAAS6B,EACjB,GAER,C","sources":["webpack://National Motor Museum Trust/./wwwroot/app/src/js/global.js","webpack://National Motor Museum Trust/./wwwroot/app/src/modules/bg-curves/bg-curves.js"],"sourcesContent":["// ***********************************\r\n// ***** global site variables *****\r\n// ***********************************\r\n\r\nconst detectReducedMotionPref = window.matchMedia('(prefers-reduced-motion: reduce)');\r\n\r\nexport const siteSettings = {\r\n reducedMotionPref: detectReducedMotionPref.matches\r\n}\r\n\r\nexport const viewport = {\r\n vw: 0,\r\n vh: 0,\r\n setVw: (val) => {\r\n viewport.vw = val;\r\n },\r\n setVh: (val) => {\r\n viewport.vh = val;\r\n }\r\n}\r\n\r\nexport const mainNavigation = {\r\n mobileActive: false,\r\n setMobileActive: (mode) => {\r\n mainNavigation.mobileActive = mode;\r\n },\r\n desktopActive: false,\r\n setDesktopActive: (mode) => {\r\n mainNavigation.desktopActive = mode;\r\n }\r\n};\r\n\r\nexport const headerSearch = {\r\n active: false,\r\n setActive: (mode) => {\r\n headerSearch.active = mode;\r\n }\r\n};","// *************************************\r\n// ************* BG Curves *************\r\n// *************************************\r\n\r\nimport { siteSettings } from '../../js/global';\r\n\r\nimport './bg-curves.scss';\r\n\r\nconst thresholdArray = [];\r\nfor(let x = 0; x <= 1; x += .05) thresholdArray.push(x);\r\n\r\nclass BgCurves {\r\n\r\n constructor(el, index) {\r\n if(siteSettings.reducedMotionPref) {\r\n el.classList.remove('bg-curves');\r\n } else {\r\n this.el = el;\r\n this.artwork = this.el.querySelector('.bg-curves--decor--inner');\r\n this.index = index;\r\n this.observer = new IntersectionObserver((entries) => {\r\n entries.forEach((entry) => {\r\n if(entry.isIntersecting) this.update(entry);\r\n });\r\n },{threshold: thresholdArray});\r\n // slight delay before observing\r\n setTimeout(() => {\r\n this.observer.observe(this.el);\r\n },200);\r\n }\r\n }\r\n\r\n update(entry) {\r\n const ratio = entry.intersectionRatio,\r\n ir = entry.intersectionRect;\r\n if(ratio > .8 || ir.height >= (window.innerHeight * .5)) {\r\n this.artwork.classList.add('animate');\r\n this.observer.unobserve(this.el);\r\n }\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 BgCurves(node);\r\n }\r\n });\r\n}"],"names":["siteSettings","reducedMotionPref","window","matchMedia","matches","viewport","vw","vh","setVw","val","setVh","mainNavigation","mobileActive","setMobileActive","mode","desktopActive","setDesktopActive","headerSearch","active","setActive","thresholdArray","x","push","BgCurves","constructor","el","index","classList","remove","this","artwork","querySelector","observer","IntersectionObserver","entries","forEach","entry","isIntersecting","update","threshold","setTimeout","observe","ratio","intersectionRatio","ir","intersectionRect","height","innerHeight","add","unobserve","createFrom","wrappers","node","nodeType"],"sourceRoot":""}