(function(g){var window=this;'use strict';var GB=function(H,E){led(g.wH(H.screens,Ubd));E&&xb3()},zRM=function(H,E){return g.GI(H,E)},T3R=function(H){var E=0,G; for(G in H)E++;return E},SjH=function(H,E,G){var P=g.iP(G); P.L!=""?(E&&g.yZ(P,E+"."+P.L),g.bg(P,P.G)):(P=g.lU.location,P=VKu(P.protocol,E?E+"."+P.hostname:P.hostname,+P.port,G));E=H.PF;G=H.qC;E&&G&&g.MZ(P,E,G);g.MZ(P,"VER",H.d_);P7(H,P);return P},FOW=function(H,E){var G=H.AT+Math.floor(Math.random()*H.hC); H.isActive()||(G*=2);return G*E},feZ=function(H,E,G){var P=E.params.videoId||E.params.video_id,Q=parseInt(E.params.currentIndex,10); H.L.listId=E.params.listId||H.L.listId;Q5(H.L,P,Q);H.publish("remoteQueueChange",G)},pkR=function(H){if(H instanceof g.eQ)return H; if(typeof H.CX=="function")return H.CX(!1);if(g.gw(H)){var E=0,G=new g.eQ;G.next=function(){for(;;){if(E>=H.length)return g.eT;if(E in H)return g.CD(H[E++]);E++}}; return G}throw Error("Not implemented");},Hmd=function(H,E){g.Xa(H,E)||H.push(E)},GNR=function(H,E,G,P,Q){H.S8=1; H.T0=sG(E.clone());H.vW=null;H.PF=G;Q&&(H.aX=!1);Ejo(H,P)},ur=function(H,E){o$(); ed()&&ed();if(wZ)hn=H;else{POW(H.id);var G=g.Un("yt.mdx.remote.enableConnectWithInitialState_")||!1;H=new $U(tn,H,QvJ(),G);H.connect(E,svM());H.subscribe("beforeDisconnect",function(P){kU("yt-remote-before-disconnect",P)}); H.subscribe("beforeDispose",function(){W7()&&(W7(),ojC(null))}); H.subscribe("browserChannelAuthError",function(){var P=ed();P&&P.idType=="shortLived"&&(I$()?An().handleBrowserChannelAuthError():mR("refreshLoungeToken called before API ready."))}); ojC(H)}},xb3=function(){g.Fj("yt-remote-lounge-token-expiration",!0,86400)},mR=function(H){v7("cloudview",H)},dZ=function(H,E){var G=H.get(E.id); G?(G.uuid=E.uuid,E=G):((G=MR(H.G,E.uuid))?(G.id=E.id,G.token=E.token,E=G):H.G.push(E),H.B||ewW(H));wMd(H);H.T[E.uuid]=E.id;g.Fj("yt-remote-device-id-map",H.T,31536E3);return E},hwC=function(H,E){var G=E.params.videoId; delete E.params.videoId;G==H.L.videoId&&(g.ZR(E.params)?H.L.trackData=null:H.L.trackData=E.params,H.publish("remotePlayerChange"))},W7=function(){return g.Un("yt.mdx.remote.connection_")},kN3=function(H,E){var G=H.screens.length!=E.length; H.screens=g.W2(H.screens,function(e){return!!$BJ(E,e)}); for(var P=E.length,Q=0;Q1){var G=H-1;E.push("//www.gstatic.com/eureka/clank/"+H+"/cast_sender.js");E.push("//www.gstatic.com/eureka/clank/"+G+"/cast_sender.js")}return E},OG=function(){if(uEC)return uEC; var H=g.pr("yt-remote-device-id");H||(H=vjC(),g.Fj("yt-remote-device-id",H,31536E3));for(var E=a$(),G=1,P=H;g.Xa(E,P);)G++,P=H+"#"+G;return uEC=P},MaC=function(H,E,G){H.S8=1; H.T0=sG(E.clone());H.vW=G;H.PF=!0;Ejo(H,null)},DBo=function(){KM()?An()?I$()?(jd("Requesting cast selector."),An().requestSession()):(jd("Wait for cast API to be ready to request the session."),dBR.push(g.tf("yt-remote-cast2-api-ready",DBo))):mR("requestCastSelector: Cast is not initialized."):mR("requestCastSelector: Cast API is not installed!")},nj$=function(H){g.DK.call(this,"channelError"); this.error=H},a9u=function(H){return"chrome-extension://"+H+"/cast_sender.js"},OmM=function(H){var E=H.player.K(); return!E.U("mdx_enable_privacy_disclosure_ui")||H.isLoggedIn()||H.QK||!H.iz?!1:g.sn(E)||g.iH(E)},c7=function(H){var E=KeD(); E.dispatchEvent(new jvW(E,H))},y5=function(H,E,G){NR.call(this,H,E,"CastSession"); var P=this;this.config_=G;this.G=null;this.WF=(0,g.co)(this.nx,this);this.E7=(0,g.co)(this.tAu,this);this.p_=g.bw(function(){cH3(P,null)},12E4); this.B=this.T=this.C=this.N=0;this.Jm=!1;this.L_="unknown"},rHJ=function(H,E,G){var P=this; G=G===void 0?function(){return""}:G; var Q=Q===void 0?new NaZ:Q;var e=e===void 0?new g.DD:e;this.pathPrefix=H;this.L=E;this.Jm=G;this.T=e;this.N=null;this.L_=this.B=0;this.channel=null;this.C=0;this.G=new br(function(){P.G.isActive();var w;((w=P.channel)==null?void 0:yHu((new bmR(w,w.L)).L.W))===0&&P.connect(P.N,P.B)}); this.D={};this.W={};this.p_=!1;this.logger=null;this.WF=[];this.tK=void 0;this.T$=new imu;this.E7=new qDd;this.O7=new Rwo;this.PF=new JHu},Bao=function(){},YDo=function(H){return!!document.currentScript&&(document.currentScript.src.indexOf("?"+H)!=-1||document.currentScript.src.indexOf("&"+H)!=-1)},imu=function(){var H=ir(); this.L=H;H.rX("/client_streamz/youtube/living_room/mdx/channel/opened",g.A3("channel_type"))},CO3=function(){XMJ(); var H=mBZ();H.push.apply(H,g.EC(ZmR.map(a9u)));H.push("//www.gstatic.com/eureka/clank/cast_sender.js");qR(H)},XMJ=function(){if(gj$){var H=2,E=LeH(),G=function(){H--; H==0&&E&&E(!0)}; window.__onGCastApiAvailable=G;l9o("//www.gstatic.com/cast/sdk/libs/sender/1.0/cast_framework.js",UBZ,G)}},VaK=function(H,E,G,P,Q){function e(){return new xBR(R$(H,"/bc"),E,!1,G,P)} G=G===void 0?function(){return""}:G; return g.Xj("enable_mdx_web_channel_desktop")?new zwW(function(){return new rHJ(R$(H,"/wc"),E,G)}):new TaK(e,Q)},Jn=function(H){H.G.f0()||H.O7||SDd(H.G,H)},rZ=function(H,E,G){E!=H.L&&(g.Vq(H.L),(H.L=E)?(G?H.publish("yt-remote-cast2-receiver-resumed",E.W):H.publish("yt-remote-cast2-receiver-selected",E.W),E.subscribe("sessionScreen",(0,g.co)(H.jC,H,E)),E.subscribe("sessionFailed",function(){return FeK(H,E)}),E.L?H.publish("yt-remote-cast2-session-change",E.L):G&&H.L.IQ(null)):H.publish("yt-remote-cast2-session-change", null))},f9J=function(H){g.DK.call(this,"serverreachability",H)},pMK=function(H,E){H.experiments.clear(); E.split(",").forEach(function(G){H.experiments.add(G)})},EbM=function(){var H=B7().qW.$_gos(); var E=ed();E&&W7()&&($BJ(H,E)||H.push(E));return H2u(H)},GY$=function(H){g.D9(H.C,function(E){this.D.unsubscribeByKey(E)},H); H.C.length=0},l9o=function(H,E,G){var P=document.createElement("script"); P.onerror=E;G&&(P.onload=G);g.sN(P,g.Qb(H));(document.head||document.documentElement).appendChild(P)},qDd=function(){var H=ir(); this.L=H;H.rX("/client_streamz/youtube/living_room/mdx/channel/closed",g.A3("channel_type"))},PH3=function(H,E,G,P){H.info("requestLoungeToken_ for "+E); var Q={postParams:{screen_ids:E},method:"POST",context:H,onSuccess:function(e,w){e=w&&w.screens||[];e[0]&&e[0].screenId==E?G(e[0].loungeToken):P(Error("Missing lounge token in token response"))}, onError:function(){P(Error("Request screen lounge token failed"))}}; g.a2(R$(H.D,"/pairing/get_lounge_token_batch"),Q)},spH=function(H){var E=H.W.fE(),G=H.L&&H.L.W; H=g.wH(E,function(P){G&&YU(P,G.label)&&(G=null);var Q=P.uuid?P.uuid:P.id,e=QpH(this,P);e?(e.label=Q,e.friendlyName=P.name):(e=new chrome.cast.Receiver(Q,P.name),e.receiverType=chrome.cast.ReceiverType.CUSTOM);return e},H); G&&(G.receiverType!=chrome.cast.ReceiverType.CUSTOM&&(G=new chrome.cast.Receiver(G.label,G.friendlyName),G.receiverType=chrome.cast.ReceiverType.CUSTOM),H.push(G));return H},kU=function(H,E){g.qP[H]=!0; var G=g.t1();G&&G.publish.apply(G,arguments);g.qP[H]=!1},obK=function(H){if(H.W!=null)return H.G.concat(H.W.WF); if(H.L!=null&&H.L.size!==0){var E=H.G;H=g.R(H.L.values());for(var G=H.next();!G.done;G=H.next())E=E.concat(G.value.WF);return E}return g.dm(H.G)},svM=function(){return g.Un("yt.mdx.remote.connectData_")},eZW=function(H){g.DK.call(this,"channelMessage"); this.message=H},sG=function(H){g.MZ(H,"zx",Math.floor(Math.random()*2147483648).toString(36)+Math.abs(Math.floor(Math.random()*2147483648)^g.Gl()).toString(36)); return H},wyR=function(){g.DK.call(this,"o")},hZu=function(H,E){var G=E.params.hasNext=="true"; H.L.vR=E.params.hasPrevious=="true";H.L.wU=G;H.publish("previousNextChange")},$tW=function(){this.L=[]; this.W=[]},tFK=function(){},kY3=function(H,E){return H.W?H.W==E:H.L?H.L.has(E):!1},VKu=function(H,E,G,P){var Q=new g.TE(null); H&&g.el(Q,H);E&&g.yZ(Q,E);G&&g.bg(Q,G);P&&(Q.W=P);return Q},Xw=function(H){H.p_!=null&&(g.lU.clearTimeout(H.p_),H.p_=null)},IX$=function(H,E){H.capabilities.clear(); g.W2(E.split(","),g.iK(zRM,WDD)).forEach(function(G){H.capabilities.add(G)})},MFK=function(H){wMd(H); H.W=new ZC(H.D);H.W.subscribe("screenChange",(0,g.co)(H.B5x,H));A03(H);H.B||(H.G=mtK(g.pr("yt-remote-automatic-screen-cache")||[]));wMd(H);H.info("Initializing automatic screens: "+ueD(H.G));H.L=new vbJ(H.D,(0,g.co)(H.RF,H,!0));H.L.subscribe("screenChange",(0,g.co)(function(){this.publish("onlineScreenChange")},H))},dt$=function(H){H=g.Gz(g.Fy(H.L,function(E){return E})); g.nT(H);H.length?g.Fj("yt-remote-online-screen-ids",H.join(","),60):g.yF("yt-remote-online-screen-ids")},DtD=function(H){g.kM("yt.mdx.remote.cloudview.initializing_",H)},nbK=function(){var H=W7(); return!!H&&H.getProxyState()!=3},aXD=function(H){return H.D?H.B+CM(H):H.B},SDd=function(H,E){var G=null; if(H.L==E){Xw(H);O2W(H);H.L=null;var P=2}else if(kY3(H.W,E))G=E.WF,KD$(H.W,E),P=1;else return;if(H.vL!=0)if(E.C)if(P==1){G=E.L_?E.L_.length:0;E=Date.now()-E.Jm;var Q=H.Jm;P=KeD();P.dispatchEvent(new jpJ(P,G,E,Q));gZ(H)}else c0Z(H);else{var e=E.FI;Q=E.getLastError();if(Q==3||Q==0&&e>0||!(P==1&&NeM(H,E)||P==2&&y0R(H)))switch(G&&G.length>0&&(E=H.W,E.G=E.G.concat(G)),Q){case 1:LM(H,5);break;case 4:LM(H,10);break;case 3:LM(H,6);break;default:LM(H,2)}}},QvJ=function(){return g.Un("yt.mdx.remote.channelParams_")|| {}},b2J=function(H,E){if(lr(H)&&!H.T){var G=null; E&&(G={style:H.S.getSubtitlesUserSettings()},Object.assign(G,E));H.KP.hd(H.S.getVideoData(1).videoId,G);H.D=UG(H.KP).trackData}},i2R=function(H){v7("OnlineScreenService",H)},qOo=function(H,E){if(H.p_!=null)throw Error("WatchDog timer not null"); H.p_=xU((0,g.co)(H.S3,H),E)},RZR=function(H){var E=H.L.C; E!=null?(zB(5),E?(zB(11),TB(H.L,H,!1)):(zB(12),TB(H.L,H,!0))):(H.hv=new V5(H),H.hv.Z9=H.qt,E=H.L,E=Sd(E,E.Oa()?H.Oi:null,H.FC),zB(5),Fw(E,"TYPE","xmlhttp"),GNR(H.hv,E,!1,H.Oi,!1))},Ubd=function(H){return{name:H.name, screenId:H.id,loungeToken:H.token,dialId:H.uuid,screenIdType:H.idType,screenIdSecret:H.secret}},r0M=function(H,E,G,P,Q){if(P==0)G(!1); else{var e=Q||0;P--;J0D(H,E,function(w){w?G(!0):g.lU.setTimeout(function(){r0M(H,E,G,P,e)},e)})}},fM=function(H){this.scheme="https"; this.port=this.domain="";this.L="/api/lounge";this.W=!0;H=H||document.location.href;var E=Number(g.AL(H)[4]||null)||"";E&&(this.port=":"+E);this.domain=g.mS(H)||"";H=g.u0();H.search("MSIE")>=0&&(H=H.match(/MSIE ([\d.]+)/)[1],g.ry(H,"10.0")<0&&(this.W=!1))},P7=function(H,E){H.O7&&g.kn(H.O7,function(G,P){g.MZ(E,P,G)}); H.T&&g.kn({},function(G,P){g.MZ(E,P,G)})},Q5=function(H,E,G){var P=H.videoId; H.videoId=E;H.index=G;E!=P&&Bed(H)},ueD=function(H){return Array.isArray(H)?"["+g.wH(H,pM).join(",")+"]":"null"},YOK=function(){this.G=null; this.L="";this.W=!1},An=function(){return g.Un("yt.mdx.remote.cloudview.instance_")},XyH=function(){},Z2C=function(H){H0.call(this,"ScreenServiceProxy"); this.qW=H;this.L=[];this.L.push(this.qW.$_s("screenChange",(0,g.co)(this.V3,this)));this.L.push(this.qW.$_s("onlineScreenChange",(0,g.co)(this.C1F,this)))},gbH=function(H){if(H.NW||H.xS||H.fU>=3)return!1; H.B++;H.xS=EP((0,g.co)(H.cC,H),CHR(H,H.fU));H.fU++;return!0},LDo=function(H,E){H.L?H.L.add(E):H.W=E},Gw=function(H){H.au=Date.now()+H.hm; qOo(H,H.hm)},P0=function(H,E){GY$(H); H.D.setPlayerContextData(lXu(E));UtW(H)},TeZ=function(H,E,G){H.info("initOnConnectedScreenDataPromise_: Received screenData: "+JSON.stringify(E)); var P=new QB(E);return(new Promise(function(Q){xtW(H,P,function(e){e?(H.WF=!0,dZ(H.D,P),sP(H,P),og(H,G)):g.OS(Error("DialSession, RemoteScreen from screenData: "+JSON.stringify(E)+" is not online."));Q(e)},5)})).then(function(Q){return Q?new chrome.cast.DialLaunchResponse(!1):zZ3(H)})},SOM=function(H,E){if(E)if(H.je>6){H.W=H.G.concat(H.W); H.G.length=0;var G=H.Cb-1;E=VFd(H)}else G=E.B,E=E.vW;else G=H.Cb++,E=VFd(H);var P=H.zL.clone();g.MZ(P,"SID",H.D);g.MZ(P,"RID",G);g.MZ(P,"AID",H.jj);eJ(H,P);G=new V5(H,H.D,G,H.vg+1);G.Z9=H.UH;G.setTimeout(1E4+Math.round(1E4*Math.random()));H.ut=G;MaC(G,P,E)},Ejo=function(H,E){H.Ik=Date.now(); FDZ(H);H.tQ=H.T0.clone();Fw(H.tQ,"t",H.C);H.IS=0;H.Ht=H.L.RU(H.L.Oa()?E:null);H.VT>0&&(H.TL=new g.S7((0,g.co)(H.Ih,H,H.Ht),H.VT));H.G.listen(H.Ht,"readystatechange",H.oy);E=H.Z9?g.sj(H.Z9):{};H.vW?(H.Ui="POST",E["Content-Type"]="application/x-www-form-urlencoded",H.Ht.send(H.tQ,H.Ui,H.vW,E)):(H.Ui="GET",H.aX&&!g.E7&&(E.Connection="close"),H.Ht.send(H.tQ,H.Ui,null,E));H.L.x4(1)},fXM=function(H,E){if(H.L.playerState!=-1E3){var G=1085; switch(parseInt(E.params.adState,10)){case 1:G=1081;break;case 2:G=1084;break;case 0:G=1083}H.L.playerState=G;E=parseInt(E.params.currentTime,10);w5(H.L,isNaN(E)?0:E);H.publish("remotePlayerChange")}},hX=function(H){H.y4!=null&&(g.lU.clearTimeout(H.y4),H.y4=null)},pyW=function(H,E){a:if(T3R(E)!=T3R(H.L))var G=!1; else{G=g.Gz(E);for(var P=G.length,Q=0;QE.length)return h33;E=E.slice(P,P+G);H.B=P+G;return E},WSD=function(H,E){E.params=E.params||{}; feZ(H,E,"NOW_PLAYING_MAY_CHANGE");kcR(H,E);H.publish("autoplayDismissed")},tX=function(H,E){var G=H.S.getPlaylist(); if(G==null?0:G.listId){var P=G.index;var Q=G.listId.toString()}G=H.S.getVideoData(1);H.KP.playVideo(G.videoId,E,P,Q,G.playerParams,G.p_,IyC(G));H.wP(new g.bb(1))},Av3=function(H){H.iM&&(H.iM.abort(),H.iM=null); H.NW&&(H.NW.cancel(),H.NW=null);H.xS&&(g.lU.clearTimeout(H.xS),H.xS=null);hX(H);H.ut&&(H.ut.cancel(),H.ut=null);H.YZ&&(g.lU.clearTimeout(H.YZ),H.YZ=null)},$BJ=function(H,E){return g.VS(H,function(G){return G||E?!G!=!E?!1:G.id==E.id:!0})},kR=function(H){H.L&&(O2W(H),H.L.cancel(),H.L=null)},m3C=function(H){this.L=H; this.W=new W0},uBJ=function(H){if(H.vL==0)return H.dP; var E=[];g.x1(E,obK(H.W));g.x1(E,H.G);return E},vZW=function(H){var E=H.L.media,G=H.L.customData; if(E&&G){var P=UG(H);E.contentId!=P.videoId&&Ig("Cast changing video to: "+E.contentId);P.videoId=E.contentId;P.playerState=G.playerState;w5(P,H.L.getEstimatedTime());P0(H,P)}else Ig("No cast media video. Ignoring state update.")},mt=function(H,E){g.E4.call(this); this.L=new M3K(E);this.T=H;this.W=E&&E.q2u||null;H=E&&E.Rax||null;E&&E.lv7&&(H?H["X-Client-Protocol"]="webchannel":H={"X-Client-Protocol":"webchannel"});this.L.L_=H;H=E&&E.l0o||null;E&&E.yE&&(H?H["X-WebChannel-Content-Type"]=E.yE:H={"X-WebChannel-Content-Type":E.yE});E&&E.Si&&(H?H["X-WebChannel-Client-Profile"]=E.Si:H={"X-WebChannel-Client-Profile":E.Si});this.L.G6=H;(H=E&&E.uV5)&&!g.xm(H)&&(this.L.B=H);this.C=E&&E.bM5||!1;this.D=E&&E.uyZ||!1;(E=E&&E.suu)&&!g.xm(E)&&(this.L.PF=E,g.Fe(this.W,E)&&(H= this.W,E in H&&delete H[E]));this.G=new AX(this)},ayo=function(H,E){return H.gt?!0:H.s7?Object.values(d33).includes(E):H.FI?!Object.values(D3$).includes(E):H.G6?Object.values(nZR).includes(E):!1},OA3=function(H,E){H.L&&(H.L.token=E,dZ(H.D,H.L)); H.publish("sessionScreen",H.L)},v0=function(H){this.name=this.id=""; this.clientName="UNKNOWN_INTERFACE";this.app="";this.type="REMOTE_CONTROL";this.ownerObfuscatedGaiaId=this.obfuscatedGaiaId=this.avatar=this.username="";this.capabilities=new Set;this.compatibleSenderThemes=new Set;this.experiments=new Set;this.theme="u";new u4;this.model=this.brand="";this.year=0;this.chipset=this.osVersion=this.os="";this.mdxDialServerType="MDX_DIAL_SERVER_TYPE_UNKNOWN";H&&(this.id=H.id||H.name,this.name=H.name,this.clientName=H.clientName?H.clientName.toUpperCase():"UNKNOWN_INTERFACE", this.app=H.app,this.type=H.type||"REMOTE_CONTROL",this.username=H.user||"",this.avatar=H.userAvatarUri||"",this.obfuscatedGaiaId=H.obfuscatedGaiaId||"",this.ownerObfuscatedGaiaId=H.ownerObfuscatedGaiaId||"",this.theme=H.theme||"u",IX$(this,H.capabilities||""),KS$(this,H.compatibleSenderThemes||""),pMK(this,H.experiments||""),this.brand=H.brand||"",this.model=H.model||"",this.year=H.year||0,this.os=H.os||"",this.osVersion=H.osVersion||"",this.chipset=H.chipset||"",this.mdxDialServerType=H.mdxDialServerType|| "MDX_DIAL_SERVER_TYPE_UNKNOWN",H=H.deviceInfo)&&(H=JSON.parse(H),this.brand=H.brand||"",this.model=H.model||"",this.year=H.year||0,this.os=H.os||"",this.osVersion=H.osVersion||"",this.chipset=H.chipset||"",this.clientName=H.clientName?H.clientName.toUpperCase():"UNKNOWN_INTERFACE",this.mdxDialServerType=H.mdxDialServerType||"MDX_DIAL_SERVER_TYPE_UNKNOWN")},jbM=function(H){Me("remote.onCastSessionChange_: "+pM(H)); if(H){var E=ed();if(E&&E.id==H.id){if(d5(E.id,"YouTube TV"),H.idType=="shortLived"&&(H=H.token))hn&&(hn.token=H),(E=W7())&&E.bT(H)}else E&&DT(),ur(H,1)}else W7()&&DT()},cvR=function(H){g.DK.call(this,"serverreachability",H)},ns=function(){},Sd=function(H,E,G){var P=g.iP(G); if(P.L!="")E&&g.yZ(P,E+"."+P.L),g.bg(P,P.G);else{var Q=window.location;P=VKu(Q.protocol,E?E+"."+Q.hostname:Q.hostname,+Q.port,G)}H.z0&&g.kn(H.z0,function(e,w){g.MZ(P,w,e)}); g.MZ(P,"VER",H.je);eJ(H,P);return P},CHR=function(H,E){var G=5E3+Math.floor(Math.random()*1E4); H.isActive()||(G*=2);return G*E},yvd=function(H,E,G){H.z$=1; H.N=sG(E.clone());H.L_=G;H.PF=!0;Nzu(H,null)},bAD=function(H){H.vL=0; H.dP=[];if(H.T){var E=obK(H.W);if(E.length!=0||H.G.length!=0)g.x1(H.dP,E),g.x1(H.dP,H.G),H.W.G.length=0,g.dm(H.G),H.G.length=0;H.T.Tu()}},qR=function(H){H.length?l9o(H.shift(),function(){qR(H)}):UBZ()},vjC=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(H){var E=Math.random()*16|0; return(H=="x"?E:E&3|8).toString(16)})},ag=function(H,E){if(E==2||E==9){var G=null; H.jx&&(G=null);var P=(0,g.co)(H.TaJ,H);G||(G=new g.TE("//www.google.com/images/cleardot.gif"),sG(G));J0D(G.toString(),1E4,P)}else zB(2);iAC(H,E)},YU=function(H,E){return!!E&&(H.id==E||H.uuid==E)},qSC=function(H,E,G){if(E&&!H.eR)throw Error("Can't create secondary domain capable XhrIo object."); E=H.Fa&&!H.b8?new g.il(new g.qG({zX:G})):new g.il(H.b8);E.B=H.eR;return E},R3Z=function(H,E,G){G=Math.min(H.G.length,G); var P=H.T?(0,g.co)(H.T.Os,H.T,H):null;a:{for(var Q=H.G,e=-1;;){var w=["count="+G];e==-1?G>0?(e=Q[0].L,w.push("ofs="+e)):e=0:w.push("ofs="+e);for(var t=!0,k=0;k=0&&window.navigator.userAgent.indexOf("Chrome/")>=0&&window.navigator.presentation?AHd()>=60&&CpW():!window.chrome||!window.navigator.presentation||window.navigator.userAgent.indexOf("Edge")>=0?UBZ():AHd()>=89?CO3():(XMJ(),qR(ZmR.map(a9u))))):jd("Cannot initialize because not running Chrome")},LS$=function(){var H=OP; if(Ks[0]){var E=jJ?c0:-1,G={};do G={Uy:void 0},E=(E+1)%50,G.Uy=Ks[E],g.D9(H,function(P){return function(Q){Q(P.Uy)}}(G)); while(E!=c0);Ks=Array(50);c0=-1;jJ=!1}},Ne=function(){g.D.call(this,{J:"div", Y:"ytp-mdx-popup-dialog",j:{role:"dialog"},V:[{J:"div",Y:"ytp-mdx-popup-dialog-inner-content",V:[{J:"div",Y:"ytp-mdx-popup-title",iJ:"You're signed out"},{J:"div",Y:"ytp-mdx-popup-description",iJ:"Videos you watch may be added to the TV's watch history and influence TV recommendations. To avoid this, cancel and sign in to YouTube on your computer."},{J:"div",Y:"ytp-mdx-privacy-popup-buttons",V:[{J:"button",QN:["ytp-button","ytp-mdx-privacy-popup-cancel"],iJ:"Cancel"},{J:"button",QN:["ytp-button", "ytp-mdx-privacy-popup-confirm"],iJ:"Confirm"}]}]}]});this.fade=new g.NB(this,250);this.cancelButton=this.HF("ytp-mdx-privacy-popup-cancel");this.confirmButton=this.HF("ytp-mdx-privacy-popup-confirm");g.d(this,this.fade);this.Z(this.cancelButton,"click",this.L);this.Z(this.confirmButton,"click",this.W)},lyM=function(H,E){if(H.Zg!=null)throw Error("WatchDog timer not null"); H.Zg=EP((0,g.co)(H.z4,H),E)},z3W=function(H){var E,G; g.L(function(P){if(P.L==1)return g.Fq(P,2),g.U(P,U3W(H),2);g.ED(P);E=H.G;H.G=[];G=E.length;x3Z(H,E,G);yB(H);return g.GN(P,0)})},Tzu=function(H,E){this.L=H; this.map=E;this.context=null},b4=function(H){V33(H); g.Vq(H.TL);H.TL=null;H.T.stop();H.G.removeAll();if(H.Ht){var E=H.Ht;H.Ht=null;E.abort();E.dispose()}H.Vg&&(H.Vg=null)},NeM=function(H,E){if(yHu(H.W)>=H.W.D-(H.C?1:0))return!1; if(H.C)return H.G=E.WF.concat(H.G),!0;if(H.vL==1||H.vL==2||H.Jm>=(H.lG?0:H.yS))return!1;H.C=xU((0,g.co)(H.Qo,H,E),FOW(H,H.Jm));H.Jm++;return!0},bmR=function(H,E){this.W=H; this.L=E},TaK=function(H,E){g.E4.call(this); var G=this;this.handler=H();this.handler.subscribe("handlerOpened",this.Af,this);this.handler.subscribe("handlerClosed",this.onClosed,this);this.handler.subscribe("handlerError",function(P,Q){G.onError(Q)}); this.handler.subscribe("handlerMessage",this.onMessage,this);this.L=E},SSR=function(H,E){this.action=H; this.params=E||{}},FSM=function(H,E){var G; E?G=E.V8:G=H.BF++;var P=H.T$.clone();g.MZ(P,"SID",H.D);g.MZ(P,"RID",G);g.MZ(P,"AID",H.z$);P7(H,P);H.B&&H.L_&&g.Wi(P,H.B,H.L_);G=new i4(H,H.D,G,H.Jm+1);H.B===null&&(G.T$=H.L_);E&&(H.G=E.WF.concat(H.G));E=R3Z(H,G,1E3);G.setTimeout(Math.round(H.cK*.5)+Math.round(H.cK*.5*Math.random()));LDo(H.W,G);yvd(G,P,E)},KS$=function(H,E){H.compatibleSenderThemes.clear(); g.W2(E.split(","),g.iK(zRM,fyH)).forEach(function(G){H.compatibleSenderThemes.add(G)})},qe=function(H){H||(g.yF("yt-remote-session-screen-id"),g.yF("yt-remote-session-video-id")); ppd();H=a$();g.Ih(H,OG());HtH(H)},EGD=function(H,E){return new g.od(H,E)},a$=function(){var H=g.pr("yt-remote-connected-devices")||[]; g.nT(H);return H},KD$=function(H,E){H.W&&H.W==E?H.W=null:H.L&&H.L.has(E)&&H.L.delete(E)},Gto=function(H){var E={}; g.D9(H.C(),function(G){G.token?E[G.token]=G.id:this.L0("Requesting availability of screen w/o lounge token.")}); return E},P3$=function(H){return H.L?H.E7=="GET"&&H.z$!=2&&H.G.Fa:!1},ppd=function(){var H=a$(),E=OG(); g.GH()&&g.iW(H,E);H=Jvo(H);if(H.length==0)try{g.WC("remote_sid")}catch(G){}else try{g.m9("remote_sid",H.join(","),-1)}catch(G){}},POW=function(H){g.kM("yt.mdx.remote.currentScreenId_",H)},QMH=function(H){H.C=g.bw(function(){Rg("Connecting timeout"); H.Qb(1)},2E4)},etM=function(H,E){var G=H.IS,P=E.indexOf("\n",G); if(P==-1)return sMM;G=Number(E.substring(G,P));if(isNaN(G))return oGC;P+=1;if(P+G>E.length)return sMM;E=E.slice(P,P+G);H.IS=P+G;return E},JX=function(H,E,G){return G&&G.pTo?G.pTo[H]||E:E},w2M=function(H){H.L=0; H.qn=-1;if(H.jx)if(H.G.length==0&&H.W.length==0)H.jx.gE();else{var E=g.dm(H.G),G=g.dm(H.W);H.G.length=0;H.W.length=0;H.jx.gE(E,G)}},AHd=function(){var H=window.navigator.userAgent.match(/Chrome\/([0-9]+)/); return H?parseInt(H[1],10):0},htJ=function(){var H=EbM(),E=ed(); E||(E=r5());return g.VS(H,function(G){return E&&YU(E,G.key)?!0:!1})},$au=function(H,E){this.L=H; this.map=E;this.context=null},Abd=function(H,E){var G=null; if(E){var P=tgR(H);P&&(G={clientName:P.clientName,deviceMake:P.brand,deviceModel:P.model,osVersion:P.osVersion})}g.kM("yt.mdx.remote.remoteClient_",G);E&&(ktH(H),WZW(H));G=H.W.hc()&&isNaN(H.C);E==G?E&&(B0(H,1),YR(H,"getSubtitlesTrack")):E?(H.kL()&&H.L.reset(),B0(H,1),YR(H,"getNowPlaying"),IJH(H)):H.Qb(1)},maH=function(H){return uBJ(H.L).map(function(E){var G=H.W; E=E.map;"__data__"in E?(E=E.__data__,G=G.D?HAW(E):E):G=E;return G})},O2W=function(H){H.E7!=null&&(g.lU.clearTimeout(H.E7),H.E7=null)},XpR=function(H){jd("setCastInstalled_ "+H); g.Fj("yt-remote-cast-installed",H)},c0Z=function(H){H.L||H.N||(H.U2=1,g.VP(H.Eb,H),H.WF=0)},uWu=function(H){g.M9(H.C); H.C=0;g.M9(H.B);H.B=0;H.T();H.T=function(){}; g.M9(H.L_)},XU=function(H,E,G){H.D.sendMessage(E,G)},vGH=function(H,E){H.info("sendYoutubeMessage_: "+E+" "+g.Lv()); var G={};G.type=E;H.G?H.G.sendMessage("urn:x-cast:com.google.youtube.mdx",G,function(){},(0,g.co)(function(){ZT(this,"Failed to send message: "+E+".")},H)):ZT(H,"Sending yt message without session: "+g.Lv(G))},kcR=function(H,E){var G=parseInt(E.params.currentTime||E.params.current_time,10); w5(H.L,isNaN(G)?0:G);G=parseInt(E.params.state,10);G=isNaN(G)?-1:G;G==-1&&H.L.playerState==-1E3&&(G=-1E3);H.L.playerState=G;G=Number(E.params.loadedTime);H.L.N=isNaN(G)?0:G;H.L.uB(Number(E.params.duration));G=H.L;var P=Number(E.params.liveIngestionTime);G.L=P;G.D=isNaN(P)?!1:!0;G=H.L;P=Number(E.params.seekableStartTime);E=Number(E.params.seekableEndTime);G.W=isNaN(P)?0:P;G.B=isNaN(E)?0:E;H.L.playerState==1?MgW(H):daW(H);H.publish("remotePlayerChange")},Dau=function(H,E,G){H.jy=G; H.player.publish("presentingplayerstatechange",new g.Jt(G,E))},Cs=function(H){v7("Controller",H)},aJC=function(H,E){if(H.L==0)throw Error("Invalid operation: sending map when state is closed"); H.W.push(new Tzu(H.e3++,E));H.L!=2&&H.L!=3||nGd(H)},Oto=function(){jd("clearCurrentReceiver"); g.yF("yt-remote-cast-receiver")},jMR=function(){var H=g.LU.OP(); H&&KZC(H,H.u3.CX(!0))},g5=function(H){H.onload=null; H.onerror=null;H.onabort=null;H.ontimeout=null},KM=function(){return!!g.pr("yt-remote-cast-installed")},lXu=function(H){var E={}; E.index=H.index;E.listId=H.listId;E.videoId=H.videoId;E.playerState=H.playerState;E.volume=H.volume;E.muted=H.muted;E.audioTrackId=H.audioTrackId;E.trackData=g.sM(H.trackData);E.hasPrevious=H.vR;E.hasNext=H.wU;E.playerTime=H.C;E.playerTimeAt=H.T;E.seekableStart=H.W;E.seekableEnd=H.B;E.duration=H.G;E.loadedTime=H.N;E.liveIngestionTime=H.L;return E},cbo=function(H){H.NW||H.xS||(H.B=1,H.xS=EP((0,g.co)(H.cC,H),0),H.fU=0)},yHu=function(H){return H.W?1:H.L?H.L.size:0},NoD=function(H,E,G,P){g.DK.call(this, "timingevent",H); this.size=E;this.rtt=G;this.retries=P},btd=function(H,E,G,P){g.M9(H.C); H.C=0;ybC(H.D,E,function(Q){Q||P<0?G(Q):H.C=g.bw(function(){btd(H,E,G,P-1)},300)})},itK=function(H,E){H.B=E.params.videoId; H.publish("nowAutoplaying",parseInt(E.params.timeout,10))},xBR=function(H,E,G,P,Q,e,w,t,k,W,I,A,m,u,v){var n=this; G=G===void 0?!1:G;P=P===void 0?function(){return""}:P; Q=Q===void 0?!1:Q;e=e===void 0?!1:e;w=w===void 0?!1:w;t=t===void 0?function(){return g.GU({})}:t; k=k===void 0?!1:k;I=I===void 0?!1:I;A=A===void 0?!1:A;m=m===void 0?!1:m;u=u===void 0?!1:u;this.eR=H;this.p_=E;this.C=new g.DD;this.W=(this.PF=!!v)?v(function(){n.dB()}):new br(this.dB,this); this.L=null;this.B=!1;this.L_=null;this.Jm="";this.WF=this.N=0;this.G=[];this.U2=G;this.O7=P;this.T=e;this.z$=t;this.T$=W;this.V8=w;this.E7=null;this.D=g.GU();this.jT=Q;this.dP=k;this.FI=I;this.s7=A;this.gt=m;this.G6=u;this.hm=new imu;this.Yp=new qDd;this.au=new qy3;this.MZ=new Rwo;this.BF=new JHu;this.ML=new RtR;this.WO=new GcD},xU=function(H,E){if(typeof H!=="function")throw Error("Fn must not be null and must be a function"); return g.lU.setTimeout(function(){H()},E)},Ls=function(H,E,G){g.J.call(this); this.C=G!=null?(0,g.co)(H,G):H;this.nM=E;this.T=(0,g.co)(this.tf,this);this.L=!1;this.W=0;this.G=this.Zj=null;this.D=[]},l4=function(H){if(H.size!=H.L.length){for(var E=0,G=0;E0&&(H.capabilities= Q),H.name=E.device,H.app=E.app,(E=E.theme)&&(H.theme=E),Me(" -- with channel params: "+g.Lv(H)),H?(g.Fj("yt-remote-session-app",H.app),g.Fj("yt-remote-session-name",H.name)):(g.yF("yt-remote-session-app"),g.yF("yt-remote-session-name")),g.kM("yt.mdx.remote.channelParams_",H),G.start(),o$()||xaJ())}},ToJ=function(H){g.M9(H.N); H.N=0;g.M9(H.C);H.C=0;g.M9(H.p_);H.p_=0;g.M9(H.T);H.T=0;g.M9(H.B);H.B=0},Vgo=function(H,E,G,P,Q){g.z7.call(this); this.G=H;this.B=E;this.D=G;this.C=P;this.T=Q;this.W=0;this.L=null;this.Zj=NaN},vbJ=function(H,E){g.z7.call(this); this.C=E;E=(E=g.pr("yt-remote-online-screen-ids")||"")?E.split(","):[];for(var G={},P=this.C(),Q=P.length,e=0;e=H.D:!1},s0u=function(H,E){E?(H.info("onConnectedScreenId_: Received screenId: "+E),H.L&&H.L.id==E||H.qr(E,function(G){sP(H,G)},function(){return H.Yj()},5)):H.Yj(Error("Waiting for session status timed out."))},o6C=function(){return g.pr("yt-remote-session-browser-channel")},IyC=function(H){if(H.s7){if(H.s7.locationOverrideToken)return{locationOverrideToken:H.s7.locationOverrideToken}; if(H.s7.latitudeE7!=null&&H.s7.longitudeE7!=null)return{latitudeE7:H.s7.latitudeE7,longitudeE7:H.s7.longitudeE7}}return null},gZ=function(H){Q0d(H.W)||H.C||(H.C=!0,g.VP(H.Qo,H),H.Jm=0)},BzJ=function(H,E){var G=!1; An()||(H=new ps(H,E),H.subscribe("yt-remote-cast2-availability-change",function(P){g.Fj("yt-remote-cast-available",P);kU("yt-remote-cast2-availability-change",P)}),H.subscribe("yt-remote-cast2-receiver-selected",function(P){jd("onReceiverSelected: "+P.friendlyName); g.Fj("yt-remote-cast-receiver",P);kU("yt-remote-cast2-receiver-selected",P)}),H.subscribe("yt-remote-cast2-receiver-resumed",function(P){jd("onReceiverResumed: "+P.friendlyName); g.Fj("yt-remote-cast-receiver",P);kU("yt-remote-cast2-receiver-resumed",P)}),H.subscribe("yt-remote-cast2-session-change",function(P){jd("onSessionChange: "+pM(P)); P||g.yF("yt-remote-cast-receiver");kU("yt-remote-cast2-session-change",P)}),g.kM("yt.mdx.remote.cloudview.instance_",H),G=!0); jd("cloudview.createSingleton_: "+G);return G},br=function(H,E){g.J.call(this); this.L=new g.Wt(this.Gqw,0,this);g.d(this,this.L);this.nM=5E3;this.ya=0;if(typeof H==="function")E&&(H=(0,g.co)(H,E));else if(H&&typeof H.handleEvent==="function")H=(0,g.co)(H.handleEvent,H);else throw Error("Invalid listener argument");this.W=H},eQ3=function(H){var E=H.Jm(); E?H.D["x-youtube-lounge-xsrf-token"]=E:delete H.D["x-youtube-lounge-xsrf-token"]},Zto=function(){return KM()?An()?An().getCastSession():(mR("getCastSelector: Cast is not initialized."),null):(mR("getCastSelector: Cast API is not installed!"),null)},Guo=function(H){window.chrome&&chrome.cast&&chrome.cast.logMessage&&chrome.cast.logMessage(H)},wSH=function(H){this.T=H||10; g.lU.PerformanceNavigationTiming?(H=g.lU.performance.getEntriesByType("navigation"),H=H.length>0&&(H[0].nextHopProtocol=="hq"||H[0].nextHopProtocol=="h2")):H=!!(g.lU.chrome&&g.lU.chrome.loadTimes&&g.lU.chrome.loadTimes()&&g.lU.chrome.loadTimes().wasFetchedViaSpdy);this.D=H?this.T:1;this.L=null;this.D>1&&(this.L=new Set);this.W=null;this.G=[]},W0=function(){},hQK=function(H){var E=Sd(H.L,H.Ep,"/mail/images/cleardot.gif"); sG(E);r0M(E.toString(),5E3,(0,g.co)(H.J9,H),3,2E3);H.x4(1)},wMd=function(H){H.T=g.pr("yt-remote-device-id-map")||{}},$N3=function(H){var E=(c0+1)%50; c0=E;Ks[E]=H;jJ||(jJ=E==49)},IJH=function(H){g.M9(H.L_); H.L_=g.bw(function(){H.Qb(1)},864E5)},tLK=function(H){g.UM.call(this,H); this.X2={key:vjC(),name:"This computer"};this.cA=null;this.subscriptions=[];this.o0=this.KP=null;this.Y1=[this.X2];this.DK=this.X2;this.jy=new g.bb(64);this.Wx=0;this.Fr=-1;this.QK=!1;this.pM=this.EA=this.iz=null;if(!g.Rp(this.player.K())&&!g.qt(this.player.K())){H=this.player;var E=g.X0(H);E&&(E=E.TA())&&(E=new zw(H,E),g.d(this,E));E=new Hl(H);g.d(this,E);g.as(H,E.element,4);this.iz=new Ne;g.d(this,this.iz);g.as(H,this.iz.element,4);this.QK=!!r5()}},kuK=function(H){var E=0; H.NW&&E++;H.ut&&E++;return E},H2u=function(H){return g.wH(H,function(E){return{key:E.id, name:E.name}})},WEo=function(H,E){var G=H.screens.length; H.screens=g.W2(H.screens,function(P){return!(P||E?!P!=!E?0:P.id==E.id:1)}); return H.screens.length0&&(G.MZ=1.5*k);P=G;var W=H.S9();if(W){var I=g.kf(W,"X-Client-Wire-Protocol");if(I){var A=P.W;!A.L&&(g.f3(I,"spdy")||g.f3(I,"quic")||g.f3(I,"h2"))&&(A.D=A.T,A.L=new Set,A.W&&(LDo(A,A.W),A.W=null))}if(P.PF){var m=g.kf(W,"X-HTTP-Session-Id");m&&(P.qC=m,g.MZ(P.T$,P.PF,m))}}G.vL=3;G.T&&G.T.Ub();G.ML&&(G.WO=Date.now()-H.Jm);P=G;var u=H;P.AG=SjH(P,P.eR?P.V8:null,P.jT); if(u.eR){KD$(P.W,u);var v=u,n=P.MZ;n&&v.setTimeout(n);v.p_&&(oZR(v),Gw(v));P.L=u}else c0Z(P);G.G.length>0&&gZ(G)}else e[0]!="stop"&&e[0]!="close"||LM(G,7);else G.vL==3&&(e[0]=="stop"||e[0]=="close"?e[0]=="stop"?LM(G,7):G.disconnect():e[0]!="noop"&&G.T&&G.T.S_(e),G.WF=0)}wY(4)}catch(O){}},KeD=function(){return j0K=j0K||new g.E4},d5=function(H,E){I$()?An().setConnectedScreenStatus(H,E):mR("setConnectedScreenStatus called before ready.")},hW=function(H){if(g.lU.JSON)try{return g.lU.JSON.parse(H)}catch(E){}return HAW(H)}, jd=function(H){v7("cloudview",H)},cUZ=function(){this.L=new W0},ed=function(){var H=o$(); if(!H)return null;var E=B7().RF();return MR(E,H)},ps=function(H,E){g.z7.call(this); this.config_=E;this.W=H;this.N=E.appId||"233637DE";this.D=E.theme||"cl";this.L_=E.disableCastApi||!1;this.C=E.forceMirroring||!1;this.L=null;this.B=!1;this.G=[];this.T=(0,g.co)(this.IO7,this)},QB=function(H){H=H||{}; this.name=H.name||"";this.id=H.id||H.screenId||"";this.token=H.token||H.loungeToken||"";this.uuid=H.uuid||H.dialId||"";this.idType=H.screenIdType||"normal";this.secret=H.screenIdSecret||""},$X=function(H){isNaN(H.G)||g.M9(H.G); H.G=g.bw((0,g.co)(H.gB,H),H.D>0&&H.D=0; return g.pC||H},yB=function(H){H.publish("handlerOpened"); H.hm.UM("BROWSER_CHANNEL")},led=function(H){H.length>5&&(H=H.slice(H.length-5)); var E=g.wH(mNu(),function(P){return P.loungeToken}),G=g.wH(H,function(P){return P.loungeToken}); g.fF(G,function(P){return!g.Xa(E,P)})&&xb3(); g.Fj("yt-remote-local-screens",H,31536E3)},ir=function(){if(!tW){tW=new g.Jo(new Bao); var H=g.kF("client_streamz_web_flush_count",-1);H!==-1&&(tW.G=H)}return tW},kX=function(H,E,G){return(0,g.co)(function(P){this.L0("Failed to "+E+" with cast v2 channel. Error code: "+P.code); P.code!=chrome.cast.ErrorCode.TIMEOUT&&(this.L0("Retrying "+E+" using MDx browser channel."),XU(this,E,G))},H)},Wl=function(H){switch(H.playerState){case 1:case 1081:return(g.Gl()-H.T)/1E3+H.C; case -1E3:return 0}return H.C},NR=function(H,E,G){g.z7.call(this); this.PF=G;this.D=H;this.W=E;this.L=null},zB=function(H){IB.dispatchEvent(new RQH(IB,H))},AX=function(H){this.L=H},J0D=function(H,E,G){var P=new Image; P.onload=function(){try{g5(P),G(!0)}catch(Q){}}; P.onerror=function(){try{g5(P),G(!1)}catch(Q){}}; P.onabort=function(){try{g5(P),G(!1)}catch(Q){}}; P.ontimeout=function(){try{g5(P),G(!1)}catch(Q){}}; g.lU.setTimeout(function(){if(P.ontimeout)P.ontimeout()},E); P.src=H},MLZ=function(H,E,G){if(g.gw(H))g.D9(H,E,G); else for(H=pkR(H);;){var P=H.next();if(P.done)break;E.call(G,P.value,void 0,H)}},MR=function(H,E){return g.VS(H,function(G){return YU(G,E)})},$U=function(H,E,G,P){P=P===void 0?!1:P; g.z7.call(this);var Q=this;this.C=NaN;this.E7=!1;this.L_=this.N=this.WF=this.Jm=NaN;this.p_=[];this.T=this.B=this.D=this.L=this.W=null;this.T$=H;this.O7=P;this.p_.push(g.Pm(window,"beforeunload",function(){Q.Qb(2)})); this.G=[];this.L=new GT;this.z$=E.id;this.PF=E.idType;this.W=VaK(this.T$,G,this.xe,this.PF=="shortLived",this.z$);this.W.listen("channelOpened",function(){JUW(Q)}); this.W.listen("channelClosed",function(){Rg("Channel closed");isNaN(Q.C)?qe(!0):qe();Q.dispose()}); this.W.listen("channelError",function(e){qe();isNaN(Q.A0())?(e==1&&Q.PF=="shortLived"&&Q.publish("browserChannelAuthError",e),Rg("Channel error: "+e+" without reconnection"),Q.dispose()):(Q.E7=!0,Rg("Channel error: "+e+" with reconnection in "+Q.A0()+" ms"),B0(Q,2))}); this.W.listen("channelMessage",function(e){rUK(Q,e)}); this.W.bT(E.token);this.subscribe("remoteQueueChange",function(){var e=Q.L.videoId;g.GH()&&g.Fj("yt-remote-session-video-id",e)})},YpC=function(){var H=htJ(); !H&&KM()&&Bm3()&&(H={key:"cast-selector-receiver",name:Bm3()});return H},RQH=function(H){g.DK.call(this,"statevent",H)},Pp$=function(H,E){if(H.L){var G=H.L.UH||{}; E&&Object.keys(E).length>0?G=Object.assign({},G,E):delete G.Authorization;H.L.UH=G}},XSR=function(H,E,G){H.info("onConnectedScreenData_: Received screenData: "+JSON.stringify(E)); var P=new QB(E);btd(H,P,function(Q){Q?(H.Jm=!0,dZ(H.D,P),sP(H,P),H.L_="unknown",bQo(H,G)):(g.OS(Error("CastSession, RemoteScreen from screenData: "+JSON.stringify(E)+" is not online.")),H.Yj())},5)},zwW=function(H){g.E4.call(this); this.L=H();this.L.subscribe("webChannelOpened",this.Y2,this);this.L.subscribe("webChannelClosed",this.onClosed,this);this.L.subscribe("webChannelError",this.onError,this);this.L.subscribe("webChannelMessage",this.onMessage,this)},i4=function(H,E,G,P){this.G=H; this.D=E;this.V8=G;this.U2=P||1;this.s7=new g.S1(this);this.hm=45E3;this.T$=null;this.C=!1;this.L_=this.BF=this.N=this.z$=this.Jm=this.au=this.p_=null;this.WF=[];this.L=null;this.B=0;this.T=this.E7=null;this.FI=-1;this.O7=!1;this.MZ=0;this.Yp=null;this.dP=this.eR=this.G6=this.PF=!1;this.W=new YOK},CwH=function(H,E){var G=(Date.now()-ZQW)/1E3; G.toFixed&&(G=G.toFixed(3));var P=[];P.push("[",G+"s","] ");P.push("[","yt.mdx.remote","] ");P.push(H+": "+E,"\n");return P.join("")},YSZ=function(H,E){XpR(!0); DtD(!1);g6H(H,function(G){G?(e3u(!0),g.ky("yt-remote-cast2-api-ready")):(mR("Failed to initialize cast API."),XpR(!1),g.yF("yt-remote-cast-available"),g.yF("yt-remote-cast-receiver"),wp$());E(G)})},LEu=function(H,E,G){this.L=1; this.W=[];this.G=[];this.T=new W0;this.L_=H||null;this.C=E!=null?E:null;this.N=G||!1},RtR=function(){var H=ir(); this.L=H;H.rX("/client_streamz/youtube/living_room/mdx/browser_channel/pending_maps")},llu=function(H){ep(H)&&H.G.getDialAppInfo(function(E){H.info("getDialAppInfo dialLaunchData: "+JSON.stringify(E)); E=E.extraData||{};var G=null;if(E.loungeToken){var P;((P=H.L)==null?void 0:P.token)==E.loungeToken&&(G="staleLoungeToken")}else G="missingLoungeToken";G?(H.Jm=G,og(H,3E4)):(H.WF=!1,H.Jm="unknown",OA3(H,E.loungeToken),og(H,E.loungeTokenRefreshIntervalMs))},function(E){H.info("getDialAppInfo error: "+E); H.Jm="noLoungeTokenResponse";og(H,3E4)})},jvW=function(H){g.DK.call(this,"statevent",H)},UNR=function(H,E,G){var P=UG(H); w5(P,G);P.playerState!=-1E3&&(P.playerState=E);P0(H,P)},Nzu=function(H,E){H.Jm=Date.now(); Gw(H);H.BF=H.N.clone();Fw(H.BF,"t",H.U2);H.B=0;var G=H.G.eR;H.W=new YOK;H.L=qSC(H.G,G?E:null,!H.L_);H.MZ>0&&(H.Yp=new g.S7((0,g.co)(H.m5,H,H.L),H.MZ));H.s7.listen(H.L,"readystatechange",H.Us);E=H.T$?g.sj(H.T$):{};H.L_?(H.E7||(H.E7="POST"),E["Content-Type"]="application/x-www-form-urlencoded",H.L.send(H.BF,H.E7,H.L_,E)):(H.E7="GET",H.L.send(H.BF,H.E7,null,E));wY(1)},Ig=function(H){v7("CP",H)},xNW=function(H,E){if(E){var G=H.S.getOption("captions","tracklist",{B7:1}); G&&G.length?(H.S.setOption("captions","track",E),H.T=!1):(H.S.loadModule("captions"),H.T=!0)}else H.S.setOption("captions","track",{})},sP=function(H,E){H.L=E; H.publish("sessionScreen",H.L)},g6H=function(H,E){An().init(H,E)},QpH=function(H,E){return E?g.VS(H.G,function(G){return YU(E,G.label)},H):null},cH3=function(H,E){g.M9(H.p_); H.p_=0;E?H.config_.enableCastLoungeToken&&E.loungeToken?E.deviceId?H.L&&H.L.uuid==E.deviceId||(E.loungeTokenRefreshIntervalMs?XSR(H,{name:H.W.friendlyName,screenId:E.screenId,loungeToken:E.loungeToken,dialId:E.deviceId,screenIdType:"shortLived"},E.loungeTokenRefreshIntervalMs):(g.OS(Error("No loungeTokenRefreshIntervalMs presents in mdxSessionStatusData: "+JSON.stringify(E)+".")),s0u(H,E.screenId))):(g.OS(Error("No device id presents in mdxSessionStatusData: "+JSON.stringify(E)+".")),s0u(H,E.screenId)): s0u(H,E.screenId):H.Yj(Error("Waiting for session status timed out."))},Me=function(H){v7("remote",H)},FDZ=function(H){H.XT=Date.now()+H.W; lyM(H,H.W)},HtH=function(H){g.Fj("yt-remote-connected-devices",H,86400)},zQd=function(H,E){var G=E.params.muted=="true"; H.L.volume=parseInt(E.params.volume,10);H.L.muted=G;H.publish("remotePlayerChange")},Tmu=function(H,E){H.B=E.params.videoId||null; H.publish("autoplayUpNext",H.B)},iAC=function(H,E){H.L=0; H.jx&&H.jx.r_(E);w2M(H);Av3(H)},JUW=function(H){Rg("Channel opened"); H.E7&&(H.E7=!1,WZW(H),H.Jm=g.bw(function(){Rg("Timing out waiting for a screen.");H.Qb(1)},15E3))},nGd=function(H){H.ut||H.YZ||(H.YZ=EP((0,g.co)(H.e_,H),0),H.vg=0)},WZW=function(H){g.M9(H.Jm); H.Jm=NaN},AW=function(H){return H.B||!!H.G.length||!!H.L},B0=function(H,E){H.publish("proxyStateChange",E)},CM=function(H){return H.isPlaying()?(g.Gl()-H.T)/1E3:0},UP=function(H,E){H.W&&(H.W.removeUpdateListener(H.L_),H.W.removeMediaListener(H.B),H.Ng(null)); H.W=E;H.W&&(Ig("Setting cast session: "+H.W.sessionId),H.W.addUpdateListener(H.L_),H.W.addMediaListener(H.B),H.W.media.length&&H.Ng(H.W.media[0]))},VLW=function(H){if(!P3$(H))return g.u3(H.L); var E=g.Hi(H.L);if(E==="")return"";var G="",P=E.length,Q=g.cS(H.L)==4;if(!H.W.G){if(typeof TextDecoder==="undefined")return $R(H),Jn(H),"";H.W.G=new g.lU.TextDecoder}for(var e=0;e6&&E>0){var P=H.W[0].L;G.push("ofs="+P)}else P=0;for(var Q={},e=0;e0&&(this.ox=H.oe);this.FI=void 0;this.WO=0;this.hm=!1;this.dP=this.E7=null},v7=function(H,E){fJH(); var G=CwH(H,String(E));OP.length==0?$N3(G):(LS$(),g.D9(OP,function(P){P(G)}))},ojC=function(H){var E=W7(); fs(null);H||POW("");g.kM("yt.mdx.remote.connection_",H);VB&&(g.D9(VB,function(G){G(H)}),VB.length=0); E&&!H?kU("yt-remote-connection-change",!1):!E&&H&&kU("yt-remote-connection-change",!0)},y0R=function(H){if(H.L||H.N||H.WF>=3)return!1; H.U2++;H.N=xU((0,g.co)(H.Eb,H),FOW(H,H.WF));H.WF++;return!0},u4=function(H,E){this.W={}; this.L=[];this.Se=this.size=0;var G=arguments.length;if(G>1){if(G%2)throw Error("Uneven number of arguments");for(var P=0;P0&&og(H,G)},function(E){H.T=function(){}; H.Yj(E)})},HBC=function(H,E){return H===E}; g.NK.prototype.xP=g.Mt(49,function(){this.app.UR().xP()}); g.Ee.prototype.xP=g.Mt(48,function(){this.pM=null}); g.NK.prototype.JV=g.Mt(47,function(H){this.app.UR().JV(H)}); g.Ee.prototype.JV=g.Mt(46,function(H){this.pM=H}); imu.prototype.UM=function(H){this.L.OH("/client_streamz/youtube/living_room/mdx/channel/opened",H)}; qDd.prototype.UM=function(H){this.L.OH("/client_streamz/youtube/living_room/mdx/channel/closed",H)}; Rwo.prototype.UM=function(H){this.L.OH("/client_streamz/youtube/living_room/mdx/channel/message_received",H)}; qy3.prototype.UM=function(){this.L.OH("/client_streamz/youtube/living_room/mdx/channel/success")}; JHu.prototype.UM=function(H,E){this.L.OH("/client_streamz/youtube/living_room/mdx/channel/error",H,E)}; RtR.prototype.UM=function(){this.L.OH("/client_streamz/youtube/living_room/mdx/browser_channel/pending_maps")}; GcD.prototype.UM=function(){this.L.OH("/client_streamz/youtube/living_room/mdx/browser_channel/undelivered_maps")}; g.M=u4.prototype;g.M.KX=function(){l4(this);for(var H=[],E=0;E2*this.size&&l4(this),!0):!1}; g.M.get=function(H,E){return DC(this.W,H)?this.W[H]:E}; g.M.set=function(H,E){DC(this.W,H)||(this.size+=1,this.L.push(H),this.Se++);this.W[H]=E}; g.M.forEach=function(H,E){for(var G=this.cR(),P=0;P=P.L.length)return g.eT;var e=P.L[E++];return g.CD(H?e:P.W[e])}; return Q}; var WDD={QF7:"atp",QOJ:"ska",jjJ:"que",eeu:"mus",dFN:"sus",Wc5:"dsp",Fpo:"seq",tfZ:"mic",E7u:"dpa",Cu7:"mlm",md7:"dsdtr",jGF:"ntb",WA$:"vsp",r_N:"scn",nw5:"rpe",uG$:"dcn",lq_:"dcp",FYu:"pas",PAw:"drq",NHu:"opf",e6Z:"els",c_F:"isg",iBx:"svq",c2R:"mvp",tdN:"ads",oSo:"stcp",JqF:"sads",bX_:"dloc",TXw:"dcw",UM7:"asw",SvF:"apw",I1m:"wrc",dON:"pcw",Kco:"ipv",xnN:"ndt",X$p:"ctops"},fyH={p57:"u",yvx:"cl",s27:"k",SFa:"i",pA_:"cr",r2J:"m",KQp:"g",Tf:"up"},d33={hk:"adPlaying",FK:"onAdStateChange"},D3$={nQ7:"nowPlaying", kP5:"onStateChange",hk:"adPlaying",FK:"onAdStateChange",RE:"nowPlayingShorts",Lw:"onShortsStateChange"},nZR={RE:"nowPlayingShorts",Lw:"onShortsStateChange"};v0.prototype.equals=function(H){return H?this.id==H.id:!1}; var uEC="",nM=null;g.C(Bao,g.xO);var tW,gj$=YDo("loadCastFramework")||YDo("loadCastApplicationFramework"),ZmR=["pkedcjkdefgpdelpbcmbmeomcjbeemfm","enhhojjnijigcajfphajepfemndkmdlo"];g.xE(Ls,g.J);g.M=Ls.prototype;g.M.T4=function(H){this.D=arguments;this.L=!1;this.Zj?this.G=g.Gl()+this.nM:this.Zj=g.N0(this.T,this.nM)}; g.M.stop=function(){this.Zj&&(g.lU.clearTimeout(this.Zj),this.Zj=null);this.G=null;this.L=!1;this.D=[]}; g.M.pause=function(){++this.W}; g.M.resume=function(){this.W&&(--this.W,!this.W&&this.L&&(this.L=!1,this.C.apply(null,this.D)))}; g.M.G$=function(){this.stop();Ls.j7.G$.call(this)}; g.M.tf=function(){this.Zj&&(g.lU.clearTimeout(this.Zj),this.Zj=null);this.G?(this.Zj=g.N0(this.T,this.G-g.Gl()),this.G=null):this.W?this.L=!0:(this.L=!1,this.C.apply(null,this.D))};W0.prototype.stringify=function(H){return g.lU.JSON.stringify(H,void 0)}; W0.prototype.parse=function(H){return g.lU.JSON.parse(H,void 0)};g.xE(iQM,g.DK);g.xE(wyR,g.DK);var j0K=null;g.xE(cvR,g.DK);g.xE(jvW,g.DK);g.xE(jpJ,g.DK);ns.prototype.debug=function(){}; ns.prototype.info=function(){}; ns.prototype.warning=function(){};var $3K={},h33={};g.M=i4.prototype;g.M.setTimeout=function(H){this.hm=H}; g.M.Us=function(H){H=H.target;var E=this.Yp;E&&g.cS(H)==3?E.c_():this.m5(H)}; g.M.m5=function(H){try{if(H==this.L)a:{var E=g.cS(this.L),G=this.L.W,P=this.L.getStatus();if(!(E<3)&&(E!=3||this.L&&(this.W.W||g.u3(this.L)||g.Hi(this.L)))){this.O7||E!=4||G==7||(G==8||P<=0?wY(3):wY(2));oZR(this);var Q=this.L.getStatus();this.FI=Q;var e=VLW(this);if(this.C=Q==200){if(this.G6&&!this.eR){b:{if(this.L){var w=g.kf(this.L,"X-HTTP-Initial-Response");if(w&&!g.xm(w)){var t=w;break b}}t=null}if(H=t)this.eR=!0,KER(this,H);else{this.C=!1;this.T=3;c7(12);$R(this);Jn(this);break a}}if(this.PF){H= !0;for(var k;!this.O7&&this.B0&&!this.dP&&(this.dP=!0,this.G.ea(this)):($R(this),Jn(this))}else KER(this,e);E==4&&$R(this);this.C&&!this.O7&&(E==4?SDd(this.G,this):(this.C=!1,Gw(this)))}else g.Z$d(this.L),Q==400&&e.indexOf("Unknown SID")> 0?(this.T=3,c7(12)):(this.T=0,c7(13)),$R(this),Jn(this)}}}catch(W){}finally{}}; g.M.cancel=function(){this.O7=!0;$R(this)}; g.M.S3=function(){this.p_=null;var H=Date.now();H-this.au>=0?(this.z$!=2&&(wY(3),c7(17)),$R(this),this.T=2,Jn(this)):qOo(this,this.au-H)}; g.M.getLastError=function(){return this.T}; g.M.S9=function(){return this.L};wSH.prototype.cancel=function(){this.G=obK(this);if(this.W)this.W.cancel(),this.W=null;else if(this.L&&this.L.size!==0){for(var H=g.R(this.L.values()),E=H.next();!E.done;E=H.next())E.value.cancel();this.L.clear()}};g.M=M3K.prototype;g.M.d_=8;g.M.vL=1;g.M.connect=function(H,E,G,P){c7(0);this.jT=H;this.O7=E||{};G&&P!==void 0&&(this.O7.OSID=G,this.O7.OAID=P);this.Yp=this.gt;this.T$=SjH(this,null,this.jT);gZ(this)}; g.M.disconnect=function(){NmW(this);if(this.vL==3){var H=this.BF++,E=this.T$.clone();g.MZ(E,"SID",this.D);g.MZ(E,"RID",H);g.MZ(E,"TYPE","terminate");P7(this,E);H=new i4(this,this.D,H);H.z$=2;H.N=sG(E.clone());E=!1;if(g.lU.navigator&&g.lU.navigator.sendBeacon)try{E=g.lU.navigator.sendBeacon(H.N.toString(),"")}catch(G){}!E&&g.lU.Image&&((new Image).src=H.N,E=!0);E||(H.L=qSC(H.G,null),H.L.send(H.N));H.Jm=Date.now();Gw(H)}bAD(this)}; g.M.f0=function(){return this.vL==0}; g.M.getState=function(){return this.vL}; g.M.Qo=function(H){if(this.C)if(this.C=null,this.vL==1){if(!H){this.BF=Math.floor(Math.random()*1E5);H=this.BF++;var E=new i4(this,"",H),G=this.L_;this.G6&&(G?(G=g.sj(G),g.S5(G,this.G6)):G=this.G6);this.B!==null||this.au||(E.T$=G,G=null);var P;if(this.s7)a:{for(var Q=P=0;Q4096){P=Q;break a}if(P===4096||Q===this.G.length-1){P=Q+1;break a}}P= 1E3}else P=1E3;P=R3Z(this,E,P);Q=this.T$.clone();g.MZ(Q,"RID",H);g.MZ(Q,"CVER",22);this.PF&&g.MZ(Q,"X-HTTP-Session-Id",this.PF);P7(this,Q);G&&(this.au?P="headers="+g.Bo(g.jGt(G))+"&"+P:this.B&&g.Wi(Q,this.B,G));LDo(this.W,E);this.xW&&g.MZ(Q,"TYPE","init");this.s7?(g.MZ(Q,"$req",P),g.MZ(Q,"SID","null"),E.G6=!0,yvd(E,Q,null)):yvd(E,Q,P);this.vL=2}}else this.vL==3&&(H?FSM(this,H):this.G.length==0||Q0d(this.W)||FSM(this))}; g.M.Eb=function(){this.N=null;fl3(this);if(this.ML&&!(this.hm||this.L==null||this.WO<=0)){var H=4*this.WO;this.E7=xU((0,g.co)(this.rGp,this),H)}}; g.M.rGp=function(){this.E7&&(this.E7=null,this.Yp=!1,this.hm=!0,c7(10),kR(this),fl3(this))}; g.M.ea=function(H){this.L==H&&this.ML&&!this.hm&&(O2W(this),this.hm=!0,c7(11))}; g.M.Iy=function(){this.p_!=null&&(this.p_=null,kR(this),y0R(this),c7(19))}; g.M.tt7=function(H){H?c7(2):c7(1)}; g.M.isActive=function(){return!!this.T&&this.T.isActive(this)}; g.M=XyH.prototype;g.M.Ub=function(){}; g.M.S_=function(){}; g.M.td=function(){}; g.M.Tu=function(){}; g.M.isActive=function(){return!0}; g.M.Os=function(){};g.xE(mt,g.E4);mt.prototype.open=function(){this.L.T=this.G;this.C&&(this.L.eR=!0);this.L.connect(this.T,this.W||void 0)}; mt.prototype.close=function(){this.L.disconnect()}; mt.prototype.send=function(H){var E=this.L;if(typeof H==="string"){var G={};G.__data__=H;H=G}else this.D&&(G={},G.__data__=g.Lv(H),H=G);E.G.push(new $au(E.n6++,H));E.vL==3&&gZ(E)}; mt.prototype.G$=function(){this.L.T=null;delete this.G;this.L.disconnect();delete this.L;mt.j7.G$.call(this)}; g.xE(qpD,iQM);g.xE(X2u,wyR);g.xE(AX,XyH);AX.prototype.Ub=function(){this.L.dispatchEvent("m")}; AX.prototype.S_=function(H){this.L.dispatchEvent(new qpD(H))}; AX.prototype.td=function(H){this.L.dispatchEvent(new X2u(H))}; AX.prototype.Tu=function(){this.L.dispatchEvent("n")}; bmR.prototype.commit=function(H){this.L.FI=H};var IB=new g.E4;g.C(RQH,g.DK);g.M=V5.prototype;g.M.Z9=null;g.M.r0=!1;g.M.Zg=null;g.M.XT=null;g.M.Ik=null;g.M.S8=null;g.M.T0=null;g.M.tQ=null;g.M.vW=null;g.M.Ht=null;g.M.IS=0;g.M.Vg=null;g.M.Ui=null;g.M.fv=null;g.M.Ua=-1;g.M.aX=!0;g.M.SD=!1;g.M.VT=0;g.M.TL=null;var oGC={},sMM={};g.M=V5.prototype;g.M.setTimeout=function(H){this.W=H}; g.M.oy=function(H){H=H.target;var E=this.TL;E&&g.cS(H)==3?E.c_():this.Ih(H)}; g.M.Ih=function(H){try{if(H==this.Ht)a:{var E=g.cS(this.Ht),G=this.Ht.W,P=this.Ht.getStatus();if(g.E7&&!g.Gp("420+")){if(E<4)break a}else if(E<3||E==3&&!g.u3(this.Ht))break a;this.SD||E!=4||G==7||(G==8||P<=0?this.L.x4(3):this.L.x4(2));V33(this);var Q=this.Ht.getStatus();this.Ua=Q;var e=g.u3(this.Ht);if(this.r0=Q==200){E==4&&b4(this);if(this.PF){for(H=!0;!this.SD&&this.IS0?(this.fv=3,zB(13)):(this.fv=0,zB(14)),b4(this),p23(this)}}catch(t){}finally{}}; g.M.cancel=function(){this.SD=!0;b4(this)}; g.M.z4=function(){this.Zg=null;var H=Date.now();H-this.XT>=0?(this.S8!=2&&this.L.x4(3),b4(this),this.fv=2,zB(18),p23(this)):lyM(this,this.XT-H)}; g.M.getLastError=function(){return this.fv};g.M=m3C.prototype;g.M.qt=null;g.M.hv=null;g.M.JY=!1;g.M.FC=null;g.M.Sm=null;g.M.hq=-1;g.M.Oi=null;g.M.Ep=null;g.M.connect=function(H){this.FC=H;H=Sd(this.L,null,this.FC);zB(3);Date.now();var E=this.L.L_;E!=null?(this.Oi=E[0],(this.Ep=E[1])?(this.Sm=1,hQK(this)):(this.Sm=2,RZR(this))):(Fw(H,"MODE","init"),this.hv=new V5(this),this.hv.Z9=this.qt,GNR(this.hv,H,!1,null,!0),this.Sm=0)}; g.M.J9=function(H){if(H)this.Sm=2,RZR(this);else{zB(4);var E=this.L;E.qn=E.iM.hq;ag(E,9)}H&&this.x4(2)}; g.M.RU=function(H){return this.L.RU(H)}; g.M.abort=function(){this.hv&&(this.hv.cancel(),this.hv=null);this.hq=-1}; g.M.f0=function(){return!1}; g.M.Ob=function(H,E){this.hq=H.Ua;if(this.Sm==0)if(E){try{var G=this.W.parse(E)}catch(P){H=this.L;H.qn=this.hq;ag(H,2);return}this.Oi=G[0];this.Ep=G[1]}else H=this.L,H.qn=this.hq,ag(H,2);else this.Sm==2&&(this.JY?(zB(7),Date.now()):E=="11111"?(zB(6),this.JY=!0,Date.now(),this.hq=200,this.hv.cancel(),zB(12),TB(this.L,this,!0)):(zB(8),Date.now(),this.JY=!1))}; g.M.wM=function(){this.hq=this.hv.Ua;if(this.hv.r0)this.Sm==0?this.Ep?(this.Sm=1,hQK(this)):(this.Sm=2,RZR(this)):this.Sm==2&&(this.JY?(zB(12),TB(this.L,this,!0)):(zB(11),TB(this.L,this,!1)));else{this.Sm==0?zB(9):this.Sm==2&&zB(10);var H=this.L;this.hv.getLastError();H.qn=this.hq;ag(H,2)}}; g.M.Oa=function(){return this.L.Oa()}; g.M.isActive=function(){return this.L.isActive()}; g.M.x4=function(H){this.L.x4(H)};g.M=LEu.prototype;g.M.UH=null;g.M.z0=null;g.M.ut=null;g.M.NW=null;g.M.p5=null;g.M.zL=null;g.M.oh=null;g.M.L5=null;g.M.Cb=0;g.M.e3=0;g.M.jx=null;g.M.YZ=null;g.M.xS=null;g.M.y4=null;g.M.iM=null;g.M.dM=null;g.M.jj=-1;g.M.CE=-1;g.M.qn=-1;g.M.vg=0;g.M.fU=0;g.M.je=8;var ES3={OK:0,KYJ:2,bz_:4,heu:5,LAF:6,STOP:7,sU:8,Ie7:9,tua:10,USo:11,OW_:12};g.xE(NoD,g.DK);g.xE(f9J,g.DK);g.M=LEu.prototype; g.M.connect=function(H,E,G,P,Q){zB(0);this.p5=E;this.z0=G||{};P&&Q!==void 0&&(this.z0.OSID=P,this.z0.OAID=Q);this.N?(EP((0,g.co)(this.oa,this,H),100),sbu(this)):this.oa(H)}; g.M.disconnect=function(){Av3(this);if(this.L==3){var H=this.Cb++,E=this.zL.clone();g.MZ(E,"SID",this.D);g.MZ(E,"RID",H);g.MZ(E,"TYPE","terminate");eJ(this,E);H=new V5(this,this.D,H);H.S8=2;H.T0=sG(E.clone());(new Image).src=H.T0.toString();H.Ik=Date.now();FDZ(H)}w2M(this)}; g.M.oa=function(H){this.iM=new m3C(this);this.iM.qt=this.UH;this.iM.W=this.T;this.iM.connect(H)}; g.M.f0=function(){return this.L==0}; g.M.getState=function(){return this.L}; g.M.e_=function(H){this.YZ=null;FZ$(this,H)}; g.M.cC=function(){this.xS=null;this.NW=new V5(this,this.D,"rpc",this.B);this.NW.Z9=this.UH;this.NW.VT=0;var H=this.oh.clone();g.MZ(H,"RID","rpc");g.MZ(H,"SID",this.D);g.MZ(H,"CI",this.dM?"0":"1");g.MZ(H,"AID",this.jj);eJ(this,H);g.MZ(H,"TYPE","xmlhttp");GNR(this.NW,H,!0,this.L5,!1)}; g.M.Ob=function(H,E){if(this.L!=0&&(this.NW==H||this.ut==H))if(this.qn=H.Ua,this.ut==H&&this.L==3)if(this.je>7){try{var G=this.T.parse(E)}catch(P){G=null}if(Array.isArray(G)&&G.length==3)if(H=G,H[0]==0)a:{if(!this.xS){if(this.NW)if(this.NW.Ik+3E30)){if(P=E==1)this.ut||this.YZ||this.L==1||this.vg>=2?P=!1:(this.YZ=EP((0,g.co)(this.e_,this,H),CHR(this,this.vg)),this.vg++, P=!0);P=!(P||E==2&&gbH(this))}if(P)switch(G){case 1:ag(this,5);break;case 4:ag(this,10);break;case 3:ag(this,6);break;case 7:ag(this,12);break;default:ag(this,2)}}}; g.M.Cx=function(H){if(!g.Xa(arguments,this.L))throw Error("Unexpected channel state: "+this.L);}; g.M.TaJ=function(H){H?zB(2):(zB(1),iAC(this,8))}; g.M.RU=function(H){if(H)throw Error("Can't create secondary domain capable XhrIo object.");H=new g.il;H.B=!1;return H}; g.M.isActive=function(){return!!this.jx&&this.jx.isActive(this)}; g.M.x4=function(H){var E=IB;E.dispatchEvent(new f9J(E,H))}; g.M.Oa=function(){return!1}; g.M=tFK.prototype;g.M.Ye=function(){}; g.M.Ad=function(){}; g.M.BC=function(){}; g.M.r_=function(){}; g.M.gE=function(){}; g.M.Zt=function(){return{}}; g.M.isActive=function(){return!0};g.M=$tW.prototype;g.M.enqueue=function(H){this.W.push(H)}; g.M.isEmpty=function(){return this.L.length===0&&this.W.length===0}; g.M.clear=function(){this.L=[];this.W=[]}; g.M.contains=function(H){return g.Xa(this.L,H)||g.Xa(this.W,H)}; g.M.remove=function(H){var E=this.L;var G=(0,g.De7)(E,H);G>=0?(g.Fh(E,G),E=!0):E=!1;return E||g.Ih(this.W,H)}; g.M.KX=function(){for(var H=[],E=this.L.length-1;E>=0;--E)H.push(this.L[E]);E=this.W.length;for(var G=0;G=Gm3.length?this.publish("pairingFailed",Error("DIAL polling timed out")):(H=Gm3[this.W],this.Zj=g.bw((0,g.co)(this.l0,this),H),this.W++):this.publish("pairingFailed",Error("Server error "+H.status))}; g.M.j3=function(){this.L=null;this.publish("pairingFailed",Error("Server not responding"))}; var Gm3=[2E3,2E3,1E3,1E3,1E3,2E3,2E3,5E3,5E3,1E4];g.xE(ZC,H0);g.M=ZC.prototype;g.M.start=function(){Pl(this)&&this.publish("screenChange");!g.pr("yt-remote-lounge-token-expiration")&&Sp3(this);g.M9(this.L);this.L=g.bw((0,g.co)(this.start,this),1E4)}; g.M.add=function(H,E){Pl(this);taD(this,H);GB(this,!1);this.publish("screenChange");E(H);H.token||Sp3(this)}; g.M.remove=function(H,E){var G=Pl(this);WEo(this,H)&&(GB(this,!1),G=!0);E(H);G&&this.publish("screenChange")}; g.M.Pj=function(H,E,G,P){var Q=Pl(this),e=this.get(H.id);e?(e.name!=E&&(e.name=E,GB(this,!1),Q=!0),G(H)):P(Error("no such local screen."));Q&&this.publish("screenChange")}; g.M.G$=function(){g.M9(this.L);ZC.j7.G$.call(this)}; g.M.O_5=function(H){Pl(this);var E=this.screens.length;H=H&&H.screens||[];for(var G=H.length,P=0;P20)break a;t=E(e,w)}e=t}Q.name=e}G(dZ(this,Q))},this), onError:(0,g.co)(function(Q){P(Error("pairing request failed: "+Q.status))},this), onTimeout:(0,g.co)(function(){P(Error("pairing request timed out."))},this)})}; g.M.G$=function(){g.Vq(this.W);g.Vq(this.L);SJ.j7.G$.call(this)}; g.M.B5x=function(){A03(this);this.publish("screenChange");this.L.update()}; SJ.prototype.dispose=SJ.prototype.dispose;g.xE(NR,g.z7);g.M=NR.prototype;g.M.Yj=function(H){this.Iu()||(H&&(ZT(this,""+H),this.publish("sessionFailed")),this.L=null,this.publish("sessionScreen",null))}; g.M.info=function(H){v7(this.PF,H)}; g.M.j_=function(){return null}; g.M.cZ=function(H){var E=this.W;H?(E.displayStatus=new chrome.cast.ReceiverDisplayStatus(H,[]),E.displayStatus.showStop=!0):E.displayStatus=null;chrome.cast.setReceiverDisplayStatus(E,(0,g.co)(function(){this.info("Updated receiver status for "+E.friendlyName+": "+H)},this),(0,g.co)(function(){ZT(this,"Failed to update receiver status for: "+E.friendlyName)},this))}; g.M.G$=function(){this.cZ("");NR.j7.G$.call(this)};g.C(y5,NR);g.M=y5.prototype;g.M.o6=function(H){if(this.G){if(this.G==H)return;ZT(this,"Overriding cast session with new session object");ToJ(this);this.Jm=!1;this.L_="unknown";this.G.removeUpdateListener(this.WF);this.G.removeMessageListener("urn:x-cast:com.google.youtube.mdx",this.E7)}this.G=H;this.G.addUpdateListener(this.WF);this.G.addMessageListener("urn:x-cast:com.google.youtube.mdx",this.E7);vGH(this,"getMdxSessionStatus")}; g.M.IQ=function(H){this.info("launchWithParams no-op for Cast: "+g.Lv(H))}; g.M.stop=function(){this.G?this.G.stop((0,g.co)(function(){this.Yj()},this),(0,g.co)(function(){this.Yj(Error("Failed to stop receiver app."))},this)):this.Yj(Error("Stopping cast device without session."))}; g.M.cZ=function(){}; g.M.G$=function(){this.info("disposeInternal");ToJ(this);this.G&&(this.G.removeUpdateListener(this.WF),this.G.removeMessageListener("urn:x-cast:com.google.youtube.mdx",this.E7));this.G=null;NR.prototype.G$.call(this)}; g.M.tAu=function(H,E){if(!this.Iu())if(E)if(E=hW(E),g.rW(E))switch(H=""+E.type,E=E.data||{},this.info("onYoutubeMessage_: "+H+" "+g.Lv(E)),H){case "mdxSessionStatus":cH3(this,E);break;case "loungeToken":JbK(this,E);break;default:ZT(this,"Unknown youtube message: "+H)}else ZT(this,"Unable to parse message.");else ZT(this,"No data in message.")}; g.M.qr=function(H,E,G,P){g.M9(this.N);this.N=0;OQD(this.D,this.W.label,H,this.W.friendlyName,(0,g.co)(function(Q){Q?E(Q):P>=0?(ZT(this,"Screen "+H+" appears to be offline. "+P+" retries left."),this.N=g.bw((0,g.co)(this.qr,this,H,E,G,P-1),300)):G(Error("Unable to fetch screen."))},this),G)}; g.M.j_=function(){return this.G}; g.M.nx=function(H){this.Iu()||H||(ZT(this,"Cast session died."),this.Yj())};g.C(um,NR);g.M=um.prototype;g.M.o6=function(H){this.G=H;this.G.addUpdateListener(this.O7)}; g.M.IQ=function(H){this.T$=H;this.p_()}; g.M.stop=function(){uWu(this);this.G?this.G.stop((0,g.co)(this.Yj,this,null),(0,g.co)(this.Yj,this,"Failed to stop DIAL device.")):this.Yj()}; g.M.G$=function(){uWu(this);this.G&&this.G.removeUpdateListener(this.O7);this.G=null;NR.prototype.G$.call(this)}; g.M.hf=function(H){this.Iu()||H||(ZT(this,"DIAL session died."),this.T(),this.T=function(){},this.Yj())};g.C(EX,NR);EX.prototype.stop=function(){this.Yj()}; EX.prototype.o6=function(){}; EX.prototype.IQ=function(){g.M9(this.G);this.G=NaN;var H=MR(this.D.RF(),this.W.label);H?sP(this,H):this.Yj(Error("No such screen"))}; EX.prototype.G$=function(){g.M9(this.G);this.G=NaN;NR.prototype.G$.call(this)};g.C(ps,g.z7);g.M=ps.prototype; g.M.init=function(H,E){chrome.cast.timeout.requestSession=3E4;var G=new chrome.cast.SessionRequest(this.N,[chrome.cast.Capability.AUDIO_OUT]);g.Xj("desktop_enable_cast_connect")&&(G.androidReceiverCompatible=!0);this.L_||(G.dialRequest=new chrome.cast.DialRequest("YouTube"));var P=chrome.cast.AutoJoinPolicy.TAB_AND_ORIGIN_SCOPED;H=H||this.C?chrome.cast.DefaultActionPolicy.CAST_THIS_TAB:chrome.cast.DefaultActionPolicy.CREATE_SESSION;var Q=(0,g.co)(this.oWp,this);G=new chrome.cast.ApiConfig(G,(0,g.co)(this.f3, this),Q,P,H);G.customDialLaunchCallback=(0,g.co)(this.Klm,this);chrome.cast.initialize(G,(0,g.co)(function(){this.Iu()||(chrome.cast.addReceiverActionListener(this.T),PwK(),this.W.subscribe("onlineScreenChange",(0,g.co)(this.nE,this)),this.G=spH(this),chrome.cast.setCustomReceivers(this.G,function(){},(0,g.co)(function(e){this.L0("Failed to set initial custom receivers: "+g.Lv(e))},this)),this.publish("yt-remote-cast2-availability-change",AW(this)),E(!0))},this),(0,g.co)(function(e){this.L0("Failed to initialize API: "+ g.Lv(e)); E(!1)},this))}; g.M.f5J=function(H,E){Cs("Setting connected screen ID: "+H+" -> "+E);if(this.L){var G=this.L.L;if(!H||G&&G.id!=H)Cs("Unsetting old screen status: "+this.L.W.friendlyName),rZ(this,null)}if(H&&E){if(!this.L){H=MR(this.W.RF(),H);if(!H){Cs("setConnectedScreenStatus: Unknown screen.");return}if(H.idType=="shortLived"){Cs("setConnectedScreenStatus: Screen with id type to be short lived.");return}G=QpH(this,H);G||(Cs("setConnectedScreenStatus: Connected receiver not custom..."),G=new chrome.cast.Receiver(H.uuid? H.uuid:H.id,H.name),G.receiverType=chrome.cast.ReceiverType.CUSTOM,this.G.push(G),chrome.cast.setCustomReceivers(this.G,function(){},(0,g.co)(function(P){this.L0("Failed to set initial custom receivers: "+g.Lv(P))},this))); Cs("setConnectedScreenStatus: new active receiver: "+G.friendlyName);rZ(this,new EX(this.W,G),!0)}this.L.cZ(E)}else Cs("setConnectedScreenStatus: no screen.")}; g.M.nHJ=function(H){this.Iu()?this.L0("Setting connection data on disposed cast v2"):this.L?this.L.IQ(H):this.L0("Setting connection data without a session")}; g.M.NR=function(){this.Iu()?this.L0("Stopping session on disposed cast v2"):this.L?(this.L.stop(),rZ(this,null)):Cs("Stopping non-existing session")}; g.M.requestSession=function(){chrome.cast.requestSession((0,g.co)(this.f3,this),(0,g.co)(this.V7x,this))}; g.M.G$=function(){this.W.unsubscribe("onlineScreenChange",(0,g.co)(this.nE,this));window.chrome&&chrome.cast&&chrome.cast.removeReceiverActionListener(this.T);var H=Guo,E=g.Un("yt.mdx.remote.debug.handlers_");g.Ih(E||[],H);g.Vq(this.L);g.z7.prototype.G$.call(this)}; g.M.L0=function(H){v7("Controller",H)}; g.M.jC=function(H,E){this.L==H&&(E||rZ(this,null),this.publish("yt-remote-cast2-session-change",E))}; g.M.IO7=function(H,E){if(!this.Iu())if(H)switch(H.friendlyName=chrome.cast.unescape(H.friendlyName),Cs("onReceiverAction_ "+H.label+" / "+H.friendlyName+"-- "+E),E){case chrome.cast.ReceiverAction.CAST:if(this.L)if(this.L.W.label!=H.label)Cs("onReceiverAction_: Stopping active receiver: "+this.L.W.friendlyName),this.L.stop();else{Cs("onReceiverAction_: Casting to active receiver.");this.L.L&&this.publish("yt-remote-cast2-session-change",this.L.L);break}switch(H.receiverType){case chrome.cast.ReceiverType.CUSTOM:rZ(this, new EX(this.W,H));break;case chrome.cast.ReceiverType.DIAL:rZ(this,new um(this.W,H,this.D,this.config_));break;case chrome.cast.ReceiverType.CAST:rZ(this,new y5(this.W,H,this.config_));break;default:this.L0("Unknown receiver type: "+H.receiverType)}break;case chrome.cast.ReceiverAction.STOP:this.L&&this.L.W.label==H.label?this.L.stop():this.L0("Stopping receiver w/o session: "+H.friendlyName)}else this.L0("onReceiverAction_ called without receiver.")}; g.M.Klm=function(H){if(this.Iu())return Promise.reject(Error("disposed"));var E=H.receiver;E.receiverType!=chrome.cast.ReceiverType.DIAL&&(this.L0("Not DIAL receiver: "+E.friendlyName),E.receiverType=chrome.cast.ReceiverType.DIAL);var G=this.L?this.L.W:null;if(!G||G.label!=E.label)return this.L0("Receiving DIAL launch request for non-clicked DIAL receiver: "+E.friendlyName),Promise.reject(Error("illegal DIAL launch"));if(G&&G.label==E.label&&G.receiverType!=chrome.cast.ReceiverType.DIAL){if(this.L.L)return Cs("Reselecting dial screen."), this.publish("yt-remote-cast2-session-change",this.L.L),Promise.resolve(new chrome.cast.DialLaunchResponse(!1));this.L0('Changing CAST intent from "'+G.receiverType+'" to "dial" for '+E.friendlyName);rZ(this,new um(this.W,E,this.D,this.config_))}E=this.L;E.N=H;E.N.appState==chrome.cast.DialAppState.RUNNING?(H=E.N.extraData||{},G=H.screenId||null,ep(E)&&H.loungeToken?H.loungeTokenRefreshIntervalMs?H=TeZ(E,{name:E.W.friendlyName,screenId:H.screenId,loungeToken:H.loungeToken,dialId:E.N.receiver.label, screenIdType:"shortLived"},H.loungeTokenRefreshIntervalMs):(g.OS(Error("No loungeTokenRefreshIntervalMs presents in additionalData: "+JSON.stringify(H)+".")),H=yUZ(E,G)):H=yUZ(E,G)):H=zZ3(E);return H}; g.M.f3=function(H){var E=this;if(!this.Iu()&&!this.C){Cs("New cast session ID: "+H.sessionId);var G=H.receiver;if(G.receiverType!=chrome.cast.ReceiverType.CUSTOM){if(!this.L)if(G.receiverType==chrome.cast.ReceiverType.CAST)Cs("Got resumed cast session before resumed mdx connection."),G.friendlyName=chrome.cast.unescape(G.friendlyName),rZ(this,new y5(this.W,G,this.config_),!0);else{this.L0("Got non-cast session without previous mdx receiver event, or mdx resume.");return}var P=this.L.W,Q=MR(this.W.RF(), P.label);Q&&YU(Q,G.label)&&P.receiverType!=chrome.cast.ReceiverType.CAST&&G.receiverType==chrome.cast.ReceiverType.CAST&&(Cs("onSessionEstablished_: manual to cast session change "+G.friendlyName),g.Vq(this.L),this.L=new y5(this.W,G,this.config_),this.L.subscribe("sessionScreen",(0,g.co)(this.jC,this,this.L)),this.L.subscribe("sessionFailed",function(){return FeK(E,E.L)}),this.L.IQ(null)); this.L.o6(H)}}}; g.M.MR=function(){return this.L?this.L.j_():null}; g.M.V7x=function(H){this.Iu()||(this.L0("Failed to estabilish a session: "+g.Lv(H)),H.code!=chrome.cast.ErrorCode.CANCEL&&rZ(this,null),this.publish("yt-remote-cast2-session-failed"))}; g.M.oWp=function(H){Cs("Receiver availability updated: "+H);if(!this.Iu()){var E=AW(this);this.B=H==chrome.cast.ReceiverAvailability.AVAILABLE;AW(this)!=E&&this.publish("yt-remote-cast2-availability-change",AW(this))}}; g.M.nE=function(){this.Iu()||(this.G=spH(this),Cs("Updating custom receivers: "+g.Lv(this.G)),chrome.cast.setCustomReceivers(this.G,function(){},(0,g.co)(function(){this.L0("Failed to set custom receivers.")},this)),this.publish("yt-remote-cast2-availability-change",AW(this)))}; ps.prototype.setLaunchParams=ps.prototype.nHJ;ps.prototype.setConnectedScreenStatus=ps.prototype.f5J;ps.prototype.stopSession=ps.prototype.NR;ps.prototype.getCastSession=ps.prototype.MR;ps.prototype.requestSession=ps.prototype.requestSession;ps.prototype.init=ps.prototype.init;ps.prototype.dispose=ps.prototype.dispose;var Pcu=g.m$(["https://www.gstatic.com/cv/js/sender/v1/cast_sender.js"]),dBR=[],ZAR=g.Pa(Pcu);g.M=GT.prototype; g.M.reset=function(H){this.listId="";this.index=-1;this.videoId="";Bed(this);this.volume=-1;this.muted=!1;H&&(this.index=H.index,this.listId=H.listId,this.videoId=H.videoId,this.playerState=H.playerState,this.volume=H.volume,this.muted=H.muted,this.audioTrackId=H.audioTrackId,this.trackData=H.trackData,this.vR=H.hasPrevious,this.wU=H.hasNext,this.C=H.playerTime,this.T=H.playerTimeAt,this.W=H.seekableStart,this.B=H.seekableEnd,this.G=H.duration,this.N=H.loadedTime,this.L=H.liveIngestionTime,this.D= !isNaN(this.L))}; g.M.isPlaying=function(){return this.playerState==1}; g.M.isBuffering=function(){return this.playerState==3}; g.M.uB=function(H){this.G=isNaN(H)?0:H}; g.M.getDuration=function(){return this.D?this.G+CM(this):this.G}; g.M.clone=function(){return new GT(lXu(this))};g.C(xR,g.z7);g.M=xR.prototype;g.M.getState=function(){return this.G}; g.M.Cd=function(){return this.D.getReconnectTimeout()}; g.M.K4=function(){this.D.reconnect()}; g.M.play=function(){mC(this)?(this.L?this.L.play(null,g.jB,kX(this,"play")):XU(this,"play"),UNR(this,1,Wl(UG(this))),this.publish("remotePlayerChange")):Qk(this,this.play)}; g.M.pause=function(){mC(this)?(this.L?this.L.pause(null,g.jB,kX(this,"pause")):XU(this,"pause"),UNR(this,2,Wl(UG(this))),this.publish("remotePlayerChange")):Qk(this,this.pause)}; g.M.seekTo=function(H){if(mC(this)){if(this.L){var E=UG(this),G=new chrome.cast.media.SeekRequest;G.currentTime=H;E.isPlaying()||E.isBuffering()?G.resumeState=chrome.cast.media.ResumeState.PLAYBACK_START:G.resumeState=chrome.cast.media.ResumeState.PLAYBACK_PAUSE;this.L.seek(G,g.jB,kX(this,"seekTo",{newTime:H}))}else XU(this,"seekTo",{newTime:H});UNR(this,3,H);this.publish("remotePlayerChange")}else Qk(this,g.iK(this.seekTo,H))}; g.M.stop=function(){if(mC(this)){this.L?this.L.stop(null,g.jB,kX(this,"stopVideo")):XU(this,"stopVideo");var H=UG(this);H.index=-1;H.videoId="";Bed(H);P0(this,H);this.publish("remotePlayerChange")}else Qk(this,this.stop)}; g.M.setVolume=function(H,E){if(mC(this)){var G=UG(this);if(this.W){if(G.volume!=H){var P=Math.round(H)/100;this.W.setReceiverVolumeLevel(P,(0,g.co)(function(){Ig("set receiver volume: "+P)},this),(0,g.co)(function(){this.L0("failed to set receiver volume.")},this))}G.muted!=E&&this.W.setReceiverMuted(E,(0,g.co)(function(){Ig("set receiver muted: "+E)},this),(0,g.co)(function(){this.L0("failed to set receiver muted.")},this))}else{var Q={volume:H, muted:E};G.volume!=-1&&(Q.delta=H-G.volume);XU(this,"setVolume",Q)}G.muted=E;G.volume=H;P0(this,G)}else Qk(this,g.iK(this.setVolume,H,E))}; g.M.hd=function(H,E){if(mC(this)){var G=UG(this);H={videoId:H};E&&(G.trackData={trackName:E.name,languageCode:E.languageCode,sourceLanguageCode:E.translationLanguage?E.translationLanguage.languageCode:"",languageName:E.languageName,kind:E.kind},H.style=g.Lv(E.style),g.S5(H,G.trackData));XU(this,"setSubtitlesTrack",H);P0(this,G)}else Qk(this,g.iK(this.hd,H,E))}; g.M.setAudioTrack=function(H,E){mC(this)?(E=E.getLanguageInfo().getId(),XU(this,"setAudioTrack",{videoId:H,audioTrackId:E}),H=UG(this),H.audioTrackId=E,P0(this,H)):Qk(this,g.iK(this.setAudioTrack,H,E))}; g.M.playVideo=function(H,E,G,P,Q,e,w){P=P===void 0?null:P;Q=Q===void 0?null:Q;e=e===void 0?null:e;w=w===void 0?null:w;var t=UG(this),k={videoId:H};G!==void 0&&(k.currentIndex=G);Q5(t,H,G||0);E!==void 0&&(w5(t,E),k.currentTime=E);P&&(k.listId=P);Q&&(k.playerParams=Q);e&&(k.clickTrackingParams=e);w&&(k.locationInfo=g.Lv(w));XU(this,"setPlaylist",k);P||P0(this,t)}; g.M.wk=function(H,E){if(mC(this)){if(H&&E){var G=UG(this);Q5(G,H,E);P0(this,G)}XU(this,"previous")}else Qk(this,g.iK(this.wk,H,E))}; g.M.nextVideo=function(H,E){if(mC(this)){if(H&&E){var G=UG(this);Q5(G,H,E);P0(this,G)}XU(this,"next")}else Qk(this,g.iK(this.nextVideo,H,E))}; g.M.UE=function(){if(mC(this)){XU(this,"clearPlaylist");var H=UG(this);H.reset();P0(this,H);this.publish("remotePlayerChange")}else Qk(this,this.UE)}; g.M.Ra=function(){mC(this)?XU(this,"dismissAutoplay"):Qk(this,this.Ra)}; g.M.dispose=function(){if(this.G!=3){var H=this.G;this.G=3;this.publish("proxyStateChange",H,this.G)}g.z7.prototype.dispose.call(this)}; g.M.G$=function(){GY$(this);this.D=null;this.T.clear();UP(this,null);g.z7.prototype.G$.call(this)}; g.M.BZ=function(H){if((H!=this.G||H==2)&&this.G!=3&&H!=0){var E=this.G;this.G=H;this.publish("proxyStateChange",E,H);if(H==1)for(;!this.T.isEmpty();)E=H=this.T,E.L.length===0&&(E.L=E.W,E.L.reverse(),E.W=[]),H.L.pop().apply(this);else H==3&&this.dispose()}}; g.M.t7x=function(H,E){this.publish(H,E)}; g.M.Za5=function(H){if(!H)this.Ng(null),UP(this,null);else if(this.W.receiver.volume){H=this.W.receiver.volume;var E=UG(this),G=Math.round(100*H.level||0);if(E.volume!=G||E.muted!=H.muted)Ig("Cast volume update: "+H.level+(H.muted?" muted":"")),E.volume=G,E.muted=!!H.muted,P0(this,E)}}; g.M.Ng=function(H){Ig("Cast media: "+!!H);this.L&&this.L.removeUpdateListener(this.N);if(this.L=H)this.L.addUpdateListener(this.N),vZW(this),this.publish("remotePlayerChange")}; g.M.BtZ=function(H){H?(vZW(this),this.publish("remotePlayerChange")):this.Ng(null)}; g.M.Hq=function(){XU(this,"sendDebugCommand",{debugCommand:"stats4nerds "})}; g.M.vtu=function(){var H=Zto();H&&UP(this,H)}; g.M.L0=function(H){v7("CP",H)};g.C($U,g.z7);g.M=$U.prototype; g.M.connect=function(H,E){if(E){var G=E.listId,P=E.videoId,Q=E.videoIds,e=E.playerParams,w=E.clickTrackingParams,t=E.index,k={videoId:P},W=E.currentTime,I=E.locationInfo;E=E.loopMode;W!==void 0&&(k.currentTime=W<=5?0:W);e&&(k.playerParams=e);I&&(k.locationInfo=I);w&&(k.clickTrackingParams=w);G&&(k.listId=G);Q&&Q.length>0&&(k.videoIds=Q.join(","));t!==void 0&&(k.currentIndex=t);this.O7&&(k.loopMode=E||"LOOP_MODE_OFF");G&&(this.L.listId=G);this.L.videoId=P;this.L.index=t||0;this.L.state=3;w5(this.L, W);this.T="UNSUPPORTED";G=this.O7?"setInitialState":"setPlaylist";Rg("Connecting with "+G+" and params: "+g.Lv(k));this.W.connect({method:G,params:g.Lv(k)},H,o6C())}else Rg("Connecting without params"),this.W.connect({},H,o6C());QMH(this)}; g.M.bT=function(H){this.W.bT(H)}; g.M.dispose=function(){this.Iu()||(g.kM("yt.mdx.remote.remoteClient_",null),this.publish("beforeDispose"),B0(this,3));g.z7.prototype.dispose.call(this)}; g.M.G$=function(){ktH(this);daW(this);WZW(this);g.M9(this.N);this.N=NaN;g.M9(this.L_);this.L_=NaN;this.D=null;g.sz(this.p_);this.p_.length=0;this.W.dispose();g.z7.prototype.G$.call(this);this.T=this.B=this.G=this.L=this.W=null}; g.M.Vl=function(H){if(!this.G||this.G.length===0)return!1;for(var E=g.R(this.G),G=E.next();!G.done;G=E.next())if(!G.value.capabilities.has(H))return!1;return!0}; g.M.pFm=function(){var H=3;this.Iu()||(H=0,isNaN(this.A0())?this.W.hc()&&isNaN(this.C)&&(H=1):H=2);return H}; g.M.Qb=function(H){Rg("Disconnecting with "+H);g.kM("yt.mdx.remote.remoteClient_",null);ktH(this);this.publish("beforeDisconnect",H);H==1&&qe();this.W.disconnect(H);this.dispose()}; g.M.Xq=function(){var H=this.L;this.D&&(H=this.L.clone(),Q5(H,this.D,H.index));return lXu(H)}; g.M.Mxx=function(H){var E=this,G=new GT(H);G.videoId&&G.videoId!=this.L.videoId&&(this.D=G.videoId,g.M9(this.N),this.N=g.bw(function(){if(E.D){var Q=E.D;E.D=null;E.L.videoId!=Q&&YR(E,"getNowPlaying")}},5E3)); var P=[];this.L.listId==G.listId&&this.L.videoId==G.videoId&&this.L.index==G.index||P.push("remoteQueueChange");this.L.playerState==G.playerState&&this.L.volume==G.volume&&this.L.muted==G.muted&&Wl(this.L)==Wl(G)&&g.Lv(this.L.trackData)==g.Lv(G.trackData)||P.push("remotePlayerChange");this.L.reset(H);g.D9(P,function(Q){this.publish(Q)},this)}; g.M.kL=function(){var H=this.W.getDeviceId(),E=g.VS(this.G,function(G){return G.type=="REMOTE_CONTROL"&&G.id!=H}); return E?E.id:""}; g.M.A0=function(){return this.W.Cd()}; g.M.Yg=function(){return this.T||"UNSUPPORTED"}; g.M.BI=function(){return this.B||""}; g.M.Kx=function(){!isNaN(this.A0())&&this.W.K4()}; g.M.Ajw=function(H,E){YR(this,H,E);IJH(this)}; g.M.xe=function(){var H=g.cb("SAPISID","")||g.cb("__Secure-1PAPISID")||"",E=g.cb("__Secure-3PAPISID","")||"";if(!H&&!E)return"";H=g.H4(g.Vc(H),2);E=g.H4(g.Vc(E),2);return g.H4(g.Vc(","+H+","+E),2)}; $U.prototype.subscribe=$U.prototype.subscribe;$U.prototype.unsubscribeByKey=$U.prototype.fm;$U.prototype.getProxyState=$U.prototype.pFm;$U.prototype.disconnect=$U.prototype.Qb;$U.prototype.getPlayerContextData=$U.prototype.Xq;$U.prototype.setPlayerContextData=$U.prototype.Mxx;$U.prototype.getOtherConnectedRemoteId=$U.prototype.kL;$U.prototype.getReconnectTimeout=$U.prototype.A0;$U.prototype.getAutoplayMode=$U.prototype.Yg;$U.prototype.getAutoplayVideoId=$U.prototype.BI;$U.prototype.reconnect=$U.prototype.Kx; $U.prototype.sendMessage=$U.prototype.Ajw;$U.prototype.getXsrfToken=$U.prototype.xe;$U.prototype.isCapabilitySupportedOnConnectedDevices=$U.prototype.Vl;g.C(Z2C,H0);g.M=Z2C.prototype;g.M.RF=function(H){return this.qW.$_gs(H)}; g.M.contains=function(H){return!!this.qW.$_c(H)}; g.M.get=function(H){return this.qW.$_g(H)}; g.M.start=function(){this.qW.$_st()}; g.M.add=function(H,E,G){this.qW.$_a(H,E,G)}; g.M.remove=function(H,E,G){this.qW.$_r(H,E,G)}; g.M.Pj=function(H,E,G,P){this.qW.$_un(H,E,G,P)}; g.M.G$=function(){for(var H=this.L.length,E=0;E1&&!this.S.getOption("remote","quickCast")?(this.Y1=g.yL(H,this.L,this),this.MS(g.wH(H,this.L)),H=this.S.getOption("remote","currentReceiver"),H=this.L(H),this.options[H]&&this.nm(H),this.enable(!0)):this.enable(!1)}; zw.prototype.L=function(H){return H.key}; zw.prototype.RJ=function(H){return H==="cast-selector-receiver"?"Cast...":this.Y1[H].name}; zw.prototype.K0=function(H){g.os.prototype.K0.call(this,H);this.S.setOption("remote","currentReceiver",this.Y1[H]);this.Ru.t7()};g.C(tLK,g.UM);g.M=tLK.prototype; g.M.create=function(){var H=this.player.K(),E=g.nb(H);H={device:"Desktop",app:"youtube-desktop",loadCastApiSetupScript:H.U("mdx_load_cast_api_bootstrap_script"),enableDialLoungeToken:H.U("enable_dial_short_lived_lounge_token"),enableCastLoungeToken:H.U("enable_cast_short_lived_lounge_token")};ztK(E,H);this.subscriptions.push(g.tf("yt-remote-before-disconnect",this.e0u,this));this.subscriptions.push(g.tf("yt-remote-connection-change",this.CG$,this));this.subscriptions.push(g.tf("yt-remote-receiver-availability-change",this.Y0, this));this.subscriptions.push(g.tf("yt-remote-auto-connect",this.zB_,this));this.subscriptions.push(g.tf("yt-remote-receiver-resumed",this.O6J,this));this.subscriptions.push(g.tf("mdx-privacy-popup-confirm",this.VAx,this));this.subscriptions.push(g.tf("mdx-privacy-popup-cancel",this.arJ,this));this.Y0()}; g.M.load=function(){this.player.cancelPlayback();g.UM.prototype.load.call(this);this.pM=new HQC(this.player.K(),this);this.player.JV(this.pM);this.cA=new Yyo(this,this.player,this.KP);var H=(H=svM())?H.currentTime:0;var E=nbK()?new xR(W7(),void 0):null;H==0&&E&&(H=Wl(UG(E)));H!==0&&this.Ix(H);Dau(this,this.jy,this.jy);this.player.UV(6)}; g.M.unload=function(){this.player.publish("mdxautoplaycanceled");this.player.xP();this.DK=this.X2;g.dT(this.cA,this.KP);this.KP=this.pM=this.cA=null;g.UM.prototype.unload.call(this);this.player.UV(5);oB(this)}; g.M.G$=function(){g.$O(this.subscriptions);g.UM.prototype.G$.call(this)}; g.M.uw=function(H){var E=g.c4.apply(1,arguments);this.loaded&&this.cA.EB.apply(this.cA,[H].concat(g.EC(E)))}; g.M.getAdState=function(){return this.Fr}; g.M.vR=function(){return this.KP?UG(this.KP).vR:!1}; g.M.wU=function(){return this.KP?UG(this.KP).wU:!1}; g.M.Ix=function(H,E){this.Wx=H||0;this.player.publish("progresssync",H,E);this.player.GU("onVideoProgress",H||0)}; g.M.getCurrentTime=function(){return this.Wx}; g.M.getDuration=function(){return UG(this.KP).getDuration()||0}; g.M.JT=function(){var H=UG(this.KP);return H.D?H.L+CM(H):H.L}; g.M.dU=function(){return UG(this.KP).N}; g.M.Q0=function(){return aXD(UG(this.KP))}; g.M.P5=function(){var H=UG(this.KP);return H.W>0?H.W+CM(H):H.W}; g.M.getProgressState=function(){var H=UG(this.KP),E=this.player.getVideoData();return{airingStart:0,airingEnd:0,allowSeeking:H.playerState!=1081&&this.player.vK(),clipEnd:E.clipEnd,clipStart:E.clipStart,current:this.getCurrentTime(),displayedStart:-1,duration:this.getDuration(),ingestionTime:this.JT(),isAtLiveHead:this.isAtLiveHead(),loaded:this.dU(),seekableEnd:this.Q0(),seekableStart:this.P5(),offset:0,viewerLivestreamJoinMediaTime:0}}; g.M.isAtLiveHead=function(){return aXD(UG(this.KP))-this.getCurrentTime()<=1}; g.M.nextVideo=function(){this.KP&&this.KP.nextVideo()}; g.M.wk=function(){this.KP&&this.KP.wk()}; g.M.e0u=function(H){H===1&&(this.o0=this.KP?UG(this.KP):null)}; g.M.CG$=function(){var H=nbK()?new xR(W7(),void 0):null;if(H){var E=this.DK;this.loaded&&this.unload();this.KP=H;this.o0=null;E.key!==this.X2.key&&(this.DK=E,this.load())}else g.Vq(this.KP),this.KP=null,this.loaded&&(this.unload(),(H=this.o0)&&H.videoId===this.player.getVideoData().videoId&&this.player.cueVideoById(H.videoId,Wl(H)));this.player.publish("videodatachange","newdata",this.player.getVideoData(),3)}; g.M.Y0=function(){var H=[this.X2],E=H.concat,G=EbM();KM()&&g.pr("yt-remote-cast-available")&&G.push({key:"cast-selector-receiver",name:"Cast..."});this.Y1=E.call(H,G);H=YpC()||this.X2;sX(this,H);this.player.GU("onMdxReceiversChange")}; g.M.zB_=function(){var H=YpC();sX(this,H)}; g.M.O6J=function(){this.DK=YpC()}; g.M.VAx=function(){this.QK=!0;oB(this);wZ=!1;hn&&ur(hn,1);hn=null}; g.M.arJ=function(){this.QK=!1;oB(this);sX(this,this.X2);this.DK=this.X2;wZ=!1;hn=null;this.player.playVideo()}; g.M.Mf=function(H,E){switch(H){case "casting":return this.loaded;case "receivers":return this.Y1;case "currentReceiver":return E&&(E.key==="cast-selector-receiver"?DBo():sX(this,E)),this.loaded?this.DK:this.X2;case "quickCast":return this.Y1.length===2&&this.Y1[1].key==="cast-selector-receiver"?(E&&DBo(),!0):!1}}; g.M.Hq=function(){this.KP.Hq()}; g.M.Eh=function(){return!1}; g.M.getOptions=function(){return["casting","receivers","currentReceiver","quickCast"]}; g.M.isLoggedIn=function(){var H,E;return((H=g.tJ("PLAYER_CONFIG"))==null?void 0:(E=H.args)==null?void 0:E.authuser)!==void 0?!0:!(!g.tJ("SESSION_INDEX")&&!g.tJ("LOGGED_IN"))};g.IK("remote",tLK);})(_yt_player);