!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?module.exports=n():"function"==typeof define&&define.amd?define(n):e.vhCheck=n()}(this,function(){"use strict";var r=function(){return(r=Object.assign||function(e){for(var n,t=1,o=arguments.length;t<o;t++)for(var r in n=arguments[t])Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r]);return e}).apply(this,arguments)};function n(){var e,n,t=((e=document.createElement("div")).style.cssText="position: fixed; top: 0; height: 100vh; pointer-events: none;",document.documentElement.insertBefore(e,document.documentElement.firstChild),e),o=window.innerHeight,r=t.offsetHeight,i=r-o;return n=t,document.documentElement.removeChild(n),{vh:r,windowHeight:o,offset:i,isNeeded:0!==i,value:0}}function i(){}function e(){var e=n();return e.value=e.offset,e}var c=Object.freeze({noop:i,computeDifference:e,redefineVhUnit:function(){var e=n();return e.value=.01*e.windowHeight,e}});function u(e){return"string"==typeof e&&0<e.length}var a=Object.freeze({cssVarName:"vh-offset",redefineVh:!1,method:e,force:!1,bind:!0,updateOnTouch:!1,onUpdate:i});var t=!1,o=[];try{var f=Object.defineProperty({},"passive",{get:function(){t=!0}});window.addEventListener("test",f,f),window.removeEventListener("test",f,f)}catch(e){t=!1}function d(e,n){o.push({eventName:e,callback:n}),window.addEventListener(e,n,!!t&&{passive:!0})}function s(){o.forEach(function(e){window.removeEventListener(e.eventName,e.callback)}),o=[]}function m(e,n){document.documentElement.style.setProperty("--"+e,n.value+"px")}function h(e,n){return r({},e,{unbind:s,recompute:n.method})}return function(e){var n=Object.freeze(function(e){if(u(e))return r({},a,{cssVarName:e});if("object"!=typeof e)return a;var n,t={force:!0===e.force,bind:!1!==e.bind,updateOnTouch:!0===e.updateOnTouch,onUpdate:(n=e.onUpdate,"function"==typeof n?e.onUpdate:i)},o=!0===e.redefineVh;return t.method=c[o?"redefineVhUnit":"computeDifference"],t.cssVarName=u(e.cssVarName)?e.cssVarName:o?"vh":a.cssVarName,t}(e)),t=h(n.method(),n);if(!t.isNeeded&&!n.force)return t;if(m(n.cssVarName,t),n.onUpdate(t),!n.bind)return t;function o(){window.requestAnimationFrame(function(){var e=n.method();m(n.cssVarName,e),n.onUpdate(h(e,n))})}return t.unbind(),d("orientationchange",o),n.updateOnTouch&&d("touchmove",o),t}});
