{"version":3,"sources":["webpack:///./src/js/modules/mastheadForm.js"],"names":["Module","this","dom","requestInfo","el","querySelector","requestInfoForm","formCloseCTA","formOpen","window","addEventListener","handleResize","handleClick","document","disableTouchScroll","passive","e","preventDefault","stopPropagation","classList","toggle","scrollIntoView","behavior","isDesktop","matchMedia","matches","remove","add","Component"],"mappings":"qYAAA,Q,EACA,QACA,O,EACA,QACA,O,wTAEMA,E,ieAEFC,KAAKC,IAAM,CACTC,YAAaF,KAAKG,GAAGC,cAAc,mBACnCC,gBAAiBL,KAAKG,GAAGC,cAAc,mBACvCE,aAAcN,KAAKG,GAAGC,cAAc,8BAEtCJ,KAAKO,UAAW,I,qCAIhBC,OAAOC,iBAAiB,OAAUT,KAAKU,aAAvC,KAAkCV,OAClCQ,OAAOC,iBAAiB,SAAYT,KAAKU,aAAzC,KAAoCV,OACpCA,KAAKC,IAAIC,YAAYO,iBAAiB,QAAWT,KAAKW,YAAtD,KAAiDX,OACjDA,KAAKC,IAAIK,aAAaG,iBAAiB,QAAWT,KAAKW,YAAvD,KAAkDX,OAClDY,SAASH,iBAAiB,YAAeT,KAAKa,mBAA9C,KAAyCb,MAAyB,CAAEc,SAAS,IAC7EF,SAASH,iBAAiB,QAAWT,KAAKa,mBAA1C,KAAqCb,MAAyB,CAAEc,SAAS,M,yCAGxDC,GACbf,KAAKO,WACPQ,EAAEC,iBACFD,EAAEE,qB,kCAIMF,GACVf,KAAKC,IAAII,gBAAgBa,UAAUC,OAAO,wBAC1CnB,KAAKC,IAAII,gBAAgBe,eAAe,CAAEC,SAAU,WACpDrB,KAAKO,UAAYP,KAAKO,W,qCAItBP,KAAKsB,UAAYd,OAAOe,WAAW,uBAAuBC,QACrDxB,KAAKsB,WAIRtB,KAAKC,IAAII,gBAAgBa,UAAUO,OAAO,wBAC1CzB,KAAKO,UAAW,IAJhBP,KAAKC,IAAII,gBAAgBa,UAAUQ,IAAI,wBACvC1B,KAAKO,UAAW,O,GApCDoB,a,UA6CN5B","file":"62.690598157a37a7a3509b.js","sourcesContent":["import { Component } from '@verndale/core';\nimport debounce from 'lodash/debounce';\nimport { sendValuesToZaiusAndBoxever } from '../helpers/ZaiusBoxeverEvents';\nimport validate from 'validate.js';\nimport { waitForElm } from '../helpers';\n\nclass Module extends Component {\n  setupDefaults() {\n    this.dom = {\n      requestInfo: this.el.querySelector('.masthead__ctas'),\n      requestInfoForm: this.el.querySelector('.masthead__form'),\n      formCloseCTA: this.el.querySelector('#masthead__form-close-cta')\n    };\n    this.formOpen = false;\n  }\n\n  addListeners() {\n    window.addEventListener('load', ::this.handleResize);\n    window.addEventListener('resize', ::this.handleResize);\n    this.dom.requestInfo.addEventListener('click', ::this.handleClick);\n    this.dom.formCloseCTA.addEventListener('click', ::this.handleClick);\n    document.addEventListener('touchmove', ::this.disableTouchScroll, { passive: false });\n    document.addEventListener('wheel', ::this.disableTouchScroll, { passive: false });\n  }\n\n  disableTouchScroll(e){\n    if (this.formOpen){\n      e.preventDefault();\n      e.stopPropagation();\n    }\n  }\n\n  handleClick(e) {\n    this.dom.requestInfoForm.classList.toggle('masthead__form-close');\n    this.dom.requestInfoForm.scrollIntoView({ behavior: 'smooth' });\n    this.formOpen = !this.formOpen;\n  }\n\n  handleResize(){\n    this.isDesktop = window.matchMedia('(min-width: 1025px)').matches;\n    if (!this.isDesktop) {\n      this.dom.requestInfoForm.classList.add('masthead__form-close');\n      this.formOpen = false;\n    } else {\n      this.dom.requestInfoForm.classList.remove('masthead__form-close');\n      this.formOpen = false;\n    }\n  }\n\n}\n\nexport default Module;\n"],"sourceRoot":""}