jwplayer.vast={},function(a){function b(b){var c;return a.utils.foreach(b,function(a,b){c=c||{},"_adQueue"===a?c[a]=b.slice():c[a]=b}),c}function c(a,b){return"%"===a.toString().slice(-1)?b*parseFloat(a.slice(0,-1))/100:parseFloat(a)}a.vast.schedule=function(){var d,e,f,g=[],h=0;this.setPreRoll=function(a){d=a},this.getPreRoll=function(){return b(d)},this.getPostRoll=function(){return b(f)},this.getNextMidRoll=function(a,d){if(this.sort(d),g.length>=h+1){var e=g[h],f=c(e._offSet,d);if(a>f)return h++,b(e)}},this.getMidRolls=function(){var c=[];return a.utils.foreach(g,function(a,d){c.push(b(d))}),c},this.reset=function(){h=0},this.addMidRoll=function(a){g.push(a)},this.setPostRoll=function(a){f=a},this.sort=function(a){(!a||1>a)&&(a=1),g.sort(function(b,d){return c(b._offSet,a)-c(d._offSet,a)})},this.setVMAP=function(a){e=a},this.isVMAP=function(){return e?!0:!1},this.getVMAP=function(){return e}}}(jwplayer),function(a){function b(a){return h.isString(a)?[a]:h.isArray(a)?a.slice(0):a}function c(a){if("start"===a||"0%"===a)return"pre";if("end"===a||"100%"===a)return"post";if("pre"===a||"post"===a||h.indexOf(a,"%")>-1)return a;var b=g.seconds(a);return h.isNumber(b)?b:!1}function d(a,d){var e=d.schedule||d.adschedule;h.each(e,function(d){d.ad&&(g.extend(d,d.ad),delete d.ad);var e=c(d.offset),f={_offSet:e,_type:d.type};if(e===!1&&g.log("Error: ad offset format not supported",e),d.tag)f._adQueue=b(d.tag),f._waterfallIndex=0;else{if(!h.isString(d.vastxml))return void g.log("Error: no ad tag provided");f._adXML=d.vastxml}switch(e){case"pre":a.setPreRoll(f);break;case"post":a.setPostRoll(f);break;default:a.addMidRoll(f)}})}function e(c){var e=new a.vast.schedule;if(c.tag)e.setPreRoll({_offSet:"pre",_adQueue:b(c.tag),_waterfallIndex:0});else if(h.isString(c.vastxml))e.setPreRoll({_offSet:"pre",_adXML:c.vastxml});else{if(h.isString(c.schedule))return e.setVMAP(c.schedule),e;d(e,c)}return e.sort(),e}function f(a){var b={cuetext:a.cuetext||l,dynamicMessage:a.admessage||i,podMessage:a.podmessage||j,skipoffset:a.skipoffset||k,skipMessage:a.skipmessage||m,skipText:a.skiptext||n},c=a.companiondiv;return c&&(b.companion={id:c.id,height:c.height,width:c.width}),b}var g=a.utils,h=a._,i="This ad will end in xx seconds.",j="Ad __AD_POD_CURRENT__ of __AD_POD_LENGTH__. ",k=-1,l="Advertisement",m="Skip ad in xx",n="Skip";a.vast.configparser={getSchedule:e,getOptParams:f}}(jwplayer),function(a){function b(a,b,c){var d=[];return a&&(d=a.getElementsByTagName(b),c&&d&&0===d.length&&(d=a.getElementsByTagName(c+":"+b))),d}function c(a,b){return a?a.getAttribute(b):null}function d(a){if(a){var b=a.textContent||a.text;if(b)return g.trim(b)}return""}function e(a,b){var e=c(b,"event");if("progress"===e){var g=c(b,"offset");e=e+"_"+g}var h=d(b);f(a,e,h)}function f(a,b,c){a[b]||(a[b]=[]),c&&a[b].push(c)}var g=a.utils,h="vmap";a.vast.vmapparser=function(a,f){for(var i=b(a,"AdBreak",h),j=0;j3||1>a)&&k(102,"Vast version not supported"),o?(a>=2?(g=m(o),l(o,"Impression",g.trackers),l(o,"Error",g.trackers)):g=n(o),i&&(g.wrappedURI=d(b(i,"VASTAdTagURI")[0])||d(b(i,"VASTAdTagURL")[0])),g=j(f,g)):k(101,"Invalid VAST response"),g}function j(a,b){var c=g.extend({},a);return g.foreach(b,function(a,d){g.exists(c[a])?"array"==g.typeOf(d)?c[a]=c[a].concat(d):"object"==g.typeOf(d)?c[a]=g.extend(c[a],b[a]):c[a]=d:c[a]=d}),c}function k(a,b){throw s={code:a,message:b,toString:function(){return this.code+" "+this.message}}}function l(a,c,e){var g,h=b(a,c);for(g=0;g=0&&b.split("/")[2]!=a.location.href.split("/")[2]}var e=a.jwplayer,f=e.events,g=e.utils,h=e._,i=e.vast;i.vloader=function(a,c){function e(){var a=c.getContainer();return a.querySelector("object")}function j(a,b){var d=c.id+":vast:"+b.name+":"+Math.random().toString(16).substr(2);return a.on(d,b,y),d}function k(a){function b(b){clearTimeout(A),y.parseXmlString(b,a)}function c(b){clearTimeout(A),g.log(b),s(b,a)}return g.ajax(a,function(b){clearTimeout(A),m(b,a)},function(f,g,h){if(h.withCredentials===!0){var i=!0;return void y.load(a,i)}var k=e();return k&&"Invalid XML"!==f&&d(a)?void k.triggerFlash("loadXml",a,j(k,b),j(k,c)):(clearTimeout(A),void s(f,a))})}function l(a){a&&(a.onload=null,a.onreadystatechange=null,a.onerror=null,a.abort&&a.abort())}function m(b,d){w=w||new i.vparser;try{w.parse(b.responseXML)}catch(e){return void u(e.message,e.code||900,d)}var h=w.parsedAds();h&&h.length?(B=h,g.foreach(B,function(b,d){if(d.wrappedURI){var e=new i.vloader(a,c);e.addEventListener(f.COMPLETE,function(){n(d,e.allAds())}),e.addEventListener(f.ERROR,function(a){u(a.message,a.code,a.url)}),e.load(d.wrappedURI)}}),q()):u("Ad Tag Empty",101,d)}function n(a,b){var c=o(a,b),d=h.indexOf(B,a);Array.prototype.splice.apply(B,[d,1].concat(c)),q()}function o(a,b){var c=[];return g.foreach(b,function(b,d){a.companions&&(d.companions=(d.companions?d.companions:[]).concat(a.companions)),a.trackers&&(d.trackers=p(d.trackers,a.trackers)),a.sequence&&(d.sequence=a.sequence),c.push(d)}),c}function p(a,b){return a=a||{},g.foreach(b,function(b,c){a[b]?a[b]=a[b].concat(c):a[b]=c}),a}function q(){var a=!1;g.foreach(B,function(b,c){c.wrappedURI&&(a=!0)}),a||r()}function r(){for(var a=B.slice(0),b=a.length,c=a.length;c--;){var d=a[c];d.media&&d.media.length||a.length--}var e=0===b,g=a.length!==b;return e||g?void u("Ad Tag Empty",101,z[z.length-1]):void v(f.COMPLETE,{vloader:y})}function s(a,b){"Invalid XML"===a?u(a,100,b):u("VAST could not be loaded",301,b)}function t(){return z&&z.length?z[0]:""}function u(a,b,c){C||(C=!0,y.sendEvent(f.ERROR,{message:a,code:b,vloader:y,url:t()||c,wrappedUrl:c}))}function v(a,b){return y.sendEvent(a,b)}var w,x,y=this,z=[],A=-1,B=[],C=!1;g.extend(y,new f.eventdispatcher),y.load=function(a,b){z.push(a),C=!1;var c=k(a);c&&(!b&&"withCredentials"in c&&(c.withCredentials=!0),x=c,clearTimeout(A),A=setTimeout(function(){l(c),s("Timeout",a)},5e3))},y.destroy=function(){clearTimeout(A),l(x),c=null},y.scheduledAd=function(){return a},y.allAds=function(){return B},y.adPod=function(){var a=[];return g.foreach(B,function(b,c){c.sequence&&a.push(c)}),a.sort(function(a,b){return a.sequence-b.sequence}),a},y.adBuffet=function(){var a=[];return g.foreach(B,function(b,c){c.sequence||a.push(c)}),a},y.history=function(){return z},y.parseXmlString=function(a,c){m({responseXML:b(a)},c)}}}(window),function(a){a.vast.companion=function(b){function c(a){if(a=a.creativeView){for(var c=0;c';e+='',e+='',e+='',e+='',e+='',e+='',e+="",h.innerHTML=e}else{var f=document.createElement("object");f.setAttribute("type","application/x-shockwave-flash"),f.setAttribute("data",a.source),f.setAttribute("width","100%"),f.setAttribute("height","100%"),f.setAttribute("tabindex",0),d(f,"allowfullscreen","true"),d(f,"allowscriptaccess","always"),d(f,"seamlesstabbing","true"),d(f,"wmode","opaque"),h.appendChild(f)}return void c(a.trackers)}var k=new Image;k.src=a.source,j.exists(a.clickthrough)&&(k.onclick=function(){var b=window.open(a.clickthrough,"_blank");b.focus()}),h.innerHTML="",h.appendChild(k),c(a.trackers)}function f(a){return a.width==g.width&&a.height==g.height}var g,h,i=this,j=a.utils,k=a._;i.addCompanion=function(a,b){if(g=a,h=document.getElementById(g.id),!h)return!1;for(var c=0;c=b)){for(var c=(4*a+.05)/b|0;c>n&&3>n;)n++,1===n?g("firstQuartile"):2===n?g("midpoint"):3===n&&g("thirdQuartile");k(a,b)}}function k(a,b){for(var c=p.length;c--;){var d=p[c];if(!d.tracked){var e=d.offset;d.percentage&&(e=b*e/100),a>=e&&(d.tracked=!0,g(d.key))}}}function l(a){o.firedError=!0,a=a||900;var b={};b[d]=a,g("error",b)}function m(a){return function(){g(a)}}var n=0,o=this,p=[];for(var q in a)if(a.hasOwnProperty(q)&&0===q.indexOf("progress")){var r=""+q.split("_")[1],s={key:q,offset:r,tracked:!1,percentage:!1};/^\d+%$/.test(r)?(s.percentage=!0,s.offset=parseFloat(r)):s.offset=b.seconds(r),p.push(s)}o.started=!1,o.firedError=!1,o.hasComp=!1,o.addUrl=function(b,c){a.hasOwnProperty(b)?a[b].push(c):(a[b]=[],a[b].push(c))},o.creativeView=m("creativeView"),o.start=h,o.click=m("click"),o.skip=m("skip"),o.complete=m("complete"),o.pause=m("pause"),o.resume=m("resume"),o.mute=m("mute"),o.unmute=m("unmute"),o.fullscreen=m("fullscreen"),o.expand=m("expand"),o.collapse=m("collapse"),o.acceptInvitation=m("acceptInvitation"),o.close=m("close"),o.rewind=m("rewind"),o.impression=m("impression"),o.breakStart=i,o.breakEnd=m("breakEnd"),o.time=j,o.error=l}}(window.jwplayer),function(a){var b,c,d=a.utils,e=d.UI,f=a.events,g=f.JWPLAYER_MEDIA_TIME,h={CLICK:"onClick",PLAY:"onPlay",PAUSE:"onPause",ERROR:"onError",COMPLETE:"onComplete"},i=function(a,b,c,e){function g(){a.triggerFlash("vast:addClickHandler",k(j)),m.sendEvent(h.PLAY)}function i(){m.sendEvent(h.ERROR)}function j(){m.sendEvent(h.CLICK)}function k(c){var d=b.id+":vast:"+c.name+":"+Math.random().toString(16).substr(2);return a.on(d,c,m),d}var l=-1,m=this;d.extend(this,new f.eventdispatcher),l=setTimeout(function(){a.triggerFlash("vast:loadStatic",c,e,k(g),k(i))},0),m.removeListeners=function(){clearTimeout(l),m.resetEventListeners()},m.stop=function(){a.triggerFlash("vast:stopStatic")}},j="data:image/png;base64,",k="iVBORw0KGgoAAAANSUhEUgAAABEAAAARCAYAAAA7bUf6AAAAw0lEQVQ4y2NgwATcQJwGxGuB+BoQP4PSa6Hi3AwEQCAQX4BqxIUvQNVhBcUENKPjYmwueEYGDkYOg4tkGnIViPlAhiSiS+7du/eHs7PzG2QxFxeXNyBxLAaB9DOsQJcAaXj79u1fmEEwPojGYghIP8N5bE6Faayurv6Ix4BnUP0MD3H5GWTAfyAA0XjC5SFOl4C8guwS9DBCd8kKXAaghwkOg1ZSLXaokk5AIIhMQ0KonneQXURMLg4mVBzAypN1xJYnALKHAXPzEPJQAAAAAElFTkSuQmCC",l="iVBORw0KGgoAAAANSUhEUgAAABEAAAARCAYAAAA7bUf6AAAAiklEQVQ4y2NgwATcQJwGxGuB+BoQP4PSa6Hi3AwEQCAQX4BqxIUvQNVhBcUENKPjYmwueEYGDkYOg4tkGnIViPlAhiTiU/gfCAgYBNLPsIJCQ0D6Gc5TaAhIP8NDbBpxASyGPKSaSygNk5VUix2qpBMQCCLTkBCq5x1kFxGTi4MJFQew8mQdseUJAImp82D/nQbxAAAAAElFTkSuQmCC",m={cursor:"pointer",position:"absolute",margin:"auto",left:0,right:0,bottom:0,display:"block"},n="opacity 0.2s",o={"-webkit-transition":n,transition:n},p=function(a,g,i,j){function k(){clearTimeout(A),C.sendEvent(h.ERROR),y()}function l(){C.sendEvent(h.CLICK)}function n(){u(c)}function p(){u(c,.75)}function q(){u(b)}function r(){u(b,.5)}function s(a){-1===B&&(a.preventDefault(),j.onmouseover=j.onmouseout=null,v([z,c,b]),j.appendChild(b),B=setTimeout(function(){w(z),w(c),u(b,.5),j.onmouseover=q,j.onmouseout=r,B=-1},250))}function t(a){-1===B&&(a.preventDefault(),j.onmouseover=j.onmouseout=null,j.appendChild(z),j.appendChild(c),B=setTimeout(function(){u([z,c]),j.onmouseover=n,j.onmouseout=p,B=-1},50),v(b))}function u(a,b){d.css.style(a,{opacity:b||1})}function v(a){d.css.style(a,{opacity:0})}function w(a){j.contains(a)&&j.removeChild(a)}function x(){z.onload=z.onerror=null}function y(){x(),w(z)}var z,A=-1,B=-1,C=this;d.extend(this,new f.eventdispatcher);var D=j.parentNode,E=d.bounds(D).bottom,F=a.getContainer().querySelector(".jw-controlbar"),G="none"===F.style.display,H=0;G&&(H=F.style.opacity,F.style.opacity=0,F.style.display="inline-block");var I=d.bounds(F).top||E-40;G&&(F.style.opacity=H,F.style.display="none");var J=E-I;d.css.style(j,{bottom:J}),z=document.createElement("img"),z.id=a.id+"_vast_static",d.css.style(z,d.extend({"max-width":"100%",opacity:0},m,o)),v([c,b]),w(b),j.appendChild(z),j.appendChild(c),A=setTimeout(k,5e3),z.onerror=k,z.onload=function(){return clearTimeout(A),0===z.naturalWidth?k():(x(),d.css.style(z,{top:-z.height},!0),d.css.style(c,{top:-z.height-8,bottom:z.height-8,left:z.width},!0),d.css.style(b,{top:-16},!0),u([j,z]),u(c,.75),new e(z).on("click tap",l),d.isMobile()||(j.onmouseover=n,j.onmouseout=p),c.onclick=c.ontouchstart=s,b.onclick=b.ontouchstart=t,void C.sendEvent(h.PLAY))},z.src=g,C.removeListeners=function(){clearTimeout(A),clearTimeout(B),j.onmouseover=j.onmouseout=c.onclick=b.onclick=null,C.resetEventListeners(),x()},C.stop=function(){v([j,z,c,b]),setTimeout(y,400),w(c),w(b)}};a.vast.staticplayer=function(a,e){function n(a){z.sendEvent(g,a)}function q(){A=a.getPosition(),B>0&&(0===A?z.addEventListener(g,r):z.addEventListener(g,s)),v(h.PLAY)}function r(a){A=a.position,z.removeEventListener(g,r),z.addEventListener(g,s)}function s(a){var b=a.position-A;b>B&&(z.removeEventListener(g,s),z.stop())}function t(){v(h.CLICK)}function u(){v(h.ERROR)}function v(a,b){b=b||{},b.tag=b.tag||y,z.sendEvent(a,b)}function w(a){return function(b){z.addEventListener(a,b)}}var x,y,z=this,A=0,B=0;d.extend(this,new f.eventdispatcher),z.type="static",a.onTime(n),z.playAd=function(f,g,n,r,s){B=d.seconds(r),y=s,x&&(x.removeListeners(),x.stop());var v=a.getProvider(),w=0===(v.name||"").indexOf("flash");if(w&&f)e.style.visibility="hidden",x=new i(f,a,g,n);else{e.style.opacity=0,e.style.visibility="visible";var z=d.isFF()?{}:o;d.css.style(e,d.extend({top:"",position:"absolute",width:"100%"},z)),c=c||document.createElement("img"),b=b||document.createElement("img"),d.css.style([c,b],d.extend({opacity:.75},m,z)),c.src=j+k,b.src=j+l,x=new p(a,g,n,e)}x.addEventListener(h.PLAY,q),x.addEventListener(h.CLICK,t),x.addEventListener(h.ERROR,u)},z.removeEvents=function(){z.resetEventListeners()},z.getState=function(){return f.state.PLAYING},z.stop=function(){A&&x&&(A=0,B=0,z.removeEventListener(g,r),z.removeEventListener(g,s),x.removeListeners(),x.stop(),v(h.COMPLETE))},z.pause=function(){},z.onPlay=w(h.PLAY),z.onComplete=w(h.COMPLETE),z.onClick=w(h.CLICK),z.onError=w(h.ERROR)}}(window.jwplayer),function(a){var b=a.vast,c=a.events.state;b.vpaidplayer=function(b,d,e,f,g){function h(){A(K,l),A(L,m),A(N,o),A(O,p),A(U,r),A(V,s),A(M,q),A(P,t),A(T,n),A(W,j),A(Q,u),A(R,v),A(S,w);var a=b.getSafeRegion(!1);y("initAd",a.width,a.height+a.y,i(),0,g)}function i(){return b.getFullscreen()?"fullscreen":"normal"}function j(){k(J.ERROR)}function k(a,b){I&&(b=b||{},b.tag||(b.tag=f),I.sendEvent(a,b))}function l(a){F=a,o(a),z("adVolume",b.getMute()?0:b.getVolume()/100),y("startAd")}function m(a){F=a,a.linear&&D.blocking&&D.blocking.hide(),k(J.PLAY,{oldstate:c.BUFFERING,newstate:c.PLAYING,linear:a.linear?"linear":"nonlinear"})}function n(a){F=a,k(J.CLICK)}function o(a){F=a;var c,d,e;if(a.linear){if(D.blocking)D.blocking.hide();else{E=!0,b.setControls(!1);var f=b.getState();(f===f.PLAYING||f===f.BUFFERING)&&b.pause(!0)}e=b.getSafeRegion(!1),d=e.height+e.y,c=e.width}else D.blocking?(D.blocking.destroy(),D.blocking=null):E&&(b.play(!0),b.setControls(!0)),e=b.getSafeRegion(!0),d=e.height+e.y,c=e.width;y("resizeAd",c,d,i())}function p(a){F=a,k(J.EXPANDED_CHANGE,{expanded:F.expanded})}function q(a){F=a,E&&(b.play(!0),b.setControls(!0)),k(J.COMPLETE)}function r(a){F=a,H||(H=!0,k(J.PAUSE,{newstate:c.PAUSED,oldstate:c.PLAYING}))}function s(a){F=a,H&&(H=!1,k(J.PLAY,{newstate:c.PLAYING,oldstate:c.PAUSED}))}function t(a){F=a,G=Math.max(G,1);var b=0;a.remainingTime>0&&(G=Math.max(G,a.remainingTime),b=G-a.remainingTime),k(J.TIME,{position:b,duration:G})}function u(a){F=a,x(1,a.remainingTime)}function v(a){F=a,x(2,a.remainingTime)}function w(a){F=a,x(3,a.remainingTime)}function x(a,b){G=Math.max(G,1),b>0&&(G=Math.max(G,4*b/(4-a))),k(J.TIME,{position:G*a*.25,duration:G})}function y(){var a=Array.prototype.slice.call(arguments);a.unshift("vast:callVpaid"),d.triggerFlash.apply(d,a)}function z(a,b){d.triggerFlash("vast:setVpaidProperty",a,b)}function A(a,b){d.triggerFlash("vast:addVpaidListener",a,B(b))}function B(a){var c=b.id+":vast:"+a.name+":"+Math.random().toString(16).substr(2);return d.on(c,a,D),c}function C(a){return function(b){I&&I.addEventListener(a,b)}}var D=this,E=!1,F={linear:!1,expanded:!1,remainingTime:-1},G=0,H=!1,I=new a.events.eventdispatcher,J={TIME:"time",CLICK:"click",PLAY:"play",PAUSE:"pause",ERROR:"error",COMPLETE:"complete",EXPANDED_CHANGE:"expandedChange"},K="AdLoaded",L="AdStarted",M="AdStopped",N="AdLinearChange",O="AdExpandedChange",P="AdRemainingTimeChange",Q="AdVideoFirstQuartile",R="AdVideoMidpoint",S="AdVideoThirdQuartile",T="AdClickThru",U="AdPaused",V="AdPlaying",W="AdError";D.type="vpaid",D.blocking=null,this.setVolume=function(a){z("adVolume",a)},D.setVolume=function(a){z("adVolume",a/100)},D.onTime=C(J.TIME),D.onComplete=C(J.COMPLETE),D.onClick=C(J.CLICK),D.onPlay=C(J.PLAY),D.onPause=C(J.PAUSE),D.onError=C(J.ERROR),D.onExpandedChange=C(J.EXPANDED_CHANGE),D.play=function(){y("resumeAd")},D.pause=function(){y("pauseAd")},D.stop=function(){y("stopAd")},D.resize=function(){var a=b.getSafeRegion(!F.linear);y("resizeAd",a.width,a.height+a.y,i())},D.removeEvents=function(){I&&I.resetEventListeners()},D.destroy=function(){D.removeEvents(),d.off(null,null,D),D.blocking=null,I=null},D.getState=function(){return F.linear?H?c.PAUSED:c.PLAYING:c.IDLE},d.triggerFlash("vast:loadVpaid",e,B(h),B(j))}}(window.jwplayer),function(a){function b(a){for(var b=[],c=0;ce[l.file].width)&&(l=n),o.width>=k.width&&(!m||o.width=0?n.skipoffset:null;return{skipoffset:a.skipoffset||b,skipMessage:n.skipMessage,skipText:n.skipText}}function B(a){if(aa){var b;if(b=aa.length?aa[a]:aa,b.vastAd)return b.vastAd}else if(!fa&&ea)return ea[a];return fa}function C(a,b){b=b||900;var c=B(ga),d=c.tracker;d.error(b);var e=v();e.code=b,e.message=a,ba.sendEvent(h.JWPLAYER_AD_ERROR,e)}function D(a){var b=B(ga),c=b.tracker;a.fullscreen&&c.started&&c.fullscreen()}function E(a){Z&&Z.setVolume(a.volume)}function F(a){Z&&Z.setVolume(a.mute?0:j.getVolume())}function G(a){$&&(ga=a.index)}function H(a){var d,e=B(ga),i=e.tracker;if(i.started)a.oldstate===h.state.PAUSED&&(i.resume(),I(a));else{Z&&(i.linear=a.linear);var k=f.extend({linear:i.linear},v(),A(e));k.message=n.dynamicMessage||"",k.clickthrough=e.clickthrough,k.sequence&&(k.podMessage=n.podMessage||""),e.adTitle&&(k.title=e.adTitle),e.companions&&(k.companions=e.companions),j.dispatchEvent(h.JWPLAYER_AD_META,k),e.companions&&(d=v(),d.companions=b(e.companions),j.dispatchEvent(h.JWPLAYER_AD_COMPANIONS,d));var m,p=l;m=f.flashVersion()>9?e.companions:c(e.companions),n.companion&&m&&m.length&&(i.hasComp=p.addCompanion(n.companion,m));var q=X(e);i.addUrl("impression",q),i.impression(),g.isFunction(o)&&o({type:"url",data:{url:q}}),d=v(),d.adposition=ca._position||"",d.adtitle=e.adTitle||"",d.adsystem=e.adsystem||"",d.vastversion=e.vastversion,d.creativetype=_,ba.sendEvent(h.JWPLAYER_AD_IMPRESSION,d),i.start(),i.creativeView(),I(a)}}function I(a){if("static"!==Y&&("vpaid"!==Y||"linear"===a.linear)){var b=v();b.oldstate=a.oldstate,b.newstate=a.newstate,j.dispatchEvent(h.JWPLAYER_AD_PLAY,b)}}function J(a){var b=B(ga),c=b.tracker;c.pause();var d=v();d.oldstate=a.oldstate,d.newstate=a.newstate,j.dispatchEvent(h.JWPLAYER_AD_PAUSE,d)}function K(a){var b=B(ga),c=a.position,d=a.duration,e=n.dynamicMessage||"",f=n.podMessage||"",g=d-c,i=b.tracker;if(i&&i.time(c,d),$&&e&&g>0){if(e=e.replace(/xx/gi,""+Math.round(g)),aa&&aa.length){var k=ga+1;f=f.replace(/__AD_POD_CURRENT__/g,""+k),f=f.replace(/__AD_POD_LENGTH__/g,""+aa.length),e=f+e}$.setText(e)}var l=v();l.position=c,l.duration=d,j.dispatchEvent(h.JWPLAYER_AD_TIME,l)}function L(){M(),N()}function M(){var a=B(ga),b=a.tracker;b.firedError||(b.complete(),b.close(),j.dispatchEvent(h.JWPLAYER_AD_COMPLETE,v()))}function N(){t(),ba.sendEvent(h.JWPLAYER_AD_COMPLETE)}function O(a){var b=B(ga),c=b.tracker;c&&(a.mute?(c.mute(),Z&&Z.setVolume(0)):(c.unmute(),Z&&Z.setVolume(j.getVolume()/100)))}function P(){var a=B(ga);j.pause(!0),S(a)}function Q(){var a=B(ga);S(a)}function R(){var a=B(ga),b=$.getState()===h.state.PAUSED;b||S(a)}function S(b){b.tracker.click(),j.dispatchEvent(h.JWPLAYER_AD_CLICK,v());var c=a.jwcast&&a.jwcast.player.id;c||b.clickthrough&&a.open(b.clickthrough)}function T(){var a=B(ga);a.tracker.skip(),j.dispatchEvent(h.JWPLAYER_AD_SKIPPED,v())}function U(a){a.message&&-1!==a.message.indexOf("File could not be played")?C("Error Playing Creative",405):C("Error Playing Ad Tag",400)}function V(){var a="Unable to fetch NonLinear resource",b=502;C(a,b)}function W(a){var b=B(ga),c=b.tracker;a.expanded?c.expand():c.collapse()}function X(a){var b=p()?"flash":"html5",c={d:m.domain,c:"vast",m:b,a:m.account,co:a.tracker.hasComp,p:ca._position,ad:a.adsystem,type:a.tracker.linear,ph:m.hosting,ed:m.edition,n:Math.random().toFixed(16).substr(2,16)},d=m.trackingbase,e="?";for(var f in c)d+=e+f+"="+encodeURIComponent(c[f]),e="&";return d}var Y,Z,$,_,aa,ba=this,ca=i.scheduledAd(),da=i.adBuffet(),ea=i.adPod(),fa=da.length?da[0]:null,ga=0;f.extend(ba,new h.eventdispatcher),ba.init=function(a){if(ba.init=function(){throw"vast.adplayer can only be initialized once"},fa&&u(fa),ea)for(var b=0;b1e3&&(k=k.substring(0,1e3)),a=G(a,h,encodeURIComponent(k))}else a=G(a,h,"")}return a}function G(a,b,c){return a.replace(b,c)}function H(a){var b=a.vloader;Y.removeEventListener(f.state.PLAYING,w),clearTimeout(la),la=-1,ja.isWaterfalling||N(),E(b);var c=new d.adplayer(b,i,W,X,aa,Z,na);c.addEventListener(f.JWPLAYER_AD_ERROR,K),c.addEventListener(f.JWPLAYER_AD_IMPRESSION,L);var e=c.init(fa);return e?(ma=fa,fa=null,c.addEventListener(f.JWPLAYER_AD_COMPLETE,M),void ha.push(c)):void c.destroy()}function I(){N()}function J(){for(var a=ha.length;a--;){var b=ha[a];ha.length--,b.destroy()}}function K(a){if(ka=!1,Q(a),!ka&&c(ja)){fa=ma;var b=g.extend({},ja);return b._offset=0,b.isWaterfalling=!0,void v(b)}J(),ka=!1,la=setTimeout(function(){la=-1,0===ga.length&&("post"===ba&&i.attachMedia(),O())},0)}function L(a){ja={},V&&!V.started&&V.breakStart(),i.dispatchEvent(f.JWPLAYER_AD_IMPRESSION,a)}function M(){V&&V.breakEnd(),0===ga.length&&"post"===ba&&i.attachMedia()}function N(){if(ha.length){var a=ha[ha.length-1];a.clearNonlinear()}}function O(){fa&&(fa.destroy(),fa=null),ma=null}function P(a){Y.removeEventListener(f.state.PLAYING,w);var b=a.vloader,e=b.allAds();if(E(b),e&&e.length){var h=e[0];if(h){var i=h.trackers;if(i&&i.error){var j=new d.tracker(i,na);j.error(a.code)}}}var k=C(b.scheduledAd(),a.url);if(k.message=a.message,k.code=a.code,a.wrappedUrl!==a.url&&(k.wrappedTag=a.wrappedUrl),ka=!1,Q(k),!ka&&c(ja)){var l=g.extend({},ja);return l._offset=0,l.isWaterfalling=!0,void v(l)}J(),ka=!1,-1===la&&(la=setTimeout(function(){la=-1,0===ga.length&&O()},0))}function Q(a){e.extend(a,{client:"vast"}),V&&V.error(a.code),i.dispatchEvent(f.JWPLAYER_AD_ERROR,a)}function R(){var a=window.location.href;return a=a.match(new RegExp(/^[^/]*:\/\/\/?([^\/]*)/)),a&&a.length>1?a[1]:""}function S(a){var b=a.getMidRolls(),c=[];b.length&&(e.foreach(b,function(a,b){"nonlinear"!==b._type&&c.push({begin:b._offSet,text:Z.cuetext})}),i.setCues(c))}var T,U,V,W,X,Y=this,Z={},$=!1,_=!1,aa={},ba="",ca=!1,da=!1,ea=0,fa=null,ga=[],ha=[],ia=!1,ja={},ka=!1,la=-1,ma=null,na=null;e.extend(Y,new f.eventdispatcher),j.debug&&j.trackFn&&(na=j.trackFn),U=T=d.configparser.getSchedule(j),T.isVMAP()&&l(T.getVMAP()),i.onReady(function(){$=!0,W=new d.staticplayer(i,k),X=new d.companion(na);var b=window.location.href,c=new e.key(i.getConfig().key),f=c.edition();aa.trackingbase=(b.match(/^https/)?"https://s":"http://i")+".n.jwpltx.com/v1/adclient/ping.gif",aa.account=c.token(),aa.domain=R(),aa.edition=g.indexOf(["pro","premium","ads","invalid","enterprise"],f)+1,aa.hosting=a.defaults&&a.defaults.ph?a.defaults.ph:0,Z=d.configparser.getOptParams(j),i.onBeforePlay(o),i.onCast(m),i.onPlay(n),i.onTime(p),i.onBeforeComplete(q),i.onPlaylistItem(x),i.onPlaylistComplete(x),i.onComplete(I)}),Y.destroy=function(){x({index:0})},i.pauseAd=function(){if(ha.length){var a=ha[ha.length-1],b=a.getState();b===f.state.PLAYING||b===f.state.BUFFERING?a.pause():b===f.state.PAUSED&&a.play()}},i.playAd=function(a){ka=!0,N();var b;b=g.isArray(a)?a.slice(0):[a];var c={_id:A(12),_adQueue:b,_waterfallIndex:0,_offset:0,_position:"api"};v(c)}},a().registerPlugin("vast","7.0",d.adcontroller,"vast.swf")}(window.jwplayer);