(function(g){var window=this;var JDa=function(a,b){return g.Vb(a,b)},l6=function(a){g.an(a,"zx",g.ub());
return a},m6=function(a,b,c){g.xa(c)||(c=[String(c)]);
g.dn(a.o,b,c)},KDa=function(a,b){var c=[];
g.Ok(b,function(a){try{var b=g.AD.prototype.A.call(this,a,!0)}catch(f){if("Storage: Invalid value was encountered"==f)return;throw f;}g.u(b)?g.zD(b)&&c.push(a):c.push(a)},a);
return c},LDa=function(a,b){var c=KDa(a,b);
(0,g.D)(c,function(a){g.AD.prototype.remove.call(this,a)},a)},MDa=function(a){if(a.Nd){if(a.Nd.locationOverrideToken)return{locationOverrideToken:a.Nd.locationOverrideToken};
if(null!=a.Nd.latitudeE7&&null!=a.Nd.longitudeE7)return{latitudeE7:a.Nd.latitudeE7,longitudeE7:a.Nd.longitudeE7}}return null},NDa=function(a,b,c,d){var e=new g.Sm(null,void 0);
a&&g.Tm(e,a);b&&g.Um(e,b);c&&g.Vm(e,c);d&&g.Wm(e,d);return e},ODa=function(a){g.eG[a]&&(a=g.eG[a],(0,g.D)(a,function(a){g.cG[a]&&delete g.cG[a]}),a.length=0)},PDa=function(a){var b=g.bG();
if(b)if(b.clear(a),a)ODa(a);else for(var c in g.eG)ODa(c)},n6=function(a){this.app=this.name=this.id="";
this.type="REMOTE_CONTROL";this.obfuscatedGaiaId=this.avatar=this.username="";this.B=!1;this.capabilities=new window.Set;this.experiments=new window.Set;this.theme="u";new g.Mm;this.o=this.A="";a&&(this.id=a.id||a.name,this.name=a.name,this.app=a.app,this.type=a.type||"REMOTE_CONTROL",this.username=a.user||"",this.avatar=a.userAvatarUri||"",this.obfuscatedGaiaId=a.obfuscatedGaiaId||"",this.theme=a.theme||"u",QDa(this,a.capabilities||""),RDa(this,a.experiments||""),this.A=a.remoteControllerUrl||"",
this.o=a.localChannelEncryptionKey||"")},QDa=function(a,b){a.capabilities.clear();
(0,g.Vd)(b.split(","),g.Da(JDa,SDa)).forEach(function(b){a.capabilities.add(b)})},RDa=function(a,b){a.experiments.clear();
b.split(",").forEach(function(b){a.experiments.add(b)})},o6=function(a){a=a||{};
this.name=a.name||"";this.id=a.id||a.screenId||"";this.token=a.token||a.loungeToken||"";this.uuid=a.uuid||a.dialId||""},p6=function(a,b){return!!b&&(a.id==b||a.uuid==b)},TDa=function(a){return{name:a.name,
screenId:a.id,loungeToken:a.token,dialId:a.uuid}},UDa=function(a){return new o6(a)},VDa=function(a){return g.xa(a)?(0,g.I)(a,UDa):[]},q6=function(a){return a?'{name:"'+a.name+'",id:'+a.id.substr(0,6)+"..,token:"+(a.token?".."+a.token.slice(-6):"-")+",uuid:"+(a.uuid?".."+a.uuid.slice(-6):"-")+"}":"null"},r6=function(a){return g.xa(a)?"["+(0,g.I)(a,q6).join(",")+"]":"null"},s6=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(a){var b=16*Math.random()|0;
return("x"==a?b:b&3|8).toString(16)})},WDa=function(a){return(0,g.I)(a,function(a){return{key:a.id,
name:a.name}})},t6=function(a,b){return g.Ia(a,function(a){return a||b?!a!=!b?!1:a.id==b.id:!0})},u6=function(a,b){return g.Ia(a,function(a){return p6(a,b)})},XDa=function(){var a=(0,g.pH)();
a&&LDa(a,a.o.ge(!0))},v6=function(){var a=g.sH("yt-remote-connected-devices")||[];
g.db(a);return a},YDa=function(a){if(g.Na(a))return[];
var b=a[0].indexOf("#"),c=-1==b?a[0]:a[0].substring(0,b);return(0,g.I)(a,function(a,b){return 0==b?a:a.substring(c.length)})},ZDa=function(a){g.rH("yt-remote-connected-devices",a,86400)},x6=function(){if(w6)return w6;
var a=g.sH("yt-remote-device-id");a||(a=s6(),g.rH("yt-remote-device-id",a,31536E3));for(var b=v6(),c=1,d=a;g.Ma(b,d);)c++,d=a+"#"+c;return w6=d},y6=function(){var a=v6(),b=x6();
g.Ma(a,b);g.uH()&&g.gb(a,b);a=YDa(a);if(g.Na(a))try{g.NG("remote_sid")}catch(c){}else try{g.MG("remote_sid",a.join(","),-1)}catch(c){}},$Da=function(){return g.sH("yt-remote-session-browser-channel")},aEa=function(){return g.sH("yt-remote-local-screens")||[]},bEa=function(){g.rH("yt-remote-lounge-token-expiration",!0,86400)},cEa=function(a){5<a.length&&(a=a.slice(a.length-5));
var b=(0,g.I)(aEa(),function(a){return a.loungeToken}),c=(0,g.I)(a,function(a){return a.loungeToken});
(0,g.Am)(c,function(a){return!g.Ma(b,a)})&&bEa();
g.rH("yt-remote-local-screens",a,31536E3)},dEa=function(a,b){g.rH("yt-remote-session-browser-channel",a);
g.rH("yt-remote-session-screen-id",b);var c=v6(),d=x6();g.Ma(c,d)||c.push(d);ZDa(c);y6()},z6=function(a){a||(g.tH("yt-remote-session-screen-id"),g.tH("yt-remote-session-video-id"));
y6();a=v6();g.Sa(a,x6());ZDa(a)},eEa=function(){if(!A6){var a=g.LD();
a&&(A6=new g.uD(a))}return A6?!!A6.get("yt-remote-use-staging-server"):!1},fEa=function(){var a=window.document.createElement("a");
g.hd(a,"https://web.archive.org/web/20181027081346/https://www.gstatic.com/cv/js/sender/v1/cast_sender.js");a=a.href.replace(/^[a-zA-Z]+:\/\//,"//");return"js-"+g.zb(a)},gEa=function(a,b,c){c=void 0===c?null:c;
var d=g.Od("SCRIPT");d.id=a;d.onload=function(){b&&(0,window.setTimeout)(b,0)};
d.onreadystatechange=function(){switch(d.readyState){case "loaded":case "complete":d.onload()}};
c&&d.setAttribute("nonce",c);g.jd(d,g.me("https://web.archive.org/web/20181027081346/https://www.gstatic.com/cv/js/sender/v1/cast_sender.js"));a=window.document.getElementsByTagName("head")[0]||window.document.body;a.insertBefore(d,a.firstChild);return d},hEa=function(a){a=void 0===a?null:a;
var b=fEa(),c=window.document.getElementById(b),d=c&&g.nF(c,"loaded");d||c&&!d||(c=gEa(b,function(){g.nF(c,"loaded")||(g.mF(c,"loaded","true"),g.iG(b),g.mE(g.Da(PDa,b),0))},a))},iEa=function(){var a=void 0===a?null:a;
window.spf?window.spf.script.load("https://web.archive.org/web/20181027081346/https://www.gstatic.com/cv/js/sender/v1/cast_sender.js","",void 0):hEa(a)},B6=function(a){return!!window.document.currentScript&&(-1!=window.document.currentScript.src.indexOf("?"+a)||-1!=window.document.currentScript.src.indexOf("&"+a))},jEa=function(){return"function"==typeof window.__onGCastApiAvailable?window.__onGCastApiAvailable:null},C6=function(a){a.length?kEa(a.shift(),function(){C6(a)}):D6()},lEa=function(a){return"chrome-extension://"+a+E6},kEa=function(a,
b,c){var d=window.document.createElement("script");
d.onerror=b;c&&(d.onload=c);d.src=a;(window.document.head||window.document.documentElement).appendChild(d)},F6=function(a){return 0<=window.navigator.userAgent.indexOf(a)},D6=function(){var a=jEa();
a&&a(!1,"No cast extension found")},G6=function(){if(mEa){var a=2,b=jEa(),c=function(){a--;
0==a&&b&&b(!0)};
window.__onGCastApiAvailable=c;kEa("//web.archive.org/web/20181027081346/https://www.gstatic.com/cast/sdk/libs/sender/1.0/cast_framework.js",D6,c)}},nEa=function(){var a=window.__gCrWeb&&window.__gCrWeb.message&&window.__gCrWeb.message.invokeOnHost;
a&&(G6(),a({command:"cast.sender.init"}))},oEa=function(){G6();
var a=window.navigator.userAgent.match(/Chrome\/([0-9]+)/);C6(["//web.archive.org/web/20181027081346/https://www.gstatic.com/eureka/clank/"+(a?(0,window.parseInt)(a[1],10):0)+E6,"//web.archive.org/web/20181027081346/https://www.gstatic.com/eureka/clank"+E6])},H6=function(a,b,c){g.L.call(this);
this.F=null!=c?(0,g.B)(a,c):a;this.Fd=b;this.D=(0,g.B)(this.wL,this);this.o=!1;this.A=0;this.B=this.Fa=null;this.C=[]},I6=function(){},J6=function(a,b,c,d){this.o=a;
this.B=b;this.G=c;this.F=d||1;this.C=45E3;this.Z=new g.hn(this);this.A=new g.Bg;this.A.setInterval(250)},qEa=function(a,b,c){a.xk=1;
a.Ph=l6(b.clone());a.Dj=c;a.D=!0;pEa(a,null)},K6=function(a,b,c,d,e){a.xk=1;
a.Ph=l6(b.clone());a.Dj=null;a.D=c;e&&(a.SF=!1);pEa(a,d)},pEa=function(a,b){a.wl=(0,g.H)();
L6(a);a.si=a.Ph.clone();m6(a.si,"t",a.F);a.ho=0;a.Xc=a.o.Ft(a.o.Yn()?b:null);0<a.ju&&(a.fr=new g.tl((0,g.B)(a.nH,a,a.Xc),a.ju));a.Z.X(a.Xc,"readystatechange",a.QW);var c=a.dj?g.cc(a.dj):{};a.Dj?(a.Vr="POST",c["Content-Type"]="application/x-www-form-urlencoded",a.Xc.send(a.si,a.Vr,a.Dj,c)):(a.Vr="GET",a.SF&&!g.Jd&&(c.Connection="close"),a.Xc.send(a.si,a.Vr,null,c));a.o.Hf(1)},tEa=function(a,b,c){for(var d=!0;!a.Oi&&a.ho<c.length;){var e=rEa(a,c);
if(e==M6){4==b&&(a.Qh=4,N6(15),d=!1);break}else if(e==sEa){a.Qh=4;N6(16);d=!1;break}else O6(a,e)}4==b&&0==c.length&&(a.Qh=1,N6(17),d=!1);a.Of=a.Of&&d;d||(P6(a),Q6(a))},rEa=function(a,b){var c=a.ho,d=b.indexOf("\n",c);
if(-1==d)return M6;c=Number(b.substring(c,d));if((0,window.isNaN)(c))return sEa;d+=1;if(d+c>b.length)return M6;var e=b.substr(d,c);a.ho=d+c;return e},vEa=function(a,b){a.wl=(0,g.H)();
L6(a);var c=b?window.location.hostname:"";a.si=a.Ph.clone();g.an(a.si,"DOMAIN",c);g.an(a.si,"t",a.F);try{a.Pf=new window.ActiveXObject("htmlfile")}catch(n){P6(a);a.Qh=7;N6(22);Q6(a);return}var d="<html><body>";if(b){for(var e="",f=0;f<c.length;f++){var k=c.charAt(f);if("<"==k)e+="\\x3c";else if(">"==k)e+="\\x3e";else{var l=k;if(l in R6)k=R6[l];else if(l in uEa)k=R6[l]=uEa[l];else{var m=l.charCodeAt(0);if(31<m&&127>m)k=l;else{if(256>m){if(k="\\x",16>m||256<m)k+="0"}else k="\\u",4096>m&&(k+="0");k+=
m.toString(16).toUpperCase()}k=R6[l]=k}e+=k}}d+='<script>document.domain="'+e+'"\x3c/script>'}c=g.kd(g.Ac("b/12014412"),d+"</body></html>");a.Pf.open();a.Pf.write(g.ad(c));a.Pf.close();a.Pf.parentWindow.m=(0,g.B)(a.YV,a);a.Pf.parentWindow.d=(0,g.B)(a.bF,a,!0);a.Pf.parentWindow.rpcClose=(0,g.B)(a.bF,a,!1);c=a.Pf.createElement("DIV");a.Pf.parentWindow.document.body.appendChild(c);d=g.Oc(a.si.toString());d=g.ob(g.Lc(d));d=g.kd(g.Ac("b/12014412"),'<iframe src="'+d+'"></iframe>');g.gd(c,g.ad(d));a.o.Hf(1)},
L6=function(a){a.Xx=(0,g.H)()+a.C;
wEa(a,a.C)},wEa=function(a,b){if(null!=a.Ol)throw Error("WatchDog timer not null");
a.Ol=S6((0,g.B)(a.oW,a),b)},T6=function(a){a.Ol&&(g.x.clearTimeout(a.Ol),a.Ol=null)},Q6=function(a){a.o.eB()||a.Oi||a.o.Mq(a)},P6=function(a){T6(a);
g.lf(a.fr);a.fr=null;a.A.stop();g.on(a.Z);if(a.Xc){var b=a.Xc;a.Xc=null;b.abort();b.dispose()}a.Pf&&(a.Pf=null)},O6=function(a,b){try{a.o.TE(a,b),a.o.Hf(4)}catch(c){}},yEa=function(a,b,c,d,e){if(0==d)c(!1);
else{var f=e||0;d--;xEa(a,b,function(e){e?c(!0):g.x.setTimeout(function(){yEa(a,b,c,d,f)},f)})}},xEa=function(a,b,c){var d=new window.Image;
d.onload=function(){try{U6(d),c(!0)}catch(e){}};
d.onerror=function(){try{U6(d),c(!1)}catch(e){}};
d.onabort=function(){try{U6(d),c(!1)}catch(e){}};
d.ontimeout=function(){try{U6(d),c(!1)}catch(e){}};
g.x.setTimeout(function(){if(d.ontimeout)d.ontimeout()},b);
d.src=a},U6=function(a){a.onload=null;
a.onerror=null;a.onabort=null;a.ontimeout=null},zEa=function(a){this.o=a;
this.A=new I6},AEa=function(a){var b=V6(a.o,a.Xl,"/mail/images/cleardot.gif");
l6(b);yEa(b.toString(),5E3,(0,g.B)(a.BK,a),3,2E3);a.Hf(1)},X6=function(a){var b=a.o.J;
if(null!=b)N6(5),b?(N6(11),W6(a.o,a,!1)):(N6(12),W6(a.o,a,!0));else if(a.Je=new J6(a,void 0,void 0,void 0),a.Je.dj=a.hu,b=a.o,b=V6(b,b.Yn()?a.Pm:null,a.iu),N6(5),!g.Hd||g.sc(10))m6(b,"TYPE","xmlhttp"),K6(a.Je,b,!1,a.Pm,!1);else{m6(b,"TYPE","html");var c=a.Je;a=!!a.Pm;c.xk=3;c.Ph=l6(b.clone());vEa(c,a)}},Y6=function(a,b,c){this.o=1;
this.A=[];this.C=[];this.D=new I6;this.H=a||null;this.J=null!=b?b:null;this.F=c||!1},BEa=function(a,b){this.o=a;
this.map=b;this.context=null},CEa=function(a){g.of.call(this,"statevent",a)},DEa=function(a,b){g.of.call(this,"timingevent",a);
this.size=b},EEa=function(a){g.of.call(this,"serverreachability",a)},HEa=function(a){FEa(a);
if(3==a.o){var b=a.Kn++,c=a.xp.clone();g.an(c,"SID",a.B);g.an(c,"RID",b);g.an(c,"TYPE","terminate");Z6(a,c);b=new J6(a,a.B,b,void 0);b.xk=2;b.Ph=l6(c.clone());(new window.Image).src=b.Ph;b.wl=(0,g.H)();L6(b)}GEa(a)},IEa=function(a){a.XK(1,0);
a.xp=V6(a,null,a.gu);$6(a)},FEa=function(a){a.Fh&&(a.Fh.abort(),a.Fh=null);
a.Bc&&(a.Bc.cancel(),a.Bc=null);a.Jg&&(g.x.clearTimeout(a.Jg),a.Jg=null);a7(a);a.ne&&(a.ne.cancel(),a.ne=null);a.Kh&&(g.x.clearTimeout(a.Kh),a.Kh=null)},JEa=function(a,b){if(0==a.o)throw Error("Invalid operation: sending map when state is closed");
a.A.push(new BEa(a.KR++,b));2!=a.o&&3!=a.o||$6(a)},$6=function(a){a.ne||a.Kh||(a.Kh=S6((0,g.B)(a.ZE,a),0),a.lk=0)},LEa=function(a,b){if(1==a.o){if(!b){a.Kn=Math.floor(1E5*Math.random());
var c=a.Kn++,d=new J6(a,"",c,void 0);d.dj=null;var e=b7(a),f=a.xp.clone();g.an(f,"RID",c);g.an(f,"CVER","1");Z6(a,f);qEa(d,f,e);a.ne=d;a.o=2}}else 3==a.o&&(b?KEa(a,b):0==a.A.length||a.ne||KEa(a))},KEa=function(a,b){if(b)if(6<a.Qi){a.A=a.C.concat(a.A);
a.C.length=0;var c=a.Kn-1;var d=b7(a)}else c=b.G,d=b.Dj;else c=a.Kn++,d=b7(a);var e=a.xp.clone();g.an(e,"SID",a.B);g.an(e,"RID",c);g.an(e,"AID",a.Nk);Z6(a,e);c=new J6(a,a.B,c,a.lk+1);c.dj=null;c.setTimeout(1E4+Math.round(1E4*Math.random()));a.ne=c;qEa(c,e,d)},Z6=function(a,b){if(a.Ed){var c=a.Ed.KA();
c&&g.Hb(c,function(a,c){g.an(b,c,a)})}},b7=function(a){var b=Math.min(a.A.length,1E3),c=["count="+b];
if(6<a.Qi&&0<b){var d=a.A[0].o;c.push("ofs="+d)}else d=0;for(var e=0;e<b;e++){var f=a.A[e].o,k=a.A[e].map;f=6>=a.Qi?e:f-d;try{g.Hb(k,function(a,b){c.push("req"+f+"_"+b+"="+(0,window.encodeURIComponent)(a))})}catch(l){c.push("req"+f+"_type="+(0,window.encodeURIComponent)("_badmap"))}}a.C=a.C.concat(a.A.splice(0,b));
return c.join("&")},MEa=function(a){a.Bc||a.Jg||(a.G=1,a.Jg=S6((0,g.B)(a.YE,a),0),a.Yj=0)},c7=function(a){if(a.Bc||a.Jg||3<=a.Yj)return!1;
a.G++;a.Jg=S6((0,g.B)(a.YE,a),NEa(a,a.Yj));a.Yj++;return!0},W6=function(a,b,c){a.Tr=c;
a.gg=b.Zg;a.F||IEa(a)},a7=function(a){null!=a.Ri&&(g.x.clearTimeout(a.Ri),a.Ri=null)},NEa=function(a,b){var c=5E3+Math.floor(1E4*Math.random());
a.isActive()||(c*=2);return c*b},d7=function(a,b){if(2==b||9==b){var c=null;
a.Ed&&(c=null);var d=(0,g.B)(a.DX,a);c||(c=new g.Sm("//web.archive.org/web/20181027081346/https://www.google.com/images/cleardot.gif"),l6(c));xEa(c.toString(),1E4,d)}else N6(2);OEa(a,b)},OEa=function(a,b){a.o=0;
a.Ed&&a.Ed.Lz(b);GEa(a);FEa(a)},GEa=function(a){a.o=0;
a.gg=-1;if(a.Ed)if(0==a.C.length&&0==a.A.length)a.Ed.jt();else{g.Va(a.C);var b=g.Va(a.A);a.C.length=0;a.A.length=0;a.Ed.jt(b)}},V6=function(a,b,c){var d=g.bn(c);
if(""!=d.A)b&&g.Um(d,b+"."+d.A),g.Vm(d,d.D);else{var e=window.location;d=NDa(e.protocol,b?b+"."+e.hostname:e.hostname,+e.port,c)}a.xm&&g.Hb(a.xm,function(a,b){g.an(d,b,a)});
g.an(d,"VER",a.Qi);Z6(a,d);return d},S6=function(a,b){if(!g.za(a))throw Error("Fn must not be null and must be a function");
return g.x.setTimeout(function(){a()},b)},N6=function(a){e7.dispatchEvent(new CEa(e7,a))},PEa=function(){},QEa=function(a,b){this.action=a;
this.params=b||{}},f7=function(a,b){g.L.call(this);
this.o=new g.U(this.PV,0,this);g.M(this,this.o);this.Fd=5E3;this.A=0;if(g.za(a))b&&(a=(0,g.B)(a,b));else if(a&&g.za(a.handleEvent))a=(0,g.B)(a.handleEvent,a);else throw Error("Invalid listener argument");this.B=a},g7=function(a,b,c){this.L=a;
this.F=b;this.B=new g.tD;this.A=new f7(this.lY,this);this.o=this.jb=null;this.K=!1;this.D=null;this.J="";this.H=this.C=0;this.G=[];this.N=c||!1},REa=function(a){return{firstTestResults:[""],
secondTestResults:!a.o.Tr,sessionId:a.o.B,arrayId:a.o.Nk}},SEa=function(a,b){a.H=b||0;
a.A.stop();a.o&&(3==a.o.o&&LEa(a.o),HEa(a.o));a.H=0},h7=function(a){return!!a.o&&3==a.o.o},TEa=function(a,b){(a.F.loungeIdToken=b)||a.A.stop()},i7=function(a){this.port=this.domain="";
this.o="/api/lounge";this.A=!0;a=a||window.document.location.href;var b=g.Qg(a)||"";b&&(this.port=":"+b);this.domain=g.Pg(a)||"";a=g.Fb;0<=a.search("MSIE")&&(a=a.match(/MSIE ([\d.]+)/)[1],0>g.yb(a,"10.0")&&(this.A=!1))},j7=function(a,b){var c=a.o;
if(g.u(void 0)?0:a.A)c="https://"+a.domain+a.port+a.o;return g.Zg(c+b,{})},k7=function(a,b,c,d,e){a={format:"JSON",
method:"POST",context:a,timeout:5E3,withCredentials:!1,onSuccess:g.Da(a.C,d,!0),onError:g.Da(a.B,e),Kd:g.Da(a.D,e)};c&&(a.Tb=c,a.headers={"Content-Type":"application/x-www-form-urlencoded"});return g.DE(b,a)},XEa=function(){var a=UEa;
VEa();l7.push(a);WEa(l7)},m7=function(a,b){VEa();
var c=l7,d=YEa(a,String(b));g.Na(c)?ZEa(d):(WEa(c),(0,g.D)(c,function(a){a(d)}))},VEa=function(){l7||(l7=g.y("yt.mdx.remote.debug.handlers_")||[],g.ua("yt.mdx.remote.debug.handlers_",l7,void 0))},ZEa=function(a){var b=(n7+1)%50;
n7=b;o7[b]=a;p7||(p7=49==b)},WEa=function(a){var b=o7;
if(b[0]){var c=n7,d=p7?c:-1;do{d=(d+1)%50;var e=b[d];(0,g.D)(a,function(a){a(e)})}while(d!=c);
o7=Array(50);n7=-1;p7=!1}},YEa=function(a,b){var c=((0,g.H)()-$Ea)/1E3;
c.toFixed&&(c=c.toFixed(3));var d=[];d.push("[",c+"s","] ");d.push("[","yt.mdx.remote","] ");d.push(a+": "+b,"\n");return d.join("")},q7=function(a){g.VF.call(this);
this.G=a;this.o=[]},aFa=function(a,b){var c=a.get(b.uuid)||a.get(b.id);
if(c){var d=c.name;c.id=b.id||c.id;c.name=b.name;c.token=b.token;c.uuid=b.uuid||c.uuid;return c.name!=d}a.o.push(b);return!0},bFa=function(a,b){var c=a.o.length!=b.length;
a.o=(0,g.Vd)(a.o,function(a){return!!t6(b,a)});
for(var d=0,e=b.length;d<e;d++)c=aFa(a,b[d])||c;return c},cFa=function(a,b){var c=a.o.length;
a.o=(0,g.Vd)(a.o,function(a){return!(a||b?!a!=!b?0:a.id==b.id:1)});
return a.o.length<c},r7=function(a,b,c,d){g.VF.call(this);
this.F=a;this.D=b;this.B=c;this.C=d;this.A=0;this.o=null;this.Fa=window.NaN},t7=function(a){q7.call(this,"LocalScreenService");
this.B=a;this.A=window.NaN;s7(this);this.info("Initializing with "+r6(this.o))},dFa=function(a){if(a.o.length){var b=(0,g.I)(a.o,function(a){return a.id}),c=j7(a.B,"/pairing/get_lounge_token_batch");
k7(a.B,c,{screen_ids:b.join(",")},(0,g.B)(a.KL,a),(0,g.B)(a.JL,a))}},s7=function(a){var b=VDa(aEa());
b=(0,g.Vd)(b,function(a){return!a.uuid});
return bFa(a,b)},u7=function(a,b){cEa((0,g.I)(a.o,TDa));
b&&bEa()},w7=function(a,b){g.VF.call(this);
this.F=b;var c=g.sH("yt-remote-online-screen-ids")||"";c=c?c.split(","):[];for(var d={},e=this.F(),f=0,k=e.length;f<k;++f){var l=e[f].id;d[l]=g.Ma(c,l)}this.o=d;this.D=a;this.B=this.C=window.NaN;this.A=null;v7("Initialized with "+g.Hg(this.o))},eFa=function(a,b,c){var d=j7(a.D,"/pairing/get_screen_availability");
k7(a.D,d,{lounge_token:b.token},(0,g.B)(function(a){a=a.screens||[];for(var d=0,e=a.length;d<e;++d)if(a[d].loungeToken==b.token){c("online"==a[d].status);return}c(!1)},a),(0,g.B)(function(){c(!1)},a))},x7=function(a,b){a:if(g.Nb(b)!=g.Nb(a.o))var c=!1;
else{c=g.Qb(b);for(var d=0,e=c.length;d<e;++d)if(!a.o[c[d]]){c=!1;break a}c=!0}c||(v7("Updated online screens: "+g.Hg(a.o)),a.o=b,a.V("screenChange"));fFa(a)},y7=function(a){(0,window.isNaN)(a.B)||g.oE(a.B);
a.B=g.mE((0,g.B)(a.Zw,a),0<a.C&&a.C<(0,g.H)()?2E4:1E4)},v7=function(a){m7("OnlineScreenService",a)},gFa=function(a){var b={};
(0,g.D)(a.F(),function(a){a.token?b[a.token]=a.id:this.sc("Requesting availability of screen w/o lounge token.")});
return b},fFa=function(a){a=g.Qb(g.Ib(a.o,function(a){return a}));
g.db(a);a.length?g.rH("yt-remote-online-screen-ids",a.join(","),60):g.tH("yt-remote-online-screen-ids")},z7=function(a){q7.call(this,"ScreenService");
this.F=a;this.A=this.B=null;this.C=[];this.D={};hFa(this)},jFa=function(a,b,c,d,e,f){a.info("getAutomaticScreenByIds "+c+" / "+b);
c||(c=a.D[b]);var k=a.De();if(k=(c?u6(k,c):null)||u6(k,b)){k.uuid=b;var l=A7(a,k);eFa(a.A,l,function(a){e(a?l:null)})}else c?iFa(a,c,(0,g.B)(function(a){var f=A7(this,new o6({name:d,
screenId:c,loungeToken:a,dialId:b||""}));eFa(this.A,f,function(a){e(a?f:null)})},a),f):e(null)},kFa=function(a,b){for(var c=0,d=a.o.length;c<d;++c)if(a.o[c].name==b)return a.o[c];
return null},iFa=function(a,b,c,d){a.info("requestLoungeToken_ for "+b);
var e={Tb:{screen_ids:b},method:"POST",context:a,onSuccess:function(a,e){var f=e&&e.screens||[];f[0]&&f[0].screenId==b?c(f[0].loungeToken):d(Error("Missing lounge token in token response"))},
onError:function(){d(Error("Request screen lounge token failed"))}};
g.DE(j7(a.F,"/pairing/get_lounge_token_batch"),e)},lFa=function(a){a.o=a.B.De();
var b=a.D,c={},d;for(d in b)c[b[d]]=d;b=0;for(d=a.o.length;b<d;++b){var e=a.o[b];e.uuid=c[e.id]||""}a.info("Updated manual screens: "+r6(a.o))},hFa=function(a){B7(a);
a.B=new t7(a.F);a.B.subscribe("screenChange",(0,g.B)(a.YL,a));lFa(a);a.C=VDa(g.sH("yt-remote-automatic-screen-cache")||[]);B7(a);a.info("Initializing automatic screens: "+r6(a.C));a.A=new w7(a.F,(0,g.B)(a.De,a,!0));a.A.subscribe("screenChange",(0,g.B)(function(){this.V("onlineScreenChange")},a))},A7=function(a,b){var c=a.get(b.id);
c?(c.uuid=b.uuid,b=c):((c=u6(a.C,b.uuid))?(c.id=b.id,c.token=b.token,b=c):a.C.push(b),g.rH("yt-remote-automatic-screen-cache",(0,g.I)(a.C,TDa)));B7(a);a.D[b.uuid]=b.id;g.rH("yt-remote-device-id-map",a.D,31536E3);return b},B7=function(a){a.D=g.sH("yt-remote-device-id-map")||{}},C7=function(a,b,c){g.VF.call(this);
this.N=c;this.J=a;this.A=b;this.B=null},D7=function(a,b){m7(a.N,b)},E7=function(a,b){C7.call(this,a,b,"CastSession");
this.o=null;this.C=0;this.F=(0,g.B)(this.rY,this);this.D=(0,g.B)(this.AW,this);this.C=g.mE((0,g.B)(function(){mFa(this,null)},this),12E4)},nFa=function(a){a.info("sendYoutubeMessage_: getMdxSessionStatus "+g.Hg(void 0));
var b={type:"getMdxSessionStatus"};a.o?a.o.sendMessage("urn:x-cast:com.google.youtube.mdx",b,g.A,(0,g.B)(function(){D7(this,"Failed to send message: getMdxSessionStatus.")},a)):D7(a,"Sending yt message without session: "+g.Hg(b))},mFa=function(a,b){g.oE(a.C);
if(b){if(a.info("onConnectedScreenId_: Received screenId: "+b),!a.B||a.B.id!=b){var c=(0,g.B)(a.Nq,a),d=(0,g.B)(a.Ie,a);a.UA(b,c,d,5)}}else a.Ie(Error("Waiting for session status timed out."))},F7=function(a,b,c){C7.call(this,a,b,"DialSession");
this.C=this.H=null;this.K="";this.O=c;this.D=null;this.G=g.A;this.F=window.NaN;this.L=(0,g.B)(this.uY,this);this.o=g.A},oFa=function(a){a.o=a.J.uH(a.K,a.A.label,a.A.friendlyName,(0,g.B)(function(a){this.o=g.A;
this.Nq(a)},a),(0,g.B)(function(a){this.o=g.A;
this.Ie(a)},a))},pFa=function(a){var b={};
b.pairingCode=a.K;b.theme=a.O;if(a.D){var c=a.D.currentTime||0;b.v=a.D.videoId;b.t=c}eEa()&&(b.env_useStageMdx=1);return g.Xg(b)},G7=function(a,b){C7.call(this,a,b,"ManualSession");
this.o=g.mE((0,g.B)(this.Pk,this,null),150)},H7=function(a,b,c,d){g.VF.call(this);
this.A=a;this.G=b||"233637DE";this.F=c||"cl";this.H=d||!1;this.o=null;this.D=!1;this.B=[];this.C=(0,g.B)(this.aV,this)},qFa=function(a,b){return b?g.Ia(a.B,function(a){return p6(b,a.label)},a):null},I7=function(a){m7("Controller",a)},UEa=function(a){window.chrome&&window.chrome.cast&&window.chrome.cast.logMessage&&window.chrome.cast.logMessage(a)},J7=function(a){return a.D||!!a.B.length||!!a.o},K7=function(a,b,c){b!=a.o&&(g.lf(a.o),(a.o=b)?(c?a.V("yt-remote-cast2-receiver-resumed",b.A):a.V("yt-remote-cast2-receiver-selected",
b.A),b.subscribe("sessionScreen",(0,g.B)(a.WE,a,b)),b.B?a.V("yt-remote-cast2-session-change",b.B):c&&a.o.Pk(null)):a.V("yt-remote-cast2-session-change",null))},rFa=function(a){var b=a.A.tH(),c=a.o&&a.o.A;
a=(0,g.I)(b,function(a){c&&p6(a,c.label)&&(c=null);var b=a.uuid?a.uuid:a.id,d=qFa(this,a);d?(d.label=b,d.friendlyName=a.name):(d=new window.chrome.cast.Receiver(b,a.name),d.receiverType=window.chrome.cast.ReceiverType.CUSTOM);return d},a);
c&&(c.receiverType!=window.chrome.cast.ReceiverType.CUSTOM&&(c=new window.chrome.cast.Receiver(c.label,c.friendlyName),c.receiverType=window.chrome.cast.ReceiverType.CUSTOM),a.push(c));return a},xFa=function(a,b,c,d,e,f,k){sFa()?tFa(b,e,f,k)&&(M7(!0),window.chrome&&window.chrome.cast&&window.chrome.cast.isAvailable?uFa(a,c):(window.__onGCastApiAvailable=function(b,d){b?uFa(a,c):(N7("Failed to load cast API: "+d),O7(!1),M7(!1),g.tH("yt-remote-cast-available"),g.tH("yt-remote-cast-receiver"),vFa(),
c(!1))},d?iEa():F6("CriOS")?nEa():F6("Android")&&F6("Chrome/")&&window.navigator.presentation?oEa():window.chrome&&window.navigator.presentation&&!F6("Edge")?(G6(),C6(wFa.map(lEa))):D6())):L7("Cannot initialize because not running Chrome")},vFa=function(){L7("dispose");
var a=P7();a&&a.dispose();g.ua("yt.mdx.remote.cloudview.instance_",null,void 0);yFa(!1);g.gG(Q7);Q7.length=0},R7=function(){return!!g.sH("yt-remote-cast-installed")},zFa=function(){var a=g.sH("yt-remote-cast-receiver");
return a?a.friendlyName:null},AFa=function(){L7("clearCurrentReceiver");
g.tH("yt-remote-cast-receiver")},BFa=function(){return R7()?P7()?P7().getCastSession():(N7("getCastSelector: Cast is not initialized."),null):(N7("getCastSelector: Cast API is not installed!"),null)},T7=function(){R7()?P7()?S7()?(L7("Requesting cast selector."),P7().requestSession()):(L7("Wait for cast API to be ready to request the session."),Q7.push(g.fG("yt-remote-cast2-api-ready",T7))):N7("requestCastSelector: Cast is not initialized."):N7("requestCastSelector: Cast API is not installed!")},U7=
function(a,b){S7()?P7().setConnectedScreenStatus(a,b):N7("setConnectedScreenStatus called before ready.")},sFa=function(){var a=0<=g.Fb.search(/ (CrMo|Chrome|CriOS)\//);
return g.JI||a},CFa=function(a,b){P7().init(a,b)},tFa=function(a,b,c,d){var e=!1;
P7()||(a=new H7(a,b,c,d),a.subscribe("yt-remote-cast2-availability-change",function(a){g.rH("yt-remote-cast-available",a);g.jG("yt-remote-cast2-availability-change",a)}),a.subscribe("yt-remote-cast2-receiver-selected",function(a){L7("onReceiverSelected: "+a.friendlyName);
g.rH("yt-remote-cast-receiver",a);g.jG("yt-remote-cast2-receiver-selected",a)}),a.subscribe("yt-remote-cast2-receiver-resumed",function(a){L7("onReceiverResumed: "+a.friendlyName);
g.rH("yt-remote-cast-receiver",a)}),a.subscribe("yt-remote-cast2-session-change",function(a){L7("onSessionChange: "+q6(a));
a||g.tH("yt-remote-cast-receiver");g.jG("yt-remote-cast2-session-change",a)}),g.ua("yt.mdx.remote.cloudview.instance_",a,void 0),e=!0);
L7("cloudview.createSingleton_: "+e);return e},P7=function(){return g.y("yt.mdx.remote.cloudview.instance_")},uFa=function(a,b){O7(!0);
M7(!1);CFa(a,function(a){a?(yFa(!0),g.iG("yt-remote-cast2-api-ready")):(N7("Failed to initialize cast API."),O7(!1),g.tH("yt-remote-cast-available"),g.tH("yt-remote-cast-receiver"),vFa());b(a)})},L7=function(a){m7("cloudview",a)},N7=function(a){m7("cloudview",a)},O7=function(a){L7("setCastInstalled_ "+a);
g.rH("yt-remote-cast-installed",a)},S7=function(){return!!g.y("yt.mdx.remote.cloudview.apiReady_")},yFa=function(a){L7("setApiReady_ "+a);
g.ua("yt.mdx.remote.cloudview.apiReady_",a,void 0)},M7=function(a){g.ua("yt.mdx.remote.cloudview.initializing_",a,void 0)},V7=function(a){this.index=-1;
this.videoId=this.listId="";this.volume=this.o=-1;this.muted=!1;this.audioTrackId=null;this.G=this.H=0;this.A=null;this.hasNext=this.kg=!1;this.K=this.J=this.B=this.D=0;this.C=window.NaN;this.F=!1;this.reset(a)},W7=function(a){a.audioTrackId=null;
a.A=null;a.o=-1;a.kg=!1;a.hasNext=!1;a.H=0;a.G=(0,g.H)();a.D=0;a.B=0;a.J=0;a.K=0;a.C=window.NaN;a.F=!1},X7=function(a){return a.sb()?((0,g.H)()-a.G)/1E3:0},Y7=function(a,b){a.H=b;
a.G=(0,g.H)()},Z7=function(a){switch(a.o){case 1:case 1081:return((0,g.H)()-a.G)/1E3+a.H;
case -1E3:return 0}return a.H},$7=function(a,b,c){var d=a.videoId;
a.videoId=b;a.index=c;b!=d&&W7(a)},a8=function(a){var b={};
b.index=a.index;b.listId=a.listId;b.videoId=a.videoId;b.playerState=a.o;b.volume=a.volume;b.muted=a.muted;b.audioTrackId=a.audioTrackId;b.trackData=g.dc(a.A);b.hasPrevious=a.kg;b.hasNext=a.hasNext;b.playerTime=a.H;b.playerTimeAt=a.G;b.seekableStart=a.D;b.seekableEnd=a.B;b.duration=a.J;b.loadedTime=a.K;b.liveIngestionTime=a.C;return b},c8=function(a,b){g.VF.call(this);
this.o=0;this.C=a;this.F=[];this.D=new g.KC;this.B=this.A=null;this.J=(0,g.B)(this.tS,this);this.G=(0,g.B)(this.Nn,this);this.H=(0,g.B)(this.sS,this);this.K=(0,g.B)(this.FS,this);var c=0;a?(c=a.getProxyState(),3!=c&&(a.subscribe("proxyStateChange",this.gy,this),DFa(this))):c=3;0!=c&&(b?this.gy(c):g.mE((0,g.B)(function(){this.gy(c)},this),0));
var d=BFa();d&&b8(this,d);this.subscribe("yt-remote-cast2-session-change",this.K)},d8=function(a){return new V7(a.C.getPlayerContextData())},DFa=function(a){(0,g.D)("nowAutoplaying autoplayDismissed remotePlayerChange remoteQueueChange autoplayModeChange autoplayUpNext previousNextChange".split(" "),function(a){this.F.push(this.C.subscribe(a,g.Da(this.VU,a),this))},a)},EFa=function(a){(0,g.D)(a.F,function(a){this.C.unsubscribeByKey(a)},a);
a.F.length=0},e8=function(a,b){50>a.D.Cc()&&g.MC(a.D,b)},g8=function(a,b,c){var d=d8(a);
Y7(d,c);-1E3!=d.o&&(d.o=b);f8(a,d)},h8=function(a,b,c){a.C.sendMessage(b,c)},f8=function(a,b){EFa(a);
a.C.setPlayerContextData(a8(b));DFa(a)},b8=function(a,b){a.B&&(a.B.removeUpdateListener(a.J),a.B.removeMediaListener(a.G),a.Nn(null));
a.B=b;a.B&&(m7("CP","Setting cast session: "+a.B.sessionId),a.B.addUpdateListener(a.J),a.B.addMediaListener(a.G),a.B.media.length&&a.Nn(a.B.media[0]))},FFa=function(a){var b=a.A.media,c=a.A.customData;
if(b&&c){var d=d8(a);b.contentId!=d.videoId&&m7("CP","Cast changing video to: "+b.contentId);d.videoId=b.contentId;d.o=c.playerState;Y7(d,a.A.getEstimatedTime());f8(a,d)}else m7("CP","No cast media video. Ignoring state update.")},i8=function(a,b,c){return(0,g.B)(function(a){this.sc("Failed to "+b+" with cast v2 channel. Error code: "+a.code);
a.code!=window.chrome.cast.ErrorCode.TIMEOUT&&(this.sc("Retrying "+b+" using MDx browser channel."),h8(this,b,c))},a)},j8=function(a,b,c){g.VF.call(this);
this.D=window.NaN;this.O=!1;this.K=this.J=this.L=this.N=window.NaN;this.W=[];this.C=this.G=this.B=this.kb=this.o=null;this.sa=a;this.W.push(g.EF(window,"beforeunload",(0,g.B)(this.AL,this)));this.A=[];this.kb=new V7;this.ca=b.id;this.o=GFa(this,c);this.o.subscribe("handlerOpened",this.xS,this);this.o.subscribe("handlerClosed",this.uS,this);this.o.subscribe("handlerError",this.vS,this);this.o.subscribe("handlerMessage",this.wS,this);TEa(this.o,b.token);this.subscribe("remoteQueueChange",function(){var a=
this.kb.videoId;g.uH()&&g.rH("yt-remote-session-video-id",a)},this)},k8=function(a){m7("conn",a)},GFa=function(a,b){return new g7(j7(a.sa,"/bc"),b)},l8=function(a,b){a.V("proxyStateChange",b)},HFa=function(a){a.D=g.mE((0,g.B)(function(){k8("Connecting timeout");
this.F(1)},a),2E4)},m8=function(a){g.oE(a.D);
a.D=window.NaN},n8=function(a){g.oE(a.N);
a.N=window.NaN},IFa=function(a){o8(a);
a.L=g.mE((0,g.B)(function(){p8(this,"getNowPlaying")},a),2E4)},o8=function(a){g.oE(a.L);
a.L=window.NaN},KFa=function(a,b){b&&(m8(a),n8(a));
b==(h7(a.o)&&(0,window.isNaN)(a.D))?b&&(l8(a,1),p8(a,"getSubtitlesTrack")):b?(a.aa()&&a.kb.reset(),l8(a,1),p8(a,"getNowPlaying"),JFa(a)):a.F(1)},LFa=function(a,b){var c=b.params.videoId;
delete b.params.videoId;c==a.kb.videoId&&(g.Yb(b.params)?a.kb.A=null:a.kb.A=b.params,a.V("remotePlayerChange"))},MFa=function(a,b){var c=b.params.videoId||b.params.video_id,d=(0,window.parseInt)(b.params.currentIndex,10);
a.kb.listId=b.params.listId||a.kb.listId;$7(a.kb,c,d);a.V("remoteQueueChange")},OFa=function(a,b){b.params=b.params||{};
MFa(a,b);NFa(a,b);a.V("autoplayDismissed")},NFa=function(a,b){var c=(0,window.parseInt)(b.params.currentTime||b.params.current_time,10);
Y7(a.kb,(0,window.isNaN)(c)?0:c);c=(0,window.parseInt)(b.params.state,10);c=(0,window.isNaN)(c)?-1:c;-1==c&&-1E3==a.kb.o&&(c=-1E3);a.kb.o=c;c=Number(b.params.loadedTime);a.kb.K=(0,window.isNaN)(c)?0:c;c=Number(b.params.duration);a.kb.J=(0,window.isNaN)(c)?0:c;c=a.kb;var d=Number(b.params.liveIngestionTime);c.C=d;c.F=(0,window.isNaN)(d)?!1:!0;c=a.kb;d=Number(b.params.seekableStartTime);var e=Number(b.params.seekableEndTime);c.D=(0,window.isNaN)(d)?0:d;c.B=(0,window.isNaN)(e)?0:e;1==a.kb.o?IFa(a):o8(a);
a.V("remotePlayerChange")},PFa=function(a,b){if(-1E3!=a.kb.o){var c=1085;
switch((0,window.parseInt)(b.params.adState,10)){case 1:c=1081;break;case 2:c=1084;break;case 0:c=1083}a.kb.o=c;c=(0,window.parseInt)(b.params.currentTime,10);Y7(a.kb,(0,window.isNaN)(c)?0:c);a.V("remotePlayerChange")}},QFa=function(a,b){var c="true"==b.params.muted;
a.kb.volume=(0,window.parseInt)(b.params.volume,10);a.kb.muted=c;a.V("remotePlayerChange")},RFa=function(a,b){a.G=b.params.videoId;
a.V("nowAutoplaying",(0,window.parseInt)(b.params.timeout,10))},SFa=function(a,b){var c="true"==b.params.hasNext;
a.kb.kg="true"==b.params.hasPrevious;a.kb.hasNext=c;a.V("previousNextChange")},JFa=function(a){g.oE(a.K);
a.K=g.mE((0,g.B)(a.F,a,1),864E5)},p8=function(a,b,c){c?k8("Sending: action="+b+", params="+g.Hg(c)):k8("Sending: action="+b);
a.o.sendMessage(b,c)},q8=function(a){q7.call(this,"ScreenServiceProxy");
this.md=a;this.A=[];this.A.push(this.md.$_s("screenChange",(0,g.B)(this.pY,this)));this.A.push(this.md.$_s("onlineScreenChange",(0,g.B)(this.vU,this)))},XFa=function(a){var b={device:"Desktop",
app:"youtube-desktop"};b=g.fE("MDX_CONFIG")||b;XDa();y6();r8||(r8=new i7(b?b.loungeApiHost:void 0),eEa()&&(r8.o="/api/loungedev"));s8||(s8=g.y("yt.mdx.remote.deferredProxies_")||[],g.ua("yt.mdx.remote.deferredProxies_",s8,void 0));TFa();var c=t8();if(!c){var d=new z7(r8);g.ua("yt.mdx.remote.screenService_",d,void 0);c=t8();var e=!1,f=void 0,k=void 0,l=!1;b&&(e=!!b.loadCastApiSetupScript,f=b.appId,k=b.theme,l=!!b.disableDial);xFa(a,d,function(a){a?u8()&&U7(u8(),"YouTube TV"):d.subscribe("onlineScreenChange",
function(){g.jG("yt-remote-receiver-availability-change")})},e,f,k,l)}b&&!g.y("yt.mdx.remote.initialized_")&&(g.ua("yt.mdx.remote.initialized_",!0,void 0),v8("Initializing: "+g.Hg(b)),w8.push(g.fG("yt-remote-cast2-availability-change",function(){g.jG("yt-remote-receiver-availability-change")})),w8.push(g.fG("yt-remote-cast2-receiver-selected",function(){x8(null);
g.jG("yt-remote-auto-connect","cast-selector-receiver")})),w8.push(g.fG("yt-remote-cast2-receiver-resumed",function(){g.jG("yt-remote-receiver-resumed","cast-selector-receiver")})),w8.push(g.fG("yt-remote-cast2-session-change",UFa)),w8.push(g.fG("yt-remote-connection-change",function(a){a?U7(u8(),"YouTube TV"):y8()||(U7(null,null),AFa())})),a=z8(),b.isAuto&&(a.id+="#dial"),g.jE("desktop_enable_autoplay")&&(a.capabilities=["atp"]),a.name=b.device,a.app=b.app,(k=b.theme)&&(a.theme=k),v8(" -- with channel params: "+
g.Hg(a)),VFa(a),c.start(),u8()||WFa())},ZFa=function(){var a=YFa();
R7()&&g.sH("yt-remote-cast-available")&&a.push({key:"cast-selector-receiver",name:"Cast..."});return a},YFa=function(){var a=t8().md.$_gos();
var b=A8();b&&B8()&&(t6(a,b)||a.push(b));return WDa(a)},C8=function(){var a=$Fa();
!a&&R7()&&zFa()&&(a={key:"cast-selector-receiver",name:zFa()});return a},$Fa=function(){var a=YFa(),b=A8();
b||(b=y8());return g.Ia(a,function(a){return b&&p6(b,a.key)?!0:!1})},A8=function(){var a=u8();
if(!a)return null;var b=t8().De();return u6(b,a)},UFa=function(a){v8("remote.onCastSessionChange_: "+q6(a));
if(a){var b=A8();b&&b.id==a.id?U7(b.id,"YouTube TV"):(b&&D8(),E8(a,1))}else B8()&&D8()},D8=function(){S7()?P7().stopSession():N7("stopSession called before API ready.");
var a=B8();a&&(a.disconnect(1),F8(null))},G8=function(){var a=B8();
return!!a&&3!=a.getProxyState()},v8=function(a){m7("remote",a)},t8=function(){if(!H8){var a=g.y("yt.mdx.remote.screenService_");
H8=a?new q8(a):null}return H8},u8=function(){return g.y("yt.mdx.remote.currentScreenId_")},aGa=function(a){g.ua("yt.mdx.remote.currentScreenId_",a,void 0)},bGa=function(){return g.y("yt.mdx.remote.connectData_")},x8=function(a){g.ua("yt.mdx.remote.connectData_",a,void 0)},B8=function(){return g.y("yt.mdx.remote.connection_")},F8=function(a){var b=B8();
x8(null);a||aGa("");g.ua("yt.mdx.remote.connection_",a,void 0);s8&&((0,g.D)(s8,function(b){b(a)}),s8.length=0);
b&&!a?g.jG("yt-remote-connection-change",!1):!b&&a&&g.jG("yt-remote-connection-change",!0)},y8=function(){var a=g.uH();
if(!a)return null;var b=t8().De();return u6(b,a)},E8=function(a,b){A8()&&A8();
aGa(a.id);var c=new j8(r8,a,z8());c.connect(b,bGa());c.subscribe("beforeDisconnect",function(a){g.jG("yt-remote-before-disconnect",a)});
c.subscribe("beforeDispose",function(){B8()&&F8(null)});
F8(c)},WFa=function(){var a=y8();
a?(v8("Resume connection to: "+q6(a)),E8(a,0)):(z6(),AFa(),v8("Skipping connecting because no session screen found."))},TFa=function(){var a=z8();
if(g.Yb(a)){a=x6();var b=g.sH("yt-remote-session-name")||"",c=g.sH("yt-remote-session-app")||"";a={device:"REMOTE_CONTROL",id:a,name:b,app:c,mdxVersion:3};g.ua("yt.mdx.remote.channelParams_",a,void 0)}},z8=function(){return g.y("yt.mdx.remote.channelParams_")||{}},VFa=function(a){a?(g.rH("yt-remote-session-app",a.app),g.rH("yt-remote-session-name",a.name)):(g.tH("yt-remote-session-app"),g.tH("yt-remote-session-name"));
g.ua("yt.mdx.remote.channelParams_",a,void 0)},I8=function(a,b,c){g.L.call(this);
this.C=a;this.T=b;this.A=new g.SF(this);g.M(this,this.A);this.A.R(b,"onCaptionsTrackListChanged",this.OT);this.A.R(b,"captionschanged",this.rS);this.A.R(b,"captionssettingschanged",this.BG);this.A.R(b,"videoplayerreset",this.Oq);this.A.R(b,"mdxautoplaycancel",this.AK);this.O=this.A.R(b,"onVolumeChange",this.CE);this.G=!1;this.o=c;c.subscribe("proxyStateChange",this.SE,this);c.subscribe("remotePlayerChange",this.Pn,this);c.subscribe("remoteQueueChange",this.Oq,this);c.subscribe("autoplayUpNext",this.oE,
this);c.subscribe("previousNextChange",this.PE,this);c.subscribe("nowAutoplaying",this.GE,this);c.subscribe("autoplayDismissed",this.nE,this);this.suggestion=null;this.H=new g.JP(64);this.B=new g.U(this.xG,500,this);g.M(this,this.B);this.D=new g.U(this.yG,1E3,this);g.M(this,this.D);this.K=new H6(this.QX,0,this);g.M(this,this.K);this.F={};this.L=new g.U(this.cH,1E3,this);g.M(this,this.L);this.J=new g.tl(this.vQ,1E3,this);g.M(this,this.J);this.N=g.A;this.BG();this.Oq();this.Pn()},J8=function(a,b){var c=
a.C,d=a.T.getVideoData().lengthSeconds;
c.J=b||0;c.player.V("progresssync",b,d)},cGa=function(a){J8(a,0);
a.B.stop();K8(a,new g.JP(64))},M8=function(a,b){if(L8(a)&&!a.G){var c=null;
b&&(c={style:a.T.wj()},g.fc(c,b));a.o.mG(a.T.getVideoData(1).videoId,c);a.F=d8(a.o).A}},N8=function(a,b){var c=a.T.rg();
if(c){var d=c.Be();var e=c.listId.toString()}var f=a.T.getVideoData(1);c=a.o;var k=f.videoId,l=d;d=f.playerParams;var m=f.Gk;f=MDa(f);var n=d8(c);l=l||0;var p={videoId:k,currentIndex:l};$7(n,k,l);g.u(b)&&(Y7(n,b),p.currentTime=b);g.u(e)&&(p.listId=e);null!=d&&(p.playerParams=d);null!=m&&(p.clickTrackingParams=m);null!=f&&(p.locationInfo=g.Hg(f));h8(c,"setPlaylist",p);e||f8(c,n);K8(a,new g.JP(1))},dGa=function(a,b){if(b){var c=a.T.Fc("captions","tracklist",{NB:1});
c&&c.length?(a.T.Xd("captions","track",b),a.G=!1):(a.T.Xk("captions"),a.G=!0)}else a.T.Xd("captions","track",{})},L8=function(a){return d8(a.o).videoId==a.T.getVideoData(1).videoId},K8=function(a,b){a.D.stop();
var c=a.H;if(!g.PP(c,b)){var d=g.W(b,2);d!=g.W(a.H,2)&&g.ZT(a.T,d);a.H=b;eGa(a.C,c,b)}},O8=function(a){g.V.call(this,{I:"div",
M:"ytp-remote",P:[{I:"div",M:"ytp-remote-display-status",P:[{I:"div",M:"ytp-remote-display-status-icon",P:[g.ora()]},{I:"div",M:"ytp-remote-display-status-text",da:"{{statustext}}"}]}]});this.B=new g.YU(this,250);g.M(this,this.B);this.C=a;this.R(a,"presentingplayerstatechange",this.D);fGa(this,g.UT(a))},fGa=function(a,b){if(3==a.C.Sa()){var c={RECEIVER_NAME:a.C.Fc("remote","currentReceiver").name};
c=g.W(b,128)?g.QU("Error on $RECEIVER_NAME",c):b.sb()||g.W(b,4)?g.QU("Playing on $RECEIVER_NAME",c):g.QU("Connected to $RECEIVER_NAME",c);a.updateValue("statustext",c);a.B.show()}else a.B.hide()},P8=function(a,b){g.wY.call(this,"Play on",0,a,b);
this.T=a;this.H={};this.R(a,"onMdxReceiversChange",this.K);this.R(a,"presentingplayerstatechange",this.K);this.K()},Q8=function(a){g.zU.call(this,a);
this.A={key:s6(),name:"This computer"};this.C=null;this.D=[];this.K=this.o=null;this.H=[this.A];this.B=this.A;this.F=new g.JP(64);this.J=0;this.G=-1;if(!g.hN(g.X(this.player))){a=this.player;var b=g.kI(a);b&&(b=b.En())&&(b=new P8(a,b),g.M(this,b));b=new O8(a);g.M(this,b);g.nU(a,b.element,4)}},eGa=function(a,b,c){a.F=c;
a.player.V("presentingplayerstatechange",new g.UP(c,b))},R8=function(a,b){if(b.key!=a.B.key)if(b.key==a.A.key)D8();
else{a.B=b;var c=a.player.getPlaylistId();var d=a.player.getVideoData(1);var e=d.videoId;if(c||e){var f=a.player.rg();if(f){var k=[];for(var l=0;l<f.getLength();l++)k[l]=f.ab(l).videoId}else k=[e];f=a.player.getCurrentTime(1);c={videoIds:k,listId:c,videoId:e,playerParams:d.playerParams,clickTrackingParams:d.Gk,index:Math.max(a.player.SC(),0),currentTime:0==f?void 0:f};(d=MDa(d))&&(c.locationInfo=d);d=c}else d=null;v8("Connecting to: "+g.Hg(b));"cast-selector-receiver"==b.key?(x8(d||null),S7()?P7().setLaunchParams(d||
null):N7("setLaunchParams called before ready.")):!d&&G8()&&u8()==b.key?g.jG("yt-remote-connection-change",!0):(D8(),x8(d||null),d=t8().De(),(d=u6(d,b.key))&&E8(d,1))}},uEa={"\x00":"\\0",
"\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r","\t":"\\t","\x0B":"\\x0B",'"':'\\"',"\\":"\\\\","<":"<"},R6={"'":"\\'"},gGa={},SDa={EZ:"atp",f4:"ska",x3:"que",K2:"mus",a4:"sus",O0:"dsp"};
n6.prototype.cp=function(){var a=new n6({id:this.id,name:this.name,app:this.app,type:this.type,user:this.username,userAvatarUri:this.avatar,obfuscatedGaiaId:this.obfuscatedGaiaId,theme:this.theme,capabilities:Array.from(this.capabilities.values()).join(","),experiments:Array.from(this.experiments.values()).join(",")});a.B=this.B;a.A=this.A;a.o=this.o};
var A6,w6="",E6=B6("loadGamesSDK")?"/cast_game_sender.js":"/cast_sender.js",mEa=B6("loadCastFramework")||B6("loadCastApplicationFramework"),wFa=["pkedcjkdefgpdelpbcmbmeomcjbeemfm","enhhojjnijigcajfphajepfemndkmdlo"];g.C(H6,g.L);g.h=H6.prototype;g.h.vL=function(a){this.C=arguments;this.o=!1;this.Fa?this.B=(0,g.H)()+this.Fd:this.Fa=g.Cg(this.D,this.Fd)};
g.h.stop=function(){this.Fa&&(g.Dg(this.Fa),this.Fa=null);this.B=null;this.o=!1;this.C=[]};
g.h.pause=function(){++this.A};
g.h.resume=function(){this.A&&(--this.A,!this.A&&this.o&&(this.o=!1,this.F.apply(null,this.C)))};
g.h.Y=function(){this.stop();H6.fa.Y.call(this)};
g.h.wL=function(){this.B?(this.Fa=g.Cg(this.D,this.B-(0,g.H)()),this.B=null):(this.Fa=null,this.A?this.o=!0:(this.o=!1,this.F.apply(null,this.C)))};I6.prototype.stringify=function(a){return g.x.JSON.stringify(a,void 0)};
I6.prototype.parse=function(a){return g.x.JSON.parse(a,void 0)};g.h=J6.prototype;g.h.dj=null;g.h.Of=!1;g.h.Ol=null;g.h.Xx=null;g.h.wl=null;g.h.xk=null;g.h.Ph=null;g.h.si=null;g.h.Dj=null;g.h.Xc=null;g.h.ho=0;g.h.Pf=null;g.h.Vr=null;g.h.Qh=null;g.h.Qm=-1;g.h.SF=!0;g.h.Oi=!1;g.h.ju=0;g.h.fr=null;var sEa={},M6={};g.h=J6.prototype;g.h.setTimeout=function(a){this.C=a};
g.h.QW=function(a){a=a.target;var b=this.fr;b&&3==g.Gx(a)?b.Mm():this.nH(a)};
g.h.nH=function(a){try{if(a==this.Xc)a:{var b=g.Gx(this.Xc),c=this.Xc.A,d=this.Xc.getStatus();if(g.Hd&&!g.sc(10)||g.Jd&&!g.qc("420+")){if(4>b)break a}else if(3>b||3==b&&!g.qf&&!g.Kx(this.Xc))break a;this.Oi||4!=b||7==c||(8==c||0>=d?this.o.Hf(3):this.o.Hf(2));T6(this);var e=this.Xc.getStatus();this.Qm=e;var f=g.Kx(this.Xc);(this.Of=200==e)?(4==b&&P6(this),this.D?(tEa(this,b,f),g.qf&&this.Of&&3==b&&(this.Z.X(this.A,"tick",this.MW),this.A.start())):O6(this,f),this.Of&&!this.Oi&&(4==b?this.o.Mq(this):
(this.Of=!1,L6(this)))):(400==e&&0<f.indexOf("Unknown SID")?(this.Qh=3,N6(13)):(this.Qh=0,N6(14)),P6(this),Q6(this))}}catch(k){this.Xc&&g.Kx(this.Xc)}finally{}};
g.h.MW=function(){var a=g.Gx(this.Xc),b=g.Kx(this.Xc);this.ho<b.length&&(T6(this),tEa(this,a,b),this.Of&&4!=a&&L6(this))};
g.h.YV=function(a){S6((0,g.B)(this.XV,this,a),0)};
g.h.XV=function(a){this.Oi||(T6(this),O6(this,a),L6(this))};
g.h.bF=function(a){S6((0,g.B)(this.WV,this,a),0)};
g.h.WV=function(a){this.Oi||(P6(this),this.Of=a,this.o.Mq(this),this.o.Hf(4))};
g.h.cancel=function(){this.Oi=!0;P6(this)};
g.h.oW=function(){this.Ol=null;var a=(0,g.H)();0<=a-this.Xx?(2!=this.xk&&this.o.Hf(3),P6(this),this.Qh=2,N6(18),Q6(this)):wEa(this,this.Xx-a)};g.h=zEa.prototype;g.h.hu=null;g.h.Je=null;g.h.gr=!1;g.h.fB=null;g.h.tp=null;g.h.cv=null;g.h.iu=null;g.h.df=null;g.h.Zg=-1;g.h.Pm=null;g.h.Xl=null;g.h.connect=function(a){this.iu=a;a=V6(this.o,null,this.iu);N6(3);this.fB=(0,g.H)();var b=this.o.H;null!=b?(this.Pm=b[0],(this.Xl=b[1])?(this.df=1,AEa(this)):(this.df=2,X6(this))):(m6(a,"MODE","init"),this.Je=new J6(this,void 0,void 0,void 0),this.Je.dj=this.hu,K6(this.Je,a,!1,null,!0),this.df=0)};
g.h.BK=function(a){if(a)this.df=2,X6(this);else{N6(4);var b=this.o;b.gg=b.Fh.Zg;d7(b,9)}a&&this.Hf(2)};
g.h.Ft=function(a){return this.o.Ft(a)};
g.h.abort=function(){this.Je&&(this.Je.cancel(),this.Je=null);this.Zg=-1};
g.h.eB=function(){return!1};
g.h.TE=function(a,b){this.Zg=a.Qm;if(0==this.df)if(b){try{var c=this.A.parse(b)}catch(d){c=this.o;c.gg=this.Zg;d7(c,2);return}this.Pm=c[0];this.Xl=c[1]}else c=this.o,c.gg=this.Zg,d7(c,2);else if(2==this.df)if(this.gr)N6(7),this.cv=(0,g.H)();else if("11111"==b){if(N6(6),this.gr=!0,this.tp=(0,g.H)(),c=this.tp-this.fB,!g.Hd||g.sc(10)||500>c)this.Zg=200,this.Je.cancel(),N6(12),W6(this.o,this,!0)}else N6(8),this.tp=this.cv=(0,g.H)(),this.gr=!1};
g.h.Mq=function(){this.Zg=this.Je.Qm;if(this.Je.Of)0==this.df?this.Xl?(this.df=1,AEa(this)):(this.df=2,X6(this)):2==this.df&&((!g.Hd||g.sc(10)?!this.gr:200>this.cv-this.tp)?(N6(11),W6(this.o,this,!1)):(N6(12),W6(this.o,this,!0)));else{0==this.df?N6(9):2==this.df&&N6(10);var a=this.o;a.gg=this.Zg;d7(a,2)}};
g.h.Yn=function(){return this.o.Yn()};
g.h.isActive=function(){return this.o.isActive()};
g.h.Hf=function(a){this.o.Hf(a)};g.h=Y6.prototype;g.h.xm=null;g.h.ne=null;g.h.Bc=null;g.h.gu=null;g.h.xp=null;g.h.Bz=null;g.h.Kp=null;g.h.Kn=0;g.h.KR=0;g.h.Ed=null;g.h.Kh=null;g.h.Jg=null;g.h.Ri=null;g.h.Fh=null;g.h.Tr=null;g.h.Nk=-1;g.h.bC=-1;g.h.gg=-1;g.h.lk=0;g.h.Yj=0;g.h.Qi=8;var e7=new g.Pf;g.C(CEa,g.of);g.C(DEa,g.of);g.C(EEa,g.of);g.h=Y6.prototype;g.h.connect=function(a,b,c,d,e){N6(0);this.gu=b;this.xm=c||{};d&&g.u(e)&&(this.xm.OSID=d,this.xm.OAID=e);this.F?(S6((0,g.B)(this.Vz,this,a),100),IEa(this)):this.Vz(a)};
g.h.Vz=function(a){this.Fh=new zEa(this);this.Fh.hu=null;this.Fh.A=this.D;this.Fh.connect(a)};
g.h.eB=function(){return 0==this.o};
g.h.ZE=function(a){this.Kh=null;LEa(this,a)};
g.h.YE=function(){this.Jg=null;this.Bc=new J6(this,this.B,"rpc",this.G);this.Bc.dj=null;this.Bc.ju=0;var a=this.Bz.clone();g.an(a,"RID","rpc");g.an(a,"SID",this.B);g.an(a,"CI",this.Tr?"0":"1");g.an(a,"AID",this.Nk);Z6(this,a);if(!g.Hd||g.sc(10))g.an(a,"TYPE","xmlhttp"),K6(this.Bc,a,!0,this.Kp,!1);else{g.an(a,"TYPE","html");var b=this.Bc,c=!!this.Kp;b.xk=3;b.Ph=l6(a.clone());vEa(b,c)}};
g.h.TE=function(a,b){if(0!=this.o&&(this.Bc==a||this.ne==a))if(this.gg=a.Qm,this.ne==a&&3==this.o)if(7<this.Qi){try{var c=this.D.parse(b)}catch(f){c=null}if(g.xa(c)&&3==c.length)if(0==c[0])a:{if(!this.Jg){if(this.Bc)if(this.Bc.wl+3E3<this.ne.wl)a7(this),this.Bc.cancel(),this.Bc=null;else break a;c7(this);N6(19)}}else this.bC=c[1],0<this.bC-this.Nk&&37500>c[2]&&this.Tr&&0==this.Yj&&!this.Ri&&(this.Ri=S6((0,g.B)(this.mS,this),6E3));else d7(this,11)}else b!=gGa.F_.o&&d7(this,11);else if(this.Bc==a&&
a7(this),!g.F(b)){c=this.D.parse(b);g.xa(c);for(var d=0;d<c.length;d++){var e=c[d];this.Nk=e[0];e=e[1];2==this.o?"c"==e[0]?(this.B=e[1],this.Kp=e[2],e=e[3],null!=e?this.Qi=e:this.Qi=6,this.o=3,this.Ed&&this.Ed.Nz(),this.Bz=V6(this,this.Yn()?this.Kp:null,this.gu),MEa(this)):"stop"==e[0]&&d7(this,7):3==this.o&&("stop"==e[0]?d7(this,7):"noop"!=e[0]&&this.Ed&&this.Ed.Mz(e),this.Yj=0)}}};
g.h.mS=function(){null!=this.Ri&&(this.Ri=null,this.Bc.cancel(),this.Bc=null,c7(this),N6(20))};
g.h.Mq=function(a){if(this.Bc==a){a7(this);this.Bc=null;var b=2}else if(this.ne==a)this.ne=null,b=1;else return;this.gg=a.Qm;if(0!=this.o)if(a.Of)1==b?(b=(0,g.H)()-a.wl,e7.dispatchEvent(new DEa(e7,a.Dj?a.Dj.length:0,b,this.lk)),$6(this),this.C.length=0):MEa(this);else{var c=a.Qh,d;if(!(d=3==c||7==c||0==c&&0<this.gg)){if(d=1==b)this.ne||this.Kh||1==this.o||2<=this.lk?d=!1:(this.Kh=S6((0,g.B)(this.ZE,this,a),NEa(this,this.lk)),this.lk++,d=!0);d=!(d||2==b&&c7(this))}if(d)switch(c){case 1:d7(this,5);
break;case 4:d7(this,10);break;case 3:d7(this,6);break;case 7:d7(this,12);break;default:d7(this,2)}}};
g.h.XK=function(a){if(!g.Ma(arguments,this.o))throw Error("Unexpected channel state: "+this.o);};
g.h.DX=function(a){a?N6(2):(N6(1),OEa(this,8))};
g.h.Ft=function(a){if(a)throw Error("Can't create secondary domain capable XhrIo object.");a=new g.Ax;a.H=!1;return a};
g.h.isActive=function(){return!!this.Ed&&this.Ed.isActive(this)};
g.h.Hf=function(a){e7.dispatchEvent(new EEa(e7,a))};
g.h.Yn=function(){return!(!g.Hd||g.sc(10))};
g.h=PEa.prototype;g.h.Nz=function(){};
g.h.Mz=function(){};
g.h.Lz=function(){};
g.h.jt=function(){};
g.h.KA=function(){return{}};
g.h.isActive=function(){return!0};g.C(f7,g.L);g.h=f7.prototype;g.h.PV=function(){this.Fd=Math.min(3E5,2*this.Fd);this.B();this.A&&this.start()};
g.h.start=function(){var a=this.Fd+15E3*Math.random();g.zu(this.o,a);this.A=(0,g.H)()+a};
g.h.stop=function(){this.o.stop();this.A=0};
g.h.isActive=function(){return this.o.isActive()};
g.h.reset=function(){this.o.stop();this.Fd=5E3};g.C(g7,PEa);g.h=g7.prototype;g.h.subscribe=function(a,b,c){return this.B.subscribe(a,b,c)};
g.h.unsubscribe=function(a,b,c){return this.B.unsubscribe(a,b,c)};
g.h.ce=function(a){return this.B.ce(a)};
g.h.V=function(a,b){return this.B.V.apply(this.B,arguments)};
g.h.dispose=function(){this.K||(this.K=!0,g.lf(this.B),SEa(this),g.lf(this.A),this.A=null)};
g.h.la=function(){return this.K};
g.h.connect=function(a,b,c){if(!this.o||2!=this.o.o){this.J="";this.A.stop();this.D=a||null;this.C=b||0;a=this.L+"/test";b=this.L+"/bind";var d=new Y6(c?c.firstTestResults:null,c?c.secondTestResults:null,this.N),e=this.o;e&&(e.Ed=null);d.Ed=this;this.o=d;e?this.o.connect(a,b,this.F,e.B,e.Nk):c?this.o.connect(a,b,this.F,c.sessionId,c.arrayId):this.o.connect(a,b,this.F)}};
g.h.sendMessage=function(a,b){var c={_sc:a};b&&g.fc(c,b);this.A.isActive()||2==(this.o?this.o.o:0)?this.G.push(c):h7(this)&&JEa(this.o,c)};
g.h.Nz=function(){this.A.reset();this.D=null;this.C=0;if(this.G.length){var a=this.G;this.G=[];for(var b=0,c=a.length;b<c;++b)JEa(this.o,a[b])}this.V("handlerOpened")};
g.h.Lz=function(a){var b=2==a&&401==this.o.gg;4==a||b||this.A.start();this.V("handlerError",a)};
g.h.jt=function(a){if(!this.A.isActive())this.V("handlerClosed");else if(a)for(var b=0,c=a.length;b<c;++b){var d=a[b].map;d&&this.G.push(d)}};
g.h.KA=function(){var a={v:2};this.J&&(a.gsessionid=this.J);0!=this.C&&(a.ui=""+this.C);0!=this.H&&(a.ui=""+this.H);this.D&&g.fc(a,this.D);return a};
g.h.Mz=function(a){"S"==a[0]?this.J=a[1]:"gracefulReconnect"==a[0]?(this.A.start(),HEa(this.o)):this.V("handlerMessage",new QEa(a[0],a[1]))};
g.h.lY=function(){this.A.isActive();var a=this.o,b=0;a.Bc&&b++;a.ne&&b++;0!=b||this.connect(this.D,this.C)};i7.prototype.C=function(a,b,c,d){b?a(d):a({text:c.responseText})};
i7.prototype.B=function(a,b){a(Error("Request error: "+b.status))};
i7.prototype.D=function(a){a(Error("request timed out"))};var $Ea=(0,g.H)(),l7=null,o7=Array(50),n7=-1,p7=!1;g.C(q7,g.VF);q7.prototype.De=function(){return this.o};
q7.prototype.contains=function(a){return!!t6(this.o,a)};
q7.prototype.get=function(a){return a?u6(this.o,a):null};
q7.prototype.info=function(a){m7(this.G,a)};g.C(r7,g.VF);var hGa=[2E3,2E3,1E3,1E3,1E3,2E3,2E3,5E3,5E3,1E4];g.h=r7.prototype;g.h.start=function(){!this.o&&(0,window.isNaN)(this.Fa)&&this.sH()};
g.h.stop=function(){this.o&&(this.o.abort(),this.o=null);(0,window.isNaN)(this.Fa)||(g.oE(this.Fa),this.Fa=window.NaN)};
g.h.Y=function(){this.stop();r7.fa.Y.call(this)};
g.h.sH=function(){this.Fa=window.NaN;this.o=g.DE(j7(this.F,"/pairing/get_screen"),{method:"POST",Tb:{pairing_code:this.D},timeout:5E3,onSuccess:(0,g.B)(this.nY,this),onError:(0,g.B)(this.mY,this),Kd:(0,g.B)(this.oY,this)})};
g.h.nY=function(a,b){this.o=null;var c=b.screen||{};c.dialId=this.B;c.name=this.C;this.V("pairingComplete",new o6(c))};
g.h.mY=function(a){this.o=null;a.status&&404==a.status?this.A>=hGa.length?this.V("pairingFailed",Error("DIAL polling timed out")):(a=hGa[this.A],this.Fa=g.mE((0,g.B)(this.sH,this),a),this.A++):this.V("pairingFailed",Error("Server error "+a.status))};
g.h.oY=function(){this.o=null;this.V("pairingFailed",Error("Server not responding"))};g.C(t7,q7);g.h=t7.prototype;g.h.start=function(){s7(this)&&this.V("screenChange");!g.sH("yt-remote-lounge-token-expiration")&&dFa(this);g.oE(this.A);this.A=g.mE((0,g.B)(this.start,this),1E4)};
g.h.add=function(a,b){s7(this);aFa(this,a);u7(this,!1);this.V("screenChange");b(a);a.token||dFa(this)};
g.h.remove=function(a,b){var c=s7(this);cFa(this,a)&&(u7(this,!1),c=!0);b(a);c&&this.V("screenChange")};
g.h.Or=function(a,b,c,d){var e=s7(this),f=this.get(a.id);f?(f.name!=b&&(f.name=b,u7(this,!1),e=!0),c(a)):d(Error("no such local screen."));e&&this.V("screenChange")};
g.h.Y=function(){g.oE(this.A);t7.fa.Y.call(this)};
g.h.KL=function(a){s7(this);var b=this.o.length;a=a&&a.screens||[];for(var c=0,d=a.length;c<d;++c){var e=a[c],f=this.get(e.screenId);f&&(f.token=e.loungeToken,--b)}u7(this,!b);b&&m7(this.G,"Missed "+b+" lounge tokens.")};
g.h.JL=function(a){m7(this.G,"Requesting lounge tokens failed: "+a)};g.C(w7,g.VF);g.h=w7.prototype;g.h.start=function(){var a=(0,window.parseInt)(g.sH("yt-remote-fast-check-period")||"0",10);(this.C=(0,g.H)()-144E5<a?0:a)?y7(this):(this.C=(0,g.H)()+3E5,g.rH("yt-remote-fast-check-period",this.C),this.Zw())};
g.h.isEmpty=function(){return g.Yb(this.o)};
g.h.update=function(){v7("Updating availability on schedule.");var a=this.F(),b=g.Ib(this.o,function(b,d){return b&&!!u6(a,d)},this);
x7(this,b)};
g.h.Y=function(){g.oE(this.B);this.B=window.NaN;this.A&&(this.A.abort(),this.A=null);w7.fa.Y.call(this)};
g.h.Zw=function(){g.oE(this.B);this.B=window.NaN;this.A&&this.A.abort();var a=gFa(this);if(g.Nb(a)){var b=j7(this.D,"/pairing/get_screen_availability");this.A=k7(this.D,b,{lounge_token:g.Qb(a).join(",")},(0,g.B)(this.wV,this,a),(0,g.B)(this.vV,this))}else x7(this,{}),y7(this)};
g.h.wV=function(a,b){this.A=null;var c=g.Qb(gFa(this));if(g.fb(c,g.Qb(a))){c=b.screens||[];for(var d={},e=0,f=c.length;e<f;++e)d[a[c[e].loungeToken]]="online"==c[e].status;x7(this,d);y7(this)}else this.sc("Changing Screen set during request."),this.Zw()};
g.h.vV=function(a){this.sc("Screen availability failed: "+a);this.A=null;y7(this)};
g.h.sc=function(a){m7("OnlineScreenService",a)};g.C(z7,q7);g.h=z7.prototype;g.h.start=function(){this.B.start();this.A.start();this.o.length&&(this.V("screenChange"),this.A.isEmpty()||this.V("onlineScreenChange"))};
g.h.add=function(a,b,c){this.B.add(a,b,c)};
g.h.remove=function(a,b,c){this.B.remove(a,b,c);this.A.update()};
g.h.Or=function(a,b,c,d){this.B.contains(a)?this.B.Or(a,b,c,d):(a="Updating name of unknown screen: "+a.name,m7(this.G,a),d(Error(a)))};
g.h.De=function(a){return a?this.o:g.Ua(this.o,(0,g.Vd)(this.C,function(a){return!this.contains(a)},this))};
g.h.tH=function(){return(0,g.Vd)(this.De(!0),function(a){return!!this.A.o[a.id]},this)};
g.h.uH=function(a,b,c,d,e){this.info("getDialScreenByPairingCode "+a+" / "+b);var f=new r7(this.F,a,b,c);f.subscribe("pairingComplete",(0,g.B)(function(a){g.lf(f);d(A7(this,a))},this));
f.subscribe("pairingFailed",function(a){g.lf(f);e(a)});
f.start();return(0,g.B)(f.stop,f)};
g.h.qY=function(a,b,c,d){g.DE(j7(this.F,"/pairing/get_screen"),{method:"POST",Tb:{pairing_code:a},timeout:5E3,onSuccess:(0,g.B)(function(a,d){var e=new o6(d.screen||{});if(!e.name||kFa(this,e.name)){a:{var f=e.name;for(var m=2,n=b(f,m);kFa(this,n);){m++;if(20<m)break a;n=b(f,m)}f=n}e.name=f}c(A7(this,e))},this),
onError:(0,g.B)(function(a){d(Error("pairing request failed: "+a.status))},this),
Kd:(0,g.B)(function(){d(Error("pairing request timed out."))},this)})};
g.h.Y=function(){g.lf(this.B);g.lf(this.A);z7.fa.Y.call(this)};
g.h.YL=function(){lFa(this);this.V("screenChange");this.A.update()};
z7.prototype.dispose=z7.prototype.dispose;g.C(C7,g.VF);g.h=C7.prototype;g.h.Nq=function(a){this.B=a;this.V("sessionScreen",this.B)};
g.h.Ie=function(a){this.la()||(a&&D7(this,""+a),this.B=null,this.V("sessionScreen",null))};
g.h.info=function(a){m7(this.N,a)};
g.h.wH=function(){return null};
g.h.kx=function(a){var b=this.A;a?(b.displayStatus=new window.chrome.cast.ReceiverDisplayStatus(a,[]),b.displayStatus.showStop=!0):b.displayStatus=null;window.chrome.cast.setReceiverDisplayStatus(b,(0,g.B)(function(){this.info("Updated receiver status for "+b.friendlyName+": "+a)},this),(0,g.B)(function(){D7(this,"Failed to update receiver status for: "+b.friendlyName)},this))};
g.h.Y=function(){this.kx("");C7.fa.Y.call(this)};g.C(E7,C7);g.h=E7.prototype;g.h.jx=function(a){if(this.o){if(this.o==a)return;D7(this,"Overriding cast sesison with new session object");this.o.removeUpdateListener(this.F);this.o.removeMessageListener("urn:x-cast:com.google.youtube.mdx",this.D)}this.o=a;this.o.addUpdateListener(this.F);this.o.addMessageListener("urn:x-cast:com.google.youtube.mdx",this.D);nFa(this)};
g.h.Pk=function(a){this.info("launchWithParams no-op for Cast: "+g.Hg(a))};
g.h.stop=function(){this.o?this.o.stop((0,g.B)(function(){this.Ie()},this),(0,g.B)(function(){this.Ie(Error("Failed to stop receiver app."))},this)):this.Ie(Error("Stopping cast device witout session."))};
g.h.kx=g.A;g.h.Y=function(){this.info("disposeInternal");g.oE(this.C);this.C=0;this.o&&(this.o.removeUpdateListener(this.F),this.o.removeMessageListener("urn:x-cast:com.google.youtube.mdx",this.D));this.o=null;E7.fa.Y.call(this)};
g.h.AW=function(a,b){if(!this.la())if(b){var c=g.ux(b);if(g.Aa(c)){var d=""+c.type;c=c.data||{};this.info("onYoutubeMessage_: "+d+" "+g.Hg(c));switch(d){case "mdxSessionStatus":mFa(this,c.screenId);break;default:D7(this,"Unknown youtube message: "+d)}}else D7(this,"Unable to parse message.")}else D7(this,"No data in message.")};
g.h.UA=function(a,b,c,d){jFa(this.J,this.A.label,a,this.A.friendlyName,(0,g.B)(function(e){e?b(e):0<=d?(D7(this,"Screen "+a+" appears to be offline. "+d+" retries left."),g.mE((0,g.B)(this.UA,this,a,b,c,d-1),300)):c(Error("Unable to fetch screen."))},this),c)};
g.h.wH=function(){return this.o};
g.h.rY=function(a){this.la()||a||(D7(this,"Cast session died."),this.Ie())};g.C(F7,C7);g.h=F7.prototype;g.h.jx=function(a){this.C=a;this.C.addUpdateListener(this.L)};
g.h.Pk=function(a){this.D=a;this.G()};
g.h.stop=function(){this.o();this.o=g.A;g.oE(this.F);this.C?this.C.stop((0,g.B)(this.Ie,this,null),(0,g.B)(this.Ie,this,"Failed to stop DIAL device.")):this.Ie()};
g.h.Y=function(){this.o();this.o=g.A;g.oE(this.F);this.C&&this.C.removeUpdateListener(this.L);this.C=null;F7.fa.Y.call(this)};
g.h.uY=function(a){this.la()||a||(D7(this,"DIAL session died."),this.o(),this.o=g.A,this.Ie())};
g.h.Nu=function(a){this.K=s6();if(this.D){var b=new window.chrome.cast.DialLaunchResponse(!0,pFa(this));a(b);oFa(this)}else this.G=(0,g.B)(function(){g.oE(this.F);this.G=g.A;this.F=window.NaN;var b=new window.chrome.cast.DialLaunchResponse(!0,pFa(this));a(b);oFa(this)},this),this.F=g.mE((0,g.B)(function(){this.G()},this),100)};
g.h.oN=function(a,b,c){jFa(this.J,this.H.receiver.label,a,this.A.friendlyName,(0,g.B)(function(a){a&&a.token?(this.Nq(a),b(new window.chrome.cast.DialLaunchResponse(!1))):this.Nu(b,c)},this),(0,g.B)(function(a){D7(this,"Failed to get DIAL screen: "+a);
this.Nu(b,c)},this))};g.C(G7,C7);G7.prototype.stop=function(){this.Ie()};
G7.prototype.jx=g.A;G7.prototype.Pk=function(){g.oE(this.o);this.o=window.NaN;var a=u6(this.J.De(),this.A.label);a?this.Nq(a):this.Ie(Error("No such screen"))};
G7.prototype.Y=function(){g.oE(this.o);this.o=window.NaN;G7.fa.Y.call(this)};g.C(H7,g.VF);g.h=H7.prototype;
g.h.init=function(a,b){window.chrome.cast.timeout.requestSession=3E4;var c=new window.chrome.cast.SessionRequest(this.G);this.H||(c.dialRequest=new window.chrome.cast.DialRequest("YouTube"));var d=window.chrome.cast.AutoJoinPolicy.TAB_AND_ORIGIN_SCOPED,e=a?window.chrome.cast.DefaultActionPolicy.CAST_THIS_TAB:window.chrome.cast.DefaultActionPolicy.CREATE_SESSION;c=new window.chrome.cast.ApiConfig(c,(0,g.B)(this.VE,this),(0,g.B)(this.eV,this),d,e);c.customDialLaunchCallback=(0,g.B)(this.XS,this);window.chrome.cast.initialize(c,
(0,g.B)(function(){this.la()||(window.chrome.cast.addReceiverActionListener(this.C),XEa(),this.A.subscribe("onlineScreenChange",(0,g.B)(this.vH,this)),this.B=rFa(this),window.chrome.cast.setCustomReceivers(this.B,g.A,(0,g.B)(function(a){this.sc("Failed to set initial custom receivers: "+g.Hg(a))},this)),this.V("yt-remote-cast2-availability-change",J7(this)),b(!0))},this),(0,g.B)(function(a){this.sc("Failed to initialize API: "+g.Hg(a));
b(!1)},this))};
g.h.lX=function(a,b){I7("Setting connected screen ID: "+a+" -> "+b);if(this.o){var c=this.o.B;if(!a||c&&c.id!=a)I7("Unsetting old screen status: "+this.o.A.friendlyName),K7(this,null)}if(a&&b){if(!this.o){c=u6(this.A.De(),a);if(!c){I7("setConnectedScreenStatus: Unknown screen.");return}var d=qFa(this,c);d||(I7("setConnectedScreenStatus: Connected receiver not custom..."),d=new window.chrome.cast.Receiver(c.uuid?c.uuid:c.id,c.name),d.receiverType=window.chrome.cast.ReceiverType.CUSTOM,this.B.push(d),
window.chrome.cast.setCustomReceivers(this.B,g.A,(0,g.B)(function(a){this.sc("Failed to set initial custom receivers: "+g.Hg(a))},this)));
I7("setConnectedScreenStatus: new active receiver: "+d.friendlyName);K7(this,new G7(this.A,d),!0)}this.o.kx(b)}else I7("setConnectedScreenStatus: no screen.")};
g.h.mX=function(a){this.la()?this.sc("Setting connection data on disposed cast v2"):this.o?this.o.Pk(a):this.sc("Setting connection data without a session")};
g.h.tY=function(){this.la()?this.sc("Stopping session on disposed cast v2"):this.o?(this.o.stop(),K7(this,null)):I7("Stopping non-existing session")};
g.h.requestSession=function(){window.chrome.cast.requestSession((0,g.B)(this.VE,this),(0,g.B)(this.AV,this))};
g.h.Y=function(){this.A.unsubscribe("onlineScreenChange",(0,g.B)(this.vH,this));window.chrome&&window.chrome.cast&&window.chrome.cast.removeReceiverActionListener(this.C);g.Sa(g.y("yt.mdx.remote.debug.handlers_")||[],UEa);g.lf(this.o);H7.fa.Y.call(this)};
g.h.sc=function(a){m7("Controller",a)};
g.h.WE=function(a,b){this.o==a&&(b||K7(this,null),this.V("yt-remote-cast2-session-change",b))};
g.h.aV=function(a,b){if(!this.la())if(a)switch(a.friendlyName=window.chrome.cast.unescape(a.friendlyName),I7("onReceiverAction_ "+a.label+" / "+a.friendlyName+"-- "+b),b){case window.chrome.cast.ReceiverAction.CAST:if(this.o)if(this.o.A.label!=a.label)I7("onReceiverAction_: Stopping active receiver: "+this.o.A.friendlyName),this.o.stop();else{I7("onReceiverAction_: Casting to active receiver.");this.o.B&&this.V("yt-remote-cast2-session-change",this.o.B);break}switch(a.receiverType){case window.chrome.cast.ReceiverType.CUSTOM:K7(this,
new G7(this.A,a));break;case window.chrome.cast.ReceiverType.DIAL:K7(this,new F7(this.A,a,this.F));break;case window.chrome.cast.ReceiverType.CAST:K7(this,new E7(this.A,a));break;default:this.sc("Unknown receiver type: "+a.receiverType)}break;case window.chrome.cast.ReceiverAction.STOP:this.o&&this.o.A.label==a.label?this.o.stop():this.sc("Stopping receiver w/o session: "+a.friendlyName)}else this.sc("onReceiverAction_ called without receiver.")};
g.h.XS=function(a){if(this.la())return window.Promise.reject(Error("disposed"));var b=a.receiver;b.receiverType!=window.chrome.cast.ReceiverType.DIAL&&(this.sc("Not DIAL receiver: "+b.friendlyName),b.receiverType=window.chrome.cast.ReceiverType.DIAL);var c=this.o?this.o.A:null;if(!c||c.label!=b.label)return this.sc("Receiving DIAL launch request for non-clicked DIAL receiver: "+b.friendlyName),window.Promise.reject(Error("illegal DIAL launch"));if(c&&c.label==b.label&&c.receiverType!=window.chrome.cast.ReceiverType.DIAL){if(this.o.B)return I7("Reselecting dial screen."),
this.V("yt-remote-cast2-session-change",this.o.B),window.Promise.resolve(new window.chrome.cast.DialLaunchResponse(!1));this.sc('Changing CAST intent from "'+c.receiverType+'" to "dial" for '+b.friendlyName);K7(this,new F7(this.A,b,this.F))}b=this.o;b.H=a;return b.H.appState==window.chrome.cast.DialAppState.RUNNING?new window.Promise((0,g.B)(b.oN,b,(b.H.extraData||{}).screenId||null)):new window.Promise((0,g.B)(b.Nu,b))};
g.h.VE=function(a){if(!this.la()){I7("New cast session ID: "+a.sessionId);var b=a.receiver;if(b.receiverType!=window.chrome.cast.ReceiverType.CUSTOM){if(!this.o)if(b.receiverType==window.chrome.cast.ReceiverType.CAST)I7("Got resumed cast session before resumed mdx connection."),b.friendlyName=window.chrome.cast.unescape(b.friendlyName),K7(this,new E7(this.A,b),!0);else{this.sc("Got non-cast session without previous mdx receiver event, or mdx resume.");return}var c=this.o.A,d=u6(this.A.De(),c.label);
d&&p6(d,b.label)&&c.receiverType!=window.chrome.cast.ReceiverType.CAST&&b.receiverType==window.chrome.cast.ReceiverType.CAST&&(I7("onSessionEstablished_: manual to cast session change "+b.friendlyName),g.lf(this.o),this.o=new E7(this.A,b),this.o.subscribe("sessionScreen",(0,g.B)(this.WE,this,this.o)),this.o.Pk(null));this.o.jx(a)}}};
g.h.sY=function(){return this.o?this.o.wH():null};
g.h.AV=function(a){this.la()||(this.sc("Failed to estabilish a session: "+g.Hg(a)),a.code!=window.chrome.cast.ErrorCode.CANCEL&&K7(this,null))};
g.h.eV=function(a){I7("Receiver availability updated: "+a);if(!this.la()){var b=J7(this);this.D=a==window.chrome.cast.ReceiverAvailability.AVAILABLE;J7(this)!=b&&this.V("yt-remote-cast2-availability-change",J7(this))}};
g.h.vH=function(){this.la()||(this.B=rFa(this),I7("Updating custom receivers: "+g.Hg(this.B)),window.chrome.cast.setCustomReceivers(this.B,g.A,(0,g.B)(function(){this.sc("Failed to set custom receivers.")},this)),this.V("yt-remote-cast2-availability-change",J7(this)))};
H7.prototype.setLaunchParams=H7.prototype.mX;H7.prototype.setConnectedScreenStatus=H7.prototype.lX;H7.prototype.stopSession=H7.prototype.tY;H7.prototype.getCastSession=H7.prototype.sY;H7.prototype.requestSession=H7.prototype.requestSession;H7.prototype.init=H7.prototype.init;H7.prototype.dispose=H7.prototype.dispose;var Q7=[];g.h=V7.prototype;
g.h.reset=function(a){this.listId="";this.index=-1;this.videoId="";W7(this);this.volume=-1;this.muted=!1;a&&(this.index=a.index,this.listId=a.listId,this.videoId=a.videoId,this.o=a.playerState,this.volume=a.volume,this.muted=a.muted,this.audioTrackId=a.audioTrackId,this.A=a.trackData,this.kg=a.hasPrevious,this.hasNext=a.hasNext,this.H=a.playerTime,this.G=a.playerTimeAt,this.D=a.seekableStart,this.B=a.seekableEnd,this.J=a.duration,this.K=a.loadedTime,this.C=a.liveIngestionTime,this.F=!(0,window.isNaN)(this.C))};
g.h.sb=function(){return 1==this.o};
g.h.isAdPlaying=function(){return 1081==this.o};
g.h.getDuration=function(){return this.F?this.J+X7(this):this.J};
g.h.clone=function(){return new V7(a8(this))};g.C(c8,g.VF);g.h=c8.prototype;g.h.play=function(){1==this.o?(this.A?this.A.play(null,g.A,i8(this,"play")):h8(this,"play"),g8(this,1,Z7(d8(this))),this.V("remotePlayerChange")):e8(this,this.play)};
g.h.pause=function(){1==this.o?(this.A?this.A.pause(null,g.A,i8(this,"pause")):h8(this,"pause"),g8(this,2,Z7(d8(this))),this.V("remotePlayerChange")):e8(this,this.pause)};
g.h.rH=function(a){if(1==this.o){if(this.A){var b=d8(this),c=new window.chrome.cast.media.SeekRequest;c.currentTime=a;c.resumeState=b.sb()||3==b.o?window.chrome.cast.media.ResumeState.PLAYBACK_START:window.chrome.cast.media.ResumeState.PLAYBACK_PAUSE;this.A.seek(c,g.A,i8(this,"seekTo",{newTime:a}))}else h8(this,"seekTo",{newTime:a});g8(this,3,a);this.V("remotePlayerChange")}else e8(this,g.Da(this.rH,a))};
g.h.stop=function(){if(1==this.o){this.A?this.A.stop(null,g.A,i8(this,"stopVideo")):h8(this,"stopVideo");var a=d8(this);a.index=-1;a.videoId="";W7(a);f8(this,a);this.V("remotePlayerChange")}else e8(this,this.stop)};
g.h.setVolume=function(a,b){if(1==this.o){var c=d8(this);if(this.B){if(c.volume!=a){var d=Math.round(a)/100;this.B.setReceiverVolumeLevel(d,(0,g.B)(function(){m7("CP","set receiver volume: "+d)},this),(0,g.B)(function(){this.sc("failed to set receiver volume.")},this))}c.muted!=b&&this.B.setReceiverMuted(b,(0,g.B)(function(){m7("CP","set receiver muted: "+b)},this),(0,g.B)(function(){this.sc("failed to set receiver muted.")},this))}else{var e={volume:a,
muted:b};-1!=c.volume&&(e.delta=a-c.volume);h8(this,"setVolume",e)}c.muted=b;c.volume=a;f8(this,c)}else e8(this,g.Da(this.setVolume,a,b))};
g.h.mG=function(a,b){if(1==this.o){var c=d8(this),d={videoId:a};b&&(c.A={trackName:b.name,languageCode:b.languageCode,sourceLanguageCode:b.translationLanguage?b.translationLanguage.languageCode:"",languageName:b.languageName,format:b.format,kind:b.kind},d.style=g.Hg(b.style),g.fc(d,c.A));h8(this,"setSubtitlesTrack",d);f8(this,c)}else e8(this,g.Da(this.mG,a,b))};
g.h.fy=function(a,b){if(1==this.o){h8(this,"setAudioTrack",{videoId:a,audioTrackId:b.Mb.id});var c=d8(this);c.audioTrackId=b.Mb.id;f8(this,c)}else e8(this,g.Da(this.fy,a,b))};
g.h.qH=function(a,b){if(1==this.o){if(a&&b){var c=d8(this);$7(c,a,b);f8(this,c)}h8(this,"previous")}else e8(this,g.Da(this.qH,a,b))};
g.h.pH=function(a,b){if(1==this.o){if(a&&b){var c=d8(this);$7(c,a,b);f8(this,c)}h8(this,"next")}else e8(this,g.Da(this.pH,a,b))};
g.h.oA=function(){1==this.o?h8(this,"dismissAutoplay"):e8(this,this.oA)};
g.h.dispose=function(){if(3!=this.o){var a=this.o;this.o=3;this.V("proxyStateChange",a,this.o)}c8.fa.dispose.call(this)};
g.h.Y=function(){EFa(this);this.C=null;this.D.clear();b8(this,null);c8.fa.Y.call(this)};
g.h.gy=function(a){if((a!=this.o||2==a)&&3!=this.o&&0!=a){var b=this.o;this.o=a;this.V("proxyStateChange",b,a);if(1==a)for(;!this.D.isEmpty();)g.NC(this.D).apply(this);else 3==a&&this.dispose()}};
g.h.VU=function(a,b){this.V(a,b)};
g.h.tS=function(a){if(!a)this.Nn(null),b8(this,null);else if(this.B.receiver.volume){a=this.B.receiver.volume;var b=d8(this),c=Math.round(100*a.level||0);if(b.volume!=c||b.muted!=a.muted)m7("CP","Cast volume update: "+a.level+(a.muted?" muted":"")),b.volume=c,b.muted=!!a.muted,f8(this,b)}};
g.h.Nn=function(a){m7("CP","Cast media: "+!!a);this.A&&this.A.removeUpdateListener(this.H);if(this.A=a)this.A.addUpdateListener(this.H),FFa(this),this.V("remotePlayerChange")};
g.h.sS=function(a){a?(FFa(this),this.V("remotePlayerChange")):this.Nn(null)};
g.h.FS=function(){var a=BFa();a&&b8(this,a)};
g.h.sc=function(a){m7("CP",a)};g.C(j8,g.VF);g.h=j8.prototype;
g.h.connect=function(a,b){if(b){var c=b.listId,d=b.videoId,e=b.playerParams,f=b.clickTrackingParams,k=b.index,l={videoId:d},m=b.currentTime,n=b.locationInfo;g.u(m)&&(l.currentTime=5>=m?0:m);e&&(l.playerParams=e);n&&(l.locationInfo=n);f&&(l.clickTrackingParams=f);c&&(l.listId=c);g.u(k)&&(l.currentIndex=k);c&&(this.kb.listId=c);this.kb.videoId=d;this.kb.index=k||0;this.kb.state=3;Y7(this.kb,m);this.C="UNSUPPORTED";k8("Connecting with setPlaylist and params: "+g.Hg(l));this.o.connect({method:"setPlaylist",
params:g.Hg(l)},a,$Da())}else k8("Connecting without params"),this.o.connect({},a,$Da());HFa(this)};
g.h.dispose=function(){this.la()||(this.V("beforeDispose"),l8(this,3));j8.fa.dispose.call(this)};
g.h.Y=function(){m8(this);o8(this);n8(this);g.oE(this.J);this.J=window.NaN;g.oE(this.K);this.K=window.NaN;this.B=null;g.FF(this.W);this.W.length=0;this.o.dispose();j8.fa.Y.call(this);this.C=this.G=this.A=this.kb=this.o=null};
g.h.AL=function(){this.F(2)};
g.h.xS=function(){k8("Channel opened");this.O&&(this.O=!1,n8(this),this.N=g.mE((0,g.B)(function(){k8("Timing out waiting for a screen.");this.F(1)},this),15E3));
dEa(REa(this.o),this.ca)};
g.h.uS=function(){k8("Channel closed");(0,window.isNaN)(this.D)?z6(!0):z6();this.dispose()};
g.h.vS=function(a){z6();(0,window.isNaN)(this.H())?(k8("Channel error: "+a+" without reconnection"),this.dispose()):(this.O=!0,k8("Channel error: "+a+" with reconnection in "+this.H()+" ms"),l8(this,2))};
g.h.wS=function(a){a.params?k8("Received: action="+a.action+", params="+g.Hg(a.params)):k8("Received: action="+a.action+" {}");switch(a.action){case "loungeStatus":a=g.ux(a.params.devices);this.A=(0,g.I)(a,function(a){return new n6(a)});
a=!!g.Ia(this.A,function(a){return"LOUNGE_SCREEN"==a.type});
KFa(this,a);break;case "loungeScreenDisconnected":g.Ta(this.A,function(a){return"LOUNGE_SCREEN"==a.type});
KFa(this,!1);break;case "remoteConnected":var b=new n6(g.ux(a.params.device));g.Ia(this.A,function(a){return b?a.id==b.id:!1})||g.Pa(this.A,b);
break;case "remoteDisconnected":b=new n6(g.ux(a.params.device));g.Ta(this.A,function(a){return b?a.id==b.id:!1});
break;case "gracefulDisconnect":break;case "playlistModified":MFa(this,a);break;case "nowPlaying":OFa(this,a);break;case "onStateChange":NFa(this,a);break;case "onAdStateChange":PFa(this,a);break;case "onVolumeChanged":QFa(this,a);break;case "onSubtitlesTrackChanged":LFa(this,a);break;case "nowAutoplaying":RFa(this,a);break;case "autoplayDismissed":this.V("autoplayDismissed");break;case "autoplayUpNext":this.G=a.params.videoId||null;this.V("autoplayUpNext",this.G);break;case "onAutoplayModeChanged":this.C=
a.params.autoplayMode;this.V("autoplayModeChange",this.C);"DISABLED"==this.C&&this.V("autoplayDismissed");break;case "onHasPreviousNextChanged":SFa(this,a);break;case "requestAssistedSignIn":this.V("assistedSignInRequested",a.params.authCode);break;default:k8("Unrecognized action: "+a.action)}};
g.h.YW=function(){if(this.B){var a=this.B;this.B=null;this.kb.videoId!=a&&p8(this,"getNowPlaying")}};
j8.prototype.subscribe=j8.prototype.subscribe;j8.prototype.unsubscribeByKey=j8.prototype.ce;j8.prototype.ia=function(){var a=3;this.la()||(a=0,(0,window.isNaN)(this.H())?h7(this.o)&&(0,window.isNaN)(this.D)&&(a=1):a=2);return a};
j8.prototype.getProxyState=j8.prototype.ia;j8.prototype.F=function(a){k8("Disconnecting with "+a);m8(this);this.V("beforeDisconnect",a);1==a&&z6();SEa(this.o,a);this.dispose()};
j8.prototype.disconnect=j8.prototype.F;j8.prototype.ha=function(){var a=this.kb;this.B&&(a=this.kb.clone(),$7(a,this.B,a.index));return a8(a)};
j8.prototype.getPlayerContextData=j8.prototype.ha;
j8.prototype.pa=function(a){var b=new V7(a);b.videoId&&b.videoId!=this.kb.videoId&&(this.B=b.videoId,g.oE(this.J),this.J=g.mE((0,g.B)(this.YW,this),5E3));var c=[];this.kb.listId==b.listId&&this.kb.videoId==b.videoId&&this.kb.index==b.index||c.push("remoteQueueChange");this.kb.o==b.o&&this.kb.volume==b.volume&&this.kb.muted==b.muted&&Z7(this.kb)==Z7(b)&&g.Hg(this.kb.A)==g.Hg(b.A)||c.push("remotePlayerChange");this.kb.reset(a);(0,g.D)(c,function(a){this.V(a)},this)};
j8.prototype.setPlayerContextData=j8.prototype.pa;j8.prototype.aa=function(){var a=this.o.F.id,b=g.Ia(this.A,function(b){return"REMOTE_CONTROL"==b.type&&b.id!=a});
return b?b.id:""};
j8.prototype.getOtherConnectedRemoteId=j8.prototype.aa;j8.prototype.H=function(){var a=this.o;return a.A.isActive()?a.A.A-(0,g.H)():window.NaN};
j8.prototype.getReconnectTimeout=j8.prototype.H;j8.prototype.ba=function(){return this.C||"UNSUPPORTED"};
j8.prototype.getAutoplayMode=j8.prototype.ba;j8.prototype.ga=function(){return this.G||""};
j8.prototype.getAutoplayVideoId=j8.prototype.ga;j8.prototype.wa=function(){if(!(0,window.isNaN)(this.H())){var a=this.o.A;g.Au(a.o);a.start()}};
j8.prototype.reconnect=j8.prototype.wa;j8.prototype.ka=function(a,b){p8(this,a,b);JFa(this)};
j8.prototype.sendMessage=j8.prototype.ka;g.C(q8,q7);g.h=q8.prototype;g.h.De=function(a){return this.md.$_gs(a)};
g.h.contains=function(a){return!!this.md.$_c(a)};
g.h.get=function(a){return this.md.$_g(a)};
g.h.start=function(){this.md.$_st()};
g.h.add=function(a,b,c){this.md.$_a(a,b,c)};
g.h.remove=function(a,b,c){this.md.$_r(a,b,c)};
g.h.Or=function(a,b,c,d){this.md.$_un(a,b,c,d)};
g.h.Y=function(){for(var a=0,b=this.A.length;a<b;++a)this.md.$_ubk(this.A[a]);this.A.length=0;this.md=null;q8.fa.Y.call(this)};
g.h.pY=function(){this.V("screenChange")};
g.h.vU=function(){this.V("onlineScreenChange")};
z7.prototype.$_st=z7.prototype.start;z7.prototype.$_gspc=z7.prototype.qY;z7.prototype.$_gsppc=z7.prototype.uH;z7.prototype.$_c=z7.prototype.contains;z7.prototype.$_g=z7.prototype.get;z7.prototype.$_a=z7.prototype.add;z7.prototype.$_un=z7.prototype.Or;z7.prototype.$_r=z7.prototype.remove;z7.prototype.$_gs=z7.prototype.De;z7.prototype.$_gos=z7.prototype.tH;z7.prototype.$_s=z7.prototype.subscribe;z7.prototype.$_ubk=z7.prototype.ce;var r8=null,s8=null,H8=null,w8=[];g.t(I8,g.L);g.h=I8.prototype;
g.h.Y=function(){g.L.prototype.Y.call(this);this.B.stop();this.D.stop();this.K.stop();this.N();this.o.unsubscribe("proxyStateChange",this.SE,this);this.o.unsubscribe("remotePlayerChange",this.Pn,this);this.o.unsubscribe("remoteQueueChange",this.Oq,this);this.o.unsubscribe("autoplayUpNext",this.oE,this);this.o.unsubscribe("previousNextChange",this.PE,this);this.o.unsubscribe("nowAutoplaying",this.GE,this);this.o.unsubscribe("autoplayDismissed",this.nE,this);this.o=this.C=null};
g.h.lD=function(a,b){for(var c=[],d=1;d<arguments.length;++d)c[d-1]=arguments[d];if(2!=this.o.o)if(L8(this)){if(!d8(this.o).isAdPlaying()||"control_seek"!=a)switch(a){case "control_toggle_play_pause":d8(this.o).sb()?this.o.pause():this.o.play();break;case "control_play":this.o.play();break;case "control_pause":this.o.pause();break;case "control_seek":this.J.Mm(c[0],c[1]);break;case "control_subtitles_set_track":M8(this,c[0]);break;case "control_set_audio_track":c=c[0],L8(this)&&this.o.fy(this.T.getVideoData(1).videoId,
c)}}else switch(a){case "control_toggle_play_pause":case "control_play":case "control_pause":c=this.T.getCurrentTime();N8(this,0==c?void 0:c);break;case "control_seek":N8(this,c[0]);break;case "control_subtitles_set_track":M8(this,c[0]);break;case "control_set_audio_track":c=c[0],L8(this)&&this.o.fy(this.T.getVideoData(1).videoId,c)}};
g.h.rS=function(a){this.K.vL(a)};
g.h.QX=function(a){this.lD("control_subtitles_set_track",g.Yb(a)?null:a)};
g.h.BG=function(){var a=this.T.Fc("captions","track");g.Yb(a)||M8(this,a)};
g.h.CE=function(a){if(L8(this)){this.o.unsubscribe("remotePlayerChange",this.Pn,this);var b=Math.round(a.volume);a=!!a.muted;var c=d8(this.o);if(b!=c.volume||a!=c.muted)this.o.setVolume(b,a),this.L.start();this.o.subscribe("remotePlayerChange",this.Pn,this)}};
g.h.OT=function(){g.Yb(this.F)||dGa(this,this.F);this.G=!1};
g.h.SE=function(a,b){this.D.stop();2==b&&this.yG()};
g.h.Pn=function(){if(L8(this)){this.B.stop();var a=d8(this.o);switch(a.o){case 1080:case 1081:case 1084:case 1085:this.C.G=1;break;case 1082:case 1083:this.C.G=0;break;default:this.C.G=-1}switch(a.o){case 1081:case 1:K8(this,new g.JP(8));this.xG();break;case 1085:case 3:K8(this,new g.JP(9));break;case 1083:case 0:K8(this,new g.JP(2));this.J.stop();J8(this,this.T.getVideoData().lengthSeconds);break;case 1084:K8(this,new g.JP(4));break;case 2:K8(this,new g.JP(4));J8(this,Z7(a));break;case -1:K8(this,
new g.JP(64));break;case -1E3:K8(this,new g.JP(128,{errorCode:"mdx.remoteerror",message:"This video is not available for remote playback."}))}a=d8(this.o).A;var b=this.F;(a||b?a&&b&&a.trackName==b.trackName&&a.languageCode==b.languageCode&&a.languageName==b.languageName&&a.format==b.format&&a.kind==b.kind:1)||(this.F=a,dGa(this,a));a=d8(this.o);-1==a.volume||Math.round(this.T.getVolume())==a.volume&&this.T.isMuted()==a.muted||this.L.isActive()||this.cH()}else cGa(this)};
g.h.PE=function(){this.T.V("mdxpreviousnextchange")};
g.h.Oq=function(){L8(this)||cGa(this)};
g.h.AK=function(){this.o.oA()};
g.h.oE=function(a){a&&(a=g.DE("/watch_queue_ajax",{method:"GET",gd:{action_get_watch_queue_item:1,video_id:a},onSuccess:(0,g.B)(this.bW,this)}))&&(this.N=(0,g.B)(a.abort,a))};
g.h.bW=function(a,b){var c=new g.YO(g.X(this.T),{videoId:b.videoId,title:b.title,author:b.author,murlmq_webp:b.url});this.suggestion=c;this.T.V("mdxautoplayupnext",c)};
g.h.GE=function(a){(0,window.isNaN)(a)||this.T.V("mdxnowautoplaying",a)};
g.h.nE=function(){this.T.V("mdxautoplaycanceled")};
g.h.vQ=function(a,b){-1==d8(this.o).o?N8(this,a):b&&this.o.rH(a)};
g.h.cH=function(){if(L8(this)){var a=d8(this.o);this.A.Ia(this.O);a.muted?this.T.mute():this.T.sg();this.T.setVolume(a.volume);this.O=this.A.R(this.T,"onVolumeChange",this.CE)}};
g.h.xG=function(){this.B.stop();if(!this.o.la()){var a=d8(this.o);a.sb()&&K8(this,new g.JP(8));J8(this,Z7(a));this.B.start()}};
g.h.yG=function(){this.D.stop();this.B.stop();var a=this.o.C.getReconnectTimeout();2==this.o.o&&!(0,window.isNaN)(a)&&this.D.start()};g.t(O8,g.V);O8.prototype.D=function(a){fGa(this,a.state)};g.t(P8,g.wY);P8.prototype.K=function(){var a=this.T.Fc("remote","receivers");a&&1<a.length&&!this.T.Fc("remote","quickCast")?(this.H=g.ib(a,this.D,this),g.xY(this,(0,g.I)(a,this.D)),a=this.T.Fc("remote","currentReceiver"),this.Gf(this.D(a)),this.enable(!0)):this.enable(!1)};
P8.prototype.D=function(a){return a.key};
P8.prototype.Ff=function(a){return"cast-selector-receiver"==a?"Cast...":this.H[a].name};
P8.prototype.Id=function(a){g.wY.prototype.Id.call(this,a);this.T.Xd("remote","currentReceiver",this.H[a]);this.C.Rb()};g.t(Q8,g.zU);g.h=Q8.prototype;g.h.create=function(){XFa(g.ZM(g.X(this.player)));this.D.push(g.fG("yt-remote-before-disconnect",this.nS,this));this.D.push(g.fG("yt-remote-connection-change",this.fV,this));this.D.push(g.fG("yt-remote-receiver-availability-change",this.QE,this));this.D.push(g.fG("yt-remote-auto-connect",this.dV,this));this.D.push(g.fG("yt-remote-receiver-resumed",this.cV,this));this.QE()};
g.h.load=function(){this.player.Mv();g.zU.prototype.load.call(this);this.C=new I8(this,this.player,this.o);var a=(a=bGa())?a.currentTime:0;var b=G8()?new c8(B8(),void 0):null;0==a&&b&&(a=Z7(d8(b)));0!=a&&(this.J=a||0,this.player.V("progresssync",a,void 0));eGa(this,this.F,this.F);g.L_(this.player.app,6)};
g.h.unload=function(){this.player.V("mdxautoplaycanceled");this.B=this.A;g.mf(this.C,this.o);this.o=this.C=null;g.zU.prototype.unload.call(this);g.L_(this.player.app,5)};
g.h.Y=function(){g.gG(this.D);g.zU.prototype.Y.call(this)};
g.h.Dn=function(a,b){for(var c=[],d=1;d<arguments.length;++d)c[d-1]=arguments[d];this.loaded&&this.C.lD.apply(this.C,[a].concat(g.fa(c)))};
g.h.qL=function(){return this.loaded?this.C.suggestion:null};
g.h.kg=function(){return this.o?d8(this.o).kg:!1};
g.h.hasNext=function(){return this.o?d8(this.o).hasNext:!1};
g.h.getCurrentTime=function(){return this.J};
g.h.jQ=function(){var a=d8(this.o),b=this.player.getVideoData();return{allowSeeking:g.X(this.player).experiments.o("web_player_mdx_allow_seeking_change_killswitch")?this.player.Zc():!a.isAdPlaying()&&this.player.Zc(),clipEnd:b.clipEnd,clipStart:b.clipStart,current:this.getCurrentTime(),displayedStart:-1,duration:a.getDuration(),ingestionTime:a.F?a.C+X7(a):a.C,isPeggedToLive:1>=(a.F?a.B+X7(a):a.B)-this.getCurrentTime(),loaded:a.K,seekableEnd:a.F?a.B+X7(a):a.B,seekableStart:0<a.D?a.D+X7(a):a.D}};
g.h.kQ=function(){this.o&&this.o.pH()};
g.h.lQ=function(){this.o&&this.o.qH()};
g.h.nS=function(a){1==a&&(this.K=this.o?d8(this.o):null)};
g.h.fV=function(){var a=G8()?new c8(B8(),void 0):null;if(a){var b=this.B;this.loaded&&this.unload();this.o=a;this.K=null;b.key!=this.A.key&&(this.B=b,this.load())}else g.lf(this.o),this.o=null,this.loaded&&(this.unload(),(a=this.K)&&a.videoId==this.player.getVideoData().videoId&&this.player.QC(a.videoId,Z7(a)));this.player.V("videodatachange","newdata",this.player.getVideoData(),3)};
g.h.QE=function(){this.H=[this.A].concat(ZFa());var a=C8()||this.A;R8(this,a);this.player.za("onMdxReceiversChange")};
g.h.dV=function(){var a=C8();R8(this,a)};
g.h.cV=function(){this.B=C8()};
g.h.iQ=function(a,b){switch(a){case "casting":return this.loaded;case "receivers":return this.H;case "currentReceiver":return b&&("cast-selector-receiver"==b.key?T7():R8(this,b)),this.loaded?this.B:this.A;case "quickCast":return 2==this.H.length&&"cast-selector-receiver"==this.H[1].key?(b&&T7(),!0):!1}};
g.h.mQ=function(){h8(this.o,"sendDebugCommand",{debugCommand:"stats4nerds "})};
g.h.Hc=function(){return!1};g.xX.remote=Q8;})(_yt_player);

/*
     FILE ARCHIVED ON 08:13:46 Oct 27, 2018 AND RETRIEVED FROM THE
     INTERNET ARCHIVE ON 17:58:11 Apr 23, 2019.
     JAVASCRIPT APPENDED BY WAYBACK MACHINE, COPYRIGHT INTERNET ARCHIVE.

     ALL OTHER CONTENT MAY ALSO BE PROTECTED BY COPYRIGHT (17 U.S.C.
     SECTION 108(a)(3)).
*/
/*
playback timings (ms):
  LoadShardBlock: 542.259 (3)
  esindex: 9.524
  captures_list: 584.764
  CDXLines.iter: 9.101 (3)
  PetaboxLoader3.datanode: 71.427 (5)
  exclusion.robots: 0.275
  exclusion.robots.policy: 0.264
  RedisCDXSource: 20.931
  PetaboxLoader3.resolve: 86.062
  load_resource: 239.464
*/