{"version":3,"sources":["webpack:///./LeLab.Web/src/js/discover-bikes.entry.js"],"names":["PageComponent","constructor","node","this","image","querySelector","links","querySelectorAll","template","changeHandler","change","bind","forEach","x","addEventListener","replace","dataset","imageUrl","e","target","url","picture","removeChild","newPicture","document","importNode","content","srcset","src","append","destroy","removeEventListener"],"mappings":"4FAAA,kBAqEA,IAAIA,IAAc,kBAnElB,MAEIC,aAAY,KAAEC,IACVC,KAAKD,KAAOA,EACZC,KAAKC,MAAQD,KAAKD,KAAKG,cAAc,0BACrCF,KAAKG,MAAQH,KAAKD,KAAKK,iBAAiB,yCACxCJ,KAAKK,SAAWL,KAAKD,KAAKG,cAAc,YAExCF,KAAKM,cAAgBN,KAAKO,OAAOC,KAAKR,MAEtCA,KAAKG,MAAMM,QAAQC,IACfA,EAAEC,iBAAiB,aAAcX,KAAKM,eACtCI,EAAEC,iBAAiB,UAAWX,KAAKM,iBAGnCN,KAAKG,OAASH,KAAKG,MAAM,IACzBH,KAAKY,QAAQZ,KAAKG,MAAM,GAAGU,QAAQC,UAK3CP,OAAOQ,GACHf,KAAKY,QAAQG,EAAEC,OAAOH,QAAQC,UAGlCF,QAAQK,GACJ,MACMC,EAAUlB,KAAKC,MAAMC,cAAc,wBAEzC,GAAIgB,GAAWA,EAAQL,QAAQC,WAAaG,EACxC,OAOJ,GAJIC,GACAlB,KAAKC,MAAMkB,YAAYD,IAGtBD,EACD,OAGJ,IAAIG,EAAaC,SAASC,WAAWtB,KAAKK,SAASkB,SAAS,GAE5DH,EAAWhB,iBAAiB,oBAAoBK,QAAQC,GAAKA,EAAEG,QAAQC,SAAWJ,EAAEG,QAAQC,SAASF,QAjBzF,QAiBsGK,IAClHG,EAAWhB,iBAAiB,YAAYK,QAAQC,GAAKA,EAAEc,OAASd,EAAEc,OAAOZ,QAlB7D,QAkB0EK,IACtFG,EAAWhB,iBAAiB,SAASK,QAAQC,GAAKA,EAAEe,IAAMf,EAAEe,IAAIb,QAnBpD,QAmBiEK,IAE7EjB,KAAKC,MAAMyB,OAAON,GAClBA,EAAa,KAGjBO,UACI3B,KAAKG,MAAMM,QAAQC,IACfA,EAAEkB,oBAAoB,aAAc5B,KAAKM,eACzCI,EAAEkB,oBAAoB,UAAW5B,KAAKM,wBAGnCN,KAAKD,YACLC,KAAKC,aACLD,KAAKG,aACLH,KAAKK,gBAELL,KAAKM,mB","file":"discover-bikes.js","sourcesContent":["import { PageComponent } from \"barba\"\r\n\r\nclass DiscoverBikes {\r\n\r\n constructor({ node }) {\r\n this.node = node\r\n this.image = this.node.querySelector('.discover-bikes__image')\r\n this.links = this.node.querySelectorAll('.discover-bikes__link[data-image-url]')\r\n this.template = this.node.querySelector('template')\r\n \r\n this.changeHandler = this.change.bind(this)\r\n\r\n this.links.forEach(x => {\r\n x.addEventListener('mouseenter', this.changeHandler)\r\n x.addEventListener('focusin', this.changeHandler)\r\n })\r\n\r\n if (this.links && this.links[0]) {\r\n this.replace(this.links[0].dataset.imageUrl)\r\n }\r\n \r\n }\r\n\r\n change(e) {\r\n this.replace(e.target.dataset.imageUrl)\r\n }\r\n\r\n replace(url) {\r\n const key = \"%URL%\"\r\n const picture = this.image.querySelector('.discover-bikes__pic')\r\n\r\n if (picture && picture.dataset.imageUrl === url) {\r\n return\r\n }\r\n\r\n if (picture) {\r\n this.image.removeChild(picture)\r\n }\r\n\r\n if (!url) {\r\n return\r\n }\r\n\r\n let newPicture = document.importNode(this.template.content, true)\r\n \r\n newPicture.querySelectorAll('[data-image-url]').forEach(x => x.dataset.imageUrl = x.dataset.imageUrl.replace(key, url))\r\n newPicture.querySelectorAll('[srcset]').forEach(x => x.srcset = x.srcset.replace(key, url))\r\n newPicture.querySelectorAll('[src]').forEach(x => x.src = x.src.replace(key, url))\r\n\r\n this.image.append(newPicture)\r\n newPicture = null\r\n }\r\n\r\n destroy() {\r\n this.links.forEach(x => {\r\n x.removeEventListener('mouseenter', this.changeHandler)\r\n x.removeEventListener('focusin', this.changeHandler)\r\n })\r\n\r\n delete this.node\r\n delete this.image\r\n delete this.links\r\n delete this.template\r\n\r\n delete this.changeHandler\r\n }\r\n\r\n}\r\n\r\nnew PageComponent(\".discover-bikes\", DiscoverBikes)"],"sourceRoot":""}