(function(g){var window=this;'use strict';var F4c=function(n){n.N=0;n.fD=-1;if(n.cj)if(n.T.length==0&&n.X.length==0)n.cj.H$();else{var Z=g.rU(n.T),F=g.rU(n.X);n.T.length=0;n.X.length=0;n.cj.H$(Z,F)}},yfh=function(n){n.player.getPlayerStateObject().isPlaying()?n.player.pauseVideo():(n.RL=function(Z){!n.xa&&g.On(Z,8)&&(n.player.pauseVideo(),Mf(n))},n.player.addEventListener("presentingplayerstatechange",n.RL)); n.HK&&n.HK.KJ();$_()||(nA=!0)},soc=function(n){if(n.SG)return g.Bp(); if(!n.Bx)return l3m(n);n.zx===null&&(n.zx=l3m(n));return n.zx},mhG=function(n){g.l0(n.C); n.C=NaN},a3G=function(n,Z){return n===Z},DhO=function(n,Z,F){if(g.W6(n))g.I5(n,Z,F); else for(n=K4g(n);;){var y=n.next();if(y.done)break;Z.call(F,y.value,void 0,n)}},pU7=function(){},L4x=function(n){try{return g.KQ.JSON.parse(n)}catch(Z){}n=String(n); if(/^\s*$/.test(n)?0:/^[\],:{}\s\u2028\u2029]*$/.test(n.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("("+n+")")}catch(Z){}throw Error("Invalid JSON string: "+n);},$_=function(){return g.Di("yt.mdx.remote.connection_")},ZG=function(n,Z,F){n.V.sendMessage(Z,F)},qNx=function(n,Z){n.experiments.clear(); Z.split(",").forEach(function(F){n.experiments.add(F)})},wUd=function(){var n=FT(); this.N=n;n.kR("/client_streamz/youtube/living_room/mdx/channel/message_received",g.l8("channel_type"))},y0=function(n,Z,F){return(0,g.GP)(function(y){this.QG("Failed to "+Z+" with cast v2 channel. Error code: "+y.code); y.code!=chrome.cast.ErrorCode.TIMEOUT&&(this.QG("Retrying "+Z+" using MDx browser channel."),ZG(this,Z,F))},n)},lo=function(n,Z){return!!Z&&(n.id==Z||n.uuid==Z)},TwG=function(n,Z){if(Z){var F=n.W.getOption("captions","tracklist",{dC:1}); F&&F.length?(n.W.setOption("captions","track",Z),n.S=!1):(n.W.loadModule("captions"),n.S=!0)}else n.W.setOption("captions","track",{})},sz=function(n,Z){g.I.call(this); this.N=new g.e7(this.H6R,0,this);g.S(this,this.N);this.Gj=5E3;this.Sw=0;if(typeof n==="function")Z&&(n=(0,g.GP)(n,Z));else if(n&&typeof n.handleEvent==="function")n=(0,g.GP)(n.handleEvent,n);else throw Error("Invalid listener argument");this.X=n},onU=function(n){g.l0(n.C); n.C=0;g.l0(n.J);n.J=0;n.S();n.S=function(){}; g.l0(n.Pr)},PJd=function(n,Z,F){var y=document.createElement("script"); y.onerror=Z;F&&(y.onload=F);g.NJ(y,g.x6(n));(document.head||document.documentElement).appendChild(y)},Jfc=function(){var n=FT(); this.N=n;n.kR("/client_streamz/youtube/living_room/mdx/channel/success")},mP=function(n){Qod(n); g.xA(n.Bq);n.Bq=null;n.S.stop();n.T.removeAll();if(n.Nc){var Z=n.Nc;n.Nc=null;Z.abort();Z.dispose()}n.jD&&(n.jD=null)},YNx=function(){g.Oh("yt-remote-lounge-token-expiration",!0,86400)},Qod=function(n){n.ND&&(g.KQ.clearTimeout(n.ND),n.ND=null)},SNO=function(n){if(n.length==0)return[]; var Z=n[0].indexOf("#"),F=Z==-1?n[0]:n[0].substring(0,Z);return g.Yn(n,function(y,l){return l==0?y:y.substring(F.length)})},jog=function(n){return Array.isArray(n)?"["+g.Yn(n,aE).join(",")+"]":"null"},DG=function(n){KA("remote",n)},Uh7=function(n){return!!document.currentScript&&(document.currentScript.src.indexOf("?"+n)!=-1||document.currentScript.src.indexOf("&"+n)!=-1)},Enm=function(n,Z){var F=parseInt(Z.params.currentTime||Z.params.current_time,10); pA(n.N,isNaN(F)?0:F);F=parseInt(Z.params.state,10);F=isNaN(F)?-1:F;F==-1&&n.N.playerState==-1E3&&(F=-1E3);n.N.playerState=F;F=Number(Z.params.loadedTime);n.N.loadedTime=isNaN(F)?0:F;n.N.EW(Number(Z.params.duration));F=n.N;var y=Number(Z.params.liveIngestionTime);F.N=y;F.V=isNaN(y)?!1:!0;F=n.N;y=Number(Z.params.seekableStartTime);Z=Number(Z.params.seekableEndTime);F.X=isNaN(y)?0:y;F.J=isNaN(Z)?0:Z;n.N.playerState==1?Nw7(n):hMG(n);n.publish("remotePlayerChange")},cfv=function(n,Z,F){n.r5=1; n.L=LA(Z.clone());n.Pr=F;n.zx=!0;OWh(n,null)},Vsv=function(){g.KG.call(this,"o")},I3U=function(n){return vnd(n.N).map(function(Z){var F=n.X; Z=Z.map;"__data__"in Z?(Z=Z.__data__,F=F.V?L4x(Z):Z):F=Z;return F})},f3G=function(n,Z){return g.YW(n,function(F){return F||Z?!F!=!Z?!1:F.id==Z.id:!0})},wO=function(n){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 qy;this.model=this.brand="";this.year=0;this.chipset=this.osVersion=this.os="";this.mdxDialServerType="MDX_DIAL_SERVER_TYPE_UNKNOWN";n&&(this.id=n.id||n.name,this.name=n.name,this.clientName=n.clientName?n.clientName.toUpperCase():"UNKNOWN_INTERFACE", this.app=n.app,this.type=n.type||"REMOTE_CONTROL",this.username=n.user||"",this.avatar=n.userAvatarUri||"",this.obfuscatedGaiaId=n.obfuscatedGaiaId||"",this.ownerObfuscatedGaiaId=n.ownerObfuscatedGaiaId||"",this.theme=n.theme||"u",Af1(this,n.capabilities||""),W4h(this,n.compatibleSenderThemes||""),qNx(this,n.experiments||""),this.brand=n.brand||"",this.model=n.model||"",this.year=n.year||0,this.os=n.os||"",this.osVersion=n.osVersion||"",this.chipset=n.chipset||"",this.mdxDialServerType=n.mdxDialServerType|| "MDX_DIAL_SERVER_TYPE_UNKNOWN",n=n.deviceInfo)&&(n=JSON.parse(n),this.brand=n.brand||"",this.model=n.model||"",this.year=n.year||0,this.os=n.os||"",this.osVersion=n.osVersion||"",this.chipset=n.chipset||"",this.clientName=n.clientName?n.clientName.toUpperCase():"UNKNOWN_INTERFACE",this.mdxDialServerType=n.mdxDialServerType||"MDX_DIAL_SERVER_TYPE_UNKNOWN")},TC=function(n,Z){g.$v[n]=!0; var F=g.QF();F&&F.publish.apply(F,arguments);g.$v[n]=!1},RMc=function(){if(rfO){var n=2,Z=xhc(),F=function(){n--; n==0&&Z&&Z(!0)}; window.__onGCastApiAvailable=F;PJd("//www.gstatic.com/cast/sdk/libs/sender/1.0/cast_framework.js",Gjz,F)}},gnx=function(n){g.KG.call(this,"statevent",n)},CJg=function(n,Z){var F=(Date.now()-iW1)/1E3; F.toFixed&&(F=F.toFixed(3));var y=[];y.push("[",F+"s","] ");y.push("[","yt.mdx.remote","] ");y.push(n+": "+Z,"\n");return y.join("")},bWx=function(n){var Z=$_(); oE(null);n||uuc("");g.pv("yt.mdx.remote.connection_",n);Pv&&(g.I5(Pv,function(F){F(n)}),Pv.length=0); Z&&!n?TC("yt-remote-connection-change",!1):!Z&&n&&TC("yt-remote-connection-change",!0)},Gjz=function(){var n=xhc(); n&&n(!1,"No cast extension found")},Jt=function(n){KA("Controller",n)},tsd=function(n,Z){if(Z)if(n.wd>6){n.X=n.T.concat(n.X); n.T.length=0;var F=n.TG-1;Z=XU1(n)}else F=Z.J,Z=Z.It;else F=n.TG++,Z=XU1(n);var y=n.Q5.clone();g.JJ(y,"SID",n.V);g.JJ(y,"RID",F);g.JJ(y,"AID",n.E5);Q0(n,y);F=new Y_(n,n.V,F,n.TJ+1);F.TK=n.oz;F.setTimeout(1E4+Math.round(1E4*Math.random()));n.N2=F;zMm(F,y,Z)},kjd=function(){if(!S2){var n=g.eX(); n&&(S2=new g.Ln(n))}},j2=function(){},eMU=function(n,Z){this.N=n; this.map=Z;this.context=null},dhx=function(n){Uz("Channel opened"); n.Wr&&(n.Wr=!1,HWh(n),n.w5=g.A3(function(){Uz("Timing out waiting for a screen.");n.hc(1)},15E3))},Msv=function(){return Bwv=Bwv||new g.xu},Z5v=function(n,Z){if($Xz(n.X)>=n.X.V-(n.C?1:0))return!1; if(n.C)return n.T=Z.Tx.concat(n.T),!0;if(n.JB==1||n.JB==2||n.w5>=(n.VG?0:n.GU))return!1;n.C=Ny((0,g.GP)(n.KG,n,Z),nLg(n,n.w5));n.w5++;return!0},$Xz=function(n){return n.X?1:n.N?n.N.size:0},Uz=function(n){KA("conn",n)},ht=function(n,Z){n.lY&&g.l7(n.lY,function(F,y){g.JJ(Z,y,F)}); n.S&&g.l7({},function(F,y){g.JJ(Z,y,F)})},FU7=function(n,Z){for(var F=n.screens.length,y=0;y=3)return!1; n.kV++;n.L=Ny((0,g.GP)(n.a4,n),nLg(n,n.Tx));n.Tx++;return!0},cv=function(){var n=g.OZ(); if(!n)return null;var Z=Ez();if(!Z)return null;Z=Z.M2();return Oz(Z,n)},mXc=function(n,Z){this.action=n; this.params=Z||{}},aNx=function(n){n.Wr!=null&&(g.KQ.clearTimeout(n.Wr),n.Wr=null)},KUv=function(n,Z){return Z?g.YW(n.T,function(F){return lo(Z,F.label)},n):null},DXm=function(n){n.S=n.V.YG(n.Wr,n.X.label,n.X.friendlyName,V0(n),function(Z,F){n.S=function(){}; n.Tx=!0;vv(n,Z);Z.idType=="shortLived"&&F>0&&IE(n,F)},function(Z){n.S=function(){}; n.ev(Z)})},pQ7=function(n,Z){if(fA(n)&&!n.S){var F=null; Z&&(F={style:n.W.getSubtitlesUserSettings()},Object.assign(F,Z));n.xV.mW(n.W.getVideoData(1).videoId,F);n.V=At(n.xV).trackData}},qRU=function(n,Z){LUU(n,Z).forEach(function(F){g.aV.prototype.remove.call(this,F)},n)},Oz=function(n,Z){return g.YW(n,function(F){return lo(F,Z)})},Td7=function(n){if(!wQU(n))return g.LO(n.N); var Z=g.aK(n.N);if(Z==="")return"";var F="",y=Z.length,l=g.Ya(n.N)==4;if(!n.X.T){if(typeof TextDecoder==="undefined")return Wv(n),rO(n),"";n.X.T=new g.KQ.TextDecoder}for(var m=0;m0&&(n[0].nextHopProtocol=="hq"||n[0].nextHopProtocol=="h2")):n=!!(g.KQ.chrome&&g.KQ.chrome.loadTimes&&g.KQ.chrome.loadTimes()&&g.KQ.chrome.loadTimes().wasFetchedViaSpdy);this.V=n?this.S:1;this.N=null;this.V>1&&(this.N=new Set);this.X=null;this.T=[]},GC=function(n,Z){KA(n.zx,Z)},Nd1=function(n){return Array.isArray(n)?g.Yn(n,UXx):[]},hT1=function(){var n=FT(); this.N=n;n.kR("/client_streamz/youtube/living_room/mdx/browser_channel/pending_maps")},ELI=function(n,Z){n.J=Z.params.videoId||null; n.publish("autoplayUpNext",n.J)},cwx=function(n){O5h.call(this); n.__headers__&&(this.headers=n.__headers__,this.statusCode=n.__status__,delete n.__headers__,delete n.__status__);var Z=n.__sm__;Z?this.data=(this.N=g.ep(Z))?g.aM(Z,this.N):Z:this.data=n},VtG=function(n){n.S=g.z5("yt-remote-device-id-map")||{}},CA=function(n,Z,F,y){y=y===void 0?!1:y; g.Xu.call(this);var l=this;this.C=NaN;this.Wr=!1;this.Pr=this.L=this.Tx=this.w5=NaN;this.Ns=[];this.S=this.J=this.V=this.N=this.X=null;this.jT=n;this.lY=y;this.Ns.push(g.my(window,"beforeunload",function(){l.hc(2)})); this.T=[];this.N=new RE;this.r5=Z.id;this.zx=Z.idType;this.X=vL1(this.jT,F,this.PN,this.zx=="shortLived",this.r5);this.X.listen("channelOpened",function(){dhx(l)}); this.X.listen("channelClosed",function(){Uz("Channel closed");isNaN(l.C)?gO(!0):gO();l.dispose()}); this.X.listen("channelError",function(m){gO();isNaN(l.Fs())?(m==1&&l.zx=="shortLived"&&l.publish("browserChannelAuthError",m),Uz("Channel error: "+m+" without reconnection"),l.dispose()):(l.Wr=!0,Uz("Channel error: "+m+" with reconnection in "+l.Fs()+" ms"),io(l,2))}); this.X.listen("channelMessage",function(m){IN1(l,m)}); this.X.hL(Z.token);this.subscribe("remoteQueueChange",function(){var m=l.N.videoId;g.OZ()&&g.Oh("yt-remote-session-video-id",m)})},W4h=function(n,Z){n.compatibleSenderThemes.clear(); g.I$(Z.split(","),g.je(fNm,Awh)).forEach(function(F){n.compatibleSenderThemes.add(F)})},WUx=function(n){g.l0(n.L); n.L=0;g.l0(n.C);n.C=0;g.l0(n.Ns);n.Ns=0;g.l0(n.S);n.S=0;g.l0(n.J);n.J=0},uo=function(){return!!g.Di("yt.mdx.remote.cloudview.apiReady_")},bo=function(n){n.N&&(aNx(n),n.N.cancel(),n.N=null)},rwv=function(n,Z){if(n.ND!=null)throw Error("WatchDog timer not null"); n.ND=XT((0,g.GP)(n.q7,n),Z)},xXv=function(n){n.Ns&&(g.KQ.clearTimeout(n.Ns),n.Ns=null)},Af1=function(n,Z){n.capabilities.clear(); g.I$(Z.split(","),g.je(fNm,Gid)).forEach(function(F){n.capabilities.add(F)})},RTI=function(n){n.aS=Date.now()+n.X; rwv(n,n.X)},Mf=function(n){n.RL&&(n.player.removeEventListener("presentingplayerstatechange",n.RL),n.RL=null)},nLg=function(n,Z){var F=n.RX+Math.floor(Math.random()*n.HE); n.isActive()||(F*=2);return F*Z},zC=function(n){if(g.KQ.JSON)try{return g.KQ.JSON.parse(n)}catch(Z){}return L4x(n)},XU1=function(n){var Z=Math.min(n.X.length,1E3),F=["count="+Z]; if(n.wd>6&&Z>0){var y=n.X[0].N;F.push("ofs="+y)}else y=0;for(var l={},m=0;m0||!(y==1&&Z5v(n,Z)||y==2&&s3h(n)))switch(F&&F.length>0&&(Z=n.X,Z.T=Z.T.concat(F)),l){case 1:lN(n,5);break;case 4:lN(n,10);break;case 3:lN(n,6);break;default:lN(n,2)}}},nuz=function(n){n.length>5&&(n=n.slice(n.length-5)); var Z=g.Yn($5U(),function(y){return y.loungeToken}),F=g.Yn(n,function(y){return y.loungeToken}); g.s6(F,function(y){return!g.zi(Z,y)})&&YNx(); g.Oh("yt-remote-local-screens",n,31536E3)},ydc=function(){var n=Z67(); !n&&sW()&&FDc()&&(n={key:"cast-selector-receiver",name:FDc()});return n},lIc=function(n,Z){var F=n.get(Z.uuid)||n.get(Z.id); if(F)return n=F.name,F.id=Z.id||F.id,F.name=Z.name,F.token=Z.token,F.uuid=Z.uuid||F.uuid,F.name!=n;n.screens.push(Z);return!0},srm=function(){this.T=null; this.N="";this.X=!1},m57=function(n,Z,F,y){var l=new g.fW(null); n&&g.Af(l,n);Z&&g.WU(l,Z);F&&g.rw(l,F);y&&(l.X=y);return l},ttG=function(n){n.YY(1,0); n.Q5=mw(n,null,n.GC);aIx(n)},KDz=function(){},Nw7=function(n){hMG(n); n.Tx=g.A3(function(){am(n,"getNowPlaying")},2E4)},pMO=function(n,Z){Z.params=Z.params||{}; D5h(n,Z,"NOW_PLAYING_MAY_CHANGE");Enm(n,Z);n.publish("autoplayDismissed")},Tog=function(n,Z){return n.PV?!0:n.Yi?Object.values(LDx).includes(Z):n.mJ?!Object.values(qjI).includes(Z):n.IW?Object.values(wM1).includes(Z):!1},oum=function(n){var Z=(Kx+1)%50; Kx=Z;Dy[Z]=n;px||(px=Z==49)},H5O=function(n,Z){n.X&&n.X==Z?n.X=null:n.N&&n.N.has(Z)&&n.N.delete(Z)},QrI=function(n,Z){var F=n.A6,y=Z.indexOf("\n",F); if(y==-1)return PYh;F=Number(Z.substring(F,y));if(isNaN(F))return Jdc;y+=1;if(y+F>Z.length)return PYh;Z=Z.slice(y,y+F);n.A6=y+F;return Z},Yjx=function(n){Lx("setApiReady_ "+n); g.pv("yt.mdx.remote.cloudview.apiReady_",n)},Sjh=function(n,Z){try{n.N.Hs(n,Z),n.N.jC(4)}catch(F){}},tt=function(n,Z){return Object.prototype.hasOwnProperty.call(n,Z)},qx=function(){return g.Di("yt.mdx.remote.currentScreenId_")},jrm=function(n){var Z=n.w5(); Z?n.V["x-youtube-lounge-xsrf-token"]=Z:delete n.V["x-youtube-lounge-xsrf-token"]},U5x=function(){kjd(); return S2?!!S2.get("yt-remote-use-staging-server"):!1},wH=function(n){KA("cloudview",n)},Z67=function(){var n=Nov(),Z=TT(); Z||(Z=cv());return g.YW(n,function(F){return Z&&lo(Z,F.key)?!0:!1})},om=function(n){n.length?PJd(n.shift(),function(){om(n)}):Gjz()},hoc=function(){var n=FT(); this.N=n;n.kR("/client_streamz/youtube/living_room/mdx/channel/closed",g.l8("channel_type"))},Euh=function(n){if(n.Mb||n.SP||n.XG>=3)return!1; n.J++;n.SP=XT((0,g.GP)(n.LG,n),ukI(n,n.XG));n.XG++;return!0},O6O=function(n,Z){Pj().init(n,Z)},cdO=function(n){DG("remote.onCastSessionChange_: "+aE(n)); if(n){var Z=TT();if(Z&&Z.id==n.id){if(Jj(Z.id,"YouTube TV"),n.idType=="shortLived"&&(n=n.token))Q$&&(Q$.token=n),(Z=$_())&&Z.hL(n)}else Z&&YJ(),S6(n,1)}else $_()&&YJ()},vud=function(){RMc(); var n=VA1();n.push("//www.gstatic.com/eureka/clank/cast_sender.js");om(n)},Bdh=function(n){n.N||n.L||(n.kV=1,g.MC(n.a4,n),n.Tx=0)},IIc=function(n){var Z=n.X.AI(),F=n.N&&n.N.X; n=g.Yn(Z,function(y){F&&lo(y,F.label)&&(F=null);var l=y.uuid?y.uuid:y.id,m=KUv(this,y);m?(m.label=l,m.friendlyName=y.name):(m=new chrome.cast.Receiver(l,y.name),m.receiverType=chrome.cast.ReceiverType.CUSTOM);return m},n); F&&(F.receiverType!=chrome.cast.ReceiverType.CUSTOM&&(F=new chrome.cast.Receiver(F.label,F.friendlyName),F.receiverType=chrome.cast.ReceiverType.CUSTOM),n.push(F));return n},fIh=function(n){if(n.X!=null)return n.T.concat(n.X.Tx); if(n.N!=null&&n.N.size!==0){var Z=n.T;n=g.Y(n.N.values());for(var F=n.next();!F.done;F=n.next())Z=Z.concat(F.value.Tx);return Z}return g.rU(n.T)},Adh=function(n){n.screens=n.X.M2(); var Z=n.S,F={},y;for(y in Z)F[Z[y]]=y;Z=n.screens.length;for(y=0;y0&&(n.Bq=new g.D9((0,g.GP)(n.pG,n,n.Nc),n.Jt));n.T.listen(n.Nc,"readystatechange",n.Ax);Z=n.TK?g.nO(n.TK):{};n.It?(n.dQ="POST",Z["Content-Type"]="application/x-www-form-urlencoded",n.Nc.send(n.DQ,n.dQ,n.It,Z)):(n.dQ="GET",n.SQ&&!g.Gc&&(Z.Connection="close"),n.Nc.send(n.DQ,n.dQ,null,Z));n.N.jC(1)},Ro1=function(n){return g.Yn(n,function(Z){return{key:Z.id, name:Z.name}})},UXx=function(n){return new Nx(n)},uah=function(n,Z){guv(!0); i6I(!1);O6O(n,function(F){F?(Yjx(!0),g.SH("yt-remote-cast2-api-ready")):(wH("Failed to initialize cast API."),guv(!1),g.Yc("yt-remote-cast-available"),g.Yc("yt-remote-cast-receiver"),CYg());Z(F)})},LA=function(n){g.JJ(n,"zx",Math.floor(Math.random()*2147483648).toString(36)+Math.abs(Math.floor(Math.random()*2147483648)^g.O7()).toString(36)); return n},b6x=function(n,Z){g.xu.call(this); var F=this;this.handler=n();this.handler.subscribe("handlerOpened",this.m_,this);this.handler.subscribe("handlerClosed",this.onClosed,this);this.handler.subscribe("handlerError",function(y,l){F.onError(l)}); this.handler.subscribe("handlerMessage",this.onMessage,this);this.N=Z},hj=function(n,Z){if(Z.key!==n.H4.key)if(Z.key===n.kN.key)YJ(); else if(XMg(n)&&yfh(n),n.H4=Z,!g.Fu(n.player.B())){var F=n.player.getPlaylistId();var y=n.player.getVideoData(1);var l=y.videoId;if(!F&&!l||(n.player.getAppState()===2||n.player.getAppState()===1)&&n.player.B().j("should_clear_video_data_on_player_cued_unstarted"))y=null;else{var m=n.player.getPlaylist();if(m){var a=[];for(var D=0;D1){if(F%2)throw Error("Uneven number of arguments");for(var y=0;y0&&n.V=n.V:!1},iRx=function(n,Z){try{var F=n.T; if(F.JB!=0&&(F.N==n||eTI(F.X,n)))if(!n.aY&&eTI(F.X,n)&&F.JB==3){try{var y=F.oX.N.parse(Z)}catch(h){y=null}if(Array.isArray(y)&&y.length==3){var l=y;if(l[0]==0)a:{if(!F.L){if(F.N)if(F.N.w5+3E30&&(F.xi=1.5*p);y=F;var L=n.Al();if(L){var q=g.QS(L,"X-Client-Wire-Protocol");if(q){var w=y.X;!w.N&&(g.oo(q,"spdy")||g.oo(q,"quic")||g.oo(q,"h2"))&&(w.V=w.S,w.N=new Set,w.X&&(zT7(w,w.X),w.X=null))}if(y.zx){var T=g.QS(L,"X-HTTP-Session-Id");T&&(y.KF=T,g.JJ(y.jT,y.zx,T))}}F.JB=3;F.S&&F.S.GT();F.h2&&(F.N1=Date.now()-n.w5);y=F;var P=n;y.cV=gVI(y,y.aY?y.Bx:null,y.Hx); if(P.aY){H5O(y.X,P);var J=P,U=y.xi;U&&J.setTimeout(U);J.Ns&&(xXv(J),bN(J));y.N=P}else Bdh(y);F.T.length>0&&y$(F)}else m[0]!="stop"&&m[0]!="close"||lN(F,7);else F.JB==3&&(m[0]=="stop"||m[0]=="close"?m[0]=="stop"?lN(F,7):F.disconnect():m[0]!="noop"&&F.S&&F.S.yK(m),F.Tx=0)}XA(4)}catch(h){}},CRg=function(n){this.N=n; this.X=new Im},zT=function(n){this.scheme="https"; this.port=this.domain="";this.N="/api/lounge";this.X=!0;n=n||document.location.href;var Z=Number(g.Gj(n)[4]||null)||"";Z&&(this.port=":"+Z);this.domain=g.g1(n)||"";n=g.PT();n.search("MSIE")>=0&&(n=n.match(/MSIE ([\d.]+)/)[1],g.Yt(n,"10.0")<0&&(this.X=!1))},$5U=function(){return g.z5("yt-remote-local-screens")||[]},uuc=function(n){g.pv("yt.mdx.remote.currentScreenId_",n)},zoh=function(n){if(n.mJ){if(n.mJ.locationOverrideToken)return{locationOverrideToken:n.mJ.locationOverrideToken}; if(n.mJ.latitudeE7!=null&&n.mJ.longitudeE7!=null)return{latitudeE7:n.mJ.latitudeE7,longitudeE7:n.mJ.longitudeE7}}return null},uHd=function(n){g.I5(n.C,function(Z){this.V.unsubscribeByKey(Z)},n); n.C.length=0},HRU=function(n,Z,F,y){y.disableCastApi?Lx("Cannot initialize because disabled by Mdx config."):bRG()?Xyh(Z,y)&&(i6I(!0),window.chrome&&chrome.cast&&chrome.cast.isAvailable?uah(n,F):(window.__onGCastApiAvailable=function(l,m){l?uah(n,F):(wH("Failed to load cast API: "+m),guv(!1),i6I(!1),g.Yc("yt-remote-cast-available"),g.Yc("yt-remote-cast-receiver"),CYg(),F(!1))},y.loadCastApiSetupScript?g.l$(zNc):window.navigator.userAgent.indexOf("Android")>=0&&window.navigator.userAgent.indexOf("Chrome/")>= 0&&window.navigator.presentation?PM7()>=60&&vud():!window.chrome||!window.navigator.presentation||window.navigator.userAgent.indexOf("Edge")>=0?Gjz():PM7()>=89?tym():(RMc(),om(kuO.map(eNh))))):Lx("Cannot initialize because not running Chrome")},zMm=function(n,Z,F){n.q5=1; n.QI=LA(Z.clone());n.It=F;n.zx=!0;GPd(n,null)},iN=function(){var n=g.z5("yt-remote-connected-devices")||[]; g.bF(n);return n},d6U=function(n,Z,F,y,l){g.Xu.call(this); this.T=n;this.J=Z;this.V=F;this.C=y;this.S=l;this.X=0;this.N=null;this.Gu=NaN},UW=function(n,Z,F){Array.isArray(F)||(F=[String(F)]); g.P57(n.V,Z,F)},B1m=function(n){return g.YW(n.T,function(Z){return Z.type=="LOUNGE_SCREEN"})},gH=function(n,Z,F,y){this.T=n; this.V=Z;this.Bx=F;this.kV=y||1;this.Yi=new g.D4(this);this.hG=45E3;this.jT=null;this.C=!1;this.Pr=this.yg=this.L=this.r5=this.w5=this.d5=this.Ns=null;this.Tx=[];this.N=null;this.J=0;this.S=this.Wr=null;this.mJ=-1;this.lY=!1;this.xi=0;this.fR=null;this.SG=this.aY=this.IW=this.zx=!1;this.X=new srm},tj=function(n,Z,F){g.I.call(this); this.C=F!=null?(0,g.GP)(n,F):n;this.Gj=Z;this.S=(0,g.GP)(this.R3,this);this.N=!1;this.X=0;this.T=this.Gu=null;this.V=[]},e6=function(n,Z){g.xu.call(this); this.N=new MyO(Z);this.S=n;this.X=Z&&Z.axg||null;n=Z&&Z.J28||null;Z&&Z.xMT&&(n?n["X-Client-Protocol"]="webchannel":n={"X-Client-Protocol":"webchannel"});this.N.Pr=n;n=Z&&Z.v8r||null;Z&&Z.Fq&&(n?n["X-WebChannel-Content-Type"]=Z.Fq:n={"X-WebChannel-Content-Type":Z.Fq});Z&&Z.Z2&&(n?n["X-WebChannel-Client-Profile"]=Z.Z2:n={"X-WebChannel-Client-Profile":Z.Z2});this.N.IW=n;(n=Z&&Z.xOG)&&!g.$q(n)&&(this.N.J=n);this.C=Z&&Z.xhx||!1;this.V=Z&&Z.xQ8||!1;(Z=Z&&Z.a4g)&&!g.$q(Z)&&(this.N.zx=Z,g.I4(this.X,Z)&&(n= this.X,Z in n&&delete n[Z]));this.T=new kJ(this)},Im=function(){},nx=function(n,Z,F){g.Xu.call(this); this.zx=F;this.V=n;this.X=Z;this.N=null},Hj=function(n,Z){n.X&&(n.X.removeUpdateListener(n.Pr),n.X.removeMediaListener(n.J),n.jw(null)); n.X=Z;n.X&&(dO("Setting cast session: "+n.X.sessionId),n.X.addUpdateListener(n.Pr),n.X.addMediaListener(n.J),n.X.media.length&&n.jw(n.X.media[0]))},tym=function(){RMc(); var n=VA1();n.push.apply(n,g.t(kuO.map(eNh)));n.push("//www.gstatic.com/eureka/clank/cast_sender.js");om(n)},n6I=function(n,Z){g.Xu.call(this); this.C=Z;Z=(Z=g.z5("yt-remote-online-screen-ids")||"")?Z.split(","):[];for(var F={},y=this.C(),l=y.length,m=0;m1){var F=n-1;Z.push("//www.gstatic.com/eureka/clank/"+n+"/cast_sender.js");Z.push("//www.gstatic.com/eureka/clank/"+F+"/cast_sender.js")}return Z},dXd=function(n,Z,F,y){g.KG.call(this,"timingevent",n); this.size=Z;this.rtt=F;this.retries=y},bRG=function(){var n=g.PT().search(/ (CrMo|Chrome|CriOS)\//)>=0; return g.z$||n},mJc=function(n){var Z=0,F; for(F in n)Z++;return Z},a2m=function(n,Z){var F=Z.params.muted=="true"; n.N.volume=parseInt(Z.params.volume,10);n.N.muted=F;n.publish("remotePlayerChange")},LxG=function(n,Z,F){var y=this; F=F===void 0?function(){return""}:F; var l=l===void 0?new KDz:l;var m=m===void 0?new g.aR:m;this.pathPrefix=n;this.N=Z;this.w5=F;this.S=m;this.L=null;this.Pr=this.J=0;this.channel=null;this.C=0;this.T=new sz(function(){y.T.isActive();var a;((a=y.channel)==null?void 0:$Xz((new Kxh(a,a.N)).N.X))===0&&y.connect(y.L,y.J)}); this.V={};this.X={};this.Ns=!1;this.logger=null;this.Tx=[];this.Wm=void 0;this.jT=new DJG;this.Wr=new hoc;this.lY=new wUd;this.zx=new p5G},w51=function(n,Z){a:if(mJc(Z)!=mJc(n.N))var F=!1; else{F=g.XP(Z);for(var y=F.length,l=0;l0?(m=l[0].N,a.push("ofs="+m)):m=0:a.push("ofs="+m);for(var D=!0,p=0;p0&&(n.capabilities= l),n.name=Z.device,n.app=Z.app,(Z=Z.theme)&&(n.theme=Z),DG(" -- with channel params: "+g.tQ(n)),n?(g.Oh("yt-remote-session-app",n.app),g.Oh("yt-remote-session-name",n.name)):(g.Yc("yt-remote-session-app"),g.Yc("yt-remote-session-name")),g.pv("yt.mdx.remote.channelParams_",n),F.start(),qx()||UJG())}},OM7=function(n,Z){var F=n.L.receiver.label,y=n.X.friendlyName; return(new Promise(function(l){h57(n.V,F,Z,y,function(m){m&&m.token&&vv(n,m);l(m)},function(m){GC(n,"Failed to get DIAL screen: "+m); l(null)})})).then(function(l){return l&&l.token?new chrome.cast.DialLaunchResponse(!1):E6g(n)})},Lx=function(n){KA("cloudview",n)},CYg=function(){Lx("dispose"); var n=Pj();n&&n.dispose();g.pv("yt.mdx.remote.cloudview.instance_",null);Yjx(!1);g.Sv(cnm);cnm.length=0},Vmh=function(n,Z,F){n.info("initOnConnectedScreenDataPromise_: Received screenData: "+JSON.stringify(Z)); var y=new Nx(Z);return(new Promise(function(l){oLv(n,y,function(m){m?(n.Tx=!0,FC(n.V,y),vv(n,y),IE(n,F)):g.hp(Error("DialSession, RemoteScreen from screenData: "+JSON.stringify(Z)+" is not online."));l(m)},5)})).then(function(l){return l?new chrome.cast.DialLaunchResponse(!1):E6g(n)})},wQU=function(n){return n.N?n.Wr=="GET"&&n.r5!=2&&n.T.mC:!1},v61=function(n){Vsv.call(this); this.status=1;this.errorCode=n},I2x=function(){sW()?Pj()?uo()?(Lx("Requesting cast selector."),Pj().requestSession()):(Lx("Wait for cast API to be ready to request the session."),cnm.push(g.ny("yt-remote-cast2-api-ready",I2x))):wH("requestCastSelector: Cast is not initialized."):wH("requestCastSelector: Cast API is not installed!")},FC=function(n,Z){var F=n.get(Z.id); F?(F.uuid=Z.uuid,Z=F):((F=Oz(n.T,Z.uuid))?(F.id=Z.id,F.token=Z.token,Z=F):n.T.push(Z),n.J||f27(n));VtG(n);n.S[Z.uuid]=Z.id;g.Oh("yt-remote-device-id-map",n.S,31536E3);return Z},An7=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(n){var Z=Math.random()*16|0; return(n=="x"?Z:Z&3|8).toString(16)})},At=function(n){return new RE(n.V.getPlayerContextData())},WxI=function(n,Z){var F=n.screens.length; n.screens=g.I$(n.screens,function(y){return!(y||Z?!y!=!Z?0:y.id==Z.id:1)}); return n.screens.length0&&(n.fR=new g.D9((0,g.GP)(n.eZ,n,n.N),n.xi));n.Yi.listen(n.N,"readystatechange",n.v5);Z=n.jT?g.nO(n.jT):{};n.Pr?(n.Wr||(n.Wr="POST"),Z["Content-Type"]="application/x-www-form-urlencoded",n.N.send(n.yg,n.Wr,n.Pr,Z)):(n.Wr="GET",n.N.send(n.yg,n.Wr,null,Z));XA(1)},HMh=function(n){var Z,F; g.A(function(y){if(y.N==1)return g.Rj(y,2),g.x(y,soc(n),2);g.cJ(y);Z=n.T;n.T=[];F=Z.length;jx1(n,Z,F);EW(n);return g.zu(y,0)})},KA=function(n,Z){MAd(); var F=CJg(n,String(Z));j6.length==0?oum(F):(x5U(),g.I5(j6,function(y){y(F)}))},mv=function(n,Z){nx.call(this,n,Z,"ManualSession"); this.T=g.A3((0,g.GP)(this.N9,this,null),150)},E6g=function(n){return new Promise(function(Z){n.Wr=An7(); if(n.jT){var F=new chrome.cast.DialLaunchResponse(!0,WSv(n));Z(F);DXm(n)}else n.Ns=function(){g.l0(n.Pr);n.Ns=function(){}; n.Pr=NaN;var y=new chrome.cast.DialLaunchResponse(!0,WSv(n));Z(y);DXm(n)},n.Pr=g.A3(function(){n.Ns()},100)})},tmd=function(n,Z){var F=null; if(Z){var y=B1m(n);y&&(F={clientName:y.clientName,deviceMake:y.brand,deviceModel:y.model,osVersion:y.osVersion})}g.pv("yt.mdx.remote.remoteClient_",F);Z&&(mhG(n),HWh(n));F=n.X.bE()&&isNaN(n.C);Z==F?Z&&(io(n,1),am(n,"getSubtitlesTrack")):Z?(n.Im()&&n.N.reset(),io(n,1),am(n,"getNowPlaying"),dJh(n)):n.hc(1)},MyO=function(n){this.T=[]; this.Bx=this.cV=this.jT=this.Hx=this.N=this.KF=this.zx=this.lY=this.J=this.IW=this.Pr=null;this.p6=this.yg=0;this.VG=$J("failFast",!1,n);this.fR=this.Ns=this.L=this.C=this.S=null;this.PV=!0;this.Z8=this.r5=-1;this.kV=this.Tx=this.w5=0;this.RX=$J("baseRetryDelayMs",5E3,n);this.HE=$J("retryDelaySeedMs",1E4,n);this.GU=$J("forwardChannelMaxRetries",2,n);this.uH=$J("forwardChannelRequestTimeoutMs",2E4,n);this.R0=n&&n.uV5||void 0;this.Mt=n&&n.t3Y||void 0;this.mC=n&&n.CVr||!1;this.xi=void 0;this.aY=n&&n.xhx|| !1;this.V="";this.X=new j3U(n&&n.v7T);this.oX=new BQG;this.Yi=n&&n.k4i||!1;this.d5=n&&n.bfY||!1;this.Yi&&this.d5&&(this.d5=!1);this.ZD=n&&n.GWx||!1;n&&n.rY5&&(this.PV=!1);this.h2=!this.Yi&&this.PV&&n&&n.Yig||!1;this.ud=void 0;n&&n.hM&&n.hM>0&&(this.ud=n.hM);this.mJ=void 0;this.N1=0;this.hG=!1;this.SG=this.Wr=null},D5h=function(n,Z,F){var y=Z.params.videoId||Z.params.video_id,l=parseInt(Z.params.currentIndex,10); n.N.listId=Z.params.listId||n.N.listId;Aj(n.N,y,l);n.publish("remoteQueueChange",F)},Mmv=function(){return g.Di("yt.mdx.remote.connectData_")},g6h=function(n){g.I5("nowAutoplaying autoplayDismissed remotePlayerChange remoteQueueChange autoplayModeChange autoplayUpNext previousNextChange multiStateLoopEnabled loopModeChange".split(" "),function(Z){this.C.push(this.V.subscribe(Z,g.je(this.qwR,Z),this))},n)},$Ox=function(){this.N=[]; this.X=[]},sxU=function(n){return{name:n.name, screenId:n.id,loungeToken:n.token,dialId:n.uuid,screenIdType:n.idType,screenIdSecret:n.secret}},nxG=function(n,Z,F){var y=At(n); pA(y,F);y.playerState!=-1E3&&(y.playerState=Z);Bv(n,y)},lN=function(n,Z){if(Z==2){var F=(0,g.GP)(n.ABx,n),y=n.Mt,l=!y; y=new g.fW(y||"//www.google.com/images/cleardot.gif");g.KQ.location&&g.KQ.location.protocol=="http"||g.Af(y,"https");LA(y);l?l27(y.toString(),F):Q3z(y.toString(),F)}else OW(2);n.JB=0;n.S&&n.S.fG(Z);LSz(n);xJc(n)},CMO=function(n){VtG(n); n.X=new lD(n.V);n.X.subscribe("screenChange",(0,g.GP)(n.UsQ,n));Adh(n);n.J||(n.T=Nd1(g.z5("yt-remote-automatic-screen-cache")||[]));VtG(n);n.info("Initializing automatic screens: "+jog(n.T));n.N=new n6I(n.V,(0,g.GP)(n.M2,n,!0));n.N.subscribe("screenChange",(0,g.GP)(function(){this.publish("onlineScreenChange")},n))},a2=function(n,Z){g.Xu.call(this); var F=this;this.T=0;this.V=n;this.C=[];this.S=new $Ox;this.X=this.N=null;this.Pr=(0,g.GP)(this.VO5,this);this.J=(0,g.GP)(this.jw,this);this.L=(0,g.GP)(this.wVr,this);this.Ns=(0,g.GP)(this.iJY,this);var y=0;n?(y=n.getProxyState(),y!=3&&(n.subscribe("proxyStateChange",this.B8,this),g6h(this))):y=3;y!=0&&(Z?this.B8(y):g.A3(function(){F.B8(y)},0)); (n=iMO())&&Hj(this,n);this.subscribe("yt-remote-cast2-session-change",this.Ns)},Xyh=function(n,Z){var F=!1; Pj()||(n=new KJ(n,Z),n.subscribe("yt-remote-cast2-availability-change",function(y){g.Oh("yt-remote-cast-available",y);TC("yt-remote-cast2-availability-change",y)}),n.subscribe("yt-remote-cast2-receiver-selected",function(y){Lx("onReceiverSelected: "+y.friendlyName); g.Oh("yt-remote-cast-receiver",y);TC("yt-remote-cast2-receiver-selected",y)}),n.subscribe("yt-remote-cast2-receiver-resumed",function(y){Lx("onReceiverResumed: "+y.friendlyName); g.Oh("yt-remote-cast-receiver",y);TC("yt-remote-cast2-receiver-resumed",y)}),n.subscribe("yt-remote-cast2-session-change",function(y){Lx("onSessionChange: "+aE(y)); y||g.Yc("yt-remote-cast-receiver");TC("yt-remote-cast2-session-change",y)}),g.pv("yt.mdx.remote.cloudview.instance_",n),F=!0); Lx("cloudview.createSingleton_: "+F);return F},DP=function(n){switch(n.playerState){case 1:case 1081:return(g.O7()-n.S)/1E3+n.C; case -1E3:return 0}return n.C},ZGx=function(n){n.C=g.A3(function(){Uz("Connecting timeout"); n.hc(1)},2E4)},Jj=function(n,Z){uo()?Pj().setConnectedScreenStatus(n,Z):wH("setConnectedScreenStatus called before ready.")},pJ=function(){g.R.call(this,{U:"div", K:"ytp-mdx-popup-dialog",Z:{role:"dialog"},D:[{U:"div",K:"ytp-mdx-popup-dialog-inner-content",D:[{U:"div",K:"ytp-mdx-popup-title",E8:"You're signed out"},{U:"div",K:"ytp-mdx-popup-description",E8:"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."},{U:"div",K:"ytp-mdx-privacy-popup-buttons",D:[{U:"button",s8:["ytp-button","ytp-mdx-privacy-popup-cancel"],E8:"Cancel"},{U:"button",s8:["ytp-button", "ytp-mdx-privacy-popup-confirm"],E8:"Confirm"}]}]}]});this.fade=new g.J9(this,250);this.cancelButton=this.Vg("ytp-mdx-privacy-popup-cancel");this.confirmButton=this.Vg("ytp-mdx-privacy-popup-confirm");g.S(this,this.fade);this.G(this.cancelButton,"click",this.N);this.G(this.confirmButton,"click",this.X)},LJ=function(n,Z){if(Z==2||Z==9){var F=null; n.cj&&(F=null);var y=(0,g.GP)(n.dhr,n);F||(F=new g.fW("//www.google.com/images/cleardot.gif"),LA(F));eoz(F.toString(),1E4,y)}else rH(2);TQd(n,Z)},o6G=function(){var n=FT(); this.N=n;n.kR("/client_streamz/youtube/living_room/mdx/browser_channel/undelivered_maps")},eTI=function(n,Z){return n.X?n.X==Z:n.N?n.N.has(Z):!1},e2=function(n){g.Xu.call(this); this.C=n;this.screens=[]},qR=function(n){return n.isPlaying()?(g.O7()-n.S)/1E3:0},Fk7=function(n){n.Mb||n.SP||(n.J=1,n.SP=XT((0,g.GP)(n.LG,n),0),n.XG=0)},y3U=function(n){return n.V?n.J+qR(n):n.J},Pj=function(){return g.Di("yt.mdx.remote.cloudview.instance_")},Ez=function(){if(!lhU){var n=g.Di("yt.mdx.remote.screenService_"); lhU=n?new Ifh(n):null}return lhU},LUU=function(n,Z){var F=[]; DhO(Z,function(y){try{var l=g.aV.prototype.CZ.call(this,y,!0)}catch(m){if(m=="Storage: Invalid value was encountered")return;throw m;}l===void 0?F.push(y):g.sX8(l)&&F.push(y)},n); return F},sHI=function(n){n.N=new gH(n,n.V,"rpc",n.kV); n.J===null&&(n.N.jT=n.Pr);n.N.xi=0;var Z=n.cV.clone();g.JJ(Z,"RID","rpc");g.JJ(Z,"SID",n.V);g.JJ(Z,"AID",n.r5);g.JJ(Z,"CI",n.fR?"0":"1");!n.fR&&n.ud&&g.JJ(Z,"TO",n.ud);g.JJ(Z,"TYPE","xmlhttp");ht(n,Z);n.J&&n.Pr&&g.Of(Z,n.J,n.Pr);n.xi&&n.N.setTimeout(n.xi);var F=n.N;n=n.Bx;F.r5=1;F.L=LA(Z.clone());F.Pr=null;F.zx=!0;OWh(F,n)},O5h=function(){g.KG.call(this,"p")},eoz=function(n,Z,F){var y=new Image; y.onload=function(){try{dH(y),F(!0)}catch(l){}}; y.onerror=function(){try{dH(y),F(!1)}catch(l){}}; y.onabort=function(){try{dH(y),F(!1)}catch(l){}}; y.ontimeout=function(){try{dH(y),F(!1)}catch(l){}}; g.KQ.setTimeout(function(){if(y.ontimeout)y.ontimeout()},Z); y.src=n},d5G=function(n){V0(n)&&n.T.getDialAppInfo(function(Z){n.info("getDialAppInfo dialLaunchData: "+JSON.stringify(Z)); Z=Z.extraData||{};var F=null;if(Z.loungeToken){var y;((y=n.N)==null?void 0:y.token)==Z.loungeToken&&(F="staleLoungeToken")}else F="missingLoungeToken";F?(n.w5=F,IE(n,3E4)):(n.Tx=!1,n.w5="unknown",utm(n,Z.loungeToken),IE(n,Z.loungeTokenRefreshIntervalMs))},function(Z){n.info("getDialAppInfo error: "+Z); n.w5="noLoungeTokenResponse";IE(n,3E4)})},ZM7=function(n){g.KG.call(this,"serverreachability",n)},i6I=function(n){g.pv("yt.mdx.remote.cloudview.initializing_",n)},Kxh=function(n,Z){this.X=n; this.N=Z},dJh=function(n){g.l0(n.Pr); n.Pr=g.A3(function(){n.hc(1)},864E5)},mw=function(n,Z,F){var y=g.E$(F); if(y.N!="")Z&&g.WU(y,Z+"."+y.N),g.rw(y,y.T);else{var l=window.location;y=m57(l.protocol,Z?Z+"."+l.hostname:l.hostname,+l.port,F)}n.XQ&&g.l7(n.XQ,function(m,a){g.JJ(y,a,m)}); g.JJ(y,"VER",n.wd);Q0(n,y);return y},jcg=function(){Lx("clearCurrentReceiver"); g.Yc("yt-remote-cast-receiver")},wx=function(n,Z,F){Z!=n.N&&(g.xA(n.N),(n.N=Z)?(F?n.publish("yt-remote-cast2-receiver-resumed",Z.X):n.publish("yt-remote-cast2-receiver-selected",Z.X),Z.subscribe("sessionScreen",(0,g.GP)(n.Tf,n,Z)),Z.subscribe("sessionFailed",function(){return RNc(n,Z)}),Z.N?n.publish("yt-remote-cast2-session-change",Z.N):F&&n.N.N9(null)):n.publish("yt-remote-cast2-session-change",null))},mOh=function(n){g.J0.call(this,n); this.kN={key:An7(),name:"This computer"};this.ul=null;this.subscriptions=[];this.xv=this.xV=null;this.UH=[this.kN];this.H4=this.kN;this.gV=new g.iE(64);this.jt=0;this.Bj=-1;this.xa=!1;this.qh=this.RL=this.HK=null;if(!g.Uo(this.player.B())&&!g.Fu(this.player.B())){n=this.player;var Z=g.PZ(n);Z&&(Z=Z.zj())&&(Z=new uN(n,Z),g.S(this,Z));Z=new Bj(n);g.S(this,Z);g.y7(n,Z.element,4);this.HK=new pJ;g.S(this,this.HK);g.y7(n,this.HK.element,4);this.xa=!!cv()}},Qcc=function(n,Z){if(fA(n)){n.xV.unsubscribe("remotePlayerChange", n.lm,n); var F=Math.round(Z.volume);Z=!!Z.muted;var y=At(n.xV);if(F!==y.volume||Z!==y.muted)n.xV.setVolume(F,Z),n.Pr.start();n.xV.subscribe("remotePlayerChange",n.lm,n)}},KJ=function(n,Z){g.Xu.call(this); this.config_=Z;this.X=n;this.L=Z.appId||"233637DE";this.V=Z.theme||"cl";this.Pr=Z.disableCastApi||!1;this.C=Z.forceMirroring||!1;this.N=null;this.J=!1;this.T=[];this.S=(0,g.GP)(this.Yws,this)},FDc=function(){var n=g.z5("yt-remote-cast-receiver"); return n?n.friendlyName:null},Tq=function(n){return n.getState()==1},S6=function(n,Z){qx(); TT()&&TT();if(nA)Q$=n;else{uuc(n.id);var F=g.Di("yt.mdx.remote.enableConnectWithInitialState_")||!1;n=new CA(nJ,n,FSm(),F);n.connect(Z,Mmv());n.subscribe("beforeDisconnect",function(y){TC("yt-remote-before-disconnect",y)}); n.subscribe("beforeDispose",function(){$_()&&($_(),bWx(null))}); n.subscribe("browserChannelAuthError",function(){var y=TT();y&&y.idType=="shortLived"&&(uo()?Pj().handleBrowserChannelAuthError():wH("refreshLoungeToken called before API ready."))}); bWx(n)}},pyh=function(n,Z){g.l0(n.Ns); n.Ns=0;Z?n.config_.enableCastLoungeToken&&Z.loungeToken?Z.deviceId?n.N&&n.N.uuid==Z.deviceId||(Z.loungeTokenRefreshIntervalMs?e5v(n,{name:n.X.friendlyName,screenId:Z.screenId,loungeToken:Z.loungeToken,dialId:Z.deviceId,screenIdType:"shortLived"},Z.loungeTokenRefreshIntervalMs):(g.hp(Error("No loungeTokenRefreshIntervalMs presents in mdxSessionStatusData: "+JSON.stringify(Z)+".")),x6G(n,Z.screenId))):(g.hp(Error("No device id presents in mdxSessionStatusData: "+JSON.stringify(Z)+".")),x6G(n,Z.screenId)): x6G(n,Z.screenId):n.ev(Error("Waiting for session status timed out."))},CHI=function(n,Z){g.l0(n.J); n.J=0;Z==0?cRc(n):n.J=g.A3(function(){cRc(n)},Z)},ahm=function(n){if(n.screens.length){var Z=g.Yn(n.screens,function(y){return y.id}),F=cj(n.X,"/pairing/get_lounge_token_batch"); n.X.sendRequest("POST",F,{screen_ids:Z.join(",")},(0,g.GP)(n.XrY,n),(0,g.GP)(n.N5Y,n))}},afh=function(n){n.audioTrackId=null; n.trackData=null;n.playerState=-1;n.hasPrevious=!1;n.hasNext=!1;n.C=0;n.S=g.O7();n.X=0;n.J=0;n.T=0;n.loadedTime=0;n.N=NaN;n.V=!1},o2=function(n,Z){var F=n.S; F.N.length+F.X.length<50&&n.S.enqueue(Z)},pA=function(n,Z){n.C=Z; n.S=g.O7()},wyI=function(n){if(n.N){var Z=n.lY(),F=n.N.oz||{}; Z?F["x-youtube-lounge-xsrf-token"]=Z:delete F["x-youtube-lounge-xsrf-token"];n.N.oz=F}},utm=function(n,Z){n.N&&(n.N.token=Z,FC(n.V,n.N)); n.publish("sessionScreen",n.N)},pNh=function(n,Z){var F=n.J,y=Z.indexOf("\n",F); if(y==-1)return Kkg;F=Number(Z.substring(F,y));if(isNaN(F))return DOG;y+=1;if(y+F>Z.length)return Kkg;Z=Z.slice(y,y+F);n.J=y+F;return Z},eNh=function(n){return"chrome-extension://"+n+"/cast_sender.js"},BQG=function(){this.N=new Im},TT=function(){var n=qx(); if(!n)return null;var Z=Ez().M2();return Oz(Z,n)},Lkv=function(n){g.pO(n.channel,"m",function(){n.C=3; n.T.reset();n.L=null;n.J=0;for(var Z=g.Y(n.Tx),F=Z.next();!F.done;F=Z.next())F=F.value,n.channel&&n.channel.send(F);n.Tx=[];n.publish("webChannelOpened");n.jT.tV("WEB_CHANNEL")}); g.pO(n.channel,"n",function(){n.C=0;n.T.isActive()||n.publish("webChannelClosed");var Z,F=(Z=n.channel)==null?void 0:I3U(new Kxh(Z,Z.N));F&&(n.Tx=[].concat(g.t(F)));n.Wr.tV("WEB_CHANNEL")}); g.pO(n.channel,"p",function(Z){var F=Z.data;F[0]==="gracefulReconnect"?(n.T.start(),n.channel&&n.channel.close()):n.publish("webChannelMessage",new mXc(F[0],F[1]));n.Wm=Z.statusCode;n.lY.tV("WEB_CHANNEL")}); g.pO(n.channel,"o",function(){n.Wm===401||n.T.start();n.publish("webChannelError");n.zx.tV("WEB_CHANNEL","")})},T1x=function(n){var Z=0; n.Mb&&Z++;n.N2&&Z++;return Z},WDv=function(n,Z){if(n.N){var F=n.N.oz||{}; Z&&Object.keys(Z).length>0?F=Object.assign({},F,Z):delete F.Authorization;n.N.oz=F}},RE=function(n){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.T=this.J=this.X=0;this.N=NaN;this.V=!1;this.reset(n)},YJ=function(){uo()?Pj().stopSession():wH("stopSession called before API ready."); var n=$_();n&&(n.disconnect(1),bWx(null))},R57=function(n){var Z={}; Z.index=n.index;Z.listId=n.listId;Z.videoId=n.videoId;Z.playerState=n.playerState;Z.volume=n.volume;Z.muted=n.muted;Z.audioTrackId=n.audioTrackId;Z.trackData=g.Q7(n.trackData);Z.hasPrevious=n.hasPrevious;Z.hasNext=n.hasNext;Z.playerTime=n.C;Z.playerTimeAt=n.S;Z.seekableStart=n.X;Z.seekableEnd=n.J;Z.duration=n.T;Z.loadedTime=n.loadedTime;Z.liveIngestionTime=n.N;return Z},k9g=function(n,Z){n.S=Z.params.autoplayMode; n.publish("autoplayModeChange",n.S);n.S=="DISABLED"&&n.publish("autoplayDismissed")},qPG=function(){},vnd=function(n){if(n.JB==0)return n.SG; var Z=[];g.Y$(Z,fIh(n.X));g.Y$(Z,n.T);return Z},rO=function(n){n.T.JX()||n.lY||Mtz(n.T,n)},qeG=function(n){n=g.XP(g.Vx(n.N,function(Z){return Z})); g.bF(n);n.length?g.Oh("yt-remote-online-screen-ids",n.join(","),60):g.Yc("yt-remote-online-screen-ids")},yc=function(n){if(g.N5("deprecate_pair_servlet_enabled"))return ffh(n,[]); var Z=Nd1($5U());Z=g.I$(Z,function(F){return!F.uuid}); return ffh(n,Z)},UJG=function(){var n=cv(); n?(DG("Resume connection to: "+aE(n)),S6(n,0)):(gO(),jcg(),DG("Skipping connecting because no session screen found."))},vL1=function(n,Z,F,y,l){function m(){return new PH7(cj(n,"/bc"),Z,!1,F,y)} F=F===void 0?function(){return""}:F; return g.N5("enable_mdx_web_channel_desktop")?new sc7(function(){return new LxG(cj(n,"/wc"),Z,F)}):new b6x(m,l)},gVI=function(n,Z,F){var y=g.E$(F); y.N!=""?(Z&&g.WU(y,Z+"."+y.N),g.rw(y,y.T)):(y=g.KQ.location,y=m57(y.protocol,Z?Z+"."+y.hostname:y.hostname,+y.port,F));Z=n.zx;F=n.KF;Z&&F&&g.JJ(y,Z,F);g.JJ(y,"VER",n.JI);ht(n,y);return y},K4g=function(n){if(n instanceof g.eB)return n; if(typeof n.Cm=="function")return n.Cm(!1);if(g.W6(n)){var Z=0,F=new g.eB;F.next=function(){for(;;){if(Z>=n.length)return g.aQ;if(Z in n)return g.Kg(n[Z++]);Z++}}; return F}throw Error("Not implemented");}; g.ql.prototype.zP=g.fe(49,function(){this.app.iG().zP()}); g.QC.prototype.zP=g.fe(48,function(){this.qh=null}); g.ql.prototype.Z_=g.fe(47,function(n){this.app.iG().Z_(n)}); g.QC.prototype.Z_=g.fe(46,function(n){this.qh=n}); DJG.prototype.tV=function(n){this.N.jl("/client_streamz/youtube/living_room/mdx/channel/opened",n)}; hoc.prototype.tV=function(n){this.N.jl("/client_streamz/youtube/living_room/mdx/channel/closed",n)}; wUd.prototype.tV=function(n){this.N.jl("/client_streamz/youtube/living_room/mdx/channel/message_received",n)}; Jfc.prototype.tV=function(){this.N.jl("/client_streamz/youtube/living_room/mdx/channel/success")}; p5G.prototype.tV=function(n,Z){this.N.jl("/client_streamz/youtube/living_room/mdx/channel/error",n,Z)}; hT1.prototype.tV=function(){this.N.jl("/client_streamz/youtube/living_room/mdx/browser_channel/pending_maps")}; o6G.prototype.tV=function(){this.N.jl("/client_streamz/youtube/living_room/mdx/browser_channel/undelivered_maps")}; g.Q=qy.prototype;g.Q.Lm=function(){k_(this);for(var n=[],Z=0;Z2*this.size&&k_(this),!0):!1}; g.Q.get=function(n,Z){return tt(this.X,n)?this.X[n]:Z}; g.Q.set=function(n,Z){tt(this.X,n)||(this.size+=1,this.N.push(n),this.qQ++);this.X[n]=Z}; g.Q.forEach=function(n,Z){for(var F=this.EZ(),y=0;y=y.N.length)return g.aQ;var m=y.N[Z++];return g.Kg(n?m:y.X[m])}; return l}; var Gid={dcR:"atp",dNp:"ska",oNs:"que",IwY:"mus",DN4:"sus",G6i:"dsp",Kq5:"seq",YWY:"mic",qDQ:"dpa",T64:"mlm",B8s:"dsdtr",o4Q:"ntb",GBx:"vsp",wWg:"scn",t5s:"rpe",hG8:"dcn",RGT:"dcp",KD4:"pas",vMQ:"drq",unT:"opf",InY:"els",ERQ:"isg",pti:"svq",E4x:"mvp",Yjr:"ads",X9T:"stcp",M5s:"sads",x28:"dloc",AwT:"dcw",Fgx:"asw",Qh8:"apw",mc5:"wrc",DKg:"pcw",kyT:"ipv",juQ:"ndt",eGY:"ctops"},Awh={fpG:"u",WlR:"cl",JmY:"k",Qz4:"i",fdx:"cr",wfi:"m",k68:"g",xo:"up"},LDx={wD:"adPlaying",eL:"onAdStateChange"},qjI={tUp:"nowPlaying", ODY:"onStateChange",wD:"adPlaying",eL:"onAdStateChange",Ov:"nowPlayingShorts",Jk:"onShortsStateChange"},wM1={Ov:"nowPlayingShorts",Jk:"onShortsStateChange"};wO.prototype.equals=function(n){return n?this.id==n.id:!1}; var bMU="",S2=null;g.d(PRc,g.SC);var Rm,rfO=Uh7("loadCastFramework")||Uh7("loadCastApplicationFramework"),kuO=["pkedcjkdefgpdelpbcmbmeomcjbeemfm","enhhojjnijigcajfphajepfemndkmdlo"];g.aT(tj,g.I);g.Q=tj.prototype;g.Q.hx=function(n){this.V=arguments;this.N=!1;this.Gu?this.T=g.O7()+this.Gj:this.Gu=g.JY(this.S,this.Gj)}; g.Q.stop=function(){this.Gu&&(g.KQ.clearTimeout(this.Gu),this.Gu=null);this.T=null;this.N=!1;this.V=[]}; g.Q.pause=function(){++this.X}; g.Q.resume=function(){this.X&&(--this.X,!this.X&&this.N&&(this.N=!1,this.C.apply(null,this.V)))}; g.Q.IY=function(){this.stop();tj.yG.IY.call(this)}; g.Q.R3=function(){this.Gu&&(g.KQ.clearTimeout(this.Gu),this.Gu=null);this.T?(this.Gu=g.JY(this.S,this.T-g.O7()),this.T=null):this.X?this.N=!0:(this.N=!1,this.C.apply(null,this.V))};Im.prototype.stringify=function(n){return g.KQ.JSON.stringify(n,void 0)}; Im.prototype.parse=function(n){return g.KQ.JSON.parse(n,void 0)};g.aT(O5h,g.KG);g.aT(Vsv,g.KG);var Bwv=null;g.aT(ZM7,g.KG);g.aT(gnx,g.KG);g.aT(dXd,g.KG);j2.prototype.debug=function(){}; j2.prototype.info=function(){}; j2.prototype.warning=function(){};var DOG={},Kkg={};g.Q=gH.prototype;g.Q.setTimeout=function(n){this.hG=n}; g.Q.v5=function(n){n=n.target;var Z=this.fR;Z&&g.Ya(n)==3?Z.Ni():this.eZ(n)}; g.Q.eZ=function(n){try{if(n==this.N)a:{var Z=g.Ya(this.N),F=this.N.X,y=this.N.getStatus();if(!(Z<3)&&(Z!=3||this.N&&(this.X.X||g.LO(this.N)||g.aK(this.N)))){this.lY||Z!=4||F==7||(F==8||y<=0?XA(3):XA(2));xXv(this);var l=this.N.getStatus();this.mJ=l;var m=Td7(this);if(this.C=l==200){if(this.IW&&!this.aY){b:{if(this.N){var a=g.QS(this.N,"X-HTTP-Initial-Response");if(a&&!g.$q(a)){var D=a;break b}}D=null}if(n=D)this.aY=!0,iRx(this,n);else{this.C=!1;this.S=3;OW(12);Wv(this);rO(this);break a}}if(this.zx){n= !0;for(var p;!this.lY&&this.J0&&!this.SG&&(this.SG=!0,this.T.qx(this)):(Wv(this),rO(this))}else iRx(this,m);Z==4&&Wv(this);this.C&&!this.lY&&(Z==4?Mtz(this.T,this):(this.C=!1,bN(this)))}else g.$i7(this.N),l==400&&m.indexOf("Unknown SID")> 0?(this.S=3,OW(12)):(this.S=0,OW(13)),Wv(this),rO(this)}}}catch(L){}finally{}}; g.Q.cancel=function(){this.lY=!0;Wv(this)}; g.Q.xY=function(){this.Ns=null;var n=Date.now();n-this.d5>=0?(this.r5!=2&&(XA(3),OW(17)),Wv(this),this.S=2,rO(this)):EVc(this,this.d5-n)}; g.Q.getLastError=function(){return this.S}; g.Q.Al=function(){return this.N};j3U.prototype.cancel=function(){this.T=fIh(this);if(this.X)this.X.cancel(),this.X=null;else if(this.N&&this.N.size!==0){for(var n=g.Y(this.N.values()),Z=n.next();!Z.done;Z=n.next())Z.value.cancel();this.N.clear()}};g.Q=MyO.prototype;g.Q.JI=8;g.Q.JB=1;g.Q.connect=function(n,Z,F,y){OW(0);this.Hx=n;this.lY=Z||{};F&&y!==void 0&&(this.lY.OSID=F,this.lY.OAID=y);this.fR=this.PV;this.jT=gVI(this,null,this.Hx);y$(this)}; g.Q.disconnect=function(){xJc(this);if(this.JB==3){var n=this.yg++,Z=this.jT.clone();g.JJ(Z,"SID",this.V);g.JJ(Z,"RID",n);g.JJ(Z,"TYPE","terminate");ht(this,Z);n=new gH(this,this.V,n);n.r5=2;n.L=LA(Z.clone());Z=!1;if(g.KQ.navigator&&g.KQ.navigator.sendBeacon)try{Z=g.KQ.navigator.sendBeacon(n.L.toString(),"")}catch(F){}!Z&&g.KQ.Image&&((new Image).src=n.L,Z=!0);Z||(n.N=z5m(n.T,null),n.N.send(n.L));n.w5=Date.now();bN(n)}LSz(this)}; g.Q.JX=function(){return this.JB==0}; g.Q.getState=function(){return this.JB}; g.Q.KG=function(n){if(this.C)if(this.C=null,this.JB==1){if(!n){this.yg=Math.floor(Math.random()*1E5);n=this.yg++;var Z=new gH(this,"",n),F=this.Pr;this.IW&&(F?(F=g.nO(F),g.RH(F,this.IW)):F=this.IW);this.J!==null||this.d5||(Z.jT=F,F=null);var y;if(this.Yi)a:{for(var l=y=0;l4096){y=l;break a}if(y===4096||l===this.T.length-1){y=l+1;break a}}y= 1E3}else y=1E3;y=U6v(this,Z,y);l=this.jT.clone();g.JJ(l,"RID",n);g.JJ(l,"CVER",22);this.zx&&g.JJ(l,"X-HTTP-Session-Id",this.zx);ht(this,l);F&&(this.d5?y="headers="+g.J5(g.P$f(F))+"&"+y:this.J&&g.Of(l,this.J,F));zT7(this.X,Z);this.ZD&&g.JJ(l,"TYPE","init");this.Yi?(g.JJ(l,"$req",y),g.JJ(l,"SID","null"),Z.IW=!0,cfv(Z,l,null)):cfv(Z,l,y);this.JB=2}}else this.JB==3&&(n?N1c(this,n):this.T.length==0||Vyh(this.X)||N1c(this))}; g.Q.a4=function(){this.L=null;sHI(this);if(this.h2&&!(this.hG||this.N==null||this.N1<=0)){var n=4*this.N1;this.Wr=Ny((0,g.GP)(this.TMY,this),n)}}; g.Q.TMY=function(){this.Wr&&(this.Wr=null,this.fR=!1,this.hG=!0,OW(10),bo(this),sHI(this))}; g.Q.qx=function(n){this.N==n&&this.h2&&!this.hG&&(aNx(this),this.hG=!0,OW(11))}; g.Q.B5=function(){this.Ns!=null&&(this.Ns=null,bo(this),s3h(this),OW(19))}; g.Q.ABx=function(n){n?OW(2):OW(1)}; g.Q.isActive=function(){return!!this.S&&this.S.isActive(this)}; g.Q=qPG.prototype;g.Q.GT=function(){}; g.Q.yK=function(){}; g.Q.fG=function(){}; g.Q.nG=function(){}; g.Q.isActive=function(){return!0}; g.Q.Dl=function(){};g.aT(e6,g.xu);e6.prototype.open=function(){this.N.S=this.T;this.C&&(this.N.aY=!0);this.N.connect(this.S,this.X||void 0)}; e6.prototype.close=function(){this.N.disconnect()}; e6.prototype.send=function(n){var Z=this.N;if(typeof n==="string"){var F={};F.__data__=n;n=F}else this.V&&(F={},F.__data__=g.tQ(n),n=F);Z.T.push(new eMU(Z.p6++,n));Z.JB==3&&y$(Z)}; e6.prototype.IY=function(){this.N.S=null;delete this.T;this.N.disconnect();delete this.N;e6.yG.IY.call(this)}; g.aT(cwx,O5h);g.aT(v61,Vsv);g.aT(kJ,qPG);kJ.prototype.GT=function(){this.N.dispatchEvent("m")}; kJ.prototype.yK=function(n){this.N.dispatchEvent(new cwx(n))}; kJ.prototype.fG=function(n){this.N.dispatchEvent(new v61(n))}; kJ.prototype.nG=function(){this.N.dispatchEvent("n")}; Kxh.prototype.commit=function(n){this.N.mJ=n};var Wj=new g.xu;g.d(kiG,g.KG);g.Q=Y_.prototype;g.Q.TK=null;g.Q.E7=!1;g.Q.ND=null;g.Q.aS=null;g.Q.Po=null;g.Q.q5=null;g.Q.QI=null;g.Q.DQ=null;g.Q.It=null;g.Q.Nc=null;g.Q.A6=0;g.Q.jD=null;g.Q.dQ=null;g.Q.E3=null;g.Q.mX=-1;g.Q.SQ=!0;g.Q.F_=!1;g.Q.Jt=0;g.Q.Bq=null;var Jdc={},PYh={};g.Q=Y_.prototype;g.Q.setTimeout=function(n){this.X=n}; g.Q.Ax=function(n){n=n.target;var Z=this.Bq;Z&&g.Ya(n)==3?Z.Ni():this.pG(n)}; g.Q.pG=function(n){try{if(n==this.Nc)a:{var Z=g.Ya(this.Nc),F=this.Nc.X,y=this.Nc.getStatus();if(g.Gc&&!g.SG("420+")){if(Z<4)break a}else if(Z<3||Z==3&&!g.LO(this.Nc))break a;this.F_||Z!=4||F==7||(F==8||y<=0?this.N.jC(3):this.N.jC(2));Qod(this);var l=this.Nc.getStatus();this.mX=l;var m=g.LO(this.Nc);if(this.E7=l==200){Z==4&&mP(this);if(this.zx){for(n=!0;!this.F_&&this.A60?(this.E3=3,rH(13)):(this.E3=0,rH(14)),mP(this),Fxz(this)}}catch(D){}finally{}}; g.Q.cancel=function(){this.F_=!0;mP(this)}; g.Q.q7=function(){this.ND=null;var n=Date.now();n-this.aS>=0?(this.q5!=2&&this.N.jC(3),mP(this),this.E3=2,rH(18),Fxz(this)):rwv(this,this.aS-n)}; g.Q.getLastError=function(){return this.E3};g.Q=CRg.prototype;g.Q.gY=null;g.Q.nK=null;g.Q.Gl=!1;g.Q.fp=null;g.Q.Sl=null;g.Q.zB=-1;g.Q.YZ=null;g.Q.xu=null;g.Q.connect=function(n){this.fp=n;n=mw(this.N,null,this.fp);rH(3);Date.now();var Z=this.N.Pr;Z!=null?(this.YZ=Z[0],(this.xu=Z[1])?(this.Sl=1,KSz(this)):(this.Sl=2,ARd(this))):(UW(n,"MODE","init"),this.nK=new Y_(this),this.nK.TK=this.gY,lfm(this.nK,n,!1,null,!0),this.Sl=0)}; g.Q.nW=function(n){if(n)this.Sl=2,ARd(this);else{rH(4);var Z=this.N;Z.fD=Z.yN.zB;LJ(Z,9)}n&&this.jC(2)}; g.Q.c$=function(n){return this.N.c$(n)}; g.Q.abort=function(){this.nK&&(this.nK.cancel(),this.nK=null);this.zB=-1}; g.Q.JX=function(){return!1}; g.Q.Hs=function(n,Z){this.zB=n.mX;if(this.Sl==0)if(Z){try{var F=this.X.parse(Z)}catch(y){n=this.N;n.fD=this.zB;LJ(n,2);return}this.YZ=F[0];this.xu=F[1]}else n=this.N,n.fD=this.zB,LJ(n,2);else this.Sl==2&&(this.Gl?(rH(7),Date.now()):Z=="11111"?(rH(6),this.Gl=!0,Date.now(),this.zB=200,this.nK.cancel(),rH(12),My(this.N,this,!0)):(rH(8),Date.now(),this.Gl=!1))}; g.Q.Kp=function(){this.zB=this.nK.mX;if(this.nK.E7)this.Sl==0?this.xu?(this.Sl=1,KSz(this)):(this.Sl=2,ARd(this)):this.Sl==2&&(this.Gl?(rH(12),My(this.N,this,!0)):(rH(11),My(this.N,this,!1)));else{this.Sl==0?rH(9):this.Sl==2&&rH(10);var n=this.N;this.nK.getLastError();n.fD=this.zB;LJ(n,2)}}; g.Q.NR=function(){return this.N.NR()}; g.Q.isActive=function(){return this.N.isActive()}; g.Q.jC=function(n){this.N.jC(n)};g.Q=m6G.prototype;g.Q.oz=null;g.Q.XQ=null;g.Q.N2=null;g.Q.Mb=null;g.Q.GC=null;g.Q.Q5=null;g.Q.Z0=null;g.Q.yp=null;g.Q.TG=0;g.Q.QL=0;g.Q.cj=null;g.Q.Ir=null;g.Q.SP=null;g.Q.Vv=null;g.Q.yN=null;g.Q.vX=null;g.Q.E5=-1;g.Q.Mr=-1;g.Q.fD=-1;g.Q.TJ=0;g.Q.XG=0;g.Q.wd=8;var wNm={OK:0,kQ8:2,xp8:4,suY:5,nLG:6,STOP:7,uB:8,m2s:9,YVQ:10,FfY:11,Pn4:12};g.aT(G9G,g.KG);g.aT(X5I,g.KG);g.Q=m6G.prototype; g.Q.connect=function(n,Z,F,y,l){rH(0);this.GC=Z;this.XQ=F||{};y&&l!==void 0&&(this.XQ.OSID=y,this.XQ.OAID=l);this.L?(XT((0,g.GP)(this.Rn,this,n),100),ttG(this)):this.Rn(n)}; g.Q.disconnect=function(){qT1(this);if(this.N==3){var n=this.TG++,Z=this.Q5.clone();g.JJ(Z,"SID",this.V);g.JJ(Z,"RID",n);g.JJ(Z,"TYPE","terminate");Q0(this,Z);n=new Y_(this,this.V,n);n.q5=2;n.QI=LA(Z.clone());(new Image).src=n.QI.toString();n.Po=Date.now();RTI(n)}F4c(this)}; g.Q.Rn=function(n){this.yN=new CRg(this);this.yN.gY=this.oz;this.yN.X=this.S;this.yN.connect(n)}; g.Q.JX=function(){return this.N==0}; g.Q.getState=function(){return this.N}; g.Q.hI=function(n){this.Ir=null;YTh(this,n)}; g.Q.LG=function(){this.SP=null;this.Mb=new Y_(this,this.V,"rpc",this.J);this.Mb.TK=this.oz;this.Mb.Jt=0;var n=this.Z0.clone();g.JJ(n,"RID","rpc");g.JJ(n,"SID",this.V);g.JJ(n,"CI",this.vX?"0":"1");g.JJ(n,"AID",this.E5);Q0(this,n);g.JJ(n,"TYPE","xmlhttp");lfm(this.Mb,n,!0,this.yp,!1)}; g.Q.Hs=function(n,Z){if(this.N!=0&&(this.Mb==n||this.N2==n))if(this.fD=n.mX,this.N2==n&&this.N==3)if(this.wd>7){try{var F=this.S.parse(Z)}catch(y){F=null}if(Array.isArray(F)&&F.length==3)if(n=F,n[0]==0)a:{if(!this.SP){if(this.Mb)if(this.Mb.Po+3E30)){if(y=Z==1)this.N2||this.Ir||this.N==1||this.TJ>=2?y=!1:(this.Ir=XT((0,g.GP)(this.hI,this,n),ukI(this,this.TJ)),this.TJ++, y=!0);y=!(y||Z==2&&Euh(this))}if(y)switch(F){case 1:LJ(this,5);break;case 4:LJ(this,10);break;case 3:LJ(this,6);break;case 7:LJ(this,12);break;default:LJ(this,2)}}}; g.Q.YY=function(n){if(!g.zi(arguments,this.N))throw Error("Unexpected channel state: "+this.N);}; g.Q.dhr=function(n){n?rH(2):(rH(1),TQd(this,8))}; g.Q.c$=function(n){if(n)throw Error("Can't create secondary domain capable XhrIo object.");n=new g.jX;n.J=!1;return n}; g.Q.isActive=function(){return!!this.cj&&this.cj.isActive(this)}; g.Q.jC=function(n){var Z=Wj;Z.dispatchEvent(new X5I(Z,n))}; g.Q.NR=function(){return!1}; g.Q=pU7.prototype;g.Q.Bs=function(){}; g.Q.xG=function(){}; g.Q.D0=function(){}; g.Q.R4=function(){}; g.Q.H$=function(){}; g.Q.qr=function(){return{}}; g.Q.isActive=function(){return!0};g.Q=$Ox.prototype;g.Q.enqueue=function(n){this.X.push(n)}; g.Q.isEmpty=function(){return this.N.length===0&&this.X.length===0}; g.Q.clear=function(){this.N=[];this.X=[]}; g.Q.contains=function(n){return g.zi(this.N,n)||g.zi(this.X,n)}; g.Q.remove=function(n){var Z=this.N;var F=(0,g.Uy3)(Z,n);F>=0?(g.ye(Z,F),Z=!0):Z=!1;return Z||g.ov(this.X,n)}; g.Q.Lm=function(){for(var n=[],Z=this.N.length-1;Z>=0;--Z)n.push(this.N[Z]);Z=this.X.length;for(var F=0;F=T6z.length?this.publish("pairingFailed",Error("DIAL polling timed out")):(n=T6z[this.X],this.Gu=g.A3((0,g.GP)(this.gL,this),n),this.X++):this.publish("pairingFailed",Error("Server error "+n.status))}; g.Q.TI=function(){this.N=null;this.publish("pairingFailed",Error("Server not responding"))}; var T6z=[2E3,2E3,1E3,1E3,1E3,2E3,2E3,5E3,5E3,1E4];g.aT(lD,e2);g.Q=lD.prototype;g.Q.start=function(){yc(this)&&this.publish("screenChange");!g.z5("yt-remote-lounge-token-expiration")&&ahm(this);g.l0(this.N);this.N=g.A3((0,g.GP)(this.start,this),1E4)}; g.Q.add=function(n,Z){yc(this);lIc(this,n);vj(this,!1);this.publish("screenChange");Z(n);n.token||ahm(this)}; g.Q.remove=function(n,Z){var F=yc(this);WxI(this,n)&&(vj(this,!1),F=!0);Z(n);F&&this.publish("screenChange")}; g.Q.R1=function(n,Z,F,y){var l=yc(this),m=this.get(n.id);m?(m.name!=Z&&(m.name=Z,vj(this,!1),l=!0),F(n)):y(Error("no such local screen."));l&&this.publish("screenChange")}; g.Q.IY=function(){g.l0(this.N);lD.yG.IY.call(this)}; g.Q.XrY=function(n){yc(this);var Z=this.screens.length;n=n&&n.screens||[];for(var F=n.length,y=0;y20)break a;D=Z(m,a)}m=D}l.name=m}F(FC(this,l))},this), onError:(0,g.GP)(function(l){y(Error("pairing request failed: "+l.status))},this), onTimeout:(0,g.GP)(function(){y(Error("pairing request timed out."))},this)})}; g.Q.IY=function(){g.xA(this.X);g.xA(this.N);Hv.yG.IY.call(this)}; g.Q.UsQ=function(){Adh(this);this.publish("screenChange");this.N.update()}; Hv.prototype.dispose=Hv.prototype.dispose;g.aT(nx,g.Xu);g.Q=nx.prototype;g.Q.ev=function(n){this.CR()||(n&&(GC(this,""+n),this.publish("sessionFailed")),this.N=null,this.publish("sessionScreen",null))}; g.Q.info=function(n){KA(this.zx,n)}; g.Q.QK=function(){return null}; g.Q.h8=function(n){var Z=this.X;n?(Z.displayStatus=new chrome.cast.ReceiverDisplayStatus(n,[]),Z.displayStatus.showStop=!0):Z.displayStatus=null;chrome.cast.setReceiverDisplayStatus(Z,(0,g.GP)(function(){this.info("Updated receiver status for "+Z.friendlyName+": "+n)},this),(0,g.GP)(function(){GC(this,"Failed to update receiver status for: "+Z.friendlyName)},this))}; g.Q.IY=function(){this.h8("");nx.yG.IY.call(this)};g.d(xJ,nx);g.Q=xJ.prototype;g.Q.L1=function(n){if(this.T){if(this.T==n)return;GC(this,"Overriding cast session with new session object");WUx(this);this.w5=!1;this.Pr="unknown";this.T.removeUpdateListener(this.Tx);this.T.removeMessageListener("urn:x-cast:com.google.youtube.mdx",this.Wr)}this.T=n;this.T.addUpdateListener(this.Tx);this.T.addMessageListener("urn:x-cast:com.google.youtube.mdx",this.Wr);JwG(this,"getMdxSessionStatus")}; g.Q.N9=function(n){this.info("launchWithParams no-op for Cast: "+g.tQ(n))}; g.Q.stop=function(){this.T?this.T.stop((0,g.GP)(function(){this.ev()},this),(0,g.GP)(function(){this.ev(Error("Failed to stop receiver app."))},this)):this.ev(Error("Stopping cast device without session."))}; g.Q.h8=function(){}; g.Q.IY=function(){this.info("disposeInternal");WUx(this);this.T&&(this.T.removeUpdateListener(this.Tx),this.T.removeMessageListener("urn:x-cast:com.google.youtube.mdx",this.Wr));this.T=null;nx.prototype.IY.call(this)}; g.Q.QZp=function(n,Z){if(!this.CR())if(Z)if(Z=zC(Z),g.VO(Z))switch(n=""+Z.type,Z=Z.data||{},this.info("onYoutubeMessage_: "+n+" "+g.tQ(Z)),n){case "mdxSessionStatus":pyh(this,Z);break;case "loungeToken":ORh(this,Z);break;default:GC(this,"Unknown youtube message: "+n)}else GC(this,"Unable to parse message.");else GC(this,"No data in message.")}; g.Q.zF=function(n,Z,F,y){g.l0(this.L);this.L=0;h57(this.V,this.X.label,n,this.X.friendlyName,(0,g.GP)(function(l){l?Z(l):y>=0?(GC(this,"Screen "+n+" appears to be offline. "+y+" retries left."),this.L=g.A3((0,g.GP)(this.zF,this,n,Z,F,y-1),300)):F(Error("Unable to fetch screen."))},this),F)}; g.Q.QK=function(){return this.T}; g.Q.IJ=function(n){this.CR()||n||(GC(this,"Cast session died."),this.ev())};g.d(Zy,nx);g.Q=Zy.prototype;g.Q.L1=function(n){this.T=n;this.T.addUpdateListener(this.lY)}; g.Q.N9=function(n){this.jT=n;this.Ns()}; g.Q.stop=function(){onU(this);this.T?this.T.stop((0,g.GP)(this.ev,this,null),(0,g.GP)(this.ev,this,"Failed to stop DIAL device.")):this.ev()}; g.Q.IY=function(){onU(this);this.T&&this.T.removeUpdateListener(this.lY);this.T=null;nx.prototype.IY.call(this)}; g.Q.wP=function(n){this.CR()||n||(GC(this,"DIAL session died."),this.S(),this.S=function(){},this.ev())};g.d(mv,nx);mv.prototype.stop=function(){this.ev()}; mv.prototype.L1=function(){}; mv.prototype.N9=function(){g.l0(this.T);this.T=NaN;var n=Oz(this.V.M2(),this.X.label);n?vv(this,n):this.ev(Error("No such screen"))}; mv.prototype.IY=function(){g.l0(this.T);this.T=NaN;nx.prototype.IY.call(this)};g.d(KJ,g.Xu);g.Q=KJ.prototype; g.Q.init=function(n,Z){chrome.cast.timeout.requestSession=3E4;var F=new chrome.cast.SessionRequest(this.L,[chrome.cast.Capability.AUDIO_OUT]);g.N5("desktop_enable_cast_connect")&&(F.androidReceiverCompatible=!0);this.Pr||(F.dialRequest=new chrome.cast.DialRequest("YouTube"));var y=chrome.cast.AutoJoinPolicy.TAB_AND_ORIGIN_SCOPED;n=n||this.C?chrome.cast.DefaultActionPolicy.CAST_THIS_TAB:chrome.cast.DefaultActionPolicy.CREATE_SESSION;var l=(0,g.GP)(this.mtY,this);F=new chrome.cast.ApiConfig(F,(0,g.GP)(this.Nw, this),l,y,n);F.customDialLaunchCallback=(0,g.GP)(this.j0Y,this);chrome.cast.initialize(F,(0,g.GP)(function(){this.CR()||(chrome.cast.addReceiverActionListener(this.S),$6I(),this.X.subscribe("onlineScreenChange",(0,g.GP)(this.Fg,this)),this.T=IIc(this),chrome.cast.setCustomReceivers(this.T,function(){},(0,g.GP)(function(m){this.QG("Failed to set initial custom receivers: "+g.tQ(m))},this)),this.publish("yt-remote-cast2-availability-change",sM(this)),Z(!0))},this),(0,g.GP)(function(m){this.QG("Failed to initialize API: "+ g.tQ(m)); Z(!1)},this))}; g.Q.Smu=function(n,Z){Jt("Setting connected screen ID: "+n+" -> "+Z);if(this.N){var F=this.N.N;if(!n||F&&F.id!=n)Jt("Unsetting old screen status: "+this.N.X.friendlyName),wx(this,null)}if(n&&Z){if(!this.N){n=Oz(this.X.M2(),n);if(!n){Jt("setConnectedScreenStatus: Unknown screen.");return}if(n.idType=="shortLived"){Jt("setConnectedScreenStatus: Screen with id type to be short lived.");return}F=KUv(this,n);F||(Jt("setConnectedScreenStatus: Connected receiver not custom..."),F=new chrome.cast.Receiver(n.uuid? n.uuid:n.id,n.name),F.receiverType=chrome.cast.ReceiverType.CUSTOM,this.T.push(F),chrome.cast.setCustomReceivers(this.T,function(){},(0,g.GP)(function(y){this.QG("Failed to set initial custom receivers: "+g.tQ(y))},this))); Jt("setConnectedScreenStatus: new active receiver: "+F.friendlyName);wx(this,new mv(this.X,F),!0)}this.N.h8(Z)}else Jt("setConnectedScreenStatus: no screen.")}; g.Q.ssY=function(n){this.CR()?this.QG("Setting connection data on disposed cast v2"):this.N?this.N.N9(n):this.QG("Setting connection data without a session")}; g.Q.Uo=function(){this.CR()?this.QG("Stopping session on disposed cast v2"):this.N?(this.N.stop(),wx(this,null)):Jt("Stopping non-existing session")}; g.Q.requestSession=function(){chrome.cast.requestSession((0,g.GP)(this.Nw,this),(0,g.GP)(this.kUG,this))}; g.Q.IY=function(){this.X.unsubscribe("onlineScreenChange",(0,g.GP)(this.Fg,this));window.chrome&&chrome.cast&&chrome.cast.removeReceiverActionListener(this.S);var n=i5I,Z=g.Di("yt.mdx.remote.debug.handlers_");g.ov(Z||[],n);g.xA(this.N);g.Xu.prototype.IY.call(this)}; g.Q.QG=function(n){KA("Controller",n)}; g.Q.Tf=function(n,Z){this.N==n&&(Z||wx(this,null),this.publish("yt-remote-cast2-session-change",Z))}; g.Q.Yws=function(n,Z){if(!this.CR())if(n)switch(n.friendlyName=chrome.cast.unescape(n.friendlyName),Jt("onReceiverAction_ "+n.label+" / "+n.friendlyName+"-- "+Z),Z){case chrome.cast.ReceiverAction.CAST:if(this.N)if(this.N.X.label!=n.label)Jt("onReceiverAction_: Stopping active receiver: "+this.N.X.friendlyName),this.N.stop();else{Jt("onReceiverAction_: Casting to active receiver.");this.N.N&&this.publish("yt-remote-cast2-session-change",this.N.N);break}switch(n.receiverType){case chrome.cast.ReceiverType.CUSTOM:wx(this, new mv(this.X,n));break;case chrome.cast.ReceiverType.DIAL:wx(this,new Zy(this.X,n,this.V,this.config_));break;case chrome.cast.ReceiverType.CAST:wx(this,new xJ(this.X,n,this.config_));break;default:this.QG("Unknown receiver type: "+n.receiverType)}break;case chrome.cast.ReceiverAction.STOP:this.N&&this.N.X.label==n.label?this.N.stop():this.QG("Stopping receiver w/o session: "+n.friendlyName)}else this.QG("onReceiverAction_ called without receiver.")}; g.Q.j0Y=function(n){if(this.CR())return Promise.reject(Error("disposed"));var Z=n.receiver;Z.receiverType!=chrome.cast.ReceiverType.DIAL&&(this.QG("Not DIAL receiver: "+Z.friendlyName),Z.receiverType=chrome.cast.ReceiverType.DIAL);var F=this.N?this.N.X:null;if(!F||F.label!=Z.label)return this.QG("Receiving DIAL launch request for non-clicked DIAL receiver: "+Z.friendlyName),Promise.reject(Error("illegal DIAL launch"));if(F&&F.label==Z.label&&F.receiverType!=chrome.cast.ReceiverType.DIAL){if(this.N.N)return Jt("Reselecting dial screen."), this.publish("yt-remote-cast2-session-change",this.N.N),Promise.resolve(new chrome.cast.DialLaunchResponse(!1));this.QG('Changing CAST intent from "'+F.receiverType+'" to "dial" for '+Z.friendlyName);wx(this,new Zy(this.X,Z,this.V,this.config_))}Z=this.N;Z.L=n;Z.L.appState==chrome.cast.DialAppState.RUNNING?(n=Z.L.extraData||{},F=n.screenId||null,V0(Z)&&n.loungeToken?n.loungeTokenRefreshIntervalMs?n=Vmh(Z,{name:Z.X.friendlyName,screenId:n.screenId,loungeToken:n.loungeToken,dialId:Z.L.receiver.label, screenIdType:"shortLived"},n.loungeTokenRefreshIntervalMs):(g.hp(Error("No loungeTokenRefreshIntervalMs presents in additionalData: "+JSON.stringify(n)+".")),n=OM7(Z,F)):n=OM7(Z,F)):n=E6g(Z);return n}; g.Q.Nw=function(n){var Z=this;if(!this.CR()&&!this.C){Jt("New cast session ID: "+n.sessionId);var F=n.receiver;if(F.receiverType!=chrome.cast.ReceiverType.CUSTOM){if(!this.N)if(F.receiverType==chrome.cast.ReceiverType.CAST)Jt("Got resumed cast session before resumed mdx connection."),F.friendlyName=chrome.cast.unescape(F.friendlyName),wx(this,new xJ(this.X,F,this.config_),!0);else{this.QG("Got non-cast session without previous mdx receiver event, or mdx resume.");return}var y=this.N.X,l=Oz(this.X.M2(), y.label);l&&lo(l,F.label)&&y.receiverType!=chrome.cast.ReceiverType.CAST&&F.receiverType==chrome.cast.ReceiverType.CAST&&(Jt("onSessionEstablished_: manual to cast session change "+F.friendlyName),g.xA(this.N),this.N=new xJ(this.X,F,this.config_),this.N.subscribe("sessionScreen",(0,g.GP)(this.Tf,this,this.N)),this.N.subscribe("sessionFailed",function(){return RNc(Z,Z.N)}),this.N.N9(null)); this.N.L1(n)}}}; g.Q.Vj=function(){return this.N?this.N.QK():null}; g.Q.kUG=function(n){this.CR()||(this.QG("Failed to estabilish a session: "+g.tQ(n)),n.code!=chrome.cast.ErrorCode.CANCEL&&wx(this,null),this.publish("yt-remote-cast2-session-failed"))}; g.Q.mtY=function(n){Jt("Receiver availability updated: "+n);if(!this.CR()){var Z=sM(this);this.J=n==chrome.cast.ReceiverAvailability.AVAILABLE;sM(this)!=Z&&this.publish("yt-remote-cast2-availability-change",sM(this))}}; g.Q.Fg=function(){this.CR()||(this.T=IIc(this),Jt("Updating custom receivers: "+g.tQ(this.T)),chrome.cast.setCustomReceivers(this.T,function(){},(0,g.GP)(function(){this.QG("Failed to set custom receivers.")},this)),this.publish("yt-remote-cast2-availability-change",sM(this)))}; KJ.prototype.setLaunchParams=KJ.prototype.ssY;KJ.prototype.setConnectedScreenStatus=KJ.prototype.Smu;KJ.prototype.stopSession=KJ.prototype.Uo;KJ.prototype.getCastSession=KJ.prototype.Vj;KJ.prototype.requestSession=KJ.prototype.requestSession;KJ.prototype.init=KJ.prototype.init;KJ.prototype.dispose=KJ.prototype.dispose;var oxI=g.VT(["https://www.gstatic.com/cv/js/sender/v1/cast_sender.js"]),cnm=[],zNc=g.AU(oxI);g.Q=RE.prototype; g.Q.reset=function(n){this.listId="";this.index=-1;this.videoId="";afh(this);this.volume=-1;this.muted=!1;n&&(this.index=n.index,this.listId=n.listId,this.videoId=n.videoId,this.playerState=n.playerState,this.volume=n.volume,this.muted=n.muted,this.audioTrackId=n.audioTrackId,this.trackData=n.trackData,this.hasPrevious=n.hasPrevious,this.hasNext=n.hasNext,this.C=n.playerTime,this.S=n.playerTimeAt,this.X=n.seekableStart,this.J=n.seekableEnd,this.T=n.duration,this.loadedTime=n.loadedTime,this.N=n.liveIngestionTime, this.V=!isNaN(this.N))}; g.Q.isPlaying=function(){return this.playerState==1}; g.Q.isBuffering=function(){return this.playerState==3}; g.Q.EW=function(n){this.T=isNaN(n)?0:n}; g.Q.getDuration=function(){return this.V?this.T+qR(this):this.T}; g.Q.clone=function(){return new RE(R57(this))};g.d(a2,g.Xu);g.Q=a2.prototype;g.Q.getState=function(){return this.T}; g.Q.PM=function(){return this.V.getReconnectTimeout()}; g.Q.zA=function(){this.V.reconnect()}; g.Q.play=function(){Tq(this)?(this.N?this.N.play(null,g.ha,y0(this,"play")):ZG(this,"play"),nxG(this,1,DP(At(this))),this.publish("remotePlayerChange")):o2(this,this.play)}; g.Q.pause=function(){Tq(this)?(this.N?this.N.pause(null,g.ha,y0(this,"pause")):ZG(this,"pause"),nxG(this,2,DP(At(this))),this.publish("remotePlayerChange")):o2(this,this.pause)}; g.Q.seekTo=function(n){if(Tq(this)){if(this.N){var Z=At(this),F=new chrome.cast.media.SeekRequest;F.currentTime=n;Z.isPlaying()||Z.isBuffering()?F.resumeState=chrome.cast.media.ResumeState.PLAYBACK_START:F.resumeState=chrome.cast.media.ResumeState.PLAYBACK_PAUSE;this.N.seek(F,g.ha,y0(this,"seekTo",{newTime:n}))}else ZG(this,"seekTo",{newTime:n});nxG(this,3,n);this.publish("remotePlayerChange")}else o2(this,g.je(this.seekTo,n))}; g.Q.stop=function(){if(Tq(this)){this.N?this.N.stop(null,g.ha,y0(this,"stopVideo")):ZG(this,"stopVideo");var n=At(this);n.index=-1;n.videoId="";afh(n);Bv(this,n);this.publish("remotePlayerChange")}else o2(this,this.stop)}; g.Q.setVolume=function(n,Z){if(Tq(this)){var F=At(this);if(this.X){if(F.volume!=n){var y=Math.round(n)/100;this.X.setReceiverVolumeLevel(y,(0,g.GP)(function(){dO("set receiver volume: "+y)},this),(0,g.GP)(function(){this.QG("failed to set receiver volume.")},this))}F.muted!=Z&&this.X.setReceiverMuted(Z,(0,g.GP)(function(){dO("set receiver muted: "+Z)},this),(0,g.GP)(function(){this.QG("failed to set receiver muted.")},this))}else{var l={volume:n, muted:Z};F.volume!=-1&&(l.delta=n-F.volume);ZG(this,"setVolume",l)}F.muted=Z;F.volume=n;Bv(this,F)}else o2(this,g.je(this.setVolume,n,Z))}; g.Q.mW=function(n,Z){if(Tq(this)){var F=At(this);n={videoId:n};Z&&(F.trackData={trackName:Z.name,languageCode:Z.languageCode,sourceLanguageCode:Z.translationLanguage?Z.translationLanguage.languageCode:"",languageName:Z.languageName,kind:Z.kind},n.style=g.tQ(Z.style),g.RH(n,F.trackData));ZG(this,"setSubtitlesTrack",n);Bv(this,F)}else o2(this,g.je(this.mW,n,Z))}; g.Q.setAudioTrack=function(n,Z){Tq(this)?(Z=Z.getLanguageInfo().getId(),ZG(this,"setAudioTrack",{videoId:n,audioTrackId:Z}),n=At(this),n.audioTrackId=Z,Bv(this,n)):o2(this,g.je(this.setAudioTrack,n,Z))}; g.Q.playVideo=function(n,Z,F,y,l,m,a){y=y===void 0?null:y;l=l===void 0?null:l;m=m===void 0?null:m;a=a===void 0?null:a;var D=At(this),p={videoId:n};F!==void 0&&(p.currentIndex=F);Aj(D,n,F||0);Z!==void 0&&(pA(D,Z),p.currentTime=Z);y&&(p.listId=y);l&&(p.playerParams=l);m&&(p.clickTrackingParams=m);a&&(p.locationInfo=g.tQ(a));ZG(this,"setPlaylist",p);y||Bv(this,D)}; g.Q.rU=function(n,Z){if(Tq(this)){if(n&&Z){var F=At(this);Aj(F,n,Z);Bv(this,F)}ZG(this,"previous")}else o2(this,g.je(this.rU,n,Z))}; g.Q.nextVideo=function(n,Z){if(Tq(this)){if(n&&Z){var F=At(this);Aj(F,n,Z);Bv(this,F)}ZG(this,"next")}else o2(this,g.je(this.nextVideo,n,Z))}; g.Q.NZ=function(){if(Tq(this)){ZG(this,"clearPlaylist");var n=At(this);n.reset();Bv(this,n);this.publish("remotePlayerChange")}else o2(this,this.NZ)}; g.Q.IF=function(){Tq(this)?ZG(this,"dismissAutoplay"):o2(this,this.IF)}; g.Q.dispose=function(){if(this.T!=3){var n=this.T;this.T=3;this.publish("proxyStateChange",n,this.T)}g.Xu.prototype.dispose.call(this)}; g.Q.IY=function(){uHd(this);this.V=null;this.S.clear();Hj(this,null);g.Xu.prototype.IY.call(this)}; g.Q.B8=function(n){if((n!=this.T||n==2)&&this.T!=3&&n!=0){var Z=this.T;this.T=n;this.publish("proxyStateChange",Z,n);if(n==1)for(;!this.S.isEmpty();)Z=n=this.S,Z.N.length===0&&(Z.N=Z.X,Z.N.reverse(),Z.X=[]),n.N.pop().apply(this);else n==3&&this.dispose()}}; g.Q.qwR=function(n,Z){this.publish(n,Z)}; g.Q.VO5=function(n){if(!n)this.jw(null),Hj(this,null);else if(this.X.receiver.volume){n=this.X.receiver.volume;var Z=At(this),F=Math.round(100*n.level||0);if(Z.volume!=F||Z.muted!=n.muted)dO("Cast volume update: "+n.level+(n.muted?" muted":"")),Z.volume=F,Z.muted=!!n.muted,Bv(this,Z)}}; g.Q.jw=function(n){dO("Cast media: "+!!n);this.N&&this.N.removeUpdateListener(this.L);if(this.N=n)this.N.addUpdateListener(this.L),b5h(this),this.publish("remotePlayerChange")}; g.Q.wVr=function(n){n?(b5h(this),this.publish("remotePlayerChange")):this.jw(null)}; g.Q.kT=function(){ZG(this,"sendDebugCommand",{debugCommand:"stats4nerds "})}; g.Q.iJY=function(){var n=iMO();n&&Hj(this,n)}; g.Q.QG=function(n){KA("CP",n)};g.d(CA,g.Xu);g.Q=CA.prototype; g.Q.connect=function(n,Z){if(Z){var F=Z.listId,y=Z.videoId,l=Z.videoIds,m=Z.playerParams,a=Z.clickTrackingParams,D=Z.index,p={videoId:y},L=Z.currentTime,q=Z.locationInfo;Z=Z.loopMode;L!==void 0&&(p.currentTime=L<=5?0:L);m&&(p.playerParams=m);q&&(p.locationInfo=q);a&&(p.clickTrackingParams=a);F&&(p.listId=F);l&&l.length>0&&(p.videoIds=l.join(","));D!==void 0&&(p.currentIndex=D);this.lY&&(p.loopMode=Z||"LOOP_MODE_OFF");F&&(this.N.listId=F);this.N.videoId=y;this.N.index=D||0;this.N.state=3;pA(this.N, L);this.S="UNSUPPORTED";F=this.lY?"setInitialState":"setPlaylist";Uz("Connecting with "+F+" and params: "+g.tQ(p));this.X.connect({method:F,params:g.tQ(p)},n,ynU())}else Uz("Connecting without params"),this.X.connect({},n,ynU());ZGx(this)}; g.Q.hL=function(n){this.X.hL(n)}; g.Q.dispose=function(){this.CR()||(g.pv("yt.mdx.remote.remoteClient_",null),this.publish("beforeDispose"),io(this,3));g.Xu.prototype.dispose.call(this)}; g.Q.IY=function(){mhG(this);hMG(this);HWh(this);g.l0(this.L);this.L=NaN;g.l0(this.Pr);this.Pr=NaN;this.V=null;g.nL(this.Ns);this.Ns.length=0;this.X.dispose();g.Xu.prototype.IY.call(this);this.S=this.J=this.T=this.N=this.X=null}; g.Q.I8=function(n){if(!this.T||this.T.length===0)return!1;for(var Z=g.Y(this.T),F=Z.next();!F.done;F=Z.next())if(!F.value.capabilities.has(n))return!1;return!0}; g.Q.yZ=function(){var n=3;this.CR()||(n=0,isNaN(this.Fs())?this.X.bE()&&isNaN(this.C)&&(n=1):n=2);return n}; g.Q.hc=function(n){Uz("Disconnecting with "+n);g.pv("yt.mdx.remote.remoteClient_",null);mhG(this);this.publish("beforeDisconnect",n);n==1&&gO();this.X.disconnect(n);this.dispose()}; g.Q.eh=function(){var n=this.N;this.V&&(n=this.N.clone(),Aj(n,this.V,n.index));return R57(n)}; g.Q.uHu=function(n){var Z=this,F=new RE(n);F.videoId&&F.videoId!=this.N.videoId&&(this.V=F.videoId,g.l0(this.L),this.L=g.A3(function(){if(Z.V){var l=Z.V;Z.V=null;Z.N.videoId!=l&&am(Z,"getNowPlaying")}},5E3)); var y=[];this.N.listId==F.listId&&this.N.videoId==F.videoId&&this.N.index==F.index||y.push("remoteQueueChange");this.N.playerState==F.playerState&&this.N.volume==F.volume&&this.N.muted==F.muted&&DP(this.N)==DP(F)&&g.tQ(this.N.trackData)==g.tQ(F.trackData)||y.push("remotePlayerChange");this.N.reset(n);g.I5(y,function(l){this.publish(l)},this)}; g.Q.Im=function(){var n=this.X.getDeviceId(),Z=g.YW(this.T,function(F){return F.type=="REMOTE_CONTROL"&&F.id!=n}); return Z?Z.id:""}; g.Q.Fs=function(){return this.X.PM()}; g.Q.E2=function(){return this.S||"UNSUPPORTED"}; g.Q.ID=function(){return this.J||""}; g.Q.zI=function(){!isNaN(this.Fs())&&this.X.zA()}; g.Q.bFg=function(n,Z){am(this,n,Z);dJh(this)}; g.Q.PN=function(){var n=g.qs("SAPISID","")||g.qs("__Secure-1PAPISID")||"",Z=g.qs("__Secure-3PAPISID","")||"";if(!n&&!Z)return"";n=g.Ee(g.xc(n),2);Z=g.Ee(g.xc(Z),2);return g.Ee(g.xc(","+n+","+Z),2)}; CA.prototype.subscribe=CA.prototype.subscribe;CA.prototype.unsubscribeByKey=CA.prototype.ez;CA.prototype.getProxyState=CA.prototype.yZ;CA.prototype.disconnect=CA.prototype.hc;CA.prototype.getPlayerContextData=CA.prototype.eh;CA.prototype.setPlayerContextData=CA.prototype.uHu;CA.prototype.getOtherConnectedRemoteId=CA.prototype.Im;CA.prototype.getReconnectTimeout=CA.prototype.Fs;CA.prototype.getAutoplayMode=CA.prototype.E2;CA.prototype.getAutoplayVideoId=CA.prototype.ID;CA.prototype.reconnect=CA.prototype.zI; CA.prototype.sendMessage=CA.prototype.bFg;CA.prototype.getXsrfToken=CA.prototype.PN;CA.prototype.isCapabilitySupportedOnConnectedDevices=CA.prototype.I8;g.d(Ifh,e2);g.Q=Ifh.prototype;g.Q.M2=function(n){return this.qb.$_gs(n)}; g.Q.contains=function(n){return!!this.qb.$_c(n)}; g.Q.get=function(n){return this.qb.$_g(n)}; g.Q.start=function(){this.qb.$_st()}; g.Q.add=function(n,Z,F){this.qb.$_a(n,Z,F)}; g.Q.remove=function(n,Z,F){this.qb.$_r(n,Z,F)}; g.Q.R1=function(n,Z,F,y){this.qb.$_un(n,Z,F,y)}; g.Q.IY=function(){for(var n=this.N.length,Z=0;Z1&&!this.W.getOption("remote","quickCast")?(this.UH=g.hh(n,this.N,this),this.fK(g.Yn(n,this.N)),n=this.W.getOption("remote","currentReceiver"),n=this.N(n),this.options[n]&&this.gB(n),this.enable(!0)):this.enable(!1)}; uN.prototype.N=function(n){return n.key}; uN.prototype.R7=function(n){return n==="cast-selector-receiver"?"Cast...":this.UH[n].name}; uN.prototype.LN=function(n){g.$K.prototype.LN.call(this,n);this.W.setOption("remote","currentReceiver",this.UH[n]);this.Fp.jG()};g.d(mOh,g.J0);g.Q=mOh.prototype; g.Q.create=function(){var n=this.player.B(),Z=g.ri(n);n={device:"Desktop",app:"youtube-desktop",loadCastApiSetupScript:n.j("mdx_load_cast_api_bootstrap_script"),enableDialLoungeToken:n.j("enable_dial_short_lived_lounge_token"),enableCastLoungeToken:n.j("enable_cast_short_lived_lounge_token")};NQg(Z,n);this.subscriptions.push(g.ny("yt-remote-before-disconnect",this.XV4,this));this.subscriptions.push(g.ny("yt-remote-connection-change",this.PP4,this));this.subscriptions.push(g.ny("yt-remote-receiver-availability-change",this.Qn, this));this.subscriptions.push(g.ny("yt-remote-auto-connect",this.FCs,this));this.subscriptions.push(g.ny("yt-remote-receiver-resumed",this.QXQ,this));this.subscriptions.push(g.ny("mdx-privacy-popup-confirm",this.exY,this));this.subscriptions.push(g.ny("mdx-privacy-popup-cancel",this.rXY,this));this.Qn()}; g.Q.load=function(){this.player.cancelPlayback();g.J0.prototype.load.call(this);this.qh=new rRg(this.player.B(),this);this.player.Z_(this.qh);this.ul=new Yeg(this,this.player,this.xV);var n=(n=Mmv())?n.currentTime:0;var Z=tAv()?new a2($_(),void 0):null;n==0&&Z&&(n=DP(At(Z)));n!==0&&this.jO(n);Qxd(this,this.gV,this.gV);this.player.D6(6)}; g.Q.unload=function(){this.player.publish("mdxautoplaycanceled");this.player.zP();this.H4=this.kN;g.rk(this.ul,this.xV);this.xV=this.qh=this.ul=null;g.J0.prototype.unload.call(this);this.player.D6(5);Mf(this)}; g.Q.IY=function(){g.Sv(this.subscriptions);g.J0.prototype.IY.call(this)}; g.Q.MP=function(n){var Z=g.S7.apply(1,arguments);this.loaded&&this.ul.Te.apply(this.ul,[n].concat(g.t(Z)))}; g.Q.getAdState=function(){return this.Bj}; g.Q.hasPrevious=function(){return this.xV?At(this.xV).hasPrevious:!1}; g.Q.hasNext=function(){return this.xV?At(this.xV).hasNext:!1}; g.Q.jO=function(n,Z){this.jt=n||0;this.player.publish("progresssync",n,Z);this.player.Qm("onVideoProgress",n||0)}; g.Q.getCurrentTime=function(){return this.jt}; g.Q.getDuration=function(){return At(this.xV).getDuration()||0}; g.Q.Xh=function(){var n=At(this.xV);return n.V?n.N+qR(n):n.N}; g.Q.fP=function(){return At(this.xV).loadedTime}; g.Q.zc=function(){return y3U(At(this.xV))}; g.Q.xL=function(){var n=At(this.xV);return n.X>0?n.X+qR(n):n.X}; g.Q.getProgressState=function(){var n=At(this.xV),Z=this.player.getVideoData();return{airingStart:0,airingEnd:0,allowSeeking:n.playerState!=1081&&this.player.aH(),clipEnd:Z.clipEnd,clipStart:Z.clipStart,current:this.getCurrentTime(),displayedStart:-1,duration:this.getDuration(),ingestionTime:this.Xh(),isAtLiveHead:this.isAtLiveHead(),loaded:this.fP(),seekableEnd:this.zc(),seekableStart:this.xL(),offset:0,viewerLivestreamJoinMediaTime:0}}; g.Q.isAtLiveHead=function(){return y3U(At(this.xV))-this.getCurrentTime()<=1}; g.Q.nextVideo=function(){this.xV&&this.xV.nextVideo()}; g.Q.rU=function(){this.xV&&this.xV.rU()}; g.Q.XV4=function(n){n===1&&(this.xv=this.xV?At(this.xV):null)}; g.Q.PP4=function(){var n=tAv()?new a2($_(),void 0):null;if(n){var Z=this.H4;this.loaded&&this.unload();this.xV=n;this.xv=null;Z.key!==this.kN.key&&(this.H4=Z,this.load())}else g.xA(this.xV),this.xV=null,this.loaded&&(this.unload(),(n=this.xv)&&n.videoId===this.player.getVideoData().videoId&&this.player.cueVideoById(n.videoId,DP(n)));this.player.publish("videodatachange","newdata",this.player.getVideoData(),3)}; g.Q.Qn=function(){var n=[this.kN],Z=n.concat,F=Nov();sW()&&g.z5("yt-remote-cast-available")&&F.push({key:"cast-selector-receiver",name:"Cast..."});this.UH=Z.call(n,F);n=ydc()||this.kN;hj(this,n);this.player.Qm("onMdxReceiversChange")}; g.Q.FCs=function(){var n=ydc();hj(this,n)}; g.Q.QXQ=function(){this.H4=ydc()}; g.Q.exY=function(){this.xa=!0;Mf(this);nA=!1;Q$&&S6(Q$,1);Q$=null}; g.Q.rXY=function(){this.xa=!1;Mf(this);hj(this,this.kN);this.H4=this.kN;nA=!1;Q$=null;this.player.playVideo()}; g.Q.G5=function(n,Z){switch(n){case "casting":return this.loaded;case "receivers":return this.UH;case "currentReceiver":return Z&&(Z.key==="cast-selector-receiver"?I2x():hj(this,Z)),this.loaded?this.H4:this.kN;case "quickCast":return this.UH.length===2&&this.UH[1].key==="cast-selector-receiver"?(Z&&I2x(),!0):!1}}; g.Q.kT=function(){this.xV.kT()}; g.Q.D1=function(){return!1}; g.Q.getOptions=function(){return["casting","receivers","currentReceiver","quickCast"]}; g.Q.isLoggedIn=function(){var n,Z;return((n=g.BT("PLAYER_CONFIG"))==null?void 0:(Z=n.args)==null?void 0:Z.authuser)!==void 0?!0:!(!g.BT("SESSION_INDEX")&&!g.BT("LOGGED_IN"))};g.hQ("remote",mOh);})(_yt_player);