(function(g){var window=this;var TFa=function(a,b){return g.Tb(a,b)},$5=function(a,b,c){a.C.set(b,c)},a6=function(a){$5(a,"zx",Math.floor(2147483648*Math.random()).toString(36)+Math.abs(Math.floor(2147483648*Math.random())^g.A()).toString(36));
return a},b6=function(a,b,c){Array.isArray(c)||(c=[String(c)]);
g.ln(a.C,b,c)},UFa=function(a,b){var c=[];
g.dj(b,function(d){try{var e=g.Yn.prototype.B.call(this,d,!0)}catch(f){if("Storage: Invalid value was encountered"==f)return;throw f;}void 0===e?c.push(d):g.Xn(e)&&c.push(d)},a);
return c},VFa=function(a,b){var c=UFa(a,b);
g.Gb(c,function(d){g.Yn.prototype.remove.call(this,d)},a)},WFa=function(a){if(a.Md){if(a.Md.locationOverrideToken)return{locationOverrideToken:a.Md.locationOverrideToken};
if(null!=a.Md.latitudeE7&&null!=a.Md.longitudeE7)return{latitudeE7:a.Md.latitudeE7,longitudeE7:a.Md.longitudeE7}}return null},XFa=function(a,b){g.nb(a,b)||a.push(b)},c6=function(a){var b=0,c;
for(c in a)b++;return b},YFa=function(a,b){var c=b instanceof g.Fc?b:g.Lc(b,/^data:image\//i.test(b));
a.src=g.Gc(c)},d6=function(){},ZFa=function(a){try{return g.v.JSON.parse(a)}catch(b){}a=String(a);
if(/^\s*$/.test(a)?0:/^[\],:{}\s\u2028\u2029]*$/.test(a.replace(/\\["\\\/bfnrtu]/g,"@").replace(/(?:"[^"\\\n\r\u2028\u2029\x00-\x08\x0a-\x1f]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?)[\s\u2028\u2029]*(?=:|,|]|}|$)/g,"]").replace(/(?:^|:|,)(?:[\s\u2028\u2029]*\[)+/g,"")))try{return eval("("+a+")")}catch(b){}throw Error("Invalid JSON string: "+a);},$Fa=function(a){if(a.Ze&&"function"==typeof a.Ze)return a.Ze();
if("string"===typeof a)return a.split("");if(g.Ra(a)){for(var b=[],c=a.length,d=0;d<c;d++)b.push(a[d]);return b}return g.Pb(a)},aGa=function(a,b){if(a.forEach&&"function"==typeof a.forEach)a.forEach(b,void 0);
else if(g.Ra(a)||"string"===typeof a)g.Gb(a,b,void 0);else{if(a.mg&&"function"==typeof a.mg)var c=a.mg();else if(a.Ze&&"function"==typeof a.Ze)c=void 0;else if(g.Ra(a)||"string"===typeof a){c=[];for(var d=a.length,e=0;e<d;e++)c.push(e)}else c=g.Qb(a);d=$Fa(a);e=d.length;for(var f=0;f<e;f++)b.call(void 0,d[f],c&&c[f],a)}},bGa=function(a,b,c,d){var e=new g.Zm(null,void 0);
a&&g.$m(e,a);b&&g.an(e,b);c&&g.bn(e,c);d&&(e.B=d);return e},e6=function(a,b){g.Lo[a]=!0;
var c=g.Jo();c&&c.publish.apply(c,arguments);g.Lo[a]=!1},f6=function(a){this.app=this.name=this.id="";
this.type="REMOTE_CONTROL";this.obfuscatedGaiaId=this.avatar=this.username="";this.capabilities=new Set;this.experiments=new Set;this.theme="u";new g.Wm;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",cGa(this,a.capabilities||""),dGa(this,a.experiments||""))},cGa=function(a,b){a.capabilities.clear();
g.Ke(b.split(","),g.Va(TFa,eGa)).forEach(function(c){a.capabilities.add(c)})},dGa=function(a,b){a.experiments.clear();
b.split(",").forEach(function(c){a.experiments.add(c)})},g6=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||""},h6=function(a,b){return!!b&&(a.id==b||a.uuid==b)},fGa=function(a){return{name:a.name,
screenId:a.id,loungeToken:a.token,dialId:a.uuid}},gGa=function(a){return new g6(a)},hGa=function(a){return Array.isArray(a)?g.Pc(a,gGa):[]},i6=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"},j6=function(a){return Array.isArray(a)?"["+g.Pc(a,i6).join(",")+"]":"null"},k6=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)})},iGa=function(a){return g.Pc(a,function(b){return{key:b.id,
name:b.name}})},l6=function(a,b){return g.jb(a,function(c){return c||b?!c!=!b?!1:c.id==b.id:!0})},m6=function(a,b){return g.jb(a,function(c){return h6(c,b)})},jGa=function(){var a=(0,g.Ns)();
a&&VFa(a,a.u.yi(!0))},n6=function(){var a=g.Qs("yt-remote-connected-devices")||[];
g.Cb(a);return a},kGa=function(a){if(g.ob(a))return[];
var b=a[0].indexOf("#"),c=-1==b?a[0]:a[0].substring(0,b);return g.Pc(a,function(d,e){return 0==e?d:d.substring(c.length)})},lGa=function(a){g.Ps("yt-remote-connected-devices",a,86400)},p6=function(){if(o6)return o6;
var a=g.Qs("yt-remote-device-id");a||(a=k6(),g.Ps("yt-remote-device-id",a,31536E3));for(var b=n6(),c=1,d=a;g.nb(b,d);)c++,d=a+"#"+c;return o6=d},q6=function(){var a=n6(),b=p6();
g.nb(a,b);g.Ss()&&g.Fb(a,b);a=kGa(a);if(g.ob(a))try{g.xq("remote_sid")}catch(c){}else try{g.vq("remote_sid",a.join(","),-1)}catch(c){}},mGa=function(){return g.Qs("yt-remote-session-browser-channel")},nGa=function(){return g.Qs("yt-remote-local-screens")||[]},oGa=function(){g.Ps("yt-remote-lounge-token-expiration",!0,86400)},pGa=function(a){5<a.length&&(a=a.slice(a.length-5));
var b=g.Pc(nGa(),function(d){return d.loungeToken}),c=g.Pc(a,function(d){return d.loungeToken});
g.jh(c,function(d){return!g.nb(b,d)})&&oGa();
g.Ps("yt-remote-local-screens",a,31536E3)},qGa=function(a,b){g.Ps("yt-remote-session-browser-channel",a);
g.Ps("yt-remote-session-screen-id",b);var c=n6(),d=p6();g.nb(c,d)||c.push(d);lGa(c);q6()},r6=function(a){a||(g.Rs("yt-remote-session-screen-id"),g.Rs("yt-remote-session-video-id"));
q6();a=n6();g.rb(a,p6());lGa(a)},rGa=function(){if(!s6){var a=g.io();
a&&(s6=new g.Sn(a))}return s6?!!s6.get("yt-remote-use-staging-server"):!1},sGa=function(a){return!!document.currentScript&&(-1!=document.currentScript.src.indexOf("?"+a)||-1!=document.currentScript.src.indexOf("&"+a))},tGa=function(){return"function"==typeof window.__onGCastApiAvailable?window.__onGCastApiAvailable:null},t6=function(a){a.length?uGa(a.shift(),function(){t6(a)}):u6()},vGa=function(a){return"chrome-extension://"+a+"/cast_sender.js"},uGa=function(a,b,c){var d=document.createElement("script");
d.onerror=b;c&&(d.onload=c);g.jd(d,g.ng(a));(document.head||document.documentElement).appendChild(d)},u6=function(){var a=tGa();
a&&a(!1,"No cast extension found")},xGa=function(){if(wGa){var a=2,b=tGa(),c=function(){a--;
0==a&&b&&b(!0)};
window.__onGCastApiAvailable=c;uGa("//www.gstatic.com/cast/sdk/libs/sender/1.0/cast_framework.js",u6,c)}},yGa=function(){xGa();
var a=window.navigator.userAgent.match(/Chrome\/([0-9]+)/);t6(["//www.gstatic.com/eureka/clank/"+(a?parseInt(a[1],10):0)+"/cast_sender.js","//www.gstatic.com/eureka/clank/cast_sender.js"])},v6=function(a,b,c){g.B.call(this);
this.I=null!=c?(0,g.z)(a,c):a;this.Le=b;this.F=(0,g.z)(this.BI,this);this.u=!1;this.B=0;this.C=this.Ua=null;this.D=[]},w6=function(a,b,c){g.B.call(this);
this.D=null!=c?a.bind(c):a;this.Le=b;this.C=null;this.u=!1;this.B=0;this.Ua=null},x6=function(a){a.Ua=g.Um(function(){a.Ua=null;
a.u&&!a.B&&(a.u=!1,x6(a))},a.Le);
var b=a.C;a.C=null;a.D.apply(null,b)},y6=function(a){if(g.v.JSON)try{return g.v.JSON.parse(a)}catch(b){}return ZFa(a)},z6=function(){},A6=function(a,b){if("function"!==typeof a)throw Error("Fn must not be null and must be a function");
return g.v.setTimeout(function(){a()},b)},C6=function(a){B6.dispatchEvent(new zGa(B6,a))},zGa=function(a){g.Ll.call(this,"statevent",a)},D6=function(){},AGa=function(){},CGa=function(a){return(a=BGa(a))?new ActiveXObject(a):new XMLHttpRequest},BGa=function(a){if(!a.B&&"undefined"==typeof XMLHttpRequest&&"undefined"!=typeof ActiveXObject){for(var b=["MSXML2.XMLHTTP.6.0",
"MSXML2.XMLHTTP.3.0","MSXML2.XMLHTTP","Microsoft.XMLHTTP"],c=0;c<b.length;c++){var d=b[c];try{return new ActiveXObject(d),a.B=d}catch(e){}}throw Error("Could not create ActiveXObject. ActiveX might be disabled, or MSXML might not be installed");}return a.B},E6=function(a,b,c,d){this.u=a;
this.B=b;this.N=c;this.K=d||1;this.F=45E3;this.D=new g.W0(this);this.C=new g.Tm;this.C.setInterval(250)},EGa=function(a,b,c){a.Bn=1;
a.Ej=a6(b.clone());a.Ll=c;a.I=!0;DGa(a,null)},F6=function(a,b,c,d,e){a.Bn=1;
a.Ej=a6(b.clone());a.Ll=null;a.I=c;e&&(a.sF=!1);DGa(a,d)},DGa=function(a,b){a.tn=g.A();
G6(a);a.uk=a.Ej.clone();b6(a.uk,"t",a.K);a.mq=0;a.Od=a.u.hv(a.u.Up()?b:null);0<a.Yv&&(a.At=new w6((0,g.z)(a.rG,a,a.Od),a.Yv));a.D.ra(a.Od,"readystatechange",a.ZP);var c=a.ll?g.Zb(a.ll):{};a.Ll?(a.iu="POST",c["Content-Type"]="application/x-www-form-urlencoded",a.Od.send(a.uk,a.iu,a.Ll,c)):(a.iu="GET",a.sF&&!g.Ae&&(c.Connection="close"),a.Od.send(a.uk,a.iu,null,c));a.u.ih(1)},HGa=function(a,b,c){for(var d=!0;!a.Ok&&a.mq<c.length;){var e=FGa(a,c);
if(e==H6){4==b&&(a.Sj=4,C6(15),d=!1);break}else if(e==GGa){a.Sj=4;C6(16);d=!1;break}else I6(a,e)}4==b&&0==c.length&&(a.Sj=1,C6(17),d=!1);a.qh=a.qh&&d;d||(J6(a),K6(a))},FGa=function(a,b){var c=a.mq,d=b.indexOf("\n",c);
if(-1==d)return H6;c=Number(b.substring(c,d));if(isNaN(c))return GGa;d+=1;if(d+c>b.length)return H6;var e=b.substr(d,c);a.mq=d+c;return e},KGa=function(a,b){a.tn=g.A();
G6(a);var c=b?window.location.hostname:"";a.uk=a.Ej.clone();$5(a.uk,"DOMAIN",c);$5(a.uk,"t",a.K);try{a.xh=new ActiveXObject("htmlfile")}catch(n){J6(a);a.Sj=7;C6(22);K6(a);return}var d="<html><body>";if(b){for(var e="",f=0;f<c.length;f++){var h=c.charAt(f);if("<"==h)h=e+"\\x3c";else if(">"==h)h=e+"\\x3e";else{if(h in L6)h=L6[h];else if(h in JGa)h=L6[h]=JGa[h];else{var l=h.charCodeAt(0);if(31<l&&127>l)var m=h;else{if(256>l){if(m="\\x",16>l||256<l)m+="0"}else m="\\u",4096>l&&(m+="0");m+=l.toString(16).toUpperCase()}h=
L6[h]=m}h=e+h}e=h}d+='<script>document.domain="'+e+'"\x3c/script>'}c=g.gd(g.kc("b/12014412"),d+"</body></html>");a.xh.open();a.xh.write(g.cd(c));a.xh.close();a.xh.parentWindow.m=(0,g.z)(a.nP,a);a.xh.parentWindow.d=(0,g.z)(a.rE,a,!0);a.xh.parentWindow.rpcClose=(0,g.z)(a.rE,a,!1);c=a.xh.createElement("DIV");a.xh.parentWindow.document.body.appendChild(c);d=g.Kc(a.uk.toString());d=g.nd(g.Gc(d));d=g.gd(g.kc("b/12014412"),'<iframe src="'+d+'"></iframe>');g.hd(c,d);a.u.ih(1)},G6=function(a){a.Oy=g.A()+a.F;
LGa(a,a.F)},LGa=function(a,b){if(null!=a.Hn)throw Error("WatchDog timer not null");
a.Hn=A6((0,g.z)(a.zP,a),b)},M6=function(a){a.Hn&&(g.v.clearTimeout(a.Hn),a.Hn=null)},K6=function(a){a.u.uB()||a.Ok||a.u.Lr(a)},J6=function(a){M6(a);
g.eg(a.At);a.At=null;a.C.stop();g.Oza(a.D);if(a.Od){var b=a.Od;a.Od=null;b.abort();b.dispose()}a.xh&&(a.xh=null)},I6=function(a,b){try{a.u.jE(a,b),a.u.ih(4)}catch(c){}},NGa=function(a,b,c,d,e){if(0==d)c(!1);
else{var f=e||0;d--;MGa(a,b,function(h){h?c(!0):g.v.setTimeout(function(){NGa(a,b,c,d,f)},f)})}},MGa=function(a,b,c){var d=new Image;
d.onload=function(){try{N6(d),c(!0)}catch(e){}};
d.onerror=function(){try{N6(d),c(!1)}catch(e){}};
d.onabort=function(){try{N6(d),c(!1)}catch(e){}};
d.ontimeout=function(){try{N6(d),c(!1)}catch(e){}};
g.v.setTimeout(function(){if(d.ontimeout)d.ontimeout()},b);
YFa(d,a)},N6=function(a){a.onload=null;
a.onerror=null;a.onabort=null;a.ontimeout=null},O6=function(a){g.im.call(this);
this.headers=new g.Wm;this.ba=a||null;this.B=!1;this.Y=this.u=null;this.oa=this.P="";this.I=0;this.D="";this.F=this.ha=this.N=this.fa=!1;this.K=0;this.W=null;this.ya="";this.X=this.ea=!1},OGa=function(a){return g.ye&&g.$d(9)&&"number"===typeof a.timeout&&void 0!==a.ontimeout},PGa=function(a){return"content-type"==a.toLowerCase()},RGa=function(a,b){a.B=!1;
a.u&&(a.F=!0,a.u.abort(),a.F=!1);a.D=b;a.I=5;QGa(a);P6(a)},QGa=function(a){a.fa||(a.fa=!0,a.dispatchEvent("complete"),a.dispatchEvent("error"))},TGa=function(a){if(a.B&&"undefined"!=typeof g.a1)if(a.Y[1]&&4==Q6(a)&&2==a.getStatus())R6(a,"Local request error detected and ignored");
else if(a.N&&4==Q6(a))g.Um(a.fE,0,a);else if(a.dispatchEvent("readystatechange"),4==Q6(a)){R6(a,"Request complete");a.B=!1;try{var b=a.getStatus();a:switch(b){case 200:case 201:case 202:case 204:case 206:case 304:case 1223:var c=!0;break a;default:c=!1}var d;if(!(d=c)){var e;if(e=0===b){var f=g.xd(1,String(a.P));if(!f&&g.v.self&&g.v.self.location){var h=g.v.self.location.protocol;f=h.substr(0,h.length-1)}e=!SGa.test(f?f.toLowerCase():"")}d=e}if(d)a.dispatchEvent("complete"),a.dispatchEvent("success");
else{a.I=6;try{var l=2<Q6(a)?a.u.statusText:""}catch(m){l=""}a.D=l+" ["+a.getStatus()+"]";QGa(a)}}finally{P6(a)}}},P6=function(a,b){if(a.u){UGa(a);
var c=a.u,d=a.Y[0]?g.Oa:null;a.u=null;a.Y=null;b||a.dispatchEvent("ready");try{c.onreadystatechange=d}catch(e){}}},UGa=function(a){a.u&&a.X&&(a.u.ontimeout=null);
a.W&&(g.v.clearTimeout(a.W),a.W=null)},Q6=function(a){return a.u?a.u.readyState:0},S6=function(a){try{return a.u?a.u.responseText:""}catch(b){return""}},R6=function(a,b){return b+" ["+a.oa+" "+a.P+" "+a.getStatus()+"]"},VGa=function(a){this.u=a;
this.B=new z6},WGa=function(a){var b=T6(a.u,a.Wn,"/mail/images/cleardot.gif");
a6(b);NGa(b.toString(),5E3,(0,g.z)(a.CH,a),3,2E3);a.ih(1)},V6=function(a){var b=a.u.N;
if(null!=b)C6(5),b?(C6(11),U6(a.u,a,!1)):(C6(12),U6(a.u,a,!0));else if(a.Jf=new E6(a,void 0,void 0,void 0),a.Jf.ll=a.Wv,b=a.u,b=T6(b,b.Up()?a.Co:null,a.Xv),C6(5),!g.ye||g.ae(10))b6(b,"TYPE","xmlhttp"),F6(a.Jf,b,!1,a.Co,!1);else{b6(b,"TYPE","html");var c=a.Jf;a=!!a.Co;c.Bn=3;c.Ej=a6(b.clone());KGa(c,a)}},W6=function(a,b,c){this.Ca=1;
this.u=[];this.C=[];this.D=new z6;this.K=a||null;this.N=null!=b?b:null;this.F=c||!1},XGa=function(a,b){this.u=a;
this.map=b;this.context=null},YGa=function(a,b,c,d){g.Ll.call(this,"timingevent",a);
this.size=b;this.Mp=d},ZGa=function(a){g.Ll.call(this,"serverreachability",a)},bHa=function(a){$Ga(a);
if(3==a.Ca){var b=a.lp++,c=a.tr.clone();$5(c,"SID",a.B);$5(c,"RID",b);$5(c,"TYPE","terminate");X6(a,c);b=new E6(a,a.B,b,void 0);b.Bn=2;b.Ej=a6(c.clone());YFa(new Image,b.Ej.toString());b.tn=g.A();G6(b)}aHa(a)},cHa=function(a){a.YH(1,0);
a.tr=T6(a,null,a.Vv);Y6(a)},$Ga=function(a){a.Hj&&(a.Hj.abort(),a.Hj=null);
a.md&&(a.md.cancel(),a.md=null);a.Ai&&(g.v.clearTimeout(a.Ai),a.Ai=null);Z6(a);a.zf&&(a.zf.cancel(),a.zf=null);a.Lj&&(g.v.clearTimeout(a.Lj),a.Lj=null)},dHa=function(a,b){if(0==a.Ca)throw Error("Invalid operation: sending map when state is closed");
a.u.push(new XGa(a.TL++,b));2!=a.Ca&&3!=a.Ca||Y6(a)},Y6=function(a){a.zf||a.Lj||(a.Lj=A6((0,g.z)(a.qE,a),0),a.Bm=0)},fHa=function(a,b){if(1==a.Ca){if(!b){a.lp=Math.floor(1E5*Math.random());
var c=a.lp++,d=new E6(a,"",c,void 0);d.ll=a.Gm;var e=$6(a),f=a.tr.clone();$5(f,"RID",c);$5(f,"CVER","1");X6(a,f);EGa(d,f,e);a.zf=d;a.Ca=2}}else 3==a.Ca&&(b?eHa(a,b):0==a.u.length||a.zf||eHa(a))},eHa=function(a,b){if(b)if(6<a.Pk){a.u=a.C.concat(a.u);
a.C.length=0;var c=a.lp-1;var d=$6(a)}else c=b.N,d=b.Ll;else c=a.lp++,d=$6(a);var e=a.tr.clone();$5(e,"SID",a.B);$5(e,"RID",c);$5(e,"AID",a.Sm);X6(a,e);c=new E6(a,a.B,c,a.Bm+1);c.ll=a.Gm;c.setTimeout(1E4+Math.round(1E4*Math.random()));a.zf=c;EGa(c,e,d)},X6=function(a,b){if(a.He){var c=a.He.VA();
c&&g.Jb(c,function(d,e){$5(b,e,d)})}},$6=function(a){var b=Math.min(a.u.length,1E3),c=["count="+b];
if(6<a.Pk&&0<b){var d=a.u[0].u;c.push("ofs="+d)}else d=0;for(var e={},f=0;f<b;e={gm:e.gm},f++){e.gm=a.u[f].u;var h=a.u[f].map;e.gm=6>=a.Pk?f:e.gm-d;try{g.Jb(h,function(l){return function(m,n){c.push("req"+l.gm+"_"+n+"="+encodeURIComponent(m))}}(e))}catch(l){c.push("req"+e.gm+"_type="+encodeURIComponent("_badmap"))}}a.C=a.C.concat(a.u.splice(0,b));
return c.join("&")},gHa=function(a){a.md||a.Ai||(a.I=1,a.Ai=A6((0,g.z)(a.pE,a),0),a.km=0)},a7=function(a){if(a.md||a.Ai||3<=a.km)return!1;
a.I++;a.Ai=A6((0,g.z)(a.pE,a),hHa(a,a.km));a.km++;return!0},U6=function(a,b,c){a.fu=c;
a.Ph=b.Qi;a.F||cHa(a)},Z6=function(a){null!=a.Uk&&(g.v.clearTimeout(a.Uk),a.Uk=null)},hHa=function(a,b){var c=5E3+Math.floor(1E4*Math.random());
a.isActive()||(c*=2);return c*b},b7=function(a,b){if(2==b||9==b){var c=null;
a.He&&(c=null);var d=(0,g.z)(a.FQ,a);c||(c=new g.Zm("//www.google.com/images/cleardot.gif"),a6(c));MGa(c.toString(),1E4,d)}else C6(2);iHa(a,b)},iHa=function(a,b){a.Ca=0;
a.He&&a.He.hA(b);aHa(a);$Ga(a)},aHa=function(a){a.Ca=0;
a.Ph=-1;if(a.He)if(0==a.C.length&&0==a.u.length)a.He.Vu();else{g.ub(a.C);var b=g.ub(a.u);a.C.length=0;a.u.length=0;a.He.Vu(b)}},T6=function(a,b,c){var d=g.gn(c);
if(""!=d.u)b&&g.an(d,b+"."+d.u),g.bn(d,d.D);else{var e=window.location;d=bGa(e.protocol,b?b+"."+e.hostname:e.hostname,+e.port,c)}a.po&&g.Jb(a.po,function(f,h){$5(d,h,f)});
$5(d,"VER",a.Pk);X6(a,d);return d},jHa=function(){},kHa=function(){this.u=[];
this.B=[]},lHa=function(a,b){this.action=a;
this.params=b||{}},c7=function(a,b){g.B.call(this);
this.u=new g.H(this.gP,0,this);g.C(this,this.u);this.Le=5E3;this.B=0;if("function"===typeof a)b&&(a=(0,g.z)(a,b));else if(a&&"function"===typeof a.handleEvent)a=(0,g.z)(a.handleEvent,a);else throw Error("Invalid listener argument");this.C=a},d7=function(a,b,c,d){c=void 0===c?!1:c;
d=void 0===d?function(){return""}:d;
this.W=a;this.I=b;this.C=new g.Rn;this.B=new c7(this.lQ,this);this.u=null;this.Cd=!1;this.F=null;this.P="";this.N=this.D=0;this.K=[];this.Y=c;this.X=d},mHa=function(a){return{firstTestResults:[""],
secondTestResults:!a.u.fu,sessionId:a.u.B,arrayId:a.u.Sm}},nHa=function(a,b){a.N=b||0;
a.B.stop();e7(a);a.u&&(3==a.u.Ca&&fHa(a.u),bHa(a.u));a.N=0},f7=function(a){return!!a.u&&3==a.u.Ca},e7=function(a){if(a.u){var b=a.X(),c=a.u.Gm||{};
b?c["x-youtube-lounge-xsrf-token"]=b:delete c["x-youtube-lounge-xsrf-token"];a.u.Gm=c}},oHa=function(a,b){(a.I.loungeIdToken=b)||a.B.stop()},g7=function(a){this.scheme="https";
this.port=this.domain="";this.u="/api/lounge";this.B=!0;a=a||document.location.href;var b=Number(g.xd(4,a))||"";b&&(this.port=":"+b);this.domain=g.yd(a)||"";a=g.Vc;0<=a.search("MSIE")&&(a=a.match(/MSIE ([\d.]+)/)[1],0>g.Dc(a,"10.0")&&(this.B=!1))},h7=function(a,b){var c=a.u;
a.B&&(c=a.scheme+"://"+a.domain+a.port+a.u);return g.Ld(c+b,{})},i7=function(a,b,c,d,e){a={format:"JSON",
method:"POST",context:a,timeout:5E3,withCredentials:!1,onSuccess:g.Va(a.D,d,!0),onError:g.Va(a.C,e),Ef:g.Va(a.F,e)};c&&(a.Xb=c,a.headers={"Content-Type":"application/x-www-form-urlencoded"});return g.oq(b,a)},sHa=function(){var a=pHa;
qHa();j7.push(a);rHa(j7)},k7=function(a,b){qHa();
var c=j7,d=tHa(a,String(b));g.ob(c)?uHa(d):(rHa(c),g.Gb(c,function(e){e(d)}))},qHa=function(){j7||(j7=g.Na("yt.mdx.remote.debug.handlers_")||[],g.Ja("yt.mdx.remote.debug.handlers_",j7,void 0))},uHa=function(a){var b=(l7+1)%50;
l7=b;m7[b]=a;n7||(n7=49==b)},rHa=function(a){var b=m7;
if(b[0]){var c=l7,d=n7?c:-1;do{d=(d+1)%50;var e=b[d];g.Gb(a,function(f){f(e)})}while(d!=c);
m7=Array(50);l7=-1;n7=!1}},tHa=function(a,b){var c=(g.A()-vHa)/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("")},o7=function(a){g.P.call(this);
this.I=a;this.screens=[]},wHa=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.screens.push(b);return!0},xHa=function(a,b){var c=a.screens.length!=b.length;
a.screens=g.Ke(a.screens,function(f){return!!l6(b,f)});
for(var d=0,e=b.length;d<e;d++)c=wHa(a,b[d])||c;return c},yHa=function(a,b){var c=a.screens.length;
a.screens=g.Ke(a.screens,function(d){return!(d||b?!d!=!b?0:d.id==b.id:1)});
return a.screens.length<c},p7=function(a,b,c,d){g.P.call(this);
this.I=a;this.F=b;this.C=c;this.D=d;this.B=0;this.u=null;this.Ua=NaN},r7=function(a){o7.call(this,"LocalScreenService");
this.B=a;this.u=NaN;q7(this);this.info("Initializing with "+j6(this.screens))},zHa=function(a){if(a.screens.length){var b=g.Pc(a.screens,function(d){return d.id}),c=h7(a.B,"/pairing/get_lounge_token_batch");
i7(a.B,c,{screen_ids:b.join(",")},(0,g.z)(a.LI,a),(0,g.z)(a.KI,a))}},q7=function(a){if(g.uo("deprecate_pair_servlet_enabled"))return xHa(a,[]);
var b=hGa(nGa());b=g.Ke(b,function(c){return!c.uuid});
return xHa(a,b)},s7=function(a,b){pGa(g.Pc(a.screens,fGa));
b&&oGa()},u7=function(a,b){g.P.call(this);
this.I=b;var c=g.Qs("yt-remote-online-screen-ids")||"";c=c?c.split(","):[];for(var d={},e=this.I(),f=0,h=e.length;f<h;++f){var l=e[f].id;d[l]=g.nb(c,l)}this.u=d;this.F=a;this.C=this.D=NaN;this.B=null;t7("Initialized with "+g.Fj(this.u))},AHa=function(a,b,c){var d=h7(a.F,"/pairing/get_screen_availability");
i7(a.F,d,{lounge_token:b.token},(0,g.z)(function(e){e=e.screens||[];for(var f=0,h=e.length;f<h;++f)if(e[f].loungeToken==b.token){c("online"==e[f].status);return}c(!1)},a),(0,g.z)(function(){c(!1)},a))},v7=function(a,b){a:if(c6(b)!=c6(a.u))var c=!1;
else{c=g.Qb(b);for(var d=0,e=c.length;d<e;++d)if(!a.u[c[d]]){c=!1;break a}c=!0}c||(t7("Updated online screens: "+g.Fj(a.u)),a.u=b,a.V("screenChange"));BHa(a)},w7=function(a){isNaN(a.C)||g.Io(a.C);
a.C=g.Fo((0,g.z)(a.Nx,a),0<a.D&&a.D<g.A()?2E4:1E4)},t7=function(a){k7("OnlineScreenService",a)},CHa=function(a){var b={};
g.Gb(a.I(),function(c){c.token?b[c.token]=c.id:this.Tc("Requesting availability of screen w/o lounge token.")});
return b},BHa=function(a){a=g.Qb(g.Kb(a.u,function(b){return b}));
g.Cb(a);a.length?g.Ps("yt-remote-online-screen-ids",a.join(","),60):g.Rs("yt-remote-online-screen-ids")},x7=function(a){o7.call(this,"ScreenService");
this.F=a;this.u=this.B=null;this.C=[];this.D={};DHa(this)},FHa=function(a,b,c,d,e,f){a.info("getAutomaticScreenByIds "+c+" / "+b);
c||(c=a.D[b]);var h=a.Qf();if(h=(c?m6(h,c):null)||m6(h,b)){h.uuid=b;var l=y7(a,h);AHa(a.u,l,function(m){e(m?l:null)})}else c?EHa(a,c,(0,g.z)(function(m){var n=y7(this,new g6({name:d,
screenId:c,loungeToken:m,dialId:b||""}));AHa(this.u,n,function(p){e(p?n:null)})},a),f):e(null)},GHa=function(a,b){for(var c=0,d=a.screens.length;c<d;++c)if(a.screens[c].name==b)return a.screens[c];
return null},EHa=function(a,b,c,d){a.info("requestLoungeToken_ for "+b);
var e={Xb:{screen_ids:b},method:"POST",context:a,onSuccess:function(f,h){var l=h&&h.screens||[];l[0]&&l[0].screenId==b?c(l[0].loungeToken):d(Error("Missing lounge token in token response"))},
onError:function(){d(Error("Request screen lounge token failed"))}};
g.oq(h7(a.F,"/pairing/get_lounge_token_batch"),e)},HHa=function(a){a.screens=a.B.Qf();
var b=a.D,c={},d;for(d in b)c[b[d]]=d;b=0;for(d=a.screens.length;b<d;++b){var e=a.screens[b];e.uuid=c[e.id]||""}a.info("Updated manual screens: "+j6(a.screens))},DHa=function(a){z7(a);
a.B=new r7(a.F);a.B.subscribe("screenChange",(0,g.z)(a.TI,a));HHa(a);a.C=hGa(g.Qs("yt-remote-automatic-screen-cache")||[]);z7(a);a.info("Initializing automatic screens: "+j6(a.C));a.u=new u7(a.F,(0,g.z)(a.Qf,a,!0));a.u.subscribe("screenChange",(0,g.z)(function(){this.V("onlineScreenChange")},a))},y7=function(a,b){var c=a.get(b.id);
c?(c.uuid=b.uuid,b=c):((c=m6(a.C,b.uuid))?(c.id=b.id,c.token=b.token,b=c):a.C.push(b),g.Ps("yt-remote-automatic-screen-cache",g.Pc(a.C,fGa)));z7(a);a.D[b.uuid]=b.id;g.Ps("yt-remote-device-id-map",a.D,31536E3);return b},z7=function(a){a.D=g.Qs("yt-remote-device-id-map")||{}},A7=function(a,b,c){g.P.call(this);
this.Y=c;this.N=a;this.u=b;this.K=null},B7=function(a,b){k7(a.Y,b)},C7=function(a,b){A7.call(this,a,b,"CastSession");
this.B=null;this.C=0;this.F=(0,g.z)(this.oR,this);this.D=(0,g.z)(this.GP,this);this.C=g.Fo((0,g.z)(function(){IHa(this,null)},this),12E4)},JHa=function(a){a.info("sendYoutubeMessage_: getMdxSessionStatus "+g.Fj(void 0));
var b={type:"getMdxSessionStatus"};a.B?a.B.sendMessage("urn:x-cast:com.google.youtube.mdx",b,g.Oa,(0,g.z)(function(){B7(this,"Failed to send message: getMdxSessionStatus.")},a)):B7(a,"Sending yt message without session: "+g.Fj(b))},IHa=function(a,b){g.Io(a.C);
if(b){if(a.info("onConnectedScreenId_: Received screenId: "+b),!a.getScreen()||a.getScreen().id!=b){var c=(0,g.z)(a.kt,a),d=(0,g.z)(a.Wf,a);a.nB(b,c,d,5)}}else a.Wf(Error("Waiting for session status timed out."))},D7=function(a,b,c){A7.call(this,a,b,"DialSession");
this.C=this.I=null;this.P="";this.ba=c;this.W=null;this.F=g.Oa;this.D=NaN;this.X=(0,g.z)(this.rR,this);this.B=g.Oa},KHa=function(a){a.B=a.N.yG(a.P,a.u.label,a.u.friendlyName,(0,g.z)(function(b){this.B=g.Oa;
this.kt(b)},a),(0,g.z)(function(b){this.B=g.Oa;
this.Wf(b)},a))},LHa=function(a){var b={};
b.pairingCode=a.P;b.theme=a.ba;rGa()&&(b.env_useStageMdx=1);return g.Hd(b)},E7=function(a,b){A7.call(this,a,b,"ManualSession");
this.B=g.Fo((0,g.z)(this.Tm,this,null),150)},F7=function(a,b,c,d){g.P.call(this);
this.B=a;this.K=b||"233637DE";this.I=c||"cl";this.N=d||!1;this.u=null;this.F=!1;this.C=[];this.D=(0,g.z)(this.xO,this)},MHa=function(a,b){return b?g.jb(a.C,function(c){return h6(b,c.label)},a):null},G7=function(a){k7("Controller",a)},pHa=function(a){window.chrome&&chrome.cast&&chrome.cast.logMessage&&chrome.cast.logMessage(a)},H7=function(a){return a.F||!!a.C.length||!!a.u},I7=function(a,b,c){b!=a.u&&(g.eg(a.u),(a.u=b)?(c?a.V("yt-remote-cast2-receiver-resumed",b.u):a.V("yt-remote-cast2-receiver-selected",
b.u),b.subscribe("sessionScreen",(0,g.z)(a.nE,a,b)),b.getScreen()?a.V("yt-remote-cast2-session-change",b.getScreen()):c&&a.u.Tm(null)):a.V("yt-remote-cast2-session-change",null))},NHa=function(a){var b=a.B.xG(),c=a.u&&a.u.u;
a=g.Pc(b,function(d){c&&h6(d,c.label)&&(c=null);var e=d.uuid?d.uuid:d.id,f=MHa(this,d);f?(f.label=e,f.friendlyName=d.name):(f=new chrome.cast.Receiver(e,d.name),f.receiverType=chrome.cast.ReceiverType.CUSTOM);return f},a);
c&&(c.receiverType!=chrome.cast.ReceiverType.CUSTOM&&(c=new chrome.cast.Receiver(c.label,c.friendlyName),c.receiverType=chrome.cast.ReceiverType.CUSTOM),a.push(c));return a},THa=function(a,b,c,d,e,f,h){OHa()?PHa(b,e,f,h)&&(K7(!0),window.chrome&&chrome.cast&&chrome.cast.isAvailable?QHa(a,c):(window.__onGCastApiAvailable=function(l,m){l?QHa(a,c):(L7("Failed to load cast API: "+m),M7(!1),K7(!1),g.Rs("yt-remote-cast-available"),g.Rs("yt-remote-cast-receiver"),RHa(),c(!1))},d?g.So("https://www.gstatic.com/cv/js/sender/v1/cast_sender.js"):
0<=window.navigator.userAgent.indexOf("Android")&&0<=window.navigator.userAgent.indexOf("Chrome/")&&window.navigator.presentation?yGa():!window.chrome||!window.navigator.presentation||0<=window.navigator.userAgent.indexOf("Edge")?u6():(xGa(),t6(SHa.map(vGa))))):J7("Cannot initialize because not running Chrome")},RHa=function(){J7("dispose");
var a=N7();a&&a.dispose();g.Ja("yt.mdx.remote.cloudview.instance_",null,void 0);UHa(!1);g.Oo(O7);O7.length=0},P7=function(){return!!g.Qs("yt-remote-cast-installed")},VHa=function(){var a=g.Qs("yt-remote-cast-receiver");
return a?a.friendlyName:null},WHa=function(){J7("clearCurrentReceiver");
g.Rs("yt-remote-cast-receiver")},XHa=function(){return P7()?N7()?N7().getCastSession():(L7("getCastSelector: Cast is not initialized."),null):(L7("getCastSelector: Cast API is not installed!"),null)},R7=function(){P7()?N7()?Q7()?(J7("Requesting cast selector."),N7().requestSession()):(J7("Wait for cast API to be ready to request the session."),O7.push(g.No("yt-remote-cast2-api-ready",R7))):L7("requestCastSelector: Cast is not initialized."):L7("requestCastSelector: Cast API is not installed!")},S7=
function(a,b){Q7()?N7().setConnectedScreenStatus(a,b):L7("setConnectedScreenStatus called before ready.")},OHa=function(){var a=0<=g.Vc.search(/ (CrMo|Chrome|CriOS)\//);
return g.ZA||a},YHa=function(a,b){N7().init(a,b)},PHa=function(a,b,c,d){var e=!1;
N7()||(a=new F7(a,b,c,d),a.subscribe("yt-remote-cast2-availability-change",function(f){g.Ps("yt-remote-cast-available",f);e6("yt-remote-cast2-availability-change",f)}),a.subscribe("yt-remote-cast2-receiver-selected",function(f){J7("onReceiverSelected: "+f.friendlyName);
g.Ps("yt-remote-cast-receiver",f);e6("yt-remote-cast2-receiver-selected",f)}),a.subscribe("yt-remote-cast2-receiver-resumed",function(f){J7("onReceiverResumed: "+f.friendlyName);
g.Ps("yt-remote-cast-receiver",f)}),a.subscribe("yt-remote-cast2-session-change",function(f){J7("onSessionChange: "+i6(f));
f||g.Rs("yt-remote-cast-receiver");e6("yt-remote-cast2-session-change",f)}),g.Ja("yt.mdx.remote.cloudview.instance_",a,void 0),e=!0);
J7("cloudview.createSingleton_: "+e);return e},N7=function(){return g.Na("yt.mdx.remote.cloudview.instance_")},QHa=function(a,b){M7(!0);
K7(!1);YHa(a,function(c){c?(UHa(!0),g.Po("yt-remote-cast2-api-ready")):(L7("Failed to initialize cast API."),M7(!1),g.Rs("yt-remote-cast-available"),g.Rs("yt-remote-cast-receiver"),RHa());b(c)})},J7=function(a){k7("cloudview",a)},L7=function(a){k7("cloudview",a)},M7=function(a){J7("setCastInstalled_ "+a);
g.Ps("yt-remote-cast-installed",a)},Q7=function(){return!!g.Na("yt.mdx.remote.cloudview.apiReady_")},UHa=function(a){J7("setApiReady_ "+a);
g.Ja("yt.mdx.remote.cloudview.apiReady_",a,void 0)},K7=function(a){g.Ja("yt.mdx.remote.cloudview.initializing_",a,void 0)},T7=function(a){this.index=-1;
this.videoId=this.listId="";this.volume=this.playerState=-1;this.muted=!1;this.audioTrackId=null;this.I=this.K=0;this.u=null;this.hasNext=this.Qh=!1;this.P=this.N=this.B=this.F=0;this.D=NaN;this.C=!1;this.reset(a)},U7=function(a){a.audioTrackId=null;
a.u=null;a.playerState=-1;a.Qh=!1;a.hasNext=!1;a.K=0;a.I=g.A();a.F=0;a.B=0;a.N=0;a.P=0;a.D=NaN;a.C=!1},V7=function(a){return a.Cb()?(g.A()-a.I)/1E3:0},W7=function(a,b){a.K=b;
a.I=g.A()},X7=function(a){switch(a.playerState){case 1:case 1081:return(g.A()-a.I)/1E3+a.K;
case -1E3:return 0}return a.K},Y7=function(a,b,c){var d=a.videoId;
a.videoId=b;a.index=c;b!=d&&U7(a)},Z7=function(a){var b={};
b.index=a.index;b.listId=a.listId;b.videoId=a.videoId;b.playerState=a.playerState;b.volume=a.volume;b.muted=a.muted;b.audioTrackId=a.audioTrackId;b.trackData=g.$b(a.u);b.hasPrevious=a.Qh;b.hasNext=a.hasNext;b.playerTime=a.K;b.playerTimeAt=a.I;b.seekableStart=a.F;b.seekableEnd=a.B;b.duration=a.N;b.loadedTime=a.P;b.liveIngestionTime=a.D;return b},a8=function(a,b){g.P.call(this);
this.Ca=0;this.C=a;this.F=[];this.D=new kHa;this.B=this.u=null;this.N=(0,g.z)(this.HM,this);this.I=(0,g.z)(this.qp,this);this.K=(0,g.z)(this.GM,this);this.P=(0,g.z)(this.QM,this);var c=0;a?(c=a.getProxyState(),3!=c&&(a.subscribe("proxyStateChange",this.Ry,this),ZHa(this))):c=3;0!=c&&(b?this.Ry(c):g.Fo((0,g.z)(function(){this.Ry(c)},this),0));
var d=XHa();d&&$7(this,d);this.subscribe("yt-remote-cast2-session-change",this.P)},b8=function(a){return new T7(a.C.getPlayerContextData())},ZHa=function(a){g.Gb("nowAutoplaying autoplayDismissed remotePlayerChange remoteQueueChange autoplayModeChange autoplayUpNext previousNextChange".split(" "),function(b){this.F.push(this.C.subscribe(b,g.Va(this.tO,b),this))},a)},$Ha=function(a){g.Gb(a.F,function(b){this.C.unsubscribeByKey(b)},a);
a.F.length=0},c8=function(a,b){var c=a.D;
50>c.u.length+c.B.length&&a.D.B.push(b)},e8=function(a,b,c){var d=b8(a);
W7(d,c);-1E3!=d.playerState&&(d.playerState=b);d8(a,d)},f8=function(a,b,c){a.C.sendMessage(b,c)},d8=function(a,b){$Ha(a);
a.C.setPlayerContextData(Z7(b));ZHa(a)},$7=function(a,b){a.B&&(a.B.removeUpdateListener(a.N),a.B.removeMediaListener(a.I),a.qp(null));
a.B=b;a.B&&(k7("CP","Setting cast session: "+a.B.sessionId),a.B.addUpdateListener(a.N),a.B.addMediaListener(a.I),a.B.media.length&&a.qp(a.B.media[0]))},aIa=function(a){var b=a.u.media,c=a.u.customData;
if(b&&c){var d=b8(a);b.contentId!=d.videoId&&k7("CP","Cast changing video to: "+b.contentId);d.videoId=b.contentId;d.playerState=c.playerState;W7(d,a.u.getEstimatedTime());d8(a,d)}else k7("CP","No cast media video. Ignoring state update.")},g8=function(a,b,c){return(0,g.z)(function(d){this.Tc("Failed to "+b+" with cast v2 channel. Error code: "+d.code);
d.code!=chrome.cast.ErrorCode.TIMEOUT&&(this.Tc("Retrying "+b+" using MDx browser channel."),f8(this,b,c))},a)},h8=function(a,b,c){g.P.call(this);
this.F=NaN;this.X=!1;this.N=this.K=this.P=this.W=NaN;this.Y=[];this.D=this.I=this.C=this.Ab=this.u=null;this.fa=a;this.Y.push(g.cp(window,"beforeunload",(0,g.z)(this.DI,this)));this.B=[];this.Ab=new T7;this.ba=b.id;this.u=bIa(this,c);this.u.subscribe("handlerOpened",this.LM,this);this.u.subscribe("handlerClosed",this.IM,this);this.u.subscribe("handlerError",this.JM,this);this.u.subscribe("handlerMessage",this.KM,this);oHa(this.u,b.token);this.subscribe("remoteQueueChange",function(){var d=this.Ab.videoId;
g.Ss()&&g.Ps("yt-remote-session-video-id",d)},this)},i8=function(a){k7("conn",a)},bIa=function(a,b){return new d7(h7(a.fa,"/bc"),b,!1,function(){return a.uG()})},j8=function(a,b){a.V("proxyStateChange",b)},cIa=function(a){a.F=g.Fo((0,g.z)(function(){i8("Connecting timeout");
this.wm(1)},a),2E4)},k8=function(a){g.Io(a.F);
a.F=NaN},l8=function(a){g.Io(a.W);
a.W=NaN},dIa=function(a){m8(a);
a.P=g.Fo((0,g.z)(function(){n8(this,"getNowPlaying")},a),2E4)},m8=function(a){g.Io(a.P);
a.P=NaN},fIa=function(a,b){b&&(k8(a),l8(a));
b==(f7(a.u)&&isNaN(a.F))?b&&(j8(a,1),n8(a,"getSubtitlesTrack")):b?(a.lB()&&a.Ab.reset(),j8(a,1),n8(a,"getNowPlaying"),eIa(a)):a.wm(1)},gIa=function(a,b){var c=b.params.videoId;
delete b.params.videoId;c==a.Ab.videoId&&(g.Wb(b.params)?a.Ab.u=null:a.Ab.u=b.params,a.V("remotePlayerChange"))},hIa=function(a,b){var c=b.params.videoId||b.params.video_id,d=parseInt(b.params.currentIndex,10);
a.Ab.listId=b.params.listId||a.Ab.listId;Y7(a.Ab,c,d);a.V("remoteQueueChange")},jIa=function(a,b){b.params=b.params||{};
hIa(a,b);iIa(a,b);a.V("autoplayDismissed")},iIa=function(a,b){var c=parseInt(b.params.currentTime||b.params.current_time,10);
W7(a.Ab,isNaN(c)?0:c);c=parseInt(b.params.state,10);c=isNaN(c)?-1:c;-1==c&&-1E3==a.Ab.playerState&&(c=-1E3);a.Ab.playerState=c;c=Number(b.params.loadedTime);a.Ab.P=isNaN(c)?0:c;c=Number(b.params.duration);a.Ab.N=isNaN(c)?0:c;c=a.Ab;var d=Number(b.params.liveIngestionTime);c.D=d;c.C=isNaN(d)?!1:!0;c=a.Ab;d=Number(b.params.seekableStartTime);var e=Number(b.params.seekableEndTime);c.F=isNaN(d)?0:d;c.B=isNaN(e)?0:e;1==a.Ab.playerState?dIa(a):m8(a);a.V("remotePlayerChange")},kIa=function(a,b){if(-1E3!=
a.Ab.playerState){var c=1085;
switch(parseInt(b.params.adState,10)){case 1:c=1081;break;case 2:c=1084;break;case 0:c=1083}a.Ab.playerState=c;c=parseInt(b.params.currentTime,10);W7(a.Ab,isNaN(c)?0:c);a.V("remotePlayerChange")}},lIa=function(a,b){var c="true"==b.params.muted;
a.Ab.volume=parseInt(b.params.volume,10);a.Ab.muted=c;a.V("remotePlayerChange")},mIa=function(a,b){a.I=b.params.videoId;
a.V("nowAutoplaying",parseInt(b.params.timeout,10))},nIa=function(a,b){var c="true"==b.params.hasNext;
a.Ab.Qh="true"==b.params.hasPrevious;a.Ab.hasNext=c;a.V("previousNextChange")},eIa=function(a){g.Io(a.N);
a.N=g.Fo((0,g.z)(a.wm,a,1),864E5)},n8=function(a,b,c){c?i8("Sending: action="+b+", params="+g.Fj(c)):i8("Sending: action="+b);
a.u.sendMessage(b,c)},o8=function(a){o7.call(this,"ScreenServiceProxy");
this.Je=a;this.u=[];this.u.push(this.Je.$_s("screenChange",(0,g.z)(this.mR,this)));this.u.push(this.Je.$_s("onlineScreenChange",(0,g.z)(this.ZN,this)))},sIa=function(a,b){b=g.L("MDX_CONFIG")||b;
jGa();q6();p8||(p8=new g7(b?b.loungeApiHost:void 0),rGa()&&(p8.u="/api/loungedev"));q8||(q8=g.Na("yt.mdx.remote.deferredProxies_")||[],g.Ja("yt.mdx.remote.deferredProxies_",q8,void 0));oIa();var c=r8();if(!c){var d=new x7(p8);g.Ja("yt.mdx.remote.screenService_",d,void 0);c=r8();var e=!1,f=void 0,h=void 0,l=!1;b&&(e=!!b.loadCastApiSetupScript,f=b.appId,h=b.theme,l=!!b.disableDial);THa(a,d,function(m){m?s8()&&S7(s8(),"YouTube TV"):d.subscribe("onlineScreenChange",function(){e6("yt-remote-receiver-availability-change")})},
e,f,h,l)}b&&!g.Na("yt.mdx.remote.initialized_")&&(g.Ja("yt.mdx.remote.initialized_",!0,void 0),t8("Initializing: "+g.Fj(b)),u8.push(g.No("yt-remote-cast2-availability-change",function(){e6("yt-remote-receiver-availability-change")})),u8.push(g.No("yt-remote-cast2-receiver-selected",function(){v8(null);
e6("yt-remote-auto-connect","cast-selector-receiver")})),u8.push(g.No("yt-remote-cast2-receiver-resumed",function(){e6("yt-remote-receiver-resumed","cast-selector-receiver")})),u8.push(g.No("yt-remote-cast2-session-change",pIa)),u8.push(g.No("yt-remote-connection-change",function(m){m?S7(s8(),"YouTube TV"):w8()||(S7(null,null),WHa())})),e=x8(),b.isAuto&&(e.id+="#dial"),g.uo("desktop_enable_autoplay")&&(e.capabilities=["atp"]),e.name=b.device,e.app=b.app,(h=b.theme)&&(e.theme=h),t8(" -- with channel params: "+
g.Fj(e)),qIa(e),c.start(),s8()||rIa())},uIa=function(){var a=tIa();
P7()&&g.Qs("yt-remote-cast-available")&&a.push({key:"cast-selector-receiver",name:"Cast..."});return a},tIa=function(){var a=r8().Je.$_gos();
var b=y8();b&&z8()&&(l6(a,b)||a.push(b));return iGa(a)},A8=function(){var a=vIa();
!a&&P7()&&VHa()&&(a={key:"cast-selector-receiver",name:VHa()});return a},vIa=function(){var a=tIa(),b=y8();
b||(b=w8());return g.jb(a,function(c){return b&&h6(b,c.key)?!0:!1})},y8=function(){var a=s8();
if(!a)return null;var b=r8().Qf();return m6(b,a)},pIa=function(a){t8("remote.onCastSessionChange_: "+i6(a));
if(a){var b=y8();b&&b.id==a.id?S7(b.id,"YouTube TV"):(b&&B8(),C8(a,1))}else z8()&&B8()},B8=function(){Q7()?N7().stopSession():L7("stopSession called before API ready.");
var a=z8();a&&(a.disconnect(1),D8(null))},E8=function(){var a=z8();
return!!a&&3!=a.getProxyState()},t8=function(a){k7("remote",a)},r8=function(){if(!F8){var a=g.Na("yt.mdx.remote.screenService_");
F8=a?new o8(a):null}return F8},s8=function(){return g.Na("yt.mdx.remote.currentScreenId_")},wIa=function(a){g.Ja("yt.mdx.remote.currentScreenId_",a,void 0)},xIa=function(){return g.Na("yt.mdx.remote.connectData_")},v8=function(a){g.Ja("yt.mdx.remote.connectData_",a,void 0)},z8=function(){return g.Na("yt.mdx.remote.connection_")},D8=function(a){var b=z8();
v8(null);a||wIa("");g.Ja("yt.mdx.remote.connection_",a,void 0);q8&&(g.Gb(q8,function(c){c(a)}),q8.length=0);
b&&!a?e6("yt-remote-connection-change",!1):!b&&a&&e6("yt-remote-connection-change",!0)},w8=function(){var a=g.Ss();
if(!a)return null;var b=r8();if(!b)return null;b=b.Qf();return m6(b,a)},C8=function(a,b){s8();
y8()&&y8();if(G8)H8=a;else{wIa(a.id);var c=new h8(p8,a,x8());c.connect(b,xIa());c.subscribe("beforeDisconnect",function(d){e6("yt-remote-before-disconnect",d)});
c.subscribe("beforeDispose",function(){z8()&&(z8(),D8(null))});
D8(c)}},rIa=function(){var a=w8();
a?(t8("Resume connection to: "+i6(a)),C8(a,0)):(r6(),WHa(),t8("Skipping connecting because no session screen found."))},oIa=function(){var a=x8();
if(g.Wb(a)){a=p6();var b=g.Qs("yt-remote-session-name")||"",c=g.Qs("yt-remote-session-app")||"";a={device:"REMOTE_CONTROL",id:a,name:b,app:c,mdxVersion:3};g.Ja("yt.mdx.remote.channelParams_",a,void 0)}},x8=function(){return g.Na("yt.mdx.remote.channelParams_")||{}},qIa=function(a){a?(g.Ps("yt-remote-session-app",a.app),g.Ps("yt-remote-session-name",a.name)):(g.Rs("yt-remote-session-app"),g.Rs("yt-remote-session-name"));
g.Ja("yt.mdx.remote.channelParams_",a,void 0)},I8=function(a,b,c){g.B.call(this);
var d=this;this.module=a;this.J=b;this.rb=c;this.events=new g.Pr(this);this.P=this.events.R(this.J,"onVolumeChange",this.PD);this.D=!1;this.suggestion=null;this.F=new g.LK(64);this.u=new g.H(this.CF,500,this);this.B=new g.H(this.DF,1E3,this);this.K=new v6(this.RQ,0,this);this.C={};this.N=new g.H(this.fG,1E3,this);this.I=new w6(this.seekTo,1E3,this);this.W=g.Oa;g.C(this,this.events);this.events.R(b,"onCaptionsTrackListChanged",this.CN);this.events.R(b,"captionschanged",this.EM);this.events.R(b,"captionssettingschanged",
this.GF);this.events.R(b,"videoplayerreset",this.lt);this.events.R(b,"mdxautoplaycancel",function(){d.rb.AA()});
a=this.rb;a.la();a.subscribe("proxyStateChange",this.iE,this);a.subscribe("remotePlayerChange",this.yp,this);a.subscribe("remoteQueueChange",this.lt,this);a.subscribe("previousNextChange",this.eE,this);a.subscribe("nowAutoplaying",this.ZD,this);a.subscribe("autoplayDismissed",this.zD,this);g.C(this,this.u);g.C(this,this.B);g.C(this,this.K);g.C(this,this.N);g.C(this,this.I);this.GF();this.lt();this.yp()},yIa=function(a){a.Ec(0);
a.u.stop();a.Bd(new g.LK(64))},K8=function(a,b){if(J8(a)&&!a.D){var c=null;
b&&(c={style:a.J.getSubtitlesUserSettings()},g.bc(c,b));a.rb.vG(a.J.getVideoData(1).videoId,c);a.C=b8(a.rb).u}},L8=function(a,b){var c=a.J.getPlaylist();
if(c){var d=c.index;var e=c.listId.toString()}c=a.J.getVideoData(1);a.rb.playVideo(c.videoId,b,d,e,c.playerParams,c.pg,WFa(c));a.Bd(new g.LK(1))},zIa=function(a,b){if(b){var c=a.J.getOption("captions","tracklist",{KB:1});
c&&c.length?(a.J.setOption("captions","track",b),a.D=!1):(a.J.loadModule("captions"),a.D=!0)}else a.J.setOption("captions","track",{})},J8=function(a){return b8(a.rb).videoId===a.J.getVideoData(1).videoId},M8=function(){g.V.call(this,{G:"div",
L:"ytp-mdx-manual-pairing-popup-dialog",U:{role:"dialog"},S:[{G:"div",L:"ytp-mdx-manual-pairing-popup-dialog-inner-content",S:[{G:"div",L:"ytp-mdx-manual-pairing-popup-title",Z:"Connecting to your TV on web using a code will be going away soon"},{G:"div",L:"ytp-mdx-manual-pairing-popup-buttons",S:[{G:"button",ia:["ytp-button","ytp-mdx-manual-pairing-popup-learn-more"],Z:"Learn more"},{G:"button",ia:["ytp-button","ytp-mdx-manual-pairing-popup-ok"],Z:"OK"}]}]}]});this.u=new g.vN(this,250);this.learnMoreButton=
this.ga("ytp-mdx-manual-pairing-popup-learn-more");this.okButton=this.ga("ytp-mdx-manual-pairing-popup-ok");g.C(this,this.u);this.R(this.learnMoreButton,"click",this.B);this.R(this.okButton,"click",this.C)},N8=function(){g.V.call(this,{G:"div",
L:"ytp-mdx-popup-dialog",U:{role:"dialog"},S:[{G:"div",L:"ytp-mdx-popup-dialog-inner-content",S:[{G:"div",L:"ytp-mdx-popup-title",Z:"You're signed out"},{G:"div",L:"ytp-mdx-popup-description",Z:"Videos you watch may be added to the TV's watch history and influence TV recommendations. To avoid this, cancel and sign in to YouTube on your computer."},{G:"div",L:"ytp-mdx-privacy-popup-buttons",S:[{G:"button",ia:["ytp-button","ytp-mdx-privacy-popup-cancel"],Z:"Cancel"},{G:"button",ia:["ytp-button","ytp-mdx-privacy-popup-confirm"],
Z:"Confirm"}]}]}]});this.u=new g.vN(this,250);this.cancelButton=this.ga("ytp-mdx-privacy-popup-cancel");this.confirmButton=this.ga("ytp-mdx-privacy-popup-confirm");g.C(this,this.u);this.R(this.cancelButton,"click",this.B);this.R(this.confirmButton,"click",this.C)},O8=function(a){g.V.call(this,{G:"div",
L:"ytp-remote",S:[{G:"div",L:"ytp-remote-display-status",S:[{G:"div",L:"ytp-remote-display-status-icon",S:[g.PM()]},{G:"div",L:"ytp-remote-display-status-text",Z:"{{statustext}}"}]}]});this.api=a;this.u=new g.vN(this,250);g.C(this,this.u);this.R(a,"presentingplayerstatechange",this.B);AIa(this,g.fI(a))},AIa=function(a,b){if(3===a.api.getPresentingPlayerType()){var c={RECEIVER_NAME:a.api.getOption("remote","currentReceiver").name};
c=g.T(b,128)?g.ZI("Error on $RECEIVER_NAME",c):b.Cb()||g.T(b,4)?g.ZI("Playing on $RECEIVER_NAME",c):g.ZI("Connected to $RECEIVER_NAME",c);a.ua("statustext",c);a.u.show()}else a.u.hide()},P8=function(a,b){g.JZ.call(this,"Play on",0,a,b);
this.J=a;this.tk={};this.R(a,"onMdxReceiversChange",this.D);this.R(a,"presentingplayerstatechange",this.D);this.D()},Q8=function(a){g.vS.call(this,a);
this.bh={key:k6(),name:"This computer"};this.Eh=null;this.subscriptions=[];this.zx=this.rb=null;this.tk=[this.bh];this.Jj=this.bh;this.yc=new g.LK(64);this.eC=0;this.Xd=-1;this.Vm=null;this.Bp=this.xs=!1;this.Kl=this.on=null;if(!g.WB(this.player.T())){a=this.player;var b=g.HW(a);b&&(b=b.il())&&(b=new P8(a,b),g.C(this,b));b=new O8(a);g.C(this,b);g.$O(a,b.element,4);this.on=new N8;g.C(this,this.on);g.$O(a,this.on.element,4);g.R(this.player.T().experiments,"pair_servlet_deprecation_warning_enabled")&&
!g.R(this.player.T().experiments,"deprecate_pair_servlet_enabled")&&(this.Vm=new M8,g.C(this,this.Vm),g.$O(a,this.Vm.element,4));this.Bp=!!w8();this.xs=!!g.Qs("yt-remote-manual-pairing-warning-shown")}},R8=function(a){a.Kl&&(a.player.removeEventListener("presentingplayerstatechange",a.Kl),a.Kl=null)},BIa=function(a,b,c){a.yc=c;
a.player.V("presentingplayerstatechange",new g.nI(c,b))},CIa=function(a,b,c){var d=!1;
1===b?d=!a.Bp:2===b&&(d=!a.xs);d&&g.pI(c,8)&&(a.player.pauseVideo(),R8(a))},S8=function(a,b){if(b.key!==a.Jj.key)if(b.key===a.bh.key)B8();
else{if(a.Vm&&!a.xs&&b!==a.bh&&"cast-selector-receiver"!==b.key&&g.fC(a.player.T()))DIa(a);else{var c;(c=!g.R(a.player.T().experiments,"mdx_enable_privacy_disclosure_ui"))||(c=((c=g.L("PLAYER_CONFIG"))&&c.args&&void 0!==c.args.authuser?!0:!(!g.L("SESSION_INDEX")&&!g.L("LOGGED_IN")))||a.Bp||!a.on);(c?0:g.fC(a.player.T())||g.jC(a.player.T()))&&EIa(a)}a.Jj=b;var d=a.player.getPlaylistId();c=a.player.getVideoData(1);var e=c.videoId;if(!d&&!e||(2===a.player.getAppState()||1===a.player.getAppState())&&
g.R(a.player.T().experiments,"should_clear_video_data_on_player_cued_unstarted"))c=null;else{var f=a.player.getPlaylist();if(f){var h=[];for(var l=0;l<f.getLength();l++)h[l]=f.Ja(l).videoId}else h=[e];f=a.player.getCurrentTime(1);d={videoIds:h,listId:d,videoId:e,playerParams:c.playerParams,clickTrackingParams:c.pg,index:Math.max(a.player.getPlaylistIndex(),0),currentTime:0===f?void 0:f};(c=WFa(c))&&(d.locationInfo=c);c=d}t8("Connecting to: "+g.Fj(b));"cast-selector-receiver"==b.key?(v8(c||null),c=
c||null,Q7()?N7().setLaunchParams(c):L7("setLaunchParams called before ready.")):!c&&E8()&&s8()==b.key?e6("yt-remote-connection-change",!0):(B8(),v8(c||null),c=r8().Qf(),(c=m6(c,b.key))&&C8(c,1))}},EIa=function(a){g.fI(a.player).Cb()?a.player.pauseVideo():(a.Kl=function(b){CIa(a,1,b)},a.player.addEventListener("presentingplayerstatechange",a.Kl));
a.on&&a.on.pc();z8()||(G8=!0)},DIa=function(a){g.fI(a.player).Cb()?a.player.pauseVideo():(a.Kl=function(b){CIa(a,2,b)},a.player.addEventListener("presentingplayerstatechange",a.Kl));
a.Vm&&a.Vm.pc();z8()||(G8=!0)},JGa={"\x00":"\\0",
"\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r","\t":"\\t","\x0B":"\\x0B",'"':'\\"',"\\":"\\\\","<":"\\u003C"},L6={"'":"\\'"},FIa={},eGa={SR:"atp",RU:"ska",CU:"que",QT:"mus",QU:"sus",QS:"dsp",JU:"seq"},s6,o6="",wGa=sGa("loadCastFramework")||sGa("loadCastApplicationFramework"),SHa=["pkedcjkdefgpdelpbcmbmeomcjbeemfm","enhhojjnijigcajfphajepfemndkmdlo"];/*

 Copyright The Closure Library Authors.
 SPDX-License-Identifier: Apache-2.0
*/
g.Xa(v6,g.B);g.k=v6.prototype;g.k.AI=function(a){this.D=arguments;this.u=!1;this.Ua?this.C=g.A()+this.Le:this.Ua=g.Um(this.F,this.Le)};
g.k.stop=function(){this.Ua&&(g.v.clearTimeout(this.Ua),this.Ua=null);this.C=null;this.u=!1;this.D=[]};
g.k.pause=function(){++this.B};
g.k.resume=function(){this.B&&(--this.B,!this.B&&this.u&&(this.u=!1,this.I.apply(null,this.D)))};
g.k.aa=function(){this.stop();v6.Wc.aa.call(this)};
g.k.BI=function(){this.C?(this.Ua=g.Um(this.F,this.C-g.A()),this.C=null):(this.Ua=null,this.B?this.u=!0:(this.u=!1,this.I.apply(null,this.D)))};g.u(w6,g.B);g.k=w6.prototype;g.k.uC=function(a){this.C=arguments;this.Ua||this.B?this.u=!0:x6(this)};
g.k.stop=function(){this.Ua&&(g.v.clearTimeout(this.Ua),this.Ua=null,this.u=!1,this.C=null)};
g.k.pause=function(){this.B++};
g.k.resume=function(){this.B--;this.B||!this.u||this.Ua||(this.u=!1,x6(this))};
g.k.aa=function(){g.B.prototype.aa.call(this);this.stop()};z6.prototype.stringify=function(a){return g.v.JSON.stringify(a,void 0)};
z6.prototype.parse=function(a){return g.v.JSON.parse(a,void 0)};var B6=new g.im;g.u(zGa,g.Ll);D6.prototype.u=null;D6.prototype.getOptions=function(){var a;(a=this.u)||(a={},BGa(this)&&(a[0]=!0,a[1]=!0),a=this.u=a);return a};var T8;g.Xa(AGa,D6);T8=new AGa;g.k=E6.prototype;g.k.ll=null;g.k.qh=!1;g.k.Hn=null;g.k.Oy=null;g.k.tn=null;g.k.Bn=null;g.k.Ej=null;g.k.uk=null;g.k.Ll=null;g.k.Od=null;g.k.mq=0;g.k.xh=null;g.k.iu=null;g.k.Sj=null;g.k.Do=-1;g.k.sF=!0;g.k.Ok=!1;g.k.Yv=0;g.k.At=null;var GGa={},H6={};g.k=E6.prototype;g.k.setTimeout=function(a){this.F=a};
g.k.ZP=function(a){a=a.target;var b=this.At;b&&3==Q6(a)?b.uC():this.rG(a)};
g.k.rG=function(a){try{if(a==this.Od)a:{var b=Q6(this.Od),c=this.Od.I,d=this.Od.getStatus();if(g.ye&&!g.ae(10)||g.Ae&&!g.$d("420+")){if(4>b)break a}else if(3>b||3==b&&!g.rg&&!S6(this.Od))break a;this.Ok||4!=b||7==c||(8==c||0>=d?this.u.ih(3):this.u.ih(2));M6(this);var e=this.Od.getStatus();this.Do=e;var f=S6(this.Od);(this.qh=200==e)?(4==b&&J6(this),this.I?(HGa(this,b,f),g.rg&&this.qh&&3==b&&(this.D.ra(this.C,"tick",this.TP),this.C.start())):I6(this,f),this.qh&&!this.Ok&&(4==b?this.u.Lr(this):(this.qh=
!1,G6(this)))):(400==e&&0<f.indexOf("Unknown SID")?(this.Sj=3,C6(13)):(this.Sj=0,C6(14)),J6(this),K6(this))}}catch(h){this.Od&&S6(this.Od)}finally{}};
g.k.TP=function(){var a=Q6(this.Od),b=S6(this.Od);this.mq<b.length&&(M6(this),HGa(this,a,b),this.qh&&4!=a&&G6(this))};
g.k.nP=function(a){A6((0,g.z)(this.mP,this,a),0)};
g.k.mP=function(a){this.Ok||(M6(this),I6(this,a),G6(this))};
g.k.rE=function(a){A6((0,g.z)(this.lP,this,a),0)};
g.k.lP=function(a){this.Ok||(J6(this),this.qh=a,this.u.Lr(this),this.u.ih(4))};
g.k.cancel=function(){this.Ok=!0;J6(this)};
g.k.zP=function(){this.Hn=null;var a=g.A();0<=a-this.Oy?(2!=this.Bn&&this.u.ih(3),J6(this),this.Sj=2,C6(18),K6(this)):LGa(this,this.Oy-a)};
g.k.getLastError=function(){return this.Sj};g.Xa(O6,g.im);var SGa=/^https?$/i,GIa=["POST","PUT"];g.k=O6.prototype;
g.k.send=function(a,b,c,d){if(this.u)throw Error("[goog.net.XhrIo] Object is active with another request="+this.P+"; newUri="+a);b=b?b.toUpperCase():"GET";this.P=a;this.D="";this.I=0;this.oa=b;this.fa=!1;this.B=!0;this.u=this.ba?CGa(this.ba):CGa(T8);this.Y=this.ba?this.ba.getOptions():T8.getOptions();this.u.onreadystatechange=(0,g.z)(this.fE,this);try{d6(R6(this,"Opening Xhr")),this.ha=!0,this.u.open(b,String(a),!0),this.ha=!1}catch(f){d6(R6(this,"Error opening Xhr: "+f.message));RGa(this,f);return}a=
c||"";var e=this.headers.clone();d&&aGa(d,function(f,h){e.set(h,f)});
d=g.jb(e.mg(),PGa);c=g.v.FormData&&a instanceof g.v.FormData;!g.nb(GIa,b)||d||c||e.set("Content-Type","application/x-www-form-urlencoded;charset=utf-8");e.forEach(function(f,h){this.u.setRequestHeader(h,f)},this);
this.ya&&(this.u.responseType=this.ya);"withCredentials"in this.u&&this.u.withCredentials!==this.ea&&(this.u.withCredentials=this.ea);try{UGa(this),0<this.K&&(this.X=OGa(this.u),d6(R6(this,"Will abort after "+this.K+"ms if incomplete, xhr2 "+this.X)),this.X?(this.u.timeout=this.K,this.u.ontimeout=(0,g.z)(this.wB,this)):this.W=g.Um(this.wB,this.K,this)),d6(R6(this,"Sending request")),this.N=!0,this.u.send(a),this.N=!1}catch(f){d6(R6(this,"Send error: "+f.message)),RGa(this,f)}};
g.k.wB=function(){"undefined"!=typeof g.a1&&this.u&&(this.D="Timed out after "+this.K+"ms, aborting",this.I=8,R6(this,this.D),this.dispatchEvent("timeout"),this.abort(8))};
g.k.abort=function(a){this.u&&this.B&&(R6(this,"Aborting"),this.B=!1,this.F=!0,this.u.abort(),this.F=!1,this.I=a||7,this.dispatchEvent("complete"),this.dispatchEvent("abort"),P6(this))};
g.k.aa=function(){this.u&&(this.B&&(this.B=!1,this.F=!0,this.u.abort(),this.F=!1),P6(this,!0));O6.Wc.aa.call(this)};
g.k.fE=function(){this.la()||(this.ha||this.N||this.F?TGa(this):this.wO())};
g.k.wO=function(){TGa(this)};
g.k.isActive=function(){return!!this.u};
g.k.getStatus=function(){try{return 2<Q6(this)?this.u.status:-1}catch(a){return-1}};
g.k.getLastError=function(){return"string"===typeof this.D?this.D:String(this.D)};g.k=VGa.prototype;g.k.Wv=null;g.k.Jf=null;g.k.Bt=!1;g.k.vB=null;g.k.rr=null;g.k.Ew=null;g.k.Xv=null;g.k.Ca=null;g.k.Qi=-1;g.k.Co=null;g.k.Wn=null;g.k.connect=function(a){this.Xv=a;a=T6(this.u,null,this.Xv);C6(3);this.vB=g.A();var b=this.u.K;null!=b?(this.Co=b[0],(this.Wn=b[1])?(this.Ca=1,WGa(this)):(this.Ca=2,V6(this))):(b6(a,"MODE","init"),this.Jf=new E6(this,void 0,void 0,void 0),this.Jf.ll=this.Wv,F6(this.Jf,a,!1,null,!0),this.Ca=0)};
g.k.CH=function(a){if(a)this.Ca=2,V6(this);else{C6(4);var b=this.u;b.Ph=b.Hj.Qi;b7(b,9)}a&&this.ih(2)};
g.k.hv=function(a){return this.u.hv(a)};
g.k.abort=function(){this.Jf&&(this.Jf.cancel(),this.Jf=null);this.Qi=-1};
g.k.uB=function(){return!1};
g.k.jE=function(a,b){this.Qi=a.Do;if(0==this.Ca)if(b){try{var c=this.B.parse(b)}catch(d){c=this.u;c.Ph=this.Qi;b7(c,2);return}this.Co=c[0];this.Wn=c[1]}else c=this.u,c.Ph=this.Qi,b7(c,2);else if(2==this.Ca)if(this.Bt)C6(7),this.Ew=g.A();else if("11111"==b){if(C6(6),this.Bt=!0,this.rr=g.A(),c=this.rr-this.vB,!g.ye||g.ae(10)||500>c)this.Qi=200,this.Jf.cancel(),C6(12),U6(this.u,this,!0)}else C6(8),this.rr=this.Ew=g.A(),this.Bt=!1};
g.k.Lr=function(){this.Qi=this.Jf.Do;if(this.Jf.qh)0==this.Ca?this.Wn?(this.Ca=1,WGa(this)):(this.Ca=2,V6(this)):2==this.Ca&&((!g.ye||g.ae(10)?!this.Bt:200>this.Ew-this.rr)?(C6(11),U6(this.u,this,!1)):(C6(12),U6(this.u,this,!0)));else{0==this.Ca?C6(9):2==this.Ca&&C6(10);var a=this.u;this.Jf.getLastError();a.Ph=this.Qi;b7(a,2)}};
g.k.Up=function(){return this.u.Up()};
g.k.isActive=function(){return this.u.isActive()};
g.k.ih=function(a){this.u.ih(a)};g.k=W6.prototype;g.k.Gm=null;g.k.po=null;g.k.zf=null;g.k.md=null;g.k.Vv=null;g.k.tr=null;g.k.Xz=null;g.k.Kr=null;g.k.lp=0;g.k.TL=0;g.k.He=null;g.k.Lj=null;g.k.Ai=null;g.k.Uk=null;g.k.Hj=null;g.k.fu=null;g.k.Sm=-1;g.k.dC=-1;g.k.Ph=-1;g.k.Bm=0;g.k.km=0;g.k.Pk=8;g.Xa(YGa,g.Ll);g.Xa(ZGa,g.Ll);g.k=W6.prototype;g.k.connect=function(a,b,c,d,e){C6(0);this.Vv=b;this.po=c||{};d&&void 0!==e&&(this.po.OSID=d,this.po.OAID=e);this.F?(A6((0,g.z)(this.nA,this,a),100),cHa(this)):this.nA(a)};
g.k.nA=function(a){this.Hj=new VGa(this);this.Hj.Wv=this.Gm;this.Hj.B=this.D;this.Hj.connect(a)};
g.k.uB=function(){return 0==this.Ca};
g.k.qE=function(a){this.Lj=null;fHa(this,a)};
g.k.pE=function(){this.Ai=null;this.md=new E6(this,this.B,"rpc",this.I);this.md.ll=this.Gm;this.md.Yv=0;var a=this.Xz.clone();$5(a,"RID","rpc");$5(a,"SID",this.B);$5(a,"CI",this.fu?"0":"1");$5(a,"AID",this.Sm);X6(this,a);if(!g.ye||g.ae(10))$5(a,"TYPE","xmlhttp"),F6(this.md,a,!0,this.Kr,!1);else{$5(a,"TYPE","html");var b=this.md,c=!!this.Kr;b.Bn=3;b.Ej=a6(a.clone());KGa(b,c)}};
g.k.jE=function(a,b){if(0!=this.Ca&&(this.md==a||this.zf==a))if(this.Ph=a.Do,this.zf==a&&3==this.Ca)if(7<this.Pk){try{var c=this.D.parse(b)}catch(f){c=null}if(Array.isArray(c)&&3==c.length)if(0==c[0])a:{if(!this.Ai){if(this.md)if(this.md.tn+3E3<this.zf.tn)Z6(this),this.md.cancel(),this.md=null;else break a;a7(this);C6(19)}}else this.dC=c[1],0<this.dC-this.Sm&&37500>c[2]&&this.fu&&0==this.km&&!this.Uk&&(this.Uk=A6((0,g.z)(this.yM,this),6E3));else b7(this,11)}else b!=FIa.pS.u&&b7(this,11);else if(this.md==
a&&Z6(this),!g.sc(b)){c=this.D.parse(b);for(var d=0;d<c.length;d++){var e=c[d];this.Sm=e[0];e=e[1];2==this.Ca?"c"==e[0]?(this.B=e[1],this.Kr=e[2],e=e[3],null!=e?this.Pk=e:this.Pk=6,this.Ca=3,this.He&&this.He.jA(),this.Xz=T6(this,this.Up()?this.Kr:null,this.Vv),gHa(this)):"stop"==e[0]&&b7(this,7):3==this.Ca&&("stop"==e[0]?b7(this,7):"noop"!=e[0]&&this.He&&this.He.iA(e),this.km=0)}}};
g.k.yM=function(){null!=this.Uk&&(this.Uk=null,this.md.cancel(),this.md=null,a7(this),C6(20))};
g.k.Lr=function(a){if(this.md==a){Z6(this);this.md=null;var b=2}else if(this.zf==a)this.zf=null,b=1;else return;this.Ph=a.Do;if(0!=this.Ca)if(a.qh)1==b?(b=B6,b.dispatchEvent(new YGa(b,a.Ll?a.Ll.length:0,g.A()-a.tn,this.Bm)),Y6(this),this.C.length=0):gHa(this);else{var c=a.getLastError(),d;if(!(d=3==c||7==c||0==c&&0<this.Ph)){if(d=1==b)this.zf||this.Lj||1==this.Ca||2<=this.Bm?d=!1:(this.Lj=A6((0,g.z)(this.qE,this,a),hHa(this,this.Bm)),this.Bm++,d=!0);d=!(d||2==b&&a7(this))}if(d)switch(c){case 1:b7(this,
5);break;case 4:b7(this,10);break;case 3:b7(this,6);break;case 7:b7(this,12);break;default:b7(this,2)}}};
g.k.YH=function(a){if(!g.nb(arguments,this.Ca))throw Error("Unexpected channel state: "+this.Ca);};
g.k.FQ=function(a){a?C6(2):(C6(1),iHa(this,8))};
g.k.hv=function(a){if(a)throw Error("Can't create secondary domain capable XhrIo object.");a=new O6;a.ea=!1;return a};
g.k.isActive=function(){return!!this.He&&this.He.isActive(this)};
g.k.ih=function(a){var b=B6;b.dispatchEvent(new ZGa(b,a))};
g.k.Up=function(){return!(!g.ye||g.ae(10))};
g.k=jHa.prototype;g.k.jA=function(){};
g.k.iA=function(){};
g.k.hA=function(){};
g.k.Vu=function(){};
g.k.VA=function(){return{}};
g.k.isActive=function(){return!0};g.k=kHa.prototype;g.k.isEmpty=function(){return g.ob(this.u)&&g.ob(this.B)};
g.k.clear=function(){this.u=[];this.B=[]};
g.k.contains=function(a){return g.nb(this.u,a)||g.nb(this.B,a)};
g.k.remove=function(a){var b=this.u;var c=(0,g.Tza)(b,a);0<=c?(g.qb(b,c),b=!0):b=!1;return b||g.rb(this.B,a)};
g.k.Ze=function(){for(var a=[],b=this.u.length-1;0<=b;--b)a.push(this.u[b]);var c=this.B.length;for(b=0;b<c;++b)a.push(this.B[b]);return a};g.Xa(c7,g.B);g.k=c7.prototype;g.k.gP=function(){this.Le=Math.min(3E5,2*this.Le);this.C();this.B&&this.start()};
g.k.start=function(){var a=this.Le+15E3*Math.random();this.u.ub(a);this.B=g.A()+a};
g.k.stop=function(){this.u.stop();this.B=0};
g.k.isActive=function(){return this.u.isActive()};
g.k.reset=function(){this.u.stop();this.Le=5E3};g.Xa(d7,jHa);g.k=d7.prototype;g.k.subscribe=function(a,b,c){return this.C.subscribe(a,b,c)};
g.k.unsubscribe=function(a,b,c){return this.C.unsubscribe(a,b,c)};
g.k.jk=function(a){return this.C.nl(a)};
g.k.V=function(a,b){return this.C.V.apply(this.C,arguments)};
g.k.dispose=function(){this.Cd||(this.Cd=!0,g.eg(this.C),nHa(this),g.eg(this.B),this.B=null,this.X=function(){return""})};
g.k.la=function(){return this.Cd};
g.k.connect=function(a,b,c){if(!this.u||2!=this.u.Ca){this.P="";this.B.stop();this.F=a||null;this.D=b||0;a=this.W+"/test";b=this.W+"/bind";var d=new W6(c?c.firstTestResults:null,c?c.secondTestResults:null,this.Y),e=this.u;e&&(e.He=null);d.He=this;this.u=d;e7(this);e?this.u.connect(a,b,this.I,e.B,e.Sm):c?this.u.connect(a,b,this.I,c.sessionId,c.arrayId):this.u.connect(a,b,this.I)}};
g.k.sendMessage=function(a,b){var c={_sc:a};b&&g.bc(c,b);this.B.isActive()||2==(this.u?this.u.Ca:0)?this.K.push(c):f7(this)&&(e7(this),dHa(this.u,c))};
g.k.jA=function(){this.B.reset();this.F=null;this.D=0;if(this.K.length){var a=this.K;this.K=[];for(var b=0,c=a.length;b<c;++b)dHa(this.u,a[b])}this.V("handlerOpened")};
g.k.hA=function(a){var b=2==a&&401==this.u.Ph;4==a||b||this.B.start();this.V("handlerError",a)};
g.k.Vu=function(a){if(!this.B.isActive())this.V("handlerClosed");else if(a)for(var b=0,c=a.length;b<c;++b){var d=a[b].map;d&&this.K.push(d)}};
g.k.VA=function(){var a={v:2};this.P&&(a.gsessionid=this.P);0!=this.D&&(a.ui=""+this.D);0!=this.N&&(a.ui=""+this.N);this.F&&g.bc(a,this.F);return a};
g.k.iA=function(a){"S"==a[0]?this.P=a[1]:"gracefulReconnect"==a[0]?(this.B.start(),bHa(this.u)):this.V("handlerMessage",new lHa(a[0],a[1]))};
g.k.lQ=function(){this.B.isActive();var a=this.u,b=0;a.md&&b++;a.zf&&b++;0==b&&this.connect(this.F,this.D)};g7.prototype.D=function(a,b,c,d){b?a(d):a({text:c.responseText})};
g7.prototype.C=function(a,b){a(Error("Request error: "+b.status))};
g7.prototype.F=function(a){a(Error("request timed out"))};var vHa=g.A(),j7=null,m7=Array(50),l7=-1,n7=!1;g.Xa(o7,g.P);o7.prototype.Qf=function(){return this.screens};
o7.prototype.contains=function(a){return!!l6(this.screens,a)};
o7.prototype.get=function(a){return a?m6(this.screens,a):null};
o7.prototype.info=function(a){k7(this.I,a)};g.u(p7,g.P);g.k=p7.prototype;g.k.start=function(){!this.u&&isNaN(this.Ua)&&this.wG()};
g.k.stop=function(){this.u&&(this.u.abort(),this.u=null);isNaN(this.Ua)||(g.Io(this.Ua),this.Ua=NaN)};
g.k.aa=function(){this.stop();g.P.prototype.aa.call(this)};
g.k.wG=function(){this.Ua=NaN;this.u=g.oq(h7(this.I,"/pairing/get_screen"),{method:"POST",Xb:{pairing_code:this.F},timeout:5E3,onSuccess:(0,g.z)(this.kR,this),onError:(0,g.z)(this.jR,this),Ef:(0,g.z)(this.lR,this)})};
g.k.kR=function(a,b){this.u=null;var c=b.screen||{};c.dialId=this.C;c.name=this.D;this.V("pairingComplete",new g6(c))};
g.k.jR=function(a){this.u=null;a.status&&404==a.status?this.B>=HIa.length?this.V("pairingFailed",Error("DIAL polling timed out")):(a=HIa[this.B],this.Ua=g.Fo((0,g.z)(this.wG,this),a),this.B++):this.V("pairingFailed",Error("Server error "+a.status))};
g.k.lR=function(){this.u=null;this.V("pairingFailed",Error("Server not responding"))};
var HIa=[2E3,2E3,1E3,1E3,1E3,2E3,2E3,5E3,5E3,1E4];g.Xa(r7,o7);g.k=r7.prototype;g.k.start=function(){q7(this)&&this.V("screenChange");!g.Qs("yt-remote-lounge-token-expiration")&&zHa(this);g.Io(this.u);this.u=g.Fo((0,g.z)(this.start,this),1E4)};
g.k.add=function(a,b){q7(this);wHa(this,a);s7(this,!1);this.V("screenChange");b(a);a.token||zHa(this)};
g.k.remove=function(a,b){var c=q7(this);yHa(this,a)&&(s7(this,!1),c=!0);b(a);c&&this.V("screenChange")};
g.k.du=function(a,b,c,d){var e=q7(this),f=this.get(a.id);f?(f.name!=b&&(f.name=b,s7(this,!1),e=!0),c(a)):d(Error("no such local screen."));e&&this.V("screenChange")};
g.k.aa=function(){g.Io(this.u);r7.Wc.aa.call(this)};
g.k.LI=function(a){q7(this);var b=this.screens.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)}s7(this,!b);b&&k7(this.I,"Missed "+b+" lounge tokens.")};
g.k.KI=function(a){k7(this.I,"Requesting lounge tokens failed: "+a)};g.u(u7,g.P);g.k=u7.prototype;g.k.start=function(){var a=parseInt(g.Qs("yt-remote-fast-check-period")||"0",10);(this.D=g.A()-144E5<a?0:a)?w7(this):(this.D=g.A()+3E5,g.Ps("yt-remote-fast-check-period",this.D),this.Nx())};
g.k.isEmpty=function(){return g.Wb(this.u)};
g.k.update=function(){t7("Updating availability on schedule.");var a=this.I(),b=g.Kb(this.u,function(c,d){return c&&!!m6(a,d)},this);
v7(this,b)};
g.k.aa=function(){g.Io(this.C);this.C=NaN;this.B&&(this.B.abort(),this.B=null);g.P.prototype.aa.call(this)};
g.k.Nx=function(){g.Io(this.C);this.C=NaN;this.B&&this.B.abort();var a=CHa(this);if(c6(a)){var b=h7(this.F,"/pairing/get_screen_availability");this.B=i7(this.F,b,{lounge_token:g.Qb(a).join(",")},(0,g.z)(this.RO,this,a),(0,g.z)(this.QO,this))}else v7(this,{}),w7(this)};
g.k.RO=function(a,b){this.B=null;var c=g.Qb(CHa(this));if(g.Eb(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;v7(this,d);w7(this)}else this.Tc("Changing Screen set during request."),this.Nx()};
g.k.QO=function(a){this.Tc("Screen availability failed: "+a);this.B=null;w7(this)};
g.k.Tc=function(a){k7("OnlineScreenService",a)};g.Xa(x7,o7);g.k=x7.prototype;g.k.start=function(){this.B.start();this.u.start();this.screens.length&&(this.V("screenChange"),this.u.isEmpty()||this.V("onlineScreenChange"))};
g.k.add=function(a,b,c){this.B.add(a,b,c)};
g.k.remove=function(a,b,c){this.B.remove(a,b,c);this.u.update()};
g.k.du=function(a,b,c,d){this.B.contains(a)?this.B.du(a,b,c,d):(a="Updating name of unknown screen: "+a.name,k7(this.I,a),d(Error(a)))};
g.k.Qf=function(a){return a?this.screens:g.tb(this.screens,g.Ke(this.C,function(b){return!this.contains(b)},this))};
g.k.xG=function(){return g.Ke(this.Qf(!0),function(a){return!!this.u.u[a.id]},this)};
g.k.yG=function(a,b,c,d,e){this.info("getDialScreenByPairingCode "+a+" / "+b);var f=new p7(this.F,a,b,c);f.subscribe("pairingComplete",(0,g.z)(function(h){g.eg(f);d(y7(this,h))},this));
f.subscribe("pairingFailed",function(h){g.eg(f);e(h)});
f.start();return(0,g.z)(f.stop,f)};
g.k.nR=function(a,b,c,d){g.oq(h7(this.F,"/pairing/get_screen"),{method:"POST",Xb:{pairing_code:a},timeout:5E3,onSuccess:(0,g.z)(function(e,f){var h=new g6(f.screen||{});if(!h.name||GHa(this,h.name)){a:{var l=h.name;for(var m=2,n=b(l,m);GHa(this,n);){m++;if(20<m)break a;n=b(l,m)}l=n}h.name=l}c(y7(this,h))},this),
onError:(0,g.z)(function(e){d(Error("pairing request failed: "+e.status))},this),
Ef:(0,g.z)(function(){d(Error("pairing request timed out."))},this)})};
g.k.aa=function(){g.eg(this.B);g.eg(this.u);x7.Wc.aa.call(this)};
g.k.TI=function(){HHa(this);this.V("screenChange");this.u.update()};
x7.prototype.dispose=x7.prototype.dispose;g.Xa(A7,g.P);g.k=A7.prototype;g.k.getScreen=function(){return this.K};
g.k.kt=function(a){this.K=a;this.V("sessionScreen",this.K)};
g.k.Wf=function(a){this.la()||(a&&B7(this,""+a),this.K=null,this.V("sessionScreen",null))};
g.k.info=function(a){k7(this.Y,a)};
g.k.AG=function(){return null};
g.k.Yx=function(a){var b=this.u;a?(b.displayStatus=new chrome.cast.ReceiverDisplayStatus(a,[]),b.displayStatus.showStop=!0):b.displayStatus=null;chrome.cast.setReceiverDisplayStatus(b,(0,g.z)(function(){this.info("Updated receiver status for "+b.friendlyName+": "+a)},this),(0,g.z)(function(){B7(this,"Failed to update receiver status for: "+b.friendlyName)},this))};
g.k.aa=function(){this.Yx("");A7.Wc.aa.call(this)};g.u(C7,A7);g.k=C7.prototype;g.k.Xx=function(a){if(this.B){if(this.B==a)return;B7(this,"Overriding cast sesison with new session object");this.B.removeUpdateListener(this.F);this.B.removeMessageListener("urn:x-cast:com.google.youtube.mdx",this.D)}this.B=a;this.B.addUpdateListener(this.F);this.B.addMessageListener("urn:x-cast:com.google.youtube.mdx",this.D);JHa(this)};
g.k.Tm=function(a){this.info("launchWithParams no-op for Cast: "+g.Fj(a))};
g.k.stop=function(){this.B?this.B.stop((0,g.z)(function(){this.Wf()},this),(0,g.z)(function(){this.Wf(Error("Failed to stop receiver app."))},this)):this.Wf(Error("Stopping cast device witout session."))};
g.k.Yx=function(){};
g.k.aa=function(){this.info("disposeInternal");g.Io(this.C);this.C=0;this.B&&(this.B.removeUpdateListener(this.F),this.B.removeMessageListener("urn:x-cast:com.google.youtube.mdx",this.D));this.B=null;A7.prototype.aa.call(this)};
g.k.GP=function(a,b){if(!this.la())if(b){var c=y6(b);if(g.Sa(c)){var d=""+c.type;c=c.data||{};this.info("onYoutubeMessage_: "+d+" "+g.Fj(c));switch(d){case "mdxSessionStatus":IHa(this,c.screenId);break;default:B7(this,"Unknown youtube message: "+d)}}else B7(this,"Unable to parse message.")}else B7(this,"No data in message.")};
g.k.nB=function(a,b,c,d){FHa(this.N,this.u.label,a,this.u.friendlyName,(0,g.z)(function(e){e?b(e):0<=d?(B7(this,"Screen "+a+" appears to be offline. "+d+" retries left."),g.Fo((0,g.z)(this.nB,this,a,b,c,d-1),300)):c(Error("Unable to fetch screen."))},this),c)};
g.k.AG=function(){return this.B};
g.k.oR=function(a){this.la()||a||(B7(this,"Cast session died."),this.Wf())};g.u(D7,A7);g.k=D7.prototype;g.k.Xx=function(a){this.C=a;this.C.addUpdateListener(this.X)};
g.k.Tm=function(a){this.W=a;this.F()};
g.k.stop=function(){this.B();this.B=g.Oa;g.Io(this.D);this.C?this.C.stop((0,g.z)(this.Wf,this,null),(0,g.z)(this.Wf,this,"Failed to stop DIAL device.")):this.Wf()};
g.k.aa=function(){this.B();this.B=g.Oa;g.Io(this.D);this.C&&this.C.removeUpdateListener(this.X);this.C=null;A7.prototype.aa.call(this)};
g.k.rR=function(a){this.la()||a||(B7(this,"DIAL session died."),this.B(),this.B=g.Oa,this.Wf())};
g.k.kw=function(a){this.P=k6();if(this.W){var b=new chrome.cast.DialLaunchResponse(!0,LHa(this));a(b);KHa(this)}else this.F=(0,g.z)(function(){g.Io(this.D);this.F=g.Oa;this.D=NaN;var c=new chrome.cast.DialLaunchResponse(!0,LHa(this));a(c);KHa(this)},this),this.D=g.Fo((0,g.z)(function(){this.F()},this),100)};
g.k.jJ=function(a,b,c){FHa(this.N,this.I.receiver.label,a,this.u.friendlyName,(0,g.z)(function(d){d&&d.token?(this.kt(d),b(new chrome.cast.DialLaunchResponse(!1))):this.kw(b,c)},this),(0,g.z)(function(d){B7(this,"Failed to get DIAL screen: "+d);
this.kw(b,c)},this))};g.u(E7,A7);E7.prototype.stop=function(){this.Wf()};
E7.prototype.Xx=function(){};
E7.prototype.Tm=function(){g.Io(this.B);this.B=NaN;var a=m6(this.N.Qf(),this.u.label);a?this.kt(a):this.Wf(Error("No such screen"))};
E7.prototype.aa=function(){g.Io(this.B);this.B=NaN;A7.prototype.aa.call(this)};g.u(F7,g.P);g.k=F7.prototype;
g.k.init=function(a,b){chrome.cast.timeout.requestSession=3E4;var c=new chrome.cast.SessionRequest(this.K);this.N||(c.dialRequest=new chrome.cast.DialRequest("YouTube"));var d=chrome.cast.AutoJoinPolicy.TAB_AND_ORIGIN_SCOPED,e=a?chrome.cast.DefaultActionPolicy.CAST_THIS_TAB:chrome.cast.DefaultActionPolicy.CREATE_SESSION,f=(0,g.z)(this.BO,this);c=new chrome.cast.ApiConfig(c,(0,g.z)(this.lE,this),f,d,e);c.customDialLaunchCallback=(0,g.z)(this.YM,this);chrome.cast.initialize(c,(0,g.z)(function(){this.la()||
(chrome.cast.addReceiverActionListener(this.D),sHa(),this.B.subscribe("onlineScreenChange",(0,g.z)(this.zG,this)),this.C=NHa(this),chrome.cast.setCustomReceivers(this.C,g.Oa,(0,g.z)(function(h){this.Tc("Failed to set initial custom receivers: "+g.Fj(h))},this)),this.V("yt-remote-cast2-availability-change",H7(this)),b(!0))},this),(0,g.z)(function(h){this.Tc("Failed to initialize API: "+g.Fj(h));
b(!1)},this))};
g.k.rQ=function(a,b){G7("Setting connected screen ID: "+a+" -> "+b);if(this.u){var c=this.u.getScreen();if(!a||c&&c.id!=a)G7("Unsetting old screen status: "+this.u.u.friendlyName),I7(this,null)}if(a&&b){if(!this.u){c=m6(this.B.Qf(),a);if(!c){G7("setConnectedScreenStatus: Unknown screen.");return}var d=MHa(this,c);d||(G7("setConnectedScreenStatus: Connected receiver not custom..."),d=new chrome.cast.Receiver(c.uuid?c.uuid:c.id,c.name),d.receiverType=chrome.cast.ReceiverType.CUSTOM,this.C.push(d),chrome.cast.setCustomReceivers(this.C,
g.Oa,(0,g.z)(function(e){this.Tc("Failed to set initial custom receivers: "+g.Fj(e))},this)));
G7("setConnectedScreenStatus: new active receiver: "+d.friendlyName);I7(this,new E7(this.B,d),!0)}this.u.Yx(b)}else G7("setConnectedScreenStatus: no screen.")};
g.k.sQ=function(a){this.la()?this.Tc("Setting connection data on disposed cast v2"):this.u?this.u.Tm(a):this.Tc("Setting connection data without a session")};
g.k.qR=function(){this.la()?this.Tc("Stopping session on disposed cast v2"):this.u?(this.u.stop(),I7(this,null)):G7("Stopping non-existing session")};
g.k.requestSession=function(){chrome.cast.requestSession((0,g.z)(this.lE,this),(0,g.z)(this.TO,this))};
g.k.aa=function(){this.B.unsubscribe("onlineScreenChange",(0,g.z)(this.zG,this));window.chrome&&chrome.cast&&chrome.cast.removeReceiverActionListener(this.D);var a=pHa,b=g.Na("yt.mdx.remote.debug.handlers_");g.rb(b||[],a);g.eg(this.u);g.P.prototype.aa.call(this)};
g.k.Tc=function(a){k7("Controller",a)};
g.k.nE=function(a,b){this.u==a&&(b||I7(this,null),this.V("yt-remote-cast2-session-change",b))};
g.k.xO=function(a,b){if(!this.la())if(a)switch(a.friendlyName=chrome.cast.unescape(a.friendlyName),G7("onReceiverAction_ "+a.label+" / "+a.friendlyName+"-- "+b),b){case chrome.cast.ReceiverAction.CAST:if(this.u)if(this.u.u.label!=a.label)G7("onReceiverAction_: Stopping active receiver: "+this.u.u.friendlyName),this.u.stop();else{G7("onReceiverAction_: Casting to active receiver.");this.u.getScreen()&&this.V("yt-remote-cast2-session-change",this.u.getScreen());break}switch(a.receiverType){case chrome.cast.ReceiverType.CUSTOM:I7(this,
new E7(this.B,a));break;case chrome.cast.ReceiverType.DIAL:I7(this,new D7(this.B,a,this.I));break;case chrome.cast.ReceiverType.CAST:I7(this,new C7(this.B,a));break;default:this.Tc("Unknown receiver type: "+a.receiverType)}break;case chrome.cast.ReceiverAction.STOP:this.u&&this.u.u.label==a.label?this.u.stop():this.Tc("Stopping receiver w/o session: "+a.friendlyName)}else this.Tc("onReceiverAction_ called without receiver.")};
g.k.YM=function(a){if(this.la())return Promise.reject(Error("disposed"));var b=a.receiver;b.receiverType!=chrome.cast.ReceiverType.DIAL&&(this.Tc("Not DIAL receiver: "+b.friendlyName),b.receiverType=chrome.cast.ReceiverType.DIAL);var c=this.u?this.u.u:null;if(!c||c.label!=b.label)return this.Tc("Receiving DIAL launch request for non-clicked DIAL receiver: "+b.friendlyName),Promise.reject(Error("illegal DIAL launch"));if(c&&c.label==b.label&&c.receiverType!=chrome.cast.ReceiverType.DIAL){if(this.u.getScreen())return G7("Reselecting dial screen."),
this.V("yt-remote-cast2-session-change",this.u.getScreen()),Promise.resolve(new chrome.cast.DialLaunchResponse(!1));this.Tc('Changing CAST intent from "'+c.receiverType+'" to "dial" for '+b.friendlyName);I7(this,new D7(this.B,b,this.I))}b=this.u;b.I=a;return b.I.appState==chrome.cast.DialAppState.RUNNING?new Promise((0,g.z)(b.jJ,b,(b.I.extraData||{}).screenId||null)):new Promise((0,g.z)(b.kw,b))};
g.k.lE=function(a){if(!this.la()){G7("New cast session ID: "+a.sessionId);var b=a.receiver;if(b.receiverType!=chrome.cast.ReceiverType.CUSTOM){if(!this.u)if(b.receiverType==chrome.cast.ReceiverType.CAST)G7("Got resumed cast session before resumed mdx connection."),b.friendlyName=chrome.cast.unescape(b.friendlyName),I7(this,new C7(this.B,b),!0);else{this.Tc("Got non-cast session without previous mdx receiver event, or mdx resume.");return}var c=this.u.u,d=m6(this.B.Qf(),c.label);d&&h6(d,b.label)&&
c.receiverType!=chrome.cast.ReceiverType.CAST&&b.receiverType==chrome.cast.ReceiverType.CAST&&(G7("onSessionEstablished_: manual to cast session change "+b.friendlyName),g.eg(this.u),this.u=new C7(this.B,b),this.u.subscribe("sessionScreen",(0,g.z)(this.nE,this,this.u)),this.u.Tm(null));this.u.Xx(a)}}};
g.k.pR=function(){return this.u?this.u.AG():null};
g.k.TO=function(a){this.la()||(this.Tc("Failed to estabilish a session: "+g.Fj(a)),a.code!=chrome.cast.ErrorCode.CANCEL&&I7(this,null))};
g.k.BO=function(a){G7("Receiver availability updated: "+a);if(!this.la()){var b=H7(this);this.F=a==chrome.cast.ReceiverAvailability.AVAILABLE;H7(this)!=b&&this.V("yt-remote-cast2-availability-change",H7(this))}};
g.k.zG=function(){this.la()||(this.C=NHa(this),G7("Updating custom receivers: "+g.Fj(this.C)),chrome.cast.setCustomReceivers(this.C,g.Oa,(0,g.z)(function(){this.Tc("Failed to set custom receivers.")},this)),this.V("yt-remote-cast2-availability-change",H7(this)))};
F7.prototype.setLaunchParams=F7.prototype.sQ;F7.prototype.setConnectedScreenStatus=F7.prototype.rQ;F7.prototype.stopSession=F7.prototype.qR;F7.prototype.getCastSession=F7.prototype.pR;F7.prototype.requestSession=F7.prototype.requestSession;F7.prototype.init=F7.prototype.init;F7.prototype.dispose=F7.prototype.dispose;var O7=[];g.k=T7.prototype;
g.k.reset=function(a){this.listId="";this.index=-1;this.videoId="";U7(this);this.volume=-1;this.muted=!1;a&&(this.index=a.index,this.listId=a.listId,this.videoId=a.videoId,this.playerState=a.playerState,this.volume=a.volume,this.muted=a.muted,this.audioTrackId=a.audioTrackId,this.u=a.trackData,this.Qh=a.hasPrevious,this.hasNext=a.hasNext,this.K=a.playerTime,this.I=a.playerTimeAt,this.F=a.seekableStart,this.B=a.seekableEnd,this.N=a.duration,this.P=a.loadedTime,this.D=a.liveIngestionTime,this.C=!isNaN(this.D))};
g.k.Cb=function(){return 1==this.playerState};
g.k.isAdPlaying=function(){return 1081==this.playerState};
g.k.getDuration=function(){return this.C?this.N+V7(this):this.N};
g.k.clone=function(){return new T7(Z7(this))};g.u(a8,g.P);g.k=a8.prototype;g.k.play=function(){1==this.Ca?(this.u?this.u.play(null,g.Oa,g8(this,"play")):f8(this,"play"),e8(this,1,X7(b8(this))),this.V("remotePlayerChange")):c8(this,this.play)};
g.k.pause=function(){1==this.Ca?(this.u?this.u.pause(null,g.Oa,g8(this,"pause")):f8(this,"pause"),e8(this,2,X7(b8(this))),this.V("remotePlayerChange")):c8(this,this.pause)};
g.k.seekTo=function(a){if(1==this.Ca){if(this.u){var b=b8(this),c=new chrome.cast.media.SeekRequest;c.currentTime=a;b.Cb()||3==b.playerState?c.resumeState=chrome.cast.media.ResumeState.PLAYBACK_START:c.resumeState=chrome.cast.media.ResumeState.PLAYBACK_PAUSE;this.u.seek(c,g.Oa,g8(this,"seekTo",{newTime:a}))}else f8(this,"seekTo",{newTime:a});e8(this,3,a);this.V("remotePlayerChange")}else c8(this,g.Va(this.seekTo,a))};
g.k.stop=function(){if(1==this.Ca){this.u?this.u.stop(null,g.Oa,g8(this,"stopVideo")):f8(this,"stopVideo");var a=b8(this);a.index=-1;a.videoId="";U7(a);d8(this,a);this.V("remotePlayerChange")}else c8(this,this.stop)};
g.k.setVolume=function(a,b){if(1==this.Ca){var c=b8(this);if(this.B){if(c.volume!=a){var d=Math.round(a)/100;this.B.setReceiverVolumeLevel(d,(0,g.z)(function(){k7("CP","set receiver volume: "+d)},this),(0,g.z)(function(){this.Tc("failed to set receiver volume.")},this))}c.muted!=b&&this.B.setReceiverMuted(b,(0,g.z)(function(){k7("CP","set receiver muted: "+b)},this),(0,g.z)(function(){this.Tc("failed to set receiver muted.")},this))}else{var e={volume:a,
muted:b};-1!=c.volume&&(e.delta=a-c.volume);f8(this,"setVolume",e)}c.muted=b;c.volume=a;d8(this,c)}else c8(this,g.Va(this.setVolume,a,b))};
g.k.vG=function(a,b){if(1==this.Ca){var c=b8(this),d={videoId:a};b&&(c.u={trackName:b.name,languageCode:b.languageCode,sourceLanguageCode:b.translationLanguage?b.translationLanguage.languageCode:"",languageName:b.languageName,kind:b.kind},d.style=g.Fj(b.style),g.bc(d,c.u));f8(this,"setSubtitlesTrack",d);d8(this,c)}else c8(this,g.Va(this.vG,a,b))};
g.k.setAudioTrack=function(a,b){if(1==this.Ca){var c=b.getLanguageInfo().getId();f8(this,"setAudioTrack",{videoId:a,audioTrackId:c});var d=b8(this);d.audioTrackId=c;d8(this,d)}else c8(this,g.Va(this.setAudioTrack,a,b))};
g.k.playVideo=function(a,b,c,d,e,f,h){var l=b8(this);c=c||0;var m={videoId:a,currentIndex:c};Y7(l,a,c);void 0!==b&&(W7(l,b),m.currentTime=b);void 0!==d&&(m.listId=d);null!=e&&(m.playerParams=e);null!=f&&(m.clickTrackingParams=f);null!=h&&(m.locationInfo=g.Fj(h));f8(this,"setPlaylist",m);d||d8(this,l)};
g.k.vt=function(a,b){if(1==this.Ca){if(a&&b){var c=b8(this);Y7(c,a,b);d8(this,c)}f8(this,"previous")}else c8(this,g.Va(this.vt,a,b))};
g.k.nextVideo=function(a,b){if(1==this.Ca){if(a&&b){var c=b8(this);Y7(c,a,b);d8(this,c)}f8(this,"next")}else c8(this,g.Va(this.nextVideo,a,b))};
g.k.AA=function(){1==this.Ca?f8(this,"dismissAutoplay"):c8(this,this.AA)};
g.k.dispose=function(){if(3!=this.Ca){var a=this.Ca;this.Ca=3;this.V("proxyStateChange",a,this.Ca)}g.P.prototype.dispose.call(this)};
g.k.aa=function(){$Ha(this);this.C=null;this.D.clear();$7(this,null);g.P.prototype.aa.call(this)};
g.k.Ry=function(a){if((a!=this.Ca||2==a)&&3!=this.Ca&&0!=a){var b=this.Ca;this.Ca=a;this.V("proxyStateChange",b,a);if(1==a)for(;!this.D.isEmpty();)b=a=this.D,g.ob(b.u)&&(b.u=b.B,b.u.reverse(),b.B=[]),a.u.pop().apply(this);else 3==a&&this.dispose()}};
g.k.tO=function(a,b){this.V(a,b)};
g.k.HM=function(a){if(!a)this.qp(null),$7(this,null);else if(this.B.receiver.volume){a=this.B.receiver.volume;var b=b8(this),c=Math.round(100*a.level||0);if(b.volume!=c||b.muted!=a.muted)k7("CP","Cast volume update: "+a.level+(a.muted?" muted":"")),b.volume=c,b.muted=!!a.muted,d8(this,b)}};
g.k.qp=function(a){k7("CP","Cast media: "+!!a);this.u&&this.u.removeUpdateListener(this.K);if(this.u=a)this.u.addUpdateListener(this.K),aIa(this),this.V("remotePlayerChange")};
g.k.GM=function(a){a?(aIa(this),this.V("remotePlayerChange")):this.qp(null)};
g.k.ry=function(){f8(this,"sendDebugCommand",{debugCommand:"stats4nerds "})};
g.k.QM=function(){var a=XHa();a&&$7(this,a)};
g.k.Tc=function(a){k7("CP",a)};g.u(h8,g.P);g.k=h8.prototype;
g.k.connect=function(a,b){if(b){var c=b.listId,d=b.videoId,e=b.playerParams,f=b.clickTrackingParams,h=b.index,l={videoId:d},m=b.currentTime,n=b.locationInfo;void 0!==m&&(l.currentTime=5>=m?0:m);e&&(l.playerParams=e);n&&(l.locationInfo=n);f&&(l.clickTrackingParams=f);c&&(l.listId=c);void 0!==h&&(l.currentIndex=h);c&&(this.Ab.listId=c);this.Ab.videoId=d;this.Ab.index=h||0;this.Ab.state=3;W7(this.Ab,m);this.D="UNSUPPORTED";i8("Connecting with setPlaylist and params: "+g.Fj(l));this.u.connect({method:"setPlaylist",
params:g.Fj(l)},a,mGa())}else i8("Connecting without params"),this.u.connect({},a,mGa());cIa(this)};
g.k.dispose=function(){this.la()||(this.V("beforeDispose"),j8(this,3));g.P.prototype.dispose.call(this)};
g.k.aa=function(){k8(this);m8(this);l8(this);g.Io(this.K);this.K=NaN;g.Io(this.N);this.N=NaN;this.C=null;g.dp(this.Y);this.Y.length=0;this.u.dispose();g.P.prototype.aa.call(this);this.D=this.I=this.B=this.Ab=this.u=null};
g.k.DI=function(){this.wm(2)};
g.k.LM=function(){i8("Channel opened");this.X&&(this.X=!1,l8(this),this.W=g.Fo((0,g.z)(function(){i8("Timing out waiting for a screen.");this.wm(1)},this),15E3));
qGa(mHa(this.u),this.ba)};
g.k.IM=function(){i8("Channel closed");isNaN(this.F)?r6(!0):r6();this.dispose()};
g.k.JM=function(a){r6();isNaN(this.yo())?(i8("Channel error: "+a+" without reconnection"),this.dispose()):(this.X=!0,i8("Channel error: "+a+" with reconnection in "+this.yo()+" ms"),j8(this,2))};
g.k.KM=function(a){a.params?i8("Received: action="+a.action+", params="+g.Fj(a.params)):i8("Received: action="+a.action+" {}");switch(a.action){case "loungeStatus":a=y6(a.params.devices);this.B=g.Pc(a,function(c){return new f6(c)});
a=!!g.jb(this.B,function(c){return"LOUNGE_SCREEN"==c.type});
fIa(this,a);break;case "loungeScreenDisconnected":g.sb(this.B,function(c){return"LOUNGE_SCREEN"==c.type});
fIa(this,!1);break;case "remoteConnected":var b=new f6(y6(a.params.device));g.jb(this.B,function(c){return b?c.id==b.id:!1})||XFa(this.B,b);
break;case "remoteDisconnected":b=new f6(y6(a.params.device));g.sb(this.B,function(c){return b?c.id==b.id:!1});
break;case "gracefulDisconnect":break;case "playlistModified":hIa(this,a);break;case "nowPlaying":jIa(this,a);break;case "onStateChange":iIa(this,a);break;case "onAdStateChange":kIa(this,a);break;case "onVolumeChanged":lIa(this,a);break;case "onSubtitlesTrackChanged":gIa(this,a);break;case "nowAutoplaying":mIa(this,a);break;case "autoplayDismissed":this.V("autoplayDismissed");break;case "autoplayUpNext":this.I=a.params.videoId||null;this.V("autoplayUpNext",this.I);break;case "onAutoplayModeChanged":this.D=
a.params.autoplayMode;this.V("autoplayModeChange",this.D);"DISABLED"==this.D&&this.V("autoplayDismissed");break;case "onHasPreviousNextChanged":nIa(this,a);break;case "requestAssistedSignIn":this.V("assistedSignInRequested",a.params.authCode);break;default:i8("Unrecognized action: "+a.action)}};
g.k.hQ=function(){if(this.C){var a=this.C;this.C=null;this.Ab.videoId!=a&&n8(this,"getNowPlaying")}};
g.k.uI=function(){var a=3;this.la()||(a=0,isNaN(this.yo())?f7(this.u)&&isNaN(this.F)&&(a=1):a=2);return a};
g.k.wm=function(a){i8("Disconnecting with "+a);k8(this);this.V("beforeDisconnect",a);1==a&&r6();nHa(this.u,a);this.dispose()};
g.k.sI=function(){var a=this.Ab;this.C&&(a=this.Ab.clone(),Y7(a,this.C,a.index));return Z7(a)};
g.k.tQ=function(a){var b=new T7(a);b.videoId&&b.videoId!=this.Ab.videoId&&(this.C=b.videoId,g.Io(this.K),this.K=g.Fo((0,g.z)(this.hQ,this),5E3));var c=[];this.Ab.listId==b.listId&&this.Ab.videoId==b.videoId&&this.Ab.index==b.index||c.push("remoteQueueChange");this.Ab.playerState==b.playerState&&this.Ab.volume==b.volume&&this.Ab.muted==b.muted&&X7(this.Ab)==X7(b)&&g.Fj(this.Ab.u)==g.Fj(b.u)||c.push("remotePlayerChange");this.Ab.reset(a);g.Gb(c,function(d){this.V(d)},this)};
g.k.lB=function(){var a=this.u.I.id,b=g.jb(this.B,function(c){return"REMOTE_CONTROL"==c.type&&c.id!=a});
return b?b.id:""};
g.k.yo=function(){var a=this.u;return a.B.isActive()?a.B.B-g.A():NaN};
g.k.hI=function(){return this.D||"UNSUPPORTED"};
g.k.iI=function(){return this.I||""};
g.k.iR=function(){if(!isNaN(this.yo())){var a=this.u.B;g.tn(a.u);a.start()}};
g.k.pQ=function(a,b){n8(this,a,b);eIa(this)};
g.k.uG=function(){var a=g.wq("SID","")||"",b=g.wq("SAPISID","")||"",c=g.wq("__Secure-3PAPISID","")||"";if(!a&&!b&&!c)return"";a=g.qf(g.Ve(a),2);b=g.qf(g.Ve(b),2);c=g.qf(g.Ve(c),2);return g.qf(g.Ve(a+","+b+","+c),2)};
h8.prototype.subscribe=h8.prototype.subscribe;h8.prototype.unsubscribeByKey=h8.prototype.jk;h8.prototype.getProxyState=h8.prototype.uI;h8.prototype.disconnect=h8.prototype.wm;h8.prototype.getPlayerContextData=h8.prototype.sI;h8.prototype.setPlayerContextData=h8.prototype.tQ;h8.prototype.getOtherConnectedRemoteId=h8.prototype.lB;h8.prototype.getReconnectTimeout=h8.prototype.yo;h8.prototype.getAutoplayMode=h8.prototype.hI;h8.prototype.getAutoplayVideoId=h8.prototype.iI;h8.prototype.reconnect=h8.prototype.iR;
h8.prototype.sendMessage=h8.prototype.pQ;h8.prototype.getXsrfToken=h8.prototype.uG;g.u(o8,o7);g.k=o8.prototype;g.k.Qf=function(a){return this.Je.$_gs(a)};
g.k.contains=function(a){return!!this.Je.$_c(a)};
g.k.get=function(a){return this.Je.$_g(a)};
g.k.start=function(){this.Je.$_st()};
g.k.add=function(a,b,c){this.Je.$_a(a,b,c)};
g.k.remove=function(a,b,c){this.Je.$_r(a,b,c)};
g.k.du=function(a,b,c,d){this.Je.$_un(a,b,c,d)};
g.k.aa=function(){for(var a=0,b=this.u.length;a<b;++a)this.Je.$_ubk(this.u[a]);this.u.length=0;this.Je=null;o7.prototype.aa.call(this)};
g.k.mR=function(){this.V("screenChange")};
g.k.ZN=function(){this.V("onlineScreenChange")};
x7.prototype.$_st=x7.prototype.start;x7.prototype.$_gspc=x7.prototype.nR;x7.prototype.$_gsppc=x7.prototype.yG;x7.prototype.$_c=x7.prototype.contains;x7.prototype.$_g=x7.prototype.get;x7.prototype.$_a=x7.prototype.add;x7.prototype.$_un=x7.prototype.du;x7.prototype.$_r=x7.prototype.remove;x7.prototype.$_gs=x7.prototype.Qf;x7.prototype.$_gos=x7.prototype.xG;x7.prototype.$_s=x7.prototype.subscribe;x7.prototype.$_ubk=x7.prototype.jk;var H8=null,G8=!1,p8=null,q8=null,F8=null,u8=[];g.u(I8,g.B);g.k=I8.prototype;g.k.aa=function(){g.B.prototype.aa.call(this);this.u.stop();this.B.stop();this.K.stop();this.W();var a=this.rb;a.unsubscribe("proxyStateChange",this.iE,this);a.unsubscribe("remotePlayerChange",this.yp,this);a.unsubscribe("remoteQueueChange",this.lt,this);a.unsubscribe("previousNextChange",this.eE,this);a.unsubscribe("nowAutoplaying",this.ZD,this);a.unsubscribe("autoplayDismissed",this.zD,this);this.rb=this.module=null};
g.k.KC=function(a,b){for(var c=[],d=1;d<arguments.length;++d)c[d-1]=arguments[d];if(2!=this.rb.Ca)if(J8(this)){if(!b8(this.rb).isAdPlaying()||"control_seek"!==a)switch(a){case "control_toggle_play_pause":b8(this.rb).Cb()?this.rb.pause():this.rb.play();break;case "control_play":this.rb.play();break;case "control_pause":this.rb.pause();break;case "control_seek":this.I.uC(c[0],c[1]);break;case "control_subtitles_set_track":K8(this,c[0]);break;case "control_set_audio_track":this.setAudioTrack(c[0])}}else switch(a){case "control_toggle_play_pause":case "control_play":case "control_pause":c=
this.J.getCurrentTime();L8(this,0===c?void 0:c);break;case "control_seek":L8(this,c[0]);break;case "control_subtitles_set_track":K8(this,c[0]);break;case "control_set_audio_track":this.setAudioTrack(c[0])}};
g.k.EM=function(a){this.K.AI(a)};
g.k.RQ=function(a){this.KC("control_subtitles_set_track",g.Wb(a)?null:a)};
g.k.GF=function(){var a=this.J.getOption("captions","track");g.Wb(a)||K8(this,a)};
g.k.Ec=function(a){this.module.Ec(a,this.J.getVideoData().lengthSeconds)};
g.k.PD=function(a){if(J8(this)){this.rb.unsubscribe("remotePlayerChange",this.yp,this);var b=Math.round(a.volume);a=!!a.muted;var c=b8(this.rb);if(b!==c.volume||a!==c.muted)this.rb.setVolume(b,a),this.N.start();this.rb.subscribe("remotePlayerChange",this.yp,this)}};
g.k.CN=function(){g.Wb(this.C)||zIa(this,this.C);this.D=!1};
g.k.iE=function(a,b){this.B.stop();2===b&&this.DF()};
g.k.yp=function(){if(J8(this)){this.u.stop();var a=b8(this.rb);switch(a.playerState){case 1080:case 1081:case 1084:case 1085:this.module.Xd=1;break;case 1082:case 1083:this.module.Xd=0;break;default:this.module.Xd=-1}switch(a.playerState){case 1081:case 1:this.Bd(new g.LK(8));this.CF();break;case 1085:case 3:this.Bd(new g.LK(9));break;case 1083:case 0:this.Bd(new g.LK(2));this.I.stop();this.Ec(this.J.getVideoData().lengthSeconds);break;case 1084:this.Bd(new g.LK(4));break;case 2:this.Bd(new g.LK(4));
this.Ec(X7(a));break;case -1:this.Bd(new g.LK(64));break;case -1E3:this.Bd(new g.LK(128,{errorCode:"mdx.remoteerror",errorMessage:"This video is not available for remote playback."}))}a=b8(this.rb).u;var b=this.C;(a||b?a&&b&&a.trackName==b.trackName&&a.languageCode==b.languageCode&&a.languageName==b.languageName&&a.kind==b.kind:1)||(this.C=a,zIa(this,a));a=b8(this.rb);-1===a.volume||Math.round(this.J.getVolume())===a.volume&&this.J.isMuted()===a.muted||this.N.isActive()||this.fG()}else yIa(this)};
g.k.eE=function(){this.J.V("mdxpreviousnextchange")};
g.k.lt=function(){J8(this)||yIa(this)};
g.k.ZD=function(a){isNaN(a)||this.J.V("mdxnowautoplaying",a)};
g.k.zD=function(){this.J.V("mdxautoplaycanceled")};
g.k.setAudioTrack=function(a){J8(this)&&this.rb.setAudioTrack(this.J.getVideoData(1).videoId,a)};
g.k.seekTo=function(a,b){-1===b8(this.rb).playerState?L8(this,a):b&&this.rb.seekTo(a)};
g.k.fG=function(){if(J8(this)){var a=b8(this.rb);this.events.Bb(this.P);a.muted?this.J.mute():this.J.unMute();this.J.setVolume(a.volume);this.P=this.events.R(this.J,"onVolumeChange",this.PD)}};
g.k.CF=function(){this.u.stop();if(!this.rb.la()){var a=b8(this.rb);a.Cb()&&this.Bd(new g.LK(8));this.Ec(X7(a));this.u.start()}};
g.k.DF=function(){this.B.stop();this.u.stop();var a=this.rb.C.getReconnectTimeout();2==this.rb.Ca&&!isNaN(a)&&this.B.start()};
g.k.Bd=function(a){this.B.stop();var b=this.F;if(!g.QK(b,a)){var c=g.T(a,2);c!==g.T(this.F,2)&&g.u0(this.J.app,c);this.F=a;BIa(this.module,b,a)}};g.u(M8,g.V);M8.prototype.pc=function(){this.u.show()};
M8.prototype.bb=function(){this.u.hide()};
M8.prototype.B=function(){g.gK("https://support.google.com/youtube/answer/7640706")};
M8.prototype.C=function(){e6("mdx-manual-pairing-popup-ok");this.bb()};g.u(N8,g.V);N8.prototype.pc=function(){this.u.show()};
N8.prototype.bb=function(){this.u.hide()};
N8.prototype.B=function(){e6("mdx-privacy-popup-cancel");this.bb()};
N8.prototype.C=function(){e6("mdx-privacy-popup-confirm");this.bb()};g.u(O8,g.V);O8.prototype.B=function(a){AIa(this,a.state)};g.u(P8,g.JZ);P8.prototype.D=function(){var a=this.J.getOption("remote","receivers");a&&1<a.length&&!this.J.getOption("remote","quickCast")?(this.tk=g.Ib(a,this.u,this),g.KZ(this,g.Pc(a,this.u)),a=this.J.getOption("remote","currentReceiver"),this.wc(this.u(a)),this.enable(!0)):this.enable(!1)};
P8.prototype.u=function(a){return a.key};
P8.prototype.fh=function(a){return"cast-selector-receiver"===a?"Cast...":this.tk[a].name};
P8.prototype.ne=function(a){g.JZ.prototype.ne.call(this,a);this.J.setOption("remote","currentReceiver",this.tk[a]);this.Sa.bb()};g.u(Q8,g.vS);g.k=Q8.prototype;
g.k.create=function(){var a=this.player.T(),b=g.MB(a);a={device:"Desktop",app:"youtube-desktop",loadCastApiSetupScript:g.R(a.experiments,"mdx_load_cast_api_bootstrap_script")};sIa(b,a);this.subscriptions.push(g.No("yt-remote-before-disconnect",this.CM,this));this.subscriptions.push(g.No("yt-remote-connection-change",this.CO,this));this.subscriptions.push(g.No("yt-remote-receiver-availability-change",this.gE,this));this.subscriptions.push(g.No("yt-remote-auto-connect",this.AO,this));this.subscriptions.push(g.No("yt-remote-receiver-resumed",
this.zO,this));this.subscriptions.push(g.No("mdx-privacy-popup-confirm",this.XP,this));this.subscriptions.push(g.No("mdx-privacy-popup-cancel",this.WP,this));this.subscriptions.push(g.No("mdx-manual-pairing-popup-ok",this.yJ,this));this.gE()};
g.k.load=function(){this.player.cancelPlayback();g.vS.prototype.load.call(this);this.Eh=new I8(this,this.player,this.rb);var a=(a=xIa())?a.currentTime:0;var b=E8()?new a8(z8(),void 0):null;0==a&&b&&(a=X7(b8(b)));0!==a&&this.Ec(a);BIa(this,this.yc,this.yc);g.C0(this.player.app,6)};
g.k.unload=function(){this.player.V("mdxautoplaycanceled");this.Jj=this.bh;g.fg(this.Eh,this.rb);this.rb=this.Eh=null;g.vS.prototype.unload.call(this);g.C0(this.player.app,5);R8(this)};
g.k.aa=function(){g.Oo(this.subscriptions);g.vS.prototype.aa.call(this)};
g.k.di=function(a,b){for(var c=[],d=1;d<arguments.length;++d)c[d-1]=arguments[d];this.loaded&&this.Eh.KC.apply(this.Eh,[a].concat(g.la(c)))};
g.k.getAdState=function(){return this.Xd};
g.k.wI=function(){return this.loaded?this.Eh.suggestion:null};
g.k.Qh=function(){return this.rb?b8(this.rb).Qh:!1};
g.k.hasNext=function(){return this.rb?b8(this.rb).hasNext:!1};
g.k.Ec=function(a,b){this.eC=a||0;this.player.V("progresssync",a,b)};
g.k.getCurrentTime=function(){return this.eC};
g.k.getProgressState=function(){var a=b8(this.rb),b=this.player.getVideoData();return{allowSeeking:g.R(this.player.T().experiments,"web_player_mdx_allow_seeking_change_killswitch")?this.player.Vd():!a.isAdPlaying()&&this.player.Vd(),clipEnd:b.clipEnd,clipStart:b.clipStart,current:this.getCurrentTime(),displayedStart:-1,duration:a.getDuration(),ingestionTime:a.C?a.D+V7(a):a.D,isAtLiveHead:1>=(a.C?a.B+V7(a):a.B)-this.getCurrentTime(),loaded:a.P,seekableEnd:a.C?a.B+V7(a):a.B,seekableStart:0<a.F?a.F+
V7(a):a.F}};
g.k.nextVideo=function(){this.rb&&this.rb.nextVideo()};
g.k.vt=function(){this.rb&&this.rb.vt()};
g.k.CM=function(a){1===a&&(this.zx=this.rb?b8(this.rb):null)};
g.k.CO=function(){var a=E8()?new a8(z8(),void 0):null;if(a){var b=this.Jj;this.loaded&&this.unload();this.rb=a;this.zx=null;b.key!==this.bh.key&&(this.Jj=b,this.load())}else g.eg(this.rb),this.rb=null,this.loaded&&(this.unload(),(a=this.zx)&&a.videoId===this.player.getVideoData().videoId&&this.player.cueVideoById(a.videoId,X7(a)));this.player.V("videodatachange","newdata",this.player.getVideoData(),3)};
g.k.gE=function(){this.tk=[this.bh].concat(uIa());var a=A8()||this.bh;S8(this,a);this.player.va("onMdxReceiversChange")};
g.k.AO=function(){var a=A8();S8(this,a)};
g.k.zO=function(){this.Jj=A8()};
g.k.XP=function(){this.Bp=!0;R8(this);G8=!1;H8&&C8(H8,1);H8=null};
g.k.WP=function(){this.Bp=!1;R8(this);S8(this,this.bh);this.Jj=this.bh;G8=!1;H8=null;this.player.playVideo()};
g.k.yJ=function(){this.xs=!0;R8(this);g.Ps("yt-remote-manual-pairing-warning-shown",!0,2592E3);G8=!1;H8&&C8(H8,1);H8=null};
g.k.Rd=function(a,b){switch(a){case "casting":return this.loaded;case "receivers":return this.tk;case "currentReceiver":return b&&("cast-selector-receiver"===b.key?R7():S8(this,b)),this.loaded?this.Jj:this.bh;case "quickCast":return 2===this.tk.length&&"cast-selector-receiver"===this.tk[1].key?(b&&R7(),!0):!1}};
g.k.ry=function(){this.rb.ry()};
g.k.ph=function(){return!1};
g.k.getOptions=function(){return["casting","receivers","currentReceiver","quickCast"]};g.oX.remote=Q8;})(_yt_player);
