(function(g){var window=this;'use strict';var HF$=function(M,W){return g.uI(M,W)},fqr=function(M){if(M instanceof g.aK)return M; if(typeof M.aE=="function")return M.aE(!1);if(g.mL(M)){let W=0;const b=new g.aK;b.next=function(){for(;;){if(W>=M.length)return g.Q$;if(W in M)return g.EG(M[W++]);W++}}; return b}throw Error("Not implemented");},Rd4=function(M,W,b){if(g.mL(M))g.Py(M,W,b); else for(M=fqr(M);;){const {done:T,value:q}=M.next();if(T)break;W.call(b,q,void 0,M)}},qL=function(M){g.sW(M,"zx",Math.floor(Math.random()*2147483648).toString(36)+Math.abs(Math.floor(Math.random()*2147483648)^g.Hy()).toString(36)); return M},XB=function(M,W,b){Array.isArray(b)||(b=[String(b)]); g.Mr(M.A,W,b)},rXQ=function(M,W){const b=[]; Rd4(W,function(T){let q;try{q=g.RO.prototype.Vh.call(this,T,!0)}catch(X){if(X=="Storage: Invalid value was encountered")return;throw X;}q===void 0?b.push(T):g.fc(q)&&b.push(T)},M); return b},xCI=function(M,W){rXQ(M,W).forEach(function(b){g.RO.prototype.remove.call(this,b)},M)},FD4=function(M){if(M.d9){if(M.d9.locationOverrideToken)return{locationOverrideToken:M.d9.locationOverrideToken}; if(M.d9.latitudeE7!=null&&M.d9.longitudeE7!=null)return{latitudeE7:M.d9.latitudeE7,longitudeE7:M.d9.longitudeE7}}return null},iFp=function(M,W){g.ME(M,W)||M.push(W)},jJ=function(M){let W=0; for(const b in M)W++;return W},hdB=function(M){try{return g.yp.JSON.parse(M)}catch(W){}M=String(M); if(/^\s*$/.test(M)?0:/^[\],:{}\s\u2028\u2029]*$/.test(M.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("("+M+")")}catch(W){}throw Error("Invalid JSON string: "+M);},G$=function(M){if(g.yp.JSON)try{return g.yp.JSON.parse(M)}catch(W){}return hdB(M)},AXI=function(M,W,b,T){const q=new g.Sm(null); M&&g.OW(q,M);W&&g.Pc(q,W);b&&g.em(q,b);T&&(q.V=T);return q},zdp=function(M,W){return new g.d2s(M,W)},Ve=function(M,W){return Object.prototype.hasOwnProperty.call(M,W)},uX4=function(M,W){return M===W},JR=function(M,W){this.V={}; this.Z=[];this.BV=this.size=0;var b=arguments.length;if(b>1){if(b%2)throw Error("Uneven number of arguments");for(var T=0;T{M.capabilities.add(b)})},OFQ=function(M,W){M.compatibleSenderThemes.clear(); g.et(W.split(","),g.Na(HF$,dCQ)).forEach(b=>{M.compatibleSenderThemes.add(b)})},Pvc=function(M,W){M.experiments.clear(); W.split(",").forEach(b=>{M.experiments.add(b)})},ab=function(M){M=M||{}; this.name=M.name||"";this.id=M.id||M.screenId||"";this.token=M.token||M.loungeToken||"";this.uuid=M.uuid||M.dialId||"";this.idType=M.screenIdType||"normal";this.secret=M.screenIdSecret||""},EM=function(M,W){return!!W&&(M.id==W||M.uuid==W)},ozc=function(M){return{name:M.name, screenId:M.id,loungeToken:M.token,dialId:M.uuid,screenIdType:M.idType,screenIdSecret:M.secret}},cXQ=function(M){return new ab(M)},Q3B=function(M){return Array.isArray(M)?g.dG(M,cXQ):[]},n4=function(M){return M?`{name:"${M.name}",id:${M.id.substr(0,6)}..,token:${M.token?".."+M.token.slice(-6):"-"},uuid:${M.uuid?".."+M.uuid.slice(-6):"-"},idType:${M.idType},secret:${M.secret?".."+M.secret.slice(-6):"-"}}`:"null"},ye=function(M){return Array.isArray(M)?"["+g.dG(M,n4).join(",")+"]":"null"},UM=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function(M){const W=Math.random()*16|0; return(M=="x"?W:W&3|8).toString(16)})},gzc=function(M){return g.dG(M,function(W){return{key:W.id, name:W.name}})},C4=function(M,W){return g.pt(M,function(b){return b||W?!b!=!W?!1:b.id==W.id:!0})},kY=function(M,W){return g.pt(M,function(b){return EM(b,W)})},s3J=function(){const M=g.Ys.a_(); M&&xCI(M,M.A6.aE(!0))},K4=function(){const M=g.MZ("yt-remote-connected-devices")||[]; g.v$(M);return M},wIB=function(M){if(M.length==0)return[]; const W=M[0].indexOf("#"),b=W==-1?M[0]:M[0].substring(0,W);return g.dG(M,function(T,q){return q==0?T:T.substring(b.length)})},pI5=function(M){g.$u("yt-remote-connected-devices",M,86400)},me=function(){if(v3)return v3; let M=g.MZ("yt-remote-device-id");M||(M=UM(),g.$u("yt-remote-device-id",M,31536E3));const W=K4();let b=1,T=M;for(;g.ME(W,T);)b++,T=M+"#"+b;return v3=T},L4=function(){let M=K4(); const W=me();g.b1()&&g.ZB(M,W);M=wIB(M);if(M.length==0)try{g.qG("remote_sid")}catch(b){}else try{g.Td("remote_sid",M.join(","),-1)}catch(b){}},Yu9=function(){return g.MZ("yt-remote-session-browser-channel")},$SQ=function(){return g.MZ("yt-remote-local-screens")||[]},Mkc=function(){g.$u("yt-remote-lounge-token-expiration",!0,86400)},WIc=function(M){M.length>5&&(M=M.slice(M.length-5)); const W=g.dG($SQ(),function(T){return T.loungeToken}),b=g.dG(M,function(T){return T.loungeToken}); g.sq(b,function(T){return!g.ME(W,T)})&&Mkc(); g.$u("yt-remote-local-screens",M,31536E3)},lK=function(M){M||(g.W8("yt-remote-session-screen-id"),g.W8("yt-remote-session-video-id")); L4();M=K4();g.X9(M,me());pI5(M)},bNp=function(){if(!tR){const M=g.us(); M&&(tR=new g.tt(M))}},Ti5=function(){bNp(); return tR?!!tR.get("yt-remote-use-staging-server"):!1},ZH=function(M,W){g.w0[M]=!0; const b=g.g0();b&&b.publish.apply(b,arguments);g.w0[M]=!1},Ib=function(){let M=window.navigator.userAgent.match(/Chrome\/([0-9]+)/); return M?parseInt(M[1],10):0},qj9=function(M){return!!document.currentScript&&(document.currentScript.src.indexOf("?"+M)!=-1||document.currentScript.src.indexOf("&"+M)!=-1)},X7A=function(){return typeof window.__onGCastApiAvailable=="function"?window.__onGCastApiAvailable:null},NL=function(M){M.length?jg9(M.shift(),function(){NL(M)}):H3()},H3=function(){let M=X7A(); M&&M(!1,"No cast extension found")},jg9=function(M,W,b){let T=document.createElement("script"); T.onerror=W;b&&(T.onload=b);g.Yp(T,g.We(M));(document.head||document.documentElement).appendChild(T)},GPc=function(M){return"chrome-extension://"+M+"/cast_sender.js"},Vkr=function(){const M=Ib(),W=[]; if(M>1){const b=M-1;W.push("//www.gstatic.com/eureka/clank/"+M+"/cast_sender.js");W.push("//www.gstatic.com/eureka/clank/"+b+"/cast_sender.js")}return W},f4=function(){if(Jc4){var M=2,W=X7A(),b=function(){M--; M==0&&W&&W(!0)}; window.__onGCastApiAvailable=b;jg9("//www.gstatic.com/cast/sdk/libs/sender/1.0/cast_framework.js",H3,b)}},BiV=function(){f4(); let M=Vkr();M.push("//www.gstatic.com/eureka/clank/cast_sender.js");NL(M)},aop=function(){f4(); let M=Vkr();M.push(...DSE.map(GPc));M.push("//www.gstatic.com/eureka/clank/cast_sender.js");NL(M)},Rb=function(M,W,b){g.gz.call(this); this.C=b!=null?(0,g.IJ)(M,b):M;this.nT=W;this.S=(0,g.IJ)(this.Jd,this);this.Z=!1;this.V=0;this.B=this.J5=null;this.A=[]},rs=function(){this.Z=g.Hy()},EQc=function(){xY||(xY=new rs)},nQr=function(){xY||(xY=new rs)},FB=function(){g.wi.call(this,"p")},iK=function(){g.wi.call(this,"o")},hR=function(){return yc5=yc5||new g.Uo},US9=function(M){g.wi.call(this,"serverreachability",M)},AR=function(M){const W=hR(); W.dispatchEvent(new US9(W,M))},CJ7=function(M){g.wi.call(this,"statevent",M)},z$=function(M){const W=hR(); W.dispatchEvent(new CJ7(W,M))},kPV=function(M,W,b,T){g.wi.call(this,"timingevent",M); this.size=W;this.rtt=b;this.retries=T},uK=function(M,W){if(typeof M!=="function")throw Error("Fn must not be null and must be a function"); return g.yp.setTimeout(function(){M()},W)},SJ=function(){},OM=function(M,W,b,T){this.B=M; this.A=W;this.vP=b;this.d9=T||1;this.EY=new g.Tw(this);this.wK=45E3;this.lV=null;this.C=!1;this.X=this.Lp=this.D=this.An=this.Zs=this.Ds=this.gK=null;this.O=[];this.Z=null;this.W=0;this.S=this.sY=null;this.bV=-1;this.BY=!1;this.jT=0;this.MK=null;this.OY=this.xk=this.XX=this.yz=!1;this.V=new KIB},KIB=function(){this.B=null; this.Z="";this.V=!1},P3=function(M,W,b){M.An=1; M.D=qL(W.clone());M.X=b;M.yz=!0;vQQ(M,null)},vQQ=function(M,W){M.Zs=Date.now(); eJ(M);M.Lp=M.D.clone();XB(M.Lp,"t",M.d9);M.W=0;const b=M.B.xk;M.V=new KIB;M.Z=mSE(M.B,b?W:null,!M.X);M.jT>0&&(M.MK=new g.El((0,g.IJ)(M.rB,M,M.Z),M.jT));M.EY.listen(M.Z,"readystatechange",M.Y$);W=M.lV?g.c$(M.lV):{};M.X?(M.sY||(M.sY="POST"),W["Content-Type"]="application/x-www-form-urlencoded",M.Z.send(M.Lp,M.sY,M.X,W)):(M.sY="GET",M.Z.send(M.Lp,M.sY,null,W));AR(1)},loh=function(M){if(!LIQ(M))return g.Ri(M.Z); const W=g.ru(M.Z);if(W==="")return"";let b="";const T=W.length,q=g.NO(M.Z)==4;if(!M.V.B){if(typeof TextDecoder==="undefined")return ds(M),ob(M),"";M.V.B=new g.yp.TextDecoder}for(let X=0;XW.length)return c3;W=W.slice(T,T+b);M.W=T+b;return W},eJ=function(M){M.Ds=Date.now()+M.wK; Io4(M,M.wK)},Io4=function(M,W){if(M.gK!=null)throw Error("WatchDog timer not null"); M.gK=uK((0,g.IJ)(M.GA,M),W)},Qe=function(M){M.gK&&(g.yp.clearTimeout(M.gK),M.gK=null)},ob=function(M){M.B.Cz()||M.BY||NiA(M.B,M)},ds=function(M){Qe(M); g.cG(M.MK);M.MK=null;M.EY.removeAll();if(M.Z){const W=M.Z;M.Z=null;W.abort();W.dispose()}},bn=function(M,W){try{var b=M.B; if(b.Gs!=0&&(b.Z==M||gs(b.V,M)))if(!M.xk&&gs(b.V,M)&&b.Gs==3){try{var T=b.m$.Z.parse(W)}catch(B){T=null}if(Array.isArray(T)&&T.length==3){var q=T;if(q[0]==0)a:{if(!b.D){if(b.Z)if(b.Z.Zs+3E30&&(b.jT=1.5*E);T=b;const n=M.uE();if(n){const C=g.Fp(n,"X-Client-Wire-Protocol");if(C){var X=T.V;!X.Z&&(g.qR(C,"spdy")||g.qR(C,"quic")||g.qR(C,"h2"))&&(X.A=X.S,X.Z=new Set,X.V&&(MK(X,X.V),X.V=null))}if(T.yz){const l=g.Fp(n,"X-HTTP-Session-Id");l&&(T.nz=l,g.sW(T.lV,T.yz,l))}}b.Gs=3;b.S&&b.S.HQ();b.fv&&(b.FT=Date.now()-M.Zs);T=b;var G=M;T.aT=HN$(T,T.xk? T.vP:null,T.oT);if(G.xk){fo7(T.V,G);var V=G,J=T.jT;J&&V.setTimeout(J);V.gK&&(Qe(V),eJ(V));T.Z=G}else RFc(T);b.B.length>0&&Ww(b)}else B[0]!="stop"&&B[0]!="close"||$1(b,7);else b.Gs==3&&(B[0]=="stop"||B[0]=="close"?B[0]=="stop"?$1(b,7):b.disconnect():B[0]!="noop"&&b.S&&b.S.LQ(B),b.O=0)}AR(4)}catch(B){}},rc5=function(M){this.S=M||10; g.yp.PerformanceNavigationTiming?(M=g.yp.performance.getEntriesByType("navigation"),M=M.length>0&&(M[0].nextHopProtocol=="hq"||M[0].nextHopProtocol=="h2")):M=!!(g.yp.chrome&&g.yp.chrome.loadTimes&&g.yp.chrome.loadTimes()&&g.yp.chrome.loadTimes().wasFetchedViaSpdy);this.A=M?this.S:1;this.Z=null;this.A>1&&(this.Z=new Set);this.V=null;this.B=[]},xSp=function(M){return M.V?!0:M.Z?M.Z.size>=M.A:!1},YY=function(M){return M.V?1:M.Z?M.Z.size:0},gs=function(M,W){return M.V?M.V==W:M.Z?M.Z.has(W):!1},MK=function(M, W){M.Z?M.Z.add(W):M.V=W},fo7=function(M,W){M.V&&M.V==W?M.V=null:M.Z&&M.Z.has(W)&&M.Z.delete(W)},TE=function(M){if(M.V!=null)return M.B.concat(M.V.O); if(M.Z!=null&&M.Z.size!==0){let W=M.B;for(const b of M.Z.values())W=W.concat(b.O);return W}return g.Vh(M.B)},FIB=function(M,W){const b=new SJ; if(g.yp.Image){const T=new Image;T.onload=g.Na(qK,b,"TestLoadImage: loaded",!0,W,T);T.onerror=g.Na(qK,b,"TestLoadImage: error",!1,W,T);T.onabort=g.Na(qK,b,"TestLoadImage: abort",!1,W,T);T.ontimeout=g.Na(qK,b,"TestLoadImage: timeout",!1,W,T);g.yp.setTimeout(function(){if(T.ontimeout)T.ontimeout()},1E4); T.src=M}else W(!1)},iNI=function(M,W){const b=new SJ,T=new AbortController,q=setTimeout(()=>{T.abort(); qK(b,"TestPingServer: timeout",!1,W)},1E4); fetch(M,{signal:T.signal}).then(X=>{clearTimeout(q);X.ok?qK(b,"TestPingServer: ok",!0,W):qK(b,"TestPingServer: server error",!1,W)}).catch(()=>{clearTimeout(q); qK(b,"TestPingServer: error",!1,W)})},qK=function(M,W,b,T,q){try{q&&(q.onload=null,q.onerror=null,q.onabort=null,q.ontimeout=null),T(b)}catch(X){}},hFh=function(){this.Z=new X0},jS=function(M,W,b){return b&&b.S8?b.S8[M]||W:W},Ac$=function(M){this.B=[]; this.vP=this.aT=this.lV=this.oT=this.Z=this.nz=this.yz=this.BY=this.W=this.XX=this.X=null;this.sj=this.Lp=0;this.EX=jS("failFast",!1,M);this.MK=this.gK=this.D=this.C=this.S=null;this.cP=!0;this.A5=this.An=-1;this.d9=this.O=this.Zs=0;this.GY=jS("baseRetryDelayMs",5E3,M);this.p7=jS("retryDelaySeedMs",1E4,M);this.k_=jS("forwardChannelMaxRetries",2,M);this.s2=jS("forwardChannelRequestTimeoutMs",2E4,M);this.x_=M&&M.CnK||void 0;this.XP=M&&M.Iak||void 0;this.Hr=M&&M.mZv||!1;this.jT=void 0;this.xk=M&&M.PK|| !1;this.A="";this.V=new rc5(M&&M.bNT);this.Y9=Math.min(M&&M.VOK||1E3,1E3);this.m$=new hFh;this.EY=M&&M.xpY||!1;this.Ds=M&&M.y1X||!1;this.EY&&this.Ds&&(this.Ds=!1);this.GN=M&&M.Dds||!1;M&&M.fyT&&(this.cP=!1);this.fv=!this.EY&&this.cP&&M&&M.t2X||!1;this.WP=void 0;M&&M.RM&&M.RM>0&&(this.WP=M.RM);this.bV=void 0;this.FT=0;this.wK=!1;this.OY=this.sY=null},ws=function(M){M.Z&&(GE(M),M.Z.cancel(),M.Z=null)},zF7=function(M){ws(M); M.D&&(g.yp.clearTimeout(M.D),M.D=null);sM(M);M.V.cancel();M.C&&(typeof M.C==="number"&&g.yp.clearTimeout(M.C),M.C=null)},Ww=function(M){xSp(M.V)||M.C||(M.C=!0,g.xS(M.Sb,M),M.Zs=0)},Sjp=function(M,W){if(YY(M.V)>=M.V.A-(M.C?1:0))return!1; if(M.C)return M.B=W.O.concat(M.B),!0;if(M.Gs==1||M.Gs==2||M.Zs>=(M.EX?0:M.k_))return!1;M.C=uK((0,g.IJ)(M.Sb,M,W),uyE(M,M.Zs));M.Zs++;return!0},PJc=function(M,W){var b; W?b=W.vP:b=M.Lp++;const T=M.lV.clone();g.sW(T,"SID",M.A);g.sW(T,"RID",b);g.sW(T,"AID",M.An);VO(M,T);M.W&&M.X&&g.bT(T,M.W,M.X);b=new OM(M,M.A,b,M.Zs+1);M.W===null&&(b.lV=M.X);W&&(M.B=W.O.concat(M.B));W=ONp(M,b,M.Y9);b.setTimeout(Math.round(M.s2*.5)+Math.round(M.s2*.5*Math.random()));MK(M.V,b);P3(b,T,W)},VO=function(M,W){M.BY&&g.NE(M.BY,function(b,T){g.sW(W,T,b)}); M.S&&g.NE({},function(b,T){g.sW(W,T,b)})},ONp=function(M,W,b){b=Math.min(M.B.length,b); const T=M.S?(0,g.IJ)(M.S.Fu,M.S,M):null;a:{var q=M.B;let V=-1;for(;;){const J=["count="+b];V==-1?b>0?(V=q[0].Z,J.push("ofs="+V)):V=0:J.push("ofs="+V);let B=!0;for(let D=0;D=3)return!1; M.d9++;M.D=uK((0,g.IJ)(M.fQ,M),uyE(M,M.O));M.O++;return!0},GE=function(M){M.sY!=null&&(g.yp.clearTimeout(M.sY),M.sY=null)},eFp=function(M){M.Z=new OM(M,M.A,"rpc",M.d9); M.W===null&&(M.Z.lV=M.X);M.Z.jT=0;var W=M.aT.clone();g.sW(W,"RID","rpc");g.sW(W,"SID",M.A);g.sW(W,"AID",M.An);g.sW(W,"CI",M.MK?"0":"1");!M.MK&&M.WP&&g.sW(W,"TO",M.WP);g.sW(W,"TYPE","xmlhttp");VO(M,W);M.W&&M.X&&g.bT(W,M.W,M.X);M.jT&&M.Z.setTimeout(M.jT);var b=M.Z;M=M.vP;b.An=1;b.D=qL(W.clone());b.X=null;b.yz=!0;vQQ(b,M)},sM=function(M){M.gK!=null&&(g.yp.clearTimeout(M.gK),M.gK=null)},NiA=function(M,W){var b=null; if(M.Z==W){sM(M);GE(M);M.Z=null;var T=2}else if(gs(M.V,W))b=W.O,fo7(M.V,W),T=1;else return;if(M.Gs!=0)if(W.C)if(T==1){b=W.X?W.X.length:0;W=Date.now()-W.Zs;var q=M.Zs;T=hR();T.dispatchEvent(new kPV(T,b,W,q));Ww(M)}else RFc(M);else{var X=W.bV;q=W.getLastError();if(q==3||q==0&&X>0||!(T==1&&Sjp(M,W)||T==2&&p4(M)))switch(b&&b.length>0&&(W=M.V,W.B=W.B.concat(b)),q){case 1:$1(M,5);break;case 4:$1(M,10);break;case 3:$1(M,6);break;default:$1(M,2)}}},uyE=function(M,W){let b=M.GY+Math.floor(Math.random()*M.p7); M.isActive()||(b*=2);return b*W},$1=function(M,W){if(W==2){var b=(0,g.IJ)(M.xN,M),T=M.XP; const q=!T;T=new g.Sm(T||"//www.google.com/images/cleardot.gif");g.yp.location&&g.yp.location.protocol=="http"||g.OW(T,"https");qL(T);q?FIB(T.toString(),b):iNI(T.toString(),b)}else z$(2);M.Gs=0;M.S&&M.S.KQ(W);dSJ(M);zF7(M)},dSJ=function(M){M.Gs=0; M.OY=[];if(M.S){const W=TE(M.V);if(W.length!=0||M.B.length!=0)g.J7(M.OY,W),g.J7(M.OY,M.B),M.V.B.length=0,g.Vh(M.B),M.B.length=0;M.S.iz()}},oQ5=function(M){if(M.Gs==0)return M.OY; let W=[];g.J7(W,TE(M.V));g.J7(W,M.B);return W},HN$=function(M,W,b){var T=g.wj(b); T.Z!=""?(W&&g.Pc(T,W+"."+T.Z),g.em(T,T.B)):(T=g.yp.location,T=AXI(T.protocol,W?W+"."+T.hostname:T.hostname,+T.port,b));W=M.yz;b=M.nz;W&&b&&g.sW(T,W,b);g.sW(T,"VER",M.Mo);VO(M,T);return T},mSE=function(M,W,b){if(W&&!M.xk)throw Error("Can't create secondary domain capable XhrIo object."); W=M.Hr&&!M.x_?new g.my(new g.iE({p8:b})):new g.my(M.x_);W.W=M.xk;return W},cc$=function(){},QgE=function(){},Bw=function(M,W){g.Uo.call(this); this.Z=new Ac$(W);this.C=M;this.V=W&&W.BB||null;M=W&&W.V_||null;W&&W.agk&&(M?M["X-Client-Protocol"]="webchannel":M={"X-Client-Protocol":"webchannel"});this.Z.X=M;M=W&&W.beK||null;W&&W.lQ&&(M?M["X-WebChannel-Content-Type"]=W.lQ:M={"X-WebChannel-Content-Type":W.lQ});W&&W.zS&&(M?M["X-WebChannel-Client-Profile"]=W.zS:M={"X-WebChannel-Client-Profile":W.zS});this.Z.XX=M;(M=W&&W.FvV)&&!g.Tp(M)&&(this.Z.W=M);this.W=W&&W.PK||!1;this.S=W&&W.QqK||!1;(W=W&&W.Aq)&&!g.Tp(W)&&(this.Z.yz=W,g.z4(this.V,W)&&(M=this.V, W in M&&delete M[W]));this.B=new Jv(this)},gQr=function(M){FB.call(this); M.__headers__&&(this.headers=M.__headers__,this.statusCode=M.__status__,delete M.__headers__,delete M.__status__);const W=M.__sm__;W?this.data=(this.Z=g.x5(W))?g.dV(W,this.Z):W:this.data=M},sgr=function(M){iK.call(this); this.status=1;this.errorCode=M},Jv=function(M){this.Z=M},Di=function(M,W){this.A=M; this.Z=W},a4=function(M,W){if(typeof M!=="function")throw Error("Fn must not be null and must be a function"); return g.yp.setTimeout(function(){M()},W)},nK=function(){Ez.dispatchEvent(new w7V)},yO=function(M,W,b,T){this.Z=M; this.A=W;this.W=b;this.C=T||1;this.V=45E3;this.B=new g.Tw(this);this.S=new g.$N;this.S.setInterval(250)},Yj$=function(M,W,b){M.HT=1; M.r_=qL(W.clone());M.Sm=b;M.yz=!0;p75(M,null)},Uz=function(M,W,b,T,q){M.HT=1; M.r_=qL(W.clone());M.Sm=null;M.yz=b;q&&(M.Yt=!1);p75(M,T)},p75=function(M,W){M.Ss=Date.now(); CK(M);M.Lg=M.r_.clone();XB(M.Lg,"t",M.C);M.mV=0;M.Bg=M.Z.DX(M.Z.Ks()?W:null);M.zB>0&&(M.Kg=new g.El((0,g.IJ)(M.oh,M,M.Bg),M.zB));M.B.listen(M.Bg,"readystatechange",M.bT);W=M.MY?g.c$(M.MY):{};M.Sm?(M.o7="POST",W["Content-Type"]="application/x-www-form-urlencoded",M.Bg.send(M.Lg,M.o7,M.Sm,W)):(M.o7="GET",M.Yt&&!g.bq&&(W.Connection="close"),M.Bg.send(M.Lg,M.o7,null,W));M.Z.Bj(1)},Mqc=function(M,W){var b=M.mV,T=W.indexOf("\n",b); if(T==-1)return k1;b=Number(W.substring(b,T));if(isNaN(b))return $B7;T+=1;if(T+b>W.length)return k1;W=W.slice(T,T+b);M.mV=T+b;return W},CK=function(M){M.N_=Date.now()+M.V; W4p(M,M.V)},W4p=function(M,W){if(M.ZW!=null)throw Error("WatchDog timer not null"); M.ZW=a4((0,g.IJ)(M.aP,M),W)},bGQ=function(M){M.ZW&&(g.yp.clearTimeout(M.ZW),M.ZW=null)},KK=function(M){M.Z.Cz()||M.xp||M.Z.JV(M)},vw=function(M){bGQ(M); g.cG(M.Kg);M.Kg=null;M.S.stop();M.B.removeAll();if(M.Bg){const W=M.Bg;M.Bg=null;W.abort();W.dispose()}M.D$&&(M.D$=null)},TAB=function(M,W){try{M.Z.mY(M,W),M.Z.Bj(4)}catch(b){}},XsE=function(M,W,b,T,q){if(T==0)b(!1); else{var X=q||0;T--;qo5(M,W,function(G){G?b(!0):g.yp.setTimeout(function(){XsE(M,W,b,T,X)},X)})}},qo5=function(M,W,b){const T=new Image; T.onload=function(){try{mu(T),b(!0)}catch(q){}}; T.onerror=function(){try{mu(T),b(!1)}catch(q){}}; T.onabort=function(){try{mu(T),b(!1)}catch(q){}}; T.ontimeout=function(){try{mu(T),b(!1)}catch(q){}}; g.yp.setTimeout(function(){if(T.ontimeout)T.ontimeout()},W); T.src=M},mu=function(M){M.onload=null; M.onerror=null;M.onabort=null;M.ontimeout=null},jk9=function(M){this.Z=M; this.V=new X0},GjB=function(M){const W=LK(M.Z,M.Xb,"/mail/images/cleardot.gif"); qL(W);XsE(W.toString(),5E3,(0,g.IJ)(M.pn,M),3,2E3);M.Bj(1)},tv=function(M){var W=M.Z.C; W!=null?(nK(),W?(nK(),ln(M.Z,M,!1)):(nK(),ln(M.Z,M,!0))):(M.Eg=new yO(M),M.Eg.MY=M.eS,W=M.Z,W=LK(W,W.Ks()?M.wd:null,M.GB),nK(),XB(W,"TYPE","xmlhttp"),Uz(M.Eg,W,!1,M.wd,!1))},Zi=function(M,W,b){this.Z=1; this.V=[];this.B=[];this.S=new X0;this.X=M||null;this.C=W!=null?W:null;this.D=b||!1},Vqc=function(M,W){this.Z=M; this.map=W;this.context=null},Jq$=function(M,W,b,T){g.wi.call(this,"timingevent",M); this.size=W;this.rtt=b;this.retries=T},BAp=function(M){g.wi.call(this,"serverreachability",M)},DBE=function(M){M.k$(1,0); M.Cg=LK(M,null,M.ET);I4(M)},amV=function(M){M.c$&&(M.c$.abort(),M.c$=null); M.E1&&(M.E1.cancel(),M.E1=null);M.PH&&(g.yp.clearTimeout(M.PH),M.PH=null);NK(M);M.vO&&(M.vO.cancel(),M.vO=null);M.uv&&(g.yp.clearTimeout(M.uv),M.uv=null)},Hw=function(M,W){if(M.Z==0)throw Error("Invalid operation: sending map when state is closed"); M.V.push(new Vqc(M.Ux++,W));M.Z!=2&&M.Z!=3||I4(M)},ESh=function(M){let W=0; M.E1&&W++;M.vO&&W++;return W},I4=function(M){M.vO||M.uv||(M.uv=a4((0,g.IJ)(M.WQ,M),0),M.sz=0)},yqB=function(M,W){if(M.Z==1){if(!W){M.HC=Math.floor(Math.random()*1E5); W=M.HC++;const b=new yO(M,"",W);b.MY=M.nu;const T=fK(M),q=M.Cg.clone();g.sW(q,"RID",W);g.sW(q,"CVER","1");R4(M,q);Yj$(b,q,T);M.vO=b;M.Z=2}}else M.Z==3&&(W?nSV(M,W):M.V.length==0||M.vO||nSV(M))},nSV=function(M,W){if(W)if(M.Ko>6){M.V=M.B.concat(M.V); M.B.length=0;var b=M.HC-1;W=fK(M)}else b=W.W,W=W.Sm;else b=M.HC++,W=fK(M);const T=M.Cg.clone();g.sW(T,"SID",M.A);g.sW(T,"RID",b);g.sW(T,"AID",M.tS);R4(M,T);b=new yO(M,M.A,b,M.sz+1);b.MY=M.nu;b.setTimeout(1E4+Math.round(1E4*Math.random()));M.vO=b;Yj$(b,T,W)},R4=function(M,W){M.YS&&(M=M.YS.Jo())&&g.NE(M,function(b,T){g.sW(W,T,b)})},fK=function(M){const W=Math.min(M.V.length,1E3),b=["count="+W]; let T;M.Ko>6&&W>0?(T=M.V[0].Z,b.push("ofs="+T)):T=0;for(let q=0;q=3)return!1; M.W++;M.PH=a4((0,g.IJ)(M.jb,M),CU5(M,M.dc));M.dc++;return!0},ln=function(M,W,b){M.tV=M.C==null?b:!M.C; M.Y7=W.Av;M.D||DBE(M)},NK=function(M){M.Lo!=null&&(g.yp.clearTimeout(M.Lo),M.Lo=null)},CU5=function(M,W){let b=5E3+Math.floor(Math.random()*1E4); M.isActive()||(b*=2);return b*W},x1=function(M,W){if(W==2||W==9){var b=null; M.YS&&(b=null);var T=(0,g.IJ)(M.r$,M);b||(b=new g.Sm("//www.google.com/images/cleardot.gif"),qL(b));qo5(b.toString(),1E4,T)}else nK();kjc(M,W)},kjc=function(M,W){M.Z=0; M.YS&&M.YS.zc(W);K47(M);amV(M)},K47=function(M){M.Z=0; M.Y7=-1;if(M.YS)if(M.B.length==0&&M.V.length==0)M.YS.n5();else{const W=g.Vh(M.B),b=g.Vh(M.V);M.B.length=0;M.V.length=0;M.YS.n5(W,b)}},LK=function(M,W,b){let T=g.wj(b); if(T.Z!="")W&&g.Pc(T,W+"."+T.Z),g.em(T,T.B);else{const q=window.location;T=AXI(q.protocol,W?W+"."+q.hostname:q.hostname,+q.port,b)}M.Ls&&g.NE(M.Ls,function(q,X){g.sW(T,X,q)}); g.sW(T,"VER",M.Ko);R4(M,T);return T},vSJ=function(){},mB4=function(){this.Z=[]; this.V=[]},L4$=function(M,W){this.action=M; this.params=W||{}},F0=function(M,W){g.gz.call(this); this.Z=new g.d9(this.q5,0,this);g.t(this,this.Z);this.nT=5E3;this.retryCount=this.g4=0;if(typeof M==="function")W&&(M=(0,g.IJ)(M,W));else if(M&&typeof M.handleEvent==="function")M=(0,g.IJ)(M.handleEvent,M);else throw Error("Invalid listener argument");this.V=M},hv=function(M,W,b=!1,T=()=>"",q=!1,X=!1,G=!1,V=()=>g.fG({}),J=!1,B,D){this.xk=M; this.Zs=W;this.W=new g.ls;this.C=D;this.V=(this.B=!!B)?B(()=>{this.xU()}):new F0(this.xU,this); this.Z=null;this.X=!1;this.O=null;this.yz="";this.sY=this.gK=0;this.A=[];this.bV=b;this.lV=T;this.D=X;this.An=V;this.XX=G;this.BY=null;this.S=g.fG();this.OY=q;this.EY=J;this.wK=new lmp;this.MK=new tqJ;this.Ds=new ZG$;this.jT=new ImE;this.Lp=new NA5;this.d9=new HGJ;this.vP=new fmI},R4E=function(M,W,b,T,q){Av(M); if(M.Z){const X=g.F("ID_TOKEN"),G=M.Z.nu||{};X?G["x-youtube-identity-token"]=X:delete G["x-youtube-identity-token"];M.Z.nu=G}T?(T.getState()!=3&&ESh(T)==0||T.getState(),M.Z.connect(W,b,M.Zs,T.A,T.tS)):q?M.Z.connect(W,b,M.Zs,q.sessionId,q.arrayId):M.Z.connect(W,b,M.Zs);M.B&&!M.V.isActive()&&M.V.start();M.C&&M.C.rjz()},xB9=function(M,W){return M.EY?!Object.values(rq$).includes(W):!1},F44=async function(M){try{await zE(M)}finally{var W=M.A; M.A=[];var b=W;W=W.length;for(let T=0;T{if(M.Z){let b=M.Z.nu||{}; W&&Object.keys(W).length>0?b={...b,...W}:delete b.Authorization;M.Z.nu=b}}).JD(()=>{}),()=>{M.BY=null})},SS=function(M){this.scheme="https"; this.port=this.domain="";this.Z="/api/lounge";this.V=!0;M=M||document.location.href;const W=Number(g.pD(M)[4]||null)||"";W&&(this.port=":"+W);this.domain=g.$F(M)||"";M=g.Vd();M.search("MSIE")>=0&&(M=M.match(/MSIE ([\d.]+)/)[1],g.Gp(M,"10.0")<0&&(this.V=!1))},Oz=function(M,W){let b=M.Z; M.V&&(b=M.scheme+"://"+M.domain+M.port+M.Z);return g.JM(b+W,{})},h4h=function(M){g.Xr(M.channel,"m",()=>{M.C=3; M.B.reset();M.D=null;M.W=0;for(const W of M.O)M.channel&&M.channel.send(W);M.O=[];M.publish("webChannelOpened");M.lV.Z("WEB_CHANNEL")}); g.Xr(M.channel,"n",()=>{M.C=0;M.B.isActive()||M.publish("webChannelClosed");const W=M.channel?.A().B();W&&(M.O=[...W]);M.sY.Z("WEB_CHANNEL")}); g.Xr(M.channel,"p",W=>{const b=W.data;b[0]==="gracefulReconnect"?(M.B.start(),M.channel&&M.channel.close()):M.publish("webChannelMessage",new L4$(b[0],b[1]));M.Iq=W.statusCode;M.BY.Z("WEB_CHANNEL")}); g.Xr(M.channel,"o",()=>{M.Iq===401||M.B.start();M.publish("webChannelError");M.yz.Z("WEB_CHANNEL","")})},Pw=function(M){const W=M.Zs(); W?M.A["x-youtube-lounge-xsrf-token"]=W:delete M.A["x-youtube-lounge-xsrf-token"]},SoA=function(M,W,b=()=>"",T,q){const X=()=>new hv(Oz(M,"/bc"),W,!1,b,T); return g.he("enable_mdx_web_channel_desktop")?new AqB(()=>new z4r(Oz(M,"/wc"),W,b)):new urh(X,q)},dB9=function(){var M=OGI; PU7();eS.push(M);e4r()},dE=function(M,W){PU7(); const b=oS9(M,String(W));eS.length==0?cqI(b):(e4r(),g.Py(eS,function(T){T(b)}))},o4=function(M){dE("CP",M)},PU7=function(){eS||(eS=g.Ct("yt.mdx.remote.debug.handlers_")||[],g.Uq("yt.mdx.remote.debug.handlers_",eS))},cqI=function(M){const W=(cw+1)%50; cw=W;QO[W]=M;gE||(gE=W==49)},e4r=function(){var M=eS; if(QO[0]){var W=gE?cw:-1;do{W=(W+1)%50;const b=QO[W];g.Py(M,function(T){T(b)})}while(W!=cw); QO=Array(50);cw=-1;gE=!1}},oS9=function(M,W){let b=(Date.now()-Qk4)/1E3; b.toFixed&&(b=b.toFixed(3));const T=[];T.push("[",b+"s","] ");T.push("[","yt.mdx.remote","] ");T.push(M+": "+W,"\n");return T.join("")},sz=function(M){g.b9.call(this); this.C=M;this.screens=[]},gSr=function(M,W){const b=M.get(W.uuid)||M.get(W.id); if(b)return M=b.name,b.id=W.id||b.id,b.name=W.name,b.token=W.token,b.uuid=W.uuid||b.uuid,b.name!=M;M.screens.push(W);return!0},skr=function(M,W){let b=M.screens.length!=W.length; M.screens=g.et(M.screens,function(q){return!!C4(W,q)}); const T=W.length;for(let q=0;q0&&M.AW.idType!="shortLived"); g.$u("yt-remote-automatic-screen-cache",g.dG(M,ozc))},Xk=function(M){M.S=g.MZ("yt-remote-device-id-map")||{}},jG=function(M,W,b){g.b9.call(this); this.yz=b;this.A=M;this.V=W;this.Z=null},GB=function(M,W){M.Z=W; M.publish("sessionScreen",M.Z)},V1p=function(M,W){M.Z&&(M.Z.token=W,qQ(M.A,M.Z)); M.publish("sessionScreen",M.Z)},V2=function(M,W){dE(M.yz,W)},Buh=function(M,W){g.x7(M.gK); M.gK=0;W?M.config_.enableCastLoungeToken&&W.loungeToken?W.deviceId?M.Z&&M.Z.uuid==W.deviceId||(W.loungeTokenRefreshIntervalMs?JJB(M,{name:M.V.friendlyName,screenId:W.screenId,loungeToken:W.loungeToken,dialId:W.deviceId,screenIdType:"shortLived"},W.loungeTokenRefreshIntervalMs):(g.Vr(Error(`No loungeTokenRefreshIntervalMs presents in mdxSessionStatusData: ${JSON.stringify(W)}.`)),J4(M,W.screenId))):(g.Vr(Error(`No device id presents in mdxSessionStatusData: ${JSON.stringify(W)}.`)),J4(M,W.screenId)): J4(M,W.screenId):M.wS(Error("Waiting for session status timed out."))},DOE=function(M){g.x7(M.X); M.X=0;g.x7(M.W);M.W=0;g.x7(M.gK);M.gK=0;g.x7(M.S);M.S=0;g.x7(M.D);M.D=0},aEr=function(M,W){M.info("sendYoutubeMessage_: "+W+" "+g.ys()); const b={};b.type=W;M.B?M.B.sendMessage("urn:x-cast:com.google.youtube.mdx",b,()=>{},(0,g.IJ)(function(){V2(this,"Failed to send message: "+W+".")},M)):V2(M,"Sending yt message without session: "+g.ys(b))},nN5=function(M){aEr(M,"getLoungeToken"); g.x7(M.S);M.S=g.RS(()=>{ENI(M,null)},3E4)},BC=function(M,W){g.x7(M.D); M.D=0;W==0?nN5(M):M.D=g.RS(()=>{nN5(M)},W)},ENI=function(M,W){g.x7(M.S); M.S=0;let b=null;W?W.loungeToken?M.Z?.token==W.loungeToken&&(b="staleLoungeToken"):b="missingLoungeToken":b="noLoungeTokenResponse";b?(M.info("Did not receive a new lounge token in onLoungeToken_ with "+`data: ${JSON.stringify(W)}, error: ${b}`),BC(M,3E4)):(V1p(M,W.loungeToken),BC(M,W.loungeTokenRefreshIntervalMs))},J4=function(M,W){W?(M.info("onConnectedScreenId_: Received screenId: "+W),M.Z&&M.Z.id==W||M.BY(W,b=>{GB(M,b)},()=>M.wS(),5)):M.wS(Error("Waiting for session status timed out."))},yJA= function(M,W,b,T){g.x7(M.W); M.W=0;q04(M.A,W,q=>{q||T<0?b(q):M.W=g.RS(()=>{yJA(M,W,b,T-1)},300)})},JJB=function(M,W,b){M.info(`onConnectedScreenData_: Received screenData: ${JSON.stringify(W)}`); const T=new ab(W);yJA(M,T,q=>{q?(qQ(M.A,T),GB(M,T),BC(M,b)):(g.Vr(Error(`CastSession, RemoteScreen from screenData: ${JSON.stringify(W)} is not online.`)),M.wS())},5)},DL=function(M){return new Promise(W=>{M.Zs=UM(); if(M.lV){const b=new chrome.cast.DialLaunchResponse(!0,UO7(M));W(b);CNI(M)}else M.O=()=>{g.x7(M.gK);M.O=()=>{}; M.gK=NaN;const b=new chrome.cast.DialLaunchResponse(!0,UO7(M));W(b);CNI(M)},M.gK=g.RS(()=>{M.O()},100)})},kAV=function(M){g.x7(M.W); M.W=0;g.x7(M.D);M.D=0;M.S();M.S=()=>{}; g.x7(M.gK)},as=function(M){return!(!M.config_.enableDialLoungeToken||!M.B?.getDialAppInfo)},EZ=function(M,W){M.info(`getDialAppInfoWithTimeout_ ${W}`); as(M)&&(g.x7(M.D),M.D=0,W==0?KyV(M):M.D=g.RS(()=>{KyV(M)},W))},CNI=function(M){M.S=M.A.Y2(M.Zs,M.V.label,M.V.friendlyName,as(M),(W,b)=>{M.S=()=>{}; GB(M,W);W.idType=="shortLived"&&b>0&&EZ(M,b)},W=>{M.S=()=>{}; M.wS(W)})},UO7=function(M){var W={}; W.pairingCode=M.Zs;W.theme=M.An;Ti5()&&(W.env_useStageMdx=1);return g.Vb(W)},vNJ=function(M,W){const b=M.X.receiver.label,T=M.V.friendlyName; return(new Promise(q=>{bSA(M.A,b,W,T,X=>{X&&X.token&&GB(M,X);q(X)},X=>{V2(M,"Failed to get DIAL screen: "+X); q(null)})})).then(q=>q&&q.token?new chrome.cast.DialLaunchResponse(!1):DL(M))},Ly7=function(M,W,b){M.info(`initOnConnectedScreenDataPromise_: Received screenData: ${JSON.stringify(W)}`); const T=new ab(W);return(new Promise(q=>{mOJ(M,T,X=>{X?(qQ(M.A,T),GB(M,T),EZ(M,b)):g.Vr(Error(`DialSession, RemoteScreen from screenData: ${JSON.stringify(W)} is not online.`));q(X)},5)})).then(q=>q?new chrome.cast.DialLaunchResponse(!1):DL(M))},mOJ=function(M,W,b,T){g.x7(M.W); M.W=0;q04(M.A,W,q=>{q||T<0?b(q):M.W=g.RS(()=>{mOJ(M,W,b,T-1)},300)})},KyV=function(M){as(M)&&M.B.getDialAppInfo(W=>{M.info(`getDialAppInfo dialLaunchData: ${JSON.stringify(W)}`); W=W.extraData||{};let b=null;W.loungeToken?M.Z?.token==W.loungeToken&&(b="staleLoungeToken"):b="missingLoungeToken";b?EZ(M,3E4):(V1p(M,W.loungeToken),EZ(M,W.loungeTokenRefreshIntervalMs))},W=>{M.info(`getDialAppInfo error: ${W}`); EZ(M,3E4)})},OGI=function(M){window.chrome&&chrome.cast&&chrome.cast.logMessage&&chrome.cast.logMessage(M)},t1p=function(M){const W=M.V.Gc(); let b=M.Z&&M.Z.V;M=g.dG(W,function(T){b&&EM(T,b.label)&&(b=null);const q=T.uuid?T.uuid:T.id;let X=lE4(this,T);X?(X.label=q,X.friendlyName=T.name):(X=new chrome.cast.Receiver(q,T.name),X.receiverType=chrome.cast.ReceiverType.CUSTOM);return X},M); b&&(b.receiverType!=chrome.cast.ReceiverType.CUSTOM&&(b=new chrome.cast.Receiver(b.label,b.friendlyName),b.receiverType=chrome.cast.ReceiverType.CUSTOM),M.push(b));return M},n6=function(M){return M.D||!!M.B.length||!!M.Z},y2=function(M){dE("Controller",M)},UZ=function(M,W,b){W!=M.Z&&(g.cG(M.Z),(M.Z=W)?(b?M.publish("yt-remote-cast2-receiver-resumed",W.V):M.publish("yt-remote-cast2-receiver-selected",W.V),W.subscribe("sessionScreen",(0,g.IJ)(M.gK,M,W)),W.subscribe("sessionFailed",()=>ZS4(M,W)),W.Z? M.publish("yt-remote-cast2-session-change",W.Z):b&&M.Z.C(null)):M.publish("yt-remote-cast2-session-change",null))},lE4=function(M,W){return W?g.pt(M.B,function(b){return EM(W,b.label)},M):null},ZS4=function(M,W){M.Z==W&&M.publish("yt-remote-cast2-session-failed")},rJ4=function(M,W,b,T){T.disableCastApi?C6("Cannot initialize because disabled by Mdx config."):IEc()?NuQ(W,T)&&(kI(!0),window.chrome&&chrome.cast&&chrome.cast.isAvailable?HSQ(M,b):(window.__onGCastApiAvailable=function(q,X){q?HSQ(M,b):(K6("Failed to load cast API: "+ X),vC(!1),kI(!1),g.W8("yt-remote-cast-available"),g.W8("yt-remote-cast-receiver"),fEA(),b(!1))},T.loadCastApiSetupScript?g.WA(RP7):window.navigator.userAgent.indexOf("Android")>=0&&window.navigator.userAgent.indexOf("Chrome/")>=0&&window.navigator.presentation?Ib()>=60&&BiV():!window.chrome||!window.navigator.presentation||window.navigator.userAgent.indexOf("Edge")>=0?H3():Ib()>=89?aop():(f4(),NL(DSE.map(GPc))))):C6("Cannot initialize because not running Chrome")},fEA=function(){C6("dispose"); const M=mE();M&&M.dispose();g.Uq("yt.mdx.remote.cloudview.instance_",null);xO7(!1);g.$2(L6);L6.length=0},lG=function(){return!!g.MZ("yt-remote-cast-installed")},Fy9=function(){const M=g.MZ("yt-remote-cast-receiver"); return M?M.friendlyName:null},iS7=function(){C6("clearCurrentReceiver"); g.W8("yt-remote-cast-receiver")},hPh=function(){return lG()?mE()?mE().getCastSession():(K6("getCastSelector: Cast is not initialized."),null):(K6("getCastSelector: Cast API is not installed!"),null)},ZL=function(){lG()?mE()?t4()?(C6("Requesting cast selector."),mE().requestSession()):(C6("Wait for cast API to be ready to request the session."),L6.push(g.Yw("yt-remote-cast2-api-ready",ZL))):K6("requestCastSelector: Cast is not initialized."):K6("requestCastSelector: Cast API is not installed!")},Is= function(M,W){t4()?mE().setConnectedScreenStatus(M,W):K6("setConnectedScreenStatus called before ready.")},IEc=function(){var M=g.Vd().search(/ (CrMo|Chrome|CriOS)\//)>=0; return g.XH||M},AJ7=function(M,W){mE().init(M,W)},NuQ=function(M,W){let b=!1; mE()||(M=new NQ(M,W),M.subscribe("yt-remote-cast2-availability-change",function(T){g.$u("yt-remote-cast-available",T);ZH("yt-remote-cast2-availability-change",T)}),M.subscribe("yt-remote-cast2-receiver-selected",function(T){C6("onReceiverSelected: "+T.friendlyName); g.$u("yt-remote-cast-receiver",T);ZH("yt-remote-cast2-receiver-selected",T)}),M.subscribe("yt-remote-cast2-receiver-resumed",function(T){C6("onReceiverResumed: "+T.friendlyName); g.$u("yt-remote-cast-receiver",T);ZH("yt-remote-cast2-receiver-resumed",T)}),M.subscribe("yt-remote-cast2-session-change",function(T){C6("onSessionChange: "+n4(T)); T||g.W8("yt-remote-cast-receiver");ZH("yt-remote-cast2-session-change",T)}),g.Uq("yt.mdx.remote.cloudview.instance_",M),b=!0); C6("cloudview.createSingleton_: "+b);return b},mE=function(){return g.Ct("yt.mdx.remote.cloudview.instance_")},HSQ=function(M,W){vC(!0); kI(!1);AJ7(M,function(b){b?(xO7(!0),g.M9("yt-remote-cast2-api-ready")):(K6("Failed to initialize cast API."),vC(!1),g.W8("yt-remote-cast-available"),g.W8("yt-remote-cast-receiver"),fEA());W(b)})},C6=function(M){dE("cloudview",M)},K6=function(M){dE("cloudview",M)},vC=function(M){C6("setCastInstalled_ "+M); g.$u("yt-remote-cast-installed",M)},t4=function(){return!!g.Ct("yt.mdx.remote.cloudview.apiReady_")},xO7=function(M){C6("setApiReady_ "+M); g.Uq("yt.mdx.remote.cloudview.apiReady_",M)},kI=function(M){g.Uq("yt.mdx.remote.cloudview.initializing_",M)},HC=function(M){this.index=-1; this.videoId=this.listId="";this.volume=this.playerState=-1;this.muted=!1;this.audioTrackId=null;this.S=this.C=0;this.trackData=null;this.hasNext=this.hasPrevious=!1;this.loadedTime=this.B=this.W=this.V=0;this.Z=NaN;this.A=!1;this.reset(M)},f6=function(M){M.audioTrackId=null; M.trackData=null;M.playerState=-1;M.hasPrevious=!1;M.hasNext=!1;M.C=0;M.S=g.Hy();M.V=0;M.W=0;M.B=0;M.loadedTime=0;M.Z=NaN;M.A=!1},Rs=function(M){return M.isPlaying()?(g.Hy()-M.S)/1E3:0},rh=function(M,W){M.C=W; M.S=g.Hy()},xI=function(M){switch(M.playerState){case 1:case 1081:return(g.Hy()-M.S)/1E3+M.C; case -1E3:return 0}return M.C},zPp=function(M){return M.A?M.W+Rs(M):M.W},Fk=function(M,W,b){const T=M.videoId; M.videoId=W;M.index=b;W!=T&&f6(M)},iG=function(M){const W={}; W.index=M.index;W.listId=M.listId;W.videoId=M.videoId;W.playerState=M.playerState;W.volume=M.volume;W.muted=M.muted;W.audioTrackId=M.audioTrackId;W.trackData=g.Qh(M.trackData);W.hasPrevious=M.hasPrevious;W.hasNext=M.hasNext;W.playerTime=M.C;W.playerTimeAt=M.S;W.seekableStart=M.V;W.seekableEnd=M.W;W.duration=M.B;W.loadedTime=M.loadedTime;W.liveIngestionTime=M.Z;return W},up5=function(M){g.Py("nowAutoplaying autoplayDismissed remotePlayerChange remoteQueueChange autoplayModeChange autoplayUpNext previousNextChange multiStateLoopEnabled loopModeChange".split(" "), function(W){this.W.push(this.A.subscribe(W,g.Na(this.xk,W),this))},M)},h4=function(M,W){M.V&&(M.V.removeUpdateListener(M.O),M.V.removeMediaListener(M.X),M.C(null)); M.V=W;M.V&&(o4("Setting cast session: "+M.V.sessionId),M.V.addUpdateListener(M.O),M.V.addMediaListener(M.X),M.V.media.length&&M.C(M.V.media[0]))},A4=function(M){return new HC(M.A.getPlayerContextData())},zB=function(M){return M.getState()==1},SG=function(M,W,b){return(0,g.IJ)(function(T){this.Za("Failed to "+W+" with cast v2 channel. Error code: "+T.code); T.code!=chrome.cast.ErrorCode.TIMEOUT&&(this.Za("Retrying "+W+" using MDx browser channel."),uG(this,W,b))},M)},uG=function(M,W,b){M.A.sendMessage(W,b)},PC=function(M,W,b){const T=A4(M); rh(T,b);T.playerState!=-1E3&&(T.playerState=W);OZ(M,T)},eG=function(M,W){var b=M.S; b.Z.length+b.V.length<50&&M.S.enqueue(W)},OZ=function(M,W){S0r(M); M.A.setPlayerContextData(iG(W));up5(M)},S0r=function(M){g.Py(M.W,function(W){this.A.unsubscribeByKey(W)},M); M.W.length=0},OSr=function(M){const W=M.Z.media,b=M.Z.customData; if(W&&b){var T=A4(M);W.contentId!=T.videoId&&o4("Cast changing video to: "+W.contentId);T.videoId=W.contentId;T.playerState=b.playerState;rh(T,M.Z.getEstimatedTime());OZ(M,T)}else o4("No cast media video. Ignoring state update.")},PNp=function(M){dh("Channel opened"); M.BY&&(M.BY=!1,os(M),M.yz=g.RS(()=>{dh("Timing out waiting for a screen.");M.W(1)},15E3))},MmQ=function(M,W){W=W.message; W.params?dh("Received: action="+W.action+", params="+g.ys(W.params)):dh("Received: action="+W.action+" {}");switch(W.action){case "loungeStatus":W=G$(W.params.devices);M.B=g.dG(W,function(T){return new DH(T)}); W=!!g.pt(M.B,function(T){return T.type=="LOUNGE_SCREEN"}); ePE(M,W);W=M.Lp("mlm");M.publish("multiStateLoopEnabled",W);break;case "loungeScreenDisconnected":g.jp(M.B,function(T){return T.type=="LOUNGE_SCREEN"}); ePE(M,!1);break;case "remoteConnected":let b=new DH(G$(W.params.device));g.pt(M.B,function(T){return T.equals(b)})||iFp(M.B,b); break;case "remoteDisconnected":b=new DH(G$(W.params.device));g.jp(M.B,function(T){return T.equals(b)}); break;case "gracefulDisconnect":break;case "playlistModified":dOh(M,W,"QUEUE_MODIFIED");break;case "nowPlaying":oNE(M,W);break;case "onStateChange":cJ$(M,W);break;case "onAdStateChange":Qi5(M,W);break;case "onVolumeChanged":gNV(M,W);break;case "onSubtitlesTrackChanged":siV(M,W);break;case "nowAutoplaying":wDE(M,W);break;case "autoplayDismissed":M.publish("autoplayDismissed");break;case "autoplayUpNext":pDh(M,W);break;case "onAutoplayModeChanged":Y0p(M,W);break;case "onHasPreviousNextChanged":$tc(M, W);break;case "requestAssistedSignIn":M.publish("assistedSignInRequested",W.params.authCode);break;case "onLoopModeChanged":M.publish("loopModeChange",W.params.loopMode);break;default:dh("Unrecognized action: "+W.action)}},dh=function(M){dE("conn",M)},Wz4=function(M){M.C=g.RS(()=>{dh("Connecting timeout"); M.W(1)},2E4)},cC=function(M,W){M.publish("proxyStateChange",W)},Q2=function(M){g.x7(M.C); M.C=NaN},gh=function(M){g.x7(M.sY); M.sY=NaN},os=function(M){g.x7(M.yz); M.yz=NaN},bIp=function(M){return g.pt(M.B,function(W){return W.type=="LOUNGE_SCREEN"})},sZ=function(M,W,b){b?dh("Sending: action="+W+", params="+g.ys(b)):dh("Sending: action="+W); M.V.sendMessage(W,b)},TjQ=function(M){gh(M); M.sY=g.RS(()=>{sZ(M,"getNowPlaying")},2E4)},qWp=function(M){g.x7(M.O); M.O=g.RS(()=>{M.W(1)},864E5)},ePE=function(M,W){var b=null; if(W){const T=bIp(M);T&&(b={clientName:T.clientName,deviceMake:T.brand,deviceModel:T.model,osVersion:T.osVersion})}g.Uq("yt.mdx.remote.remoteClient_",b);W&&(Q2(M),os(M));b=M.V.M3()&&isNaN(M.C);W==b?W&&(cC(M,1),sZ(M,"getSubtitlesTrack")):W?(M.MK()&&M.Z.reset(),cC(M,1),sZ(M,"getNowPlaying"),qWp(M)):M.W(1)},siV=function(M,W){const b=W.params.videoId; delete W.params.videoId;b==M.Z.videoId&&(g.P$(W.params)?M.Z.trackData=null:M.Z.trackData=W.params,M.publish("remotePlayerChange"))},dOh=function(M,W,b){const T=W.params.videoId||W.params.video_id,q=parseInt(W.params.currentIndex,10); M.Z.listId=W.params.listId||M.Z.listId;Fk(M.Z,T,q);M.publish("remoteQueueChange",b)},cJ$=function(M,W){var b=parseInt(W.params.currentTime||W.params.current_time,10); rh(M.Z,isNaN(b)?0:b);b=parseInt(W.params.state,10);b=isNaN(b)?-1:b;b==-1&&M.Z.playerState==-1E3&&(b=-1E3);M.Z.playerState=b;b=Number(W.params.loadedTime);M.Z.loadedTime=isNaN(b)?0:b;M.Z.wI(Number(W.params.duration));b=M.Z;var T=Number(W.params.liveIngestionTime);b.Z=T;b.A=isNaN(T)?!1:!0;b=M.Z;T=Number(W.params.seekableStartTime);W=Number(W.params.seekableEndTime);b.V=isNaN(T)?0:T;b.W=isNaN(W)?0:W;M.Z.playerState==1?TjQ(M):gh(M);M.publish("remotePlayerChange")},oNE=function(M,W){W.params=W.params|| {}; dOh(M,W,"NOW_PLAYING_MAY_CHANGE");cJ$(M,W);M.publish("autoplayDismissed")},Qi5=function(M,W){if(M.Z.playerState!=-1E3){var b=1085; switch(parseInt(W.params.adState,10)){case 1:b=1081;break;case 2:b=1084;break;case 0:b=1083}M.Z.playerState=b;W=parseInt(W.params.currentTime,10);rh(M.Z,isNaN(W)?0:W);M.publish("remotePlayerChange")}},gNV=function(M,W){const b=W.params.muted=="true"; M.Z.volume=parseInt(W.params.volume,10);M.Z.muted=b;M.publish("remotePlayerChange")},wDE=function(M,W){M.D=W.params.videoId; M.publish("nowAutoplaying",parseInt(W.params.timeout,10))},pDh=function(M,W){M.D=W.params.videoId||null; M.publish("autoplayUpNext",M.D)},Y0p=function(M,W){M.S=W.params.autoplayMode; M.publish("autoplayModeChange",M.S);M.S=="DISABLED"&&M.publish("autoplayDismissed")},$tc=function(M,W){const b=W.params.hasNext=="true"; M.Z.hasPrevious=W.params.hasPrevious=="true";M.Z.hasNext=b;M.publish("previousNextChange")},VmJ=function(M,W){bNp(); if(!tR||!tR.get("yt-remote-disable-remote-module-for-dev")){W=g.F("MDX_CONFIG")||W;s3J();L4();wh||(wh=new SS(W?W.loungeApiHost:void 0),Ti5()&&(wh.Z="/api/loungedev"));p6||(p6=g.Ct("yt.mdx.remote.deferredProxies_")||[],g.Uq("yt.mdx.remote.deferredProxies_",p6));Xcc();var b=YI();if(!b){const q=new TB(wh,W?W.disableAutomaticScreenCache||!1:!1);g.Uq("yt.mdx.remote.screenService_",q);b=YI();var T={};W&&(T={appId:W.appId,disableDial:W.disableDial,theme:W.theme,loadCastApiSetupScript:W.loadCastApiSetupScript, disableCastApi:W.disableCastApi,enableDialLoungeToken:W.enableDialLoungeToken,enableCastLoungeToken:W.enableCastLoungeToken,forceMirroring:W.forceMirroring});g.Uq("yt.mdx.remote.enableConnectWithInitialState_",W?W.enableConnectWithInitialState||!1:!1);rJ4(M,q,function(X){X?$W()&&Is($W(),"YouTube TV"):q.subscribe("onlineScreenChange",function(){ZH("yt-remote-receiver-availability-change")})},T)}W&&!g.Ct("yt.mdx.remote.initialized_")&&(g.Uq("yt.mdx.remote.initialized_",!0),MD("Initializing: "+g.ys(W)), Wx.push(g.Yw("yt-remote-cast2-api-ready",function(){ZH("yt-remote-api-ready")})),Wx.push(g.Yw("yt-remote-cast2-availability-change",function(){ZH("yt-remote-receiver-availability-change")})),Wx.push(g.Yw("yt-remote-cast2-receiver-selected",function(){bD(null); ZH("yt-remote-auto-connect","cast-selector-receiver")})),Wx.push(g.Yw("yt-remote-cast2-receiver-resumed",function(){ZH("yt-remote-receiver-resumed","cast-selector-receiver")})),Wx.push(g.Yw("yt-remote-cast2-session-change",jXQ)),Wx.push(g.Yw("yt-remote-connection-change",function(q){q?Is($W(),"YouTube TV"):Tv()||(Is(null,null),iS7())})),Wx.push(g.Yw("yt-remote-cast2-session-failed",()=>{ZH("yt-remote-connection-failed")})),M=qD(),W.isAuto&&(M.id+="#dial"),T=W.capabilities||[],T.length>0&&(M.capabilities= T),M.name=W.device,M.app=W.app,(W=W.theme)&&(M.theme=W),MD(" -- with channel params: "+g.ys(M)),M?(g.$u("yt-remote-session-app",M.app),g.$u("yt-remote-session-name",M.name)):(g.W8("yt-remote-session-app"),g.W8("yt-remote-session-name")),g.Uq("yt.mdx.remote.channelParams_",M),b.start(),$W()||GRQ())}},JHV=function(){var M=YI().g0.$_gos(); const W=Xz();W&&j6()&&(C4(M,W)||M.push(W));return gzc(M)},Gv=function(){let M=Bjp(); !M&&lG()&&Fy9()&&(M={key:"cast-selector-receiver",name:Fy9()});return M},Bjp=function(){const M=JHV(); let W=Xz();W||(W=Tv());return g.pt(M,function(b){return W&&EM(W,b.key)?!0:!1})},Xz=function(){const M=$W(); if(!M)return null;const W=YI().dI();return kY(W,M)},jXQ=function(M){MD("remote.onCastSessionChange_: "+n4(M)); if(M){var W=Xz();if(W&&W.id==M.id){if(Is(W.id,"YouTube TV"),M.idType=="shortLived"&&(M=M.token))VR&&(VR.token=M),(W=j6())&&W.jw(M)}else W&&Jo(),Bx(M,1)}else j6()&&Jo()},Jo=function(){t4()?mE().stopSession():K6("stopSession called before API ready."); const M=j6();M&&(M.disconnect(1),DN(null))},a7=function(){const M=j6(); return!!M&&M.getProxyState()!=3},MD=function(M){dE("remote",M)},YI=function(){if(!Ex){const M=g.Ct("yt.mdx.remote.screenService_"); Ex=M?new DtQ(M):null}return Ex},$W=function(){return g.Ct("yt.mdx.remote.currentScreenId_")},aF4=function(M){g.Uq("yt.mdx.remote.currentScreenId_",M)},Ed7=function(){return g.Ct("yt.mdx.remote.connectData_")},bD=function(M){g.Uq("yt.mdx.remote.connectData_",M)},j6=function(){return g.Ct("yt.mdx.remote.connection_")},DN=function(M){const W=j6(); bD(null);M||aF4("");g.Uq("yt.mdx.remote.connection_",M);p6&&(g.Py(p6,function(b){b(M)}),p6.length=0); W&&!M?ZH("yt-remote-connection-change",!1):!W&&M&&ZH("yt-remote-connection-change",!0)},Tv=function(){const M=g.b1(); if(!M)return null;var W=YI();if(!W)return null;W=W.dI();return kY(W,M)},Bx=function(M,W){$W(); Xz()&&Xz();if(nR)VR=M;else{aF4(M.id);var b=g.Ct("yt.mdx.remote.enableConnectWithInitialState_")||!1;M=new yR(M,b);M.connect(W,Ed7());M.subscribe("beforeDisconnect",function(T){ZH("yt-remote-before-disconnect",T)}); M.subscribe("beforeDispose",function(){j6()&&(j6(),DN(null))}); M.subscribe("browserChannelAuthError",()=>{const T=Xz();T&&T.idType=="shortLived"&&(t4()?mE().handleBrowserChannelAuthError():K6("refreshLoungeToken called before API ready."))}); DN(M)}},GRQ=function(){const M=Tv(); M?(MD("Resume connection to: "+n4(M)),Bx(M,0)):(lK(),iS7(),MD("Skipping connecting because no session screen found."))},Xcc=function(){var M=qD(); if(g.P$(M)){M=me();var W=g.MZ("yt-remote-session-name")||"";const b=g.MZ("yt-remote-session-app")||"";M={device:"REMOTE_CONTROL",id:M,name:W,app:b,mdxVersion:3};M.authuser=String(g.F("SESSION_INDEX","0"));(W=g.F("DELEGATED_SESSION_ID"))&&(M.pageId=String(W));g.Uq("yt.mdx.remote.channelParams_",M)}},qD=function(){return g.Ct("yt.mdx.remote.channelParams_")||{}},ndc=function(M,W){if(Ux(M)){M.uw.unsubscribe("remotePlayerChange",M.S,M); const b=Math.round(W.volume);W=!!W.muted;const T=A4(M.uw);if(b!==T.volume||W!==T.muted)M.uw.setVolume(b,W),M.O.start();M.uw.subscribe("remotePlayerChange",M.S,M)}},Ux=function(M){return A4(M.uw).videoId===CR(M).videoId},kW=function(M,W){let b,T; var q=M.L.getPlaylist();q?.listId&&(b=q.index,T=q.listId.toString());q=CR(M);M.uw.playVideo(q.videoId,W,b,T,q.playerParams,q.O,FD4(q));M.Rg(new g.TD(1))},KR=function(M,W){if(Ux(M)&&!M.C){let b=null; W&&(b={style:M.L.getSubtitlesUserSettings()},Object.assign(b,W));M.uw.D(CR(M).videoId,b);M.A=A4(M.uw).trackData}},yHV=function(M,W){if(W){const b=M.L.getOption("captions","tracklist",{ME:1}); b&&b.length?(M.L.setOption("captions","track",W),M.C=!1):(M.L.loadModule("captions"),M.C=!0)}else M.L.setOption("captions","track",{})},Utc=function(M){M.SR(0); M.V.stop();M.Rg(new g.TD(64))},CR=function(M){return M.L.getVideoData({playerType:1})},CEc=function(M){const W=M.player.G(); return!W.j("mdx_enable_privacy_disclosure_ui")||M.isLoggedIn()||M.Cf||!M.MC?!1:g.Zk(W)||g.kj(W)},kRA=function(M,W,b){M.Np=b; M.player.publish("presentingplayerstatechange",new g.yB(b,W))},vx=function(M,W,...b){M.loaded&&M.zT.h2(W,...b)},mP=function(M){M.oC&&(M.player.removeEventListener("presentingplayerstatechange",M.oC),M.oC=null)},LR=function(M,W){if(W.key!==M.MA.key)if(W.key===M.iG.key)Jo(); else if(CEc(M)&&KzQ(M),M.MA=W,!g.dB(M.player.G())){{const X=M.player.getPlaylistId();var b=M.player.getVideoData({playerType:1});const G=b.videoId;if(!X&&!G||(M.player.getAppState()===2||M.player.getAppState()===1)&&M.player.G().j("should_clear_video_data_on_player_cued_unstarted"))b=null;else{var T=M.player.getPlaylist();if(T){var q=[];for(let V=0;V{!M.Cf&&W.QN(8)&&(M.player.pauseVideo(), mP(M))},M.player.addEventListener("presentingplayerstatechange",M.oC)); M.MC&&M.MC.Nd();j6()||(nR=!0)}; g.J0.prototype.X3=g.Wy(46,function(){this.app.wW().X3()}); g.cv.prototype.X3=g.Wy(45,function(){this.Rw=null}); g.J0.prototype.Af=g.Wy(44,function(M){this.app.wW().Af(M)}); g.cv.prototype.Af=g.Wy(43,function(M){this.Rw=M}); g.Tz.prototype.yh=g.Wy(1,function(){return g.Yy(this,3)}); g.Y2.prototype.yh=g.Wy(0,function(){return g.Yy(this,11)}); var lmp=class{constructor(){var M=g.QI();this.V=M;g.Xp(M,"/client_streamz/youtube/living_room/mdx/channel/opened",g.Uj("channel_type"))}Z(M){g.JJ(this.V,"/client_streamz/youtube/living_room/mdx/channel/opened",M)}},tqJ=class{constructor(){var M=g.QI();this.V=M;g.Xp(M,"/client_streamz/youtube/living_room/mdx/channel/closed",g.Uj("channel_type"))}Z(M){g.JJ(this.V,"/client_streamz/youtube/living_room/mdx/channel/closed",M)}},ImE=class{constructor(){var M=g.QI();this.V=M;g.Xp(M,"/client_streamz/youtube/living_room/mdx/channel/message_received", g.Uj("channel_type"))}Z(M){g.JJ(this.V,"/client_streamz/youtube/living_room/mdx/channel/message_received",M)}},ZG$=class{constructor(){var M=g.QI();this.V=M;g.Xp(M,"/client_streamz/youtube/living_room/mdx/channel/success")}Z(){g.JJ(this.V,"/client_streamz/youtube/living_room/mdx/channel/success")}},NA5=class{constructor(){var M=g.QI();this.V=M;g.Xp(M,"/client_streamz/youtube/living_room/mdx/channel/error",g.Uj("channel_type"),g.Uj("error_type"))}Z(M,W){g.JJ(this.V,"/client_streamz/youtube/living_room/mdx/channel/error", M,W)}},HGJ=class{constructor(){var M=g.QI();this.V=M;g.Xp(M,"/client_streamz/youtube/living_room/mdx/browser_channel/pending_maps")}Z(){g.JJ(this.V,"/client_streamz/youtube/living_room/mdx/browser_channel/pending_maps")}},fmI=class{constructor(){var M=g.QI();this.V=M;g.Xp(M,"/client_streamz/youtube/living_room/mdx/browser_channel/undelivered_maps")}Z(){g.JJ(this.V,"/client_streamz/youtube/living_room/mdx/browser_channel/undelivered_maps")}};g.L=JR.prototype; g.L.vc=function(){B3(this);const M=[];for(let W=0;W2*this.size&&B3(this),!0):!1}; g.L.get=function(M,W){return Ve(this.V,M)?this.V[M]:W}; g.L.set=function(M,W){Ve(this.V,M)||(this.size+=1,this.Z.push(M),this.BV++);this.V[M]=W}; g.L.forEach=function(M,W){const b=this.Z4();for(let T=0;T=T.Z.length)return g.Q$;const X=T.Z[W++];return g.EG(M?X:T.V[X])}; return q}; var edA={VH:"atp",XYX:"ska",PVY:"que",gJ:"mus",kvK:"sus",hQ:"dsp",CVY:"seq",aA:"mic",IH:"dpa",uC:"mlm",pF:"dsdtr",yU:"ntb",e8Y:"vsp",wA:"scn",IsK:"rpe",VY:"dcn",B7:"dcp",ov:"pas",P7:"drq",pX:"opf",m9:"els",oH:"isg",DKz:"svq",qJ:"mvp",R9:"ads",tWY:"stcp",GvT:"sads",Ac:"dloc",rA:"dcw",h9:"asw",y8:"apw",T6:"wrc",F0:"pcw",hG:"ipv",AZ:"ndt",U6:"ctops",g1:"gsrm"},dCQ={N90:"u",N0:"cl",Pu:"k",Ny:"i",Zi:"cr",Z7:"m",kV:"g",LM:"up"},rq$={TM:"nowPlaying",x4:"onStateChange",rb:"adPlaying",Iv:"onAdStateChange", VU:"nowPlayingShorts",rJ:"onShortsStateChange"};DH.prototype.equals=function(M){return M?this.id==M.id:!1}; var v3="",tR=null,Jc4=qj9("loadCastFramework")||qj9("loadCastApplicationFramework"),DSE=["pkedcjkdefgpdelpbcmbmeomcjbeemfm","enhhojjnijigcajfphajepfemndkmdlo"];g.rG(Rb,g.gz);g.L=Rb.prototype;g.L.er=function(M){this.A=arguments;this.Z=!1;this.J5?this.B=g.Hy()+this.nT:this.J5=g.MO(this.S,this.nT)}; g.L.stop=function(){this.J5&&(g.yp.clearTimeout(this.J5),this.J5=null);this.B=null;this.Z=!1;this.A=[]}; g.L.pause=function(){++this.V}; g.L.resume=function(){this.V&&(--this.V,!this.V&&this.Z&&(this.Z=!1,this.C.apply(null,this.A)))}; g.L.vY=function(){this.stop();Rb.EO.vY.call(this)}; g.L.Jd=function(){this.J5&&(g.yp.clearTimeout(this.J5),this.J5=null);this.B?(this.J5=g.MO(this.S,this.B-g.Hy()),this.B=null):this.V?this.Z=!0:(this.Z=!1,this.C.apply(null,this.A))};var xY=null;rs.prototype.set=function(M){this.Z=M}; rs.prototype.reset=function(){this.set(g.Hy())}; rs.prototype.get=function(){return this.Z};g.rG(nQr,EQc);var X0=class{stringify(M){return g.yp.JSON.stringify(M,void 0)}parse(M){return g.yp.JSON.parse(M,void 0)}};g.rG(FB,g.wi);g.rG(iK,g.wi);var yc5=null;g.rG(US9,g.wi);g.rG(CJ7,g.wi);g.rG(kPV,g.wi);SJ.prototype.debug=function(){}; SJ.prototype.info=function(){}; SJ.prototype.warning=function(){};var tkB={},c3={};g.L=OM.prototype;g.L.setTimeout=function(M){this.wK=M}; g.L.Y$=function(M){M=M.target;const W=this.MK;W&&g.NO(M)==3?W.A():this.rB(M)}; g.L.rB=function(M){try{if(M==this.Z)a:{const q=g.NO(this.Z),X=this.Z.V,G=this.Z.getStatus();if(!(q<3)&&(q!=3||this.Z&&(this.V.V||g.Ri(this.Z)||g.ru(this.Z)))){this.BY||q!=4||X==7||(X==8||G<=0?AR(3):AR(2));Qe(this);var W=this.Z.getStatus();this.bV=W;var b=loh(this);if(this.C=W==200){if(this.XX&&!this.xk){b:{if(this.Z){const V=g.Fp(this.Z,"X-HTTP-Initial-Response");if(V&&!g.Tp(V)){var T=V;break b}}T=null}if(M=T)this.xk=!0,bn(this,M);else{this.C=!1;this.S=3;z$(12);ds(this);ob(this);break a}}if(this.yz){M= !0;let V;for(;!this.BY&&this.W0&&!this.OY&&(this.OY=!0,this.B.zd(this)):(ds(this),ob(this))}else bn(this,b);q==4&&ds(this);this.C&&!this.BY&&(q==4?NiA(this.B,this):(this.C=!1,eJ(this)))}else g.xN(this.Z),W==400&&b.indexOf("Unknown SID")> 0?(this.S=3,z$(12)):(this.S=0,z$(13)),ds(this),ob(this)}}}catch(q){}finally{}}; g.L.cancel=function(){this.BY=!0;ds(this)}; g.L.GA=function(){this.gK=null;const M=Date.now();M-this.Ds>=0?(this.An!=2&&(AR(3),z$(17)),ds(this),this.S=2,ob(this)):Io4(this,this.Ds-M)}; g.L.getLastError=function(){return this.S}; g.L.uE=function(){return this.Z};var vd4=class{constructor(M,W){this.Z=M;this.map=W;this.context=null}};rc5.prototype.cancel=function(){this.B=TE(this);if(this.V)this.V.cancel(),this.V=null;else if(this.Z&&this.Z.size!==0){for(const M of this.Z.values())M.cancel();this.Z.clear()}};g.L=Ac$.prototype;g.L.Mo=8;g.L.Gs=1;g.L.connect=function(M,W,b,T){z$(0);this.oT=M;this.BY=W||{};b&&T!==void 0&&(this.BY.OSID=b,this.BY.OAID=T);this.MK=this.cP;this.lV=HN$(this,null,this.oT);Ww(this)}; g.L.disconnect=function(){zF7(this);if(this.Gs==3){var M=this.Lp++,W=this.lV.clone();g.sW(W,"SID",this.A);g.sW(W,"RID",M);g.sW(W,"TYPE","terminate");VO(this,W);M=new OM(this,this.A,M);M.An=2;M.D=qL(W.clone());W=!1;if(g.yp.navigator&&g.yp.navigator.sendBeacon)try{W=g.yp.navigator.sendBeacon(M.D.toString(),"")}catch{}!W&&g.yp.Image&&((new Image).src=M.D,W=!0);W||(M.Z=mSE(M.B,null),M.Z.send(M.D));M.Zs=Date.now();eJ(M)}dSJ(this)}; g.L.Cz=function(){return this.Gs==0}; g.L.getState=function(){return this.Gs}; g.L.Sb=function(M){if(this.C)if(this.C=null,this.Gs==1){if(!M){this.Lp=Math.floor(Math.random()*1E5);M=this.Lp++;const q=new OM(this,"",M);let X=this.X;this.XX&&(X?(X=g.c$(X),g.sr(X,this.XX)):X=this.XX);this.W!==null||this.Ds||(q.lV=X,X=null);if(this.EY)a:{var W=0;for(var b=0;b4096){W=b;break a}if(W===4096||b===this.B.length-1){W=b+1;break a}}W= this.Y9}else W=this.Y9;W=ONp(this,q,W);b=this.lV.clone();g.sW(b,"RID",M);g.sW(b,"CVER",22);this.yz&&g.sW(b,"X-HTTP-Session-Id",this.yz);VO(this,b);X&&(this.Ds?W="headers="+g.ju(g.Wp(X))+"&"+W:this.W&&g.bT(b,this.W,X));MK(this.V,q);this.GN&&g.sW(b,"TYPE","init");this.EY?(g.sW(b,"$req",W),g.sW(b,"SID","null"),q.XX=!0,P3(q,b,null)):P3(q,b,W);this.Gs=2}}else this.Gs==3&&(M?PJc(this,M):this.B.length==0||xSp(this.V)||PJc(this))}; g.L.fQ=function(){this.D=null;eFp(this);if(this.fv&&!(this.wK||this.Z==null||this.FT<=0)){var M=4*this.FT;this.sY=uK((0,g.IJ)(this.jV,this),M)}}; g.L.jV=function(){this.sY&&(this.sY=null,this.MK=!1,this.wK=!0,z$(10),ws(this),eFp(this))}; g.L.zd=function(M){this.Z==M&&this.fv&&!this.wK&&(GE(this),this.wK=!0,z$(11))}; g.L.Ex=function(){this.gK!=null&&(this.gK=null,ws(this),p4(this),z$(19))}; g.L.xN=function(M){M?z$(2):z$(1)}; g.L.isActive=function(){return!!this.S&&this.S.isActive(this)}; g.L=cc$.prototype;g.L.HQ=function(){}; g.L.LQ=function(){}; g.L.KQ=function(){}; g.L.iz=function(){}; g.L.isActive=function(){return!0}; g.L.Fu=function(){};g.rG(Bw,g.Uo);Bw.prototype.open=function(){this.Z.S=this.B;this.W&&(this.Z.xk=!0);this.Z.connect(this.C,this.V||void 0)}; Bw.prototype.close=function(){this.Z.disconnect()}; Bw.prototype.send=function(M){var W=this.Z;if(typeof M==="string"){var b={};b.__data__=M;M=b}else this.S&&(b={},b.__data__=g.ys(M),M=b);W.B.push(new vd4(W.sj++,M));W.Gs==3&&Ww(W)}; Bw.prototype.vY=function(){this.Z.S=null;delete this.B;this.Z.disconnect();delete this.Z;Bw.EO.vY.call(this)}; g.rG(gQr,FB);g.rG(sgr,iK);g.rG(Jv,cc$);Jv.prototype.HQ=function(){this.Z.dispatchEvent("m")}; Jv.prototype.LQ=function(M){this.Z.dispatchEvent(new gQr(M))}; Jv.prototype.KQ=function(M){this.Z.dispatchEvent(new sgr(M))}; Jv.prototype.iz=function(){this.Z.dispatchEvent("n")}; Bw.prototype.A=function(){return new Di(this,this.Z)}; Di.prototype.V=function(){return YY(this.Z.V)}; Di.prototype.B=function(){return oQ5(this.Z).map(M=>{var W=this.A;M=M.map;"__data__"in M?(M=M.__data__,W=W.S?hdB(M):M):W=M;return W})}; Di.prototype.commit=function(M){this.Z.bV=M};var Ez=new g.Uo,w7V=class extends g.wi{constructor(){super("statevent",Ez)}};g.L=yO.prototype;g.L.MY=null;g.L.Qq=!1;g.L.ZW=null;g.L.N_=null;g.L.Ss=null;g.L.HT=null;g.L.r_=null;g.L.Lg=null;g.L.Sm=null;g.L.Bg=null;g.L.mV=0;g.L.D$=null;g.L.o7=null;g.L.qs=null;g.L.Mt=-1;g.L.Yt=!0;g.L.xp=!1;g.L.zB=0;g.L.Kg=null;var $B7={},k1={};g.L=yO.prototype;g.L.setTimeout=function(M){this.V=M}; g.L.bT=function(M){M=M.target;const W=this.Kg;W&&g.NO(M)==3?W.A():this.oh(M)}; g.L.oh=function(M){try{if(M==this.Bg)a:{const W=g.NO(this.Bg),b=this.Bg.V,T=this.Bg.getStatus();if(g.bq&&!g.tY("420+")){if(W<4)break a}else if(W<3||W==3&&!g.Ri(this.Bg))break a;this.xp||W!=4||b==7||(b==8||T<=0?this.Z.Bj(3):this.Z.Bj(2));bGQ(this);const q=this.Bg.getStatus();this.Mt=q;const X=g.Ri(this.Bg);if(this.Qq=q==200){W==4&&vw(this);if(this.yz){for(M=!0;!this.xp&&this.mV0?3:0,nK(),vw(this),KK(this)}}catch(W){}finally{}}; g.L.cancel=function(){this.xp=!0;vw(this)}; g.L.aP=function(){this.ZW=null;const M=Date.now();M-this.N_>=0?(this.HT!=2&&this.Z.Bj(3),vw(this),this.qs=2,nK(),KK(this)):W4p(this,this.N_-M)}; g.L.getLastError=function(){return this.qs};g.L=jk9.prototype;g.L.eS=null;g.L.Eg=null;g.L.v_=!1;g.L.GB=null;g.L.Em=null;g.L.Av=-1;g.L.wd=null;g.L.Xb=null;g.L.connect=function(M){this.GB=M;M=LK(this.Z,null,this.GB);nK();Date.now();const W=this.Z.X;W!=null?(this.wd=W[0],(this.Xb=W[1])?(this.Em=1,GjB(this)):(this.Em=2,tv(this))):(XB(M,"MODE","init"),this.Eg=new yO(this),this.Eg.MY=this.eS,Uz(this.Eg,M,!1,null,!0),this.Em=0)}; g.L.pn=function(M){if(M)this.Em=2,tv(this);else{nK();var W=this.Z;W.Y7=W.c$.Av;x1(W,9)}M&&this.Bj(2)}; g.L.DX=function(M){return this.Z.DX(M)}; g.L.abort=function(){this.Eg&&(this.Eg.cancel(),this.Eg=null);this.Av=-1}; g.L.Cz=function(){return!1}; g.L.mY=function(M,W){this.Av=M.Mt;if(this.Em==0)if(W){try{var b=this.V.parse(W)}catch(T){M=this.Z;M.Y7=this.Av;x1(M,2);return}this.wd=b[0];this.Xb=b[1]}else M=this.Z,M.Y7=this.Av,x1(M,2);else this.Em==2&&(this.v_?(nK(),Date.now()):W=="11111"?(nK(),this.v_=!0,Date.now(),this.Av=200,this.Eg.cancel(),nK(),ln(this.Z,this,!0)):(nK(),Date.now(),this.v_=!1))}; g.L.JV=function(){this.Av=this.Eg.Mt;if(this.Eg.Qq)this.Em==0?this.Xb?(this.Em=1,GjB(this)):(this.Em=2,tv(this)):this.Em==2&&(this.v_?(nK(),ln(this.Z,this,!0)):(nK(),ln(this.Z,this,!1)));else{this.Em==0?nK():this.Em==2&&nK();var M=this.Z;this.Eg.getLastError();M.Y7=this.Av;x1(M,2)}}; g.L.Ks=function(){return this.Z.Ks()}; g.L.isActive=function(){return this.Z.isActive()}; g.L.Bj=function(M){this.Z.Bj(M)};g.L=Zi.prototype;g.L.nu=null;g.L.Ls=null;g.L.vO=null;g.L.E1=null;g.L.ET=null;g.L.Cg=null;g.L.wB=null;g.L.YR=null;g.L.HC=0;g.L.Ux=0;g.L.YS=null;g.L.uv=null;g.L.PH=null;g.L.Lo=null;g.L.c$=null;g.L.tV=null;g.L.tS=-1;g.L.CQ=-1;g.L.Y7=-1;g.L.sz=0;g.L.dc=0;g.L.Ko=8;var mtI={OK:0,fsY:2,NH:4,B4:5,z8k:6,STOP:7,VX:8,Id:9,Ak:10,p$:11,V8:12};g.rG(Jq$,g.wi);g.rG(BAp,g.wi);g.L=Zi.prototype; g.L.connect=function(M,W,b,T,q){nK();this.ET=W;this.Ls=b||{};T&&q!==void 0&&(this.Ls.OSID=T,this.Ls.OAID=q);this.D?(a4((0,g.IJ)(this.e1,this,M),100),DBE(this)):this.e1(M)}; g.L.disconnect=function(){amV(this);if(this.Z==3){var M=this.HC++;const W=this.Cg.clone();g.sW(W,"SID",this.A);g.sW(W,"RID",M);g.sW(W,"TYPE","terminate");R4(this,W);M=new yO(this,this.A,M);M.HT=2;M.r_=qL(W.clone());(new Image).src=M.r_.toString();M.Ss=Date.now();CK(M)}K47(this)}; g.L.e1=function(M){this.c$=new jk9(this);this.c$.eS=this.nu;this.c$.V=this.S;this.c$.connect(M)}; g.L.Cz=function(){return this.Z==0}; g.L.getState=function(){return this.Z}; g.L.WQ=function(M){this.uv=null;yqB(this,M)}; g.L.jb=function(){this.PH=null;this.E1=new yO(this,this.A,"rpc",this.W);this.E1.MY=this.nu;this.E1.zB=0;var M=this.wB.clone();g.sW(M,"RID","rpc");g.sW(M,"SID",this.A);g.sW(M,"CI",this.tV?"0":"1");g.sW(M,"AID",this.tS);R4(this,M);g.sW(M,"TYPE","xmlhttp");Uz(this.E1,M,!0,this.YR,!1)}; g.L.mY=function(M,W){if(this.Z!=0&&(this.E1==M||this.vO==M))if(this.Y7=M.Mt,this.vO==M&&this.Z==3)if(this.Ko>7){try{var b=this.S.parse(W)}catch(T){b=null}if(Array.isArray(b)&&b.length==3)if(M=b,M[0]==0)a:{if(!this.PH){if(this.E1)if(this.E1.Ss+3E30)){if(T=W==1)this.vO||this.uv||this.Z==1||this.sz>=2?T=!1:(this.uv=a4((0,g.IJ)(this.WQ,this,M),CU5(this,this.sz)),this.sz++, T=!0);T=!(T||W==2&&rE(this))}if(T)switch(b){case 1:x1(this,5);break;case 4:x1(this,10);break;case 3:x1(this,6);break;case 7:x1(this,12);break;default:x1(this,2)}}}; g.L.k$=function(M){if(!g.ME(arguments,this.Z))throw Error("Unexpected channel state: "+this.Z);}; g.L.r$=function(M){M?nK():(nK(),kjc(this,8))}; g.L.DX=function(M){if(M)throw Error("Can't create secondary domain capable XhrIo object.");M=new g.my;M.W=!1;return M}; g.L.isActive=function(){return!!this.YS&&this.YS.isActive(this)}; g.L.Bj=function(M){const W=Ez;W.dispatchEvent(new BAp(W,M))}; g.L.Ks=function(){return!1}; new nQr;g.L=vSJ.prototype;g.L.D9=function(){}; g.L.No=function(){}; g.L.eb=function(){}; g.L.zc=function(){}; g.L.n5=function(){}; g.L.Jo=function(){return{}}; g.L.isActive=function(){return!0};g.L=mB4.prototype;g.L.enqueue=function(M){this.V.push(M)}; g.L.isEmpty=function(){return this.Z.length===0&&this.V.length===0}; g.L.clear=function(){this.Z=[];this.V=[]}; g.L.contains=function(M){return g.ME(this.Z,M)||g.ME(this.V,M)}; g.L.remove=function(M){{var W=this.Z;const b=Array.prototype.lastIndexOf.call(W,M,W.length-1);b>=0?(g.qE(W,b),W=!0):W=!1}return W||g.X9(this.V,M)}; g.L.vc=function(){const M=[];for(var W=this.Z.length-1;W>=0;--W)M.push(this.Z[W]);W=this.V.length;for(let b=0;b"",this.An=()=>g.fG({}))}; g.L.ST=function(){return this.X}; g.L.connect=async function(M,W,b){try{this.D&&await this.S}finally{if(this.X||this.Z&&this.Z.getState()==2&&!this.B)return;this.yz="";this.B||this.V.stop();this.O=M||null;this.gK=W||0;const T=this.xk+"/test",q=this.xk+"/bind";M=new Zi(b?b.firstTestResults:null,b?b.secondTestResults:null,this.bV);const X=this.Z;X&&(X.YS=null);M.YS=this;this.Z=M;if(this.D)return this.S=zE(this).then(()=>R4E(this,T,q,X,b)),this.S.then(()=>{this.S=g.fG()}); R4E(this,T,q,X,b)}}; g.L.disconnect=function(M){try{this.D&&(this.S.cancel(),this.S=g.fG())}finally{this.sY=M||0,this.V&&this.V.stop(),Av(this),this.Z&&(this.Z.getState()==3&&yqB(this.Z),this.Z.disconnect()),this.sY=0}}; g.L.sendMessage=async function(M,W){try{this.D&&await this.S}finally{if(this.X)return;const b={_sc:M};W&&g.sr(b,W);if(this.V.isActive()||(this.Z?this.Z.getState():0)==2)this.A.push(b);else if(this.M3())try{this.D&&!xB9(this,M)&&await zE(this)}finally{this.M3()&&(xB9(this,M),Av(this),Hw(this.Z,b))}}}; g.L.D9=function(){this.C&&this.V&&this.V.yh()>0&&(this.C.yyV(this.V.yh(),this.B,!0),this.C.hFz());this.C&&this.C.J5v();this.B?(this.V.stop(),g.cG(this.V),this.V=new F0(this.xU,this),this.B=!1):this.V.reset();this.O=null;this.gK=0;if(this.A.length)if(this.D)F44(this);else{var M=this.A;this.A=[];var W=M.length;for(let b=0;bmtI[b]===M); this.Lp.Z("BROWSER_CHANNEL",W??"UNKNOWN")}; g.L.n5=function(M,W){if(!this.V.isActive())this.publish("handlerClosed");else if(W){const b=W.length;for(let T=0;T{this.onError(T)}); this.handler.subscribe("handlerMessage",this.onMessage,this);this.V=W}connect(M,W,b){this.handler.connect(M,W,b)}disconnect(M){this.handler.disconnect(M)}Il(){this.handler.Il()}getDeviceId(){return this.handler.getDeviceId()}E7(){return this.handler.E7()}M3(){return this.handler.M3()}Z(){this.dispatchEvent("channelOpened");var M=this.handler,W=this.V;g.$u("yt-remote-session-browser-channel",{firstTestResults:[""],secondTestResults:!M.Z.tV,sessionId:M.Z.A,arrayId:M.Z.tS});g.$u("yt-remote-session-screen-id", W);M=K4();W=me();g.ME(M,W)||M.push(W);pI5(M);L4()}onClosed(){this.dispatchEvent("channelClosed")}onMessage(M){this.dispatchEvent(new LzE(M))}onError(M){this.dispatchEvent(new lFh(M?1:0))}sendMessage(M,W){this.handler.sendMessage(M,W)}jw(M){this.handler.jw(M)}dispose(){this.handler.dispose()}};var z4r=class{constructor(M,W,b=()=>""){new QgE; var T=new g.ls;this.pathPrefix=M;this.Z=W;this.Zs=b;this.S=T;this.D=null;this.X=this.W=0;this.channel=null;this.C=0;this.B=new F0(()=>{this.B.isActive();this.channel?.A().V()===0&&this.connect(this.D,this.W)}); this.A={};this.V={};this.gK=!1;this.logger=null;this.O=[];this.Iq=void 0;this.lV=new lmp;this.sY=new tqJ;this.BY=new ImE;this.yz=new NA5}connect(M={},W=0){this.C!==2&&(this.B.stop(),this.D=M,this.W=W,Pw(this),(M=g.F("ID_TOKEN"))?this.A["x-youtube-identity-token"]=M:delete this.A["x-youtube-identity-token"],this.Z&&(this.V.device=this.Z.device,this.V.name=this.Z.name,this.V.app=this.Z.app,this.V.id=this.Z.id,this.Z.RI&&(this.V.mdxVersion=`${this.Z.RI}`),this.Z.theme&&(this.V.theme=this.Z.theme),this.Z.capabilities&& (this.V.capabilities=this.Z.capabilities),this.Z.WJ&&(this.V.cst=this.Z.WJ),this.Z.authuser&&(this.V.authuser=this.Z.authuser),this.Z.pageId&&(this.V.pageId=this.Z.pageId)),this.W!==0?this.V.ui=`${this.W}`:delete this.V.ui,Object.assign(this.V,this.D),this.channel=new Bw(this.pathPrefix,{Aq:"gsessionid",V_:this.A,BB:this.V}),this.channel.open(),this.C=2,h4h(this))}disconnect(M=0){this.X=M;this.B.stop();Pw(this);this.channel&&(this.X!==0?this.V.ui=`${this.X}`:delete this.V.ui,this.channel.close()); this.X=0}E7(){return this.B.isActive()?this.B.g4-Date.now():NaN}Il(){var M=this.B;g.oP(M.Z);M.start()}sendMessage(M,W){this.channel&&(Pw(this),this.channel.send({_sc:M,...W}))}jw(M){M||this.B.stop();M?this.A["X-YouTube-LoungeId-Token"]=M:delete this.A["X-YouTube-LoungeId-Token"]}getDeviceId(){return this.Z?this.Z.id:""}publish(M,...W){return this.S.publish(M,...W)}subscribe(M,W,b){return this.S.subscribe(M,W,b)}unsubscribe(M,W,b){return this.S.unsubscribe(M,W,b)}Jj(M){return this.S.Jj(M)}dispose(){this.gK|| (this.gK=!0,g.cG(this.S),this.disconnect(),g.cG(this.B),this.Zs=()=>"")}ST(){return this.gK}};var AqB=class extends g.Uo{constructor(M){super();this.Z=M();this.Z.subscribe("webChannelOpened",this.V,this);this.Z.subscribe("webChannelClosed",this.onClosed,this);this.Z.subscribe("webChannelError",this.onError,this);this.Z.subscribe("webChannelMessage",this.onMessage,this)}connect(M,W){this.Z.connect(M,W)}disconnect(M){this.Z.disconnect(M)}Il(){this.Z.Il()}getDeviceId(){return this.Z.getDeviceId()}E7(){return this.Z.E7()}M3(){return this.Z.C===3}V(){this.dispatchEvent("channelOpened")}onClosed(){this.dispatchEvent("channelClosed")}onMessage(M){this.dispatchEvent(new LzE(M))}onError(){this.dispatchEvent(new lFh(this.Z.Iq=== 401?1:0))}sendMessage(M,W){this.Z.sendMessage(M,W)}jw(M){this.Z.jw(M)}dispose(){this.Z.dispose()}};var Qk4=Date.now(),eS=null,QO=Array(50),cw=-1,gE=!1;g.rG(sz,g.b9);sz.prototype.dI=function(){return this.screens}; sz.prototype.contains=function(M){return!!C4(this.screens,M)}; sz.prototype.get=function(M){return M?kY(this.screens,M):null}; sz.prototype.info=function(M){dE(this.C,M)};var ZI$=class extends g.b9{constructor(M,W,b,T,q){super();this.A=M;this.O=W;this.D=b;this.gK=T;this.X=q;this.V=0;this.Z=null;this.J5=NaN}start(){!this.Z&&isNaN(this.J5)&&this.B()}stop(){this.Z&&(this.Z.abort(),this.Z=null);isNaN(this.J5)||(g.x7(this.J5),this.J5=NaN)}vY(){this.stop();super.vY()}B(){this.J5=NaN;this.Z=g.Pe(Oz(this.A,"/pairing/get_screen"),{method:"POST",postParams:{pairing_code:this.O},timeout:5E3,onSuccess:(0,g.IJ)(this.C,this),onError:(0,g.IJ)(this.S,this),onTimeout:(0,g.IJ)(this.W, this)})}C(M,W){this.Z=null;M=W.screen||{};M.dialId=this.D;M.name=this.gK;W=-1;this.X&&M.shortLivedLoungeToken&&M.shortLivedLoungeToken.value&&M.shortLivedLoungeToken.refreshIntervalMs&&(M.screenIdType="shortLived",M.loungeToken=M.shortLivedLoungeToken.value,W=M.shortLivedLoungeToken.refreshIntervalMs);this.publish("pairingComplete",new ab(M),W)}S(M){this.Z=null;M.status&&M.status==404?this.V>=tmc.length?this.publish("pairingFailed",Error("DIAL polling timed out")):(M=tmc[this.V],this.J5=g.RS((0,g.IJ)(this.B, this),M),this.V++):this.publish("pairingFailed",Error("Server error "+M.status))}W(){this.Z=null;this.publish("pairingFailed",Error("Server not responding"))}},tmc=[2E3,2E3,1E3,1E3,1E3,2E3,2E3,5E3,5E3,1E4];g.rG(pK,sz);g.L=pK.prototype;g.L.start=function(){wE(this)&&this.publish("screenChange");!g.MZ("yt-remote-lounge-token-expiration")&&psV(this);g.x7(this.Z);this.Z=g.RS((0,g.IJ)(this.start,this),1E4)}; g.L.add=function(M,W){wE(this);gSr(this,M);Y1(this,!1);this.publish("screenChange");W(M);M.token||psV(this)}; g.L.remove=function(M,W){let b=wE(this);ws7(this,M)&&(Y1(this,!1),b=!0);W(M);b&&this.publish("screenChange")}; g.L.dh=function(M,W,b,T){let q=wE(this);const X=this.get(M.id);X?(X.name!=W&&(X.name=W,Y1(this,!1),q=!0),b(M)):T(Error("no such local screen."));q&&this.publish("screenChange")}; g.L.vY=function(){g.x7(this.Z);pK.EO.vY.call(this)}; g.L.dY=function(M){wE(this);let W=this.screens.length;M=M&&M.screens||[];const b=M.length;for(let T=0;T{g.cG(G);q(qQ(this,V),J)}); G.subscribe("pairingFailed",V=>{g.cG(G);X(V)}); G.start();return(0,g.IJ)(G.stop,G)}; g.L.Ox=function(M,W,b,T){g.Pe(Oz(this.A,"/pairing/get_screen"),{method:"POST",postParams:{pairing_code:M},timeout:5E3,onSuccess:(0,g.IJ)(function(q,X){q=new ab(X.screen||{});if(!q.name||TuB(this,q.name)){a:{X=q.name;let G=2,V=W(X,G);for(;TuB(this,V);){G++;if(G>20)break a;V=W(X,G)}X=V}q.name=X}b(qQ(this,q))},this), onError:(0,g.IJ)(function(q){T(Error("pairing request failed: "+q.status))},this), onTimeout:(0,g.IJ)(function(){T(Error("pairing request timed out."))},this)})}; g.L.vY=function(){g.cG(this.V);g.cG(this.Z);TB.EO.vY.call(this)}; g.L.yR=function(){XDE(this);this.publish("screenChange");this.Z.update()}; TB.prototype.dispose=TB.prototype.dispose;g.rG(jG,g.b9);g.L=jG.prototype;g.L.wS=function(M){this.ST()||(M&&(V2(this,""+M),this.publish("sessionFailed")),this.Z=null,this.publish("sessionScreen",null))}; g.L.info=function(M){dE(this.yz,M)}; g.L.Ew=function(){return null}; g.L.T1=function(M){const W=this.V;M?(W.displayStatus=new chrome.cast.ReceiverDisplayStatus(M,[]),W.displayStatus.showStop=!0):W.displayStatus=null;chrome.cast.setReceiverDisplayStatus(W,(0,g.IJ)(function(){this.info("Updated receiver status for "+W.friendlyName+": "+M)},this),(0,g.IJ)(function(){V2(this,"Failed to update receiver status for: "+W.friendlyName)},this))}; g.L.vY=function(){this.T1("");jG.EO.vY.call(this)};var lD=class extends jG{constructor(M,W,b){super(M,W,"CastSession");this.config_=b;this.B=null;this.O=(0,g.IJ)(this.lV,this);this.Zs=(0,g.IJ)(this.An,this);this.gK=g.RS(()=>{Buh(this,null)},12E4); this.D=this.S=this.W=this.X=0}sY(M){if(this.B){if(this.B==M)return;V2(this,"Overriding cast session with new session object");DOE(this);this.B.removeUpdateListener(this.O);this.B.removeMessageListener("urn:x-cast:com.google.youtube.mdx",this.Zs)}this.B=M;this.B.addUpdateListener(this.O);this.B.addMessageListener("urn:x-cast:com.google.youtube.mdx",this.Zs);aEr(this,"getMdxSessionStatus")}C(M){this.info("launchWithParams no-op for Cast: "+g.ys(M))}stop(){this.B?this.B.stop((0,g.IJ)(function(){this.wS()}, this),(0,g.IJ)(function(){this.wS(Error("Failed to stop receiver app."))},this)):this.wS(Error("Stopping cast device without session."))}T1(){}vY(){this.info("disposeInternal"); DOE(this);this.B&&(this.B.removeUpdateListener(this.O),this.B.removeMessageListener("urn:x-cast:com.google.youtube.mdx",this.Zs));this.B=null;super.vY()}An(M,W){if(!this.ST())if(W)if(W=G$(W),g.lQ(W))switch(M=""+W.type,W=W.data||{},this.info("onYoutubeMessage_: "+M+" "+g.ys(W)),M){case "mdxSessionStatus":Buh(this,W);break;case "loungeToken":ENI(this,W);break;default:V2(this,"Unknown youtube message: "+M)}else V2(this,"Unable to parse message.");else V2(this,"No data in message.")}BY(M,W,b,T){g.x7(this.X); this.X=0;bSA(this.A,this.V.label,M,this.V.friendlyName,(0,g.IJ)(function(q){q?W(q):T>=0?(V2(this,"Screen "+M+" appears to be offline. "+T+" retries left."),this.X=g.RS((0,g.IJ)(this.BY,this,M,W,b,T-1),300)):b(Error("Unable to fetch screen."))},this),b)}Ew(){return this.B}lV(M){this.ST()||M||(V2(this,"Cast session died."),this.wS())}};var IFr=class extends jG{constructor(M,W,b,T){super(M,W,"DialSession");this.config_=T;this.B=this.X=null;this.Zs="";this.An=b;this.lV=null;this.O=()=>{}; this.gK=NaN;this.BY=(0,g.IJ)(this.xk,this);this.S=()=>{}; this.D=this.W=0}sY(M){this.B=M;this.B.addUpdateListener(this.BY)}C(M){this.lV=M;this.O()}stop(){kAV(this);this.B?this.B.stop((0,g.IJ)(this.wS,this,null),(0,g.IJ)(this.wS,this,"Failed to stop DIAL device.")):this.wS()}vY(){kAV(this);this.B&&this.B.removeUpdateListener(this.BY);this.B=null;super.vY()}xk(M){this.ST()||M||(V2(this,"DIAL session died."),this.S(),this.S=()=>{},this.wS())}};var NjJ=class extends jG{constructor(M,W){super(M,W,"ManualSession");this.B=g.RS((0,g.IJ)(this.C,this,null),150)}stop(){this.wS()}sY(){}C(){g.x7(this.B);this.B=NaN;const M=kY(this.A.dI(),this.V.label);M?GB(this,M):this.wS(Error("No such screen"))}vY(){g.x7(this.B);this.B=NaN;super.vY()}};var NQ=class extends g.b9{constructor(M,W){super();this.config_=W;this.V=M;this.sY=W.appId||"233637DE";this.A=W.theme||"cl";this.yz=W.disableCastApi||!1;this.W=W.forceMirroring||!1;this.Z=null;this.D=!1;this.B=[];this.C=(0,g.IJ)(this.lV,this)}init(M,W){chrome.cast.timeout.requestSession=3E4;var b=new chrome.cast.SessionRequest(this.sY,[chrome.cast.Capability.AUDIO_OUT]);g.he("desktop_enable_cast_connect")&&(b.androidReceiverCompatible=!0);this.yz||(b.dialRequest=new chrome.cast.DialRequest("YouTube")); const T=chrome.cast.AutoJoinPolicy.TAB_AND_ORIGIN_SCOPED;M=M||this.W?chrome.cast.DefaultActionPolicy.CAST_THIS_TAB:chrome.cast.DefaultActionPolicy.CREATE_SESSION;const q=(0,g.IJ)(this.An,this);b=new chrome.cast.ApiConfig(b,(0,g.IJ)(this.X,this),q,T,M);b.customDialLaunchCallback=(0,g.IJ)(this.BY,this);chrome.cast.initialize(b,(0,g.IJ)(function(){this.ST()||(chrome.cast.addReceiverActionListener(this.C),dB9(),this.V.subscribe("onlineScreenChange",(0,g.IJ)(this.S,this)),this.B=t1p(this),chrome.cast.setCustomReceivers(this.B, ()=>{},(0,g.IJ)(function(X){this.Za("Failed to set initial custom receivers: "+g.ys(X))},this)),this.publish("yt-remote-cast2-availability-change",n6(this)),W(!0))},this),(0,g.IJ)(function(X){this.Za("Failed to initialize API: "+g.ys(X)); W(!1)},this))}MK(M,W){y2("Setting connected screen ID: "+M+" -> "+W); if(this.Z){var b=this.Z.Z;if(!M||b&&b.id!=M)y2("Unsetting old screen status: "+this.Z.V.friendlyName),UZ(this,null)}if(M&&W){if(!this.Z){M=kY(this.V.dI(),M);if(!M){y2("setConnectedScreenStatus: Unknown screen.");return}if(M.idType=="shortLived"){y2("setConnectedScreenStatus: Screen with id type to be short lived.");return}b=lE4(this,M);b||(y2("setConnectedScreenStatus: Connected receiver not custom..."),b=new chrome.cast.Receiver(M.uuid?M.uuid:M.id,M.name),b.receiverType=chrome.cast.ReceiverType.CUSTOM, this.B.push(b),chrome.cast.setCustomReceivers(this.B,()=>{},(0,g.IJ)(function(T){this.Za("Failed to set initial custom receivers: "+g.ys(T))},this))); y2("setConnectedScreenStatus: new active receiver: "+b.friendlyName);UZ(this,new NjJ(this.V,b),!0)}this.Z.T1(W)}else y2("setConnectedScreenStatus: no screen.")}Lp(M){this.ST()?this.Za("Setting connection data on disposed cast v2"):this.Z?this.Z.C(M):this.Za("Setting connection data without a session")}Zs(){this.ST()?this.Za("Stopping session on disposed cast v2"):this.Z?(this.Z.stop(),UZ(this,null)):y2("Stopping non-existing session")}requestSession(){chrome.cast.requestSession((0,g.IJ)(this.X,this), (0,g.IJ)(this.xk,this))}vY(){this.V.unsubscribe("onlineScreenChange",(0,g.IJ)(this.S,this));window.chrome&&chrome.cast&&chrome.cast.removeReceiverActionListener(this.C);var M=OGI;const W=g.Ct("yt.mdx.remote.debug.handlers_");g.X9(W||[],M);g.cG(this.Z);super.vY()}Za(M){dE("Controller",M)}gK(M,W){this.Z==M&&(W||UZ(this,null),this.publish("yt-remote-cast2-session-change",W))}lV(M,W){if(!this.ST())if(M)switch(M.friendlyName=chrome.cast.unescape(M.friendlyName),y2("onReceiverAction_ "+M.label+" / "+M.friendlyName+ "-- "+W),W){case chrome.cast.ReceiverAction.CAST:if(this.Z)if(this.Z.V.label!=M.label)y2("onReceiverAction_: Stopping active receiver: "+this.Z.V.friendlyName),this.Z.stop();else{y2("onReceiverAction_: Casting to active receiver.");this.Z.Z&&this.publish("yt-remote-cast2-session-change",this.Z.Z);break}switch(M.receiverType){case chrome.cast.ReceiverType.CUSTOM:UZ(this,new NjJ(this.V,M));break;case chrome.cast.ReceiverType.DIAL:UZ(this,new IFr(this.V,M,this.A,this.config_));break;case chrome.cast.ReceiverType.CAST:UZ(this, new lD(this.V,M,this.config_));break;default:this.Za("Unknown receiver type: "+M.receiverType)}break;case chrome.cast.ReceiverAction.STOP:this.Z&&this.Z.V.label==M.label?this.Z.stop():this.Za("Stopping receiver w/o session: "+M.friendlyName)}else this.Za("onReceiverAction_ called without receiver.")}BY(M){if(this.ST())return Promise.reject(Error("disposed"));var W=M.receiver;W.receiverType!=chrome.cast.ReceiverType.DIAL&&(this.Za("Not DIAL receiver: "+W.friendlyName),W.receiverType=chrome.cast.ReceiverType.DIAL); var b=this.Z?this.Z.V:null;if(!b||b.label!=W.label)return this.Za("Receiving DIAL launch request for non-clicked DIAL receiver: "+W.friendlyName),Promise.reject(Error("illegal DIAL launch"));if(b&&b.label==W.label&&b.receiverType!=chrome.cast.ReceiverType.DIAL){if(this.Z.Z)return y2("Reselecting dial screen."),this.publish("yt-remote-cast2-session-change",this.Z.Z),Promise.resolve(new chrome.cast.DialLaunchResponse(!1));this.Za('Changing CAST intent from "'+b.receiverType+'" to "dial" for '+W.friendlyName); UZ(this,new IFr(this.V,W,this.A,this.config_))}W=this.Z;W.X=M;W.X.appState==chrome.cast.DialAppState.RUNNING?(M=W.X.extraData||{},b=M.screenId||null,as(W)&&M.loungeToken?M.loungeTokenRefreshIntervalMs?M=Ly7(W,{name:W.V.friendlyName,screenId:M.screenId,loungeToken:M.loungeToken,dialId:W.X.receiver.label,screenIdType:"shortLived"},M.loungeTokenRefreshIntervalMs):(g.Vr(Error(`No loungeTokenRefreshIntervalMs presents in additionalData: ${JSON.stringify(M)}.`)),M=vNJ(W,b)):M=vNJ(W,b)):M=DL(W);return M}X(M){if(!this.ST()&& !this.W){y2("New cast session ID: "+M.sessionId);var W=M.receiver;if(W.receiverType!=chrome.cast.ReceiverType.CUSTOM){if(!this.Z)if(W.receiverType==chrome.cast.ReceiverType.CAST)y2("Got resumed cast session before resumed mdx connection."),W.friendlyName=chrome.cast.unescape(W.friendlyName),UZ(this,new lD(this.V,W,this.config_),!0);else{this.Za("Got non-cast session without previous mdx receiver event, or mdx resume.");return}var b=this.Z.V,T=kY(this.V.dI(),b.label);T&&EM(T,W.label)&&b.receiverType!= chrome.cast.ReceiverType.CAST&&W.receiverType==chrome.cast.ReceiverType.CAST&&(y2("onSessionEstablished_: manual to cast session change "+W.friendlyName),g.cG(this.Z),this.Z=new lD(this.V,W,this.config_),this.Z.subscribe("sessionScreen",(0,g.IJ)(this.gK,this,this.Z)),this.Z.subscribe("sessionFailed",()=>ZS4(this,this.Z)),this.Z.C(null)); this.Z.sY(M)}}}O(){return this.Z?this.Z.Ew():null}xk(M){this.ST()||(this.Za("Failed to estabilish a session: "+g.ys(M)),M.code!=chrome.cast.ErrorCode.CANCEL&&UZ(this,null),this.publish("yt-remote-cast2-session-failed"))}An(M){y2("Receiver availability updated: "+M);if(!this.ST()){var W=n6(this);this.D=M==chrome.cast.ReceiverAvailability.AVAILABLE;n6(this)!=W&&this.publish("yt-remote-cast2-availability-change",n6(this))}}S(){this.ST()||(this.B=t1p(this),y2("Updating custom receivers: "+g.ys(this.B)), chrome.cast.setCustomReceivers(this.B,()=>{},(0,g.IJ)(function(){this.Za("Failed to set custom receivers.")},this)),this.publish("yt-remote-cast2-availability-change",n6(this)))}}; NQ.prototype.setLaunchParams=NQ.prototype.Lp;NQ.prototype.setConnectedScreenStatus=NQ.prototype.MK;NQ.prototype.stopSession=NQ.prototype.Zs;NQ.prototype.getCastSession=NQ.prototype.O;NQ.prototype.requestSession=NQ.prototype.requestSession;NQ.prototype.init=NQ.prototype.init;NQ.prototype.dispose=NQ.prototype.dispose;var L6=[],RP7=(0,g.Su)`https://www.gstatic.com/cv/js/sender/v1/cast_sender.js`;g.L=HC.prototype; g.L.reset=function(M){this.listId="";this.index=-1;this.videoId="";f6(this);this.volume=-1;this.muted=!1;M&&(this.index=M.index,this.listId=M.listId,this.videoId=M.videoId,this.playerState=M.playerState,this.volume=M.volume,this.muted=M.muted,this.audioTrackId=M.audioTrackId,this.trackData=M.trackData,this.hasPrevious=M.hasPrevious,this.hasNext=M.hasNext,this.C=M.playerTime,this.S=M.playerTimeAt,this.V=M.seekableStart,this.W=M.seekableEnd,this.B=M.duration,this.loadedTime=M.loadedTime,this.Z=M.liveIngestionTime, this.A=!isNaN(this.Z))}; g.L.isPlaying=function(){return this.playerState==1}; g.L.isBuffering=function(){return this.playerState==3}; g.L.wI=function(M){this.B=isNaN(M)?0:M}; g.L.getDuration=function(){return this.A?this.B+Rs(this):this.B}; g.L.clone=function(){return new HC(iG(this))};var HIA=class extends g.b9{constructor(){var M=j6();super();this.B=0;this.A=M;this.W=[];this.S=new mB4;this.V=this.Z=null;this.O=(0,g.IJ)(this.lV,this);this.X=(0,g.IJ)(this.C,this);this.gK=(0,g.IJ)(this.BY,this);this.yz=(0,g.IJ)(this.An,this);let W=0;M?(W=M.getProxyState(),W!=3&&(M.subscribe("proxyStateChange",this.sY,this),up5(this))):W=3;W!=0&&g.RS(()=>{this.sY(W)},0); (M=hPh())&&h4(this,M);this.subscribe("yt-remote-cast2-session-change",this.yz)}getState(){return this.B}E7(){return this.A.getReconnectTimeout()}Il(){this.A.reconnect()}play(){zB(this)?(this.Z?this.Z.play(null,g.lq,SG(this,"play")):uG(this,"play"),PC(this,1,xI(A4(this))),this.publish("remotePlayerChange")):eG(this,this.play)}pause(){zB(this)?(this.Z?this.Z.pause(null,g.lq,SG(this,"pause")):uG(this,"pause"),PC(this,2,xI(A4(this))),this.publish("remotePlayerChange")):eG(this,this.pause)}seekTo(M){if(zB(this)){if(this.Z){const W= A4(this),b=new chrome.cast.media.SeekRequest;b.currentTime=M;W.isPlaying()||W.isBuffering()?b.resumeState=chrome.cast.media.ResumeState.PLAYBACK_START:b.resumeState=chrome.cast.media.ResumeState.PLAYBACK_PAUSE;this.Z.seek(b,g.lq,SG(this,"seekTo",{newTime:M}))}else uG(this,"seekTo",{newTime:M});PC(this,3,M);this.publish("remotePlayerChange")}else eG(this,g.Na(this.seekTo,M))}stop(){if(zB(this)){this.Z?this.Z.stop(null,g.lq,SG(this,"stopVideo")):uG(this,"stopVideo");var M=A4(this);M.index=-1;M.videoId= "";f6(M);OZ(this,M);this.publish("remotePlayerChange")}else eG(this,this.stop)}setVolume(M,W){if(zB(this)){var b=A4(this);if(this.V){if(b.volume!=M){const T=Math.round(M)/100;this.V.setReceiverVolumeLevel(T,(0,g.IJ)(function(){o4("set receiver volume: "+T)},this),(0,g.IJ)(function(){this.Za("failed to set receiver volume.")},this))}b.muted!=W&&this.V.setReceiverMuted(W,(0,g.IJ)(function(){o4("set receiver muted: "+W)},this),(0,g.IJ)(function(){this.Za("failed to set receiver muted.")},this))}else{const T= {volume:M, muted:W};b.volume!=-1&&(T.delta=M-b.volume);uG(this,"setVolume",T)}b.muted=W;b.volume=M;OZ(this,b)}else eG(this,g.Na(this.setVolume,M,W))}D(M,W){if(zB(this)){var b=A4(this);M={videoId:M};W&&(b.trackData={trackName:W.name,languageCode:W.languageCode,sourceLanguageCode:W.translationLanguage?W.translationLanguage.languageCode:"",languageName:W.languageName,kind:W.kind},M.style=g.ys(W.style),g.sr(M,b.trackData));uG(this,"setSubtitlesTrack",M);OZ(this,b)}else eG(this,g.Na(this.D,M,W))}setAudioTrack(M, W){zB(this)?(W=W.getLanguageInfo().getId(),uG(this,"setAudioTrack",{videoId:M,audioTrackId:W}),M=A4(this),M.audioTrackId=W,OZ(this,M)):eG(this,g.Na(this.setAudioTrack,M,W))}playVideo(M,W,b,T=null,q=null,X=null,G=null){const V=A4(this),J={videoId:M};b!==void 0&&(J.currentIndex=b);Fk(V,M,b||0);W!==void 0&&(rh(V,W),J.currentTime=W);T&&(J.listId=T);q&&(J.playerParams=q);X&&(J.clickTrackingParams=X);G&&(J.locationInfo=g.ys(G));uG(this,"setPlaylist",J);T||OZ(this,V)}UP(M,W){if(zB(this)){if(M&&W){const b= A4(this);Fk(b,M,W);OZ(this,b)}uG(this,"previous")}else eG(this,g.Na(this.UP,M,W))}nextVideo(M,W){if(zB(this)){if(M&&W){const b=A4(this);Fk(b,M,W);OZ(this,b)}uG(this,"next")}else eG(this,g.Na(this.nextVideo,M,W))}ij(){if(zB(this)){uG(this,"clearPlaylist");var M=A4(this);M.reset();OZ(this,M);this.publish("remotePlayerChange")}else eG(this,this.ij)}Zs(){zB(this)?uG(this,"dismissAutoplay"):eG(this,this.Zs)}dispose(){if(this.B!=3){const M=this.B;this.B=3;this.publish("proxyStateChange",M,this.B)}super.dispose()}vY(){S0r(this); this.A=null;this.S.clear();h4(this,null);super.vY()}sY(M){if((M!=this.B||M==2)&&this.B!=3&&M!=0){var W=this.B;this.B=M;this.publish("proxyStateChange",W,M);if(M==1)for(;!this.S.isEmpty();)W=M=this.S,W.Z.length===0&&(W.Z=W.V,W.Z.reverse(),W.V=[]),M.Z.pop().apply(this);else M==3&&this.dispose()}}xk(M,W){this.publish(M,W)}lV(M){if(!M)this.C(null),h4(this,null);else if(this.V.receiver.volume){M=this.V.receiver.volume;const W=A4(this),b=Math.round(100*M.level||0);if(W.volume!=b||W.muted!=M.muted)o4("Cast volume update: "+ M.level+(M.muted?" muted":"")),W.volume=b,W.muted=!!M.muted,OZ(this,W)}}C(M){o4("Cast media: "+!!M);this.Z&&this.Z.removeUpdateListener(this.gK);if(this.Z=M)this.Z.addUpdateListener(this.gK),OSr(this),this.publish("remotePlayerChange")}BY(M){M?(OSr(this),this.publish("remotePlayerChange")):this.C(null)}YG(){uG(this,"sendDebugCommand",{debugCommand:"stats4nerds "})}An(){const M=hPh();M&&h4(this,M)}Za(M){dE("CP",M)}};var yR=class extends g.b9{constructor(M,W=!1){var b=wh,T=qD();super();this.C=NaN;this.BY=!1;this.O=this.gK=this.sY=this.yz=NaN;this.Zs=[];this.S=this.D=this.A=this.Z=this.V=null;this.jT=b;this.xk=W;this.Zs.push(g.o$(window,"beforeunload",()=>{this.W(2)})); this.B=[];this.Z=new HC;this.Ds=M.id;this.An=M.idType;this.V=SoA(this.jT,T,this.lV,this.An=="shortLived",this.Ds);this.V.listen("channelOpened",()=>{PNp(this)}); this.V.listen("channelClosed",()=>{dh("Channel closed");isNaN(this.C)?lK(!0):lK();this.dispose()}); this.V.listen("channelError",q=>{lK();isNaN(this.X())?(q==1&&this.An=="shortLived"&&this.publish("browserChannelAuthError",q),dh(`Channel error: ${q} without reconnection`),this.dispose()):(this.BY=!0,dh("Channel error: "+q+" with reconnection in "+this.X()+" ms"),cC(this,2))}); this.V.listen("channelMessage",q=>{MmQ(this,q)}); this.V.jw(M.token);this.subscribe("remoteQueueChange",()=>{var q=this.Z.videoId;g.b1()&&g.$u("yt-remote-session-video-id",q)})}connect(M,W){if(W){var b=W.listId; const T=W.videoId,q=W.videoIds,X=W.playerParams,G=W.clickTrackingParams,V=W.index,J={videoId:T},B=W.currentTime,D=W.locationInfo;W=W.loopMode;B!==void 0&&(J.currentTime=B<=5?0:B);X&&(J.playerParams=X);D&&(J.locationInfo=D);G&&(J.clickTrackingParams=G);b&&(J.listId=b);q&&q.length>0&&(J.videoIds=q.join(","));V!==void 0&&(J.currentIndex=V);this.xk&&(J.loopMode=W||"LOOP_MODE_OFF");b&&(this.Z.listId=b);this.Z.videoId=T;this.Z.index=V||0;this.Z.state=3;rh(this.Z,B);this.S="UNSUPPORTED";b=this.xk?"setInitialState": "setPlaylist";dh(`Connecting with ${b} and params: ${g.ys(J)}`);this.V.connect({method:b,params:g.ys(J)},M,Yu9())}else dh("Connecting without params"),this.V.connect({},M,Yu9());Wz4(this)}jw(M){this.V.jw(M)}dispose(){this.ST()||(g.Uq("yt.mdx.remote.remoteClient_",null),this.publish("beforeDispose"),cC(this,3));super.dispose()}vY(){Q2(this);gh(this);os(this);g.x7(this.gK);this.gK=NaN;g.x7(this.O);this.O=NaN;this.A=null;g.cV(this.Zs);this.Zs.length=0;this.V.dispose();super.vY();this.S=this.D=this.B= this.Z=this.V=null}Lp(M){if(!this.B||this.B.length===0)return!1;for(const W of this.B)if(!W.capabilities.has(M))return!1;return!0}OY(){let M=3;this.ST()||(M=0,isNaN(this.X())?this.V.M3()&&isNaN(this.C)&&(M=1):M=2);return M}W(M){dh("Disconnecting with "+M);g.Uq("yt.mdx.remote.remoteClient_",null);Q2(this);this.publish("beforeDisconnect",M);M==1&&lK();this.V.disconnect(M);this.dispose()}XX(){let M=this.Z;this.A&&(M=this.Z.clone(),Fk(M,this.A,M.index));return iG(M)}vP(M){const W=new HC(M);W.videoId&& W.videoId!=this.Z.videoId&&(this.A=W.videoId,g.x7(this.gK),this.gK=g.RS(()=>{if(this.A){const T=this.A;this.A=null;this.Z.videoId!=T&&sZ(this,"getNowPlaying")}},5E3)); const b=[];this.Z.listId==W.listId&&this.Z.videoId==W.videoId&&this.Z.index==W.index||b.push("remoteQueueChange");this.Z.playerState==W.playerState&&this.Z.volume==W.volume&&this.Z.muted==W.muted&&xI(this.Z)==xI(W)&&g.ys(this.Z.trackData)==g.ys(W.trackData)||b.push("remotePlayerChange");this.Z.reset(M);g.Py(b,function(T){this.publish(T)},this)}MK(){const M=this.V.getDeviceId(),W=g.pt(this.B,function(b){return b.type=="REMOTE_CONTROL"&&b.id!=M}); return W?W.id:""}X(){return this.V.E7()}EY(){return this.S||"UNSUPPORTED"}bV(){return this.D||""}wK(){!isNaN(this.X())&&this.V.Il()}d9(M,W){sZ(this,M,W);qWp(this)}lV(){var M=g.Ql("SAPISID","")||g.Ql("__Secure-1PAPISID")||"",W=g.Ql("__Secure-3PAPISID","")||"";if(!M&&!W)return"";M=g.Id(g.l2(M),2);W=g.Id(g.l2(W),2);return g.Id(g.l2(`,${M},${W}`),2)}};yR.prototype.subscribe=yR.prototype.subscribe;yR.prototype.unsubscribeByKey=yR.prototype.Jj;yR.prototype.getProxyState=yR.prototype.OY; yR.prototype.disconnect=yR.prototype.W;yR.prototype.getPlayerContextData=yR.prototype.XX;yR.prototype.setPlayerContextData=yR.prototype.vP;yR.prototype.getOtherConnectedRemoteId=yR.prototype.MK;yR.prototype.getReconnectTimeout=yR.prototype.X;yR.prototype.getAutoplayMode=yR.prototype.EY;yR.prototype.getAutoplayVideoId=yR.prototype.bV;yR.prototype.reconnect=yR.prototype.wK;yR.prototype.sendMessage=yR.prototype.d9;yR.prototype.getXsrfToken=yR.prototype.lV; yR.prototype.isCapabilitySupportedOnConnectedDevices=yR.prototype.Lp;var DtQ=class extends sz{constructor(M){super("ScreenServiceProxy");this.g0=M;this.Z=[];this.Z.push(this.g0.$_s("screenChange",(0,g.IJ)(this.V,this)));this.Z.push(this.g0.$_s("onlineScreenChange",(0,g.IJ)(this.B,this)))}dI(M){return this.g0.$_gs(M)}contains(M){return!!this.g0.$_c(M)}get(M){return this.g0.$_g(M)}start(){this.g0.$_st()}add(M,W,b){this.g0.$_a(M,W,b)}remove(M,W,b){this.g0.$_r(M,W,b)}dh(M,W,b,T){this.g0.$_un(M,W,b,T)}vY(){const M=this.Z.length;for(let W=0;W{ndc(this,T)}); g.t(this,this.events);this.events.J(W,"onCaptionsTrackListChanged",this.wK);this.events.J(W,"captionschanged",this.jT);this.events.J(W,"captionssettingschanged",this.xk);this.events.J(W,"videoplayerreset",this.W);this.events.J(W,"mdxautoplaycancel",()=>{this.uw.Zs()}); W.j("enable_mdx_video_play_directly")&&this.events.J(W,"videodatachange",()=>{CEc(this.Z)||Ux(this)||kW(this,0)}); M=this.uw;M.ST();M.subscribe("proxyStateChange",this.BY,this);M.subscribe("remotePlayerChange",this.S,this);M.subscribe("remoteQueueChange",this.W,this);M.subscribe("previousNextChange",this.yz,this);M.subscribe("nowAutoplaying",this.sY,this);M.subscribe("autoplayDismissed",this.Zs,this);g.t(this,this.V);g.t(this,this.B);g.t(this,this.gK);g.t(this,this.O);g.t(this,this.X);this.xk();this.W();this.S()}vY(){super.vY();this.V.stop();this.B.stop();this.gK.stop();const M=this.uw;M.unsubscribe("proxyStateChange", this.BY,this);M.unsubscribe("remotePlayerChange",this.S,this);M.unsubscribe("remoteQueueChange",this.W,this);M.unsubscribe("previousNextChange",this.yz,this);M.unsubscribe("nowAutoplaying",this.sY,this);M.unsubscribe("autoplayDismissed",this.Zs,this);this.uw=this.Z=null}h2(M,...W){if(this.uw.B!=2)if(Ux(this)){if(A4(this.uw).playerState!=1081||M!=="control_seek")switch(M){case "control_toggle_play_pause":A4(this.uw).isPlaying()?this.uw.pause():this.uw.play();break;case "control_play":this.uw.play(); break;case "control_pause":this.uw.pause();break;case "control_seek":this.X.A(W[0],W[1]);break;case "control_subtitles_set_track":KR(this,W[0]);break;case "control_set_audio_track":this.setAudioTrack(W[0])}}else switch(M){case "control_toggle_play_pause":case "control_play":case "control_pause":M=this.L.getCurrentTime();kW(this,M===0?void 0:M);break;case "control_seek":kW(this,W[0]);break;case "control_subtitles_set_track":KR(this,W[0]);break;case "control_set_audio_track":this.setAudioTrack(W[0])}}jT(M){this.gK.er(M)}Ds(M){this.h2("control_subtitles_set_track", g.P$(M)?null:M)}xk(){const M=this.L.getOption("captions","track");g.P$(M)||KR(this,M)}SR(M){this.Z.SR(M,this.L.getVideoData().lengthSeconds)}wK(){g.P$(this.A)||yHV(this,this.A);this.C=!1}BY(M,W){this.B.stop();W===2&&this.An()}S(){if(Ux(this)){this.V.stop();var M=A4(this.uw);switch(M.playerState){case 1080:case 1081:case 1084:case 1085:this.Z.QB=1;break;case 1082:case 1083:this.Z.QB=0;break;default:this.Z.QB=-1}switch(M.playerState){case 1081:case 1:this.Rg(new g.TD(8));this.lV();break;case 1085:case 3:this.Rg(new g.TD(9)); break;case 1083:case 0:this.Rg(new g.TD(2));this.X.stop();this.SR(this.L.getVideoData().lengthSeconds);break;case 1084:this.Rg(new g.TD(4));break;case 2:this.Rg(new g.TD(4));this.SR(xI(M));break;case -1:this.Rg(new g.TD(64));break;case -1E3:this.Rg(new g.TD(128,{errorCode:"mdx.remoteerror",errorMessage:"Este v\u00eddeo no se puede reproducir de forma remota.",hs:2}))}const b=A4(this.uw).trackData;M=b;var W=this.A;(M||W?M&&W&&M.trackName==W.trackName&&M.languageCode==W.languageCode&&M.languageName== W.languageName&&M.kind==W.kind:1)||(this.A=b,yHV(this,b));M=A4(this.uw);M.volume===-1||Math.round(this.L.getVolume())===M.volume&&this.L.isMuted()===M.muted||this.O.isActive()||this.MK()}else Utc(this)}yz(){this.L.publish("mdxpreviousnextchange")}W(){Ux(this)||Utc(this)}sY(M){isNaN(M)||this.L.publish("mdxnowautoplaying",M)}Zs(){this.L.publish("mdxautoplaycanceled")}setAudioTrack(M){Ux(this)&&this.uw.setAudioTrack(CR(this).videoId,M)}seekTo(M,W){A4(this.uw).playerState===-1?kW(this,M):W&&this.uw.seekTo(M)}MK(){if(Ux(this)){var M= A4(this.uw);this.events.fN(this.Lp);M.muted?this.L.mute():this.L.unMute();this.L.setVolume(M.volume);this.Lp=this.events.J(this.L,"onVolumeChange",W=>{ndc(this,W)})}}lV(){this.V.stop(); if(!this.uw.ST()){var M=A4(this.uw);M.isPlaying()&&this.Rg(new g.TD(8));this.SR(xI(M));this.V.start()}}An(){this.B.stop();this.V.stop();const M=this.uw.E7();this.uw.B==2&&!isNaN(M)&&this.B.start()}Rg(M){this.B.stop();const W=this.D;if(!g.Dx(W,M)){const b=M.Z(2);b!==this.D.Z(2)&&this.L.NC(b);this.D=M;kRA(this.Z,W,M)}}};var R6I=class extends g.d7{constructor(M,W){super(M);this.Z=W}getCurrentTime(){return this.Z.getCurrentTime()}getDuration(){return this.Z.getDuration()}A1(){return this.Z.A1()}gI(){return this.Z.gI()}y3(){return this.Z.y3()}e_(){return this.Z.e_()}getPlayerState(){return this.Z.Np}isAtLiveHead(){return this.Z.isAtLiveHead()}pauseVideo(){vx(this.Z,"control_pause")}async playVideo(){vx(this.Z,"control_play")}seekTo(M,W){vx(this.Z,"control_seek",M,!W?.a6)}Ys(M){vx(this.Z,"control_set_audio_track",M); return!0}};var rH7=class extends g.w{constructor(){super({K:"div",N:"ytp-mdx-popup-dialog",Y:{role:"dialog"},U:[{K:"div",N:"ytp-mdx-popup-dialog-inner-content",U:[{K:"div",N:"ytp-mdx-popup-title",R0:"No has iniciado sesi\u00f3n"},{K:"div",N:"ytp-mdx-popup-description",R0:"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."},{K:"div",N:"ytp-mdx-privacy-popup-buttons", U:[{K:"button",rK:["ytp-button","ytp-mdx-privacy-popup-cancel"],R0:"Cancelar"},{K:"button",rK:["ytp-button","ytp-mdx-privacy-popup-confirm"],R0:"Confirmar"}]}]}]});this.fade=new g.Ol(this,250);this.cancelButton=this.hn("ytp-mdx-privacy-popup-cancel");this.confirmButton=this.hn("ytp-mdx-privacy-popup-confirm");g.t(this,this.fade);this.J(this.cancelButton,"click",this.Z);this.J(this.confirmButton,"click",this.V)}Nd(){this.fade.show()}Lv(){this.fade.hide()}Z(){ZH("mdx-privacy-popup-cancel");this.Lv()}V(){ZH("mdx-privacy-popup-confirm"); this.Lv()}};var xtc=class extends g.w{constructor(M){super({K:"div",N:"ytp-remote",U:[{K:"div",N:"ytp-remote-display-status",U:[{K:"div",N:"ytp-remote-display-status-icon",U:[g.dhy()]},{K:"div",N:"ytp-remote-display-status-text",R0:"{{statustext}}"}]}]});this.api=M;this.fade=new g.Ol(this,250);g.t(this,this.fade);this.J(M,"presentingplayerstatechange",this.onStateChange);this.LN(M.getPlayerStateObject())}onStateChange(M){this.LN(M.state)}LN(M){if(this.api.getPresentingPlayerType()===3){const W={RECEIVER_NAME:this.api.getOption("remote", "currentReceiver").name};M=M.Z(128)?g.tZ("No se ha podido reproducir el v\u00eddeo en $RECEIVER_NAME",W):M.isPlaying()||M.isPaused()?g.tZ("El v\u00eddeo se est\u00e1 reproduciendo en $RECEIVER_NAME",W):g.tZ("Conectado/a a $RECEIVER_NAME",W);this.updateValue("statustext",M);this.fade.show()}else this.fade.hide()}};var FzV=class extends g.RV{constructor(M,W){super("Reproducir en",1,M,W);this.L=M;this.wD={};this.J(M,"onMdxReceiversChange",this.C);this.J(M,"presentingplayerstatechange",this.C);this.C()}C(){var M=this.L.getOption("remote","receivers");M&&M.length>1&&!this.L.getOption("remote","quickCast")?(this.wD=g.IQ(M,this.S,this),this.A(g.dG(M,this.S)),M=this.L.getOption("remote","currentReceiver"),M=this.S(M),this.options[M]&&this.V(M),this.enable(!0)):this.enable(!1)}S(M){return M.key}B(M){return M==="cast-selector-receiver"? "Enviar...":this.wD[M].name}Z(M){super.Z(M);this.L.setOption("remote","currentReceiver",this.wD[M]);this.tT.Lv()}};g.FQ("remote",class extends g.F2{constructor(M){super(M);this.iG={key:UM(),name:"Este ordenador"};this.zT=null;this.subscriptions=[];this.S3=this.uw=null;this.wD=[this.iG];this.MA=this.iG;this.Np=new g.TD(64);this.JF=0;this.QB=-1;this.Cf=!1;this.Rw=this.oC=this.MC=null;if(!g.WQ(this.player.G())&&!g.dB(this.player.G())){M=this.player;var W=g.am(M);W&&(W=W.fT())&&(W=new FzV(M,W),g.t(this,W));W=new xtc(M);g.t(this,W);g.Im(M,W.element,4);this.MC=new rH7;g.t(this,this.MC);g.Im(M,this.MC.element,4);this.Cf= !!Tv()}}create(){var M=this.player.G();const W=g.Th(M);M={device:"Desktop",app:"youtube-desktop",loadCastApiSetupScript:M.j("mdx_load_cast_api_bootstrap_script"),enableDialLoungeToken:M.j("enable_dial_short_lived_lounge_token"),enableCastLoungeToken:M.j("enable_cast_short_lived_lounge_token")};VmJ(W,M);this.subscriptions.push(g.Yw("yt-remote-before-disconnect",this.CE,this));this.subscriptions.push(g.Yw("yt-remote-connection-change",this.jL,this));this.subscriptions.push(g.Yw("yt-remote-receiver-availability-change", this.Y8,this));this.subscriptions.push(g.Yw("yt-remote-auto-connect",this.Cw,this));this.subscriptions.push(g.Yw("yt-remote-receiver-resumed",this.wE,this));this.subscriptions.push(g.Yw("mdx-privacy-popup-confirm",this.f2,this));this.subscriptions.push(g.Yw("mdx-privacy-popup-cancel",this.M5,this));this.Y8()}load(){this.player.cancelPlayback();super.load();this.Rw=new R6I(this.player.G(),this);this.player.Af(this.Rw);this.zT=new fFE(this,this.player,this.uw);var M=(M=Ed7())?M.currentTime:0;const W= a7()?new HIA:null;M==0&&W&&(M=xI(A4(W)));M!==0&&this.SR(M);kRA(this,this.Np,this.Np);this.player.bG(6)}unload(){this.player.publish("mdxautoplaycanceled");this.player.X3();this.MA=this.iG;g.Qb(this.zT,this.uw);this.uw=this.Rw=this.zT=null;super.unload();this.player.bG(5);mP(this)}vY(){g.$2(this.subscriptions);super.vY()}getAdState(){return this.QB}hasPrevious(){return this.uw?A4(this.uw).hasPrevious:!1}hasNext(){return this.uw?A4(this.uw).hasNext:!1}SR(M,W){this.JF=M||0;this.player.publish("progresssync", M,W);g.Vc(this.player,"onVideoProgress",M||0)}getCurrentTime(){return this.JF}getDuration(){return A4(this.uw).getDuration()||0}A1(){var M=A4(this.uw);return M.A?M.Z+Rs(M):M.Z}gI(){return A4(this.uw).loadedTime}y3(){return zPp(A4(this.uw))}e_(){var M=A4(this.uw);return M.V>0?M.V+Rs(M):M.V}getProgressState(){const M=A4(this.uw),W=this.player.getVideoData();return{airingStart:0,airingEnd:0,allowSeeking:M.playerState!=1081&&this.player.jO(),clipEnd:W.clipEnd,clipStart:W.clipStart,current:this.getCurrentTime(), displayedStart:-1,duration:this.getDuration(),ingestionTime:this.A1(),isAtLiveHead:this.isAtLiveHead(),loaded:this.gI(),seekableEnd:this.y3(),seekableStart:this.e_(),offset:0,viewerLivestreamJoinMediaTime:0}}isAtLiveHead(){return zPp(A4(this.uw))-this.getCurrentTime()<=1}nextVideo(){this.uw&&this.uw.nextVideo()}UP(){this.uw&&this.uw.UP()}CE(M){M===1&&(this.S3=this.uw?A4(this.uw):null)}jL(){var M=a7()?new HIA:null;if(M){const W=this.MA;this.loaded&&this.unload();this.uw=M;this.S3=null;W.key!==this.iG.key&& (this.MA=W,this.load())}else g.cG(this.uw),this.uw=null,this.loaded&&(this.unload(),(M=this.S3)&&M.videoId===this.player.getVideoData().videoId&&this.player.cueVideoById(M.videoId,xI(M)));this.player.publish("videodatachange","newdata",this.player.getVideoData(),3)}Y8(){var M=[this.iG],W=M.concat;const b=JHV();lG()&&g.MZ("yt-remote-cast-available")&&b.push({key:"cast-selector-receiver",name:"Cast..."});this.wD=W.call(M,b);M=Gv()||this.iG;LR(this,M);g.Vc(this.player,"onMdxReceiversChange")}Cw(){const M= Gv();LR(this,M)}wE(){this.MA=Gv()}f2(){this.Cf=!0;mP(this);nR=!1;VR&&Bx(VR,1);VR=null}M5(){this.Cf=!1;mP(this);LR(this,this.iG);this.MA=this.iG;nR=!1;VR=null;this.player.playVideo()}nK(M,W){switch(M){case "casting":return this.loaded;case "receivers":return this.wD;case "currentReceiver":return W&&(W.key==="cast-selector-receiver"?ZL():LR(this,W)),this.loaded?this.MA:this.iG;case "quickCast":return this.wD.length===2&&this.wD[1].key==="cast-selector-receiver"?(W&&ZL(),!0):!1}}YG(){this.uw.YG()}Nm(){return!1}getOptions(){return["casting", "receivers","currentReceiver","quickCast"]}isLoggedIn(){return g.F("PLAYER_CONFIG")?.args?.authuser!==void 0?!0:!(!g.F("SESSION_INDEX")&&!g.F("LOGGED_IN"))}});})(_yt_player);