(function(g){var window=this;var ZAa=function(a,b){return g.Sb(a,b)},Q6=function(a){g.Dm(a,"zx",g.wb());
return a},R6=function(a,b,c){g.ya(c)||(c=[String(c)]);
g.Gm(a.g,b,c)},$Aa=function(a,b){var c=[];
g.sk(b,function(a){try{var b=g.cD.prototype.l.call(this,a,!0)}catch(f){if("Storage: Invalid value was encountered"==f)return;throw f;}g.u(b)?g.bD(b)&&c.push(a):c.push(a)},a);
return c},aBa=function(a,b){var c=$Aa(a,b);
(0,g.C)(c,function(a){g.cD.prototype.remove.call(this,a)},a)},bBa=function(a){if(a.Bd){if(a.Bd.locationOverrideToken)return{locationOverrideToken:a.Bd.locationOverrideToken};
if(null!=a.Bd.latitudeE7&&null!=a.Bd.longitudeE7)return{latitudeE7:a.Bd.latitudeE7,longitudeE7:a.Bd.longitudeE7}}return null},cBa=function(a,b,c,d){var e=new g.um(null,void 0);
a&&g.vm(e,a);b&&g.wm(e,b);c&&g.xm(e,c);d&&g.ym(e,d);return e},dBa=function(a){g.SF[a]&&(a=g.SF[a],(0,g.C)(a,function(a){g.QF[a]&&delete g.QF[a]}),a.length=0)},eBa=function(a){var b=g.PF();
if(b)if(b.clear(a),a)dBa(a);else for(var c in g.SF)dBa(c)},S6=function(a){this.app=this.name=this.id="";
this.type="REMOTE_CONTROL";this.obfuscatedGaiaId=this.avatar=this.username="";this.o=!1;this.capabilities=new window.Set;this.experiments=new window.Set;this.theme="u";new g.om;this.g=this.l="";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",fBa(this,a.capabilities||""),gBa(this,a.experiments||""),this.l=a.remoteControllerUrl||"",
this.g=a.localChannelEncryptionKey||"")},fBa=function(a,b){a.capabilities.clear();
(0,g.Jd)(b.split(","),g.Ea(ZAa,hBa)).forEach(function(b){a.capabilities.add(b)})},gBa=function(a,b){a.experiments.clear();
b.split(",").forEach(function(b){a.experiments.add(b)})},T6=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||""},U6=function(a,b){return!!b&&(a.id==b||a.uuid==b)},iBa=function(a){return{name:a.name,
screenId:a.id,loungeToken:a.token,dialId:a.uuid}},jBa=function(a){return new T6(a)},kBa=function(a){return g.ya(a)?(0,g.I)(a,jBa):[]},V6=function(a){return a?'{name:"'+a.name+'",id:'+a.id.substr(0,6)+"..,token:"+(a.token?".."+a.token.slice(-6):"-")+",uuid:"+(a.uuid?".."+a.uuid.slice(-6):"-")+"}":"null"},W6=function(a){return g.ya(a)?"["+(0,g.I)(a,V6).join(",")+"]":"null"},X6=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)})},lBa=function(a){return(0,g.I)(a,function(a){return{key:a.id,
name:a.name}})},Y6=function(a,b){return g.Ka(a,function(a){return a||b?!a!=!b?!1:a.id==b.id:!0})},Z6=function(a,b){return g.Ka(a,function(a){return U6(a,b)})},mBa=function(){var a=(0,g.LG)();
a&&aBa(a,a.g.Rd(!0))},$6=function(){var a=g.OG("yt-remote-connected-devices")||[];
g.fb(a);return a},nBa=function(a){if(g.Pa(a))return[];
var b=a[0].indexOf("#"),c=-1==b?a[0]:a[0].substring(0,b);return(0,g.I)(a,function(a,b){return 0==b?a:a.substring(c.length)})},oBa=function(a){g.NG("yt-remote-connected-devices",a,86400)},b7=function(){if(a7)return a7;
var a=g.OG("yt-remote-device-id");a||(a=X6(),g.NG("yt-remote-device-id",a,31536E3));for(var b=$6(),c=1,d=a;g.Oa(b,d);)c++,d=a+"#"+c;return a7=d},c7=function(){var a=$6(),b=b7();
g.Oa(a,b);g.QG()&&g.ib(a,b);a=nBa(a);if(g.Pa(a))try{g.yG("remote_sid")}catch(c){}else try{g.xG("remote_sid",a.join(","),-1)}catch(c){}},pBa=function(){return g.OG("yt-remote-session-browser-channel")},qBa=function(){return g.OG("yt-remote-local-screens")||[]},rBa=function(){g.NG("yt-remote-lounge-token-expiration",!0,86400)},sBa=function(a){5<a.length&&(a=a.slice(a.length-5));
var b=(0,g.I)(qBa(),function(a){return a.loungeToken}),c=(0,g.I)(a,function(a){return a.loungeToken});
(0,g.cm)(c,function(a){return!g.Oa(b,a)})&&rBa();
g.NG("yt-remote-local-screens",a,31536E3)},tBa=function(a,b){g.NG("yt-remote-session-browser-channel",a);
g.NG("yt-remote-session-screen-id",b);var c=$6(),d=b7();g.Oa(c,d)||c.push(d);oBa(c);c7()},d7=function(a){a||(g.PG("yt-remote-session-screen-id"),g.PG("yt-remote-session-video-id"));
c7();a=$6();g.Ta(a,b7());oBa(a)},uBa=function(){if(!e7){var a=g.nD();
a&&(e7=new g.XC(a))}return e7?!!e7.get("yt-remote-use-staging-server"):!1},vBa=function(){var a=window.document.createElement("a");
g.Xc(a,"https://www.gstatic.com/cv/js/sender/v1/cast_sender.js");a=a.href.replace(/^[a-zA-Z]+:\/\//,"//");return"js-"+g.Ab(a)},wBa=function(a,b){var c=g.Cd("SCRIPT");
c.id=a;c.onload=function(){b&&(0,window.setTimeout)(b,0)};
c.onreadystatechange=function(){switch(c.readyState){case "loaded":case "complete":c.onload()}};
g.Zc(c,g.ae("https://www.gstatic.com/cv/js/sender/v1/cast_sender.js"));var d=window.document.getElementsByTagName("head")[0]||window.document.body;d.insertBefore(c,d.firstChild);return c},xBa=function(){var a=vBa(),b=window.document.getElementById(a),c=b&&g.aF(b,"loaded");
c||b&&!c||(b=wBa(a,function(){g.aF(b,"loaded")||(g.$E(b,"loaded","true"),g.WF(a),g.WD(g.Ea(eBa,a),0))}))},f7=function(a){return!!window.document.currentScript&&(-1!=window.document.currentScript.src.indexOf("?"+a)||-1!=window.document.currentScript.src.indexOf("&"+a))},yBa=function(){return"function"==typeof window.__onGCastApiAvailable?window.__onGCastApiAvailable:null},g7=function(a){a.length?zBa(a.shift(),function(){g7(a)}):h7()},ABa=function(a){return"chrome-extension://"+a+i7},zBa=function(a,
b,c){var d=window.document.createElement("script");
d.onerror=b;c&&(d.onload=c);d.src=a;(window.document.head||window.document.documentElement).appendChild(d)},j7=function(a){return 0<=window.navigator.userAgent.indexOf(a)},h7=function(){var a=yBa();
a&&a(!1,"No cast extension found")},k7=function(){if(BBa){var a=2,b=yBa(),c=function(){a--;
0==a&&b&&b(!0)};
window.__onGCastApiAvailable=c;zBa("//www.gstatic.com/cast/sdk/libs/sender/1.0/cast_framework.js",h7,c)}},CBa=function(){var a=window.__gCrWeb&&window.__gCrWeb.message&&window.__gCrWeb.message.invokeOnHost;
a&&(k7(),a({command:"cast.sender.init"}))},DBa=function(){k7();
var a=window.navigator.userAgent.match(/Chrome\/([0-9]+)/);g7(["//www.gstatic.com/eureka/clank/"+(a?(0,window.parseInt)(a[1],10):0)+i7,"//www.gstatic.com/eureka/clank"+i7])},l7=function(a,b,c){g.M.call(this);
this.C=null!=c?(0,g.A)(a,c):a;this.rd=b;this.B=(0,g.A)(this.sJ,this);this.g=!1;this.l=0;this.o=this.Ba=null;this.A=[]},m7=function(){},n7=function(a,b,c,d){this.g=a;
this.o=b;this.D=c;this.C=d||1;this.A=45E3;this.W=new g.Km(this);this.l=new g.qg;this.l.setInterval(250)},FBa=function(a,b,c){a.Kj=1;
a.jh=Q6(b.clone());a.Oi=c;a.B=!0;EBa(a,null)},o7=function(a,b,c,d,e){a.Kj=1;
a.jh=Q6(b.clone());a.Oi=null;a.B=c;e&&(a.GD=!1);EBa(a,d)},EBa=function(a,b){a.xk=(0,g.G)();
p7(a);a.Hh=a.jh.clone();R6(a.Hh,"t",a.C);a.Km=0;a.Sc=a.g.zr(a.g.Bm()?b:null);0<a.hs&&(a.Dp=new g.Vk((0,g.A)(a.UE,a,a.Sc),a.hs));a.W.U(a.Sc,"readystatechange",a.KU);var c=a.mi?g.$b(a.mi):{};a.Oi?(a.oq="POST",c["Content-Type"]="application/x-www-form-urlencoded",a.Sc.send(a.Hh,a.oq,a.Oi,c)):(a.oq="GET",a.GD&&!g.yd&&(c.Connection="close"),a.Sc.send(a.Hh,a.oq,null,c));a.g.xf(1)},IBa=function(a,b,c){for(var d=!0;!a.Wh&&a.Km<c.length;){var e=GBa(a,c);
if(e==q7){4==b&&(a.kh=4,r7(15),d=!1);break}else if(e==HBa){a.kh=4;r7(16);d=!1;break}else s7(a,e)}4==b&&0==c.length&&(a.kh=1,r7(17),d=!1);a.Df=a.Df&&d;d||(t7(a),u7(a))},GBa=function(a,b){var c=a.Km,d=b.indexOf("\n",c);
if(-1==d)return q7;c=Number(b.substring(c,d));if((0,window.isNaN)(c))return HBa;d+=1;if(d+c>b.length)return q7;var e=b.substr(d,c);a.Km=d+c;return e},KBa=function(a,b){a.xk=(0,g.G)();
p7(a);var c=b?window.location.hostname:"";a.Hh=a.jh.clone();g.Dm(a.Hh,"DOMAIN",c);g.Dm(a.Hh,"t",a.C);try{a.Ef=new window.ActiveXObject("htmlfile")}catch(n){t7(a);a.kh=7;r7(22);u7(a);return}var d="<html><body>";if(b){for(var e="",f=0;f<c.length;f++){var k=c.charAt(f);if("<"==k)e+="\\x3c";else if(">"==k)e+="\\x3e";else{var l=k;if(l in v7)k=v7[l];else if(l in JBa)k=v7[l]=JBa[l];else{var m=l.charCodeAt(0);if(31<m&&127>m)k=l;else{if(256>m){if(k="\\x",16>m||256<m)k+="0"}else k="\\u",4096>m&&(k+="0");k+=
m.toString(16).toUpperCase()}k=v7[l]=k}e+=k}}d+='<script>document.domain="'+e+'"\x3c/script>'}d+="</body></html>";c=g.$c(g.vc("b/12014412"),d);a.Ef.open();a.Ef.write(g.Rc(c));a.Ef.close();a.Ef.parentWindow.m=(0,g.A)(a.RT,a);a.Ef.parentWindow.d=(0,g.A)(a.SC,a,!0);a.Ef.parentWindow.rpcClose=(0,g.A)(a.SC,a,!1);c=a.Ef.createElement("DIV");a.Ef.parentWindow.document.body.appendChild(c);d=g.Ic(a.Hh.toString());d=g.pb(g.Fc(d));d=g.$c(g.vc("b/12014412"),'<iframe src="'+d+'"></iframe>');c.innerHTML=g.Rc(d);
a.g.xf(1)},p7=function(a){a.Pv=(0,g.G)()+a.A;
LBa(a,a.A)},LBa=function(a,b){if(null!=a.Ok)throw Error("WatchDog timer not null");
a.Ok=w7((0,g.A)(a.jU,a),b)},x7=function(a){a.Ok&&(g.x.clearTimeout(a.Ok),a.Ok=null)},u7=function(a){a.g.ez()||a.Wh||a.g.pp(a)},t7=function(a){x7(a);
g.Ze(a.Dp);a.Dp=null;a.l.stop();g.Qm(a.W);if(a.Sc){var b=a.Sc;a.Sc=null;b.abort();b.dispose()}a.Ef&&(a.Ef=null)},s7=function(a,b){try{a.g.LC(a,b),a.g.xf(4)}catch(c){}},NBa=function(a,b,c,d,e){if(0==d)c(!1);
else{var f=e||0;d--;MBa(a,b,function(e){e?c(!0):g.x.setTimeout(function(){NBa(a,b,c,d,f)},f)})}},MBa=function(a,b,c){var d=new window.Image;
d.onload=function(){try{y7(d),c(!0)}catch(e){}};
d.onerror=function(){try{y7(d),c(!1)}catch(e){}};
d.onabort=function(){try{y7(d),c(!1)}catch(e){}};
d.ontimeout=function(){try{y7(d),c(!1)}catch(e){}};
g.x.setTimeout(function(){if(d.ontimeout)d.ontimeout()},b);
d.src=a},y7=function(a){a.onload=null;
a.onerror=null;a.onabort=null;a.ontimeout=null},OBa=function(a){this.g=a;
this.l=new m7},PBa=function(a){var b=z7(a.g,a.Vk,"/mail/images/cleardot.gif");
Q6(b);NBa(b.toString(),5E3,(0,g.A)(a.CI,a),3,2E3);a.xf(1)},B7=function(a){var b=a.g.H;
if(null!=b)r7(5),b?(r7(11),A7(a.g,a,!1)):(r7(12),A7(a.g,a,!0));else if(a.se=new n7(a,void 0,void 0,void 0),a.se.mi=a.es,b=a.g,b=z7(b,b.Bm()?a.yl:null,a.gs),r7(5),!g.wd||g.pc(10))R6(b,"TYPE","xmlhttp"),o7(a.se,b,!1,a.yl,!1);else{R6(b,"TYPE","html");var c=a.se;a=!!a.yl;c.Kj=3;c.jh=Q6(b.clone());KBa(c,a)}},C7=function(a,b,c){this.g=1;
this.l=[];this.A=[];this.B=new m7;this.F=a||null;this.H=null!=b?b:null;this.C=c||!1},QBa=function(a,b){this.g=a;
this.map=b;this.context=null},RBa=function(a){g.af.call(this,"statevent",a)},SBa=function(a,b){g.af.call(this,"timingevent",a);
this.size=b},TBa=function(a){g.af.call(this,"serverreachability",a)},WBa=function(a){UBa(a);
if(3==a.g){var b=a.gm++,c=a.Xn.clone();g.Dm(c,"SID",a.o);g.Dm(c,"RID",b);g.Dm(c,"TYPE","terminate");D7(a,c);b=new n7(a,a.o,b,void 0);b.Kj=2;b.jh=Q6(c.clone());(new window.Image).src=b.jh;b.xk=(0,g.G)();p7(b)}VBa(a)},XBa=function(a){a.aJ(1,0);
a.Xn=z7(a,null,a.ds);E7(a)},UBa=function(a){a.ah&&(a.ah.abort(),a.ah=null);
a.xc&&(a.xc.cancel(),a.xc=null);a.rg&&(g.x.clearTimeout(a.rg),a.rg=null);F7(a);a.Xd&&(a.Xd.cancel(),a.Xd=null);a.eh&&(g.x.clearTimeout(a.eh),a.eh=null)},YBa=function(a,b){if(0==a.g)throw Error("Invalid operation: sending map when state is closed");
a.l.push(new QBa(a.HP++,b));2!=a.g&&3!=a.g||E7(a)},E7=function(a){a.Xd||a.eh||(a.eh=w7((0,g.A)(a.QC,a),0),a.vj=0)},$Ba=function(a,b){if(1==a.g){if(!b){a.gm=Math.floor(1E5*Math.random());
var c=a.gm++,d=new n7(a,"",c,void 0);d.mi=null;var e=G7(a),f=a.Xn.clone();g.Dm(f,"RID",c);g.Dm(f,"CVER","1");D7(a,f);FBa(d,f,e);a.Xd=d;a.g=2}}else 3==a.g&&(b?ZBa(a,b):0==a.l.length||a.Xd||ZBa(a))},ZBa=function(a,b){if(b)if(6<a.Yh){a.l=a.A.concat(a.l);
a.A.length=0;var c=a.gm-1;var d=G7(a)}else c=b.D,d=b.Oi;else c=a.gm++,d=G7(a);var e=a.Xn.clone();g.Dm(e,"SID",a.o);g.Dm(e,"RID",c);g.Dm(e,"AID",a.Yj);D7(a,e);c=new n7(a,a.o,c,a.vj+1);c.mi=null;c.setTimeout(1E4+Math.round(1E4*Math.random()));a.Xd=c;FBa(c,e,d)},D7=function(a,b){if(a.qd){var c=a.qd.Ly();
c&&g.Ib(c,function(a,c){g.Dm(b,c,a)})}},G7=function(a){var b=Math.min(a.l.length,1E3),c=["count="+b];
if(6<a.Yh&&0<b){var d=a.l[0].g;c.push("ofs="+d)}else d=0;for(var e=0;e<b;e++){var f=a.l[e].g,k=a.l[e].map;f=6>=a.Yh?e:f-d;try{g.Ib(k,function(a,b){c.push("req"+f+"_"+b+"="+(0,window.encodeURIComponent)(a))})}catch(l){c.push("req"+f+"_type="+(0,window.encodeURIComponent)("_badmap"))}}a.A=a.A.concat(a.l.splice(0,b));
return c.join("&")},aCa=function(a){a.xc||a.rg||(a.D=1,a.rg=w7((0,g.A)(a.PC,a),0),a.hj=0)},H7=function(a){if(a.xc||a.rg||3<=a.hj)return!1;
a.D++;a.rg=w7((0,g.A)(a.PC,a),bCa(a,a.hj));a.hj++;return!0},A7=function(a,b,c){a.nq=c;
a.Pf=b.Cg;a.C||XBa(a)},F7=function(a){null!=a.bi&&(g.x.clearTimeout(a.bi),a.bi=null)},bCa=function(a,b){var c=5E3+Math.floor(1E4*Math.random());
a.isActive()||(c*=2);return c*b},I7=function(a,b){if(2==b||9==b){var c=null;
a.qd&&(c=null);var d=(0,g.A)(a.CV,a);c||(c=new g.um("//www.google.com/images/cleardot.gif"),Q6(c));MBa(c.toString(),1E4,d)}else r7(2);cCa(a,b)},cCa=function(a,b){a.g=0;
a.qd&&a.qd.Gx(b);VBa(a);UBa(a)},VBa=function(a){a.g=0;
a.Pf=-1;if(a.qd)if(0==a.A.length&&0==a.l.length)a.qd.lr();else{g.Wa(a.A);var b=g.Wa(a.l);a.A.length=0;a.l.length=0;a.qd.lr(b)}},z7=function(a,b,c){var d=g.Em(c);
if(""!=d.l)b&&g.wm(d,b+"."+d.l),g.xm(d,d.B);else{var e=window.location;d=cBa(e.protocol,b?b+"."+e.hostname:e.hostname,e.port,c)}a.kl&&g.Ib(a.kl,function(a,b){g.Dm(d,b,a)});
g.Dm(d,"VER",a.Yh);D7(a,d);return d},w7=function(a,b){if(!g.Aa(a))throw Error("Fn must not be null and must be a function");
return g.x.setTimeout(function(){a()},b)},r7=function(a){J7.dispatchEvent(new RBa(J7,a))},dCa=function(){},eCa=function(a,b){this.action=a;
this.params=b||{}},K7=function(a,b){g.M.call(this);
this.g=new g.Xt(this.HT,0,this);g.N(this,this.g);this.rd=5E3;this.l=0;if(g.Aa(a))b&&(a=(0,g.A)(a,b));else if(a&&g.Aa(a.handleEvent))a=(0,g.A)(a.handleEvent,a);else throw Error("Invalid listener argument");this.o=a},L7=function(a,b,c){this.J=a;
this.C=b;this.o=new g.WC;this.l=new K7(this.jW,this);this.g=this.Ya=null;this.I=!1;this.B=null;this.H="";this.F=this.A=0;this.D=[];this.K=c||!1},fCa=function(a){return{firstTestResults:[""],
secondTestResults:!a.g.nq,sessionId:a.g.o,arrayId:a.g.Yj}},gCa=function(a,b){a.F=b||0;
a.l.stop();a.g&&(3==a.g.g&&$Ba(a.g),WBa(a.g));a.F=0},M7=function(a){return!!a.g&&3==a.g.g},hCa=function(a,b){(a.C.loungeIdToken=b)||a.l.stop()},N7=function(a){this.port=this.domain="";
this.g="/api/lounge";this.l=!0;a=a||window.document.location.href;var b=g.Gg(a)||"";b&&(this.port=":"+b);this.domain=g.Fg(a)||"";a=g.Gb;0<=a.search("MSIE")&&(a=a.match(/MSIE ([\d.]+)/)[1],0>g.zb(a,"10.0")&&(this.l=!1))},O7=function(a,b){var c=a.g;
if(g.u(void 0)?0:a.l)c="https://"+a.domain+a.port+a.g;return g.Pg(c+b,{})},P7=function(a,b,c,d,e){a={format:"JSON",
method:"POST",context:a,timeout:5E3,withCredentials:!1,onSuccess:g.Ea(a.A,d,!0),onError:g.Ea(a.o,e),yd:g.Ea(a.B,e)};c&&(a.Nb=c,a.headers={"Content-Type":"application/x-www-form-urlencoded"});return g.mE(b,a)},lCa=function(){var a=iCa;
jCa();Q7.push(a);kCa(Q7)},R7=function(a,b){jCa();
var c=Q7,d=mCa(a,String(b));g.Pa(c)?nCa(d):(kCa(c),(0,g.C)(c,function(a){a(d)}))},jCa=function(){Q7||(Q7=g.y("yt.mdx.remote.debug.handlers_")||[],g.va("yt.mdx.remote.debug.handlers_",Q7,void 0))},nCa=function(a){var b=(S7+1)%50;
S7=b;T7[b]=a;U7||(U7=49==b)},kCa=function(a){var b=T7;
if(b[0]){var c=S7,d=U7?c:-1;do{d=(d+1)%50;var e=b[d];(0,g.C)(a,function(a){a(e)})}while(d!=c);
T7=Array(50);S7=-1;U7=!1}},mCa=function(a,b){var c=((0,g.G)()-oCa)/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("")},V7=function(a){g.HF.call(this);
this.D=a;this.g=[]},pCa=function(a,b){var c=a.get(b.uuid)||a.get(b.id);
if(c){var d=c.name;c.id=b.id||c.id;c.name=b.name;c.token=b.token;c.uuid=b.uuid||c.uuid;return c.name!=d}a.g.push(b);return!0},qCa=function(a,b){var c=a.g.length!=b.length;
a.g=(0,g.Jd)(a.g,function(a){return!!Y6(b,a)});
for(var d=0,e=b.length;d<e;d++)c=pCa(a,b[d])||c;return c},rCa=function(a,b){var c=a.g.length;
a.g=(0,g.Jd)(a.g,function(a){return!(a||b?!a!=!b?0:a.id==b.id:1)});
return a.g.length<c},W7=function(a,b,c,d){g.HF.call(this);
this.C=a;this.B=b;this.o=c;this.A=d;this.l=0;this.g=null;this.Ba=window.NaN},Y7=function(a){V7.call(this,"LocalScreenService");
this.o=a;this.l=window.NaN;X7(this);this.info("Initializing with "+W6(this.g))},sCa=function(a){if(a.g.length){var b=(0,g.I)(a.g,function(a){return a.id}),c=O7(a.o,"/pairing/get_lounge_token_batch");
P7(a.o,c,{screen_ids:b.join(",")},(0,g.A)(a.FJ,a),(0,g.A)(a.EJ,a))}},X7=function(a){var b=kBa(qBa());
b=(0,g.Jd)(b,function(a){return!a.uuid});
return qCa(a,b)},Z7=function(a,b){sBa((0,g.I)(a.g,iBa));
b&&rBa()},a8=function(a,b){g.HF.call(this);
this.C=b;var c=g.OG("yt-remote-online-screen-ids")||"";c=c?c.split(","):[];for(var d={},e=this.C(),f=0,k=e.length;f<k;++f){var l=e[f].id;d[l]=g.Oa(c,l)}this.g=d;this.B=a;this.o=this.A=window.NaN;this.l=null;$7("Initialized with "+g.xg(this.g))},tCa=function(a,b,c){var d=O7(a.B,"/pairing/get_screen_availability");
P7(a.B,d,{lounge_token:b.token},(0,g.A)(function(a){a=a.screens||[];for(var d=0,e=a.length;d<e;++d)if(a[d].loungeToken==b.token){c("online"==a[d].status);return}c(!1)},a),(0,g.A)(function(){c(!1)},a))},b8=function(a,b){a:if(g.Mb(b)!=g.Mb(a.g))var c=!1;
else{c=g.Pb(b);for(var d=0,e=c.length;d<e;++d)if(!a.g[c[d]]){c=!1;break a}c=!0}c||($7("Updated online screens: "+g.xg(a.g)),a.g=b,a.T("screenChange"));uCa(a)},c8=function(a){(0,window.isNaN)(a.o)||g.YD(a.o);
a.o=g.WD((0,g.A)(a.bv,a),0<a.A&&a.A<(0,g.G)()?2E4:1E4)},$7=function(a){R7("OnlineScreenService",a)},vCa=function(a){var b={};
(0,g.C)(a.C(),function(a){a.token?b[a.token]=a.id:this.hc("Requesting availability of screen w/o lounge token.")});
return b},uCa=function(a){a=g.Pb(g.Jb(a.g,function(a){return a}));
g.fb(a);a.length?g.NG("yt-remote-online-screen-ids",a.join(","),60):g.PG("yt-remote-online-screen-ids")},d8=function(a){V7.call(this,"ScreenService");
this.C=a;this.l=this.o=null;this.A=[];this.B={};wCa(this)},yCa=function(a,b,c,d,e,f){a.info("getAutomaticScreenByIds "+c+" / "+b);
c||(c=a.B[b]);var k=a.ke();if(k=(c?Z6(k,c):null)||Z6(k,b)){k.uuid=b;var l=e8(a,k);tCa(a.l,l,function(a){e(a?l:null)})}else c?xCa(a,c,(0,g.A)(function(a){var f=e8(this,new T6({name:d,
screenId:c,loungeToken:a,dialId:b||""}));tCa(this.l,f,function(a){e(a?f:null)})},a),f):e(null)},zCa=function(a,b){for(var c=0,d=a.g.length;c<d;++c)if(a.g[c].name==b)return a.g[c];
return null},xCa=function(a,b,c,d){a.info("requestLoungeToken_ for "+b);
var e={Nb:{screen_ids:b},method:"POST",context:a,onSuccess:function(a,e){var f=e&&e.screens||[];f[0]&&f[0].screenId==b?c(f[0].loungeToken):d(Error("Missing lounge token in token response"))},
onError:function(){d(Error("Request screen lounge token failed"))}};
g.mE(O7(a.C,"/pairing/get_lounge_token_batch"),e)},ACa=function(a){a.g=a.o.ke();
var b=a.B,c={},d;for(d in b)c[b[d]]=d;b=0;for(d=a.g.length;b<d;++b){var e=a.g[b];e.uuid=c[e.id]||""}a.info("Updated manual screens: "+W6(a.g))},wCa=function(a){f8(a);
a.o=new Y7(a.C);a.o.subscribe("screenChange",(0,g.A)(a.UJ,a));ACa(a);a.A=kBa(g.OG("yt-remote-automatic-screen-cache")||[]);f8(a);a.info("Initializing automatic screens: "+W6(a.A));a.l=new a8(a.C,(0,g.A)(a.ke,a,!0));a.l.subscribe("screenChange",(0,g.A)(function(){this.T("onlineScreenChange")},a))},e8=function(a,b){var c=a.get(b.id);
c?(c.uuid=b.uuid,b=c):((c=Z6(a.A,b.uuid))?(c.id=b.id,c.token=b.token,b=c):a.A.push(b),g.NG("yt-remote-automatic-screen-cache",(0,g.I)(a.A,iBa)));f8(a);a.B[b.uuid]=b.id;g.NG("yt-remote-device-id-map",a.B,31536E3);return b},f8=function(a){a.B=g.OG("yt-remote-device-id-map")||{}},g8=function(a,b,c){g.HF.call(this);
this.K=c;this.H=a;this.l=b;this.o=null},h8=function(a,b){R7(a.K,b)},i8=function(a,b){g8.call(this,a,b,"CastSession");
this.g=null;this.A=0;this.C=(0,g.A)(this.pW,this);this.B=(0,g.A)(this.vU,this);this.A=g.WD((0,g.A)(function(){BCa(this,null)},this),12E4)},CCa=function(a){a.info("sendYoutubeMessage_: getMdxSessionStatus "+g.xg(void 0));
var b={type:"getMdxSessionStatus"};a.g?a.g.sendMessage("urn:x-cast:com.google.youtube.mdx",b,g.z,(0,g.A)(function(){h8(this,"Failed to send message: getMdxSessionStatus.")},a)):h8(a,"Sending yt message without session: "+g.xg(b))},BCa=function(a,b){g.YD(a.A);
if(b){if(a.info("onConnectedScreenId_: Received screenId: "+b),!a.o||a.o.id!=b){var c=(0,g.A)(a.qp,a),d=(0,g.A)(a.re,a);a.Vy(b,c,d,5)}}else a.re(Error("Waiting for session status timed out."))},j8=function(a,b,c){g8.call(this,a,b,"DialSession");
this.A=this.F=null;this.I="";this.M=c;this.B=null;this.D=g.z;this.C=window.NaN;this.J=(0,g.A)(this.sW,this);this.g=g.z},DCa=function(a){a.g=a.H.bF(a.I,a.l.label,a.l.friendlyName,(0,g.A)(function(a){this.g=g.z;
this.qp(a)},a),(0,g.A)(function(a){this.g=g.z;
this.re(a)},a))},ECa=function(a){var b={};
b.pairingCode=a.I;b.theme=a.M;if(a.B){var c=a.B.currentTime||0;b.v=a.B.videoId;b.t=c}uBa()&&(b.env_useStageMdx=1);return g.Ng(b)},k8=function(a,b){g8.call(this,a,b,"ManualSession");
this.g=g.WD((0,g.A)(this.ak,this,null),150)},l8=function(a,b,c,d){g.HF.call(this);
this.l=a;this.D=b||"233637DE";this.C=c||"cl";this.F=d||!1;this.g=null;this.B=!1;this.o=[];this.A=(0,g.A)(this.US,this)},FCa=function(a,b){return b?g.Ka(a.o,function(a){return U6(b,a.label)},a):null},m8=function(a){R7("Controller",a)},iCa=function(a){window.chrome&&window.chrome.cast&&window.chrome.cast.logMessage&&window.chrome.cast.logMessage(a)},n8=function(a){return a.B||!!a.o.length||!!a.g},o8=function(a,b,c){b!=a.g&&(g.Ze(a.g),(a.g=b)?(c?a.T("yt-remote-cast2-receiver-resumed",b.l):a.T("yt-remote-cast2-receiver-selected",
b.l),b.subscribe("sessionScreen",(0,g.A)(a.NC,a,b)),b.o?a.T("yt-remote-cast2-session-change",b.o):c&&a.g.ak(null)):a.T("yt-remote-cast2-session-change",null))},GCa=function(a){var b=a.l.aF(),c=a.g&&a.g.l;
a=(0,g.I)(b,function(a){c&&U6(a,c.label)&&(c=null);var b=a.uuid?a.uuid:a.id,d=FCa(this,a);d?(d.label=b,d.friendlyName=a.name):(d=new window.chrome.cast.Receiver(b,a.name),d.receiverType=window.chrome.cast.ReceiverType.CUSTOM);return d},a);
c&&(c.receiverType!=window.chrome.cast.ReceiverType.CUSTOM&&(c=new window.chrome.cast.Receiver(c.label,c.friendlyName),c.receiverType=window.chrome.cast.ReceiverType.CUSTOM),a.push(c));return a},MCa=function(a,b,c,d,e,f,k){HCa()?ICa(b,e,f,k)&&(q8(!0),window.chrome&&window.chrome.cast&&window.chrome.cast.isAvailable?JCa(a,c):(window.__onGCastApiAvailable=function(b,d){b?JCa(a,c):(r8("Failed to load cast API: "+d),s8(!1),q8(!1),g.PG("yt-remote-cast-available"),g.PG("yt-remote-cast-receiver"),KCa(),
c(!1))},d?window.spf?window.spf.script.load("https://www.gstatic.com/cv/js/sender/v1/cast_sender.js","",void 0):xBa():j7("CriOS")?CBa():j7("Android")&&j7("Chrome/")&&window.navigator.presentation?DBa():window.chrome&&window.navigator.presentation&&!j7("Edge")?(k7(),g7(LCa.map(ABa))):h7())):p8("Cannot initialize because not running Chrome")},KCa=function(){p8("dispose");
var a=t8();a&&a.dispose();g.va("yt.mdx.remote.cloudview.instance_",null,void 0);NCa(!1);g.UF(u8);u8.length=0},v8=function(){return!!g.OG("yt-remote-cast-installed")},OCa=function(){var a=g.OG("yt-remote-cast-receiver");
return a?a.friendlyName:null},PCa=function(){p8("clearCurrentReceiver");
g.PG("yt-remote-cast-receiver")},QCa=function(){return v8()?t8()?t8().getCastSession():(r8("getCastSelector: Cast is not initialized."),null):(r8("getCastSelector: Cast API is not installed!"),null)},x8=function(){v8()?t8()?w8()?(p8("Requesting cast selector."),t8().requestSession()):(p8("Wait for cast API to be ready to request the session."),u8.push(g.TF("yt-remote-cast2-api-ready",x8))):r8("requestCastSelector: Cast is not initialized."):r8("requestCastSelector: Cast API is not installed!")},y8=
function(a,b){w8()?t8().setConnectedScreenStatus(a,b):r8("setConnectedScreenStatus called before ready.")},HCa=function(){var a=0<=g.Gb.search(/ (CrMo|Chrome|CriOS)\//);
return g.zI||a},RCa=function(a,b){t8().init(a,b)},ICa=function(a,b,c,d){var e=!1;
t8()||(a=new l8(a,b,c,d),a.subscribe("yt-remote-cast2-availability-change",function(a){g.NG("yt-remote-cast-available",a);g.XF("yt-remote-cast2-availability-change",a)}),a.subscribe("yt-remote-cast2-receiver-selected",function(a){p8("onReceiverSelected: "+a.friendlyName);
g.NG("yt-remote-cast-receiver",a);g.XF("yt-remote-cast2-receiver-selected",a)}),a.subscribe("yt-remote-cast2-receiver-resumed",function(a){p8("onReceiverResumed: "+a.friendlyName);
g.NG("yt-remote-cast-receiver",a)}),a.subscribe("yt-remote-cast2-session-change",function(a){p8("onSessionChange: "+V6(a));
a||g.PG("yt-remote-cast-receiver");g.XF("yt-remote-cast2-session-change",a)}),g.va("yt.mdx.remote.cloudview.instance_",a,void 0),e=!0);
p8("cloudview.createSingleton_: "+e);return e},t8=function(){return g.y("yt.mdx.remote.cloudview.instance_")},JCa=function(a,b){s8(!0);
q8(!1);RCa(a,function(a){a?(NCa(!0),g.WF("yt-remote-cast2-api-ready")):(r8("Failed to initialize cast API."),s8(!1),g.PG("yt-remote-cast-available"),g.PG("yt-remote-cast-receiver"),KCa());b(a)})},p8=function(a){R7("cloudview",a)},r8=function(a){R7("cloudview",a)},s8=function(a){p8("setCastInstalled_ "+a);
g.NG("yt-remote-cast-installed",a)},w8=function(){return!!g.y("yt.mdx.remote.cloudview.apiReady_")},NCa=function(a){p8("setApiReady_ "+a);
g.va("yt.mdx.remote.cloudview.apiReady_",a,void 0)},q8=function(a){g.va("yt.mdx.remote.cloudview.initializing_",a,void 0)},z8=function(a){this.index=-1;
this.videoId=this.listId="";this.volume=this.g=-1;this.muted=!1;this.audioTrackId=null;this.D=this.F=0;this.l=null;this.hasNext=this.Sf=!1;this.I=this.H=this.o=this.B=0;this.A=window.NaN;this.C=!1;this.reset(a)},A8=function(a){a.audioTrackId=null;
a.l=null;a.g=-1;a.Sf=!1;a.hasNext=!1;a.F=0;a.D=(0,g.G)();a.B=0;a.o=0;a.H=0;a.I=0;a.A=window.NaN;a.C=!1},B8=function(a){return a.jb()?((0,g.G)()-a.D)/1E3:0},C8=function(a,b){a.F=b;
a.D=(0,g.G)()},D8=function(a){switch(a.g){case 1:case 1081:return((0,g.G)()-a.D)/1E3+a.F;
case -1E3:return 0}return a.F},E8=function(a,b,c){var d=a.videoId;
a.videoId=b;a.index=c;b!=d&&A8(a)},F8=function(a){var b={};
b.index=a.index;b.listId=a.listId;b.videoId=a.videoId;b.playerState=a.g;b.volume=a.volume;b.muted=a.muted;b.audioTrackId=a.audioTrackId;b.trackData=g.ac(a.l);b.hasPrevious=a.Sf;b.hasNext=a.hasNext;b.playerTime=a.F;b.playerTimeAt=a.D;b.seekableStart=a.B;b.seekableEnd=a.o;b.duration=a.H;b.loadedTime=a.I;b.liveIngestionTime=a.A;return b},H8=function(a,b){g.HF.call(this);
this.g=0;this.A=a;this.C=[];this.B=new g.mC;this.o=this.l=null;this.H=(0,g.A)(this.rQ,this);this.D=(0,g.A)(this.jm,this);this.F=(0,g.A)(this.qQ,this);this.I=(0,g.A)(this.DQ,this);var c=0;a?(c=a.getProxyState(),3!=c&&(a.subscribe("proxyStateChange",this.Wv,this),SCa(this))):c=3;0!=c&&(b?this.Wv(c):g.WD((0,g.A)(function(){this.Wv(c)},this),0));
var d=QCa();d&&G8(this,d);this.subscribe("yt-remote-cast2-session-change",this.I)},I8=function(a){return new z8(a.A.getPlayerContextData())},SCa=function(a){(0,g.C)("nowAutoplaying autoplayDismissed remotePlayerChange remoteQueueChange autoplayModeChange autoplayUpNext previousNextChange".split(" "),function(a){this.C.push(this.A.subscribe(a,g.Ea(this.OS,a),this))},a)},TCa=function(a){(0,g.C)(a.C,function(a){this.A.unsubscribeByKey(a)},a);
a.C.length=0},J8=function(a,b){50>a.B.Dc()&&g.oC(a.B,b)},L8=function(a,b,c){var d=I8(a);
C8(d,c);-1E3!=d.g&&(d.g=b);K8(a,d)},M8=function(a,b,c){a.A.sendMessage(b,c)},K8=function(a,b){TCa(a);
a.A.setPlayerContextData(F8(b));SCa(a)},G8=function(a,b){a.o&&(a.o.removeUpdateListener(a.H),a.o.removeMediaListener(a.D),a.jm(null));
a.o=b;a.o&&(R7("CP","Setting cast session: "+a.o.sessionId),a.o.addUpdateListener(a.H),a.o.addMediaListener(a.D),a.o.media.length&&a.jm(a.o.media[0]))},UCa=function(a){var b=a.l.media,c=a.l.customData;
if(b&&c){var d=I8(a);b.contentId!=d.videoId&&R7("CP","Cast changing video to: "+b.contentId);d.videoId=b.contentId;d.g=c.playerState;C8(d,a.l.getEstimatedTime());K8(a,d)}else R7("CP","No cast media video. Ignoring state update.")},N8=function(a,b,c){return(0,g.A)(function(a){this.hc("Failed to "+b+" with cast v2 channel. Error code: "+a.code);
a.code!=window.chrome.cast.ErrorCode.TIMEOUT&&(this.hc("Retrying "+b+" using MDx browser channel."),M8(this,b,c))},a)},O8=function(a,b,c){g.HF.call(this);
this.B=window.NaN;this.M=!1;this.I=this.H=this.J=this.K=window.NaN;this.R=[];this.A=this.D=this.o=this.Za=this.g=null;this.ra=a;this.R.push(g.qF(window,"beforeunload",(0,g.A)(this.wJ,this)));this.l=[];this.Za=new z8;this.Y=b.id;this.g=VCa(this,c);this.g.subscribe("handlerOpened",this.vQ,this);this.g.subscribe("handlerClosed",this.sQ,this);this.g.subscribe("handlerError",this.tQ,this);this.g.subscribe("handlerMessage",this.uQ,this);hCa(this.g,b.token);this.subscribe("remoteQueueChange",function(){var a=
this.Za.videoId;g.QG()&&g.NG("yt-remote-session-video-id",a)},this)},P8=function(a){R7("conn",a)},VCa=function(a,b){return new L7(O7(a.ra,"/bc"),b)},Q8=function(a,b){a.T("proxyStateChange",b)},WCa=function(a){a.B=g.WD((0,g.A)(function(){P8("Connecting timeout");
this.C(1)},a),2E4)},R8=function(a){g.YD(a.B);
a.B=window.NaN},S8=function(a){g.YD(a.K);
a.K=window.NaN},XCa=function(a){T8(a);
a.J=g.WD((0,g.A)(function(){U8(this,"getNowPlaying")},a),2E4)},T8=function(a){g.YD(a.J);
a.J=window.NaN},ZCa=function(a,b){b&&(R8(a),S8(a));
b==(M7(a.g)&&(0,window.isNaN)(a.B))?b&&(Q8(a,1),U8(a,"getSubtitlesTrack")):b?(a.X()&&a.Za.reset(),Q8(a,1),U8(a,"getNowPlaying"),YCa(a)):a.C(1)},$Ca=function(a,b){var c=b.params.videoId;
delete b.params.videoId;c==a.Za.videoId&&(g.Vb(b.params)?a.Za.l=null:a.Za.l=b.params,a.T("remotePlayerChange"))},aDa=function(a,b){var c=b.params.videoId||b.params.video_id,d=(0,window.parseInt)(b.params.currentIndex,10);
a.Za.listId=b.params.listId||a.Za.listId;E8(a.Za,c,d);a.T("remoteQueueChange")},cDa=function(a,b){b.params=b.params||{};
aDa(a,b);bDa(a,b);a.T("autoplayDismissed")},bDa=function(a,b){var c=(0,window.parseInt)(b.params.currentTime||b.params.current_time,10);
C8(a.Za,(0,window.isNaN)(c)?0:c);c=(0,window.parseInt)(b.params.state,10);c=(0,window.isNaN)(c)?-1:c;-1==c&&-1E3==a.Za.g&&(c=-1E3);a.Za.g=c;c=Number(b.params.loadedTime);a.Za.I=(0,window.isNaN)(c)?0:c;c=Number(b.params.duration);a.Za.H=(0,window.isNaN)(c)?0:c;c=a.Za;var d=Number(b.params.liveIngestionTime);c.A=d;c.C=(0,window.isNaN)(d)?!1:!0;c=a.Za;d=Number(b.params.seekableStartTime);var e=Number(b.params.seekableEndTime);c.B=(0,window.isNaN)(d)?0:d;c.o=(0,window.isNaN)(e)?0:e;1==a.Za.g?XCa(a):T8(a);
a.T("remotePlayerChange")},dDa=function(a,b){if(-1E3!=a.Za.g){var c=1085;
switch((0,window.parseInt)(b.params.adState,10)){case 1:c=1081;break;case 2:c=1084;break;case 0:c=1083}a.Za.g=c;c=(0,window.parseInt)(b.params.currentTime,10);C8(a.Za,(0,window.isNaN)(c)?0:c);a.T("remotePlayerChange")}},eDa=function(a,b){var c="true"==b.params.muted;
a.Za.volume=(0,window.parseInt)(b.params.volume,10);a.Za.muted=c;a.T("remotePlayerChange")},fDa=function(a,b){a.D=b.params.videoId;
a.T("nowAutoplaying",(0,window.parseInt)(b.params.timeout,10))},gDa=function(a,b){var c="true"==b.params.hasNext;
a.Za.Sf="true"==b.params.hasPrevious;a.Za.hasNext=c;a.T("previousNextChange")},YCa=function(a){g.YD(a.I);
a.I=g.WD((0,g.A)(a.C,a,1),864E5)},U8=function(a,b,c){c?P8("Sending: action="+b+", params="+g.xg(c)):P8("Sending: action="+b);
a.g.sendMessage(b,c)},V8=function(a){V7.call(this,"ScreenServiceProxy");
this.fd=a;this.l=[];this.l.push(this.fd.$_s("screenChange",(0,g.A)(this.nW,this)));this.l.push(this.fd.$_s("onlineScreenChange",(0,g.A)(this.qS,this)))},lDa=function(a){var b={device:"Desktop",
app:"youtube-desktop"};b=g.QD("MDX_CONFIG")||b;mBa();c7();W8||(W8=new N7(b?b.loungeApiHost:void 0),uBa()&&(W8.g="/api/loungedev"));X8||(X8=g.y("yt.mdx.remote.deferredProxies_")||[],g.va("yt.mdx.remote.deferredProxies_",X8,void 0));hDa();var c=Y8();if(!c){var d=new d8(W8);g.va("yt.mdx.remote.screenService_",d,void 0);c=Y8();var e=!1,f=void 0,k=void 0,l=!1;b&&(e=!!b.loadCastApiSetupScript,f=b.appId,k=b.theme,l=!!b.disableDial);MCa(a,d,function(a){a?Z8()&&y8(Z8(),"YouTube TV"):d.subscribe("onlineScreenChange",
function(){g.XF("yt-remote-receiver-availability-change")})},e,f,k,l)}b&&!g.y("yt.mdx.remote.initialized_")&&(g.va("yt.mdx.remote.initialized_",!0,void 0),$8("Initializing: "+g.xg(b)),a9.push(g.TF("yt-remote-cast2-availability-change",function(){g.XF("yt-remote-receiver-availability-change")})),a9.push(g.TF("yt-remote-cast2-receiver-selected",function(){b9(null);
g.XF("yt-remote-auto-connect","cast-selector-receiver")})),a9.push(g.TF("yt-remote-cast2-receiver-resumed",function(){g.XF("yt-remote-receiver-resumed","cast-selector-receiver")})),a9.push(g.TF("yt-remote-cast2-session-change",iDa)),a9.push(g.TF("yt-remote-connection-change",function(a){a?y8(Z8(),"YouTube TV"):c9()||(y8(null,null),PCa())})),a=d9(),b.isAuto&&(a.id+="#dial"),g.NF("desktop_enable_autoplay")&&(a.capabilities=["atp"]),a.name=b.device,a.app=b.app,(k=b.theme)&&(a.theme=k),$8(" -- with channel params: "+
g.xg(a)),jDa(a),c.start(),Z8()||kDa())},nDa=function(){var a=mDa();
v8()&&g.OG("yt-remote-cast-available")&&a.push({key:"cast-selector-receiver",name:"Cast..."});return a},mDa=function(){var a=Y8().fd.$_gos();
var b=e9();b&&f9()&&(Y6(a,b)||a.push(b));return lBa(a)},g9=function(){var a=oDa();
!a&&v8()&&OCa()&&(a={key:"cast-selector-receiver",name:OCa()});return a},oDa=function(){var a=mDa(),b=e9();
b||(b=c9());return g.Ka(a,function(a){return b&&U6(b,a.key)?!0:!1})},e9=function(){var a=Z8();
if(!a)return null;var b=Y8().ke();return Z6(b,a)},iDa=function(a){$8("remote.onCastSessionChange_: "+V6(a));
if(a){var b=e9();b&&b.id==a.id?y8(b.id,"YouTube TV"):(b&&h9(),i9(a,1))}else f9()&&h9()},h9=function(){w8()?t8().stopSession():r8("stopSession called before API ready.");
var a=f9();a&&(a.disconnect(1),j9(null))},k9=function(){var a=f9();
return!!a&&3!=a.getProxyState()},$8=function(a){R7("remote",a)},Y8=function(){if(!l9){var a=g.y("yt.mdx.remote.screenService_");
l9=a?new V8(a):null}return l9},Z8=function(){return g.y("yt.mdx.remote.currentScreenId_")},pDa=function(a){g.va("yt.mdx.remote.currentScreenId_",a,void 0)},qDa=function(){return g.y("yt.mdx.remote.connectData_")},b9=function(a){g.va("yt.mdx.remote.connectData_",a,void 0)},f9=function(){return g.y("yt.mdx.remote.connection_")},j9=function(a){var b=f9();
b9(null);a||pDa("");g.va("yt.mdx.remote.connection_",a,void 0);X8&&((0,g.C)(X8,function(b){b(a)}),X8.length=0);
b&&!a?g.XF("yt-remote-connection-change",!1):!b&&a&&g.XF("yt-remote-connection-change",!0)},c9=function(){var a=g.QG();
if(!a)return null;var b=Y8().ke();return Z6(b,a)},i9=function(a,b){e9()&&e9();
pDa(a.id);var c=new O8(W8,a,d9());c.connect(b,qDa());c.subscribe("beforeDisconnect",function(a){g.XF("yt-remote-before-disconnect",a)});
c.subscribe("beforeDispose",function(){f9()&&j9(null)});
j9(c)},kDa=function(){var a=c9();
a?($8("Resume connection to: "+V6(a)),i9(a,0)):(d7(),PCa(),$8("Skipping connecting because no session screen found."))},hDa=function(){var a=d9();
if(g.Vb(a)){a=b7();var b=g.OG("yt-remote-session-name")||"",c=g.OG("yt-remote-session-app")||"";a={device:"REMOTE_CONTROL",id:a,name:b,app:c,mdxVersion:3};g.va("yt.mdx.remote.channelParams_",a,void 0)}},d9=function(){return g.y("yt.mdx.remote.channelParams_")||{}},jDa=function(a){a?(g.NG("yt-remote-session-app",a.app),g.NG("yt-remote-session-name",a.name)):(g.PG("yt-remote-session-app"),g.PG("yt-remote-session-name"));
g.va("yt.mdx.remote.channelParams_",a,void 0)},m9=function(a,b,c){g.M.call(this);
this.F=a;this.l=b;this.o=new g.EF(this);g.N(this,this.o);this.o.O(b,"onCaptionsTrackListChanged",this.KR);this.o.O(b,"captionschanged",this.pQ);this.o.O(b,"captionssettingschanged",this.pE);this.o.O(b,"videoplayerreset",this.rp);this.o.O(b,"mdxautoplaycancel",this.BI);this.R=this.o.O(b,"onVolumeChange",this.xC);this.D=!1;this.g=c;c.subscribe("proxyStateChange",this.KC,this);c.subscribe("remotePlayerChange",this.pm,this);c.subscribe("remoteQueueChange",this.rp,this);c.subscribe("autoplayUpNext",this.iC,
this);c.subscribe("previousNextChange",this.HC,this);c.subscribe("nowAutoplaying",this.zC,this);c.subscribe("autoplayDismissed",this.hC,this);this.suggestion=null;this.H=new g.DP(64);this.A=new g.Xt(this.lE,500,this);g.N(this,this.A);this.B=new g.Xt(this.mE,1E3,this);g.N(this,this.B);this.J=new l7(this.RV,0,this);g.N(this,this.J);this.C={};this.K=new g.Xt(this.ME,1E3,this);g.N(this,this.K);this.I=new g.Vk(this.pO,1E3,this);g.N(this,this.I);this.M=g.z;this.pE();this.rp();this.pm()},n9=function(a,b){var c=
a.F,d=a.l.getVideoData().lengthSeconds;
c.H=b||0;c.g.T("progresssync",b,d)},rDa=function(a){n9(a,0);
a.A.stop();o9(a,new g.DP(64))},q9=function(a,b){if(p9(a)&&!a.D){var c=null;
b&&(c={style:a.l.Hi()},g.cc(c,b));a.g.ZD(a.l.getVideoData(1).videoId,c);a.C=I8(a.g).l}},r9=function(a,b){var c=a.l.cg();
if(c){var d=c.ie();var e=c.listId.toString()}var f=a.l.getVideoData(1);c=a.g;var k=f.videoId,l=d;d=f.playerParams;var m=f.Tj;f=bBa(f);var n=I8(c);l=l||0;var q={videoId:k,currentIndex:l};E8(n,k,l);g.u(b)&&(C8(n,b),q.currentTime=b);g.u(e)&&(q.listId=e);null!=d&&(q.playerParams=d);null!=m&&(q.clickTrackingParams=m);null!=f&&(q.locationInfo=g.xg(f));M8(c,"setPlaylist",q);e||K8(c,n);o9(a,new g.DP(1))},sDa=function(a,b){if(b){var c=a.l.yc("captions","tracklist",{Pz:1});
c&&c.length?(a.l.Md("captions","track",b),a.D=!1):(a.l.hk("captions"),a.D=!0)}else a.l.Md("captions","track",{})},p9=function(a){return I8(a.g).videoId==a.l.getVideoData(1).videoId},o9=function(a,b){a.B.stop();
var c=a.H;if(!g.IP(c,b)){var d=g.X(b,2);d!=g.X(a.H,2)&&g.fV(a.l,d);a.H=b;tDa(a.F,c,b)}},s9=function(a){g.W.call(this,{G:"div",
L:"ytp-remote",N:[{G:"div",L:"ytp-remote-display-status",N:[{G:"div",L:"ytp-remote-display-status-icon",N:[g.Woa()]},{G:"div",L:"ytp-remote-display-status-text",aa:"{{statustext}}"}]}]});this.o=new g.VV(this,250);g.N(this,this.o);this.A=a;this.O(a,"presentingplayerstatechange",this.B);uDa(this,g.cV(a))},uDa=function(a,b){if(3==a.A.Ra()){var c={RECEIVER_NAME:a.A.yc("remote","currentReceiver").name};
c=g.X(b,128)?g.S0("Error on $RECEIVER_NAME",c):b.jb()||g.X(b,4)?g.S0("Playing on $RECEIVER_NAME",c):g.S0("Connected to $RECEIVER_NAME",c);a.updateValue("statustext",c);a.o.show()}else a.o.hide()},t9=function(a,b){g.b_.call(this,"Play on",0,a,b);
this.o=a;this.H={};this.O(a,"onMdxReceiversChange",this.J);this.O(a,"presentingplayerstatechange",this.J);this.J()},u9=function(a){g.AV.call(this,a);
this.o={key:X6(),name:"This computer"};this.B=null;this.C=[];this.I=this.l=null;this.F=[this.o];this.A=this.o;this.D=new g.DP(64);this.H=0;if(!g.XM(g.Y(this.g))){a=this.g;var b=g.EH(a);b&&(b=b.No())&&(b=new t9(a,b),g.N(this,b));b=new s9(a);g.N(this,b);g.uV(a,b.element,4)}},tDa=function(a,b,c){a.D=c;
a.g.T("presentingplayerstatechange",new g.NP(c,b))},v9=function(a,b){if(b.key!=a.A.key)if(b.key==a.o.key)h9();
else{a.A=b;var c=a.g.getPlaylistId();var d=a.g.getVideoData(1);var e=d.videoId;if(c||e){var f=a.g.cg();if(f){var k=[];for(var l=0;l<f.getLength();l++)k[l]=f.Zb(l).videoId}else k=[e];f=a.g.getCurrentTime(1);c={videoIds:k,listId:c,videoId:e,playerParams:d.playerParams,clickTrackingParams:d.Tj,index:Math.max(a.g.PA(),0),currentTime:0==f?void 0:f};(d=bBa(d))&&(c.locationInfo=d);d=c}else d=null;$8("Connecting to: "+g.xg(b));"cast-selector-receiver"==b.key?(b9(d||null),w8()?t8().setLaunchParams(d||null):
r8("setLaunchParams called before ready.")):!d&&k9()&&Z8()==b.key?g.XF("yt-remote-connection-change",!0):(h9(),b9(d||null),d=Y8().ke(),(d=Z6(d,b.key))&&i9(d,1))}},JBa={"\x00":"\\0",
"\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r","\t":"\\t","\x0B":"\\x0B",'"':'\\"',"\\":"\\\\","<":"<"},v7={"'":"\\'"},vDa={},hBa={EX:"atp",d2:"ska",t1:"que",D0:"mus",Z1:"sus",MZ:"dsp"};
S6.prototype.Gn=function(){var a=new S6({id:this.id,name:this.name,app:this.app,type:this.type,user:this.username,userAvatarUri:this.avatar,obfuscatedGaiaId:this.obfuscatedGaiaId,theme:this.theme,capabilities:Array.from(this.capabilities.values()).join(","),experiments:Array.from(this.experiments.values()).join(",")});a.o=this.o;a.l=this.l;a.g=this.g};
var e7,a7="",i7=f7("loadGamesSDK")?"/cast_game_sender.js":"/cast_sender.js",BBa=f7("loadCastFramework")||f7("loadCastApplicationFramework"),LCa=["pkedcjkdefgpdelpbcmbmeomcjbeemfm","enhhojjnijigcajfphajepfemndkmdlo"];g.B(l7,g.M);g.h=l7.prototype;g.h.rJ=function(a){this.A=arguments;this.g=!1;this.Ba?this.o=(0,g.G)()+this.rd:this.Ba=g.rg(this.B,this.rd)};
g.h.stop=function(){this.Ba&&(g.sg(this.Ba),this.Ba=null);this.o=null;this.g=!1;this.A=[]};
g.h.pause=function(){++this.l};
g.h.resume=function(){this.l&&(--this.l,!this.l&&this.g&&(this.g=!1,this.C.apply(null,this.A)))};
g.h.V=function(){this.stop();l7.ca.V.call(this)};
g.h.sJ=function(){this.o?(this.Ba=g.rg(this.B,this.o-(0,g.G)()),this.o=null):(this.Ba=null,this.l?this.g=!0:(this.g=!1,this.C.apply(null,this.A)))};m7.prototype.stringify=function(a){return g.x.JSON.stringify(a,void 0)};
m7.prototype.parse=function(a){return g.x.JSON.parse(a,void 0)};g.h=n7.prototype;g.h.mi=null;g.h.Df=!1;g.h.Ok=null;g.h.Pv=null;g.h.xk=null;g.h.Kj=null;g.h.jh=null;g.h.Hh=null;g.h.Oi=null;g.h.Sc=null;g.h.Km=0;g.h.Ef=null;g.h.oq=null;g.h.kh=null;g.h.zl=-1;g.h.GD=!0;g.h.Wh=!1;g.h.hs=0;g.h.Dp=null;var HBa={},q7={};g.h=n7.prototype;g.h.setTimeout=function(a){this.A=a};
g.h.KU=function(a){a=a.target;var b=this.Dp;b&&3==g.hx(a)?b.Ij():this.UE(a)};
g.h.UE=function(a){try{if(a==this.Sc)a:{var b=g.hx(this.Sc),c=this.Sc.l,d=this.Sc.getStatus();if(g.wd&&!g.pc(10)||g.yd&&!g.oc("420+")){if(4>b)break a}else if(3>b||3==b&&!g.cf&&!g.lx(this.Sc))break a;this.Wh||4!=b||7==c||(8==c||0>=d?this.g.xf(3):this.g.xf(2));x7(this);var e=this.Sc.getStatus();this.zl=e;var f=g.lx(this.Sc);(this.Df=200==e)?(4==b&&t7(this),this.B?(IBa(this,b,f),g.cf&&this.Df&&3==b&&(this.W.U(this.l,"tick",this.GU),this.l.start())):s7(this,f),this.Df&&!this.Wh&&(4==b?this.g.pp(this):
(this.Df=!1,p7(this)))):(400==e&&0<f.indexOf("Unknown SID")?(this.kh=3,r7(13)):(this.kh=0,r7(14)),t7(this),u7(this))}}catch(k){this.Sc&&g.lx(this.Sc)}finally{}};
g.h.GU=function(){var a=g.hx(this.Sc),b=g.lx(this.Sc);this.Km<b.length&&(x7(this),IBa(this,a,b),this.Df&&4!=a&&p7(this))};
g.h.RT=function(a){w7((0,g.A)(this.QT,this,a),0)};
g.h.QT=function(a){this.Wh||(x7(this),s7(this,a),p7(this))};
g.h.SC=function(a){w7((0,g.A)(this.PT,this,a),0)};
g.h.PT=function(a){this.Wh||(t7(this),this.Df=a,this.g.pp(this),this.g.xf(4))};
g.h.cancel=function(){this.Wh=!0;t7(this)};
g.h.jU=function(){this.Ok=null;var a=(0,g.G)();0<=a-this.Pv?(2!=this.Kj&&this.g.xf(3),t7(this),this.kh=2,r7(18),u7(this)):LBa(this,this.Pv-a)};g.h=OBa.prototype;g.h.es=null;g.h.se=null;g.h.Ep=!1;g.h.fz=null;g.h.Tn=null;g.h.lt=null;g.h.gs=null;g.h.Ne=null;g.h.Cg=-1;g.h.yl=null;g.h.Vk=null;g.h.connect=function(a){this.gs=a;a=z7(this.g,null,this.gs);r7(3);this.fz=(0,g.G)();var b=this.g.F;null!=b?(this.yl=b[0],(this.Vk=b[1])?(this.Ne=1,PBa(this)):(this.Ne=2,B7(this))):(R6(a,"MODE","init"),this.se=new n7(this,void 0,void 0,void 0),this.se.mi=this.es,o7(this.se,a,!1,null,!0),this.Ne=0)};
g.h.CI=function(a){if(a)this.Ne=2,B7(this);else{r7(4);var b=this.g;b.Pf=b.ah.Cg;I7(b,9)}a&&this.xf(2)};
g.h.zr=function(a){return this.g.zr(a)};
g.h.abort=function(){this.se&&(this.se.cancel(),this.se=null);this.Cg=-1};
g.h.ez=function(){return!1};
g.h.LC=function(a,b){this.Cg=a.zl;if(0==this.Ne)if(b){try{var c=this.l.parse(b)}catch(d){c=this.g;c.Pf=this.Cg;I7(c,2);return}this.yl=c[0];this.Vk=c[1]}else c=this.g,c.Pf=this.Cg,I7(c,2);else if(2==this.Ne)if(this.Ep)r7(7),this.lt=(0,g.G)();else if("11111"==b){if(r7(6),this.Ep=!0,this.Tn=(0,g.G)(),c=this.Tn-this.fz,!g.wd||g.pc(10)||500>c)this.Cg=200,this.se.cancel(),r7(12),A7(this.g,this,!0)}else r7(8),this.Tn=this.lt=(0,g.G)(),this.Ep=!1};
g.h.pp=function(){this.Cg=this.se.zl;if(this.se.Df)0==this.Ne?this.Vk?(this.Ne=1,PBa(this)):(this.Ne=2,B7(this)):2==this.Ne&&((!g.wd||g.pc(10)?!this.Ep:200>this.lt-this.Tn)?(r7(11),A7(this.g,this,!1)):(r7(12),A7(this.g,this,!0)));else{0==this.Ne?r7(9):2==this.Ne&&r7(10);var a=this.g;a.Pf=this.Cg;I7(a,2)}};
g.h.Bm=function(){return this.g.Bm()};
g.h.isActive=function(){return this.g.isActive()};
g.h.xf=function(a){this.g.xf(a)};g.h=C7.prototype;g.h.kl=null;g.h.Xd=null;g.h.xc=null;g.h.ds=null;g.h.Xn=null;g.h.wx=null;g.h.mo=null;g.h.gm=0;g.h.HP=0;g.h.qd=null;g.h.eh=null;g.h.rg=null;g.h.bi=null;g.h.ah=null;g.h.nq=null;g.h.Yj=-1;g.h.dA=-1;g.h.Pf=-1;g.h.vj=0;g.h.hj=0;g.h.Yh=8;var J7=new g.Cf;g.B(RBa,g.af);g.B(SBa,g.af);g.B(TBa,g.af);g.h=C7.prototype;g.h.connect=function(a,b,c,d,e){r7(0);this.ds=b;this.kl=c||{};d&&g.u(e)&&(this.kl.OSID=d,this.kl.OAID=e);this.C?(w7((0,g.A)(this.Rx,this,a),100),XBa(this)):this.Rx(a)};
g.h.Rx=function(a){this.ah=new OBa(this);this.ah.es=null;this.ah.l=this.B;this.ah.connect(a)};
g.h.ez=function(){return 0==this.g};
g.h.QC=function(a){this.eh=null;$Ba(this,a)};
g.h.PC=function(){this.rg=null;this.xc=new n7(this,this.o,"rpc",this.D);this.xc.mi=null;this.xc.hs=0;var a=this.wx.clone();g.Dm(a,"RID","rpc");g.Dm(a,"SID",this.o);g.Dm(a,"CI",this.nq?"0":"1");g.Dm(a,"AID",this.Yj);D7(this,a);if(!g.wd||g.pc(10))g.Dm(a,"TYPE","xmlhttp"),o7(this.xc,a,!0,this.mo,!1);else{g.Dm(a,"TYPE","html");var b=this.xc,c=!!this.mo;b.Kj=3;b.jh=Q6(a.clone());KBa(b,c)}};
g.h.LC=function(a,b){if(0!=this.g&&(this.xc==a||this.Xd==a))if(this.Pf=a.zl,this.Xd==a&&3==this.g)if(7<this.Yh){try{var c=this.B.parse(b)}catch(f){c=null}if(g.ya(c)&&3==c.length)if(0==c[0])a:{if(!this.rg){if(this.xc)if(this.xc.xk+3E3<this.Xd.xk)F7(this),this.xc.cancel(),this.xc=null;else break a;H7(this);r7(19)}}else this.dA=c[1],0<this.dA-this.Yj&&37500>c[2]&&this.nq&&0==this.hj&&!this.bi&&(this.bi=w7((0,g.A)(this.kQ,this),6E3));else I7(this,11)}else b!=vDa.HY.g&&I7(this,11);else if(this.xc==a&&
F7(this),!g.D(b)){c=this.B.parse(b);g.ya(c);for(var d=0;d<c.length;d++){var e=c[d];this.Yj=e[0];e=e[1];2==this.g?"c"==e[0]?(this.o=e[1],this.mo=e[2],e=e[3],null!=e?this.Yh=e:this.Yh=6,this.g=3,this.qd&&this.qd.Ix(),this.wx=z7(this,this.Bm()?this.mo:null,this.ds),aCa(this)):"stop"==e[0]&&I7(this,7):3==this.g&&("stop"==e[0]?I7(this,7):"noop"!=e[0]&&this.qd&&this.qd.Hx(e),this.hj=0)}}};
g.h.kQ=function(){null!=this.bi&&(this.bi=null,this.xc.cancel(),this.xc=null,H7(this),r7(20))};
g.h.pp=function(a){if(this.xc==a){F7(this);this.xc=null;var b=2}else if(this.Xd==a)this.Xd=null,b=1;else return;this.Pf=a.zl;if(0!=this.g)if(a.Df)1==b?(b=(0,g.G)()-a.xk,J7.dispatchEvent(new SBa(J7,a.Oi?a.Oi.length:0,b,this.vj)),E7(this),this.A.length=0):aCa(this);else{var c=a.kh,d;if(!(d=3==c||7==c||0==c&&0<this.Pf)){if(d=1==b)this.Xd||this.eh||1==this.g||2<=this.vj?d=!1:(this.eh=w7((0,g.A)(this.QC,this,a),bCa(this,this.vj)),this.vj++,d=!0);d=!(d||2==b&&H7(this))}if(d)switch(c){case 1:I7(this,5);
break;case 4:I7(this,10);break;case 3:I7(this,6);break;case 7:I7(this,12);break;default:I7(this,2)}}};
g.h.aJ=function(a){if(!g.Oa(arguments,this.g))throw Error("Unexpected channel state: "+this.g);};
g.h.CV=function(a){a?r7(2):(r7(1),cCa(this,8))};
g.h.zr=function(a){if(a)throw Error("Can't create secondary domain capable XhrIo object.");a=new g.bx;a.F=!1;return a};
g.h.isActive=function(){return!!this.qd&&this.qd.isActive(this)};
g.h.xf=function(a){J7.dispatchEvent(new TBa(J7,a))};
g.h.Bm=function(){return!(!g.wd||g.pc(10))};
g.h=dCa.prototype;g.h.Ix=function(){};
g.h.Hx=function(){};
g.h.Gx=function(){};
g.h.lr=function(){};
g.h.Ly=function(){return{}};
g.h.isActive=function(){return!0};g.B(K7,g.M);g.h=K7.prototype;g.h.HT=function(){this.rd=Math.min(3E5,2*this.rd);this.o();this.l&&this.start()};
g.h.start=function(){var a=this.rd+15E3*Math.random();g.Yt(this.g,a);this.l=(0,g.G)()+a};
g.h.stop=function(){this.g.stop();this.l=0};
g.h.isActive=function(){return this.g.isActive()};
g.h.reset=function(){this.g.stop();this.rd=5E3};g.B(L7,dCa);g.h=L7.prototype;g.h.subscribe=function(a,b,c){return this.o.subscribe(a,b,c)};
g.h.unsubscribe=function(a,b,c){return this.o.unsubscribe(a,b,c)};
g.h.Qd=function(a){return this.o.Qd(a)};
g.h.T=function(a,b){return this.o.T.apply(this.o,arguments)};
g.h.dispose=function(){this.I||(this.I=!0,g.Ze(this.o),gCa(this),g.Ze(this.l),this.l=null)};
g.h.ka=function(){return this.I};
g.h.connect=function(a,b,c){if(!this.g||2!=this.g.g){this.H="";this.l.stop();this.B=a||null;this.A=b||0;a=this.J+"/test";b=this.J+"/bind";var d=new C7(c?c.firstTestResults:null,c?c.secondTestResults:null,this.K),e=this.g;e&&(e.qd=null);d.qd=this;this.g=d;e?this.g.connect(a,b,this.C,e.o,e.Yj):c?this.g.connect(a,b,this.C,c.sessionId,c.arrayId):this.g.connect(a,b,this.C)}};
g.h.sendMessage=function(a,b){var c={_sc:a};b&&g.cc(c,b);this.l.isActive()||2==(this.g?this.g.g:0)?this.D.push(c):M7(this)&&YBa(this.g,c)};
g.h.Ix=function(){this.l.reset();this.B=null;this.A=0;if(this.D.length){var a=this.D;this.D=[];for(var b=0,c=a.length;b<c;++b)YBa(this.g,a[b])}this.T("handlerOpened")};
g.h.Gx=function(a){var b=2==a&&401==this.g.Pf;4==a||b||this.l.start();this.T("handlerError",a)};
g.h.lr=function(a){if(!this.l.isActive())this.T("handlerClosed");else if(a)for(var b=0,c=a.length;b<c;++b){var d=a[b].map;d&&this.D.push(d)}};
g.h.Ly=function(){var a={v:2};this.H&&(a.gsessionid=this.H);0!=this.A&&(a.ui=""+this.A);0!=this.F&&(a.ui=""+this.F);this.B&&g.cc(a,this.B);return a};
g.h.Hx=function(a){"S"==a[0]?this.H=a[1]:"gracefulReconnect"==a[0]?(this.l.start(),WBa(this.g)):this.T("handlerMessage",new eCa(a[0],a[1]))};
g.h.jW=function(){this.l.isActive();var a=this.g,b=0;a.xc&&b++;a.Xd&&b++;0!=b||this.connect(this.B,this.A)};N7.prototype.A=function(a,b,c,d){b?a(d):a({text:c.responseText})};
N7.prototype.o=function(a,b){a(Error("Request error: "+b.status))};
N7.prototype.B=function(a){a(Error("request timed out"))};var oCa=(0,g.G)(),Q7=null,T7=Array(50),S7=-1,U7=!1;g.B(V7,g.HF);V7.prototype.ke=function(){return this.g};
V7.prototype.contains=function(a){return!!Y6(this.g,a)};
V7.prototype.get=function(a){return a?Z6(this.g,a):null};
V7.prototype.info=function(a){R7(this.D,a)};g.B(W7,g.HF);var wDa=[2E3,2E3,1E3,1E3,1E3,2E3,2E3,5E3,5E3,1E4];g.h=W7.prototype;g.h.start=function(){!this.g&&(0,window.isNaN)(this.Ba)&&this.ZE()};
g.h.stop=function(){this.g&&(this.g.abort(),this.g=null);(0,window.isNaN)(this.Ba)||(g.YD(this.Ba),this.Ba=window.NaN)};
g.h.V=function(){this.stop();W7.ca.V.call(this)};
g.h.ZE=function(){this.Ba=window.NaN;this.g=g.mE(O7(this.C,"/pairing/get_screen"),{method:"POST",Nb:{pairing_code:this.B},timeout:5E3,onSuccess:(0,g.A)(this.lW,this),onError:(0,g.A)(this.kW,this),yd:(0,g.A)(this.mW,this)})};
g.h.lW=function(a,b){this.g=null;var c=b.screen||{};c.dialId=this.o;c.name=this.A;this.T("pairingComplete",new T6(c))};
g.h.kW=function(a){this.g=null;a.status&&404==a.status?this.l>=wDa.length?this.T("pairingFailed",Error("DIAL polling timed out")):(a=wDa[this.l],this.Ba=g.WD((0,g.A)(this.ZE,this),a),this.l++):this.T("pairingFailed",Error("Server error "+a.status))};
g.h.mW=function(){this.g=null;this.T("pairingFailed",Error("Server not responding"))};g.B(Y7,V7);g.h=Y7.prototype;g.h.start=function(){X7(this)&&this.T("screenChange");!g.OG("yt-remote-lounge-token-expiration")&&sCa(this);g.YD(this.l);this.l=g.WD((0,g.A)(this.start,this),1E4)};
g.h.add=function(a,b){X7(this);pCa(this,a);Z7(this,!1);this.T("screenChange");b(a);a.token||sCa(this)};
g.h.remove=function(a,b){var c=X7(this);rCa(this,a)&&(Z7(this,!1),c=!0);b(a);c&&this.T("screenChange")};
g.h.iq=function(a,b,c,d){var e=X7(this),f=this.get(a.id);f?(f.name!=b&&(f.name=b,Z7(this,!1),e=!0),c(a)):d(Error("no such local screen."));e&&this.T("screenChange")};
g.h.V=function(){g.YD(this.l);Y7.ca.V.call(this)};
g.h.FJ=function(a){X7(this);var b=this.g.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)}Z7(this,!b);b&&R7(this.D,"Missed "+b+" lounge tokens.")};
g.h.EJ=function(a){R7(this.D,"Requesting lounge tokens failed: "+a)};g.B(a8,g.HF);g.h=a8.prototype;g.h.start=function(){var a=(0,window.parseInt)(g.OG("yt-remote-fast-check-period")||"0",10);(this.A=(0,g.G)()-144E5<a?0:a)?c8(this):(this.A=(0,g.G)()+3E5,g.NG("yt-remote-fast-check-period",this.A),this.bv())};
g.h.isEmpty=function(){return g.Vb(this.g)};
g.h.update=function(){$7("Updating availability on schedule.");var a=this.C(),b=g.Jb(this.g,function(b,d){return b&&!!Z6(a,d)},this);
b8(this,b)};
g.h.V=function(){g.YD(this.o);this.o=window.NaN;this.l&&(this.l.abort(),this.l=null);a8.ca.V.call(this)};
g.h.bv=function(){g.YD(this.o);this.o=window.NaN;this.l&&this.l.abort();var a=vCa(this);if(g.Mb(a)){var b=O7(this.B,"/pairing/get_screen_availability");this.l=P7(this.B,b,{lounge_token:g.Pb(a).join(",")},(0,g.A)(this.oT,this,a),(0,g.A)(this.nT,this))}else b8(this,{}),c8(this)};
g.h.oT=function(a,b){this.l=null;var c=g.Pb(vCa(this));if(g.gb(c,g.Pb(a))){c=b.screens||[];for(var d={},e=0,f=c.length;e<f;++e)d[a[c[e].loungeToken]]="online"==c[e].status;b8(this,d);c8(this)}else this.hc("Changing Screen set during request."),this.bv()};
g.h.nT=function(a){this.hc("Screen availability failed: "+a);this.l=null;c8(this)};
g.h.hc=function(a){R7("OnlineScreenService",a)};g.B(d8,V7);g.h=d8.prototype;g.h.start=function(){this.o.start();this.l.start();this.g.length&&(this.T("screenChange"),this.l.isEmpty()||this.T("onlineScreenChange"))};
g.h.add=function(a,b,c){this.o.add(a,b,c)};
g.h.remove=function(a,b,c){this.o.remove(a,b,c);this.l.update()};
g.h.iq=function(a,b,c,d){this.o.contains(a)?this.o.iq(a,b,c,d):(a="Updating name of unknown screen: "+a.name,R7(this.D,a),d(Error(a)))};
g.h.ke=function(a){return a?this.g:g.Va(this.g,(0,g.Jd)(this.A,function(a){return!this.contains(a)},this))};
g.h.aF=function(){return(0,g.Jd)(this.ke(!0),function(a){return!!this.l.g[a.id]},this)};
g.h.bF=function(a,b,c,d,e){this.info("getDialScreenByPairingCode "+a+" / "+b);var f=new W7(this.C,a,b,c);f.subscribe("pairingComplete",(0,g.A)(function(a){g.Ze(f);d(e8(this,a))},this));
f.subscribe("pairingFailed",function(a){g.Ze(f);e(a)});
f.start();return(0,g.A)(f.stop,f)};
g.h.oW=function(a,b,c,d){g.mE(O7(this.C,"/pairing/get_screen"),{method:"POST",Nb:{pairing_code:a},timeout:5E3,onSuccess:(0,g.A)(function(a,d){var e=new T6(d.screen||{});if(!e.name||zCa(this,e.name)){a:{var f=e.name;for(var m=2,n=b(f,m);zCa(this,n);){m++;if(20<m)break a;n=b(f,m)}f=n}e.name=f}c(e8(this,e))},this),
onError:(0,g.A)(function(a){d(Error("pairing request failed: "+a.status))},this),
yd:(0,g.A)(function(){d(Error("pairing request timed out."))},this)})};
g.h.V=function(){g.Ze(this.o);g.Ze(this.l);d8.ca.V.call(this)};
g.h.UJ=function(){ACa(this);this.T("screenChange");this.l.update()};
d8.prototype.dispose=d8.prototype.dispose;g.B(g8,g.HF);g.h=g8.prototype;g.h.qp=function(a){this.o=a;this.T("sessionScreen",this.o)};
g.h.re=function(a){this.ka()||(a&&h8(this,""+a),this.o=null,this.T("sessionScreen",null))};
g.h.info=function(a){R7(this.K,a)};
g.h.dF=function(){return null};
g.h.hv=function(a){var b=this.l;a?(b.displayStatus=new window.chrome.cast.ReceiverDisplayStatus(a,[]),b.displayStatus.showStop=!0):b.displayStatus=null;window.chrome.cast.setReceiverDisplayStatus(b,(0,g.A)(function(){this.info("Updated receiver status for "+b.friendlyName+": "+a)},this),(0,g.A)(function(){h8(this,"Failed to update receiver status for: "+b.friendlyName)},this))};
g.h.V=function(){this.hv("");g8.ca.V.call(this)};g.B(i8,g8);g.h=i8.prototype;g.h.gv=function(a){if(this.g){if(this.g==a)return;h8(this,"Overriding cast sesison with new session object");this.g.removeUpdateListener(this.C);this.g.removeMessageListener("urn:x-cast:com.google.youtube.mdx",this.B)}this.g=a;this.g.addUpdateListener(this.C);this.g.addMessageListener("urn:x-cast:com.google.youtube.mdx",this.B);CCa(this)};
g.h.ak=function(a){this.info("launchWithParams no-op for Cast: "+g.xg(a))};
g.h.stop=function(){this.g?this.g.stop((0,g.A)(function(){this.re()},this),(0,g.A)(function(){this.re(Error("Failed to stop receiver app."))},this)):this.re(Error("Stopping cast device witout session."))};
g.h.hv=g.z;g.h.V=function(){this.info("disposeInternal");g.YD(this.A);this.A=0;this.g&&(this.g.removeUpdateListener(this.C),this.g.removeMessageListener("urn:x-cast:com.google.youtube.mdx",this.B));this.g=null;i8.ca.V.call(this)};
g.h.vU=function(a,b){if(!this.ka())if(b){var c=g.Ww(b);if(g.Ba(c)){var d=""+c.type;c=c.data||{};this.info("onYoutubeMessage_: "+d+" "+g.xg(c));switch(d){case "mdxSessionStatus":BCa(this,c.screenId);break;default:h8(this,"Unknown youtube message: "+d)}}else h8(this,"Unable to parse message.")}else h8(this,"No data in message.")};
g.h.Vy=function(a,b,c,d){yCa(this.H,this.l.label,a,this.l.friendlyName,(0,g.A)(function(e){e?b(e):0<=d?(h8(this,"Screen "+a+" appears to be offline. "+d+" retries left."),g.WD((0,g.A)(this.Vy,this,a,b,c,d-1),300)):c(Error("Unable to fetch screen."))},this),c)};
g.h.dF=function(){return this.g};
g.h.pW=function(a){this.ka()||a||(h8(this,"Cast session died."),this.re())};g.B(j8,g8);g.h=j8.prototype;g.h.gv=function(a){this.A=a;this.A.addUpdateListener(this.J)};
g.h.ak=function(a){this.B=a;this.D()};
g.h.stop=function(){this.g();this.g=g.z;g.YD(this.C);this.A?this.A.stop((0,g.A)(this.re,this,null),(0,g.A)(this.re,this,"Failed to stop DIAL device.")):this.re()};
g.h.V=function(){this.g();this.g=g.z;g.YD(this.C);this.A&&this.A.removeUpdateListener(this.J);this.A=null;j8.ca.V.call(this)};
g.h.sW=function(a){this.ka()||a||(h8(this,"DIAL session died."),this.g(),this.g=g.z,this.re())};
g.h.Rs=function(a){this.I=X6();if(this.B){var b=new window.chrome.cast.DialLaunchResponse(!0,ECa(this));a(b);DCa(this)}else this.D=(0,g.A)(function(){g.YD(this.C);this.D=g.z;this.C=window.NaN;var b=new window.chrome.cast.DialLaunchResponse(!0,ECa(this));a(b);DCa(this)},this),this.C=g.WD((0,g.A)(function(){this.D()},this),100)};
g.h.iL=function(a,b,c){yCa(this.H,this.F.receiver.label,a,this.l.friendlyName,(0,g.A)(function(a){a&&a.token?(this.qp(a),b(new window.chrome.cast.DialLaunchResponse(!1))):this.Rs(b,c)},this),(0,g.A)(function(a){h8(this,"Failed to get DIAL screen: "+a);
this.Rs(b,c)},this))};g.B(k8,g8);k8.prototype.stop=function(){this.re()};
k8.prototype.gv=g.z;k8.prototype.ak=function(){g.YD(this.g);this.g=window.NaN;var a=Z6(this.H.ke(),this.l.label);a?this.qp(a):this.re(Error("No such screen"))};
k8.prototype.V=function(){g.YD(this.g);this.g=window.NaN;k8.ca.V.call(this)};g.B(l8,g.HF);g.h=l8.prototype;
g.h.init=function(a,b){window.chrome.cast.timeout.requestSession=3E4;var c=new window.chrome.cast.SessionRequest(this.D);this.F||(c.dialRequest=new window.chrome.cast.DialRequest("YouTube"));var d=window.chrome.cast.AutoJoinPolicy.TAB_AND_ORIGIN_SCOPED,e=a?window.chrome.cast.DefaultActionPolicy.CAST_THIS_TAB:window.chrome.cast.DefaultActionPolicy.CREATE_SESSION;c=new window.chrome.cast.ApiConfig(c,(0,g.A)(this.MC,this),(0,g.A)(this.YS,this),d,e);c.customDialLaunchCallback=(0,g.A)(this.UQ,this);window.chrome.cast.initialize(c,
(0,g.A)(function(){this.ka()||(window.chrome.cast.addReceiverActionListener(this.A),lCa(),this.l.subscribe("onlineScreenChange",(0,g.A)(this.cF,this)),this.o=GCa(this),window.chrome.cast.setCustomReceivers(this.o,g.z,(0,g.A)(function(a){this.hc("Failed to set initial custom receivers: "+g.xg(a))},this)),this.T("yt-remote-cast2-availability-change",n8(this)),b(!0))},this),(0,g.A)(function(a){this.hc("Failed to initialize API: "+g.xg(a));
b(!1)},this))};
g.h.mV=function(a,b){m8("Setting connected screen ID: "+a+" -> "+b);if(this.g){var c=this.g.o;if(!a||c&&c.id!=a)m8("Unsetting old screen status: "+this.g.l.friendlyName),o8(this,null)}if(a&&b){if(!this.g){c=Z6(this.l.ke(),a);if(!c){m8("setConnectedScreenStatus: Unknown screen.");return}var d=FCa(this,c);d||(m8("setConnectedScreenStatus: Connected receiver not custom..."),d=new window.chrome.cast.Receiver(c.uuid?c.uuid:c.id,c.name),d.receiverType=window.chrome.cast.ReceiverType.CUSTOM,this.o.push(d),
window.chrome.cast.setCustomReceivers(this.o,g.z,(0,g.A)(function(a){this.hc("Failed to set initial custom receivers: "+g.xg(a))},this)));
m8("setConnectedScreenStatus: new active receiver: "+d.friendlyName);o8(this,new k8(this.l,d),!0)}this.g.hv(b)}else m8("setConnectedScreenStatus: no screen.")};
g.h.nV=function(a){this.ka()?this.hc("Setting connection data on disposed cast v2"):this.g?this.g.ak(a):this.hc("Setting connection data without a session")};
g.h.rW=function(){this.ka()?this.hc("Stopping session on disposed cast v2"):this.g?(this.g.stop(),o8(this,null)):m8("Stopping non-existing session")};
g.h.requestSession=function(){window.chrome.cast.requestSession((0,g.A)(this.MC,this),(0,g.A)(this.tT,this))};
g.h.V=function(){this.l.unsubscribe("onlineScreenChange",(0,g.A)(this.cF,this));window.chrome&&window.chrome.cast&&window.chrome.cast.removeReceiverActionListener(this.A);g.Ta(g.y("yt.mdx.remote.debug.handlers_")||[],iCa);g.Ze(this.g);l8.ca.V.call(this)};
g.h.hc=function(a){R7("Controller",a)};
g.h.NC=function(a,b){this.g==a&&(b||o8(this,null),this.T("yt-remote-cast2-session-change",b))};
g.h.US=function(a,b){if(!this.ka())if(a)switch(a.friendlyName=window.chrome.cast.unescape(a.friendlyName),m8("onReceiverAction_ "+a.label+" / "+a.friendlyName+"-- "+b),b){case window.chrome.cast.ReceiverAction.CAST:if(this.g)if(this.g.l.label!=a.label)m8("onReceiverAction_: Stopping active receiver: "+this.g.l.friendlyName),this.g.stop();else{m8("onReceiverAction_: Casting to active receiver.");this.g.o&&this.T("yt-remote-cast2-session-change",this.g.o);break}switch(a.receiverType){case window.chrome.cast.ReceiverType.CUSTOM:o8(this,
new k8(this.l,a));break;case window.chrome.cast.ReceiverType.DIAL:o8(this,new j8(this.l,a,this.C));break;case window.chrome.cast.ReceiverType.CAST:o8(this,new i8(this.l,a));break;default:this.hc("Unknown receiver type: "+a.receiverType)}break;case window.chrome.cast.ReceiverAction.STOP:this.g&&this.g.l.label==a.label?this.g.stop():this.hc("Stopping receiver w/o session: "+a.friendlyName)}else this.hc("onReceiverAction_ called without receiver.")};
g.h.UQ=function(a){if(this.ka())return window.Promise.reject(Error("disposed"));var b=a.receiver;b.receiverType!=window.chrome.cast.ReceiverType.DIAL&&(this.hc("Not DIAL receiver: "+b.friendlyName),b.receiverType=window.chrome.cast.ReceiverType.DIAL);var c=this.g?this.g.l:null;if(!c||c.label!=b.label)return this.hc("Receiving DIAL launch request for non-clicked DIAL receiver: "+b.friendlyName),window.Promise.reject(Error("illegal DIAL launch"));if(c&&c.label==b.label&&c.receiverType!=window.chrome.cast.ReceiverType.DIAL){if(this.g.o)return m8("Reselecting dial screen."),
this.T("yt-remote-cast2-session-change",this.g.o),window.Promise.resolve(new window.chrome.cast.DialLaunchResponse(!1));this.hc('Changing CAST intent from "'+c.receiverType+'" to "dial" for '+b.friendlyName);o8(this,new j8(this.l,b,this.C))}b=this.g;b.F=a;return b.F.appState==window.chrome.cast.DialAppState.RUNNING?new window.Promise((0,g.A)(b.iL,b,(b.F.extraData||{}).screenId||null)):new window.Promise((0,g.A)(b.Rs,b))};
g.h.MC=function(a){if(!this.ka()){m8("New cast session ID: "+a.sessionId);var b=a.receiver;if(b.receiverType!=window.chrome.cast.ReceiverType.CUSTOM){if(!this.g)if(b.receiverType==window.chrome.cast.ReceiverType.CAST)m8("Got resumed cast session before resumed mdx connection."),b.friendlyName=window.chrome.cast.unescape(b.friendlyName),o8(this,new i8(this.l,b),!0);else{this.hc("Got non-cast session without previous mdx receiver event, or mdx resume.");return}var c=this.g.l,d=Z6(this.l.ke(),c.label);
d&&U6(d,b.label)&&c.receiverType!=window.chrome.cast.ReceiverType.CAST&&b.receiverType==window.chrome.cast.ReceiverType.CAST&&(m8("onSessionEstablished_: manual to cast session change "+b.friendlyName),g.Ze(this.g),this.g=new i8(this.l,b),this.g.subscribe("sessionScreen",(0,g.A)(this.NC,this,this.g)),this.g.ak(null));this.g.gv(a)}}};
g.h.qW=function(){return this.g?this.g.dF():null};
g.h.tT=function(a){this.ka()||(this.hc("Failed to estabilish a session: "+g.xg(a)),a.code!=window.chrome.cast.ErrorCode.CANCEL&&o8(this,null))};
g.h.YS=function(a){m8("Receiver availability updated: "+a);if(!this.ka()){var b=n8(this);this.B=a==window.chrome.cast.ReceiverAvailability.AVAILABLE;n8(this)!=b&&this.T("yt-remote-cast2-availability-change",n8(this))}};
g.h.cF=function(){this.ka()||(this.o=GCa(this),m8("Updating custom receivers: "+g.xg(this.o)),window.chrome.cast.setCustomReceivers(this.o,g.z,(0,g.A)(function(){this.hc("Failed to set custom receivers.")},this)),this.T("yt-remote-cast2-availability-change",n8(this)))};
l8.prototype.setLaunchParams=l8.prototype.nV;l8.prototype.setConnectedScreenStatus=l8.prototype.mV;l8.prototype.stopSession=l8.prototype.rW;l8.prototype.getCastSession=l8.prototype.qW;l8.prototype.requestSession=l8.prototype.requestSession;l8.prototype.init=l8.prototype.init;l8.prototype.dispose=l8.prototype.dispose;var u8=[];g.h=z8.prototype;
g.h.reset=function(a){this.listId="";this.index=-1;this.videoId="";A8(this);this.volume=-1;this.muted=!1;a&&(this.index=a.index,this.listId=a.listId,this.videoId=a.videoId,this.g=a.playerState,this.volume=a.volume,this.muted=a.muted,this.audioTrackId=a.audioTrackId,this.l=a.trackData,this.Sf=a.hasPrevious,this.hasNext=a.hasNext,this.F=a.playerTime,this.D=a.playerTimeAt,this.B=a.seekableStart,this.o=a.seekableEnd,this.H=a.duration,this.I=a.loadedTime,this.A=a.liveIngestionTime,this.C=!(0,window.isNaN)(this.A))};
g.h.jb=function(){return 1==this.g};
g.h.isAdPlaying=function(){return 1081==this.g};
g.h.getDuration=function(){return this.C?this.H+B8(this):this.H};
g.h.clone=function(){return new z8(F8(this))};g.B(H8,g.HF);g.h=H8.prototype;g.h.play=function(){1==this.g?(this.l?this.l.play(null,g.z,N8(this,"play")):M8(this,"play"),L8(this,1,D8(I8(this))),this.T("remotePlayerChange")):J8(this,this.play)};
g.h.pause=function(){1==this.g?(this.l?this.l.pause(null,g.z,N8(this,"pause")):M8(this,"pause"),L8(this,2,D8(I8(this))),this.T("remotePlayerChange")):J8(this,this.pause)};
g.h.YE=function(a){if(1==this.g){if(this.l){var b=I8(this),c=new window.chrome.cast.media.SeekRequest;c.currentTime=a;c.resumeState=b.jb()||3==b.g?window.chrome.cast.media.ResumeState.PLAYBACK_START:window.chrome.cast.media.ResumeState.PLAYBACK_PAUSE;this.l.seek(c,g.z,N8(this,"seekTo",{newTime:a}))}else M8(this,"seekTo",{newTime:a});L8(this,3,a);this.T("remotePlayerChange")}else J8(this,g.Ea(this.YE,a))};
g.h.stop=function(){if(1==this.g){this.l?this.l.stop(null,g.z,N8(this,"stopVideo")):M8(this,"stopVideo");var a=I8(this);a.index=-1;a.videoId="";A8(a);K8(this,a);this.T("remotePlayerChange")}else J8(this,this.stop)};
g.h.setVolume=function(a,b){if(1==this.g){var c=I8(this);if(this.o){if(c.volume!=a){var d=Math.round(a)/100;this.o.setReceiverVolumeLevel(d,(0,g.A)(function(){R7("CP","set receiver volume: "+d)},this),(0,g.A)(function(){this.hc("failed to set receiver volume.")},this))}c.muted!=b&&this.o.setReceiverMuted(b,(0,g.A)(function(){R7("CP","set receiver muted: "+b)},this),(0,g.A)(function(){this.hc("failed to set receiver muted.")},this))}else{var e={volume:a,
muted:b};-1!=c.volume&&(e.delta=a-c.volume);M8(this,"setVolume",e)}c.muted=b;c.volume=a;K8(this,c)}else J8(this,g.Ea(this.setVolume,a,b))};
g.h.ZD=function(a,b){if(1==this.g){var c=I8(this),d={videoId:a};b&&(c.l={trackName:b.name,languageCode:b.languageCode,sourceLanguageCode:b.translationLanguage?b.translationLanguage.languageCode:"",languageName:b.languageName,format:b.format,kind:b.kind},d.style=g.xg(b.style),g.cc(d,c.l));M8(this,"setSubtitlesTrack",d);K8(this,c)}else J8(this,g.Ea(this.ZD,a,b))};
g.h.Vv=function(a,b){if(1==this.g){M8(this,"setAudioTrack",{videoId:a,audioTrackId:b.Hb.id});var c=I8(this);c.audioTrackId=b.Hb.id;K8(this,c)}else J8(this,g.Ea(this.Vv,a,b))};
g.h.XE=function(a,b){if(1==this.g){if(a&&b){var c=I8(this);E8(c,a,b);K8(this,c)}M8(this,"previous")}else J8(this,g.Ea(this.XE,a,b))};
g.h.WE=function(a,b){if(1==this.g){if(a&&b){var c=I8(this);E8(c,a,b);K8(this,c)}M8(this,"next")}else J8(this,g.Ea(this.WE,a,b))};
g.h.ky=function(){1==this.g?M8(this,"dismissAutoplay"):J8(this,this.ky)};
g.h.dispose=function(){if(3!=this.g){var a=this.g;this.g=3;this.T("proxyStateChange",a,this.g)}H8.ca.dispose.call(this)};
g.h.V=function(){TCa(this);this.A=null;this.B.clear();G8(this,null);H8.ca.V.call(this)};
g.h.Wv=function(a){if((a!=this.g||2==a)&&3!=this.g&&0!=a){var b=this.g;this.g=a;this.T("proxyStateChange",b,a);if(1==a)for(;!this.B.isEmpty();)g.pC(this.B).apply(this);else 3==a&&this.dispose()}};
g.h.OS=function(a,b){this.T(a,b)};
g.h.rQ=function(a){if(!a)this.jm(null),G8(this,null);else if(this.o.receiver.volume){a=this.o.receiver.volume;var b=I8(this),c=Math.round(100*a.level||0);if(b.volume!=c||b.muted!=a.muted)R7("CP","Cast volume update: "+a.level+(a.muted?" muted":"")),b.volume=c,b.muted=!!a.muted,K8(this,b)}};
g.h.jm=function(a){R7("CP","Cast media: "+!!a);this.l&&this.l.removeUpdateListener(this.F);if(this.l=a)this.l.addUpdateListener(this.F),UCa(this),this.T("remotePlayerChange")};
g.h.qQ=function(a){a?(UCa(this),this.T("remotePlayerChange")):this.jm(null)};
g.h.DQ=function(){var a=QCa();a&&G8(this,a)};
g.h.hc=function(a){R7("CP",a)};g.B(O8,g.HF);g.h=O8.prototype;
g.h.connect=function(a,b){if(b){var c=b.listId,d=b.videoId,e=b.playerParams,f=b.clickTrackingParams,k=b.index,l={videoId:d},m=b.currentTime,n=b.locationInfo;g.u(m)&&(l.currentTime=5>=m?0:m);e&&(l.playerParams=e);n&&(l.locationInfo=n);f&&(l.clickTrackingParams=f);c&&(l.listId=c);g.u(k)&&(l.currentIndex=k);c&&(this.Za.listId=c);this.Za.videoId=d;this.Za.index=k||0;this.Za.state=3;C8(this.Za,m);this.A="UNSUPPORTED";P8("Connecting with setPlaylist and params: "+g.xg(l));this.g.connect({method:"setPlaylist",
params:g.xg(l)},a,pBa())}else P8("Connecting without params"),this.g.connect({},a,pBa());WCa(this)};
g.h.dispose=function(){this.ka()||(this.T("beforeDispose"),Q8(this,3));O8.ca.dispose.call(this)};
g.h.V=function(){R8(this);T8(this);S8(this);g.YD(this.H);this.H=window.NaN;g.YD(this.I);this.I=window.NaN;this.o=null;g.rF(this.R);this.R.length=0;this.g.dispose();O8.ca.V.call(this);this.A=this.D=this.l=this.Za=this.g=null};
g.h.wJ=function(){this.C(2)};
g.h.vQ=function(){P8("Channel opened");this.M&&(this.M=!1,S8(this),this.K=g.WD((0,g.A)(function(){P8("Timing out waiting for a screen.");this.C(1)},this),15E3));
tBa(fCa(this.g),this.Y)};
g.h.sQ=function(){P8("Channel closed");(0,window.isNaN)(this.B)?d7(!0):d7();this.dispose()};
g.h.tQ=function(a){d7();(0,window.isNaN)(this.F())?(P8("Channel error: "+a+" without reconnection"),this.dispose()):(this.M=!0,P8("Channel error: "+a+" with reconnection in "+this.F()+" ms"),Q8(this,2))};
g.h.uQ=function(a){a.params?P8("Received: action="+a.action+", params="+g.xg(a.params)):P8("Received: action="+a.action+" {}");switch(a.action){case "loungeStatus":a=g.Ww(a.params.devices);this.l=(0,g.I)(a,function(a){return new S6(a)});
a=!!g.Ka(this.l,function(a){return"LOUNGE_SCREEN"==a.type});
ZCa(this,a);break;case "loungeScreenDisconnected":g.Ua(this.l,function(a){return"LOUNGE_SCREEN"==a.type});
ZCa(this,!1);break;case "remoteConnected":var b=new S6(g.Ww(a.params.device));g.Ka(this.l,function(a){return b?a.id==b.id:!1})||g.Ra(this.l,b);
break;case "remoteDisconnected":b=new S6(g.Ww(a.params.device));g.Ua(this.l,function(a){return b?a.id==b.id:!1});
break;case "gracefulDisconnect":break;case "playlistModified":aDa(this,a);break;case "nowPlaying":cDa(this,a);break;case "onStateChange":bDa(this,a);break;case "onAdStateChange":dDa(this,a);break;case "onVolumeChanged":eDa(this,a);break;case "onSubtitlesTrackChanged":$Ca(this,a);break;case "nowAutoplaying":fDa(this,a);break;case "autoplayDismissed":this.T("autoplayDismissed");break;case "autoplayUpNext":this.D=a.params.videoId||null;this.T("autoplayUpNext",this.D);break;case "onAutoplayModeChanged":this.A=
a.params.autoplayMode;this.T("autoplayModeChange",this.A);"DISABLED"==this.A&&this.T("autoplayDismissed");break;case "onHasPreviousNextChanged":gDa(this,a);break;case "requestAssistedSignIn":this.T("assistedSignInRequested",a.params.authCode);break;default:P8("Unrecognized action: "+a.action)}};
g.h.WU=function(){if(this.o){var a=this.o;this.o=null;this.Za.videoId!=a&&U8(this,"getNowPlaying")}};
O8.prototype.subscribe=O8.prototype.subscribe;O8.prototype.unsubscribeByKey=O8.prototype.Qd;O8.prototype.ga=function(){var a=3;this.ka()||(a=0,(0,window.isNaN)(this.F())?M7(this.g)&&(0,window.isNaN)(this.B)&&(a=1):a=2);return a};
O8.prototype.getProxyState=O8.prototype.ga;O8.prototype.C=function(a){P8("Disconnecting with "+a);R8(this);this.T("beforeDisconnect",a);1==a&&d7();gCa(this.g,a);this.dispose()};
O8.prototype.disconnect=O8.prototype.C;O8.prototype.fa=function(){var a=this.Za;this.o&&(a=this.Za.clone(),E8(a,this.o,a.index));return F8(a)};
O8.prototype.getPlayerContextData=O8.prototype.fa;
O8.prototype.na=function(a){var b=new z8(a);b.videoId&&b.videoId!=this.Za.videoId&&(this.o=b.videoId,g.YD(this.H),this.H=g.WD((0,g.A)(this.WU,this),5E3));var c=[];this.Za.listId==b.listId&&this.Za.videoId==b.videoId&&this.Za.index==b.index||c.push("remoteQueueChange");this.Za.g==b.g&&this.Za.volume==b.volume&&this.Za.muted==b.muted&&D8(this.Za)==D8(b)&&g.xg(this.Za.l)==g.xg(b.l)||c.push("remotePlayerChange");this.Za.reset(a);(0,g.C)(c,function(a){this.T(a)},this)};
O8.prototype.setPlayerContextData=O8.prototype.na;O8.prototype.X=function(){var a=this.g.C.id,b=g.Ka(this.l,function(b){return"REMOTE_CONTROL"==b.type&&b.id!=a});
return b?b.id:""};
O8.prototype.getOtherConnectedRemoteId=O8.prototype.X;O8.prototype.F=function(){var a=this.g;return a.l.isActive()?a.l.l-(0,g.G)():window.NaN};
O8.prototype.getReconnectTimeout=O8.prototype.F;O8.prototype.Z=function(){return this.A||"UNSUPPORTED"};
O8.prototype.getAutoplayMode=O8.prototype.Z;O8.prototype.ba=function(){return this.D||""};
O8.prototype.getAutoplayVideoId=O8.prototype.ba;O8.prototype.sa=function(){if(!(0,window.isNaN)(this.F())){var a=this.g.l;g.Zt(a.g);a.start()}};
O8.prototype.reconnect=O8.prototype.sa;O8.prototype.ia=function(a,b){U8(this,a,b);YCa(this)};
O8.prototype.sendMessage=O8.prototype.ia;g.B(V8,V7);g.h=V8.prototype;g.h.ke=function(a){return this.fd.$_gs(a)};
g.h.contains=function(a){return!!this.fd.$_c(a)};
g.h.get=function(a){return this.fd.$_g(a)};
g.h.start=function(){this.fd.$_st()};
g.h.add=function(a,b,c){this.fd.$_a(a,b,c)};
g.h.remove=function(a,b,c){this.fd.$_r(a,b,c)};
g.h.iq=function(a,b,c,d){this.fd.$_un(a,b,c,d)};
g.h.V=function(){for(var a=0,b=this.l.length;a<b;++a)this.fd.$_ubk(this.l[a]);this.l.length=0;this.fd=null;V8.ca.V.call(this)};
g.h.nW=function(){this.T("screenChange")};
g.h.qS=function(){this.T("onlineScreenChange")};
d8.prototype.$_st=d8.prototype.start;d8.prototype.$_gspc=d8.prototype.oW;d8.prototype.$_gsppc=d8.prototype.bF;d8.prototype.$_c=d8.prototype.contains;d8.prototype.$_g=d8.prototype.get;d8.prototype.$_a=d8.prototype.add;d8.prototype.$_un=d8.prototype.iq;d8.prototype.$_r=d8.prototype.remove;d8.prototype.$_gs=d8.prototype.ke;d8.prototype.$_gos=d8.prototype.aF;d8.prototype.$_s=d8.prototype.subscribe;d8.prototype.$_ubk=d8.prototype.Qd;var W8=null,X8=null,l9=null,a9=[];g.t(m9,g.M);g.h=m9.prototype;
g.h.V=function(){g.M.prototype.V.call(this);this.A.stop();this.B.stop();this.J.stop();this.M();this.g.unsubscribe("proxyStateChange",this.KC,this);this.g.unsubscribe("remotePlayerChange",this.pm,this);this.g.unsubscribe("remoteQueueChange",this.rp,this);this.g.unsubscribe("autoplayUpNext",this.iC,this);this.g.unsubscribe("previousNextChange",this.HC,this);this.g.unsubscribe("nowAutoplaying",this.zC,this);this.g.unsubscribe("autoplayDismissed",this.hC,this);this.g=this.F=null};
g.h.jB=function(a,b){for(var c=[],d=1;d<arguments.length;++d)c[d-1]=arguments[d];if(2!=this.g.g)if(p9(this)){if(!I8(this.g).isAdPlaying()||"control_seek"!=a)switch(a){case "control_toggle_play_pause":I8(this.g).jb()?this.g.pause():this.g.play();break;case "control_play":this.g.play();break;case "control_pause":this.g.pause();break;case "control_seek":this.I.Ij(c[0],c[1]);break;case "control_subtitles_set_track":q9(this,c[0]);break;case "control_set_audio_track":c=c[0],p9(this)&&this.g.Vv(this.l.getVideoData(1).videoId,
c)}}else switch(a){case "control_toggle_play_pause":case "control_play":case "control_pause":c=this.l.getCurrentTime();r9(this,0==c?void 0:c);break;case "control_seek":r9(this,c[0]);break;case "control_subtitles_set_track":q9(this,c[0]);break;case "control_set_audio_track":c=c[0],p9(this)&&this.g.Vv(this.l.getVideoData(1).videoId,c)}};
g.h.pQ=function(a){this.J.rJ(a)};
g.h.RV=function(a){this.jB("control_subtitles_set_track",g.Vb(a)?null:a)};
g.h.pE=function(){var a=this.l.yc("captions","track");g.Vb(a)||q9(this,a)};
g.h.xC=function(a){if(p9(this)){this.g.unsubscribe("remotePlayerChange",this.pm,this);var b=Math.round(a.volume);a=!!a.muted;var c=I8(this.g);if(b!=c.volume||a!=c.muted)this.g.setVolume(b,a),this.K.start();this.g.subscribe("remotePlayerChange",this.pm,this)}};
g.h.KR=function(){g.Vb(this.C)||sDa(this,this.C);this.D=!1};
g.h.KC=function(a,b){this.B.stop();2==b&&this.mE()};
g.h.pm=function(){if(p9(this)){this.A.stop();var a=I8(this.g);switch(a.g){case 1081:case 1:o9(this,new g.DP(8));this.lE();break;case 1085:case 3:o9(this,new g.DP(9));break;case 1083:case 0:o9(this,new g.DP(2));this.I.stop();n9(this,this.l.getVideoData().lengthSeconds);break;case 1084:o9(this,new g.DP(4));break;case 2:o9(this,new g.DP(4));n9(this,D8(a));break;case -1:o9(this,new g.DP(64));break;case -1E3:o9(this,new g.DP(128,{errorCode:"mdx.remoteerror",message:"This video is not available for remote playback."}))}a=
I8(this.g).l;var b=this.C;(a||b?a&&b&&a.trackName==b.trackName&&a.languageCode==b.languageCode&&a.languageName==b.languageName&&a.format==b.format&&a.kind==b.kind:1)||(this.C=a,sDa(this,a));a=I8(this.g);-1==a.volume||Math.round(this.l.getVolume())==a.volume&&this.l.isMuted()==a.muted||this.K.isActive()||this.ME()}else rDa(this)};
g.h.HC=function(){this.l.T("mdxpreviousnextchange")};
g.h.rp=function(){p9(this)||rDa(this)};
g.h.BI=function(){this.g.ky()};
g.h.iC=function(a){a&&(a=g.mE("/watch_queue_ajax",{method:"GET",Yc:{action_get_watch_queue_item:1,video_id:a},onSuccess:(0,g.A)(this.UT,this)}))&&(this.M=(0,g.A)(a.abort,a))};
g.h.UT=function(a,b){var c=new g.vO({videoId:b.videoId,title:b.title,author:b.author,murlmq_webp:b.url});this.suggestion=c;this.l.T("mdxautoplayupnext",c)};
g.h.zC=function(a){(0,window.isNaN)(a)||this.l.T("mdxnowautoplaying",a)};
g.h.hC=function(){this.l.T("mdxautoplaycanceled")};
g.h.pO=function(a,b){-1==I8(this.g).g?r9(this,a):b&&this.g.YE(a)};
g.h.ME=function(){if(p9(this)){var a=I8(this.g);this.o.Da(this.R);a.muted?this.l.mute():this.l.dg();this.l.setVolume(a.volume);this.R=this.o.O(this.l,"onVolumeChange",this.xC)}};
g.h.lE=function(){this.A.stop();if(!this.g.ka()){var a=I8(this.g);a.jb()&&o9(this,new g.DP(8));n9(this,D8(a));this.A.start()}};
g.h.mE=function(){this.B.stop();this.A.stop();var a=this.g.A.getReconnectTimeout();2==this.g.g&&!(0,window.isNaN)(a)&&this.B.start()};g.t(s9,g.W);s9.prototype.B=function(a){uDa(this,a.state)};g.t(t9,g.b_);t9.prototype.J=function(){var a=this.o.yc("remote","receivers");a&&1<a.length&&!this.o.yc("remote","quickCast")?(this.H=g.jb(a,this.C,this),g.c_(this,(0,g.I)(a,this.C)),a=this.o.yc("remote","currentReceiver"),this.wf(this.C(a)),this.enable(!0)):this.enable(!1)};
t9.prototype.C=function(a){return a.key};
t9.prototype.vf=function(a){return"cast-selector-receiver"==a?"Cast...":this.H[a].name};
t9.prototype.wd=function(a){g.b_.prototype.wd.call(this,a);this.o.Md("remote","currentReceiver",this.H[a]);this.B.Rb()};g.t(u9,g.AV);g.h=u9.prototype;g.h.create=function(){lDa(g.KM(g.Y(this.g)));this.C.push(g.TF("yt-remote-before-disconnect",this.lQ,this));this.C.push(g.TF("yt-remote-connection-change",this.ZS,this));this.C.push(g.TF("yt-remote-receiver-availability-change",this.IC,this));this.C.push(g.TF("yt-remote-auto-connect",this.XS,this));this.C.push(g.TF("yt-remote-receiver-resumed",this.WS,this));this.IC()};
g.h.load=function(){this.g.Yt();g.AV.prototype.load.call(this);this.B=new m9(this,this.g,this.l);var a=(a=qDa())?a.currentTime:0;var b=k9()?new H8(f9(),void 0):null;0==a&&b&&(a=D8(I8(b)));0!=a&&(this.H=a||0,this.g.T("progresssync",a,void 0));tDa(this,this.D,this.D);g.x0(this.g.app,6)};
g.h.unload=function(){this.g.T("mdxautoplaycanceled");this.A=this.o;g.$e(this.B,this.l);this.l=this.B=null;g.AV.prototype.unload.call(this);g.x0(this.g.app,5)};
g.h.V=function(){g.UF(this.C);g.AV.prototype.V.call(this)};
g.h.Yl=function(a,b){for(var c=[],d=1;d<arguments.length;++d)c[d-1]=arguments[d];this.loaded&&this.B.jB.apply(this.B,[a].concat(g.oa(c)))};
g.h.nJ=function(){return this.loaded?this.B.suggestion:null};
g.h.Sf=function(){return this.l?I8(this.l).Sf:!1};
g.h.hasNext=function(){return this.l?I8(this.l).hasNext:!1};
g.h.getCurrentTime=function(){return this.H};
g.h.dO=function(){var a=I8(this.l),b=this.g.getVideoData();return{allowSeeking:this.g.gd(),clipEnd:b.clipEnd,clipStart:b.clipStart,current:this.getCurrentTime(),displayedStart:-1,duration:a.getDuration(),ingestionTime:a.C?a.A+B8(a):a.A,isPeggedToLive:1>=(a.C?a.o+B8(a):a.o)-this.getCurrentTime(),loaded:a.I,seekableEnd:a.C?a.o+B8(a):a.o,seekableStart:0<a.B?a.B+B8(a):a.B}};
g.h.eO=function(){this.l&&this.l.WE()};
g.h.fO=function(){this.l&&this.l.XE()};
g.h.lQ=function(a){1==a&&(this.I=this.l?I8(this.l):null)};
g.h.ZS=function(){var a=k9()?new H8(f9(),void 0):null;if(a){var b=this.A;this.loaded&&this.unload();this.l=a;this.I=null;b.key!=this.o.key&&(this.A=b,this.load())}else g.Ze(this.l),this.l=null,this.loaded&&(this.unload(),(a=this.I)&&a.videoId==this.g.getVideoData().videoId&&this.g.NA(a.videoId,D8(a)));this.g.T("videodatachange","newdata",this.g.getVideoData(),3)};
g.h.IC=function(){this.F=[this.o].concat(nDa());var a=g9()||this.o;v9(this,a);this.g.va("onMdxReceiversChange")};
g.h.XS=function(){var a=g9();v9(this,a)};
g.h.WS=function(){this.A=g9()};
g.h.cO=function(a,b){switch(a){case "casting":return this.loaded;case "receivers":return this.F;case "currentReceiver":return b&&("cast-selector-receiver"==b.key?x8():v9(this,b)),this.loaded?this.A:this.o;case "quickCast":return 2==this.F.length&&"cast-selector-receiver"==this.F[1].key?(b&&x8(),!0):!1}};
g.h.gO=function(){M8(this.l,"sendDebugCommand",{debugCommand:"stats4nerds "})};
g.h.Pc=function(){return!1};g.rY.remote=u9;})(_yt_player);
