(function(g){var window=this;'use strict';var rXb=function(d,L){return g.$w(d,L)},klV=function(d){if(d instanceof g.CB)return d; if(typeof d.mL=="function")return d.mL(!1);if(g.pn(d)){let L=0;const I=new g.CB;I.next=function(){for(;;){if(L>=d.length)return g.Jm;if(L in d)return g.$$(d[L++]);L++}}; return I}throw Error("Not implemented");},KB9=function(d,L,I){if(g.pn(d))g.ld(d,L,I); else for(d=klV(d);;){const {done:v,value:F}=d.next();if(v)break;L.call(I,F,void 0,d)}},FA=function(d){g.nt(d,"zx",Math.floor(Math.random()*2147483648).toString(36)+Math.abs(Math.floor(Math.random()*2147483648)^g.E$()).toString(36)); return d},RI=function(d,L,I){Array.isArray(I)||(I=[String(I)]); g.kI(d.N,L,I)},em$=function(d,L){const I=[]; KB9(L,function(v){let F;try{F=g.NU.prototype.yy.call(this,v,!0)}catch(R){if(R=="Storage: Invalid value was encountered")return;throw R;}F===void 0?I.push(v):g.ZL(F)&&I.push(v)},d); return I},WB$=function(d,L){em$(d,L).forEach(function(I){g.NU.prototype.remove.call(this,I)},d)},aU9=function(d){if(d.Wx){if(d.Wx.locationOverrideToken)return{locationOverrideToken:d.Wx.locationOverrideToken}; if(d.Wx.latitudeE7!=null&&d.Wx.longitudeE7!=null)return{latitudeE7:d.Wx.latitudeE7,longitudeE7:d.Wx.longitudeE7}}return null},BL1=function(d,L){g.L8(d,L)||d.push(L)},D3=function(d){let L=0; for(const I in d)L++;return L},jv9=function(d){try{return g.er.JSON.parse(d)}catch(L){}d=String(d); if(/^\s*$/.test(d)?0:/^[\],:{}\s\u2028\u2029]*$/.test(d.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("("+d+")")}catch(L){}throw Error("Invalid JSON string: "+d);},Ot=function(d){if(g.er.JSON)try{return g.er.JSON.parse(d)}catch(L){}return jv9(d)},td$=function(d,L,I,v){const F=new g.ZH(null); d&&g.Fx(F,d);L&&g.Nx(F,L);I&&g.R7(F,I);v&&(F.W=v);return F},AXL=function(d,L){return new g.d$7(d,L)},ba=function(d,L){return Object.prototype.hasOwnProperty.call(d,L)},pKj=function(d,L){return d===L},Hj=function(d,L){this.W={}; this.O=[];this.tA=this.size=0;var I=arguments.length;if(I>1){if(I%2)throw Error("Uneven number of arguments");for(var v=0;v{d.capabilities.add(I)})},Gl8=function(d,L){d.compatibleSenderThemes.clear(); g.ZN(L.split(","),g.zF(rXb,zmj)).forEach(I=>{d.compatibleSenderThemes.add(I)})},uS8=function(d,L){d.experiments.clear(); L.split(",").forEach(I=>{d.experiments.add(I)})},yz=function(d){d=d||{}; this.name=d.name||"";this.id=d.id||d.screenId||"";this.token=d.token||d.loungeToken||"";this.uuid=d.uuid||d.dialId||"";this.idType=d.screenIdType||"normal";this.secret=d.screenIdSecret||""},r8=function(d,L){return!!L&&(d.id==L||d.uuid==L)},Eh9=function(d){return{name:d.name, screenId:d.id,loungeToken:d.token,dialId:d.uuid,screenIdType:d.idType,screenIdSecret:d.secret}},hm$=function(d){return new yz(d)},wK$=function(d){return Array.isArray(d)?g.N7(d,hm$):[]},kM=function(d){return d?`{name:"${d.name}",id:${d.id.substr(0,6)}..,token:${d.token?".."+d.token.slice(-6):"-"},uuid:${d.uuid?".."+d.uuid.slice(-6):"-"},idType:${d.idType},secret:${d.secret?".."+d.secret.slice(-6):"-"}}`:"null"},K3=function(d){return Array.isArray(d)?"["+g.N7(d,kM).join(",")+"]":"null"},e9=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function(d){const L=Math.random()*16|0; return(d=="x"?L:L&3|8).toString(16)})},JX$=function(d){return g.N7(d,function(L){return{key:L.id, name:L.name}})},Wj=function(d,L){return g.g$(d,function(I){return I||L?!I!=!L?!1:I.id==L.id:!0})},aI=function(d,L){return g.g$(d,function(I){return r8(I,L)})},CWc=function(){const d=g.OI.Iv(); d&&WB$(d,d.Lc.mL(!0))},Bj=function(){const d=g.HR("yt-remote-connected-devices")||[]; g.tc(d);return d},iY1=function(d){if(d.length==0)return[]; const L=d[0].indexOf("#"),I=L==-1?d[0]:d[0].substring(0,L);return g.N7(d,function(v,F){return F==0?v:v.substring(I.length)})},$qU=function(d){g.bq("yt-remote-connected-devices",d,86400)},ts=function(){if(j9)return j9; let d=g.HR("yt-remote-device-id");d||(d=e9(),g.bq("yt-remote-device-id",d,31536E3));const L=Bj();let I=1,v=d;for(;g.L8(L,v);)I++,v=d+"#"+I;return j9=v},As=function(){let d=Bj(); const L=ts();g.ow()&&g.p8(d,L);d=iY1(d);if(d.length==0)try{g.Kq("remote_sid")}catch(I){}else try{g.rM("remote_sid",d.join(","),-1)}catch(I){}},xqc=function(){return g.HR("yt-remote-session-browser-channel")},YX9=function(){return g.HR("yt-remote-local-screens")||[]},SXn=function(){g.bq("yt-remote-lounge-token-expiration",!0,86400)},Uqc=function(d){d.length>5&&(d=d.slice(d.length-5)); const L=g.N7(YX9(),function(v){return v.loungeToken}),I=g.N7(d,function(v){return v.loungeToken}); g.VS(I,function(v){return!g.L8(L,v)})&&SXn(); g.bq("yt-remote-local-screens",d,31536E3)},p3=function(d){d||(g.nX("yt-remote-session-screen-id"),g.nX("yt-remote-session-video-id")); As();d=Bj();g.DH(d,ts());$qU(d)},svw=function(){if(!Pj){const d=g.gI(); d&&(Pj=new g.SR(d))}},qX$=function(){svw(); return Pj?!!Pj.get("yt-remote-use-staging-server"):!1},GL=function(d,L){g.OE[d]=!0; const I=g.R$();I&&I.publish.apply(I,arguments);g.OE[d]=!1},ua=function(){let d=window.navigator.userAgent.match(/Chrome\/([0-9]+)/); return d?parseInt(d[1],10):0},lUj=function(d){return!!document.currentScript&&(document.currentScript.src.indexOf("?"+d)!=-1||document.currentScript.src.indexOf("&"+d)!=-1)},ZYb=function(){return typeof window.__onGCastApiAvailable=="function"?window.__onGCastApiAvailable:null},mq=function(d){d.length?NL8(d.shift(),function(){mq(d)}):zL()},zL=function(){let d=ZYb(); d&&d(!1,"No cast extension found")},NL8=function(d,L,I){let v=document.createElement("script"); v.onerror=L;I&&(v.onload=I);g.IL(v,g.y4(d));(document.head||document.documentElement).appendChild(v)},Md$=function(d){return"chrome-extension://"+d+"/cast_sender.js"},Qvc=function(){const d=ua(),L=[]; if(d>1){const I=d-1;L.push("//www.gstatic.com/eureka/clank/"+d+"/cast_sender.js");L.push("//www.gstatic.com/eureka/clank/"+I+"/cast_sender.js")}return L},Et=function(){if(cXb){var d=2,L=ZYb(),I=function(){d--; d==0&&L&&L(!0)}; window.__onGCastApiAvailable=I;NL8("//www.gstatic.com/cast/sdk/libs/sender/1.0/cast_framework.js",zL,I)}},Vd8=function(){Et(); let d=Qvc();d.push("//www.gstatic.com/eureka/clank/cast_sender.js");mq(d)},TLn=function(){Et(); let d=Qvc();d.push(...fUV.map(Md$));d.push("//www.gstatic.com/eureka/clank/cast_sender.js");mq(d)},hs=function(d,L,I){g.IJ.call(this); this.K=I!=null?(0,g.m7)(d,I):d;this.O3=L;this.L=(0,g.m7)(this.AE,this);this.O=!1;this.W=0;this.G=this.qh=null;this.N=[]},w8=function(){this.O=g.E$()},gh1=function(){Js||(Js=new w8)},XKw=function(){Js||(Js=new w8)},C3=function(){g.j2.call(this,"p")},ia=function(){g.j2.call(this,"o")},$M=function(){return d8c=d8c||new g.sz},LGH=function(d){g.j2.call(this,"serverreachability",d)},xM=function(d){const L=$M(); L.dispatchEvent(new LGH(L,d))},IRH=function(d){g.j2.call(this,"statevent",d)},YM=function(d){const L=$M(); L.dispatchEvent(new IRH(L,d))},v$Q=function(d,L,I,v){g.j2.call(this,"timingevent",d); this.size=L;this.rtt=I;this.retries=v},S9=function(d,L){if(typeof d!=="function")throw Error("Fn must not be null and must be a function"); return g.er.setTimeout(function(){d()},L)},Ut=function(){},qu=function(d,L,I,v){this.G=d; this.N=L;this.Px=I;this.Wx=v||1;this.IL=new g.W0(this);this.By=45E3;this.Sj=null;this.K=!1;this.U=this.K1=this.j=this.tU=this.Wy=this.jj=this.md=null;this.Z=[];this.O=null;this.B=0;this.L=this.N0=null;this.q0=-1;this.L1=!1;this.M0=0;this.aL=null;this.ej=this.bU=this.ZH=this.sU=!1;this.W=new FGL},FGL=function(){this.G=null; this.O="";this.W=!1},la=function(d,L,I){d.tU=1; d.j=FA(L.clone());d.U=I;d.sU=!0;RZQ(d,null)},RZQ=function(d,L){d.Wy=Date.now(); Z3(d);d.K1=d.j.clone();RI(d.K1,"t",d.Wx);d.B=0;const I=d.G.bU;d.W=new FGL;d.O=D8w(d.G,I?L:null,!d.U);d.M0>0&&(d.aL=new g.dB((0,g.m7)(d.mE,d,d.O),d.M0));d.IL.listen(d.O,"readystatechange",d.VK);L=d.Sj?g.TV(d.Sj):{};d.U?(d.N0||(d.N0="POST"),L["Content-Type"]="application/x-www-form-urlencoded",d.O.send(d.K1,d.N0,d.U,L)):(d.N0="GET",d.O.send(d.K1,d.N0,null,L));xM(1)},bBL=function(d){if(!OB9(d))return g.ce(d.O); const L=g.Vi(d.O);if(L==="")return"";let I="";const v=L.length,F=g.Nc(d.O)==4;if(!d.W.G){if(typeof TextDecoder==="undefined")return Nu(d),Mu(d),"";d.W.G=new g.er.TextDecoder}for(let R=0;RL.length)return Qz;L=L.slice(v,v+I);d.B=v+I;return L},Z3=function(d){d.jj=Date.now()+d.By; o$U(d,d.By)},o$U=function(d,L){if(d.md!=null)throw Error("WatchDog timer not null"); d.md=S9((0,g.m7)(d.D9,d),L)},cj=function(d){d.md&&(g.er.clearTimeout(d.md),d.md=null)},Mu=function(d){d.G.Ib()||d.L1||yNU(d.G,d)},Nu=function(d){cj(d); g.dr(d.aL);d.aL=null;d.IL.removeAll();if(d.O){const L=d.O;d.O=null;L.abort();L.dispose()}},vo=function(d,L){try{var I=d.G; if(I.oK!=0&&(I.O==d||Vz(I.W,d)))if(!d.bU&&Vz(I.W,d)&&I.oK==3){try{var v=I.le.O.parse(L)}catch(H){v=null}if(Array.isArray(v)&&v.length==3){var F=v;if(F[0]==0)a:{if(!I.j){if(I.O)if(I.O.Wy+3E30&&(I.M0=1.5*r);v=I;const k=d.Df();if(k){const W=g.TJ(k,"X-Client-Wire-Protocol");if(W){var R=v.W;!R.O&&(g.HZ(W,"spdy")||g.HZ(W,"quic")||g.HZ(W,"h2"))&&(R.N=R.L,R.O=new Set,R.W&&(L5(R,R.W),R.W=null))}if(v.sU){const P=g.TJ(k,"X-HTTP-Session-Id");P&&(v.v5=P,g.nt(v.Sj,v.sU,P))}}I.oK=3;I.L&&I.L.E2();I.YF&&(I.TO=Date.now()-d.Wy);v=I;var D=d;v.Zu=rNL(v,v.bU? v.Px:null,v.CX);if(D.bU){kAj(v.W,D);var O=D,b=v.M0;b&&O.setTimeout(b);O.md&&(cj(O),Z3(O));v.O=D}else KG8(v);I.G.length>0&&Ig(I)}else H[0]!="stop"&&H[0]!="close"||dx(I,7);else I.oK==3&&(H[0]=="stop"||H[0]=="close"?H[0]=="stop"?dx(I,7):I.disconnect():H[0]!="noop"&&I.L&&I.L.s2(H),I.Z=0)}xM(4)}catch(H){}},eZ8=function(d){this.L=d||10; g.er.PerformanceNavigationTiming?(d=g.er.performance.getEntriesByType("navigation"),d=d.length>0&&(d[0].nextHopProtocol=="hq"||d[0].nextHopProtocol=="h2")):d=!!(g.er.chrome&&g.er.chrome.loadTimes&&g.er.chrome.loadTimes()&&g.er.chrome.loadTimes().wasFetchedViaSpdy);this.N=d?this.L:1;this.O=null;this.N>1&&(this.O=new Set);this.W=null;this.G=[]},WGc=function(d){return d.W?!0:d.O?d.O.size>=d.N:!1},XA=function(d){return d.W?1:d.O?d.O.size:0},Vz=function(d,L){return d.W?d.W==L:d.O?d.O.has(L):!1},L5=function(d, L){d.O?d.O.add(L):d.W=L},kAj=function(d,L){d.W&&d.W==L?d.W=null:d.O&&d.O.has(L)&&d.O.delete(L)},FY=function(d){if(d.W!=null)return d.G.concat(d.W.Z); if(d.O!=null&&d.O.size!==0){let L=d.G;for(const I of d.O.values())L=L.concat(I.Z);return L}return g.H1(d.G)},aR$=function(d,L){const I=new Ut; if(g.er.Image){const v=new Image;v.onload=g.zF(Rg,I,"TestLoadImage: loaded",!0,L,v);v.onerror=g.zF(Rg,I,"TestLoadImage: error",!1,L,v);v.onabort=g.zF(Rg,I,"TestLoadImage: abort",!1,L,v);v.ontimeout=g.zF(Rg,I,"TestLoadImage: timeout",!1,L,v);g.er.setTimeout(function(){if(v.ontimeout)v.ontimeout()},1E4); v.src=d}else L(!1)},BrQ=function(d,L){const I=new Ut,v=new AbortController,F=setTimeout(()=>{v.abort(); Rg(I,"TestPingServer: timeout",!1,L)},1E4); fetch(d,{signal:v.signal}).then(R=>{clearTimeout(F);R.ok?Rg(I,"TestPingServer: ok",!0,L):Rg(I,"TestPingServer: server error",!1,L)}).catch(()=>{clearTimeout(F); Rg(I,"TestPingServer: error",!1,L)})},Rg=function(d,L,I,v,F){try{F&&(F.onload=null,F.onerror=null,F.onabort=null,F.ontimeout=null),v(I)}catch(R){}},jJ1=function(){this.O=new D6},Oj=function(d,L,I){return I&&I.s0?I.s0[d]||L:L},tJ$=function(d){this.G=[]; this.Px=this.Zu=this.Sj=this.CX=this.O=this.v5=this.sU=this.L1=this.B=this.ZH=this.U=null;this.XI=this.K1=0;this.hj=Oj("failFast",!1,d);this.aL=this.md=this.j=this.K=this.L=null;this.Sl=!0;this.Rd=this.tU=-1;this.Wx=this.Z=this.Wy=0;this.OE=Oj("baseRetryDelayMs",5E3,d);this.zC=Oj("retryDelaySeedMs",1E4,d);this.fU=Oj("forwardChannelMaxRetries",2,d);this.La=Oj("forwardChannelRequestTimeoutMs",2E4,d);this.Xo=d&&d.XS2||void 0;this.ye=d&&d.nPj||void 0;this.Yv=d&&d.ca1||!1;this.M0=void 0;this.bU=d&&d.y9|| !1;this.N="";this.W=new eZ8(d&&d.DhU);this.qv=Math.min(d&&d.Pva||1E3,1E3);this.le=new jJ1;this.IL=d&&d.QMj||!1;this.jj=d&&d.mBS||!1;this.IL&&this.jj&&(this.jj=!1);this.OH=d&&d.kTS||!1;d&&d.riS&&(this.Sl=!1);this.YF=!this.IL&&this.Sl&&d&&d.HUU||!1;this.Du=void 0;d&&d.Ix&&d.Ix>0&&(this.Du=d.Ix);this.q0=void 0;this.TO=0;this.By=!1;this.ej=this.N0=null},TL=function(d){d.O&&(bi(d),d.O.cancel(),d.O=null)},ANb=function(d){TL(d); d.j&&(g.er.clearTimeout(d.j),d.j=null);f3(d);d.W.cancel();d.K&&(typeof d.K==="number"&&g.er.clearTimeout(d.K),d.K=null)},Ig=function(d){WGc(d.W)||d.K||(d.K=!0,g.ve(d.PO,d),d.Wy=0)},Pt$=function(d,L){if(XA(d.W)>=d.W.N-(d.K?1:0))return!1; if(d.K)return d.G=L.Z.concat(d.G),!0;if(d.oK==1||d.oK==2||d.Wy>=(d.hj?0:d.fU))return!1;d.K=S9((0,g.m7)(d.PO,d,L),pA8(d,d.Wy));d.Wy++;return!0},unU=function(d,L){var I; L?I=L.Px:I=d.K1++;const v=d.Sj.clone();g.nt(v,"SID",d.N);g.nt(v,"RID",I);g.nt(v,"AID",d.tU);Ho(d,v);d.B&&d.U&&g.eM(v,d.B,d.U);I=new qu(d,d.N,I,d.Wy+1);d.B===null&&(I.Sj=d.U);L&&(d.G=L.Z.concat(d.G));L=GA$(d,I,d.qv);I.setTimeout(Math.round(d.La*.5)+Math.round(d.La*.5*Math.random()));L5(d.W,I);la(I,v,L)},Ho=function(d,L){d.L1&&g.GV(d.L1,function(I,v){g.nt(L,v,I)}); d.L&&g.GV({},function(I,v){g.nt(L,v,I)})},GA$=function(d,L,I){I=Math.min(d.G.length,I); const v=d.L?(0,g.m7)(d.L.I_,d.L,d):null;a:{var F=d.G;let O=-1;for(;;){const b=["count="+I];O==-1?I>0?(O=F[0].O,b.push("ofs="+O)):O=0:b.push("ofs="+O);let H=!0;for(let n=0;n=3)return!1; d.Wx++;d.j=S9((0,g.m7)(d.Nj,d),pA8(d,d.Z));d.Z++;return!0},bi=function(d){d.N0!=null&&(g.er.clearTimeout(d.N0),d.N0=null)},m88=function(d){d.O=new qu(d,d.N,"rpc",d.Wx); d.B===null&&(d.O.Sj=d.U);d.O.M0=0;var L=d.Zu.clone();g.nt(L,"RID","rpc");g.nt(L,"SID",d.N);g.nt(L,"AID",d.tU);g.nt(L,"CI",d.aL?"0":"1");!d.aL&&d.Du&&g.nt(L,"TO",d.Du);g.nt(L,"TYPE","xmlhttp");Ho(d,L);d.B&&d.U&&g.eM(L,d.B,d.U);d.M0&&d.O.setTimeout(d.M0);var I=d.O;d=d.Px;I.tU=1;I.j=FA(L.clone());I.U=null;I.sU=!0;RZQ(I,d)},f3=function(d){d.md!=null&&(g.er.clearTimeout(d.md),d.md=null)},yNU=function(d,L){var I=null; if(d.O==L){f3(d);bi(d);d.O=null;var v=2}else if(Vz(d.W,L))I=L.Z,kAj(d.W,L),v=1;else return;if(d.oK!=0)if(L.K)if(v==1){I=L.U?L.U.length:0;L=Date.now()-L.Wy;var F=d.Wy;v=$M();v.dispatchEvent(new v$Q(v,I,L,F));Ig(d)}else KG8(d);else{var R=L.q0;F=L.getLastError();if(F==3||F==0&&R>0||!(v==1&&Pt$(d,L)||v==2&&g8(d)))switch(I&&I.length>0&&(L=d.W,L.G=L.G.concat(I)),F){case 1:dx(d,5);break;case 4:dx(d,10);break;case 3:dx(d,6);break;default:dx(d,2)}}},pA8=function(d,L){let I=d.OE+Math.floor(Math.random()*d.zC); d.isActive()||(I*=2);return I*L},dx=function(d,L){if(L==2){var I=(0,g.m7)(d.L_,d),v=d.ye; const F=!v;v=new g.ZH(v||"//www.google.com/images/cleardot.gif");g.er.location&&g.er.location.protocol=="http"||g.Fx(v,"https");FA(v);F?aR$(v.toString(),I):BrQ(v.toString(),I)}else YM(2);d.oK=0;d.L&&d.L.Fy(L);zZ$(d);ANb(d)},zZ$=function(d){d.oK=0; d.ej=[];if(d.L){const L=FY(d.W);if(L.length!=0||d.G.length!=0)g.n8(d.ej,L),g.n8(d.ej,d.G),d.W.G.length=0,g.H1(d.G),d.G.length=0;d.L.yE()}},E$9=function(d){if(d.oK==0)return d.ej; let L=[];g.n8(L,FY(d.W));g.n8(L,d.G);return L},rNL=function(d,L,I){var v=g.Z0(I); v.O!=""?(L&&g.Nx(v,L+"."+v.O),g.R7(v,v.G)):(v=g.er.location,v=td$(v.protocol,L?L+"."+v.hostname:v.hostname,+v.port,I));L=d.sU;I=d.v5;L&&I&&g.nt(v,L,I);g.nt(v,"VER",d.GX);Ho(d,v);return v},D8w=function(d,L,I){if(L&&!d.bU)throw Error("Can't create secondary domain capable XhrIo object."); L=d.Yv&&!d.Xo?new g.SP(new g.XN({yL:I})):new g.SP(d.Xo);L.B=d.bU;return L},hZj=function(){},wAx=function(){},og=function(d,L){g.sz.call(this); this.O=new tJ$(L);this.K=d;this.W=L&&L.U0||null;d=L&&L.q2||null;L&&L.Aja&&(d?d["X-Client-Protocol"]="webchannel":d={"X-Client-Protocol":"webchannel"});this.O.U=d;d=L&&L.D_U||null;L&&L.Oj&&(d?d["X-WebChannel-Content-Type"]=L.Oj:d={"X-WebChannel-Content-Type":L.Oj});L&&L.wg&&(d?d["X-WebChannel-Client-Profile"]=L.wg:d={"X-WebChannel-Client-Profile":L.wg});this.O.ZH=d;(d=L&&L.jN1)&&!g.bm(d)&&(this.O.B=d);this.B=L&&L.y9||!1;this.L=L&&L.inU||!1;(L=L&&L.Gs)&&!g.bm(L)&&(this.O.sU=L,g.iL(this.W,L)&&(d=this.W, L in d&&delete d[L]));this.G=new n5(this)},JNL=function(d){C3.call(this); d.__headers__&&(this.headers=d.__headers__,this.statusCode=d.__status__,delete d.__headers__,delete d.__status__);const L=d.__sm__;L?this.data=(this.O=g.hc(L))?g.qx(L,this.O):L:this.data=d},Ct$=function(d){ia.call(this); this.status=1;this.errorCode=d},n5=function(d){this.O=d},yr=function(d,L){this.N=d; this.O=L},rx=function(d,L){if(typeof d!=="function")throw Error("Fn must not be null and must be a function"); return g.er.setTimeout(function(){d()},L)},K5=function(){kB.dispatchEvent(new iB$)},e1=function(d,L,I,v){this.O=d; this.N=L;this.B=I;this.K=v||1;this.W=45E3;this.G=new g.W0(this);this.L=new g.ax;this.L.setInterval(250)},x8$=function(d,L,I){d.r3=1; d.xb=FA(L.clone());d.cW=I;d.sU=!0;$8L(d,null)},Wo=function(d,L,I,v,F){d.r3=1; d.xb=FA(L.clone());d.cW=null;d.sU=I;F&&(d.B_=!1);$8L(d,v)},$8L=function(d,L){d.bC=Date.now(); ag(d);d.Si=d.xb.clone();RI(d.Si,"t",d.K);d.g3=0;d.dW=d.O.XF(d.O.wR()?L:null);d.wO>0&&(d.Qc=new g.dB((0,g.m7)(d.nt,d,d.dW),d.wO));d.G.listen(d.dW,"readystatechange",d.Ue);L=d.wX?g.TV(d.wX):{};d.cW?(d.xs="POST",L["Content-Type"]="application/x-www-form-urlencoded",d.dW.send(d.Si,d.xs,d.cW,L)):(d.xs="GET",d.B_&&!g.Ft&&(L.Connection="close"),d.dW.send(d.Si,d.xs,null,L));d.O.Es(1)},SFH=function(d,L){var I=d.g3,v=L.indexOf("\n",I); if(v==-1)return Bo;I=Number(L.substring(I,v));if(isNaN(I))return YFU;v+=1;if(v+I>L.length)return Bo;L=L.slice(v,v+I);d.g3=v+I;return L},ag=function(d){d.cI=Date.now()+d.W; U81(d,d.W)},U81=function(d,L){if(d.hS!=null)throw Error("WatchDog timer not null"); d.hS=rx((0,g.m7)(d.qq,d),L)},sJQ=function(d){d.hS&&(g.er.clearTimeout(d.hS),d.hS=null)},j1=function(d){d.O.Ib()||d.gR||d.O.zn(d)},tx=function(d){sJQ(d); g.dr(d.Qc);d.Qc=null;d.L.stop();d.G.removeAll();if(d.dW){const L=d.dW;d.dW=null;L.abort();L.dispose()}d.un&&(d.un=null)},qFx=function(d,L){try{d.O.Lt(d,L),d.O.Es(4)}catch(I){}},ZB$=function(d,L,I,v,F){if(v==0)I(!1); else{var R=F||0;v--;lRb(d,L,function(D){D?I(!0):g.er.setTimeout(function(){ZB$(d,L,I,v,R)},R)})}},lRb=function(d,L,I){const v=new Image; v.onload=function(){try{Ax(v),I(!0)}catch(F){}}; v.onerror=function(){try{Ax(v),I(!1)}catch(F){}}; v.onabort=function(){try{Ax(v),I(!1)}catch(F){}}; v.ontimeout=function(){try{Ax(v),I(!1)}catch(F){}}; g.er.setTimeout(function(){if(v.ontimeout)v.ontimeout()},L); v.src=d},Ax=function(d){d.onload=null; d.onerror=null;d.onabort=null;d.ontimeout=null},NrQ=function(d){this.O=d; this.W=new D6},MJx=function(d){const L=p5(d.O,d.Ia,"/mail/images/cleardot.gif"); FA(L);ZB$(L.toString(),5E3,(0,g.m7)(d.sS,d),3,2E3);d.Es(1)},G_=function(d){var L=d.O.K; L!=null?(K5(),L?(K5(),Po(d.O,d,!1)):(K5(),Po(d.O,d,!0))):(d.GR=new e1(d),d.GR.wX=d.dO,L=d.O,L=p5(L,L.wR()?d.RB:null,d.K0),K5(),RI(L,"TYPE","xmlhttp"),Wo(d.GR,L,!1,d.RB,!1))},ui=function(d,L,I){this.O=1; this.W=[];this.G=[];this.L=new D6;this.U=d||null;this.K=L!=null?L:null;this.j=I||!1},QJn=function(d,L){this.O=d; this.map=L;this.context=null},cNV=function(d,L,I,v){g.j2.call(this,"timingevent",d); this.size=L;this.rtt=I;this.retries=v},VJx=function(d){g.j2.call(this,"serverreachability",d)},fRw=function(d){d.Z9(1,0); d.aB=p5(d,null,d.BI);mL(d)},Trn=function(d){d.Q4&&(d.Q4.abort(),d.Q4=null); d.NC&&(d.NC.cancel(),d.NC=null);d.rZ&&(g.er.clearTimeout(d.rZ),d.rZ=null);z_(d);d.S_&&(d.S_.cancel(),d.S_=null);d.oV&&(g.er.clearTimeout(d.oV),d.oV=null)},Ej=function(d,L){if(d.O==0)throw Error("Invalid operation: sending map when state is closed"); d.W.push(new QJn(d.ek++,L));d.O!=2&&d.O!=3||mL(d)},g$$=function(d){let L=0; d.NC&&L++;d.S_&&L++;return L},mL=function(d){d.S_||d.oV||(d.oV=rx((0,g.m7)(d.ri,d),0),d.Oq=0)},dS8=function(d,L){if(d.O==1){if(!L){d.XO=Math.floor(Math.random()*1E5); L=d.XO++;const I=new e1(d,"",L);I.wX=d.OJ;const v=hx(d),F=d.aB.clone();g.nt(F,"RID",L);g.nt(F,"CVER","1");wx(d,F);x8$(I,F,v);d.S_=I;d.O=2}}else d.O==3&&(L?XA9(d,L):d.W.length==0||d.S_||XA9(d))},XA9=function(d,L){if(L)if(d.Xp>6){d.W=d.G.concat(d.W); d.G.length=0;var I=d.XO-1;L=hx(d)}else I=L.B,L=L.cW;else I=d.XO++,L=hx(d);const v=d.aB.clone();g.nt(v,"SID",d.N);g.nt(v,"RID",I);g.nt(v,"AID",d.WY);wx(d,v);I=new e1(d,d.N,I,d.Oq+1);I.wX=d.OJ;I.setTimeout(1E4+Math.round(1E4*Math.random()));d.S_=I;x8$(I,v,L)},wx=function(d,L){d.Hf&&(d=d.Hf.wi())&&g.GV(d,function(I,v){g.nt(L,v,I)})},hx=function(d){const L=Math.min(d.W.length,1E3),I=["count="+L]; let v;d.Xp>6&&L>0?(v=d.W[0].O,I.push("ofs="+v)):v=0;for(let F=0;F=3)return!1; d.B++;d.rZ=rx((0,g.m7)(d.Ss,d),I7w(d,d.HY));d.HY++;return!0},Po=function(d,L,I){d.qx=d.K==null?I:!d.K; d.O5=L.Su;d.j||fRw(d)},z_=function(d){d.dX!=null&&(g.er.clearTimeout(d.dX),d.dX=null)},I7w=function(d,L){let I=5E3+Math.floor(Math.random()*1E4); d.isActive()||(I*=2);return I*L},C5=function(d,L){if(L==2||L==9){var I=null; d.Hf&&(I=null);var v=(0,g.m7)(d.n_,d);I||(I=new g.ZH("//www.google.com/images/cleardot.gif"),FA(I));lRb(I.toString(),1E4,v)}else K5();vex(d,L)},vex=function(d,L){d.O=0; d.Hf&&d.Hf.xT(L);FwU(d);Trn(d)},FwU=function(d){d.O=0; d.O5=-1;if(d.Hf)if(d.G.length==0&&d.W.length==0)d.Hf.u2();else{const L=g.H1(d.G),I=g.H1(d.W);d.G.length=0;d.W.length=0;d.Hf.u2(L,I)}},p5=function(d,L,I){let v=g.Z0(I); if(v.O!="")L&&g.Nx(v,L+"."+v.O),g.R7(v,v.G);else{const F=window.location;v=td$(F.protocol,L?L+"."+F.hostname:F.hostname,+F.port,I)}d.cT&&g.GV(d.cT,function(F,R){g.nt(v,R,F)}); g.nt(v,"VER",d.Xp);wx(d,v);return v},RYn=function(){},DSx=function(){this.O=[]; this.W=[]},Oy1=function(d,L){this.action=d; this.params=L||{}},ii=function(d,L){g.IJ.call(this); this.O=new g.Rk(this.Dd,0,this);g.G(this,this.O);this.O3=5E3;this.retryCount=this.pw=0;if(typeof d==="function")L&&(d=(0,g.m7)(d,L));else if(d&&typeof d.handleEvent==="function")d=(0,g.m7)(d.handleEvent,d);else throw Error("Invalid listener argument");this.W=d},$B=function(d,L,I=!1,v=()=>"",F=!1,R=!1,D=!1,O=()=>g.dN({}),b=!1,H,n){this.bU=d; this.Wy=L;this.B=new g.YK;this.K=n;this.W=(this.G=!!H)?H(()=>{this.Pv()}):new ii(this.Pv,this); this.O=null;this.U=!1;this.Z=null;this.sU="";this.N0=this.md=0;this.N=[];this.q0=I;this.Sj=v;this.j=R;this.tU=O;this.ZH=D;this.L1=null;this.L=g.dN();this.ej=F;this.IL=b;this.By=new by1;this.aL=new HyU;this.jj=new ne$;this.M0=new oe8;this.K1=new yqH;this.Wx=new rq1;this.Px=new kj9},Kwn=function(d,L,I,v,F){xB(d); if(d.O){const R=g.x("ID_TOKEN"),D=d.O.OJ||{};R?D["x-youtube-identity-token"]=R:delete D["x-youtube-identity-token"];d.O.OJ=D}v?(v.getState()!=3&&g$$(v)==0||v.getState(),d.O.connect(L,I,d.Wy,v.N,v.WY)):F?d.O.connect(L,I,d.Wy,F.sessionId,F.arrayId):d.O.connect(L,I,d.Wy);d.G&&!d.W.isActive()&&d.W.start();d.K&&d.K.Lej()},WwH=function(d,L){return d.IL?!Object.values(eYx).includes(L):!1},a78=async function(d){try{await YB(d)}finally{var L=d.N; d.N=[];var I=L;L=L.length;for(let v=0;v{if(d.O){let I=d.O.OJ||{}; L&&Object.keys(L).length>0?I={...I,...L}:delete I.Authorization;d.O.OJ=I}}).o5(()=>{}),()=>{d.L1=null})},Uj=function(d){this.scheme="https"; this.port=this.domain="";this.O="/api/lounge";this.W=!0;d=d||document.location.href;const L=Number(g.Rv(d)[4]||null)||"";L&&(this.port=":"+L);this.domain=g.OX(d)||"";d=g.ku();d.search("MSIE")>=0&&(d=d.match(/MSIE ([\d.]+)/)[1],g.rY(d,"10.0")<0&&(this.W=!1))},sj=function(d,L){let I=d.O; d.W&&(I=d.scheme+"://"+d.domain+d.port+d.O);return g.WK(I+L,{})},j1c=function(d){g.Ez(d.channel,"m",()=>{d.K=3; d.G.reset();d.j=null;d.B=0;for(const L of d.Z)d.channel&&d.channel.send(L);d.Z=[];d.publish("webChannelOpened");d.Sj.O("WEB_CHANNEL")}); g.Ez(d.channel,"n",()=>{d.K=0;d.G.isActive()||d.publish("webChannelClosed");const L=d.channel?.N().G();L&&(d.Z=[...L]);d.N0.O("WEB_CHANNEL")}); g.Ez(d.channel,"p",L=>{const I=L.data;I[0]==="gracefulReconnect"?(d.G.start(),d.channel&&d.channel.close()):d.publish("webChannelMessage",new Oy1(I[0],I[1]));d.kP=L.statusCode;d.L1.O("WEB_CHANNEL")}); g.Ez(d.channel,"o",()=>{d.kP===401||d.G.start();d.publish("webChannelError");d.sU.O("WEB_CHANNEL","")})},qM=function(d){const L=d.Wy(); L?d.N["x-youtube-lounge-xsrf-token"]=L:delete d.N["x-youtube-lounge-xsrf-token"]},P6$=function(d,L,I=()=>"",v,F){const R=()=>new $B(sj(d,"/bc"),L,!1,I,v); return g.cW("enable_mdx_web_channel_desktop")?new tXU(()=>new AqH(sj(d,"/wc"),L,I)):new pXj(R,F)},zYc=function(){var d=GjH; uv9();li.push(d);mSx()},Z6=function(d,L){uv9(); const I=Eec(d,String(L));li.length==0?hY1(I):(mSx(),g.ld(li,function(v){v(I)}))},NM=function(d){Z6("CP",d)},uv9=function(){li||(li=g.ai("yt.mdx.remote.debug.handlers_")||[],g.WB("yt.mdx.remote.debug.handlers_",li))},hY1=function(d){const L=(MM+1)%50; MM=L;Qr[L]=d;co||(co=L==49)},mSx=function(){var d=li; if(Qr[0]){var L=co?MM:-1;do{L=(L+1)%50;const I=Qr[L];g.ld(d,function(v){v(I)})}while(L!=MM); Qr=Array(50);MM=-1;co=!1}},Eec=function(d,L){let I=(Date.now()-wX9)/1E3; I.toFixed&&(I=I.toFixed(3));const v=[];v.push("[",I+"s","] ");v.push("[","yt.mdx.remote","] ");v.push(d+": "+L,"\n");return v.join("")},Vr=function(d){g.bh.call(this); this.K=d;this.screens=[]},Jq1=function(d,L){const I=d.get(L.uuid)||d.get(L.id); if(I)return d=I.name,I.id=L.id||I.id,I.name=L.name,I.token=L.token,I.uuid=L.uuid||I.uuid,I.name!=d;d.screens.push(L);return!0},C6U=function(d,L){let I=d.screens.length!=L.length; d.screens=g.ZN(d.screens,function(F){return!!Wj(L,F)}); const v=L.length;for(let F=0;F0&&d.NL.idType!="shortLived"); g.bq("yt-remote-automatic-screen-cache",g.N7(d,Eh9))},Re=function(d){d.L=g.HR("yt-remote-device-id-map")||{}},D1=function(d,L,I){g.bh.call(this); this.sU=I;this.N=d;this.W=L;this.O=null},O8=function(d,L){d.O=L; d.publish("sessionScreen",d.O)},Q1n=function(d,L){d.O&&(d.O.token=L,FW(d.N,d.O)); d.publish("sessionScreen",d.O)},bI=function(d,L){Z6(d.sU,L)},VXw=function(d,L){g.NE(d.md); d.md=0;L?d.config_.enableCastLoungeToken&&L.loungeToken?L.deviceId?d.O&&d.O.uuid==L.deviceId||(L.loungeTokenRefreshIntervalMs?cqL(d,{name:d.W.friendlyName,screenId:L.screenId,loungeToken:L.loungeToken,dialId:L.deviceId,screenIdType:"shortLived"},L.loungeTokenRefreshIntervalMs):(g.BW(Error(`No loungeTokenRefreshIntervalMs presents in mdxSessionStatusData: ${JSON.stringify(L)}.`)),HC(d,L.screenId))):(g.BW(Error(`No device id presents in mdxSessionStatusData: ${JSON.stringify(L)}.`)),HC(d,L.screenId)): HC(d,L.screenId):d.J4(Error("Waiting for session status timed out."))},f7L=function(d){g.NE(d.U); d.U=0;g.NE(d.B);d.B=0;g.NE(d.md);d.md=0;g.NE(d.L);d.L=0;g.NE(d.j);d.j=0},TQ9=function(d,L){d.info("sendYoutubeMessage_: "+L+" "+g.JC()); const I={};I.type=L;d.G?d.G.sendMessage("urn:x-cast:com.google.youtube.mdx",I,()=>{},(0,g.m7)(function(){bI(this,"Failed to send message: "+L+".")},d)):bI(d,"Sending yt message without session: "+g.JC(I))},XXQ=function(d){TQ9(d,"getLoungeToken"); g.NE(d.L);d.L=g.l$(()=>{geQ(d,null)},3E4)},n0=function(d,L){g.NE(d.j); d.j=0;L==0?XXQ(d):d.j=g.l$(()=>{XXQ(d)},L)},geQ=function(d,L){g.NE(d.L); d.L=0;let I=null;L?L.loungeToken?d.O?.token==L.loungeToken&&(I="staleLoungeToken"):I="missingLoungeToken":I="noLoungeTokenResponse";I?(d.info("Did not receive a new lounge token in onLoungeToken_ with "+`data: ${JSON.stringify(L)}, error: ${I}`),n0(d,3E4)):(Q1n(d,L.loungeToken),n0(d,L.loungeTokenRefreshIntervalMs))},HC=function(d,L){L?(d.info("onConnectedScreenId_: Received screenId: "+L),d.O&&d.O.id==L||d.L1(L,I=>{O8(d,I)},()=>d.J4(),5)):d.J4(Error("Waiting for session status timed out."))},dCb= function(d,L,I,v){g.NE(d.B); d.B=0;l7j(d.N,L,F=>{F||v<0?I(F):d.B=g.l$(()=>{dCb(d,L,I,v-1)},300)})},cqL=function(d,L,I){d.info(`onConnectedScreenData_: Received screenData: ${JSON.stringify(L)}`); const v=new yz(L);dCb(d,v,F=>{F?(FW(d.N,v),O8(d,v),n0(d,I)):(g.BW(Error(`CastSession, RemoteScreen from screenData: ${JSON.stringify(L)} is not online.`)),d.J4())},5)},oe=function(d){return new Promise(L=>{d.Wy=e9(); if(d.Sj){const I=new chrome.cast.DialLaunchResponse(!0,LeU(d));L(I);IPw(d)}else d.Z=()=>{g.NE(d.md);d.Z=()=>{}; d.md=NaN;const I=new chrome.cast.DialLaunchResponse(!0,LeU(d));L(I);IPw(d)},d.md=g.l$(()=>{d.Z()},100)})},vy9=function(d){g.NE(d.B); d.B=0;g.NE(d.j);d.j=0;d.L();d.L=()=>{}; g.NE(d.md)},yh=function(d){return!(!d.config_.enableDialLoungeToken||!d.G?.getDialAppInfo)},rd=function(d,L){d.info(`getDialAppInfoWithTimeout_ ${L}`); yh(d)&&(g.NE(d.j),d.j=0,L==0?FeL(d):d.j=g.l$(()=>{FeL(d)},L))},IPw=function(d){d.L=d.N.Xy(d.Wy,d.W.label,d.W.friendlyName,yh(d),(L,I)=>{d.L=()=>{}; O8(d,L);L.idType=="shortLived"&&I>0&&rd(d,I)},L=>{d.L=()=>{}; d.J4(L)})},LeU=function(d){var L={}; L.pairingCode=d.Wy;L.theme=d.tU;qX$()&&(L.env_useStageMdx=1);return g.ed(L)},RSb=function(d,L){const I=d.U.receiver.label,v=d.W.friendlyName; return(new Promise(F=>{s1j(d.N,I,L,v,R=>{R&&R.token&&O8(d,R);F(R)},R=>{bI(d,"Failed to get DIAL screen: "+R); F(null)})})).then(F=>F&&F.token?new chrome.cast.DialLaunchResponse(!1):oe(d))},OW8=function(d,L,I){d.info(`initOnConnectedScreenDataPromise_: Received screenData: ${JSON.stringify(L)}`); const v=new yz(L);return(new Promise(F=>{DCQ(d,v,R=>{R?(FW(d.N,v),O8(d,v),rd(d,I)):g.BW(Error(`DialSession, RemoteScreen from screenData: ${JSON.stringify(L)} is not online.`));F(R)},5)})).then(F=>F?new chrome.cast.DialLaunchResponse(!1):oe(d))},DCQ=function(d,L,I,v){g.NE(d.B); d.B=0;l7j(d.N,L,F=>{F||v<0?I(F):d.B=g.l$(()=>{DCQ(d,L,I,v-1)},300)})},FeL=function(d){yh(d)&&d.G.getDialAppInfo(L=>{d.info(`getDialAppInfo dialLaunchData: ${JSON.stringify(L)}`); L=L.extraData||{};let I=null;L.loungeToken?d.O?.token==L.loungeToken&&(I="staleLoungeToken"):I="missingLoungeToken";I?rd(d,3E4):(Q1n(d,L.loungeToken),rd(d,L.loungeTokenRefreshIntervalMs))},L=>{d.info(`getDialAppInfo error: ${L}`); rd(d,3E4)})},GjH=function(d){window.chrome&&chrome.cast&&chrome.cast.logMessage&&chrome.cast.logMessage(d)},HW8=function(d){const L=d.W.cO(); let I=d.O&&d.O.W;d=g.N7(L,function(v){I&&r8(v,I.label)&&(I=null);const F=v.uuid?v.uuid:v.id;let R=bW1(this,v);R?(R.label=F,R.friendlyName=v.name):(R=new chrome.cast.Receiver(F,v.name),R.receiverType=chrome.cast.ReceiverType.CUSTOM);return R},d); I&&(I.receiverType!=chrome.cast.ReceiverType.CUSTOM&&(I=new chrome.cast.Receiver(I.label,I.friendlyName),I.receiverType=chrome.cast.ReceiverType.CUSTOM),d.push(I));return d},ks=function(d){return d.j||!!d.G.length||!!d.O},K0=function(d){Z6("Controller",d)},ev=function(d,L,I){L!=d.O&&(g.dr(d.O),(d.O=L)?(I?d.publish("yt-remote-cast2-receiver-resumed",L.W):d.publish("yt-remote-cast2-receiver-selected",L.W),L.subscribe("sessionScreen",(0,g.m7)(d.md,d,L)),L.subscribe("sessionFailed",()=>nyn(d,L)),L.O? d.publish("yt-remote-cast2-session-change",L.O):I&&d.O.K(null)):d.publish("yt-remote-cast2-session-change",null))},bW1=function(d,L){return L?g.g$(d.G,function(I){return r8(L,I.label)},d):null},nyn=function(d,L){d.O==L&&d.publish("yt-remote-cast2-session-failed")},eS$=function(d,L,I,v){v.disableCastApi?WC("Cannot initialize because disabled by Mdx config."):oyQ()?yKb(L,v)&&(ae(!0),window.chrome&&chrome.cast&&chrome.cast.isAvailable?rKj(d,I):(window.__onGCastApiAvailable=function(F,R){F?rKj(d,I):(BC("Failed to load cast API: "+ R),jv(!1),ae(!1),g.nX("yt-remote-cast-available"),g.nX("yt-remote-cast-receiver"),kCL(),I(!1))},v.loadCastApiSetupScript?g.y7(Keb):window.navigator.userAgent.indexOf("Android")>=0&&window.navigator.userAgent.indexOf("Chrome/")>=0&&window.navigator.presentation?ua()>=60&&Vd8():!window.chrome||!window.navigator.presentation||window.navigator.userAgent.indexOf("Edge")>=0?zL():ua()>=89?TLn():(Et(),mq(fUV.map(Md$))))):WC("Cannot initialize because not running Chrome")},kCL=function(){WC("dispose"); const d=tG();d&&d.dispose();g.WB("yt.mdx.remote.cloudview.instance_",null);WeH(!1);g.nf(AG);AG.length=0},p0=function(){return!!g.HR("yt-remote-cast-installed")},aPc=function(){const d=g.HR("yt-remote-cast-receiver"); return d?d.friendlyName:null},BSH=function(){WC("clearCurrentReceiver"); g.nX("yt-remote-cast-receiver")},jrw=function(){return p0()?tG()?tG().getCastSession():(BC("getCastSelector: Cast is not initialized."),null):(BC("getCastSelector: Cast API is not installed!"),null)},GI=function(){p0()?tG()?PC()?(WC("Requesting cast selector."),tG().requestSession()):(WC("Wait for cast API to be ready to request the session."),AG.push(g.Hr("yt-remote-cast2-api-ready",GI))):BC("requestCastSelector: Cast is not initialized."):BC("requestCastSelector: Cast API is not installed!")},uI= function(d,L){PC()?tG().setConnectedScreenStatus(d,L):BC("setConnectedScreenStatus called before ready.")},oyQ=function(){var d=g.ku().search(/ (CrMo|Chrome|CriOS)\//)>=0; return g.Ff||d},tuH=function(d,L){tG().init(d,L)},yKb=function(d,L){let I=!1; tG()||(d=new mP(d,L),d.subscribe("yt-remote-cast2-availability-change",function(v){g.bq("yt-remote-cast-available",v);GL("yt-remote-cast2-availability-change",v)}),d.subscribe("yt-remote-cast2-receiver-selected",function(v){WC("onReceiverSelected: "+v.friendlyName); g.bq("yt-remote-cast-receiver",v);GL("yt-remote-cast2-receiver-selected",v)}),d.subscribe("yt-remote-cast2-receiver-resumed",function(v){WC("onReceiverResumed: "+v.friendlyName); g.bq("yt-remote-cast-receiver",v);GL("yt-remote-cast2-receiver-resumed",v)}),d.subscribe("yt-remote-cast2-session-change",function(v){WC("onSessionChange: "+kM(v)); v||g.nX("yt-remote-cast-receiver");GL("yt-remote-cast2-session-change",v)}),g.WB("yt.mdx.remote.cloudview.instance_",d),I=!0); WC("cloudview.createSingleton_: "+I);return I},tG=function(){return g.ai("yt.mdx.remote.cloudview.instance_")},rKj=function(d,L){jv(!0); ae(!1);tuH(d,function(I){I?(WeH(!0),g.o$("yt-remote-cast2-api-ready")):(BC("Failed to initialize cast API."),jv(!1),g.nX("yt-remote-cast-available"),g.nX("yt-remote-cast-receiver"),kCL());L(I)})},WC=function(d){Z6("cloudview",d)},BC=function(d){Z6("cloudview",d)},jv=function(d){WC("setCastInstalled_ "+d); g.bq("yt-remote-cast-installed",d)},PC=function(){return!!g.ai("yt.mdx.remote.cloudview.apiReady_")},WeH=function(d){WC("setApiReady_ "+d); g.WB("yt.mdx.remote.cloudview.apiReady_",d)},ae=function(d){g.WB("yt.mdx.remote.cloudview.initializing_",d)},zI=function(d){this.index=-1; this.videoId=this.listId="";this.volume=this.playerState=-1;this.muted=!1;this.audioTrackId=null;this.L=this.K=0;this.trackData=null;this.hasNext=this.hasPrevious=!1;this.loadedTime=this.G=this.B=this.W=0;this.O=NaN;this.N=!1;this.reset(d)},E8=function(d){d.audioTrackId=null; d.trackData=null;d.playerState=-1;d.hasPrevious=!1;d.hasNext=!1;d.K=0;d.L=g.E$();d.W=0;d.B=0;d.G=0;d.loadedTime=0;d.O=NaN;d.N=!1},hG=function(d){return d.isPlaying()?(g.E$()-d.L)/1E3:0},wd=function(d,L){d.K=L; d.L=g.E$()},JG=function(d){switch(d.playerState){case 1:case 1081:return(g.E$()-d.L)/1E3+d.K; case -1E3:return 0}return d.K},AKj=function(d){return d.N?d.B+hG(d):d.B},C0=function(d,L,I){const v=d.videoId; d.videoId=L;d.index=I;L!=v&&E8(d)},iI=function(d){const L={}; L.index=d.index;L.listId=d.listId;L.videoId=d.videoId;L.playerState=d.playerState;L.volume=d.volume;L.muted=d.muted;L.audioTrackId=d.audioTrackId;L.trackData=g.gj(d.trackData);L.hasPrevious=d.hasPrevious;L.hasNext=d.hasNext;L.playerTime=d.K;L.playerTimeAt=d.L;L.seekableStart=d.W;L.seekableEnd=d.B;L.duration=d.G;L.loadedTime=d.loadedTime;L.liveIngestionTime=d.O;return L},pL$=function(d){g.ld("nowAutoplaying autoplayDismissed remotePlayerChange remoteQueueChange autoplayModeChange autoplayUpNext previousNextChange multiStateLoopEnabled loopModeChange".split(" "), function(L){this.B.push(this.N.subscribe(L,g.zF(this.bU,L),this))},d)},$s=function(d,L){d.W&&(d.W.removeUpdateListener(d.Z),d.W.removeMediaListener(d.U),d.K(null)); d.W=L;d.W&&(NM("Setting cast session: "+d.W.sessionId),d.W.addUpdateListener(d.Z),d.W.addMediaListener(d.U),d.W.media.length&&d.K(d.W.media[0]))},xs=function(d){return new zI(d.N.getPlayerContextData())},Ys=function(d){return d.getState()==1},U8=function(d,L,I){return(0,g.m7)(function(v){this.Q0("Failed to "+L+" with cast v2 channel. Error code: "+v.code); v.code!=chrome.cast.ErrorCode.TIMEOUT&&(this.Q0("Retrying "+L+" using MDx browser channel."),Sv(this,L,I))},d)},Sv=function(d,L,I){d.N.sendMessage(L,I)},q4=function(d,L,I){const v=xs(d); wd(v,I);v.playerState!=-1E3&&(v.playerState=L);s8(d,v)},lI=function(d,L){var I=d.L; I.O.length+I.W.length<50&&d.L.enqueue(L)},s8=function(d,L){PYU(d); d.N.setPlayerContextData(iI(L));pL$(d)},PYU=function(d){g.ld(d.B,function(L){this.N.unsubscribeByKey(L)},d); d.B.length=0},GCw=function(d){const L=d.O.media,I=d.O.customData; if(L&&I){var v=xs(d);L.contentId!=v.videoId&&NM("Cast changing video to: "+L.contentId);v.videoId=L.contentId;v.playerState=I.playerState;wd(v,d.O.getEstimatedTime());s8(d,v)}else NM("No cast media video. Ignoring state update.")},upw=function(d){Z1("Channel opened"); d.L1&&(d.L1=!1,N4(d),d.sU=g.l$(()=>{Z1("Timing out waiting for a screen.");d.B(1)},15E3))},SuL=function(d,L){L=L.message; L.params?Z1("Received: action="+L.action+", params="+g.JC(L.params)):Z1("Received: action="+L.action+" {}");switch(L.action){case "loungeStatus":L=Ot(L.params.devices);d.G=g.N7(L,function(v){return new oI(v)}); L=!!g.g$(d.G,function(v){return v.type=="LOUNGE_SCREEN"}); mCx(d,L);L=d.K1("mlm");d.publish("multiStateLoopEnabled",L);break;case "loungeScreenDisconnected":g.On(d.G,function(v){return v.type=="LOUNGE_SCREEN"}); mCx(d,!1);break;case "remoteConnected":let I=new oI(Ot(L.params.device));g.g$(d.G,function(v){return v.equals(I)})||BL1(d.G,I); break;case "remoteDisconnected":I=new oI(Ot(L.params.device));g.On(d.G,function(v){return v.equals(I)}); break;case "gracefulDisconnect":break;case "playlistModified":zSw(d,L,"QUEUE_MODIFIED");break;case "nowPlaying":Eyw(d,L);break;case "onStateChange":hSH(d,L);break;case "onAdStateChange":wLU(d,L);break;case "onVolumeChanged":JK$(d,L);break;case "onSubtitlesTrackChanged":CYc(d,L);break;case "nowAutoplaying":iW$(d,L);break;case "autoplayDismissed":d.publish("autoplayDismissed");break;case "autoplayUpNext":$Cc(d,L);break;case "onAutoplayModeChanged":xCL(d,L);break;case "onHasPreviousNextChanged":YuQ(d, L);break;case "requestAssistedSignIn":d.publish("assistedSignInRequested",L.params.authCode);break;case "onLoopModeChanged":d.publish("loopModeChange",L.params.loopMode);break;default:Z1("Unrecognized action: "+L.action)}},Z1=function(d){Z6("conn",d)},UC8=function(d){d.K=g.l$(()=>{Z1("Connecting timeout"); d.B(1)},2E4)},M4=function(d,L){d.publish("proxyStateChange",L)},Qh=function(d){g.NE(d.K); d.K=NaN},cC=function(d){g.NE(d.N0); d.N0=NaN},N4=function(d){g.NE(d.sU); d.sU=NaN},srw=function(d){return g.g$(d.G,function(L){return L.type=="LOUNGE_SCREEN"})},Vh=function(d,L,I){I?Z1("Sending: action="+L+", params="+g.JC(I)):Z1("Sending: action="+L); d.W.sendMessage(L,I)},qu$=function(d){cC(d); d.N0=g.l$(()=>{Vh(d,"getNowPlaying")},2E4)},lPb=function(d){g.NE(d.Z); d.Z=g.l$(()=>{d.B(1)},864E5)},mCx=function(d,L){var I=null; if(L){const v=srw(d);v&&(I={clientName:v.clientName,deviceMake:v.brand,deviceModel:v.model,osVersion:v.osVersion})}g.WB("yt.mdx.remote.remoteClient_",I);L&&(Qh(d),N4(d));I=d.W.nP()&&isNaN(d.K);L==I?L&&(M4(d,1),Vh(d,"getSubtitlesTrack")):L?(d.aL()&&d.O.reset(),M4(d,1),Vh(d,"getNowPlaying"),lPb(d)):d.B(1)},CYc=function(d,L){const I=L.params.videoId; delete L.params.videoId;I==d.O.videoId&&(g.Un(L.params)?d.O.trackData=null:d.O.trackData=L.params,d.publish("remotePlayerChange"))},zSw=function(d,L,I){const v=L.params.videoId||L.params.video_id,F=parseInt(L.params.currentIndex,10); d.O.listId=L.params.listId||d.O.listId;C0(d.O,v,F);d.publish("remoteQueueChange",I)},hSH=function(d,L){var I=parseInt(L.params.currentTime||L.params.current_time,10); wd(d.O,isNaN(I)?0:I);I=parseInt(L.params.state,10);I=isNaN(I)?-1:I;I==-1&&d.O.playerState==-1E3&&(I=-1E3);d.O.playerState=I;I=Number(L.params.loadedTime);d.O.loadedTime=isNaN(I)?0:I;d.O.Jg(Number(L.params.duration));I=d.O;var v=Number(L.params.liveIngestionTime);I.O=v;I.N=isNaN(v)?!1:!0;I=d.O;v=Number(L.params.seekableStartTime);L=Number(L.params.seekableEndTime);I.W=isNaN(v)?0:v;I.B=isNaN(L)?0:L;d.O.playerState==1?qu$(d):cC(d);d.publish("remotePlayerChange")},Eyw=function(d,L){L.params=L.params|| {}; zSw(d,L,"NOW_PLAYING_MAY_CHANGE");hSH(d,L);d.publish("autoplayDismissed")},wLU=function(d,L){if(d.O.playerState!=-1E3){var I=1085; switch(parseInt(L.params.adState,10)){case 1:I=1081;break;case 2:I=1084;break;case 0:I=1083}d.O.playerState=I;L=parseInt(L.params.currentTime,10);wd(d.O,isNaN(L)?0:L);d.publish("remotePlayerChange")}},JK$=function(d,L){const I=L.params.muted=="true"; d.O.volume=parseInt(L.params.volume,10);d.O.muted=I;d.publish("remotePlayerChange")},iW$=function(d,L){d.j=L.params.videoId; d.publish("nowAutoplaying",parseInt(L.params.timeout,10))},$Cc=function(d,L){d.j=L.params.videoId||null; d.publish("autoplayUpNext",d.j)},xCL=function(d,L){d.L=L.params.autoplayMode; d.publish("autoplayModeChange",d.L);d.L=="DISABLED"&&d.publish("autoplayDismissed")},YuQ=function(d,L){const I=L.params.hasNext=="true"; d.O.hasPrevious=L.params.hasPrevious=="true";d.O.hasNext=I;d.publish("previousNextChange")},QrQ=function(d,L){svw(); if(!Pj||!Pj.get("yt-remote-disable-remote-module-for-dev")){L=g.x("MDX_CONFIG")||L;CWc();As();f0||(f0=new Uj(L?L.loungeApiHost:void 0),qX$()&&(f0.O="/api/loungedev"));TI||(TI=g.ai("yt.mdx.remote.deferredProxies_")||[],g.WB("yt.mdx.remote.deferredProxies_",TI));ZW$();var I=gd();if(!I){const F=new vC(f0,L?L.disableAutomaticScreenCache||!1:!1);g.WB("yt.mdx.remote.screenService_",F);I=gd();var v={};L&&(v={appId:L.appId,disableDial:L.disableDial,theme:L.theme,loadCastApiSetupScript:L.loadCastApiSetupScript, disableCastApi:L.disableCastApi,enableDialLoungeToken:L.enableDialLoungeToken,enableCastLoungeToken:L.enableCastLoungeToken,forceMirroring:L.forceMirroring});g.WB("yt.mdx.remote.enableConnectWithInitialState_",L?L.enableConnectWithInitialState||!1:!1);eS$(d,F,function(R){R?XW()&&uI(XW(),"YouTube TV"):F.subscribe("onlineScreenChange",function(){GL("yt-remote-receiver-availability-change")})},v)}L&&!g.ai("yt.mdx.remote.initialized_")&&(g.WB("yt.mdx.remote.initialized_",!0),dm("Initializing: "+g.JC(L)), LK.push(g.Hr("yt-remote-cast2-api-ready",function(){GL("yt-remote-api-ready")})),LK.push(g.Hr("yt-remote-cast2-availability-change",function(){GL("yt-remote-receiver-availability-change")})),LK.push(g.Hr("yt-remote-cast2-receiver-selected",function(){IA(null); GL("yt-remote-auto-connect","cast-selector-receiver")})),LK.push(g.Hr("yt-remote-cast2-receiver-resumed",function(){GL("yt-remote-receiver-resumed","cast-selector-receiver")})),LK.push(g.Hr("yt-remote-cast2-session-change",NS9)),LK.push(g.Hr("yt-remote-connection-change",function(F){F?uI(XW(),"YouTube TV"):vI()||(uI(null,null),BSH())})),LK.push(g.Hr("yt-remote-cast2-session-failed",()=>{GL("yt-remote-connection-failed")})),d=Fq(),L.isAuto&&(d.id+="#dial"),v=L.capabilities||[],v.length>0&&(d.capabilities= v),d.name=L.device,d.app=L.app,(L=L.theme)&&(d.theme=L),dm(" -- with channel params: "+g.JC(d)),d?(g.bq("yt-remote-session-app",d.app),g.bq("yt-remote-session-name",d.name)):(g.nX("yt-remote-session-app"),g.nX("yt-remote-session-name")),g.WB("yt.mdx.remote.channelParams_",d),I.start(),XW()||Mub())}},cK9=function(){var d=gd().r4.$_gos(); const L=RA();L&&D_()&&(Wj(d,L)||d.push(L));return JX$(d)},Ow=function(){let d=VuV(); !d&&p0()&&aPc()&&(d={key:"cast-selector-receiver",name:aPc()});return d},VuV=function(){const d=cK9(); let L=RA();L||(L=vI());return g.g$(d,function(I){return L&&r8(L,I.key)?!0:!1})},RA=function(){const d=XW(); if(!d)return null;const L=gd().gG();return aI(L,d)},NS9=function(d){dm("remote.onCastSessionChange_: "+kM(d)); if(d){var L=RA();if(L&&L.id==d.id){if(uI(L.id,"YouTube TV"),d.idType=="shortLived"&&(d=d.token))bM&&(bM.token=d),(L=D_())&&L.uP(d)}else L&&HI(),nK(d,1)}else D_()&&HI()},HI=function(){PC()?tG().stopSession():BC("stopSession called before API ready."); const d=D_();d&&(d.disconnect(1),oA(null))},y6=function(){const d=D_(); return!!d&&d.getProxyState()!=3},dm=function(d){Z6("remote",d)},gd=function(){if(!rm){const d=g.ai("yt.mdx.remote.screenService_"); rm=d?new fP9(d):null}return rm},XW=function(){return g.ai("yt.mdx.remote.currentScreenId_")},TSn=function(d){g.WB("yt.mdx.remote.currentScreenId_",d)},gyH=function(){return g.ai("yt.mdx.remote.connectData_")},IA=function(d){g.WB("yt.mdx.remote.connectData_",d)},D_=function(){return g.ai("yt.mdx.remote.connection_")},oA=function(d){const L=D_(); IA(null);d||TSn("");g.WB("yt.mdx.remote.connection_",d);TI&&(g.ld(TI,function(I){I(d)}),TI.length=0); L&&!d?GL("yt-remote-connection-change",!1):!L&&d&&GL("yt-remote-connection-change",!0)},vI=function(){const d=g.ow(); if(!d)return null;var L=gd();if(!L)return null;L=L.gG();return aI(L,d)},nK=function(d,L){XW(); RA()&&RA();if(kv)bM=d;else{TSn(d.id);var I=g.ai("yt.mdx.remote.enableConnectWithInitialState_")||!1;d=new KK(d,I);d.connect(L,gyH());d.subscribe("beforeDisconnect",function(v){GL("yt-remote-before-disconnect",v)}); d.subscribe("beforeDispose",function(){D_()&&(D_(),oA(null))}); d.subscribe("browserChannelAuthError",()=>{const v=RA();v&&v.idType=="shortLived"&&(PC()?tG().handleBrowserChannelAuthError():BC("refreshLoungeToken called before API ready."))}); oA(d)}},Mub=function(){const d=vI(); d?(dm("Resume connection to: "+kM(d)),nK(d,0)):(p3(),BSH(),dm("Skipping connecting because no session screen found."))},ZW$=function(){var d=Fq(); if(g.Un(d)){d=ts();var L=g.HR("yt-remote-session-name")||"";const I=g.HR("yt-remote-session-app")||"";d={device:"REMOTE_CONTROL",id:d,name:L,app:I,mdxVersion:3};d.authuser=String(g.x("SESSION_INDEX","0"));(L=g.x("DELEGATED_SESSION_ID"))&&(d.pageId=String(L));g.WB("yt.mdx.remote.channelParams_",d)}},Fq=function(){return g.ai("yt.mdx.remote.channelParams_")||{}},XL$=function(d,L){if(eO(d)){d.mB.unsubscribe("remotePlayerChange",d.L,d); const I=Math.round(L.volume);L=!!L.muted;const v=xs(d.mB);if(I!==v.volume||L!==v.muted)d.mB.setVolume(I,L),d.Z.start();d.mB.subscribe("remotePlayerChange",d.L,d)}},eO=function(d){return xs(d.mB).videoId===WI(d).videoId},aA=function(d,L){let I,v; var F=d.X.getPlaylist();F?.listId&&(I=F.index,v=F.listId.toString());F=WI(d);d.mB.playVideo(F.videoId,L,I,v,F.playerParams,F.Z,aU9(F));d.F4(new g.WM(1))},BI=function(d,L){if(eO(d)&&!d.K){let I=null; L&&(I={style:d.X.getSubtitlesUserSettings()},Object.assign(I,L));d.mB.j(WI(d).videoId,I);d.N=xs(d.mB).trackData}},dAQ=function(d,L){if(L){const I=d.X.getOption("captions","tracklist",{N$:1}); I&&I.length?(d.X.setOption("captions","track",L),d.K=!1):(d.X.loadModule("captions"),d.K=!0)}else d.X.setOption("captions","track",{})},Lp$=function(d){d.B5(0); d.W.stop();d.F4(new g.WM(64))},WI=function(d){return d.X.getVideoData({playerType:1})},ISw=function(d){const L=d.player.V(); return!L.C("mdx_enable_privacy_disclosure_ui")||d.isLoggedIn()||d.X3||!d.g8?!1:g.EF(L)||g.yQ(L)},vGU=function(d,L,I){d.ZQ=I; d.player.publish("presentingplayerstatechange",new g.mT(I,L))},jO=function(d,L,...I){d.loaded&&d.Iq.aq(L,...I)},t$=function(d){d.wE&&(d.player.removeEventListener("presentingplayerstatechange",d.wE),d.wE=null)},A$=function(d,L){if(L.key!==d.rJ.key)if(L.key===d.kI.key)HI(); else if(ISw(d)&&FpQ(d),d.rJ=L,!g.fV(d.player.V())){{const R=d.player.getPlaylistId();var I=d.player.getVideoData({playerType:1});const D=I.videoId;if(!R&&!D||(d.player.getAppState()===2||d.player.getAppState()===1)&&d.player.V().C("should_clear_video_data_on_player_cued_unstarted"))I=null;else{var v=d.player.getPlaylist();if(v){var F=[];for(let O=0;O{!d.X3&&L.yR(8)&&(d.player.pauseVideo(), t$(d))},d.player.addEventListener("presentingplayerstatechange",d.wE)); d.g8&&d.g8.Ut();D_()||(kv=!0)}; g.QJ.prototype.Ds=g.Ii(46,function(){this.app.JF().Ds()}); g.hD.prototype.Ds=g.Ii(45,function(){this.EE=null}); g.QJ.prototype.G$=g.Ii(44,function(d){this.app.JF().G$(d)}); g.hD.prototype.G$=g.Ii(43,function(d){this.EE=d}); g.lk.prototype.G9=g.Ii(1,function(){return g.Dd(this,3)}); g.bs.prototype.G9=g.Ii(0,function(){return g.Dd(this,11)}); var by1=class{constructor(){var d=g.XJ();this.W=d;g.Pe(d,"/client_streamz/youtube/living_room/mdx/channel/opened",g.Uu("channel_type"))}O(d){g.uv(this.W,"/client_streamz/youtube/living_room/mdx/channel/opened",d)}},HyU=class{constructor(){var d=g.XJ();this.W=d;g.Pe(d,"/client_streamz/youtube/living_room/mdx/channel/closed",g.Uu("channel_type"))}O(d){g.uv(this.W,"/client_streamz/youtube/living_room/mdx/channel/closed",d)}},oe8=class{constructor(){var d=g.XJ();this.W=d;g.Pe(d,"/client_streamz/youtube/living_room/mdx/channel/message_received", g.Uu("channel_type"))}O(d){g.uv(this.W,"/client_streamz/youtube/living_room/mdx/channel/message_received",d)}},ne$=class{constructor(){var d=g.XJ();this.W=d;g.Pe(d,"/client_streamz/youtube/living_room/mdx/channel/success")}O(){g.uv(this.W,"/client_streamz/youtube/living_room/mdx/channel/success")}},yqH=class{constructor(){var d=g.XJ();this.W=d;g.Pe(d,"/client_streamz/youtube/living_room/mdx/channel/error",g.Uu("channel_type"),g.Uu("error_type"))}O(d,L){g.uv(this.W,"/client_streamz/youtube/living_room/mdx/channel/error", d,L)}},rq1=class{constructor(){var d=g.XJ();this.W=d;g.Pe(d,"/client_streamz/youtube/living_room/mdx/browser_channel/pending_maps")}O(){g.uv(this.W,"/client_streamz/youtube/living_room/mdx/browser_channel/pending_maps")}},kj9=class{constructor(){var d=g.XJ();this.W=d;g.Pe(d,"/client_streamz/youtube/living_room/mdx/browser_channel/undelivered_maps")}O(){g.uv(this.W,"/client_streamz/youtube/living_room/mdx/browser_channel/undelivered_maps")}};g.p=Hj.prototype; g.p.Rq=function(){n3(this);const d=[];for(let L=0;L2*this.size&&n3(this),!0):!1}; g.p.get=function(d,L){return ba(this.W,d)?this.W[d]:L}; g.p.set=function(d,L){ba(this.W,d)||(this.size+=1,this.O.push(d),this.tA++);this.W[d]=L}; g.p.forEach=function(d,L){const I=this.Qf();for(let v=0;v=v.O.length)return g.Jm;const R=v.O[L++];return g.$$(d?R:v.W[R])}; return F}; var mqw={OB:"atp",IHU:"ska",EEy:"que",o1:"mus",Vj1:"sus",yQ:"dsp",d0S:"seq",Vs:"mic",s$:"dpa",eD:"mlm",yz:"dsdtr",NN:"ntb",Ml2:"vsp",zK:"scn",nEU:"rpe",WH:"dcn",GK:"dcp",dL:"pas",PH:"drq",LR:"opf",Xx:"els",cH:"isg",u2y:"svq",pf:"mvp",oQ:"ads",HXE:"stcp",vE2:"sads",Nm:"dloc",Li:"dcw",OC:"asw",H9:"apw",W9:"wrc",Vu:"pcw",Gd:"ipv",fR:"ndt",YY:"ctops",HE:"gsrm"},zmj={uaj:"u",cV:"cl",nf:"k",uW:"i",Ij:"cr",hs:"m",J5:"g",dF:"up"},eYx={yu:"nowPlaying",rL:"onStateChange",fE:"adPlaying",Qu:"onAdStateChange", FU:"nowPlayingShorts",Sw:"onShortsStateChange"};oI.prototype.equals=function(d){return d?this.id==d.id:!1}; var j9="",Pj=null,cXb=lUj("loadCastFramework")||lUj("loadCastApplicationFramework"),fUV=["pkedcjkdefgpdelpbcmbmeomcjbeemfm","enhhojjnijigcajfphajepfemndkmdlo"];g.J0(hs,g.IJ);g.p=hs.prototype;g.p.jk=function(d){this.N=arguments;this.O=!1;this.qh?this.G=g.E$()+this.O3:this.qh=g.Be(this.L,this.O3)}; g.p.stop=function(){this.qh&&(g.er.clearTimeout(this.qh),this.qh=null);this.G=null;this.O=!1;this.N=[]}; g.p.pause=function(){++this.W}; g.p.resume=function(){this.W&&(--this.W,!this.W&&this.O&&(this.O=!1,this.K.apply(null,this.N)))}; g.p.F2=function(){this.stop();hs.Oi.F2.call(this)}; g.p.AE=function(){this.qh&&(g.er.clearTimeout(this.qh),this.qh=null);this.G?(this.qh=g.Be(this.L,this.G-g.E$()),this.G=null):this.W?this.O=!0:(this.O=!1,this.K.apply(null,this.N))};var Js=null;w8.prototype.set=function(d){this.O=d}; w8.prototype.reset=function(){this.set(g.E$())}; w8.prototype.get=function(){return this.O};g.J0(XKw,gh1);var D6=class{stringify(d){return g.er.JSON.stringify(d,void 0)}parse(d){return g.er.JSON.parse(d,void 0)}};g.J0(C3,g.j2);g.J0(ia,g.j2);var d8c=null;g.J0(LGH,g.j2);g.J0(IRH,g.j2);g.J0(v$Q,g.j2);Ut.prototype.debug=function(){}; Ut.prototype.info=function(){}; Ut.prototype.warning=function(){};var HBn={},Qz={};g.p=qu.prototype;g.p.setTimeout=function(d){this.By=d}; g.p.VK=function(d){d=d.target;const L=this.aL;L&&g.Nc(d)==3?L.N():this.mE(d)}; g.p.mE=function(d){try{if(d==this.O)a:{const F=g.Nc(this.O),R=this.O.W,D=this.O.getStatus();if(!(F<3)&&(F!=3||this.O&&(this.W.W||g.ce(this.O)||g.Vi(this.O)))){this.L1||F!=4||R==7||(R==8||D<=0?xM(3):xM(2));cj(this);var L=this.O.getStatus();this.q0=L;var I=bBL(this);if(this.K=L==200){if(this.ZH&&!this.bU){b:{if(this.O){const O=g.TJ(this.O,"X-HTTP-Initial-Response");if(O&&!g.bm(O)){var v=O;break b}}v=null}if(d=v)this.bU=!0,vo(this,d);else{this.K=!1;this.L=3;YM(12);Nu(this);Mu(this);break a}}if(this.sU){d= !0;let O;for(;!this.L1&&this.B0&&!this.ej&&(this.ej=!0,this.G.cK(this)):(Nu(this),Mu(this))}else vo(this,I);F==4&&Nu(this);this.K&&!this.L1&&(F==4?yNU(this.G,this):(this.K=!1,Z3(this)))}else g.fv(this.O),L==400&&I.indexOf("Unknown SID")> 0?(this.L=3,YM(12)):(this.L=0,YM(13)),Nu(this),Mu(this)}}}catch(F){}finally{}}; g.p.cancel=function(){this.L1=!0;Nu(this)}; g.p.D9=function(){this.md=null;const d=Date.now();d-this.jj>=0?(this.tU!=2&&(xM(3),YM(17)),Nu(this),this.L=2,Mu(this)):o$U(this,this.jj-d)}; g.p.getLastError=function(){return this.L}; g.p.Df=function(){return this.O};var Ro$=class{constructor(d,L){this.O=d;this.map=L;this.context=null}};eZ8.prototype.cancel=function(){this.G=FY(this);if(this.W)this.W.cancel(),this.W=null;else if(this.O&&this.O.size!==0){for(const d of this.O.values())d.cancel();this.O.clear()}};g.p=tJ$.prototype;g.p.GX=8;g.p.oK=1;g.p.connect=function(d,L,I,v){YM(0);this.CX=d;this.L1=L||{};I&&v!==void 0&&(this.L1.OSID=I,this.L1.OAID=v);this.aL=this.Sl;this.Sj=rNL(this,null,this.CX);Ig(this)}; g.p.disconnect=function(){ANb(this);if(this.oK==3){var d=this.K1++,L=this.Sj.clone();g.nt(L,"SID",this.N);g.nt(L,"RID",d);g.nt(L,"TYPE","terminate");Ho(this,L);d=new qu(this,this.N,d);d.tU=2;d.j=FA(L.clone());L=!1;if(g.er.navigator&&g.er.navigator.sendBeacon)try{L=g.er.navigator.sendBeacon(d.j.toString(),"")}catch{}!L&&g.er.Image&&((new Image).src=d.j,L=!0);L||(d.O=D8w(d.G,null),d.O.send(d.j));d.Wy=Date.now();Z3(d)}zZ$(this)}; g.p.Ib=function(){return this.oK==0}; g.p.getState=function(){return this.oK}; g.p.PO=function(d){if(this.K)if(this.K=null,this.oK==1){if(!d){this.K1=Math.floor(Math.random()*1E5);d=this.K1++;const F=new qu(this,"",d);let R=this.U;this.ZH&&(R?(R=g.TV(R),g.Lr(R,this.ZH)):R=this.ZH);this.B!==null||this.jj||(F.Sj=R,R=null);if(this.IL)a:{var L=0;for(var I=0;I4096){L=I;break a}if(L===4096||I===this.G.length-1){L=I+1;break a}}L= this.qv}else L=this.qv;L=GA$(this,F,L);I=this.Sj.clone();g.nt(I,"RID",d);g.nt(I,"CVER",22);this.sU&&g.nt(I,"X-HTTP-Session-Id",this.sU);Ho(this,I);R&&(this.jj?L="headers="+g.n_(g.Kt(R))+"&"+L:this.B&&g.eM(I,this.B,R));L5(this.W,F);this.OH&&g.nt(I,"TYPE","init");this.IL?(g.nt(I,"$req",L),g.nt(I,"SID","null"),F.ZH=!0,la(F,I,null)):la(F,I,L);this.oK=2}}else this.oK==3&&(d?unU(this,d):this.G.length==0||WGc(this.W)||unU(this))}; g.p.Nj=function(){this.j=null;m88(this);if(this.YF&&!(this.By||this.O==null||this.TO<=0)){var d=4*this.TO;this.N0=S9((0,g.m7)(this.fO,this),d)}}; g.p.fO=function(){this.N0&&(this.N0=null,this.aL=!1,this.By=!0,YM(10),TL(this),m88(this))}; g.p.cK=function(d){this.O==d&&this.YF&&!this.By&&(bi(this),this.By=!0,YM(11))}; g.p.JE=function(){this.md!=null&&(this.md=null,TL(this),g8(this),YM(19))}; g.p.L_=function(d){d?YM(2):YM(1)}; g.p.isActive=function(){return!!this.L&&this.L.isActive(this)}; g.p=hZj.prototype;g.p.E2=function(){}; g.p.s2=function(){}; g.p.Fy=function(){}; g.p.yE=function(){}; g.p.isActive=function(){return!0}; g.p.I_=function(){};g.J0(og,g.sz);og.prototype.open=function(){this.O.L=this.G;this.B&&(this.O.bU=!0);this.O.connect(this.K,this.W||void 0)}; og.prototype.close=function(){this.O.disconnect()}; og.prototype.send=function(d){var L=this.O;if(typeof d==="string"){var I={};I.__data__=d;d=I}else this.L&&(I={},I.__data__=g.JC(d),d=I);L.G.push(new Ro$(L.XI++,d));L.oK==3&&Ig(L)}; og.prototype.F2=function(){this.O.L=null;delete this.G;this.O.disconnect();delete this.O;og.Oi.F2.call(this)}; g.J0(JNL,C3);g.J0(Ct$,ia);g.J0(n5,hZj);n5.prototype.E2=function(){this.O.dispatchEvent("m")}; n5.prototype.s2=function(d){this.O.dispatchEvent(new JNL(d))}; n5.prototype.Fy=function(d){this.O.dispatchEvent(new Ct$(d))}; n5.prototype.yE=function(){this.O.dispatchEvent("n")}; og.prototype.N=function(){return new yr(this,this.O)}; yr.prototype.W=function(){return XA(this.O.W)}; yr.prototype.G=function(){return E$9(this.O).map(d=>{var L=this.N;d=d.map;"__data__"in d?(d=d.__data__,L=L.L?jv9(d):d):L=d;return L})}; yr.prototype.commit=function(d){this.O.q0=d};var kB=new g.sz,iB$=class extends g.j2{constructor(){super("statevent",kB)}};g.p=e1.prototype;g.p.wX=null;g.p.pL=!1;g.p.hS=null;g.p.cI=null;g.p.bC=null;g.p.r3=null;g.p.xb=null;g.p.Si=null;g.p.cW=null;g.p.dW=null;g.p.g3=0;g.p.un=null;g.p.xs=null;g.p.o6=null;g.p.Ra=-1;g.p.B_=!0;g.p.gR=!1;g.p.wO=0;g.p.Qc=null;var YFU={},Bo={};g.p=e1.prototype;g.p.setTimeout=function(d){this.W=d}; g.p.Ue=function(d){d=d.target;const L=this.Qc;L&&g.Nc(d)==3?L.N():this.nt(d)}; g.p.nt=function(d){try{if(d==this.dW)a:{const L=g.Nc(this.dW),I=this.dW.W,v=this.dW.getStatus();if(g.Ft&&!g.E_("420+")){if(L<4)break a}else if(L<3||L==3&&!g.ce(this.dW))break a;this.gR||L!=4||I==7||(I==8||v<=0?this.O.Es(3):this.O.Es(2));sJQ(this);const F=this.dW.getStatus();this.Ra=F;const R=g.ce(this.dW);if(this.pL=F==200){L==4&&tx(this);if(this.sU){for(d=!0;!this.gR&&this.g30?3:0,K5(),tx(this),j1(this)}}catch(L){}finally{}}; g.p.cancel=function(){this.gR=!0;tx(this)}; g.p.qq=function(){this.hS=null;const d=Date.now();d-this.cI>=0?(this.r3!=2&&this.O.Es(3),tx(this),this.o6=2,K5(),j1(this)):U81(this,this.cI-d)}; g.p.getLastError=function(){return this.o6};g.p=NrQ.prototype;g.p.dO=null;g.p.GR=null;g.p.iY=!1;g.p.K0=null;g.p.HN=null;g.p.Su=-1;g.p.RB=null;g.p.Ia=null;g.p.connect=function(d){this.K0=d;d=p5(this.O,null,this.K0);K5();Date.now();const L=this.O.U;L!=null?(this.RB=L[0],(this.Ia=L[1])?(this.HN=1,MJx(this)):(this.HN=2,G_(this))):(RI(d,"MODE","init"),this.GR=new e1(this),this.GR.wX=this.dO,Wo(this.GR,d,!1,null,!0),this.HN=0)}; g.p.sS=function(d){if(d)this.HN=2,G_(this);else{K5();var L=this.O;L.O5=L.Q4.Su;C5(L,9)}d&&this.Es(2)}; g.p.XF=function(d){return this.O.XF(d)}; g.p.abort=function(){this.GR&&(this.GR.cancel(),this.GR=null);this.Su=-1}; g.p.Ib=function(){return!1}; g.p.Lt=function(d,L){this.Su=d.Ra;if(this.HN==0)if(L){try{var I=this.W.parse(L)}catch(v){d=this.O;d.O5=this.Su;C5(d,2);return}this.RB=I[0];this.Ia=I[1]}else d=this.O,d.O5=this.Su,C5(d,2);else this.HN==2&&(this.iY?(K5(),Date.now()):L=="11111"?(K5(),this.iY=!0,Date.now(),this.Su=200,this.GR.cancel(),K5(),Po(this.O,this,!0)):(K5(),Date.now(),this.iY=!1))}; g.p.zn=function(){this.Su=this.GR.Ra;if(this.GR.pL)this.HN==0?this.Ia?(this.HN=1,MJx(this)):(this.HN=2,G_(this)):this.HN==2&&(this.iY?(K5(),Po(this.O,this,!0)):(K5(),Po(this.O,this,!1)));else{this.HN==0?K5():this.HN==2&&K5();var d=this.O;this.GR.getLastError();d.O5=this.Su;C5(d,2)}}; g.p.wR=function(){return this.O.wR()}; g.p.isActive=function(){return this.O.isActive()}; g.p.Es=function(d){this.O.Es(d)};g.p=ui.prototype;g.p.OJ=null;g.p.cT=null;g.p.S_=null;g.p.NC=null;g.p.BI=null;g.p.aB=null;g.p.tR=null;g.p.C0=null;g.p.XO=0;g.p.ek=0;g.p.Hf=null;g.p.oV=null;g.p.rZ=null;g.p.dX=null;g.p.Q4=null;g.p.qx=null;g.p.WY=-1;g.p.QE=-1;g.p.O5=-1;g.p.Oq=0;g.p.HY=0;g.p.Xp=8;var DAH={OK:0,rUU:2,M3:4,Eo:5,Bd1:6,STOP:7,fZ:8,PV:9,m_:10,NS:11,m2:12};g.J0(cNV,g.j2);g.J0(VJx,g.j2);g.p=ui.prototype; g.p.connect=function(d,L,I,v,F){K5();this.BI=L;this.cT=I||{};v&&F!==void 0&&(this.cT.OSID=v,this.cT.OAID=F);this.j?(rx((0,g.m7)(this.dg,this,d),100),fRw(this)):this.dg(d)}; g.p.disconnect=function(){Trn(this);if(this.O==3){var d=this.XO++;const L=this.aB.clone();g.nt(L,"SID",this.N);g.nt(L,"RID",d);g.nt(L,"TYPE","terminate");wx(this,L);d=new e1(this,this.N,d);d.r3=2;d.xb=FA(L.clone());(new Image).src=d.xb.toString();d.bC=Date.now();ag(d)}FwU(this)}; g.p.dg=function(d){this.Q4=new NrQ(this);this.Q4.dO=this.OJ;this.Q4.W=this.L;this.Q4.connect(d)}; g.p.Ib=function(){return this.O==0}; g.p.getState=function(){return this.O}; g.p.ri=function(d){this.oV=null;dS8(this,d)}; g.p.Ss=function(){this.rZ=null;this.NC=new e1(this,this.N,"rpc",this.B);this.NC.wX=this.OJ;this.NC.wO=0;var d=this.tR.clone();g.nt(d,"RID","rpc");g.nt(d,"SID",this.N);g.nt(d,"CI",this.qx?"0":"1");g.nt(d,"AID",this.WY);wx(this,d);g.nt(d,"TYPE","xmlhttp");Wo(this.NC,d,!0,this.C0,!1)}; g.p.Lt=function(d,L){if(this.O!=0&&(this.NC==d||this.S_==d))if(this.O5=d.Ra,this.S_==d&&this.O==3)if(this.Xp>7){try{var I=this.L.parse(L)}catch(v){I=null}if(Array.isArray(I)&&I.length==3)if(d=I,d[0]==0)a:{if(!this.rZ){if(this.NC)if(this.NC.bC+3E30)){if(v=L==1)this.S_||this.oV||this.O==1||this.Oq>=2?v=!1:(this.oV=rx((0,g.m7)(this.ri,this,d),I7w(this,this.Oq)),this.Oq++, v=!0);v=!(v||L==2&&Jx(this))}if(v)switch(I){case 1:C5(this,5);break;case 4:C5(this,10);break;case 3:C5(this,6);break;case 7:C5(this,12);break;default:C5(this,2)}}}; g.p.Z9=function(d){if(!g.L8(arguments,this.O))throw Error("Unexpected channel state: "+this.O);}; g.p.n_=function(d){d?K5():(K5(),vex(this,8))}; g.p.XF=function(d){if(d)throw Error("Can't create secondary domain capable XhrIo object.");d=new g.SP;d.B=!1;return d}; g.p.isActive=function(){return!!this.Hf&&this.Hf.isActive(this)}; g.p.Es=function(d){const L=kB;L.dispatchEvent(new VJx(L,d))}; g.p.wR=function(){return!1}; new XKw;g.p=RYn.prototype;g.p.Rf=function(){}; g.p.gi=function(){}; g.p.bq=function(){}; g.p.xT=function(){}; g.p.u2=function(){}; g.p.wi=function(){return{}}; g.p.isActive=function(){return!0};g.p=DSx.prototype;g.p.enqueue=function(d){this.W.push(d)}; g.p.isEmpty=function(){return this.O.length===0&&this.W.length===0}; g.p.clear=function(){this.O=[];this.W=[]}; g.p.contains=function(d){return g.L8(this.O,d)||g.L8(this.W,d)}; g.p.remove=function(d){{var L=this.O;const I=Array.prototype.lastIndexOf.call(L,d,L.length-1);I>=0?(g.Rb(L,I),L=!0):L=!1}return L||g.DH(this.W,d)}; g.p.Rq=function(){const d=[];for(var L=this.O.length-1;L>=0;--L)d.push(this.O[L]);L=this.W.length;for(let I=0;I"",this.tU=()=>g.dN({}))}; g.p.X2=function(){return this.U}; g.p.connect=async function(d,L,I){try{this.j&&await this.L}finally{if(this.U||this.O&&this.O.getState()==2&&!this.G)return;this.sU="";this.G||this.W.stop();this.Z=d||null;this.md=L||0;const v=this.bU+"/test",F=this.bU+"/bind";d=new ui(I?I.firstTestResults:null,I?I.secondTestResults:null,this.q0);const R=this.O;R&&(R.Hf=null);d.Hf=this;this.O=d;if(this.j)return this.L=YB(this).then(()=>Kwn(this,v,F,R,I)),this.L.then(()=>{this.L=g.dN()}); Kwn(this,v,F,R,I)}}; g.p.disconnect=function(d){try{this.j&&(this.L.cancel(),this.L=g.dN())}finally{this.N0=d||0,this.W&&this.W.stop(),xB(this),this.O&&(this.O.getState()==3&&dS8(this.O),this.O.disconnect()),this.N0=0}}; g.p.sendMessage=async function(d,L){try{this.j&&await this.L}finally{if(this.U)return;const I={_sc:d};L&&g.Lr(I,L);if(this.W.isActive()||(this.O?this.O.getState():0)==2)this.N.push(I);else if(this.nP())try{this.j&&!WwH(this,d)&&await YB(this)}finally{this.nP()&&(WwH(this,d),xB(this),Ej(this.O,I))}}}; g.p.Rf=function(){this.K&&this.W&&this.W.G9()>0&&(this.K.mk2(this.W.G9(),this.G,!0),this.K.GWS());this.K&&this.K.vvU();this.G?(this.W.stop(),g.dr(this.W),this.W=new ii(this.Pv,this),this.G=!1):this.W.reset();this.Z=null;this.md=0;if(this.N.length)if(this.j)a78(this);else{var d=this.N;this.N=[];var L=d.length;for(let I=0;IDAH[I]===d); this.K1.O("BROWSER_CHANNEL",L??"UNKNOWN")}; g.p.u2=function(d,L){if(!this.W.isActive())this.publish("handlerClosed");else if(L){const I=L.length;for(let v=0;v{this.onError(v)}); this.handler.subscribe("handlerMessage",this.onMessage,this);this.W=L}connect(d,L,I){this.handler.connect(d,L,I)}disconnect(d){this.handler.disconnect(d)}Pd(){this.handler.Pd()}getDeviceId(){return this.handler.getDeviceId()}T6(){return this.handler.T6()}nP(){return this.handler.nP()}O(){this.dispatchEvent("channelOpened");var d=this.handler,L=this.W;g.bq("yt-remote-session-browser-channel",{firstTestResults:[""],secondTestResults:!d.O.qx,sessionId:d.O.N,arrayId:d.O.WY});g.bq("yt-remote-session-screen-id", L);d=Bj();L=ts();g.L8(d,L)||d.push(L);$qU(d);As()}onClosed(){this.dispatchEvent("channelClosed")}onMessage(d){this.dispatchEvent(new O9$(d))}onError(d){this.dispatchEvent(new b9w(d?1:0))}sendMessage(d,L){this.handler.sendMessage(d,L)}uP(d){this.handler.uP(d)}dispose(){this.handler.dispose()}};var AqH=class{constructor(d,L,I=()=>""){new wAx; var v=new g.YK;this.pathPrefix=d;this.O=L;this.Wy=I;this.L=v;this.j=null;this.U=this.B=0;this.channel=null;this.K=0;this.G=new ii(()=>{this.G.isActive();this.channel?.N().W()===0&&this.connect(this.j,this.B)}); this.N={};this.W={};this.md=!1;this.logger=null;this.Z=[];this.kP=void 0;this.Sj=new by1;this.N0=new HyU;this.L1=new oe8;this.sU=new yqH}connect(d={},L=0){this.K!==2&&(this.G.stop(),this.j=d,this.B=L,qM(this),(d=g.x("ID_TOKEN"))?this.N["x-youtube-identity-token"]=d:delete this.N["x-youtube-identity-token"],this.O&&(this.W.device=this.O.device,this.W.name=this.O.name,this.W.app=this.O.app,this.W.id=this.O.id,this.O.V8&&(this.W.mdxVersion=`${this.O.V8}`),this.O.theme&&(this.W.theme=this.O.theme),this.O.capabilities&& (this.W.capabilities=this.O.capabilities),this.O.X1&&(this.W.cst=this.O.X1),this.O.authuser&&(this.W.authuser=this.O.authuser),this.O.pageId&&(this.W.pageId=this.O.pageId)),this.B!==0?this.W.ui=`${this.B}`:delete this.W.ui,Object.assign(this.W,this.j),this.channel=new og(this.pathPrefix,{Gs:"gsessionid",q2:this.N,U0:this.W}),this.channel.open(),this.K=2,j1c(this))}disconnect(d=0){this.U=d;this.G.stop();qM(this);this.channel&&(this.U!==0?this.W.ui=`${this.U}`:delete this.W.ui,this.channel.close()); this.U=0}T6(){return this.G.isActive()?this.G.pw-Date.now():NaN}Pd(){var d=this.G;g.DL(d.O);d.start()}sendMessage(d,L){this.channel&&(qM(this),this.channel.send({_sc:d,...L}))}uP(d){d||this.G.stop();d?this.N["X-YouTube-LoungeId-Token"]=d:delete this.N["X-YouTube-LoungeId-Token"]}getDeviceId(){return this.O?this.O.id:""}publish(d,...L){return this.L.publish(d,...L)}subscribe(d,L,I){return this.L.subscribe(d,L,I)}unsubscribe(d,L,I){return this.L.unsubscribe(d,L,I)}pC(d){return this.L.pC(d)}dispose(){this.md|| (this.md=!0,g.dr(this.L),this.disconnect(),g.dr(this.G),this.Wy=()=>"")}X2(){return this.md}};var tXU=class extends g.sz{constructor(d){super();this.O=d();this.O.subscribe("webChannelOpened",this.W,this);this.O.subscribe("webChannelClosed",this.onClosed,this);this.O.subscribe("webChannelError",this.onError,this);this.O.subscribe("webChannelMessage",this.onMessage,this)}connect(d,L){this.O.connect(d,L)}disconnect(d){this.O.disconnect(d)}Pd(){this.O.Pd()}getDeviceId(){return this.O.getDeviceId()}T6(){return this.O.T6()}nP(){return this.O.K===3}W(){this.dispatchEvent("channelOpened")}onClosed(){this.dispatchEvent("channelClosed")}onMessage(d){this.dispatchEvent(new O9$(d))}onError(){this.dispatchEvent(new b9w(this.O.kP=== 401?1:0))}sendMessage(d,L){this.O.sendMessage(d,L)}uP(d){this.O.uP(d)}dispose(){this.O.dispose()}};var wX9=Date.now(),li=null,Qr=Array(50),MM=-1,co=!1;g.J0(Vr,g.bh);Vr.prototype.gG=function(){return this.screens}; Vr.prototype.contains=function(d){return!!Wj(this.screens,d)}; Vr.prototype.get=function(d){return d?aI(this.screens,d):null}; Vr.prototype.info=function(d){Z6(this.K,d)};var nG$=class extends g.bh{constructor(d,L,I,v,F){super();this.N=d;this.Z=L;this.j=I;this.md=v;this.U=F;this.W=0;this.O=null;this.qh=NaN}start(){!this.O&&isNaN(this.qh)&&this.G()}stop(){this.O&&(this.O.abort(),this.O=null);isNaN(this.qh)||(g.NE(this.qh),this.qh=NaN)}F2(){this.stop();super.F2()}G(){this.qh=NaN;this.O=g.Lq(sj(this.N,"/pairing/get_screen"),{method:"POST",postParams:{pairing_code:this.Z},timeout:5E3,onSuccess:(0,g.m7)(this.K,this),onError:(0,g.m7)(this.L,this),onTimeout:(0,g.m7)(this.B, this)})}K(d,L){this.O=null;d=L.screen||{};d.dialId=this.j;d.name=this.md;L=-1;this.U&&d.shortLivedLoungeToken&&d.shortLivedLoungeToken.value&&d.shortLivedLoungeToken.refreshIntervalMs&&(d.screenIdType="shortLived",d.loungeToken=d.shortLivedLoungeToken.value,L=d.shortLivedLoungeToken.refreshIntervalMs);this.publish("pairingComplete",new yz(d),L)}L(d){this.O=null;d.status&&d.status==404?this.W>=H9b.length?this.publish("pairingFailed",Error("DIAL polling timed out")):(d=H9b[this.W],this.qh=g.l$((0,g.m7)(this.G, this),d),this.W++):this.publish("pairingFailed",Error("Server error "+d.status))}B(){this.O=null;this.publish("pairingFailed",Error("Server not responding"))}},H9b=[2E3,2E3,1E3,1E3,1E3,2E3,2E3,5E3,5E3,1E4];g.J0(T_,Vr);g.p=T_.prototype;g.p.start=function(){f5(this)&&this.publish("screenChange");!g.HR("yt-remote-lounge-token-expiration")&&$Sb(this);g.NE(this.O);this.O=g.l$((0,g.m7)(this.start,this),1E4)}; g.p.add=function(d,L){f5(this);Jq1(this,d);gx(this,!1);this.publish("screenChange");L(d);d.token||$Sb(this)}; g.p.remove=function(d,L){let I=f5(this);iyx(this,d)&&(gx(this,!1),I=!0);L(d);I&&this.publish("screenChange")}; g.p.IC=function(d,L,I,v){let F=f5(this);const R=this.get(d.id);R?(R.name!=L&&(R.name=L,gx(this,!1),F=!0),I(d)):v(Error("no such local screen."));F&&this.publish("screenChange")}; g.p.F2=function(){g.NE(this.O);T_.Oi.F2.call(this)}; g.p.UR=function(d){f5(this);let L=this.screens.length;d=d&&d.screens||[];const I=d.length;for(let v=0;v{g.dr(D);F(FW(this,O),b)}); D.subscribe("pairingFailed",O=>{g.dr(D);R(O)}); D.start();return(0,g.m7)(D.stop,D)}; g.p.o_=function(d,L,I,v){g.Lq(sj(this.N,"/pairing/get_screen"),{method:"POST",postParams:{pairing_code:d},timeout:5E3,onSuccess:(0,g.m7)(function(F,R){F=new yz(R.screen||{});if(!F.name||q5H(this,F.name)){a:{R=F.name;let D=2,O=L(R,D);for(;q5H(this,O);){D++;if(D>20)break a;O=L(R,D)}R=O}F.name=R}I(FW(this,F))},this), onError:(0,g.m7)(function(F){v(Error("pairing request failed: "+F.status))},this), onTimeout:(0,g.m7)(function(){v(Error("pairing request timed out."))},this)})}; g.p.F2=function(){g.dr(this.W);g.dr(this.O);vC.Oi.F2.call(this)}; g.p.ot=function(){Zy$(this);this.publish("screenChange");this.O.update()}; vC.prototype.dispose=vC.prototype.dispose;g.J0(D1,g.bh);g.p=D1.prototype;g.p.J4=function(d){this.X2()||(d&&(bI(this,""+d),this.publish("sessionFailed")),this.O=null,this.publish("sessionScreen",null))}; g.p.info=function(d){Z6(this.sU,d)}; g.p.di=function(){return null}; g.p.oJ=function(d){const L=this.W;d?(L.displayStatus=new chrome.cast.ReceiverDisplayStatus(d,[]),L.displayStatus.showStop=!0):L.displayStatus=null;chrome.cast.setReceiverDisplayStatus(L,(0,g.m7)(function(){this.info("Updated receiver status for "+L.friendlyName+": "+d)},this),(0,g.m7)(function(){bI(this,"Failed to update receiver status for: "+L.friendlyName)},this))}; g.p.F2=function(){this.oJ("");D1.Oi.F2.call(this)};var pK=class extends D1{constructor(d,L,I){super(d,L,"CastSession");this.config_=I;this.G=null;this.Z=(0,g.m7)(this.Sj,this);this.Wy=(0,g.m7)(this.tU,this);this.md=g.l$(()=>{VXw(this,null)},12E4); this.j=this.L=this.B=this.U=0}N0(d){if(this.G){if(this.G==d)return;bI(this,"Overriding cast session with new session object");f7L(this);this.G.removeUpdateListener(this.Z);this.G.removeMessageListener("urn:x-cast:com.google.youtube.mdx",this.Wy)}this.G=d;this.G.addUpdateListener(this.Z);this.G.addMessageListener("urn:x-cast:com.google.youtube.mdx",this.Wy);TQ9(this,"getMdxSessionStatus")}K(d){this.info("launchWithParams no-op for Cast: "+g.JC(d))}stop(){this.G?this.G.stop((0,g.m7)(function(){this.J4()}, this),(0,g.m7)(function(){this.J4(Error("Failed to stop receiver app."))},this)):this.J4(Error("Stopping cast device without session."))}oJ(){}F2(){this.info("disposeInternal"); f7L(this);this.G&&(this.G.removeUpdateListener(this.Z),this.G.removeMessageListener("urn:x-cast:com.google.youtube.mdx",this.Wy));this.G=null;super.F2()}tU(d,L){if(!this.X2())if(L)if(L=Ot(L),g.PB(L))switch(d=""+L.type,L=L.data||{},this.info("onYoutubeMessage_: "+d+" "+g.JC(L)),d){case "mdxSessionStatus":VXw(this,L);break;case "loungeToken":geQ(this,L);break;default:bI(this,"Unknown youtube message: "+d)}else bI(this,"Unable to parse message.");else bI(this,"No data in message.")}L1(d,L,I,v){g.NE(this.U); this.U=0;s1j(this.N,this.W.label,d,this.W.friendlyName,(0,g.m7)(function(F){F?L(F):v>=0?(bI(this,"Screen "+d+" appears to be offline. "+v+" retries left."),this.U=g.l$((0,g.m7)(this.L1,this,d,L,I,v-1),300)):I(Error("Unable to fetch screen."))},this),I)}di(){return this.G}Sj(d){this.X2()||d||(bI(this,"Cast session died."),this.J4())}};var oGn=class extends D1{constructor(d,L,I,v){super(d,L,"DialSession");this.config_=v;this.G=this.U=null;this.Wy="";this.tU=I;this.Sj=null;this.Z=()=>{}; this.md=NaN;this.L1=(0,g.m7)(this.bU,this);this.L=()=>{}; this.j=this.B=0}N0(d){this.G=d;this.G.addUpdateListener(this.L1)}K(d){this.Sj=d;this.Z()}stop(){vy9(this);this.G?this.G.stop((0,g.m7)(this.J4,this,null),(0,g.m7)(this.J4,this,"Failed to stop DIAL device.")):this.J4()}F2(){vy9(this);this.G&&this.G.removeUpdateListener(this.L1);this.G=null;super.F2()}bU(d){this.X2()||d||(bI(this,"DIAL session died."),this.L(),this.L=()=>{},this.J4())}};var yO1=class extends D1{constructor(d,L){super(d,L,"ManualSession");this.G=g.l$((0,g.m7)(this.K,this,null),150)}stop(){this.J4()}N0(){}K(){g.NE(this.G);this.G=NaN;const d=aI(this.N.gG(),this.W.label);d?O8(this,d):this.J4(Error("No such screen"))}F2(){g.NE(this.G);this.G=NaN;super.F2()}};var mP=class extends g.bh{constructor(d,L){super();this.config_=L;this.W=d;this.N0=L.appId||"233637DE";this.N=L.theme||"cl";this.sU=L.disableCastApi||!1;this.B=L.forceMirroring||!1;this.O=null;this.j=!1;this.G=[];this.K=(0,g.m7)(this.Sj,this)}init(d,L){chrome.cast.timeout.requestSession=3E4;var I=new chrome.cast.SessionRequest(this.N0,[chrome.cast.Capability.AUDIO_OUT]);g.cW("desktop_enable_cast_connect")&&(I.androidReceiverCompatible=!0);this.sU||(I.dialRequest=new chrome.cast.DialRequest("YouTube")); const v=chrome.cast.AutoJoinPolicy.TAB_AND_ORIGIN_SCOPED;d=d||this.B?chrome.cast.DefaultActionPolicy.CAST_THIS_TAB:chrome.cast.DefaultActionPolicy.CREATE_SESSION;const F=(0,g.m7)(this.tU,this);I=new chrome.cast.ApiConfig(I,(0,g.m7)(this.U,this),F,v,d);I.customDialLaunchCallback=(0,g.m7)(this.L1,this);chrome.cast.initialize(I,(0,g.m7)(function(){this.X2()||(chrome.cast.addReceiverActionListener(this.K),zYc(),this.W.subscribe("onlineScreenChange",(0,g.m7)(this.L,this)),this.G=HW8(this),chrome.cast.setCustomReceivers(this.G, ()=>{},(0,g.m7)(function(R){this.Q0("Failed to set initial custom receivers: "+g.JC(R))},this)),this.publish("yt-remote-cast2-availability-change",ks(this)),L(!0))},this),(0,g.m7)(function(R){this.Q0("Failed to initialize API: "+g.JC(R)); L(!1)},this))}aL(d,L){K0("Setting connected screen ID: "+d+" -> "+L); if(this.O){var I=this.O.O;if(!d||I&&I.id!=d)K0("Unsetting old screen status: "+this.O.W.friendlyName),ev(this,null)}if(d&&L){if(!this.O){d=aI(this.W.gG(),d);if(!d){K0("setConnectedScreenStatus: Unknown screen.");return}if(d.idType=="shortLived"){K0("setConnectedScreenStatus: Screen with id type to be short lived.");return}I=bW1(this,d);I||(K0("setConnectedScreenStatus: Connected receiver not custom..."),I=new chrome.cast.Receiver(d.uuid?d.uuid:d.id,d.name),I.receiverType=chrome.cast.ReceiverType.CUSTOM, this.G.push(I),chrome.cast.setCustomReceivers(this.G,()=>{},(0,g.m7)(function(v){this.Q0("Failed to set initial custom receivers: "+g.JC(v))},this))); K0("setConnectedScreenStatus: new active receiver: "+I.friendlyName);ev(this,new yO1(this.W,I),!0)}this.O.oJ(L)}else K0("setConnectedScreenStatus: no screen.")}K1(d){this.X2()?this.Q0("Setting connection data on disposed cast v2"):this.O?this.O.K(d):this.Q0("Setting connection data without a session")}Wy(){this.X2()?this.Q0("Stopping session on disposed cast v2"):this.O?(this.O.stop(),ev(this,null)):K0("Stopping non-existing session")}requestSession(){chrome.cast.requestSession((0,g.m7)(this.U,this), (0,g.m7)(this.bU,this))}F2(){this.W.unsubscribe("onlineScreenChange",(0,g.m7)(this.L,this));window.chrome&&chrome.cast&&chrome.cast.removeReceiverActionListener(this.K);var d=GjH;const L=g.ai("yt.mdx.remote.debug.handlers_");g.DH(L||[],d);g.dr(this.O);super.F2()}Q0(d){Z6("Controller",d)}md(d,L){this.O==d&&(L||ev(this,null),this.publish("yt-remote-cast2-session-change",L))}Sj(d,L){if(!this.X2())if(d)switch(d.friendlyName=chrome.cast.unescape(d.friendlyName),K0("onReceiverAction_ "+d.label+" / "+d.friendlyName+ "-- "+L),L){case chrome.cast.ReceiverAction.CAST:if(this.O)if(this.O.W.label!=d.label)K0("onReceiverAction_: Stopping active receiver: "+this.O.W.friendlyName),this.O.stop();else{K0("onReceiverAction_: Casting to active receiver.");this.O.O&&this.publish("yt-remote-cast2-session-change",this.O.O);break}switch(d.receiverType){case chrome.cast.ReceiverType.CUSTOM:ev(this,new yO1(this.W,d));break;case chrome.cast.ReceiverType.DIAL:ev(this,new oGn(this.W,d,this.N,this.config_));break;case chrome.cast.ReceiverType.CAST:ev(this, new pK(this.W,d,this.config_));break;default:this.Q0("Unknown receiver type: "+d.receiverType)}break;case chrome.cast.ReceiverAction.STOP:this.O&&this.O.W.label==d.label?this.O.stop():this.Q0("Stopping receiver w/o session: "+d.friendlyName)}else this.Q0("onReceiverAction_ called without receiver.")}L1(d){if(this.X2())return Promise.reject(Error("disposed"));var L=d.receiver;L.receiverType!=chrome.cast.ReceiverType.DIAL&&(this.Q0("Not DIAL receiver: "+L.friendlyName),L.receiverType=chrome.cast.ReceiverType.DIAL); var I=this.O?this.O.W:null;if(!I||I.label!=L.label)return this.Q0("Receiving DIAL launch request for non-clicked DIAL receiver: "+L.friendlyName),Promise.reject(Error("illegal DIAL launch"));if(I&&I.label==L.label&&I.receiverType!=chrome.cast.ReceiverType.DIAL){if(this.O.O)return K0("Reselecting dial screen."),this.publish("yt-remote-cast2-session-change",this.O.O),Promise.resolve(new chrome.cast.DialLaunchResponse(!1));this.Q0('Changing CAST intent from "'+I.receiverType+'" to "dial" for '+L.friendlyName); ev(this,new oGn(this.W,L,this.N,this.config_))}L=this.O;L.U=d;L.U.appState==chrome.cast.DialAppState.RUNNING?(d=L.U.extraData||{},I=d.screenId||null,yh(L)&&d.loungeToken?d.loungeTokenRefreshIntervalMs?d=OW8(L,{name:L.W.friendlyName,screenId:d.screenId,loungeToken:d.loungeToken,dialId:L.U.receiver.label,screenIdType:"shortLived"},d.loungeTokenRefreshIntervalMs):(g.BW(Error(`No loungeTokenRefreshIntervalMs presents in additionalData: ${JSON.stringify(d)}.`)),d=RSb(L,I)):d=RSb(L,I)):d=oe(L);return d}U(d){if(!this.X2()&& !this.B){K0("New cast session ID: "+d.sessionId);var L=d.receiver;if(L.receiverType!=chrome.cast.ReceiverType.CUSTOM){if(!this.O)if(L.receiverType==chrome.cast.ReceiverType.CAST)K0("Got resumed cast session before resumed mdx connection."),L.friendlyName=chrome.cast.unescape(L.friendlyName),ev(this,new pK(this.W,L,this.config_),!0);else{this.Q0("Got non-cast session without previous mdx receiver event, or mdx resume.");return}var I=this.O.W,v=aI(this.W.gG(),I.label);v&&r8(v,L.label)&&I.receiverType!= chrome.cast.ReceiverType.CAST&&L.receiverType==chrome.cast.ReceiverType.CAST&&(K0("onSessionEstablished_: manual to cast session change "+L.friendlyName),g.dr(this.O),this.O=new pK(this.W,L,this.config_),this.O.subscribe("sessionScreen",(0,g.m7)(this.md,this,this.O)),this.O.subscribe("sessionFailed",()=>nyn(this,this.O)),this.O.K(null)); this.O.N0(d)}}}Z(){return this.O?this.O.di():null}bU(d){this.X2()||(this.Q0("Failed to estabilish a session: "+g.JC(d)),d.code!=chrome.cast.ErrorCode.CANCEL&&ev(this,null),this.publish("yt-remote-cast2-session-failed"))}tU(d){K0("Receiver availability updated: "+d);if(!this.X2()){var L=ks(this);this.j=d==chrome.cast.ReceiverAvailability.AVAILABLE;ks(this)!=L&&this.publish("yt-remote-cast2-availability-change",ks(this))}}L(){this.X2()||(this.G=HW8(this),K0("Updating custom receivers: "+g.JC(this.G)), chrome.cast.setCustomReceivers(this.G,()=>{},(0,g.m7)(function(){this.Q0("Failed to set custom receivers.")},this)),this.publish("yt-remote-cast2-availability-change",ks(this)))}}; mP.prototype.setLaunchParams=mP.prototype.K1;mP.prototype.setConnectedScreenStatus=mP.prototype.aL;mP.prototype.stopSession=mP.prototype.Wy;mP.prototype.getCastSession=mP.prototype.Z;mP.prototype.requestSession=mP.prototype.requestSession;mP.prototype.init=mP.prototype.init;mP.prototype.dispose=mP.prototype.dispose;var AG=[],Keb=(0,g.lf)`https://www.gstatic.com/cv/js/sender/v1/cast_sender.js`;g.p=zI.prototype; g.p.reset=function(d){this.listId="";this.index=-1;this.videoId="";E8(this);this.volume=-1;this.muted=!1;d&&(this.index=d.index,this.listId=d.listId,this.videoId=d.videoId,this.playerState=d.playerState,this.volume=d.volume,this.muted=d.muted,this.audioTrackId=d.audioTrackId,this.trackData=d.trackData,this.hasPrevious=d.hasPrevious,this.hasNext=d.hasNext,this.K=d.playerTime,this.L=d.playerTimeAt,this.W=d.seekableStart,this.B=d.seekableEnd,this.G=d.duration,this.loadedTime=d.loadedTime,this.O=d.liveIngestionTime, this.N=!isNaN(this.O))}; g.p.isPlaying=function(){return this.playerState==1}; g.p.isBuffering=function(){return this.playerState==3}; g.p.Jg=function(d){this.G=isNaN(d)?0:d}; g.p.getDuration=function(){return this.N?this.G+hG(this):this.G}; g.p.clone=function(){return new zI(iI(this))};var rOQ=class extends g.bh{constructor(){var d=D_();super();this.G=0;this.N=d;this.B=[];this.L=new DSx;this.W=this.O=null;this.Z=(0,g.m7)(this.Sj,this);this.U=(0,g.m7)(this.K,this);this.md=(0,g.m7)(this.L1,this);this.sU=(0,g.m7)(this.tU,this);let L=0;d?(L=d.getProxyState(),L!=3&&(d.subscribe("proxyStateChange",this.N0,this),pL$(this))):L=3;L!=0&&g.l$(()=>{this.N0(L)},0); (d=jrw())&&$s(this,d);this.subscribe("yt-remote-cast2-session-change",this.sU)}getState(){return this.G}T6(){return this.N.getReconnectTimeout()}Pd(){this.N.reconnect()}play(){Ys(this)?(this.O?this.O.play(null,g.G9,U8(this,"play")):Sv(this,"play"),q4(this,1,JG(xs(this))),this.publish("remotePlayerChange")):lI(this,this.play)}pause(){Ys(this)?(this.O?this.O.pause(null,g.G9,U8(this,"pause")):Sv(this,"pause"),q4(this,2,JG(xs(this))),this.publish("remotePlayerChange")):lI(this,this.pause)}seekTo(d){if(Ys(this)){if(this.O){const L= xs(this),I=new chrome.cast.media.SeekRequest;I.currentTime=d;L.isPlaying()||L.isBuffering()?I.resumeState=chrome.cast.media.ResumeState.PLAYBACK_START:I.resumeState=chrome.cast.media.ResumeState.PLAYBACK_PAUSE;this.O.seek(I,g.G9,U8(this,"seekTo",{newTime:d}))}else Sv(this,"seekTo",{newTime:d});q4(this,3,d);this.publish("remotePlayerChange")}else lI(this,g.zF(this.seekTo,d))}stop(){if(Ys(this)){this.O?this.O.stop(null,g.G9,U8(this,"stopVideo")):Sv(this,"stopVideo");var d=xs(this);d.index=-1;d.videoId= "";E8(d);s8(this,d);this.publish("remotePlayerChange")}else lI(this,this.stop)}setVolume(d,L){if(Ys(this)){var I=xs(this);if(this.W){if(I.volume!=d){const v=Math.round(d)/100;this.W.setReceiverVolumeLevel(v,(0,g.m7)(function(){NM("set receiver volume: "+v)},this),(0,g.m7)(function(){this.Q0("failed to set receiver volume.")},this))}I.muted!=L&&this.W.setReceiverMuted(L,(0,g.m7)(function(){NM("set receiver muted: "+L)},this),(0,g.m7)(function(){this.Q0("failed to set receiver muted.")},this))}else{const v= {volume:d, muted:L};I.volume!=-1&&(v.delta=d-I.volume);Sv(this,"setVolume",v)}I.muted=L;I.volume=d;s8(this,I)}else lI(this,g.zF(this.setVolume,d,L))}j(d,L){if(Ys(this)){var I=xs(this);d={videoId:d};L&&(I.trackData={trackName:L.name,languageCode:L.languageCode,sourceLanguageCode:L.translationLanguage?L.translationLanguage.languageCode:"",languageName:L.languageName,kind:L.kind},d.style=g.JC(L.style),g.Lr(d,I.trackData));Sv(this,"setSubtitlesTrack",d);s8(this,I)}else lI(this,g.zF(this.j,d,L))}setAudioTrack(d, L){Ys(this)?(L=L.getLanguageInfo().getId(),Sv(this,"setAudioTrack",{videoId:d,audioTrackId:L}),d=xs(this),d.audioTrackId=L,s8(this,d)):lI(this,g.zF(this.setAudioTrack,d,L))}playVideo(d,L,I,v=null,F=null,R=null,D=null){const O=xs(this),b={videoId:d};I!==void 0&&(b.currentIndex=I);C0(O,d,I||0);L!==void 0&&(wd(O,L),b.currentTime=L);v&&(b.listId=v);F&&(b.playerParams=F);R&&(b.clickTrackingParams=R);D&&(b.locationInfo=g.JC(D));Sv(this,"setPlaylist",b);v||s8(this,O)}Bs(d,L){if(Ys(this)){if(d&&L){const I= xs(this);C0(I,d,L);s8(this,I)}Sv(this,"previous")}else lI(this,g.zF(this.Bs,d,L))}nextVideo(d,L){if(Ys(this)){if(d&&L){const I=xs(this);C0(I,d,L);s8(this,I)}Sv(this,"next")}else lI(this,g.zF(this.nextVideo,d,L))}Rp(){if(Ys(this)){Sv(this,"clearPlaylist");var d=xs(this);d.reset();s8(this,d);this.publish("remotePlayerChange")}else lI(this,this.Rp)}Wy(){Ys(this)?Sv(this,"dismissAutoplay"):lI(this,this.Wy)}dispose(){if(this.G!=3){const d=this.G;this.G=3;this.publish("proxyStateChange",d,this.G)}super.dispose()}F2(){PYU(this); this.N=null;this.L.clear();$s(this,null);super.F2()}N0(d){if((d!=this.G||d==2)&&this.G!=3&&d!=0){var L=this.G;this.G=d;this.publish("proxyStateChange",L,d);if(d==1)for(;!this.L.isEmpty();)L=d=this.L,L.O.length===0&&(L.O=L.W,L.O.reverse(),L.W=[]),d.O.pop().apply(this);else d==3&&this.dispose()}}bU(d,L){this.publish(d,L)}Sj(d){if(!d)this.K(null),$s(this,null);else if(this.W.receiver.volume){d=this.W.receiver.volume;const L=xs(this),I=Math.round(100*d.level||0);if(L.volume!=I||L.muted!=d.muted)NM("Cast volume update: "+ d.level+(d.muted?" muted":"")),L.volume=I,L.muted=!!d.muted,s8(this,L)}}K(d){NM("Cast media: "+!!d);this.O&&this.O.removeUpdateListener(this.md);if(this.O=d)this.O.addUpdateListener(this.md),GCw(this),this.publish("remotePlayerChange")}L1(d){d?(GCw(this),this.publish("remotePlayerChange")):this.K(null)}Kb(){Sv(this,"sendDebugCommand",{debugCommand:"stats4nerds "})}tU(){const d=jrw();d&&$s(this,d)}Q0(d){Z6("CP",d)}};var KK=class extends g.bh{constructor(d,L=!1){var I=f0,v=Fq();super();this.K=NaN;this.L1=!1;this.Z=this.md=this.N0=this.sU=NaN;this.Wy=[];this.L=this.j=this.N=this.O=this.W=null;this.M0=I;this.bU=L;this.Wy.push(g.LX(window,"beforeunload",()=>{this.B(2)})); this.G=[];this.O=new zI;this.jj=d.id;this.tU=d.idType;this.W=P6$(this.M0,v,this.Sj,this.tU=="shortLived",this.jj);this.W.listen("channelOpened",()=>{upw(this)}); this.W.listen("channelClosed",()=>{Z1("Channel closed");isNaN(this.K)?p3(!0):p3();this.dispose()}); this.W.listen("channelError",F=>{p3();isNaN(this.U())?(F==1&&this.tU=="shortLived"&&this.publish("browserChannelAuthError",F),Z1(`Channel error: ${F} without reconnection`),this.dispose()):(this.L1=!0,Z1("Channel error: "+F+" with reconnection in "+this.U()+" ms"),M4(this,2))}); this.W.listen("channelMessage",F=>{SuL(this,F)}); this.W.uP(d.token);this.subscribe("remoteQueueChange",()=>{var F=this.O.videoId;g.ow()&&g.bq("yt-remote-session-video-id",F)})}connect(d,L){if(L){var I=L.listId; const v=L.videoId,F=L.videoIds,R=L.playerParams,D=L.clickTrackingParams,O=L.index,b={videoId:v},H=L.currentTime,n=L.locationInfo;L=L.loopMode;H!==void 0&&(b.currentTime=H<=5?0:H);R&&(b.playerParams=R);n&&(b.locationInfo=n);D&&(b.clickTrackingParams=D);I&&(b.listId=I);F&&F.length>0&&(b.videoIds=F.join(","));O!==void 0&&(b.currentIndex=O);this.bU&&(b.loopMode=L||"LOOP_MODE_OFF");I&&(this.O.listId=I);this.O.videoId=v;this.O.index=O||0;this.O.state=3;wd(this.O,H);this.L="UNSUPPORTED";I=this.bU?"setInitialState": "setPlaylist";Z1(`Connecting with ${I} and params: ${g.JC(b)}`);this.W.connect({method:I,params:g.JC(b)},d,xqc())}else Z1("Connecting without params"),this.W.connect({},d,xqc());UC8(this)}uP(d){this.W.uP(d)}dispose(){this.X2()||(g.WB("yt.mdx.remote.remoteClient_",null),this.publish("beforeDispose"),M4(this,3));super.dispose()}F2(){Qh(this);cC(this);N4(this);g.NE(this.md);this.md=NaN;g.NE(this.Z);this.Z=NaN;this.N=null;g.Iw(this.Wy);this.Wy.length=0;this.W.dispose();super.F2();this.L=this.j=this.G= this.O=this.W=null}K1(d){if(!this.G||this.G.length===0)return!1;for(const L of this.G)if(!L.capabilities.has(d))return!1;return!0}ej(){let d=3;this.X2()||(d=0,isNaN(this.U())?this.W.nP()&&isNaN(this.K)&&(d=1):d=2);return d}B(d){Z1("Disconnecting with "+d);g.WB("yt.mdx.remote.remoteClient_",null);Qh(this);this.publish("beforeDisconnect",d);d==1&&p3();this.W.disconnect(d);this.dispose()}ZH(){let d=this.O;this.N&&(d=this.O.clone(),C0(d,this.N,d.index));return iI(d)}Px(d){const L=new zI(d);L.videoId&& L.videoId!=this.O.videoId&&(this.N=L.videoId,g.NE(this.md),this.md=g.l$(()=>{if(this.N){const v=this.N;this.N=null;this.O.videoId!=v&&Vh(this,"getNowPlaying")}},5E3)); const I=[];this.O.listId==L.listId&&this.O.videoId==L.videoId&&this.O.index==L.index||I.push("remoteQueueChange");this.O.playerState==L.playerState&&this.O.volume==L.volume&&this.O.muted==L.muted&&JG(this.O)==JG(L)&&g.JC(this.O.trackData)==g.JC(L.trackData)||I.push("remotePlayerChange");this.O.reset(d);g.ld(I,function(v){this.publish(v)},this)}aL(){const d=this.W.getDeviceId(),L=g.g$(this.G,function(I){return I.type=="REMOTE_CONTROL"&&I.id!=d}); return L?L.id:""}U(){return this.W.T6()}IL(){return this.L||"UNSUPPORTED"}q0(){return this.j||""}By(){!isNaN(this.U())&&this.W.Pd()}Wx(d,L){Vh(this,d,L);lPb(this)}Sj(){var d=g.k8("SAPISID","")||g.k8("__Secure-1PAPISID")||"",L=g.k8("__Secure-3PAPISID","")||"";if(!d&&!L)return"";d=g.Ev(g.uS(d),2);L=g.Ev(g.uS(L),2);return g.Ev(g.uS(`,${d},${L}`),2)}};KK.prototype.subscribe=KK.prototype.subscribe;KK.prototype.unsubscribeByKey=KK.prototype.pC;KK.prototype.getProxyState=KK.prototype.ej; KK.prototype.disconnect=KK.prototype.B;KK.prototype.getPlayerContextData=KK.prototype.ZH;KK.prototype.setPlayerContextData=KK.prototype.Px;KK.prototype.getOtherConnectedRemoteId=KK.prototype.aL;KK.prototype.getReconnectTimeout=KK.prototype.U;KK.prototype.getAutoplayMode=KK.prototype.IL;KK.prototype.getAutoplayVideoId=KK.prototype.q0;KK.prototype.reconnect=KK.prototype.By;KK.prototype.sendMessage=KK.prototype.Wx;KK.prototype.getXsrfToken=KK.prototype.Sj; KK.prototype.isCapabilitySupportedOnConnectedDevices=KK.prototype.K1;var fP9=class extends Vr{constructor(d){super("ScreenServiceProxy");this.r4=d;this.O=[];this.O.push(this.r4.$_s("screenChange",(0,g.m7)(this.W,this)));this.O.push(this.r4.$_s("onlineScreenChange",(0,g.m7)(this.G,this)))}gG(d){return this.r4.$_gs(d)}contains(d){return!!this.r4.$_c(d)}get(d){return this.r4.$_g(d)}start(){this.r4.$_st()}add(d,L,I){this.r4.$_a(d,L,I)}remove(d,L,I){this.r4.$_r(d,L,I)}IC(d,L,I,v){this.r4.$_un(d,L,I,v)}F2(){const d=this.O.length;for(let L=0;L{XL$(this,v)}); g.G(this,this.events);this.events.A(L,"onCaptionsTrackListChanged",this.By);this.events.A(L,"captionschanged",this.M0);this.events.A(L,"captionssettingschanged",this.bU);this.events.A(L,"videoplayerreset",this.B);this.events.A(L,"mdxautoplaycancel",()=>{this.mB.Wy()}); L.C("enable_mdx_video_play_directly")&&this.events.A(L,"videodatachange",()=>{ISw(this.O)||eO(this)||aA(this,0)}); d=this.mB;d.X2();d.subscribe("proxyStateChange",this.L1,this);d.subscribe("remotePlayerChange",this.L,this);d.subscribe("remoteQueueChange",this.B,this);d.subscribe("previousNextChange",this.sU,this);d.subscribe("nowAutoplaying",this.N0,this);d.subscribe("autoplayDismissed",this.Wy,this);g.G(this,this.W);g.G(this,this.G);g.G(this,this.md);g.G(this,this.Z);g.G(this,this.U);this.bU();this.B();this.L()}F2(){super.F2();this.W.stop();this.G.stop();this.md.stop();const d=this.mB;d.unsubscribe("proxyStateChange", this.L1,this);d.unsubscribe("remotePlayerChange",this.L,this);d.unsubscribe("remoteQueueChange",this.B,this);d.unsubscribe("previousNextChange",this.sU,this);d.unsubscribe("nowAutoplaying",this.N0,this);d.unsubscribe("autoplayDismissed",this.Wy,this);this.mB=this.O=null}aq(d,...L){if(this.mB.G!=2)if(eO(this)){if(xs(this.mB).playerState!=1081||d!=="control_seek")switch(d){case "control_toggle_play_pause":xs(this.mB).isPlaying()?this.mB.pause():this.mB.play();break;case "control_play":this.mB.play(); break;case "control_pause":this.mB.pause();break;case "control_seek":this.U.N(L[0],L[1]);break;case "control_subtitles_set_track":BI(this,L[0]);break;case "control_set_audio_track":this.setAudioTrack(L[0])}}else switch(d){case "control_toggle_play_pause":case "control_play":case "control_pause":d=this.X.getCurrentTime();aA(this,d===0?void 0:d);break;case "control_seek":aA(this,L[0]);break;case "control_subtitles_set_track":BI(this,L[0]);break;case "control_set_audio_track":this.setAudioTrack(L[0])}}M0(d){this.md.jk(d)}jj(d){this.aq("control_subtitles_set_track", g.Un(d)?null:d)}bU(){const d=this.X.getOption("captions","track");g.Un(d)||BI(this,d)}B5(d){this.O.B5(d,this.X.getVideoData().lengthSeconds)}By(){g.Un(this.N)||dAQ(this,this.N);this.K=!1}L1(d,L){this.G.stop();L===2&&this.tU()}L(){if(eO(this)){this.W.stop();var d=xs(this.mB);switch(d.playerState){case 1080:case 1081:case 1084:case 1085:this.O.sE=1;break;case 1082:case 1083:this.O.sE=0;break;default:this.O.sE=-1}switch(d.playerState){case 1081:case 1:this.F4(new g.WM(8));this.Sj();break;case 1085:case 3:this.F4(new g.WM(9)); break;case 1083:case 0:this.F4(new g.WM(2));this.U.stop();this.B5(this.X.getVideoData().lengthSeconds);break;case 1084:this.F4(new g.WM(4));break;case 2:this.F4(new g.WM(4));this.B5(JG(d));break;case -1:this.F4(new g.WM(64));break;case -1E3:this.F4(new g.WM(128,{errorCode:"mdx.remoteerror",errorMessage:"\u9019\u90e8\u5f71\u7247\u4e0d\u63d0\u4f9b\u9060\u7aef\u64ad\u653e\u3002\u3000",OL:2}))}const I=xs(this.mB).trackData;d=I;var L=this.N;(d||L?d&&L&&d.trackName==L.trackName&&d.languageCode==L.languageCode&& d.languageName==L.languageName&&d.kind==L.kind:1)||(this.N=I,dAQ(this,I));d=xs(this.mB);d.volume===-1||Math.round(this.X.getVolume())===d.volume&&this.X.isMuted()===d.muted||this.Z.isActive()||this.aL()}else Lp$(this)}sU(){this.X.publish("mdxpreviousnextchange")}B(){eO(this)||Lp$(this)}N0(d){isNaN(d)||this.X.publish("mdxnowautoplaying",d)}Wy(){this.X.publish("mdxautoplaycanceled")}setAudioTrack(d){eO(this)&&this.mB.setAudioTrack(WI(this).videoId,d)}seekTo(d,L){xs(this.mB).playerState===-1?aA(this, d):L&&this.mB.seekTo(d)}aL(){if(eO(this)){var d=xs(this.mB);this.events.Ca(this.K1);d.muted?this.X.mute():this.X.unMute();this.X.setVolume(d.volume);this.K1=this.events.A(this.X,"onVolumeChange",L=>{XL$(this,L)})}}Sj(){this.W.stop(); if(!this.mB.X2()){var d=xs(this.mB);d.isPlaying()&&this.F4(new g.WM(8));this.B5(JG(d));this.W.start()}}tU(){this.G.stop();this.W.stop();const d=this.mB.T6();this.mB.G==2&&!isNaN(d)&&this.G.start()}F4(d){this.G.stop();const L=this.j;if(!g.p$(L,d)){const I=d.O(2);I!==this.j.O(2)&&this.X.YD(I);this.j=d;vGU(this.O,L,d)}}};var Kpc=class extends g.zu{constructor(d,L){super(d);this.O=L}getCurrentTime(){return this.O.getCurrentTime()}getDuration(){return this.O.getDuration()}aM(){return this.O.aM()}rG(){return this.O.rG()}xR(){return this.O.xR()}kH(){return this.O.kH()}getPlayerState(){return this.O.ZQ}isAtLiveHead(){return this.O.isAtLiveHead()}pauseVideo(){jO(this.O,"control_pause")}async playVideo(){jO(this.O,"control_play")}seekTo(d,L){jO(this.O,"control_seek",d,!L?.v4)}Tp(d){jO(this.O,"control_set_audio_track",d); return!0}};var eoH=class extends g.f{constructor(){super({S:"div",Y:"ytp-mdx-popup-dialog",D:{role:"dialog"},J:[{S:"div",Y:"ytp-mdx-popup-dialog-inner-content",J:[{S:"div",Y:"ytp-mdx-popup-title",Py:"\u4f60\u5df2\u767b\u51fa\u5e33\u6236"},{S:"div",Y:"ytp-mdx-popup-description",Py:"\u4f60\u89c0\u770b\u7684\u5f71\u7247\u53ef\u80fd\u6703\u65b0\u589e\u81f3\u96fb\u8996\u7684\u89c0\u770b\u8a18\u9304\uff0c\u4e26\u5f71\u97ff\u7cfb\u7d71\u5728\u96fb\u8996\u4e0a\u63a8\u85a6\u7684\u5167\u5bb9\u3002\u5982\u8981\u907f\u514d\u9019\u7a2e\u60c5\u6cc1\uff0c\u8acb\u6309\u4e00\u4e0b [\u53d6\u6d88] \u4e26\u5728\u96fb\u8166\u4e0a\u767b\u5165 YouTube\u3002"}, {S:"div",Y:"ytp-mdx-privacy-popup-buttons",J:[{S:"button",RL:["ytp-button","ytp-mdx-privacy-popup-cancel"],Py:"\u53d6\u6d88"},{S:"button",RL:["ytp-button","ytp-mdx-privacy-popup-confirm"],Py:"\u78ba\u8a8d"}]}]}]});this.fade=new g.G2(this,250);this.cancelButton=this.EU("ytp-mdx-privacy-popup-cancel");this.confirmButton=this.EU("ytp-mdx-privacy-popup-confirm");g.G(this,this.fade);this.A(this.cancelButton,"click",this.O);this.A(this.confirmButton,"click",this.W)}Ut(){this.fade.show()}zO(){this.fade.hide()}O(){GL("mdx-privacy-popup-cancel"); this.zO()}W(){GL("mdx-privacy-popup-confirm");this.zO()}};var WpL=class extends g.f{constructor(d){super({S:"div",Y:"ytp-remote",J:[{S:"div",Y:"ytp-remote-display-status",J:[{S:"div",Y:"ytp-remote-display-status-icon",J:[g.Tr$()]},{S:"div",Y:"ytp-remote-display-status-text",Py:"{{statustext}}"}]}]});this.api=d;this.fade=new g.G2(this,250);g.G(this,this.fade);this.A(d,"presentingplayerstatechange",this.onStateChange);this.Mh(d.getPlayerStateObject())}onStateChange(d){this.Mh(d.state)}Mh(d){if(this.api.getPresentingPlayerType()===3){const L={RECEIVER_NAME:this.api.getOption("remote", "currentReceiver").name};d=d.O(128)?g.pe("\u300c$RECEIVER_NAME\u300d\u767c\u751f\u932f\u8aa4",L):d.isPlaying()||d.isPaused()?g.pe("\u6b63\u5728\u300c$RECEIVER_NAME\u300d\u4e0a\u64ad\u653e",L):g.pe("\u5df2\u9023\u7dda\u81f3\u300c$RECEIVER_NAME\u300d",L);this.updateValue("statustext",d);this.fade.show()}else this.fade.hide()}};var aS9=class extends g.k7{constructor(d,L){super("\u64ad\u653e\u87a2\u5e55\uff1a",1,d,L);this.X=d;this.MW={};this.A(d,"onMdxReceiversChange",this.K);this.A(d,"presentingplayerstatechange",this.K);this.K()}K(){var d=this.X.getOption("remote","receivers");d&&d.length>1&&!this.X.getOption("remote","quickCast")?(this.MW=g.P1(d,this.L,this),this.N(g.N7(d,this.L)),d=this.X.getOption("remote","currentReceiver"),d=this.L(d),this.options[d]&&this.W(d),this.enable(!0)):this.enable(!1)}L(d){return d.key}G(d){return d=== "cast-selector-receiver"?"\u6295\u653e\u2026":this.MW[d].name}O(d){super.O(d);this.X.setOption("remote","currentReceiver",this.MW[d]);this.GO.zO()}};g.au("remote",class extends g.WN{constructor(d){super(d);this.kI={key:e9(),name:"\u9019\u53f0\u96fb\u8166"};this.Iq=null;this.subscriptions=[];this.f2=this.mB=null;this.MW=[this.kI];this.rJ=this.kI;this.ZQ=new g.WM(64);this.wC=0;this.sE=-1;this.X3=!1;this.EE=this.wE=this.g8=null;if(!g.cU(this.player.V())&&!g.fV(this.player.V())){d=this.player;var L=g.I9(d);L&&(L=L.uB())&&(L=new aS9(d,L),g.G(this,L));L=new WpL(d);g.G(this,L);g.KH(d,L.element,4);this.g8=new eoH;g.G(this,this.g8);g.KH(d,this.g8.element, 4);this.X3=!!vI()}}create(){var d=this.player.V();const L=g.fT(d);d={device:"Desktop",app:"youtube-desktop",loadCastApiSetupScript:d.C("mdx_load_cast_api_bootstrap_script"),enableDialLoungeToken:d.C("enable_dial_short_lived_lounge_token"),enableCastLoungeToken:d.C("enable_cast_short_lived_lounge_token")};QrQ(L,d);this.subscriptions.push(g.Hr("yt-remote-before-disconnect",this.Ez,this));this.subscriptions.push(g.Hr("yt-remote-connection-change",this.xf,this));this.subscriptions.push(g.Hr("yt-remote-receiver-availability-change", this.CQ,this));this.subscriptions.push(g.Hr("yt-remote-auto-connect",this.ST,this));this.subscriptions.push(g.Hr("yt-remote-receiver-resumed",this.QD,this));this.subscriptions.push(g.Hr("mdx-privacy-popup-confirm",this.EX,this));this.subscriptions.push(g.Hr("mdx-privacy-popup-cancel",this.sX,this));this.CQ()}load(){this.player.cancelPlayback();super.load();this.EE=new Kpc(this.player.V(),this);this.player.G$(this.EE);this.Iq=new kKL(this,this.player,this.mB);var d=(d=gyH())?d.currentTime:0;const L= y6()?new rOQ:null;d==0&&L&&(d=JG(xs(L)));d!==0&&this.B5(d);vGU(this,this.ZQ,this.ZQ);this.player.oD(6)}unload(){this.player.publish("mdxautoplaycanceled");this.player.Ds();this.rJ=this.kI;g.LB(this.Iq,this.mB);this.mB=this.EE=this.Iq=null;super.unload();this.player.oD(5);t$(this)}F2(){g.nf(this.subscriptions);super.F2()}getAdState(){return this.sE}hasPrevious(){return this.mB?xs(this.mB).hasPrevious:!1}hasNext(){return this.mB?xs(this.mB).hasNext:!1}B5(d,L){this.wC=d||0;this.player.publish("progresssync", d,L);g.gO(this.player,"onVideoProgress",d||0)}getCurrentTime(){return this.wC}getDuration(){return xs(this.mB).getDuration()||0}aM(){var d=xs(this.mB);return d.N?d.O+hG(d):d.O}rG(){return xs(this.mB).loadedTime}xR(){return AKj(xs(this.mB))}kH(){var d=xs(this.mB);return d.W>0?d.W+hG(d):d.W}getProgressState(){const d=xs(this.mB),L=this.player.getVideoData();return{airingStart:0,airingEnd:0,allowSeeking:d.playerState!=1081&&this.player.qk(),clipEnd:L.clipEnd,clipStart:L.clipStart,current:this.getCurrentTime(), displayedStart:-1,duration:this.getDuration(),ingestionTime:this.aM(),isAtLiveHead:this.isAtLiveHead(),loaded:this.rG(),seekableEnd:this.xR(),seekableStart:this.kH(),offset:0,viewerLivestreamJoinMediaTime:0}}isAtLiveHead(){return AKj(xs(this.mB))-this.getCurrentTime()<=1}nextVideo(){this.mB&&this.mB.nextVideo()}Bs(){this.mB&&this.mB.Bs()}Ez(d){d===1&&(this.f2=this.mB?xs(this.mB):null)}xf(){var d=y6()?new rOQ:null;if(d){const L=this.rJ;this.loaded&&this.unload();this.mB=d;this.f2=null;L.key!==this.kI.key&& (this.rJ=L,this.load())}else g.dr(this.mB),this.mB=null,this.loaded&&(this.unload(),(d=this.f2)&&d.videoId===this.player.getVideoData().videoId&&this.player.cueVideoById(d.videoId,JG(d)));this.player.publish("videodatachange","newdata",this.player.getVideoData(),3)}CQ(){var d=[this.kI],L=d.concat;const I=cK9();p0()&&g.HR("yt-remote-cast-available")&&I.push({key:"cast-selector-receiver",name:"Cast..."});this.MW=L.call(d,I);d=Ow()||this.kI;A$(this,d);g.gO(this.player,"onMdxReceiversChange")}ST(){const d= Ow();A$(this,d)}QD(){this.rJ=Ow()}EX(){this.X3=!0;t$(this);kv=!1;bM&&nK(bM,1);bM=null}sX(){this.X3=!1;t$(this);A$(this,this.kI);this.rJ=this.kI;kv=!1;bM=null;this.player.playVideo()}Wf(d,L){switch(d){case "casting":return this.loaded;case "receivers":return this.MW;case "currentReceiver":return L&&(L.key==="cast-selector-receiver"?GI():A$(this,L)),this.loaded?this.rJ:this.kI;case "quickCast":return this.MW.length===2&&this.MW[1].key==="cast-selector-receiver"?(L&&GI(),!0):!1}}Kb(){this.mB.Kb()}Yy(){return!1}getOptions(){return["casting", "receivers","currentReceiver","quickCast"]}isLoggedIn(){return g.x("PLAYER_CONFIG")?.args?.authuser!==void 0?!0:!(!g.x("SESSION_INDEX")&&!g.x("LOGGED_IN"))}});})(_yt_player);