{"version":3,"file":"306.min.js?t=1757401264672","mappings":"okBAMe,MAAMA,EAYpBC,WAAAA,CAAYC,GAASC,EAAA,qBA0CLC,IAEXC,KAAKC,gBAAgBC,qBAAqBF,KAAKC,gBAInDD,KAAKC,eAAiBE,uBAAsB,KAE3C,MAAMC,EAAW,GAAHC,OAAMN,EAAMO,OAAOC,MAAK,KAChCC,EAAUT,EAAMO,OAAOG,cAAcC,uBAE3CF,EAAQG,MAAMC,YAAY,aAAcR,GAGb,MAAvBL,EAAMO,OAAOC,OAAwC,QAAvBR,EAAMO,OAAOC,MAC9CC,EAAQK,UAAUC,IAAInB,EAAiBoB,QAAQC,gBAE/CR,EAAQK,UAAUI,OAAOtB,EAAiBoB,QAAQC,eACnD,GACC,IA5DFhB,KAAKH,QAAUA,EACfG,KAAKkB,IAAKrB,aAAO,EAAPA,EAASqB,KAAM,GACzBlB,KAAKmB,SAAWC,EAAAA,EAASC,cAEzBrB,KAAKsB,oBAAsBtB,KAAKmB,SAASG,oBAEzCtB,KAAKuB,WACLvB,KAAKwB,cACN,CAKAD,QAAAA,GACCvB,KAAKyB,eAAiBzB,KAAKH,QAAQ6B,cAClC/B,EAAiBgC,UAAUC,gBAE7B,CAKAJ,YAAAA,GAECxB,KAAKyB,eAAeI,iBAAiB,QAAS7B,KAAK8B,aACpD,CAKAC,YAAAA,GACC/B,KAAKyB,eAAeO,oBAAoB,QAAShC,KAAK8B,aACvD,CAKAG,OAAAA,GACCjC,KAAK+B,cACN,EAuBAjC,EA3EoBH,EAAgB,YACjB,CAClBuC,UAAW,oCACXN,gBAAiB,mDACjB9B,EAJmBH,EAAgB,UAMnB,CAChBqB,eAAgB,0CAChBlB,EARmBH,EAAgB,SAUpB,CAAC,E","sources":["webpack://@hero-digital/masonite/./src/components/modules/ComparisonSlider/ComparisonSlider.js"],"sourcesContent":["import Services from 'services'\n\n/* Comparison Slider Module:\n Please note: Part of the code in this component is based on an article created by Paul Hebert.\n The article can be found here: https://cloudfour.com/thinks/building-an-accessible-image-comparison-web-component/\n*/\nexport default class ComparisonSlider {\n\tstatic SELECTORS = {\n\t\tCOMPONENT: '[data-cmp-is=\"comparison-slider\"]',\n\t\tCLIPPING_SLIDER: '[data-cmp-comparison-slider=\"clipping-slider\"]'\n\t}\n\n\tstatic CLASSES = {\n\t\tSLIDER_BOOKEND: 'mod-comparison-slider__after--bookend'\n\t}\n\n\tstatic VALUES = {}\n\n\tconstructor(element) {\n\t\tthis.element = element // ref to component element\n\t\tthis.id = element?.id || '' // ref to component id\n\t\tthis.services = Services.getInstance()\n\n\t\tthis.EventEmitterService = this.services.EventEmitterService\n\n\t\tthis.cacheDom()\n\t\tthis.attachEvents()\n\t}\n\n\t/**\n\t * Cache the dom refs needed for the component\n\t */\n\tcacheDom() {\n\t\tthis.clippingSlider = this.element.querySelector(\n\t\t\tComparisonSlider.SELECTORS.CLIPPING_SLIDER\n\t\t)\n\t}\n\n\t/**\n\t * Attach component event listeners\n\t */\n\tattachEvents() {\n\t\t// Listen for the input being dragged\n\t\tthis.clippingSlider.addEventListener('input', this.slideHandler)\n\t}\n\n\t/**\n\t * Detach component event listeners\n\t */\n\tdetachEvents() {\n\t\tthis.clippingSlider.removeEventListener('input', this.slideHandler)\n\t}\n\n\t/**\n\t * Destroy the carousel instance and remove event listeners\n\t */\n\tdestroy() {\n\t\tthis.detachEvents()\n\t}\n\n\tslideHandler = (event) => {\n\t\t// If an animation frame is already queued up, cancel it\n\t\tif (this.animationFrame) cancelAnimationFrame(this.animationFrame)\n\n\t\t// Store an animation frame so we can keep track of scheduled\n\t\t// repaints and cancel old repaints that haven't happened yet\n\t\tthis.animationFrame = requestAnimationFrame(() => {\n\t\t\t// Grab the input's value\n\t\t\tconst newValue = `${event.target.value}%`\n\t\t\tconst afterEl = event.target.parentElement.previousElementSibling\n\t\t\t// Use it to set our custom property on the clipped (after) image\n\t\t\tafterEl.style.setProperty('--exposure', newValue)\n\n\t\t\t// hide the divider line when slider is at 0 or 100\n\t\t\tif (event.target.value === '0' || event.target.value === '100') {\n\t\t\t\tafterEl.classList.add(ComparisonSlider.CLASSES.SLIDER_BOOKEND)\n\t\t\t} else {\n\t\t\t\tafterEl.classList.remove(ComparisonSlider.CLASSES.SLIDER_BOOKEND)\n\t\t\t}\n\t\t})\n\t}\n}\n"],"names":["ComparisonSlider","constructor","element","_defineProperty","event","this","animationFrame","cancelAnimationFrame","requestAnimationFrame","newValue","concat","target","value","afterEl","parentElement","previousElementSibling","style","setProperty","classList","add","CLASSES","SLIDER_BOOKEND","remove","id","services","Services","getInstance","EventEmitterService","cacheDom","attachEvents","clippingSlider","querySelector","SELECTORS","CLIPPING_SLIDER","addEventListener","slideHandler","detachEvents","removeEventListener","destroy","COMPONENT"],"sourceRoot":""}