!function(){var e="googima",t="TYPE_API",i="TYPE_SCHEDULE",n="-1",r="jwp",o="jw-flag-ads-googleima",a="jw-flag-ads-vpaid",s="jw-flag-ads-vpaid-controls",d="paused",l="playing",u="adBidRequest",p="adBidResponse",h="adBreakStart",c="adBreakEnd",g="adCompanions",f="adError",m="adStarted",v="adPlay",y=2e3,b=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")},w={adcountercountkey:"__AD_POD_CURRENT__",adcounterdynamic:"Ad __AD_POD_CURRENT__ of __AD_POD_LENGTH__. ",adcountertotalkey:"__AD_POD_LENGTH__",admessage:"This ad will end in xx",admessagedynamickey:"xx",admessagestatic:"This is an Advertisement",advideoheight:0,advideowidth:0,allowadskip:!1,allowadskippastseconds:0,allowplayercontrols:!1,allowvolumeslider:!1,autoplayadsmuted:!1,click_tracking:!0,companiondiv:null,companionResourceType:"",cuetext:"Advertisement",debug:!1,enablePreloading:!1,invertmutebutton:!1,loadVideoTimeout:15e3,locale:"",maxRedirects:-1,overlayslotheight:0,overlayslotwidth:0,premiumAds:!1,requestTimeout:1e4,scaled_ads:!0,usestaticmessage:!1,vpaidcontrols:!1,vpaidmode:"insecure"};function A(e){if("true"===e)return!0;if("false"===e)return!1;var t=parseFloat(e);return isNaN(t)?e:t}function P(e){var t=Object.keys(e).filter(function(t){return"pre"===e[t].offset||!e[t].offset});return t.length?t[0]:null}var E=function(){function e(t,i){for(var n in b(this,e),this.config=t,this.utils=i,w)if(w.hasOwnProperty(n)){var r=t[n],o=w[n],a=typeof o;if(void 0!==r){if("boolean"!==a&&"number"!==a||(r=A(r)),typeof r!==a)throw new Error("invalid parameter: "+n+" should be a "+a);this[n]=r}else this[n]=o}this.admessagedynamic=this.admessage}return e.prototype.getPrerollBlock=function(){var e=this.getConfigSchedule(),t=this.bidsResponse;if("string"==typeof e){if(!t)return e;var i=t.custParams;if(i){var n="jwFANBidPrice="+i.jwFANBidPrice+"&jwFANBidID="+i.jwFANBidID,r=t.tag.indexOf("?")>=0?"&":"?";return""+t.tag+r+n}return t.tag}var o=P(e);if(!o)return null;var a=this.utils.extend({},e[o]);return t&&(a.tag=t.tag,a.custParams=this.utils.extend({},a.custParams,t.custParams)),a},e.prototype.addBidsResponse=function(e){e&&!e.error&&(e.bidWon||e.tag)?this.bidsResponse=e:this.bidsResponse=null},e.prototype.getSchedule=function(){var e=this.utils.extend({},this.getConfigSchedule());if(!this.bidsResponse)return this.getConfigSchedule();var t=this.getPrerollBlock();return"string"==typeof t?t:(e[P(e)]=t,e)},e.prototype.getConfigSchedule=function(){var e=this.config;return e.tag||this.adschedule||e.schedule||e.ad},e.prototype.getAdRules=function(){var e=this.config.rules||{};return{startOn:e.startOn||1,frequency:void 0!==e.frequency?e.frequency:1}},e}(),C=function(){function e(t,i,n){b(this,e);var r=document.createElement("div");this.visible=!1,this.style=n,this.div=t,this.adDiv=r,r.id=i+"_ad",n(t,{overflow:"hidden",width:"100%",height:"100%",display:"block",visibility:"hidden",pointerEvents:"none",opacity:0}),n(r,{position:"absolute",width:"100%",height:"100%"}),t.appendChild(r)}return e.prototype.resizeNonLinear=function(e,t){this.style(this.div,{height:t+"px",top:"auto",width:"100%"})},e.prototype.resizeLinear=function(){this.style(this.div,{top:"0px",left:"0px",width:"100%",height:"100%"})},e.prototype.getAdDiv=function(){return this.adDiv},e.prototype.adSetup=function(){this.visible=!0,this.style(this.div,{visibility:"visible",display:"block",pointerEvents:"all",opacity:1},!0);for(var e=this.adDiv.childNodes,t=0;tu,v={id:d,name:"FAN",bidWon:m,priceCents:a,priceCurrency:f};return m?(v.tag=["https://an.facebook.com/v1/instream/vast.xml?placementid="+d,"&playerwidth="+p,"&playerheight="+h,"&sdk="+q,"&bidid="+s,"&pageurl="+z].join(""),t(v)):t(v)}},a.open("GET",c),a.withCredentials=!0,a.send(null),{id:d,name:"FAN"})}var X={},K=null;function Q(){if(K)return K;if(X.apstag=X.apstag||window.apstag,X.apstag&&X.apstag.init&&X.apstag.fetchBids)return K=Promise.resolve();var e=["//",U];return"file:"===document.location.protocol&&e.unshift("https:"),K=R(e.join(""),B).then(function(){X.apstag=window.apstag})}function Y(e,t){var i=e.bidders.APS;return i.id&&i.slotID?(Q().then(function(){return X.apstag.init({id:i.pubId,adServer:i.adServer}),X.apstag.fetchBids({slots:[{slotID:i.slotID}],timeout:e.settings.bidTimeout},function(n){return n&&n[0]&&n[0].slotID===i.slotID?t({id:i.id,name:"APS",tag:e.tag,custParams:{amznbid:n[0].amznbid,amzniid:n[0].amzniid}}):t({id:i.id,name:"APS",error:!0,message:"No bids for pubID and slotID"})})}).catch(function(){t({id:i.id,name:"APS",error:!0,message:"Amazon header bidding failed"})}),{id:i.id,name:"APS"}):t({id:i.id,name:"APS",error:!0,message:"invalid"})}var Z=null;function $(){if(Z)return Z;if(X.SpotX=X.SpotX||window.SpotX,X.SpotX&&X.SpotX.DirectAdOS)return Z=Promise.resolve();var e,t,i=["//",W];return"file:"===document.location.protocol&&i.unshift("https:"),Z="function"==typeof require?(e=i.join(""),t=B,new Promise(function(i,n){setTimeout(n,t),require([e],i)}).catch(function(){return Promise.reject("Error loading script")})).then(function(e){X.SpotX=e}):R(i.join(""),B).then(function(){X.SpotX=window.SpotX})}function ee(e,t){return{id:e,name:"SpotX",error:!0,message:t}}function te(e,t){var i=e.bidders.SpotX;if(!i||!i.id)return t(ee(i.id,"invalid"));var n=e.settings,r={channel_id:i.id,slot:n.playerContainer,content_width:n.playerWidth,content_height:n.playerHeight};return $().then(function(){var t=new X.SpotX.DirectAdOS(r);return"dfp"===n.mediationLayerAdServer?t.addSpotXParamsToMVT(e.tag):t.getAdServerKVPs()}).then(function(e){if("string"==typeof e)return t({id:i.id,name:"SpotX",tag:e});var r=100*parseFloat(e.spotx_bid),o=e.spotx_ad_key;if(!(r>n.floorPriceCents)){var a="Bid price of "+r+" from SpotX is not greater than floor price of "+n.floorPriceCents;return t(ee(i.id,a))}var s=["//",F,o];return"file:"===document.location.protocol&&s.unshift("https:"),t({id:i.id,name:"SpotX",tag:s.join(""),tagKey:o,priceCents:r})}).catch(function(e){return t(ee(i.id,"SpotX header bidding failed: "+e))}),{id:i.id,name:"SpotX"}}var ie=null;function ne(e){if(ie)return ie;if(X.indexapi=X.indexapi||window.indexapi,X.indexapi)return ie=Promise.resolve();var t=["//",e||V];return"file:"===document.location.protocol&&t.unshift("https:"),ie=R(t.join(""),B).then(function(){X.indexapi=window.indexapi})}function re(e,t){return{id:e,name:"index",error:!0,message:t}}function oe(e,t){var i=D({videoCommonArgs:{protocols:[2,3,5,6],mimes:["video/mp4","video/webm","application/javascript"],apiList:[1,2]}},e.bidders.index);return i.script||i.id||X.indexapi?(setTimeout(function(){t(re(i.id,"Index Exchange header bidding request failed"))},e.settings.bidTimeout),ne().then(function(){var n=function(n,r){if(void 0!==r)return t({id:i.id,name:"index",tag:e.tag,custParams:r});t(re(i.id,"Index Exchange header bidding request failed"))};X.indexapi=X.indexapi||{},X.indexapi.deferQueue=X.indexapi.deferQueue||[],X.indexapi.deferQueue.push(function(){X.indexapi.solicitIndexVideoAds(e.tag,n,i)})}).catch(function(){t(re(i.id,"Index Exchange header bidding failed"))}),{id:i.id,name:"index"}):t(re(i.id,"invalid"))}var ae=function(e){return!(e.error&&"invalid"===e.message)};function se(e){var t={SpotX:{},FAN:{},APS:{}};return e.length?(G.forEach(function(i){var n=function(e,t){if(!e||"function"!=typeof t)return null;for(var i=Object(e),n=i.length,r=0;r0&&void 0!==arguments[0]?arguments[0]:{settings:{},bidders:[]},n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,o=this,a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,s=arguments[4];b(this,e),this.tag=n,this.settings=(t=i.settings,D({bidTimeout:O,playerWidth:r,playerHeight:a,playerContainer:s},t)),this.bidders=se(i.bidders),this.xhttpFAN=new XMLHttpRequest,this.request=new Promise(function(e){o.resolve=e}),this._bidRequests=[],this.bidders.APS&&this.bidders.APS.id&&this.bidders.APS.slotID&&Q(),this.bidders.index&&(this.bidders.index.script||this.bidders.index.id)&&ne(this.bidders.index.script),this.bidders.SpotX&&this.bidders.SpotX.id&&$(),this.currentTimeout=null}return e.prototype.start=function(){var e,t,i;return this.start=function(){return this.request},this._bidRequests=(t=[],i=("dfp"===(e=this).settings.mediationLayerAdServer?[te,H,Y,oe]:[te,H]).map(function(i){var n=k();return new Promise(function(n){var r=i(e,n)||{};t.push(function(e){n(D(r,e))})}).then(function(e){return e.timeForBidResponse=k()-n|0,e})}),Promise.all(i).then(function(t){var i="dfp"===e.settings.mediationLayerAdServer,n={},r={},o=void 0,a=[],s={};return s.bidders=t.filter(ae).map(function(e){var t=!e.error,d={id:e.id,name:e.name,result:t?"bid":"noBid",timeForBidResponse:e.timeForBidResponse};return"timeout"===e.message&&(d.result=e.message),t&&(a.push(e),e.priceCents&&(d.priceInCents=e.priceCents),e.tagKey&&(d.tagKey=e.tagKey),D(r,e.custParams),"SpotX"===e.name&&(o=e.tag),i||"priceInCents"in n&&!(n.priceInCents2&&void 0!==arguments[2]?arguments[2]:null;return{type:t,client:e,adposition:null!==n?n:function(e){if(e.isBeforePlay()||0===e.getPosition())return"pre";if(e.isBeforeComplete()||e.getPosition()===e.getDuration())return"post";return"mid"}(i),viewable:i.getViewable()}}function ue(t,i){var n=i.offset,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:[];return{type:t,client:e,offset:n,mediationLayerAdServer:o.mediationLayerAdServer||r,floorPriceCents:o.floorPriceCents,floorPriceCurrency:o.floorPriceCurrency,bidTimeout:o.bidTimeout||O,bidders:a}}function pe(e,t){var i=t.bidders,n=t.options;return n.config.bids&&n.config.bids.settings&&i.length&&(e.mediationLayerAdServer=n.config.bids.settings.mediationLayerAdServer||r,e.bidders=i),e}var he=function(){function e(t,i,n,r,o,a,s){b(this,e),n.utils.extend(this,n.Events),this.item=t,this.options=i,this.player=n,this.env=n.getEnvironment(),this.utils=n.utils,this.instreamProvider=r,this.view=o,this.initAdsManagerPromise=null,this.bidsPromise=null,this.blockingInstreamPlayer=null,this.currentAd=null,this.bidders=[],this.bids=null,this.timeoutAdStart=-1,this.progressIntervalId=-1,this.fullscreenIcon=n.getContainer().querySelector(".jw-icon-fullscreen"),this.adsLoaderManager=a,this.playbackProxy={currentTime:0,duration:0},this.video=s,this.isItemSchedule=!0,this.paused=!1,this.pausedByViewable=!1,this._qoe=new n.utils.Timer,this.debugConsoleLog=n.utils.noop,i.debug&&(this.debugConsoleLog=function(){var e;(e=console).log.apply(e,arguments)})}return e.prototype.init=function(e,t){var i=this,n=t.getPrerollBlock(),r=t.config.bids;if(n&&r){var o="string"!=typeof n?n.tag:n;this.bids=new de(r,o,this.player.getWidth(),this.player.getHeight(),this.player.getContainer()),this.bids.start(),this.trigger(u,ue(u,n,r.settings,r.bidders)),this.bidsPromise=this.bids.then(function(e){if(i.bidders=e.bidders,i.trigger(p,ue(p,n,r.settings,i.bidders)),i.destroyed())return null;t.addBidsResponse(e.result)})}else this.bidsPromise=Promise.resolve();this.initAdsManagerPromise=this.bidsPromise.then(_).then(function(){return i.destroyed()?null:(i.debugConsoleLog("[JW DEBUG] Open adsLoaderManager"),i.adsLoaderManager.open(e,t,i.player,i.options,i.video))}).then(function(e){if(i.destroyed())return null;var t=i.playbackProxy,n=i.adsLoaderManager,r=n.getAdsManager(e,t,i.options);i.instreamProvider.setProxy(r),i.muteInstreamProvider();var o=i.player.getSafeRegion(!1);if(i.debugConsoleLog("[JW DEBUG] adsManager init with",o.width,o.height,i.getViewMode()),r.init(o.width,o.height,i.getViewMode()),n.initializeDisplay(),n.bindEvents({LOADED:i.adLoaded.bind(i),AD_ERROR:i.adError.bind(i),CONTENT_PAUSE_REQUESTED:i.pauseRequested.bind(i),CONTENT_RESUME_REQUESTED:i.resumeRequested.bind(i),LOG:i.adLog.bind(i),STARTED:i.adStarted.bind(i),IMPRESSION:i.adImpression.bind(i),LINEAR_CHANGED:i.resize.bind(i),CLICK:i.adClick.bind(i),PAUSED:i.adPaused.bind(i),RESUMED:i.adResumed.bind(i),SKIPPED:i.adSkipped.bind(i),USER_CLOSE:i.adUserClose.bind(i),ALL_ADS_COMPLETED:i.allAdsCompleted.bind(i)}),i.isItemSchedule){var a=r.getCuePoints();if("string"==typeof n.schedule||a.length&&0===a[0]||(i.debugConsoleLog("[JW DEBUG] Stop blocking since there is no preroll"),i.stopBlocking()),a.length){var s=a.filter(function(e){return e>0}).map(function(e){return{begin:e,text:i.options.cuetext}});i.player.setCues(s)}}return r}).catch(function(e){throw i.asyncError(e),e})},e.prototype.getViewMode=function(){var e=google.ima.ViewMode;return this.player.getFullscreen()?e.FULLSCREEN:e.NORMAL},e.prototype.prepareToPlayAd=function(){this.destroyed()||this.blockingInstreamPlayer||(clearTimeout(this.timeoutAdStart),this.startBlocking())},e.prototype.muteInstreamProvider=function(){var e=this.video.muted||this.player.getMute()||0===this.adsLoaderManager.adsManager.getVolume();this.debugConsoleLog("[JW DEBUG] Setting mute on instreamProvider",e),this.instreamProvider.mute(e)},e.prototype.exitFullscreenOnInlineIOS=function(){this.env.OS.iOS&&(this.env.Browser.version.major<10||(this.debugConsoleLog("[JW DEBUG] Exiting fullscreen mode on iOS 10+"),this.player.setFullscreen(!1),this.utils.style(this.fullscreenIcon,{display:"none"})))},e.prototype.startBlocking=function(){var e=this;if(!this.blockingInstreamPlayer&&!this.destroyed()){this.debugConsoleLog("[JW DEBUG] JW Player startBlocking"),this.exitFullscreenOnInlineIOS(),this.options.premiumAds&&this.player.on("viewable",function(t){t.viewable?e.pausedByViewable&&(e.debugConsoleLog("[JW DEBUG] PremiumAds mode enabled. Start playing the ad on viewable"),e.player.play()):e.paused||(e.debugConsoleLog("[JW DEBUG] PremiumAds mode enabled. Pause the ad on not viewable"),e.player.pause(),e.pausedByViewable=!0)},this),this._qoe.tick("adLoading"),this.player.utils.addClass(this.player.getContainer(),o),this.adsLoaderManager&&this.adsLoaderManager.videoProxy&&this.adsLoaderManager.videoProxy.unblock(),this.blockingInstreamPlayer=this.player.createInstream().init();var t=this.player.getConfig().localization.loadingAd;this.blockingInstreamPlayer.setText(t),this.blockingInstreamPlayer.applyProviderListeners(this.instreamProvider),this.initAdsManagerPromise.then(function(t){e.debugConsoleLog("[JW DEBUG] Start adsManager"),t.start()}).catch(function(){}),clearTimeout(this.timeoutAdStart),this.timeoutAdStart=setTimeout(function(){if(e.debugConsoleLog("[JW DEBUG] Ad request timeout"),!e.destroyed()){e.stopBlocking(),e.asyncDiscardAdBreak();var t={message:"Ad Request timeout after "+e.options.requestTimeout+" milliseconds",getErrorCode:function(){return 60004}},i=e.adsLoaderManager.adErrorEventObject(t,{});e.trigger(f,i)}},this.options.requestTimeout)}},e.prototype.stopBlocking=function(){this.destroyed()||(this.debugConsoleLog("[JW DEBUG] JW Player stopBlocking"),this.player.off("viewable",null,this),clearTimeout(this.timeoutAdStart),this.utils.style(this.fullscreenIcon,{display:""}),this.player.utils.removeClass(this.player.getContainer(),[a,s,o]),this.blockingInstreamPlayer&&(this.adsLoaderManager&&this.adsLoaderManager.videoProxy&&this.adsLoaderManager.videoProxy.block(),this.instreamProvider.off(),this.blockingInstreamPlayer.destroy(),this.blockingInstreamPlayer=null,this.view.adTakeDown()))},e.prototype.pauseRequested=function(e){var t=this;this.prepareToPlayAd();var i=this.adsLoaderManager.adEventObject(e.getAd());this.player.trigger(h,le(h,this.player,i.adposition)),this.blockingInstreamPlayer.on("destroyed",function(){t.player.trigger(c,le(c,t.player,i.adposition))})},e.prototype.resumeRequested=function(){this.debugConsoleLog("[JW DEBUG] ResumeRequest from IMA SDK"),this.currentAd&&this.currentAd.isLinear()&&(this.finishAd(),this.view.adTakeDown()),this.stopBlocking()},e.prototype.finishAd=function(){this.currentAd&&(clearInterval(this.progressIntervalId),this.currentAd=null)},e.prototype.discardAdBreak=function(e){!e&&this.adsLoaderManager&&(e=this.adsLoaderManager.adsManager),!this.destroyed()&&e&&(e.discardAdBreak(),e.stop())},e.prototype.asyncDiscardAdBreak=function(){var e=this;this.initAdsManagerPromise.then(function(t){return e.discardAdBreak(t)}).catch(function(){})},e.prototype.pause=function(){this.pausedByViewable=!1;var e=this.adsLoaderManager.adsManager;e&&(this.debugConsoleLog("[JW DEBUG] JW Player pause ad"),e.pause())},e.prototype.resume=function(){this.pausedByViewable=!1;var e=this.adsLoaderManager.adsManager;e&&(this.debugConsoleLog("[JW DEBUG] JW Player resume ad"),e.resume())},e.prototype.beforePlay=function(e){var t=this;this.bids&&this.bids.timeout&&this.bids.timeout(),this.player.off("beforePlay",null,this),this.isItemSchedule=!!e,this.prepareToPlayAd(),this.adsLoaderManager.initializeDisplay(),this.bidsPromise.then(_).then(function(){t.destroyed()||(t.debugConsoleLog("[JW DEBUG] Request ads to IMA SDK"),t.adsLoaderManager.requestAds())}).catch(this.utils.noop)},e.prototype.beforeComplete=function(){var e=this.adsLoaderManager.adsManager;e&&e.getCuePoints().indexOf(-1)>-1&&this.prepareToPlayAd(),this.adsLoaderManager.unbindEvents(["CONTENT_RESUME_REQUESTED"]),this.playbackProxy.currentTime=this.playbackProxy.duration,this.debugConsoleLog("[JW DEBUG] Call contentComplete on IMA SDK"),this.adsLoaderManager.contentComplete()},e.prototype.time=function(e){this.playbackProxy.currentTime=e.position,e.duration>=e.position?this.playbackProxy.duration=e.duration:this.playbackProxy.duration=1/0},e.prototype.resize=function(){var e=this.currentAd,t=this.adsLoaderManager.adsManager;if(t){var i=e&&!e.isLinear(),n=this.player.getSafeRegion(i);if(i){var r=e.getHeight();r=this.player.getFullscreen()?n.height/2:Math.max(100,r+10),this.debugConsoleLog("[JW DEBUG] Resize adsManager",n.width,r,this.getViewMode()),t.resize(n.width,r,this.getViewMode()),this.view.resizeNonLinear(n,r)}else this.debugConsoleLog("[JW DEBUG] Resize adsManager",n.width,n.height,this.getViewMode()),t.resize(n.width,n.height,this.getViewMode()),this.view.resizeLinear()}},e.prototype.triggerAdPlay=function(e,t,i,n){if(e.isLinear()){this.instreamProvider.trigger("state",{newstate:i,oldstate:n});var r=this.adsLoaderManager.adEventObject(e);r.oldstate=n,r.newstate=i,this.trigger(t,r)}},e.prototype.progressInterval=function(e,t){var i=this;if(clearInterval(this.progressIntervalId),t){var n=e.getAdId(),r=e.getAdPodInfo(),o=-1,a=this.options.admessage||"",s=new RegExp(this.options.admessagedynamickey,"g"),d=this.options.adcounterdynamic||"",l=new RegExp(this.options.adcountercountkey,"g"),u=new RegExp(this.options.adcountertotalkey,"g");this.progressIntervalId=setInterval(function(){if(i.currentAd&&i.currentAd.getAdId()===n){var p=t.getRemainingTime();if(!(isNaN(p)||p<=0)&&o!==p){o=p;var h=e.getDuration(),c=h-p;if(i.blockingInstreamPlayer){var g=a.replace(s,Math.round(h-c)),f=r.getTotalAds();if(f>1){var m=r.getAdPosition();g=d.replace(l,m).replace(u,f)+" "+g}i.blockingInstreamPlayer.setText(g),i.instreamProvider.trigger("time",{duration:h,position:c})}if(h>0){var v=i.adsLoaderManager.adEventObject(e);v.position=c,v.duration=h,i.trigger("adTime",v)}}}else clearInterval(i.progressIntervalId)},250)}},e.prototype.adLoaded=function(e){this.muteInstreamProvider();var t=this.adsLoaderManager.adEventObject(e.getAd());this.trigger("adRequest",t)},e.prototype.adStarted=function(e){var t=e.getAd(),i=this.adsLoaderManager.adEventObject(t);this.trigger(m,i)},e.prototype.adImpression=function(e){var t=this,i=e.getAd(),n=i.isLinear(),r=n&&(i.getContentType().indexOf("image")>=0||-1===i.getDuration()),o=i.getContentType(),d="application/javascript"===o||"application/x-shockwave-flash"===o,u=n&&d&&this.options.vpaidcontrols;this.currentAd=i,this.blockingInstreamPlayer&&this.blockingInstreamPlayer.setSkipOffset(i.getSkipTimeOffset()),this.adsLoaderManager.bindEvents({COMPLETE:this.adComplete.bind(this)}),d&&this.env.OS.mobile&&this.options.autoplayadsmuted&&this.adsLoaderManager.bindEvents({VOLUME_CHANGED:function(){t.adsLoaderManager.unbindEvents(["VOLUME_CHANGED"]),t.player.setMute(!!t.adsLoaderManager.adsManager.getVolume())}}),r?this.startBlocking():n||this.stopBlocking(),this.player.utils.toggleClass(this.player.getContainer(),a,n&&(r||d)),this.player.utils.toggleClass(this.player.getContainer(),s,u),this.view.adSetup(),this.resize(),this.muteInstreamProvider(),clearTimeout(this.timeoutAdStart);var p=this.adsLoaderManager.adsManager;this.progressInterval(i,p);var h=this.adsLoaderManager.adEventObject(i);if("pre"===h.adposition&&(void 0===h.podcount||1===h.sequence)){this._qoe.tick("adImpression");var c=this._qoe.between("adLoading","adImpression");h.timeLoading=c}pe(h,this),this.trigger("adImpression",h),this.triggerAdPlay(i,v,l,"buffering")},e.prototype.adComplete=function(e){this.finishAd();var t=e.getAd(),i=this.adsLoaderManager.adEventObject(t);this.trigger("adComplete",i),this.adsLoaderManager.unbindEvents(["VOLUME_CHANGED"])},e.prototype.adClick=function(e){var t=this.adsLoaderManager.adsManager,i=e.getAd(),n=i.getContentType();"application/javascript"===n||"application/x-shockwave-flash"===n||(this.debugConsoleLog("[JW DEBUG] Ad paused due to ad click"),t.pause());var r=this.adsLoaderManager.adEventObject(i);this.trigger("adClick",r),this.pausedByViewable=!1},e.prototype.adPaused=function(e){this.paused||(this.paused=!0,this.triggerAdPlay(e.getAd(),"adPause",d,l))},e.prototype.adResumed=function(e){this.paused&&(this.paused=!1,this.triggerAdPlay(e.getAd(),v,l,d))},e.prototype.adSkipped=function(e){this.debugConsoleLog("[JW DEBUG] AdSkipped"),this.adsLoaderManager.unbindEvents(["COMPLETE","VOLUME_CHANGED"]),this.finishAd();var t=this.adsLoaderManager.adEventObject(e.getAd());this.trigger("adSkipped",t)},e.prototype.adUserClose=function(e){this.debugConsoleLog("[JW DEBUG] AdUserClose"),this.currentAd&&this.currentAd.isLinear()&&-1===this.currentAd.getDuration()?this.adSkipped(e):(this.adsLoaderManager.unbindEvents(["COMPLETE","VOLUME_CHANGED"]),this.finishAd())},e.prototype.allAdsCompleted=function(){this.resumeRequested(),this.view.adTakeDown(),this.stopAdsManager()},e.prototype.stopAdsManager=function(){var e=this;this.initAdsManagerPromise.then(function(t){e.destroyed()||(e.debugConsoleLog("[JW DEBUG] Stop IMA SDK adsManager"),t.stop(),t.destroy(),e.initAdsManagerPromise=null,e.bidsPromise=null)}).catch(function(){})},e.prototype.adLog=function(e){this.debugConsoleLog("[JW DEBUG]",e.type,e);var t=e.getAdData();if(t&&t.adError){var i=this.adsLoaderManager.adErrorEventObject(t.adError,e);402===i.code?this.handleAdError(t.adError,i):this.trigger(f,i)}},e.prototype.adError=function(e){var t=e.getError();this.handleAdError(t,e)},e.prototype.asyncError=function(e){var t=this;if(!this.destroyed())if(clearTimeout(this.timeoutAdStart),this.timeoutAdStart=setTimeout(function(){return t.destroy()},0),e&&e.getError){var i=e.getError();this.handleAdError(i,e,!0)}else e.target&&e.target.src?console.error("Failed to load "+e.target.src):console.error(e)},e.prototype.handleAdError=function(e,t,i){var n=this;this.options.debug&&console.error(e),900===e.getErrorCode()||i?(clearTimeout(this.timeoutAdStart),this.timeoutAdStart=setTimeout(function(){return n.destroy()},0)):(this.stopBlocking(),this.view.adTakeDown());var r=this.adsLoaderManager.adErrorEventObject(e,t);pe(r,this),this.trigger(f,r)},e.prototype.destroy=function(){if(this.debugConsoleLog("[JW DEBUG] JW Player destroy PlaylistItemManager"),this.off(),!this.destroyed()){this.player.off(null,null,this),this.bids&&this.bids.stop&&(this.bids.stop(),this.bids=null),clearTimeout(this.timeoutAdStart),clearInterval(this.progressIntervalId),this.currentAd=null,this.options=null,this.video=null,this.initAdsManagerPromise=null,this.bidsPromise=null;var e=this.adsLoaderManager;e&&(e.reset(),this.adsLoaderManager=null),this.blockingInstreamPlayer&&this.stopBlocking(),this.instreamProvider.off(),this.instreamProvider.setProxy(null),this.instreamProvider=null,this.view.adTakeDown(),this.view=null,this.player=null,this.item=null}},e.prototype.destroyed=function(){return!this.item},e}();function ce(e){var t=this;t.video=e,t.blocked=!1;var i={},n=function(n){"function"==typeof e[n]?i[n]={get:function(){return function(){var e=t.video[n];if(e){if("pause"===n&&t.blocked)return;return e.apply(t.video,arguments)}}}}:i[n]={get:function(){return t.video[n]},set:function(e){t.video[n]=e}}};for(var r in e)n(r);Object.defineProperties(this,i)}function ge(e,t,i){if(!e)return e;for(var n,r,o,a,s=t.getPlaylistItem(),d=t.getConfig(),l=e.replace("__random-number__",Math.random()*Math.pow(10,18)).replace("__timestamp__",(new Date).getTime()).replace("__page-url__",encodeURIComponent(window.location.href)).replace("__referrer__",encodeURIComponent(document.referrer)).replace("__player-height__",t.getHeight()||d.height).replace("__player-width__",t.getWidth()||d.width).replace("__item-duration__",(r=t.getDuration(),o=3,a=Math.pow(10,o),Math.round(r*a)/a)).replace("__domain__",encodeURIComponent((n=window.location.href.match(new RegExp(/^[^/]*:\/\/\/?([^/]*)/)))&&n.length>1?n[1]:"")),u=(l=i.companiondiv&&i.companiondiv.id?l.replace("__companion-div__",i.companiondiv.id):l.replace("__companion-div__","")).match(new RegExp(/__item-[a-z 0-9 A-Z]*__/g)),p=0;u&&p1e3&&(g=g.substring(0,1e3)),l=l.replace(h,encodeURIComponent(g))}else l=l.replace(h,"")}if(s.title&&-1===l.indexOf("vid_t=")){var f=s.title.substring(0,100).replace(/[^\x00-\x7F]/g,"");l+=(-1!==l.indexOf("?")?"&":"?")+"vid_t="+encodeURIComponent(f)}return l}function fe(e,t,i){if("start"===e||"0%"===e)return"pre";if("end"===e||"100%"===e)return"post";if("pre"===e||"post"===e||i.indexOf(e,"%")>-1)return e;var n=t.seconds(e);return!!i.isNumber(n)&&n}function me(e,t,i){var n,r,o,a,s,d=fe(e,t,i);return d||(d="pre"),i.isNumber(d)&&(n=parseInt(1e3*d,10),r=Math.floor(n)%1e3,o=Math.floor(n/1e3)%60,a=Math.floor(n/6e4)%60,d=(s=(s=Math.floor(n/36e5)%24)<10?"0"+s:s)+":"+(a=a<10?"0"+a:a)+":"+(o=o<10?"0"+o:o)+"."+(r=("000"+r).slice(-3))),d}function ve(e,t,i){var n={};return t.foreach(e,function(e,r){var o={},a=r.ad||r;o.offset=me(a.offset||a.position||r.offset||"",t,i),o.tag=function(e,t,i){if(!i)return e;var n=e.indexOf("?")>=0?"&":"?",r="cust_params=",o=e.indexOf(r),a=r.length,s="",d="";if(t.foreach(i,function(e,t){s=""+s+d+e+"="+t,d="&"}),s=encodeURIComponent(s),o>=0){var l=e.substr(0,o+a),u=e.substr(o+a);return""+l+s+"%26"+u}return""+e+n+"cust_params="+s}(a.tag,t,a.custParams),o.type=a.type||r.type||"linear,nonlinear",n[e]=o}),n}!function(e,t){for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])}(ce.prototype,{block:function(){this.blocked=!0},unblock:function(){this.blocked=!1}});var ye=function(){function e(t,i){b(this,e),this.player=t,this.options=i}return e.prototype.getAdsResponse=function(e){var t=this,i=this.player,n=i.utils,r='',o=[],a=[],s=[];return n.foreach(ve(e,n,i._),function(e,n){var d=n.offset.replace("pre","start").replace("post","end"),l=r.replace(/_type_/g,n.type).replace(/_adbreakname_/g,e).replace(/_offset_/g,d).replace(/_url_/g,ge(n.tag,i,t.options,n.custParams));"start"===d?o.push(l):"end"===d?s.push(l):a.push(l)}),''+o.join("")+a.join("")+s.join("")+""},e.prototype.getTagMap=function(e){var t=this,i=this.player,n=i.utils,r={};return n.foreach(ve(e,n,i._),function(e,o){var a=fe(o.offset,n,i._);i._.isString(a)&&(a=parseFloat(a.replace("pre","0").replace("post","-1"))),i._.isNumber(a)&&(r[a]=ge(o.tag,i,t.options))}),r},e.prototype.getTagList=function(e){var t=this,i=this.player,n=i.utils,r=[];return n.foreach(ve(e,n,i._),function(e,o){var a=fe(o.offset,n,i._);i._.isString(a)&&(a=parseFloat(a.replace("pre","0").replace("post","-1"))),r.push({offset:a,tag:ge(o.tag,i,t.options)})}),r},e}();function be(e){try{return e.getAdPodInfo()}catch(e){return null}}var we=function(){function t(e){b(this,t),this.adsLoader=null,this.adDisplayContainer=null,this.displayInitialized=!1,this.adsRequest=null,this.userRequestContext=null,this.adsManager=null,this.adsManagerEvents={},this.container=e,this.adIds={},this.schedule=null,this.tagMap={},this.playerApi=null,this.videoProxy=null}return t.prototype.getVpaidMode=function(e){var t=google.ima.ImaSdkSettings.VpaidMode;return"disabled"===e||"none"===e?t.DISABLED:"enabled"===e?t.ENABLED:t.INSECURE},t.prototype.initializeDisplay=function(){this.videoProxy&&this.videoProxy.unblock(),!this.displayInitialized&&this.adDisplayContainer&&(this.adDisplayContainer.initialize(),this.displayInitialized=!0)},t.prototype.contentComplete=function(){if(null!==this.adsRequest){var e=this.adsLoader;e&&e.contentComplete(),this.adsRequest=null}},t.prototype.reset=function(){this.userRequestContext=null;var e=this.adsManager;e&&(e.destroy(),this.adsManager=null),this.contentComplete(!0),this.schedule=null,this.videoProxy&&this.videoProxy.block(),this.adsManagerEvents={},this.adIds={},this.tagMap={}},t.prototype.prepare=function(e){google.ima.settings.setDisableCustomPlaybackForIOS10Plus(!0);var t=this.adsLoader;return t||(this.videoProxy=new ce(e),this.adDisplayContainer=new google.ima.AdDisplayContainer(this.container,this.videoProxy),t=this.adsLoader=new google.ima.AdsLoader(this.adDisplayContainer)),t},t.prototype.open=function(e,t,i,n,r){t.locale&&google.ima.settings.setLocale(t.locale),t.maxRedirects>=0&&google.ima.settings.setNumRedirects(t.maxRedirects);var o=this.prepare(r);this.playerApi=i;var a={requestType:e,vpaidMode:t.vpaidmode,playerVersion:i.version.split("+")[0]};this.userRequestContext=a;var s=t.getSchedule();if(!s)return Promise.reject();var d=new google.ima.AdsRequest,l=i.getSafeRegion(!1);d.linearAdSlotWidth=l.width,d.linearAdSlotHeight=l.height;var u=i.getSafeRegion(!0);d.nonLinearAdSlotWidth=u.width,d.nonLinearAdSlotHeight=u.height,d.setAdWillAutoPlay(i.getConfig().autostart&&!i.getEnvironment().OS.mobile),d.forceNonLinearFullSlot=n.forceNonLinearFullSlot,this.adsRequest=d;var p=new ye(i,n);if("object"==typeof s){var h=p.getTagList(s);1===h.length&&0===h[0].offset&&(s=h[0].tag)}return"string"==typeof s?s=d.adTagUrl=a.adTagUrl=ge(s,i,n):(d.adsResponse=a.adsResponse=p.getAdsResponse(s),this.tagMap=p.getTagMap(s)),this.schedule=s,new Promise(function(e,t){o.addEventListener(google.ima.AdErrorEvent.Type.AD_ERROR,t,!1),o.addEventListener(google.ima.AdsManagerLoadedEvent.Type.ADS_MANAGER_LOADED,e,!1)})},t.prototype.requestAds=function(){var e=this.adsLoader,t=this.userRequestContext,i=this.getVpaidMode(t.vpaidMode),n=e.getSettings();n.setPlayerType("jwplayer"),n.setPlayerVersion(t.playerVersion),n.setVpaidMode(i),e.requestAds(this.adsRequest,t)},t.prototype.getAdsManager=function(e,t,i){var n=new google.ima.AdsRenderingSettings;return n.loadVideoTimeout=i.loadVideoTimeout,n.enablePreloading=i.enablePreloading,n.uiElements=null,n.autoAlign=!0,n.useStyledNonLinearAds=!0,this.adsManager=e.getAdsManager(t,n),this.userRequestContext=e.getUserRequestContext(),this.adsManager},t.prototype.bindEvents=function(e){var t=this,i=google.ima.AdEvent.Type,n=google.ima.AdErrorEvent.Type;Object.keys(e).forEach(function(r){var o=i[r]||n[r],a=t.adsManagerEvents[o];a&&t.adsManager.removeEventListener(o,a),t.adsManager.addEventListener(o,e[r],!1),t.adsManagerEvents[o]=e[r]})},t.prototype.unbindEvents=function(e){var t=this,i=google.ima.AdEvent.Type,n=google.ima.AdErrorEvent.Type;e.forEach(function(e){var r=i[e]||n[e],o=t.adsManagerEvents[r];o&&(t.adsManager.removeEventListener(r,o),delete t.adsManagerEvents[r])})},t.prototype.getAdId=function(e){if(e){var t=e.getAdId(),i=be(e);if(i&&(t=""+i.getTimeOffset()),t)return void 0===this.adIds[t]&&(this.adIds[t]=(r=12,new Array(r+1).join((Math.random().toString(36)+"00000000000000000").slice(2,18)).slice(0,r))),this.adIds[t]}var r;return n},t.prototype.getTag=function(e,t){if("string"==typeof this.schedule)return this.schedule;var i=be(e);if(i){var n=this.tagMap[i.getTimeOffset()];if(n)return n}var r=this.userRequestContext;return t&&t.getUserRequestContext&&(r=t.getUserRequestContext()||r),r?r.adTagUrl||r.adsResponse||"":(console.error("invalid request context",r),"")},t.prototype.adEventObject=function(t){var i={client:e,tag:this.getTag(t),ima:{ad:t,userRequestContext:this.userRequestContext}};if(!t)return i;i.id=this.getAdId(t),i.adtitle=t.getTitle(),i.adsystem=t.getAdSystem(),i.creativetype=t.getContentType(),i.linear=t.isLinear()?"linear":"nonlinear",i.viewable=this.playerApi.getViewable();var n=be(t);if(n){var r=n.getTotalAds();r>1&&(i.sequence=n.getAdPosition(),i.podcount=r);var o=n.getTimeOffset(),a="mid";0===o?a="pre":-1===o&&(a="post"),i.adposition=a}return i},t.prototype.adErrorEventObject=function(t,i){var r=t.getMessage&&t.getMessage()||t.message,o=t.getVastErrorCode&&t.getVastErrorCode()||900,a=t.getErrorCode&&t.getErrorCode()||900;a<1e4&&(a+=2e4);var s=this.getTag(i.getAd&&i.getAd(),i);return{id:n,client:e,message:"Ad Error: "+r,code:o,adErrorCode:a,tag:s}},t}();!function(e){if(e&&"undefined"!=typeof window){var t=document.createElement("style");t.setAttribute("media","screen"),t.innerHTML=e,document.head.appendChild(t)}}(".jwplayer.jw-flag-ads-googleima.jw-flag-small-player .jw-controls-backdrop,.jwplayer.jw-flag-ads-googleima.jw-flag-small-player .jw-icon-fullscreen{display:none}.jwplayer.jw-flag-ads-googleima.jw-flag-touch .jw-controlbar{font-size:1em}.jwplayer.jw-flag-ads-googleima.jw-flag-small-player.jw-flag-ads.jw-state-playing.jw-flag-touch:not(.jw-flag-ads-vpaid) .jw-controls .jw-controlbar,.jwplayer.jw-flag-ads-googleima.jw-flag-touch .jw-display-icon-display,.jwplayer.jw-flag-ads-googleima.jw-flag-touch .jw-display-icon-display .jw-icon-display{pointer-events:none}.jwplayer.jw-flag-ads-googleima.jw-flag-small-player .jw-controlbar{background:0 0!important;flex-flow:column-reverse nowrap;height:100%;max-height:none;pointer-events:none}.jwplayer.jw-flag-ads-googleima.jw-flag-small-player .jw-button-container{align-items:flex-end;flex-wrap:wrap;margin-bottom:18px}.jwplayer.jw-flag-ads-googleima.jw-flag-small-player .jw-controlbar .jw-icon{height:30px}.jwplayer.jw-flag-ads-googleima.jw-flag-small-player .jw-svg-icon{fill:#fff;filter:drop-shadow(0 0 3px #000)}.jwplayer.jw-flag-ads-googleima.jw-flag-small-player .jw-text{align-self:flex-start;margin-top:12px;order:-1;text-shadow:0 0 3px #000;width:100%}"),(window.jwplayerPluginJsonp||window.jwplayer().registerPlugin)(e,"8.1",function(r,o,a){var s=this,d=r.utils,l=r.getConfig(),u=new E(o||{},d),p=null,h=void 0,c=0;if(u.premiumAds){if(r.getMute()||l.autostart)return console.log("Premium Ads: Cannot play ads in autostart or muted"),void(this.destroy&&this.destroy());if(function(){var e=(window.performance||{}).timing;if(e){var t=e.loadEventEnd||(new Date).getTime(),i=t-e.navigationStart;if(i>0)return i}return y}()>=y)return console.log("Premium Ads: Page load took too long to start an ad"),void(this.destroy&&this.destroy())}_(d).then(function(){if(h){var e=L();e>=0&&e-h>=y&&(console.log("Premium Ads: IMA SDK load took too long to start an ad"),s.destroy&&s.destroy())}}).catch(d.noop);var v=r._,b=l.key;d.addClass(a,"jw-plugin-googima");var w=new C(a,r.id,d.style),A=new j(d,r.Events,w),P=new we(w.getAdDiv()),M=null;function S(e,t,i,n){try{return e.getCompanionAds(t,i,n)}catch(e){return[]}}function x(e){var t=new google.ima.CompanionAdSelectionSettings;t.sizeCriteria=google.ima.CompanionAdSelectionSettings.SizeCriteria.IGNORE;var i=u.companiondiv||{width:300,height:250},n=function(e){for(var t=[],i=0;i0}function I(){M&&!M.destroyed()&&(r.off(null,null,M),M.destroy(),M=null)}function k(e){M&&M.discardAdBreak(),P.contentComplete(),I(),e&&e.adschedule?u.adschedule=e.adschedule:u.adschedule=null,r.setCues([])}function D(e,t,n){var o,a,s,l=this,g=e.item||{};k(g),t!==i||(o=u.getAdRules(),a=0===o.frequency&&1===c,s=c>=o.startOn&&(c-o.startOn)%o.frequency==0,a||s)?(p||(p=r.createInstream().getMediaElement()),n.getSchedule()?(P.reset(),(M=new he(g,u,r,A,w,P,p)).on("all",function(e,t){return r.trigger(e,t)}),M.init(t,n),M.on(m,function(e){x(e.ima.ad)}),r.once("beforePlay",function(e){if(u.premiumAds){var t=r.getHeight(),i=r.getWidth();if(t<270||i<480)return console.log("Premium Ads: Player size is smaller than 480x270 to play an ad"),void l.destroy();L()<0&&(h=Date.now())}M.beforePlay(e)},M).on("beforeComplete",function(){return M.beforeComplete()},M).on("time",function(e){return M.time(e)},M).on("resize",function(){return M.resize()},M).on("fullscreen",function(){return M.resize()},M)):_(d).then(function(){P.prepare(p)}).catch(d.noop)):u.adschedule=null}this.version="8.1.6",r.utils.extend(this,r.Events),r.pauseAd=function(e){M&&(e?M.pause():M.resume())},r.playAd=function(e){var i=d.extend({},o,{debug:u.debug});delete i.ad,delete i.tag,delete i.schedule,r._.isArray(e)?i.tag=e[0]:i.tag=e;var n=new E(i,d),a=M?M.blockingInstreamPlayer:null;a&&(a.noResume=!0),D({},t,n),M&&M.beforePlay(null)},r.on("ready",function(){_().catch(function(e){e.message.match(/Failed to load/)&&O("Ad playback blocked by an ad blocker",2e4)}),R.catch(function(e){O("Ad Error: "+e.message,60002)})},this).on("playlistItem",function(e){c++,D(e,i,u)},this).on("playlistComplete",function(){k()},this).on("cast",function(e){e.active&&k()},this).on("destroyPlugin",function(){s.destroy()},this);var R=T.call(this,d,b);R.catch(d.noop);var O=function(t,i){I(),r.off(null,null,s),r.playAd=d.noop,r.trigger(f,{id:n,client:e,message:t,code:900,adErrorCode:i,tag:""})};this.destroy=I,this.adsDebugMode=function(){u.debug=!0,M&&(M.debugConsoleLog=function(){var e;(e=console).log.apply(e,arguments)})}})}();