(function(g){var window=this;var aHa=function(a,b){return g.Tb(a,b)},Z5=function(a,b,c){a.C.set(b,c)},$5=function(a){Z5(a,"zx",Math.floor(2147483648*Math.random()).toString(36)+Math.abs(Math.floor(2147483648*Math.random())^g.A()).toString(36));
return a},a6=function(a,b,c){Array.isArray(c)||(c=[String(c)]);
g.ln(a.C,b,c)},bHa=function(a,b){var c=[];
g.cj(b,function(d){try{var e=g.Zn.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.Yn(e)&&c.push(d)},a);
return c},cHa=function(a,b){var c=bHa(a,b);
g.Fb(c,function(d){g.Zn.prototype.remove.call(this,d)},a)},dHa=function(a){if(a.be){if(a.be.locationOverrideToken)return{locationOverrideToken:a.be.locationOverrideToken};
if(null!=a.be.latitudeE7&&null!=a.be.longitudeE7)return{latitudeE7:a.be.latitudeE7,longitudeE7:a.be.longitudeE7}}return null},eHa=function(a,b){g.nb(a,b)||a.push(b)},b6=function(a){var b=0,c;
for(c in a)b++;return b},fHa=function(a,b){var c=b instanceof g.Fc?b:g.Lc(b,/^data:image\//i.test(b));
a.src=g.Gc(c)},c6=function(){},gHa=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);},hHa=function(a){if(a.qf&&"function"==typeof a.qf)return a.qf();
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)},iHa=function(a,b){if(a.forEach&&"function"==typeof a.forEach)a.forEach(b,void 0);
else if(g.Ra(a)||"string"===typeof a)g.Fb(a,b,void 0);else{if(a.wg&&"function"==typeof a.wg)var c=a.wg();else if(a.qf&&"function"==typeof a.qf)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=hHa(a);e=d.length;for(var f=0;f<e;f++)b.call(void 0,d[f],c&&c[f],a)}},jHa=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},d6=function(a,b){g.Lo[a]=!0;
var c=g.Jo();c&&c.publish.apply(c,arguments);g.Lo[a]=!1},e6=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",kHa(this,a.capabilities||""),lHa(this,a.experiments||""))},kHa=function(a,b){a.capabilities.clear();
g.Ke(b.split(","),g.Va(aHa,mHa)).forEach(function(c){a.capabilities.add(c)})},lHa=function(a,b){a.experiments.clear();
b.split(",").forEach(function(c){a.experiments.add(c)})},f6=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||""},g6=function(a,b){return!!b&&(a.id==b||a.uuid==b)},nHa=function(a){return{name:a.name,
screenId:a.id,loungeToken:a.token,dialId:a.uuid}},oHa=function(a){return new f6(a)},pHa=function(a){return Array.isArray(a)?g.Pc(a,oHa):[]},h6=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"},i6=function(a){return Array.isArray(a)?"["+g.Pc(a,h6).join(",")+"]":"null"},j6=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)})},qHa=function(a){return g.Pc(a,function(b){return{key:b.id,
name:b.name}})},k6=function(a,b){return g.jb(a,function(c){return c||b?!c!=!b?!1:c.id==b.id:!0})},l6=function(a,b){return g.jb(a,function(c){return g6(c,b)})},rHa=function(){var a=(0,g.ut)();
a&&cHa(a,a.u.Ri(!0))},m6=function(){var a=g.xt("yt-remote-connected-devices")||[];
g.Cb(a);return a},sHa=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)})},tHa=function(a){g.wt("yt-remote-connected-devices",a,86400)},o6=function(){if(n6)return n6;
var a=g.xt("yt-remote-device-id");a||(a=j6(),g.wt("yt-remote-device-id",a,31536E3));for(var b=m6(),c=1,d=a;g.nb(b,d);)c++,d=a+"#"+c;return n6=d},p6=function(){var a=m6(),b=o6();
g.nb(a,b);g.At()&&g.Eb(a,b);a=sHa(a);if(g.ob(a))try{g.xq("remote_sid")}catch(c){}else try{g.vq("remote_sid",a.join(","),-1)}catch(c){}},uHa=function(){return g.xt("yt-remote-session-browser-channel")},vHa=function(){return g.xt("yt-remote-local-screens")||[]},wHa=function(){g.wt("yt-remote-lounge-token-expiration",!0,86400)},xHa=function(a){5<a.length&&(a=a.slice(a.length-5));
var b=g.Pc(vHa(),function(d){return d.loungeToken}),c=g.Pc(a,function(d){return d.loungeToken});
g.jh(c,function(d){return!g.nb(b,d)})&&wHa();
g.wt("yt-remote-local-screens",a,31536E3)},yHa=function(a,b){g.wt("yt-remote-session-browser-channel",a);
g.wt("yt-remote-session-screen-id",b);var c=m6(),d=o6();g.nb(c,d)||c.push(d);tHa(c);p6()},q6=function(a){a||(g.zt("yt-remote-session-screen-id"),g.zt("yt-remote-session-video-id"));
p6();a=m6();g.rb(a,o6());tHa(a)},zHa=function(){if(!r6){var a=g.jo();
a&&(r6=new g.Tn(a))}return r6?!!r6.get("yt-remote-use-staging-server"):!1},AHa=function(a){return!!document.currentScript&&(-1!=document.currentScript.src.indexOf("?"+a)||-1!=document.currentScript.src.indexOf("&"+a))},BHa=function(){return"function"==typeof window.__onGCastApiAvailable?window.__onGCastApiAvailable:null},s6=function(a){a.length?CHa(a.shift(),function(){s6(a)}):t6()},DHa=function(a){return"chrome-extension://"+a+"/cast_sender.js"},CHa=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)},t6=function(){var a=BHa();
a&&a(!1,"No cast extension found")},FHa=function(){if(EHa){var a=2,b=BHa(),c=function(){a--;
0==a&&b&&b(!0)};
window.__onGCastApiAvailable=c;CHa("//www.gstatic.com/cast/sdk/libs/sender/1.0/cast_framework.js",t6,c)}},GHa=function(){FHa();
var a=(a=window.navigator.userAgent.match(/Chrome\/([0-9]+)/))?parseInt(a[1],10):0;var b=[];if(0!=a){var c=a-1;b.push("//www.gstatic.com/eureka/clank/"+a+"/cast_sender.js");b.push("//www.gstatic.com/eureka/clank/"+c+"/cast_sender.js")}b.push("//www.gstatic.com/eureka/clank/cast_sender.js");s6(b)},u6=function(a,b,c){g.B.call(this);
this.G=null!=c?(0,g.z)(a,c):a;this.df=b;this.F=(0,g.z)(this.MI,this);this.u=!1;this.B=0;this.C=this.Wa=null;this.D=[]},v6=function(a,b,c){g.B.call(this);
this.D=null!=c?a.bind(c):a;this.df=b;this.C=null;this.u=!1;this.B=0;this.Wa=null},w6=function(a){a.Wa=g.Um(function(){a.Wa=null;
a.u&&!a.B&&(a.u=!1,w6(a))},a.df);
var b=a.C;a.C=null;a.D.apply(null,b)},x6=function(a){if(g.v.JSON)try{return g.v.JSON.parse(a)}catch(b){}return gHa(a)},y6=function(){},z6=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)},B6=function(a){A6.dispatchEvent(new HHa(A6,a))},HHa=function(a){g.Ll.call(this,"statevent",a)},C6=function(){},IHa=function(){},KHa=function(a){return(a=JHa(a))?new ActiveXObject(a):new XMLHttpRequest},JHa=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},D6=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.o1(this);this.C=new g.Tm;this.C.setInterval(250)},MHa=function(a,b,c){a.Wn=1;
a.Uj=$5(b.clone());a.gm=c;a.G=!0;LHa(a,null)},E6=function(a,b,c,d,e){a.Wn=1;
a.Uj=$5(b.clone());a.gm=null;a.G=c;e&&(a.IF=!1);LHa(a,d)},LHa=function(a,b){a.Nn=g.A();
F6(a);a.Kk=a.Uj.clone();a6(a.Kk,"t",a.K);a.Kq=0;a.ge=a.u.Jv(a.u.rq()?b:null);0<a.Aw&&(a.Yt=new v6((0,g.z)(a.IG,a,a.ge),a.Aw));a.D.wa(a.ge,"readystatechange",a.fQ);var c=a.Fl?g.Zb(a.Fl):{};a.gm?(a.Eu="POST",c["Content-Type"]="application/x-www-form-urlencoded",a.ge.send(a.Kk,a.Eu,a.gm,c)):(a.Eu="GET",a.IF&&!g.Ae&&(c.Connection="close"),a.ge.send(a.Kk,a.Eu,null,c));a.u.wh(1)},PHa=function(a,b,c){for(var d=!0;!a.kl&&a.Kq<c.length;){var e=NHa(a,c);
if(e==G6){4==b&&(a.kk=4,B6(15),d=!1);break}else if(e==OHa){a.kk=4;B6(16);d=!1;break}else H6(a,e)}4==b&&0==c.length&&(a.kk=1,B6(17),d=!1);a.Eh=a.Eh&&d;d||(I6(a),J6(a))},NHa=function(a,b){var c=a.Kq,d=b.indexOf("\n",c);
if(-1==d)return G6;c=Number(b.substring(c,d));if(isNaN(c))return OHa;d+=1;if(d+c>b.length)return G6;var e=b.substr(d,c);a.Kq=d+c;return e},RHa=function(a,b){a.Nn=g.A();
F6(a);var c=b?window.location.hostname:"";a.Kk=a.Uj.clone();Z5(a.Kk,"DOMAIN",c);Z5(a.Kk,"t",a.K);try{a.Jh=new ActiveXObject("htmlfile")}catch(n){I6(a);a.kk=7;B6(22);J6(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 K6)h=K6[h];else if(h in QHa)h=K6[h]=QHa[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=
K6[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.Jh.open();a.Jh.write(g.cd(c));a.Jh.close();a.Jh.parentWindow.m=(0,g.z)(a.sP,a);a.Jh.parentWindow.d=(0,g.z)(a.GE,a,!0);a.Jh.parentWindow.rpcClose=(0,g.z)(a.GE,a,!1);c=a.Jh.createElement("DIV");a.Jh.parentWindow.document.body.appendChild(c);d=g.Kc(a.Kk.toString());d=g.nd(g.Gc(d));d=g.gd(g.kc("b/12014412"),'<iframe src="'+d+'"></iframe>');g.hd(c,d);a.u.wh(1)},F6=function(a){a.mz=g.A()+a.F;
SHa(a,a.F)},SHa=function(a,b){if(null!=a.eo)throw Error("WatchDog timer not null");
a.eo=z6((0,g.z)(a.EP,a),b)},L6=function(a){a.eo&&(g.v.clearTimeout(a.eo),a.eo=null)},J6=function(a){a.u.GB()||a.kl||a.u.ks(a)},I6=function(a){L6(a);
g.eg(a.Yt);a.Yt=null;a.C.stop();g.wBa(a.D);if(a.ge){var b=a.ge;a.ge=null;b.abort();b.dispose()}a.Jh&&(a.Jh=null)},H6=function(a,b){try{a.u.yE(a,b),a.u.wh(4)}catch(c){}},UHa=function(a,b,c,d,e){if(0==d)c(!1);
else{var f=e||0;d--;THa(a,b,function(h){h?c(!0):g.v.setTimeout(function(){UHa(a,b,c,d,f)},f)})}},THa=function(a,b,c){var d=new Image;
d.onload=function(){try{M6(d),c(!0)}catch(e){}};
d.onerror=function(){try{M6(d),c(!1)}catch(e){}};
d.onabort=function(){try{M6(d),c(!1)}catch(e){}};
d.ontimeout=function(){try{M6(d),c(!1)}catch(e){}};
g.v.setTimeout(function(){if(d.ontimeout)d.ontimeout()},b);
fHa(d,a)},M6=function(a){a.onload=null;
a.onerror=null;a.onabort=null;a.ontimeout=null},N6=function(a){g.im.call(this);
this.headers=new g.Wm;this.ba=a||null;this.C=!1;this.Y=this.u=null;this.ra=this.P="";this.G=0;this.D="";this.F=this.ha=this.N=this.ea=!1;this.K=0;this.V=null;this.Aa="";this.X=this.da=!1},VHa=function(a){return g.ye&&g.Zd(9)&&"number"===typeof a.timeout&&void 0!==a.ontimeout},WHa=function(a){return"content-type"==a.toLowerCase()},YHa=function(a,b){a.C=!1;
a.u&&(a.F=!0,a.u.abort(),a.F=!1);a.D=b;a.G=5;XHa(a);O6(a)},XHa=function(a){a.ea||(a.ea=!0,a.dispatchEvent("complete"),a.dispatchEvent("error"))},$Ha=function(a){if(a.C&&"undefined"!=typeof g.t1)if(a.Y[1]&&4==P6(a)&&2==a.getStatus())Q6(a,"Local request error detected and ignored");
else if(a.N&&4==P6(a))g.Um(a.vE,0,a);else if(a.dispatchEvent("readystatechange"),4==P6(a)){Q6(a,"Request complete");a.C=!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=!ZHa.test(f?f.toLowerCase():"")}d=e}if(d)a.dispatchEvent("complete"),a.dispatchEvent("success");
else{a.G=6;try{var l=2<P6(a)?a.u.statusText:""}catch(m){l=""}a.D=l+" ["+a.getStatus()+"]";XHa(a)}}finally{O6(a)}}},O6=function(a,b){if(a.u){aIa(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){}}},aIa=function(a){a.u&&a.X&&(a.u.ontimeout=null);
a.V&&(g.v.clearTimeout(a.V),a.V=null)},P6=function(a){return a.u?a.u.readyState:0},R6=function(a){try{return a.u?a.u.responseText:""}catch(b){return""}},Q6=function(a,b){return b+" ["+a.ra+" "+a.P+" "+a.getStatus()+"]"},bIa=function(a){this.u=a;
this.B=new y6},cIa=function(a){var b=S6(a.u,a.yo,"/mail/images/cleardot.gif");
$5(b);UHa(b.toString(),5E3,(0,g.z)(a.KH,a),3,2E3);a.wh(1)},U6=function(a){var b=a.u.N;
if(null!=b)B6(5),b?(B6(11),T6(a.u,a,!1)):(B6(12),T6(a.u,a,!0));else if(a.Rf=new D6(a,void 0,void 0,void 0),a.Rf.Fl=a.yw,b=a.u,b=S6(b,b.rq()?a.ep:null,a.zw),B6(5),!g.ye||g.$d(10))a6(b,"TYPE","xmlhttp"),E6(a.Rf,b,!1,a.ep,!1);else{a6(b,"TYPE","html");var c=a.Rf;a=!!a.ep;c.Wn=3;c.Uj=$5(b.clone());RHa(c,a)}},V6=function(a,b,c){this.Ha=1;
this.u=[];this.C=[];this.D=new y6;this.K=a||null;this.N=null!=b?b:null;this.F=c||!1},eIa=function(a,b){this.u=a;
this.map=b;this.context=null},fIa=function(a,b,c,d){g.Ll.call(this,"timingevent",a);
this.size=b;this.hq=d},gIa=function(a){g.Ll.call(this,"serverreachability",a)},jIa=function(a){hIa(a);
if(3==a.Ha){var b=a.Mp++,c=a.Jr.clone();Z5(c,"SID",a.B);Z5(c,"RID",b);Z5(c,"TYPE","terminate");W6(a,c);b=new D6(a,a.B,b,void 0);b.Wn=2;b.Uj=$5(c.clone());fHa(new Image,b.Uj.toString());b.Nn=g.A();F6(b)}iIa(a)},kIa=function(a){a.jI(1,0);
a.Jr=S6(a,null,a.xw);X6(a)},hIa=function(a){a.Zj&&(a.Zj.abort(),a.Zj=null);
a.Ad&&(a.Ad.cancel(),a.Ad=null);a.Ti&&(g.v.clearTimeout(a.Ti),a.Ti=null);Y6(a);a.Hf&&(a.Hf.cancel(),a.Hf=null);a.dk&&(g.v.clearTimeout(a.dk),a.dk=null)},lIa=function(a,b){if(0==a.Ha)throw Error("Invalid operation: sending map when state is closed");
a.u.push(new eIa(a.bM++,b));2!=a.Ha&&3!=a.Ha||X6(a)},mIa=function(a){var b=0;
a.Ad&&b++;a.Hf&&b++;return b},X6=function(a){a.Hf||a.dk||(a.dk=z6((0,g.z)(a.FE,a),0),a.Qm=0)},oIa=function(a,b){if(1==a.Ha){if(!b){a.Mp=Math.floor(1E5*Math.random());
var c=a.Mp++,d=new D6(a,"",c,void 0);d.Fl=a.Vm;var e=Z6(a),f=a.Jr.clone();Z5(f,"RID",c);Z5(f,"CVER","1");W6(a,f);MHa(d,f,e);a.Hf=d;a.Ha=2}}else 3==a.Ha&&(b?nIa(a,b):0==a.u.length||a.Hf||nIa(a))},nIa=function(a,b){if(b)if(6<a.ll){a.u=a.C.concat(a.u);
a.C.length=0;var c=a.Mp-1;var d=Z6(a)}else c=b.N,d=b.gm;else c=a.Mp++,d=Z6(a);var e=a.Jr.clone();Z5(e,"SID",a.B);Z5(e,"RID",c);Z5(e,"AID",a.gn);W6(a,e);c=new D6(a,a.B,c,a.Qm+1);c.Fl=a.Vm;c.setTimeout(1E4+Math.round(1E4*Math.random()));a.Hf=c;MHa(c,e,d)},W6=function(a,b){if(a.af){var c=a.af.iB();
c&&g.Ib(c,function(d,e){Z5(b,e,d)})}},Z6=function(a){var b=Math.min(a.u.length,1E3),c=["count="+b];
if(6<a.ll&&0<b){var d=a.u[0].u;c.push("ofs="+d)}else d=0;for(var e={},f=0;f<b;e={ym:e.ym},f++){e.ym=a.u[f].u;var h=a.u[f].map;e.ym=6>=a.ll?f:e.ym-d;try{g.Ib(h,function(l){return function(m,n){c.push("req"+l.ym+"_"+n+"="+encodeURIComponent(m))}}(e))}catch(l){c.push("req"+e.ym+"_type="+encodeURIComponent("_badmap"))}}a.C=a.C.concat(a.u.splice(0,b));
return c.join("&")},pIa=function(a){a.Ad||a.Ti||(a.G=1,a.Ti=z6((0,g.z)(a.EE,a),0),a.Cm=0)},$6=function(a){if(a.Ad||a.Ti||3<=a.Cm)return!1;
a.G++;a.Ti=z6((0,g.z)(a.EE,a),qIa(a,a.Cm));a.Cm++;return!0},T6=function(a,b,c){a.Bu=c;
a.hi=b.gj;a.F||kIa(a)},Y6=function(a){null!=a.rl&&(g.v.clearTimeout(a.rl),a.rl=null)},qIa=function(a,b){var c=5E3+Math.floor(1E4*Math.random());
a.isActive()||(c*=2);return c*b},a7=function(a,b){if(2==b||9==b){var c=null;
a.af&&(c=null);var d=(0,g.z)(a.PQ,a);c||(c=new g.Zm("//www.google.com/images/cleardot.gif"),$5(c));THa(c.toString(),1E4,d)}else B6(2);rIa(a,b)},rIa=function(a,b){a.Ha=0;
a.af&&a.af.uA(b);iIa(a);hIa(a)},iIa=function(a){a.Ha=0;
a.hi=-1;if(a.af)if(0==a.C.length&&0==a.u.length)a.af.xv();else{g.ub(a.C);var b=g.ub(a.u);a.C.length=0;a.u.length=0;a.af.xv(b)}},S6=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=jHa(e.protocol,b?b+"."+e.hostname:e.hostname,+e.port,c)}a.Oo&&g.Ib(a.Oo,function(f,h){Z5(d,h,f)});
Z5(d,"VER",a.ll);W6(a,d);return d},sIa=function(){},tIa=function(){this.u=[];
this.B=[]},uIa=function(a,b){this.action=a;
this.params=b||{}},b7=function(a,b){g.B.call(this);
this.u=new g.G(this.lP,0,this);g.C(this,this.u);this.df=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},c7=function(a,b,c,d){c=void 0===c?!1:c;
d=void 0===d?function(){return""}:d;
this.V=a;this.G=b;this.C=new g.Sn;this.B=new b7(this.rQ,this);this.u=null;this.Rd=!1;this.F=null;this.P="";this.N=this.D=0;this.K=[];this.Y=c;this.X=d},vIa=function(a){return{firstTestResults:[""],
secondTestResults:!a.u.Bu,sessionId:a.u.B,arrayId:a.u.gn}},wIa=function(a,b){a.N=b||0;
a.B.stop();d7(a);a.u&&(3==a.u.getState()&&oIa(a.u),jIa(a.u));a.N=0},e7=function(a){return!!a.u&&3==a.u.getState()},d7=function(a){if(a.u){var b=a.X(),c=a.u.Vm||{};
b?c["x-youtube-lounge-xsrf-token"]=b:delete c["x-youtube-lounge-xsrf-token"];a.u.Vm=c}},xIa=function(a,b){(a.G.loungeIdToken=b)||a.B.stop()},f7=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))},g7=function(a,b){var c=a.u;
a.B&&(c=a.scheme+"://"+a.domain+a.port+a.u);return g.Jd(c+b,{})},h7=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),kg:g.Va(a.F,e)};c&&(a.fc=c,a.headers={"Content-Type":"application/x-www-form-urlencoded"});return g.pq(b,a)},BIa=function(){var a=yIa;
zIa();i7.push(a);AIa(i7)},j7=function(a,b){zIa();
var c=i7,d=CIa(a,String(b));g.ob(c)?DIa(d):(AIa(c),g.Fb(c,function(e){e(d)}))},zIa=function(){i7||(i7=g.Na("yt.mdx.remote.debug.handlers_")||[],g.Ia("yt.mdx.remote.debug.handlers_",i7,void 0))},DIa=function(a){var b=(k7+1)%50;
k7=b;l7[b]=a;m7||(m7=49==b)},AIa=function(a){var b=l7;
if(b[0]){var c=k7,d=m7?c:-1;do{d=(d+1)%50;var e=b[d];g.Fb(a,function(f){f(e)})}while(d!=c);
l7=Array(50);k7=-1;m7=!1}},CIa=function(a,b){var c=(g.A()-EIa)/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("")},n7=function(a){g.P.call(this);
this.G=a;this.screens=[]},FIa=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},GIa=function(a,b){var c=a.screens.length!=b.length;
a.screens=g.Ke(a.screens,function(f){return!!k6(b,f)});
for(var d=0,e=b.length;d<e;d++)c=FIa(a,b[d])||c;return c},HIa=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},o7=function(a,b,c,d){g.P.call(this);
this.G=a;this.F=b;this.C=c;this.D=d;this.B=0;this.u=null;this.Wa=NaN},q7=function(a){n7.call(this,"LocalScreenService");
this.B=a;this.u=NaN;p7(this);this.info("Initializing with "+i6(this.screens))},IIa=function(a){if(a.screens.length){var b=g.Pc(a.screens,function(d){return d.id}),c=g7(a.B,"/pairing/get_lounge_token_batch");
h7(a.B,c,{screen_ids:b.join(",")},(0,g.z)(a.WI,a),(0,g.z)(a.VI,a))}},p7=function(a){if(g.vo("deprecate_pair_servlet_enabled"))return GIa(a,[]);
var b=pHa(vHa());b=g.Ke(b,function(c){return!c.uuid});
return GIa(a,b)},r7=function(a,b){xHa(g.Pc(a.screens,nHa));
b&&wHa()},t7=function(a,b){g.P.call(this);
this.G=b;var c=g.xt("yt-remote-online-screen-ids")||"";c=c?c.split(","):[];for(var d={},e=this.G(),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;s7("Initialized with "+g.Fj(this.u))},JIa=function(a,b,c){var d=g7(a.F,"/pairing/get_screen_availability");
h7(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))},u7=function(a,b){a:if(b6(b)!=b6(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||(s7("Updated online screens: "+g.Fj(a.u)),a.u=b,a.W("screenChange"));KIa(a)},v7=function(a){isNaN(a.C)||g.Io(a.C);
a.C=g.Go((0,g.z)(a.ny,a),0<a.D&&a.D<g.A()?2E4:1E4)},s7=function(a){j7("OnlineScreenService",a)},LIa=function(a){var b={};
g.Fb(a.G(),function(c){c.token?b[c.token]=c.id:this.cd("Requesting availability of screen w/o lounge token.")});
return b},KIa=function(a){a=g.Qb(g.Jb(a.u,function(b){return b}));
g.Cb(a);a.length?g.wt("yt-remote-online-screen-ids",a.join(","),60):g.zt("yt-remote-online-screen-ids")},w7=function(a){n7.call(this,"ScreenService");
this.F=a;this.u=this.B=null;this.C=[];this.D={};MIa(this)},OIa=function(a,b,c,d,e,f){a.info("getAutomaticScreenByIds "+c+" / "+b);
c||(c=a.D[b]);var h=a.Zf();if(h=(c?l6(h,c):null)||l6(h,b)){h.uuid=b;var l=x7(a,h);JIa(a.u,l,function(m){e(m?l:null)})}else c?NIa(a,c,(0,g.z)(function(m){var n=x7(this,new f6({name:d,
screenId:c,loungeToken:m,dialId:b||""}));JIa(this.u,n,function(p){e(p?n:null)})},a),f):e(null)},PIa=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},NIa=function(a,b,c,d){a.info("requestLoungeToken_ for "+b);
var e={fc:{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.pq(g7(a.F,"/pairing/get_lounge_token_batch"),e)},QIa=function(a){a.screens=a.B.Zf();
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: "+i6(a.screens))},MIa=function(a){y7(a);
a.B=new q7(a.F);a.B.subscribe("screenChange",(0,g.z)(a.dJ,a));QIa(a);a.C=pHa(g.xt("yt-remote-automatic-screen-cache")||[]);y7(a);a.info("Initializing automatic screens: "+i6(a.C));a.u=new t7(a.F,(0,g.z)(a.Zf,a,!0));a.u.subscribe("screenChange",(0,g.z)(function(){this.W("onlineScreenChange")},a))},x7=function(a,b){var c=a.get(b.id);
c?(c.uuid=b.uuid,b=c):((c=l6(a.C,b.uuid))?(c.id=b.id,c.token=b.token,b=c):a.C.push(b),g.wt("yt-remote-automatic-screen-cache",g.Pc(a.C,nHa)));y7(a);a.D[b.uuid]=b.id;g.wt("yt-remote-device-id-map",a.D,31536E3);return b},y7=function(a){a.D=g.xt("yt-remote-device-id-map")||{}},z7=function(a,b,c){g.P.call(this);
this.Y=c;this.N=a;this.u=b;this.K=null},A7=function(a,b){j7(a.Y,b)},B7=function(a,b){z7.call(this,a,b,"CastSession");
this.B=null;this.C=0;this.F=(0,g.z)(this.BR,this);this.D=(0,g.z)(this.LP,this);this.C=g.Go((0,g.z)(function(){RIa(this,null)},this),12E4)},SIa=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(){A7(this,"Failed to send message: getMdxSessionStatus.")},a)):A7(a,"Sending yt message without session: "+g.Fj(b))},RIa=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.Ot,a),d=(0,g.z)(a.hg,a);a.zB(b,c,d,5)}}else a.hg(Error("Waiting for session status timed out."))},C7=function(a,b,c){z7.call(this,a,b,"DialSession");
this.C=this.G=null;this.P="";this.ba=c;this.V=null;this.F=g.Oa;this.D=NaN;this.X=(0,g.z)(this.ER,this);this.B=g.Oa},TIa=function(a){a.B=a.N.PG(a.P,a.u.label,a.u.friendlyName,(0,g.z)(function(b){this.B=g.Oa;
this.Ot(b)},a),(0,g.z)(function(b){this.B=g.Oa;
this.hg(b)},a))},UIa=function(a){var b={};
b.pairingCode=a.P;b.theme=a.ba;zHa()&&(b.env_useStageMdx=1);return g.Hd(b)},D7=function(a,b){z7.call(this,a,b,"ManualSession");
this.B=g.Go((0,g.z)(this.hn,this,null),150)},E7=function(a,b,c,d){g.P.call(this);
this.B=a;this.K=b||"233637DE";this.G=c||"cl";this.N=d||!1;this.u=null;this.F=!1;this.C=[];this.D=(0,g.z)(this.DO,this)},VIa=function(a,b){return b?g.jb(a.C,function(c){return g6(b,c.label)},a):null},F7=function(a){j7("Controller",a)},yIa=function(a){window.chrome&&chrome.cast&&chrome.cast.logMessage&&chrome.cast.logMessage(a)},G7=function(a){return a.F||!!a.C.length||!!a.u},H7=function(a,b,c){b!=a.u&&(g.eg(a.u),(a.u=b)?(c?a.W("yt-remote-cast2-receiver-resumed",b.u):a.W("yt-remote-cast2-receiver-selected",
b.u),b.subscribe("sessionScreen",(0,g.z)(a.CE,a,b)),b.getScreen()?a.W("yt-remote-cast2-session-change",b.getScreen()):c&&a.u.hn(null)):a.W("yt-remote-cast2-session-change",null))},WIa=function(a){var b=a.B.OG(),c=a.u&&a.u.u;
a=g.Pc(b,function(d){c&&g6(d,c.label)&&(c=null);var e=d.uuid?d.uuid:d.id,f=VIa(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},bJa=function(a,b,c,d,e,f,h){XIa()?YIa(b,e,f,h)&&(J7(!0),window.chrome&&chrome.cast&&chrome.cast.isAvailable?ZIa(a,c):(window.__onGCastApiAvailable=function(l,m){l?ZIa(a,c):(K7("Failed to load cast API: "+m),L7(!1),J7(!1),g.zt("yt-remote-cast-available"),g.zt("yt-remote-cast-receiver"),$Ia(),c(!1))},d?g.To("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?GHa():!window.chrome||!window.navigator.presentation||0<=window.navigator.userAgent.indexOf("Edge")?t6():(FHa(),s6(aJa.map(DHa))))):I7("Cannot initialize because not running Chrome")},$Ia=function(){I7("dispose");
var a=M7();a&&a.dispose();g.Ia("yt.mdx.remote.cloudview.instance_",null,void 0);cJa(!1);g.Oo(N7);N7.length=0},O7=function(){return!!g.xt("yt-remote-cast-installed")},dJa=function(){var a=g.xt("yt-remote-cast-receiver");
return a?a.friendlyName:null},eJa=function(){I7("clearCurrentReceiver");
g.zt("yt-remote-cast-receiver")},fJa=function(){return O7()?M7()?M7().getCastSession():(K7("getCastSelector: Cast is not initialized."),null):(K7("getCastSelector: Cast API is not installed!"),null)},Q7=function(){O7()?M7()?P7()?(I7("Requesting cast selector."),M7().requestSession()):(I7("Wait for cast API to be ready to request the session."),N7.push(g.No("yt-remote-cast2-api-ready",Q7))):K7("requestCastSelector: Cast is not initialized."):K7("requestCastSelector: Cast API is not installed!")},R7=
function(a,b){P7()?M7().setConnectedScreenStatus(a,b):K7("setConnectedScreenStatus called before ready.")},XIa=function(){var a=0<=g.Vc.search(/ (CrMo|Chrome|CriOS)\//);
return g.AB||a},gJa=function(a,b){M7().init(a,b)},YIa=function(a,b,c,d){var e=!1;
M7()||(a=new E7(a,b,c,d),a.subscribe("yt-remote-cast2-availability-change",function(f){g.wt("yt-remote-cast-available",f);d6("yt-remote-cast2-availability-change",f)}),a.subscribe("yt-remote-cast2-receiver-selected",function(f){I7("onReceiverSelected: "+f.friendlyName);
g.wt("yt-remote-cast-receiver",f);d6("yt-remote-cast2-receiver-selected",f)}),a.subscribe("yt-remote-cast2-receiver-resumed",function(f){I7("onReceiverResumed: "+f.friendlyName);
g.wt("yt-remote-cast-receiver",f)}),a.subscribe("yt-remote-cast2-session-change",function(f){I7("onSessionChange: "+h6(f));
f||g.zt("yt-remote-cast-receiver");d6("yt-remote-cast2-session-change",f)}),g.Ia("yt.mdx.remote.cloudview.instance_",a,void 0),e=!0);
I7("cloudview.createSingleton_: "+e);return e},M7=function(){return g.Na("yt.mdx.remote.cloudview.instance_")},ZIa=function(a,b){L7(!0);
J7(!1);gJa(a,function(c){c?(cJa(!0),g.Qo("yt-remote-cast2-api-ready")):(K7("Failed to initialize cast API."),L7(!1),g.zt("yt-remote-cast-available"),g.zt("yt-remote-cast-receiver"),$Ia());b(c)})},I7=function(a){j7("cloudview",a)},K7=function(a){j7("cloudview",a)},L7=function(a){I7("setCastInstalled_ "+a);
g.wt("yt-remote-cast-installed",a)},P7=function(){return!!g.Na("yt.mdx.remote.cloudview.apiReady_")},cJa=function(a){I7("setApiReady_ "+a);
g.Ia("yt.mdx.remote.cloudview.apiReady_",a,void 0)},J7=function(a){g.Ia("yt.mdx.remote.cloudview.initializing_",a,void 0)},S7=function(a){this.index=-1;
this.videoId=this.listId="";this.volume=this.playerState=-1;this.muted=!1;this.audioTrackId=null;this.G=this.K=0;this.u=null;this.hasNext=this.ii=!1;this.P=this.N=this.B=this.F=0;this.D=NaN;this.C=!1;this.reset(a)},T7=function(a){a.audioTrackId=null;
a.u=null;a.playerState=-1;a.ii=!1;a.hasNext=!1;a.K=0;a.G=g.A();a.F=0;a.B=0;a.N=0;a.P=0;a.D=NaN;a.C=!1},U7=function(a){return a.Kb()?(g.A()-a.G)/1E3:0},V7=function(a,b){a.K=b;
a.G=g.A()},W7=function(a){switch(a.playerState){case 1:case 1081:return(g.A()-a.G)/1E3+a.K;
case -1E3:return 0}return a.K},X7=function(a,b,c){var d=a.videoId;
a.videoId=b;a.index=c;b!=d&&T7(a)},Y7=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.ii;b.hasNext=a.hasNext;b.playerTime=a.K;b.playerTimeAt=a.G;b.seekableStart=a.F;b.seekableEnd=a.B;b.duration=a.N;b.loadedTime=a.P;b.liveIngestionTime=a.D;return b},$7=function(a,b){g.P.call(this);
this.Ha=0;this.C=a;this.F=[];this.D=new tIa;this.B=this.u=null;this.N=(0,g.z)(this.QM,this);this.G=(0,g.z)(this.Op,this);this.K=(0,g.z)(this.PM,this);this.P=(0,g.z)(this.XM,this);var c=0;a?(c=a.getProxyState(),3!=c&&(a.subscribe("proxyStateChange",this.pz,this),hJa(this))):c=3;0!=c&&(b?this.pz(c):g.Go((0,g.z)(function(){this.pz(c)},this),0));
var d=fJa();d&&Z7(this,d);this.subscribe("yt-remote-cast2-session-change",this.P)},a8=function(a){return new S7(a.C.getPlayerContextData())},hJa=function(a){g.Fb("nowAutoplaying autoplayDismissed remotePlayerChange remoteQueueChange autoplayModeChange autoplayUpNext previousNextChange".split(" "),function(b){this.F.push(this.C.subscribe(b,g.Va(this.zO,b),this))},a)},iJa=function(a){g.Fb(a.F,function(b){this.C.unsubscribeByKey(b)},a);
a.F.length=0},b8=function(a){return 1==a.getState()},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=a8(a);
V7(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){iJa(a);
a.C.setPlayerContextData(Y7(b));hJa(a)},Z7=function(a,b){a.B&&(a.B.removeUpdateListener(a.N),a.B.removeMediaListener(a.G),a.Op(null));
a.B=b;a.B&&(j7("CP","Setting cast session: "+a.B.sessionId),a.B.addUpdateListener(a.N),a.B.addMediaListener(a.G),a.B.media.length&&a.Op(a.B.media[0]))},jJa=function(a){var b=a.u.media,c=a.u.customData;
if(b&&c){var d=a8(a);b.contentId!=d.videoId&&j7("CP","Cast changing video to: "+b.contentId);d.videoId=b.contentId;d.playerState=c.playerState;V7(d,a.u.getEstimatedTime());d8(a,d)}else j7("CP","No cast media video. Ignoring state update.")},g8=function(a,b,c){return(0,g.z)(function(d){this.cd("Failed to "+b+" with cast v2 channel. Error code: "+d.code);
d.code!=chrome.cast.ErrorCode.TIMEOUT&&(this.cd("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.V=NaN;this.Y=[];this.D=this.G=this.C=this.Db=this.u=null;this.ea=a;this.Y.push(g.dp(window,"beforeunload",(0,g.z)(this.OI,this)));this.B=[];this.Db=new S7;this.ba=b.id;this.u=kJa(this,c);this.u.subscribe("handlerOpened",this.UM,this);this.u.subscribe("handlerClosed",this.RM,this);this.u.subscribe("handlerError",this.SM,this);this.u.subscribe("handlerMessage",this.TM,this);xIa(this.u,b.token);this.subscribe("remoteQueueChange",function(){var d=this.Db.videoId;
g.At()&&g.wt("yt-remote-session-video-id",d)},this)},i8=function(a){j7("conn",a)},kJa=function(a,b){return new c7(g7(a.ea,"/bc"),b,!1,function(){return a.LG()})},j8=function(a,b){a.W("proxyStateChange",b)},lJa=function(a){a.F=g.Go((0,g.z)(function(){i8("Connecting timeout");
this.Lm(1)},a),2E4)},k8=function(a){g.Io(a.F);
a.F=NaN},l8=function(a){g.Io(a.V);
a.V=NaN},mJa=function(a){m8(a);
a.P=g.Go((0,g.z)(function(){n8(this,"getNowPlaying")},a),2E4)},m8=function(a){g.Io(a.P);
a.P=NaN},oJa=function(a,b){b&&(k8(a),l8(a));
var c=e7(a.u)&&isNaN(a.F);b==c?b&&(j8(a,1),n8(a,"getSubtitlesTrack")):b?(a.xB()&&a.Db.reset(),j8(a,1),n8(a,"getNowPlaying"),nJa(a)):a.Lm(1)},pJa=function(a,b){var c=b.params.videoId;
delete b.params.videoId;c==a.Db.videoId&&(g.Wb(b.params)?a.Db.u=null:a.Db.u=b.params,a.W("remotePlayerChange"))},qJa=function(a,b){var c=b.params.videoId||b.params.video_id,d=parseInt(b.params.currentIndex,10);
a.Db.listId=b.params.listId||a.Db.listId;X7(a.Db,c,d);a.W("remoteQueueChange")},sJa=function(a,b){b.params=b.params||{};
qJa(a,b);rJa(a,b);a.W("autoplayDismissed")},rJa=function(a,b){var c=parseInt(b.params.currentTime||b.params.current_time,10);
V7(a.Db,isNaN(c)?0:c);c=parseInt(b.params.state,10);c=isNaN(c)?-1:c;-1==c&&-1E3==a.Db.playerState&&(c=-1E3);a.Db.playerState=c;c=Number(b.params.loadedTime);a.Db.P=isNaN(c)?0:c;c=Number(b.params.duration);a.Db.N=isNaN(c)?0:c;c=a.Db;var d=Number(b.params.liveIngestionTime);c.D=d;c.C=isNaN(d)?!1:!0;c=a.Db;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.Db.playerState?mJa(a):m8(a);a.W("remotePlayerChange")},tJa=function(a,b){if(-1E3!=
a.Db.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.Db.playerState=c;c=parseInt(b.params.currentTime,10);V7(a.Db,isNaN(c)?0:c);a.W("remotePlayerChange")}},uJa=function(a,b){var c="true"==b.params.muted;
a.Db.volume=parseInt(b.params.volume,10);a.Db.muted=c;a.W("remotePlayerChange")},vJa=function(a,b){a.G=b.params.videoId;
a.W("nowAutoplaying",parseInt(b.params.timeout,10))},wJa=function(a,b){var c="true"==b.params.hasNext;
a.Db.ii="true"==b.params.hasPrevious;a.Db.hasNext=c;a.W("previousNextChange")},nJa=function(a){g.Io(a.N);
a.N=g.Go((0,g.z)(a.Lm,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){n7.call(this,"ScreenServiceProxy");
this.cf=a;this.u=[];this.u.push(this.cf.$_s("screenChange",(0,g.z)(this.zR,this)));this.u.push(this.cf.$_s("onlineScreenChange",(0,g.z)(this.fO,this)))},BJa=function(a,b){b=g.L("MDX_CONFIG")||b;
rHa();p6();p8||(p8=new f7(b?b.loungeApiHost:void 0),zHa()&&(p8.u="/api/loungedev"));q8||(q8=g.Na("yt.mdx.remote.deferredProxies_")||[],g.Ia("yt.mdx.remote.deferredProxies_",q8,void 0));xJa();var c=r8();if(!c){var d=new w7(p8);g.Ia("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);bJa(a,d,function(m){m?s8()&&R7(s8(),"YouTube TV"):d.subscribe("onlineScreenChange",function(){d6("yt-remote-receiver-availability-change")})},
e,f,h,l)}b&&!g.Na("yt.mdx.remote.initialized_")&&(g.Ia("yt.mdx.remote.initialized_",!0,void 0),t8("Initializing: "+g.Fj(b)),u8.push(g.No("yt-remote-cast2-availability-change",function(){d6("yt-remote-receiver-availability-change")})),u8.push(g.No("yt-remote-cast2-receiver-selected",function(){v8(null);
d6("yt-remote-auto-connect","cast-selector-receiver")})),u8.push(g.No("yt-remote-cast2-receiver-resumed",function(){d6("yt-remote-receiver-resumed","cast-selector-receiver")})),u8.push(g.No("yt-remote-cast2-session-change",yJa)),u8.push(g.No("yt-remote-connection-change",function(m){m?R7(s8(),"YouTube TV"):w8()||(R7(null,null),eJa())})),e=x8(),b.isAuto&&(e.id+="#dial"),g.vo("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)),zJa(e),c.start(),s8()||AJa())},DJa=function(){var a=CJa();
O7()&&g.xt("yt-remote-cast-available")&&a.push({key:"cast-selector-receiver",name:"Cast..."});return a},CJa=function(){var a=r8().cf.$_gos();
var b=y8();b&&z8()&&(k6(a,b)||a.push(b));return qHa(a)},A8=function(){var a=EJa();
!a&&O7()&&dJa()&&(a={key:"cast-selector-receiver",name:dJa()});return a},EJa=function(){var a=CJa(),b=y8();
b||(b=w8());return g.jb(a,function(c){return b&&g6(b,c.key)?!0:!1})},y8=function(){var a=s8();
if(!a)return null;var b=r8().Zf();return l6(b,a)},yJa=function(a){t8("remote.onCastSessionChange_: "+h6(a));
if(a){var b=y8();b&&b.id==a.id?R7(b.id,"YouTube TV"):(b&&B8(),C8(a,1))}else z8()&&B8()},B8=function(){P7()?M7().stopSession():K7("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){j7("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_")},FJa=function(a){g.Ia("yt.mdx.remote.currentScreenId_",a,void 0)},GJa=function(){return g.Na("yt.mdx.remote.connectData_")},v8=function(a){g.Ia("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||FJa("");g.Ia("yt.mdx.remote.connection_",a,void 0);q8&&(g.Fb(q8,function(c){c(a)}),q8.length=0);
b&&!a?d6("yt-remote-connection-change",!1):!b&&a&&d6("yt-remote-connection-change",!0)},w8=function(){var a=g.At();
if(!a)return null;var b=r8();if(!b)return null;b=b.Zf();return l6(b,a)},C8=function(a,b){s8();
y8()&&y8();if(G8)H8=a;else{FJa(a.id);var c=new h8(p8,a,x8());c.connect(b,GJa());c.subscribe("beforeDisconnect",function(d){d6("yt-remote-before-disconnect",d)});
c.subscribe("beforeDispose",function(){z8()&&(z8(),D8(null))});
D8(c)}},AJa=function(){var a=w8();
a?(t8("Resume connection to: "+h6(a)),C8(a,0)):(q6(),eJa(),t8("Skipping connecting because no session screen found."))},xJa=function(){var a=x8();
if(g.Wb(a)){a=o6();var b=g.xt("yt-remote-session-name")||"",c=g.xt("yt-remote-session-app")||"";a={device:"REMOTE_CONTROL",id:a,name:b,app:c,mdxVersion:3};g.Ia("yt.mdx.remote.channelParams_",a,void 0)}},x8=function(){return g.Na("yt.mdx.remote.channelParams_")||{}},zJa=function(a){a?(g.wt("yt-remote-session-app",a.app),g.wt("yt-remote-session-name",a.name)):(g.zt("yt-remote-session-app"),g.zt("yt-remote-session-name"));
g.Ia("yt.mdx.remote.channelParams_",a,void 0)},I8=function(a,b,c){g.B.call(this);
var d=this;this.B=a;this.J=b;this.vb=c;this.events=new g.rs(this);this.V=this.events.R(this.J,"onVolumeChange",this.fE);this.F=!1;this.suggestion=null;this.G=new g.FL(64);this.u=new g.G(this.RF,500,this);this.C=new g.G(this.SF,1E3,this);this.N=new u6(this.dR,0,this);this.D={};this.P=new g.G(this.wG,1E3,this);this.K=new v6(this.seekTo,1E3,this);this.X=g.Oa;g.C(this,this.events);this.events.R(b,"onCaptionsTrackListChanged",this.IN);this.events.R(b,"captionschanged",this.MM);this.events.R(b,"captionssettingschanged",
this.VF);this.events.R(b,"videoplayerreset",this.Pt);this.events.R(b,"mdxautoplaycancel",function(){d.vb.RA()});
a=this.vb;a.la();a.subscribe("proxyStateChange",this.xE,this);a.subscribe("remotePlayerChange",this.Tp,this);a.subscribe("remoteQueueChange",this.Pt,this);a.subscribe("previousNextChange",this.uE,this);a.subscribe("nowAutoplaying",this.pE,this);a.subscribe("autoplayDismissed",this.QD,this);g.C(this,this.u);g.C(this,this.C);g.C(this,this.N);g.C(this,this.P);g.C(this,this.K);this.VF();this.Pt();this.Tp()},HJa=function(a){a.Hc(0);
a.u.stop();a.Pd(new g.FL(64))},K8=function(a,b){if(J8(a)&&!a.F){var c=null;
b&&(c={style:a.J.getSubtitlesUserSettings()},g.bc(c,b));a.vb.MG(a.J.getVideoData(1).videoId,c);a.D=a8(a.vb).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.vb.playVideo(c.videoId,b,d,e,c.playerParams,c.zg,dHa(c));a.Pd(new g.FL(1))},IJa=function(a,b){if(b){var c=a.J.getOption("captions","tracklist",{XB:1});
c&&c.length?(a.J.setOption("captions","track",b),a.F=!1):(a.J.loadModule("captions"),a.F=!0)}else a.J.setOption("captions","track",{})},J8=function(a){return a8(a.vb).videoId===a.J.getVideoData(1).videoId},M8=function(){g.V.call(this,{I:"div",
L:"ytp-mdx-manual-pairing-popup-dialog",U:{role:"dialog"},S:[{I:"div",L:"ytp-mdx-manual-pairing-popup-dialog-inner-content",S:[{I:"div",L:"ytp-mdx-manual-pairing-popup-title",Z:"Connecting to your TV on web using a code will be going away soon"},{I:"div",L:"ytp-mdx-manual-pairing-popup-buttons",S:[{I:"button",ia:["ytp-button","ytp-mdx-manual-pairing-popup-learn-more"],Z:"Learn more"},{I:"button",ia:["ytp-button","ytp-mdx-manual-pairing-popup-ok"],Z:"OK"}]}]}]});this.u=new g.oO(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,{I:"div",
L:"ytp-mdx-popup-dialog",U:{role:"dialog"},S:[{I:"div",L:"ytp-mdx-popup-dialog-inner-content",S:[{I:"div",L:"ytp-mdx-popup-title",Z:"You're signed out"},{I:"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."},{I:"div",L:"ytp-mdx-privacy-popup-buttons",S:[{I:"button",ia:["ytp-button","ytp-mdx-privacy-popup-cancel"],Z:"Cancel"},{I:"button",ia:["ytp-button","ytp-mdx-privacy-popup-confirm"],
Z:"Confirm"}]}]}]});this.u=new g.oO(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,{I:"div",
L:"ytp-remote",S:[{I:"div",L:"ytp-remote-display-status",S:[{I:"div",L:"ytp-remote-display-status-icon",S:[g.QN()]},{I:"div",L:"ytp-remote-display-status-text",Z:"{{statustext}}"}]}]});this.api=a;this.u=new g.oO(this,250);g.C(this,this.u);this.R(a,"presentingplayerstatechange",this.B);JJa(this,g.AJ(a))},JJa=function(a,b){if(3===a.api.getPresentingPlayerType()){var c={RECEIVER_NAME:a.api.getOption("remote","currentReceiver").name};
c=g.U(b,128)?g.yK("Error on $RECEIVER_NAME",c):b.Kb()||g.U(b,4)?g.yK("Playing on $RECEIVER_NAME",c):g.yK("Connected to $RECEIVER_NAME",c);a.ua("statustext",c);a.u.show()}else a.u.hide()},P8=function(a,b){g.b_.call(this,"Play on",0,a,b);
this.J=a;this.Jk={};this.R(a,"onMdxReceiversChange",this.D);this.R(a,"presentingplayerstatechange",this.D);this.D()},Q8=function(a){g.HS.call(this,a);
this.mh={key:j6(),name:"This computer"};this.Th=null;this.subscriptions=[];this.Xx=this.vb=null;this.Jk=[this.mh];this.bk=this.mh;this.Bc=new g.FL(64);this.tC=0;this.pe=-1;this.kn=null;this.Vp=this.Ts=!1;this.fm=this.In=null;if(!g.AC(this.player.T())){a=this.player;var b=g.ZW(a);b&&(b=b.Cl())&&(b=new P8(a,b),g.C(this,b));b=new O8(a);g.C(this,b);g.DP(a,b.element,4);this.In=new N8;g.C(this,this.In);g.DP(a,this.In.element,4);g.R(this.player.T().experiments,"pair_servlet_deprecation_warning_enabled")&&
!g.R(this.player.T().experiments,"deprecate_pair_servlet_enabled")&&(this.kn=new M8,g.C(this,this.kn),g.DP(a,this.kn.element,4));this.Vp=!!w8();this.Ts=!!g.xt("yt-remote-manual-pairing-warning-shown")}},R8=function(a){a.fm&&(a.player.removeEventListener("presentingplayerstatechange",a.fm),a.fm=null)},KJa=function(a,b,c){a.Bc=c;
a.player.W("presentingplayerstatechange",new g.KJ(c,b))},LJa=function(a,b,c){var d=!1;
1===b?d=!a.Vp:2===b&&(d=!a.Ts);d&&g.MJ(c,8)&&(a.player.pauseVideo(),R8(a))},S8=function(a,b){if(b.key!==a.bk.key)if(b.key===a.mh.key)B8();
else{if(a.kn&&!a.Ts&&b!==a.mh&&"cast-selector-receiver"!==b.key&&g.KC(a.player.T()))MJa(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.Vp||!a.In);(c?0:g.KC(a.player.T())||g.OC(a.player.T()))&&NJa(a)}a.bk=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.La(l).videoId}else h=[e];f=a.player.getCurrentTime(1);d={videoIds:h,listId:d,videoId:e,playerParams:c.playerParams,clickTrackingParams:c.zg,index:Math.max(a.player.getPlaylistIndex(),0),currentTime:0===f?void 0:f};(c=dHa(c))&&(d.locationInfo=c);c=d}t8("Connecting to: "+g.Fj(b));"cast-selector-receiver"==b.key?(v8(c||null),c=
c||null,P7()?M7().setLaunchParams(c):K7("setLaunchParams called before ready.")):!c&&E8()&&s8()==b.key?d6("yt-remote-connection-change",!0):(B8(),v8(c||null),c=r8().Zf(),(c=l6(c,b.key))&&C8(c,1))}},NJa=function(a){g.AJ(a.player).Kb()?a.player.pauseVideo():(a.fm=function(b){LJa(a,1,b)},a.player.addEventListener("presentingplayerstatechange",a.fm));
a.In&&a.In.uc();z8()||(G8=!0)},MJa=function(a){g.AJ(a.player).Kb()?a.player.pauseVideo():(a.fm=function(b){LJa(a,2,b)},a.player.addEventListener("presentingplayerstatechange",a.fm));
a.kn&&a.kn.uc();z8()||(G8=!0)},QHa={"\x00":"\\0",
"\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r","\t":"\\t","\x0B":"\\x0B",'"':'\\"',"\\":"\\\\","<":"\\u003C"},K6={"'":"\\'"},OJa={},mHa={vS:"atp",B1:"ska",w0:"que",FZ:"mus",A1:"sus",aW:"dsp",N0:"seq",kZ:"mic",YU:"dpa"},r6,n6="",EHa=AHa("loadCastFramework")||AHa("loadCastApplicationFramework"),aJa=["pkedcjkdefgpdelpbcmbmeomcjbeemfm","enhhojjnijigcajfphajepfemndkmdlo"];/*

 Copyright The Closure Library Authors.
 SPDX-License-Identifier: Apache-2.0
*/
g.Ya(u6,g.B);g.k=u6.prototype;g.k.LI=function(a){this.D=arguments;this.u=!1;this.Wa?this.C=g.A()+this.df:this.Wa=g.Um(this.F,this.df)};
g.k.stop=function(){this.Wa&&(g.v.clearTimeout(this.Wa),this.Wa=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.G.apply(null,this.D)))};
g.k.aa=function(){this.stop();u6.nd.aa.call(this)};
g.k.MI=function(){this.C?(this.Wa=g.Um(this.F,this.C-g.A()),this.C=null):(this.Wa=null,this.B?this.u=!0:(this.u=!1,this.G.apply(null,this.D)))};g.u(v6,g.B);g.k=v6.prototype;g.k.KC=function(a){this.C=arguments;this.Wa||this.B?this.u=!0:w6(this)};
g.k.stop=function(){this.Wa&&(g.v.clearTimeout(this.Wa),this.Wa=null,this.u=!1,this.C=null)};
g.k.pause=function(){this.B++};
g.k.resume=function(){this.B--;this.B||!this.u||this.Wa||(this.u=!1,w6(this))};
g.k.aa=function(){g.B.prototype.aa.call(this);this.stop()};y6.prototype.stringify=function(a){return g.v.JSON.stringify(a,void 0)};
y6.prototype.parse=function(a){return g.v.JSON.parse(a,void 0)};var A6=new g.im;g.u(HHa,g.Ll);C6.prototype.u=null;C6.prototype.getOptions=function(){var a;(a=this.u)||(a={},JHa(this)&&(a[0]=!0,a[1]=!0),a=this.u=a);return a};var T8;g.Ya(IHa,C6);T8=new IHa;g.k=D6.prototype;g.k.Fl=null;g.k.Eh=!1;g.k.eo=null;g.k.mz=null;g.k.Nn=null;g.k.Wn=null;g.k.Uj=null;g.k.Kk=null;g.k.gm=null;g.k.ge=null;g.k.Kq=0;g.k.Jh=null;g.k.Eu=null;g.k.kk=null;g.k.fp=-1;g.k.IF=!0;g.k.kl=!1;g.k.Aw=0;g.k.Yt=null;var OHa={},G6={};g.k=D6.prototype;g.k.setTimeout=function(a){this.F=a};
g.k.fQ=function(a){a=a.target;var b=this.Yt;b&&3==P6(a)?b.KC():this.IG(a)};
g.k.IG=function(a){try{if(a==this.ge)a:{var b=P6(this.ge),c=this.ge.G,d=this.ge.getStatus();if(g.ye&&!g.$d(10)||g.Ae&&!g.Zd("420+")){if(4>b)break a}else if(3>b||3==b&&!g.rg&&!R6(this.ge))break a;this.kl||4!=b||7==c||(8==c||0>=d?this.u.wh(3):this.u.wh(2));L6(this);var e=this.ge.getStatus();this.fp=e;var f=R6(this.ge);(this.Eh=200==e)?(4==b&&I6(this),this.G?(PHa(this,b,f),g.rg&&this.Eh&&3==b&&(this.D.wa(this.C,"tick",this.ZP),this.C.start())):H6(this,f),this.Eh&&!this.kl&&(4==b?this.u.ks(this):(this.Eh=
!1,F6(this)))):(400==e&&0<f.indexOf("Unknown SID")?(this.kk=3,B6(13)):(this.kk=0,B6(14)),I6(this),J6(this))}}catch(h){this.ge&&R6(this.ge)}finally{}};
g.k.ZP=function(){var a=P6(this.ge),b=R6(this.ge);this.Kq<b.length&&(L6(this),PHa(this,a,b),this.Eh&&4!=a&&F6(this))};
g.k.sP=function(a){z6((0,g.z)(this.rP,this,a),0)};
g.k.rP=function(a){this.kl||(L6(this),H6(this,a),F6(this))};
g.k.GE=function(a){z6((0,g.z)(this.qP,this,a),0)};
g.k.qP=function(a){this.kl||(I6(this),this.Eh=a,this.u.ks(this),this.u.wh(4))};
g.k.cancel=function(){this.kl=!0;I6(this)};
g.k.EP=function(){this.eo=null;var a=g.A();0<=a-this.mz?(2!=this.Wn&&this.u.wh(3),I6(this),this.kk=2,B6(18),J6(this)):SHa(this,this.mz-a)};
g.k.getLastError=function(){return this.kk};g.Ya(N6,g.im);var ZHa=/^https?$/i,PJa=["POST","PUT"];g.k=N6.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.G=0;this.ra=b;this.ea=!1;this.C=!0;this.u=this.ba?KHa(this.ba):KHa(T8);this.Y=this.ba?this.ba.getOptions():T8.getOptions();this.u.onreadystatechange=(0,g.z)(this.vE,this);try{c6(Q6(this,"Opening Xhr")),this.ha=!0,this.u.open(b,String(a),!0),this.ha=!1}catch(f){c6(Q6(this,"Error opening Xhr: "+f.message));YHa(this,f);return}a=
c||"";var e=this.headers.clone();d&&iHa(d,function(f,h){e.set(h,f)});
d=g.jb(e.wg(),WHa);c=g.v.FormData&&a instanceof g.v.FormData;!g.nb(PJa,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.Aa&&(this.u.responseType=this.Aa);"withCredentials"in this.u&&this.u.withCredentials!==this.da&&(this.u.withCredentials=this.da);try{aIa(this),0<this.K&&(this.X=VHa(this.u),c6(Q6(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.IB,this)):this.V=g.Um(this.IB,this.K,this)),c6(Q6(this,"Sending request")),this.N=!0,this.u.send(a),this.N=!1}catch(f){c6(Q6(this,"Send error: "+f.message)),YHa(this,f)}};
g.k.IB=function(){"undefined"!=typeof g.t1&&this.u&&(this.D="Timed out after "+this.K+"ms, aborting",this.G=8,Q6(this,this.D),this.dispatchEvent("timeout"),this.abort(8))};
g.k.abort=function(a){this.u&&this.C&&(Q6(this,"Aborting"),this.C=!1,this.F=!0,this.u.abort(),this.F=!1,this.G=a||7,this.dispatchEvent("complete"),this.dispatchEvent("abort"),O6(this))};
g.k.aa=function(){this.u&&(this.C&&(this.C=!1,this.F=!0,this.u.abort(),this.F=!1),O6(this,!0));N6.nd.aa.call(this)};
g.k.vE=function(){this.la()||(this.ha||this.N||this.F?$Ha(this):this.CO())};
g.k.CO=function(){$Ha(this)};
g.k.isActive=function(){return!!this.u};
g.k.getStatus=function(){try{return 2<P6(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=bIa.prototype;g.k.yw=null;g.k.Rf=null;g.k.Zt=!1;g.k.HB=null;g.k.Hr=null;g.k.gx=null;g.k.zw=null;g.k.Ha=null;g.k.gj=-1;g.k.ep=null;g.k.yo=null;g.k.connect=function(a){this.zw=a;a=S6(this.u,null,this.zw);B6(3);this.HB=g.A();var b=this.u.K;null!=b?(this.ep=b[0],(this.yo=b[1])?(this.Ha=1,cIa(this)):(this.Ha=2,U6(this))):(a6(a,"MODE","init"),this.Rf=new D6(this,void 0,void 0,void 0),this.Rf.Fl=this.yw,E6(this.Rf,a,!1,null,!0),this.Ha=0)};
g.k.KH=function(a){if(a)this.Ha=2,U6(this);else{B6(4);var b=this.u;b.hi=b.Zj.gj;a7(b,9)}a&&this.wh(2)};
g.k.Jv=function(a){return this.u.Jv(a)};
g.k.abort=function(){this.Rf&&(this.Rf.cancel(),this.Rf=null);this.gj=-1};
g.k.GB=function(){return!1};
g.k.yE=function(a,b){this.gj=a.fp;if(0==this.Ha)if(b){try{var c=this.B.parse(b)}catch(d){c=this.u;c.hi=this.gj;a7(c,2);return}this.ep=c[0];this.yo=c[1]}else c=this.u,c.hi=this.gj,a7(c,2);else if(2==this.Ha)if(this.Zt)B6(7),this.gx=g.A();else if("11111"==b){if(B6(6),this.Zt=!0,this.Hr=g.A(),c=this.Hr-this.HB,!g.ye||g.$d(10)||500>c)this.gj=200,this.Rf.cancel(),B6(12),T6(this.u,this,!0)}else B6(8),this.Hr=this.gx=g.A(),this.Zt=!1};
g.k.ks=function(){this.gj=this.Rf.fp;if(this.Rf.Eh)0==this.Ha?this.yo?(this.Ha=1,cIa(this)):(this.Ha=2,U6(this)):2==this.Ha&&((!g.ye||g.$d(10)?!this.Zt:200>this.gx-this.Hr)?(B6(11),T6(this.u,this,!1)):(B6(12),T6(this.u,this,!0)));else{0==this.Ha?B6(9):2==this.Ha&&B6(10);var a=this.u;this.Rf.getLastError();a.hi=this.gj;a7(a,2)}};
g.k.rq=function(){return this.u.rq()};
g.k.isActive=function(){return this.u.isActive()};
g.k.wh=function(a){this.u.wh(a)};g.k=V6.prototype;g.k.Vm=null;g.k.Oo=null;g.k.Hf=null;g.k.Ad=null;g.k.xw=null;g.k.Jr=null;g.k.kA=null;g.k.hs=null;g.k.Mp=0;g.k.bM=0;g.k.af=null;g.k.dk=null;g.k.Ti=null;g.k.rl=null;g.k.Zj=null;g.k.Bu=null;g.k.gn=-1;g.k.sC=-1;g.k.hi=-1;g.k.Qm=0;g.k.Cm=0;g.k.ll=8;g.Ya(fIa,g.Ll);g.Ya(gIa,g.Ll);g.k=V6.prototype;g.k.connect=function(a,b,c,d,e){B6(0);this.xw=b;this.Oo=c||{};d&&void 0!==e&&(this.Oo.OSID=d,this.Oo.OAID=e);this.F?(z6((0,g.z)(this.AA,this,a),100),kIa(this)):this.AA(a)};
g.k.AA=function(a){this.Zj=new bIa(this);this.Zj.yw=this.Vm;this.Zj.B=this.D;this.Zj.connect(a)};
g.k.GB=function(){return 0==this.Ha};
g.k.getState=function(){return this.Ha};
g.k.FE=function(a){this.dk=null;oIa(this,a)};
g.k.EE=function(){this.Ti=null;this.Ad=new D6(this,this.B,"rpc",this.G);this.Ad.Fl=this.Vm;this.Ad.Aw=0;var a=this.kA.clone();Z5(a,"RID","rpc");Z5(a,"SID",this.B);Z5(a,"CI",this.Bu?"0":"1");Z5(a,"AID",this.gn);W6(this,a);if(!g.ye||g.$d(10))Z5(a,"TYPE","xmlhttp"),E6(this.Ad,a,!0,this.hs,!1);else{Z5(a,"TYPE","html");var b=this.Ad,c=!!this.hs;b.Wn=3;b.Uj=$5(a.clone());RHa(b,c)}};
g.k.yE=function(a,b){if(0!=this.Ha&&(this.Ad==a||this.Hf==a))if(this.hi=a.fp,this.Hf==a&&3==this.Ha)if(7<this.ll){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.Ti){if(this.Ad)if(this.Ad.Nn+3E3<this.Hf.Nn)Y6(this),this.Ad.cancel(),this.Ad=null;else break a;$6(this);B6(19)}}else this.sC=c[1],0<this.sC-this.gn&&37500>c[2]&&this.Bu&&0==this.Cm&&!this.rl&&(this.rl=z6((0,g.z)(this.GM,this),6E3));else a7(this,11)}else b!=OJa.MU.u&&a7(this,11);else if(this.Ad==
a&&Y6(this),!g.rc(b)){c=this.D.parse(b);for(var d=0;d<c.length;d++){var e=c[d];this.gn=e[0];e=e[1];2==this.Ha?"c"==e[0]?(this.B=e[1],this.hs=e[2],e=e[3],null!=e?this.ll=e:this.ll=6,this.Ha=3,this.af&&this.af.wA(),this.kA=S6(this,this.rq()?this.hs:null,this.xw),pIa(this)):"stop"==e[0]&&a7(this,7):3==this.Ha&&("stop"==e[0]?a7(this,7):"noop"!=e[0]&&this.af&&this.af.vA(e),this.Cm=0)}}};
g.k.GM=function(){null!=this.rl&&(this.rl=null,this.Ad.cancel(),this.Ad=null,$6(this),B6(20))};
g.k.ks=function(a){if(this.Ad==a){Y6(this);this.Ad=null;var b=2}else if(this.Hf==a)this.Hf=null,b=1;else return;this.hi=a.fp;if(0!=this.Ha)if(a.Eh)1==b?(b=A6,b.dispatchEvent(new fIa(b,a.gm?a.gm.length:0,g.A()-a.Nn,this.Qm)),X6(this),this.C.length=0):pIa(this);else{var c=a.getLastError(),d;if(!(d=3==c||7==c||0==c&&0<this.hi)){if(d=1==b)this.Hf||this.dk||1==this.Ha||2<=this.Qm?d=!1:(this.dk=z6((0,g.z)(this.FE,this,a),qIa(this,this.Qm)),this.Qm++,d=!0);d=!(d||2==b&&$6(this))}if(d)switch(c){case 1:a7(this,
5);break;case 4:a7(this,10);break;case 3:a7(this,6);break;case 7:a7(this,12);break;default:a7(this,2)}}};
g.k.jI=function(a){if(!g.nb(arguments,this.Ha))throw Error("Unexpected channel state: "+this.Ha);};
g.k.PQ=function(a){a?B6(2):(B6(1),rIa(this,8))};
g.k.Jv=function(a){if(a)throw Error("Can't create secondary domain capable XhrIo object.");a=new N6;a.da=!1;return a};
g.k.isActive=function(){return!!this.af&&this.af.isActive(this)};
g.k.wh=function(a){var b=A6;b.dispatchEvent(new gIa(b,a))};
g.k.rq=function(){return!(!g.ye||g.$d(10))};
g.k=sIa.prototype;g.k.wA=function(){};
g.k.vA=function(){};
g.k.uA=function(){};
g.k.xv=function(){};
g.k.iB=function(){return{}};
g.k.isActive=function(){return!0};g.k=tIa.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.BBa)(b,a);0<=c?(g.qb(b,c),b=!0):b=!1;return b||g.rb(this.B,a)};
g.k.qf=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.Ya(b7,g.B);g.k=b7.prototype;g.k.lP=function(){this.df=Math.min(3E5,2*this.df);this.C();this.B&&this.start()};
g.k.start=function(){var a=this.df+15E3*Math.random();this.u.Hb(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.df=5E3};g.Ya(c7,sIa);g.k=c7.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.Ck=function(a){return this.C.Gl(a)};
g.k.W=function(a,b){return this.C.W.apply(this.C,arguments)};
g.k.dispose=function(){this.Rd||(this.Rd=!0,g.eg(this.C),wIa(this),g.eg(this.B),this.B=null,this.X=function(){return""})};
g.k.la=function(){return this.Rd};
g.k.connect=function(a,b,c){if(!this.u||2!=this.u.getState()){this.P="";this.B.stop();this.F=a||null;this.D=b||0;a=this.V+"/test";b=this.V+"/bind";var d=new V6(c?c.firstTestResults:null,c?c.secondTestResults:null,this.Y),e=this.u;e&&(e.af=null);d.af=this;this.u=d;d7(this);e?(3!=e.getState()&&0==mIa(e)||e.getState(),this.u.connect(a,b,this.G,e.B,e.gn)):c?this.u.connect(a,b,this.G,c.sessionId,c.arrayId):this.u.connect(a,b,this.G)}};
g.k.sendMessage=function(a,b){var c={_sc:a};b&&g.bc(c,b);this.B.isActive()||2==(this.u?this.u.getState():0)?this.K.push(c):e7(this)&&(d7(this),lIa(this.u,c))};
g.k.wA=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)lIa(this.u,a[b])}this.W("handlerOpened")};
g.k.uA=function(a){var b=2==a&&401==this.u.hi;4==a||b||this.B.start();this.W("handlerError",a)};
g.k.xv=function(a){if(!this.B.isActive())this.W("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.iB=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.vA=function(a){"S"==a[0]?this.P=a[1]:"gracefulReconnect"==a[0]?(this.B.start(),jIa(this.u)):this.W("handlerMessage",new uIa(a[0],a[1]))};
g.k.rQ=function(){this.B.isActive();0==mIa(this.u)&&this.connect(this.F,this.D)};f7.prototype.D=function(a,b,c,d){b?a(d):a({text:c.responseText})};
f7.prototype.C=function(a,b){a(Error("Request error: "+b.status))};
f7.prototype.F=function(a){a(Error("request timed out"))};var EIa=g.A(),i7=null,l7=Array(50),k7=-1,m7=!1;g.Ya(n7,g.P);n7.prototype.Zf=function(){return this.screens};
n7.prototype.contains=function(a){return!!k6(this.screens,a)};
n7.prototype.get=function(a){return a?l6(this.screens,a):null};
n7.prototype.info=function(a){j7(this.G,a)};g.u(o7,g.P);g.k=o7.prototype;g.k.start=function(){!this.u&&isNaN(this.Wa)&&this.NG()};
g.k.stop=function(){this.u&&(this.u.abort(),this.u=null);isNaN(this.Wa)||(g.Io(this.Wa),this.Wa=NaN)};
g.k.aa=function(){this.stop();g.P.prototype.aa.call(this)};
g.k.NG=function(){this.Wa=NaN;this.u=g.pq(g7(this.G,"/pairing/get_screen"),{method:"POST",fc:{pairing_code:this.F},timeout:5E3,onSuccess:(0,g.z)(this.xR,this),onError:(0,g.z)(this.wR,this),kg:(0,g.z)(this.yR,this)})};
g.k.xR=function(a,b){this.u=null;var c=b.screen||{};c.dialId=this.C;c.name=this.D;this.W("pairingComplete",new f6(c))};
g.k.wR=function(a){this.u=null;a.status&&404==a.status?this.B>=QJa.length?this.W("pairingFailed",Error("DIAL polling timed out")):(a=QJa[this.B],this.Wa=g.Go((0,g.z)(this.NG,this),a),this.B++):this.W("pairingFailed",Error("Server error "+a.status))};
g.k.yR=function(){this.u=null;this.W("pairingFailed",Error("Server not responding"))};
var QJa=[2E3,2E3,1E3,1E3,1E3,2E3,2E3,5E3,5E3,1E4];g.Ya(q7,n7);g.k=q7.prototype;g.k.start=function(){p7(this)&&this.W("screenChange");!g.xt("yt-remote-lounge-token-expiration")&&IIa(this);g.Io(this.u);this.u=g.Go((0,g.z)(this.start,this),1E4)};
g.k.add=function(a,b){p7(this);FIa(this,a);r7(this,!1);this.W("screenChange");b(a);a.token||IIa(this)};
g.k.remove=function(a,b){var c=p7(this);HIa(this,a)&&(r7(this,!1),c=!0);b(a);c&&this.W("screenChange")};
g.k.zu=function(a,b,c,d){var e=p7(this),f=this.get(a.id);f?(f.name!=b&&(f.name=b,r7(this,!1),e=!0),c(a)):d(Error("no such local screen."));e&&this.W("screenChange")};
g.k.aa=function(){g.Io(this.u);q7.nd.aa.call(this)};
g.k.WI=function(a){p7(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)}r7(this,!b);b&&j7(this.G,"Missed "+b+" lounge tokens.")};
g.k.VI=function(a){j7(this.G,"Requesting lounge tokens failed: "+a)};g.u(t7,g.P);g.k=t7.prototype;g.k.start=function(){var a=parseInt(g.xt("yt-remote-fast-check-period")||"0",10);(this.D=g.A()-144E5<a?0:a)?v7(this):(this.D=g.A()+3E5,g.wt("yt-remote-fast-check-period",this.D),this.ny())};
g.k.isEmpty=function(){return g.Wb(this.u)};
g.k.update=function(){s7("Updating availability on schedule.");var a=this.G(),b=g.Jb(this.u,function(c,d){return c&&!!l6(a,d)},this);
u7(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.ny=function(){g.Io(this.C);this.C=NaN;this.B&&this.B.abort();var a=LIa(this);if(b6(a)){var b=g7(this.F,"/pairing/get_screen_availability");this.B=h7(this.F,b,{lounge_token:g.Qb(a).join(",")},(0,g.z)(this.WO,this,a),(0,g.z)(this.VO,this))}else u7(this,{}),v7(this)};
g.k.WO=function(a,b){this.B=null;var c=g.Qb(LIa(this));if(g.Db(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;u7(this,d);v7(this)}else this.cd("Changing Screen set during request."),this.ny()};
g.k.VO=function(a){this.cd("Screen availability failed: "+a);this.B=null;v7(this)};
g.k.cd=function(a){j7("OnlineScreenService",a)};g.Ya(w7,n7);g.k=w7.prototype;g.k.start=function(){this.B.start();this.u.start();this.screens.length&&(this.W("screenChange"),this.u.isEmpty()||this.W("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.zu=function(a,b,c,d){this.B.contains(a)?this.B.zu(a,b,c,d):(a="Updating name of unknown screen: "+a.name,j7(this.G,a),d(Error(a)))};
g.k.Zf=function(a){return a?this.screens:g.tb(this.screens,g.Ke(this.C,function(b){return!this.contains(b)},this))};
g.k.OG=function(){return g.Ke(this.Zf(!0),function(a){return!!this.u.u[a.id]},this)};
g.k.PG=function(a,b,c,d,e){this.info("getDialScreenByPairingCode "+a+" / "+b);var f=new o7(this.F,a,b,c);f.subscribe("pairingComplete",(0,g.z)(function(h){g.eg(f);d(x7(this,h))},this));
f.subscribe("pairingFailed",function(h){g.eg(f);e(h)});
f.start();return(0,g.z)(f.stop,f)};
g.k.AR=function(a,b,c,d){g.pq(g7(this.F,"/pairing/get_screen"),{method:"POST",fc:{pairing_code:a},timeout:5E3,onSuccess:(0,g.z)(function(e,f){var h=new f6(f.screen||{});if(!h.name||PIa(this,h.name)){a:{var l=h.name;for(var m=2,n=b(l,m);PIa(this,n);){m++;if(20<m)break a;n=b(l,m)}l=n}h.name=l}c(x7(this,h))},this),
onError:(0,g.z)(function(e){d(Error("pairing request failed: "+e.status))},this),
kg:(0,g.z)(function(){d(Error("pairing request timed out."))},this)})};
g.k.aa=function(){g.eg(this.B);g.eg(this.u);w7.nd.aa.call(this)};
g.k.dJ=function(){QIa(this);this.W("screenChange");this.u.update()};
w7.prototype.dispose=w7.prototype.dispose;g.Ya(z7,g.P);g.k=z7.prototype;g.k.getScreen=function(){return this.K};
g.k.Ot=function(a){this.K=a;this.W("sessionScreen",this.K)};
g.k.hg=function(a){this.la()||(a&&A7(this,""+a),this.K=null,this.W("sessionScreen",null))};
g.k.info=function(a){j7(this.Y,a)};
g.k.SG=function(){return null};
g.k.yy=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(){A7(this,"Failed to update receiver status for: "+b.friendlyName)},this))};
g.k.aa=function(){this.yy("");z7.nd.aa.call(this)};g.u(B7,z7);g.k=B7.prototype;g.k.wy=function(a){if(this.B){if(this.B==a)return;A7(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);SIa(this)};
g.k.hn=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.hg()},this),(0,g.z)(function(){this.hg(Error("Failed to stop receiver app."))},this)):this.hg(Error("Stopping cast device witout session."))};
g.k.yy=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;z7.prototype.aa.call(this)};
g.k.LP=function(a,b){if(!this.la())if(b){var c=x6(b);if(g.Sa(c)){var d=""+c.type;c=c.data||{};this.info("onYoutubeMessage_: "+d+" "+g.Fj(c));switch(d){case "mdxSessionStatus":RIa(this,c.screenId);break;default:A7(this,"Unknown youtube message: "+d)}}else A7(this,"Unable to parse message.")}else A7(this,"No data in message.")};
g.k.zB=function(a,b,c,d){OIa(this.N,this.u.label,a,this.u.friendlyName,(0,g.z)(function(e){e?b(e):0<=d?(A7(this,"Screen "+a+" appears to be offline. "+d+" retries left."),g.Go((0,g.z)(this.zB,this,a,b,c,d-1),300)):c(Error("Unable to fetch screen."))},this),c)};
g.k.SG=function(){return this.B};
g.k.BR=function(a){this.la()||a||(A7(this,"Cast session died."),this.hg())};g.u(C7,z7);g.k=C7.prototype;g.k.wy=function(a){this.C=a;this.C.addUpdateListener(this.X)};
g.k.hn=function(a){this.V=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.hg,this,null),(0,g.z)(this.hg,this,"Failed to stop DIAL device.")):this.hg()};
g.k.aa=function(){this.B();this.B=g.Oa;g.Io(this.D);this.C&&this.C.removeUpdateListener(this.X);this.C=null;z7.prototype.aa.call(this)};
g.k.ER=function(a){this.la()||a||(A7(this,"DIAL session died."),this.B(),this.B=g.Oa,this.hg())};
g.k.Kw=function(a){this.P=j6();if(this.V){var b=new chrome.cast.DialLaunchResponse(!0,UIa(this));a(b);TIa(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,UIa(this));a(c);TIa(this)},this),this.D=g.Go((0,g.z)(function(){this.F()},this),100)};
g.k.uJ=function(a,b,c){OIa(this.N,this.G.receiver.label,a,this.u.friendlyName,(0,g.z)(function(d){d&&d.token?(this.Ot(d),b(new chrome.cast.DialLaunchResponse(!1))):this.Kw(b,c)},this),(0,g.z)(function(d){A7(this,"Failed to get DIAL screen: "+d);
this.Kw(b,c)},this))};g.u(D7,z7);D7.prototype.stop=function(){this.hg()};
D7.prototype.wy=function(){};
D7.prototype.hn=function(){g.Io(this.B);this.B=NaN;var a=l6(this.N.Zf(),this.u.label);a?this.Ot(a):this.hg(Error("No such screen"))};
D7.prototype.aa=function(){g.Io(this.B);this.B=NaN;z7.prototype.aa.call(this)};g.u(E7,g.P);g.k=E7.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.GO,this);c=new chrome.cast.ApiConfig(c,(0,g.z)(this.AE,this),f,d,e);c.customDialLaunchCallback=(0,g.z)(this.fN,this);chrome.cast.initialize(c,(0,g.z)(function(){this.la()||
(chrome.cast.addReceiverActionListener(this.D),BIa(),this.B.subscribe("onlineScreenChange",(0,g.z)(this.QG,this)),this.C=WIa(this),chrome.cast.setCustomReceivers(this.C,g.Oa,(0,g.z)(function(h){this.cd("Failed to set initial custom receivers: "+g.Fj(h))},this)),this.W("yt-remote-cast2-availability-change",G7(this)),b(!0))},this),(0,g.z)(function(h){this.cd("Failed to initialize API: "+g.Fj(h));
b(!1)},this))};
g.k.xQ=function(a,b){F7("Setting connected screen ID: "+a+" -> "+b);if(this.u){var c=this.u.getScreen();if(!a||c&&c.id!=a)F7("Unsetting old screen status: "+this.u.u.friendlyName),H7(this,null)}if(a&&b){if(!this.u){c=l6(this.B.Zf(),a);if(!c){F7("setConnectedScreenStatus: Unknown screen.");return}var d=VIa(this,c);d||(F7("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.cd("Failed to set initial custom receivers: "+g.Fj(e))},this)));
F7("setConnectedScreenStatus: new active receiver: "+d.friendlyName);H7(this,new D7(this.B,d),!0)}this.u.yy(b)}else F7("setConnectedScreenStatus: no screen.")};
g.k.yQ=function(a){this.la()?this.cd("Setting connection data on disposed cast v2"):this.u?this.u.hn(a):this.cd("Setting connection data without a session")};
g.k.DR=function(){this.la()?this.cd("Stopping session on disposed cast v2"):this.u?(this.u.stop(),H7(this,null)):F7("Stopping non-existing session")};
g.k.requestSession=function(){chrome.cast.requestSession((0,g.z)(this.AE,this),(0,g.z)(this.YO,this))};
g.k.aa=function(){this.B.unsubscribe("onlineScreenChange",(0,g.z)(this.QG,this));window.chrome&&chrome.cast&&chrome.cast.removeReceiverActionListener(this.D);var a=yIa,b=g.Na("yt.mdx.remote.debug.handlers_");g.rb(b||[],a);g.eg(this.u);g.P.prototype.aa.call(this)};
g.k.cd=function(a){j7("Controller",a)};
g.k.CE=function(a,b){this.u==a&&(b||H7(this,null),this.W("yt-remote-cast2-session-change",b))};
g.k.DO=function(a,b){if(!this.la())if(a)switch(a.friendlyName=chrome.cast.unescape(a.friendlyName),F7("onReceiverAction_ "+a.label+" / "+a.friendlyName+"-- "+b),b){case chrome.cast.ReceiverAction.CAST:if(this.u)if(this.u.u.label!=a.label)F7("onReceiverAction_: Stopping active receiver: "+this.u.u.friendlyName),this.u.stop();else{F7("onReceiverAction_: Casting to active receiver.");this.u.getScreen()&&this.W("yt-remote-cast2-session-change",this.u.getScreen());break}switch(a.receiverType){case chrome.cast.ReceiverType.CUSTOM:H7(this,
new D7(this.B,a));break;case chrome.cast.ReceiverType.DIAL:H7(this,new C7(this.B,a,this.G));break;case chrome.cast.ReceiverType.CAST:H7(this,new B7(this.B,a));break;default:this.cd("Unknown receiver type: "+a.receiverType)}break;case chrome.cast.ReceiverAction.STOP:this.u&&this.u.u.label==a.label?this.u.stop():this.cd("Stopping receiver w/o session: "+a.friendlyName)}else this.cd("onReceiverAction_ called without receiver.")};
g.k.fN=function(a){if(this.la())return Promise.reject(Error("disposed"));var b=a.receiver;b.receiverType!=chrome.cast.ReceiverType.DIAL&&(this.cd("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.cd("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 F7("Reselecting dial screen."),
this.W("yt-remote-cast2-session-change",this.u.getScreen()),Promise.resolve(new chrome.cast.DialLaunchResponse(!1));this.cd('Changing CAST intent from "'+c.receiverType+'" to "dial" for '+b.friendlyName);H7(this,new C7(this.B,b,this.G))}b=this.u;b.G=a;return b.G.appState==chrome.cast.DialAppState.RUNNING?new Promise((0,g.z)(b.uJ,b,(b.G.extraData||{}).screenId||null)):new Promise((0,g.z)(b.Kw,b))};
g.k.AE=function(a){if(!this.la()){F7("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)F7("Got resumed cast session before resumed mdx connection."),b.friendlyName=chrome.cast.unescape(b.friendlyName),H7(this,new B7(this.B,b),!0);else{this.cd("Got non-cast session without previous mdx receiver event, or mdx resume.");return}var c=this.u.u,d=l6(this.B.Zf(),c.label);d&&g6(d,b.label)&&
c.receiverType!=chrome.cast.ReceiverType.CAST&&b.receiverType==chrome.cast.ReceiverType.CAST&&(F7("onSessionEstablished_: manual to cast session change "+b.friendlyName),g.eg(this.u),this.u=new B7(this.B,b),this.u.subscribe("sessionScreen",(0,g.z)(this.CE,this,this.u)),this.u.hn(null));this.u.wy(a)}}};
g.k.CR=function(){return this.u?this.u.SG():null};
g.k.YO=function(a){this.la()||(this.cd("Failed to estabilish a session: "+g.Fj(a)),a.code!=chrome.cast.ErrorCode.CANCEL&&H7(this,null))};
g.k.GO=function(a){F7("Receiver availability updated: "+a);if(!this.la()){var b=G7(this);this.F=a==chrome.cast.ReceiverAvailability.AVAILABLE;G7(this)!=b&&this.W("yt-remote-cast2-availability-change",G7(this))}};
g.k.QG=function(){this.la()||(this.C=WIa(this),F7("Updating custom receivers: "+g.Fj(this.C)),chrome.cast.setCustomReceivers(this.C,g.Oa,(0,g.z)(function(){this.cd("Failed to set custom receivers.")},this)),this.W("yt-remote-cast2-availability-change",G7(this)))};
E7.prototype.setLaunchParams=E7.prototype.yQ;E7.prototype.setConnectedScreenStatus=E7.prototype.xQ;E7.prototype.stopSession=E7.prototype.DR;E7.prototype.getCastSession=E7.prototype.CR;E7.prototype.requestSession=E7.prototype.requestSession;E7.prototype.init=E7.prototype.init;E7.prototype.dispose=E7.prototype.dispose;var N7=[];g.k=S7.prototype;
g.k.reset=function(a){this.listId="";this.index=-1;this.videoId="";T7(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.ii=a.hasPrevious,this.hasNext=a.hasNext,this.K=a.playerTime,this.G=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.Kb=function(){return 1==this.playerState};
g.k.isAdPlaying=function(){return 1081==this.playerState};
g.k.getDuration=function(){return this.C?this.N+U7(this):this.N};
g.k.clone=function(){return new S7(Y7(this))};g.u($7,g.P);g.k=$7.prototype;g.k.getState=function(){return this.Ha};
g.k.play=function(){b8(this)?(this.u?this.u.play(null,g.Oa,g8(this,"play")):f8(this,"play"),e8(this,1,W7(a8(this))),this.W("remotePlayerChange")):c8(this,this.play)};
g.k.pause=function(){b8(this)?(this.u?this.u.pause(null,g.Oa,g8(this,"pause")):f8(this,"pause"),e8(this,2,W7(a8(this))),this.W("remotePlayerChange")):c8(this,this.pause)};
g.k.seekTo=function(a){if(b8(this)){if(this.u){var b=a8(this),c=new chrome.cast.media.SeekRequest;c.currentTime=a;b.Kb()||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.W("remotePlayerChange")}else c8(this,g.Va(this.seekTo,a))};
g.k.stop=function(){if(b8(this)){this.u?this.u.stop(null,g.Oa,g8(this,"stopVideo")):f8(this,"stopVideo");var a=a8(this);a.index=-1;a.videoId="";T7(a);d8(this,a);this.W("remotePlayerChange")}else c8(this,this.stop)};
g.k.setVolume=function(a,b){if(b8(this)){var c=a8(this);if(this.B){if(c.volume!=a){var d=Math.round(a)/100;this.B.setReceiverVolumeLevel(d,(0,g.z)(function(){j7("CP","set receiver volume: "+d)},this),(0,g.z)(function(){this.cd("failed to set receiver volume.")},this))}c.muted!=b&&this.B.setReceiverMuted(b,(0,g.z)(function(){j7("CP","set receiver muted: "+b)},this),(0,g.z)(function(){this.cd("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.MG=function(a,b){if(b8(this)){var c=a8(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.MG,a,b))};
g.k.setAudioTrack=function(a,b){if(b8(this)){var c=b.getLanguageInfo().getId();f8(this,"setAudioTrack",{videoId:a,audioTrackId:c});var d=a8(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=a8(this);c=c||0;var m={videoId:a,currentIndex:c};X7(l,a,c);void 0!==b&&(V7(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.Ut=function(a,b){if(b8(this)){if(a&&b){var c=a8(this);X7(c,a,b);d8(this,c)}f8(this,"previous")}else c8(this,g.Va(this.Ut,a,b))};
g.k.nextVideo=function(a,b){if(b8(this)){if(a&&b){var c=a8(this);X7(c,a,b);d8(this,c)}f8(this,"next")}else c8(this,g.Va(this.nextVideo,a,b))};
g.k.RA=function(){b8(this)?f8(this,"dismissAutoplay"):c8(this,this.RA)};
g.k.dispose=function(){if(3!=this.Ha){var a=this.Ha;this.Ha=3;this.W("proxyStateChange",a,this.Ha)}g.P.prototype.dispose.call(this)};
g.k.aa=function(){iJa(this);this.C=null;this.D.clear();Z7(this,null);g.P.prototype.aa.call(this)};
g.k.pz=function(a){if((a!=this.Ha||2==a)&&3!=this.Ha&&0!=a){var b=this.Ha;this.Ha=a;this.W("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.zO=function(a,b){this.W(a,b)};
g.k.QM=function(a){if(!a)this.Op(null),Z7(this,null);else if(this.B.receiver.volume){a=this.B.receiver.volume;var b=a8(this),c=Math.round(100*a.level||0);if(b.volume!=c||b.muted!=a.muted)j7("CP","Cast volume update: "+a.level+(a.muted?" muted":"")),b.volume=c,b.muted=!!a.muted,d8(this,b)}};
g.k.Op=function(a){j7("CP","Cast media: "+!!a);this.u&&this.u.removeUpdateListener(this.K);if(this.u=a)this.u.addUpdateListener(this.K),jJa(this),this.W("remotePlayerChange")};
g.k.PM=function(a){a?(jJa(this),this.W("remotePlayerChange")):this.Op(null)};
g.k.Qy=function(){f8(this,"sendDebugCommand",{debugCommand:"stats4nerds "})};
g.k.XM=function(){var a=fJa();a&&Z7(this,a)};
g.k.cd=function(a){j7("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.Db.listId=c);this.Db.videoId=d;this.Db.index=h||0;this.Db.state=3;V7(this.Db,m);this.D="UNSUPPORTED";i8("Connecting with setPlaylist and params: "+g.Fj(l));this.u.connect({method:"setPlaylist",
params:g.Fj(l)},a,uHa())}else i8("Connecting without params"),this.u.connect({},a,uHa());lJa(this)};
g.k.dispose=function(){this.la()||(this.W("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.ep(this.Y);this.Y.length=0;this.u.dispose();g.P.prototype.aa.call(this);this.D=this.G=this.B=this.Db=this.u=null};
g.k.OI=function(){this.Lm(2)};
g.k.UM=function(){i8("Channel opened");this.X&&(this.X=!1,l8(this),this.V=g.Go((0,g.z)(function(){i8("Timing out waiting for a screen.");this.Lm(1)},this),15E3));
yHa(vIa(this.u),this.ba)};
g.k.RM=function(){i8("Channel closed");isNaN(this.F)?q6(!0):q6();this.dispose()};
g.k.SM=function(a){q6();isNaN(this.Xo())?(i8("Channel error: "+a+" without reconnection"),this.dispose()):(this.X=!0,i8("Channel error: "+a+" with reconnection in "+this.Xo()+" ms"),j8(this,2))};
g.k.TM=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=x6(a.params.devices);this.B=g.Pc(a,function(c){return new e6(c)});
a=!!g.jb(this.B,function(c){return"LOUNGE_SCREEN"==c.type});
oJa(this,a);break;case "loungeScreenDisconnected":g.sb(this.B,function(c){return"LOUNGE_SCREEN"==c.type});
oJa(this,!1);break;case "remoteConnected":var b=new e6(x6(a.params.device));g.jb(this.B,function(c){return b?c.id==b.id:!1})||eHa(this.B,b);
break;case "remoteDisconnected":b=new e6(x6(a.params.device));g.sb(this.B,function(c){return b?c.id==b.id:!1});
break;case "gracefulDisconnect":break;case "playlistModified":qJa(this,a);break;case "nowPlaying":sJa(this,a);break;case "onStateChange":rJa(this,a);break;case "onAdStateChange":tJa(this,a);break;case "onVolumeChanged":uJa(this,a);break;case "onSubtitlesTrackChanged":pJa(this,a);break;case "nowAutoplaying":vJa(this,a);break;case "autoplayDismissed":this.W("autoplayDismissed");break;case "autoplayUpNext":this.G=a.params.videoId||null;this.W("autoplayUpNext",this.G);break;case "onAutoplayModeChanged":this.D=
a.params.autoplayMode;this.W("autoplayModeChange",this.D);"DISABLED"==this.D&&this.W("autoplayDismissed");break;case "onHasPreviousNextChanged":wJa(this,a);break;case "requestAssistedSignIn":this.W("assistedSignInRequested",a.params.authCode);break;default:i8("Unrecognized action: "+a.action)}};
g.k.nQ=function(){if(this.C){var a=this.C;this.C=null;this.Db.videoId!=a&&n8(this,"getNowPlaying")}};
g.k.FI=function(){var a=3;this.la()||(a=0,isNaN(this.Xo())?e7(this.u)&&isNaN(this.F)&&(a=1):a=2);return a};
g.k.Lm=function(a){i8("Disconnecting with "+a);k8(this);this.W("beforeDisconnect",a);1==a&&q6();wIa(this.u,a);this.dispose()};
g.k.CI=function(){var a=this.Db;this.C&&(a=this.Db.clone(),X7(a,this.C,a.index));return Y7(a)};
g.k.zQ=function(a){var b=new S7(a);b.videoId&&b.videoId!=this.Db.videoId&&(this.C=b.videoId,g.Io(this.K),this.K=g.Go((0,g.z)(this.nQ,this),5E3));var c=[];this.Db.listId==b.listId&&this.Db.videoId==b.videoId&&this.Db.index==b.index||c.push("remoteQueueChange");this.Db.playerState==b.playerState&&this.Db.volume==b.volume&&this.Db.muted==b.muted&&W7(this.Db)==W7(b)&&g.Fj(this.Db.u)==g.Fj(b.u)||c.push("remotePlayerChange");this.Db.reset(a);g.Fb(c,function(d){this.W(d)},this)};
g.k.xB=function(){var a=this.u.G.id,b=g.jb(this.B,function(c){return"REMOTE_CONTROL"==c.type&&c.id!=a});
return b?b.id:""};
g.k.Xo=function(){var a=this.u;return a.B.isActive()?a.B.B-g.A():NaN};
g.k.rI=function(){return this.D||"UNSUPPORTED"};
g.k.sI=function(){return this.G||""};
g.k.vR=function(){if(!isNaN(this.Xo())){var a=this.u.B;g.tn(a.u);a.start()}};
g.k.vQ=function(a,b){n8(this,a,b);nJa(this)};
g.k.LG=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.Ck;h8.prototype.getProxyState=h8.prototype.FI;h8.prototype.disconnect=h8.prototype.Lm;h8.prototype.getPlayerContextData=h8.prototype.CI;h8.prototype.setPlayerContextData=h8.prototype.zQ;h8.prototype.getOtherConnectedRemoteId=h8.prototype.xB;h8.prototype.getReconnectTimeout=h8.prototype.Xo;h8.prototype.getAutoplayMode=h8.prototype.rI;h8.prototype.getAutoplayVideoId=h8.prototype.sI;h8.prototype.reconnect=h8.prototype.vR;
h8.prototype.sendMessage=h8.prototype.vQ;h8.prototype.getXsrfToken=h8.prototype.LG;g.u(o8,n7);g.k=o8.prototype;g.k.Zf=function(a){return this.cf.$_gs(a)};
g.k.contains=function(a){return!!this.cf.$_c(a)};
g.k.get=function(a){return this.cf.$_g(a)};
g.k.start=function(){this.cf.$_st()};
g.k.add=function(a,b,c){this.cf.$_a(a,b,c)};
g.k.remove=function(a,b,c){this.cf.$_r(a,b,c)};
g.k.zu=function(a,b,c,d){this.cf.$_un(a,b,c,d)};
g.k.aa=function(){for(var a=0,b=this.u.length;a<b;++a)this.cf.$_ubk(this.u[a]);this.u.length=0;this.cf=null;n7.prototype.aa.call(this)};
g.k.zR=function(){this.W("screenChange")};
g.k.fO=function(){this.W("onlineScreenChange")};
w7.prototype.$_st=w7.prototype.start;w7.prototype.$_gspc=w7.prototype.AR;w7.prototype.$_gsppc=w7.prototype.PG;w7.prototype.$_c=w7.prototype.contains;w7.prototype.$_g=w7.prototype.get;w7.prototype.$_a=w7.prototype.add;w7.prototype.$_un=w7.prototype.zu;w7.prototype.$_r=w7.prototype.remove;w7.prototype.$_gs=w7.prototype.Zf;w7.prototype.$_gos=w7.prototype.OG;w7.prototype.$_s=w7.prototype.subscribe;w7.prototype.$_ubk=w7.prototype.Ck;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.C.stop();this.N.stop();this.X();var a=this.vb;a.unsubscribe("proxyStateChange",this.xE,this);a.unsubscribe("remotePlayerChange",this.Tp,this);a.unsubscribe("remoteQueueChange",this.Pt,this);a.unsubscribe("previousNextChange",this.uE,this);a.unsubscribe("nowAutoplaying",this.pE,this);a.unsubscribe("autoplayDismissed",this.QD,this);this.vb=this.B=null};
g.k.cD=function(a,b){for(var c=[],d=1;d<arguments.length;++d)c[d-1]=arguments[d];if(2!=this.vb.Ha)if(J8(this)){if(!a8(this.vb).isAdPlaying()||"control_seek"!==a)switch(a){case "control_toggle_play_pause":a8(this.vb).Kb()?this.vb.pause():this.vb.play();break;case "control_play":this.vb.play();break;case "control_pause":this.vb.pause();break;case "control_seek":this.K.KC(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.MM=function(a){this.N.LI(a)};
g.k.dR=function(a){this.cD("control_subtitles_set_track",g.Wb(a)?null:a)};
g.k.VF=function(){var a=this.J.getOption("captions","track");g.Wb(a)||K8(this,a)};
g.k.Hc=function(a){this.B.Hc(a,this.J.getVideoData().lengthSeconds)};
g.k.fE=function(a){if(J8(this)){this.vb.unsubscribe("remotePlayerChange",this.Tp,this);var b=Math.round(a.volume);a=!!a.muted;var c=a8(this.vb);if(b!==c.volume||a!==c.muted)this.vb.setVolume(b,a),this.P.start();this.vb.subscribe("remotePlayerChange",this.Tp,this)}};
g.k.IN=function(){g.Wb(this.D)||IJa(this,this.D);this.F=!1};
g.k.xE=function(a,b){this.C.stop();2===b&&this.SF()};
g.k.Tp=function(){if(J8(this)){this.u.stop();var a=a8(this.vb);switch(a.playerState){case 1080:case 1081:case 1084:case 1085:this.B.pe=1;break;case 1082:case 1083:this.B.pe=0;break;default:this.B.pe=-1}switch(a.playerState){case 1081:case 1:this.Pd(new g.FL(8));this.RF();break;case 1085:case 3:this.Pd(new g.FL(9));break;case 1083:case 0:this.Pd(new g.FL(2));this.K.stop();this.Hc(this.J.getVideoData().lengthSeconds);break;case 1084:this.Pd(new g.FL(4));break;case 2:this.Pd(new g.FL(4));this.Hc(W7(a));
break;case -1:this.Pd(new g.FL(64));break;case -1E3:this.Pd(new g.FL(128,{errorCode:"mdx.remoteerror",errorMessage:"This video is not available for remote playback."}))}a=a8(this.vb).u;var b=this.D;(a||b?a&&b&&a.trackName==b.trackName&&a.languageCode==b.languageCode&&a.languageName==b.languageName&&a.kind==b.kind:1)||(this.D=a,IJa(this,a));a=a8(this.vb);-1===a.volume||Math.round(this.J.getVolume())===a.volume&&this.J.isMuted()===a.muted||this.P.isActive()||this.wG()}else HJa(this)};
g.k.uE=function(){this.J.W("mdxpreviousnextchange")};
g.k.Pt=function(){J8(this)||HJa(this)};
g.k.pE=function(a){isNaN(a)||this.J.W("mdxnowautoplaying",a)};
g.k.QD=function(){this.J.W("mdxautoplaycanceled")};
g.k.setAudioTrack=function(a){J8(this)&&this.vb.setAudioTrack(this.J.getVideoData(1).videoId,a)};
g.k.seekTo=function(a,b){-1===a8(this.vb).playerState?L8(this,a):b&&this.vb.seekTo(a)};
g.k.wG=function(){if(J8(this)){var a=a8(this.vb);this.events.Eb(this.V);a.muted?this.J.mute():this.J.unMute();this.J.setVolume(a.volume);this.V=this.events.R(this.J,"onVolumeChange",this.fE)}};
g.k.RF=function(){this.u.stop();if(!this.vb.la()){var a=a8(this.vb);a.Kb()&&this.Pd(new g.FL(8));this.Hc(W7(a));this.u.start()}};
g.k.SF=function(){this.C.stop();this.u.stop();var a=this.vb.C.getReconnectTimeout();2==this.vb.Ha&&!isNaN(a)&&this.C.start()};
g.k.Pd=function(a){this.C.stop();var b=this.G;if(!g.KL(b,a)){var c=g.U(a,2);c!==g.U(this.G,2)&&g.N0(this.J.app,c);this.G=a;KJa(this.B,b,a)}};g.u(M8,g.V);M8.prototype.uc=function(){this.u.show()};
M8.prototype.ib=function(){this.u.hide()};
M8.prototype.B=function(){g.WK("https://support.google.com/youtube/answer/7640706")};
M8.prototype.C=function(){d6("mdx-manual-pairing-popup-ok");this.ib()};g.u(N8,g.V);N8.prototype.uc=function(){this.u.show()};
N8.prototype.ib=function(){this.u.hide()};
N8.prototype.B=function(){d6("mdx-privacy-popup-cancel");this.ib()};
N8.prototype.C=function(){d6("mdx-privacy-popup-confirm");this.ib()};g.u(O8,g.V);O8.prototype.B=function(a){JJa(this,a.state)};g.u(P8,g.b_);P8.prototype.D=function(){var a=this.J.getOption("remote","receivers");a&&1<a.length&&!this.J.getOption("remote","quickCast")?(this.Jk=g.Hb(a,this.u,this),g.c_(this,g.Pc(a,this.u)),a=this.J.getOption("remote","currentReceiver"),this.zc(this.u(a)),this.enable(!0)):this.enable(!1)};
P8.prototype.u=function(a){return a.key};
P8.prototype.qh=function(a){return"cast-selector-receiver"===a?"Cast...":this.Jk[a].name};
P8.prototype.He=function(a){g.b_.prototype.He.call(this,a);this.J.setOption("remote","currentReceiver",this.Jk[a]);this.Va.ib()};g.u(Q8,g.HS);g.k=Q8.prototype;
g.k.create=function(){var a=this.player.T(),b=g.qC(a);a={device:"Desktop",app:"youtube-desktop",loadCastApiSetupScript:g.R(a.experiments,"mdx_load_cast_api_bootstrap_script")};BJa(b,a);this.subscriptions.push(g.No("yt-remote-before-disconnect",this.KM,this));this.subscriptions.push(g.No("yt-remote-connection-change",this.HO,this));this.subscriptions.push(g.No("yt-remote-receiver-availability-change",this.wE,this));this.subscriptions.push(g.No("yt-remote-auto-connect",this.FO,this));this.subscriptions.push(g.No("yt-remote-receiver-resumed",
this.EO,this));this.subscriptions.push(g.No("mdx-privacy-popup-confirm",this.dQ,this));this.subscriptions.push(g.No("mdx-privacy-popup-cancel",this.cQ,this));this.subscriptions.push(g.No("mdx-manual-pairing-popup-ok",this.IJ,this));this.wE()};
g.k.load=function(){this.player.cancelPlayback();g.HS.prototype.load.call(this);this.Th=new I8(this,this.player,this.vb);var a=(a=GJa())?a.currentTime:0;var b=E8()?new $7(z8(),void 0):null;0==a&&b&&(a=W7(a8(b)));0!==a&&this.Hc(a);KJa(this,this.Bc,this.Bc);g.V0(this.player.app,6)};
g.k.unload=function(){this.player.W("mdxautoplaycanceled");this.bk=this.mh;g.fg(this.Th,this.vb);this.vb=this.Th=null;g.HS.prototype.unload.call(this);g.V0(this.player.app,5);R8(this)};
g.k.aa=function(){g.Oo(this.subscriptions);g.HS.prototype.aa.call(this)};
g.k.yi=function(a,b){for(var c=[],d=1;d<arguments.length;++d)c[d-1]=arguments[d];this.loaded&&this.Th.cD.apply(this.Th,[a].concat(g.la(c)))};
g.k.getAdState=function(){return this.pe};
g.k.HI=function(){return this.loaded?this.Th.suggestion:null};
g.k.ii=function(){return this.vb?a8(this.vb).ii:!1};
g.k.hasNext=function(){return this.vb?a8(this.vb).hasNext:!1};
g.k.Hc=function(a,b){this.tC=a||0;this.player.W("progresssync",a,b)};
g.k.getCurrentTime=function(){return this.tC};
g.k.getProgressState=function(){var a=a8(this.vb),b=this.player.getVideoData();return{allowSeeking:g.R(this.player.T().experiments,"web_player_mdx_allow_seeking_change_killswitch")?this.player.oe():!a.isAdPlaying()&&this.player.oe(),clipEnd:b.clipEnd,clipStart:b.clipStart,current:this.getCurrentTime(),displayedStart:-1,duration:a.getDuration(),ingestionTime:a.C?a.D+U7(a):a.D,isAtLiveHead:1>=(a.C?a.B+U7(a):a.B)-this.getCurrentTime(),loaded:a.P,seekableEnd:a.C?a.B+U7(a):a.B,seekableStart:0<a.F?a.F+
U7(a):a.F}};
g.k.nextVideo=function(){this.vb&&this.vb.nextVideo()};
g.k.Ut=function(){this.vb&&this.vb.Ut()};
g.k.KM=function(a){1===a&&(this.Xx=this.vb?a8(this.vb):null)};
g.k.HO=function(){var a=E8()?new $7(z8(),void 0):null;if(a){var b=this.bk;this.loaded&&this.unload();this.vb=a;this.Xx=null;b.key!==this.mh.key&&(this.bk=b,this.load())}else g.eg(this.vb),this.vb=null,this.loaded&&(this.unload(),(a=this.Xx)&&a.videoId===this.player.getVideoData().videoId&&this.player.cueVideoById(a.videoId,W7(a)));this.player.W("videodatachange","newdata",this.player.getVideoData(),3)};
g.k.wE=function(){this.Jk=[this.mh].concat(DJa());var a=A8()||this.mh;S8(this,a);this.player.va("onMdxReceiversChange")};
g.k.FO=function(){var a=A8();S8(this,a)};
g.k.EO=function(){this.bk=A8()};
g.k.dQ=function(){this.Vp=!0;R8(this);G8=!1;H8&&C8(H8,1);H8=null};
g.k.cQ=function(){this.Vp=!1;R8(this);S8(this,this.mh);this.bk=this.mh;G8=!1;H8=null;this.player.playVideo()};
g.k.IJ=function(){this.Ts=!0;R8(this);g.wt("yt-remote-manual-pairing-warning-shown",!0,2592E3);G8=!1;H8&&C8(H8,1);H8=null};
g.k.ke=function(a,b){switch(a){case "casting":return this.loaded;case "receivers":return this.Jk;case "currentReceiver":return b&&("cast-selector-receiver"===b.key?Q7():S8(this,b)),this.loaded?this.bk:this.mh;case "quickCast":return 2===this.Jk.length&&"cast-selector-receiver"===this.Jk[1].key?(b&&Q7(),!0):!1}};
g.k.Qy=function(){this.vb.Qy()};
g.k.Dh=function(){return!1};
g.k.getOptions=function(){return["casting","receivers","currentReceiver","quickCast"]};g.GX.remote=Q8;})(_yt_player);
