"use strict";var OverlayManager=function(a,b){return a&&"object"==typeof a?(this.zones=a[0].promos,this.adfree=String(b)||"false",this.$window=$(window),this.$body=$("body"),this.device=this.deviceSize(),void this.batting()):(this.logging("Data object has not been provided","error"),!1)};OverlayManager.prototype.FRAME_ID="OverlayFrame",OverlayManager.prototype.OVERLAY_ID="OverlayModal",OverlayManager.prototype.OVERLAY_CONTAINER_ID="OverlayContainer",OverlayManager.prototype.setDevice=function(){var a,b=!1,c=["tablet","mobile"],d=c.length;for(a=0;a=768&&(b="tablet"),this.isLandscape=!0):this.isLandscape=!1,a>1024&&(b="desktop"),b},OverlayManager.prototype.batting=function(){var a=this.overlayCheck();return a&&"object"==typeof this.iMatch?(this.setParameters(),this.adFreeCheck()?void(this.cookieStatus()&&(this.setPath(),this.createMask(),this.setupListeners())):void this.logging("Adfree status not matched","warn")):void this.logging("no match provided","warn")},OverlayManager.prototype.overlayCheck=function(){var a,b,c,d=this.zones,e=d.length;for(a=0;a-1)return!0;return!1},OverlayManager.prototype.setCookie=function(){var a,b,c=new Date;return c.setTime(c.getTime()+24*this.options.cookieTime*60*60*1e3),a="expires="+c.toUTCString(),b=this.options.cookieName+"="+this.options.cookieValue+";"+a+";path=/",!!(document.cookie=b)},OverlayManager.prototype.setPath=function(){this.iMatch;!this.iMatch.images&&this.iMatch.customIncludeUrl?this.options.customIncludeUrl=this.iMatch.customIncludeUrl:this.iMatch.images&&(this.options.customIncludeUrl=this.setImage())},OverlayManager.prototype.setImage=function(){var a,b="16x9",c=0,d=this.iMatch.images[0].assets;for("desktop"===this.device||this.isLandscape||(b="1x1"),c;c").attr("id",this.OVERLAY_ID).attr("className","overlayMask").css({position:"fixed",backgroundColor:"rgba("+this.options.backgroundColor+", "+this.options.opacity+")",border:"none",width:"100%",height:"100%",top:"0",left:"0",textAlign:"center",zIndex:2147483654,display:"none"}).append($("
").attr("id",this.OVERLAY_CONTAINER_ID));this.$body.append(a),this.iMatch.images?this.createImage():this.createIframe(),this.options.showClose&&this.createClose(),this.options.relaunch&&this.createRelaunch()},OverlayManager.prototype.createIframe=function(){var a=(parseInt(this.options.width,10),parseInt(this.options.height,10)),b=this.options.height.replace(a,""),c=document.createElement("iframe");c.id=this.FRAME_ID,c.style.width=this.options.width,c.style.height=this.options.height,c.style.backgroundColor="transparent",c.style.position="relative",c.style.border="none",c.style.zIndex=10,c.style.verticalAlign="center",c.allowTransparency="true",c.frameBorder=0,c.scrolling="no",c.src=this.options.customIncludeUrl,"%"===b?c.style.top=(100-a)/2+b:(c.style.top="50%",c.style.marginTop="-"+Math.floor(a/2)+b),this.$body.find("#"+this.OVERLAY_CONTAINER_ID).append(c),this.$body.find("#"+this.OVERLAY_ID).show()},OverlayManager.prototype.createImage=function(){var a=this.options.customIncludeUrl,b=(this.getMaxSize(),document.createElement("img"));this.$body.find("#"+this.FRAME_ID).remove(),$(b).attr("id",this.FRAME_ID).attr("src",a.path).css({backgroundColor:"transparent",border:"none"});var c=$("#"+this.OVERLAY_CONTAINER_ID);c.css({position:"absolute",zIndex:10,width:"85%",height:"auto",top:"50%",left:"50%","-webkit-transform":"translate(-50%, -50%)","-moz-transform":"translate(-50%, -50%)","-ms-transform":"translate(-50%, -50%)","-o-transform":"translate(-50%, -50%)",transform:"translate(-50%, -50%)"}),$(b).css("height","100%"),$(b).css("width","100%"),("desktop"===this.device||"tablet"===this.device&&this.isLandscape)&&c.css("width","80%"),"mobile"===this.device&&this.isLandscape&&c.css("width","66%"),this.positionClose(),this.options.link?this.$body.find("#"+this.OVERLAY_CONTAINER_ID).append($("").attr("id","overlayHref").attr("href",this.options.link).append(b)):this.$body.find("#"+this.OVERLAY_CONTAINER_ID).append(b),this.$body.find("#"+this.OVERLAY_ID).show()},OverlayManager.prototype.positionClose=function(){var a=this.values,b=0,c=0;this.isLandscape?(100!==a.maxHeight&&(b=(a.fullHeight-a.usedHeight)/2,"desktop"===this.device&&(b+=45)),c=(a.usedWidth-a.fullWidth)/2):(100!==a.maxHeight&&(c=(a.usedWidth-a.fullWidth)/2),b=a.fullHeight-a.usedHeight+45)},OverlayManager.prototype.getMaxSize=function(){var a={};return a.maxHeight=parseInt(this.options.height,10),a.fullHeight=this.$window.height(),a.usedHeight=a.fullHeight*(a.maxHeight/100),a.maxWidth=parseInt(this.options.width,10),a.usedWidth=this.$window.width(),a.fullWidth=a.usedWidth*(a.maxWidth/100),this.isLandscape?(a.max=a.maxHeight,a.size=a.usedHeight):(a.max=a.maxWidth,a.size=a.fullWidth),this.values=a,a},OverlayManager.prototype.setupListeners=function(){var a=!0;return this.$body.hasClass("activeOverlay")&&(a=!1),this.$body.toggleClass("activeOverlay",!0),this.$body.find("#"+this.OVERLAY_ID).bind("click",$.proxy(this.backgroundClick,this)),this.$window.bind("overlay.check",$.proxy(this.checkPosition,this)),this.$window.bind("overlay.relaunch",$.proxy(this.relaunch,this)),this.$window.bind("overlay.kill",$.proxy(this.remove,this)),this.$window.bind("orientationchange",$.proxy(this.checkPosition,this)),a},OverlayManager.prototype.backgroundClick=function(a){a.target.id===this.OVERLAY_ID&&this.relaunch()},OverlayManager.prototype.checkPosition=function(){var a=this.isLandscape;this.isLandscape=window.matchMedia("(orientation: landscape)").matches,this.isLandscape!==a&&(this.options.customIncludeUrl=this.setImage(),this.$body.find("#"+this.FRAME_ID).remove(),this.createImage())},OverlayManager.prototype.createClose=function(){var a={width:"45px",height:"45px",color:"white",border:"3px solid white",background:"black","border-radius":"25px","text-decoration":"none",display:"block",font:"48px/.83 Arial","font-weight":"Bold",position:"absolute",right:"-22.5px",top:"-22.5px",zIndex:"99999",cursor:"pointer"};this.$body.find("#"+this.OVERLAY_CONTAINER_ID).append($("
").attr({id:"overlayClose"}).html("×").css(a).bind("click",$.proxy(this.relaunchToggle,this)))},OverlayManager.prototype.createRelaunch=function(){var a={position:"fixed","background-color":"transparent","background-repeat":"no-repeat",border:"none",width:"274px",height:"66px",bottom:"0",left:"2%",zIndex:"1000","text-decoration":"none",display:"none","text-align":"center"};this.$body.append($("").attr({id:"relaunchOverlay",href:"#"}).addClass("relaunchOverlay").text("relaunch").css(a).bind("click",$.proxy(this.relaunchToggle,this)))},OverlayManager.prototype.defaults={cookieTime:1,cookieValue:"true",cookieName:"OverlayCookie",width:"100%",height:"100%",backgroundColor:"0,0,0",opacity:"0.8",adfree:"false",deferCookie:"false",showClose:"false",currentUrl:window.location.href,relaunch:"false"},OverlayManager.prototype.logging=function(a,b){return!!console&&void("object"!=typeof a?"error"===b?console.error("OverlayManager -> "+a):"warn"===b?console.warn("OverlayManager -> "+a):console.log("OverlayManager -> "+a):"error"===b?console.error("OverlayManager Obj-> ",a):"warn"===b?console.warn("OverlayManager Obj-> ",a):console.log("OverlayManager Obj-> ",a))},OverlayManager.prototype.matchCheck=function(a){var b,c,d;if(!a)return!1;for(c=a.length,d=window.location.href,b=0;b