(function(g){var window=this;var Jua=function(a,b){return g.Lb(a,b)},Y5=function(a,b,c){a.w.set(b,c)},Z5=function(a){Y5(a,"zx",Math.floor(2147483648*Math.random()).toString(36)+Math.abs(Math.floor(2147483648*Math.random())^(0,g.H)()).toString(36));
return a},$5=function(a,b,c){Array.isArray(c)||(c=[String(c)]);
g.dn(a.w,b,c)},Kua=function(a,b){var c=[];
g.kk(b,function(d){try{var e=g.go.prototype.u.call(this,d,!0)}catch(f){if("Storage: Invalid value was encountered"==f)return;throw f;}void 0===e?c.push(d):g.fo(e)&&c.push(d)},a);
return c},Lua=function(a,b){var c=Kua(a,b);
(0,g.y)(c,function(d){g.go.prototype.remove.call(this,d)},a)},Mua=function(a){if(a.Pc){if(a.Pc.locationOverrideToken)return{locationOverrideToken:a.Pc.locationOverrideToken};
if(null!=a.Pc.latitudeE7&&null!=a.Pc.longitudeE7)return{latitudeE7:a.Pc.latitudeE7,longitudeE7:a.Pc.longitudeE7}}return null},Nua=function(a,b){g.cb(a,b)||a.push(b)},a6=function(a){var b=0,c;
for(c in a)b++;return b},Oua=function(a,b){var c=b instanceof g.vc?b:g.Ac(b,/^data:image\//i.test(b));
a.src=g.wc(c)},b6=function(){},Pua=function(a){try{return g.v.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);},Qua=function(a){if(a.Bd&&"function"==typeof a.Bd)return a.Bd();
if("string"===typeof a)return a.split("");if(g.Na(a)){for(var b=[],c=a.length,d=0;d<c;d++)b.push(a[d]);return b}return g.Hb(a)},Rua=function(a,b){if(a.forEach&&"function"==typeof a.forEach)a.forEach(b,void 0);
else if(g.Na(a)||"string"===typeof a)(0,g.y)(a,b,void 0);else{if(a.se&&"function"==typeof a.se)var c=a.se();else if(a.Bd&&"function"==typeof a.Bd)c=void 0;else if(g.Na(a)||"string"===typeof a){c=[];for(var d=a.length,e=0;e<d;e++)c.push(e)}else c=g.Ib(a);d=Qua(a);e=d.length;for(var f=0;f<e;f++)b.call(void 0,d[f],c&&c[f],a)}},Sua=function(a,b,c,d){var e=new g.Sm(null,void 0);
a&&g.Tm(e,a);b&&g.Um(e,b);c&&g.Vm(e,c);d&&(e.u=d);return e},c6=function(a,b){g.Po[a]=!0;
var c=g.No();c&&c.publish.apply(c,arguments);g.Po[a]=!1},d6=function(a){this.app=this.name=this.id="";
this.type="REMOTE_CONTROL";this.obfuscatedGaiaId=this.avatar=this.username="";this.w=!1;this.capabilities=new Set;this.experiments=new Set;this.theme="u";new g.Pm;this.o=this.u="";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",Tua(this,a.capabilities||""),Uua(this,a.experiments||""),this.u=a.remoteControllerUrl||"",this.o=a.localChannelEncryptionKey||
"")},Tua=function(a,b){a.capabilities.clear();
(0,g.ve)(b.split(","),g.Sa(Jua,Vua)).forEach(function(c){a.capabilities.add(c)})},Uua=function(a,b){a.experiments.clear();
b.split(",").forEach(function(c){a.experiments.add(c)})},e6=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||""},f6=function(a,b){return!!b&&(a.id==b||a.uuid==b)},Wua=function(a){return{name:a.name,
screenId:a.id,loungeToken:a.token,dialId:a.uuid}},Xua=function(a){return new e6(a)},Yua=function(a){return g.Ma(a)?(0,g.Fc)(a,Xua):[]},g6=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):"-")+"}":"null"},h6=function(a){return g.Ma(a)?"["+(0,g.Fc)(a,g6).join(",")+"]":"null"},i6=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)})},Zua=function(a){return(0,g.Fc)(a,function(b){return{key:b.id,
name:b.name}})},j6=function(a,b){return g.$a(a,function(c){return c||b?!c!=!b?!1:c.id==b.id:!0})},k6=function(a,b){return g.$a(a,function(c){return f6(c,b)})},l6=function(a){try{var b=(0,g.ps)(),c=(0,g.os)();
b&&b.remove(a);c&&c.remove(a)}catch(d){}},$ua=function(){var a=(0,g.os)();
a&&Lua(a,a.o.If(!0))},m6=function(){var a=g.rs("yt-remote-connected-devices")||[];
g.tb(a);return a},ava=function(a){if(g.db(a))return[];
var b=a[0].indexOf("#"),c=-1==b?a[0]:a[0].substring(0,b);return(0,g.Fc)(a,function(d,e){return 0==e?d:d.substring(c.length)})},bva=function(a){g.qs("yt-remote-connected-devices",a,86400)},o6=function(){if(n6)return n6;
var a=g.rs("yt-remote-device-id");a||(a=i6(),g.qs("yt-remote-device-id",a,31536E3));for(var b=m6(),c=1,d=a;g.cb(b,d);)c++,d=a+"#"+c;return n6=d},p6=function(){var a=m6(),b=o6();
g.cb(a,b);g.ts()&&g.wb(a,b);a=ava(a);if(g.db(a))try{g.Hq("remote_sid")}catch(c){}else try{g.Fq("remote_sid",a.join(","),-1)}catch(c){}},cva=function(){return g.rs("yt-remote-session-browser-channel")},dva=function(){return g.rs("yt-remote-local-screens")||[]},eva=function(){g.qs("yt-remote-lounge-token-expiration",!0,86400)},fva=function(a){5<a.length&&(a=a.slice(a.length-5));
var b=(0,g.Fc)(dva(),function(d){return d.loungeToken}),c=(0,g.Fc)(a,function(d){return d.loungeToken});
(0,g.ui)(c,function(d){return!g.cb(b,d)})&&eva();
g.qs("yt-remote-local-screens",a,31536E3)},gva=function(a,b){g.qs("yt-remote-session-browser-channel",a);
g.qs("yt-remote-session-screen-id",b);var c=m6(),d=o6();g.cb(c,d)||c.push(d);bva(c);p6()},q6=function(a){a||(l6("yt-remote-session-screen-id"),l6("yt-remote-session-video-id"));
p6();a=m6();g.gb(a,o6());bva(a)},hva=function(){if(!r6){var a=g.ro();
a&&(r6=new g.$n(a))}return r6?!!r6.get("yt-remote-use-staging-server"):!1},iva=function(a){return!!document.currentScript&&(-1!=document.currentScript.src.indexOf("?"+a)||-1!=document.currentScript.src.indexOf("&"+a))},jva=function(){return"function"==typeof window.__onGCastApiAvailable?window.__onGCastApiAvailable:null},s6=function(a){a.length?kva(a.shift(),function(){s6(a)}):t6()},lva=function(a){return"chrome-extension://"+a+"/cast_sender.js"},kva=function(a,b,c){var d=document.createElement("script");
d.onerror=b;c&&(d.onload=c);d.src=a;(document.head||document.documentElement).appendChild(d)},t6=function(){var a=jva();
a&&a(!1,"No cast extension found")},nva=function(){if(mva){var a=2,b=jva(),c=function(){a--;
0==a&&b&&b(!0)};
window.__onGCastApiAvailable=c;kva("//www.gstatic.com/cast/sdk/libs/sender/1.0/cast_framework.js",t6,c)}},ova=function(){nva();
var a=window.navigator.userAgent.match(/Chrome\/([0-9]+)/);s6(["//www.gstatic.com/eureka/clank/"+(a?parseInt(a[1],10):0)+"/cast_sender.js","//www.gstatic.com/eureka/clank/cast_sender.js"])},u6=function(){},pva=function(){},rva=function(a){return(a=qva(a))?new ActiveXObject(a):new XMLHttpRequest},qva=function(a){if(!a.u&&"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.u=d}catch(e){}}throw Error("Could not create ActiveXObject. ActiveX might be disabled, or MSXML might not be installed");}return a.u},v6=function(a,b,c){g.A.call(this);
this.w=null!=c?(0,g.x)(a,c):a;this.rd=b;this.u=(0,g.x)(this.gF,this);this.o=[]},w6=function(a){a.Da=g.Wf(a.u,a.rd);
a.w.apply(null,a.o)},x6=function(a,b,c,d){this.o=a;
this.w=b;this.G=c;this.F=d||1;this.B=45E3;this.A=new g.R1(this);this.u=new g.Vf;this.u.setInterval(250)},tva=function(a,b,c){a.Yi=1;
a.Dg=Z5(b.clone());a.ri=c;a.C=!0;sva(a,null)},y6=function(a,b,c,d,e){a.Yi=1;
a.Dg=Z5(b.clone());a.ri=null;a.C=c;e&&(a.IB=!1);sva(a,d)},sva=function(a,b){a.Hj=(0,g.H)();
z6(a);a.ph=a.Dg.clone();$5(a.ph,"t",a.F);a.mm=0;a.Ic=a.o.Bq(a.o.Yl()?b:null);0<a.lr&&(a.Wo=new v6((0,g.x)(a.HC,a,a.Ic),a.lr));a.A.ia(a.Ic,"readystatechange",a.eO);var c=a.Uh?g.Rb(a.Uh):{};a.ri?(a.Gp="POST",c["Content-Type"]="application/x-www-form-urlencoded",a.Ic.send(a.ph,a.Gp,a.ri,c)):(a.Gp="GET",a.IB&&!g.ke&&(c.Connection="close"),a.Ic.send(a.ph,a.Gp,null,c));a.o.Ve(1)},wva=function(a,b,c){for(var d=!0;!a.Gh&&a.mm<c.length;){var e=uva(a,c);
if(e==A6){4==b&&(a.Rg=4,B6(15),d=!1);break}else if(e==vva){a.Rg=4;B6(16);d=!1;break}else C6(a,e)}4==b&&0==c.length&&(a.Rg=1,B6(17),d=!1);a.We=a.We&&d;d||(D6(a),E6(a))},uva=function(a,b){var c=a.mm,d=b.indexOf("\n",c);
if(-1==d)return A6;c=Number(b.substring(c,d));if(isNaN(c))return vva;d+=1;if(d+c>b.length)return A6;var e=b.substr(d,c);a.mm=d+c;return e},yva=function(a,b){a.Hj=(0,g.H)();
z6(a);var c=b?window.location.hostname:"";a.ph=a.Dg.clone();Y5(a.ph,"DOMAIN",c);Y5(a.ph,"t",a.F);try{a.af=new ActiveXObject("htmlfile")}catch(n){D6(a);a.Rg=7;B6(22);E6(a);return}var d="<html><body>";if(b){for(var e="",f=0;f<c.length;f++){var k=c.charAt(f);if("<"==k)e+="\\x3c";else if(">"==k)e+="\\x3e";else{var l=k;if(l in F6)k=F6[l];else if(l in xva)k=F6[l]=xva[l];else{var m=l.charCodeAt(0);if(31<m&&127>m)k=l;else{if(256>m){if(k="\\x",16>m||256<m)k+="0"}else k="\\u",4096>m&&(k+="0");k+=m.toString(16).toUpperCase()}k=
F6[l]=k}e+=k}}d+='<script>document.domain="'+e+'"\x3c/script>'}c=g.Zc(g.$b("b/12014412"),d+"</body></html>");a.af.open();a.af.write(g.Uc(c));a.af.close();a.af.parentWindow.m=(0,g.x)(a.xN,a);a.af.parentWindow.d=(0,g.x)(a.QA,a,!0);a.af.parentWindow.rpcClose=(0,g.x)(a.QA,a,!1);c=a.af.createElement("DIV");a.af.parentWindow.document.body.appendChild(c);d=g.zc(a.ph.toString());d=g.fd(g.wc(d));d=g.Zc(g.$b("b/12014412"),'<iframe src="'+d+'"></iframe>');g.$c(c,d);a.o.Ve(1)},z6=function(a){a.Bu=(0,g.H)()+a.B;
zva(a,a.B)},zva=function(a,b){if(null!=a.Vj)throw Error("WatchDog timer not null");
a.Vj=G6((0,g.x)(a.FN,a),b)},H6=function(a){a.Vj&&(g.v.clearTimeout(a.Vj),a.Vj=null)},E6=function(a){a.o.tx()||a.Gh||a.o.Oo(a)},D6=function(a){H6(a);
g.He(a.Wo);a.Wo=null;a.u.stop();g.Ipa(a.A);if(a.Ic){var b=a.Ic;a.Ic=null;b.abort();b.dispose()}a.af&&(a.af=null)},C6=function(a,b){try{a.o.KA(a,b),a.o.Ve(4)}catch(c){}},Bva=function(a,b,c,d,e){if(0==d)c(!1);
else{var f=e||0;d--;Ava(a,b,function(k){k?c(!0):g.v.setTimeout(function(){Bva(a,b,c,d,f)},f)})}},Ava=function(a,b,c){var d=new Image;
d.onload=function(){try{I6(d),c(!0)}catch(e){}};
d.onerror=function(){try{I6(d),c(!1)}catch(e){}};
d.onabort=function(){try{I6(d),c(!1)}catch(e){}};
d.ontimeout=function(){try{I6(d),c(!1)}catch(e){}};
g.v.setTimeout(function(){if(d.ontimeout)d.ontimeout()},b);
Oua(d,a)},I6=function(a){a.onload=null;
a.onerror=null;a.onabort=null;a.ontimeout=null},J6=function(){},Cva=function(a){this.o=a;
this.u=new J6},Dva=function(a){var b=K6(a.o,a.fk,"/mail/images/cleardot.gif");
Z5(b);Bva(b.toString(),5E3,(0,g.x)(a.bE,a),3,2E3);a.Ve(1)},M6=function(a){var b=a.o.H;
if(null!=b)B6(5),b?(B6(11),L6(a.o,a,!1)):(B6(12),L6(a.o,a,!0));else if(a.Pd=new x6(a,void 0,void 0,void 0),a.Pd.Uh=a.jr,b=a.o,b=K6(b,b.Yl()?a.Gk:null,a.kr),B6(5),!g.ie||g.Nd(10))$5(b,"TYPE","xmlhttp"),y6(a.Pd,b,!1,a.Gk,!1);else{$5(b,"TYPE","html");var c=a.Pd;a=!!a.Gk;c.Yi=3;c.Dg=Z5(b.clone());yva(c,a)}},N6=function(a){if(g.v.JSON)try{return g.v.JSON.parse(a)}catch(b){}return Pua(a)},O6=function(a){g.gf.call(this);
this.headers=new g.Pm;this.S=a||null;this.w=!1;this.O=this.o=null;this.da=this.H="";this.C=0;this.A="";this.B=this.Z=this.G=this.U=!1;this.F=0;this.J=null;this.ea="";this.P=this.V=!1},Eva=function(a){return g.ie&&g.Md(9)&&"number"===typeof a.timeout&&void 0!==a.ontimeout},Fva=function(a){return"content-type"==a.toLowerCase()},Hva=function(a,b){a.w=!1;
a.o&&(a.B=!0,a.o.abort(),a.B=!1);a.A=b;a.C=5;Gva(a);P6(a)},Gva=function(a){a.U||(a.U=!0,a.dispatchEvent("complete"),a.dispatchEvent("error"))},Jva=function(a){if(a.w&&"undefined"!=typeof g.W1)if(a.O[1]&&4==Q6(a)&&2==a.getStatus())R6(a,"Local request error detected and ignored");
else if(a.G&&4==Q6(a))g.Wf(a.wx,0,a);else if(a.dispatchEvent("readystatechange"),4==Q6(a)){R6(a,"Request complete");a.w=!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.pd(1,String(a.H));if(!f&&g.v.self&&g.v.self.location){var k=g.v.self.location.protocol;f=k.substr(0,k.length-1)}e=!Iva.test(f?f.toLowerCase():"")}d=e}if(d)a.dispatchEvent("complete"),a.dispatchEvent("success");
else{a.C=6;try{var l=2<Q6(a)?a.o.statusText:""}catch(m){l=""}a.A=l+" ["+a.getStatus()+"]";Gva(a)}}finally{P6(a)}}},P6=function(a,b){if(a.o){Kva(a);
var c=a.o,d=a.O[0]?g.Ja:null;a.o=null;a.O=null;b||a.dispatchEvent("ready");try{c.onreadystatechange=d}catch(e){}}},Kva=function(a){a.o&&a.P&&(a.o.ontimeout=null);
a.J&&(g.v.clearTimeout(a.J),a.J=null)},Q6=function(a){return a.o?a.o.readyState:0},S6=function(a){try{return a.o?a.o.responseText:""}catch(b){return""}},R6=function(a,b){return b+" ["+a.da+" "+a.H+" "+a.getStatus()+"]"},T6=function(a,b,c){this.o=1;
this.u=[];this.A=[];this.B=new J6;this.G=a||null;this.H=null!=b?b:null;this.C=c||!1},Lva=function(a,b){this.o=a;
this.map=b;this.context=null},Mva=function(a){g.Je.call(this,"statevent",a)},Nva=function(a,b){g.Je.call(this,"timingevent",a);
this.size=b},Ova=function(a){g.Je.call(this,"serverreachability",a)},Rva=function(a){Pva(a);
if(3==a.o){var b=a.Bl++,c=a.qn.clone();Y5(c,"SID",a.w);Y5(c,"RID",b);Y5(c,"TYPE","terminate");U6(a,c);b=new x6(a,a.w,b,void 0);b.Yi=2;b.Dg=Z5(c.clone());Oua(new Image,b.Dg.toString());b.Hj=(0,g.H)();z6(b)}Qva(a)},Sva=function(a){a.yE(1,0);
a.qn=K6(a,null,a.ir);V6(a)},Pva=function(a){a.Hg&&(a.Hg.abort(),a.Hg=null);
a.fc&&(a.fc.cancel(),a.fc=null);a.Kf&&(g.v.clearTimeout(a.Kf),a.Kf=null);W6(a);a.Kd&&(a.Kd.cancel(),a.Kd=null);a.Mg&&(g.v.clearTimeout(a.Mg),a.Mg=null)},Tva=function(a,b){if(0==a.o)throw Error("Invalid operation: sending map when state is closed");
a.u.push(new Lva(a.PJ++,b));2!=a.o&&3!=a.o||V6(a)},V6=function(a){a.Kd||a.Mg||(a.Mg=G6((0,g.x)(a.PA,a),0),a.Si=0)},Vva=function(a,b){if(1==a.o){if(!b){a.Bl=Math.floor(1E5*Math.random());
var c=a.Bl++,d=new x6(a,"",c,void 0);d.Uh=null;var e=X6(a),f=a.qn.clone();Y5(f,"RID",c);Y5(f,"CVER","1");U6(a,f);tva(d,f,e);a.Kd=d;a.o=2}}else 3==a.o&&(b?Uva(a,b):0==a.u.length||a.Kd||Uva(a))},Uva=function(a,b){if(b)if(6<a.Hh){a.u=a.A.concat(a.u);
a.A.length=0;var c=a.Bl-1;var d=X6(a)}else c=b.G,d=b.ri;else c=a.Bl++,d=X6(a);var e=a.qn.clone();Y5(e,"SID",a.w);Y5(e,"RID",c);Y5(e,"AID",a.kj);U6(a,e);c=new x6(a,a.w,c,a.Si+1);c.Uh=null;c.setTimeout(1E4+Math.round(1E4*Math.random()));a.Kd=c;tva(c,e,d)},U6=function(a,b){if(a.nd){var c=a.nd.Pw();
c&&g.Bb(c,function(d,e){Y5(b,e,d)})}},X6=function(a){var b=Math.min(a.u.length,1E3),c=["count="+b];
if(6<a.Hh&&0<b){var d=a.u[0].o;c.push("ofs="+d)}else d=0;for(var e=0;e<b;e++){var f=a.u[e].o,k=a.u[e].map;f=6>=a.Hh?e:f-d;try{g.Bb(k,function(l,m){c.push("req"+f+"_"+m+"="+encodeURIComponent(l))})}catch(l){c.push("req"+f+"_type="+encodeURIComponent("_badmap"))}}a.A=a.A.concat(a.u.splice(0,b));
return c.join("&")},Wva=function(a){a.fc||a.Kf||(a.F=1,a.Kf=G6((0,g.x)(a.OA,a),0),a.Li=0)},Y6=function(a){if(a.fc||a.Kf||3<=a.Li)return!1;
a.F++;a.Kf=G6((0,g.x)(a.OA,a),Xva(a,a.Li));a.Li++;return!0},L6=function(a,b,c){a.Ep=c;
a.kf=b.Wf;a.C||Sva(a)},W6=function(a){null!=a.Lh&&(g.v.clearTimeout(a.Lh),a.Lh=null)},Xva=function(a,b){var c=5E3+Math.floor(1E4*Math.random());
a.isActive()||(c*=2);return c*b},Z6=function(a,b){if(2==b||9==b){var c=null;
a.nd&&(c=null);var d=(0,g.x)(a.SO,a);c||(c=new g.Sm("//www.google.com/images/cleardot.gif"),Z5(c));Ava(c.toString(),1E4,d)}else B6(2);Yva(a,b)},Yva=function(a,b){a.o=0;
a.nd&&a.nd.bw(b);Qva(a);Pva(a)},Qva=function(a){a.o=0;
a.kf=-1;if(a.nd)if(0==a.A.length&&0==a.u.length)a.nd.rq();else{g.kb(a.A);var b=g.kb(a.u);a.A.length=0;a.u.length=0;a.nd.rq(b)}},K6=function(a,b,c){var d=g.$m(c);
if(""!=d.o)b&&g.Um(d,b+"."+d.o),g.Vm(d,d.B);else{var e=window.location;d=Sua(e.protocol,b?b+"."+e.hostname:e.hostname,+e.port,c)}a.tk&&g.Bb(a.tk,function(f,k){Y5(d,k,f)});
Y5(d,"VER",a.Hh);U6(a,d);return d},G6=function(a,b){if(!g.Oa(a))throw Error("Fn must not be null and must be a function");
return g.v.setTimeout(function(){a()},b)},B6=function(a){$6.dispatchEvent(new Mva($6,a))},Zva=function(){},a7=function(a,b,c){g.A.call(this);
this.C=null!=c?(0,g.x)(a,c):a;this.rd=b;this.B=(0,g.x)(this.fF,this);this.o=!1;this.u=0;this.w=this.Da=null;this.A=[]},$va=function(){this.o=[];
this.u=[]},awa=function(a,b){this.action=a;
this.params=b||{}},b7=function(a,b){g.A.call(this);
this.o=new g.I(this.oN,0,this);g.C(this,this.o);this.rd=5E3;this.u=0;if(g.Oa(a))b&&(a=(0,g.x)(a,b));else if(a&&g.Oa(a.handleEvent))a=(0,g.x)(a.handleEvent,a);else throw Error("Invalid listener argument");this.w=a},c7=function(a,b,c){this.J=a;
this.C=b;this.w=new g.Zn;this.u=new b7(this.tO,this);this.o=null;this.ub=!1;this.B=null;this.H="";this.G=this.A=0;this.F=[];this.P=c||!1},bwa=function(a){return{firstTestResults:[""],
secondTestResults:!a.o.Ep,sessionId:a.o.w,arrayId:a.o.kj}},cwa=function(a,b){a.G=b||0;
a.u.stop();a.o&&(3==a.o.o&&Vva(a.o),Rva(a.o));a.G=0},d7=function(a){return!!a.o&&3==a.o.o},dwa=function(a,b){(a.C.loungeIdToken=b)||a.u.stop()},e7=function(a){this.port=this.domain="";
this.o="/api/lounge";this.u=!0;a=a||document.location.href;var b=Number(g.pd(4,a))||"";b&&(this.port=":"+b);this.domain=g.qd(a)||"";a=g.Mc;0<=a.search("MSIE")&&(a=a.match(/MSIE ([\d.]+)/)[1],0>g.sc(a,"10.0")&&(this.u=!1))},f7=function(a,b){var c=a.o;
a.u&&(c="https://"+a.domain+a.port+a.o);return g.Ad(c+b,{})},g7=function(a,b,c,d,e){a={format:"JSON",
method:"POST",context:a,timeout:5E3,withCredentials:!1,onSuccess:g.Sa(a.A,d,!0),onError:g.Sa(a.w,e),Md:g.Sa(a.B,e)};c&&(a.yb=c,a.headers={"Content-Type":"application/x-www-form-urlencoded"});return g.xq(b,a)},hwa=function(){var a=ewa;
fwa();h7.push(a);gwa(h7)},i7=function(a,b){fwa();
var c=h7,d=iwa(a,String(b));g.db(c)?jwa(d):(gwa(c),(0,g.y)(c,function(e){e(d)}))},fwa=function(){h7||(h7=g.w("yt.mdx.remote.debug.handlers_")||[],g.Ia("yt.mdx.remote.debug.handlers_",h7,void 0))},jwa=function(a){var b=(j7+1)%50;
j7=b;k7[b]=a;l7||(l7=49==b)},gwa=function(a){var b=k7;
if(b[0]){var c=j7,d=l7?c:-1;do{d=(d+1)%50;var e=b[d];(0,g.y)(a,function(f){f(e)})}while(d!=c);
k7=Array(50);j7=-1;l7=!1}},iwa=function(a,b){var c=((0,g.H)()-kwa)/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("")},m7=function(a){g.P.call(this);
this.F=a;this.o=[]},lwa=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.o.push(b);return!0},mwa=function(a,b){var c=a.o.length!=b.length;
a.o=(0,g.ve)(a.o,function(f){return!!j6(b,f)});
for(var d=0,e=b.length;d<e;d++)c=lwa(a,b[d])||c;return c},nwa=function(a,b){var c=a.o.length;
a.o=(0,g.ve)(a.o,function(d){return!(d||b?!d!=!b?0:d.id==b.id:1)});
return a.o.length<c},n7=function(a,b,c,d){g.P.call(this);
this.C=a;this.A=b;this.B=c;this.w=d;this.u=0;this.o=null;this.Da=NaN},p7=function(a){m7.call(this,"LocalScreenService");
this.w=a;this.u=NaN;o7(this);this.info("Initializing with "+h6(this.o))},owa=function(a){if(a.o.length){var b=(0,g.Fc)(a.o,function(d){return d.id}),c=f7(a.w,"/pairing/get_lounge_token_batch");
g7(a.w,c,{screen_ids:b.join(",")},(0,g.x)(a.qF,a),(0,g.x)(a.pF,a))}},o7=function(a){var b=Yua(dva());
b=(0,g.ve)(b,function(c){return!c.uuid});
return mwa(a,b)},q7=function(a,b){fva((0,g.Fc)(a.o,Wua));
b&&eva()},s7=function(a,b){g.P.call(this);
this.C=b;var c=g.rs("yt-remote-online-screen-ids")||"";c=c?c.split(","):[];for(var d={},e=this.C(),f=0,k=e.length;f<k;++f){var l=e[f].id;d[l]=g.cb(c,l)}this.o=d;this.B=a;this.w=this.A=NaN;this.u=null;r7("Initialized with "+g.Mk(this.o))},pwa=function(a,b,c){var d=f7(a.B,"/pairing/get_screen_availability");
g7(a.B,d,{lounge_token:b.token},(0,g.x)(function(e){e=e.screens||[];for(var f=0,k=e.length;f<k;++f)if(e[f].loungeToken==b.token){c("online"==e[f].status);return}c(!1)},a),(0,g.x)(function(){c(!1)},a))},t7=function(a,b){a:if(a6(b)!=a6(a.o))var c=!1;
else{c=g.Ib(b);for(var d=0,e=c.length;d<e;++d)if(!a.o[c[d]]){c=!1;break a}c=!0}c||(r7("Updated online screens: "+g.Mk(a.o)),a.o=b,a.R("screenChange"));qwa(a)},u7=function(a){isNaN(a.w)||g.Mo(a.w);
a.w=g.Ko((0,g.x)(a.Ot,a),0<a.A&&a.A<(0,g.H)()?2E4:1E4)},r7=function(a){i7("OnlineScreenService",a)},rwa=function(a){var b={};
(0,g.y)(a.C(),function(c){c.token?b[c.token]=c.id:this.Sb("Requesting availability of screen w/o lounge token.")});
return b},qwa=function(a){a=g.Ib(g.Cb(a.o,function(b){return b}));
g.tb(a);a.length?g.qs("yt-remote-online-screen-ids",a.join(","),60):l6("yt-remote-online-screen-ids")},v7=function(a){m7.call(this,"ScreenService");
this.C=a;this.u=this.w=null;this.A=[];this.B={};swa(this)},uwa=function(a,b,c,d,e,f){a.info("getAutomaticScreenByIds "+c+" / "+b);
c||(c=a.B[b]);var k=a.ae();if(k=(c?k6(k,c):null)||k6(k,b)){k.uuid=b;var l=w7(a,k);pwa(a.u,l,function(m){e(m?l:null)})}else c?twa(a,c,(0,g.x)(function(m){var n=w7(this,new e6({name:d,
screenId:c,loungeToken:m,dialId:b||""}));pwa(this.u,n,function(p){e(p?n:null)})},a),f):e(null)},vwa=function(a,b){for(var c=0,d=a.o.length;c<d;++c)if(a.o[c].name==b)return a.o[c];
return null},twa=function(a,b,c,d){a.info("requestLoungeToken_ for "+b);
var e={yb:{screen_ids:b},method:"POST",context:a,onSuccess:function(f,k){var l=k&&k.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.xq(f7(a.C,"/pairing/get_lounge_token_batch"),e)},wwa=function(a){a.o=a.w.ae();
var b=a.B,c={},d;for(d in b)c[b[d]]=d;b=0;for(d=a.o.length;b<d;++b){var e=a.o[b];e.uuid=c[e.id]||""}a.info("Updated manual screens: "+h6(a.o))},swa=function(a){x7(a);
a.w=new p7(a.C);a.w.subscribe("screenChange",(0,g.x)(a.yF,a));wwa(a);a.A=Yua(g.rs("yt-remote-automatic-screen-cache")||[]);x7(a);a.info("Initializing automatic screens: "+h6(a.A));a.u=new s7(a.C,(0,g.x)(a.ae,a,!0));a.u.subscribe("screenChange",(0,g.x)(function(){this.R("onlineScreenChange")},a))},w7=function(a,b){var c=a.get(b.id);
c?(c.uuid=b.uuid,b=c):((c=k6(a.A,b.uuid))?(c.id=b.id,c.token=b.token,b=c):a.A.push(b),g.qs("yt-remote-automatic-screen-cache",(0,g.Fc)(a.A,Wua)));x7(a);a.B[b.uuid]=b.id;g.qs("yt-remote-device-id-map",a.B,31536E3);return b},x7=function(a){a.B=g.rs("yt-remote-device-id-map")||{}},y7=function(a,b,c){g.P.call(this);
this.O=c;this.H=a;this.u=b;this.w=null},z7=function(a,b){i7(a.O,b)},A7=function(a,b){y7.call(this,a,b,"CastSession");
this.o=null;this.A=0;this.C=(0,g.x)(this.DP,this);this.B=(0,g.x)(this.NN,this);this.A=g.Ko((0,g.x)(function(){xwa(this,null)},this),12E4)},ywa=function(a){a.info("sendYoutubeMessage_: getMdxSessionStatus "+g.Mk(void 0));
var b={type:"getMdxSessionStatus"};a.o?a.o.sendMessage("urn:x-cast:com.google.youtube.mdx",b,g.Ja,(0,g.x)(function(){z7(this,"Failed to send message: getMdxSessionStatus.")},a)):z7(a,"Sending yt message without session: "+g.Mk(b))},xwa=function(a,b){g.Mo(a.A);
if(b){if(a.info("onConnectedScreenId_: Received screenId: "+b),!a.w||a.w.id!=b){var c=(0,g.x)(a.Qo,a),d=(0,g.x)(a.ge,a);a.jx(b,c,d,5)}}else a.ge(Error("Waiting for session status timed out."))},B7=function(a,b,c){y7.call(this,a,b,"DialSession");
this.A=this.G=null;this.J="";this.S=c;this.B=null;this.F=g.Ja;this.C=NaN;this.P=(0,g.x)(this.GP,this);this.o=g.Ja},zwa=function(a){a.o=a.H.NC(a.J,a.u.label,a.u.friendlyName,(0,g.x)(function(b){this.o=g.Ja;
this.Qo(b)},a),(0,g.x)(function(b){this.o=g.Ja;
this.ge(b)},a))},Awa=function(a){var b={};
b.pairingCode=a.J;b.theme=a.S;if(a.B){var c=a.B.currentTime||0;b.v=a.B.videoId;b.t=c}hva()&&(b.env_useStageMdx=1);return g.xd(b)},C7=function(a,b){y7.call(this,a,b,"ManualSession");
this.o=g.Ko((0,g.x)(this.lj,this,null),150)},D7=function(a,b,c,d){g.P.call(this);
this.u=a;this.F=b||"233637DE";this.C=c||"cl";this.G=d||!1;this.o=null;this.B=!1;this.w=[];this.A=(0,g.x)(this.vM,this)},Bwa=function(a,b){return b?g.$a(a.w,function(c){return f6(b,c.label)},a):null},E7=function(a){i7("Controller",a)},ewa=function(a){window.chrome&&chrome.cast&&chrome.cast.logMessage&&chrome.cast.logMessage(a)},F7=function(a){return a.B||!!a.w.length||!!a.o},G7=function(a,b,c){b!=a.o&&(g.He(a.o),(a.o=b)?(c?a.R("yt-remote-cast2-receiver-resumed",b.u):a.R("yt-remote-cast2-receiver-selected",
b.u),b.subscribe("sessionScreen",(0,g.x)(a.NA,a,b)),b.w?a.R("yt-remote-cast2-session-change",b.w):c&&a.o.lj(null)):a.R("yt-remote-cast2-session-change",null))},Cwa=function(a){var b=a.u.MC(),c=a.o&&a.o.u;
a=(0,g.Fc)(b,function(d){c&&f6(d,c.label)&&(c=null);var e=d.uuid?d.uuid:d.id,f=Bwa(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},Iwa=function(a,b,c,d,e,f,k){Dwa()?Ewa(b,e,f,k)&&(I7(!0),window.chrome&&chrome.cast&&chrome.cast.isAvailable?Fwa(a,c):(window.__onGCastApiAvailable=function(l,m){l?Fwa(a,c):(J7("Failed to load cast API: "+m),K7(!1),I7(!1),l6("yt-remote-cast-available"),l6("yt-remote-cast-receiver"),Gwa(),c(!1))},d?g.Wo("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?ova():!window.chrome||!window.navigator.presentation||0<=window.navigator.userAgent.indexOf("Edge")?t6():(nva(),s6(Hwa.map(lva))))):H7("Cannot initialize because not running Chrome")},Gwa=function(){H7("dispose");
var a=L7();a&&a.dispose();g.Ia("yt.mdx.remote.cloudview.instance_",null,void 0);Jwa(!1);g.So(M7);M7.length=0},N7=function(){return!!g.rs("yt-remote-cast-installed")},Kwa=function(){var a=g.rs("yt-remote-cast-receiver");
return a?a.friendlyName:null},Lwa=function(){H7("clearCurrentReceiver");
l6("yt-remote-cast-receiver")},Mwa=function(){return N7()?L7()?L7().getCastSession():(J7("getCastSelector: Cast is not initialized."),null):(J7("getCastSelector: Cast API is not installed!"),null)},P7=function(){N7()?L7()?O7()?(H7("Requesting cast selector."),L7().requestSession()):(H7("Wait for cast API to be ready to request the session."),M7.push(g.Ro("yt-remote-cast2-api-ready",P7))):J7("requestCastSelector: Cast is not initialized."):J7("requestCastSelector: Cast API is not installed!")},Q7=
function(a,b){O7()?L7().setConnectedScreenStatus(a,b):J7("setConnectedScreenStatus called before ready.")},Dwa=function(){var a=0<=g.Mc.search(/ (CrMo|Chrome|CriOS)\//);
return g.Iv||a},Nwa=function(a,b){L7().init(a,b)},Ewa=function(a,b,c,d){var e=!1;
L7()||(a=new D7(a,b,c,d),a.subscribe("yt-remote-cast2-availability-change",function(f){g.qs("yt-remote-cast-available",f);c6("yt-remote-cast2-availability-change",f)}),a.subscribe("yt-remote-cast2-receiver-selected",function(f){H7("onReceiverSelected: "+f.friendlyName);
g.qs("yt-remote-cast-receiver",f);c6("yt-remote-cast2-receiver-selected",f)}),a.subscribe("yt-remote-cast2-receiver-resumed",function(f){H7("onReceiverResumed: "+f.friendlyName);
g.qs("yt-remote-cast-receiver",f)}),a.subscribe("yt-remote-cast2-session-change",function(f){H7("onSessionChange: "+g6(f));
f||l6("yt-remote-cast-receiver");c6("yt-remote-cast2-session-change",f)}),g.Ia("yt.mdx.remote.cloudview.instance_",a,void 0),e=!0);
H7("cloudview.createSingleton_: "+e);return e},L7=function(){return g.w("yt.mdx.remote.cloudview.instance_")},Fwa=function(a,b){K7(!0);
I7(!1);Nwa(a,function(c){c?(Jwa(!0),g.To("yt-remote-cast2-api-ready")):(J7("Failed to initialize cast API."),K7(!1),l6("yt-remote-cast-available"),l6("yt-remote-cast-receiver"),Gwa());b(c)})},H7=function(a){i7("cloudview",a)},J7=function(a){i7("cloudview",a)},K7=function(a){H7("setCastInstalled_ "+a);
g.qs("yt-remote-cast-installed",a)},O7=function(){return!!g.w("yt.mdx.remote.cloudview.apiReady_")},Jwa=function(a){H7("setApiReady_ "+a);
g.Ia("yt.mdx.remote.cloudview.apiReady_",a,void 0)},I7=function(a){g.Ia("yt.mdx.remote.cloudview.initializing_",a,void 0)},R7=function(a){this.index=-1;
this.videoId=this.listId="";this.volume=this.playerState=-1;this.muted=!1;this.audioTrackId=null;this.C=this.F=0;this.o=null;this.hasNext=this.J=!1;this.H=this.G=this.u=this.A=0;this.w=NaN;this.B=!1;this.reset(a)},S7=function(a){a.audioTrackId=null;
a.o=null;a.playerState=-1;a.J=!1;a.hasNext=!1;a.F=0;a.C=(0,g.H)();a.A=0;a.u=0;a.G=0;a.H=0;a.w=NaN;a.B=!1},T7=function(a){return 1==a.playerState?((0,g.H)()-a.C)/1E3:0},U7=function(a,b){a.F=b;
a.C=(0,g.H)()},V7=function(a){switch(a.playerState){case 1:case 1081:return((0,g.H)()-a.C)/1E3+a.F;
case -1E3:return 0}return a.F},W7=function(a,b,c){var d=a.videoId;
a.videoId=b;a.index=c;b!=d&&S7(a)},X7=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.Sb(a.o);b.hasPrevious=a.J;b.hasNext=a.hasNext;b.playerTime=a.F;b.playerTimeAt=a.C;b.seekableStart=a.A;b.seekableEnd=a.u;b.duration=a.G;b.loadedTime=a.H;b.liveIngestionTime=a.w;return b},Z7=function(a,b){g.P.call(this);
this.o=0;this.A=a;this.C=[];this.B=new $va;this.w=this.u=null;this.H=(0,g.x)(this.wK,this);this.F=(0,g.x)(this.Dl,this);this.G=(0,g.x)(this.vK,this);this.J=(0,g.x)(this.HK,this);var c=0;a?(c=a.getProxyState(),3!=c&&(a.subscribe("proxyStateChange",this.Eu,this),Owa(this))):c=3;0!=c&&(b?this.Eu(c):g.Ko((0,g.x)(function(){this.Eu(c)},this),0));
var d=Mwa();d&&Y7(this,d);this.subscribe("yt-remote-cast2-session-change",this.J)},$7=function(a){return new R7(a.A.getPlayerContextData())},Owa=function(a){(0,g.y)("nowAutoplaying autoplayDismissed remotePlayerChange remoteQueueChange autoplayModeChange autoplayUpNext previousNextChange".split(" "),function(b){this.C.push(this.A.subscribe(b,g.Sa(this.sM,b),this))},a)},Pwa=function(a){(0,g.y)(a.C,function(b){this.A.unsubscribeByKey(b)},a);
a.C.length=0},a8=function(a,b){var c=a.B;
50>c.o.length+c.u.length&&a.B.u.push(b)},c8=function(a,b,c){var d=$7(a);
U7(d,c);-1E3!=d.playerState&&(d.playerState=b);b8(a,d)},d8=function(a,b,c){a.A.sendMessage(b,c)},b8=function(a,b){Pwa(a);
a.A.setPlayerContextData(X7(b));Owa(a)},Y7=function(a,b){a.w&&(a.w.removeUpdateListener(a.H),a.w.removeMediaListener(a.F),a.Dl(null));
a.w=b;a.w&&(i7("CP","Setting cast session: "+a.w.sessionId),a.w.addUpdateListener(a.H),a.w.addMediaListener(a.F),a.w.media.length&&a.Dl(a.w.media[0]))},Qwa=function(a){var b=a.u.media,c=a.u.customData;
if(b&&c){var d=$7(a);b.contentId!=d.videoId&&i7("CP","Cast changing video to: "+b.contentId);d.videoId=b.contentId;d.playerState=c.playerState;U7(d,a.u.getEstimatedTime());b8(a,d)}else i7("CP","No cast media video. Ignoring state update.")},e8=function(a,b,c){return(0,g.x)(function(d){this.Sb("Failed to "+b+" with cast v2 channel. Error code: "+d.code);
d.code!=chrome.cast.ErrorCode.TIMEOUT&&(this.Sb("Retrying "+b+" using MDx browser channel."),d8(this,b,c))},a)},f8=function(a,b,c){g.P.call(this);
this.B=NaN;this.P=!1;this.G=this.F=this.H=this.J=NaN;this.O=[];this.A=this.C=this.w=this.Ta=this.o=null;this.U=a;this.O.push(g.yp(window,"beforeunload",(0,g.x)(this.iF,this)));this.u=[];this.Ta=new R7;this.S=b.id;this.o=Rwa(this,c);this.o.subscribe("handlerOpened",this.AK,this);this.o.subscribe("handlerClosed",this.xK,this);this.o.subscribe("handlerError",this.yK,this);this.o.subscribe("handlerMessage",this.zK,this);dwa(this.o,b.token);this.subscribe("remoteQueueChange",function(){var d=this.Ta.videoId;
g.ts()&&g.qs("yt-remote-session-video-id",d)},this)},g8=function(a){i7("conn",a)},Rwa=function(a,b){return new c7(f7(a.U,"/bc"),b)},h8=function(a,b){a.R("proxyStateChange",b)},Swa=function(a){a.B=g.Ko((0,g.x)(function(){g8("Connecting timeout");
this.Qi(1)},a),2E4)},i8=function(a){g.Mo(a.B);
a.B=NaN},j8=function(a){g.Mo(a.J);
a.J=NaN},Twa=function(a){k8(a);
a.H=g.Ko((0,g.x)(function(){l8(this,"getNowPlaying")},a),2E4)},k8=function(a){g.Mo(a.H);
a.H=NaN},Vwa=function(a,b){b&&(i8(a),j8(a));
b==(d7(a.o)&&isNaN(a.B))?b&&(h8(a,1),l8(a,"getSubtitlesTrack")):b?(a.hx()&&a.Ta.reset(),h8(a,1),l8(a,"getNowPlaying"),Uwa(a)):a.Qi(1)},Wwa=function(a,b){var c=b.params.videoId;
delete b.params.videoId;c==a.Ta.videoId&&(g.Ob(b.params)?a.Ta.o=null:a.Ta.o=b.params,a.R("remotePlayerChange"))},Xwa=function(a,b){var c=b.params.videoId||b.params.video_id,d=parseInt(b.params.currentIndex,10);
a.Ta.listId=b.params.listId||a.Ta.listId;W7(a.Ta,c,d);a.R("remoteQueueChange")},Zwa=function(a,b){b.params=b.params||{};
Xwa(a,b);Ywa(a,b);a.R("autoplayDismissed")},Ywa=function(a,b){var c=parseInt(b.params.currentTime||b.params.current_time,10);
U7(a.Ta,isNaN(c)?0:c);c=parseInt(b.params.state,10);c=isNaN(c)?-1:c;-1==c&&-1E3==a.Ta.playerState&&(c=-1E3);a.Ta.playerState=c;c=Number(b.params.loadedTime);a.Ta.H=isNaN(c)?0:c;c=Number(b.params.duration);a.Ta.G=isNaN(c)?0:c;c=a.Ta;var d=Number(b.params.liveIngestionTime);c.w=d;c.B=isNaN(d)?!1:!0;c=a.Ta;d=Number(b.params.seekableStartTime);var e=Number(b.params.seekableEndTime);c.A=isNaN(d)?0:d;c.u=isNaN(e)?0:e;1==a.Ta.playerState?Twa(a):k8(a);a.R("remotePlayerChange")},$wa=function(a,b){if(-1E3!=
a.Ta.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.Ta.playerState=c;c=parseInt(b.params.currentTime,10);U7(a.Ta,isNaN(c)?0:c);a.R("remotePlayerChange")}},axa=function(a,b){var c="true"==b.params.muted;
a.Ta.volume=parseInt(b.params.volume,10);a.Ta.muted=c;a.R("remotePlayerChange")},bxa=function(a,b){a.C=b.params.videoId;
a.R("nowAutoplaying",parseInt(b.params.timeout,10))},cxa=function(a,b){var c="true"==b.params.hasNext;
a.Ta.J="true"==b.params.hasPrevious;a.Ta.hasNext=c;a.R("previousNextChange")},Uwa=function(a){g.Mo(a.G);
a.G=g.Ko((0,g.x)(a.Qi,a,1),864E5)},l8=function(a,b,c){c?g8("Sending: action="+b+", params="+g.Mk(c)):g8("Sending: action="+b);
a.o.sendMessage(b,c)},m8=function(a){m7.call(this,"ScreenServiceProxy");
this.qd=a;this.u=[];this.u.push(this.qd.$_s("screenChange",(0,g.x)(this.BP,this)));this.u.push(this.qd.$_s("onlineScreenChange",(0,g.x)(this.XL,this)))},hxa=function(a){var b={device:"Desktop",
app:"youtube-desktop"};b=g.L("MDX_CONFIG")||b;$ua();p6();n8||(n8=new e7(b?b.loungeApiHost:void 0),hva()&&(n8.o="/api/loungedev"));o8||(o8=g.w("yt.mdx.remote.deferredProxies_")||[],g.Ia("yt.mdx.remote.deferredProxies_",o8,void 0));dxa();var c=p8();if(!c){var d=new v7(n8);g.Ia("yt.mdx.remote.screenService_",d,void 0);c=p8();var e=!1,f=void 0,k=void 0,l=!1;b&&(e=!!b.loadCastApiSetupScript,f=b.appId,k=b.theme,l=!!b.disableDial);Iwa(a,d,function(m){m?q8()&&Q7(q8(),"YouTube TV"):d.subscribe("onlineScreenChange",
function(){c6("yt-remote-receiver-availability-change")})},e,f,k,l)}b&&!g.w("yt.mdx.remote.initialized_")&&(g.Ia("yt.mdx.remote.initialized_",!0,void 0),r8("Initializing: "+g.Mk(b)),s8.push(g.Ro("yt-remote-cast2-availability-change",function(){c6("yt-remote-receiver-availability-change")})),s8.push(g.Ro("yt-remote-cast2-receiver-selected",function(){t8(null);
c6("yt-remote-auto-connect","cast-selector-receiver")})),s8.push(g.Ro("yt-remote-cast2-receiver-resumed",function(){c6("yt-remote-receiver-resumed","cast-selector-receiver")})),s8.push(g.Ro("yt-remote-cast2-session-change",exa)),s8.push(g.Ro("yt-remote-connection-change",function(m){m?Q7(q8(),"YouTube TV"):u8()||(Q7(null,null),Lwa())})),a=v8(),b.isAuto&&(a.id+="#dial"),g.$o("desktop_enable_autoplay")&&(a.capabilities=["atp"]),a.name=b.device,a.app=b.app,(k=b.theme)&&(a.theme=k),r8(" -- with channel params: "+
g.Mk(a)),fxa(a),c.start(),q8()||gxa())},jxa=function(){var a=ixa();
N7()&&g.rs("yt-remote-cast-available")&&a.push({key:"cast-selector-receiver",name:"Cast..."});return a},ixa=function(){var a=p8().qd.$_gos();
var b=w8();b&&x8()&&(j6(a,b)||a.push(b));return Zua(a)},y8=function(){var a=kxa();
!a&&N7()&&Kwa()&&(a={key:"cast-selector-receiver",name:Kwa()});return a},kxa=function(){var a=ixa(),b=w8();
b||(b=u8());return g.$a(a,function(c){return b&&f6(b,c.key)?!0:!1})},w8=function(){var a=q8();
if(!a)return null;var b=p8().ae();return k6(b,a)},exa=function(a){r8("remote.onCastSessionChange_: "+g6(a));
if(a){var b=w8();b&&b.id==a.id?Q7(b.id,"YouTube TV"):(b&&z8(),A8(a,1))}else x8()&&z8()},z8=function(){O7()?L7().stopSession():J7("stopSession called before API ready.");
var a=x8();a&&(a.disconnect(1),B8(null))},C8=function(){var a=x8();
return!!a&&3!=a.getProxyState()},r8=function(a){i7("remote",a)},p8=function(){if(!D8){var a=g.w("yt.mdx.remote.screenService_");
D8=a?new m8(a):null}return D8},q8=function(){return g.w("yt.mdx.remote.currentScreenId_")},lxa=function(a){g.Ia("yt.mdx.remote.currentScreenId_",a,void 0)},mxa=function(){return g.w("yt.mdx.remote.connectData_")},t8=function(a){g.Ia("yt.mdx.remote.connectData_",a,void 0)},x8=function(){return g.w("yt.mdx.remote.connection_")},B8=function(a){var b=x8();
t8(null);a||lxa("");g.Ia("yt.mdx.remote.connection_",a,void 0);o8&&((0,g.y)(o8,function(c){c(a)}),o8.length=0);
b&&!a?c6("yt-remote-connection-change",!1):!b&&a&&c6("yt-remote-connection-change",!0)},u8=function(){var a=g.ts();
if(!a)return null;var b=p8().ae();return k6(b,a)},A8=function(a,b){q8();
w8()&&w8();if(E8)F8=a;else{lxa(a.id);var c=new f8(n8,a,v8());c.connect(b,mxa());c.subscribe("beforeDisconnect",function(d){c6("yt-remote-before-disconnect",d)});
c.subscribe("beforeDispose",function(){x8()&&(x8(),B8(null))});
B8(c)}},gxa=function(){var a=u8();
a?(r8("Resume connection to: "+g6(a)),A8(a,0)):(q6(),Lwa(),r8("Skipping connecting because no session screen found."))},dxa=function(){var a=v8();
if(g.Ob(a)){a=o6();var b=g.rs("yt-remote-session-name")||"",c=g.rs("yt-remote-session-app")||"";a={device:"REMOTE_CONTROL",id:a,name:b,app:c,mdxVersion:3};g.Ia("yt.mdx.remote.channelParams_",a,void 0)}},v8=function(){return g.w("yt.mdx.remote.channelParams_")||{}},fxa=function(a){a?(g.qs("yt-remote-session-app",a.app),g.qs("yt-remote-session-name",a.name)):(l6("yt-remote-session-app"),l6("yt-remote-session-name"));
g.Ia("yt.mdx.remote.channelParams_",a,void 0)},G8=function(a,b,c){g.A.call(this);
this.B=a;this.u=b;this.w=new g.O(this);g.C(this,this.w);this.w.L(b,"onCaptionsTrackListChanged",this.tL);this.w.L(b,"captionschanged",this.uK);this.w.L(b,"captionssettingschanged",this.bC);this.w.L(b,"videoplayerreset",this.Ro);this.w.L(b,"mdxautoplaycancel",this.aE);this.S=this.w.L(b,"onVolumeChange",this.uA);this.G=!1;this.o=c;c.subscribe("proxyStateChange",this.JA,this);c.subscribe("remotePlayerChange",this.Il,this);c.subscribe("remoteQueueChange",this.Ro,this);c.subscribe("autoplayUpNext",this.kA,
this);c.subscribe("previousNextChange",this.GA,this);c.subscribe("nowAutoplaying",this.CA,this);c.subscribe("autoplayDismissed",this.jA,this);this.suggestion=null;this.H=new g.qD(64);this.A=new g.I(this.ZB,500,this);g.C(this,this.A);this.C=new g.I(this.aC,1E3,this);g.C(this,this.C);this.P=new a7(this.dP,0,this);g.C(this,this.P);this.F={};this.O=new g.I(this.zC,1E3,this);g.C(this,this.O);this.J=new v6(this.bI,1E3,this);g.C(this,this.J);this.U=g.Ja;this.bC();this.Ro();this.Il()},H8=function(a,b){var c=
a.B,d=a.u.getVideoData().lengthSeconds;
c.O=b||0;c.player.R("progresssync",b,d)},nxa=function(a){H8(a,0);
a.A.stop();I8(a,new g.qD(64))},K8=function(a,b){if(J8(a)&&!a.G){var c=null;
b&&(c={style:a.u.getSubtitlesUserSettings()},g.Ub(c,b));a.o.OB(a.u.getVideoData(1).videoId,c);a.F=$7(a.o).o}},L8=function(a,b){var c=a.u.getPlaylist();
if(c){var d=c.o;var e=c.listId.toString()}c=a.u.getVideoData(1);a.o.playVideo(c.videoId,b,d,e,c.playerParams,c.mf,Mua(c));I8(a,new g.qD(1))},oxa=function(a,b){if(b){var c=a.u.getOption("captions","tracklist",{vT:1});
c&&c.length?(a.u.setOption("captions","track",b),a.G=!1):(a.u.loadModule("captions"),a.G=!0)}else a.u.setOption("captions","track",{})},J8=function(a){return $7(a.o).videoId==a.u.getVideoData(1).videoId},I8=function(a,b){a.C.stop();
var c=a.H;if(!g.wD(c,b)){var d=g.W(b,2);d!=g.W(a.H,2)&&g.vT(a.u.app,d);a.H=b;pxa(a.B,c,b)}},M8=function(){g.V.call(this,{D:"div",
I:"ytp-mdx-popup-dialog",M:{role:"dialog"},K:[{D:"div",I:"ytp-mdx-popup-dialog-inner-content",K:[{D:"div",I:"ytp-mdx-popup-title",W:"You're signed out"},{D:"div",I:"ytp-mdx-popup-description",W:"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",I:"ytp-mdx-privacy-popup-buttons",K:[{D:"button",X:["ytp-button","ytp-mdx-privacy-popup-cancel"],W:"Cancel"},{D:"button",X:["ytp-button","ytp-mdx-privacy-popup-confirm"],
W:"Confirm"}]}]}]});this.u=new g.BM(this,250);g.C(this,this.u);this.C=this.o["ytp-mdx-privacy-popup-cancel"];this.L(this.C,"click",this.w);this.A=this.o["ytp-mdx-privacy-popup-confirm"];this.L(this.A,"click",this.B)},N8=function(a){g.V.call(this,{D:"div",
I:"ytp-remote",K:[{D:"div",I:"ytp-remote-display-status",K:[{D:"div",I:"ytp-remote-display-status-icon",K:[g.DM()]},{D:"div",I:"ytp-remote-display-status-text",W:"{{statustext}}"}]}]});this.u=new g.BM(this,250);g.C(this,this.u);this.w=a;this.L(a,"presentingplayerstatechange",this.A);qxa(this,g.zL(a))},qxa=function(a,b){if(3==a.w.getPresentingPlayerType()){var c={RECEIVER_NAME:a.w.getOption("remote","currentReceiver").name};
c=g.W(b,128)?g.gN("Error on $RECEIVER_NAME",c):g.xD(b)||g.W(b,4)?g.gN("Playing on $RECEIVER_NAME",c):g.gN("Connected to $RECEIVER_NAME",c);a.ha("statustext",c);a.u.show()}else a.u.hide()},O8=function(a,b){g.$O.call(this,"Play on",0,a,b);
this.u=a;this.C={};this.L(a,"onMdxReceiversChange",this.J);this.L(a,"presentingplayerstatechange",this.J);this.J()},P8=function(a){g.gM.call(this,a);
this.u={key:i6(),name:"This computer"};this.B=null;this.A=[];this.S=this.o=null;this.J=[this.u];this.w=this.u;this.F=new g.qD(64);this.O=0;this.H=-1;this.C=null;if(!g.Kx(this.player.N())){a=this.player;var b=g.XC(a);b&&(b=b.sl())&&(b=new O8(a,b),g.C(this,b));b=new N8(a);g.C(this,b);g.RL(a,b.element,4);this.C=new M8;g.C(this,this.C);g.RL(a,this.C.element,4);this.P=!!u8()}this.G=null},Q8=function(a){a.G&&(a.player.removeEventListener("presentingplayerstatechange",a.G),a.G=null)},pxa=function(a,b,c){a.F=
c;
a.player.R("presentingplayerstatechange",new g.CD(c,b))},R8=function(a,b){if(b.key!=a.w.key)if(b.key==a.u.key)z8();
else{var c;(c=!g.Q(a.player.N().experiments,"mdx_enable_privacy_disclosure_ui"))||(c=((c=g.L("PLAYER_CONFIG"))&&c.args&&void 0!==c.args.authuser?!0:!(!g.L("SESSION_INDEX")&&!g.L("LOGGED_IN")))||a.P||!a.C);if(c?0:g.Tx(a.player.N())||g.Xx(a.player.N()))g.xD(g.zL(a.player))?a.player.pauseVideo():(a.G=(0,g.x)(a.SN,a),a.player.addEventListener("presentingplayerstatechange",a.G)),a.C&&a.C.u.show(),x8()||(E8=!0);a.w=b;var d=a.player.getPlaylistId();c=a.player.getVideoData(1);var e=c.videoId;if(!d&&!e||(2==
a.player.app.U||1==a.player.app.U)&&g.Q(a.player.N().experiments,"should_clear_video_data_on_player_cued_unstarted"))c=null;else{var f=a.player.getPlaylist();if(f){var k=[];for(var l=0;l<f.w;l++)k[l]=f.wa(l).videoId}else k=[e];f=a.player.getCurrentTime(1);d={videoIds:k,listId:d,videoId:e,playerParams:c.playerParams,clickTrackingParams:c.mf,index:Math.max(a.player.getPlaylistIndex(),0),currentTime:0==f?void 0:f};(c=Mua(c))&&(d.locationInfo=c);c=d}r8("Connecting to: "+g.Mk(b));"cast-selector-receiver"==
b.key?(t8(c||null),c=c||null,O7()?L7().setLaunchParams(c):J7("setLaunchParams called before ready.")):!c&&C8()&&q8()==b.key?c6("yt-remote-connection-change",!0):(z8(),t8(c||null),c=p8().ae(),(c=k6(c,b.key))&&A8(c,1))}},xva={"\x00":"\\0",
"\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r","\t":"\\t","\x0B":"\\x0B",'"':'\\"',"\\":"\\\\","<":"\\u003C"},F6={"'":"\\'"},rxa={},Vua={eQ:"atp",JS:"ska",yS:"que",RR:"mus",IS:"sus",dR:"dsp",FS:"seq"};
d6.prototype.Ig=function(){var a=new d6({id:this.id,name:this.name,app:this.app,type:this.type,user:this.username,userAvatarUri:this.avatar,obfuscatedGaiaId:this.obfuscatedGaiaId,theme:this.theme,capabilities:Array.from(this.capabilities.values()).join(","),experiments:Array.from(this.experiments.values()).join(",")});a.w=this.w;a.u=this.u;a.o=this.o};
var r6,n6="",mva=iva("loadCastFramework")||iva("loadCastApplicationFramework"),Hwa=["pkedcjkdefgpdelpbcmbmeomcjbeemfm","enhhojjnijigcajfphajepfemndkmdlo"];u6.prototype.o=null;u6.prototype.getOptions=function(){var a;(a=this.o)||(a={},qva(this)&&(a[0]=!0,a[1]=!0),a=this.o=a);return a};var S8;g.Ua(pva,u6);S8=new pva;/*

 Copyright The Closure Library Authors.
 SPDX-License-Identifier: Apache-2.0
*/
g.Ua(v6,g.A);g.h=v6.prototype;g.h.Xi=!1;g.h.Fk=0;g.h.Da=null;g.h.sx=function(a){this.o=arguments;this.Da||this.Fk?this.Xi=!0:w6(this)};
g.h.stop=function(){this.Da&&(g.v.clearTimeout(this.Da),this.Da=null,this.Xi=!1,this.o=[])};
g.h.pause=function(){this.Fk++};
g.h.resume=function(){this.Fk--;this.Fk||!this.Xi||this.Da||(this.Xi=!1,w6(this))};
g.h.Y=function(){v6.Fb.Y.call(this);this.stop()};
g.h.gF=function(){this.Da=null;this.Xi&&!this.Fk&&(this.Xi=!1,w6(this))};g.h=x6.prototype;g.h.Uh=null;g.h.We=!1;g.h.Vj=null;g.h.Bu=null;g.h.Hj=null;g.h.Yi=null;g.h.Dg=null;g.h.ph=null;g.h.ri=null;g.h.Ic=null;g.h.mm=0;g.h.af=null;g.h.Gp=null;g.h.Rg=null;g.h.Hk=-1;g.h.IB=!0;g.h.Gh=!1;g.h.lr=0;g.h.Wo=null;var vva={},A6={};g.h=x6.prototype;g.h.setTimeout=function(a){this.B=a};
g.h.eO=function(a){a=a.target;var b=this.Wo;b&&3==Q6(a)?b.sx():this.HC(a)};
g.h.HC=function(a){try{if(a==this.Ic)a:{var b=Q6(this.Ic),c=this.Ic.C,d=this.Ic.getStatus();if(g.ie&&!g.Nd(10)||g.ke&&!g.Md("420+")){if(4>b)break a}else if(3>b||3==b&&!g.yh&&!S6(this.Ic))break a;this.Gh||4!=b||7==c||(8==c||0>=d?this.o.Ve(3):this.o.Ve(2));H6(this);var e=this.Ic.getStatus();this.Hk=e;var f=S6(this.Ic);(this.We=200==e)?(4==b&&D6(this),this.C?(wva(this,b,f),g.yh&&this.We&&3==b&&(this.A.ia(this.u,"tick",this.YN),this.u.start())):C6(this,f),this.We&&!this.Gh&&(4==b?this.o.Oo(this):(this.We=
!1,z6(this)))):(400==e&&0<f.indexOf("Unknown SID")?(this.Rg=3,B6(13)):(this.Rg=0,B6(14)),D6(this),E6(this))}}catch(k){this.Ic&&S6(this.Ic)}finally{}};
g.h.YN=function(){var a=Q6(this.Ic),b=S6(this.Ic);this.mm<b.length&&(H6(this),wva(this,a,b),this.We&&4!=a&&z6(this))};
g.h.xN=function(a){G6((0,g.x)(this.wN,this,a),0)};
g.h.wN=function(a){this.Gh||(H6(this),C6(this,a),z6(this))};
g.h.QA=function(a){G6((0,g.x)(this.vN,this,a),0)};
g.h.vN=function(a){this.Gh||(D6(this),this.We=a,this.o.Oo(this),this.o.Ve(4))};
g.h.cancel=function(){this.Gh=!0;D6(this)};
g.h.FN=function(){this.Vj=null;var a=(0,g.H)();0<=a-this.Bu?(2!=this.Yi&&this.o.Ve(3),D6(this),this.Rg=2,B6(18),E6(this)):zva(this,this.Bu-a)};
g.h.getLastError=function(){return this.Rg};J6.prototype.stringify=function(a){return g.v.JSON.stringify(a,void 0)};
J6.prototype.parse=function(a){return g.v.JSON.parse(a,void 0)};g.h=Cva.prototype;g.h.jr=null;g.h.Pd=null;g.h.Xo=!1;g.h.vx=null;g.h.nn=null;g.h.Rr=null;g.h.kr=null;g.h.xe=null;g.h.Wf=-1;g.h.Gk=null;g.h.fk=null;g.h.connect=function(a){this.kr=a;a=K6(this.o,null,this.kr);B6(3);this.vx=(0,g.H)();var b=this.o.G;null!=b?(this.Gk=b[0],(this.fk=b[1])?(this.xe=1,Dva(this)):(this.xe=2,M6(this))):($5(a,"MODE","init"),this.Pd=new x6(this,void 0,void 0,void 0),this.Pd.Uh=this.jr,y6(this.Pd,a,!1,null,!0),this.xe=0)};
g.h.bE=function(a){if(a)this.xe=2,M6(this);else{B6(4);var b=this.o;b.kf=b.Hg.Wf;Z6(b,9)}a&&this.Ve(2)};
g.h.Bq=function(a){return this.o.Bq(a)};
g.h.abort=function(){this.Pd&&(this.Pd.cancel(),this.Pd=null);this.Wf=-1};
g.h.tx=function(){return!1};
g.h.KA=function(a,b){this.Wf=a.Hk;if(0==this.xe)if(b){try{var c=this.u.parse(b)}catch(d){c=this.o;c.kf=this.Wf;Z6(c,2);return}this.Gk=c[0];this.fk=c[1]}else c=this.o,c.kf=this.Wf,Z6(c,2);else if(2==this.xe)if(this.Xo)B6(7),this.Rr=(0,g.H)();else if("11111"==b){if(B6(6),this.Xo=!0,this.nn=(0,g.H)(),c=this.nn-this.vx,!g.ie||g.Nd(10)||500>c)this.Wf=200,this.Pd.cancel(),B6(12),L6(this.o,this,!0)}else B6(8),this.nn=this.Rr=(0,g.H)(),this.Xo=!1};
g.h.Oo=function(){this.Wf=this.Pd.Hk;if(this.Pd.We)0==this.xe?this.fk?(this.xe=1,Dva(this)):(this.xe=2,M6(this)):2==this.xe&&((!g.ie||g.Nd(10)?!this.Xo:200>this.Rr-this.nn)?(B6(11),L6(this.o,this,!1)):(B6(12),L6(this.o,this,!0)));else{0==this.xe?B6(9):2==this.xe&&B6(10);var a=this.o;this.Pd.getLastError();a.kf=this.Wf;Z6(a,2)}};
g.h.Yl=function(){return this.o.Yl()};
g.h.isActive=function(){return this.o.isActive()};
g.h.Ve=function(a){this.o.Ve(a)};g.Ua(O6,g.gf);var Iva=/^https?$/i,sxa=["POST","PUT"];g.h=O6.prototype;
g.h.send=function(a,b,c,d){if(this.o)throw Error("[goog.net.XhrIo] Object is active with another request="+this.H+"; newUri="+a);b=b?b.toUpperCase():"GET";this.H=a;this.A="";this.C=0;this.da=b;this.U=!1;this.w=!0;this.o=this.S?rva(this.S):rva(S8);this.O=this.S?this.S.getOptions():S8.getOptions();this.o.onreadystatechange=(0,g.x)(this.wx,this);try{b6(R6(this,"Opening Xhr")),this.Z=!0,this.o.open(b,String(a),!0),this.Z=!1}catch(f){b6(R6(this,"Error opening Xhr: "+f.message));Hva(this,f);return}a=c||
"";var e=this.headers.clone();d&&Rua(d,function(f,k){e.set(k,f)});
d=g.$a(e.se(),Fva);c=g.v.FormData&&a instanceof g.v.FormData;!g.cb(sxa,b)||d||c||e.set("Content-Type","application/x-www-form-urlencoded;charset=utf-8");e.forEach(function(f,k){this.o.setRequestHeader(k,f)},this);
this.ea&&(this.o.responseType=this.ea);"withCredentials"in this.o&&this.o.withCredentials!==this.V&&(this.o.withCredentials=this.V);try{Kva(this),0<this.F&&(this.P=Eva(this.o),b6(R6(this,"Will abort after "+this.F+"ms if incomplete, xhr2 "+this.P)),this.P?(this.o.timeout=this.F,this.o.ontimeout=(0,g.x)(this.xx,this)):this.J=g.Wf(this.xx,this.F,this)),b6(R6(this,"Sending request")),this.G=!0,this.o.send(a),this.G=!1}catch(f){b6(R6(this,"Send error: "+f.message)),Hva(this,f)}};
g.h.xx=function(){"undefined"!=typeof g.W1&&this.o&&(this.A="Timed out after "+this.F+"ms, aborting",this.C=8,R6(this,this.A),this.dispatchEvent("timeout"),this.abort(8))};
g.h.abort=function(a){this.o&&this.w&&(R6(this,"Aborting"),this.w=!1,this.B=!0,this.o.abort(),this.B=!1,this.C=a||7,this.dispatchEvent("complete"),this.dispatchEvent("abort"),P6(this))};
g.h.Y=function(){this.o&&(this.w&&(this.w=!1,this.B=!0,this.o.abort(),this.B=!1),P6(this,!0));O6.Fb.Y.call(this)};
g.h.wx=function(){this.la()||(this.Z||this.G||this.B?Jva(this):this.uM())};
g.h.uM=function(){Jva(this)};
g.h.isActive=function(){return!!this.o};
g.h.getStatus=function(){try{return 2<Q6(this)?this.o.status:-1}catch(a){return-1}};
g.h.getLastError=function(){return"string"===typeof this.A?this.A:String(this.A)};g.h=T6.prototype;g.h.tk=null;g.h.Kd=null;g.h.fc=null;g.h.ir=null;g.h.qn=null;g.h.Ov=null;g.h.Gn=null;g.h.Bl=0;g.h.PJ=0;g.h.nd=null;g.h.Mg=null;g.h.Kf=null;g.h.Lh=null;g.h.Hg=null;g.h.Ep=null;g.h.kj=-1;g.h.gy=-1;g.h.kf=-1;g.h.Si=0;g.h.Li=0;g.h.Hh=8;var $6=new g.gf;g.Ua(Mva,g.Je);g.Ua(Nva,g.Je);g.Ua(Ova,g.Je);g.h=T6.prototype;g.h.connect=function(a,b,c,d,e){B6(0);this.ir=b;this.tk=c||{};d&&void 0!==e&&(this.tk.OSID=d,this.tk.OAID=e);this.C?(G6((0,g.x)(this.jw,this,a),100),Sva(this)):this.jw(a)};
g.h.jw=function(a){this.Hg=new Cva(this);this.Hg.jr=null;this.Hg.u=this.B;this.Hg.connect(a)};
g.h.tx=function(){return 0==this.o};
g.h.PA=function(a){this.Mg=null;Vva(this,a)};
g.h.OA=function(){this.Kf=null;this.fc=new x6(this,this.w,"rpc",this.F);this.fc.Uh=null;this.fc.lr=0;var a=this.Ov.clone();Y5(a,"RID","rpc");Y5(a,"SID",this.w);Y5(a,"CI",this.Ep?"0":"1");Y5(a,"AID",this.kj);U6(this,a);if(!g.ie||g.Nd(10))Y5(a,"TYPE","xmlhttp"),y6(this.fc,a,!0,this.Gn,!1);else{Y5(a,"TYPE","html");var b=this.fc,c=!!this.Gn;b.Yi=3;b.Dg=Z5(a.clone());yva(b,c)}};
g.h.KA=function(a,b){if(0!=this.o&&(this.fc==a||this.Kd==a))if(this.kf=a.Hk,this.Kd==a&&3==this.o)if(7<this.Hh){try{var c=this.B.parse(b)}catch(f){c=null}if(Array.isArray(c)&&3==c.length)if(0==c[0])a:{if(!this.Kf){if(this.fc)if(this.fc.Hj+3E3<this.Kd.Hj)W6(this),this.fc.cancel(),this.fc=null;else break a;Y6(this);B6(19)}}else this.gy=c[1],0<this.gy-this.kj&&37500>c[2]&&this.Ep&&0==this.Li&&!this.Lh&&(this.Lh=G6((0,g.x)(this.qK,this),6E3));else Z6(this,11)}else b!=rxa.BQ.o&&Z6(this,11);else if(this.fc==
a&&W6(this),!g.hc(b)){c=this.B.parse(b);for(var d=0;d<c.length;d++){var e=c[d];this.kj=e[0];e=e[1];2==this.o?"c"==e[0]?(this.w=e[1],this.Gn=e[2],e=e[3],null!=e?this.Hh=e:this.Hh=6,this.o=3,this.nd&&this.nd.dw(),this.Ov=K6(this,this.Yl()?this.Gn:null,this.ir),Wva(this)):"stop"==e[0]&&Z6(this,7):3==this.o&&("stop"==e[0]?Z6(this,7):"noop"!=e[0]&&this.nd&&this.nd.cw(e),this.Li=0)}}};
g.h.qK=function(){null!=this.Lh&&(this.Lh=null,this.fc.cancel(),this.fc=null,Y6(this),B6(20))};
g.h.Oo=function(a){if(this.fc==a){W6(this);this.fc=null;var b=2}else if(this.Kd==a)this.Kd=null,b=1;else return;this.kf=a.Hk;if(0!=this.o)if(a.We)1==b?(b=(0,g.H)()-a.Hj,$6.dispatchEvent(new Nva($6,a.ri?a.ri.length:0,b,this.Si)),V6(this),this.A.length=0):Wva(this);else{var c=a.getLastError(),d;if(!(d=3==c||7==c||0==c&&0<this.kf)){if(d=1==b)this.Kd||this.Mg||1==this.o||2<=this.Si?d=!1:(this.Mg=G6((0,g.x)(this.PA,this,a),Xva(this,this.Si)),this.Si++,d=!0);d=!(d||2==b&&Y6(this))}if(d)switch(c){case 1:Z6(this,
5);break;case 4:Z6(this,10);break;case 3:Z6(this,6);break;case 7:Z6(this,12);break;default:Z6(this,2)}}};
g.h.yE=function(a){if(!g.cb(arguments,this.o))throw Error("Unexpected channel state: "+this.o);};
g.h.SO=function(a){a?B6(2):(B6(1),Yva(this,8))};
g.h.Bq=function(a){if(a)throw Error("Can't create secondary domain capable XhrIo object.");a=new O6;a.V=!1;return a};
g.h.isActive=function(){return!!this.nd&&this.nd.isActive(this)};
g.h.Ve=function(a){$6.dispatchEvent(new Ova($6,a))};
g.h.Yl=function(){return!(!g.ie||g.Nd(10))};
g.h=Zva.prototype;g.h.dw=function(){};
g.h.cw=function(){};
g.h.bw=function(){};
g.h.rq=function(){};
g.h.Pw=function(){return{}};
g.h.isActive=function(){return!0};g.Ua(a7,g.A);g.h=a7.prototype;g.h.eF=function(a){this.A=arguments;this.o=!1;this.Da?this.w=(0,g.H)()+this.rd:this.Da=g.Wf(this.B,this.rd)};
g.h.stop=function(){this.Da&&(g.v.clearTimeout(this.Da),this.Da=null);this.w=null;this.o=!1;this.A=[]};
g.h.pause=function(){++this.u};
g.h.resume=function(){this.u&&(--this.u,!this.u&&this.o&&(this.o=!1,this.C.apply(null,this.A)))};
g.h.Y=function(){this.stop();a7.Fb.Y.call(this)};
g.h.fF=function(){this.w?(this.Da=g.Wf(this.B,this.w-(0,g.H)()),this.w=null):(this.Da=null,this.u?this.o=!0:(this.o=!1,this.C.apply(null,this.A)))};g.h=$va.prototype;g.h.isEmpty=function(){return g.db(this.o)&&g.db(this.u)};
g.h.clear=function(){this.o=[];this.u=[]};
g.h.contains=function(a){return g.cb(this.o,a)||g.cb(this.u,a)};
g.h.remove=function(a){var b=this.o;var c=(0,g.Npa)(b,a);0<=c?(g.fb(b,c),b=!0):b=!1;return b||g.gb(this.u,a)};
g.h.Bd=function(){for(var a=[],b=this.o.length-1;0<=b;--b)a.push(this.o[b]);var c=this.u.length;for(b=0;b<c;++b)a.push(this.u[b]);return a};g.Ua(b7,g.A);g.h=b7.prototype;g.h.oN=function(){this.rd=Math.min(3E5,2*this.rd);this.w();this.u&&this.start()};
g.h.start=function(){var a=this.rd+15E3*Math.random();g.Bn(this.o,a);this.u=(0,g.H)()+a};
g.h.stop=function(){this.o.stop();this.u=0};
g.h.isActive=function(){return this.o.isActive()};
g.h.reset=function(){this.o.stop();this.rd=5E3};g.Ua(c7,Zva);g.h=c7.prototype;g.h.subscribe=function(a,b,c){return this.w.subscribe(a,b,c)};
g.h.unsubscribe=function(a,b,c){return this.w.unsubscribe(a,b,c)};
g.h.pg=function(a){return this.w.Vh(a)};
g.h.R=function(a,b){return this.w.R.apply(this.w,arguments)};
g.h.dispose=function(){this.ub||(this.ub=!0,g.He(this.w),cwa(this),g.He(this.u),this.u=null)};
g.h.la=function(){return this.ub};
g.h.connect=function(a,b,c){if(!this.o||2!=this.o.o){this.H="";this.u.stop();this.B=a||null;this.A=b||0;a=this.J+"/test";b=this.J+"/bind";var d=new T6(c?c.firstTestResults:null,c?c.secondTestResults:null,this.P),e=this.o;e&&(e.nd=null);d.nd=this;this.o=d;e?this.o.connect(a,b,this.C,e.w,e.kj):c?this.o.connect(a,b,this.C,c.sessionId,c.arrayId):this.o.connect(a,b,this.C)}};
g.h.sendMessage=function(a,b){var c={_sc:a};b&&g.Ub(c,b);this.u.isActive()||2==(this.o?this.o.o:0)?this.F.push(c):d7(this)&&Tva(this.o,c)};
g.h.dw=function(){this.u.reset();this.B=null;this.A=0;if(this.F.length){var a=this.F;this.F=[];for(var b=0,c=a.length;b<c;++b)Tva(this.o,a[b])}this.R("handlerOpened")};
g.h.bw=function(a){var b=2==a&&401==this.o.kf;4==a||b||this.u.start();this.R("handlerError",a)};
g.h.rq=function(a){if(!this.u.isActive())this.R("handlerClosed");else if(a)for(var b=0,c=a.length;b<c;++b){var d=a[b].map;d&&this.F.push(d)}};
g.h.Pw=function(){var a={v:2};this.H&&(a.gsessionid=this.H);0!=this.A&&(a.ui=""+this.A);0!=this.G&&(a.ui=""+this.G);this.B&&g.Ub(a,this.B);return a};
g.h.cw=function(a){"S"==a[0]?this.H=a[1]:"gracefulReconnect"==a[0]?(this.u.start(),Rva(this.o)):this.R("handlerMessage",new awa(a[0],a[1]))};
g.h.tO=function(){this.u.isActive();var a=this.o,b=0;a.fc&&b++;a.Kd&&b++;0==b&&this.connect(this.B,this.A)};e7.prototype.A=function(a,b,c,d){b?a(d):a({text:c.responseText})};
e7.prototype.w=function(a,b){a(Error("Request error: "+b.status))};
e7.prototype.B=function(a){a(Error("request timed out"))};var kwa=(0,g.H)(),h7=null,k7=Array(50),j7=-1,l7=!1;g.Ua(m7,g.P);m7.prototype.ae=function(){return this.o};
m7.prototype.contains=function(a){return!!j6(this.o,a)};
m7.prototype.get=function(a){return a?k6(this.o,a):null};
m7.prototype.info=function(a){i7(this.F,a)};g.r(n7,g.P);g.h=n7.prototype;g.h.start=function(){!this.o&&isNaN(this.Da)&&this.LC()};
g.h.stop=function(){this.o&&(this.o.abort(),this.o=null);isNaN(this.Da)||(g.Mo(this.Da),this.Da=NaN)};
g.h.Y=function(){this.stop();g.P.prototype.Y.call(this)};
g.h.LC=function(){this.Da=NaN;this.o=g.xq(f7(this.C,"/pairing/get_screen"),{method:"POST",yb:{pairing_code:this.A},timeout:5E3,onSuccess:(0,g.x)(this.zP,this),onError:(0,g.x)(this.yP,this),Md:(0,g.x)(this.AP,this)})};
g.h.zP=function(a,b){this.o=null;var c=b.screen||{};c.dialId=this.B;c.name=this.w;this.R("pairingComplete",new e6(c))};
g.h.yP=function(a){this.o=null;a.status&&404==a.status?this.u>=txa.length?this.R("pairingFailed",Error("DIAL polling timed out")):(a=txa[this.u],this.Da=g.Ko((0,g.x)(this.LC,this),a),this.u++):this.R("pairingFailed",Error("Server error "+a.status))};
g.h.AP=function(){this.o=null;this.R("pairingFailed",Error("Server not responding"))};
var txa=[2E3,2E3,1E3,1E3,1E3,2E3,2E3,5E3,5E3,1E4];g.Ua(p7,m7);g.h=p7.prototype;g.h.start=function(){o7(this)&&this.R("screenChange");!g.rs("yt-remote-lounge-token-expiration")&&owa(this);g.Mo(this.u);this.u=g.Ko((0,g.x)(this.start,this),1E4)};
g.h.add=function(a,b){o7(this);lwa(this,a);q7(this,!1);this.R("screenChange");b(a);a.token||owa(this)};
g.h.remove=function(a,b){var c=o7(this);nwa(this,a)&&(q7(this,!1),c=!0);b(a);c&&this.R("screenChange")};
g.h.Cp=function(a,b,c,d){var e=o7(this),f=this.get(a.id);f?(f.name!=b&&(f.name=b,q7(this,!1),e=!0),c(a)):d(Error("no such local screen."));e&&this.R("screenChange")};
g.h.Y=function(){g.Mo(this.u);p7.Fb.Y.call(this)};
g.h.qF=function(a){o7(this);var b=this.o.length;a=a&&a.screens||[];for(var c=0,d=a.length;c<d;++c){var e=a[c],f=this.get(e.screenId);f&&(f.token=e.loungeToken,--b)}q7(this,!b);b&&i7(this.F,"Missed "+b+" lounge tokens.")};
g.h.pF=function(a){i7(this.F,"Requesting lounge tokens failed: "+a)};g.r(s7,g.P);g.h=s7.prototype;g.h.start=function(){var a=parseInt(g.rs("yt-remote-fast-check-period")||"0",10);(this.A=(0,g.H)()-144E5<a?0:a)?u7(this):(this.A=(0,g.H)()+3E5,g.qs("yt-remote-fast-check-period",this.A),this.Ot())};
g.h.isEmpty=function(){return g.Ob(this.o)};
g.h.update=function(){r7("Updating availability on schedule.");var a=this.C(),b=g.Cb(this.o,function(c,d){return c&&!!k6(a,d)},this);
t7(this,b)};
g.h.Y=function(){g.Mo(this.w);this.w=NaN;this.u&&(this.u.abort(),this.u=null);g.P.prototype.Y.call(this)};
g.h.Ot=function(){g.Mo(this.w);this.w=NaN;this.u&&this.u.abort();var a=rwa(this);if(a6(a)){var b=f7(this.B,"/pairing/get_screen_availability");this.u=g7(this.B,b,{lounge_token:g.Ib(a).join(",")},(0,g.x)(this.SM,this,a),(0,g.x)(this.RM,this))}else t7(this,{}),u7(this)};
g.h.SM=function(a,b){this.u=null;var c=g.Ib(rwa(this));if(g.ub(c,g.Ib(a))){c=b.screens||[];for(var d={},e=0,f=c.length;e<f;++e)d[a[c[e].loungeToken]]="online"==c[e].status;t7(this,d);u7(this)}else this.Sb("Changing Screen set during request."),this.Ot()};
g.h.RM=function(a){this.Sb("Screen availability failed: "+a);this.u=null;u7(this)};
g.h.Sb=function(a){i7("OnlineScreenService",a)};g.Ua(v7,m7);g.h=v7.prototype;g.h.start=function(){this.w.start();this.u.start();this.o.length&&(this.R("screenChange"),this.u.isEmpty()||this.R("onlineScreenChange"))};
g.h.add=function(a,b,c){this.w.add(a,b,c)};
g.h.remove=function(a,b,c){this.w.remove(a,b,c);this.u.update()};
g.h.Cp=function(a,b,c,d){this.w.contains(a)?this.w.Cp(a,b,c,d):(a="Updating name of unknown screen: "+a.name,i7(this.F,a),d(Error(a)))};
g.h.ae=function(a){return a?this.o:g.jb(this.o,(0,g.ve)(this.A,function(b){return!this.contains(b)},this))};
g.h.MC=function(){return(0,g.ve)(this.ae(!0),function(a){return!!this.u.o[a.id]},this)};
g.h.NC=function(a,b,c,d,e){this.info("getDialScreenByPairingCode "+a+" / "+b);var f=new n7(this.C,a,b,c);f.subscribe("pairingComplete",(0,g.x)(function(k){g.He(f);d(w7(this,k))},this));
f.subscribe("pairingFailed",function(k){g.He(f);e(k)});
f.start();return(0,g.x)(f.stop,f)};
g.h.CP=function(a,b,c,d){g.xq(f7(this.C,"/pairing/get_screen"),{method:"POST",yb:{pairing_code:a},timeout:5E3,onSuccess:(0,g.x)(function(e,f){var k=new e6(f.screen||{});if(!k.name||vwa(this,k.name)){a:{var l=k.name;for(var m=2,n=b(l,m);vwa(this,n);){m++;if(20<m)break a;n=b(l,m)}l=n}k.name=l}c(w7(this,k))},this),
onError:(0,g.x)(function(e){d(Error("pairing request failed: "+e.status))},this),
Md:(0,g.x)(function(){d(Error("pairing request timed out."))},this)})};
g.h.Y=function(){g.He(this.w);g.He(this.u);v7.Fb.Y.call(this)};
g.h.yF=function(){wwa(this);this.R("screenChange");this.u.update()};
v7.prototype.dispose=v7.prototype.dispose;g.Ua(y7,g.P);g.h=y7.prototype;g.h.Qo=function(a){this.w=a;this.R("sessionScreen",this.w)};
g.h.ge=function(a){this.la()||(a&&z7(this,""+a),this.w=null,this.R("sessionScreen",null))};
g.h.info=function(a){i7(this.O,a)};
g.h.PC=function(){return null};
g.h.Xt=function(a){var b=this.u;a?(b.displayStatus=new chrome.cast.ReceiverDisplayStatus(a,[]),b.displayStatus.showStop=!0):b.displayStatus=null;chrome.cast.setReceiverDisplayStatus(b,(0,g.x)(function(){this.info("Updated receiver status for "+b.friendlyName+": "+a)},this),(0,g.x)(function(){z7(this,"Failed to update receiver status for: "+b.friendlyName)},this))};
g.h.Y=function(){this.Xt("");y7.Fb.Y.call(this)};g.Ua(A7,y7);g.h=A7.prototype;g.h.Wt=function(a){if(this.o){if(this.o==a)return;z7(this,"Overriding cast sesison with new session object");this.o.removeUpdateListener(this.C);this.o.removeMessageListener("urn:x-cast:com.google.youtube.mdx",this.B)}this.o=a;this.o.addUpdateListener(this.C);this.o.addMessageListener("urn:x-cast:com.google.youtube.mdx",this.B);ywa(this)};
g.h.lj=function(a){this.info("launchWithParams no-op for Cast: "+g.Mk(a))};
g.h.stop=function(){this.o?this.o.stop((0,g.x)(function(){this.ge()},this),(0,g.x)(function(){this.ge(Error("Failed to stop receiver app."))},this)):this.ge(Error("Stopping cast device witout session."))};
g.h.Xt=g.Ja;g.h.Y=function(){this.info("disposeInternal");g.Mo(this.A);this.A=0;this.o&&(this.o.removeUpdateListener(this.C),this.o.removeMessageListener("urn:x-cast:com.google.youtube.mdx",this.B));this.o=null;A7.Fb.Y.call(this)};
g.h.NN=function(a,b){if(!this.la())if(b){var c=N6(b);if(g.Pa(c)){var d=""+c.type;c=c.data||{};this.info("onYoutubeMessage_: "+d+" "+g.Mk(c));switch(d){case "mdxSessionStatus":xwa(this,c.screenId);break;default:z7(this,"Unknown youtube message: "+d)}}else z7(this,"Unable to parse message.")}else z7(this,"No data in message.")};
g.h.jx=function(a,b,c,d){uwa(this.H,this.u.label,a,this.u.friendlyName,(0,g.x)(function(e){e?b(e):0<=d?(z7(this,"Screen "+a+" appears to be offline. "+d+" retries left."),g.Ko((0,g.x)(this.jx,this,a,b,c,d-1),300)):c(Error("Unable to fetch screen."))},this),c)};
g.h.PC=function(){return this.o};
g.h.DP=function(a){this.la()||a||(z7(this,"Cast session died."),this.ge())};g.Ua(B7,y7);g.h=B7.prototype;g.h.Wt=function(a){this.A=a;this.A.addUpdateListener(this.P)};
g.h.lj=function(a){this.B=a;this.F()};
g.h.stop=function(){this.o();this.o=g.Ja;g.Mo(this.C);this.A?this.A.stop((0,g.x)(this.ge,this,null),(0,g.x)(this.ge,this,"Failed to stop DIAL device.")):this.ge()};
g.h.Y=function(){this.o();this.o=g.Ja;g.Mo(this.C);this.A&&this.A.removeUpdateListener(this.P);this.A=null;B7.Fb.Y.call(this)};
g.h.GP=function(a){this.la()||a||(z7(this,"DIAL session died."),this.o(),this.o=g.Ja,this.ge())};
g.h.xr=function(a){this.J=i6();if(this.B){var b=new chrome.cast.DialLaunchResponse(!0,Awa(this));a(b);zwa(this)}else this.F=(0,g.x)(function(){g.Mo(this.C);this.F=g.Ja;this.C=NaN;var c=new chrome.cast.DialLaunchResponse(!0,Awa(this));a(c);zwa(this)},this),this.C=g.Ko((0,g.x)(function(){this.F()},this),100)};
g.h.SF=function(a,b,c){uwa(this.H,this.G.receiver.label,a,this.u.friendlyName,(0,g.x)(function(d){d&&d.token?(this.Qo(d),b(new chrome.cast.DialLaunchResponse(!1))):this.xr(b,c)},this),(0,g.x)(function(d){z7(this,"Failed to get DIAL screen: "+d);
this.xr(b,c)},this))};g.Ua(C7,y7);C7.prototype.stop=function(){this.ge()};
C7.prototype.Wt=g.Ja;C7.prototype.lj=function(){g.Mo(this.o);this.o=NaN;var a=k6(this.H.ae(),this.u.label);a?this.Qo(a):this.ge(Error("No such screen"))};
C7.prototype.Y=function(){g.Mo(this.o);this.o=NaN;C7.Fb.Y.call(this)};g.Ua(D7,g.P);g.h=D7.prototype;
g.h.init=function(a,b){chrome.cast.timeout.requestSession=3E4;var c=new chrome.cast.SessionRequest(this.F);this.G||(c.dialRequest=new chrome.cast.DialRequest("YouTube"));var d=chrome.cast.AutoJoinPolicy.TAB_AND_ORIGIN_SCOPED,e=a?chrome.cast.DefaultActionPolicy.CAST_THIS_TAB:chrome.cast.DefaultActionPolicy.CREATE_SESSION,f=(0,g.x)(this.zM,this);c=new chrome.cast.ApiConfig(c,(0,g.x)(this.MA,this),f,d,e);c.customDialLaunchCallback=(0,g.x)(this.PK,this);chrome.cast.initialize(c,(0,g.x)(function(){this.la()||
(chrome.cast.addReceiverActionListener(this.A),hwa(),this.u.subscribe("onlineScreenChange",(0,g.x)(this.OC,this)),this.w=Cwa(this),chrome.cast.setCustomReceivers(this.w,g.Ja,(0,g.x)(function(k){this.Sb("Failed to set initial custom receivers: "+g.Mk(k))},this)),this.R("yt-remote-cast2-availability-change",F7(this)),b(!0))},this),(0,g.x)(function(k){this.Sb("Failed to initialize API: "+g.Mk(k));
b(!1)},this))};
g.h.BO=function(a,b){E7("Setting connected screen ID: "+a+" -> "+b);if(this.o){var c=this.o.w;if(!a||c&&c.id!=a)E7("Unsetting old screen status: "+this.o.u.friendlyName),G7(this,null)}if(a&&b){if(!this.o){c=k6(this.u.ae(),a);if(!c){E7("setConnectedScreenStatus: Unknown screen.");return}var d=Bwa(this,c);d||(E7("setConnectedScreenStatus: Connected receiver not custom..."),d=new chrome.cast.Receiver(c.uuid?c.uuid:c.id,c.name),d.receiverType=chrome.cast.ReceiverType.CUSTOM,this.w.push(d),chrome.cast.setCustomReceivers(this.w,
g.Ja,(0,g.x)(function(e){this.Sb("Failed to set initial custom receivers: "+g.Mk(e))},this)));
E7("setConnectedScreenStatus: new active receiver: "+d.friendlyName);G7(this,new C7(this.u,d),!0)}this.o.Xt(b)}else E7("setConnectedScreenStatus: no screen.")};
g.h.DO=function(a){this.la()?this.Sb("Setting connection data on disposed cast v2"):this.o?this.o.lj(a):this.Sb("Setting connection data without a session")};
g.h.FP=function(){this.la()?this.Sb("Stopping session on disposed cast v2"):this.o?(this.o.stop(),G7(this,null)):E7("Stopping non-existing session")};
g.h.requestSession=function(){chrome.cast.requestSession((0,g.x)(this.MA,this),(0,g.x)(this.WM,this))};
g.h.Y=function(){this.u.unsubscribe("onlineScreenChange",(0,g.x)(this.OC,this));window.chrome&&chrome.cast&&chrome.cast.removeReceiverActionListener(this.A);var a=ewa,b=g.w("yt.mdx.remote.debug.handlers_");g.gb(b||[],a);g.He(this.o);D7.Fb.Y.call(this)};
g.h.Sb=function(a){i7("Controller",a)};
g.h.NA=function(a,b){this.o==a&&(b||G7(this,null),this.R("yt-remote-cast2-session-change",b))};
g.h.vM=function(a,b){if(!this.la())if(a)switch(a.friendlyName=chrome.cast.unescape(a.friendlyName),E7("onReceiverAction_ "+a.label+" / "+a.friendlyName+"-- "+b),b){case chrome.cast.ReceiverAction.CAST:if(this.o)if(this.o.u.label!=a.label)E7("onReceiverAction_: Stopping active receiver: "+this.o.u.friendlyName),this.o.stop();else{E7("onReceiverAction_: Casting to active receiver.");this.o.w&&this.R("yt-remote-cast2-session-change",this.o.w);break}switch(a.receiverType){case chrome.cast.ReceiverType.CUSTOM:G7(this,
new C7(this.u,a));break;case chrome.cast.ReceiverType.DIAL:G7(this,new B7(this.u,a,this.C));break;case chrome.cast.ReceiverType.CAST:G7(this,new A7(this.u,a));break;default:this.Sb("Unknown receiver type: "+a.receiverType)}break;case chrome.cast.ReceiverAction.STOP:this.o&&this.o.u.label==a.label?this.o.stop():this.Sb("Stopping receiver w/o session: "+a.friendlyName)}else this.Sb("onReceiverAction_ called without receiver.")};
g.h.PK=function(a){if(this.la())return Promise.reject(Error("disposed"));var b=a.receiver;b.receiverType!=chrome.cast.ReceiverType.DIAL&&(this.Sb("Not DIAL receiver: "+b.friendlyName),b.receiverType=chrome.cast.ReceiverType.DIAL);var c=this.o?this.o.u:null;if(!c||c.label!=b.label)return this.Sb("Receiving DIAL launch request for non-clicked DIAL receiver: "+b.friendlyName),Promise.reject(Error("illegal DIAL launch"));if(c&&c.label==b.label&&c.receiverType!=chrome.cast.ReceiverType.DIAL){if(this.o.w)return E7("Reselecting dial screen."),
this.R("yt-remote-cast2-session-change",this.o.w),Promise.resolve(new chrome.cast.DialLaunchResponse(!1));this.Sb('Changing CAST intent from "'+c.receiverType+'" to "dial" for '+b.friendlyName);G7(this,new B7(this.u,b,this.C))}b=this.o;b.G=a;return b.G.appState==chrome.cast.DialAppState.RUNNING?new Promise((0,g.x)(b.SF,b,(b.G.extraData||{}).screenId||null)):new Promise((0,g.x)(b.xr,b))};
g.h.MA=function(a){if(!this.la()){E7("New cast session ID: "+a.sessionId);var b=a.receiver;if(b.receiverType!=chrome.cast.ReceiverType.CUSTOM){if(!this.o)if(b.receiverType==chrome.cast.ReceiverType.CAST)E7("Got resumed cast session before resumed mdx connection."),b.friendlyName=chrome.cast.unescape(b.friendlyName),G7(this,new A7(this.u,b),!0);else{this.Sb("Got non-cast session without previous mdx receiver event, or mdx resume.");return}var c=this.o.u,d=k6(this.u.ae(),c.label);d&&f6(d,b.label)&&
c.receiverType!=chrome.cast.ReceiverType.CAST&&b.receiverType==chrome.cast.ReceiverType.CAST&&(E7("onSessionEstablished_: manual to cast session change "+b.friendlyName),g.He(this.o),this.o=new A7(this.u,b),this.o.subscribe("sessionScreen",(0,g.x)(this.NA,this,this.o)),this.o.lj(null));this.o.Wt(a)}}};
g.h.EP=function(){return this.o?this.o.PC():null};
g.h.WM=function(a){this.la()||(this.Sb("Failed to estabilish a session: "+g.Mk(a)),a.code!=chrome.cast.ErrorCode.CANCEL&&G7(this,null))};
g.h.zM=function(a){E7("Receiver availability updated: "+a);if(!this.la()){var b=F7(this);this.B=a==chrome.cast.ReceiverAvailability.AVAILABLE;F7(this)!=b&&this.R("yt-remote-cast2-availability-change",F7(this))}};
g.h.OC=function(){this.la()||(this.w=Cwa(this),E7("Updating custom receivers: "+g.Mk(this.w)),chrome.cast.setCustomReceivers(this.w,g.Ja,(0,g.x)(function(){this.Sb("Failed to set custom receivers.")},this)),this.R("yt-remote-cast2-availability-change",F7(this)))};
D7.prototype.setLaunchParams=D7.prototype.DO;D7.prototype.setConnectedScreenStatus=D7.prototype.BO;D7.prototype.stopSession=D7.prototype.FP;D7.prototype.getCastSession=D7.prototype.EP;D7.prototype.requestSession=D7.prototype.requestSession;D7.prototype.init=D7.prototype.init;D7.prototype.dispose=D7.prototype.dispose;var M7=[];R7.prototype.reset=function(a){this.listId="";this.index=-1;this.videoId="";S7(this);this.volume=-1;this.muted=!1;a&&(this.index=a.index,this.listId=a.listId,this.videoId=a.videoId,this.playerState=a.playerState,this.volume=a.volume,this.muted=a.muted,this.audioTrackId=a.audioTrackId,this.o=a.trackData,this.J=a.hasPrevious,this.hasNext=a.hasNext,this.F=a.playerTime,this.C=a.playerTimeAt,this.A=a.seekableStart,this.u=a.seekableEnd,this.G=a.duration,this.H=a.loadedTime,this.w=a.liveIngestionTime,this.B=
!isNaN(this.w))};
R7.prototype.isAdPlaying=function(){return 1081==this.playerState};
R7.prototype.getDuration=function(){return this.B?this.G+T7(this):this.G};
R7.prototype.clone=function(){return new R7(X7(this))};g.r(Z7,g.P);g.h=Z7.prototype;g.h.play=function(){1==this.o?(this.u?this.u.play(null,g.Ja,e8(this,"play")):d8(this,"play"),c8(this,1,V7($7(this))),this.R("remotePlayerChange")):a8(this,this.play)};
g.h.pause=function(){1==this.o?(this.u?this.u.pause(null,g.Ja,e8(this,"pause")):d8(this,"pause"),c8(this,2,V7($7(this))),this.R("remotePlayerChange")):a8(this,this.pause)};
g.h.seekTo=function(a){if(1==this.o){if(this.u){var b=$7(this),c=new chrome.cast.media.SeekRequest;c.currentTime=a;c.resumeState=1==b.playerState||3==b.playerState?chrome.cast.media.ResumeState.PLAYBACK_START:chrome.cast.media.ResumeState.PLAYBACK_PAUSE;this.u.seek(c,g.Ja,e8(this,"seekTo",{newTime:a}))}else d8(this,"seekTo",{newTime:a});c8(this,3,a);this.R("remotePlayerChange")}else a8(this,g.Sa(this.seekTo,a))};
g.h.stop=function(){if(1==this.o){this.u?this.u.stop(null,g.Ja,e8(this,"stopVideo")):d8(this,"stopVideo");var a=$7(this);a.index=-1;a.videoId="";S7(a);b8(this,a);this.R("remotePlayerChange")}else a8(this,this.stop)};
g.h.setVolume=function(a,b){if(1==this.o){var c=$7(this);if(this.w){if(c.volume!=a){var d=Math.round(a)/100;this.w.setReceiverVolumeLevel(d,(0,g.x)(function(){i7("CP","set receiver volume: "+d)},this),(0,g.x)(function(){this.Sb("failed to set receiver volume.")},this))}c.muted!=b&&this.w.setReceiverMuted(b,(0,g.x)(function(){i7("CP","set receiver muted: "+b)},this),(0,g.x)(function(){this.Sb("failed to set receiver muted.")},this))}else{var e={volume:a,
muted:b};-1!=c.volume&&(e.delta=a-c.volume);d8(this,"setVolume",e)}c.muted=b;c.volume=a;b8(this,c)}else a8(this,g.Sa(this.setVolume,a,b))};
g.h.OB=function(a,b){if(1==this.o){var c=$7(this),d={videoId:a};b&&(c.o={trackName:b.name,languageCode:b.languageCode,sourceLanguageCode:b.translationLanguage?b.translationLanguage.languageCode:"",languageName:b.languageName,kind:b.kind},d.style=g.Mk(b.style),g.Ub(d,c.o));d8(this,"setSubtitlesTrack",d);b8(this,c)}else a8(this,g.Sa(this.OB,a,b))};
g.h.setAudioTrack=function(a,b){if(1==this.o){var c=b.getLanguageInfo().getId();d8(this,"setAudioTrack",{videoId:a,audioTrackId:c});var d=$7(this);d.audioTrackId=c;b8(this,d)}else a8(this,g.Sa(this.setAudioTrack,a,b))};
g.h.playVideo=function(a,b,c,d,e,f,k){var l=$7(this);c=c||0;var m={videoId:a,currentIndex:c};W7(l,a,c);void 0!==b&&(U7(l,b),m.currentTime=b);void 0!==d&&(m.listId=d);null!=e&&(m.playerParams=e);null!=f&&(m.clickTrackingParams=f);null!=k&&(m.locationInfo=g.Mk(k));d8(this,"setPlaylist",m);d||b8(this,l)};
g.h.KC=function(a,b){if(1==this.o){if(a&&b){var c=$7(this);W7(c,a,b);b8(this,c)}d8(this,"previous")}else a8(this,g.Sa(this.KC,a,b))};
g.h.nextVideo=function(a,b){if(1==this.o){if(a&&b){var c=$7(this);W7(c,a,b);b8(this,c)}d8(this,"next")}else a8(this,g.Sa(this.nextVideo,a,b))};
g.h.tw=function(){1==this.o?d8(this,"dismissAutoplay"):a8(this,this.tw)};
g.h.dispose=function(){if(3!=this.o){var a=this.o;this.o=3;this.R("proxyStateChange",a,this.o)}g.P.prototype.dispose.call(this)};
g.h.Y=function(){Pwa(this);this.A=null;this.B.clear();Y7(this,null);g.P.prototype.Y.call(this)};
g.h.Eu=function(a){if((a!=this.o||2==a)&&3!=this.o&&0!=a){var b=this.o;this.o=a;this.R("proxyStateChange",b,a);if(1==a)for(;!this.B.isEmpty();)b=a=this.B,g.db(b.o)&&(b.o=b.u,b.o.reverse(),b.u=[]),a.o.pop().apply(this);else 3==a&&this.dispose()}};
g.h.sM=function(a,b){this.R(a,b)};
g.h.wK=function(a){if(!a)this.Dl(null),Y7(this,null);else if(this.w.receiver.volume){a=this.w.receiver.volume;var b=$7(this),c=Math.round(100*a.level||0);if(b.volume!=c||b.muted!=a.muted)i7("CP","Cast volume update: "+a.level+(a.muted?" muted":"")),b.volume=c,b.muted=!!a.muted,b8(this,b)}};
g.h.Dl=function(a){i7("CP","Cast media: "+!!a);this.u&&this.u.removeUpdateListener(this.G);if(this.u=a)this.u.addUpdateListener(this.G),Qwa(this),this.R("remotePlayerChange")};
g.h.vK=function(a){a?(Qwa(this),this.R("remotePlayerChange")):this.Dl(null)};
g.h.HK=function(){var a=Mwa();a&&Y7(this,a)};
g.h.Sb=function(a){i7("CP",a)};g.r(f8,g.P);g.h=f8.prototype;
g.h.connect=function(a,b){if(b){var c=b.listId,d=b.videoId,e=b.playerParams,f=b.clickTrackingParams,k=b.index,l={videoId:d},m=b.currentTime,n=b.locationInfo;void 0!==m&&(l.currentTime=5>=m?0:m);e&&(l.playerParams=e);n&&(l.locationInfo=n);f&&(l.clickTrackingParams=f);c&&(l.listId=c);void 0!==k&&(l.currentIndex=k);c&&(this.Ta.listId=c);this.Ta.videoId=d;this.Ta.index=k||0;this.Ta.state=3;U7(this.Ta,m);this.A="UNSUPPORTED";g8("Connecting with setPlaylist and params: "+g.Mk(l));this.o.connect({method:"setPlaylist",
params:g.Mk(l)},a,cva())}else g8("Connecting without params"),this.o.connect({},a,cva());Swa(this)};
g.h.dispose=function(){this.la()||(this.R("beforeDispose"),h8(this,3));g.P.prototype.dispose.call(this)};
g.h.Y=function(){i8(this);k8(this);j8(this);g.Mo(this.F);this.F=NaN;g.Mo(this.G);this.G=NaN;this.w=null;g.zp(this.O);this.O.length=0;this.o.dispose();g.P.prototype.Y.call(this);this.A=this.C=this.u=this.Ta=this.o=null};
g.h.iF=function(){this.Qi(2)};
g.h.AK=function(){g8("Channel opened");this.P&&(this.P=!1,j8(this),this.J=g.Ko((0,g.x)(function(){g8("Timing out waiting for a screen.");this.Qi(1)},this),15E3));
gva(bwa(this.o),this.S)};
g.h.xK=function(){g8("Channel closed");isNaN(this.B)?q6(!0):q6();this.dispose()};
g.h.yK=function(a){q6();isNaN(this.Ak())?(g8("Channel error: "+a+" without reconnection"),this.dispose()):(this.P=!0,g8("Channel error: "+a+" with reconnection in "+this.Ak()+" ms"),h8(this,2))};
g.h.zK=function(a){a.params?g8("Received: action="+a.action+", params="+g.Mk(a.params)):g8("Received: action="+a.action+" {}");switch(a.action){case "loungeStatus":a=N6(a.params.devices);this.u=(0,g.Fc)(a,function(c){return new d6(c)});
a=!!g.$a(this.u,function(c){return"LOUNGE_SCREEN"==c.type});
Vwa(this,a);break;case "loungeScreenDisconnected":g.ib(this.u,function(c){return"LOUNGE_SCREEN"==c.type});
Vwa(this,!1);break;case "remoteConnected":var b=new d6(N6(a.params.device));g.$a(this.u,function(c){return b?c.id==b.id:!1})||Nua(this.u,b);
break;case "remoteDisconnected":b=new d6(N6(a.params.device));g.ib(this.u,function(c){return b?c.id==b.id:!1});
break;case "gracefulDisconnect":break;case "playlistModified":Xwa(this,a);break;case "nowPlaying":Zwa(this,a);break;case "onStateChange":Ywa(this,a);break;case "onAdStateChange":$wa(this,a);break;case "onVolumeChanged":axa(this,a);break;case "onSubtitlesTrackChanged":Wwa(this,a);break;case "nowAutoplaying":bxa(this,a);break;case "autoplayDismissed":this.R("autoplayDismissed");break;case "autoplayUpNext":this.C=a.params.videoId||null;this.R("autoplayUpNext",this.C);break;case "onAutoplayModeChanged":this.A=
a.params.autoplayMode;this.R("autoplayModeChange",this.A);"DISABLED"==this.A&&this.R("autoplayDismissed");break;case "onHasPreviousNextChanged":cxa(this,a);break;case "requestAssistedSignIn":this.R("assistedSignInRequested",a.params.authCode);break;default:g8("Unrecognized action: "+a.action)}};
g.h.pO=function(){if(this.w){var a=this.w;this.w=null;this.Ta.videoId!=a&&l8(this,"getNowPlaying")}};
g.h.XE=function(){var a=3;this.la()||(a=0,isNaN(this.Ak())?d7(this.o)&&isNaN(this.B)&&(a=1):a=2);return a};
g.h.Qi=function(a){g8("Disconnecting with "+a);i8(this);this.R("beforeDisconnect",a);1==a&&q6();cwa(this.o,a);this.dispose()};
g.h.WE=function(){var a=this.Ta;this.w&&(a=this.Ta.clone(),W7(a,this.w,a.index));return X7(a)};
g.h.EO=function(a){var b=new R7(a);b.videoId&&b.videoId!=this.Ta.videoId&&(this.w=b.videoId,g.Mo(this.F),this.F=g.Ko((0,g.x)(this.pO,this),5E3));var c=[];this.Ta.listId==b.listId&&this.Ta.videoId==b.videoId&&this.Ta.index==b.index||c.push("remoteQueueChange");this.Ta.playerState==b.playerState&&this.Ta.volume==b.volume&&this.Ta.muted==b.muted&&V7(this.Ta)==V7(b)&&g.Mk(this.Ta.o)==g.Mk(b.o)||c.push("remotePlayerChange");this.Ta.reset(a);(0,g.y)(c,function(d){this.R(d)},this)};
g.h.hx=function(){var a=this.o.C.id,b=g.$a(this.u,function(c){return"REMOTE_CONTROL"==c.type&&c.id!=a});
return b?b.id:""};
g.h.Ak=function(){var a=this.o;return a.u.isActive()?a.u.u-(0,g.H)():NaN};
g.h.LE=function(){return this.A||"UNSUPPORTED"};
g.h.ME=function(){return this.C||""};
g.h.xP=function(){if(!isNaN(this.Ak())){var a=this.o.u;g.Cn(a.o);a.start()}};
g.h.yO=function(a,b){l8(this,a,b);Uwa(this)};
f8.prototype.subscribe=f8.prototype.subscribe;f8.prototype.unsubscribeByKey=f8.prototype.pg;f8.prototype.getProxyState=f8.prototype.XE;f8.prototype.disconnect=f8.prototype.Qi;f8.prototype.getPlayerContextData=f8.prototype.WE;f8.prototype.setPlayerContextData=f8.prototype.EO;f8.prototype.getOtherConnectedRemoteId=f8.prototype.hx;f8.prototype.getReconnectTimeout=f8.prototype.Ak;f8.prototype.getAutoplayMode=f8.prototype.LE;f8.prototype.getAutoplayVideoId=f8.prototype.ME;f8.prototype.reconnect=f8.prototype.xP;
f8.prototype.sendMessage=f8.prototype.yO;g.r(m8,m7);g.h=m8.prototype;g.h.ae=function(a){return this.qd.$_gs(a)};
g.h.contains=function(a){return!!this.qd.$_c(a)};
g.h.get=function(a){return this.qd.$_g(a)};
g.h.start=function(){this.qd.$_st()};
g.h.add=function(a,b,c){this.qd.$_a(a,b,c)};
g.h.remove=function(a,b,c){this.qd.$_r(a,b,c)};
g.h.Cp=function(a,b,c,d){this.qd.$_un(a,b,c,d)};
g.h.Y=function(){for(var a=0,b=this.u.length;a<b;++a)this.qd.$_ubk(this.u[a]);this.u.length=0;this.qd=null;m7.prototype.Y.call(this)};
g.h.BP=function(){this.R("screenChange")};
g.h.XL=function(){this.R("onlineScreenChange")};
v7.prototype.$_st=v7.prototype.start;v7.prototype.$_gspc=v7.prototype.CP;v7.prototype.$_gsppc=v7.prototype.NC;v7.prototype.$_c=v7.prototype.contains;v7.prototype.$_g=v7.prototype.get;v7.prototype.$_a=v7.prototype.add;v7.prototype.$_un=v7.prototype.Cp;v7.prototype.$_r=v7.prototype.remove;v7.prototype.$_gs=v7.prototype.ae;v7.prototype.$_gos=v7.prototype.MC;v7.prototype.$_s=v7.prototype.subscribe;v7.prototype.$_ubk=v7.prototype.pg;var F8=null,E8=!1,n8=null,o8=null,D8=null,s8=[];g.r(G8,g.A);g.h=G8.prototype;
g.h.Y=function(){g.A.prototype.Y.call(this);this.A.stop();this.C.stop();this.P.stop();this.U();this.o.unsubscribe("proxyStateChange",this.JA,this);this.o.unsubscribe("remotePlayerChange",this.Il,this);this.o.unsubscribe("remoteQueueChange",this.Ro,this);this.o.unsubscribe("autoplayUpNext",this.kA,this);this.o.unsubscribe("previousNextChange",this.GA,this);this.o.unsubscribe("nowAutoplaying",this.CA,this);this.o.unsubscribe("autoplayDismissed",this.jA,this);this.o=this.B=null};
g.h.fz=function(a,b){for(var c=[],d=1;d<arguments.length;++d)c[d-1]=arguments[d];if(2!=this.o.o)if(J8(this)){if(!$7(this.o).isAdPlaying()||"control_seek"!=a)switch(a){case "control_toggle_play_pause":1==$7(this.o).playerState?this.o.pause():this.o.play();break;case "control_play":this.o.play();break;case "control_pause":this.o.pause();break;case "control_seek":this.J.sx(c[0],c[1]);break;case "control_subtitles_set_track":K8(this,c[0]);break;case "control_set_audio_track":c=c[0],J8(this)&&this.o.setAudioTrack(this.u.getVideoData(1).videoId,
c)}}else switch(a){case "control_toggle_play_pause":case "control_play":case "control_pause":c=this.u.getCurrentTime();L8(this,0==c?void 0:c);break;case "control_seek":L8(this,c[0]);break;case "control_subtitles_set_track":K8(this,c[0]);break;case "control_set_audio_track":c=c[0],J8(this)&&this.o.setAudioTrack(this.u.getVideoData(1).videoId,c)}};
g.h.uK=function(a){this.P.eF(a)};
g.h.dP=function(a){this.fz("control_subtitles_set_track",g.Ob(a)?null:a)};
g.h.bC=function(){var a=this.u.getOption("captions","track");g.Ob(a)||K8(this,a)};
g.h.uA=function(a){if(J8(this)){this.o.unsubscribe("remotePlayerChange",this.Il,this);var b=Math.round(a.volume);a=!!a.muted;var c=$7(this.o);if(b!=c.volume||a!=c.muted)this.o.setVolume(b,a),this.O.start();this.o.subscribe("remotePlayerChange",this.Il,this)}};
g.h.tL=function(){g.Ob(this.F)||oxa(this,this.F);this.G=!1};
g.h.JA=function(a,b){this.C.stop();2==b&&this.aC()};
g.h.Il=function(){if(J8(this)){this.A.stop();var a=$7(this.o);switch(a.playerState){case 1080:case 1081:case 1084:case 1085:this.B.H=1;break;case 1082:case 1083:this.B.H=0;break;default:this.B.H=-1}switch(a.playerState){case 1081:case 1:I8(this,new g.qD(8));this.ZB();break;case 1085:case 3:I8(this,new g.qD(9));break;case 1083:case 0:I8(this,new g.qD(2));this.J.stop();H8(this,this.u.getVideoData().lengthSeconds);break;case 1084:I8(this,new g.qD(4));break;case 2:I8(this,new g.qD(4));H8(this,V7(a));
break;case -1:I8(this,new g.qD(64));break;case -1E3:I8(this,new g.qD(128,{errorCode:"mdx.remoteerror",errorMessage:"This video is not available for remote playback."}))}a=$7(this.o).o;var b=this.F;(a||b?a&&b&&a.trackName==b.trackName&&a.languageCode==b.languageCode&&a.languageName==b.languageName&&a.kind==b.kind:1)||(this.F=a,oxa(this,a));a=$7(this.o);-1==a.volume||Math.round(this.u.getVolume())==a.volume&&this.u.isMuted()==a.muted||this.O.isActive()||this.zC()}else nxa(this)};
g.h.GA=function(){this.u.R("mdxpreviousnextchange")};
g.h.Ro=function(){J8(this)||nxa(this)};
g.h.aE=function(){this.o.tw()};
g.h.kA=function(){};
g.h.CA=function(a){isNaN(a)||this.u.R("mdxnowautoplaying",a)};
g.h.jA=function(){this.u.R("mdxautoplaycanceled")};
g.h.bI=function(a,b){-1==$7(this.o).playerState?L8(this,a):b&&this.o.seekTo(a)};
g.h.zC=function(){if(J8(this)){var a=$7(this.o);this.w.Xa(this.S);a.muted?this.u.mute():this.u.unMute();this.u.setVolume(a.volume);this.S=this.w.L(this.u,"onVolumeChange",this.uA)}};
g.h.ZB=function(){this.A.stop();if(!this.o.la()){var a=$7(this.o);1==a.playerState&&I8(this,new g.qD(8));H8(this,V7(a));this.A.start()}};
g.h.aC=function(){this.C.stop();this.A.stop();var a=this.o.A.getReconnectTimeout();2==this.o.o&&!isNaN(a)&&this.C.start()};g.r(M8,g.V);M8.prototype.w=function(){c6("mdx-privacy-popup-cancel");this.u.hide()};
M8.prototype.B=function(){c6("mdx-privacy-popup-confirm");this.u.hide()};g.r(N8,g.V);N8.prototype.A=function(a){qxa(this,a.state)};g.r(O8,g.$O);O8.prototype.J=function(){var a=this.u.getOption("remote","receivers");a&&1<a.length&&!this.u.getOption("remote","quickCast")?(this.C=g.xb(a,this.B,this),g.bP(this,(0,g.Fc)(a,this.B)),a=this.u.getOption("remote","currentReceiver"),this.Be(this.B(a)),this.enable(!0)):this.enable(!1)};
O8.prototype.B=function(a){return a.key};
O8.prototype.Te=function(a){return"cast-selector-receiver"==a?"Cast...":this.C[a].name};
O8.prototype.Yc=function(a){g.$O.prototype.Yc.call(this,a);this.u.setOption("remote","currentReceiver",this.C[a]);this.w.kb()};g.r(P8,g.gM);g.h=P8.prototype;
g.h.create=function(){hxa(g.Bx(this.player.N()));this.A.push(g.Ro("yt-remote-before-disconnect",this.rK,this));this.A.push(g.Ro("yt-remote-connection-change",this.AM,this));this.A.push(g.Ro("yt-remote-receiver-availability-change",this.HA,this));this.A.push(g.Ro("yt-remote-auto-connect",this.yM,this));this.A.push(g.Ro("yt-remote-receiver-resumed",this.xM,this));this.A.push(g.Ro("mdx-privacy-popup-confirm",this.bO,this));this.A.push(g.Ro("mdx-privacy-popup-cancel",this.aO,this));this.HA()};
g.h.load=function(){this.player.cancelPlayback();g.gM.prototype.load.call(this);this.B=new G8(this,this.player,this.o);var a=(a=mxa())?a.currentTime:0;var b=C8()?new Z7(x8(),void 0):null;0==a&&b&&(a=V7($7(b)));0!=a&&(this.O=a||0,this.player.R("progresssync",a,void 0));pxa(this,this.F,this.F);g.BT(this.player.app,6)};
g.h.unload=function(){this.player.R("mdxautoplaycanceled");this.w=this.u;g.Ie(this.B,this.o);this.o=this.B=null;g.gM.prototype.unload.call(this);g.BT(this.player.app,5);Q8(this)};
g.h.Y=function(){g.So(this.A);g.gM.prototype.Y.call(this)};
g.h.kl=function(a,b){for(var c=[],d=1;d<arguments.length;++d)c[d-1]=arguments[d];this.loaded&&this.B.fz.apply(this.B,[a].concat(g.na(c)))};
g.h.getAdState=function(){return this.H};
g.h.ZE=function(){return this.loaded?this.B.suggestion:null};
g.h.By=function(){return this.o?$7(this.o).J:!1};
g.h.hasNext=function(){return this.o?$7(this.o).hasNext:!1};
g.h.getCurrentTime=function(){return this.O};
g.h.getProgressState=function(){var a=$7(this.o),b=this.player.getVideoData();return{allowSeeking:g.Q(this.player.N().experiments,"web_player_mdx_allow_seeking_change_killswitch")?this.player.Nc():!a.isAdPlaying()&&this.player.Nc(),clipEnd:b.clipEnd,clipStart:b.clipStart,current:this.getCurrentTime(),displayedStart:-1,duration:a.getDuration(),ingestionTime:a.B?a.w+T7(a):a.w,isAtLiveHead:1>=(a.B?a.u+T7(a):a.u)-this.getCurrentTime(),loaded:a.H,seekableEnd:a.B?a.u+T7(a):a.u,seekableStart:0<a.A?a.A+T7(a):
a.A}};
g.h.nextVideo=function(){this.o&&this.o.nextVideo()};
g.h.wG=function(){this.o&&this.o.KC()};
g.h.rK=function(a){1==a&&(this.S=this.o?$7(this.o):null)};
g.h.AM=function(){var a=C8()?new Z7(x8(),void 0):null;if(a){var b=this.w;this.loaded&&this.unload();this.o=a;this.S=null;b.key!=this.u.key&&(this.w=b,this.load())}else g.He(this.o),this.o=null,this.loaded&&(this.unload(),(a=this.S)&&a.videoId==this.player.getVideoData().videoId&&this.player.cueVideoById(a.videoId,V7(a)));this.player.R("videodatachange","newdata",this.player.getVideoData(),3)};
g.h.HA=function(){this.J=[this.u].concat(jxa());var a=y8()||this.u;R8(this,a);this.player.ma("onMdxReceiversChange")};
g.h.SN=function(a){!this.P&&g.ED(a,8)&&(this.player.pauseVideo(),Q8(this))};
g.h.yM=function(){var a=y8();R8(this,a)};
g.h.xM=function(){this.w=y8()};
g.h.bO=function(){this.P=!0;Q8(this);E8=!1;F8&&A8(F8,1);F8=null};
g.h.aO=function(){this.P=!1;Q8(this);R8(this,this.u);this.w=this.u;E8=!1;F8=null;this.player.playVideo()};
g.h.Lc=function(a,b){switch(a){case "casting":return this.loaded;case "receivers":return this.J;case "currentReceiver":return b&&("cast-selector-receiver"==b.key?P7():R8(this,b)),this.loaded?this.w:this.u;case "quickCast":return 2==this.J.length&&"cast-selector-receiver"==this.J[1].key?(b&&P7(),!0):!1}};
g.h.xG=function(){d8(this.o,"sendDebugCommand",{debugCommand:"stats4nerds "})};
g.h.Bf=function(){return!1};
g.h.getOptions=function(){return["casting","receivers","currentReceiver","quickCast"]};g.vM.remote=P8;})(_yt_player);
