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ckD,EAAAA,IACxB3D,KAAKI,cAAgB8C,EAAGO,KAAKzD,KAAKI,aAAa0C,MAGhD,MAAMc,EAAS,CAACF,EAAYpB,EAASG,GACjCC,GACHkB,EAAOX,KAAKP,GAEbQ,EAAGG,GAAGO,EAAQN,EAAAA,GAAc,CAC3BC,QAAS,EACTC,cAAe,QAEhBN,EAAGJ,MACJ,CACD,CAEArB,OAAAA,EAAQ,OAAEoC,IACT,MAAMC,EAAM9D,KAAKD,GAAGG,cAAc,iBAC5BkC,EAAUpC,KAAKD,GAAGsC,iBACvB,sCAEKjB,EAAYpB,KAAKD,GAAGG,cAAc,eAClC6D,EAAU/D,KAAKD,GAAGG,cAAc,YAChCgD,EAAKC,EAAAA,GAAKC,SAAS,CAAC,GAC1BF,EAAGc,OACFF,EACAR,EAAAA,GACAW,EAAAA,GACAC,EAAAA,IAEGH,GACHb,EAAGO,MAAK,KACPM,EAAQI,UAAUC,OAAO,gBAAgB,IAG3ClB,EAAGmB,cACFjC,EACAkB,EAAAA,GACAW,EAAAA,GACAC,EAAAA,GACAI,EAAAA,IAEGlD,IACH8B,EAAGqB,IAAInD,EAAW,CAAEmC,QAAS,IAC7BL,EAAGmB,cACFjD,EAAUoD,SACVlB,EAAAA,GACA,CAAEC,QAAS,EAAGkB,GAAI,IAClB,CAAElB,QAAS,EAAGkB,EAAG,GACjBH,EAAAA,KAGFpB,EAAGJ,MACJ,EAGD,QCxMA,MAAM4B,EAASC,SAAStC,iBAAiB,eACzC,IAAIqC,GAAQE,SAAQ7E,GAAM,IAAIF,EAAUE,I","sources":["webpack://tombras/./js/classes/HeroBlock.js","webpack://tombras/./js/components/Hero.js"],"sourcesContent":["import { componentAnimationHandler } from \"../animations/AnimationHandler\";\nimport {\n\tDEFAULT_TIME,\n\tSIMPLE_ANIMATION_START,\n\tSIMPLE_ANIMATION_FINISH,\n\tDEFAULT_STAGGER,\n} from \"../animations/config\";\nimport gsap from \"gsap\";\nimport { isMobile, isIE, DESKTOP_SIZE, TABLET_SIZE } from \"../utils\";\nimport { gtmCustomEventPush, EVENTS } from \"../analytics\";\nclass HeroBlock {\n\tconstructor(el) {\n\t\tthis.el = el;\n\t\tthis.hasVideo = !!this.el.querySelector(\".play-video\");\n\n\t\tthis.video = this.el.querySelector(\".video-holder stream\");\n\t\tthis.loopingVideo = this.el.querySelector(\".hero--teaser-video stream\");\n\t\tthis.closeVideo = el.querySelector(\".btn--close\");\n\t\tconsole.log(\"CLOSE VIDEO\", this.closeVideo);\n\t\tthis.videoIsPlaying = false;\n\t\tthis.currentWindowSize = window.innerWidth;\n\n\t\tthis.timeData = {\n\t\t\tuserClickedPlay: null,\n\t\t\tuserClickedClose: null,\n\t\t\ttotalTimeShown: null,\n\t\t};\n\n\t\tif (isMobile() && this.loopingVideo) {\n\t\t\ttry {\n\t\t\t\tthis.loopingVideo.pause();\n\t\t\t} catch (err) {\n\t\t\t\tconsole.log(err);\n\t\t\t}\n\t\t}\n\t\tthis.setupEvents(this.el);\n\t\tcomponentAnimationHandler.add(el);\n\t}\n\n\tsetupEvents(el) {\n\t\tconst playVideo = el.querySelector(\".play-video\");\n\t\tif (this.hasVideo) {\n\t\t\tplayVideo.addEventListener(\"click\", this.handlePlayingVideo.bind(this));\n\t\t\tthis.el\n\t\t\t\t.querySelector(\".btn--close\")\n\t\t\t\t.addEventListener(\"click\", this.handlePausingVideo.bind(this));\n\t\t}\n\t\tthis.el.addEventListener(\"inview\", this.animate.bind(this));\n\n\t}\n\n\t/**\n\t * Handles GTM timing data for clicks\n\t * @param {DateTime | null} start\n\t * @param {DateTime | null} close\n\t */\n\ttimingData(start = null, close = null) {\n\t\tif (start) {\n\t\t\tthis.timeData.userClickedPlay = start;\n\t\t\tthis.timeData.userClickedClose = null;\n\t\t} else {\n\t\t\tthis.timeData.userClickedClose = close;\n\t\t\tthis.timeData.totalTimeShown = close - this.timeData.userFirstSaw;\n\n\t\t\tgtmCustomEventPush({\n\t\t\t\tevent: EVENTS.HERO_VIDEO_TIMING,\n\t\t\t\textraData: this.timeData,\n\t\t\t});\n\t\t}\n\t}\n\n\t/**\n\t * Does all of the\n\t * @param {EventData} e\n\t */\n\thandlePlayingVideo(e) {\n\t\tconsole.log(\"PLAY VIDEO!\", this.videoIsPlaying);\n\t\tconst content = this.el.querySelectorAll(\".content\");\n\t\tconst playBtn = e.currentTarget;\n\t\tconst videoHolder = this.el.querySelector(\".video-holder\");\n\t\tconst heroImage = this.el.querySelector(\".hero--image\");\n\t\tconst submenu = this.el.closest(\".section\").querySelector(\".submenu\");\n\n\t\tif (!this.videoIsPlaying) {\n\t\t\tconsole.log(\"Video is not playing. Begin playing\");\n\t\t\t// set timing data for GTM\n\t\t\tthis.timingData(new Date().getTime());\n\t\t\tthis.videoIsPlaying = true;\n\t\t\tthis.video.play();\n\n\t\t\t// Pause the looping video\n\t\t\tif (this.loopingVideo) {\n\t\t\t\ttry {\n\t\t\t\t\tthis.loopingVideo.pause();\n\t\t\t\t} catch (err) {\n\t\t\t\t\tconsole.log(err);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tconst contentToHide = [playBtn];\n\t\t\tif (window.innerWidth >= TABLET_SIZE) {\n\t\t\t\tcontentToHide.push(content);\n\t\t\t}\n\n\t\t\tif (heroImage) {\n\t\t\t\tcontentToHide.push(heroImage);\n\t\t\t}\n\n\t\t\tif (submenu) {\n\t\t\t\tcontentToHide.push(submenu);\n\t\t\t}\n\n\t\t\tconst tl = gsap.timeline();\n\t\t\ttl.to(contentToHide, DEFAULT_TIME, {\n\t\t\t\topacity: 0,\n\t\t\t\tpointerEvents: \"none\",\n\t\t\t});\n\t\t\tthis.loopingVideo && tl.call(this.loopingVideo.pause);\n\t\t\ttl.call(this.video.play);\n\t\t\ttl.to([videoHolder, this.closeVideo], DEFAULT_TIME, {\n\t\t\t\topacity: 1,\n\t\t\t\tpointerEvents: \"all\",\n\t\t\t});\n\t\t\ttl.play();\n\t\t}\n\t}\n\n\thandlePausingVideo() {\n\t\tconsole.log(\"we are here 135\");\n\t\tif (this.videoIsPlaying) {\n\t\t\tconsole.log(\"Video is playing. Begin stopping the video\");\n\t\t\tthis.videoIsPlaying = false;\n\t\t\tthis.timingData(null, new Date().getTime());\n\t\t\tconst allContent = this.el.querySelectorAll(\".content\");\n\t\t\tconst videoHolder = this.el.querySelector(\".video-holder\");\n\t\t\tconst playBtn = this.el.querySelector(\".play-video\");\n\t\t\tconst heroImage = this.el.querySelector(\".hero--image\");\n\t\t\tconst submenu = this.el.closest(\".section\").querySelector(\".submenu\");\n\n\t\t\tconst tl = gsap.timeline();\n\n\t\t\ttl.to(videoHolder, DEFAULT_TIME, {\n\t\t\t\topacity: 0,\n\t\t\t\tpointerEvents: \"none\",\n\t\t\t});\n\t\t\ttl.call(this.video.pause);\n\t\t\tif (window.innerWidth >= DESKTOP_SIZE) {\n\t\t\t\tthis.loopingVideo && tl.call(this.loopingVideo.play);\n\t\t\t}\n\n\t\t\tconst reshow = [allContent, playBtn, heroImage];\n\t\t\tif (submenu) {\n\t\t\t\treshow.push(submenu);\n\t\t\t}\n\t\t\ttl.to(reshow, DEFAULT_TIME, {\n\t\t\t\topacity: 1,\n\t\t\t\tpointerEvents: \"all\",\n\t\t\t});\n\t\t\ttl.play();\n\t\t}\n\t}\n\n\tanimate({ target }) {\n\t\tconst img = this.el.querySelector(\".image-holder\");\n\t\tconst content = this.el.querySelectorAll(\n\t\t\t\".content, h1, .hero-block--tagline\",\n\t\t);\n\t\tconst playVideo = this.el.querySelector(\".play-video\");\n\t\tconst overlay = this.el.querySelector(\".overlay\");\n\t\tconst tl = gsap.timeline({});\n\t\ttl.fromTo(\n\t\t\timg,\n\t\t\tDEFAULT_TIME,\n\t\t\tSIMPLE_ANIMATION_START,\n\t\t\tSIMPLE_ANIMATION_FINISH,\n\t\t);\n\t\tif (overlay) {\n\t\t\ttl.call(() => {\n\t\t\t\toverlay.classList.remove(\".not-animated\");\n\t\t\t});\n\t\t}\n\t\ttl.staggerFromTo(\n\t\t\tcontent,\n\t\t\tDEFAULT_TIME,\n\t\t\tSIMPLE_ANIMATION_START,\n\t\t\tSIMPLE_ANIMATION_FINISH,\n\t\t\tDEFAULT_STAGGER,\n\t\t);\n\t\tif (playVideo) {\n\t\t\ttl.set(playVideo, { opacity: 1 });\n\t\t\ttl.staggerFromTo(\n\t\t\t\tplayVideo.children,\n\t\t\t\tDEFAULT_TIME,\n\t\t\t\t{ opacity: 0, x: -10 },\n\t\t\t\t{ opacity: 1, x: 0 },\n\t\t\t\tDEFAULT_STAGGER,\n\t\t\t);\n\t\t}\n\t\ttl.play();\n\t}\n}\n\nexport default HeroBlock;\n","import HeroBlock from \"../classes/HeroBlock\";\n\nconst heroes = document.querySelectorAll(\".hero-block\");\n[...heroes].forEach(el => new HeroBlock(el));\n"],"names":["HeroBlock","constructor","el","this","hasVideo","querySelector","video","loopingVideo","closeVideo","videoIsPlaying","currentWindowSize","window","innerWidth","timeData","userClickedPlay","userClickedClose","totalTimeShown","isMobile","pause","err","setupEvents","componentAnimationHandler","add","playVideo","addEventListener","handlePlayingVideo","bind","handlePausingVideo","animate","timingData","start","close","userFirstSaw","gtmCustomEventPush","event","EVENTS","HERO_VIDEO_TIMING","extraData","e","content","querySelectorAll","playBtn","currentTarget","videoHolder","heroImage","submenu","closest","Date","getTime","play","contentToHide","TABLET_SIZE","push","tl","gsap","timeline","to","DEFAULT_TIME","opacity","pointerEvents","call","allContent","DESKTOP_SIZE","reshow","target","img","overlay","fromTo","SIMPLE_ANIMATION_START","SIMPLE_ANIMATION_FINISH","classList","remove","staggerFromTo","DEFAULT_STAGGER","set","children","x","heroes","document","forEach"],"sourceRoot":""}