ds-algo-study
Version:
Just experimenting with publishing a package
279 lines (278 loc) • 97.1 kB
JavaScript
(function(g){var window=this;var IHa=function(a,b){return g.Jb(a,b)},u4=function(a,b,c){a.u.set(b,c)},v4=function(a){u4(a,"zx",Math.floor(2147483648*Math.random()).toString(36)+Math.abs(Math.floor(2147483648*Math.random())^g.C()).toString(36));
return a},w4=function(a,b,c){Array.isArray(c)||(c=[String(c)]);
g.bn(a.u,b,c)},JHa=function(a,b){var c=[];
g.kj(b,function(d){try{var e=g.Pn.prototype.l.call(this,d,!0)}catch(f){if("Storage: Invalid value was encountered"==f)return;throw f;}void 0===e?c.push(d):g.On(e)&&c.push(d)},a);
return c},KHa=function(a,b){var c=JHa(a,b);
g.yb(c,function(d){g.Pn.prototype.remove.call(this,d)},a)},LHa=function(a){if(a.W){if(a.W.locationOverrideToken)return{locationOverrideToken:a.W.locationOverrideToken};
if(null!=a.W.latitudeE7&&null!=a.W.longitudeE7)return{latitudeE7:a.W.latitudeE7,longitudeE7:a.W.longitudeE7}}return null},MHa=function(a,b){g.db(a,b)||a.push(b)},x4=function(a){var b=0,c;
for(c in a)b++;return b},NHa=function(a,b){var c=b instanceof g.zc?b:g.Fc(b,/^data:image\//i.test(b));
a.src=g.Ac(c)},y4=function(){},OHa=function(a){try{return g.A.JSON.parse(a)}catch(b){}a=String(a);
if(/^\s*$/.test(a)?0:/^[\],:{}\s\u2028\u2029]*$/.test(a.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("("+a+")")}catch(b){}throw Error("Invalid JSON string: "+a);},PHa=function(a){if(a.tg&&"function"==typeof a.tg)return a.tg();
if("string"===typeof a)return a.split("");if(g.La(a)){for(var b=[],c=a.length,d=0;d<c;d++)b.push(a[d]);return b}return g.Gb(a)},QHa=function(a,b){if(a.forEach&&"function"==typeof a.forEach)a.forEach(b,void 0);
else if(g.La(a)||"string"===typeof a)g.yb(a,b,void 0);else{if(a.uh&&"function"==typeof a.uh)var c=a.uh();else if(a.tg&&"function"==typeof a.tg)c=void 0;else if(g.La(a)||"string"===typeof a){c=[];for(var d=a.length,e=0;e<d;e++)c.push(e)}else c=g.Hb(a);d=PHa(a);e=d.length;for(var f=0;f<e;f++)b.call(void 0,d[f],c&&c[f],a)}},RHa=function(a,b,c,d){var e=new g.Qm(null,void 0);
a&&g.Rm(e,a);b&&g.Sm(e,b);c&&g.Tm(e,c);d&&(e.l=d);return e},z4=function(a,b){g.Eo[a]=!0;
var c=g.Co();c&&c.publish.apply(c,arguments);g.Eo[a]=!1},A4=function(a){this.app=this.name=this.id="";
this.type="REMOTE_CONTROL";this.obfuscatedGaiaId=this.avatar=this.username="";this.capabilities=new Set;this.experiments=new Set;this.theme="u";new g.Nm;a&&(this.id=a.id||a.name,this.name=a.name,this.app=a.app,this.type=a.type||"REMOTE_CONTROL",this.username=a.user||"",this.avatar=a.userAvatarUri||"",this.obfuscatedGaiaId=a.obfuscatedGaiaId||"",this.theme=a.theme||"u",SHa(this,a.capabilities||""),THa(this,a.experiments||""))},SHa=function(a,b){a.capabilities.clear();
g.He(b.split(","),g.Pa(IHa,UHa)).forEach(function(c){a.capabilities.add(c)})},THa=function(a,b){a.experiments.clear();
b.split(",").forEach(function(c){a.experiments.add(c)})},B4=function(a){a=a||{};
this.name=a.name||"";this.id=a.id||a.screenId||"";this.token=a.token||a.loungeToken||"";this.uuid=a.uuid||a.dialId||"";this.idType=a.screenIdType||"normal"},C4=function(a,b){return!!b&&(a.id==b||a.uuid==b)},VHa=function(a){return{name:a.name,
screenId:a.id,loungeToken:a.token,dialId:a.uuid,screenIdType:a.idType}},WHa=function(a){return new B4(a)},XHa=function(a){return Array.isArray(a)?g.Jc(a,WHa):[]},D4=function(a){return a?'{name:"'+a.name+'",id:'+a.id.substr(0,6)+"..,token:"+((a.token?".."+a.token.slice(-6):"-")+",uuid:"+(a.uuid?".."+a.uuid.slice(-6):"-")+",idType:"+a.idType+"}"):"null"},E4=function(a){return Array.isArray(a)?"["+g.Jc(a,D4).join(",")+"]":"null"},F4=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,
function(a){var b=16*Math.random()|0;
return("x"==a?b:b&3|8).toString(16)})},YHa=function(a){return g.Jc(a,function(b){return{key:b.id,
name:b.name}})},G4=function(a,b){return g.$a(a,function(c){return c||b?!c!=!b?!1:c.id==b.id:!0})},H4=function(a,b){return g.$a(a,function(c){return C4(c,b)})},ZHa=function(){var a=(0,g.Cu)();
a&&KHa(a,a.i.Qj(!0))},I4=function(){var a=g.Fu("yt-remote-connected-devices")||[];
g.vb(a);return a},$Ha=function(a){if(g.eb(a))return[];
var b=a[0].indexOf("#"),c=-1==b?a[0]:a[0].substring(0,b);return g.Jc(a,function(d,e){return 0==e?d:d.substring(c.length)})},aIa=function(a){g.Eu("yt-remote-connected-devices",a,86400)},K4=function(){if(J4)return J4;
var a=g.Fu("yt-remote-device-id");a||(a=F4(),g.Eu("yt-remote-device-id",a,31536E3));for(var b=I4(),c=1,d=a;g.db(b,d);)c++,d=a+"#"+c;return J4=d},L4=function(){var a=I4(),b=K4();
g.db(a,b);g.Hu()&&g.xb(a,b);a=$Ha(a);if(g.eb(a))try{g.Tq("remote_sid")}catch(c){}else try{g.Rq("remote_sid",a.join(","),-1)}catch(c){}},bIa=function(){return g.Fu("yt-remote-session-browser-channel")},cIa=function(){return g.Fu("yt-remote-local-screens")||[]},dIa=function(){g.Eu("yt-remote-lounge-token-expiration",!0,86400)},eIa=function(a){5<a.length&&(a=a.slice(a.length-5));
var b=g.Jc(cIa(),function(d){return d.loungeToken}),c=g.Jc(a,function(d){return d.loungeToken});
g.nh(c,function(d){return!g.db(b,d)})&&dIa();
g.Eu("yt-remote-local-screens",a,31536E3)},fIa=function(a,b){g.Eu("yt-remote-session-browser-channel",a);
g.Eu("yt-remote-session-screen-id",b);var c=I4(),d=K4();g.db(c,d)||c.push(d);aIa(c);L4()},M4=function(a){a||(g.Gu("yt-remote-session-screen-id"),g.Gu("yt-remote-session-video-id"));
L4();a=I4();g.ib(a,K4());aIa(a)},gIa=function(){if(!N4){var a=g.go();
a&&(N4=new g.Jn(a))}},hIa=function(){gIa();
return N4?!!N4.get("yt-remote-use-staging-server"):!1},O4=function(){var a=window.navigator.userAgent.match(/Chrome\/([0-9]+)/);
return a?parseInt(a[1],10):0},iIa=function(a){return!!document.currentScript&&(-1!=document.currentScript.src.indexOf("?"+a)||-1!=document.currentScript.src.indexOf("&"+a))},jIa=function(){return"function"==typeof window.__onGCastApiAvailable?window.__onGCastApiAvailable:null},P4=function(a){a.length?kIa(a.shift(),function(){P4(a)}):Q4()},lIa=function(a){return"chrome-extension://"+a+"/cast_sender.js"},kIa=function(a,b,c){var d=document.createElement("script");
d.onerror=b;c&&(d.onload=c);g.fd(d,g.ng(a));(document.head||document.documentElement).appendChild(d)},mIa=function(){var a=O4(),b=[];
if(1<a){var c=a-1;b.push("//www.gstatic.com/eureka/clank/"+a+"/cast_sender.js");b.push("//www.gstatic.com/eureka/clank/"+c+"/cast_sender.js")}return b},Q4=function(){var a=jIa();
a&&a(!1,"No cast extension found")},R4=function(){if(nIa){var a=2,b=jIa(),c=function(){a--;
0==a&&b&&b(!0)};
window.__onGCastApiAvailable=c;kIa("//www.gstatic.com/cast/sdk/libs/sender/1.0/cast_framework.js",Q4,c)}},oIa=function(){R4();
var a=mIa();a.push("//www.gstatic.com/eureka/clank/cast_sender.js");P4(a)},qIa=function(){R4();
var a=mIa();a.push.apply(a,g.la(pIa.map(lIa)));a.push("//www.gstatic.com/eureka/clank/cast_sender.js");P4(a)},S4=function(a,b,c){g.I.call(this);
this.I=null!=c?(0,g.B)(a,c):a;this.If=b;this.C=(0,g.B)(this.FJ,this);this.i=!1;this.l=0;this.u=this.gb=null;this.B=[]},T4=function(a,b,c){g.I.call(this);
this.B=null!=c?a.bind(c):a;this.If=b;this.u=null;this.i=!1;this.l=0;this.gb=null},U4=function(a){a.gb=g.Lm(function(){a.gb=null;
a.i&&!a.l&&(a.i=!1,U4(a))},a.If);
var b=a.u;a.u=null;a.B.apply(null,b)},V4=function(a){if(g.A.JSON)try{return g.A.JSON.parse(a)}catch(b){}return OHa(a)},W4=function(){},X4=function(a,b){if("function"!==typeof a)throw Error("Fn must not be null and must be a function");
return g.A.setTimeout(function(){a()},b)},Z4=function(a){Y4.dispatchEvent(new rIa(Y4,a))},rIa=function(a){g.Hl.call(this,"statevent",a)},$4=function(){},sIa=function(){},uIa=function(a){return(a=tIa(a))?new ActiveXObject(a):new XMLHttpRequest},tIa=function(a){if(!a.l&&"undefined"==typeof XMLHttpRequest&&"undefined"!=typeof ActiveXObject){for(var b=["MSXML2.XMLHTTP.6.0",
"MSXML2.XMLHTTP.3.0","MSXML2.XMLHTTP","Microsoft.XMLHTTP"],c=0;c<b.length;c++){var d=b[c];try{return new ActiveXObject(d),a.l=d}catch(e){}}throw Error("Could not create ActiveXObject. ActiveX might be disabled, or MSXML might not be installed");}return a.l},a5=function(a,b,c,d){this.i=a;
this.l=b;this.L=c;this.J=d||1;this.C=45E3;this.B=new g.u_(this);this.u=new g.Km;this.u.setInterval(250)},wIa=function(a,b,c){a.Cp=1;
a.Tk=v4(b.clone());a.zn=c;a.I=!0;vIa(a,null)},b5=function(a,b,c,d,e){a.Cp=1;
a.Tk=v4(b.clone());a.zn=null;a.I=c;e&&(a.EG=!1);vIa(a,d)},vIa=function(a,b){a.qp=g.C();
c5(a);a.Pl=a.Tk.clone();w4(a.Pl,"t",a.J);a.Bs=0;a.De=a.i.sx(a.i.Wr()?b:null);0<a.ow&&(a.Mu=new T4((0,g.B)(a.BH,a,a.De),a.ow));a.B.ya(a.De,"readystatechange",a.XP);var c=a.km?g.Qb(a.km):{};a.zn?(a.zv="POST",c["Content-Type"]="application/x-www-form-urlencoded",a.De.send(a.Pl,a.zv,a.zn,c)):(a.zv="GET",a.EG&&!g.xe&&(c.Connection="close"),a.De.send(a.Pl,a.zv,null,c));a.i.ji(1)},zIa=function(a,b,c){for(var d=!0;!a.Km&&a.Bs<c.length;){var e=xIa(a,c);
if(e==d5){4==b&&(a.Nk=4,Z4(15),d=!1);break}else if(e==yIa){a.Nk=4;Z4(16);d=!1;break}else e5(a,e)}4==b&&0==c.length&&(a.Nk=1,Z4(17),d=!1);a.zi=a.zi&&d;d||(f5(a),g5(a))},xIa=function(a,b){var c=a.Bs,d=b.indexOf("\n",c);
if(-1==d)return d5;c=Number(b.substring(c,d));if(isNaN(c))return yIa;d+=1;if(d+c>b.length)return d5;var e=b.substr(d,c);a.Bs=d+c;return e},BIa=function(a,b){a.qp=g.C();
c5(a);var c=b?window.location.hostname:"";a.Pl=a.Tk.clone();u4(a.Pl,"DOMAIN",c);u4(a.Pl,"t",a.J);try{a.Di=new ActiveXObject("htmlfile")}catch(n){f5(a);a.Nk=7;Z4(22);g5(a);return}var d="<html><body>";if(b){for(var e="",f=0;f<c.length;f++){var h=c.charAt(f);if("<"==h)h=e+"\\x3c";else if(">"==h)h=e+"\\x3e";else{if(h in h5)h=h5[h];else if(h in AIa)h=h5[h]=AIa[h];else{var l=h.charCodeAt(0);if(31<l&&127>l)var m=h;else{if(256>l){if(m="\\x",16>l||256<l)m+="0"}else m="\\u",4096>l&&(m+="0");m+=l.toString(16).toUpperCase()}h=
h5[h]=m}h=e+h}e=h}d+='<script>document.domain="'+e+'"\x3c/script>'}c=g.cd(g.bc("b/12014412"),d+"</body></html>");a.Di.open();a.Di.write(g.Zc(c));a.Di.close();a.Di.parentWindow.m=(0,g.B)(a.rP,a);a.Di.parentWindow.d=(0,g.B)(a.PF,a,!0);a.Di.parentWindow.rpcClose=(0,g.B)(a.PF,a,!1);c=a.Di.createElement("DIV");a.Di.parentWindow.document.body.appendChild(c);d=g.Ec(a.Pl.toString());d=g.kd(g.Ac(d));d=g.cd(g.bc("b/12014412"),'<iframe src="'+d+'"></iframe>');g.dd(c,d);a.i.ji(1)},c5=function(a){a.CA=g.C()+a.C;
CIa(a,a.C)},CIa=function(a,b){if(null!=a.Ip)throw Error("WatchDog timer not null");
a.Ip=X4((0,g.B)(a.zP,a),b)},i5=function(a){a.Ip&&(g.A.clearTimeout(a.Ip),a.Ip=null)},g5=function(a){a.i.BB()||a.Km||a.i.Qs(a)},f5=function(a){i5(a);
g.Ni(a.Mu);a.Mu=null;a.u.stop();g.cCa(a.B);if(a.De){var b=a.De;a.De=null;b.abort();b.dispose()}a.Di&&(a.Di=null)},e5=function(a,b){try{a.i.GF(a,b),a.i.ji(4)}catch(c){}},EIa=function(a,b,c,d,e){if(0==d)c(!1);
else{var f=e||0;d--;DIa(a,b,function(h){h?c(!0):g.A.setTimeout(function(){EIa(a,b,c,d,f)},f)})}},DIa=function(a,b,c){var d=new Image;
d.onload=function(){try{j5(d),c(!0)}catch(e){}};
d.onerror=function(){try{j5(d),c(!1)}catch(e){}};
d.onabort=function(){try{j5(d),c(!1)}catch(e){}};
d.ontimeout=function(){try{j5(d),c(!1)}catch(e){}};
g.A.setTimeout(function(){if(d.ontimeout)d.ontimeout()},b);
NHa(d,a)},j5=function(a){a.onload=null;
a.onerror=null;a.onabort=null;a.ontimeout=null},k5=function(a){g.am.call(this);
this.headers=new g.Nm;this.ea=a||null;this.B=!1;this.ca=this.i=null;this.za=this.W="";this.I=0;this.u="";this.C=this.la=this.L=this.ga=!1;this.J=0;this.X=null;this.Da="";this.Y=this.ia=!1},FIa=function(a){return g.ve&&g.Xd(9)&&"number"===typeof a.timeout&&void 0!==a.ontimeout},GIa=function(a){return"content-type"==a.toLowerCase()},IIa=function(a,b){a.B=!1;
a.i&&(a.C=!0,a.i.abort(),a.C=!1);a.u=b;a.I=5;HIa(a);l5(a)},HIa=function(a){a.ga||(a.ga=!0,a.dispatchEvent("complete"),a.dispatchEvent("error"))},KIa=function(a){if(a.B&&"undefined"!=typeof g.x_)if(a.ca[1]&&4==m5(a)&&2==a.getStatus())n5(a,"Local request error detected and ignored");
else if(a.L&&4==m5(a))g.Lm(a.DF,0,a);else if(a.dispatchEvent("readystatechange"),a.isComplete()){n5(a,"Request complete");a.B=!1;try{var b=a.getStatus();a:switch(b){case 200:case 201:case 202:case 204:case 206:case 304:case 1223:var c=!0;break a;default:c=!1}var d;if(!(d=c)){var e;if(e=0===b){var f=g.td(1,String(a.W));if(!f&&g.A.self&&g.A.self.location){var h=g.A.self.location.protocol;f=h.substr(0,h.length-1)}e=!JIa.test(f?f.toLowerCase():"")}d=e}if(d)a.dispatchEvent("complete"),a.dispatchEvent("success");
else{a.I=6;try{var l=2<m5(a)?a.i.statusText:""}catch(m){l=""}a.u=l+" ["+a.getStatus()+"]";HIa(a)}}finally{l5(a)}}},l5=function(a,b){if(a.i){LIa(a);
var c=a.i,d=a.ca[0]?g.Ia:null;a.i=null;a.ca=null;b||a.dispatchEvent("ready");try{c.onreadystatechange=d}catch(e){}}},LIa=function(a){a.i&&a.Y&&(a.i.ontimeout=null);
a.X&&(g.A.clearTimeout(a.X),a.X=null)},m5=function(a){return a.i?a.i.readyState:0},o5=function(a){try{return a.i?a.i.responseText:""}catch(b){return""}},n5=function(a,b){return b+" ["+a.za+" "+a.W+" "+a.getStatus()+"]"},MIa=function(a){this.i=a;
this.l=new W4},NIa=function(a){var b=p5(a.i,a.kq,"/mail/images/cleardot.gif");
v4(b);EIa(b.toString(),5E3,(0,g.B)(a.wK,a),3,2E3);a.ji(1)},r5=function(a){var b=a.i.L;
if(null!=b)Z4(5),b?(Z4(11),q5(a.i,a,!1)):(Z4(12),q5(a.i,a,!0));else if(a.Dg=new a5(a,void 0,void 0,void 0),a.Dg.km=a.pw,b=a.i,b=p5(b,b.Wr()?a.aq:null,a.qw),Z4(5),!g.ve||g.Yd(10))w4(b,"TYPE","xmlhttp"),b5(a.Dg,b,!1,a.aq,!1);else{w4(b,"TYPE","html");var c=a.Dg;a=!!a.aq;c.Cp=3;c.Tk=v4(b.clone());BIa(c,a)}},s5=function(a,b,c){this.Ma=1;
this.i=[];this.u=[];this.B=new W4;this.J=a||null;this.L=null!=b?b:null;this.C=c||!1},OIa=function(a,b){this.i=a;
this.map=b;this.context=null},PIa=function(a,b,c,d){g.Hl.call(this,"timingevent",a);
this.size=b;this.Pr=d},QIa=function(a){g.Hl.call(this,"serverreachability",a)},TIa=function(a){RIa(a);
if(3==a.Ma){var b=a.wr++,c=a.vt.clone();u4(c,"SID",a.l);u4(c,"RID",b);u4(c,"TYPE","terminate");t5(a,c);b=new a5(a,a.l,b,void 0);b.Cp=2;b.Tk=v4(c.clone());NHa(new Image,b.Tk.toString());b.qp=g.C();c5(b)}SIa(a)},UIa=function(a){a.RK(1,0);
a.vt=p5(a,null,a.rw);u5(a)},RIa=function(a){a.Xk&&(a.Xk.abort(),a.Xk=null);
a.Zd&&(a.Zd.cancel(),a.Zd=null);a.Rj&&(g.A.clearTimeout(a.Rj),a.Rj=null);v5(a);a.qg&&(a.qg.cancel(),a.qg=null);a.jl&&(g.A.clearTimeout(a.jl),a.jl=null)},VIa=function(a,b){if(0==a.Ma)throw Error("Invalid operation: sending map when state is closed");
a.i.push(new OIa(a.pM++,b));2!=a.Ma&&3!=a.Ma||u5(a)},WIa=function(a){var b=0;
a.Zd&&b++;a.qg&&b++;return b},u5=function(a){a.qg||a.jl||(a.jl=X4((0,g.B)(a.NF,a),0),a.xo=0)},YIa=function(a,b){if(1==a.Ma){if(!b){a.wr=Math.floor(1E5*Math.random());
var c=a.wr++,d=new a5(a,"",c,void 0);d.km=a.Ji;var e=w5(a),f=a.vt.clone();u4(f,"RID",c);u4(f,"CVER","1");t5(a,f);wIa(d,f,e);a.qg=d;a.Ma=2}}else 3==a.Ma&&(b?XIa(a,b):0==a.i.length||a.qg||XIa(a))},XIa=function(a,b){if(b)if(6<a.Lm){a.i=a.u.concat(a.i);
a.u.length=0;var c=a.wr-1;var d=w5(a)}else c=b.L,d=b.zn;else c=a.wr++,d=w5(a);var e=a.vt.clone();u4(e,"SID",a.l);u4(e,"RID",c);u4(e,"AID",a.Ro);t5(a,e);c=new a5(a,a.l,c,a.xo+1);c.km=a.Ji;c.setTimeout(1E4+Math.round(1E4*Math.random()));a.qg=c;wIa(c,e,d)},t5=function(a,b){if(a.yf){var c=a.yf.mD();
c&&g.Ab(c,function(d,e){u4(b,e,d)})}},w5=function(a){var b=Math.min(a.i.length,1E3),c=["count="+b];
if(6<a.Lm&&0<b){var d=a.i[0].i;c.push("ofs="+d)}else d=0;for(var e={},f=0;f<b;e={Pn:e.Pn},f++){e.Pn=a.i[f].i;var h=a.i[f].map;e.Pn=6>=a.Lm?f:e.Pn-d;try{g.Ab(h,function(l){return function(m,n){c.push("req"+l.Pn+"_"+n+"="+encodeURIComponent(m))}}(e))}catch(l){c.push("req"+e.Pn+"_type="+encodeURIComponent("_badmap"))}}a.u=a.u.concat(a.i.splice(0,b));
return c.join("&")},ZIa=function(a){a.Zd||a.Rj||(a.I=1,a.Rj=X4((0,g.B)(a.MF,a),0),a.eo=0)},x5=function(a){if(a.Zd||a.Rj||3<=a.eo)return!1;
a.I++;a.Rj=X4((0,g.B)(a.MF,a),$Ia(a,a.eo));a.eo++;return!0},q5=function(a,b,c){a.xv=c;
a.Ki=b.Oj;a.C||UIa(a)},v5=function(a){null!=a.Sm&&(g.A.clearTimeout(a.Sm),a.Sm=null)},$Ia=function(a,b){var c=5E3+Math.floor(1E4*Math.random());
a.isActive()||(c*=2);return c*b},y5=function(a,b){if(2==b||9==b){var c=null;
a.yf&&(c=null);var d=(0,g.B)(a.FQ,a);c||(c=new g.Qm("//www.google.com/images/cleardot.gif"),v4(c));DIa(c.toString(),1E4,d)}else Z4(2);aJa(a,b)},aJa=function(a,b){a.Ma=0;
a.yf&&a.yf.CC(b);SIa(a);RIa(a)},SIa=function(a){a.Ma=0;
a.Ki=-1;if(a.yf)if(0==a.u.length&&0==a.i.length)a.yf.bx();else{g.lb(a.u);var b=g.lb(a.i);a.u.length=0;a.i.length=0;a.yf.bx(b)}},p5=function(a,b,c){var d=g.Ym(c);
if(""!=d.i)b&&g.Sm(d,b+"."+d.i),g.Tm(d,d.B);else{var e=window.location;d=RHa(e.protocol,b?b+"."+e.hostname:e.hostname,+e.port,c)}a.Eq&&g.Ab(a.Eq,function(f,h){u4(d,h,f)});
u4(d,"VER",a.Lm);t5(a,d);return d},bJa=function(){},cJa=function(){this.i=[];
this.l=[]},dJa=function(a,b){this.action=a;
this.params=b||{}},z5=function(a,b){g.I.call(this);
this.i=new g.L(this.jP,0,this);g.K(this,this.i);this.If=5E3;this.l=0;if("function"===typeof a)b&&(a=(0,g.B)(a,b));else if(a&&"function"===typeof a.handleEvent)a=(0,g.B)(a.handleEvent,a);else throw Error("Invalid listener argument");this.u=a},A5=function(a,b,c,d,e){c=void 0===c?!1:c;
d=void 0===d?function(){return""}:d;
e=void 0===e?!1:e;this.ca=a;this.I=b;this.u=new g.In;this.l=new z5(this.hQ,this);this.i=null;this.X=!1;this.C=null;this.W="";this.L=this.B=0;this.J=[];this.ea=c;this.Y=d;this.ia=e},eJa=function(a){return{firstTestResults:[""],
secondTestResults:!a.i.xv,sessionId:a.i.l,arrayId:a.i.Ro}},fJa=function(a,b){a.L=b||0;
a.l.stop();B5(a);a.i&&(3==a.i.getState()&&YIa(a.i),TIa(a.i));a.L=0},C5=function(a){return!!a.i&&3==a.i.getState()},B5=function(a){if(a.i){var b=a.Y(),c=a.i.Ji||{};
b?c["x-youtube-lounge-xsrf-token"]=b:delete c["x-youtube-lounge-xsrf-token"];a.i.Ji=c}},D5=function(a){this.scheme="https";
this.port=this.domain="";this.i="/api/lounge";this.l=!0;a=a||document.location.href;var b=Number(g.td(4,a))||"";b&&(this.port=":"+b);this.domain=g.ud(a)||"";a=g.Pc;0<=a.search("MSIE")&&(a=a.match(/MSIE ([\d.]+)/)[1],0>g.xc(a,"10.0")&&(this.l=!1))},E5=function(a,b){var c=a.i;
a.l&&(c=a.scheme+"://"+a.domain+a.port+a.i);return g.Id(c+b,{})},F5=function(a,b,c,d,e){a={format:"JSON",
method:"POST",context:a,timeout:5E3,withCredentials:!1,onSuccess:g.Pa(a.B,d,!0),onError:g.Pa(a.u,e),onTimeout:g.Pa(a.C,e)};c&&(a.postParams=c,a.headers={"Content-Type":"application/x-www-form-urlencoded"});return g.Yp(b,a)},jJa=function(){var a=gJa;
hJa();G5.push(a);iJa()},H5=function(a,b){hJa();
var c=kJa(a,String(b));g.eb(G5)?lJa(c):(iJa(),g.yb(G5,function(d){d(c)}))},hJa=function(){G5||(G5=g.Ha("yt.mdx.remote.debug.handlers_")||[],g.Da("yt.mdx.remote.debug.handlers_",G5,void 0))},lJa=function(a){var b=(I5+1)%50;
I5=b;J5[b]=a;K5||(K5=49==b)},iJa=function(){var a=G5;
if(J5[0]){var b=K5?I5:-1;do{b=(b+1)%50;var c=J5[b];g.yb(a,function(d){d(c)})}while(b!=I5);
J5=Array(50);I5=-1;K5=!1}},kJa=function(a,b){var c=(g.C()-mJa)/1E3;
c.toFixed&&(c=c.toFixed(3));var d=[];d.push("[",c+"s","] ");d.push("[","yt.mdx.remote","] ");d.push(a+": "+b,"\n");return d.join("")},L5=function(a){g.Q.call(this);
this.I=a;this.screens=[]},nJa=function(a,b){var c=a.get(b.uuid)||a.get(b.id);
if(c){var d=c.name;c.id=b.id||c.id;c.name=b.name;c.token=b.token;c.uuid=b.uuid||c.uuid;return c.name!=d}a.screens.push(b);return!0},oJa=function(a,b){var c=a.screens.length!=b.length;
a.screens=g.He(a.screens,function(f){return!!G4(b,f)});
for(var d=0,e=b.length;d<e;d++)c=nJa(a,b[d])||c;return c},pJa=function(a,b){var c=a.screens.length;
a.screens=g.He(a.screens,function(d){return!(d||b?!d!=!b?0:d.id==b.id:1)});
return a.screens.length<c},M5=function(a,b,c,d){g.Q.call(this);
this.u=a;this.I=b;this.B=c;this.C=d;this.l=0;this.i=null;this.gb=NaN},O5=function(a){L5.call(this,"LocalScreenService");
this.l=a;this.i=NaN;N5(this);this.info("Initializing with "+E4(this.screens))},qJa=function(a){if(a.screens.length){var b=g.Jc(a.screens,function(d){return d.id}),c=E5(a.l,"/pairing/get_lounge_token_batch");
F5(a.l,c,{screen_ids:b.join(",")},(0,g.B)(a.sL,a),(0,g.B)(a.rL,a))}},N5=function(a){if(g.Po("deprecate_pair_servlet_enabled"))return oJa(a,[]);
var b=XHa(cIa());b=g.He(b,function(c){return!c.uuid});
return oJa(a,b)},P5=function(a,b){eIa(g.Jc(a.screens,VHa));
b&&dIa()},R5=function(a,b){g.Q.call(this);
this.I=b;var c=g.Fu("yt-remote-online-screen-ids")||"";c=c?c.split(","):[];for(var d={},e=this.I(),f=0,h=e.length;f<h;++f){var l=e[f].id;d[l]=g.db(c,l)}this.i=d;this.C=a;this.u=this.B=NaN;this.l=null;Q5("Initialized with "+g.Oj(this.i))},S5=function(a,b,c){var d=E5(a.C,"/pairing/get_screen_availability");
F5(a.C,d,{lounge_token:b.token},(0,g.B)(function(e){e=e.screens||[];for(var f=0,h=e.length;f<h;++f)if(e[f].loungeToken==b.token){c("online"==e[f].status);return}c(!1)},a),(0,g.B)(function(){c(!1)},a))},T5=function(a,b){a:if(x4(b)!=x4(a.i))var c=!1;
else{c=g.Hb(b);for(var d=0,e=c.length;d<e;++d)if(!a.i[c[d]]){c=!1;break a}c=!0}c||(Q5("Updated online screens: "+g.Oj(a.i)),a.i=b,a.V("screenChange"));rJa(a)},U5=function(a){isNaN(a.u)||g.Bo(a.u);
a.u=g.zo((0,g.B)(a.Dz,a),0<a.B&&a.B<g.C()?2E4:1E4)},Q5=function(a){H5("OnlineScreenService",a)},sJa=function(a){var b={};
g.yb(a.I(),function(c){c.token?b[c.token]=c.id:this.Fd("Requesting availability of screen w/o lounge token.")});
return b},rJa=function(a){a=g.Hb(g.Bb(a.i,function(b){return b}));
g.vb(a);a.length?g.Eu("yt-remote-online-screen-ids",a.join(","),60):g.Gu("yt-remote-online-screen-ids")},V5=function(a){L5.call(this,"ScreenService");
this.B=a;this.i=this.l=null;this.u=[];this.C={};tJa(this)},vJa=function(a,b,c,d,e,f){a.info("getAutomaticScreenByIds "+c+" / "+b);
c||(c=a.C[b]);var h=a.Rg();if(h=(c?H4(h,c):null)||H4(h,b)){h.uuid=b;var l=W5(a,h);S5(a.i,l,function(m){e(m?l:null)})}else c?uJa(a,c,(0,g.B)(function(m){var n=W5(this,new B4({name:d,
screenId:c,loungeToken:m,dialId:b||""}));S5(this.i,n,function(p){e(p?n:null)})},a),f):e(null)},wJa=function(a,b){for(var c=0,d=a.screens.length;c<d;++c)if(a.screens[c].name==b)return a.screens[c];
return null},xJa=function(a,b,c){S5(a.i,b,c)},uJa=function(a,b,c,d){a.info("requestLoungeToken_ for "+b);
var e={postParams:{screen_ids:b},method:"POST",context:a,onSuccess:function(f,h){var l=h&&h.screens||[];l[0]&&l[0].screenId==b?c(l[0].loungeToken):d(Error("Missing lounge token in token response"))},
onError:function(){d(Error("Request screen lounge token failed"))}};
g.Yp(E5(a.B,"/pairing/get_lounge_token_batch"),e)},yJa=function(a){a.screens=a.l.Rg();
var b=a.C,c={},d;for(d in b)c[b[d]]=d;b=0;for(d=a.screens.length;b<d;++b){var e=a.screens[b];e.uuid=c[e.id]||""}a.info("Updated manual screens: "+E4(a.screens))},tJa=function(a){X5(a);
a.l=new O5(a.B);a.l.subscribe("screenChange",(0,g.B)(a.yL,a));yJa(a);a.u=XHa(g.Fu("yt-remote-automatic-screen-cache")||[]);X5(a);a.info("Initializing automatic screens: "+E4(a.u));a.i=new R5(a.B,(0,g.B)(a.Rg,a,!0));a.i.subscribe("screenChange",(0,g.B)(function(){this.V("onlineScreenChange")},a))},W5=function(a,b){var c=a.get(b.id);
c?(c.uuid=b.uuid,b=c):((c=H4(a.u,b.uuid))?(c.id=b.id,c.token=b.token,b=c):a.u.push(b),zJa(a));X5(a);a.C[b.uuid]=b.id;g.Eu("yt-remote-device-id-map",a.C,31536E3);return b},zJa=function(a){a=g.He(a.u,function(b){return"shortLived"!=b.idType});
g.Eu("yt-remote-automatic-screen-cache",g.Jc(a,VHa))},X5=function(a){a.C=g.Fu("yt-remote-device-id-map")||{}},Y5=function(a,b,c){g.Q.call(this);
this.ia=c;this.B=a;this.i=b;this.u=null},Z5=function(a,b){a.u=b;
a.V("sessionScreen",a.u)},$5=function(a,b){H5(a.ia,b)},a6=function(a,b,c){Y5.call(this,a,b,"CastSession");
var d=this;this.ga=c;this.l=null;this.Y=(0,g.B)(this.KJ,this);this.ca=(0,g.B)(this.EP,this);this.X=g.zo(function(){AJa(d,null)},12E4);
this.J=this.C=this.I=this.L=0;this.ea=!1;this.W="unknown"},b6=function(a,b){g.Bo(a.J);
a.J=0;0==b?BJa(a):a.J=g.zo(function(){BJa(a)},b)},BJa=function(a){CJa(a,"getLoungeToken");
g.Bo(a.C);a.C=g.zo(function(){DJa(a,null)},3E4)},CJa=function(a,b){a.info("sendYoutubeMessage_: "+b+" "+g.Oj(void 0));
var c={};c.type=b;a.l?a.l.sendMessage("urn:x-cast:com.google.youtube.mdx",c,g.Ia,(0,g.B)(function(){$5(this,"Failed to send message: "+b+".")},a)):$5(a,"Sending yt message without session: "+g.Oj(c))},c6=function(a,b){b?(a.info("onConnectedScreenId_: Received screenId: "+b),a.getScreen()&&a.getScreen().id==b||a.DD(b,function(c){Z5(a,c)},function(){return a.cg()},5)):a.cg(Error("Waiting for session status timed out."))},FJa=function(a,b,c){a.info("onConnectedScreenData_: Received screenData: "+JSON.stringify(b));
var d=new B4(b);EJa(a,d,function(e){e?(a.ea=!0,W5(a.B,d),Z5(a,d),a.W="unknown",b6(a,c)):(g.wo(Error("CastSession, RemoteScreen from screenData: "+JSON.stringify(b)+" is not online.")),a.cg())},5)},AJa=function(a,b){g.Bo(a.X);
a.X=0;b?a.ga.enableCastLoungeToken&&b.loungeToken?b.deviceId?a.getScreen()&&a.getScreen().uuid==b.deviceId||(b.loungeTokenRefreshIntervalMs?FJa(a,{name:a.i.friendlyName,screenId:b.screenId,loungeToken:b.loungeToken,dialId:b.deviceId,screenIdType:"shortLived"},b.loungeTokenRefreshIntervalMs):(g.wo(Error("No loungeTokenRefreshIntervalMs presents in mdxSessionStatusData: "+JSON.stringify(b)+".")),c6(a,b.screenId))):(g.wo(Error("No device id presents in mdxSessionStatusData: "+JSON.stringify(b)+".")),
c6(a,b.screenId)):c6(a,b.screenId):a.cg(Error("Waiting for session status timed out."))},DJa=function(a,b){g.Bo(a.C);
a.C=0;var c=null;if(b)if(b.loungeToken){var d;(null==(d=a.getScreen())?void 0:d.token)==b.loungeToken&&(c="staleLoungeToken")}else c="missingLoungeToken";else c="noLoungeTokenResponse";c?(a.info("Did not receive a new lounge token in onLoungeToken_ with data: "+(JSON.stringify(b)+", error: "+c)),a.W=c,b6(a,3E4)):(a.u&&(a.u.token=b.loungeToken,W5(a.B,a.u)),a.V("sessionScreen",a.u),a.ea=!1,a.W="unknown",b6(a,b.loungeTokenRefreshIntervalMs))},EJa=function(a,b,c,d){g.Bo(a.I);
a.I=0;xJa(a.B,b,function(e){e||0>d?c(e):a.I=g.zo(function(){EJa(a,b,c,d-1)},300)})},GJa=function(a){g.Bo(a.L);
a.L=0;g.Bo(a.I);a.I=0;g.Bo(a.X);a.X=0;g.Bo(a.C);a.C=0;g.Bo(a.J);a.J=0},d6=function(a,b,c){Y5.call(this,a,b,"DialSession");
this.C=this.L=null;this.W="";this.ca=c;this.Y=null;this.J=g.Ia;this.I=NaN;this.X=(0,g.B)(this.LJ,this);this.l=g.Ia},HJa=function(a){a.l=a.B.DB(a.W,a.i.label,a.i.friendlyName,(0,g.B)(function(b){this.l=g.Ia;
Z5(this,b)},a),(0,g.B)(function(b){this.l=g.Ia;
this.cg(b)},a))},IJa=function(a){var b={};
b.pairingCode=a.W;b.theme=a.ca;hIa()&&(b.env_useStageMdx=1);return g.Gd(b)},e6=function(a,b){Y5.call(this,a,b,"ManualSession");
this.l=g.zo((0,g.B)(this.So,this,null),150)},f6=function(a,b){g.Q.call(this);
this.B=b;this.l=a;this.L=b.appId||"233637DE";this.C=b.theme||"cl";this.W=b.disableCastApi||!1;this.i=null;this.J=!1;this.u=[];this.I=(0,g.B)(this.zO,this)},JJa=function(a,b){return b?g.$a(a.u,function(c){return C4(b,c.label)},a):null},g6=function(a){H5("Controller",a)},gJa=function(a){window.chrome&&chrome.cast&&chrome.cast.logMessage&&chrome.cast.logMessage(a)},h6=function(a){return a.J||!!a.u.length||!!a.i},i6=function(a,b,c){b!=a.i&&(g.Ni(a.i),(a.i=b)?(c?a.V("yt-remote-cast2-receiver-resumed",
b.i):a.V("yt-remote-cast2-receiver-selected",b.i),b.subscribe("sessionScreen",(0,g.B)(a.KF,a,b)),b.getScreen()?a.V("yt-remote-cast2-session-change",b.getScreen()):c&&a.i.So(null)):a.V("yt-remote-cast2-session-change",null))},KJa=function(a){var b=a.l.CB(),c=a.i&&a.i.i;
a=g.Jc(b,function(d){c&&C4(d,c.label)&&(c=null);var e=d.uuid?d.uuid:d.id,f=JJa(this,d);f?(f.label=e,f.friendlyName=d.name):(f=new chrome.cast.Receiver(e,d.name),f.receiverType=chrome.cast.ReceiverType.CUSTOM);return f},a);
c&&(c.receiverType!=chrome.cast.ReceiverType.CUSTOM&&(c=new chrome.cast.Receiver(c.label,c.friendlyName),c.receiverType=chrome.cast.ReceiverType.CUSTOM),a.push(c));return a},PJa=function(a,b,c,d){d.disableCastApi?j6("Cannot initialize because disabled by Mdx config."):LJa()?MJa(b,d)&&(k6(!0),window.chrome&&chrome.cast&&chrome.cast.isAvailable?NJa(a,c):(window.__onGCastApiAvailable=function(e,f){e?NJa(a,c):(l6("Failed to load cast API: "+f),m6(!1),k6(!1),g.Gu("yt-remote-cast-available"),g.Gu("yt-remote-cast-receiver"),
OJa(),c(!1))},d.loadCastApiSetupScript?g.Lo("https://www.gstatic.com/cv/js/sender/v1/cast_sender.js"):0<=window.navigator.userAgent.indexOf("Android")&&0<=window.navigator.userAgent.indexOf("Chrome/")&&window.navigator.presentation?60<=O4()&&oIa():!window.chrome||!window.navigator.presentation||0<=window.navigator.userAgent.indexOf("Edge")?Q4():89<=O4()?qIa():(R4(),P4(pIa.map(lIa))))):j6("Cannot initialize because not running Chrome")},OJa=function(){j6("dispose");
var a=n6();a&&a.dispose();g.Da("yt.mdx.remote.cloudview.instance_",null,void 0);QJa(!1);g.Ho(o6);o6.length=0},p6=function(){return!!g.Fu("yt-remote-cast-installed")},RJa=function(){var a=g.Fu("yt-remote-cast-receiver");
return a?a.friendlyName:null},SJa=function(){j6("clearCurrentReceiver");
g.Gu("yt-remote-cast-receiver")},TJa=function(){return p6()?n6()?n6().getCastSession():(l6("getCastSelector: Cast is not initialized."),null):(l6("getCastSelector: Cast API is not installed!"),null)},r6=function(){p6()?n6()?q6()?(j6("Requesting cast selector."),n6().requestSession()):(j6("Wait for cast API to be ready to request the session."),o6.push(g.Go("yt-remote-cast2-api-ready",r6))):l6("requestCastSelector: Cast is not initialized."):l6("requestCastSelector: Cast API is not installed!")},s6=
function(a,b){q6()?n6().setConnectedScreenStatus(a,b):l6("setConnectedScreenStatus called before ready.")},LJa=function(){var a=0<=g.Pc.search(/ (CrMo|Chrome|CriOS)\//);
return g.FA||a},UJa=function(a,b){n6().init(a,b)},MJa=function(a,b){var c=!1;
n6()||(c=new f6(a,b),c.subscribe("yt-remote-cast2-availability-change",function(d){g.Eu("yt-remote-cast-available",d);z4("yt-remote-cast2-availability-change",d)}),c.subscribe("yt-remote-cast2-receiver-selected",function(d){j6("onReceiverSelected: "+d.friendlyName);
g.Eu("yt-remote-cast-receiver",d);z4("yt-remote-cast2-receiver-selected",d)}),c.subscribe("yt-remote-cast2-receiver-resumed",function(d){j6("onReceiverResumed: "+d.friendlyName);
g.Eu("yt-remote-cast-receiver",d);z4("yt-remote-cast2-receiver-resumed",d)}),c.subscribe("yt-remote-cast2-session-change",function(d){j6("onSessionChange: "+D4(d));
d||g.Gu("yt-remote-cast-receiver");z4("yt-remote-cast2-session-change",d)}),g.Da("yt.mdx.remote.cloudview.instance_",c,void 0),c=!0);
j6("cloudview.createSingleton_: "+c);return c},n6=function(){return g.Ha("yt.mdx.remote.cloudview.instance_")},NJa=function(a,b){m6(!0);
k6(!1);UJa(a,function(c){c?(QJa(!0),g.Io("yt-remote-cast2-api-ready")):(l6("Failed to initialize cast API."),m6(!1),g.Gu("yt-remote-cast-available"),g.Gu("yt-remote-cast-receiver"),OJa());b(c)})},j6=function(a){H5("cloudview",a)},l6=function(a){H5("cloudview",a)},m6=function(a){j6("setCastInstalled_ "+a);
g.Eu("yt-remote-cast-installed",a)},q6=function(){return!!g.Ha("yt.mdx.remote.cloudview.apiReady_")},QJa=function(a){j6("setApiReady_ "+a);
g.Da("yt.mdx.remote.cloudview.apiReady_",a,void 0)},k6=function(a){g.Da("yt.mdx.remote.cloudview.initializing_",a,void 0)},t6=function(a){this.index=-1;
this.videoId=this.listId="";this.volume=this.playerState=-1;this.muted=!1;this.audioTrackId=null;this.J=this.L=0;this.i=null;this.hasNext=this.dj=!1;this.W=this.I=this.l=this.C=0;this.B=NaN;this.u=!1;this.reset(a)},u6=function(a){a.audioTrackId=null;
a.i=null;a.playerState=-1;a.dj=!1;a.hasNext=!1;a.L=0;a.J=g.C();a.C=0;a.l=0;a.I=0;a.W=0;a.B=NaN;a.u=!1},v6=function(a){return a.Kb()?(g.C()-a.J)/1E3:0},w6=function(a,b){a.L=b;
a.J=g.C()},x6=function(a){switch(a.playerState){case 1:case 1081:return(g.C()-a.J)/1E3+a.L;
case -1E3:return 0}return a.L},y6=function(a,b,c){var d=a.videoId;
a.videoId=b;a.index=c;b!=d&&u6(a)},z6=function(a){var b={};
b.index=a.index;b.listId=a.listId;b.videoId=a.videoId;b.playerState=a.playerState;b.volume=a.volume;b.muted=a.muted;b.audioTrackId=a.audioTrackId;b.trackData=g.Rb(a.i);b.hasPrevious=a.dj;b.hasNext=a.hasNext;b.playerTime=a.L;b.playerTimeAt=a.J;b.seekableStart=a.C;b.seekableEnd=a.l;b.duration=a.I;b.loadedTime=a.W;b.liveIngestionTime=a.B;return b},B6=function(a,b){g.Q.call(this);
this.Ma=0;this.u=a;this.C=[];this.B=new cJa;this.l=this.i=null;this.L=(0,g.B)(this.bN,this);this.I=(0,g.B)(this.yr,this);this.J=(0,g.B)(this.aN,this);this.W=(0,g.B)(this.iN,this);var c=0;a?(c=a.getProxyState(),3!=c&&(a.subscribe("proxyStateChange",this.Rz,this),VJa(this))):c=3;0!=c&&(b?this.Rz(c):g.zo((0,g.B)(function(){this.Rz(c)},this),0));
var d=TJa();d&&A6(this,d);this.subscribe("yt-remote-cast2-session-change",this.W)},C6=function(a){return new t6(a.u.getPlayerContextData())},VJa=function(a){g.yb("nowAutoplaying autoplayDismissed remotePlayerChange remoteQueueChange autoplayModeChange autoplayUpNext previousNextChange".split(" "),function(b){this.C.push(this.u.subscribe(b,g.Pa(this.wO,b),this))},a)},WJa=function(a){g.yb(a.C,function(b){this.u.unsubscribeByKey(b)},a);
a.C.length=0},D6=function(a){return 1==a.getState()},E6=function(a,b){var c=a.B;
50>c.i.length+c.l.length&&a.B.l.push(b)},G6=function(a,b,c){var d=C6(a);
w6(d,c);-1E3!=d.playerState&&(d.playerState=b);F6(a,d)},H6=function(a,b,c){a.u.sendMessage(b,c)},F6=function(a,b){WJa(a);
a.u.setPlayerContextData(z6(b));VJa(a)},A6=function(a,b){a.l&&(a.l.removeUpdateListener(a.L),a.l.removeMediaListener(a.I),a.yr(null));
a.l=b;a.l&&(H5("CP","Setting cast session: "+a.l.sessionId),a.l.addUpdateListener(a.L),a.l.addMediaListener(a.I),a.l.media.length&&a.yr(a.l.media[0]))},XJa=function(a){var b=a.i.media,c=a.i.customData;
if(b&&c){var d=C6(a);b.contentId!=d.videoId&&H5("CP","Cast changing video to: "+b.contentId);d.videoId=b.contentId;d.playerState=c.playerState;w6(d,a.i.getEstimatedTime());F6(a,d)}else H5("CP","No cast media video. Ignoring state update.")},I6=function(a,b,c){return(0,g.B)(function(d){this.Fd("Failed to "+b+" with cast v2 channel. Error code: "+d.code);
d.code!=chrome.cast.ErrorCode.TIMEOUT&&(this.Fd("Retrying "+b+" using MDx browser channel."),H6(this,b,c))},a)},J6=function(a,b,c){g.Q.call(this);
this.C=NaN;this.ca=!1;this.L=this.J=this.X=this.Y=NaN;this.W=[];this.B=this.I=this.u=this.Fb=this.i=null;this.ia=a;this.W.push(g.ap(window,"beforeunload",(0,g.B)(this.mL,this)));this.l=[];this.Fb=new t6;this.ga=b.id;this.ea=b.idType;this.i=YJa(this,c);this.i.subscribe("handlerOpened",this.fN,this);this.i.subscribe("handlerClosed",this.cN,this);this.i.subscribe("handlerError",this.dN,this);this.i.subscribe("handlerMessage",this.eN,this);this.i.Wu(b.token);this.subscribe("remoteQueueChange",function(){var d=
this.Fb.videoId;g.Hu()&&g.Eu("yt-remote-session-video-id",d)},this)},K6=function(a){H5("conn",a)},YJa=function(a,b){return new A5(E5(a.ia,"/bc"),b,!1,function(){return a.HB()},"shortLived"==a.ea)},L6=function(a,b){a.V("proxyStateChange",b)},ZJa=function(a){a.C=g.zo((0,g.B)(function(){K6("Connecting timeout");
this.ro(1)},a),2E4)},M6=function(a){g.Bo(a.C);
a.C=NaN},N6=function(a){g.Bo(a.Y);
a.Y=NaN},$Ja=function(a){O6(a);
a.X=g.zo((0,g.B)(function(){P6(this,"getNowPlaying")},a),2E4)},O6=function(a){g.Bo(a.X);
a.X=NaN},bKa=function(a,b){b&&(M6(a),N6(a));
var c=C5(a.i)&&isNaN(a.C);b==c?b&&(L6(a,1),P6(a,"getSubtitlesTrack")):b?(a.CD()&&a.Fb.reset(),L6(a,1),P6(a,"getNowPlaying"),aKa(a)):a.ro(1)},cKa=function(a,b){var c=b.params.videoId;
delete b.params.videoId;c==a.Fb.videoId&&(g.Mb(b.params)?a.Fb.i=null:a.Fb.i=b.params,a.V("remotePlayerChange"))},dKa=function(a,b){var c=b.params.videoId||b.params.video_id,d=parseInt(b.params.currentIndex,10);
a.Fb.listId=b.params.listId||a.Fb.listId;y6(a.Fb,c,d);a.V("remoteQueueChange")},fKa=function(a,b){b.params=b.params||{};
dKa(a,b);eKa(a,b);a.V("autoplayDismissed")},eKa=function(a,b){var c=parseInt(b.params.currentTime||b.params.current_time,10);
w6(a.Fb,isNaN(c)?0:c);c=parseInt(b.params.state,10);c=isNaN(c)?-1:c;-1==c&&-1E3==a.Fb.playerState&&(c=-1E3);a.Fb.playerState=c;c=Number(b.params.loadedTime);a.Fb.W=isNaN(c)?0:c;c=Number(b.params.duration);a.Fb.I=isNaN(c)?0:c;c=a.Fb;var d=Number(b.params.liveIngestionTime);c.B=d;c.u=isNaN(d)?!1:!0;c=a.Fb;d=Number(b.params.seekableStartTime);var e=Number(b.params.seekableEndTime);c.C=isNaN(d)?0:d;c.l=isNaN(e)?0:e;1==a.Fb.playerState?$Ja(a):O6(a);a.V("remotePlayerChange")},gKa=function(a,b){if(-1E3!=
a.Fb.playerState){var c=1085;
switch(parseInt(b.params.adState,10)){case 1:c=1081;break;case 2:c=1084;break;case 0:c=1083}a.Fb.playerState=c;c=parseInt(b.params.currentTime,10);w6(a.Fb,isNaN(c)?0:c);a.V("remotePlayerChange")}},hKa=function(a,b){var c="true"==b.params.muted;
a.Fb.volume=parseInt(b.params.volume,10);a.Fb.muted=c;a.V("remotePlayerChange")},iKa=function(a,b){a.I=b.params.videoId;
a.V("nowAutoplaying",parseInt(b.params.timeout,10))},jKa=function(a,b){var c="true"==b.params.hasNext;
a.Fb.dj="true"==b.params.hasPrevious;a.Fb.hasNext=c;a.V("previousNextChange")},aKa=function(a){g.Bo(a.L);
a.L=g.zo((0,g.B)(a.ro,a,1),864E5)},P6=function(a,b,c){c?K6("Sending: action="+b+", params="+g.Oj(c)):K6("Sending: action="+b);
a.i.sendMessage(b,c)},Q6=function(a){L5.call(this,"ScreenServiceProxy");
this.Hf=a;this.i=[];this.i.push(this.Hf.$_s("screenChange",(0,g.B)(this.PJ,this)));this.i.push(this.Hf.$_s("onlineScreenChange",(0,g.B)(this.dO,this)))},nKa=function(a,b){gIa();
if(!N4||!N4.get("yt-remote-disable-remote-module-for-dev")){b=g.O("MDX_CONFIG")||b;ZHa();L4();R6||(R6=new D5(b?b.loungeApiHost:void 0),hIa()&&(R6.i="/api/loungedev"));S6||(S6=g.Ha("yt.mdx.remote.deferredProxies_")||[],g.Da("yt.mdx.remote.deferredProxies_",S6,void 0));kKa();var c=T6();if(!c){var d=new V5(R6);g.Da("yt.mdx.remote.screenService_",d,void 0);c=T6();var e={};b&&(e={appId:b.appId,disableDial:b.disableDial,theme:b.theme,loadCastApiSetupScript:b.loadCastApiSetupScript,disableCastApi:b.disableCastApi,
enableDialLoungeToken:b.enableDialLoungeToken,enableCastLoungeToken:b.enableCastLoungeToken});PJa(a,d,function(h){h?U6()&&s6(U6(),"YouTube TV"):d.subscribe("onlineScreenChange",function(){z4("yt-remote-receiver-availability-change")})},e)}if(b&&!g.Ha("yt.mdx.remote.initialized_")){g.Da("yt.mdx.remote.initialized_",!0,void 0);
V6("Initializing: "+g.Oj(b));W6.push(g.Go("yt-remote-cast2-availability-change",function(){z4("yt-remote-receiver-availability-change")}));
W6.push(g.Go("yt-remote-cast2-receiver-selected",function(){X6(null);z4("yt-remote-auto-connect","cast-selector-receiver")}));
W6.push(g.Go("yt-remote-cast2-receiver-resumed",function(){z4("yt-remote-receiver-resumed","cast-selector-receiver")}));
W6.push(g.Go("yt-remote-cast2-session-change",lKa));W6.push(g.Go("yt-remote-connection-change",function(h){h?s6(U6(),"YouTube TV"):Y6()||(s6(null,null),SJa())}));
e=Z6();b.isAuto&&(e.id+="#dial");g.Po("desktop_enable_autoplay")&&(e.capabilities=["atp"]);e.name=b.device;e.app=b.app;var f=b.theme;f&&(e.theme=f);V6(" -- with channel params: "+g.Oj(e));e?(g.Eu("yt-remote-session-app",e.app),g.Eu("yt-remote-session-name",e.name)):(g.Gu("yt-remote-session-app"),g.Gu("yt-remote-session-name"));g.Da("yt.mdx.remote.channelParams_",e,void 0);c.start();U6()||mKa()}}},oKa=function(){var a=T6().Hf.$_gos();
var b=$6();b&&a7()&&(G4(a,b)||a.push(b));return YHa(a)},b7=function(){var a=pKa();
!a&&p6()&&RJa()&&(a={key:"cast-selector-receiver",name:RJa()});return a},pKa=function(){var a=oKa(),b=$6();
b||(b=Y6());return g.$a(a,function(c){return b&&C4(b,c.key)?!0:!1})},$6=function(){var a=U6();
if(!a)return null;var b=T6().Rg();return H4(b,a)},lKa=function(a){V6("remote.onCastSessionChange_: "+D4(a));
if(a){var b=$6();if(b&&b.id==a.id){if(s6(b.id,"YouTube TV"),"shortLived"==a.idType&&(a=a.token))c7&&(c7.token=a),(b=a7())&&b.Wu(a)}else b&&d7(),e7(a,1)}else a7()&&d7()},d7=function(){q6()?n6().stopSession():l6("stopSession called before API ready.");
var a=a7();a&&(a.disconnect(1),f7(null))},g7=function(){var a=a7();
return!!a&&3!=a.getProxyState()},V6=function(a){H5("remote",a)},T6=function(){if(!h7){var a=g.Ha("yt.mdx.remote.screenService_");
h7=a?new Q6(a):null}return h7},U6=function(){return g.Ha("yt.mdx.remote.currentScreenId_")},qKa=function(a){g.Da("yt.mdx.remote.currentScreenId_",a,void 0)},rKa=function(){return g.Ha("yt.mdx.remote.connectData_")},X6=function(a){g.Da("yt.mdx.remote.connectData_",a,void 0)},a7=function(){return g.Ha("yt.mdx.remote.connection_")},f7=function(a){var b=a7();
X6(null);a||qKa("");g.Da("yt.mdx.remote.connection_",a,void 0);S6&&(g.yb(S6,function(c){c(a)}),S6.length=0);
b&&!a?z4("yt-remote-connection-change",!1):!b&&a&&z4("yt-remote-connection-change",!0)},Y6=function(){var a=g.Hu();
if(!a)return null;var b=T6();if(!b)return null;b=b.Rg();return H4(b,a)},e7=function(a,b){U6();
$6()&&$6();if(i7)c7=a;else{qKa(a.id);var c=new J6(R6,a,Z6());c.connect(b,rKa());c.subscribe("beforeDisconnect",function(d){z4("yt-remote-before-disconnect",d)});
c.subscribe("beforeDispose",function(){a7()&&(a7(),f7(null))});
c.subscribe("browserChannelAuthError",function(){var d=$6();d&&"shortLived"==d.idType&&(q6()?n6().handleBrowserChannelAuthError():l6("refreshLoungeToken called before API ready."))});
f7(c)}},mKa=function(){var a=Y6();
a?(V6("Resume connection to: "+D4(a)),e7(a,0)):(M4(),SJa(),V6("Skipping connecting because no session screen found."))},kKa=function(){var a=Z6();
if(g.Mb(a)){a=K4();var b=g.Fu("yt-remote-session-name")||"",c=g.Fu("yt-remote-session-app")||"";a={device:"REMOTE_CONTROL",id:a,name:b,app:c,mdxVersion:3};g.Da("yt.mdx.remote.channelParams_",a,void 0)}},Z6=function(){return g.Ha("yt.mdx.remote.channelParams_")||{}},j7=function(a,b,c){g.I.call(this);
var d=this;this.l=a;this.G=b;this.wb=c;this.events=new g.zN(this);this.X=this.events.N(this.G,"onVolumeChange",function(e){sKa(d,e)});
this.C=!1;this.suggestion=null;this.I=new g.vK(64);this.i=new g.L(this.NG,500,this);this.u=new g.L(this.OG,1E3,this);this.L=new S4(this.WQ,0,this);this.B={};this.W=new g.L(this.rH,1E3,this);this.J=new T4(this.seekTo,1E3,this);this.Y=g.Ia;g.K(this,this.events);this.events.N(b,"onCaptionsTrackListChanged",this.MN);this.events.N(b,"captionschanged",this.YM);this.events.N(b,"captionssettingschanged",this.UG);this.events.N(b,"videoplayerreset",this.Fu);this.events.N(b,"mdxautoplaycancel",function(){d.wb.WC()});
a=this.wb;a.na();a.subscribe("proxyStateChange",this.FF,this);a.subscribe("remotePlayerChange",this.Er,this);a.subscribe("remoteQueueChange",this.Fu,this);a.subscribe("previousNextChange",this.CF,this);a.subscribe("nowAutoplaying",this.xF,this);a.subscribe("autoplayDismissed",this.XE,this);g.K(this,this.i);g.K(this,this.u);g.K(this,this.L);g.K(this,this.W);g.K(this,this.J);this.UG();this.Fu();this.Er()},sKa=function(a,b){if(k7(a)){a.wb.unsubscribe("remotePlayerChange",a.Er,a);
var c=Math.round(b.volume),d=!!b.muted,e=C6(a.wb);if(c!==e.volume||d!==e.muted)a.wb.setVolume(c,d),a.W.start();a.wb.subscribe("remotePlayerChange",a.Er,a)}},tKa=function(a){a.Bb(0);
a.i.stop();a.tb(new g.vK(64))},l7=function(a,b){if(k7(a)&&!a.C){var c=null;
b&&(c={style:a.G.getSubtitlesUserSettings()},g.Tb(c,b));a.wb.GB(a.G.getVideoData(1).videoId,c);a.B=C6(a.wb).i}},m7=function(a,b){var c=a.G.getPlaylist();
if(null===c||void 0===c?0:c.listId){var d=c.index;var e=c.listId.toString()}c=a.G.getVideoData(1);a.wb.playVideo(c.videoId,b,d,e,c.playerParams,c.ia,LHa(c));a.tb(new g.vK(1))},uKa=function(a,b){if(b){var c=a.G.getOption("captions","tracklist",{WD:1});
c&&c.length?(a.G.setOption("captions","track",b),a.C=!1):(a.G.loadModule("captions"),a.C=!0)}else a.G.setOption("captions","track",{})},k7=function(a){return C6(a.wb).videoId===a.G.getVideoData(1).videoId},n7=function(){g.W.call(this,{D:"div",
K:"ytp-mdx-manual-pairing-popup-dialog",U:{role:"dialog"},S:[{D:"div",K:"ytp-mdx-manual-pairing-popup-dialog-inner-content",S:[{D:"div",K:"ytp-mdx-manual-pairing-popup-title",ba:"Connecting to your TV on web using a code will be going away soon"},{D:"div",K:"ytp-mdx-manual-pairing-popup-buttons",S:[{D:"button",ka:["ytp-button","ytp-mdx-manual-pairing-popup-learn-more"],ba:"Learn more"},{D:"button",ka:["ytp-button","ytp-mdx-manual-pairing-popup-ok"],ba:"OK"}]}]}]});this.i=new g.eM(this,250);this.learnMoreButton=
this.ha("ytp-mdx-manual-pairing-popup-learn-more");this.okButton=this.ha("ytp-mdx-manual-pairing-popup-ok");g.K(this,this.i);this.N(this.learnMoreButton,"click",this.l);this.N(this.okButton,"click",this.u)},o7=function(){g.W.call(this,{D:"div",
K:"ytp-mdx-popup-dialog",U:{role:"dialog"},S:[{D:"div",K:"ytp-mdx-popup-dialog-inner-content",S:[{D:"div",K:"ytp-mdx-popup-title",ba:"You're signed out"},{D:"div",K:"ytp-mdx-popup-description",ba:"Videos you watch may be added to the TV's watch history and influence TV recommendations. To avoid this, cancel and sign in to YouTube on your computer."},{D:"div",K:"ytp-mdx-privacy-popup-buttons",S:[{D:"button",ka:["ytp-button","ytp-mdx-privacy-popup-cancel"],ba:"Cancel"},{D:"button",ka:["ytp-button",
"ytp-mdx-privacy-popup-confirm"],ba:"Confirm"}]}]}]});this.i=new g.eM(this,250);this.cancelButton=this.ha("ytp-mdx-privacy-popup-cancel");this.confirmButton=this.ha("ytp-mdx-privacy-popup-confirm");g.K(this,this.i);this.N(this.cancelButton,"click",this.l);this.N(this.confirmButton,"click",this.u)},p7=function(a){g.W.call(this,{D:"div",
K:"ytp-remote",S:[{D:"div",K:"ytp-remote-display-status",S:[{D:"div",K:"ytp-remote-display-status-icon",S:[g.Fma()]},{D:"div",K:"ytp-remote-display-status-text",ba:"{{statustext}}"}]}]});this.api=a;this.i=new g.eM(this,250);g.K(this,this.i);this.N(a,"presentingplayerstatechange",this.l);vKa(this,a.Va())},vKa=function(a,b){if(3===a.api.getPresentingPlayerType()){var c={RECEIVER_NAME:a.api.getOption("remote","currentReceiver").name};
c=g.V(b,128)?g.VJ("Error on $RECEIVER_NAME",c):b.Kb()||g.V(b,4)?g.VJ("Playing on $RECEIVER_NAME",c):g.VJ("Connected to $RECEIVER_NAME",c);a.Aa("statustext",c);a.i.show()}else a.i.hide()},q7=function(a,b){g.TQ.call(this,"Play on",0,a,b);
this.G=a;this.Ml={};this.N(a,"onMdxReceiversChange",this.C);this.N(a,"presentingplayerstatechange",this.C);this.C()},r7=function(a){g.HN.call(this,a);
this.gi={key:F4(),name:"This computer"};this.nh=null;this.subscriptions=[];this.rz=this.wb=null;this.Ml=[this.gi];this.Zk=this.gi;this.Mc=new g.vK(64);this.sE=0;this.Ne=-1;this.Wo=null;this.Hr=this.ku=!1;this.yn=this.np=null;if(!g.VC(this.player.T())){a=this.player;var b=g.nN(a);b&&(b=b.bn())&&(b=new q7(a,b),g.K(this,b));b=new p7(a);g.K(this,b);g.xN(a,b.element,4);this.np=new o7;g.K(this,this.np);g.xN(a,this.np.element,4);g.S(this.player.T().experiments,"pair_servlet_deprecation_warning_enabled")&&
!g.S(this.player.T().experiments,"deprecate_pair_servlet_enabled")&&(this.Wo=new n7,g.K(this,this.Wo),g.xN(a,this.Wo.element,4));this.Hr=!!Y6();this.ku=!!g.Fu("yt-remote-manual-pairing-warning-shown")}},s7=function(a){a.yn&&(a.player.removeEventListener("presentingplayerstatechange",a.yn),a.yn=null)},wKa=function(a,b,c){a.Mc=c;
a.player.V("presentingplayerstatechange",new g.BJ(c,b))},xKa=function(a,b,c){var d=!1;
1===b?d=!a.Hr:2===b&&(d=!a.ku);d&&g.DJ(c,8)&&(a.player.pauseVideo(),s7(a))},t7=function(a,b){if(b.key!==a.Zk.key)if(b.key===a.gi.key)d7();
else{if(a.Wo&&!a.ku&&b!==a.gi&&"cast-selector-receiver"!==b.key&&g.oD(a.player.T()))yKa(a);else{var c;(c=!g.S(a.player.T().experiments,"mdx_enable_privacy_disclosure_ui"))||(c=((c=g.O("PLAYER_CONFIG"))&&c.args&&void 0!==c.args.authuser?!0:!(!g.O("SESSION_INDEX")&&!g.O("LOGGED_IN")))||a.Hr||!a.np);(c?0:g.oD(a.player.T())||g.sD(a.player.T()))&&zKa(a)}a.Zk=b;var d=a.player.getPlaylistId();c=a.player.getVideoData(1);var e=c.videoId;if(!d&&!e||(2===a.player.getAppState()||1===a.player.getAppState())&&
g.S(a.player.T().experiments,"should_clear_video_data_on_player_cued_unstarted"))c=null;else{var f=a.player.getPlaylist();if(f){var h=[];for(var l=0;l<f.length;l++)h[l]=f.Na(l).videoId}else h=[e];f=a.player.getCurrentTime(1);d={videoIds:h,listId:d,videoId:e,playerParams:c.playerParams,clickTrackingParams:c.ia,index:Math.max(a.player.getPlaylistIndex(),0),currentTime:0===f?void 0:f};(c=LHa(c))&&(d.locationInfo=c);c=d}V6("Connecting to: "+g.Oj(b));"cast-selector-receiver"==b.key?(X6(c||null),c=c||null,
q6()?n6().setLaunchParams(c):l6("setLaunchParams called before ready.")):!c&&g7()&&U6()==b.key?z4("yt-remote-connection-change",!0):(d7(),X6(c||null),c=T6().Rg(),(c=H4(c,b.key))&&e7(c,1))}},zKa=function(a){a.player.Va().Kb()?a.player.pauseVideo():(a.yn=function(b){xKa(a,1,b)},a.player.addEventListener("presentingplayerstatechange",a.yn));
a.np&&a.np.Ec();a7()||(i7=!0)},yKa=function(a){a.player.Va().Kb()?a.player.pauseVideo():(a.yn=function(b){xKa(a,2,b)},a.player.addEventListener("presentingplayerstatechange",a.yn));
a.Wo&&a.Wo.Ec();a7()||(i7=!0)},AIa={"\x00":"\\0",
"\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r","\t":"\\t","\x0B":"\\x0B",'"':'\\"',"\\":"\\\\","<":"\\u003C"},h5={"'":"\\'"},AKa={},UHa={SR:"atp",h1:"ska",g0:"que",pZ:"mus",g1:"sus",HV:"dsp",z0:"seq",TY:"mic",HU:"dpa"},N4,J4="",nIa=iIa("loadCastFramework")||iIa("loadCastApplicationFramework"),pIa=["pkedcjkdefgpdelpbcmbmeomcjbeemfm","enhhojjnijigcajfphajepfemndkmdlo"];/*
Copyright The Closure Library Authors.
SPDX-License-Identifier: Apache-2.0
*/
g.Ra(S4,g.I);g.k=S4.prototype;g.k.Qg=function(a){this.B=arguments;this.i=!1;this.gb?this.u=g.C()+this.If:this.gb=g.Lm(this.C,this.If)};
g.k.stop=function(){this.gb&&(g.A.clearTimeout(this.gb),this.gb=null);this.u=null;this.i=!1;this.B=[]};
g.k.pause=function(){++this.l};
g.k.resume=function(){this.l&&(--this.l,!this.l&&this.i&&(this.i=!1,this.I.apply(null,this.B)))};
g.k.da=function(){this.stop();S4.Dd.da.call(this)};
g.k.FJ=function(){this.u?(this.gb=g.Lm(this.C,this.u-g.C()),this.u=null):(this.gb=null,this.l?this.i=!0:(this.i=!1,this.I.apply(null,this.B)))};g.u(T4,g.I);g.k=T4.prototype;g.k.Qg=function(a){this.u=arguments;this.gb||this.l?this.i=!0:U4(this)};
g.k.stop=function(){this.gb&&(g.A.clearTimeout(this.gb),this.gb=null,this.i=!1,this.u=null)};
g.k.pause=function(){this.l++};
g.k.resume=function(){this.l--;this.l||!this.i||this.gb||(this.i=!1,U4(this))};
g.k.da=function(){g.I.prototype.da.call(this);this.stop()};W4.prototype.stringify=function(a){return g.A.JSON.stringify(a,void 0)};
W4.prototype.parse=function(a){return g.A.JSON.parse(a,void 0)};var Y4=new g.am;g.u(rIa,g.Hl);$4.prototype.i=null;$4.prototype.getOptio