(function(g){var window=this;'use strict';var KOa=function(a,b){return g.Ob(a,b)},LOa=function(a,b){b=b instanceof g.Ec?b:g.Kc(b,/^data:image\//i.test(b));
a.src=g.Fc(b)},MOa=function(a){if(a instanceof g.Uh)return a;
if("function"==typeof a.Eg)return a.Eg(!1);if(g.Ma(a)){var b=0,c=new g.Uh;c.i=function(){for(;;){if(b>=a.length)throw g.$h;if(b in a)return a[b++];b++}};
c.next=c.i.bind(c);return c}throw Error("Not implemented");},NOa=function(a,b,c){if(g.Ma(a))try{g.Cb(a,b,c)}catch(d){if(d!==g.$h)throw d;
}else{a=MOa(a);try{for(;;)b.call(c,a.next(),void 0,a)}catch(d){if(d!==g.$h)throw d;}}},C6=function(a){g.pk(a,"zx",Math.floor(2147483648*Math.random()).toString(36)+Math.abs(Math.floor(2147483648*Math.random())^g.Sa()).toString(36));
return a},D6=function(a,b,c){Array.isArray(c)||(c=[String(c)]);
g.uk(a.l,b,c)},OOa=function(a,b){var c=[];
NOa(b,function(d){try{var e=g.kr.prototype.l.call(this,d,!0)}catch(f){if("Storage: Invalid value was encountered"==f)return;throw f;}void 0===e?c.push(d):g.jr(e)&&c.push(d)},a);
return c},POa=function(a,b){OOa(a,b).forEach(function(c){g.kr.prototype.remove.call(this,c)},a)},QOa=function(a){if(a.U){if(a.U.locationOverrideToken)return{locationOverrideToken:a.U.locationOverrideToken};
if(null!=a.U.latitudeE7&&null!=a.U.longitudeE7)return{latitudeE7:a.U.latitudeE7,longitudeE7:a.U.longitudeE7}}return null},ROa=function(a,b){g.kb(a,b)||a.push(b)},E6=function(a){var b=0,c;
for(c in a)b++;return b},SOa=function(a){try{return g.A.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);},F6=function(a){if(g.A.JSON)try{return g.A.JSON.parse(a)}catch(b){}return SOa(a)},TOa=function(a,b,c,d){var e=new g.bk(null,void 0);
a&&g.ck(e,a);b&&g.dk(e,b);c&&g.ek(e,c);d&&(e.J=d);return e},G6=function(a,b){g.uu[a]=!0;
var c=g.ru();c&&c.publish.apply(c,arguments);g.uu[a]=!1},H6=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.bi;this.model=this.brand="";this.year=0;this.chipset=this.osVersion=this.os="";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",UOa(this,a.capabilities||""),VOa(this,a.experiments||""),
this.brand=a.brand||"",this.model=a.model||"",this.year=a.year||0,this.os=a.os||"",this.osVersion=a.osVersion||"",this.chipset=a.chipset||"")},UOa=function(a,b){a.capabilities.clear();
g.Po(b.split(","),g.Qa(KOa,WOa)).forEach(function(c){a.capabilities.add(c)})},VOa=function(a,b){a.experiments.clear();
b.split(",").forEach(function(c){a.experiments.add(c)})},I6=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||"";this.idType=a.screenIdType||"normal"},J6=function(a,b){return!!b&&(a.id==b||a.uuid==b)},XOa=function(a){return{name:a.name,
screenId:a.id,loungeToken:a.token,dialId:a.uuid,screenIdType:a.idType}},YOa=function(a){return new I6(a)},ZOa=function(a){return Array.isArray(a)?g.Oe(a,YOa):[]},K6=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):"-")+",idType:"+a.idType+"}"):"null"},L6=function(a){return Array.isArray(a)?"["+g.Oe(a,K6).join(",")+"]":"null"},M6=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)})},$Oa=function(a){return g.Oe(a,function(b){return{key:b.id,
name:b.name}})},N6=function(a,b){return g.gb(a,function(c){return c||b?!c!=!b?!1:c.id==b.id:!0})},O6=function(a,b){return g.gb(a,function(c){return J6(c,b)})},aPa=function(){var a=(0,g.Vy)();
a&&POa(a,a.i.Eg(!0))},P6=function(){var a=g.Yy("yt-remote-connected-devices")||[];
g.zb(a);return a},bPa=function(a){if(0==a.length)return[];
var b=a[0].indexOf("#"),c=-1==b?a[0]:a[0].substring(0,b);return g.Oe(a,function(d,e){return 0==e?d:d.substring(c.length)})},cPa=function(a){g.Xy("yt-remote-connected-devices",a,86400)},R6=function(){if(Q6)return Q6;
var a=g.Yy("yt-remote-device-id");a||(a=M6(),g.Xy("yt-remote-device-id",a,31536E3));for(var b=P6(),c=1,d=a;g.kb(b,d);)c++,d=a+"#"+c;return Q6=d},S6=function(){var a=P6(),b=R6();
g.kb(a,b);g.az()&&g.Bb(a,b);a=bPa(a);if(0==a.length)try{g.bt("remote_sid")}catch(c){}else try{g.$s("remote_sid",a.join(","),-1)}catch(c){}},dPa=function(){return g.Yy("yt-remote-session-browser-channel")},ePa=function(){return g.Yy("yt-remote-local-screens")||[]},fPa=function(){g.Xy("yt-remote-lounge-token-expiration",!0,86400)},gPa=function(a){5<a.length&&(a=a.slice(a.length-5));
var b=g.Oe(ePa(),function(d){return d.loungeToken}),c=g.Oe(a,function(d){return d.loungeToken});
g.ym(c,function(d){return!g.kb(b,d)})&&fPa();
g.Xy("yt-remote-local-screens",a,31536E3)},hPa=function(a,b){g.Xy("yt-remote-session-browser-channel",a);
g.Xy("yt-remote-session-screen-id",b);a=P6();b=R6();g.kb(a,b)||a.push(b);cPa(a);S6()},T6=function(a){a||(g.$y("yt-remote-session-screen-id"),g.$y("yt-remote-session-video-id"));
S6();a=P6();g.ob(a,R6());cPa(a)},iPa=function(){if(!U6){var a=g.ur();
a&&(U6=new g.er(a))}},jPa=function(){iPa();
return U6?!!U6.get("yt-remote-use-staging-server"):!1},V6=function(){var a=window.navigator.userAgent.match(/Chrome\/([0-9]+)/);
return a?parseInt(a[1],10):0},kPa=function(a){return!!document.currentScript&&(-1!=document.currentScript.src.indexOf("?"+a)||-1!=document.currentScript.src.indexOf("&"+a))},lPa=function(){return"function"==typeof window.__onGCastApiAvailable?window.__onGCastApiAvailable:null},W6=function(a){a.length?mPa(a.shift(),function(){W6(a)}):X6()},nPa=function(a){return"chrome-extension://"+a+"/cast_sender.js"},mPa=function(a,b,c){var d=document.createElement("script");
d.onerror=b;c&&(d.onload=c);g.Bj(d,g.xl(a));(document.head||document.documentElement).appendChild(d)},oPa=function(){var a=V6(),b=[];
if(1<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")}return b},X6=function(){var a=lPa();
a&&a(!1,"No cast extension found")},Y6=function(){if(pPa){var a=2,b=lPa(),c=function(){a--;
0==a&&b&&b(!0)};
window.__onGCastApiAvailable=c;mPa("//www.gstatic.com/cast/sdk/libs/sender/1.0/cast_framework.js",X6,c)}},qPa=function(){Y6();
var a=oPa();a.push("//www.gstatic.com/eureka/clank/cast_sender.js");W6(a)},sPa=function(){Y6();
var a=oPa();a.push.apply(a,g.ma(rPa.map(nPa)));a.push("//www.gstatic.com/eureka/clank/cast_sender.js");W6(a)},Z6=function(a,b,c){g.E.call(this);
this.G=null!=c?(0,g.C)(a,c):a;this.Of=b;this.C=(0,g.C)(this.hN,this);this.i=!1;this.l=0;this.u=this.Gb=null;this.B=[]},$6=function(a,b,c){g.E.call(this);
this.B=null!=c?a.bind(c):a;this.Of=b;this.u=null;this.i=!1;this.l=0;this.Gb=null},a7=function(a){a.Gb=g.jh(function(){a.Gb=null;
a.i&&!a.l&&(a.i=!1,a7(a))},a.Of);
var b=a.u;a.u=null;a.B.apply(null,b)},b7=function(){},c7=function(a,b){if("function"!==typeof a)throw Error("Fn must not be null and must be a function");
return g.A.setTimeout(function(){a()},b)},e7=function(a){d7.dispatchEvent(new tPa(d7,a))},tPa=function(a,b){g.hf.call(this,"statevent",a);
this.stat=b},f7=function(a,b,c,d){this.i=a;
this.l=b;this.K=c;this.J=d||1;this.C=45E3;this.B=new g.vk(this);this.u=new g.ih;this.u.setInterval(250)},vPa=function(a,b,c){a.Ar=1;
a.fm=C6(b.clone());a.np=c;a.G=!0;uPa(a,null)},g7=function(a,b,c,d,e){a.Ar=1;
a.fm=C6(b.clone());a.np=null;a.G=c;e&&(a.gK=!1);uPa(a,d)},uPa=function(a,b){a.gr=Date.now();
h7(a);a.pn=a.fm.clone();D6(a.pn,"t",a.J);a.bv=0;a.Qe=a.i.IA(a.i.Iu()?b:null);0<a.Dz&&(a.Px=new $6((0,g.C)(a.dL,a,a.Qe),a.Dz));a.B.Ra(a.Qe,"readystatechange",a.iN);b=a.Mn?g.Vb(a.Mn):{};a.np?(a.Hy="POST",b["Content-Type"]="application/x-www-form-urlencoded",a.Qe.send(a.pn,a.Hy,a.np,b)):(a.Hy="GET",a.gK&&!g.ig&&(b.Connection="close"),a.Qe.send(a.pn,a.Hy,null,b));a.i.Zi(1)},yPa=function(a,b,c){for(var d=!0;!a.Yn&&a.bv<c.length;){var e=wPa(a,c);
if(e==i7){4==b&&(a.Yl=4,e7(15),d=!1);break}else if(e==xPa){a.Yl=4;e7(16);d=!1;break}else j7(a,e)}4==b&&0==c.length&&(a.Yl=1,e7(17),d=!1);a.lj=a.lj&&d;d||(k7(a),l7(a))},wPa=function(a,b){var c=a.bv,d=b.indexOf("\n",c);
if(-1==d)return i7;c=Number(b.substring(c,d));if(isNaN(c))return xPa;d+=1;if(d+c>b.length)return i7;b=b.substr(d,c);a.bv=d+c;return b},APa=function(a,b){a.gr=Date.now();
h7(a);var c=b?window.location.hostname:"";a.pn=a.fm.clone();g.pk(a.pn,"DOMAIN",c);g.pk(a.pn,"t",a.J);try{a.qj=new ActiveXObject("htmlfile")}catch(m){k7(a);a.Yl=7;e7(22);l7(a);return}var d="<html><body>";if(b){var e="";for(b=0;b<c.length;b++){var f=c.charAt(b);if("<"==f)f=e+"\\x3c";else if(">"==f)f=e+"\\x3e";else{if(f in m7)f=m7[f];else if(f in zPa)f=m7[f]=zPa[f];else{var h=f.charCodeAt(0);if(31<h&&127>h)var l=f;else{if(256>h){if(l="\\x",16>h||256<h)l+="0"}else l="\\u",4096>h&&(l+="0");l+=h.toString(16).toUpperCase()}f=
m7[f]=l}f=e+f}e=f}d+='<script>document.domain="'+e+'"\x3c/script>'}c=g.dd(g.fc("b/12014412"),d+"</body></html>");a.qj.open();a.qj.write(g.$c(c));a.qj.close();a.qj.parentWindow.m=(0,g.C)(a.uT,a);a.qj.parentWindow.d=(0,g.C)(a.yJ,a,!0);a.qj.parentWindow.rpcClose=(0,g.C)(a.yJ,a,!1);c=a.qj.createElement("DIV");a.qj.parentWindow.document.body.appendChild(c);d=g.Jc(a.pn.toString());d=g.qd(g.Fc(d));d=g.dd(g.fc("b/12014412"),'<iframe src="'+d+'"></iframe>');g.jd(c,d);a.i.Zi(1)},h7=function(a){a.VD=Date.now()+
a.C;
BPa(a,a.C)},BPa=function(a,b){if(null!=a.Fr)throw Error("WatchDog timer not null");
a.Fr=c7((0,g.C)(a.CT,a),b)},n7=function(a){a.Fr&&(g.A.clearTimeout(a.Fr),a.Fr=null)},l7=function(a){a.i.We()||a.Yn||a.i.Bv(a)},k7=function(a){n7(a);
g.ef(a.Px);a.Px=null;a.u.stop();g.xk(a.B);if(a.Qe){var b=a.Qe;a.Qe=null;b.abort();b.dispose()}a.qj&&(a.qj=null)},j7=function(a,b){try{a.i.rJ(a,b),a.i.Zi(4)}catch(c){}},DPa=function(a,b,c,d,e){if(0==d)c(!1);
else{var f=e||0;d--;CPa(a,b,function(h){h?c(!0):g.A.setTimeout(function(){DPa(a,b,c,d,f)},f)})}},CPa=function(a,b,c){var d=new Image;
d.onload=function(){try{o7(d),c(!0)}catch(e){}};
d.onerror=function(){try{o7(d),c(!1)}catch(e){}};
d.onabort=function(){try{o7(d),c(!1)}catch(e){}};
d.ontimeout=function(){try{o7(d),c(!1)}catch(e){}};
g.A.setTimeout(function(){if(d.ontimeout)d.ontimeout()},b);
LOa(d,a)},o7=function(a){a.onload=null;
a.onerror=null;a.onabort=null;a.ontimeout=null},EPa=function(a){this.i=a;
this.l=new b7},FPa=function(a){var b=p7(a.i,a.As,"/mail/images/cleardot.gif");
C6(b);DPa(b.toString(),5E3,(0,g.C)(a.eO,a),3,2E3);a.Zi(1)},r7=function(a){var b=a.i.K;
if(null!=b)e7(5),b?(e7(11),q7(a.i,a,!1)):(e7(12),q7(a.i,a,!0));else if(a.Xg=new f7(a,void 0,void 0,void 0),a.Xg.Mn=a.Ez,b=a.i,b=p7(b,b.Iu()?a.ds:null,a.Fz),e7(5),!g.fe||g.Xd(10))D6(b,"TYPE","xmlhttp"),g7(a.Xg,b,!1,a.ds,!1);else{D6(b,"TYPE","html");var c=a.Xg;a=!!a.ds;c.Ar=3;c.fm=C6(b.clone());APa(c,a)}},s7=function(a,b,c){this.Oa=1;
this.i=[];this.u=[];this.B=new b7;this.J=a||null;this.K=null!=b?b:null;this.C=c||!1},GPa=function(a,b){this.i=a;
this.map=b;this.context=null},HPa=function(a,b,c,d){g.hf.call(this,"timingevent",a);
this.size=b;this.Cu=d},IPa=function(a){g.hf.call(this,"serverreachability",a)},LPa=function(a){JPa(a);
if(3==a.Oa){var b=a.St++,c=a.dw.clone();g.pk(c,"SID",a.l);g.pk(c,"RID",b);g.pk(c,"TYPE","terminate");t7(a,c);b=new f7(a,a.l,b,void 0);b.Ar=2;b.fm=C6(c.clone());LOa(new Image,b.fm.toString());b.gr=Date.now();h7(b)}KPa(a)},MPa=function(a){a.EO(1,0);
a.dw=p7(a,null,a.Gz);u7(a)},JPa=function(a){a.lm&&(a.lm.abort(),a.lm=null);
a.oe&&(a.oe.cancel(),a.oe=null);a.Vk&&(g.A.clearTimeout(a.Vk),a.Vk=null);v7(a);a.Lg&&(a.Lg.cancel(),a.Lg=null);a.xm&&(g.A.clearTimeout(a.xm),a.xm=null)},NPa=function(a,b){if(0==a.Oa)throw Error("Invalid operation: sending map when state is closed");
a.i.push(new GPa(a.nQ++,b));2!=a.Oa&&3!=a.Oa||u7(a)},OPa=function(a){var b=0;
a.oe&&b++;a.Lg&&b++;return b},u7=function(a){a.Lg||a.xm||(a.xm=c7((0,g.C)(a.wJ,a),0),a.zq=0)},QPa=function(a,b){if(1==a.Oa){if(!b){a.St=Math.floor(1E5*Math.random());
b=a.St++;var c=new f7(a,"",b,void 0);c.Mn=a.Ej;var d=w7(a),e=a.dw.clone();g.pk(e,"RID",b);g.pk(e,"CVER","1");t7(a,e);vPa(c,e,d);a.Lg=c;a.Oa=2}}else 3==a.Oa&&(b?PPa(a,b):0==a.i.length||a.Lg||PPa(a))},PPa=function(a,b){if(b)if(6<a.Zn){a.i=a.u.concat(a.i);
a.u.length=0;var c=a.St-1;b=w7(a)}else c=b.K,b=b.np;else c=a.St++,b=w7(a);var d=a.dw.clone();g.pk(d,"SID",a.l);g.pk(d,"RID",c);g.pk(d,"AID",a.Oq);t7(a,d);c=new f7(a,a.l,c,a.zq+1);c.Mn=a.Ej;c.setTimeout(1E4+Math.round(1E4*Math.random()));a.Lg=c;vPa(c,d,b)},t7=function(a,b){a.Kf&&(a=a.Kf.YG())&&g.Eb(a,function(c,d){g.pk(b,d,c)})},w7=function(a){var b=Math.min(a.i.length,1E3),c=["count="+b];
if(6<a.Zn&&0<b){var d=a.i[0].i;c.push("ofs="+d)}else d=0;for(var e={},f=0;f<b;e={Qp:e.Qp},f++){e.Qp=a.i[f].i;var h=a.i[f].map;e.Qp=6>=a.Zn?f:e.Qp-d;try{g.Eb(h,function(l){return function(m,n){c.push("req"+l.Qp+"_"+n+"="+encodeURIComponent(m))}}(e))}catch(l){c.push("req"+e.Qp+"_type="+encodeURIComponent("_badmap"))}}a.u=a.u.concat(a.i.splice(0,b));
return c.join("&")},RPa=function(a){a.oe||a.Vk||(a.G=1,a.Vk=c7((0,g.C)(a.vJ,a),0),a.iq=0)},x7=function(a){if(a.oe||a.Vk||3<=a.iq)return!1;
a.G++;a.Vk=c7((0,g.C)(a.vJ,a),SPa(a,a.iq));a.iq++;return!0},q7=function(a,b,c){a.Fy=c;
a.Fj=b.Fk;a.C||MPa(a)},v7=function(a){null!=a.zo&&(g.A.clearTimeout(a.zo),a.zo=null)},SPa=function(a,b){var c=5E3+Math.floor(1E4*Math.random());
a.isActive()||(c*=2);return c*b},y7=function(a,b){if(2==b||9==b){var c=null;
a.Kf&&(c=null);var d=(0,g.C)(a.CU,a);c||(c=new g.bk("//www.google.com/images/cleardot.gif"),C6(c));CPa(c.toString(),1E4,d)}else e7(2);TPa(a,b)},TPa=function(a,b){a.Oa=0;
a.Kf&&a.Kf.oG(b);KPa(a);JPa(a)},KPa=function(a){a.Oa=0;
a.Fj=-1;if(a.Kf)if(0==a.u.length&&0==a.i.length)a.Kf.vA();else{g.rb(a.u);var b=g.rb(a.i);a.u.length=0;a.i.length=0;a.Kf.vA(b)}},p7=function(a,b,c){var d=g.qk(c);
if(""!=d.i)b&&g.dk(d,b+"."+d.i),g.ek(d,d.u);else{var e=window.location;d=TOa(e.protocol,b?b+"."+e.hostname:e.hostname,+e.port,c)}a.Ps&&g.Eb(a.Ps,function(f,h){g.pk(d,h,f)});
g.pk(d,"VER",a.Zn);t7(a,d);return d},UPa=function(){},VPa=function(){this.i=[];
this.l=[]},WPa=function(a,b){this.action=a;
this.params=b||{}},z7=function(a,b){g.E.call(this);
this.i=new g.J(this.mT,0,this);g.F(this,this.i);this.Of=5E3;this.l=0;if("function"===typeof a)b&&(a=(0,g.C)(a,b));else if(a&&"function"===typeof a.handleEvent)a=(0,g.C)(a.handleEvent,a);else throw Error("Invalid listener argument");this.u=a},A7=function(a,b,c,d,e){c=void 0===c?!1:c;
d=void 0===d?function(){return""}:d;
e=void 0===e?!1:e;this.ma=a;this.G=b;this.u=new g.dr;this.l=new z7(this.hU,this);this.i=null;this.Y=!1;this.C=null;this.U="";this.K=this.B=0;this.J=[];this.va=c;this.X=d;this.xa=e},XPa=function(a){return{firstTestResults:[""],
secondTestResults:!a.i.Fy,sessionId:a.i.l,arrayId:a.i.Oq}},YPa=function(a,b){a.K=b||0;
a.l.stop();B7(a);a.i&&(3==a.i.getState()&&QPa(a.i),LPa(a.i));a.K=0},C7=function(a){return!!a.i&&3==a.i.getState()},B7=function(a){if(a.i){var b=a.X(),c=a.i.Ej||{};
b?c["x-youtube-lounge-xsrf-token"]=b:delete c["x-youtube-lounge-xsrf-token"];a.i.Ej=c}},D7=function(a){this.port=this.domain="";
this.i="/api/lounge";this.l=!0;a=a||document.location.href;var b=Number(g.hi(4,a))||"";b&&(this.port=":"+b);this.domain=g.ii(a)||"";a=g.Tc;0<=a.search("MSIE")&&(a=a.match(/MSIE ([\d.]+)/)[1],0>g.Cc(a,"10.0")&&(this.l=!1))},E7=function(a,b){var c=a.i;
a.l&&(c="https://"+a.domain+a.port+a.i);return g.ti(c+b,{})},F7=function(a,b,c,d,e){a={format:"JSON",
method:"POST",context:a,timeout:5E3,withCredentials:!1,onSuccess:g.Qa(a.B,d,!0),onError:g.Qa(a.u,e),onTimeout:g.Qa(a.C,e)};c&&(a.postParams=c,a.headers={"Content-Type":"application/x-www-form-urlencoded"});return g.Ps(b,a)},bQa=function(){var a=ZPa;
$Pa();G7.push(a);aQa()},H7=function(a,b){$Pa();
var c=cQa(a,String(b));0==G7.length?dQa(c):(aQa(),g.Cb(G7,function(d){d(c)}))},$Pa=function(){G7||(G7=g.Ia("yt.mdx.remote.debug.handlers_")||[],g.Ha("yt.mdx.remote.debug.handlers_",G7,void 0))},dQa=function(a){var b=(I7+1)%50;
I7=b;J7[b]=a;K7||(K7=49==b)},aQa=function(){var a=G7;
if(J7[0]){var b=K7?I7:-1;do{b=(b+1)%50;var c=J7[b];g.Cb(a,function(d){d(c)})}while(b!=I7);
J7=Array(50);I7=-1;K7=!1}},cQa=function(a,b){var c=(Date.now()-eQa)/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("")},L7=function(a){g.Q.call(this);
this.G=a;this.screens=[]},fQa=function(a,b){var c=a.get(b.uuid)||a.get(b.id);
if(c)return a=c.name,c.id=b.id||c.id,c.name=b.name,c.token=b.token,c.uuid=b.uuid||c.uuid,c.name!=a;a.screens.push(b);return!0},gQa=function(a,b){var c=a.screens.length!=b.length;
a.screens=g.Po(a.screens,function(f){return!!N6(b,f)});
for(var d=0,e=b.length;d<e;d++)c=fQa(a,b[d])||c;return c},hQa=function(a,b){var c=a.screens.length;
a.screens=g.Po(a.screens,function(d){return!(d||b?!d!=!b?0:d.id==b.id:1)});
return a.screens.length<c},M7=function(a,b,c,d,e){g.Q.call(this);
this.u=a;this.J=b;this.B=c;this.G=d;this.C=e;this.l=0;this.i=null;this.Gb=NaN},O7=function(a){L7.call(this,"LocalScreenService");
this.l=a;this.i=NaN;N7(this);this.info("Initializing with "+L6(this.screens))},iQa=function(a){if(a.screens.length){var b=g.Oe(a.screens,function(d){return d.id}),c=E7(a.l,"/pairing/get_lounge_token_batch");
F7(a.l,c,{screen_ids:b.join(",")},(0,g.C)(a.dP,a),(0,g.C)(a.cP,a))}},N7=function(a){if(g.Nr("deprecate_pair_servlet_enabled"))return gQa(a,[]);
var b=ZOa(ePa());b=g.Po(b,function(c){return!c.uuid});
return gQa(a,b)},P7=function(a,b){gPa(g.Oe(a.screens,XOa));
b&&fPa()},R7=function(a,b){g.Q.call(this);
this.G=b;b=(b=g.Yy("yt-remote-online-screen-ids")||"")?b.split(","):[];for(var c={},d=this.G(),e=0,f=d.length;e<f;++e){var h=d[e].id;c[h]=g.kb(b,h)}this.i=c;this.C=a;this.u=this.B=NaN;this.l=null;Q7("Initialized with "+g.Nh(this.i))},S7=function(a,b,c){var d=E7(a.C,"/pairing/get_screen_availability");
F7(a.C,d,{lounge_token:b.token},(0,g.C)(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.C)(function(){c(!1)},a))},T7=function(a,b){a:if(E6(b)!=E6(a.i))var c=!1;
else{c=g.Mb(b);for(var d=0,e=c.length;d<e;++d)if(!a.i[c[d]]){c=!1;break a}c=!0}c||(Q7("Updated online screens: "+g.Nh(a.i)),a.i=b,a.W("screenChange"));jQa(a)},U7=function(a){isNaN(a.u)||g.os(a.u);
a.u=g.ms((0,g.C)(a.UC,a),0<a.B&&a.B<g.Sa()?2E4:1E4)},Q7=function(a){H7("OnlineScreenService",a)},kQa=function(a){var b={};
g.Cb(a.G(),function(c){c.token?b[c.token]=c.id:this.Sd("Requesting availability of screen w/o lounge token.")});
return b},jQa=function(a){a=g.Mb(g.Fb(a.i,function(b){return b}));
g.zb(a);a.length?g.Xy("yt-remote-online-screen-ids",a.join(","),60):g.$y("yt-remote-online-screen-ids")},V7=function(a,b){b=void 0===b?!1:b;
L7.call(this,"ScreenService");this.B=a;this.J=b;this.i=this.l=null;this.u=[];this.C={};lQa(this)},nQa=function(a,b,c,d,e,f){a.info("getAutomaticScreenByIds "+c+" / "+b);
c||(c=a.C[b]);var h=a.nh(),l=c?O6(h,c):null;c&&(a.J||l)||(l=O6(h,b));if(l){l.uuid=b;var m=W7(a,l);S7(a.i,m,function(n){e(n?m:null)})}else c?mQa(a,c,(0,g.C)(function(n){var p=W7(this,new I6({name:d,
screenId:c,loungeToken:n,dialId:b||""}));S7(this.i,p,function(r){e(r?p:null)})},a),f):e(null)},oQa=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},pQa=function(a,b,c){S7(a.i,b,c)},mQa=function(a,b,c,d){a.info("requestLoungeToken_ for "+b);
var e={postParams:{screen_ids:b},method:"POST",context:a,onSuccess:function(f,h){f=h&&h.screens||[];f[0]&&f[0].screenId==b?c(f[0].loungeToken):d(Error("Missing lounge token in token response"))},
onError:function(){d(Error("Request screen lounge token failed"))}};
g.Ps(E7(a.B,"/pairing/get_lounge_token_batch"),e)},qQa=function(a){a.screens=a.l.nh();
var b=a.C,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: "+L6(a.screens))},lQa=function(a){X7(a);
a.l=new O7(a.B);a.l.subscribe("screenChange",(0,g.C)(a.mP,a));qQa(a);a.J||(a.u=ZOa(g.Yy("yt-remote-automatic-screen-cache")||[]));X7(a);a.info("Initializing automatic screens: "+L6(a.u));a.i=new R7(a.B,(0,g.C)(a.nh,a,!0));a.i.subscribe("screenChange",(0,g.C)(function(){this.W("onlineScreenChange")},a))},W7=function(a,b){var c=a.get(b.id);
c?(c.uuid=b.uuid,b=c):((c=O6(a.u,b.uuid))?(c.id=b.id,c.token=b.token,b=c):a.u.push(b),a.J||rQa(a));X7(a);a.C[b.uuid]=b.id;g.Xy("yt-remote-device-id-map",a.C,31536E3);return b},rQa=function(a){a=g.Po(a.u,function(b){return"shortLived"!=b.idType});
g.Xy("yt-remote-automatic-screen-cache",g.Oe(a,XOa))},X7=function(a){a.C=g.Yy("yt-remote-device-id-map")||{}},Y7=function(a,b,c){g.Q.call(this);
this.xa=c;this.u=a;this.i=b;this.B=null},Z7=function(a,b){a.B=b;
a.W("sessionScreen",a.B)},sQa=function(a,b){a.B&&(a.B.token=b,W7(a.u,a.B));
a.W("sessionScreen",a.B)},$7=function(a,b){H7(a.xa,b)},a8=function(a,b,c){Y7.call(this,a,b,"CastSession");
var d=this;this.config_=c;this.l=null;this.X=(0,g.C)(this.nN,this);this.va=(0,g.C)(this.FT,this);this.Y=g.ms(function(){tQa(d,null)},12E4);
this.J=this.C=this.G=this.K=0;this.ma=!1;this.U="unknown"},b8=function(a,b){g.os(a.J);
a.J=0;0==b?uQa(a):a.J=g.ms(function(){uQa(a)},b)},uQa=function(a){vQa(a,"getLoungeToken");
g.os(a.C);a.C=g.ms(function(){wQa(a,null)},3E4)},vQa=function(a,b){a.info("sendYoutubeMessage_: "+b+" "+g.Nh(void 0));
var c={};c.type=b;a.l?a.l.sendMessage("urn:x-cast:com.google.youtube.mdx",c,g.Ja,(0,g.C)(function(){$7(this,"Failed to send message: "+b+".")},a)):$7(a,"Sending yt message without session: "+g.Nh(c))},c8=function(a,b){b?(a.info("onConnectedScreenId_: Received screenId: "+b),a.getScreen()&&a.getScreen().id==b||a.nH(b,function(c){Z7(a,c)},function(){return a.og()},5)):a.og(Error("Waiting for session status timed out."))},yQa=function(a,b,c){a.info("onConnectedScreenData_: Received screenData: "+JSON.stringify(b));
var d=new I6(b);xQa(a,d,function(e){e?(a.ma=!0,W7(a.u,d),Z7(a,d),a.U="unknown",b8(a,c)):(g.Sr(Error("CastSession, RemoteScreen from screenData: "+JSON.stringify(b)+" is not online.")),a.og())},5)},tQa=function(a,b){g.os(a.Y);
a.Y=0;b?a.config_.enableCastLoungeToken&&b.loungeToken?b.deviceId?a.getScreen()&&a.getScreen().uuid==b.deviceId||(b.loungeTokenRefreshIntervalMs?yQa(a,{name:a.i.friendlyName,screenId:b.screenId,loungeToken:b.loungeToken,dialId:b.deviceId,screenIdType:"shortLived"},b.loungeTokenRefreshIntervalMs):(g.Sr(Error("No loungeTokenRefreshIntervalMs presents in mdxSessionStatusData: "+JSON.stringify(b)+".")),c8(a,b.screenId))):(g.Sr(Error("No device id presents in mdxSessionStatusData: "+JSON.stringify(b)+
".")),c8(a,b.screenId)):c8(a,b.screenId):a.og(Error("Waiting for session status timed out."))},wQa=function(a,b){g.os(a.C);
a.C=0;var c=null;if(b)if(b.loungeToken){var d;(null==(d=a.getScreen())?void 0:d.token)==b.loungeToken&&(c="staleLoungeToken")}else c="missingLoungeToken";else c="noLoungeTokenResponse";c?(a.info("Did not receive a new lounge token in onLoungeToken_ with data: "+(JSON.stringify(b)+", error: "+c)),a.U=c,b8(a,3E4)):(sQa(a,b.loungeToken),a.ma=!1,a.U="unknown",b8(a,b.loungeTokenRefreshIntervalMs))},xQa=function(a,b,c,d){g.os(a.G);
a.G=0;pQa(a.u,b,function(e){e||0>d?c(e):a.G=g.ms(function(){xQa(a,b,c,d-1)},300)})},zQa=function(a){g.os(a.K);
a.K=0;g.os(a.G);a.G=0;g.os(a.Y);a.Y=0;g.os(a.C);a.C=0;g.os(a.J);a.J=0},d8=function(a,b,c,d){Y7.call(this,a,b,"DialSession");
this.config_=d;this.l=this.K=null;this.va="";this.Da=c;this.Ea=null;this.Y=g.Ja;this.U=NaN;this.Aa=(0,g.C)(this.oN,this);this.C=g.Ja;this.J=this.G=0;this.X=!1;this.ma="unknown"},e8=function(a){var b;
return!!(a.config_.enableDialLoungeToken&&(null==(b=a.l)?0:b.getDialAppInfo))},AQa=function(a){a.C=a.u.TE(a.va,a.i.label,a.i.friendlyName,e8(a),function(b,c){a.C=g.Ja;
a.X=!0;Z7(a,b);"shortLived"==b.idType&&0<c&&f8(a,c)},function(b){a.C=g.Ja;
a.og(b)})},BQa=function(a){var b={};
b.pairingCode=a.va;b.theme=a.Da;jPa()&&(b.env_useStageMdx=1);return g.ri(b)},g8=function(a){return new Promise(function(b){a.va=M6();
if(a.Ea){var c=new chrome.cast.DialLaunchResponse(!0,BQa(a));b(c);AQa(a)}else a.Y=function(){g.os(a.U);a.Y=function(){};
a.U=NaN;var d=new chrome.cast.DialLaunchResponse(!0,BQa(a));b(d);AQa(a)},a.U=g.ms(function(){a.Y()},100)})},DQa=function(a,b,c){a.info("initOnConnectedScreenDataPromise_: Received screenData: "+JSON.stringify(b));
var d=new I6(b);return(new Promise(function(e){CQa(a,d,function(f){f?(a.X=!0,W7(a.u,d),Z7(a,d),f8(a,c)):g.Sr(Error("DialSession, RemoteScreen from screenData: "+JSON.stringify(b)+" is not online."));e(f)},5)})).then(function(e){return e?new chrome.cast.DialLaunchResponse(!1):g8(a)})},EQa=function(a,b){var c=a.K.receiver.label,d=a.i.friendlyName;
return(new Promise(function(e){nQa(a.u,c,b,d,function(f){f&&f.token&&Z7(a,f);e(f)},function(f){$7(a,"Failed to get DIAL screen: "+f);
e(null)})})).then(function(e){return e&&e.token?new chrome.cast.DialLaunchResponse(!1):g8(a)})},CQa=function(a,b,c,d){g.os(a.G);
a.G=0;pQa(a.u,b,function(e){e||0>d?c(e):a.G=g.ms(function(){CQa(a,b,c,d-1)},300)})},f8=function(a,b){a.info("getDialAppInfoWithTimeout_ "+b);
e8(a)&&(g.os(a.J),a.J=0,0==b?FQa(a):a.J=g.ms(function(){FQa(a)},b))},FQa=function(a){e8(a)&&a.l.getDialAppInfo(function(b){a.info("getDialAppInfo dialLaunchData: "+JSON.stringify(b));
b=b.extraData||{};var c=null;if(b.loungeToken){var d;(null==(d=a.getScreen())?void 0:d.token)==b.loungeToken&&(c="staleLoungeToken")}else c="missingLoungeToken";c?(a.ma=c,f8(a,3E4)):(a.X=!1,a.ma="unknown",sQa(a,b.loungeToken),f8(a,b.loungeTokenRefreshIntervalMs))},function(b){a.info("getDialAppInfo error: "+b);
a.ma="noLoungeTokenResponse";f8(a,3E4)})},GQa=function(a){g.os(a.G);
a.G=0;g.os(a.J);a.J=0;a.C();a.C=function(){};
g.os(a.U)},h8=function(a,b){Y7.call(this,a,b,"ManualSession");
this.l=g.ms((0,g.C)(this.Pq,this,null),150)},i8=function(a,b){g.Q.call(this);
this.config_=b;this.l=a;this.J=b.appId||"233637DE";this.B=b.theme||"cl";this.K=b.disableCastApi||!1;this.U=b.forceMirroring||!1;this.i=null;this.G=!1;this.u=[];this.C=(0,g.C)(this.xS,this)},HQa=function(a,b){return b?g.gb(a.u,function(c){return J6(b,c.label)},a):null},j8=function(a){H7("Controller",a)},ZPa=function(a){window.chrome&&chrome.cast&&chrome.cast.logMessage&&chrome.cast.logMessage(a)},k8=function(a){return a.G||!!a.u.length||!!a.i},l8=function(a,b,c){b!=a.i&&(g.ef(a.i),(a.i=b)?(c?a.W("yt-remote-cast2-receiver-resumed",
b.i):a.W("yt-remote-cast2-receiver-selected",b.i),b.subscribe("sessionScreen",(0,g.C)(a.uJ,a,b)),b.getScreen()?a.W("yt-remote-cast2-session-change",b.getScreen()):c&&a.i.Pq(null)):a.W("yt-remote-cast2-session-change",null))},IQa=function(a){var b=a.l.SE(),c=a.i&&a.i.i;
a=g.Oe(b,function(d){c&&J6(d,c.label)&&(c=null);var e=d.uuid?d.uuid:d.id,f=HQa(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},NQa=function(a,b,c,d){d.disableCastApi?m8("Cannot initialize because disabled by Mdx config."):JQa()?KQa(b,d)&&(n8(!0),window.chrome&&chrome.cast&&chrome.cast.isAvailable?LQa(a,c):(window.__onGCastApiAvailable=function(e,f){e?LQa(a,c):(o8("Failed to load cast API: "+f),p8(!1),n8(!1),g.$y("yt-remote-cast-available"),g.$y("yt-remote-cast-receiver"),
MQa(),c(!1))},d.loadCastApiSetupScript?g.bz("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?60<=V6()&&qPa():!window.chrome||!window.navigator.presentation||0<=window.navigator.userAgent.indexOf("Edge")?X6():89<=V6()?sPa():(Y6(),W6(rPa.map(nPa))))):m8("Cannot initialize because not running Chrome")},MQa=function(){m8("dispose");
var a=q8();a&&a.dispose();g.Ha("yt.mdx.remote.cloudview.instance_",null,void 0);OQa(!1);g.xu(r8);r8.length=0},s8=function(){return!!g.Yy("yt-remote-cast-installed")},PQa=function(){var a=g.Yy("yt-remote-cast-receiver");
return a?a.friendlyName:null},QQa=function(){m8("clearCurrentReceiver");
g.$y("yt-remote-cast-receiver")},RQa=function(){return s8()?q8()?q8().getCastSession():(o8("getCastSelector: Cast is not initialized."),null):(o8("getCastSelector: Cast API is not installed!"),null)},u8=function(){s8()?q8()?t8()?(m8("Requesting cast selector."),q8().requestSession()):(m8("Wait for cast API to be ready to request the session."),r8.push(g.wu("yt-remote-cast2-api-ready",u8))):o8("requestCastSelector: Cast is not initialized."):o8("requestCastSelector: Cast API is not installed!")},v8=
function(a,b){t8()?q8().setConnectedScreenStatus(a,b):o8("setConnectedScreenStatus called before ready.")},JQa=function(){var a=0<=g.Tc.search(/ (CrMo|Chrome|CriOS)\//);
return g.aj||a},SQa=function(a,b){q8().init(a,b)},KQa=function(a,b){var c=!1;
q8()||(a=new i8(a,b),a.subscribe("yt-remote-cast2-availability-change",function(d){g.Xy("yt-remote-cast-available",d);G6("yt-remote-cast2-availability-change",d)}),a.subscribe("yt-remote-cast2-receiver-selected",function(d){m8("onReceiverSelected: "+d.friendlyName);
g.Xy("yt-remote-cast-receiver",d);G6("yt-remote-cast2-receiver-selected",d)}),a.subscribe("yt-remote-cast2-receiver-resumed",function(d){m8("onReceiverResumed: "+d.friendlyName);
g.Xy("yt-remote-cast-receiver",d);G6("yt-remote-cast2-receiver-resumed",d)}),a.subscribe("yt-remote-cast2-session-change",function(d){m8("onSessionChange: "+K6(d));
d||g.$y("yt-remote-cast-receiver");G6("yt-remote-cast2-session-change",d)}),g.Ha("yt.mdx.remote.cloudview.instance_",a,void 0),c=!0);
m8("cloudview.createSingleton_: "+c);return c},q8=function(){return g.Ia("yt.mdx.remote.cloudview.instance_")},LQa=function(a,b){p8(!0);
n8(!1);SQa(a,function(c){c?(OQa(!0),g.yu("yt-remote-cast2-api-ready")):(o8("Failed to initialize cast API."),p8(!1),g.$y("yt-remote-cast-available"),g.$y("yt-remote-cast-receiver"),MQa());b(c)})},m8=function(a){H7("cloudview",a)},o8=function(a){H7("cloudview",a)},p8=function(a){m8("setCastInstalled_ "+a);
g.Xy("yt-remote-cast-installed",a)},t8=function(){return!!g.Ia("yt.mdx.remote.cloudview.apiReady_")},OQa=function(a){m8("setApiReady_ "+a);
g.Ha("yt.mdx.remote.cloudview.apiReady_",a,void 0)},n8=function(a){g.Ha("yt.mdx.remote.cloudview.initializing_",a,void 0)},w8=function(a){this.index=-1;
this.videoId=this.listId="";this.volume=this.playerState=-1;this.muted=!1;this.audioTrackId=null;this.G=this.J=0;this.trackData=null;this.hasNext=this.Vj=!1;this.K=this.C=this.i=this.B=0;this.u=NaN;this.l=!1;this.reset(a)},x8=function(a){a.audioTrackId=null;
a.trackData=null;a.playerState=-1;a.Vj=!1;a.hasNext=!1;a.J=0;a.G=g.Sa();a.B=0;a.i=0;a.C=0;a.K=0;a.u=NaN;a.l=!1},y8=function(a){return a.tc()?(g.Sa()-a.G)/1E3:0},z8=function(a,b){a.J=b;
a.G=g.Sa()},A8=function(a){switch(a.playerState){case 1:case 1081:return(g.Sa()-a.G)/1E3+a.J;
case -1E3:return 0}return a.J},B8=function(a,b,c){var d=a.videoId;
a.videoId=b;a.index=c;b!=d&&x8(a)},C8=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.Wb(a.trackData);b.hasPrevious=a.Vj;b.hasNext=a.hasNext;b.playerTime=a.J;b.playerTimeAt=a.G;b.seekableStart=a.B;b.seekableEnd=a.i;b.duration=a.C;b.loadedTime=a.K;b.liveIngestionTime=a.u;return b},E8=function(a,b){g.Q.call(this);
this.Oa=0;this.u=a;this.C=[];this.B=new VPa;this.l=this.i=null;this.K=(0,g.C)(this.WQ,this);this.G=(0,g.C)(this.Wt,this);this.J=(0,g.C)(this.VQ,this);this.U=(0,g.C)(this.dR,this);var c=0;a?(c=a.getProxyState(),3!=c&&(a.subscribe("proxyStateChange",this.gD,this),TQa(this))):c=3;0!=c&&(b?this.gD(c):g.ms((0,g.C)(function(){this.gD(c)},this),0));
(a=RQa())&&D8(this,a);this.subscribe("yt-remote-cast2-session-change",this.U)},F8=function(a){return new w8(a.u.getPlayerContextData())},TQa=function(a){g.Cb("nowAutoplaying autoplayDismissed remotePlayerChange remoteQueueChange autoplayModeChange autoplayUpNext previousNextChange".split(" "),function(b){this.C.push(this.u.subscribe(b,g.Qa(this.uS,b),this))},a)},UQa=function(a){g.Cb(a.C,function(b){this.u.unsubscribeByKey(b)},a);
a.C.length=0},G8=function(a){return 1==a.getState()},H8=function(a,b){var c=a.B;
50>c.i.length+c.l.length&&a.B.l.push(b)},J8=function(a,b,c){var d=F8(a);
z8(d,c);-1E3!=d.playerState&&(d.playerState=b);I8(a,d)},K8=function(a,b,c){a.u.sendMessage(b,c)},I8=function(a,b){UQa(a);
a.u.setPlayerContextData(C8(b));TQa(a)},D8=function(a,b){a.l&&(a.l.removeUpdateListener(a.K),a.l.removeMediaListener(a.G),a.Wt(null));
a.l=b;a.l&&(H7("CP","Setting cast session: "+a.l.sessionId),a.l.addUpdateListener(a.K),a.l.addMediaListener(a.G),a.l.media.length&&a.Wt(a.l.media[0]))},VQa=function(a){var b=a.i.media,c=a.i.customData;
if(b&&c){var d=F8(a);b.contentId!=d.videoId&&H7("CP","Cast changing video to: "+b.contentId);d.videoId=b.contentId;d.playerState=c.playerState;z8(d,a.i.getEstimatedTime());I8(a,d)}else H7("CP","No cast media video. Ignoring state update.")},L8=function(a,b,c){return(0,g.C)(function(d){this.Sd("Failed to "+b+" with cast v2 channel. Error code: "+d.code);
d.code!=chrome.cast.ErrorCode.TIMEOUT&&(this.Sd("Retrying "+b+" using MDx browser channel."),K8(this,b,c))},a)},M8=function(a,b,c){g.Q.call(this);
this.C=NaN;this.ma=!1;this.K=this.J=this.Y=this.X=NaN;this.U=[];this.B=this.G=this.u=this.dc=this.i=null;this.xa=a;this.U.push(g.Ot(window,"beforeunload",(0,g.C)(this.YO,this)));this.l=[];this.dc=new w8;this.Aa=b.id;this.va=b.idType;this.i=WQa(this,c);this.i.subscribe("handlerOpened",this.aR,this);this.i.subscribe("handlerClosed",this.XQ,this);this.i.subscribe("handlerError",this.YQ,this);this.i.subscribe("handlerMessage",this.ZQ,this);this.i.dy(b.token);this.subscribe("remoteQueueChange",function(){var d=
this.dc.videoId;g.az()&&g.Xy("yt-remote-session-video-id",d)},this)},N8=function(a){H7("conn",a)},WQa=function(a,b){return new A7(E7(a.xa,"/bc"),b,!1,function(){return a.YE()},"shortLived"==a.va)},O8=function(a,b){a.W("proxyStateChange",b)},XQa=function(a){a.C=g.ms((0,g.C)(function(){N8("Connecting timeout");
this.uq(1)},a),2E4)},P8=function(a){g.os(a.C);
a.C=NaN},Q8=function(a){g.os(a.X);
a.X=NaN},YQa=function(a){R8(a);
a.Y=g.ms((0,g.C)(function(){S8(this,"getNowPlaying")},a),2E4)},R8=function(a){g.os(a.Y);
a.Y=NaN},$Qa=function(a,b){b&&(P8(a),Q8(a));
var c=C7(a.i)&&isNaN(a.C);b==c?b&&(O8(a,1),S8(a,"getSubtitlesTrack")):b?(a.lH()&&a.dc.reset(),O8(a,1),S8(a,"getNowPlaying"),ZQa(a)):a.uq(1)},aRa=function(a,b){var c=b.params.videoId;
delete b.params.videoId;c==a.dc.videoId&&(g.Rb(b.params)?a.dc.trackData=null:a.dc.trackData=b.params,a.W("remotePlayerChange"))},bRa=function(a,b){var c=b.params.videoId||b.params.video_id,d=parseInt(b.params.currentIndex,10);
a.dc.listId=b.params.listId||a.dc.listId;B8(a.dc,c,d);a.W("remoteQueueChange")},dRa=function(a,b){b.params=b.params||{};
bRa(a,b);cRa(a,b);a.W("autoplayDismissed")},cRa=function(a,b){var c=parseInt(b.params.currentTime||b.params.current_time,10);
z8(a.dc,isNaN(c)?0:c);c=parseInt(b.params.state,10);c=isNaN(c)?-1:c;-1==c&&-1E3==a.dc.playerState&&(c=-1E3);a.dc.playerState=c;c=Number(b.params.loadedTime);a.dc.K=isNaN(c)?0:c;c=Number(b.params.duration);a.dc.C=isNaN(c)?0:c;c=a.dc;var d=Number(b.params.liveIngestionTime);c.u=d;c.l=isNaN(d)?!1:!0;c=a.dc;d=Number(b.params.seekableStartTime);b=Number(b.params.seekableEndTime);c.B=isNaN(d)?0:d;c.i=isNaN(b)?0:b;1==a.dc.playerState?YQa(a):R8(a);a.W("remotePlayerChange")},eRa=function(a,b){if(-1E3!=a.dc.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.dc.playerState=c;b=parseInt(b.params.currentTime,10);z8(a.dc,isNaN(b)?0:b);a.W("remotePlayerChange")}},fRa=function(a,b){var c="true"==b.params.muted;
a.dc.volume=parseInt(b.params.volume,10);a.dc.muted=c;a.W("remotePlayerChange")},gRa=function(a,b){a.G=b.params.videoId;
a.W("nowAutoplaying",parseInt(b.params.timeout,10))},hRa=function(a,b){var c="true"==b.params.hasNext;
a.dc.Vj="true"==b.params.hasPrevious;a.dc.hasNext=c;a.W("previousNextChange")},ZQa=function(a){g.os(a.K);
a.K=g.ms((0,g.C)(a.uq,a,1),864E5)},S8=function(a,b,c){c?N8("Sending: action="+b+", params="+g.Nh(c)):N8("Sending: action="+b);
a.i.sendMessage(b,c)},T8=function(a){L7.call(this,"ScreenServiceProxy");
this.ze=a;this.i=[];this.i.push(this.ze.$_s("screenChange",(0,g.C)(this.sN,this)));this.i.push(this.ze.$_s("onlineScreenChange",(0,g.C)(this.bS,this)))},lRa=function(a,b){iPa();
if(!U6||!U6.get("yt-remote-disable-remote-module-for-dev")){b=g.O("MDX_CONFIG")||b;aPa();S6();U8||(U8=new D7(b?b.loungeApiHost:void 0),jPa()&&(U8.i="/api/loungedev"));V8||(V8=g.Ia("yt.mdx.remote.deferredProxies_")||[],g.Ha("yt.mdx.remote.deferredProxies_",V8,void 0));iRa();var c=W8();if(!c){var d=new V7(U8,b?b.disableAutomaticScreenCache||!1:!1);g.Ha("yt.mdx.remote.screenService_",d,void 0);c=W8();var e={};b&&(e={appId:b.appId,disableDial:b.disableDial,theme:b.theme,loadCastApiSetupScript:b.loadCastApiSetupScript,
disableCastApi:b.disableCastApi,enableDialLoungeToken:b.enableDialLoungeToken,enableCastLoungeToken:b.enableCastLoungeToken,forceMirroring:b.forceMirroring});NQa(a,d,function(f){f?X8()&&v8(X8(),"YouTube TV"):d.subscribe("onlineScreenChange",function(){G6("yt-remote-receiver-availability-change")})},e)}b&&!g.Ia("yt.mdx.remote.initialized_")&&(g.Ha("yt.mdx.remote.initialized_",!0,void 0),Y8("Initializing: "+g.Nh(b)),Z8.push(g.wu("yt-remote-cast2-availability-change",function(){G6("yt-remote-receiver-availability-change")})),
Z8.push(g.wu("yt-remote-cast2-receiver-selected",function(){$8(null);
G6("yt-remote-auto-connect","cast-selector-receiver")})),Z8.push(g.wu("yt-remote-cast2-receiver-resumed",function(){G6("yt-remote-receiver-resumed","cast-selector-receiver")})),Z8.push(g.wu("yt-remote-cast2-session-change",jRa)),Z8.push(g.wu("yt-remote-connection-change",function(f){f?v8(X8(),"YouTube TV"):a9()||(v8(null,null),QQa())})),a=b9(),b.isAuto&&(a.id+="#dial"),e=b.capabilities||[],g.Nr("desktop_enable_autoplay")&&e.push("atp"),0<e.length&&(a.capabilities=e),a.name=b.device,a.app=b.app,(b=
b.theme)&&(a.theme=b),Y8(" -- with channel params: "+g.Nh(a)),a?(g.Xy("yt-remote-session-app",a.app),g.Xy("yt-remote-session-name",a.name)):(g.$y("yt-remote-session-app"),g.$y("yt-remote-session-name")),g.Ha("yt.mdx.remote.channelParams_",a,void 0),c.start(),X8()||kRa())}},mRa=function(){var a=W8().ze.$_gos();
var b=c9();b&&d9()&&(N6(a,b)||a.push(b));return $Oa(a)},e9=function(){var a=nRa();
!a&&s8()&&PQa()&&(a={key:"cast-selector-receiver",name:PQa()});return a},nRa=function(){var a=mRa(),b=c9();
b||(b=a9());return g.gb(a,function(c){return b&&J6(b,c.key)?!0:!1})},c9=function(){var a=X8();
if(!a)return null;var b=W8().nh();return O6(b,a)},jRa=function(a){Y8("remote.onCastSessionChange_: "+K6(a));
if(a){var b=c9();if(b&&b.id==a.id){if(v8(b.id,"YouTube TV"),"shortLived"==a.idType&&(a=a.token))f9&&(f9.token=a),(b=d9())&&b.dy(a)}else b&&g9(),h9(a,1)}else d9()&&g9()},g9=function(){t8()?q8().stopSession():o8("stopSession called before API ready.");
var a=d9();a&&(a.disconnect(1),i9(null))},j9=function(){var a=d9();
return!!a&&3!=a.getProxyState()},Y8=function(a){H7("remote",a)},W8=function(){if(!k9){var a=g.Ia("yt.mdx.remote.screenService_");
k9=a?new T8(a):null}return k9},X8=function(){return g.Ia("yt.mdx.remote.currentScreenId_")},oRa=function(a){g.Ha("yt.mdx.remote.currentScreenId_",a,void 0)},pRa=function(){return g.Ia("yt.mdx.remote.connectData_")},$8=function(a){g.Ha("yt.mdx.remote.connectData_",a,void 0)},d9=function(){return g.Ia("yt.mdx.remote.connection_")},i9=function(a){var b=d9();
$8(null);a||oRa("");g.Ha("yt.mdx.remote.connection_",a,void 0);V8&&(g.Cb(V8,function(c){c(a)}),V8.length=0);
b&&!a?G6("yt-remote-connection-change",!1):!b&&a&&G6("yt-remote-connection-change",!0)},a9=function(){var a=g.az();
if(!a)return null;var b=W8();if(!b)return null;b=b.nh();return O6(b,a)},h9=function(a,b){X8();
c9()&&c9();l9?f9=a:(oRa(a.id),a=new M8(U8,a,b9()),a.connect(b,pRa()),a.subscribe("beforeDisconnect",function(c){G6("yt-remote-before-disconnect",c)}),a.subscribe("beforeDispose",function(){d9()&&(d9(),i9(null))}),a.subscribe("browserChannelAuthError",function(){var c=c9();
c&&"shortLived"==c.idType&&(t8()?q8().handleBrowserChannelAuthError():o8("refreshLoungeToken called before API ready."))}),i9(a))},kRa=function(){var a=a9();
a?(Y8("Resume connection to: "+K6(a)),h9(a,0)):(T6(),QQa(),Y8("Skipping connecting because no session screen found."))},iRa=function(){var a=b9();
if(g.Rb(a)){a=R6();var b=g.Yy("yt-remote-session-name")||"",c=g.Yy("yt-remote-session-app")||"";a={device:"REMOTE_CONTROL",id:a,name:b,app:c,mdxVersion:3};g.Ha("yt.mdx.remote.channelParams_",a,void 0)}},b9=function(){return g.Ia("yt.mdx.remote.channelParams_")||{}},m9=function(a,b,c){g.E.call(this);
var d=this;this.l=a;this.I=b;this.Pb=c;this.events=new g.qN(this);this.Y=this.events.N(this.I,"onVolumeChange",function(e){qRa(d,e)});
this.C=!1;this.suggestion=null;this.G=new g.BK(64);this.i=new g.J(this.qK,500,this);this.u=new g.J(this.rK,1E3,this);this.K=new Z6(this.UU,0,this);this.B={};this.U=new g.J(this.XK,1E3,this);this.J=new $6(this.seekTo,1E3,this);this.X=g.Ja;g.F(this,this.events);this.events.N(b,"onCaptionsTrackListChanged",this.LR);this.events.N(b,"captionschanged",this.TQ);this.events.N(b,"captionssettingschanged",this.xK);this.events.N(b,"videoplayerreset",this.Hx);this.events.N(b,"mdxautoplaycancel",function(){d.Pb.HG()});
a=this.Pb;a.Ha();a.subscribe("proxyStateChange",this.qJ,this);a.subscribe("remotePlayerChange",this.du,this);a.subscribe("remoteQueueChange",this.Hx,this);a.subscribe("previousNextChange",this.nJ,this);a.subscribe("nowAutoplaying",this.hJ,this);a.subscribe("autoplayDismissed",this.HI,this);g.F(this,this.i);g.F(this,this.u);g.F(this,this.K);g.F(this,this.U);g.F(this,this.J);this.xK();this.Hx();this.du()},qRa=function(a,b){if(n9(a)){a.Pb.unsubscribe("remotePlayerChange",a.du,a);
var c=Math.round(b.volume);b=!!b.muted;var d=F8(a.Pb);if(c!==d.volume||b!==d.muted)a.Pb.setVolume(c,b),a.U.start();a.Pb.subscribe("remotePlayerChange",a.du,a)}},rRa=function(a){a.Rb(0);
a.i.stop();a.Lb(new g.BK(64))},o9=function(a,b){if(n9(a)&&!a.C){var c=null;
b&&(c={style:a.I.getSubtitlesUserSettings()},g.Yb(c,b));a.Pb.XE(a.I.getVideoData(1).videoId,c);a.B=F8(a.Pb).trackData}},p9=function(a,b){var c=a.I.getPlaylist();
if(null===c||void 0===c?0:c.listId){var d=c.index;var e=c.listId.toString()}c=a.I.getVideoData(1);a.Pb.playVideo(c.videoId,b,d,e,c.playerParams,c.Ga,QOa(c));a.Lb(new g.BK(1))},sRa=function(a,b){if(b){var c=a.I.getOption("captions","tracklist",{GH:1});
c&&c.length?(a.I.setOption("captions","track",b),a.C=!1):(a.I.loadModule("captions"),a.C=!0)}else a.I.setOption("captions","track",{})},n9=function(a){return F8(a.Pb).videoId===a.I.getVideoData(1).videoId},q9=function(){g.V.call(this,{D:"div",
L:"ytp-mdx-manual-pairing-popup-dialog",V:{role:"dialog"},S:[{D:"div",L:"ytp-mdx-manual-pairing-popup-dialog-inner-content",S:[{D:"div",L:"ytp-mdx-manual-pairing-popup-title",oa:"Connecting to your TV on web using a code will be going away soon"},{D:"div",L:"ytp-mdx-manual-pairing-popup-buttons",S:[{D:"button",Ca:["ytp-button","ytp-mdx-manual-pairing-popup-learn-more"],oa:"Learn more"},{D:"button",Ca:["ytp-button","ytp-mdx-manual-pairing-popup-ok"],oa:"OK"}]}]}]});this.i=new g.fM(this,250);this.learnMoreButton=
this.Ba("ytp-mdx-manual-pairing-popup-learn-more");this.okButton=this.Ba("ytp-mdx-manual-pairing-popup-ok");g.F(this,this.i);this.N(this.learnMoreButton,"click",this.l);this.N(this.okButton,"click",this.u)},r9=function(){g.V.call(this,{D:"div",
L:"ytp-mdx-popup-dialog",V:{role:"dialog"},S:[{D:"div",L:"ytp-mdx-popup-dialog-inner-content",S:[{D:"div",L:"ytp-mdx-popup-title",oa:"You're signed out"},{D:"div",L:"ytp-mdx-popup-description",oa:"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."},{D:"div",L:"ytp-mdx-privacy-popup-buttons",S:[{D:"button",Ca:["ytp-button","ytp-mdx-privacy-popup-cancel"],oa:"Cancel"},{D:"button",Ca:["ytp-button",
"ytp-mdx-privacy-popup-confirm"],oa:"Confirm"}]}]}]});this.i=new g.fM(this,250);this.cancelButton=this.Ba("ytp-mdx-privacy-popup-cancel");this.confirmButton=this.Ba("ytp-mdx-privacy-popup-confirm");g.F(this,this.i);this.N(this.cancelButton,"click",this.l);this.N(this.confirmButton,"click",this.u)},s9=function(a){g.V.call(this,{D:"div",
L:"ytp-remote",S:[{D:"div",L:"ytp-remote-display-status",S:[{D:"div",L:"ytp-remote-display-status-icon",S:[g.Hqa()]},{D:"div",L:"ytp-remote-display-status-text",oa:"{{statustext}}"}]}]});this.api=a;this.i=new g.fM(this,250);g.F(this,this.i);this.N(a,"presentingplayerstatechange",this.l);tRa(this,a.sb())},tRa=function(a,b){if(3===a.api.getPresentingPlayerType()){var c={RECEIVER_NAME:a.api.getOption("remote","currentReceiver").name};
b=g.U(b,128)?g.eJ("Error on $RECEIVER_NAME",c):b.tc()||g.U(b,4)?g.eJ("Playing on $RECEIVER_NAME",c):g.eJ("Connected to $RECEIVER_NAME",c);a.Sa("statustext",b);a.i.show()}else a.i.hide()},t9=function(a,b){g.qQ.call(this,"Play on",0,a,b);
this.I=a;this.hn={};this.N(a,"onMdxReceiversChange",this.C);this.N(a,"presentingplayerstatechange",this.C);this.C()},u9=function(a){g.zN.call(this,a);
this.Xi={key:M6(),name:"This computer"};this.Kh=null;this.subscriptions=[];this.HC=this.Pb=null;this.hn=[this.Xi];this.nm=this.Xi;this.hd=new g.BK(64);this.cI=0;this.Ze=-1;this.Tq=null;this.ou=this.ex=!1;this.Hl=this.Zq=null;if(!g.UF(this.player.T())&&!g.VF(this.player.T())){a=this.player;var b=g.eN(a);b&&(b=b.Gm())&&(b=new t9(a,b),g.F(this,b));b=new s9(a);g.F(this,b);g.oN(a,b.element,4);this.Zq=new r9;g.F(this,this.Zq);g.oN(a,this.Zq.element,4);g.S(this.player.T().experiments,"pair_servlet_deprecation_warning_enabled")&&
!g.S(this.player.T().experiments,"deprecate_pair_servlet_enabled")&&(this.Tq=new q9,g.F(this,this.Tq),g.oN(a,this.Tq.element,4));this.ou=!!a9();this.ex=!!g.Yy("yt-remote-manual-pairing-warning-shown")}},v9=function(a){a.Hl&&(a.player.removeEventListener("presentingplayerstatechange",a.Hl),a.Hl=null)},uRa=function(a,b,c){a.hd=c;
a.player.W("presentingplayerstatechange",new g.SI(c,b))},vRa=function(a,b,c){var d=!1;
1===b?d=!a.ou:2===b&&(d=!a.ex);d&&g.UI(c,8)&&(a.player.pauseVideo(),v9(a))},w9=function(a,b){if(b.key!==a.nm.key)if(b.key===a.Xi.key)g9();
else{if(a.Tq&&!a.ex&&b!==a.Xi&&"cast-selector-receiver"!==b.key&&g.BG(a.player.T()))wRa(a);else{var c;(c=!g.S(a.player.T().experiments,"mdx_enable_privacy_disclosure_ui"))||(c=((c=g.O("PLAYER_CONFIG"))&&c.args&&void 0!==c.args.authuser?!0:!(!g.O("SESSION_INDEX")&&!g.O("LOGGED_IN")))||a.ou||!a.Zq);(c?0:g.BG(a.player.T())||g.FG(a.player.T()))&&xRa(a)}a.nm=b;if(!a.player.T().Z("disable_mdx_connection_in_mdx_module_for_music_web")||!g.VF(a.player.T())){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.S(a.player.T().experiments,"should_clear_video_data_on_player_cued_unstarted"))a=null;else{var f=a.player.getPlaylist();if(f){var h=[];for(var l=0;l<f.length;l++)h[l]=f.fb(l).videoId}else h=[e];f=a.player.getCurrentTime(1);a={videoIds:h,listId:d,videoId:e,playerParams:c.playerParams,clickTrackingParams:c.Ga,index:Math.max(a.player.getPlaylistIndex(),0),currentTime:0===f?void 0:f};(c=QOa(c))&&(a.locationInfo=c)}Y8("Connecting to: "+
g.Nh(b));"cast-selector-receiver"==b.key?($8(a||null),b=a||null,t8()?q8().setLaunchParams(b):o8("setLaunchParams called before ready.")):!a&&j9()&&X8()==b.key?G6("yt-remote-connection-change",!0):(g9(),$8(a||null),a=W8().nh(),(b=O6(a,b.key))&&h9(b,1))}}},xRa=function(a){a.player.sb().tc()?a.player.pauseVideo():(a.Hl=function(b){vRa(a,1,b)},a.player.addEventListener("presentingplayerstatechange",a.Hl));
a.Zq&&a.Zq.Uc();d9()||(l9=!0)},wRa=function(a){a.player.sb().tc()?a.player.pauseVideo():(a.Hl=function(b){vRa(a,2,b)},a.player.addEventListener("presentingplayerstatechange",a.Hl));
a.Tq&&a.Tq.Uc();d9()||(l9=!0)},zPa={"\x00":"\\0",
"\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r","\t":"\\t","\x0B":"\\x0B",'"':'\\"',"\\":"\\\\","<":"\\u003C"},m7={"'":"\\'"},WOa={SV:"atp",D5:"ska",v4:"que",D2:"mus",C5:"sus",OZ:"dsp",P4:"seq",e2:"mic",PY:"dpa",gW:"cds",B2:"mlm"},U6,Q6="",pPa=kPa("loadCastFramework")||kPa("loadCastApplicationFramework"),rPa=["pkedcjkdefgpdelpbcmbmeomcjbeemfm","enhhojjnijigcajfphajepfemndkmdlo"];/*

 Copyright The Closure Library Authors.
 SPDX-License-Identifier: Apache-2.0
*/
g.Ta(Z6,g.E);g.k=Z6.prototype;g.k.gN=function(a){this.B=arguments;this.i=!1;this.Gb?this.u=g.Sa()+this.Of:this.Gb=g.jh(this.C,this.Of)};
g.k.stop=function(){this.Gb&&(g.A.clearTimeout(this.Gb),this.Gb=null);this.u=null;this.i=!1;this.B=[]};
g.k.pause=function(){++this.l};
g.k.resume=function(){this.l&&(--this.l,!this.l&&this.i&&(this.i=!1,this.G.apply(null,this.B)))};
g.k.ra=function(){this.stop();Z6.Rd.ra.call(this)};
g.k.hN=function(){this.Gb&&(g.A.clearTimeout(this.Gb),this.Gb=null);this.u?(this.Gb=g.jh(this.C,this.u-g.Sa()),this.u=null):this.l?this.i=!0:(this.i=!1,this.G.apply(null,this.B))};g.v($6,g.E);g.k=$6.prototype;g.k.RE=function(a){this.u=arguments;this.Gb||this.l?this.i=!0:a7(this)};
g.k.stop=function(){this.Gb&&(g.A.clearTimeout(this.Gb),this.Gb=null,this.i=!1,this.u=null)};
g.k.pause=function(){this.l++};
g.k.resume=function(){this.l--;this.l||!this.i||this.Gb||(this.i=!1,a7(this))};
g.k.ra=function(){g.E.prototype.ra.call(this);this.stop()};b7.prototype.stringify=function(a){return g.A.JSON.stringify(a,void 0)};
b7.prototype.parse=function(a){return g.A.JSON.parse(a,void 0)};var d7=new g.If;g.v(tPa,g.hf);g.k=f7.prototype;g.k.Mn=null;g.k.lj=!1;g.k.Fr=null;g.k.VD=null;g.k.gr=null;g.k.Ar=null;g.k.fm=null;g.k.pn=null;g.k.np=null;g.k.Qe=null;g.k.bv=0;g.k.qj=null;g.k.Hy=null;g.k.Yl=null;g.k.Zr=-1;g.k.gK=!0;g.k.Yn=!1;g.k.Dz=0;g.k.Px=null;var xPa={},i7={};g.k=f7.prototype;g.k.setTimeout=function(a){this.C=a};
g.k.iN=function(a){a=a.target;var b=this.Px;b&&3==g.Gi(a)?b.RE():this.dL(a)};
g.k.dL=function(a){try{if(a==this.Qe)a:{var b=g.Gi(this.Qe),c=this.Qe.l,d=this.Qe.getStatus();if(g.fe&&!g.Xd(10)||g.ig&&!g.Wd("420+")){if(4>b)break a}else if(3>b||3==b&&!g.Uk&&!g.Qi(this.Qe))break a;this.Yn||4!=b||7==c||(8==c||0>=d?this.i.Zi(3):this.i.Zi(2));n7(this);var e=this.Qe.getStatus();this.Zr=e;var f=g.Qi(this.Qe);(this.lj=200==e)?(4==b&&k7(this),this.G?(yPa(this,b,f),g.Uk&&this.lj&&3==b&&(this.B.Ra(this.u,"tick",this.LT),this.u.start())):j7(this,f),this.lj&&!this.Yn&&(4==b?this.i.Bv(this):
(this.lj=!1,h7(this)))):(400==e&&0<f.indexOf("Unknown SID")?(this.Yl=3,e7(13)):(this.Yl=0,e7(14)),k7(this),l7(this))}}catch(h){this.Qe&&g.Qi(this.Qe)}finally{}};
g.k.LT=function(){var a=g.Gi(this.Qe),b=g.Qi(this.Qe);this.bv<b.length&&(n7(this),yPa(this,a,b),this.lj&&4!=a&&h7(this))};
g.k.uT=function(a){c7((0,g.C)(this.tT,this,a),0)};
g.k.tT=function(a){this.Yn||(n7(this),j7(this,a),h7(this))};
g.k.yJ=function(a){c7((0,g.C)(this.sT,this,a),0)};
g.k.sT=function(a){this.Yn||(k7(this),this.lj=a,this.i.Bv(this),this.i.Zi(4))};
g.k.cancel=function(){this.Yn=!0;k7(this)};
g.k.CT=function(){this.Fr=null;var a=Date.now();0<=a-this.VD?(2!=this.Ar&&this.i.Zi(3),k7(this),this.Yl=2,e7(18),l7(this)):BPa(this,this.VD-a)};
g.k.getLastError=function(){return this.Yl};g.k=EPa.prototype;g.k.Ez=null;g.k.Xg=null;g.k.Qx=!1;g.k.sK=null;g.k.cw=null;g.k.RB=null;g.k.Fz=null;g.k.Oa=null;g.k.Fk=-1;g.k.ds=null;g.k.As=null;g.k.connect=function(a){this.Fz=a;a=p7(this.i,null,this.Fz);e7(3);this.sK=Date.now();var b=this.i.J;null!=b?(this.ds=b[0],(this.As=b[1])?(this.Oa=1,FPa(this)):(this.Oa=2,r7(this))):(D6(a,"MODE","init"),this.Xg=new f7(this,void 0,void 0,void 0),this.Xg.Mn=this.Ez,g7(this.Xg,a,!1,null,!0),this.Oa=0)};
g.k.eO=function(a){if(a)this.Oa=2,r7(this);else{e7(4);var b=this.i;b.Fj=b.lm.Fk;y7(b,9)}a&&this.Zi(2)};
g.k.IA=function(a){return this.i.IA(a)};
g.k.abort=function(){this.Xg&&(this.Xg.cancel(),this.Xg=null);this.Fk=-1};
g.k.We=function(){return!1};
g.k.rJ=function(a,b){this.Fk=a.Zr;if(0==this.Oa)if(b){try{var c=this.l.parse(b)}catch(d){a=this.i;a.Fj=this.Fk;y7(a,2);return}this.ds=c[0];this.As=c[1]}else a=this.i,a.Fj=this.Fk,y7(a,2);else if(2==this.Oa)if(this.Qx)e7(7),this.RB=Date.now();else if("11111"==b){if(e7(6),this.Qx=!0,this.cw=Date.now(),a=this.cw-this.sK,!g.fe||g.Xd(10)||500>a)this.Fk=200,this.Xg.cancel(),e7(12),q7(this.i,this,!0)}else e7(8),this.cw=this.RB=Date.now(),this.Qx=!1};
g.k.Bv=function(){this.Fk=this.Xg.Zr;if(this.Xg.lj)0==this.Oa?this.As?(this.Oa=1,FPa(this)):(this.Oa=2,r7(this)):2==this.Oa&&((!g.fe||g.Xd(10)?!this.Qx:200>this.RB-this.cw)?(e7(11),q7(this.i,this,!1)):(e7(12),q7(this.i,this,!0)));else{0==this.Oa?e7(9):2==this.Oa&&e7(10);var a=this.i;this.Xg.getLastError();a.Fj=this.Fk;y7(a,2)}};
g.k.Iu=function(){return this.i.Iu()};
g.k.isActive=function(){return this.i.isActive()};
g.k.Zi=function(a){this.i.Zi(a)};g.k=s7.prototype;g.k.Ej=null;g.k.Ps=null;g.k.Lg=null;g.k.oe=null;g.k.Gz=null;g.k.dw=null;g.k.bG=null;g.k.Cv=null;g.k.St=0;g.k.nQ=0;g.k.Kf=null;g.k.xm=null;g.k.Vk=null;g.k.zo=null;g.k.lm=null;g.k.Fy=null;g.k.Oq=-1;g.k.bI=-1;g.k.Fj=-1;g.k.zq=0;g.k.iq=0;g.k.Zn=8;g.Ta(HPa,g.hf);g.Ta(IPa,g.hf);g.k=s7.prototype;g.k.connect=function(a,b,c,d,e){e7(0);this.Gz=b;this.Ps=c||{};d&&void 0!==e&&(this.Ps.OSID=d,this.Ps.OAID=e);this.C?(c7((0,g.C)(this.uG,this,a),100),MPa(this)):this.uG(a)};
g.k.uG=function(a){this.lm=new EPa(this);this.lm.Ez=this.Ej;this.lm.l=this.B;this.lm.connect(a)};
g.k.We=function(){return 0==this.Oa};
g.k.getState=function(){return this.Oa};
g.k.wJ=function(a){this.xm=null;QPa(this,a)};
g.k.vJ=function(){this.Vk=null;this.oe=new f7(this,this.l,"rpc",this.G);this.oe.Mn=this.Ej;this.oe.Dz=0;var a=this.bG.clone();g.pk(a,"RID","rpc");g.pk(a,"SID",this.l);g.pk(a,"CI",this.Fy?"0":"1");g.pk(a,"AID",this.Oq);t7(this,a);if(!g.fe||g.Xd(10))g.pk(a,"TYPE","xmlhttp"),g7(this.oe,a,!0,this.Cv,!1);else{g.pk(a,"TYPE","html");var b=this.oe,c=!!this.Cv;b.Ar=3;b.fm=C6(a.clone());APa(b,c)}};
g.k.rJ=function(a,b){if(0!=this.Oa&&(this.oe==a||this.Lg==a))if(this.Fj=a.Zr,this.Lg==a&&3==this.Oa)if(7<this.Zn){try{var c=this.B.parse(b)}catch(d){c=null}if(Array.isArray(c)&&3==c.length)if(a=c,0==a[0])a:{if(!this.Vk){if(this.oe)if(this.oe.gr+3E3<this.Lg.gr)v7(this),this.oe.cancel(),this.oe=null;else break a;x7(this);e7(19)}}else this.bI=a[1],0<this.bI-this.Oq&&37500>a[2]&&this.Fy&&0==this.iq&&!this.zo&&(this.zo=c7((0,g.C)(this.QQ,this),6E3));else y7(this,11)}else null!=b&&y7(this,11);else if(this.oe==
a&&v7(this),!g.rc(b))for(a=this.B.parse(b),b=0;b<a.length;b++)c=a[b],this.Oq=c[0],c=c[1],2==this.Oa?"c"==c[0]?(this.l=c[1],this.Cv=c[2],c=c[3],null!=c?this.Zn=c:this.Zn=6,this.Oa=3,this.Kf&&this.Kf.qG(),this.bG=p7(this,this.Iu()?this.Cv:null,this.Gz),RPa(this)):"stop"==c[0]&&y7(this,7):3==this.Oa&&("stop"==c[0]?y7(this,7):"noop"!=c[0]&&this.Kf&&this.Kf.pG(c),this.iq=0)};
g.k.QQ=function(){null!=this.zo&&(this.zo=null,this.oe.cancel(),this.oe=null,x7(this),e7(20))};
g.k.Bv=function(a){if(this.oe==a){v7(this);this.oe=null;var b=2}else if(this.Lg==a)this.Lg=null,b=1;else return;this.Fj=a.Zr;if(0!=this.Oa)if(a.lj)if(1==b){b=Date.now()-a.gr;var c=d7;c.dispatchEvent(new HPa(c,a.np?a.np.length:0,b,this.zq));u7(this);this.u.length=0}else RPa(this);else{c=a.getLastError();var d;if(!(d=3==c||7==c||0==c&&0<this.Fj)){if(d=1==b)this.Lg||this.xm||1==this.Oa||2<=this.zq?d=!1:(this.xm=c7((0,g.C)(this.wJ,this,a),SPa(this,this.zq)),this.zq++,d=!0);d=!(d||2==b&&x7(this))}if(d)switch(c){case 1:y7(this,
5);break;case 4:y7(this,10);break;case 3:y7(this,6);break;case 7:y7(this,12);break;default:y7(this,2)}}};
g.k.EO=function(a){if(!g.kb(arguments,this.Oa))throw Error("Unexpected channel state: "+this.Oa);};
g.k.CU=function(a){a?e7(2):(e7(1),TPa(this,8))};
g.k.IA=function(a){if(a)throw Error("Can't create secondary domain capable XhrIo object.");a=new g.Ai;a.K=!1;return a};
g.k.isActive=function(){return!!this.Kf&&this.Kf.isActive(this)};
g.k.Zi=function(a){var b=d7;b.dispatchEvent(new IPa(b,a))};
g.k.Iu=function(){return!(!g.fe||g.Xd(10))};
g.k=UPa.prototype;g.k.qG=function(){};
g.k.pG=function(){};
g.k.oG=function(){};
g.k.vA=function(){};
g.k.YG=function(){return{}};
g.k.isActive=function(){return!0};g.k=VPa.prototype;g.k.isEmpty=function(){return 0===this.i.length&&0===this.l.length};
g.k.clear=function(){this.i=[];this.l=[]};
g.k.contains=function(a){return g.kb(this.i,a)||g.kb(this.l,a)};
g.k.remove=function(a){var b=this.i;var c=(0,g.iJa)(b,a);0<=c?(g.nb(b,c),b=!0):b=!1;return b||g.ob(this.l,a)};
g.k.Ng=function(){for(var a=[],b=this.i.length-1;0<=b;--b)a.push(this.i[b]);var c=this.l.length;for(b=0;b<c;++b)a.push(this.l[b]);return a};g.Ta(z7,g.E);g.k=z7.prototype;g.k.mT=function(){this.Of=Math.min(3E5,2*this.Of);this.u();this.l&&this.start()};
g.k.start=function(){var a=this.Of+15E3*Math.random();g.Eq(this.i,a);this.l=Date.now()+a};
g.k.stop=function(){this.i.stop();this.l=0};
g.k.isActive=function(){return this.i.isActive()};
g.k.reset=function(){this.i.stop();this.Of=5E3};g.Ta(A7,UPa);g.k=A7.prototype;g.k.subscribe=function(a,b,c){return this.u.subscribe(a,b,c)};
g.k.unsubscribe=function(a,b,c){return this.u.unsubscribe(a,b,c)};
g.k.Tf=function(a){return this.u.Tf(a)};
g.k.W=function(a,b){return this.u.W.apply(this.u,arguments)};
g.k.dispose=function(){this.Y||(this.Y=!0,g.ef(this.u),YPa(this),g.ef(this.l),this.l=null,this.X=function(){return""})};
g.k.Ha=function(){return this.Y};
g.k.connect=function(a,b,c){if(!this.i||2!=this.i.getState()){this.U="";this.l.stop();this.C=a||null;this.B=b||0;a=this.ma+"/test";b=this.ma+"/bind";var d=new s7(c?c.firstTestResults:null,c?c.secondTestResults:null,this.va),e=this.i;e&&(e.Kf=null);d.Kf=this;this.i=d;B7(this);if(this.i){d=g.O("ID_TOKEN");var f=this.i.Ej||{};d?f["x-youtube-identity-token"]=d:delete f["x-youtube-identity-token"];this.i.Ej=f}e?(3!=e.getState()&&0==OPa(e)||e.getState(),this.i.connect(a,b,this.G,e.l,e.Oq)):c?this.i.connect(a,
b,this.G,c.sessionId,c.arrayId):this.i.connect(a,b,this.G)}};
g.k.sendMessage=function(a,b){a={_sc:a};b&&g.Yb(a,b);this.l.isActive()||2==(this.i?this.i.getState():0)?this.J.push(a):C7(this)&&(B7(this),NPa(this.i,a))};
g.k.qG=function(){this.l.reset();this.C=null;this.B=0;if(this.J.length){var a=this.J;this.J=[];for(var b=0,c=a.length;b<c;++b)NPa(this.i,a[b])}this.W("handlerOpened")};
g.k.oG=function(a){var b=2==a&&401==this.i.Fj;4==a||b||this.l.start();this.W("handlerError",a,b)};
g.k.vA=function(a){if(!this.l.isActive())this.W("handlerClosed");else if(a)for(var b=0,c=a.length;b<c;++b){var d=a[b].map;d&&this.J.push(d)}};
g.k.YG=function(){var a={v:2};this.U&&(a.gsessionid=this.U);0!=this.B&&(a.ui=""+this.B);0!=this.K&&(a.ui=""+this.K);this.C&&g.Yb(a,this.C);return a};
g.k.pG=function(a){"S"==a[0]?this.U=a[1]:"gracefulReconnect"==a[0]?(this.l.start(),LPa(this.i)):this.W("handlerMessage",new WPa(a[0],a[1]))};
g.k.dy=function(a){(this.G.loungeIdToken=a)||this.l.stop();if(this.xa&&this.i){var b=this.i.Ej||{};a?b["X-YouTube-LoungeId-Token"]=a:delete b["X-YouTube-LoungeId-Token"];this.i.Ej=b}};
g.k.hU=function(){this.l.isActive();0==OPa(this.i)&&this.connect(this.C,this.B)};D7.prototype.B=function(a,b,c,d){b?a(d):a({text:c.responseText})};
D7.prototype.u=function(a,b){a(Error("Request error: "+b.status))};
D7.prototype.C=function(a){a(Error("request timed out"))};var eQa=Date.now(),G7=null,J7=Array(50),I7=-1,K7=!1;g.Ta(L7,g.Q);L7.prototype.nh=function(){return this.screens};
L7.prototype.contains=function(a){return!!N6(this.screens,a)};
L7.prototype.get=function(a){return a?O6(this.screens,a):null};
L7.prototype.info=function(a){H7(this.G,a)};g.v(M7,g.Q);g.k=M7.prototype;g.k.start=function(){!this.i&&isNaN(this.Gb)&&this.EJ()};
g.k.stop=function(){this.i&&(this.i.abort(),this.i=null);isNaN(this.Gb)||(g.os(this.Gb),this.Gb=NaN)};
g.k.ra=function(){this.stop();g.Q.prototype.ra.call(this)};
g.k.EJ=function(){this.Gb=NaN;this.i=g.Ps(E7(this.u,"/pairing/get_screen"),{method:"POST",postParams:{pairing_code:this.J},timeout:5E3,onSuccess:(0,g.C)(this.kN,this),onError:(0,g.C)(this.jN,this),onTimeout:(0,g.C)(this.lN,this)})};
g.k.kN=function(a,b){this.i=null;a=b.screen||{};a.dialId=this.B;a.name=this.G;b=-1;this.C&&a.shortLivedLoungeToken&&a.shortLivedLoungeToken.value&&a.shortLivedLoungeToken.refreshIntervalMs&&(a.screenIdType="shortLived",a.loungeToken=a.shortLivedLoungeToken.value,b=a.shortLivedLoungeToken.refreshIntervalMs);this.W("pairingComplete",new I6(a),b)};
g.k.jN=function(a){this.i=null;a.status&&404==a.status?this.l>=yRa.length?this.W("pairingFailed",Error("DIAL polling timed out")):(a=yRa[this.l],this.Gb=g.ms((0,g.C)(this.EJ,this),a),this.l++):this.W("pairingFailed",Error("Server error "+a.status))};
g.k.lN=function(){this.i=null;this.W("pairingFailed",Error("Server not responding"))};
var yRa=[2E3,2E3,1E3,1E3,1E3,2E3,2E3,5E3,5E3,1E4];g.Ta(O7,L7);g.k=O7.prototype;g.k.start=function(){N7(this)&&this.W("screenChange");!g.Yy("yt-remote-lounge-token-expiration")&&iQa(this);g.os(this.i);this.i=g.ms((0,g.C)(this.start,this),1E4)};
g.k.add=function(a,b){N7(this);fQa(this,a);P7(this,!1);this.W("screenChange");b(a);a.token||iQa(this)};
g.k.remove=function(a,b){var c=N7(this);hQa(this,a)&&(P7(this,!1),c=!0);b(a);c&&this.W("screenChange")};
g.k.Dy=function(a,b,c,d){var e=N7(this),f=this.get(a.id);f?(f.name!=b&&(f.name=b,P7(this,!1),e=!0),c(a)):d(Error("no such local screen."));e&&this.W("screenChange")};
g.k.ra=function(){g.os(this.i);O7.Rd.ra.call(this)};
g.k.dP=function(a){N7(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)}P7(this,!b);b&&H7(this.G,"Missed "+b+" lounge tokens.")};
g.k.cP=function(a){H7(this.G,"Requesting lounge tokens failed: "+a)};g.v(R7,g.Q);g.k=R7.prototype;g.k.start=function(){var a=parseInt(g.Yy("yt-remote-fast-check-period")||"0",10);(this.B=g.Sa()-144E5<a?0:a)?U7(this):(this.B=g.Sa()+3E5,g.Xy("yt-remote-fast-check-period",this.B),this.UC())};
g.k.isEmpty=function(){return g.Rb(this.i)};
g.k.update=function(){Q7("Updating availability on schedule.");var a=this.G(),b=g.Fb(this.i,function(c,d){return c&&!!O6(a,d)},this);
T7(this,b)};
g.k.ra=function(){g.os(this.u);this.u=NaN;this.l&&(this.l.abort(),this.l=null);g.Q.prototype.ra.call(this)};
g.k.UC=function(){g.os(this.u);this.u=NaN;this.l&&this.l.abort();var a=kQa(this);if(E6(a)){var b=E7(this.C,"/pairing/get_screen_availability");this.l=F7(this.C,b,{lounge_token:g.Mb(a).join(",")},(0,g.C)(this.RS,this,a),(0,g.C)(this.QS,this))}else T7(this,{}),U7(this)};
g.k.RS=function(a,b){this.l=null;var c=g.Mb(kQa(this));if(g.Ab(c,g.Mb(a))){b=b.screens||[];c={};for(var d=0,e=b.length;d<e;++d)c[a[b[d].loungeToken]]="online"==b[d].status;T7(this,c);U7(this)}else this.Sd("Changing Screen set during request."),this.UC()};
g.k.QS=function(a){this.Sd("Screen availability failed: "+a);this.l=null;U7(this)};
g.k.Sd=function(a){H7("OnlineScreenService",a)};g.Ta(V7,L7);g.k=V7.prototype;g.k.start=function(){this.l.start();this.i.start();this.screens.length&&(this.W("screenChange"),this.i.isEmpty()||this.W("onlineScreenChange"))};
g.k.add=function(a,b,c){this.l.add(a,b,c)};
g.k.remove=function(a,b,c){this.l.remove(a,b,c);this.i.update()};
g.k.Dy=function(a,b,c,d){this.l.contains(a)?this.l.Dy(a,b,c,d):(a="Updating name of unknown screen: "+a.name,H7(this.G,a),d(Error(a)))};
g.k.nh=function(a){return a?this.screens:g.qb(this.screens,g.Po(this.u,function(b){return!this.contains(b)},this))};
g.k.SE=function(){return g.Po(this.nh(!0),function(a){return!!this.i.i[a.id]},this)};
g.k.TE=function(a,b,c,d,e,f){var h=this;this.info("getDialScreenByPairingCode "+a+" / "+b);var l=new M7(this.B,a,b,c,d);l.subscribe("pairingComplete",function(m,n){g.ef(l);e(W7(h,m),n)});
l.subscribe("pairingFailed",function(m){g.ef(l);f(m)});
l.start();return(0,g.C)(l.stop,l)};
g.k.mN=function(a,b,c,d){g.Ps(E7(this.B,"/pairing/get_screen"),{method:"POST",postParams:{pairing_code:a},timeout:5E3,onSuccess:(0,g.C)(function(e,f){e=new I6(f.screen||{});if(!e.name||oQa(this,e.name)){a:{f=e.name;for(var h=2,l=b(f,h);oQa(this,l);){h++;if(20<h)break a;l=b(f,h)}f=l}e.name=f}c(W7(this,e))},this),
onError:(0,g.C)(function(e){d(Error("pairing request failed: "+e.status))},this),
onTimeout:(0,g.C)(function(){d(Error("pairing request timed out."))},this)})};
g.k.ra=function(){g.ef(this.l);g.ef(this.i);V7.Rd.ra.call(this)};
g.k.mP=function(){qQa(this);this.W("screenChange");this.i.update()};
V7.prototype.dispose=V7.prototype.dispose;g.Ta(Y7,g.Q);g.k=Y7.prototype;g.k.getScreen=function(){return this.B};
g.k.og=function(a){this.Ha()||(a&&$7(this,""+a),this.B=null,this.W("sessionScreen",null))};
g.k.info=function(a){H7(this.xa,a)};
g.k.VE=function(){return null};
g.k.eD=function(a){var b=this.i;a?(b.displayStatus=new chrome.cast.ReceiverDisplayStatus(a,[]),b.displayStatus.showStop=!0):b.displayStatus=null;chrome.cast.setReceiverDisplayStatus(b,(0,g.C)(function(){this.info("Updated receiver status for "+b.friendlyName+": "+a)},this),(0,g.C)(function(){$7(this,"Failed to update receiver status for: "+b.friendlyName)},this))};
g.k.ra=function(){this.eD("");Y7.Rd.ra.call(this)};g.v(a8,Y7);g.k=a8.prototype;g.k.dD=function(a){if(this.l){if(this.l==a)return;$7(this,"Overriding cast session with new session object");zQa(this);this.ma=!1;this.U="unknown";this.l.removeUpdateListener(this.X);this.l.removeMessageListener("urn:x-cast:com.google.youtube.mdx",this.va)}this.l=a;this.l.addUpdateListener(this.X);this.l.addMessageListener("urn:x-cast:com.google.youtube.mdx",this.va);vQa(this,"getMdxSessionStatus")};
g.k.Pq=function(a){this.info("launchWithParams no-op for Cast: "+g.Nh(a))};
g.k.stop=function(){this.l?this.l.stop((0,g.C)(function(){this.og()},this),(0,g.C)(function(){this.og(Error("Failed to stop receiver app."))},this)):this.og(Error("Stopping cast device without session."))};
g.k.eD=function(){};
g.k.ra=function(){this.info("disposeInternal");zQa(this);this.l&&(this.l.removeUpdateListener(this.X),this.l.removeMessageListener("urn:x-cast:com.google.youtube.mdx",this.va));this.l=null;Y7.prototype.ra.call(this)};
g.k.FT=function(a,b){if(!this.Ha())if(b)if(b=F6(b),g.Na(b))switch(a=""+b.type,b=b.data||{},this.info("onYoutubeMessage_: "+a+" "+g.Nh(b)),a){case "mdxSessionStatus":tQa(this,b);break;case "loungeToken":wQa(this,b);break;default:$7(this,"Unknown youtube message: "+a)}else $7(this,"Unable to parse message.");else $7(this,"No data in message.")};
g.k.nH=function(a,b,c,d){g.os(this.K);this.K=0;nQa(this.u,this.i.label,a,this.i.friendlyName,(0,g.C)(function(e){e?b(e):0<=d?($7(this,"Screen "+a+" appears to be offline. "+d+" retries left."),this.K=g.ms((0,g.C)(this.nH,this,a,b,c,d-1),300)):c(Error("Unable to fetch screen."))},this),c)};
g.k.VE=function(){return this.l};
g.k.nN=function(a){this.Ha()||a||($7(this,"Cast session died."),this.og())};g.v(d8,Y7);g.k=d8.prototype;g.k.dD=function(a){this.l=a;this.l.addUpdateListener(this.Aa)};
g.k.Pq=function(a){this.Ea=a;this.Y()};
g.k.stop=function(){GQa(this);this.l?this.l.stop((0,g.C)(this.og,this,null),(0,g.C)(this.og,this,"Failed to stop DIAL device.")):this.og()};
g.k.ra=function(){GQa(this);this.l&&this.l.removeUpdateListener(this.Aa);this.l=null;Y7.prototype.ra.call(this)};
g.k.oN=function(a){this.Ha()||a||($7(this,"DIAL session died."),this.C(),this.C=g.Ja,this.og())};g.v(h8,Y7);h8.prototype.stop=function(){this.og()};
h8.prototype.dD=function(){};
h8.prototype.Pq=function(){g.os(this.l);this.l=NaN;var a=O6(this.u.nh(),this.i.label);a?Z7(this,a):this.og(Error("No such screen"))};
h8.prototype.ra=function(){g.os(this.l);this.l=NaN;Y7.prototype.ra.call(this)};g.v(i8,g.Q);g.k=i8.prototype;
g.k.init=function(a,b){chrome.cast.timeout.requestSession=3E4;var c=new chrome.cast.SessionRequest(this.J);this.K||(c.dialRequest=new chrome.cast.DialRequest("YouTube"));var d=chrome.cast.AutoJoinPolicy.TAB_AND_ORIGIN_SCOPED;a=a||this.U?chrome.cast.DefaultActionPolicy.CAST_THIS_TAB:chrome.cast.DefaultActionPolicy.CREATE_SESSION;var e=(0,g.C)(this.AS,this);c=new chrome.cast.ApiConfig(c,(0,g.C)(this.sJ,this),e,d,a);c.customDialLaunchCallback=(0,g.C)(this.lR,this);chrome.cast.initialize(c,(0,g.C)(function(){this.Ha()||
(chrome.cast.addReceiverActionListener(this.C),bQa(),this.l.subscribe("onlineScreenChange",(0,g.C)(this.WE,this)),this.u=IQa(this),chrome.cast.setCustomReceivers(this.u,g.Ja,(0,g.C)(function(f){this.Sd("Failed to set initial custom receivers: "+g.Nh(f))},this)),this.W("yt-remote-cast2-availability-change",k8(this)),b(!0))},this),(0,g.C)(function(f){this.Sd("Failed to initialize API: "+g.Nh(f));
b(!1)},this))};
g.k.nU=function(a,b){j8("Setting connected screen ID: "+a+" -> "+b);if(this.i){var c=this.i.getScreen();if(!a||c&&c.id!=a)j8("Unsetting old screen status: "+this.i.i.friendlyName),l8(this,null)}if(a&&b){if(!this.i){c=O6(this.l.nh(),a);if(!c){j8("setConnectedScreenStatus: Unknown screen.");return}if("shortLived"==c.idType){j8("setConnectedScreenStatus: Screen with id type to be short lived.");return}a=HQa(this,c);a||(j8("setConnectedScreenStatus: Connected receiver not custom..."),a=new chrome.cast.Receiver(c.uuid?
c.uuid:c.id,c.name),a.receiverType=chrome.cast.ReceiverType.CUSTOM,this.u.push(a),chrome.cast.setCustomReceivers(this.u,g.Ja,(0,g.C)(function(d){this.Sd("Failed to set initial custom receivers: "+g.Nh(d))},this)));
j8("setConnectedScreenStatus: new active receiver: "+a.friendlyName);l8(this,new h8(this.l,a),!0)}this.i.eD(b)}else j8("setConnectedScreenStatus: no screen.")};
g.k.oU=function(a){this.Ha()?this.Sd("Setting connection data on disposed cast v2"):this.i?this.i.Pq(a):this.Sd("Setting connection data without a session")};
g.k.qN=function(){this.Ha()?this.Sd("Stopping session on disposed cast v2"):this.i?(this.i.stop(),l8(this,null)):j8("Stopping non-existing session")};
g.k.requestSession=function(){chrome.cast.requestSession((0,g.C)(this.sJ,this),(0,g.C)(this.VS,this))};
g.k.ra=function(){this.l.unsubscribe("onlineScreenChange",(0,g.C)(this.WE,this));window.chrome&&chrome.cast&&chrome.cast.removeReceiverActionListener(this.C);var a=ZPa,b=g.Ia("yt.mdx.remote.debug.handlers_");g.ob(b||[],a);g.ef(this.i);g.Q.prototype.ra.call(this)};
g.k.Sd=function(a){H7("Controller",a)};
g.k.uJ=function(a,b){this.i==a&&(b||l8(this,null),this.W("yt-remote-cast2-session-change",b))};
g.k.xS=function(a,b){if(!this.Ha())if(a)switch(a.friendlyName=chrome.cast.unescape(a.friendlyName),j8("onReceiverAction_ "+a.label+" / "+a.friendlyName+"-- "+b),b){case chrome.cast.ReceiverAction.CAST:if(this.i)if(this.i.i.label!=a.label)j8("onReceiverAction_: Stopping active receiver: "+this.i.i.friendlyName),this.i.stop();else{j8("onReceiverAction_: Casting to active receiver.");this.i.getScreen()&&this.W("yt-remote-cast2-session-change",this.i.getScreen());break}switch(a.receiverType){case chrome.cast.ReceiverType.CUSTOM:l8(this,
new h8(this.l,a));break;case chrome.cast.ReceiverType.DIAL:l8(this,new d8(this.l,a,this.B,this.config_));break;case chrome.cast.ReceiverType.CAST:l8(this,new a8(this.l,a,this.config_));break;default:this.Sd("Unknown receiver type: "+a.receiverType)}break;case chrome.cast.ReceiverAction.STOP:this.i&&this.i.i.label==a.label?this.i.stop():this.Sd("Stopping receiver w/o session: "+a.friendlyName)}else this.Sd("onReceiverAction_ called without receiver.")};
g.k.lR=function(a){if(this.Ha())return Promise.reject(Error("disposed"));var b=a.receiver;b.receiverType!=chrome.cast.ReceiverType.DIAL&&(this.Sd("Not DIAL receiver: "+b.friendlyName),b.receiverType=chrome.cast.ReceiverType.DIAL);var c=this.i?this.i.i:null;if(!c||c.label!=b.label)return this.Sd("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.i.getScreen())return j8("Reselecting dial screen."),
this.W("yt-remote-cast2-session-change",this.i.getScreen()),Promise.resolve(new chrome.cast.DialLaunchResponse(!1));this.Sd('Changing CAST intent from "'+c.receiverType+'" to "dial" for '+b.friendlyName);l8(this,new d8(this.l,b,this.B,this.config_))}b=this.i;b.K=a;b.K.appState==chrome.cast.DialAppState.RUNNING?(a=b.K.extraData||{},c=a.screenId||null,e8(b)&&a.loungeToken?a.loungeTokenRefreshIntervalMs?a=DQa(b,{name:b.i.friendlyName,screenId:a.screenId,loungeToken:a.loungeToken,dialId:b.K.receiver.label,
screenIdType:"shortLived"},a.loungeTokenRefreshIntervalMs):(g.Sr(Error("No loungeTokenRefreshIntervalMs presents in additionalData: "+JSON.stringify(a)+".")),a=EQa(b,c)):a=EQa(b,c)):a=g8(b);return a};
g.k.sJ=function(a){if(!this.Ha()){j8("New cast session ID: "+a.sessionId);var b=a.receiver;if(b.receiverType!=chrome.cast.ReceiverType.CUSTOM){if(!this.i)if(b.receiverType==chrome.cast.ReceiverType.CAST)j8("Got resumed cast session before resumed mdx connection."),b.friendlyName=chrome.cast.unescape(b.friendlyName),l8(this,new a8(this.l,b,this.config_),!0);else{this.Sd("Got non-cast session without previous mdx receiver event, or mdx resume.");return}var c=this.i.i,d=O6(this.l.nh(),c.label);d&&J6(d,
b.label)&&c.receiverType!=chrome.cast.ReceiverType.CAST&&b.receiverType==chrome.cast.ReceiverType.CAST&&(j8("onSessionEstablished_: manual to cast session change "+b.friendlyName),g.ef(this.i),this.i=new a8(this.l,b,this.config_),this.i.subscribe("sessionScreen",(0,g.C)(this.uJ,this,this.i)),this.i.Pq(null));this.i.dD(a)}}};
g.k.pN=function(){return this.i?this.i.VE():null};
g.k.VS=function(a){this.Ha()||(this.Sd("Failed to estabilish a session: "+g.Nh(a)),a.code!=chrome.cast.ErrorCode.CANCEL&&l8(this,null))};
g.k.AS=function(a){j8("Receiver availability updated: "+a);if(!this.Ha()){var b=k8(this);this.G=a==chrome.cast.ReceiverAvailability.AVAILABLE;k8(this)!=b&&this.W("yt-remote-cast2-availability-change",k8(this))}};
g.k.WE=function(){this.Ha()||(this.u=IQa(this),j8("Updating custom receivers: "+g.Nh(this.u)),chrome.cast.setCustomReceivers(this.u,g.Ja,(0,g.C)(function(){this.Sd("Failed to set custom receivers.")},this)),this.W("yt-remote-cast2-availability-change",k8(this)))};
i8.prototype.setLaunchParams=i8.prototype.oU;i8.prototype.setConnectedScreenStatus=i8.prototype.nU;i8.prototype.stopSession=i8.prototype.qN;i8.prototype.getCastSession=i8.prototype.pN;i8.prototype.requestSession=i8.prototype.requestSession;i8.prototype.init=i8.prototype.init;i8.prototype.dispose=i8.prototype.dispose;var r8=[];g.k=w8.prototype;
g.k.reset=function(a){this.listId="";this.index=-1;this.videoId="";x8(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.trackData=a.trackData,this.Vj=a.hasPrevious,this.hasNext=a.hasNext,this.J=a.playerTime,this.G=a.playerTimeAt,this.B=a.seekableStart,this.i=a.seekableEnd,this.C=a.duration,this.K=a.loadedTime,this.u=a.liveIngestionTime,this.l=
!isNaN(this.u))};
g.k.tc=function(){return 1==this.playerState};
g.k.isAdPlaying=function(){return 1081==this.playerState};
g.k.getDuration=function(){return this.l?this.C+y8(this):this.C};
g.k.clone=function(){return new w8(C8(this))};g.v(E8,g.Q);g.k=E8.prototype;g.k.getState=function(){return this.Oa};
g.k.play=function(){G8(this)?(this.i?this.i.play(null,g.Ja,L8(this,"play")):K8(this,"play"),J8(this,1,A8(F8(this))),this.W("remotePlayerChange")):H8(this,this.play)};
g.k.pause=function(){G8(this)?(this.i?this.i.pause(null,g.Ja,L8(this,"pause")):K8(this,"pause"),J8(this,2,A8(F8(this))),this.W("remotePlayerChange")):H8(this,this.pause)};
g.k.seekTo=function(a){if(G8(this)){if(this.i){var b=F8(this),c=new chrome.cast.media.SeekRequest;c.currentTime=a;b.tc()||3==b.playerState?c.resumeState=chrome.cast.media.ResumeState.PLAYBACK_START:c.resumeState=chrome.cast.media.ResumeState.PLAYBACK_PAUSE;this.i.seek(c,g.Ja,L8(this,"seekTo",{newTime:a}))}else K8(this,"seekTo",{newTime:a});J8(this,3,a);this.W("remotePlayerChange")}else H8(this,g.Qa(this.seekTo,a))};
g.k.stop=function(){if(G8(this)){this.i?this.i.stop(null,g.Ja,L8(this,"stopVideo")):K8(this,"stopVideo");var a=F8(this);a.index=-1;a.videoId="";x8(a);I8(this,a);this.W("remotePlayerChange")}else H8(this,this.stop)};
g.k.setVolume=function(a,b){if(G8(this)){var c=F8(this);if(this.l){if(c.volume!=a){var d=Math.round(a)/100;this.l.setReceiverVolumeLevel(d,(0,g.C)(function(){H7("CP","set receiver volume: "+d)},this),(0,g.C)(function(){this.Sd("failed to set receiver volume.")},this))}c.muted!=b&&this.l.setReceiverMuted(b,(0,g.C)(function(){H7("CP","set receiver muted: "+b)},this),(0,g.C)(function(){this.Sd("failed to set receiver muted.")},this))}else{var e={volume:a,
muted:b};-1!=c.volume&&(e.delta=a-c.volume);K8(this,"setVolume",e)}c.muted=b;c.volume=a;I8(this,c)}else H8(this,g.Qa(this.setVolume,a,b))};
g.k.XE=function(a,b){if(G8(this)){var c=F8(this);a={videoId:a};b&&(c.trackData={trackName:b.name,languageCode:b.languageCode,sourceLanguageCode:b.translationLanguage?b.translationLanguage.languageCode:"",languageName:b.languageName,kind:b.kind},a.style=g.Nh(b.style),g.Yb(a,c.trackData));K8(this,"setSubtitlesTrack",a);I8(this,c)}else H8(this,g.Qa(this.XE,a,b))};
g.k.setAudioTrack=function(a,b){G8(this)?(b=b.getLanguageInfo().getId(),K8(this,"setAudioTrack",{videoId:a,audioTrackId:b}),a=F8(this),a.audioTrackId=b,I8(this,a)):H8(this,g.Qa(this.setAudioTrack,a,b))};
g.k.playVideo=function(a,b,c,d,e,f,h){var l=F8(this);c=c||0;var m={videoId:a,currentIndex:c};B8(l,a,c);void 0!==b&&(z8(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.Nh(h));K8(this,"setPlaylist",m);d||I8(this,l)};
g.k.Lx=function(a,b){if(G8(this)){if(a&&b){var c=F8(this);B8(c,a,b);I8(this,c)}K8(this,"previous")}else H8(this,g.Qa(this.Lx,a,b))};
g.k.nextVideo=function(a,b){if(G8(this)){if(a&&b){var c=F8(this);B8(c,a,b);I8(this,c)}K8(this,"next")}else H8(this,g.Qa(this.nextVideo,a,b))};
g.k.HG=function(){G8(this)?K8(this,"dismissAutoplay"):H8(this,this.HG)};
g.k.dispose=function(){if(3!=this.Oa){var a=this.Oa;this.Oa=3;this.W("proxyStateChange",a,this.Oa)}g.Q.prototype.dispose.call(this)};
g.k.ra=function(){UQa(this);this.u=null;this.B.clear();D8(this,null);g.Q.prototype.ra.call(this)};
g.k.gD=function(a){if((a!=this.Oa||2==a)&&3!=this.Oa&&0!=a){var b=this.Oa;this.Oa=a;this.W("proxyStateChange",b,a);if(1==a)for(;!this.B.isEmpty();)b=a=this.B,0===b.i.length&&(b.i=b.l,b.i.reverse(),b.l=[]),a.i.pop().apply(this);else 3==a&&this.dispose()}};
g.k.uS=function(a,b){this.W(a,b)};
g.k.WQ=function(a){if(!a)this.Wt(null),D8(this,null);else if(this.l.receiver.volume){a=this.l.receiver.volume;var b=F8(this),c=Math.round(100*a.level||0);if(b.volume!=c||b.muted!=a.muted)H7("CP","Cast volume update: "+a.level+(a.muted?" muted":"")),b.volume=c,b.muted=!!a.muted,I8(this,b)}};
g.k.Wt=function(a){H7("CP","Cast media: "+!!a);this.i&&this.i.removeUpdateListener(this.J);if(this.i=a)this.i.addUpdateListener(this.J),VQa(this),this.W("remotePlayerChange")};
g.k.VQ=function(a){a?(VQa(this),this.W("remotePlayerChange")):this.Wt(null)};
g.k.zD=function(){K8(this,"sendDebugCommand",{debugCommand:"stats4nerds "})};
g.k.dR=function(){var a=RQa();a&&D8(this,a)};
g.k.Sd=function(a){H7("CP",a)};g.v(M8,g.Q);g.k=M8.prototype;
g.k.connect=function(a,b,c){c=void 0===c?!1:c;if(b){var d=b.listId,e=b.videoId,f=b.videoIds,h=b.playerParams,l=b.clickTrackingParams,m=b.index,n={videoId:e},p=b.currentTime,r=b.locationInfo;b=b.loopMode;void 0!==p&&(n.currentTime=5>=p?0:p);h&&(n.playerParams=h);r&&(n.locationInfo=r);l&&(n.clickTrackingParams=l);d&&(n.listId=d);f&&0<f.length&&(n.videoIds=f.join(","));void 0!==m&&(n.currentIndex=m);c&&(n.loopMode=b||"LOOP_MODE_OFF");d&&(this.dc.listId=d);this.dc.videoId=e;this.dc.index=m||0;this.dc.state=
3;z8(this.dc,p);this.B="UNSUPPORTED";c=c?"setInitialState":"setPlaylist";N8("Connecting with "+c+" and params: "+g.Nh(n));this.i.connect({method:c,params:g.Nh(n)},a,dPa())}else N8("Connecting without params"),this.i.connect({},a,dPa());XQa(this)};
g.k.dy=function(a){this.i.dy(a)};
g.k.dispose=function(){this.Ha()||(this.W("beforeDispose"),O8(this,3));g.Q.prototype.dispose.call(this)};
g.k.ra=function(){P8(this);R8(this);Q8(this);g.os(this.J);this.J=NaN;g.os(this.K);this.K=NaN;this.u=null;g.Pt(this.U);this.U.length=0;this.i.dispose();g.Q.prototype.ra.call(this);this.B=this.G=this.l=this.dc=this.i=null};
g.k.YO=function(){this.uq(2)};
g.k.aR=function(){N8("Channel opened");this.ma&&(this.ma=!1,Q8(this),this.X=g.ms((0,g.C)(function(){N8("Timing out waiting for a screen.");this.uq(1)},this),15E3));
hPa(XPa(this.i),this.Aa)};
g.k.XQ=function(){N8("Channel closed");isNaN(this.C)?T6(!0):T6();this.dispose()};
g.k.YQ=function(a,b){T6();isNaN(this.qt())?(b&&"shortLived"==this.va&&this.W("browserChannelAuthError",a),N8("Channel error: "+a+" without reconnection"),this.dispose()):(this.ma=!0,N8("Channel error: "+a+" with reconnection in "+this.qt()+" ms"),O8(this,2))};
g.k.ZQ=function(a){a.params?N8("Received: action="+a.action+", params="+g.Nh(a.params)):N8("Received: action="+a.action+" {}");switch(a.action){case "loungeStatus":a=F6(a.params.devices);this.l=g.Oe(a,function(c){return new H6(c)});
a=!!g.gb(this.l,function(c){return"LOUNGE_SCREEN"==c.type});
$Qa(this,a);break;case "loungeScreenDisconnected":g.pb(this.l,function(c){return"LOUNGE_SCREEN"==c.type});
$Qa(this,!1);break;case "remoteConnected":var b=new H6(F6(a.params.device));g.gb(this.l,function(c){return b?c.id==b.id:!1})||ROa(this.l,b);
break;case "remoteDisconnected":b=new H6(F6(a.params.device));g.pb(this.l,function(c){return b?c.id==b.id:!1});
break;case "gracefulDisconnect":break;case "playlistModified":bRa(this,a);break;case "nowPlaying":dRa(this,a);break;case "onStateChange":cRa(this,a);break;case "onAdStateChange":eRa(this,a);break;case "onVolumeChanged":fRa(this,a);break;case "onSubtitlesTrackChanged":aRa(this,a);break;case "nowAutoplaying":gRa(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.B=
a.params.autoplayMode;this.W("autoplayModeChange",this.B);"DISABLED"==this.B&&this.W("autoplayDismissed");break;case "onHasPreviousNextChanged":hRa(this,a);break;case "requestAssistedSignIn":this.W("assistedSignInRequested",a.params.authCode);break;case "onLoopModeChanged":this.W("loopModeChange",a.params.loopMode);break;default:N8("Unrecognized action: "+a.action)}};
g.k.bU=function(){if(this.u){var a=this.u;this.u=null;this.dc.videoId!=a&&S8(this,"getNowPlaying")}};
g.k.TO=function(){var a=3;this.Ha()||(a=0,isNaN(this.qt())?C7(this.i)&&isNaN(this.C)&&(a=1):a=2);return a};
g.k.uq=function(a){N8("Disconnecting with "+a);P8(this);this.W("beforeDisconnect",a);1==a&&T6();YPa(this.i,a);this.dispose()};
g.k.RO=function(){var a=this.dc;this.u&&(a=this.dc.clone(),B8(a,this.u,a.index));return C8(a)};
g.k.pU=function(a){var b=new w8(a);b.videoId&&b.videoId!=this.dc.videoId&&(this.u=b.videoId,g.os(this.J),this.J=g.ms((0,g.C)(this.bU,this),5E3));var c=[];this.dc.listId==b.listId&&this.dc.videoId==b.videoId&&this.dc.index==b.index||c.push("remoteQueueChange");this.dc.playerState==b.playerState&&this.dc.volume==b.volume&&this.dc.muted==b.muted&&A8(this.dc)==A8(b)&&g.Nh(this.dc.trackData)==g.Nh(b.trackData)||c.push("remotePlayerChange");this.dc.reset(a);g.Cb(c,function(d){this.W(d)},this)};
g.k.lH=function(){var a=this.i.G.id,b=g.gb(this.l,function(c){return"REMOTE_CONTROL"==c.type&&c.id!=a});
return b?b.id:""};
g.k.qt=function(){var a=this.i;return a.l.isActive()?a.l.l-Date.now():NaN};
g.k.OO=function(){return this.B||"UNSUPPORTED"};
g.k.PO=function(){return this.G||""};
g.k.rN=function(){if(!isNaN(this.qt())){var a=this.i.l;g.Fq(a.i);a.start()}};
g.k.mU=function(a,b){S8(this,a,b);ZQa(this)};
g.k.YE=function(){var a=g.at("SID","")||"",b=g.at("SAPISID","")||"",c=g.at("__Secure-3PAPISID","")||"";if(!a&&!b&&!c)return"";a=g.$d(g.Za(a),2);b=g.$d(g.Za(b),2);c=g.$d(g.Za(c),2);return g.$d(g.Za(a+","+b+","+c),2)};
M8.prototype.subscribe=M8.prototype.subscribe;M8.prototype.unsubscribeByKey=M8.prototype.Tf;M8.prototype.getProxyState=M8.prototype.TO;M8.prototype.disconnect=M8.prototype.uq;M8.prototype.getPlayerContextData=M8.prototype.RO;M8.prototype.setPlayerContextData=M8.prototype.pU;M8.prototype.getOtherConnectedRemoteId=M8.prototype.lH;M8.prototype.getReconnectTimeout=M8.prototype.qt;M8.prototype.getAutoplayMode=M8.prototype.OO;M8.prototype.getAutoplayVideoId=M8.prototype.PO;M8.prototype.reconnect=M8.prototype.rN;
M8.prototype.sendMessage=M8.prototype.mU;M8.prototype.getXsrfToken=M8.prototype.YE;g.v(T8,L7);g.k=T8.prototype;g.k.nh=function(a){return this.ze.$_gs(a)};
g.k.contains=function(a){return!!this.ze.$_c(a)};
g.k.get=function(a){return this.ze.$_g(a)};
g.k.start=function(){this.ze.$_st()};
g.k.add=function(a,b,c){this.ze.$_a(a,b,c)};
g.k.remove=function(a,b,c){this.ze.$_r(a,b,c)};
g.k.Dy=function(a,b,c,d){this.ze.$_un(a,b,c,d)};
g.k.ra=function(){for(var a=0,b=this.i.length;a<b;++a)this.ze.$_ubk(this.i[a]);this.i.length=0;this.ze=null;L7.prototype.ra.call(this)};
g.k.sN=function(){this.W("screenChange")};
g.k.bS=function(){this.W("onlineScreenChange")};
V7.prototype.$_st=V7.prototype.start;V7.prototype.$_gspc=V7.prototype.mN;V7.prototype.$_gsppc=V7.prototype.TE;V7.prototype.$_c=V7.prototype.contains;V7.prototype.$_g=V7.prototype.get;V7.prototype.$_a=V7.prototype.add;V7.prototype.$_un=V7.prototype.Dy;V7.prototype.$_r=V7.prototype.remove;V7.prototype.$_gs=V7.prototype.nh;V7.prototype.$_gos=V7.prototype.SE;V7.prototype.$_s=V7.prototype.subscribe;V7.prototype.$_ubk=V7.prototype.Tf;var f9=null,l9=!1,U8=null,V8=null,k9=null,Z8=[];g.v(m9,g.E);g.k=m9.prototype;g.k.ra=function(){g.E.prototype.ra.call(this);this.i.stop();this.u.stop();this.K.stop();this.X();var a=this.Pb;a.unsubscribe("proxyStateChange",this.qJ,this);a.unsubscribe("remotePlayerChange",this.du,this);a.unsubscribe("remoteQueueChange",this.Hx,this);a.unsubscribe("previousNextChange",this.nJ,this);a.unsubscribe("nowAutoplaying",this.hJ,this);a.unsubscribe("autoplayDismissed",this.HI,this);this.Pb=this.l=null};
g.k.Ti=function(a,b){for(var c=[],d=1;d<arguments.length;++d)c[d-1]=arguments[d];if(2!=this.Pb.Oa)if(n9(this)){if(!F8(this.Pb).isAdPlaying()||"control_seek"!==a)switch(a){case "control_toggle_play_pause":F8(this.Pb).tc()?this.Pb.pause():this.Pb.play();break;case "control_play":this.Pb.play();break;case "control_pause":this.Pb.pause();break;case "control_seek":this.J.RE(c[0],c[1]);break;case "control_subtitles_set_track":o9(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.I.getCurrentTime();p9(this,0===c?void 0:c);break;case "control_seek":p9(this,c[0]);break;case "control_subtitles_set_track":o9(this,c[0]);break;case "control_set_audio_track":this.setAudioTrack(c[0])}};
g.k.TQ=function(a){this.K.gN(a)};
g.k.UU=function(a){this.Ti("control_subtitles_set_track",g.Rb(a)?null:a)};
g.k.xK=function(){var a=this.I.getOption("captions","track");g.Rb(a)||o9(this,a)};
g.k.Rb=function(a){this.l.Rb(a,this.I.getVideoData().lengthSeconds)};
g.k.LR=function(){g.Rb(this.B)||sRa(this,this.B);this.C=!1};
g.k.qJ=function(a,b){this.u.stop();2===b&&this.rK()};
g.k.du=function(){if(n9(this)){this.i.stop();var a=F8(this.Pb);switch(a.playerState){case 1080:case 1081:case 1084:case 1085:this.l.Ze=1;break;case 1082:case 1083:this.l.Ze=0;break;default:this.l.Ze=-1}switch(a.playerState){case 1081:case 1:this.Lb(new g.BK(8));this.qK();break;case 1085:case 3:this.Lb(new g.BK(9));break;case 1083:case 0:this.Lb(new g.BK(2));this.J.stop();this.Rb(this.I.getVideoData().lengthSeconds);break;case 1084:this.Lb(new g.BK(4));break;case 2:this.Lb(new g.BK(4));this.Rb(A8(a));
break;case -1:this.Lb(new g.BK(64));break;case -1E3:this.Lb(new g.BK(128,{errorCode:"mdx.remoteerror",errorMessage:"This video is not available for remote playback."}))}a=F8(this.Pb).trackData;var b=this.B;(a||b?a&&b&&a.trackName==b.trackName&&a.languageCode==b.languageCode&&a.languageName==b.languageName&&a.kind==b.kind:1)||(this.B=a,sRa(this,a));a=F8(this.Pb);-1===a.volume||Math.round(this.I.getVolume())===a.volume&&this.I.isMuted()===a.muted||this.U.isActive()||this.XK()}else rRa(this)};
g.k.nJ=function(){this.I.W("mdxpreviousnextchange")};
g.k.Hx=function(){n9(this)||rRa(this)};
g.k.hJ=function(a){isNaN(a)||this.I.W("mdxnowautoplaying",a)};
g.k.HI=function(){this.I.W("mdxautoplaycanceled")};
g.k.setAudioTrack=function(a){n9(this)&&this.Pb.setAudioTrack(this.I.getVideoData(1).videoId,a)};
g.k.seekTo=function(a,b){-1===F8(this.Pb).playerState?p9(this,a):b&&this.Pb.seekTo(a)};
g.k.XK=function(){var a=this;if(n9(this)){var b=F8(this.Pb);this.events.fc(this.Y);b.muted?this.I.mute():this.I.unMute();this.I.setVolume(b.volume);this.Y=this.events.N(this.I,"onVolumeChange",function(c){qRa(a,c)})}};
g.k.qK=function(){this.i.stop();if(!this.Pb.Ha()){var a=F8(this.Pb);a.tc()&&this.Lb(new g.BK(8));this.Rb(A8(a));this.i.start()}};
g.k.rK=function(){this.u.stop();this.i.stop();var a=this.Pb.u.getReconnectTimeout();2==this.Pb.Oa&&!isNaN(a)&&this.u.start()};
g.k.Lb=function(a){this.u.stop();var b=this.G;if(!g.GK(b,a)){var c=g.U(a,2);c!==g.U(this.G,2)&&this.I.xp(c);this.G=a;uRa(this.l,b,a)}};g.v(q9,g.V);q9.prototype.Uc=function(){this.i.show()};
q9.prototype.Ab=function(){this.i.hide()};
q9.prototype.l=function(){g.iK("https://support.google.com/youtube/answer/7640706")};
q9.prototype.u=function(){G6("mdx-manual-pairing-popup-ok");this.Ab()};g.v(r9,g.V);r9.prototype.Uc=function(){this.i.show()};
r9.prototype.Ab=function(){this.i.hide()};
r9.prototype.l=function(){G6("mdx-privacy-popup-cancel");this.Ab()};
r9.prototype.u=function(){G6("mdx-privacy-popup-confirm");this.Ab()};g.v(s9,g.V);s9.prototype.l=function(a){tRa(this,a.state)};g.v(t9,g.qQ);t9.prototype.C=function(){var a=this.I.getOption("remote","receivers");a&&1<a.length&&!this.I.getOption("remote","quickCast")?(this.hn=g.Db(a,this.i,this),g.rQ(this,g.Oe(a,this.i)),a=this.I.getOption("remote","currentReceiver"),a=this.i(a),this.options[a]&&this.Hh(a),this.enable(!0)):this.enable(!1)};
t9.prototype.i=function(a){return a.key};
t9.prototype.Li=function(a){return"cast-selector-receiver"===a?"Cast...":this.hn[a].name};
t9.prototype.kf=function(a){g.qQ.prototype.kf.call(this,a);this.I.setOption("remote","currentReceiver",this.hn[a]);this.xb.Ab()};g.v(u9,g.zN);g.k=u9.prototype;
g.k.create=function(){var a=this.player.T(),b=g.SF(a);a={device:"Desktop",app:"youtube-desktop",loadCastApiSetupScript:g.S(a.experiments,"mdx_load_cast_api_bootstrap_script"),enableDialLoungeToken:g.S(a.experiments,"enable_dial_short_lived_lounge_token"),enableCastLoungeToken:g.S(a.experiments,"enable_cast_short_lived_lounge_token")};lRa(b,a);this.subscriptions.push(g.wu("yt-remote-before-disconnect",this.SQ,this));this.subscriptions.push(g.wu("yt-remote-connection-change",this.BS,this));this.subscriptions.push(g.wu("yt-remote-receiver-availability-change",
this.pJ,this));this.subscriptions.push(g.wu("yt-remote-auto-connect",this.zS,this));this.subscriptions.push(g.wu("yt-remote-receiver-resumed",this.yS,this));this.subscriptions.push(g.wu("mdx-privacy-popup-confirm",this.PT,this));this.subscriptions.push(g.wu("mdx-privacy-popup-cancel",this.OT,this));this.subscriptions.push(g.wu("mdx-manual-pairing-popup-ok",this.YP,this));this.pJ()};
g.k.load=function(){this.player.cancelPlayback();g.zN.prototype.load.call(this);this.Kh=new m9(this,this.player,this.Pb);var a=(a=pRa())?a.currentTime:0;var b=j9()?new E8(d9(),void 0):null;0==a&&b&&(a=A8(F8(b)));0!==a&&this.Rb(a);uRa(this,this.hd,this.hd);this.player.xk(6)};
g.k.unload=function(){this.player.W("mdxautoplaycanceled");this.nm=this.Xi;g.ff(this.Kh,this.Pb);this.Pb=this.Kh=null;g.zN.prototype.unload.call(this);this.player.xk(5);v9(this)};
g.k.ra=function(){g.xu(this.subscriptions);g.zN.prototype.ra.call(this)};
g.k.fk=function(a,b){for(var c=[],d=1;d<arguments.length;++d)c[d-1]=arguments[d];this.loaded&&this.Kh.Ti.apply(this.Kh,[a].concat(g.ma(c)))};
g.k.getAdState=function(){return this.Ze};
g.k.UO=function(){return this.loaded?this.Kh.suggestion:null};
g.k.Vj=function(){return this.Pb?F8(this.Pb).Vj:!1};
g.k.hasNext=function(){return this.Pb?F8(this.Pb).hasNext:!1};
g.k.Rb=function(a,b){this.cI=a||0;this.player.W("progresssync",a,b);this.player.Na("onVideoProgress",a)};
g.k.getCurrentTime=function(){return this.cI};
g.k.getProgressState=function(){var a=F8(this.Pb),b=this.player.getVideoData();return{allowSeeking:g.S(this.player.T().experiments,"web_player_mdx_allow_seeking_change_killswitch")?this.player.Xe():!a.isAdPlaying()&&this.player.Xe(),clipEnd:b.clipEnd,clipStart:b.clipStart,current:this.getCurrentTime(),displayedStart:-1,duration:a.getDuration(),ingestionTime:a.l?a.u+y8(a):a.u,isAtLiveHead:1>=(a.l?a.i+y8(a):a.i)-this.getCurrentTime(),loaded:a.K,seekableEnd:a.l?a.i+y8(a):a.i,seekableStart:0<a.B?a.B+
y8(a):a.B}};
g.k.nextVideo=function(){this.Pb&&this.Pb.nextVideo()};
g.k.Lx=function(){this.Pb&&this.Pb.Lx()};
g.k.SQ=function(a){1===a&&(this.HC=this.Pb?F8(this.Pb):null)};
g.k.BS=function(){var a=j9()?new E8(d9(),void 0):null;if(a){var b=this.nm;this.loaded&&this.unload();this.Pb=a;this.HC=null;b.key!==this.Xi.key&&(this.nm=b,this.load())}else g.ef(this.Pb),this.Pb=null,this.loaded&&(this.unload(),(a=this.HC)&&a.videoId===this.player.getVideoData().videoId&&this.player.cueVideoById(a.videoId,A8(a)));this.player.W("videodatachange","newdata",this.player.getVideoData(),3)};
g.k.pJ=function(){var a=[this.Xi],b=a.concat,c=mRa();s8()&&g.Yy("yt-remote-cast-available")&&c.push({key:"cast-selector-receiver",name:"Cast..."});this.hn=b.call(a,c);a=e9()||this.Xi;w9(this,a);this.player.Na("onMdxReceiversChange")};
g.k.zS=function(){var a=e9();w9(this,a)};
g.k.yS=function(){this.nm=e9()};
g.k.PT=function(){this.ou=!0;v9(this);l9=!1;f9&&h9(f9,1);f9=null};
g.k.OT=function(){this.ou=!1;v9(this);w9(this,this.Xi);this.nm=this.Xi;l9=!1;f9=null;this.player.playVideo()};
g.k.YP=function(){this.ex=!0;v9(this);g.Xy("yt-remote-manual-pairing-warning-shown",!0,2592E3);l9=!1;f9&&h9(f9,1);f9=null};
g.k.Se=function(a,b){switch(a){case "casting":return this.loaded;case "receivers":return this.hn;case "currentReceiver":return b&&("cast-selector-receiver"===b.key?u8():w9(this,b)),this.loaded?this.nm:this.Xi;case "quickCast":return 2===this.hn.length&&"cast-selector-receiver"===this.hn[1].key?(b&&u8(),!0):!1}};
g.k.zD=function(){this.Pb.zD()};
g.k.ri=function(){return!1};
g.k.getOptions=function(){return["casting","receivers","currentReceiver","quickCast"]};g.KN.remote=u9;})(_yt_player);
