(function(g){var window=this;'use strict';var ed9=function(T){if(T instanceof g.Xy)return T;if(typeof T.Xu=="function")return T.Xu(!1);if(g.o_(T)){var Q=0,k=new g.Xy;k.next=function(){for(;;){if(Q>=T.length)return g.R6;if(Q in T)return g.wR(T[Q++]);Q++}}; return k}throw Error("Not implemented");},Fae=function(T,Q,k){if(g.o_(T))g.EA(T,Q,k); else for(T=ed9(T);;){var l=T.next();if(l.done)break;Q.call(k,l.value,void 0,T)}},QL=function(T){g.Uz(T,"zx",Math.floor(Math.random()*2147483648).toString(36)+Math.abs(Math.floor(Math.random()*2147483648)^g.R_()).toString(36)); return T},jd=function(T,Q,k){Array.isArray(k)||(k=[String(k)]); g.OHt(T.Y,Q,k)},Eim=function(T,Q){var k=[]; Fae(Q,function(l){try{var v=g.AJ.prototype.S.call(this,l,!0)}catch(L){if(L=="Storage: Invalid value was encountered")return;throw L;}v===void 0?k.push(l):g.yz5(v)&&k.push(l)},T); return k},yI$=function(T,Q){Eim(T,Q).forEach(function(k){g.AJ.prototype.remove.call(this,k)},T)},iep=function(T){if(T.F_){if(T.F_.locationOverrideToken)return{locationOverrideToken:T.F_.locationOverrideToken}; if(T.F_.latitudeE7!=null&&T.F_.longitudeE7!=null)return{latitudeE7:T.F_.latitudeE7,longitudeE7:T.F_.longitudeE7}}return null},VmW=function(T,Q){g.CW(T,Q)||T.push(Q)},TVd=function(T){var Q=0,k; for(k in T)Q++;return Q},QUm=function(T,Q){return g.YZ(T,Q)},jUA=function(T){try{return g.VC.JSON.parse(T)}catch(Q){}T=String(T); if(/^\s*$/.test(T)?0:/^[\],:{}\s\u2028\u2029]*$/.test(T.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("("+T+")")}catch(Q){}throw Error("Invalid JSON string: "+T);},kU=function(T){if(g.VC.JSON)try{return g.VC.JSON.parse(T)}catch(Q){}return jUA(T)},kOp=function(){var T=l9(); this.T=T;T.Rw("/client_streamz/youtube/living_room/mdx/channel/opened",g.ol("channel_type"))},lqW=function(){var T=l9(); this.T=T;T.Rw("/client_streamz/youtube/living_room/mdx/channel/closed",g.ol("channel_type"))},o5A=function(){var T=l9(); this.T=T;T.Rw("/client_streamz/youtube/living_room/mdx/channel/message_received",g.ol("channel_type"))},v5p=function(){var T=l9(); this.T=T;T.Rw("/client_streamz/youtube/living_room/mdx/channel/success")},L6e=function(){var T=l9(); this.T=T;T.Rw("/client_streamz/youtube/living_room/mdx/channel/error",g.ol("channel_type"),g.ol("error_type"))},qGA=function(){var T=l9(); this.T=T;T.Rw("/client_streamz/youtube/living_room/mdx/browser_channel/pending_maps")},g5d=function(){var T=l9(); this.T=T;T.Rw("/client_streamz/youtube/living_room/mdx/browser_channel/undelivered_maps")},MSe=function(T,Q,k,l){var v=new g.lN(null); T&&g.oZ(v,T);Q&&g.v0(v,Q);k&&g.LV(v,k);l&&(v.S=l);return v},YGE=function(T,Q){return new g.QO(T,Q)},o7=function(T,Q){return Object.prototype.hasOwnProperty.call(T,Q)},U2p=function(T,Q){return T===Q},vo=function(T,Q){this.S={}; this.T=[];this.iR=this.size=0;var k=arguments.length;if(k>1){if(k%2)throw Error("Uneven number of arguments");for(var l=0;l5&&(T=T.slice(T.length-5)); var Q=g.IQ(E5A(),function(l){return l.loungeToken}),k=g.IQ(T,function(l){return l.loungeToken}); g.hm(k,function(l){return!g.CW(Q,l)})&&yH$(); g.ri("yt-remote-local-screens",T,31536E3)},fz=function(T){T||(g.Dk("yt-remote-session-screen-id"),g.Dk("yt-remote-session-video-id")); eIW();T=R7();g.zv(T,Za());$2T(T)},VSd=function(){if(!Ga){var T=g.uw(); T&&(Ga=new g.wl(T))}},TiE=function(){VSd(); return Ga?!!Ga.get("yt-remote-use-staging-server"):!1},mi=function(T,Q){g.iM[T]=!0; var k=g.ES();k&&k.publish.apply(k,arguments);g.iM[T]=!1},Q1A=function(){},l9=function(){if(!I7){I7=new g.td(new Q1A); var T=g.sG("client_streamz_web_flush_count",-1);T!==-1&&(I7.L=T)}return I7},j1T=function(){var T=window.navigator.userAgent.match(/Chrome\/([0-9]+)/); return T?parseInt(T[1],10):0},kL_=function(T){return!!document.currentScript&&(document.currentScript.src.indexOf("?"+T)!=-1||document.currentScript.src.indexOf("&"+T)!=-1)},lkE=function(){return typeof window.__onGCastApiAvailable=="function"?window.__onGCastApiAvailable:null},hh=function(T){T.length?oq1(T.shift(),function(){hh(T)}):vqW()},LdW=function(T){return"chrome-extension://"+T+"/cast_sender.js"},oq1=function(T,Q,k){var l=document.createElement("script"); l.onerror=Q;k&&(l.onload=k);g.SN(l,g.BN(T));(document.head||document.documentElement).appendChild(l)},qrA=function(){var T=j1T(),Q=[]; if(T>1){var k=T-1;Q.push("//www.gstatic.com/eureka/clank/"+T+"/cast_sender.js");Q.push("//www.gstatic.com/eureka/clank/"+k+"/cast_sender.js")}return Q},vqW=function(){var T=lkE(); T&&T(!1,"No cast extension found")},MG9=function(){if(gqm){var T=2,Q=lkE(),k=function(){T--; T==0&&Q&&Q(!0)}; window.__onGCastApiAvailable=k;oq1("//www.gstatic.com/cast/sdk/libs/sender/1.0/cast_framework.js",vqW,k)}},Yr$=function(){MG9(); var T=qrA();T.push("//www.gstatic.com/eureka/clank/cast_sender.js");hh(T)},RYA=function(){MG9(); var T=qrA();T.push.apply(T,g.ZH(U5m.map(LdW)));T.push("//www.gstatic.com/eureka/clank/cast_sender.js");hh(T)},s1=function(T,Q,k){g.x.call(this); this.B=k!=null?(0,g.Mp)(T,k):T;this.d8=Q;this.N=(0,g.Mp)(this.VI,this);this.T=!1;this.S=0;this.L=this.D8=null;this.Y=[]},Sd=function(){},ZY_=function(){g.Jz.call(this,"p")},fkA=function(){g.Jz.call(this,"o")},m5J=function(){return GLW=GLW||new g.fL},IkE=function(T){g.Jz.call(this,"serverreachability",T)},Cz=function(T){var Q=m5J(); Q.dispatchEvent(new IkE(Q,T))},hYm=function(T){g.Jz.call(this,"statevent",T)},Bo=function(T){var Q=m5J(); Q.dispatchEvent(new hYm(Q,T))},s1$=function(T,Q,k,l){g.Jz.call(this,"timingevent",T); this.size=Q;this.rtt=k;this.retries=l},za=function(T,Q){if(typeof T!=="function")throw Error("Fn must not be null and must be a function"); return g.VC.setTimeout(function(){T()},Q)},Xm=function(){},we=function(T,Q,k,l){this.L=T; this.Y=Q;this.Ig=k;this.Gg=l||1;this.Tg=new g.mo(this);this.f_=45E3;this.Bd=null;this.B=!1;this.D=this.u9=this.j=this.sK=this.hj=this.zg=this.z9=null;this.qO=[];this.T=null;this.C=0;this.N=this.xm=null;this.QR=-1;this.e6=!1;this.K_=0;this.p_=null;this.d5=this.Jj=this.h3=this.i9=!1;this.S=new Sr9},Sr9=function(){this.S=null; this.T="";this.L=!1},Bi$=function(T,Q,k){T.sK=1; T.j=QL(Q.clone());T.D=k;T.i9=!0;CuA(T,null)},CuA=function(T,Q){T.hj=Date.now(); de(T);T.u9=T.j.clone();jd(T.u9,"t",T.Gg);T.C=0;var k=T.L.sK;T.S=new Sr9;T.T=zYT(T.L,k?Q:null,!T.D);T.K_>0&&(T.p_=new g.Vq((0,g.Mp)(T.sV,T,T.T),T.K_));T.Tg.listen(T.T,"readystatechange",T.CD);Q=T.Bd?g.Gs(T.Bd):{};T.D?(T.xm||(T.xm="POST"),Q["Content-Type"]="application/x-www-form-urlencoded",T.T.send(T.u9,T.xm,T.D,Q)):(T.xm="GET",T.T.send(T.u9,T.xm,null,Q));Cz(1)},wyd=function(T){if(!XyA(T))return g.io(T.T); var Q=g.Vu(T.T);if(Q==="")return"";var k="",l=Q.length,v=g.EJ(T.T)==4;if(!T.S.S){if(typeof TextDecoder==="undefined")return Nb(T),Ah(T),"";T.S.S=new g.VC.TextDecoder}for(var L=0;LQ.length)return d5A;Q=Q.slice(l,l+k);T.C=l+k;return Q},de=function(T){T.zg=Date.now()+T.f_; bY$(T,T.f_)},bY$=function(T,Q){if(T.z9!=null)throw Error("WatchDog timer not null"); T.z9=za((0,g.Mp)(T.wu,T),Q)},rgA=function(T){T.z9&&(g.VC.clearTimeout(T.z9),T.z9=null)},Ah=function(T){T.L.FG()||T.e6||cgd(T.L,T)},Nb=function(T){rgA(T); g.od(T.p_);T.p_=null;T.Tg.removeAll();if(T.T){var Q=T.T;T.T=null;Q.abort();Q.dispose()}},HYW=function(T,Q){try{var k=T.L; if(k.i7!=0&&(k.T==T||D5A(k.S,T)))if(!T.Jj&&D5A(k.S,T)&&k.i7==3){try{var l=k.iK.T.parse(Q)}catch(z){l=null}if(Array.isArray(l)&&l.length==3){var v=l;if(v[0]==0)a:{if(!k.j){if(k.T)if(k.T.hj+3E30&&(k.K_=1.5*Y);l=k;var U=T.kO();if(U){var R=g.Tc(U,"X-Client-Wire-Protocol");if(R){var Z=l.S;!Z.T&&(g.rz(R,"spdy")||g.rz(R,"quic")||g.rz(R,"h2"))&&(Z.Y=Z.N,Z.T=new Set,Z.S&&(nqe(Z,Z.S),Z.S=null))}if(l.i9){var f=g.Tc(U,"X-HTTP-Session-Id");f&&(l.vn=f,g.Uz(l.Bd,l.i9,f))}}k.i7=3;k.N&&k.N.bE();k.DP&&(k.Z8=Date.now()-T.hj);l=k;var G=T;l.Hn=KdE(l,l.sK?l.Gg:null,l.Ig);if(G.Jj){x5$(l.S, G);var m=G,I=l.K_;I&&m.setTimeout(I);m.z9&&(rgA(m),de(m));l.T=G}else Pu_(l);k.L.length>0&&Da(k)}else L[0]!="stop"&&L[0]!="close"||co(k,7);else k.i7==3&&(L[0]=="stop"||L[0]=="close"?L[0]=="stop"?co(k,7):k.disconnect():L[0]!="noop"&&k.N&&k.N.jJ(L),k.qO=0)}Cz(4)}catch(z){}},tGW=function(T,Q){this.T=T; this.map=Q;this.context=null},OYJ=function(T){this.N=T||10; g.VC.PerformanceNavigationTiming?(T=g.VC.performance.getEntriesByType("navigation"),T=T.length>0&&(T[0].nextHopProtocol=="hq"||T[0].nextHopProtocol=="h2")):T=!!(g.VC.chrome&&g.VC.chrome.loadTimes&&g.VC.chrome.loadTimes()&&g.VC.chrome.loadTimes().wasFetchedViaSpdy);this.Y=T?this.N:1;this.T=null;this.Y>1&&(this.T=new Set);this.S=null;this.L=[]},pyW=function(T){return T.S?!0:T.T?T.T.size>=T.Y:!1},u4v=function(T){return T.S?1:T.T?T.T.size:0},D5A=function(T,Q){return T.S?T.S==Q:T.T?T.T.has(Q):!1},nqe= function(T,Q){T.T?T.T.add(Q):T.S=Q},x5$=function(T,Q){T.S&&T.S==Q?T.S=null:T.T&&T.T.has(Q)&&T.T.delete(Q)},WdT=function(T){if(T.S!=null)return T.L.concat(T.S.qO); if(T.T!=null&&T.T.size!==0){var Q=T.L;T=g.B(T.T.values());for(var k=T.next();!k.done;k=T.next())Q=Q.concat(k.value.qO);return Q}return g.r$(T.L)},$5$=function(T,Q){var k=new Xm; if(g.VC.Image){var l=new Image;l.onload=g.YE(a7,k,"TestLoadImage: loaded",!0,Q,l);l.onerror=g.YE(a7,k,"TestLoadImage: error",!1,Q,l);l.onabort=g.YE(a7,k,"TestLoadImage: abort",!1,Q,l);l.ontimeout=g.YE(a7,k,"TestLoadImage: timeout",!1,Q,l);g.VC.setTimeout(function(){if(l.ontimeout)l.ontimeout()},1E4); l.src=T}else Q(!1)},JgA=function(T,Q){var k=new Xm,l=new AbortController,v=setTimeout(function(){l.abort(); a7(k,"TestPingServer: timeout",!1,Q)},1E4); fetch(T,{signal:l.signal}).then(function(L){clearTimeout(v);L.ok?a7(k,"TestPingServer: ok",!0,Q):a7(k,"TestPingServer: server error",!1,Q)}).catch(function(){clearTimeout(v); a7(k,"TestPingServer: error",!1,Q)})},a7=function(T,Q,k,l,v){try{v&&(v.onload=null,v.onerror=null,v.onabort=null,v.ontimeout=null),l(k)}catch(L){}},eYp=function(){this.T=new Sd},u9=function(T,Q,k){return k&&k.Qx?k.Qx[T]||Q:Q},Fdm=function(T){this.L=[]; this.Gg=this.Hn=this.Bd=this.Ig=this.T=this.vn=this.i9=this.e6=this.C=this.QR=this.D=null;this.Tw=this.u9=0;this.pG=u9("failFast",!1,T);this.Jj=this.z9=this.j=this.B=this.N=null;this.OG=!0;this.F_=this.p_=-1;this.d5=this.qO=this.hj=0;this.nG=u9("baseRetryDelayMs",5E3,T);this.Wk=u9("retryDelaySeedMs",1E4,T);this.uK=u9("forwardChannelMaxRetries",2,T);this.gt=u9("forwardChannelRequestTimeoutMs",2E4,T);this.Ah=T&&T.ecq||void 0;this.vk=T&&T.YEq||void 0;this.YP=T&&T.UTK||!1;this.K_=void 0;this.sK=T&&T.m_j|| !1;this.Y="";this.S=new OYJ(T&&T.uLm);this.iK=new eYp;this.Tg=T&&T.dAB||!1;this.zg=T&&T.cVd||!1;this.Tg&&this.zg&&(this.zg=!1);this.OW=T&&T.jGd||!1;T&&T.RzK&&(this.OG=!1);this.DP=!this.Tg&&this.OG&&T&&T.f6B||!1;this.t6=void 0;T&&T.Tu&&T.Tu>0&&(this.t6=T.Tu);this.Fk=void 0;this.Z8=0;this.f_=!1;this.h3=this.xm=null},re=function(T){T.T&&(Eqd(T),T.T.cancel(),T.T=null)},ygA=function(T){re(T); T.j&&(g.VC.clearTimeout(T.j),T.j=null);b9(T);T.S.cancel();T.B&&(typeof T.B==="number"&&g.VC.clearTimeout(T.B),T.B=null)},Da=function(T){pyW(T.S)||T.B||(T.B=!0,g.Ad(T.Jf,T),T.hj=0)},VGd=function(T,Q){if(u4v(T.S)>=T.S.Y-(T.B?1:0))return!1; if(T.B)return T.L=Q.qO.concat(T.L),!0;if(T.i7==1||T.i7==2||T.hj>=(T.pG?0:T.uK))return!1;T.B=za((0,g.Mp)(T.Jf,T,Q),iYm(T,T.hj));T.hj++;return!0},QpA=function(T,Q){var k; Q?k=Q.Ig:k=T.u9++;var l=T.Bd.clone();g.Uz(l,"SID",T.Y);g.Uz(l,"RID",k);g.Uz(l,"AID",T.p_);nz(T,l);T.C&&T.D&&g.Gm(l,T.C,T.D);k=new we(T,T.Y,k,T.hj+1);T.C===null&&(k.Bd=T.D);Q&&(T.L=Q.qO.concat(T.L));Q=Tm$(T,k,1E3);k.setTimeout(Math.round(T.gt*.5)+Math.round(T.gt*.5*Math.random()));nqe(T.S,k);Bi$(k,l,Q)},nz=function(T,Q){T.e6&&g.VJ(T.e6,function(k,l){g.Uz(Q,l,k)}); T.N&&g.VJ({},function(k,l){g.Uz(Q,l,k)})},Tm$=function(T,Q,k){k=Math.min(T.L.length,k); var l=T.N?(0,g.Mp)(T.N.Ze,T.N,T):null;a:{for(var v=T.L,L=-1;;){var q=["count="+k];L==-1?k>0?(L=v[0].T,q.push("ofs="+L)):L=0:q.push("ofs="+L);for(var Y=!0,U=0;U=3)return!1; T.d5++;T.j=za((0,g.Mp)(T.lE,T),iYm(T,T.qO));T.qO++;return!0},Eqd=function(T){T.xm!=null&&(g.VC.clearTimeout(T.xm),T.xm=null)},jpT=function(T){T.T=new we(T,T.Y,"rpc",T.d5); T.C===null&&(T.T.Bd=T.D);T.T.K_=0;var Q=T.Hn.clone();g.Uz(Q,"RID","rpc");g.Uz(Q,"SID",T.Y);g.Uz(Q,"AID",T.p_);g.Uz(Q,"CI",T.Jj?"0":"1");!T.Jj&&T.t6&&g.Uz(Q,"TO",T.t6);g.Uz(Q,"TYPE","xmlhttp");nz(T,Q);T.C&&T.D&&g.Gm(Q,T.C,T.D);T.K_&&T.T.setTimeout(T.K_);var k=T.T;T=T.Gg;k.sK=1;k.j=QL(Q.clone());k.D=null;k.i9=!0;CuA(k,T)},b9=function(T){T.z9!=null&&(g.VC.clearTimeout(T.z9),T.z9=null)},cgd=function(T,Q){var k=null; if(T.T==Q){b9(T);Eqd(T);T.T=null;var l=2}else if(D5A(T.S,Q))k=Q.qO,x5$(T.S,Q),l=1;else return;if(T.i7!=0)if(Q.B)if(l==1){k=Q.D?Q.D.length:0;Q=Date.now()-Q.hj;var v=T.hj;l=m5J();l.dispatchEvent(new s1$(l,k,Q,v));Da(T)}else Pu_(T);else{var L=Q.QR;v=Q.getLastError();if(v==3||v==0&&L>0||!(l==1&&VGd(T,Q)||l==2&&ak$(T)))switch(k&&k.length>0&&(Q=T.S,Q.L=Q.L.concat(k)),v){case 1:co(T,5);break;case 4:co(T,10);break;case 3:co(T,6);break;default:co(T,2)}}},iYm=function(T,Q){var k=T.nG+Math.floor(Math.random()* T.Wk); T.isActive()||(k*=2);return k*Q},co=function(T,Q){if(Q==2){var k=(0,g.Mp)(T.Bwk,T),l=T.vk,v=!l; l=new g.lN(l||"//www.google.com/images/cleardot.gif");g.VC.location&&g.VC.location.protocol=="http"||g.oZ(l,"https");QL(l);v?$5$(l.toString(),k):JgA(l.toString(),k)}else Bo(2);T.i7=0;T.N&&T.N.Af(Q);kBd(T);ygA(T)},kBd=function(T){T.i7=0; T.h3=[];if(T.N){var Q=WdT(T.S);if(Q.length!=0||T.L.length!=0)g.cm(T.h3,Q),g.cm(T.h3,T.L),T.S.L.length=0,g.r$(T.L),T.L.length=0;T.N.ZD()}},lAW=function(T){if(T.i7==0)return T.h3; var Q=[];g.cm(Q,WdT(T.S));g.cm(Q,T.L);return Q},KdE=function(T,Q,k){var l=g.RZ(k); l.T!=""?(Q&&g.v0(l,Q+"."+l.T),g.LV(l,l.L)):(l=g.VC.location,l=MSe(l.protocol,Q?Q+"."+l.hostname:l.hostname,+l.port,k));Q=T.i9;k=T.vn;Q&&k&&g.Uz(l,Q,k);g.Uz(l,"VER",T.CE);nz(T,l);return l},zYT=function(T,Q,k){if(Q&&!T.sK)throw Error("Can't create secondary domain capable XhrIo object."); Q=T.YP&&!T.Ah?new g.Jd(new g.Tm({yc:k})):new g.Jd(T.Ah);Q.C=T.sK;return Q},on$=function(){},vne=function(){},xU=function(T,Q){g.fL.call(this); this.T=new Fdm(Q);this.N=T;this.S=Q&&Q.omH||null;T=Q&&Q.cj9||null;Q&&Q.p5K&&(T?T["X-Client-Protocol"]="webchannel":T={"X-Client-Protocol":"webchannel"});this.T.D=T;T=Q&&Q.I_K||null;Q&&Q.iO&&(T?T["X-WebChannel-Content-Type"]=Q.iO:T={"X-WebChannel-Content-Type":Q.iO});Q&&Q.gB&&(T?T["X-WebChannel-Client-Profile"]=Q.gB:T={"X-WebChannel-Client-Profile":Q.gB});this.T.QR=T;(T=Q&&Q.bSe)&&!g.bB(T)&&(this.T.C=T);this.B=Q&&Q.m_j||!1;this.Y=Q&&Q.uxk||!1;(Q=Q&&Q.qQ)&&!g.bB(Q)&&(this.T.i9=Q,g.MM(this.S,Q)&&(T= this.S,Q in T&&delete T[Q]));this.L=new Kz(this)},LpJ=function(T){ZY_.call(this); T.__headers__&&(this.headers=T.__headers__,this.statusCode=T.__status__,delete T.__headers__,delete T.__status__);var Q=T.__sm__;Q?this.data=(this.T=g.kZ(Q))?g.ZW(Q,this.T):Q:this.data=T},qY9=function(T){fkA.call(this); this.status=1;this.errorCode=T},Kz=function(T){this.T=T},gnm=function(T,Q){this.S=T; this.T=Q},Moe=function(T){return lAW(T.T).map(function(Q){var k=T.S; Q=Q.map;"__data__"in Q?(Q=Q.__data__,k=k.Y?jUA(Q):Q):k=Q;return k})},Po=function(T,Q){if(typeof T!=="function")throw Error("Fn must not be null and must be a function"); return g.VC.setTimeout(function(){T()},Q)},th=function(T){Ho.dispatchEvent(new YY$(Ho,T))},YY$=function(T){g.Jz.call(this,"statevent",T)},O1=function(T,Q,k,l){this.T=T; this.Y=Q;this.C=k;this.B=l||1;this.S=45E3;this.L=new g.mo(this);this.N=new g.x3;this.N.setInterval(250)},RpA=function(T,Q,k){T.Mi=1; T.sR=QL(Q.clone());T.s2=k;T.i9=!0;UhJ(T,null)},ZMJ=function(T,Q,k,l,v){T.Mi=1; T.sR=QL(Q.clone());T.s2=null;T.i9=k;v&&(T.UZ=!1);UhJ(T,l)},UhJ=function(T,Q){T.rq=Date.now(); fAW(T);T.ac=T.sR.clone();jd(T.ac,"t",T.B);T.y9=0;T.j1=T.T.cq(T.T.JQ()?Q:null);T.TL>0&&(T.D5=new g.Vq((0,g.Mp)(T.Iv,T,T.j1),T.TL));T.L.listen(T.j1,"readystatechange",T.jc);Q=T.V$?g.Gs(T.V$):{};T.s2?(T.HK="POST",Q["Content-Type"]="application/x-www-form-urlencoded",T.j1.send(T.ac,T.HK,T.s2,Q)):(T.HK="GET",T.UZ&&!g.Y1&&(Q.Connection="close"),T.j1.send(T.ac,T.HK,null,Q));T.T.TR(1)},IAd=function(T,Q){var k=T.y9,l=Q.indexOf("\n",k); if(l==-1)return GBv;k=Number(Q.substring(k,l));if(isNaN(k))return mhA;l+=1;if(l+k>Q.length)return GBv;Q=Q.slice(l,l+k);T.y9=l+k;return Q},fAW=function(T){T.S8=Date.now()+T.S; hp9(T,T.S)},hp9=function(T,Q){if(T.Oc!=null)throw Error("WatchDog timer not null"); T.Oc=Po((0,g.Mp)(T.AE,T),Q)},spA=function(T){T.Oc&&(g.VC.clearTimeout(T.Oc),T.Oc=null)},SYA=function(T){T.T.FG()||T.Ch||T.T.Qn(T)},pz=function(T){spA(T); g.od(T.D5);T.D5=null;T.N.stop();T.L.removeAll();if(T.j1){var Q=T.j1;T.j1=null;Q.abort();Q.dispose()}T.w1&&(T.w1=null)},Cnp=function(T,Q){try{T.T.KE(T,Q),T.T.TR(4)}catch(k){}},zpT=function(T,Q,k,l,v){if(l==0)k(!1); else{var L=v||0;l--;BmJ(T,Q,function(q){q?k(!0):g.VC.setTimeout(function(){zpT(T,Q,k,l,L)},L)})}},BmJ=function(T,Q,k){var l=new Image; l.onload=function(){try{Wo(l),k(!0)}catch(v){}}; l.onerror=function(){try{Wo(l),k(!1)}catch(v){}}; l.onabort=function(){try{Wo(l),k(!1)}catch(v){}}; l.ontimeout=function(){try{Wo(l),k(!1)}catch(v){}}; g.VC.setTimeout(function(){if(l.ontimeout)l.ontimeout()},Q); l.src=T},Wo=function(T){T.onload=null; T.onerror=null;T.onabort=null;T.ontimeout=null},XeJ=function(T){this.T=T; this.S=new Sd},weA=function(T){var Q=$U(T.T,T.Nq,"/mail/images/cleardot.gif"); QL(Q);zpT(Q.toString(),5E3,(0,g.Mp)(T.qX,T),3,2E3);T.TR(1)},dhm=function(T){var Q=T.T.B; Q!=null?(th(5),Q?(th(11),Jh(T.T,T,!1)):(th(12),Jh(T.T,T,!0))):(T.Bc=new O1(T),T.Bc.V$=T.EJ,Q=T.T,Q=$U(Q,Q.JQ()?T.zJ:null,T.h$),th(5),jd(Q,"TYPE","xmlhttp"),ZMJ(T.Bc,Q,!1,T.zJ,!1))},NmW=function(T,Q,k){this.T=1; this.S=[];this.L=[];this.N=new Sd;this.D=T||null;this.B=Q!=null?Q:null;this.j=k||!1},AFm=function(T,Q){this.T=T; this.map=Q;this.context=null},bM$=function(T,Q,k,l){g.Jz.call(this,"timingevent",T); this.size=Q;this.rtt=k;this.retries=l},rFW=function(T){g.Jz.call(this,"serverreachability",T)},DhW=function(T){T.bb(1,0); T.q4=$U(T,null,T.Ff);cFm(T)},aAA=function(T){T.YV&&(T.YV.abort(),T.YV=null); T.Rn&&(T.Rn.cancel(),T.Rn=null);T.Yu&&(g.VC.clearTimeout(T.Yu),T.Yu=null);ed(T);T.Zz&&(T.Zz.cancel(),T.Zz=null);T.Mk&&(g.VC.clearTimeout(T.Mk),T.Mk=null)},uYW=function(T,Q){if(T.T==0)throw Error("Invalid operation: sending map when state is closed"); T.S.push(new AFm(T.Iu++,Q));T.T!=2&&T.T!=3||cFm(T)},nn1=function(T){var Q=0; T.Rn&&Q++;T.Zz&&Q++;return Q},cFm=function(T){T.Zz||T.Mk||(T.Mk=Po((0,g.Mp)(T.pE,T),0),T.fR=0)},Pn1=function(T,Q){if(T.T==1){if(!Q){T.AQ=Math.floor(Math.random()*1E5); Q=T.AQ++;var k=new O1(T,"",Q);k.V$=T.Fu;var l=KpT(T),v=T.q4.clone();g.Uz(v,"RID",Q);g.Uz(v,"CVER","1");Fm(T,v);RpA(k,v,l);T.Zz=k;T.T=2}}else T.T==3&&(Q?xhv(T,Q):T.S.length==0||T.Zz||xhv(T))},xhv=function(T,Q){if(Q)if(T.C5>6){T.S=T.L.concat(T.S); T.L.length=0;var k=T.AQ-1;Q=KpT(T)}else k=Q.C,Q=Q.s2;else k=T.AQ++,Q=KpT(T);var l=T.q4.clone();g.Uz(l,"SID",T.Y);g.Uz(l,"RID",k);g.Uz(l,"AID",T.DA);Fm(T,l);k=new O1(T,T.Y,k,T.fR+1);k.V$=T.Fu;k.setTimeout(1E4+Math.round(1E4*Math.random()));T.Zz=k;RpA(k,l,Q)},Fm=function(T,Q){T.x_&&(T=T.x_.v_())&&g.VJ(T,function(k,l){g.Uz(Q,l,k)})},KpT=function(T){var Q=Math.min(T.S.length,1E3),k=["count="+Q]; if(T.C5>6&&Q>0){var l=T.S[0].T;k.push("ofs="+l)}else l=0;for(var v={},L=0;L=3)return!1; T.C++;T.Yu=Po((0,g.Mp)(T.nE,T),tom(T,T.vt));T.vt++;return!0},Jh=function(T,Q,k){T.bM=T.B==null?k:!T.B; T.sx=Q.F3;T.j||DhW(T)},ed=function(T){T.lR!=null&&(g.VC.clearTimeout(T.lR),T.lR=null)},tom=function(T,Q){var k=5E3+Math.floor(Math.random()*1E4); T.isActive()||(k*=2);return k*Q},E1=function(T,Q){if(Q==2||Q==9){var k=null; T.x_&&(k=null);var l=(0,g.Mp)(T.Roe,T);k||(k=new g.lN("//www.google.com/images/cleardot.gif"),QL(k));BmJ(k.toString(),1E4,l)}else th(2);peA(T,Q)},peA=function(T,Q){T.T=0; T.x_&&T.x_.uE(Q);WpW(T);aAA(T)},WpW=function(T){T.T=0; T.sx=-1;if(T.x_)if(T.L.length==0&&T.S.length==0)T.x_.Yi();else{var Q=g.r$(T.L),k=g.r$(T.S);T.L.length=0;T.S.length=0;T.x_.Yi(Q,k)}},$U=function(T,Q,k){var l=g.RZ(k); if(l.T!="")Q&&g.v0(l,Q+"."+l.T),g.LV(l,l.L);else{var v=window.location;l=MSe(v.protocol,Q?Q+"."+v.hostname:v.hostname,+v.port,k)}T.ZM&&g.VJ(T.ZM,function(L,q){g.Uz(l,q,L)}); g.Uz(l,"VER",T.C5);Fm(T,l);return l},$hd=function(){},JFm=function(){this.T=[]; this.S=[]},epm=function(T){g.Jz.call(this,"channelMessage"); this.message=T},Fpd=function(T){g.Jz.call(this,"channelError"); this.error=T},EnE=function(T,Q){this.action=T; this.params=Q||{}},yL=function(T,Q){g.x.call(this); this.T=new g.FA(this.oMB,0,this);g.P(this,this.T);this.d8=5E3;this.S=0;if(typeof T==="function")Q&&(T=(0,g.Mp)(T,Q));else if(T&&typeof T.handleEvent==="function")T=(0,g.Mp)(T.handleEvent,T);else throw Error("Invalid listener argument");this.L=T},yFm=function(T,Q,k,l,v,L,q,Y,U,R,Z,f,G,m){k=k===void 0?!1:k; l=l===void 0?function(){return""}:l; v=v===void 0?!1:v;L=L===void 0?!1:L;q=q===void 0?!1:q;Y=Y===void 0?function(){return g.DT({})}:Y; U=U===void 0?!1:U;Z=Z===void 0?!1:Z;f=f===void 0?!1:f;G=G===void 0?!1:G;m=m===void 0?!1:m;this.sK=T;this.z9=Q;this.B=new g.XE;this.S=new yL(this.wk_,this);this.T=null;this.C=!1;this.D=null;this.hj="";this.qO=this.j=0;this.L=[];this.d5=k;this.i9=l;this.N=L;this.Bd=Y;this.e6=R;this.Gg=q;this.xm=null;this.Y=g.DT();this.Ig=v;this.h3=U;this.Tg=Z;this.zg=f;this.OG=G;this.QR=m;this.K_=new kOp;this.Jj=new lqW;this.f_=new v5p;this.u9=new o5A;this.p_=new L6e;this.DP=new qGA;this.Fk=new g5d},T7v=function(T, Q,k,l,v){iMW(T); if(T.T){var L=g.$i("ID_TOKEN"),q=T.T.Fu||{};L?q["x-youtube-identity-token"]=L:delete q["x-youtube-identity-token"];T.T.Fu=q}Vo9(T);l?(l.getState()!=3&&nn1(l)==0||l.getState(),T.T.connect(Q,k,T.z9,l.Y,l.DA)):v?T.T.connect(Q,k,T.z9,v.sessionId,v.arrayId):T.T.connect(Q,k,T.z9)},l2J=function(T,Q){return T.OG?!0:T.zg?Object.values(QKW).includes(Q):T.Tg?!Object.values(jK1).includes(Q):T.QR?Object.values(kP$).includes(Q):!1},L4m=function(T){var Q,k; g.a(function(l){if(l.S==1)return g.Xg(l,2),g.c(l,or$(T),2);g.aI(l);Q=T.L;T.L=[];k=Q.length;vr9(T,Q,k);i9(T);return g.n5(l,0)})},vr9=function(T,Q,k){for(var l=0;l0?k=Object.assign({},k,Q):delete k.Authorization;T.T.Fu=k}},Vo9=function(T){T.e6&&!T.N&&gr_(T,T.e6())},VL=function(T){this.scheme="https"; this.port=this.domain="";this.T="/api/lounge";this.S=!0;T=T||document.location.href;var Q=Number(g.UD(T)[4]||null)||"";Q&&(this.port=":"+Q);this.domain=g.Rq(T)||"";T=g.KJ();T.search("MSIE")>=0&&(T=T.match(/MSIE ([\d.]+)/)[1],g.nJ(T,"10.0")<0&&(this.S=!1))},TM=function(T,Q){var k=T.T; T.S&&(k=T.scheme+"://"+T.domain+T.port+T.T);return g.sD(k+Q,{})},MzT=function(T,Q){g.fL.call(this); var k=this;this.Qp=T();this.Qp.subscribe("handlerOpened",this.Gy,this);this.Qp.subscribe("handlerClosed",this.onClosed,this);this.Qp.subscribe("handlerError",function(l,v){k.onError(v)}); this.Qp.subscribe("handlerMessage",this.onMessage,this);this.T=Q},YSv=function(T,Q,k){var l=this; k=k===void 0?function(){return""}:k; var v=v===void 0?new vne:v;var L=L===void 0?new g.XE:L;this.pathPrefix=T;this.T=Q;this.hj=k;this.N=L;this.j=null;this.D=this.C=0;this.channel=null;this.B=0;this.L=new yL(function(){l.L.isActive();var q;((q=l.channel)==null?void 0:u4v((new gnm(q,q.T)).T.S))===0&&l.connect(l.j,l.C)}); this.Y={};this.S={};this.z9=!1;this.logger=null;this.qO=[];this.W1=void 0;this.Bd=new kOp;this.xm=new lqW;this.e6=new o5A;this.i9=new L6e},UUv=function(T){g.Qu(T.channel,"m",function(){T.B=3; T.L.reset();T.j=null;T.C=0;for(var Q=g.B(T.qO),k=Q.next();!k.done;k=Q.next())k=k.value,T.channel&&T.channel.send(k);T.qO=[];T.publish("webChannelOpened");T.Bd.ML("WEB_CHANNEL")}); g.Qu(T.channel,"n",function(){T.B=0;T.L.isActive()||T.publish("webChannelClosed");var Q,k=(Q=T.channel)==null?void 0:Moe(new gnm(Q,Q.T));k&&(T.qO=[].concat(g.ZH(k)));T.xm.ML("WEB_CHANNEL")}); g.Qu(T.channel,"p",function(Q){var k=Q.data;k[0]==="gracefulReconnect"?(T.L.start(),T.channel&&T.channel.close()):T.publish("webChannelMessage",new EnE(k[0],k[1]));T.W1=Q.statusCode;T.e6.ML("WEB_CHANNEL")}); g.Qu(T.channel,"o",function(){T.W1===401||T.L.start();T.publish("webChannelError");T.i9.ML("WEB_CHANNEL","")})},RA9=function(T){var Q=T.hj(); Q?T.Y["x-youtube-lounge-xsrf-token"]=Q:delete T.Y["x-youtube-lounge-xsrf-token"]},Zjd=function(T){g.fL.call(this); this.T=T();this.T.subscribe("webChannelOpened",this.PE,this);this.T.subscribe("webChannelClosed",this.onClosed,this);this.T.subscribe("webChannelError",this.onError,this);this.T.subscribe("webChannelMessage",this.onMessage,this)},f2J=function(T,Q,k,l,v){function L(){return new yFm(TM(T,"/bc"),Q,!1,k,l)} k=k===void 0?function(){return""}:k; return g.hH("enable_mdx_web_channel_desktop")?new Zjd(function(){return new YSv(TM(T,"/wc"),Q,k)}):new MzT(L,v)},hAp=function(){var T=GPe; mUA();QF.push(T);I2m()},jR=function(T,Q){mUA(); var k=sKT(T,String(Q));QF.length==0?SSd(k):(I2m(),g.EA(QF,function(l){l(k)}))},ko=function(T){jR("CP",T)},mUA=function(){QF||(QF=g.jA("yt.mdx.remote.debug.handlers_")||[],g.Tv("yt.mdx.remote.debug.handlers_",QF))},SSd=function(T){var Q=(lR+1)%50; lR=Q;oe[Q]=T;vF||(vF=Q==49)},I2m=function(){var T=QF; if(oe[0]){var Q=vF?lR:-1,k={};do k={D7:void 0},Q=(Q+1)%50,k.D7=oe[Q],g.EA(T,function(l){return function(v){v(l.D7)}}(k)); while(Q!=lR);oe=Array(50);lR=-1;vF=!1}},sKT=function(T,Q){var k=(Date.now()-CMW)/1E3; k.toFixed&&(k=k.toFixed(3));var l=[];l.push("[",k+"s","] ");l.push("[","yt.mdx.remote","] ");l.push(T+": "+Q,"\n");return l.join("")},LK=function(T){g.ox.call(this); this.B=T;this.screens=[]},B7v=function(T,Q){var k=T.get(Q.uuid)||T.get(Q.id); if(k)return T=k.name,k.id=Q.id||k.id,k.name=Q.name,k.token=Q.token,k.uuid=Q.uuid||k.uuid,k.name!=T;T.screens.push(Q);return!0},zAE=function(T,Q){var k=T.screens.length!=Q.length; T.screens=g.bl(T.screens,function(L){return!!Oh$(Q,L)}); for(var l=Q.length,v=0;v0&&T.Y0&&sb(T,k)},function(Q){T.N=function(){}; T.q1(Q)})},T1m=function(T){var Q={}; Q.pairingCode=T.xm;Q.theme=T.sK;TiE()&&(Q.env_useStageMdx=1);return g.h3(Q)},Q$E=function(T){return new Promise(function(Q){T.xm=HhA(); if(T.Bd){var k=new chrome.cast.DialLaunchResponse(!0,T1m(T));Q(k);Vz9(T)}else T.z9=function(){g.GO(T.D);T.z9=function(){}; T.D=NaN;var l=new chrome.cast.DialLaunchResponse(!0,T1m(T));Q(l);Vz9(T)},T.D=g.Zq(function(){T.z9()},100)})},kA$=function(T,Q,k){T.info("initOnConnectedScreenDataPromise_: Received screenData: "+JSON.stringify(Q)); var l=new ge(Q);return(new Promise(function(v){j$W(T,l,function(L){L?(T.qO=!0,Re(T.Y,l),fK(T,l),sb(T,k)):g.FH(Error("DialSession, RemoteScreen from screenData: "+JSON.stringify(Q)+" is not online."));v(L)},5)})).then(function(v){return v?new chrome.cast.DialLaunchResponse(!1):Q$E(T)})},lZT=function(T,Q){var k=T.j.receiver.label,l=T.S.friendlyName; return(new Promise(function(v){nr_(T.Y,k,Q,l,function(L){L&&L.token&&fK(T,L);v(L)},function(L){GM(T,"Failed to get DIAL screen: "+L); v(null)})})).then(function(v){return v&&v.token?new chrome.cast.DialLaunchResponse(!1):Q$E(T)})},j$W=function(T,Q,k,l){g.GO(T.B); T.B=0;xUJ(T.Y,Q,function(v){v||l<0?k(v):T.B=g.Zq(function(){j$W(T,Q,k,l-1)},300)})},sb=function(T,Q){T.info("getDialAppInfoWithTimeout_ "+Q); hR(T)&&(g.GO(T.C),T.C=0,Q==0?o_d(T):T.C=g.Zq(function(){o_d(T)},Q))},o_d=function(T){hR(T)&&T.L.getDialAppInfo(function(Q){T.info("getDialAppInfo dialLaunchData: "+JSON.stringify(Q)); Q=Q.extraData||{};var k=null;if(Q.loungeToken){var l;((l=T.T)==null?void 0:l.token)==Q.loungeToken&&(k="staleLoungeToken")}else k="missingLoungeToken";k?(T.hj=k,sb(T,3E4)):(T.qO=!1,T.hj="unknown",OjT(T,Q.loungeToken),sb(T,Q.loungeTokenRefreshIntervalMs))},function(Q){T.info("getDialAppInfo error: "+Q); T.hj="noLoungeTokenResponse";sb(T,3E4)})},v_1=function(T){g.GO(T.B); T.B=0;g.GO(T.C);T.C=0;T.N();T.N=function(){}; g.GO(T.D)},SR=function(T,Q){Zu.call(this,T,Q,"ManualSession"); this.L=g.Zq((0,g.Mp)(this.Zl,this,null),150)},CK=function(T,Q){g.ox.call(this); this.config_=Q;this.S=T;this.j=Q.appId||"233637DE";this.Y=Q.theme||"cl";this.D=Q.disableCastApi||!1;this.B=Q.forceMirroring||!1;this.T=null;this.C=!1;this.L=[];this.N=(0,g.Mp)(this.Nnj,this)},LbA=function(T,Q){return Q?g.sA(T.L,function(k){return Mb(Q,k.label)},T):null},BF=function(T){jR("Controller",T)},GPe=function(T){window.chrome&&chrome.cast&&chrome.cast.logMessage&&chrome.cast.logMessage(T)},zM=function(T){return T.C||!!T.L.length||!!T.T},XF=function(T,Q,k){Q!=T.T&&(g.od(T.T),(T.T=Q)?(k?T.publish("yt-remote-cast2-receiver-resumed", Q.S):T.publish("yt-remote-cast2-receiver-selected",Q.S),Q.subscribe("sessionScreen",(0,g.Mp)(T.k8,T,Q)),Q.subscribe("sessionFailed",function(){return qqm(T,Q)}),Q.T?T.publish("yt-remote-cast2-session-change",Q.T):k&&T.T.Zl(null)):T.publish("yt-remote-cast2-session-change",null))},qqm=function(T,Q){T.T==Q&&T.publish("yt-remote-cast2-session-failed")},g_d=function(T){var Q=T.S.fE(),k=T.T&&T.T.S; T=g.IQ(Q,function(l){k&&Mb(l,k.label)&&(k=null);var v=l.uuid?l.uuid:l.id,L=LbA(this,l);L?(L.label=v,L.friendlyName=l.name):(L=new chrome.cast.Receiver(v,l.name),L.receiverType=chrome.cast.ReceiverType.CUSTOM);return L},T); k&&(k.receiverType!=chrome.cast.ReceiverType.CUSTOM&&(k=new chrome.cast.Receiver(k.label,k.friendlyName),k.receiverType=chrome.cast.ReceiverType.CUSTOM),T.push(k));return T},mEA=function(T,Q,k,l){l.disableCastApi?wZ("Cannot initialize because disabled by Mdx config."):MVd()?YqJ(Q,l)&&(UEA(!0),window.chrome&&chrome.cast&&chrome.cast.isAvailable?RZd(T,k):(window.__onGCastApiAvailable=function(v,L){v?RZd(T,k):(dZ("Failed to load cast API: "+L),ZZ$(!1),UEA(!1),g.Dk("yt-remote-cast-available"),g.Dk("yt-remote-cast-receiver"), fZv(),k(!1))},l.loadCastApiSetupScript?g.LZ(GA9):window.navigator.userAgent.indexOf("Android")>=0&&window.navigator.userAgent.indexOf("Chrome/")>=0&&window.navigator.presentation?j1T()>=60&&Yr$():!window.chrome||!window.navigator.presentation||window.navigator.userAgent.indexOf("Edge")>=0?vqW():j1T()>=89?RYA():(MG9(),hh(U5m.map(LdW))))):wZ("Cannot initialize because not running Chrome")},fZv=function(){wZ("dispose"); var T=NG();T&&T.dispose();g.Tv("yt.mdx.remote.cloudview.instance_",null);IZv(!1);g.o$(hZ$);hZ$.length=0},AR=function(){return!!g.cy("yt-remote-cast-installed")},s$E=function(){var T=g.cy("yt-remote-cast-receiver"); return T?T.friendlyName:null},Sqe=function(){wZ("clearCurrentReceiver"); g.Dk("yt-remote-cast-receiver")},CvW=function(){return AR()?NG()?NG().getCastSession():(dZ("getCastSelector: Cast is not initialized."),null):(dZ("getCastSelector: Cast API is not installed!"),null)},B1E=function(){AR()?NG()?bR()?(wZ("Requesting cast selector."),NG().requestSession()):(wZ("Wait for cast API to be ready to request the session."),hZ$.push(g.TA("yt-remote-cast2-api-ready",B1E))):dZ("requestCastSelector: Cast is not initialized."):dZ("requestCastSelector: Cast API is not installed!")}, rZ=function(T,Q){bR()?NG().setConnectedScreenStatus(T,Q):dZ("setConnectedScreenStatus called before ready.")},MVd=function(){var T=g.KJ().search(/ (CrMo|Chrome|CriOS)\//)>=0; return g.hW||T},zZJ=function(T,Q){NG().init(T,Q)},YqJ=function(T,Q){var k=!1; NG()||(T=new CK(T,Q),T.subscribe("yt-remote-cast2-availability-change",function(l){g.ri("yt-remote-cast-available",l);mi("yt-remote-cast2-availability-change",l)}),T.subscribe("yt-remote-cast2-receiver-selected",function(l){wZ("onReceiverSelected: "+l.friendlyName); g.ri("yt-remote-cast-receiver",l);mi("yt-remote-cast2-receiver-selected",l)}),T.subscribe("yt-remote-cast2-receiver-resumed",function(l){wZ("onReceiverResumed: "+l.friendlyName); g.ri("yt-remote-cast-receiver",l);mi("yt-remote-cast2-receiver-resumed",l)}),T.subscribe("yt-remote-cast2-session-change",function(l){wZ("onSessionChange: "+YU(l)); l||g.Dk("yt-remote-cast-receiver");mi("yt-remote-cast2-session-change",l)}),g.Tv("yt.mdx.remote.cloudview.instance_",T),k=!0); wZ("cloudview.createSingleton_: "+k);return k},NG=function(){return g.jA("yt.mdx.remote.cloudview.instance_")},RZd=function(T,Q){ZZ$(!0); UEA(!1);zZJ(T,function(k){k?(IZv(!0),g.vd("yt-remote-cast2-api-ready")):(dZ("Failed to initialize cast API."),ZZ$(!1),g.Dk("yt-remote-cast-available"),g.Dk("yt-remote-cast-receiver"),fZv());Q(k)})},wZ=function(T){jR("cloudview",T)},dZ=function(T){jR("cloudview",T)},ZZ$=function(T){wZ("setCastInstalled_ "+T); g.ri("yt-remote-cast-installed",T)},bR=function(){return!!g.jA("yt.mdx.remote.cloudview.apiReady_")},IZv=function(T){wZ("setApiReady_ "+T); g.Tv("yt.mdx.remote.cloudview.apiReady_",T)},UEA=function(T){g.Tv("yt.mdx.remote.cloudview.initializing_",T)},cF=function(T){this.index=-1; this.videoId=this.listId="";this.volume=this.playerState=-1;this.muted=!1;this.audioTrackId=null;this.N=this.B=0;this.trackData=null;this.G0=this.E_=!1;this.j=this.L=this.C=this.S=0;this.T=NaN;this.Y=!1;this.reset(T)},XdE=function(T){T.audioTrackId=null; T.trackData=null;T.playerState=-1;T.E_=!1;T.G0=!1;T.B=0;T.N=g.R_();T.S=0;T.C=0;T.L=0;T.j=0;T.T=NaN;T.Y=!1},Du=function(T){return T.isPlaying()?(g.R_()-T.N)/1E3:0},ae=function(T,Q){T.B=Q; T.N=g.R_()},uR=function(T){switch(T.playerState){case 1:case 1081:return(g.R_()-T.N)/1E3+T.B; case -1E3:return 0}return T.B},wd1=function(T){return T.Y?T.C+Du(T):T.C},nK=function(T,Q,k){var l=T.videoId; T.videoId=Q;T.index=k;Q!=l&&XdE(T)},dEE=function(T){var Q={}; Q.index=T.index;Q.listId=T.listId;Q.videoId=T.videoId;Q.playerState=T.playerState;Q.volume=T.volume;Q.muted=T.muted;Q.audioTrackId=T.audioTrackId;Q.trackData=g.my(T.trackData);Q.hasPrevious=T.E_;Q.hasNext=T.G0;Q.playerTime=T.B;Q.playerTimeAt=T.N;Q.seekableStart=T.S;Q.seekableEnd=T.C;Q.duration=T.L;Q.loadedTime=T.j;Q.liveIngestionTime=T.T;return Q},xo=function(T,Q){g.ox.call(this); var k=this;this.L=0;this.Y=T;this.B=[];this.N=new JFm;this.S=this.T=null;this.D=(0,g.Mp)(this.Kek,this);this.C=(0,g.Mp)(this.pO,this);this.j=(0,g.Mp)(this.IVK,this);this.z9=(0,g.Mp)(this.P96,this);var l=0;T?(l=T.getProxyState(),l!=3&&(T.subscribe("proxyStateChange",this.PW,this),N1v(this))):l=3;l!=0&&(Q?this.PW(l):g.Zq(function(){k.PW(l)},0)); (T=CvW())&&KK(this,T);this.subscribe("yt-remote-cast2-session-change",this.z9)},PF=function(T){return new cF(T.Y.getPlayerContextData())},N1v=function(T){g.EA("nowAutoplaying autoplayDismissed remotePlayerChange remoteQueueChange autoplayModeChange autoplayUpNext previousNextChange multiStateLoopEnabled loopModeChange".split(" "),function(Q){this.B.push(this.Y.subscribe(Q,g.YE(this.U2O,Q),this))},T)},Au9=function(T){g.EA(T.B,function(Q){this.Y.unsubscribeByKey(Q)},T); T.B.length=0},HF=function(T){return T.getState()==1},tR=function(T,Q){var k=T.N; k.T.length+k.S.length<50&&T.N.enqueue(Q)},bZA=function(T,Q,k){var l=PF(T); ae(l,k);l.playerState!=-1E3&&(l.playerState=Q);Ob(T,l)},pK=function(T,Q,k){T.Y.sendMessage(Q,k)},Ob=function(T,Q){Au9(T); T.Y.setPlayerContextData(dEE(Q));N1v(T)},KK=function(T,Q){T.S&&(T.S.removeUpdateListener(T.D),T.S.removeMediaListener(T.C),T.pO(null)); T.S=Q;T.S&&(ko("Setting cast session: "+T.S.sessionId),T.S.addUpdateListener(T.D),T.S.addMediaListener(T.C),T.S.media.length&&T.pO(T.S.media[0]))},rup=function(T){var Q=T.T.media,k=T.T.customData; if(Q&&k){var l=PF(T);Q.contentId!=l.videoId&&ko("Cast changing video to: "+Q.contentId);l.videoId=Q.contentId;l.playerState=k.playerState;ae(l,T.T.getEstimatedTime());Ob(T,l)}else ko("No cast media video. Ignoring state update.")},WF=function(T,Q,k){return(0,g.Mp)(function(l){this.ww("Failed to "+Q+" with cast v2 channel. Error code: "+l.code); l.code!=chrome.cast.ErrorCode.TIMEOUT&&(this.ww("Retrying "+Q+" using MDx browser channel."),pK(this,Q,k))},T)},eR=function(T,Q,k,l){l=l===void 0?!1:l; g.ox.call(this);var v=this;this.B=NaN;this.xm=!1;this.D=this.j=this.qO=this.hj=NaN;this.z9=[];this.N=this.C=this.Y=this.T=this.S=null;this.Bd=T;this.e6=l;this.z9.push(g.SG(window,"beforeunload",function(){v.Cw(2)})); this.L=[];this.T=new cF;this.sK=Q.id;this.i9=Q.idType;this.S=f2J(this.Bd,k,this.zn,this.i9=="shortLived",this.sK);this.S.listen("channelOpened",function(){cuW(v)}); this.S.listen("channelClosed",function(){$o("Channel closed");isNaN(v.B)?fz(!0):fz();v.dispose()}); this.S.listen("channelError",function(L){fz();isNaN(v.CP())?(L==1&&v.i9=="shortLived"&&v.publish("browserChannelAuthError",L),$o("Channel error: "+L+" without reconnection"),v.dispose()):(v.xm=!0,$o("Channel error: "+L+" with reconnection in "+v.CP()+" ms"),JR(v,2))}); this.S.listen("channelMessage",function(L){DEW(v,L)}); this.S.Ca(Q.token);this.subscribe("remoteQueueChange",function(){var L=v.T.videoId;g.a1()&&g.ri("yt-remote-session-video-id",L)})},aZW=function(T){return g.sA(T.L,function(Q){return Q.type=="LOUNGE_SCREEN"})},$o=function(T){jR("conn",T)},JR=function(T,Q){T.publish("proxyStateChange",Q)},urJ=function(T){T.B=g.Zq(function(){$o("Connecting timeout"); T.Cw(1)},2E4)},n_J=function(T){g.GO(T.B); T.B=NaN},KbA=function(T){g.GO(T.hj); T.hj=NaN},Pve=function(T){xEA(T); T.qO=g.Zq(function(){FF(T,"getNowPlaying")},2E4)},xEA=function(T){g.GO(T.qO); T.qO=NaN},cuW=function(T){$o("Channel opened"); T.xm&&(T.xm=!1,KbA(T),T.hj=g.Zq(function(){$o("Timing out waiting for a screen.");T.Cw(1)},15E3))},tVe=function(T,Q){var k=null; if(Q){var l=aZW(T);l&&(k={clientName:l.clientName,deviceMake:l.brand,deviceModel:l.model,osVersion:l.osVersion})}g.Tv("yt.mdx.remote.remoteClient_",k);Q&&(n_J(T),KbA(T));k=T.S.zM()&&isNaN(T.B);Q==k?Q&&(JR(T,1),FF(T,"getSubtitlesTrack")):Q?(T.X6()&&T.T.reset(),JR(T,1),FF(T,"getNowPlaying"),HZd(T)):T.Cw(1)},OZJ=function(T,Q){var k=Q.params.videoId; delete Q.params.videoId;k==T.T.videoId&&(g.Rs(Q.params)?T.T.trackData=null:T.T.trackData=Q.params,T.publish("remotePlayerChange"))},pdA=function(T,Q,k){var l=Q.params.videoId||Q.params.video_id,v=parseInt(Q.params.currentIndex,10); T.T.listId=Q.params.listId||T.T.listId;nK(T.T,l,v);T.publish("remoteQueueChange",k)},$EW=function(T,Q){Q.params=Q.params||{}; pdA(T,Q,"NOW_PLAYING_MAY_CHANGE");Wbe(T,Q);T.publish("autoplayDismissed")},Wbe=function(T,Q){var k=parseInt(Q.params.currentTime||Q.params.current_time,10); ae(T.T,isNaN(k)?0:k);k=parseInt(Q.params.state,10);k=isNaN(k)?-1:k;k==-1&&T.T.playerState==-1E3&&(k=-1E3);T.T.playerState=k;k=Number(Q.params.loadedTime);T.T.j=isNaN(k)?0:k;T.T.SR(Number(Q.params.duration));k=T.T;var l=Number(Q.params.liveIngestionTime);k.T=l;k.Y=isNaN(l)?!1:!0;k=T.T;l=Number(Q.params.seekableStartTime);Q=Number(Q.params.seekableEndTime);k.S=isNaN(l)?0:l;k.C=isNaN(Q)?0:Q;T.T.playerState==1?Pve(T):xEA(T);T.publish("remotePlayerChange")},JuW=function(T,Q){if(T.T.playerState!=-1E3){var k= 1085; switch(parseInt(Q.params.adState,10)){case 1:k=1081;break;case 2:k=1084;break;case 0:k=1083}T.T.playerState=k;Q=parseInt(Q.params.currentTime,10);ae(T.T,isNaN(Q)?0:Q);T.publish("remotePlayerChange")}},eZW=function(T,Q){var k=Q.params.muted=="true"; T.T.volume=parseInt(Q.params.volume,10);T.T.muted=k;T.publish("remotePlayerChange")},Fbv=function(T,Q){T.C=Q.params.videoId; T.publish("nowAutoplaying",parseInt(Q.params.timeout,10))},E_A=function(T,Q){T.C=Q.params.videoId||null; T.publish("autoplayUpNext",T.C)},yuT=function(T,Q){T.N=Q.params.autoplayMode; T.publish("autoplayModeChange",T.N);T.N=="DISABLED"&&T.publish("autoplayDismissed")},iZW=function(T,Q){var k=Q.params.hasNext=="true"; T.T.E_=Q.params.hasPrevious=="true";T.T.G0=k;T.publish("previousNextChange")},DEW=function(T,Q){Q=Q.message; Q.params?$o("Received: action="+Q.action+", params="+g.pL(Q.params)):$o("Received: action="+Q.action+" {}");switch(Q.action){case "loungeStatus":Q=kU(Q.params.devices);T.L=g.IQ(Q,function(l){return new qb(l)}); Q=!!g.sA(T.L,function(l){return l.type=="LOUNGE_SCREEN"}); tVe(T,Q);Q=T.Nj("mlm");T.publish("multiStateLoopEnabled",Q);break;case "loungeScreenDisconnected":g.AT(T.L,function(l){return l.type=="LOUNGE_SCREEN"}); tVe(T,!1);break;case "remoteConnected":var k=new qb(kU(Q.params.device));g.sA(T.L,function(l){return l.equals(k)})||VmW(T.L,k); break;case "remoteDisconnected":k=new qb(kU(Q.params.device));g.AT(T.L,function(l){return l.equals(k)}); break;case "gracefulDisconnect":break;case "playlistModified":pdA(T,Q,"QUEUE_MODIFIED");break;case "nowPlaying":$EW(T,Q);break;case "onStateChange":Wbe(T,Q);break;case "onAdStateChange":JuW(T,Q);break;case "onVolumeChanged":eZW(T,Q);break;case "onSubtitlesTrackChanged":OZJ(T,Q);break;case "nowAutoplaying":Fbv(T,Q);break;case "autoplayDismissed":T.publish("autoplayDismissed");break;case "autoplayUpNext":E_A(T,Q);break;case "onAutoplayModeChanged":yuT(T,Q);break;case "onHasPreviousNextChanged":iZW(T, Q);break;case "requestAssistedSignIn":T.publish("assistedSignInRequested",Q.params.authCode);break;case "onLoopModeChanged":T.publish("loopModeChange",Q.params.loopMode);break;default:$o("Unrecognized action: "+Q.action)}},HZd=function(T){g.GO(T.D); T.D=g.Zq(function(){T.Cw(1)},864E5)},FF=function(T,Q,k){k?$o("Sending: action="+Q+", params="+g.pL(k)):$o("Sending: action="+Q); T.S.sendMessage(Q,k)},VVd=function(T){LK.call(this,"ScreenServiceProxy"); this.Zf=T;this.T=[];this.T.push(this.Zf.$_s("screenChange",(0,g.Mp)(this.au,this)));this.T.push(this.Zf.$_s("onlineScreenChange",(0,g.Mp)(this.sgK,this)))},lh$=function(T,Q){VSd(); if(!Ga||!Ga.get("yt-remote-disable-remote-module-for-dev")){Q=g.$i("MDX_CONFIG")||Q;pDJ();eIW();Eb||(Eb=new VL(Q?Q.loungeApiHost:void 0),TiE()&&(Eb.T="/api/loungedev"));yF||(yF=g.jA("yt.mdx.remote.deferredProxies_")||[],g.Tv("yt.mdx.remote.deferredProxies_",yF));TBW();var k=iR();if(!k){var l=new Ub(Eb,Q?Q.disableAutomaticScreenCache||!1:!1);g.Tv("yt.mdx.remote.screenService_",l);k=iR();var v={};Q&&(v={appId:Q.appId,disableDial:Q.disableDial,theme:Q.theme,loadCastApiSetupScript:Q.loadCastApiSetupScript, disableCastApi:Q.disableCastApi,enableDialLoungeToken:Q.enableDialLoungeToken,enableCastLoungeToken:Q.enableCastLoungeToken,forceMirroring:Q.forceMirroring});g.Tv("yt.mdx.remote.enableConnectWithInitialState_",Q?Q.enableConnectWithInitialState||!1:!1);mEA(T,l,function(L){L?VF()&&rZ(VF(),"YouTube TV"):l.subscribe("onlineScreenChange",function(){mi("yt-remote-receiver-availability-change")})},v)}Q&&!g.jA("yt.mdx.remote.initialized_")&&(g.Tv("yt.mdx.remote.initialized_",!0),Ti("Initializing: "+g.pL(Q)), Qy.push(g.TA("yt-remote-cast2-api-ready",function(){mi("yt-remote-api-ready")})),Qy.push(g.TA("yt-remote-cast2-availability-change",function(){mi("yt-remote-receiver-availability-change")})),Qy.push(g.TA("yt-remote-cast2-receiver-selected",function(){j9(null); mi("yt-remote-auto-connect","cast-selector-receiver")})),Qy.push(g.TA("yt-remote-cast2-receiver-resumed",function(){mi("yt-remote-receiver-resumed","cast-selector-receiver")})),Qy.push(g.TA("yt-remote-cast2-session-change",QP9)),Qy.push(g.TA("yt-remote-connection-change",function(L){L?rZ(VF(),"YouTube TV"):kz()||(rZ(null,null),Sqe())})),Qy.push(g.TA("yt-remote-cast2-session-failed",function(){mi("yt-remote-connection-failed")})),T=jP_(),Q.isAuto&&(T.id+="#dial"),v=Q.capabilities||[],v.length>0&&(T.capabilities= v),T.name=Q.device,T.app=Q.app,(Q=Q.theme)&&(T.theme=Q),Ti(" -- with channel params: "+g.pL(T)),T?(g.ri("yt-remote-session-app",T.app),g.ri("yt-remote-session-name",T.name)):(g.Dk("yt-remote-session-app"),g.Dk("yt-remote-session-name")),g.Tv("yt.mdx.remote.channelParams_",T),k.start(),VF()||k$v())}},ouE=function(){var T=iR().Zf.$_gos(); var Q=l6();Q&&ok()&&(Oh$(T,Q)||T.push(Q));return tSE(T)},LAm=function(){var T=vue(); !T&&AR()&&s$E()&&(T={key:"cast-selector-receiver",name:s$E()});return T},vue=function(){var T=ouE(),Q=l6(); Q||(Q=kz());return g.sA(T,function(k){return Q&&Mb(Q,k.key)?!0:!1})},l6=function(){var T=VF(); if(!T)return null;var Q=iR().b5();return U1(Q,T)},QP9=function(T){Ti("remote.onCastSessionChange_: "+YU(T)); if(T){var Q=l6();if(Q&&Q.id==T.id){if(rZ(Q.id,"YouTube TV"),T.idType=="shortLived"&&(T=T.token))vY&&(vY.token=T),(Q=ok())&&Q.Ca(T)}else Q&&L4(),qk(T,1)}else ok()&&L4()},L4=function(){bR()?NG().stopSession():dZ("stopSession called before API ready."); var T=ok();T&&(T.disconnect(1),q2_(null))},gu_=function(){var T=ok(); return!!T&&T.getProxyState()!=3},Ti=function(T){jR("remote",T)},iR=function(){if(!MTW){var T=g.jA("yt.mdx.remote.screenService_"); MTW=T?new VVd(T):null}return MTW},VF=function(){return g.jA("yt.mdx.remote.currentScreenId_")},Y29=function(T){g.Tv("yt.mdx.remote.currentScreenId_",T)},U8m=function(){return g.jA("yt.mdx.remote.connectData_")},j9=function(T){g.Tv("yt.mdx.remote.connectData_",T)},ok=function(){return g.jA("yt.mdx.remote.connection_")},q2_=function(T){var Q=ok(); j9(null);T||Y29("");g.Tv("yt.mdx.remote.connection_",T);yF&&(g.EA(yF,function(k){k(T)}),yF.length=0); Q&&!T?mi("yt-remote-connection-change",!1):!Q&&T&&mi("yt-remote-connection-change",!0)},kz=function(){var T=g.a1(); if(!T)return null;var Q=iR();if(!Q)return null;Q=Q.b5();return U1(Q,T)},qk=function(T,Q){VF(); l6()&&l6();if(gP)vY=T;else{Y29(T.id);var k=g.jA("yt.mdx.remote.enableConnectWithInitialState_")||!1;T=new eR(Eb,T,jP_(),k);T.connect(Q,U8m());T.subscribe("beforeDisconnect",function(l){mi("yt-remote-before-disconnect",l)}); T.subscribe("beforeDispose",function(){ok()&&(ok(),q2_(null))}); T.subscribe("browserChannelAuthError",function(){var l=l6();l&&l.idType=="shortLived"&&(bR()?NG().handleBrowserChannelAuthError():dZ("refreshLoungeToken called before API ready."))}); q2_(T)}},k$v=function(){var T=kz(); T?(Ti("Resume connection to: "+YU(T)),qk(T,0)):(fz(),Sqe(),Ti("Skipping connecting because no session screen found."))},TBW=function(){var T=jP_(); if(g.Rs(T)){T=Za();var Q=g.cy("yt-remote-session-name")||"",k=g.cy("yt-remote-session-app")||"";T={device:"REMOTE_CONTROL",id:T,name:Q,app:k,mdxVersion:3};T.authuser=String(g.$i("SESSION_INDEX","0"));(Q=g.$i("DELEGATED_SESSION_ID"))&&(T.pageId=String(Q));g.Tv("yt.mdx.remote.channelParams_",T)}},jP_=function(){return g.jA("yt.mdx.remote.channelParams_")||{}},fhm=function(T,Q,k){g.x.call(this); var l=this;this.T=T;this.U=Q;this.SV=k;this.events=new g.Bj(this);this.N=!1;this.B=new g.Cd(64);this.S=new g.FA(this.Wu,500,this);this.L=new g.FA(this.OZ,1E3,this);this.j=new s1(this.Oi9,0,this);this.Y={};this.D=new g.FA(this.zd,1E3,this);this.C=new g.Vq(this.seekTo,1E3,this);this.z9=this.events.Z(this.U,"onVolumeChange",function(v){RUT(l,v)}); g.P(this,this.events);this.events.Z(Q,"onCaptionsTrackListChanged",this.YGm);this.events.Z(Q,"captionschanged",this.jkB);this.events.Z(Q,"captionssettingschanged",this.SW);this.events.Z(Q,"videoplayerreset",this.Hi);this.events.Z(Q,"mdxautoplaycancel",function(){l.SV.lQ()}); Q.V("enable_mdx_video_play_directly")&&this.events.Z(Q,"videodatachange",function(){Z99(l.T)||Mk(l)||Yz(l,0)}); T=this.SV;T.wd();T.subscribe("proxyStateChange",this.E9,this);T.subscribe("remotePlayerChange",this.vQ,this);T.subscribe("remoteQueueChange",this.Hi,this);T.subscribe("previousNextChange",this.TN,this);T.subscribe("nowAutoplaying",this.Ml,this);T.subscribe("autoplayDismissed",this.At,this);g.P(this,this.S);g.P(this,this.L);g.P(this,this.j);g.P(this,this.D);g.P(this,this.C);this.SW();this.Hi();this.vQ()},RUT=function(T,Q){if(Mk(T)){T.SV.unsubscribe("remotePlayerChange",T.vQ,T); var k=Math.round(Q.volume);Q=!!Q.muted;var l=PF(T.SV);if(k!==l.volume||Q!==l.muted)T.SV.setVolume(k,Q),T.D.start();T.SV.subscribe("remotePlayerChange",T.vQ,T)}},G$J=function(T){T.bC(0); T.S.stop();T.LA(new g.Cd(64))},m8W=function(T,Q){if(Mk(T)&&!T.N){var k=null; Q&&(k={style:T.U.getSubtitlesUserSettings()},Object.assign(k,Q));T.SV.yk(T.U.getVideoData(1).videoId,k);T.Y=PF(T.SV).trackData}},Yz=function(T,Q){var k=T.U.getPlaylist(); if(k==null?0:k.listId){var l=k.index;var v=k.listId.toString()}k=T.U.getVideoData(1);T.SV.playVideo(k.videoId,Q,l,v,k.playerParams,k.Bd,iep(k));T.LA(new g.Cd(1))},Ih9=function(T,Q){if(Q){var k=T.U.getOption("captions","tracklist",{hR:1}); k&&k.length?(T.U.setOption("captions","track",Q),T.N=!1):(T.U.loadModule("captions"),T.N=!0)}else T.U.setOption("captions","track",{})},Mk=function(T){return PF(T.SV).videoId===T.U.getVideoData(1).videoId},hUp=function(T,Q){g.yg.call(this,T); this.T=Q},UK=function(){g.p.call(this,{X:"div", J:"ytp-mdx-popup-dialog",K:{role:"dialog"},W:[{X:"div",J:"ytp-mdx-popup-dialog-inner-content",W:[{X:"div",J:"ytp-mdx-popup-title",S6:"No has iniciado sesi\u00f3n"},{X:"div",J:"ytp-mdx-popup-description",S6:"Los v\u00eddeos que veas podr\u00edan aparecer en el historial de reproducciones de la TV e influir en las recomendaciones. Puedes evitarlo si cancelas e inicias sesi\u00f3n en YouTube desde tu ordenador."},{X:"div",J:"ytp-mdx-privacy-popup-buttons",W:[{X:"button",Rk:["ytp-button","ytp-mdx-privacy-popup-cancel"], S6:"Cancelar"},{X:"button",Rk:["ytp-button","ytp-mdx-privacy-popup-confirm"],S6:"Confirmar"}]}]}]});this.fade=new g.TZ(this,250);this.cancelButton=this.L_("ytp-mdx-privacy-popup-cancel");this.confirmButton=this.L_("ytp-mdx-privacy-popup-confirm");g.P(this,this.fade);this.Z(this.cancelButton,"click",this.T);this.Z(this.confirmButton,"click",this.S)},Rk=function(T){g.p.call(this,{X:"div", J:"ytp-remote",W:[{X:"div",J:"ytp-remote-display-status",W:[{X:"div",J:"ytp-remote-display-status-icon",W:[g.ZYI()]},{X:"div",J:"ytp-remote-display-status-text",S6:"{{statustext}}"}]}]});this.api=T;this.fade=new g.TZ(this,250);g.P(this,this.fade);this.Z(T,"presentingplayerstatechange",this.onStateChange);this.OH(T.getPlayerStateObject())},Z$=function(T,Q){g.Hp.call(this,"Reproducir en",1,T,Q); this.U=T;this.IQ={};this.Z(T,"onMdxReceiversChange",this.Y);this.Z(T,"presentingplayerstatechange",this.Y);this.Y()},sPE=function(T){g.A4.call(this,T); this.BA={key:HhA(),name:"Este ordenador"};this.UU=null;this.subscriptions=[];this.uZ=this.SV=null;this.IQ=[this.BA];this.iW=this.BA;this.yU=new g.Cd(64);this.AR=0;this.I2=-1;this.kA=!1;this.GP=this.LV=this.FV=null;if(!g.q0(this.player.G())&&!g.uP(this.player.G())){T=this.player;var Q=g.aa(T);Q&&(Q=Q.K$())&&(Q=new Z$(T,Q),g.P(this,Q));Q=new Rk(T);g.P(this,Q);g.TQ(T,Q.element,4);this.FV=new UK;g.P(this,this.FV);g.TQ(T,this.FV.element,4);this.kA=!!kz()}},f4=function(T){T.LV&&(T.player.removeEventListener("presentingplayerstatechange", T.LV),T.LV=null)},S2v=function(T,Q,k){T.yU=k; T.player.publish("presentingplayerstatechange",new g.YX(k,Q))},Gi=function(T,Q){if(Q.key!==T.iW.key)if(Q.key===T.BA.key)L4(); else if(Z99(T)&&CAv(T),T.iW=Q,!T.player.G().V("disable_mdx_connection_in_mdx_module_for_music_web")||!g.uP(T.player.G())){var k=T.player.getPlaylistId();var l=T.player.getVideoData(1);var v=l.videoId;if(!k&&!v||(T.player.getAppState()===2||T.player.getAppState()===1)&&T.player.G().V("should_clear_video_data_on_player_cued_unstarted"))l=null;else{var L=T.player.getPlaylist();if(L){var q=[];for(var Y=0;Y2*this.size&&Lz(this),!0):!1}; g.h.get=function(T,Q){return o7(this.S,T)?this.S[T]:Q}; g.h.set=function(T,Q){o7(this.S,T)||(this.size+=1,this.T.push(T),this.iR++);this.S[T]=Q}; g.h.forEach=function(T,Q){for(var k=this.zG(),l=0;l=l.T.length)return g.R6;var L=l.T[Q++];return g.wR(T?L:l.S[L])}; return v}; var GOv={xVj:"atp",fd9:"ska",YUq:"que",wck:"mus",Ovq:"sus",gEK:"dsp",rHj:"seq",ipd:"mic",mNd:"dpa",NJj:"mlm",FxV:"dsdtr",As6:"ntb",jxe:"vsp",C89:"scn",ivV:"rpe",QDe:"dcn",hMO:"dcp",Dmk:"pas",ksO:"drq",G0q:"opf",sDj:"els",eMd:"isg",bvq:"svq",VOd:"mvp",xKV:"ads",gzH:"stcp",GW9:"sads",LxO:"dloc",dNB:"dcw",UK9:"asw",XTm:"apw"},m2p={Z76:"u",Ko6:"cl",vEB:"k",XgB:"i",zMm:"cr",eU6:"m",uJd:"g",wG:"up"},QKW={UB:"adPlaying",F$:"onAdStateChange"},jK1={bpH:"nowPlaying",nh6:"onStateChange",UB:"adPlaying",F$:"onAdStateChange", hZ:"nowPlayingShorts",Y1:"onShortsStateChange"},kP$={hZ:"nowPlayingShorts",Y1:"onShortsStateChange"};qb.prototype.equals=function(T){return T?this.id==T.id:!1}; var JH$="",Ga=null;g.S(Q1A,g.KN);var I7,gqm=kL_("loadCastFramework")||kL_("loadCastApplicationFramework"),U5m=["pkedcjkdefgpdelpbcmbmeomcjbeemfm","enhhojjnijigcajfphajepfemndkmdlo"];g.fW(s1,g.x);g.h=s1.prototype;g.h.Ns=function(T){this.Y=arguments;this.T=!1;this.D8?this.L=g.R_()+this.d8:this.D8=g.P4(this.N,this.d8)}; g.h.stop=function(){this.D8&&(g.VC.clearTimeout(this.D8),this.D8=null);this.L=null;this.T=!1;this.Y=[]}; g.h.pause=function(){++this.S}; g.h.resume=function(){this.S&&(--this.S,!this.S&&this.T&&(this.T=!1,this.B.apply(null,this.Y)))}; g.h.EK=function(){this.stop();s1.Ye.EK.call(this)}; g.h.VI=function(){this.D8&&(g.VC.clearTimeout(this.D8),this.D8=null);this.L?(this.D8=g.P4(this.N,this.L-g.R_()),this.L=null):this.S?this.T=!0:(this.T=!1,this.B.apply(null,this.Y))};Sd.prototype.stringify=function(T){return g.VC.JSON.stringify(T,void 0)}; Sd.prototype.parse=function(T){return g.VC.JSON.parse(T,void 0)};g.fW(ZY_,g.Jz);g.fW(fkA,g.Jz);var GLW=null;g.fW(IkE,g.Jz);g.fW(hYm,g.Jz);g.fW(s1$,g.Jz);Xm.prototype.debug=function(){}; Xm.prototype.info=function(){}; Xm.prototype.warning=function(){};var Ni9={},d5A={};g.h=we.prototype;g.h.setTimeout=function(T){this.f_=T}; g.h.CD=function(T){T=T.target;var Q=this.p_;Q&&g.EJ(T)==3?Q.SF():this.sV(T)}; g.h.sV=function(T){try{if(T==this.T)a:{var Q=g.EJ(this.T),k=this.T.S,l=this.T.getStatus();if(!(Q<3)&&(Q!=3||this.T&&(this.S.L||g.io(this.T)||g.Vu(this.T)))){this.e6||Q!=4||k==7||(k==8||l<=0?Cz(3):Cz(2));rgA(this);var v=this.T.getStatus();this.QR=v;var L=wyd(this);if(this.B=v==200){if(this.h3&&!this.Jj){b:{if(this.T){var q=g.Tc(this.T,"X-HTTP-Initial-Response");if(q&&!g.bB(q)){var Y=q;break b}}Y=null}if(T=Y)this.Jj=!0,HYW(this,T);else{this.B=!1;this.N=3;Bo(12);Nb(this);Ah(this);break a}}if(this.i9){T= !0;for(var U;!this.e6&&this.C0&&!this.d5&&(this.d5=!0,this.L.MJ(this)):(Nb(this),Ah(this))}else HYW(this,L);Q==4&&Nb(this);this.B&&!this.e6&&(Q==4?cgd(this.L,this):(this.B=!1,de(this)))}else g.SBb(this.T),v==400&&L.indexOf("Unknown SID")> 0?(this.N=3,Bo(12)):(this.N=0,Bo(13)),Nb(this),Ah(this)}}}catch(R){}finally{}}; g.h.cancel=function(){this.e6=!0;Nb(this)}; g.h.wu=function(){this.z9=null;var T=Date.now();T-this.zg>=0?(this.sK!=2&&(Cz(3),Bo(17)),Nb(this),this.N=2,Ah(this)):bY$(this,this.zg-T)}; g.h.getLastError=function(){return this.N}; g.h.kO=function(){return this.T};OYJ.prototype.cancel=function(){this.L=WdT(this);if(this.S)this.S.cancel(),this.S=null;else if(this.T&&this.T.size!==0){for(var T=g.B(this.T.values()),Q=T.next();!Q.done;Q=T.next())Q.value.cancel();this.T.clear()}};g.h=Fdm.prototype;g.h.CE=8;g.h.i7=1;g.h.connect=function(T,Q,k,l){Bo(0);this.Ig=T;this.e6=Q||{};k&&l!==void 0&&(this.e6.OSID=k,this.e6.OAID=l);this.Jj=this.OG;this.Bd=KdE(this,null,this.Ig);Da(this)}; g.h.disconnect=function(){ygA(this);if(this.i7==3){var T=this.u9++,Q=this.Bd.clone();g.Uz(Q,"SID",this.Y);g.Uz(Q,"RID",T);g.Uz(Q,"TYPE","terminate");nz(this,Q);T=new we(this,this.Y,T);T.sK=2;T.j=QL(Q.clone());Q=!1;if(g.VC.navigator&&g.VC.navigator.sendBeacon)try{Q=g.VC.navigator.sendBeacon(T.j.toString(),"")}catch(k){}!Q&&g.VC.Image&&((new Image).src=T.j,Q=!0);Q||(T.T=zYT(T.L,null),T.T.send(T.j));T.hj=Date.now();de(T)}kBd(this)}; g.h.FG=function(){return this.i7==0}; g.h.getState=function(){return this.i7}; g.h.Jf=function(T){if(this.B)if(this.B=null,this.i7==1){if(!T){this.u9=Math.floor(Math.random()*1E5);T=this.u9++;var Q=new we(this,"",T),k=this.D;this.QR&&(k?(k=g.Gs(k),g.Is(k,this.QR)):k=this.QR);this.C!==null||this.zg||(Q.Bd=k,k=null);var l;if(this.Tg)a:{for(var v=l=0;v4096){l=v;break a}if(l===4096||v===this.L.length-1){l=v+1;break a}}l= 1E3}else l=1E3;l=Tm$(this,Q,l);v=this.Bd.clone();g.Uz(v,"RID",T);g.Uz(v,"CVER",22);this.i9&&g.Uz(v,"X-HTTP-Session-Id",this.i9);nz(this,v);k&&(this.zg?l="headers="+g.Nn(g.pH6(k))+"&"+l:this.C&&g.Gm(v,this.C,k));nqe(this.S,Q);this.OW&&g.Uz(v,"TYPE","init");this.Tg?(g.Uz(v,"$req",l),g.Uz(v,"SID","null"),Q.h3=!0,Bi$(Q,v,null)):Bi$(Q,v,l);this.i7=2}}else this.i7==3&&(T?QpA(this,T):this.L.length==0||pyW(this.S)||QpA(this))}; g.h.lE=function(){this.j=null;jpT(this);if(this.DP&&!(this.f_||this.T==null||this.Z8<=0)){var T=4*this.Z8;this.xm=za((0,g.Mp)(this.AjH,this),T)}}; g.h.AjH=function(){this.xm&&(this.xm=null,this.Jj=!1,this.f_=!0,Bo(10),re(this),jpT(this))}; g.h.MJ=function(T){this.T==T&&this.DP&&!this.f_&&(Eqd(this),this.f_=!0,Bo(11))}; g.h.JE=function(){this.z9!=null&&(this.z9=null,re(this),ak$(this),Bo(19))}; g.h.Bwk=function(T){T?Bo(2):Bo(1)}; g.h.isActive=function(){return!!this.N&&this.N.isActive(this)}; g.h=on$.prototype;g.h.bE=function(){}; g.h.jJ=function(){}; g.h.Af=function(){}; g.h.ZD=function(){}; g.h.isActive=function(){return!0}; g.h.Ze=function(){};g.fW(xU,g.fL);xU.prototype.open=function(){this.T.N=this.L;this.B&&(this.T.sK=!0);this.T.connect(this.N,this.S||void 0)}; xU.prototype.close=function(){this.T.disconnect()}; xU.prototype.send=function(T){var Q=this.T;if(typeof T==="string"){var k={};k.__data__=T;T=k}else this.Y&&(k={},k.__data__=g.pL(T),T=k);Q.L.push(new tGW(Q.Tw++,T));Q.i7==3&&Da(Q)}; xU.prototype.EK=function(){this.T.N=null;delete this.L;this.T.disconnect();delete this.T;xU.Ye.EK.call(this)}; g.fW(LpJ,ZY_);g.fW(qY9,fkA);g.fW(Kz,on$);Kz.prototype.bE=function(){this.T.dispatchEvent("m")}; Kz.prototype.jJ=function(T){this.T.dispatchEvent(new LpJ(T))}; Kz.prototype.Af=function(T){this.T.dispatchEvent(new qY9(T))}; Kz.prototype.ZD=function(){this.T.dispatchEvent("n")};var Ho=new g.fL;g.S(YY$,g.Jz);g.h=O1.prototype;g.h.V$=null;g.h.D0=!1;g.h.Oc=null;g.h.S8=null;g.h.rq=null;g.h.Mi=null;g.h.sR=null;g.h.ac=null;g.h.s2=null;g.h.j1=null;g.h.y9=0;g.h.w1=null;g.h.HK=null;g.h.wQ=null;g.h.lL=-1;g.h.UZ=!0;g.h.Ch=!1;g.h.TL=0;g.h.D5=null;var mhA={},GBv={};g.h=O1.prototype;g.h.setTimeout=function(T){this.S=T}; g.h.jc=function(T){T=T.target;var Q=this.D5;Q&&g.EJ(T)==3?Q.SF():this.Iv(T)}; g.h.Iv=function(T){try{if(T==this.j1)a:{var Q=g.EJ(this.j1),k=this.j1.S,l=this.j1.getStatus();if(g.Y1&&!g.HX("420+")){if(Q<4)break a}else if(Q<3||Q==3&&!g.io(this.j1))break a;this.Ch||Q!=4||k==7||(k==8||l<=0?this.T.TR(3):this.T.TR(2));spA(this);var v=this.j1.getStatus();this.lL=v;var L=g.io(this.j1);if(this.D0=v==200){Q==4&&pz(this);if(this.i9){for(T=!0;!this.Ch&&this.y90?(this.wQ=3,th(13)):(this.wQ=0,th(14)),pz(this),SYA(this)}}catch(Y){}finally{}}; g.h.cancel=function(){this.Ch=!0;pz(this)}; g.h.AE=function(){this.Oc=null;var T=Date.now();T-this.S8>=0?(this.Mi!=2&&this.T.TR(3),pz(this),this.wQ=2,th(18),SYA(this)):hp9(this,this.S8-T)}; g.h.getLastError=function(){return this.wQ};g.h=XeJ.prototype;g.h.EJ=null;g.h.Bc=null;g.h.lw=!1;g.h.h$=null;g.h.kF=null;g.h.F3=-1;g.h.zJ=null;g.h.Nq=null;g.h.connect=function(T){this.h$=T;T=$U(this.T,null,this.h$);th(3);Date.now();var Q=this.T.D;Q!=null?(this.zJ=Q[0],(this.Nq=Q[1])?(this.kF=1,weA(this)):(this.kF=2,dhm(this))):(jd(T,"MODE","init"),this.Bc=new O1(this),this.Bc.V$=this.EJ,ZMJ(this.Bc,T,!1,null,!0),this.kF=0)}; g.h.qX=function(T){if(T)this.kF=2,dhm(this);else{th(4);var Q=this.T;Q.sx=Q.YV.F3;E1(Q,9)}T&&this.TR(2)}; g.h.cq=function(T){return this.T.cq(T)}; g.h.abort=function(){this.Bc&&(this.Bc.cancel(),this.Bc=null);this.F3=-1}; g.h.FG=function(){return!1}; g.h.KE=function(T,Q){this.F3=T.lL;if(this.kF==0)if(Q){try{var k=this.S.parse(Q)}catch(l){T=this.T;T.sx=this.F3;E1(T,2);return}this.zJ=k[0];this.Nq=k[1]}else T=this.T,T.sx=this.F3,E1(T,2);else this.kF==2&&(this.lw?(th(7),Date.now()):Q=="11111"?(th(6),this.lw=!0,Date.now(),this.F3=200,this.Bc.cancel(),th(12),Jh(this.T,this,!0)):(th(8),Date.now(),this.lw=!1))}; g.h.Qn=function(){this.F3=this.Bc.lL;if(this.Bc.D0)this.kF==0?this.Nq?(this.kF=1,weA(this)):(this.kF=2,dhm(this)):this.kF==2&&(this.lw?(th(12),Jh(this.T,this,!0)):(th(11),Jh(this.T,this,!1)));else{this.kF==0?th(9):this.kF==2&&th(10);var T=this.T;this.Bc.getLastError();T.sx=this.F3;E1(T,2)}}; g.h.JQ=function(){return this.T.JQ()}; g.h.isActive=function(){return this.T.isActive()}; g.h.TR=function(T){this.T.TR(T)};g.h=NmW.prototype;g.h.Fu=null;g.h.ZM=null;g.h.Zz=null;g.h.Rn=null;g.h.Ff=null;g.h.q4=null;g.h.GX=null;g.h.LW=null;g.h.AQ=0;g.h.Iu=0;g.h.x_=null;g.h.Mk=null;g.h.Yu=null;g.h.lR=null;g.h.YV=null;g.h.bM=null;g.h.DA=-1;g.h.P_=-1;g.h.sx=-1;g.h.fR=0;g.h.vt=0;g.h.C5=8;var BBW={OK:0,Rs9:2,QM6:4,Isd:5,J_m:6,STOP:7,Qz:8,Bee:9,XlK:10,R9_:11,R0O:12};g.fW(bM$,g.Jz);g.fW(rFW,g.Jz);g.h=NmW.prototype; g.h.connect=function(T,Q,k,l,v){th(0);this.Ff=Q;this.ZM=k||{};l&&v!==void 0&&(this.ZM.OSID=l,this.ZM.OAID=v);this.j?(Po((0,g.Mp)(this.oo,this,T),100),DhW(this)):this.oo(T)}; g.h.disconnect=function(){aAA(this);if(this.T==3){var T=this.AQ++,Q=this.q4.clone();g.Uz(Q,"SID",this.Y);g.Uz(Q,"RID",T);g.Uz(Q,"TYPE","terminate");Fm(this,Q);T=new O1(this,this.Y,T);T.Mi=2;T.sR=QL(Q.clone());(new Image).src=T.sR.toString();T.rq=Date.now();fAW(T)}WpW(this)}; g.h.oo=function(T){this.YV=new XeJ(this);this.YV.EJ=this.Fu;this.YV.S=this.N;this.YV.connect(T)}; g.h.FG=function(){return this.T==0}; g.h.getState=function(){return this.T}; g.h.pE=function(T){this.Mk=null;Pn1(this,T)}; g.h.nE=function(){this.Yu=null;this.Rn=new O1(this,this.Y,"rpc",this.C);this.Rn.V$=this.Fu;this.Rn.TL=0;var T=this.GX.clone();g.Uz(T,"RID","rpc");g.Uz(T,"SID",this.Y);g.Uz(T,"CI",this.bM?"0":"1");g.Uz(T,"AID",this.DA);Fm(this,T);g.Uz(T,"TYPE","xmlhttp");ZMJ(this.Rn,T,!0,this.LW,!1)}; g.h.KE=function(T,Q){if(this.T!=0&&(this.Rn==T||this.Zz==T))if(this.sx=T.lL,this.Zz==T&&this.T==3)if(this.C5>7){try{var k=this.N.parse(Q)}catch(l){k=null}if(Array.isArray(k)&&k.length==3)if(T=k,T[0]==0)a:{if(!this.Yu){if(this.Rn)if(this.Rn.rq+3E30)){if(l=Q==1)this.Zz||this.Mk||this.T==1||this.fR>=2?l=!1:(this.Mk=Po((0,g.Mp)(this.pE,this,T),tom(this,this.fR)),this.fR++, l=!0);l=!(l||Q==2&&OMJ(this))}if(l)switch(k){case 1:E1(this,5);break;case 4:E1(this,10);break;case 3:E1(this,6);break;case 7:E1(this,12);break;default:E1(this,2)}}}; g.h.bb=function(T){if(!g.CW(arguments,this.T))throw Error("Unexpected channel state: "+this.T);}; g.h.Roe=function(T){T?th(2):(th(1),peA(this,8))}; g.h.cq=function(T){if(T)throw Error("Can't create secondary domain capable XhrIo object.");T=new g.Jd;T.C=!1;return T}; g.h.isActive=function(){return!!this.x_&&this.x_.isActive(this)}; g.h.TR=function(T){var Q=Ho;Q.dispatchEvent(new rFW(Q,T))}; g.h.JQ=function(){return!1}; g.h=$hd.prototype;g.h.W_=function(){}; g.h.tf=function(){}; g.h.OV=function(){}; g.h.uE=function(){}; g.h.Yi=function(){}; g.h.v_=function(){return{}}; g.h.isActive=function(){return!0};g.h=JFm.prototype;g.h.enqueue=function(T){this.S.push(T)}; g.h.isEmpty=function(){return this.T.length===0&&this.S.length===0}; g.h.clear=function(){this.T=[];this.S=[]}; g.h.contains=function(T){return g.CW(this.T,T)||g.CW(this.S,T)}; g.h.remove=function(T){var Q=this.T;var k=(0,g.zeW)(Q,T);k>=0?(g.Bm(Q,k),Q=!0):Q=!1;return Q||g.zv(this.S,T)}; g.h.b0=function(){for(var T=[],Q=this.T.length-1;Q>=0;--Q)T.push(this.T[Q]);Q=this.S.length;for(var k=0;k=zUd.length?this.publish("pairingFailed",Error("DIAL polling timed out")):(T=zUd[this.S],this.D8=g.Zq((0,g.Mp)(this.IE,this),T),this.S++):this.publish("pairingFailed",Error("Server error "+T.status))}; g.h.ub=function(){this.T=null;this.publish("pairingFailed",Error("Server not responding"))}; var zUd=[2E3,2E3,1E3,1E3,1E3,2E3,2E3,5E3,5E3,1E4];g.fW(gZ,LK);g.h=gZ.prototype;g.h.start=function(){qG(this)&&this.publish("screenChange");!g.cy("yt-remote-lounge-token-expiration")&&dU$(this);g.GO(this.T);this.T=g.Zq((0,g.Mp)(this.start,this),1E4)}; g.h.add=function(T,Q){qG(this);B7v(this,T);MG(this,!1);this.publish("screenChange");Q(T);T.token||dU$(this)}; g.h.remove=function(T,Q){var k=qG(this);XlA(this,T)&&(MG(this,!1),k=!0);Q(T);k&&this.publish("screenChange")}; g.h.AF=function(T,Q,k,l){var v=qG(this),L=this.get(T.id);L?(L.name!=Q&&(L.name=Q,MG(this,!1),v=!0),k(T)):l(Error("no such local screen."));v&&this.publish("screenChange")}; g.h.EK=function(){g.GO(this.T);gZ.Ye.EK.call(this)}; g.h.wX=function(T){qG(this);var Q=this.screens.length;T=T&&T.screens||[];for(var k=T.length,l=0;l20)break a;Y=Q(L,q)}L=Y}v.name=L}k(Re(this,v))},this), onError:(0,g.Mp)(function(v){l(Error("pairing request failed: "+v.status))},this), onTimeout:(0,g.Mp)(function(){l(Error("pairing request timed out."))},this)})}; g.h.EK=function(){g.od(this.S);g.od(this.T);Ub.Ye.EK.call(this)}; g.h.I1=function(){PMJ(this);this.publish("screenChange");this.T.update()}; Ub.prototype.dispose=Ub.prototype.dispose;g.fW(Zu,g.ox);g.h=Zu.prototype;g.h.q1=function(T){this.wd()||(T&&(GM(this,""+T),this.publish("sessionFailed")),this.T=null,this.publish("sessionScreen",null))}; g.h.info=function(T){jR(this.i9,T)}; g.h.Mx=function(){return null}; g.h.b1=function(T){var Q=this.S;T?(Q.displayStatus=new chrome.cast.ReceiverDisplayStatus(T,[]),Q.displayStatus.showStop=!0):Q.displayStatus=null;chrome.cast.setReceiverDisplayStatus(Q,(0,g.Mp)(function(){this.info("Updated receiver status for "+Q.friendlyName+": "+T)},this),(0,g.Mp)(function(){GM(this,"Failed to update receiver status for: "+Q.friendlyName)},this))}; g.h.EK=function(){this.b1("");Zu.Ye.EK.call(this)};g.S(mg,Zu);g.h=mg.prototype;g.h.Z9=function(T){if(this.L){if(this.L==T)return;GM(this,"Overriding cast session with new session object");ij_(this);this.hj=!1;this.D="unknown";this.L.removeUpdateListener(this.qO);this.L.removeMessageListener("urn:x-cast:com.google.youtube.mdx",this.xm)}this.L=T;this.L.addUpdateListener(this.qO);this.L.addMessageListener("urn:x-cast:com.google.youtube.mdx",this.xm);Jxv(this,"getMdxSessionStatus")}; g.h.Zl=function(T){this.info("launchWithParams no-op for Cast: "+g.pL(T))}; g.h.stop=function(){this.L?this.L.stop((0,g.Mp)(function(){this.q1()},this),(0,g.Mp)(function(){this.q1(Error("Failed to stop receiver app."))},this)):this.q1(Error("Stopping cast device without session."))}; g.h.b1=function(){}; g.h.EK=function(){this.info("disposeInternal");ij_(this);this.L&&(this.L.removeUpdateListener(this.qO),this.L.removeMessageListener("urn:x-cast:com.google.youtube.mdx",this.xm));this.L=null;Zu.prototype.EK.call(this)}; g.h.UFB=function(T,Q){if(!this.wd())if(Q)if(Q=kU(Q),g.vm(Q))switch(T=""+Q.type,Q=Q.data||{},this.info("onYoutubeMessage_: "+T+" "+g.pL(Q)),T){case "mdxSessionStatus":plp(this,Q);break;case "loungeToken":eAm(this,Q);break;default:GM(this,"Unknown youtube message: "+T)}else GM(this,"Unable to parse message.");else GM(this,"No data in message.")}; g.h.wU=function(T,Q,k,l){g.GO(this.j);this.j=0;nr_(this.Y,this.S.label,T,this.S.friendlyName,(0,g.Mp)(function(v){v?Q(v):l>=0?(GM(this,"Screen "+T+" appears to be offline. "+l+" retries left."),this.j=g.Zq((0,g.Mp)(this.wU,this,T,Q,k,l-1),300)):k(Error("Unable to fetch screen."))},this),k)}; g.h.Mx=function(){return this.L}; g.h.WE=function(T){this.wd()||T||(GM(this,"Cast session died."),this.q1())};g.S(Ie,Zu);g.h=Ie.prototype;g.h.Z9=function(T){this.L=T;this.L.addUpdateListener(this.e6)}; g.h.Zl=function(T){this.Bd=T;this.z9()}; g.h.stop=function(){v_1(this);this.L?this.L.stop((0,g.Mp)(this.q1,this,null),(0,g.Mp)(this.q1,this,"Failed to stop DIAL device.")):this.q1()}; g.h.EK=function(){v_1(this);this.L&&this.L.removeUpdateListener(this.e6);this.L=null;Zu.prototype.EK.call(this)}; g.h.Ow=function(T){this.wd()||T||(GM(this,"DIAL session died."),this.N(),this.N=function(){},this.q1())};g.S(SR,Zu);SR.prototype.stop=function(){this.q1()}; SR.prototype.Z9=function(){}; SR.prototype.Zl=function(){g.GO(this.L);this.L=NaN;var T=U1(this.Y.b5(),this.S.label);T?fK(this,T):this.q1(Error("No such screen"))}; SR.prototype.EK=function(){g.GO(this.L);this.L=NaN;Zu.prototype.EK.call(this)};g.S(CK,g.ox);g.h=CK.prototype; g.h.init=function(T,Q){chrome.cast.timeout.requestSession=3E4;var k=new chrome.cast.SessionRequest(this.j,[chrome.cast.Capability.AUDIO_OUT]);g.hH("desktop_enable_cast_connect")&&(k.androidReceiverCompatible=!0);this.D||(k.dialRequest=new chrome.cast.DialRequest("YouTube"));var l=chrome.cast.AutoJoinPolicy.TAB_AND_ORIGIN_SCOPED;T=T||this.B?chrome.cast.DefaultActionPolicy.CAST_THIS_TAB:chrome.cast.DefaultActionPolicy.CREATE_SESSION;var v=(0,g.Mp)(this.egV,this);k=new chrome.cast.ApiConfig(k,(0,g.Mp)(this.hK, this),v,l,T);k.customDialLaunchCallback=(0,g.Mp)(this.fVH,this);chrome.cast.initialize(k,(0,g.Mp)(function(){this.wd()||(chrome.cast.addReceiverActionListener(this.N),hAp(),this.S.subscribe("onlineScreenChange",(0,g.Mp)(this.HF,this)),this.L=g_d(this),chrome.cast.setCustomReceivers(this.L,function(){},(0,g.Mp)(function(L){this.ww("Failed to set initial custom receivers: "+g.pL(L))},this)),this.publish("yt-remote-cast2-availability-change",zM(this)),Q(!0))},this),(0,g.Mp)(function(L){this.ww("Failed to initialize API: "+ g.pL(L)); Q(!1)},this))}; g.h.Klj=function(T,Q){BF("Setting connected screen ID: "+T+" -> "+Q);if(this.T){var k=this.T.T;if(!T||k&&k.id!=T)BF("Unsetting old screen status: "+this.T.S.friendlyName),XF(this,null)}if(T&&Q){if(!this.T){T=U1(this.S.b5(),T);if(!T){BF("setConnectedScreenStatus: Unknown screen.");return}if(T.idType=="shortLived"){BF("setConnectedScreenStatus: Screen with id type to be short lived.");return}k=LbA(this,T);k||(BF("setConnectedScreenStatus: Connected receiver not custom..."),k=new chrome.cast.Receiver(T.uuid? T.uuid:T.id,T.name),k.receiverType=chrome.cast.ReceiverType.CUSTOM,this.L.push(k),chrome.cast.setCustomReceivers(this.L,function(){},(0,g.Mp)(function(l){this.ww("Failed to set initial custom receivers: "+g.pL(l))},this))); BF("setConnectedScreenStatus: new active receiver: "+k.friendlyName);XF(this,new SR(this.S,k),!0)}this.T.b1(Q)}else BF("setConnectedScreenStatus: no screen.")}; g.h.pkB=function(T){this.wd()?this.ww("Setting connection data on disposed cast v2"):this.T?this.T.Zl(T):this.ww("Setting connection data without a session")}; g.h.fD=function(){this.wd()?this.ww("Stopping session on disposed cast v2"):this.T?(this.T.stop(),XF(this,null)):BF("Stopping non-existing session")}; g.h.requestSession=function(){chrome.cast.requestSession((0,g.Mp)(this.hK,this),(0,g.Mp)(this.f8k,this))}; g.h.EK=function(){this.S.unsubscribe("onlineScreenChange",(0,g.Mp)(this.HF,this));window.chrome&&chrome.cast&&chrome.cast.removeReceiverActionListener(this.N);var T=GPe,Q=g.jA("yt.mdx.remote.debug.handlers_");g.zv(Q||[],T);g.od(this.T);g.ox.prototype.EK.call(this)}; g.h.ww=function(T){jR("Controller",T)}; g.h.k8=function(T,Q){this.T==T&&(Q||XF(this,null),this.publish("yt-remote-cast2-session-change",Q))}; g.h.Nnj=function(T,Q){if(!this.wd())if(T)switch(T.friendlyName=chrome.cast.unescape(T.friendlyName),BF("onReceiverAction_ "+T.label+" / "+T.friendlyName+"-- "+Q),Q){case chrome.cast.ReceiverAction.CAST:if(this.T)if(this.T.S.label!=T.label)BF("onReceiverAction_: Stopping active receiver: "+this.T.S.friendlyName),this.T.stop();else{BF("onReceiverAction_: Casting to active receiver.");this.T.T&&this.publish("yt-remote-cast2-session-change",this.T.T);break}switch(T.receiverType){case chrome.cast.ReceiverType.CUSTOM:XF(this, new SR(this.S,T));break;case chrome.cast.ReceiverType.DIAL:XF(this,new Ie(this.S,T,this.Y,this.config_));break;case chrome.cast.ReceiverType.CAST:XF(this,new mg(this.S,T,this.config_));break;default:this.ww("Unknown receiver type: "+T.receiverType)}break;case chrome.cast.ReceiverAction.STOP:this.T&&this.T.S.label==T.label?this.T.stop():this.ww("Stopping receiver w/o session: "+T.friendlyName)}else this.ww("onReceiverAction_ called without receiver.")}; g.h.fVH=function(T){if(this.wd())return Promise.reject(Error("disposed"));var Q=T.receiver;Q.receiverType!=chrome.cast.ReceiverType.DIAL&&(this.ww("Not DIAL receiver: "+Q.friendlyName),Q.receiverType=chrome.cast.ReceiverType.DIAL);var k=this.T?this.T.S:null;if(!k||k.label!=Q.label)return this.ww("Receiving DIAL launch request for non-clicked DIAL receiver: "+Q.friendlyName),Promise.reject(Error("illegal DIAL launch"));if(k&&k.label==Q.label&&k.receiverType!=chrome.cast.ReceiverType.DIAL){if(this.T.T)return BF("Reselecting dial screen."), this.publish("yt-remote-cast2-session-change",this.T.T),Promise.resolve(new chrome.cast.DialLaunchResponse(!1));this.ww('Changing CAST intent from "'+k.receiverType+'" to "dial" for '+Q.friendlyName);XF(this,new Ie(this.S,Q,this.Y,this.config_))}Q=this.T;Q.j=T;Q.j.appState==chrome.cast.DialAppState.RUNNING?(T=Q.j.extraData||{},k=T.screenId||null,hR(Q)&&T.loungeToken?T.loungeTokenRefreshIntervalMs?T=kA$(Q,{name:Q.S.friendlyName,screenId:T.screenId,loungeToken:T.loungeToken,dialId:Q.j.receiver.label, screenIdType:"shortLived"},T.loungeTokenRefreshIntervalMs):(g.FH(Error("No loungeTokenRefreshIntervalMs presents in additionalData: "+JSON.stringify(T)+".")),T=lZT(Q,k)):T=lZT(Q,k)):T=Q$E(Q);return T}; g.h.hK=function(T){var Q=this;if(!this.wd()&&!this.B){BF("New cast session ID: "+T.sessionId);var k=T.receiver;if(k.receiverType!=chrome.cast.ReceiverType.CUSTOM){if(!this.T)if(k.receiverType==chrome.cast.ReceiverType.CAST)BF("Got resumed cast session before resumed mdx connection."),k.friendlyName=chrome.cast.unescape(k.friendlyName),XF(this,new mg(this.S,k,this.config_),!0);else{this.ww("Got non-cast session without previous mdx receiver event, or mdx resume.");return}var l=this.T.S,v=U1(this.S.b5(), l.label);v&&Mb(v,k.label)&&l.receiverType!=chrome.cast.ReceiverType.CAST&&k.receiverType==chrome.cast.ReceiverType.CAST&&(BF("onSessionEstablished_: manual to cast session change "+k.friendlyName),g.od(this.T),this.T=new mg(this.S,k,this.config_),this.T.subscribe("sessionScreen",(0,g.Mp)(this.k8,this,this.T)),this.T.subscribe("sessionFailed",function(){return qqm(Q,Q.T)}),this.T.Zl(null)); this.T.Z9(T)}}}; g.h.vE=function(){return this.T?this.T.Mx():null}; g.h.f8k=function(T){this.wd()||(this.ww("Failed to estabilish a session: "+g.pL(T)),T.code!=chrome.cast.ErrorCode.CANCEL&&XF(this,null),this.publish("yt-remote-cast2-session-failed"))}; g.h.egV=function(T){BF("Receiver availability updated: "+T);if(!this.wd()){var Q=zM(this);this.C=T==chrome.cast.ReceiverAvailability.AVAILABLE;zM(this)!=Q&&this.publish("yt-remote-cast2-availability-change",zM(this))}}; g.h.HF=function(){this.wd()||(this.L=g_d(this),BF("Updating custom receivers: "+g.pL(this.L)),chrome.cast.setCustomReceivers(this.L,function(){},(0,g.Mp)(function(){this.ww("Failed to set custom receivers.")},this)),this.publish("yt-remote-cast2-availability-change",zM(this)))}; CK.prototype.setLaunchParams=CK.prototype.pkB;CK.prototype.setConnectedScreenStatus=CK.prototype.Klj;CK.prototype.stopSession=CK.prototype.fD;CK.prototype.getCastSession=CK.prototype.vE;CK.prototype.requestSession=CK.prototype.requestSession;CK.prototype.init=CK.prototype.init;CK.prototype.dispose=CK.prototype.dispose;var XxW=g.G5(["https://www.gstatic.com/cv/js/sender/v1/cast_sender.js"]),hZ$=[],GA9=g.Vw(XxW);g.h=cF.prototype; g.h.reset=function(T){this.listId="";this.index=-1;this.videoId="";XdE(this);this.volume=-1;this.muted=!1;T&&(this.index=T.index,this.listId=T.listId,this.videoId=T.videoId,this.playerState=T.playerState,this.volume=T.volume,this.muted=T.muted,this.audioTrackId=T.audioTrackId,this.trackData=T.trackData,this.E_=T.hasPrevious,this.G0=T.hasNext,this.B=T.playerTime,this.N=T.playerTimeAt,this.S=T.seekableStart,this.C=T.seekableEnd,this.L=T.duration,this.j=T.loadedTime,this.T=T.liveIngestionTime,this.Y= !isNaN(this.T))}; g.h.isPlaying=function(){return this.playerState==1}; g.h.isBuffering=function(){return this.playerState==3}; g.h.SR=function(T){this.L=isNaN(T)?0:T}; g.h.getDuration=function(){return this.Y?this.L+Du(this):this.L}; g.h.clone=function(){return new cF(dEE(this))};g.S(xo,g.ox);g.h=xo.prototype;g.h.getState=function(){return this.L}; g.h.ZH=function(){return this.Y.getReconnectTimeout()}; g.h.TT=function(){this.Y.reconnect()}; g.h.play=function(){HF(this)?(this.T?this.T.play(null,g.DM,WF(this,"play")):pK(this,"play"),bZA(this,1,uR(PF(this))),this.publish("remotePlayerChange")):tR(this,this.play)}; g.h.pause=function(){HF(this)?(this.T?this.T.pause(null,g.DM,WF(this,"pause")):pK(this,"pause"),bZA(this,2,uR(PF(this))),this.publish("remotePlayerChange")):tR(this,this.pause)}; g.h.seekTo=function(T){if(HF(this)){if(this.T){var Q=PF(this),k=new chrome.cast.media.SeekRequest;k.currentTime=T;Q.isPlaying()||Q.isBuffering()?k.resumeState=chrome.cast.media.ResumeState.PLAYBACK_START:k.resumeState=chrome.cast.media.ResumeState.PLAYBACK_PAUSE;this.T.seek(k,g.DM,WF(this,"seekTo",{newTime:T}))}else pK(this,"seekTo",{newTime:T});bZA(this,3,T);this.publish("remotePlayerChange")}else tR(this,g.YE(this.seekTo,T))}; g.h.stop=function(){if(HF(this)){this.T?this.T.stop(null,g.DM,WF(this,"stopVideo")):pK(this,"stopVideo");var T=PF(this);T.index=-1;T.videoId="";XdE(T);Ob(this,T);this.publish("remotePlayerChange")}else tR(this,this.stop)}; g.h.setVolume=function(T,Q){if(HF(this)){var k=PF(this);if(this.S){if(k.volume!=T){var l=Math.round(T)/100;this.S.setReceiverVolumeLevel(l,(0,g.Mp)(function(){ko("set receiver volume: "+l)},this),(0,g.Mp)(function(){this.ww("failed to set receiver volume.")},this))}k.muted!=Q&&this.S.setReceiverMuted(Q,(0,g.Mp)(function(){ko("set receiver muted: "+Q)},this),(0,g.Mp)(function(){this.ww("failed to set receiver muted.")},this))}else{var v={volume:T, muted:Q};k.volume!=-1&&(v.delta=T-k.volume);pK(this,"setVolume",v)}k.muted=Q;k.volume=T;Ob(this,k)}else tR(this,g.YE(this.setVolume,T,Q))}; g.h.yk=function(T,Q){if(HF(this)){var k=PF(this);T={videoId:T};Q&&(k.trackData={trackName:Q.name,languageCode:Q.languageCode,sourceLanguageCode:Q.translationLanguage?Q.translationLanguage.languageCode:"",languageName:Q.languageName,kind:Q.kind},T.style=g.pL(Q.style),g.Is(T,k.trackData));pK(this,"setSubtitlesTrack",T);Ob(this,k)}else tR(this,g.YE(this.yk,T,Q))}; g.h.setAudioTrack=function(T,Q){HF(this)?(Q=Q.getLanguageInfo().getId(),pK(this,"setAudioTrack",{videoId:T,audioTrackId:Q}),T=PF(this),T.audioTrackId=Q,Ob(this,T)):tR(this,g.YE(this.setAudioTrack,T,Q))}; g.h.playVideo=function(T,Q,k,l,v,L,q){l=l===void 0?null:l;v=v===void 0?null:v;L=L===void 0?null:L;q=q===void 0?null:q;var Y=PF(this),U={videoId:T};k!==void 0&&(U.currentIndex=k);nK(Y,T,k||0);Q!==void 0&&(ae(Y,Q),U.currentTime=Q);l&&(U.listId=l);v&&(U.playerParams=v);L&&(U.clickTrackingParams=L);q&&(U.locationInfo=g.pL(q));pK(this,"setPlaylist",U);l||Ob(this,Y)}; g.h.Bi=function(T,Q){if(HF(this)){if(T&&Q){var k=PF(this);nK(k,T,Q);Ob(this,k)}pK(this,"previous")}else tR(this,g.YE(this.Bi,T,Q))}; g.h.nextVideo=function(T,Q){if(HF(this)){if(T&&Q){var k=PF(this);nK(k,T,Q);Ob(this,k)}pK(this,"next")}else tR(this,g.YE(this.nextVideo,T,Q))}; g.h.Nd=function(){if(HF(this)){pK(this,"clearPlaylist");var T=PF(this);T.reset();Ob(this,T);this.publish("remotePlayerChange")}else tR(this,this.Nd)}; g.h.lQ=function(){HF(this)?pK(this,"dismissAutoplay"):tR(this,this.lQ)}; g.h.dispose=function(){if(this.L!=3){var T=this.L;this.L=3;this.publish("proxyStateChange",T,this.L)}g.ox.prototype.dispose.call(this)}; g.h.EK=function(){Au9(this);this.Y=null;this.N.clear();KK(this,null);g.ox.prototype.EK.call(this)}; g.h.PW=function(T){if((T!=this.L||T==2)&&this.L!=3&&T!=0){var Q=this.L;this.L=T;this.publish("proxyStateChange",Q,T);if(T==1)for(;!this.N.isEmpty();)Q=T=this.N,Q.T.length===0&&(Q.T=Q.S,Q.T.reverse(),Q.S=[]),T.T.pop().apply(this);else T==3&&this.dispose()}}; g.h.U2O=function(T,Q){this.publish(T,Q)}; g.h.Kek=function(T){if(!T)this.pO(null),KK(this,null);else if(this.S.receiver.volume){T=this.S.receiver.volume;var Q=PF(this),k=Math.round(100*T.level||0);if(Q.volume!=k||Q.muted!=T.muted)ko("Cast volume update: "+T.level+(T.muted?" muted":"")),Q.volume=k,Q.muted=!!T.muted,Ob(this,Q)}}; g.h.pO=function(T){ko("Cast media: "+!!T);this.T&&this.T.removeUpdateListener(this.j);if(this.T=T)this.T.addUpdateListener(this.j),rup(this),this.publish("remotePlayerChange")}; g.h.IVK=function(T){T?(rup(this),this.publish("remotePlayerChange")):this.pO(null)}; g.h.RF=function(){pK(this,"sendDebugCommand",{debugCommand:"stats4nerds "})}; g.h.P96=function(){var T=CvW();T&&KK(this,T)}; g.h.ww=function(T){jR("CP",T)};g.S(eR,g.ox);g.h=eR.prototype; g.h.connect=function(T,Q){if(Q){var k=Q.listId,l=Q.videoId,v=Q.videoIds,L=Q.playerParams,q=Q.clickTrackingParams,Y=Q.index,U={videoId:l},R=Q.currentTime,Z=Q.locationInfo;Q=Q.loopMode;R!==void 0&&(U.currentTime=R<=5?0:R);L&&(U.playerParams=L);Z&&(U.locationInfo=Z);q&&(U.clickTrackingParams=q);k&&(U.listId=k);v&&v.length>0&&(U.videoIds=v.join(","));Y!==void 0&&(U.currentIndex=Y);this.e6&&(U.loopMode=Q||"LOOP_MODE_OFF");k&&(this.T.listId=k);this.T.videoId=l;this.T.index=Y||0;this.T.state=3;ae(this.T, R);this.N="UNSUPPORTED";k=this.e6?"setInitialState":"setPlaylist";$o("Connecting with "+k+" and params: "+g.pL(U));this.S.connect({method:k,params:g.pL(U)},T,F6d())}else $o("Connecting without params"),this.S.connect({},T,F6d());urJ(this)}; g.h.Ca=function(T){this.S.Ca(T)}; g.h.dispose=function(){this.wd()||(g.Tv("yt.mdx.remote.remoteClient_",null),this.publish("beforeDispose"),JR(this,3));g.ox.prototype.dispose.call(this)}; g.h.EK=function(){n_J(this);xEA(this);KbA(this);g.GO(this.j);this.j=NaN;g.GO(this.D);this.D=NaN;this.Y=null;g.CY(this.z9);this.z9.length=0;this.S.dispose();g.ox.prototype.EK.call(this);this.N=this.C=this.L=this.T=this.S=null}; g.h.Nj=function(T){if(!this.L||this.L.length===0)return!1;for(var Q=g.B(this.L),k=Q.next();!k.done;k=Q.next())if(!k.value.capabilities.has(T))return!1;return!0}; g.h.gX=function(){var T=3;this.wd()||(T=0,isNaN(this.CP())?this.S.zM()&&isNaN(this.B)&&(T=1):T=2);return T}; g.h.Cw=function(T){$o("Disconnecting with "+T);g.Tv("yt.mdx.remote.remoteClient_",null);n_J(this);this.publish("beforeDisconnect",T);T==1&&fz();this.S.disconnect(T);this.dispose()}; g.h.a8=function(){var T=this.T;this.Y&&(T=this.T.clone(),nK(T,this.Y,T.index));return dEE(T)}; g.h.Wl_=function(T){var Q=this,k=new cF(T);k.videoId&&k.videoId!=this.T.videoId&&(this.Y=k.videoId,g.GO(this.j),this.j=g.Zq(function(){if(Q.Y){var v=Q.Y;Q.Y=null;Q.T.videoId!=v&&FF(Q,"getNowPlaying")}},5E3)); var l=[];this.T.listId==k.listId&&this.T.videoId==k.videoId&&this.T.index==k.index||l.push("remoteQueueChange");this.T.playerState==k.playerState&&this.T.volume==k.volume&&this.T.muted==k.muted&&uR(this.T)==uR(k)&&g.pL(this.T.trackData)==g.pL(k.trackData)||l.push("remotePlayerChange");this.T.reset(T);g.EA(l,function(v){this.publish(v)},this)}; g.h.X6=function(){var T=this.S.getDeviceId(),Q=g.sA(this.L,function(k){return k.type=="REMOTE_CONTROL"&&k.id!=T}); return Q?Q.id:""}; g.h.CP=function(){return this.S.ZH()}; g.h.Jq=function(){return this.N||"UNSUPPORTED"}; g.h.ZW=function(){return this.C||""}; g.h.De=function(){!isNaN(this.CP())&&this.S.TT()}; g.h.Aue=function(T,Q){FF(this,T,Q);HZd(this)}; g.h.zn=function(){var T=g.uC("SAPISID","")||g.uC("__Secure-1PAPISID")||"",Q=g.uC("__Secure-3PAPISID","")||"";if(!T&&!Q)return"";T=g.dJ(g.wJ(T),2);Q=g.dJ(g.wJ(Q),2);return g.dJ(g.wJ(","+T+","+Q),2)}; eR.prototype.subscribe=eR.prototype.subscribe;eR.prototype.unsubscribeByKey=eR.prototype.Y_;eR.prototype.getProxyState=eR.prototype.gX;eR.prototype.disconnect=eR.prototype.Cw;eR.prototype.getPlayerContextData=eR.prototype.a8;eR.prototype.setPlayerContextData=eR.prototype.Wl_;eR.prototype.getOtherConnectedRemoteId=eR.prototype.X6;eR.prototype.getReconnectTimeout=eR.prototype.CP;eR.prototype.getAutoplayMode=eR.prototype.Jq;eR.prototype.getAutoplayVideoId=eR.prototype.ZW;eR.prototype.reconnect=eR.prototype.De; eR.prototype.sendMessage=eR.prototype.Aue;eR.prototype.getXsrfToken=eR.prototype.zn;eR.prototype.isCapabilitySupportedOnConnectedDevices=eR.prototype.Nj;g.S(VVd,LK);g.h=VVd.prototype;g.h.b5=function(T){return this.Zf.$_gs(T)}; g.h.contains=function(T){return!!this.Zf.$_c(T)}; g.h.get=function(T){return this.Zf.$_g(T)}; g.h.start=function(){this.Zf.$_st()}; g.h.add=function(T,Q,k){this.Zf.$_a(T,Q,k)}; g.h.remove=function(T,Q,k){this.Zf.$_r(T,Q,k)}; g.h.AF=function(T,Q,k,l){this.Zf.$_un(T,Q,k,l)}; g.h.EK=function(){for(var T=this.T.length,Q=0;Q1&&!this.U.getOption("remote","quickCast")?(this.IQ=g.yJ(T,this.T,this),this.VE(g.IQ(T,this.T)),T=this.U.getOption("remote","currentReceiver"),T=this.T(T),this.options[T]&&this.U$(T),this.enable(!0)):this.enable(!1)}; Z$.prototype.T=function(T){return T.key}; Z$.prototype.U4=function(T){return T==="cast-selector-receiver"?"Enviar...":this.IQ[T].name}; Z$.prototype.BT=function(T){g.Hp.prototype.BT.call(this,T);this.U.setOption("remote","currentReceiver",this.IQ[T]);this.YB.sG()};g.S(sPE,g.A4);g.h=sPE.prototype; g.h.create=function(){var T=this.player.G(),Q=g.Ln(T);T={device:"Desktop",app:"youtube-desktop",loadCastApiSetupScript:T.V("mdx_load_cast_api_bootstrap_script"),enableDialLoungeToken:T.V("enable_dial_short_lived_lounge_token"),enableCastLoungeToken:T.V("enable_cast_short_lived_lounge_token")};lh$(Q,T);this.subscriptions.push(g.TA("yt-remote-before-disconnect",this.Z_k,this));this.subscriptions.push(g.TA("yt-remote-connection-change",this.s_m,this));this.subscriptions.push(g.TA("yt-remote-receiver-availability-change",this.oE, this));this.subscriptions.push(g.TA("yt-remote-auto-connect",this.wh6,this));this.subscriptions.push(g.TA("yt-remote-receiver-resumed",this.VVB,this));this.subscriptions.push(g.TA("mdx-privacy-popup-confirm",this.DF9,this));this.subscriptions.push(g.TA("mdx-privacy-popup-cancel",this.fCK,this));this.oE()}; g.h.load=function(){this.player.cancelPlayback();g.A4.prototype.load.call(this);this.GP=new hUp(this.player.G(),this);this.player.zU(this.GP);this.UU=new fhm(this,this.player,this.SV);var T=(T=U8m())?T.currentTime:0;var Q=gu_()?new xo(ok(),void 0):null;T==0&&Q&&(T=uR(PF(Q)));T!==0&&this.bC(T);S2v(this,this.yU,this.yU);this.player.pU(6)}; g.h.unload=function(){this.player.publish("mdxautoplaycanceled");this.player.JO();this.iW=this.BA;g.vU(this.UU,this.SV);this.SV=this.GP=this.UU=null;g.A4.prototype.unload.call(this);this.player.pU(5);f4(this)}; g.h.EK=function(){g.o$(this.subscriptions);g.A4.prototype.EK.call(this)}; g.h.AC=function(T){var Q=g.HT.apply(1,arguments);this.loaded&&this.UU.Pg.apply(this.UU,[T].concat(g.ZH(Q)))}; g.h.getAdState=function(){return this.I2}; g.h.E_=function(){return this.SV?PF(this.SV).E_:!1}; g.h.G0=function(){return this.SV?PF(this.SV).G0:!1}; g.h.bC=function(T,Q){this.AR=T||0;this.player.publish("progresssync",T,Q);this.player.UM("onVideoProgress",T||0)}; g.h.getCurrentTime=function(){return this.AR}; g.h.getDuration=function(){return PF(this.SV).getDuration()||0}; g.h.xM=function(){var T=PF(this.SV);return T.Y?T.T+Du(T):T.T}; g.h.bS=function(){return PF(this.SV).j}; g.h.WG=function(){return wd1(PF(this.SV))}; g.h.r_=function(){var T=PF(this.SV);return T.S>0?T.S+Du(T):T.S}; g.h.getProgressState=function(){var T=PF(this.SV),Q=this.player.getVideoData();return{airingStart:0,airingEnd:0,allowSeeking:T.playerState!=1081&&this.player.Yo(),clipEnd:Q.clipEnd,clipStart:Q.clipStart,current:this.getCurrentTime(),displayedStart:-1,duration:this.getDuration(),ingestionTime:this.xM(),isAtLiveHead:this.isAtLiveHead(),loaded:this.bS(),seekableEnd:this.WG(),seekableStart:this.r_(),offset:0,viewerLivestreamJoinMediaTime:0}}; g.h.isAtLiveHead=function(){return wd1(PF(this.SV))-this.getCurrentTime()<=1}; g.h.nextVideo=function(){this.SV&&this.SV.nextVideo()}; g.h.Bi=function(){this.SV&&this.SV.Bi()}; g.h.Z_k=function(T){T===1&&(this.uZ=this.SV?PF(this.SV):null)}; g.h.s_m=function(){var T=gu_()?new xo(ok(),void 0):null;if(T){var Q=this.iW;this.loaded&&this.unload();this.SV=T;this.uZ=null;Q.key!==this.BA.key&&(this.iW=Q,this.load())}else g.od(this.SV),this.SV=null,this.loaded&&(this.unload(),(T=this.uZ)&&T.videoId===this.player.getVideoData().videoId&&this.player.cueVideoById(T.videoId,uR(T)));this.player.publish("videodatachange","newdata",this.player.getVideoData(),3)}; g.h.oE=function(){var T=[this.BA],Q=T.concat,k=ouE();AR()&&g.cy("yt-remote-cast-available")&&k.push({key:"cast-selector-receiver",name:"Cast..."});this.IQ=Q.call(T,k);T=LAm()||this.BA;Gi(this,T);this.player.UM("onMdxReceiversChange")}; g.h.wh6=function(){var T=LAm();Gi(this,T)}; g.h.VVB=function(){this.iW=LAm()}; g.h.DF9=function(){this.kA=!0;f4(this);gP=!1;vY&&qk(vY,1);vY=null}; g.h.fCK=function(){this.kA=!1;f4(this);Gi(this,this.BA);this.iW=this.BA;gP=!1;vY=null;this.player.playVideo()}; g.h.R2=function(T,Q){switch(T){case "casting":return this.loaded;case "receivers":return this.IQ;case "currentReceiver":return Q&&(Q.key==="cast-selector-receiver"?B1E():Gi(this,Q)),this.loaded?this.iW:this.BA;case "quickCast":return this.IQ.length===2&&this.IQ[1].key==="cast-selector-receiver"?(Q&&B1E(),!0):!1}}; g.h.RF=function(){this.SV.RF()}; g.h.cH=function(){return!1}; g.h.getOptions=function(){return["casting","receivers","currentReceiver","quickCast"]}; g.h.isLoggedIn=function(){var T,Q;return((T=g.$i("PLAYER_CONFIG"))==null?void 0:(Q=T.args)==null?void 0:Q.authuser)!==void 0?!0:!(!g.$i("SESSION_INDEX")&&!g.$i("LOGGED_IN"))};g.ND("remote",sPE);})(_yt_player);