!function(e){if("object"==typeof module&&"object"==typeof module.exports){var t=e(require,exports);void 0!==t&&(module.exports=t)}else"function"==typeof define&&define.amd&&define(["require","exports","jquery"],e)}(function(l,e){function r(e,t){if(!function(e){return Array.isArray?Array.isArray(e):e&&"[object Array]"===Object.prototype.toString.call(e)}(e))throw new TypeError("forEach called on a non-array type value. The given value is "+typeof e);for(var i,n=e.length-1;0<=n&&("boolean"!=typeof(i=t.call(e,e[n],n,e))||i);n--);}function t(e,t){void 0===e&&(e=.5),void 0===t&&(t=250),this._intersectionObserver=null,this.threshold=e,this.scrollwait=t,this._viewport=null,this._obsEl=[],this._intersected=[],this._scrolltimer=null,this._GetViewportSize(),this._OnScroll=this._OnScroll.bind(this),this._OnResize=this._OnResize.bind(this);var i=!1;try{var n=Object.defineProperty({},"passive",{get:function(){i=!0}});window.addEventListener("test",n,n),window.removeEventListener("test",n,n)}catch(e){i=!1}window.addEventListener("scroll",this._OnScroll,!!i&&{passive:!0}),window.addEventListener("resize",this._OnResize)}return t.prototype._OnScroll=function(){var t=this;clearTimeout(t._scrolltimer),t._scrolltimer=setTimeout(function(){t._intersectionObserver?(r(t._intersected,function(i){var n;r(t._obsEl,function(e,t){if(e.el==i)return n=t,!1});var e=t._obsEl[n];e&&(e.handler(),t._obsEl.splice(n,1),t._intersectionObserver.unobserve(i))}),t._intersected=[]):t.CheckInView()},t.scrollwait)},t.prototype._OnResize=function(){var e=this;requestAnimationFrame(function(){e._GetViewportSize(),e._intersectionObserver||e.CheckInView()})},t.prototype.Destroy=function(){this._intersected=null,this._obsEl=null,this._obs=null,window.removeEventListener("scroll",this._OnScroll),window.removeEventListener("resize",this._OnResize)},t.prototype.Observe=function(i,e){var t=this,n=-1;r(this._obsEl,function(e,t){if(e.el==i)return n=t,!1}),n<0?(this._obsEl.push({el:i,handler:e}),n=this._obsEl.length-1):this._obsEl[n].handler=e,requestAnimationFrame(function(){t._InViewport(i)?(t._obsEl.splice(n,1),t._intersectionObserver&&t._intersectionObserver.unobserve(i),e()):t._intersectionObserver&&(t._intersectionObserver.unobserve(i),t._intersectionObserver.observe(i))})},t.prototype.Unobserve=function(i){var n;r(this._obsEl,function(e,t){if(e.el==i)return n=t,!1}),-1<n&&(this._obsEl.splice(n,1),this._intersectionObserver&&this._intersectionObserver.unobserve(i))},t.prototype._GetViewportSize=function(){var e=window;null!=e.innerWidth&&(this._viewport={w:e.innerWidth,h:e.innerHeight})},t.prototype._InViewport=function(e){if(!this._viewport)return!1;var t=e instanceof Element?e.getBoundingClientRect():e.boundingClientRect,i=t.height||t.bottom-t.top,n=t.width||t.right-t.left;return!(!i||!n)&&!(t.top+t.height*this.threshold>this._viewport.h||t.bottom<0)},t.prototype.CheckForIntersection=function(e){this._intersected=[];for(var t=0,i=e.length;t<i;t++){var n=e[t],r=e[t].target;!n.isIntersecting&&(null!=(o=n.isIntersecting)&&void 0!==o||!this._InViewport(n))||this._intersected.push(r)}var o},t.prototype.CheckInView=function(){var i=this,n=[];this._obsEl&&r(this._obsEl,function(e,t){i._InViewport(e.el)?e.handler():n.push(e)}),this._obsEl=n},t.prototype.PixelObserve=function(t,o,s){l(["cookie-helper","jquery"],function(i){var e=l("jquery"),n=e.fn.Uniqid(),r=e.fn.Uniqid();this.Observe(t,function(){e.get("/pixel.png",Object.assign({adview_id:n,adview_offer_type:o,adview_page:window.location.pathname},s))}),e(t).on("click",function(){if("Personal_Loan_PQ_Button"==o){var t=JSON.stringify({view:n,click:r,type:o,adview_page:window.location.pathname});try{window.sessionStorage.setItem("mw_prequal_start",t)}catch(e){i.create("mw_prequal_start",t,0)}}e.get("/pixel.png",Object.assign({adview_id:n,adview_offer_type:o,adview_page:window.location.pathname,adview_click:r},s))})})},t});