!function(){var e="googima",t="TYPE_API",i="TYPE_SCHEDULE",n="-1",r="jw-flag-ads-googleima",o="jw-flag-ads-vpaid",a="jw-flag-ads-vpaid-controls",s="paused",d="playing",l="adBreakStart",u="adBreakEnd",h="adCompanions",g="adError",p="adStarted",c="adPlay",f=2e3,m=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")},y={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 v(e){if("true"===e)return!0;if("false"===e)return!1;var t=parseFloat(e);return isNaN(t)?e:t}function b(e){var t=Object.keys(e).filter(function(t){return"pre"===e[t].offset||!e[t].offset});return t.length?t[0]:null}var w=function(){function e(t,i){for(var n in m(this,e),this.config=t,this.utils=i,y)if(y.hasOwnProperty(n)){var r=t[n],o=y[n],a=typeof o;if(void 0!==r){if("boolean"!==a&&"number"!==a||(r=v(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=b(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[b(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}(),A=function(){function e(t,i,n){m(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,y={bidWon:m,priceCents:a,priceCurrency:c};return m?(y.tag=["https://an.facebook.com/v1/instream/vast.xml?placementid="+d,"&playerwidth="+h,"&playerheight="+g,"&sdk="+k,"&bidid="+s,"&pageurl="+V].join(""),t(y)):t(y)}},a.open("GET",p),a.withCredentials=!0,a.send(null)}function G(e,t){var i=e.bidders.APS;if(!i.pubID||!i.slotID)return t({error:!0,message:"Invalid config"});N().then(function(){return apstag.init({pubID:i.pubId,adServer:i.adServer}),apstag.fetchBids({slots:[{slotID:i.slotID}],timeout:e.settings.bidTimeout},function(n){return n&&n[0]&&n[0].slotID===i.slotID?t({tag:e.tag,custParams:{amznbid:n[0].amznbid,amzniid:n[0].amzniid}}):t({error:!0,message:"No bids for pubID and slotID"})})}).catch(function(){t({error:!0,message:"Amazon header bidding failed"})})}function z(e,t){var i=I({videoCommonArgs:{protocols:[2,3,5,6],mimes:["video/mp4","video/webm","application/javascript"],apiList:[1,2]}},e.bidders.index);if(!i.script&&!i.siteID&&!window.indexapi)return t({error:!0,message:"Invalid config"});setTimeout(function(){t({error:!0,message:"Index Exchange header bidding request failed"})},e.settings.bidTimeout),q().then(function(){var n=function(i,n){if(void 0!==n)return t({tag:e.tag,custParams:n});t({error:!0,message:"Index Exchange header bidding request failed"})};window.indexapi=window.indexapi||{},window.indexapi.deferQueue=window.indexapi.deferQueue||[],window.indexapi.deferQueue.push(function(){window.indexapi.solicitIndexVideoAds(e.tag,n,i)})}).catch(function(){t({error:!0,message:"Index Exchange header bidding failed"})})}var J=function(){function e(){var t,i,n,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{settings:{},bidders:{}},o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",a=this,s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,d=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;m(this,e),this.tag=o,this.mediationLayer=r.mediationLayerAdServer,this.settings=(t=r.settings,I({bidTimeout:T,playerWidth:s,playerHeight:d},t)),this.bidders=(i=r.bidders,n={FAN:I({},i.FAN),APS:I({},i.APS)},i.index&&(n.index=i.index),n),this.xhttpFAN=new XMLHttpRequest,this.request=new Promise(function(e){a.resolve=e}),r.bidders.APS&&r.bidders.APS.pubID&&r.bidders.APS.slotID&&N(),r.bidders.index&&(r.bidders.index.script||r.bidders.index.siteID)&&q(r.bidders.index.script),this.currentTimeout=null}return e.prototype.start=function(){return this.start=function(){return this.request},function(e){for(var t=[W,G,z],i=[],n=0;n2&&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()}}var H=function(){function e(t,i,n,r,o,a,s){m(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.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();if(n){var r=t.config.bids,o="string"!=typeof n?n.tag:n;this.bids=new J(r,o,this.player.getWidth(),this.player.getHeight()),this.bids.start()}else this.bids=Promise.resolve();this.bidsPromise=this.bids.then(function(e){if(i.destroyed())return null;t.addBidsResponse(e)}),this.initAdsManagerPromise=this.bidsPromise.then(M).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(),r),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(g,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(),[o,a,r]),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(l,F(l,this.player,i.adposition)),this.blockingInstreamPlayer.on("destroyed",function(){t.player.trigger(u,F(u,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(M).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 h=t.getRemainingTime();if(!(isNaN(h)||h<=0)&&o!==h){o=h;var g=e.getDuration(),p=g-h;if(i.blockingInstreamPlayer){var c=a.replace(s,Math.round(g-p)),f=r.getTotalAds();if(f>1){var m=r.getAdPosition();c=d.replace(l,m).replace(u,f)+" "+c}i.blockingInstreamPlayer.setText(c),i.instreamProvider.trigger("time",{duration:g,position:p})}if(g>0){var y=i.adsLoaderManager.adEventObject(e);y.position=p,y.duration=g,i.trigger("adTime",y)}}}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(p,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()),s=i.getContentType(),l="application/javascript"===s||"application/x-shockwave-flash"===s,u=n&&l&&this.options.vpaidcontrols;this.currentAd=i,this.blockingInstreamPlayer&&this.blockingInstreamPlayer.setSkipOffset(i.getSkipTimeOffset()),this.adsLoaderManager.bindEvents({COMPLETE:this.adComplete.bind(this)}),l&&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(),o,n&&(r||l)),this.player.utils.toggleClass(this.player.getContainer(),a,u),this.view.adSetup(),this.resize(),this.muteInstreamProvider(),clearTimeout(this.timeoutAdStart);var h=this.adsLoaderManager.adsManager;this.progressInterval(i,h);var g=this.adsLoaderManager.adEventObject(i);if("pre"===g.adposition&&(void 0===g.podcount||1===g.sequence)){this._qoe.tick("adImpression");var p=this._qoe.between("adLoading","adImpression");g.timeLoading=p}this.trigger("adImpression",g),this.triggerAdPlay(i,c,d,"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",s,d))},e.prototype.adResumed=function(e){this.paused&&(this.paused=!1,this.triggerAdPlay(e.getAd(),c,d,s))},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(g,i)}},e.prototype.adError=function(e){var t=e.getError();this.handleAdError(t,e)},e.prototype.asyncError=function(e){var t=this;this.destroyed()||(e&&e.getError?this.adError(e):e.target&&e.target.src?console.error("Failed to load "+e.target.src):console.error(e),this.timeoutAdStart=setTimeout(function(){return t.destroy()},0))},e.prototype.handleAdError=function(e,t){var i=this;this.options.debug&&console.error(e),900===e.getErrorCode()?this.timeoutAdStart=setTimeout(function(){return i.destroy()},0):(this.stopBlocking(),this.view.adTakeDown());var n=this.adsLoaderManager.adErrorEventObject(e,t);this.trigger(g,n)},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 K(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 Q(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)),h=0;u&&h1e3&&(c=c.substring(0,1e3)),l=l.replace(g,encodeURIComponent(c))}else l=l.replace(g,"")}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 Y(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 X(e,t,i){var n,r,o,a,s,d=Y(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 Z(e,t,i){var n={};return t.foreach(e,function(e,r){var o={},a=r.ad||r;o.offset=X(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])}(K.prototype,{block:function(){this.blocked=!0},unblock:function(){this.blocked=!1}});var $=function(){function e(t,i){m(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(Z(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,Q(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(Z(e,n,i._),function(e,o){var a=Y(o.offset,n,i._);i._.isString(a)&&(a=parseFloat(a.replace("pre","0").replace("post","-1"))),i._.isNumber(a)&&(r[a]=Q(o.tag,i,t.options))}),r},e.prototype.getTagList=function(e){var t=this,i=this.player,n=i.utils,r=[];return n.foreach(Z(e,n,i._),function(e,o){var a=Y(o.offset,n,i._);i._.isString(a)&&(a=parseFloat(a.replace("pre","0").replace("post","-1"))),r.push({offset:a,tag:Q(o.tag,i,t.options)})}),r},e}();function ee(e){try{return e.getAdPodInfo()}catch(e){return null}}var te=function(){function t(e){m(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 K(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 h=new $(i,n);if("object"==typeof s){var g=h.getTagList(s);1===g.length&&0===g[0].offset&&(s=g[0].tag)}return"string"==typeof s?s=d.adTagUrl=a.adTagUrl=Q(s,i,n):(d.adsResponse=a.adsResponse=h.getAdsResponse(s),this.tagMap=h.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=ee(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=ee(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=ee(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 w(o||{},d),c=null,m=void 0,y=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 f}()>=f)return console.log("Premium Ads: Page load took too long to start an ad"),void(this.destroy&&this.destroy())}M(d).then(function(){if(m){var e=C();e>=0&&e-m>=f&&(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 E=new A(a,r.id,d.style),P=new x(d,r.Events,E),L=new te(E.getAdDiv()),I=null;function D(e,t,i,n){try{return e.getCompanionAds(t,i,n)}catch(e){return[]}}function T(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 S(){I&&!I.destroyed()&&(r.off(null,null,I),I.destroy(),I=null)}function k(e){I&&I.discardAdBreak(),L.contentComplete(),S(),e&&e.adschedule?u.adschedule=e.adschedule:u.adschedule=null,r.setCues([])}function j(e,t,n){var o,a,s,l=this,h=e.item||{};k(h),t!==i||(o=u.getAdRules(),a=0===o.frequency&&1===y,s=y>=o.startOn&&(y-o.startOn)%o.frequency==0,a||s)?(c||(c=r.createInstream().getMediaElement()),n.getSchedule()?(L.reset(),(I=new H(h,u,r,P,E,L,c)).init(t,n),I.on("all",function(e,t){return r.trigger(e,t)}),I.on(p,function(e){T(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();C()<0&&(m=Date.now())}I.beforePlay(e)},I).on("beforeComplete",function(){return I.beforeComplete()},I).on("time",function(e){return I.time(e)},I).on("resize",function(){return I.resize()},I).on("fullscreen",function(){return I.resize()},I)):M(d).then(function(){L.prepare(c)}).catch(d.noop)):u.adschedule=null}this.version="8.1.5",r.utils.extend(this,r.Events),r.pauseAd=function(e){I&&(e?I.pause():I.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 w(i,d);j({},t,n),I&&I.beforePlay(null)},r.on("ready",function(){M().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){y++,j(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=_.call(this,d,b);R.catch(d.noop);var O=function(t,i){S(),r.off(null,null,s),r.playAd=d.noop,r.trigger(g,{id:n,client:e,message:t,code:900,adErrorCode:i,tag:""})};this.destroy=S,this.adsDebugMode=function(){u.debug=!0,I&&(I.debugConsoleLog=function(){var e;(e=console).log.apply(e,arguments)})}})}();