{"version":3,"file":"home.77fca1.js","mappings":"oFAKA,IAAWA,IAgHRC,OA/GCC,OAAOC,kBAAqB,WACxB,SAASC,IAEL,IAAMC,EAAeC,SAASC,iBAAiB,8BAyD/C,IAWMC,EAAmB,WA5BrBH,EAAaI,SAAQ,SAACC,GAf1B,IAGUC,EACAC,EADAD,EAaeD,EAbAG,wBACfD,EAAWN,SAASQ,gBAEtBH,EAAKI,KAAO,GACZJ,EAAKK,MAAQ,GACbL,EAAKM,SAAWC,OAAOC,aAAeP,EAASQ,cANtB,GAOzBT,EAAKU,QAAUH,OAAOI,YAAcV,EAASW,aARpB,GAgBrBb,EAAUc,UAAUC,IAAI,sBACxBf,EAAUc,UAAUE,OAAO,uBAE3BhB,EAAUc,UAAUE,OAAO,sBAC3BhB,EAAUc,UAAUC,IAAI,qBAEhC,GAsBJ,EAKAzB,EAAEkB,QAAQS,GAAG,eAAe,SAACC,GAEzB,IAAMC,EAAc7B,EAAEkB,QAAQY,QAxB9B9B,EAAE,iBAAiB+B,YAAY,wCA6B3BF,GAAe,KAEf7B,EAAE,8BAA8BgC,IAAI,yBAGpCd,OAAOe,iBAAiB,SAAUzB,KAGlCU,OAAOgB,oBAAoB,SAAU1B,GAhCzCR,EAAE,8BAA8BmC,OAC5B,WACInC,EAAEoC,MAAMC,SAAS,sBAAsBN,YAAY,oBACvD,IACA,WACI/B,EAAEoC,MAAML,YAAY,sBAAsBM,SAAS,oBACvD,IA+BR,GACJ,CACA,MAAO,CACHC,KAAI,WACAlC,GACJ,EAER,CAzG4B,GA4G5BJ,EAAEM,UAAUiC,OAAM,WACdrC,OAAOC,kBAAkBmC,MAC7B,G","sources":["webpack://soyvay-com/./js/src/pages/home.js"],"sourcesContent":["/**\n * home js\n * js functions for the home page\n *\n */\n(function ($) {\n SoyVay.homePageFunctions = (function () {\n function privateInit() {\n // get all promo modules, filter down to only modules without nested modules\n const promoModules = document.querySelectorAll('.promo-module:not(.parent)');\n\n // limit the rate at which a function can fire.\n // https://davidwalsh.name/javascript-debounce-function\n function debounce(func) {\n /* eslint-disable prefer-rest-params */\n const wait = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 20;\n const immediate = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;\n\n let timeout;\n return function () {\n const context = this;\n const args = arguments;\n const later = function later() {\n timeout = null;\n if (!immediate) func.apply(context, args);\n };\n const callNow = immediate && !timeout;\n clearTimeout(timeout);\n timeout = setTimeout(later, wait);\n if (callNow) func.apply(context, args);\n };\n }\n\n // Determine if an element is in the visible viewport\n function isInViewport(element, offsetXIn, offsetYIn) {\n const offsetX = offsetXIn || 0;\n const offsetY = offsetYIn || 0;\n const area = element.getBoundingClientRect();\n const boundary = document.documentElement;\n return (\n area.top >= 0 &&\n area.left >= 0 &&\n area.bottom <= (window.innerHeight || boundary.clientHeight) + offsetY &&\n area.right <= (window.innerWidth || boundary.clientWidth) + offsetX\n );\n }\n\n // loop through each promo module and check where it's at\n function checkPromoVisibility(event) {\n promoModules.forEach((promoUnit) => {\n if (isInViewport(promoUnit, 0, 0)) {\n promoUnit.classList.add('activate-animation');\n promoUnit.classList.remove('reverse-animation');\n } else {\n promoUnit.classList.remove('activate-animation');\n promoUnit.classList.add('reverse-animation');\n }\n });\n }\n\n // reset animation state classes\n function resetPromoModule() {\n $('.promo-module').removeClass('activate-animation reverse-animation');\n }\n\n // make a reference var for each experience type to help with unbinding\n const hoverExperience = function () {\n $('.promo-module:not(.parent)').hover(\n function () {\n $(this).addClass('activate-animation').removeClass('reverse-animation');\n },\n function () {\n $(this).removeClass('activate-animation').addClass('reverse-animation');\n }\n );\n };\n\n const scrollExperience = function () {\n debounce(checkPromoVisibility());\n };\n\n // user resizes window.\n // should get one set of rules for mobile, one set for desktop\n // kill desktop for mobile and vice versa\n $(window).on('load resize', (e) => {\n // cache current window width\n const windowWidth = $(window).width();\n\n // clear out any animation classes on promo modules\n resetPromoModule();\n\n if (windowWidth <= 768) {\n // unbind any hover events that might be left over from a window resize\n $('.promo-module:not(.parent)').off('mouseenter mouseleave');\n\n // do the scroll experience\n window.addEventListener('scroll', scrollExperience);\n } else {\n // unbind scroll events that might be left over from a window resize\n window.removeEventListener('scroll', scrollExperience);\n\n // do the hover experience\n hoverExperience();\n }\n });\n }\n return {\n init() {\n privateInit();\n },\n };\n })();\n\n // document ready\n $(document).ready(() => {\n SoyVay.homePageFunctions.init();\n });\n})(jQuery);\n"],"names":["$","jQuery","SoyVay","homePageFunctions","privateInit","promoModules","document","querySelectorAll","scrollExperience","forEach","promoUnit","area","boundary","getBoundingClientRect","documentElement","top","left","bottom","window","innerHeight","clientHeight","right","innerWidth","clientWidth","classList","add","remove","on","e","windowWidth","width","removeClass","off","addEventListener","removeEventListener","hover","this","addClass","init","ready"],"sourceRoot":""}