(function(g){var window=this;'use strict';var nTa=function(a,b){return g.Ae(a,b)},oTa=function(a,b){b=b instanceof g.Cf?b:g.If(b,/^data:image\//i.test(b));
a.src=g.Df(b)},O6=function(a){g.Ck(a,"zx",Math.floor(2147483648*Math.random()).toString(36)+Math.abs(Math.floor(2147483648*Math.random())^g.Sa()).toString(36));
return a},P6=function(a,b,c){Array.isArray(c)||(c=[String(c)]);
g.Ok(a.u,b,c)},pTa=function(a){if(a===g.Bo)throw Error("ES6 Iteration protocol does NOT adjust control flow when StopIteration is thrown from callback helper functions. If your code relies on this behavior, consider throwing a different error and catching it to terminate iteration.");
throw a;},qTa=function(a){if(a instanceof g.zo)return a;
if("function"==typeof a.Jg)return a.Jg(!1);if(g.Ma(a)){var b=0,c=new g.zo;c.next=function(){for(;;){if(b>=a.length)return g.e2;if(b in a)return g.Ao(a[b++]);b++}};
var d=c.next;c.yj=function(){return g.Co(d.call(c))};
return c}throw Error("Not implemented");},rTa=function(a,b,c){if(g.Ma(a))try{g.jc(a,b,c)}catch(e){pTa(e)}else for(a=qTa(a);;){var d=void 0;
try{d=a.yj()}catch(e){if(e===g.Bo)break;throw e;}try{b.call(c,d,void 0,a)}catch(e){pTa(e)}}},sTa=function(a,b){var c=[];
rTa(b,function(d){try{var e=g.Sr.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.Rr(e)&&c.push(d)},a);
return c},tTa=function(a,b){sTa(a,b).forEach(function(c){g.Sr.prototype.remove.call(this,c)},a)},uTa=function(a){if(a.va){if(a.va.locationOverrideToken)return{locationOverrideToken:a.va.locationOverrideToken};
if(null!=a.va.latitudeE7&&null!=a.va.longitudeE7)return{latitudeE7:a.va.latitudeE7,longitudeE7:a.va.longitudeE7}}return null},vTa=function(a,b){g.Qb(a,b)||a.push(b)},Q6=function(a){var b=0,c;
for(c in a)b++;return b},wTa=function(a){try{return g.B.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);},R6=function(a){if(g.B.JSON)try{return g.B.JSON.parse(a)}catch(b){}return wTa(a)},xTa=function(a,b,c,d){var e=new g.uk(null,void 0);
a&&g.vk(e,a);b&&g.wk(e,b);c&&g.xk(e,c);d&&(e.K=d);return e},S6=function(a,b){g.Bv[a]=!0;
var c=g.zv();c&&c.publish.apply(c,arguments);g.Bv[a]=!1},T6=function(a){this.name=this.id="";
this.clientName="UNKNOWN_INTERFACE";this.app="";this.type="REMOTE_CONTROL";this.obfuscatedGaiaId=this.avatar=this.username="";this.capabilities=new Set;this.experiments=new Set;this.theme="u";new g.sr;this.model=this.brand="";this.year=0;this.chipset=this.osVersion=this.os="";this.mdxDialServerType="MDX_DIAL_SERVER_TYPE_UNKNOWN";a&&(this.id=a.id||a.name,this.name=a.name,this.clientName=a.clientName?a.clientName.toUpperCase():"UNKNOWN_INTERFACE",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",yTa(this,a.capabilities||""),zTa(this,a.experiments||""),this.brand=a.brand||"",this.model=a.model||"",this.year=a.year||0,this.os=a.os||"",this.osVersion=a.osVersion||"",this.chipset=a.chipset||"",this.mdxDialServerType=a.mdxDialServerType||"MDX_DIAL_SERVER_TYPE_UNKNOWN",a=a.deviceInfo)&&(a=JSON.parse(a),this.brand=a.brand||"",this.model=a.model||"",this.year=a.year||0,this.os=a.os||"",
this.osVersion=a.osVersion||"",this.chipset=a.chipset||"",this.clientName=a.clientName?a.clientName.toUpperCase():"UNKNOWN_INTERFACE",this.mdxDialServerType=a.mdxDialServerType||"MDX_DIAL_SERVER_TYPE_UNKNOWN")},yTa=function(a,b){a.capabilities.clear();
g.ap(b.split(","),g.Ra(nTa,ATa)).forEach(function(c){a.capabilities.add(c)})},zTa=function(a,b){a.experiments.clear();
b.split(",").forEach(function(c){a.experiments.add(c)})},U6=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"},V6=function(a,b){return!!b&&(a.id==b||a.uuid==b)},BTa=function(a){return{name:a.name,
screenId:a.id,loungeToken:a.token,dialId:a.uuid,screenIdType:a.idType}},CTa=function(a){return new U6(a)},DTa=function(a){return Array.isArray(a)?g.Mm(a,CTa):[]},W6=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"},X6=function(a){return Array.isArray(a)?"["+g.Mm(a,W6).join(",")+"]":"null"},Y6=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)})},ETa=function(a){return g.Mm(a,function(b){return{key:b.id,
name:b.name}})},Z6=function(a,b){return g.Mb(a,function(c){return c||b?!c!=!b?!1:c.id==b.id:!0})},$6=function(a,b){return g.Mb(a,function(c){return V6(c,b)})},FTa=function(){var a=(0,g.wy)();
a&&tTa(a,a.i.Jg(!0))},a7=function(){var a=g.Ay("yt-remote-connected-devices")||[];
g.gc(a);return a},GTa=function(a){if(g.Rb(a))return[];
var b=a[0].indexOf("#"),c=-1==b?a[0]:a[0].substring(0,b);return g.Mm(a,function(d,e){return 0==e?d:d.substring(c.length)})},HTa=function(a){g.zy("yt-remote-connected-devices",a,86400)},c7=function(){if(b7)return b7;
var a=g.Ay("yt-remote-device-id");a||(a=Y6(),g.zy("yt-remote-device-id",a,31536E3));for(var b=a7(),c=1,d=a;g.Qb(b,d);)c++,d=a+"#"+c;return b7=d},d7=function(){var a=a7(),b=c7();
g.Qb(a,b);g.Cy()&&g.ic(a,b);a=GTa(a);if(g.Rb(a))try{g.ku("remote_sid")}catch(c){}else try{g.iu("remote_sid",a.join(","),-1)}catch(c){}},ITa=function(){return g.Ay("yt-remote-session-browser-channel")},JTa=function(){return g.Ay("yt-remote-local-screens")||[]},KTa=function(){g.zy("yt-remote-lounge-token-expiration",!0,86400)},LTa=function(a){5<a.length&&(a=a.slice(a.length-5));
var b=g.Mm(JTa(),function(d){return d.loungeToken}),c=g.Mm(a,function(d){return d.loungeToken});
g.Nm(c,function(d){return!g.Qb(b,d)})&&KTa();
g.zy("yt-remote-local-screens",a,31536E3)},MTa=function(a,b){g.zy("yt-remote-session-browser-channel",a);
g.zy("yt-remote-session-screen-id",b);a=a7();b=c7();g.Qb(a,b)||a.push(b);HTa(a);d7()},e7=function(a){a||(g.By("yt-remote-session-screen-id"),g.By("yt-remote-session-video-id"));
d7();a=a7();g.Ub(a,c7());HTa(a)},NTa=function(){if(!f7){var a=g.bs();
a&&(f7=new g.Mr(a))}},OTa=function(){NTa();
return f7?!!f7.get("yt-remote-use-staging-server"):!1},g7=function(){var a=window.navigator.userAgent.match(/Chrome\/([0-9]+)/);
return a?parseInt(a[1],10):0},PTa=function(a){return!!document.currentScript&&(-1!=document.currentScript.src.indexOf("?"+a)||-1!=document.currentScript.src.indexOf("&"+a))},QTa=function(){return"function"==typeof window.__onGCastApiAvailable?window.__onGCastApiAvailable:null},h7=function(a){a.length?RTa(a.shift(),function(){h7(a)}):i7()},STa=function(a){return"chrome-extension://"+a+"/cast_sender.js"},RTa=function(a,b,c){var d=document.createElement("script");
d.onerror=b;c&&(d.onload=c);g.Rj(d,g.Ar(a));(document.head||document.documentElement).appendChild(d)},TTa=function(){var a=g7(),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},i7=function(){var a=QTa();
a&&a(!1,"No cast extension found")},j7=function(){if(UTa){var a=2,b=QTa(),c=function(){a--;
0==a&&b&&b(!0)};
window.__onGCastApiAvailable=c;RTa("//www.gstatic.com/cast/sdk/libs/sender/1.0/cast_framework.js",i7,c)}},VTa=function(){j7();
var a=TTa();a.push("//www.gstatic.com/eureka/clank/cast_sender.js");h7(a)},XTa=function(){j7();
var a=TTa();a.push.apply(a,g.la(WTa.map(STa)));a.push("//www.gstatic.com/eureka/clank/cast_sender.js");h7(a)},k7=function(a,b,c){g.E.call(this);
this.I=null!=c?(0,g.D)(a,c):a;this.Uf=b;this.D=(0,g.D)(this.pQ,this);this.i=!1;this.u=0;this.B=this.Mb=null;this.C=[]},l7=function(a,b,c){g.E.call(this);
this.C=null!=c?a.bind(c):a;this.Uf=b;this.B=null;this.i=!1;this.u=0;this.Mb=null},m7=function(a){a.Mb=g.Hh(function(){a.Mb=null;
a.i&&!a.u&&(a.i=!1,m7(a))},a.Uf);
var b=a.B;a.B=null;a.C.apply(null,b)},n7=function(){},o7=function(a,b){if("function"!==typeof a)throw Error("Fn must not be null and must be a function");
return g.B.setTimeout(function(){a()},b)},q7=function(a){p7.dispatchEvent(new YTa(p7,a))},YTa=function(a,b){g.ie.call(this,"statevent",a);
this.stat=b},r7=function(a,b,c,d){this.i=a;
this.B=b;this.S=c;this.K=d||1;this.u=45E3;this.C=new g.Pk(this);this.I=new g.Gh;this.I.setInterval(250)},$Ta=function(a,b,c){a.Mt=1;
a.Vm=O6(b.clone());a.wq=c;a.D=!0;ZTa(a,null)},s7=function(a,b,c,d,e){a.Mt=1;
a.Vm=O6(b.clone());a.wq=null;a.D=c;e&&(a.JN=!1);ZTa(a,d)},ZTa=function(a,b){a.zt=Date.now();
t7(a);a.Fo=a.Vm.clone();P6(a.Fo,"t",a.K);a.xB=0;a.Kf=a.i.uD(a.i.lx()?b:null);0<a.jC&&(a.LA=new l7((0,g.D)(a.LO,a,a.Kf),a.jC));a.C.Qa(a.Kf,"readystatechange",a.qQ);b=a.Vo?g.Je(a.Vo):{};a.wq?(a.vB="POST",b["Content-Type"]="application/x-www-form-urlencoded",a.Kf.send(a.Fo,a.vB,a.wq,b)):(a.vB="GET",a.JN&&!g.Ig&&(b.Connection="close"),a.Kf.send(a.Fo,a.vB,null,b));a.i.zj(1)},bUa=function(a,b){var c=a.xB,d=b.indexOf("\n",c);
if(-1==d)return u7;c=Number(b.substring(c,d));if(isNaN(c))return aUa;d+=1;if(d+c>b.length)return u7;b=b.substr(d,c);a.xB=d+c;return b},dUa=function(a,b){a.zt=Date.now();
t7(a);var c=b?window.location.hostname:"";a.Fo=a.Vm.clone();g.Ck(a.Fo,"DOMAIN",c);g.Ck(a.Fo,"t",a.K);try{a.Mj=new ActiveXObject("htmlfile")}catch(m){v7(a);a.Om=7;q7(22);w7(a);return}var d="<html><body>";if(b){var e="";for(b=0;b<c.length;b++){var f=c.charAt(b);if("<"==f)f=e+"\\x3c";else if(">"==f)f=e+"\\x3e";else{if(f in x7)f=x7[f];else if(f in cUa)f=x7[f]=cUa[f];else{var h=f.charCodeAt(0);if(31<h&&127>h)var l=f;else{if(256>h){if(l="\\x",16>h||256<h)l+="0"}else l="\\u",4096>h&&(l+="0");l+=h.toString(16).toUpperCase()}f=
x7[f]=l}f=e+f}e=f}d+='<script>document.domain="'+e+'"\x3c/script>'}d+="</body></html>";c=g.Yf(g.tf("b/12014412"),d);a.Mj.open();a.Mj.write(g.Uf(c));a.Mj.close();a.Mj.parentWindow.m=(0,g.D)(a.mW,a);a.Mj.parentWindow.d=(0,g.D)(a.UM,a,!0);a.Mj.parentWindow.rpcClose=(0,g.D)(a.UM,a,!1);c=a.Mj.createElement("DIV");a.Mj.parentWindow.document.body.appendChild(c);d=g.Hf(a.Fo.toString());d=g.og(g.Df(d));d=g.Yf(g.tf("b/12014412"),'<iframe src="'+d+'"></iframe>');g.$f(c,d);a.i.zj(1)},t7=function(a){a.hH=Date.now()+
a.u;
eUa(a,a.u)},eUa=function(a,b){if(null!=a.Xt)throw Error("WatchDog timer not null");
a.Xt=o7((0,g.D)(a.tW,a),b)},y7=function(a){a.Xt&&(g.B.clearTimeout(a.Xt),a.Xt=null)},w7=function(a){a.i.rf()||a.mp||a.i.Wx(a)},v7=function(a){y7(a);
g.ee(a.LA);a.LA=null;a.I.stop();g.Rk(a.C);if(a.Kf){var b=a.Kf;a.Kf=null;b.abort();b.dispose()}a.Mj&&(a.Mj=null)},z7=function(a,b){try{a.i.MM(a,b),a.i.zj(4)}catch(c){}},gUa=function(a,b,c,d,e){if(0==d)c(!1);
else{var f=e||0;d--;fUa(a,b,function(h){h?c(!0):g.B.setTimeout(function(){gUa(a,b,c,d,f)},f)})}},fUa=function(a,b,c){var d=new Image;
d.onload=function(){try{A7(d),c(!0)}catch(e){}};
d.onerror=function(){try{A7(d),c(!1)}catch(e){}};
d.onabort=function(){try{A7(d),c(!1)}catch(e){}};
d.ontimeout=function(){try{A7(d),c(!1)}catch(e){}};
g.B.setTimeout(function(){if(d.ontimeout)d.ontimeout()},b);
oTa(d,a)},A7=function(a){a.onload=null;
a.onerror=null;a.onabort=null;a.ontimeout=null},hUa=function(a){this.i=a;
this.u=new n7},iUa=function(a){var b=B7(a.i,a.Nu,"/mail/images/cleardot.gif");
O6(b);gUa(b.toString(),5E3,(0,g.D)(a.iR,a),3,2E3);a.zj(1)},D7=function(a){var b=a.i.X;
if(null!=b)q7(5),b?(q7(11),C7(a.i,a,!1)):(q7(12),C7(a.i,a,!0));else if(a.ph=new r7(a,void 0,void 0,void 0),a.ph.Vo=a.kC,b=a.i,b=B7(b,b.lx()?a.Fu:null,a.lC),q7(5),!g.Cc||g.tc(10))P6(b,"TYPE","xmlhttp"),s7(a.ph,b,!1,a.Fu,!1);else{P6(b,"TYPE","html");var c=a.ph;a=!!a.Fu;c.Mt=3;c.Vm=O6(b.clone());dUa(c,a)}},E7=function(a,b,c){this.i=1;
this.u=[];this.C=[];this.D=new n7;this.S=a||null;this.X=null!=b?b:null;this.I=c||!1},jUa=function(a,b){this.i=a;
this.map=b;this.context=null},kUa=function(a,b,c,d){g.ie.call(this,"timingevent",a);
this.size=b;this.Zw=d},lUa=function(a){g.ie.call(this,"serverreachability",a)},oUa=function(a){mUa(a);
if(3==a.i){var b=a.mw++,c=a.Ry.clone();g.Ck(c,"SID",a.B);g.Ck(c,"RID",b);g.Ck(c,"TYPE","terminate");F7(a,c);b=new r7(a,a.B,b,void 0);b.Mt=2;b.Vm=O6(c.clone());oTa(new Image,b.Vm.toString());b.zt=Date.now();t7(b)}nUa(a)},pUa=function(a){a.IR(1,0);
a.Ry=B7(a,null,a.mC);G7(a)},mUa=function(a){a.Zm&&(a.Zm.abort(),a.Zm=null);
a.He&&(a.He.cancel(),a.He=null);a.El&&(g.B.clearTimeout(a.El),a.El=null);H7(a);a.Tg&&(a.Tg.cancel(),a.Tg=null);a.xn&&(g.B.clearTimeout(a.xn),a.xn=null)},qUa=function(a,b){if(0==a.i)throw Error("Invalid operation: sending map when state is closed");
a.u.push(new jUa(a.mT++,b));2!=a.i&&3!=a.i||G7(a)},rUa=function(a){var b=0;
a.He&&b++;a.Tg&&b++;return b},G7=function(a){a.Tg||a.xn||(a.xn=o7((0,g.D)(a.SM,a),0),a.ls=0)},tUa=function(a,b){if(1==a.i){if(!b){a.mw=Math.floor(1E5*Math.random());
b=a.mw++;var c=new r7(a,"",b,void 0);c.Vo=a.Yj;var d=I7(a),e=a.Ry.clone();g.Ck(e,"RID",b);g.Ck(e,"CVER","1");F7(a,e);$Ta(c,e,d);a.Tg=c;a.i=2}}else 3==a.i&&(b?sUa(a,b):0==a.u.length||a.Tg||sUa(a))},sUa=function(a,b){if(b)if(6<a.np){a.u=a.C.concat(a.u);
a.C.length=0;var c=a.mw-1;b=I7(a)}else c=b.S,b=b.wq;else c=a.mw++,b=I7(a);var d=a.Ry.clone();g.Ck(d,"SID",a.B);g.Ck(d,"RID",c);g.Ck(d,"AID",a.Ps);F7(a,d);c=new r7(a,a.B,c,a.ls+1);c.Vo=a.Yj;c.setTimeout(1E4+Math.round(1E4*Math.random()));a.Tg=c;$Ta(c,d,b)},F7=function(a,b){a.Lf&&(a=a.Lf.mK())&&g.qe(a,function(c,d){g.Ck(b,d,c)})},I7=function(a){var b=Math.min(a.u.length,1E3),c=["count="+b];
if(6<a.np&&0<b){var d=a.u[0].i;c.push("ofs="+d)}else d=0;for(var e={},f=0;f<b;e={Vq:e.Vq},f++){e.Vq=a.u[f].i;var h=a.u[f].map;e.Vq=6>=a.np?f:e.Vq-d;try{g.qe(h,function(l){return function(m,n){c.push("req"+l.Vq+"_"+n+"="+encodeURIComponent(m))}}(e))}catch(l){c.push("req"+e.Vq+"_type="+encodeURIComponent("_badmap"))}}a.C=a.C.concat(a.u.splice(0,b));
return c.join("&")},uUa=function(a){a.He||a.El||(a.K=1,a.El=o7((0,g.D)(a.RM,a),0),a.Mr=0)},J7=function(a){if(a.He||a.El||3<=a.Mr)return!1;
a.K++;a.El=o7((0,g.D)(a.RM,a),vUa(a,a.Mr));a.Mr++;return!0},C7=function(a,b,c){a.tB=c;
a.Zj=b.ol;a.I||pUa(a)},H7=function(a){null!=a.yp&&(g.B.clearTimeout(a.yp),a.yp=null)},vUa=function(a,b){var c=5E3+Math.floor(1E4*Math.random());
a.isActive()||(c*=2);return c*b},K7=function(a,b){if(2==b||9==b){var c=null;
a.Lf&&(c=null);var d=(0,g.D)(a.wX,a);c||(c=new g.uk("//www.google.com/images/cleardot.gif"),O6(c));fUa(c.toString(),1E4,d)}else q7(2);wUa(a,b)},wUa=function(a,b){a.i=0;
a.Lf&&a.Lf.zJ(b);nUa(a);mUa(a)},nUa=function(a){a.i=0;
a.Zj=-1;if(a.Lf)if(0==a.C.length&&0==a.u.length)a.Lf.hD();else{g.Xb(a.C);var b=g.Xb(a.u);a.C.length=0;a.u.length=0;a.Lf.hD(b)}},B7=function(a,b,c){var d=g.Kk(c);
if(""!=d.i)b&&g.wk(d,b+"."+d.i),g.xk(d,d.B);else{var e=window.location;d=xTa(e.protocol,b?b+"."+e.hostname:e.hostname,+e.port,c)}a.tv&&g.qe(a.tv,function(f,h){g.Ck(d,h,f)});
g.Ck(d,"VER",a.np);F7(a,d);return d},xUa=function(){},yUa=function(){this.i=[];
this.u=[]},zUa=function(a,b){this.action=a;
this.params=b||{}},L7=function(a,b){g.E.call(this);
this.i=new g.I(this.dW,0,this);g.H(this,this.i);this.Uf=5E3;this.u=0;if("function"===typeof a)b&&(a=(0,g.D)(a,b));else if(a&&"function"===typeof a.handleEvent)a=(0,g.D)(a.handleEvent,a);else throw Error("Invalid listener argument");this.B=a},M7=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.va=a;this.I=b;this.B=new g.Lr;this.u=new L7(this.aX,this);this.i=null;this.Z=!1;this.D=null;this.X="";this.S=this.C=0;this.K=[];this.Aa=c;this.oa=d;this.Ba=e},AUa=function(a){return{firstTestResults:[""],
secondTestResults:!a.i.tB,sessionId:a.i.B,arrayId:a.i.Ps}},BUa=function(a,b){a.S=b||0;
a.u.stop();N7(a);a.i&&(3==a.i.getState()&&tUa(a.i),oUa(a.i));a.S=0},O7=function(a){return!!a.i&&3==a.i.getState()},N7=function(a){if(a.i){var b=a.oa(),c=a.i.Yj||{};
b?c["x-youtube-lounge-xsrf-token"]=b:delete c["x-youtube-lounge-xsrf-token"];a.i.Yj=c}},P7=function(a){this.port=this.domain="";
this.i="/api/lounge";this.u=!0;a=a||document.location.href;var b=Number(g.si(4,a))||"";b&&(this.port=":"+b);this.domain=g.ti(a)||"";a=g.Ab;0<=a.search("MSIE")&&(a=a.match(/MSIE ([\d.]+)/)[1],0>g.xb(a,"10.0")&&(this.u=!1))},Q7=function(a,b){var c=a.i;
a.u&&(c="https://"+a.domain+a.port+a.i);return g.Ei(c+b,{})},R7=function(a,b,c,d,e){a={format:"JSON",
method:"POST",context:a,timeout:5E3,withCredentials:!1,onSuccess:g.Ra(a.C,d,!0),onError:g.Ra(a.B,e),onTimeout:g.Ra(a.D,e)};c&&(a.postParams=c,a.headers={"Content-Type":"application/x-www-form-urlencoded"});return g.Yt(b,a)},FUa=function(){var a=CUa;
DUa();S7.push(a);EUa()},T7=function(a,b){DUa();
var c=GUa(a,String(b));g.Rb(S7)?HUa(c):(EUa(),g.jc(S7,function(d){d(c)}))},DUa=function(){S7||(S7=g.Ha("yt.mdx.remote.debug.handlers_")||[],g.Ga("yt.mdx.remote.debug.handlers_",S7,void 0))},HUa=function(a){var b=(U7+1)%50;
U7=b;V7[b]=a;W7||(W7=49==b)},EUa=function(){var a=S7;
if(V7[0]){var b=W7?U7:-1;do{b=(b+1)%50;var c=V7[b];g.jc(a,function(d){d(c)})}while(b!=U7);
V7=Array(50);U7=-1;W7=!1}},GUa=function(a,b){var c=(Date.now()-IUa)/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("")},X7=function(a){g.Q.call(this);
this.I=a;this.screens=[]},JUa=function(a,b){var c=a.get(b.uuid)||a.get(b.id);
if(c)return a=c.name,c.id=b.id||c.id,c.name=b.name,c.token=b.token,c.uuid=b.uuid||c.uuid,c.name!=a;a.screens.push(b);return!0},KUa=function(a,b){var c=a.screens.length!=b.length;
a.screens=g.ap(a.screens,function(f){return!!Z6(b,f)});
for(var d=0,e=b.length;d<e;d++)c=JUa(a,b[d])||c;return c},LUa=function(a,b){var c=a.screens.length;
a.screens=g.ap(a.screens,function(d){return!(d||b?!d!=!b?0:d.id==b.id:1)});
return a.screens.length<c},Y7=function(a,b,c,d,e){g.Q.call(this);
this.B=a;this.K=b;this.C=c;this.I=d;this.D=e;this.u=0;this.i=null;this.Mb=NaN},$7=function(a){X7.call(this,"LocalScreenService");
this.u=a;this.i=NaN;Z7(this);this.info("Initializing with "+X6(this.screens))},MUa=function(a){if(a.screens.length){var b=g.Mm(a.screens,function(d){return d.id}),c=Q7(a.u,"/pairing/get_lounge_token_batch");
R7(a.u,c,{screen_ids:b.join(",")},(0,g.D)(a.gS,a),(0,g.D)(a.fS,a))}},Z7=function(a){if(g.O("deprecate_pair_servlet_enabled"))return KUa(a,[]);
var b=DTa(JTa());b=g.ap(b,function(c){return!c.uuid});
return KUa(a,b)},a8=function(a,b){LTa(g.Mm(a.screens,BTa));
b&&KTa()},c8=function(a,b){g.Q.call(this);
this.I=b;b=(b=g.Ay("yt-remote-online-screen-ids")||"")?b.split(","):[];for(var c={},d=this.I(),e=0,f=d.length;e<f;++e){var h=d[e].id;c[h]=g.Qb(b,h)}this.i=c;this.D=a;this.B=this.C=NaN;this.u=null;b8("Initialized with "+g.ji(this.i))},d8=function(a,b,c){var d=Q7(a.D,"/pairing/get_screen_availability");
R7(a.D,d,{lounge_token:b.token},(0,g.D)(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.D)(function(){c(!1)},a))},e8=function(a,b){a:if(Q6(b)!=Q6(a.i))var c=!1;
else{c=g.ye(b);for(var d=0,e=c.length;d<e;++d)if(!a.i[c[d]]){c=!1;break a}c=!0}c||(b8("Updated online screens: "+g.ji(a.i)),a.i=b,a.ea("screenChange"));NUa(a)},f8=function(a){isNaN(a.B)||g.St(a.B);
a.B=g.Qt((0,g.D)(a.aG,a),0<a.C&&a.C<g.Sa()?2E4:1E4)},b8=function(a){T7("OnlineScreenService",a)},OUa=function(a){var b={};
g.jc(a.I(),function(c){c.token?b[c.token]=c.id:this.je("Requesting availability of screen w/o lounge token.")});
return b},NUa=function(a){a=g.ye(g.re(a.i,function(b){return b}));
g.gc(a);a.length?g.zy("yt-remote-online-screen-ids",a.join(","),60):g.By("yt-remote-online-screen-ids")},g8=function(a,b){b=void 0===b?!1:b;
X7.call(this,"ScreenService");this.C=a;this.K=b;this.i=this.u=null;this.B=[];this.D={};PUa(this)},RUa=function(a,b,c,d,e,f){a.info("getAutomaticScreenByIds "+c+" / "+b);
c||(c=a.D[b]);var h=a.Fh(),l=c?$6(h,c):null;c&&(a.K||l)||(l=$6(h,b));if(l){l.uuid=b;var m=h8(a,l);d8(a.i,m,function(n){e(n?m:null)})}else c?QUa(a,c,(0,g.D)(function(n){var p=h8(this,new U6({name:d,
screenId:c,loungeToken:n,dialId:b||""}));d8(this.i,p,function(q){e(q?p:null)})},a),f):e(null)},SUa=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},TUa=function(a,b,c){d8(a.i,b,c)},QUa=function(a,b,c,d){a.info("requestLoungeToken_ for "+b);
var e={postParams:{screen_ids:b},method:"POST",context:a,onSuccess:function(f,h){f=h&&h.screens||[];f[0]&&f[0].screenId==b?c(f[0].loungeToken):d(Error("Missing lounge token in token response"))},
onError:function(){d(Error("Request screen lounge token failed"))}};
g.Yt(Q7(a.C,"/pairing/get_lounge_token_batch"),e)},UUa=function(a){a.screens=a.u.Fh();
var b=a.D,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: "+X6(a.screens))},PUa=function(a){i8(a);
a.u=new $7(a.C);a.u.subscribe("screenChange",(0,g.D)(a.pS,a));UUa(a);a.K||(a.B=DTa(g.Ay("yt-remote-automatic-screen-cache")||[]));i8(a);a.info("Initializing automatic screens: "+X6(a.B));a.i=new c8(a.C,(0,g.D)(a.Fh,a,!0));a.i.subscribe("screenChange",(0,g.D)(function(){this.ea("onlineScreenChange")},a))},h8=function(a,b){var c=a.get(b.id);
c?(c.uuid=b.uuid,b=c):((c=$6(a.B,b.uuid))?(c.id=b.id,c.token=b.token,b=c):a.B.push(b),a.K||VUa(a));i8(a);a.D[b.uuid]=b.id;g.zy("yt-remote-device-id-map",a.D,31536E3);return b},VUa=function(a){a=g.ap(a.B,function(b){return"shortLived"!=b.idType});
g.zy("yt-remote-automatic-screen-cache",g.Mm(a,BTa))},i8=function(a){a.D=g.Ay("yt-remote-device-id-map")||{}},j8=function(a,b,c){g.Q.call(this);
this.Ba=c;this.B=a;this.i=b;this.C=null},k8=function(a,b){a.C=b;
a.ea("sessionScreen",a.C)},WUa=function(a,b){a.C&&(a.C.token=b,h8(a.B,a.C));
a.ea("sessionScreen",a.C)},l8=function(a,b){T7(a.Ba,b)},m8=function(a,b,c){j8.call(this,a,b,"CastSession");
var d=this;this.config_=c;this.u=null;this.oa=(0,g.D)(this.vQ,this);this.Aa=(0,g.D)(this.xW,this);this.Z=g.Qt(function(){XUa(d,null)},12E4);
this.K=this.D=this.I=this.S=0;this.va=!1;this.X="unknown"},n8=function(a,b){g.St(a.K);
a.K=0;0==b?YUa(a):a.K=g.Qt(function(){YUa(a)},b)},YUa=function(a){ZUa(a,"getLoungeToken");
g.St(a.D);a.D=g.Qt(function(){$Ua(a,null)},3E4)},ZUa=function(a,b){a.info("sendYoutubeMessage_: "+b+" "+g.ji(void 0));
var c={};c.type=b;a.u?a.u.sendMessage("urn:x-cast:com.google.youtube.mdx",c,g.Ia,(0,g.D)(function(){l8(this,"Failed to send message: "+b+".")},a)):l8(a,"Sending yt message without session: "+g.ji(c))},o8=function(a,b){b?(a.info("onConnectedScreenId_: Received screenId: "+b),a.getScreen()&&a.getScreen().id==b||a.zK(b,function(c){k8(a,c)},function(){return a.yg()},5)):a.yg(Error("Waiting for session status timed out."))},bVa=function(a,b,c){a.info("onConnectedScreenData_: Received screenData: "+JSON.stringify(b));
var d=new U6(b);aVa(a,d,function(e){e?(a.va=!0,h8(a.B,d),k8(a,d),a.X="unknown",n8(a,c)):(g.Zs(Error("CastSession, RemoteScreen from screenData: "+JSON.stringify(b)+" is not online.")),a.yg())},5)},XUa=function(a,b){g.St(a.Z);
a.Z=0;b?a.config_.enableCastLoungeToken&&b.loungeToken?b.deviceId?a.getScreen()&&a.getScreen().uuid==b.deviceId||(b.loungeTokenRefreshIntervalMs?bVa(a,{name:a.i.friendlyName,screenId:b.screenId,loungeToken:b.loungeToken,dialId:b.deviceId,screenIdType:"shortLived"},b.loungeTokenRefreshIntervalMs):(g.Zs(Error("No loungeTokenRefreshIntervalMs presents in mdxSessionStatusData: "+JSON.stringify(b)+".")),o8(a,b.screenId))):(g.Zs(Error("No device id presents in mdxSessionStatusData: "+JSON.stringify(b)+
".")),o8(a,b.screenId)):o8(a,b.screenId):a.yg(Error("Waiting for session status timed out."))},$Ua=function(a,b){g.St(a.D);
a.D=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.X=c,n8(a,3E4)):(WUa(a,b.loungeToken),a.va=!1,a.X="unknown",n8(a,b.loungeTokenRefreshIntervalMs))},aVa=function(a,b,c,d){g.St(a.I);
a.I=0;TUa(a.B,b,function(e){e||0>d?c(e):a.I=g.Qt(function(){aVa(a,b,c,d-1)},300)})},cVa=function(a){g.St(a.S);
a.S=0;g.St(a.I);a.I=0;g.St(a.Z);a.Z=0;g.St(a.D);a.D=0;g.St(a.K);a.K=0},p8=function(a,b,c,d){j8.call(this,a,b,"DialSession");
this.config_=d;this.u=this.S=null;this.Aa="";this.La=c;this.Ka=null;this.Z=g.Ia;this.X=NaN;this.Ha=(0,g.D)(this.wQ,this);this.D=g.Ia;this.K=this.I=0;this.oa=!1;this.va="unknown"},q8=function(a){var b;
return!!(a.config_.enableDialLoungeToken&&(null==(b=a.u)?0:b.getDialAppInfo))},dVa=function(a){a.D=a.B.jI(a.Aa,a.i.label,a.i.friendlyName,q8(a),function(b,c){a.D=g.Ia;
a.oa=!0;k8(a,b);"shortLived"==b.idType&&0<c&&r8(a,c)},function(b){a.D=g.Ia;
a.yg(b)})},eVa=function(a){var b={};
b.pairingCode=a.Aa;b.theme=a.La;OTa()&&(b.env_useStageMdx=1);return g.Ci(b)},s8=function(a){return new Promise(function(b){a.Aa=Y6();
if(a.Ka){var c=new chrome.cast.DialLaunchResponse(!0,eVa(a));b(c);dVa(a)}else a.Z=function(){g.St(a.X);a.Z=function(){};
a.X=NaN;var d=new chrome.cast.DialLaunchResponse(!0,eVa(a));b(d);dVa(a)},a.X=g.Qt(function(){a.Z()},100)})},gVa=function(a,b,c){a.info("initOnConnectedScreenDataPromise_: Received screenData: "+JSON.stringify(b));
var d=new U6(b);return(new Promise(function(e){fVa(a,d,function(f){f?(a.oa=!0,h8(a.B,d),k8(a,d),r8(a,c)):g.Zs(Error("DialSession, RemoteScreen from screenData: "+JSON.stringify(b)+" is not online."));e(f)},5)})).then(function(e){return e?new chrome.cast.DialLaunchResponse(!1):s8(a)})},hVa=function(a,b){var c=a.S.receiver.label,d=a.i.friendlyName;
return(new Promise(function(e){RUa(a.B,c,b,d,function(f){f&&f.token&&k8(a,f);e(f)},function(f){l8(a,"Failed to get DIAL screen: "+f);
e(null)})})).then(function(e){return e&&e.token?new chrome.cast.DialLaunchResponse(!1):s8(a)})},fVa=function(a,b,c,d){g.St(a.I);
a.I=0;TUa(a.B,b,function(e){e||0>d?c(e):a.I=g.Qt(function(){fVa(a,b,c,d-1)},300)})},r8=function(a,b){a.info("getDialAppInfoWithTimeout_ "+b);
q8(a)&&(g.St(a.K),a.K=0,0==b?iVa(a):a.K=g.Qt(function(){iVa(a)},b))},iVa=function(a){q8(a)&&a.u.getDialAppInfo(function(b){a.info("getDialAppInfo dialLaunchData: "+JSON.stringify(b));
b=b.extraData||{};var c=null;if(b.loungeToken){var d;(null==(d=a.getScreen())?void 0:d.token)==b.loungeToken&&(c="staleLoungeToken")}else c="missingLoungeToken";c?(a.va=c,r8(a,3E4)):(a.oa=!1,a.va="unknown",WUa(a,b.loungeToken),r8(a,b.loungeTokenRefreshIntervalMs))},function(b){a.info("getDialAppInfo error: "+b);
a.va="noLoungeTokenResponse";r8(a,3E4)})},jVa=function(a){g.St(a.I);
a.I=0;g.St(a.K);a.K=0;a.D();a.D=function(){};
g.St(a.X)},t8=function(a,b){j8.call(this,a,b,"ManualSession");
this.u=g.Qt((0,g.D)(this.Qs,this,null),150)},u8=function(a,b){g.Q.call(this);
this.config_=b;this.u=a;this.S=b.appId||"233637DE";this.C=b.theme||"cl";this.X=b.disableCastApi||!1;this.I=b.forceMirroring||!1;this.i=null;this.K=!1;this.B=[];this.D=(0,g.D)(this.qV,this)},kVa=function(a,b){return b?g.Mb(a.B,function(c){return V6(b,c.label)},a):null},v8=function(a){T7("Controller",a)},CUa=function(a){window.chrome&&chrome.cast&&chrome.cast.logMessage&&chrome.cast.logMessage(a)},w8=function(a){return a.K||!!a.B.length||!!a.i},x8=function(a,b,c){b!=a.i&&(g.ee(a.i),(a.i=b)?(c?a.ea("yt-remote-cast2-receiver-resumed",
b.i):a.ea("yt-remote-cast2-receiver-selected",b.i),b.subscribe("sessionScreen",(0,g.D)(a.QM,a,b)),b.subscribe("sessionFailed",function(){return lVa(a,b)}),b.getScreen()?a.ea("yt-remote-cast2-session-change",b.getScreen()):c&&a.i.Qs(null)):a.ea("yt-remote-cast2-session-change",null))},lVa=function(a,b){a.i==b&&a.ea("yt-remote-cast2-session-failed")},mVa=function(a){var b=a.u.iI(),c=a.i&&a.i.i;
a=g.Mm(b,function(d){c&&V6(d,c.label)&&(c=null);var e=d.uuid?d.uuid:d.id,f=kVa(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},rVa=function(a,b,c,d){d.disableCastApi?y8("Cannot initialize because disabled by Mdx config."):nVa()?oVa(b,d)&&(z8(!0),window.chrome&&chrome.cast&&chrome.cast.isAvailable?pVa(a,c):(window.__onGCastApiAvailable=function(e,f){e?pVa(a,c):(A8("Failed to load cast API: "+f),B8(!1),z8(!1),g.By("yt-remote-cast-available"),g.By("yt-remote-cast-receiver"),
qVa(),c(!1))},d.loadCastApiSetupScript?g.Dy("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<=g7()&&VTa():!window.chrome||!window.navigator.presentation||0<=window.navigator.userAgent.indexOf("Edge")?i7():89<=g7()?XTa():(j7(),h7(WTa.map(STa))))):y8("Cannot initialize because not running Chrome")},qVa=function(){y8("dispose");
var a=C8();a&&a.dispose();g.Ga("yt.mdx.remote.cloudview.instance_",null,void 0);sVa(!1);g.Ev(D8);D8.length=0},E8=function(){return!!g.Ay("yt-remote-cast-installed")},tVa=function(){var a=g.Ay("yt-remote-cast-receiver");
return a?a.friendlyName:null},uVa=function(){y8("clearCurrentReceiver");
g.By("yt-remote-cast-receiver")},vVa=function(){return E8()?C8()?C8().getCastSession():(A8("getCastSelector: Cast is not initialized."),null):(A8("getCastSelector: Cast API is not installed!"),null)},G8=function(){E8()?C8()?F8()?(y8("Requesting cast selector."),C8().requestSession()):(y8("Wait for cast API to be ready to request the session."),D8.push(g.Dv("yt-remote-cast2-api-ready",G8))):A8("requestCastSelector: Cast is not initialized."):A8("requestCastSelector: Cast API is not installed!")},H8=
function(a,b){F8()?C8().setConnectedScreenStatus(a,b):A8("setConnectedScreenStatus called before ready.")},nVa=function(){var a=0<=g.Ab.search(/ (CrMo|Chrome|CriOS)\//);
return g.lj||a},wVa=function(a,b){C8().init(a,b)},oVa=function(a,b){var c=!1;
C8()||(a=new u8(a,b),a.subscribe("yt-remote-cast2-availability-change",function(d){g.zy("yt-remote-cast-available",d);S6("yt-remote-cast2-availability-change",d)}),a.subscribe("yt-remote-cast2-receiver-selected",function(d){y8("onReceiverSelected: "+d.friendlyName);
g.zy("yt-remote-cast-receiver",d);S6("yt-remote-cast2-receiver-selected",d)}),a.subscribe("yt-remote-cast2-receiver-resumed",function(d){y8("onReceiverResumed: "+d.friendlyName);
g.zy("yt-remote-cast-receiver",d);S6("yt-remote-cast2-receiver-resumed",d)}),a.subscribe("yt-remote-cast2-session-change",function(d){y8("onSessionChange: "+W6(d));
d||g.By("yt-remote-cast-receiver");S6("yt-remote-cast2-session-change",d)}),g.Ga("yt.mdx.remote.cloudview.instance_",a,void 0),c=!0);
y8("cloudview.createSingleton_: "+c);return c},C8=function(){return g.Ha("yt.mdx.remote.cloudview.instance_")},pVa=function(a,b){B8(!0);
z8(!1);wVa(a,function(c){c?(sVa(!0),g.Fv("yt-remote-cast2-api-ready")):(A8("Failed to initialize cast API."),B8(!1),g.By("yt-remote-cast-available"),g.By("yt-remote-cast-receiver"),qVa());b(c)})},y8=function(a){T7("cloudview",a)},A8=function(a){T7("cloudview",a)},B8=function(a){y8("setCastInstalled_ "+a);
g.zy("yt-remote-cast-installed",a)},F8=function(){return!!g.Ha("yt.mdx.remote.cloudview.apiReady_")},sVa=function(a){y8("setApiReady_ "+a);
g.Ga("yt.mdx.remote.cloudview.apiReady_",a,void 0)},z8=function(a){g.Ga("yt.mdx.remote.cloudview.initializing_",a,void 0)},I8=function(a){this.index=-1;
this.videoId=this.listId="";this.volume=this.playerState=-1;this.muted=!1;this.audioTrackId=null;this.I=this.K=0;this.trackData=null;this.hasNext=this.Hk=!1;this.S=this.D=this.i=this.C=0;this.B=NaN;this.u=!1;this.reset(a)},J8=function(a){a.audioTrackId=null;
a.trackData=null;a.playerState=-1;a.Hk=!1;a.hasNext=!1;a.K=0;a.I=g.Sa();a.C=0;a.i=0;a.D=0;a.S=0;a.B=NaN;a.u=!1},K8=function(a){return a.Ec()?(g.Sa()-a.I)/1E3:0},L8=function(a,b){a.K=b;
a.I=g.Sa()},M8=function(a){switch(a.playerState){case 1:case 1081:return(g.Sa()-a.I)/1E3+a.K;
case -1E3:return 0}return a.K},N8=function(a,b,c){var d=a.videoId;
a.videoId=b;a.index=c;b!=d&&J8(a)},O8=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.Ke(a.trackData);b.hasPrevious=a.Hk;b.hasNext=a.hasNext;b.playerTime=a.K;b.playerTimeAt=a.I;b.seekableStart=a.C;b.seekableEnd=a.i;b.duration=a.D;b.loadedTime=a.S;b.liveIngestionTime=a.B;return b},Q8=function(a,b){g.Q.call(this);
this.B=0;this.C=a;this.I=[];this.D=new yUa;this.u=this.i=null;this.X=(0,g.D)(this.ZT,this);this.K=(0,g.D)(this.zw,this);this.S=(0,g.D)(this.XT,this);this.Z=(0,g.D)(this.gU,this);var c=0;a?(c=a.getProxyState(),3!=c&&(a.subscribe("proxyStateChange",this.pG,this),xVa(this))):c=3;0!=c&&(b?this.pG(c):g.Qt((0,g.D)(function(){this.pG(c)},this),0));
(a=vVa())&&P8(this,a);this.subscribe("yt-remote-cast2-session-change",this.Z)},R8=function(a){return new I8(a.C.getPlayerContextData())},xVa=function(a){g.jc("nowAutoplaying autoplayDismissed remotePlayerChange remoteQueueChange autoplayModeChange autoplayUpNext previousNextChange multiStateLoopEnabled loopModeChange".split(" "),function(b){this.I.push(this.C.subscribe(b,g.Ra(this.oV,b),this))},a)},yVa=function(a){g.jc(a.I,function(b){this.C.unsubscribeByKey(b)},a);
a.I.length=0},S8=function(a){return 1==a.getState()},T8=function(a,b){var c=a.D;
50>c.i.length+c.u.length&&a.D.u.push(b)},V8=function(a,b,c){var d=R8(a);
L8(d,c);-1E3!=d.playerState&&(d.playerState=b);U8(a,d)},W8=function(a,b,c){a.C.sendMessage(b,c)},U8=function(a,b){yVa(a);
a.C.setPlayerContextData(O8(b));xVa(a)},P8=function(a,b){a.u&&(a.u.removeUpdateListener(a.X),a.u.removeMediaListener(a.K),a.zw(null));
a.u=b;a.u&&(T7("CP","Setting cast session: "+a.u.sessionId),a.u.addUpdateListener(a.X),a.u.addMediaListener(a.K),a.u.media.length&&a.zw(a.u.media[0]))},zVa=function(a){var b=a.i.media,c=a.i.customData;
if(b&&c){var d=R8(a);b.contentId!=d.videoId&&T7("CP","Cast changing video to: "+b.contentId);d.videoId=b.contentId;d.playerState=c.playerState;L8(d,a.i.getEstimatedTime());U8(a,d)}else T7("CP","No cast media video. Ignoring state update.")},X8=function(a,b,c){return(0,g.D)(function(d){this.je("Failed to "+b+" with cast v2 channel. Error code: "+d.code);
d.code!=chrome.cast.ErrorCode.TIMEOUT&&(this.je("Retrying "+b+" using MDx browser channel."),W8(this,b,c))},a)},Y8=function(a,b,c,d){d=void 0===d?!1:d;
g.Q.call(this);this.D=NaN;this.va=!1;this.S=this.K=this.Z=this.oa=NaN;this.X=[];this.C=this.I=this.B=this.kc=this.i=null;this.Ha=a;this.Ba=d;this.X.push(g.Wu(window,"beforeunload",(0,g.D)(this.bS,this)));this.u=[];this.kc=new I8;this.Ka=b.id;this.Aa=b.idType;this.i=AVa(this,c);this.i.subscribe("handlerOpened",this.dU,this);this.i.subscribe("handlerClosed",this.aU,this);this.i.subscribe("handlerError",this.bU,this);this.i.subscribe("handlerMessage",this.cU,this);this.i.XA(b.token);this.subscribe("remoteQueueChange",
function(){var e=this.kc.videoId;g.Cy()&&g.zy("yt-remote-session-video-id",e)},this)},BVa=function(a){return g.Mb(a.u,function(b){return"LOUNGE_SCREEN"==b.type})},Z8=function(a){T7("conn",a)},AVa=function(a,b){return new M7(Q7(a.Ha,"/bc"),b,!1,function(){return a.nI()},"shortLived"==a.Aa)},$8=function(a,b){a.ea("proxyStateChange",b)},CVa=function(a){a.D=g.Qt((0,g.D)(function(){Z8("Connecting timeout");
this.Zr(1)},a),2E4)},a9=function(a){g.St(a.D);
a.D=NaN},b9=function(a){g.St(a.oa);
a.oa=NaN},DVa=function(a){c9(a);
a.Z=g.Qt((0,g.D)(function(){d9(this,"getNowPlaying")},a),2E4)},c9=function(a){g.St(a.Z);
a.Z=NaN},FVa=function(a,b){var c=null;
if(b){var d=BVa(a);d&&(c={clientName:d.clientName,deviceMake:d.brand,deviceModel:d.model,osVersion:d.osVersion})}g.Ga("yt.mdx.remote.remoteClient_",c,void 0);b&&(a9(a),b9(a));c=O7(a.i)&&isNaN(a.D);b==c?b&&($8(a,1),d9(a,"getSubtitlesTrack")):b?(a.yK()&&a.kc.reset(),$8(a,1),d9(a,"getNowPlaying"),EVa(a)):a.Zr(1)},GVa=function(a,b){var c=b.params.videoId;
delete b.params.videoId;c==a.kc.videoId&&(g.De(b.params)?a.kc.trackData=null:a.kc.trackData=b.params,a.ea("remotePlayerChange"))},HVa=function(a,b,c){var d=b.params.videoId||b.params.video_id,e=parseInt(b.params.currentIndex,10);
a.kc.listId=b.params.listId||a.kc.listId;N8(a.kc,d,e);a.ea("remoteQueueChange",c)},JVa=function(a,b){b.params=b.params||{};
HVa(a,b,"NOW_PLAYING_MAY_CHANGE");IVa(a,b);a.ea("autoplayDismissed")},IVa=function(a,b){var c=parseInt(b.params.currentTime||b.params.current_time,10);
L8(a.kc,isNaN(c)?0:c);c=parseInt(b.params.state,10);c=isNaN(c)?-1:c;-1==c&&-1E3==a.kc.playerState&&(c=-1E3);a.kc.playerState=c;c=Number(b.params.loadedTime);a.kc.S=isNaN(c)?0:c;a.kc.Ij(Number(b.params.duration));c=a.kc;var d=Number(b.params.liveIngestionTime);c.B=d;c.u=isNaN(d)?!1:!0;c=a.kc;d=Number(b.params.seekableStartTime);b=Number(b.params.seekableEndTime);c.C=isNaN(d)?0:d;c.i=isNaN(b)?0:b;1==a.kc.playerState?DVa(a):c9(a);a.ea("remotePlayerChange")},KVa=function(a,b){if(-1E3!=a.kc.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.kc.playerState=c;b=parseInt(b.params.currentTime,10);L8(a.kc,isNaN(b)?0:b);a.ea("remotePlayerChange")}},LVa=function(a,b){var c="true"==b.params.muted;
a.kc.volume=parseInt(b.params.volume,10);a.kc.muted=c;a.ea("remotePlayerChange")},MVa=function(a,b){a.I=b.params.videoId;
a.ea("nowAutoplaying",parseInt(b.params.timeout,10))},NVa=function(a,b){var c="true"==b.params.hasNext;
a.kc.Hk="true"==b.params.hasPrevious;a.kc.hasNext=c;a.ea("previousNextChange")},EVa=function(a){g.St(a.S);
a.S=g.Qt((0,g.D)(a.Zr,a,1),864E5)},d9=function(a,b,c){c?Z8("Sending: action="+b+", params="+g.ji(c)):Z8("Sending: action="+b);
a.i.sendMessage(b,c)},e9=function(a){X7.call(this,"ScreenServiceProxy");
this.Re=a;this.i=[];this.i.push(this.Re.$_s("screenChange",(0,g.D)(this.AQ,this)));this.i.push(this.Re.$_s("onlineScreenChange",(0,g.D)(this.VU,this)))},RVa=function(a,b){NTa();
if(!f7||!f7.get("yt-remote-disable-remote-module-for-dev")){b=g.N("MDX_CONFIG")||b;FTa();d7();f9||(f9=new P7(b?b.loungeApiHost:void 0),OTa()&&(f9.i="/api/loungedev"));g9||(g9=g.Ha("yt.mdx.remote.deferredProxies_")||[],g.Ga("yt.mdx.remote.deferredProxies_",g9,void 0));OVa();var c=h9();if(!c){var d=new g8(f9,b?b.disableAutomaticScreenCache||!1:!1);g.Ga("yt.mdx.remote.screenService_",d,void 0);c=h9();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,forceMirroring:b.forceMirroring});g.Ga("yt.mdx.remote.enableConnectWithInitialState_",b?b.enableConnectWithInitialState||!1:!1,void 0);rVa(a,d,function(f){f?i9()&&H8(i9(),"YouTube TV"):d.subscribe("onlineScreenChange",function(){S6("yt-remote-receiver-availability-change")})},e)}b&&!g.Ha("yt.mdx.remote.initialized_")&&(g.Ga("yt.mdx.remote.initialized_",!0,void 0),j9("Initializing: "+
g.ji(b)),k9.push(g.Dv("yt-remote-cast2-api-ready",function(){S6("yt-remote-api-ready")})),k9.push(g.Dv("yt-remote-cast2-availability-change",function(){S6("yt-remote-receiver-availability-change")})),k9.push(g.Dv("yt-remote-cast2-receiver-selected",function(){l9(null);
S6("yt-remote-auto-connect","cast-selector-receiver")})),k9.push(g.Dv("yt-remote-cast2-receiver-resumed",function(){S6("yt-remote-receiver-resumed","cast-selector-receiver")})),k9.push(g.Dv("yt-remote-cast2-session-change",PVa)),k9.push(g.Dv("yt-remote-connection-change",function(f){f?H8(i9(),"YouTube TV"):m9()||(H8(null,null),uVa())})),k9.push(g.Dv("yt-remote-cast2-session-failed",function(){S6("yt-remote-connection-failed")})),a=n9(),b.isAuto&&(a.id+="#dial"),e=b.capabilities||[],g.O("desktop_enable_autoplay")&&
e.push("atp"),0<e.length&&(a.capabilities=e),a.name=b.device,a.app=b.app,(b=b.theme)&&(a.theme=b),j9(" -- with channel params: "+g.ji(a)),a?(g.zy("yt-remote-session-app",a.app),g.zy("yt-remote-session-name",a.name)):(g.By("yt-remote-session-app"),g.By("yt-remote-session-name")),g.Ga("yt.mdx.remote.channelParams_",a,void 0),c.start(),i9()||QVa())}},SVa=function(){var a=h9().Re.$_gos();
var b=o9();b&&p9()&&(Z6(a,b)||a.push(b));return ETa(a)},q9=function(){var a=TVa();
!a&&E8()&&tVa()&&(a={key:"cast-selector-receiver",name:tVa()});return a},TVa=function(){var a=SVa(),b=o9();
b||(b=m9());return g.Mb(a,function(c){return b&&V6(b,c.key)?!0:!1})},o9=function(){var a=i9();
if(!a)return null;var b=h9().Fh();return $6(b,a)},PVa=function(a){j9("remote.onCastSessionChange_: "+W6(a));
if(a){var b=o9();if(b&&b.id==a.id){if(H8(b.id,"YouTube TV"),"shortLived"==a.idType&&(a=a.token))r9&&(r9.token=a),(b=p9())&&b.XA(a)}else b&&s9(),t9(a,1)}else p9()&&s9()},s9=function(){F8()?C8().stopSession():A8("stopSession called before API ready.");
var a=p9();a&&(a.disconnect(1),u9(null))},v9=function(){var a=p9();
return!!a&&3!=a.getProxyState()},j9=function(a){T7("remote",a)},h9=function(){if(!w9){var a=g.Ha("yt.mdx.remote.screenService_");
w9=a?new e9(a):null}return w9},i9=function(){return g.Ha("yt.mdx.remote.currentScreenId_")},UVa=function(a){g.Ga("yt.mdx.remote.currentScreenId_",a,void 0)},VVa=function(){return g.Ha("yt.mdx.remote.connectData_")},l9=function(a){g.Ga("yt.mdx.remote.connectData_",a,void 0)},p9=function(){return g.Ha("yt.mdx.remote.connection_")},u9=function(a){var b=p9();
l9(null);a||UVa("");g.Ga("yt.mdx.remote.connection_",a,void 0);g9&&(g.jc(g9,function(c){c(a)}),g9.length=0);
b&&!a?S6("yt-remote-connection-change",!1):!b&&a&&S6("yt-remote-connection-change",!0)},m9=function(){var a=g.Cy();
if(!a)return null;var b=h9();if(!b)return null;b=b.Fh();return $6(b,a)},t9=function(a,b){i9();
o9()&&o9();if(x9)r9=a;else{UVa(a.id);var c=g.Ha("yt.mdx.remote.enableConnectWithInitialState_")||!1;a=new Y8(f9,a,n9(),c);a.connect(b,VVa());a.subscribe("beforeDisconnect",function(d){S6("yt-remote-before-disconnect",d)});
a.subscribe("beforeDispose",function(){p9()&&(p9(),u9(null))});
a.subscribe("browserChannelAuthError",function(){var d=o9();d&&"shortLived"==d.idType&&(F8()?C8().handleBrowserChannelAuthError():A8("refreshLoungeToken called before API ready."))});
u9(a)}},QVa=function(){var a=m9();
a?(j9("Resume connection to: "+W6(a)),t9(a,0)):(e7(),uVa(),j9("Skipping connecting because no session screen found."))},OVa=function(){var a=n9();
if(g.De(a)){a=c7();var b=g.Ay("yt-remote-session-name")||"",c=g.Ay("yt-remote-session-app")||"";a={device:"REMOTE_CONTROL",id:a,name:b,app:c,mdxVersion:3};g.Ga("yt.mdx.remote.channelParams_",a,void 0)}},n9=function(){return g.Ha("yt.mdx.remote.channelParams_")||{}},y9=function(a,b,c){g.E.call(this);
var d=this;this.u=a;this.J=b;this.Tb=c;this.events=new g.WC(this);this.Z=this.events.T(this.J,"onVolumeChange",function(e){WVa(d,e)});
this.D=!1;this.I=new g.CJ(64);this.i=new g.I(this.UN,500,this);this.B=new g.I(this.VN,1E3,this);this.S=new k7(this.MX,0,this);this.C={};this.X=new g.I(this.DO,1E3,this);this.K=new l7(this.seekTo,1E3,this);this.oa=g.Ia;g.H(this,this.events);this.events.T(b,"onCaptionsTrackListChanged",this.GU);this.events.T(b,"captionschanged",this.UT);this.events.T(b,"captionssettingschanged",this.bO);this.events.T(b,"videoplayerreset",this.qA);this.events.T(b,"mdxautoplaycancel",function(){d.Tb.VJ()});
a=this.Tb;a.isDisposed();a.subscribe("proxyStateChange",this.LM,this);a.subscribe("remotePlayerChange",this.Ew,this);a.subscribe("remoteQueueChange",this.qA,this);a.subscribe("previousNextChange",this.IM,this);a.subscribe("nowAutoplaying",this.CM,this);a.subscribe("autoplayDismissed",this.fM,this);g.H(this,this.i);g.H(this,this.B);g.H(this,this.S);g.H(this,this.X);g.H(this,this.K);this.bO();this.qA();this.Ew()},WVa=function(a,b){if(z9(a)){a.Tb.unsubscribe("remotePlayerChange",a.Ew,a);
var c=Math.round(b.volume);b=!!b.muted;var d=R8(a.Tb);if(c!==d.volume||b!==d.muted)a.Tb.setVolume(c,b),a.X.start();a.Tb.subscribe("remotePlayerChange",a.Ew,a)}},XVa=function(a){a.Xb(0);
a.i.stop();a.Ub(new g.CJ(64))},A9=function(a,b){if(z9(a)&&!a.D){var c=null;
b&&(c={style:a.J.getSubtitlesUserSettings()},g.Me(c,b));a.Tb.mI(a.J.getVideoData(1).videoId,c);a.C=R8(a.Tb).trackData}},B9=function(a,b){var c=a.J.getPlaylist();
if(null===c||void 0===c?0:c.listId){var d=c.index;var e=c.listId.toString()}c=a.J.getVideoData(1);a.Tb.playVideo(c.videoId,b,d,e,c.playerParams,c.Za,uTa(c));a.Ub(new g.CJ(1))},YVa=function(a,b){if(b){var c=a.J.getOption("captions","tracklist",{WK:1});
c&&c.length?(a.J.setOption("captions","track",b),a.D=!1):(a.J.loadModule("captions"),a.D=!0)}else a.J.setOption("captions","track",{})},z9=function(a){return R8(a.Tb).videoId===a.J.getVideoData(1).videoId},C9=function(){g.X.call(this,{G:"div",
L:"ytp-mdx-popup-dialog",W:{role:"dialog"},U:[{G:"div",L:"ytp-mdx-popup-dialog-inner-content",U:[{G:"div",L:"ytp-mdx-popup-title",ya:"\u0412\u044b \u0432\u044b\u0448\u043b\u0438 \u0438\u0437 \u0430\u043a\u043a\u0430\u0443\u043d\u0442\u0430"},{G:"div",L:"ytp-mdx-popup-description",ya:'\u0420\u043e\u043b\u0438\u043a\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0432\u044b \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u0442\u0435, \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u044b \u0432 \u0438\u0441\u0442\u043e\u0440\u0438\u044e \u043f\u0440\u043e\u0441\u043c\u043e\u0442\u0440\u0430 \u043d\u0430 \u0442\u0435\u043b\u0435\u0432\u0438\u0437\u043e\u0440\u0435, \u0447\u0442\u043e \u0441\u043a\u0430\u0436\u0435\u0442\u0441\u044f \u043d\u0430 \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0430\u0446\u0438\u044f\u0445. \u0427\u0442\u043e\u0431\u044b \u044d\u0442\u043e\u0433\u043e \u0438\u0437\u0431\u0435\u0436\u0430\u0442\u044c, \u0432\u044b\u0431\u0435\u0440\u0438\u0442\u0435 "\u041e\u0442\u043c\u0435\u043d\u0430" \u0438 \u0432\u043e\u0439\u0434\u0438\u0442\u0435 \u0432 \u0430\u043a\u043a\u0430\u0443\u043d\u0442 \u043d\u0430 \u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440\u0435.'},
{G:"div",L:"ytp-mdx-privacy-popup-buttons",U:[{G:"button",Ga:["ytp-button","ytp-mdx-privacy-popup-cancel"],ya:"\u041e\u0442\u043c\u0435\u043d\u0430"},{G:"button",Ga:["ytp-button","ytp-mdx-privacy-popup-confirm"],ya:"\u041e\u041a"}]}]}]});this.i=new g.hL(this,250);this.cancelButton=this.Fa("ytp-mdx-privacy-popup-cancel");this.confirmButton=this.Fa("ytp-mdx-privacy-popup-confirm");g.H(this,this.i);this.T(this.cancelButton,"click",this.u);this.T(this.confirmButton,"click",this.B)},D9=function(a){g.X.call(this,
{G:"div",
L:"ytp-remote",U:[{G:"div",L:"ytp-remote-display-status",U:[{G:"div",L:"ytp-remote-display-status-icon",U:[g.hua()]},{G:"div",L:"ytp-remote-display-status-text",ya:"{{statustext}}"}]}]});this.api=a;this.i=new g.hL(this,250);g.H(this,this.i);this.T(a,"presentingplayerstatechange",this.onStateChange);ZVa(this,a.zb())},ZVa=function(a,b){if(3===a.api.getPresentingPlayerType()){var c={RECEIVER_NAME:a.api.getOption("remote","currentReceiver").name};
b=g.T(b,128)?g.$H('\u041e\u0448\u0438\u0431\u043a\u0430 \u043d\u0430 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0435 "$RECEIVER_NAME"',c):b.Ec()||g.T(b,4)?g.$H('\u0412\u043e\u0441\u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u043d\u0430 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0435 "$RECEIVER_NAME"',c):g.$H('\u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u043e \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u043a \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0443 "$RECEIVER_NAME"',
c);a.Ra("statustext",b);a.i.show()}else a.i.hide()},E9=function(a,b){g.BP.call(this,"\u0412\u044b\u0431\u0435\u0440\u0438\u0442\u0435 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u043e \u0434\u043b\u044f \u043f\u0440\u043e\u0441\u043c\u043e\u0442\u0440\u0430",0,a,b);
this.J=a;this.Co={};this.T(a,"onMdxReceiversChange",this.D);this.T(a,"presentingplayerstatechange",this.D);this.D()},F9=function(a){g.LM.call(this,a);
this.Ok={key:Y6(),name:"\u042d\u0442\u043e\u0442 \u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440"};this.Zh=null;this.subscriptions=[];this.OF=this.Tb=null;this.Co=[this.Ok];this.dn=this.Ok;this.Ad=new g.CJ(64);this.xL=0;this.vf=-1;this.Mw=!1;this.Kw=this.qt=null;if(!g.FE(this.player.V())&&!g.GE(this.player.V())){a=this.player;var b=g.oM(a);b&&(b=b.Fn())&&(b=new E9(a,b),g.H(this,b));b=new D9(a);g.H(this,b);g.yM(a,b.element,4);this.qt=new C9;g.H(this,this.qt);g.yM(a,this.qt.element,4);this.Mw=
!!m9()}},G9=function(a){a.Kw&&(a.player.removeEventListener("presentingplayerstatechange",a.Kw),a.Kw=null)},$Va=function(a,b,c){a.Ad=c;
a.player.ea("presentingplayerstatechange",new g.vH(c,b))},H9=function(a,b){if(b.key!==a.dn.key)if(b.key===a.Ok.key)s9();
else{var c;(c=!a.player.V().N("mdx_enable_privacy_disclosure_ui"))||(c=((c=g.N("PLAYER_CONFIG"))&&c.args&&void 0!==c.args.authuser?!0:!(!g.N("SESSION_INDEX")&&!g.N("LOGGED_IN")))||a.Mw||!a.qt);(c?0:g.WE(a.player.V())||g.ZE(a.player.V()))&&aWa(a);a.dn=b;if(!a.player.V().N("disable_mdx_connection_in_mdx_module_for_music_web")||!g.GE(a.player.V())){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())&&a.player.V().N("should_clear_video_data_on_player_cued_unstarted"))a=
null;else{var f=a.player.getPlaylist();if(f){var h=[];for(var l=0;l<f.length;l++)h[l]=g.FM(f,l).videoId}else h=[e];f=a.player.getCurrentTime(1);a={videoIds:h,listId:d,videoId:e,playerParams:c.playerParams,clickTrackingParams:c.Za,index:Math.max(a.player.getPlaylistIndex(),0),currentTime:0===f?void 0:f};(c=uTa(c))&&(a.locationInfo=c)}j9("Connecting to: "+g.ji(b));"cast-selector-receiver"==b.key?(l9(a||null),b=a||null,F8()?C8().setLaunchParams(b):A8("setLaunchParams called before ready.")):!a&&v9()&&
i9()==b.key?S6("yt-remote-connection-change",!0):(s9(),l9(a||null),a=h9().Fh(),(b=$6(a,b.key))&&t9(b,1))}}},aWa=function(a){a.player.zb().Ec()?a.player.pauseVideo():(a.Kw=function(b){!a.Mw&&g.xH(b,8)&&(a.player.pauseVideo(),G9(a))},a.player.addEventListener("presentingplayerstatechange",a.Kw));
a.qt&&a.qt.zd();p9()||(x9=!0)},cUa={"\x00":"\\0",
"\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r","\t":"\\t","\x0B":"\\x0B",'"':'\\"',"\\":"\\\\","<":"\\u003C"},x7={"'":"\\'"},ATa={kZ:"atp",H$:"ska",s9:"que",j7:"mus",G$:"sus",j3:"dsp",O9:"seq",M6:"mic",W1:"dpa",zZ:"cds",h7:"mlm",U1:"dsdtr"},f7,b7="",UTa=PTa("loadCastFramework")||PTa("loadCastApplicationFramework"),WTa=["pkedcjkdefgpdelpbcmbmeomcjbeemfm","enhhojjnijigcajfphajepfemndkmdlo"];/*

 Copyright The Closure Library Authors.
 SPDX-License-Identifier: Apache-2.0
*/
g.Ta(k7,g.E);g.k=k7.prototype;g.k.oQ=function(a){this.C=arguments;this.i=!1;this.Mb?this.B=g.Sa()+this.Uf:this.Mb=g.Hh(this.D,this.Uf)};
g.k.stop=function(){this.Mb&&(g.B.clearTimeout(this.Mb),this.Mb=null);this.B=null;this.i=!1;this.C=[]};
g.k.pause=function(){++this.u};
g.k.resume=function(){this.u&&(--this.u,!this.u&&this.i&&(this.i=!1,this.I.apply(null,this.C)))};
g.k.xa=function(){this.stop();k7.ge.xa.call(this)};
g.k.pQ=function(){this.Mb&&(g.B.clearTimeout(this.Mb),this.Mb=null);this.B?(this.Mb=g.Hh(this.D,this.B-g.Sa()),this.B=null):this.u?this.i=!0:(this.i=!1,this.I.apply(null,this.C))};g.w(l7,g.E);g.k=l7.prototype;g.k.hI=function(a){this.B=arguments;this.Mb||this.u?this.i=!0:m7(this)};
g.k.stop=function(){this.Mb&&(g.B.clearTimeout(this.Mb),this.Mb=null,this.i=!1,this.B=null)};
g.k.pause=function(){this.u++};
g.k.resume=function(){this.u--;this.u||!this.i||this.Mb||(this.i=!1,m7(this))};
g.k.xa=function(){g.E.prototype.xa.call(this);this.stop()};n7.prototype.stringify=function(a){return g.B.JSON.stringify(a,void 0)};
n7.prototype.parse=function(a){return g.B.JSON.parse(a,void 0)};var p7=new g.ef;g.w(YTa,g.ie);g.k=r7.prototype;g.k.Vo=null;g.k.Fm=!1;g.k.Xt=null;g.k.hH=null;g.k.zt=null;g.k.Mt=null;g.k.Vm=null;g.k.Fo=null;g.k.wq=null;g.k.Kf=null;g.k.xB=0;g.k.Mj=null;g.k.vB=null;g.k.Om=null;g.k.Eu=-1;g.k.JN=!0;g.k.mp=!1;g.k.jC=0;g.k.LA=null;var aUa={},u7={};g.k=r7.prototype;g.k.setTimeout=function(a){this.u=a};
g.k.qQ=function(a){a=a.target;var b=this.LA;b&&3==g.Ri(a)?b.hI():this.LO(a)};
g.k.LO=function(a){try{if(a==this.Kf)a:{var b=g.Ri(this.Kf),c=this.Kf.u,d=this.Kf.getStatus();if(g.Cc&&!g.tc(10)||g.Ig&&!g.sc("420+")){if(4>b)break a}else if(3>b||3==b&&!g.Wi(this.Kf))break a;this.mp||4!=b||7==c||(8==c||0>=d?this.i.zj(3):this.i.zj(2));y7(this);var e=this.Kf.getStatus();this.Eu=e;var f=g.Wi(this.Kf);if(this.Fm=200==e){4==b&&v7(this);if(this.D){for(a=!0;!this.mp&&this.xB<f.length;){var h=bUa(this,f);if(h==u7){4==b&&(this.Om=4,q7(15),a=!1);break}else if(h==aUa){this.Om=4;q7(16);a=!1;
break}else z7(this,h)}4==b&&0==f.length&&(this.Om=1,q7(17),a=!1);this.Fm=this.Fm&&a;a||(v7(this),w7(this))}else z7(this,f);this.Fm&&!this.mp&&(4==b?this.i.Wx(this):(this.Fm=!1,t7(this)))}else 400==e&&0<f.indexOf("Unknown SID")?(this.Om=3,q7(13)):(this.Om=0,q7(14)),v7(this),w7(this)}}catch(l){this.Kf&&g.Wi(this.Kf)}finally{}};
g.k.mW=function(a){o7((0,g.D)(this.lW,this,a),0)};
g.k.lW=function(a){this.mp||(y7(this),z7(this,a),t7(this))};
g.k.UM=function(a){o7((0,g.D)(this.kW,this,a),0)};
g.k.kW=function(a){this.mp||(v7(this),this.Fm=a,this.i.Wx(this),this.i.zj(4))};
g.k.cancel=function(){this.mp=!0;v7(this)};
g.k.tW=function(){this.Xt=null;var a=Date.now();0<=a-this.hH?(2!=this.Mt&&this.i.zj(3),v7(this),this.Om=2,q7(18),w7(this)):eUa(this,this.hH-a)};
g.k.getLastError=function(){return this.Om};g.k=hUa.prototype;g.k.kC=null;g.k.ph=null;g.k.MA=!1;g.k.WN=null;g.k.Qy=null;g.k.ME=null;g.k.lC=null;g.k.Wh=null;g.k.ol=-1;g.k.Fu=null;g.k.Nu=null;g.k.connect=function(a){this.lC=a;a=B7(this.i,null,this.lC);q7(3);this.WN=Date.now();var b=this.i.S;null!=b?(this.Fu=b[0],(this.Nu=b[1])?(this.Wh=1,iUa(this)):(this.Wh=2,D7(this))):(P6(a,"MODE","init"),this.ph=new r7(this,void 0,void 0,void 0),this.ph.Vo=this.kC,s7(this.ph,a,!1,null,!0),this.Wh=0)};
g.k.iR=function(a){if(a)this.Wh=2,D7(this);else{q7(4);var b=this.i;b.Zj=b.Zm.ol;K7(b,9)}a&&this.zj(2)};
g.k.uD=function(a){return this.i.uD(a)};
g.k.abort=function(){this.ph&&(this.ph.cancel(),this.ph=null);this.ol=-1};
g.k.rf=function(){return!1};
g.k.MM=function(a,b){this.ol=a.Eu;if(0==this.Wh)if(b){try{var c=this.u.parse(b)}catch(d){a=this.i;a.Zj=this.ol;K7(a,2);return}this.Fu=c[0];this.Nu=c[1]}else a=this.i,a.Zj=this.ol,K7(a,2);else if(2==this.Wh)if(this.MA)q7(7),this.ME=Date.now();else if("11111"==b){if(q7(6),this.MA=!0,this.Qy=Date.now(),a=this.Qy-this.WN,!g.Cc||g.tc(10)||500>a)this.ol=200,this.ph.cancel(),q7(12),C7(this.i,this,!0)}else q7(8),this.Qy=this.ME=Date.now(),this.MA=!1};
g.k.Wx=function(){this.ol=this.ph.Eu;if(this.ph.Fm)0==this.Wh?this.Nu?(this.Wh=1,iUa(this)):(this.Wh=2,D7(this)):2==this.Wh&&((!g.Cc||g.tc(10)?!this.MA:200>this.ME-this.Qy)?(q7(11),C7(this.i,this,!1)):(q7(12),C7(this.i,this,!0)));else{0==this.Wh?q7(9):2==this.Wh&&q7(10);var a=this.i;this.ph.getLastError();a.Zj=this.ol;K7(a,2)}};
g.k.lx=function(){return this.i.lx()};
g.k.isActive=function(){return this.i.isActive()};
g.k.zj=function(a){this.i.zj(a)};g.k=E7.prototype;g.k.Yj=null;g.k.tv=null;g.k.Tg=null;g.k.He=null;g.k.mC=null;g.k.Ry=null;g.k.jJ=null;g.k.Xx=null;g.k.mw=0;g.k.mT=0;g.k.Lf=null;g.k.xn=null;g.k.El=null;g.k.yp=null;g.k.Zm=null;g.k.tB=null;g.k.Ps=-1;g.k.wL=-1;g.k.Zj=-1;g.k.ls=0;g.k.Mr=0;g.k.np=8;g.Ta(kUa,g.ie);g.Ta(lUa,g.ie);g.k=E7.prototype;g.k.connect=function(a,b,c,d,e){q7(0);this.mC=b;this.tv=c||{};d&&void 0!==e&&(this.tv.OSID=d,this.tv.OAID=e);this.I?(o7((0,g.D)(this.FJ,this,a),100),pUa(this)):this.FJ(a)};
g.k.FJ=function(a){this.Zm=new hUa(this);this.Zm.kC=this.Yj;this.Zm.u=this.D;this.Zm.connect(a)};
g.k.rf=function(){return 0==this.i};
g.k.getState=function(){return this.i};
g.k.SM=function(a){this.xn=null;tUa(this,a)};
g.k.RM=function(){this.El=null;this.He=new r7(this,this.B,"rpc",this.K);this.He.Vo=this.Yj;this.He.jC=0;var a=this.jJ.clone();g.Ck(a,"RID","rpc");g.Ck(a,"SID",this.B);g.Ck(a,"CI",this.tB?"0":"1");g.Ck(a,"AID",this.Ps);F7(this,a);if(!g.Cc||g.tc(10))g.Ck(a,"TYPE","xmlhttp"),s7(this.He,a,!0,this.Xx,!1);else{g.Ck(a,"TYPE","html");var b=this.He,c=!!this.Xx;b.Mt=3;b.Vm=O6(a.clone());dUa(b,c)}};
g.k.MM=function(a,b){if(0!=this.i&&(this.He==a||this.Tg==a))if(this.Zj=a.Eu,this.Tg==a&&3==this.i)if(7<this.np){try{var c=this.D.parse(b)}catch(d){c=null}if(Array.isArray(c)&&3==c.length)if(a=c,0==a[0])a:{if(!this.El){if(this.He)if(this.He.zt+3E3<this.Tg.zt)H7(this),this.He.cancel(),this.He=null;else break a;J7(this);q7(19)}}else this.wL=a[1],0<this.wL-this.Ps&&37500>a[2]&&this.tB&&0==this.Mr&&!this.yp&&(this.yp=o7((0,g.D)(this.RT,this),6E3));else K7(this,11)}else null!=b&&K7(this,11);else if(this.He==
a&&H7(this),!g.jb(b))for(a=this.D.parse(b),b=0;b<a.length;b++)c=a[b],this.Ps=c[0],c=c[1],2==this.i?"c"==c[0]?(this.B=c[1],this.Xx=c[2],c=c[3],null!=c?this.np=c:this.np=6,this.i=3,this.Lf&&this.Lf.BJ(),this.jJ=B7(this,this.lx()?this.Xx:null,this.mC),uUa(this)):"stop"==c[0]&&K7(this,7):3==this.i&&("stop"==c[0]?K7(this,7):"noop"!=c[0]&&this.Lf&&this.Lf.AJ(c),this.Mr=0)};
g.k.RT=function(){null!=this.yp&&(this.yp=null,this.He.cancel(),this.He=null,J7(this),q7(20))};
g.k.Wx=function(a){if(this.He==a){H7(this);this.He=null;var b=2}else if(this.Tg==a)this.Tg=null,b=1;else return;this.Zj=a.Eu;if(0!=this.i)if(a.Fm)if(1==b){b=Date.now()-a.zt;var c=p7;c.dispatchEvent(new kUa(c,a.wq?a.wq.length:0,b,this.ls));G7(this);this.C.length=0}else uUa(this);else{c=a.getLastError();var d;if(!(d=3==c||7==c||0==c&&0<this.Zj)){if(d=1==b)this.Tg||this.xn||1==this.i||2<=this.ls?d=!1:(this.xn=o7((0,g.D)(this.SM,this,a),vUa(this,this.ls)),this.ls++,d=!0);d=!(d||2==b&&J7(this))}if(d)switch(c){case 1:K7(this,
5);break;case 4:K7(this,10);break;case 3:K7(this,6);break;case 7:K7(this,12);break;default:K7(this,2)}}};
g.k.IR=function(a){if(!g.Qb(arguments,this.i))throw Error("Unexpected channel state: "+this.i);};
g.k.wX=function(a){a?q7(2):(q7(1),wUa(this,8))};
g.k.uD=function(a){if(a)throw Error("Can't create secondary domain capable XhrIo object.");a=new g.Li;a.S=!1;return a};
g.k.isActive=function(){return!!this.Lf&&this.Lf.isActive(this)};
g.k.zj=function(a){var b=p7;b.dispatchEvent(new lUa(b,a))};
g.k.lx=function(){return!(!g.Cc||g.tc(10))};
g.k=xUa.prototype;g.k.BJ=function(){};
g.k.AJ=function(){};
g.k.zJ=function(){};
g.k.hD=function(){};
g.k.mK=function(){return{}};
g.k.isActive=function(){return!0};g.k=yUa.prototype;g.k.isEmpty=function(){return 0===this.i.length&&0===this.u.length};
g.k.clear=function(){this.i=[];this.u=[]};
g.k.contains=function(a){return g.Qb(this.i,a)||g.Qb(this.u,a)};
g.k.remove=function(a){var b=this.i;var c=(0,g.ENa)(b,a);0<=c?(g.Tb(b,c),b=!0):b=!1;return b||g.Ub(this.u,a)};
g.k.Mp=function(){for(var a=[],b=this.i.length-1;0<=b;--b)a.push(this.i[b]);var c=this.u.length;for(b=0;b<c;++b)a.push(this.u[b]);return a};g.Ta(L7,g.E);g.k=L7.prototype;g.k.dW=function(){this.Uf=Math.min(3E5,2*this.Uf);this.B();this.u&&this.start()};
g.k.start=function(){var a=this.Uf+15E3*Math.random();g.br(this.i,a);this.u=Date.now()+a};
g.k.stop=function(){this.i.stop();this.u=0};
g.k.isActive=function(){return this.i.isActive()};
g.k.reset=function(){this.i.stop();this.Uf=5E3};g.Ta(M7,xUa);g.k=M7.prototype;g.k.subscribe=function(a,b,c){return this.B.subscribe(a,b,c)};
g.k.unsubscribe=function(a,b,c){return this.B.unsubscribe(a,b,c)};
g.k.cg=function(a){return this.B.cg(a)};
g.k.ea=function(a,b){return this.B.ea.apply(this.B,arguments)};
g.k.dispose=function(){this.Z||(this.Z=!0,g.ee(this.B),BUa(this),g.ee(this.u),this.u=null,this.oa=function(){return""})};
g.k.isDisposed=function(){return this.Z};
g.k.connect=function(a,b,c){if(!this.i||2!=this.i.getState()){this.X="";this.u.stop();this.D=a||null;this.C=b||0;a=this.va+"/test";b=this.va+"/bind";var d=new E7(c?c.firstTestResults:null,c?c.secondTestResults:null,this.Aa),e=this.i;e&&(e.Lf=null);d.Lf=this;this.i=d;N7(this);if(this.i){d=g.N("ID_TOKEN");var f=this.i.Yj||{};d?f["x-youtube-identity-token"]=d:delete f["x-youtube-identity-token"];this.i.Yj=f}e?(3!=e.getState()&&0==rUa(e)||e.getState(),this.i.connect(a,b,this.I,e.B,e.Ps)):c?this.i.connect(a,
b,this.I,c.sessionId,c.arrayId):this.i.connect(a,b,this.I)}};
g.k.sendMessage=function(a,b){a={_sc:a};b&&g.Me(a,b);this.u.isActive()||2==(this.i?this.i.getState():0)?this.K.push(a):O7(this)&&(N7(this),qUa(this.i,a))};
g.k.BJ=function(){this.u.reset();this.D=null;this.C=0;if(this.K.length){var a=this.K;this.K=[];for(var b=0,c=a.length;b<c;++b)qUa(this.i,a[b])}this.ea("handlerOpened")};
g.k.zJ=function(a){var b=2==a&&401==this.i.Zj;4==a||b||this.u.start();this.ea("handlerError",a,b)};
g.k.hD=function(a){if(!this.u.isActive())this.ea("handlerClosed");else if(a)for(var b=0,c=a.length;b<c;++b){var d=a[b].map;d&&this.K.push(d)}};
g.k.mK=function(){var a={v:2};this.X&&(a.gsessionid=this.X);0!=this.C&&(a.ui=""+this.C);0!=this.S&&(a.ui=""+this.S);this.D&&g.Me(a,this.D);return a};
g.k.AJ=function(a){"S"==a[0]?this.X=a[1]:"gracefulReconnect"==a[0]?(this.u.start(),oUa(this.i)):this.ea("handlerMessage",new zUa(a[0],a[1]))};
g.k.XA=function(a){(this.I.loungeIdToken=a)||this.u.stop();if(this.Ba&&this.i){var b=this.i.Yj||{};a?b["X-YouTube-LoungeId-Token"]=a:delete b["X-YouTube-LoungeId-Token"];this.i.Yj=b}};
g.k.aX=function(){this.u.isActive();0==rUa(this.i)&&this.connect(this.D,this.C)};P7.prototype.C=function(a,b,c,d){b?a(d):a({text:c.responseText})};
P7.prototype.B=function(a,b){a(Error("Request error: "+b.status))};
P7.prototype.D=function(a){a(Error("request timed out"))};var IUa=Date.now(),S7=null,V7=Array(50),U7=-1,W7=!1;g.Ta(X7,g.Q);X7.prototype.Fh=function(){return this.screens};
X7.prototype.contains=function(a){return!!Z6(this.screens,a)};
X7.prototype.get=function(a){return a?$6(this.screens,a):null};
X7.prototype.info=function(a){T7(this.I,a)};g.w(Y7,g.Q);g.k=Y7.prototype;g.k.start=function(){!this.i&&isNaN(this.Mb)&&this.eN()};
g.k.stop=function(){this.i&&(this.i.abort(),this.i=null);isNaN(this.Mb)||(g.St(this.Mb),this.Mb=NaN)};
g.k.xa=function(){this.stop();g.Q.prototype.xa.call(this)};
g.k.eN=function(){this.Mb=NaN;this.i=g.Yt(Q7(this.B,"/pairing/get_screen"),{method:"POST",postParams:{pairing_code:this.K},timeout:5E3,onSuccess:(0,g.D)(this.sQ,this),onError:(0,g.D)(this.rQ,this),onTimeout:(0,g.D)(this.tQ,this)})};
g.k.sQ=function(a,b){this.i=null;a=b.screen||{};a.dialId=this.C;a.name=this.I;b=-1;this.D&&a.shortLivedLoungeToken&&a.shortLivedLoungeToken.value&&a.shortLivedLoungeToken.refreshIntervalMs&&(a.screenIdType="shortLived",a.loungeToken=a.shortLivedLoungeToken.value,b=a.shortLivedLoungeToken.refreshIntervalMs);this.ea("pairingComplete",new U6(a),b)};
g.k.rQ=function(a){this.i=null;a.status&&404==a.status?this.u>=bWa.length?this.ea("pairingFailed",Error("DIAL polling timed out")):(a=bWa[this.u],this.Mb=g.Qt((0,g.D)(this.eN,this),a),this.u++):this.ea("pairingFailed",Error("Server error "+a.status))};
g.k.tQ=function(){this.i=null;this.ea("pairingFailed",Error("Server not responding"))};
var bWa=[2E3,2E3,1E3,1E3,1E3,2E3,2E3,5E3,5E3,1E4];g.Ta($7,X7);g.k=$7.prototype;g.k.start=function(){Z7(this)&&this.ea("screenChange");!g.Ay("yt-remote-lounge-token-expiration")&&MUa(this);g.St(this.i);this.i=g.Qt((0,g.D)(this.start,this),1E4)};
g.k.add=function(a,b){Z7(this);JUa(this,a);a8(this,!1);this.ea("screenChange");b(a);a.token||MUa(this)};
g.k.remove=function(a,b){var c=Z7(this);LUa(this,a)&&(a8(this,!1),c=!0);b(a);c&&this.ea("screenChange")};
g.k.rB=function(a,b,c,d){var e=Z7(this),f=this.get(a.id);f?(f.name!=b&&(f.name=b,a8(this,!1),e=!0),c(a)):d(Error("no such local screen."));e&&this.ea("screenChange")};
g.k.xa=function(){g.St(this.i);$7.ge.xa.call(this)};
g.k.gS=function(a){Z7(this);var b=this.screens.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)}a8(this,!b);b&&T7(this.I,"Missed "+b+" lounge tokens.")};
g.k.fS=function(a){T7(this.I,"Requesting lounge tokens failed: "+a)};g.w(c8,g.Q);g.k=c8.prototype;g.k.start=function(){var a=parseInt(g.Ay("yt-remote-fast-check-period")||"0",10);(this.C=g.Sa()-144E5<a?0:a)?f8(this):(this.C=g.Sa()+3E5,g.zy("yt-remote-fast-check-period",this.C),this.aG())};
g.k.isEmpty=function(){return g.De(this.i)};
g.k.update=function(){b8("Updating availability on schedule.");var a=this.I(),b=g.re(this.i,function(c,d){return c&&!!$6(a,d)},this);
e8(this,b)};
g.k.xa=function(){g.St(this.B);this.B=NaN;this.u&&(this.u.abort(),this.u=null);g.Q.prototype.xa.call(this)};
g.k.aG=function(){g.St(this.B);this.B=NaN;this.u&&this.u.abort();var a=OUa(this);if(Q6(a)){var b=Q7(this.D,"/pairing/get_screen_availability");this.u=R7(this.D,b,{lounge_token:g.ye(a).join(",")},(0,g.D)(this.KV,this,a),(0,g.D)(this.JV,this))}else e8(this,{}),f8(this)};
g.k.KV=function(a,b){this.u=null;var c=g.ye(OUa(this));if(g.hc(c,g.ye(a))){b=b.screens||[];c={};for(var d=0,e=b.length;d<e;++d)c[a[b[d].loungeToken]]="online"==b[d].status;e8(this,c);f8(this)}else this.je("Changing Screen set during request."),this.aG()};
g.k.JV=function(a){this.je("Screen availability failed: "+a);this.u=null;f8(this)};
g.k.je=function(a){T7("OnlineScreenService",a)};g.Ta(g8,X7);g.k=g8.prototype;g.k.start=function(){this.u.start();this.i.start();this.screens.length&&(this.ea("screenChange"),this.i.isEmpty()||this.ea("onlineScreenChange"))};
g.k.add=function(a,b,c){this.u.add(a,b,c)};
g.k.remove=function(a,b,c){this.u.remove(a,b,c);this.i.update()};
g.k.rB=function(a,b,c,d){this.u.contains(a)?this.u.rB(a,b,c,d):(a="Updating name of unknown screen: "+a.name,T7(this.I,a),d(Error(a)))};
g.k.Fh=function(a){return a?this.screens:g.Wb(this.screens,g.ap(this.B,function(b){return!this.contains(b)},this))};
g.k.iI=function(){return g.ap(this.Fh(!0),function(a){return!!this.i.i[a.id]},this)};
g.k.jI=function(a,b,c,d,e,f){var h=this;this.info("getDialScreenByPairingCode "+a+" / "+b);var l=new Y7(this.C,a,b,c,d);l.subscribe("pairingComplete",function(m,n){g.ee(l);e(h8(h,m),n)});
l.subscribe("pairingFailed",function(m){g.ee(l);f(m)});
l.start();return(0,g.D)(l.stop,l)};
g.k.uQ=function(a,b,c,d){g.Yt(Q7(this.C,"/pairing/get_screen"),{method:"POST",postParams:{pairing_code:a},timeout:5E3,onSuccess:(0,g.D)(function(e,f){e=new U6(f.screen||{});if(!e.name||SUa(this,e.name)){a:{f=e.name;for(var h=2,l=b(f,h);SUa(this,l);){h++;if(20<h)break a;l=b(f,h)}f=l}e.name=f}c(h8(this,e))},this),
onError:(0,g.D)(function(e){d(Error("pairing request failed: "+e.status))},this),
onTimeout:(0,g.D)(function(){d(Error("pairing request timed out."))},this)})};
g.k.xa=function(){g.ee(this.u);g.ee(this.i);g8.ge.xa.call(this)};
g.k.pS=function(){UUa(this);this.ea("screenChange");this.i.update()};
g8.prototype.dispose=g8.prototype.dispose;g.Ta(j8,g.Q);g.k=j8.prototype;g.k.getScreen=function(){return this.C};
g.k.yg=function(a){this.isDisposed()||(a&&(l8(this,""+a),this.ea("sessionFailed")),this.C=null,this.ea("sessionScreen",null))};
g.k.info=function(a){T7(this.Ba,a)};
g.k.kI=function(){return null};
g.k.oG=function(a){var b=this.i;a?(b.displayStatus=new chrome.cast.ReceiverDisplayStatus(a,[]),b.displayStatus.showStop=!0):b.displayStatus=null;chrome.cast.setReceiverDisplayStatus(b,(0,g.D)(function(){this.info("Updated receiver status for "+b.friendlyName+": "+a)},this),(0,g.D)(function(){l8(this,"Failed to update receiver status for: "+b.friendlyName)},this))};
g.k.xa=function(){this.oG("");j8.ge.xa.call(this)};g.w(m8,j8);g.k=m8.prototype;g.k.nG=function(a){if(this.u){if(this.u==a)return;l8(this,"Overriding cast session with new session object");cVa(this);this.va=!1;this.X="unknown";this.u.removeUpdateListener(this.oa);this.u.removeMessageListener("urn:x-cast:com.google.youtube.mdx",this.Aa)}this.u=a;this.u.addUpdateListener(this.oa);this.u.addMessageListener("urn:x-cast:com.google.youtube.mdx",this.Aa);ZUa(this,"getMdxSessionStatus")};
g.k.Qs=function(a){this.info("launchWithParams no-op for Cast: "+g.ji(a))};
g.k.stop=function(){this.u?this.u.stop((0,g.D)(function(){this.yg()},this),(0,g.D)(function(){this.yg(Error("Failed to stop receiver app."))},this)):this.yg(Error("Stopping cast device without session."))};
g.k.oG=function(){};
g.k.xa=function(){this.info("disposeInternal");cVa(this);this.u&&(this.u.removeUpdateListener(this.oa),this.u.removeMessageListener("urn:x-cast:com.google.youtube.mdx",this.Aa));this.u=null;j8.prototype.xa.call(this)};
g.k.xW=function(a,b){if(!this.isDisposed())if(b)if(b=R6(b),g.Na(b))switch(a=""+b.type,b=b.data||{},this.info("onYoutubeMessage_: "+a+" "+g.ji(b)),a){case "mdxSessionStatus":XUa(this,b);break;case "loungeToken":$Ua(this,b);break;default:l8(this,"Unknown youtube message: "+a)}else l8(this,"Unable to parse message.");else l8(this,"No data in message.")};
g.k.zK=function(a,b,c,d){g.St(this.S);this.S=0;RUa(this.B,this.i.label,a,this.i.friendlyName,(0,g.D)(function(e){e?b(e):0<=d?(l8(this,"Screen "+a+" appears to be offline. "+d+" retries left."),this.S=g.Qt((0,g.D)(this.zK,this,a,b,c,d-1),300)):c(Error("Unable to fetch screen."))},this),c)};
g.k.kI=function(){return this.u};
g.k.vQ=function(a){this.isDisposed()||a||(l8(this,"Cast session died."),this.yg())};g.w(p8,j8);g.k=p8.prototype;g.k.nG=function(a){this.u=a;this.u.addUpdateListener(this.Ha)};
g.k.Qs=function(a){this.Ka=a;this.Z()};
g.k.stop=function(){jVa(this);this.u?this.u.stop((0,g.D)(this.yg,this,null),(0,g.D)(this.yg,this,"Failed to stop DIAL device.")):this.yg()};
g.k.xa=function(){jVa(this);this.u&&this.u.removeUpdateListener(this.Ha);this.u=null;j8.prototype.xa.call(this)};
g.k.wQ=function(a){this.isDisposed()||a||(l8(this,"DIAL session died."),this.D(),this.D=g.Ia,this.yg())};g.w(t8,j8);t8.prototype.stop=function(){this.yg()};
t8.prototype.nG=function(){};
t8.prototype.Qs=function(){g.St(this.u);this.u=NaN;var a=$6(this.B.Fh(),this.i.label);a?k8(this,a):this.yg(Error("No such screen"))};
t8.prototype.xa=function(){g.St(this.u);this.u=NaN;j8.prototype.xa.call(this)};g.w(u8,g.Q);g.k=u8.prototype;
g.k.init=function(a,b){chrome.cast.timeout.requestSession=3E4;var c=new chrome.cast.SessionRequest(this.S,[chrome.cast.Capability.AUDIO_OUT]);this.X||(c.dialRequest=new chrome.cast.DialRequest("YouTube"));var d=chrome.cast.AutoJoinPolicy.TAB_AND_ORIGIN_SCOPED;a=a||this.I?chrome.cast.DefaultActionPolicy.CAST_THIS_TAB:chrome.cast.DefaultActionPolicy.CREATE_SESSION;var e=(0,g.D)(this.tV,this);c=new chrome.cast.ApiConfig(c,(0,g.D)(this.OM,this),e,d,a);c.customDialLaunchCallback=(0,g.D)(this.oU,this);
chrome.cast.initialize(c,(0,g.D)(function(){this.isDisposed()||(chrome.cast.addReceiverActionListener(this.D),FUa(),this.u.subscribe("onlineScreenChange",(0,g.D)(this.lI,this)),this.B=mVa(this),chrome.cast.setCustomReceivers(this.B,g.Ia,(0,g.D)(function(f){this.je("Failed to set initial custom receivers: "+g.ji(f))},this)),this.ea("yt-remote-cast2-availability-change",w8(this)),b(!0))},this),(0,g.D)(function(f){this.je("Failed to initialize API: "+g.ji(f));
b(!1)},this))};
g.k.fX=function(a,b){v8("Setting connected screen ID: "+a+" -> "+b);if(this.i){var c=this.i.getScreen();if(!a||c&&c.id!=a)v8("Unsetting old screen status: "+this.i.i.friendlyName),x8(this,null)}if(a&&b){if(!this.i){c=$6(this.u.Fh(),a);if(!c){v8("setConnectedScreenStatus: Unknown screen.");return}if("shortLived"==c.idType){v8("setConnectedScreenStatus: Screen with id type to be short lived.");return}a=kVa(this,c);a||(v8("setConnectedScreenStatus: Connected receiver not custom..."),a=new chrome.cast.Receiver(c.uuid?
c.uuid:c.id,c.name),a.receiverType=chrome.cast.ReceiverType.CUSTOM,this.B.push(a),chrome.cast.setCustomReceivers(this.B,g.Ia,(0,g.D)(function(d){this.je("Failed to set initial custom receivers: "+g.ji(d))},this)));
v8("setConnectedScreenStatus: new active receiver: "+a.friendlyName);x8(this,new t8(this.u,a),!0)}this.i.oG(b)}else v8("setConnectedScreenStatus: no screen.")};
g.k.gX=function(a){this.isDisposed()?this.je("Setting connection data on disposed cast v2"):this.i?this.i.Qs(a):this.je("Setting connection data without a session")};
g.k.yQ=function(){this.isDisposed()?this.je("Stopping session on disposed cast v2"):this.i?(this.i.stop(),x8(this,null)):v8("Stopping non-existing session")};
g.k.requestSession=function(){chrome.cast.requestSession((0,g.D)(this.OM,this),(0,g.D)(this.NV,this))};
g.k.xa=function(){this.u.unsubscribe("onlineScreenChange",(0,g.D)(this.lI,this));window.chrome&&chrome.cast&&chrome.cast.removeReceiverActionListener(this.D);var a=CUa,b=g.Ha("yt.mdx.remote.debug.handlers_");g.Ub(b||[],a);g.ee(this.i);g.Q.prototype.xa.call(this)};
g.k.je=function(a){T7("Controller",a)};
g.k.QM=function(a,b){this.i==a&&(b||x8(this,null),this.ea("yt-remote-cast2-session-change",b))};
g.k.qV=function(a,b){if(!this.isDisposed())if(a)switch(a.friendlyName=chrome.cast.unescape(a.friendlyName),v8("onReceiverAction_ "+a.label+" / "+a.friendlyName+"-- "+b),b){case chrome.cast.ReceiverAction.CAST:if(this.i)if(this.i.i.label!=a.label)v8("onReceiverAction_: Stopping active receiver: "+this.i.i.friendlyName),this.i.stop();else{v8("onReceiverAction_: Casting to active receiver.");this.i.getScreen()&&this.ea("yt-remote-cast2-session-change",this.i.getScreen());break}switch(a.receiverType){case chrome.cast.ReceiverType.CUSTOM:x8(this,
new t8(this.u,a));break;case chrome.cast.ReceiverType.DIAL:x8(this,new p8(this.u,a,this.C,this.config_));break;case chrome.cast.ReceiverType.CAST:x8(this,new m8(this.u,a,this.config_));break;default:this.je("Unknown receiver type: "+a.receiverType)}break;case chrome.cast.ReceiverAction.STOP:this.i&&this.i.i.label==a.label?this.i.stop():this.je("Stopping receiver w/o session: "+a.friendlyName)}else this.je("onReceiverAction_ called without receiver.")};
g.k.oU=function(a){if(this.isDisposed())return Promise.reject(Error("disposed"));var b=a.receiver;b.receiverType!=chrome.cast.ReceiverType.DIAL&&(this.je("Not DIAL receiver: "+b.friendlyName),b.receiverType=chrome.cast.ReceiverType.DIAL);var c=this.i?this.i.i:null;if(!c||c.label!=b.label)return this.je("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.i.getScreen())return v8("Reselecting dial screen."),
this.ea("yt-remote-cast2-session-change",this.i.getScreen()),Promise.resolve(new chrome.cast.DialLaunchResponse(!1));this.je('Changing CAST intent from "'+c.receiverType+'" to "dial" for '+b.friendlyName);x8(this,new p8(this.u,b,this.C,this.config_))}b=this.i;b.S=a;b.S.appState==chrome.cast.DialAppState.RUNNING?(a=b.S.extraData||{},c=a.screenId||null,q8(b)&&a.loungeToken?a.loungeTokenRefreshIntervalMs?a=gVa(b,{name:b.i.friendlyName,screenId:a.screenId,loungeToken:a.loungeToken,dialId:b.S.receiver.label,
screenIdType:"shortLived"},a.loungeTokenRefreshIntervalMs):(g.Zs(Error("No loungeTokenRefreshIntervalMs presents in additionalData: "+JSON.stringify(a)+".")),a=hVa(b,c)):a=hVa(b,c)):a=s8(b);return a};
g.k.OM=function(a){var b=this;if(!this.isDisposed()&&!this.I){v8("New cast session ID: "+a.sessionId);var c=a.receiver;if(c.receiverType!=chrome.cast.ReceiverType.CUSTOM){if(!this.i)if(c.receiverType==chrome.cast.ReceiverType.CAST)v8("Got resumed cast session before resumed mdx connection."),c.friendlyName=chrome.cast.unescape(c.friendlyName),x8(this,new m8(this.u,c,this.config_),!0);else{this.je("Got non-cast session without previous mdx receiver event, or mdx resume.");return}var d=this.i.i,e=$6(this.u.Fh(),
d.label);e&&V6(e,c.label)&&d.receiverType!=chrome.cast.ReceiverType.CAST&&c.receiverType==chrome.cast.ReceiverType.CAST&&(v8("onSessionEstablished_: manual to cast session change "+c.friendlyName),g.ee(this.i),this.i=new m8(this.u,c,this.config_),this.i.subscribe("sessionScreen",(0,g.D)(this.QM,this,this.i)),this.i.subscribe("sessionFailed",function(){return lVa(b,b.i)}),this.i.Qs(null));
this.i.nG(a)}}};
g.k.xQ=function(){return this.i?this.i.kI():null};
g.k.NV=function(a){this.isDisposed()||(this.je("Failed to estabilish a session: "+g.ji(a)),a.code!=chrome.cast.ErrorCode.CANCEL&&x8(this,null),this.ea("yt-remote-cast2-session-failed"))};
g.k.tV=function(a){v8("Receiver availability updated: "+a);if(!this.isDisposed()){var b=w8(this);this.K=a==chrome.cast.ReceiverAvailability.AVAILABLE;w8(this)!=b&&this.ea("yt-remote-cast2-availability-change",w8(this))}};
g.k.lI=function(){this.isDisposed()||(this.B=mVa(this),v8("Updating custom receivers: "+g.ji(this.B)),chrome.cast.setCustomReceivers(this.B,g.Ia,(0,g.D)(function(){this.je("Failed to set custom receivers.")},this)),this.ea("yt-remote-cast2-availability-change",w8(this)))};
u8.prototype.setLaunchParams=u8.prototype.gX;u8.prototype.setConnectedScreenStatus=u8.prototype.fX;u8.prototype.stopSession=u8.prototype.yQ;u8.prototype.getCastSession=u8.prototype.xQ;u8.prototype.requestSession=u8.prototype.requestSession;u8.prototype.init=u8.prototype.init;u8.prototype.dispose=u8.prototype.dispose;var D8=[];g.k=I8.prototype;
g.k.reset=function(a){this.listId="";this.index=-1;this.videoId="";J8(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.trackData=a.trackData,this.Hk=a.hasPrevious,this.hasNext=a.hasNext,this.K=a.playerTime,this.I=a.playerTimeAt,this.C=a.seekableStart,this.i=a.seekableEnd,this.D=a.duration,this.S=a.loadedTime,this.B=a.liveIngestionTime,this.u=
!isNaN(this.B))};
g.k.Ec=function(){return 1==this.playerState};
g.k.isAdPlaying=function(){return 1081==this.playerState};
g.k.Ij=function(a){this.D=isNaN(a)?0:a};
g.k.getDuration=function(){return this.u?this.D+K8(this):this.D};
g.k.clone=function(){return new I8(O8(this))};g.w(Q8,g.Q);g.k=Q8.prototype;g.k.getState=function(){return this.B};
g.k.play=function(){S8(this)?(this.i?this.i.play(null,g.Ia,X8(this,"play")):W8(this,"play"),V8(this,1,M8(R8(this))),this.ea("remotePlayerChange")):T8(this,this.play)};
g.k.pause=function(){S8(this)?(this.i?this.i.pause(null,g.Ia,X8(this,"pause")):W8(this,"pause"),V8(this,2,M8(R8(this))),this.ea("remotePlayerChange")):T8(this,this.pause)};
g.k.seekTo=function(a){if(S8(this)){if(this.i){var b=R8(this),c=new chrome.cast.media.SeekRequest;c.currentTime=a;b.Ec()||3==b.playerState?c.resumeState=chrome.cast.media.ResumeState.PLAYBACK_START:c.resumeState=chrome.cast.media.ResumeState.PLAYBACK_PAUSE;this.i.seek(c,g.Ia,X8(this,"seekTo",{newTime:a}))}else W8(this,"seekTo",{newTime:a});V8(this,3,a);this.ea("remotePlayerChange")}else T8(this,g.Ra(this.seekTo,a))};
g.k.stop=function(){if(S8(this)){this.i?this.i.stop(null,g.Ia,X8(this,"stopVideo")):W8(this,"stopVideo");var a=R8(this);a.index=-1;a.videoId="";J8(a);U8(this,a);this.ea("remotePlayerChange")}else T8(this,this.stop)};
g.k.setVolume=function(a,b){if(S8(this)){var c=R8(this);if(this.u){if(c.volume!=a){var d=Math.round(a)/100;this.u.setReceiverVolumeLevel(d,(0,g.D)(function(){T7("CP","set receiver volume: "+d)},this),(0,g.D)(function(){this.je("failed to set receiver volume.")},this))}c.muted!=b&&this.u.setReceiverMuted(b,(0,g.D)(function(){T7("CP","set receiver muted: "+b)},this),(0,g.D)(function(){this.je("failed to set receiver muted.")},this))}else{var e={volume:a,
muted:b};-1!=c.volume&&(e.delta=a-c.volume);W8(this,"setVolume",e)}c.muted=b;c.volume=a;U8(this,c)}else T8(this,g.Ra(this.setVolume,a,b))};
g.k.mI=function(a,b){if(S8(this)){var c=R8(this);a={videoId:a};b&&(c.trackData={trackName:b.name,languageCode:b.languageCode,sourceLanguageCode:b.translationLanguage?b.translationLanguage.languageCode:"",languageName:b.languageName,kind:b.kind},a.style=g.ji(b.style),g.Me(a,c.trackData));W8(this,"setSubtitlesTrack",a);U8(this,c)}else T8(this,g.Ra(this.mI,a,b))};
g.k.setAudioTrack=function(a,b){S8(this)?(b=b.getLanguageInfo().getId(),W8(this,"setAudioTrack",{videoId:a,audioTrackId:b}),a=R8(this),a.audioTrackId=b,U8(this,a)):T8(this,g.Ra(this.setAudioTrack,a,b))};
g.k.playVideo=function(a,b,c,d,e,f,h){d=void 0===d?null:d;e=void 0===e?null:e;f=void 0===f?null:f;h=void 0===h?null:h;var l=R8(this),m={videoId:a};void 0!==c&&(m.currentIndex=c);N8(l,a,c||0);void 0!==b&&(L8(l,b),m.currentTime=b);d&&(m.listId=d);e&&(m.playerParams=e);f&&(m.clickTrackingParams=f);h&&(m.locationInfo=g.ji(h));W8(this,"setPlaylist",m);d||U8(this,l)};
g.k.EA=function(a,b){if(S8(this)){if(a&&b){var c=R8(this);N8(c,a,b);U8(this,c)}W8(this,"previous")}else T8(this,g.Ra(this.EA,a,b))};
g.k.nextVideo=function(a,b){if(S8(this)){if(a&&b){var c=R8(this);N8(c,a,b);U8(this,c)}W8(this,"next")}else T8(this,g.Ra(this.nextVideo,a,b))};
g.k.Qr=function(){if(S8(this)){W8(this,"clearPlaylist");var a=R8(this);a.reset();U8(this,a);this.ea("remotePlayerChange")}else T8(this,this.Qr)};
g.k.VJ=function(){S8(this)?W8(this,"dismissAutoplay"):T8(this,this.VJ)};
g.k.dispose=function(){if(3!=this.B){var a=this.B;this.B=3;this.ea("proxyStateChange",a,this.B)}g.Q.prototype.dispose.call(this)};
g.k.xa=function(){yVa(this);this.C=null;this.D.clear();P8(this,null);g.Q.prototype.xa.call(this)};
g.k.pG=function(a){if((a!=this.B||2==a)&&3!=this.B&&0!=a){var b=this.B;this.B=a;this.ea("proxyStateChange",b,a);if(1==a)for(;!this.D.isEmpty();)b=a=this.D,0===b.i.length&&(b.i=b.u,b.i.reverse(),b.u=[]),a.i.pop().apply(this);else 3==a&&this.dispose()}};
g.k.oV=function(a,b){this.ea(a,b)};
g.k.ZT=function(a){if(!a)this.zw(null),P8(this,null);else if(this.u.receiver.volume){a=this.u.receiver.volume;var b=R8(this),c=Math.round(100*a.level||0);if(b.volume!=c||b.muted!=a.muted)T7("CP","Cast volume update: "+a.level+(a.muted?" muted":"")),b.volume=c,b.muted=!!a.muted,U8(this,b)}};
g.k.zw=function(a){T7("CP","Cast media: "+!!a);this.i&&this.i.removeUpdateListener(this.S);if(this.i=a)this.i.addUpdateListener(this.S),zVa(this),this.ea("remotePlayerChange")};
g.k.XT=function(a){a?(zVa(this),this.ea("remotePlayerChange")):this.zw(null)};
g.k.KG=function(){W8(this,"sendDebugCommand",{debugCommand:"stats4nerds "})};
g.k.gU=function(){var a=vVa();a&&P8(this,a)};
g.k.je=function(a){T7("CP",a)};g.w(Y8,g.Q);g.k=Y8.prototype;
g.k.connect=function(a,b){if(b){var c=b.listId,d=b.videoId,e=b.videoIds,f=b.playerParams,h=b.clickTrackingParams,l=b.index,m={videoId:d},n=b.currentTime,p=b.locationInfo;b=b.loopMode;void 0!==n&&(m.currentTime=5>=n?0:n);f&&(m.playerParams=f);p&&(m.locationInfo=p);h&&(m.clickTrackingParams=h);c&&(m.listId=c);e&&0<e.length&&(m.videoIds=e.join(","));void 0!==l&&(m.currentIndex=l);this.Ba&&(m.loopMode=b||"LOOP_MODE_OFF");c&&(this.kc.listId=c);this.kc.videoId=d;this.kc.index=l||0;this.kc.state=3;L8(this.kc,
n);this.C="UNSUPPORTED";c=this.Ba?"setInitialState":"setPlaylist";Z8("Connecting with "+c+" and params: "+g.ji(m));this.i.connect({method:c,params:g.ji(m)},a,ITa())}else Z8("Connecting without params"),this.i.connect({},a,ITa());CVa(this)};
g.k.XA=function(a){this.i.XA(a)};
g.k.dispose=function(){this.isDisposed()||(g.Ga("yt.mdx.remote.remoteClient_",null,void 0),this.ea("beforeDispose"),$8(this,3));g.Q.prototype.dispose.call(this)};
g.k.xa=function(){a9(this);c9(this);b9(this);g.St(this.K);this.K=NaN;g.St(this.S);this.S=NaN;this.B=null;g.Xu(this.X);this.X.length=0;this.i.dispose();g.Q.prototype.xa.call(this);this.C=this.I=this.u=this.kc=this.i=null};
g.k.bS=function(){this.Zr(2)};
g.k.dU=function(){Z8("Channel opened");this.va&&(this.va=!1,b9(this),this.oa=g.Qt((0,g.D)(function(){Z8("Timing out waiting for a screen.");this.Zr(1)},this),15E3));
MTa(AUa(this.i),this.Ka)};
g.k.aU=function(){Z8("Channel closed");isNaN(this.D)?e7(!0):e7();this.dispose()};
g.k.bU=function(a,b){e7();isNaN(this.Jv())?(b&&"shortLived"==this.Aa&&this.ea("browserChannelAuthError",a),Z8("Channel error: "+a+" without reconnection"),this.dispose()):(this.va=!0,Z8("Channel error: "+a+" with reconnection in "+this.Jv()+" ms"),$8(this,2))};
g.k.hL=function(a){if(!this.u||0===this.u.length)return!1;for(var b=g.r(this.u),c=b.next();!c.done;c=b.next())if(!c.value.capabilities.has(a))return!1;return!0};
g.k.cU=function(a){a.params?Z8("Received: action="+a.action+", params="+g.ji(a.params)):Z8("Received: action="+a.action+" {}");switch(a.action){case "loungeStatus":a=R6(a.params.devices);this.u=g.Mm(a,function(c){return new T6(c)});
a=!!g.Mb(this.u,function(c){return"LOUNGE_SCREEN"==c.type});
FVa(this,a);a=this.hL("mlm");this.ea("multiStateLoopEnabled",a);break;case "loungeScreenDisconnected":g.Vb(this.u,function(c){return"LOUNGE_SCREEN"==c.type});
FVa(this,!1);break;case "remoteConnected":var b=new T6(R6(a.params.device));g.Mb(this.u,function(c){return b?c.id==b.id:!1})||vTa(this.u,b);
break;case "remoteDisconnected":b=new T6(R6(a.params.device));g.Vb(this.u,function(c){return b?c.id==b.id:!1});
break;case "gracefulDisconnect":break;case "playlistModified":HVa(this,a,"QUEUE_MODIFIED");break;case "nowPlaying":JVa(this,a);break;case "onStateChange":IVa(this,a);break;case "onAdStateChange":KVa(this,a);break;case "onVolumeChanged":LVa(this,a);break;case "onSubtitlesTrackChanged":GVa(this,a);break;case "nowAutoplaying":MVa(this,a);break;case "autoplayDismissed":this.ea("autoplayDismissed");break;case "autoplayUpNext":this.I=a.params.videoId||null;this.ea("autoplayUpNext",this.I);break;case "onAutoplayModeChanged":this.C=
a.params.autoplayMode;this.ea("autoplayModeChange",this.C);"DISABLED"==this.C&&this.ea("autoplayDismissed");break;case "onHasPreviousNextChanged":NVa(this,a);break;case "requestAssistedSignIn":this.ea("assistedSignInRequested",a.params.authCode);break;case "onLoopModeChanged":this.ea("loopModeChange",a.params.loopMode);break;default:Z8("Unrecognized action: "+a.action)}};
g.k.TW=function(){if(this.B){var a=this.B;this.B=null;this.kc.videoId!=a&&d9(this,"getNowPlaying")}};
g.k.YR=function(){var a=3;this.isDisposed()||(a=0,isNaN(this.Jv())?O7(this.i)&&isNaN(this.D)&&(a=1):a=2);return a};
g.k.Zr=function(a){Z8("Disconnecting with "+a);g.Ga("yt.mdx.remote.remoteClient_",null,void 0);a9(this);this.ea("beforeDisconnect",a);1==a&&e7();BUa(this.i,a);this.dispose()};
g.k.WR=function(){var a=this.kc;this.B&&(a=this.kc.clone(),N8(a,this.B,a.index));return O8(a)};
g.k.hX=function(a){var b=new I8(a);b.videoId&&b.videoId!=this.kc.videoId&&(this.B=b.videoId,g.St(this.K),this.K=g.Qt((0,g.D)(this.TW,this),5E3));var c=[];this.kc.listId==b.listId&&this.kc.videoId==b.videoId&&this.kc.index==b.index||c.push("remoteQueueChange");this.kc.playerState==b.playerState&&this.kc.volume==b.volume&&this.kc.muted==b.muted&&M8(this.kc)==M8(b)&&g.ji(this.kc.trackData)==g.ji(b.trackData)||c.push("remotePlayerChange");this.kc.reset(a);g.jc(c,function(d){this.ea(d)},this)};
g.k.yK=function(){var a=this.i.I.id,b=g.Mb(this.u,function(c){return"REMOTE_CONTROL"==c.type&&c.id!=a});
return b?b.id:""};
g.k.Jv=function(){var a=this.i;return a.u.isActive()?a.u.u-Date.now():NaN};
g.k.TR=function(){return this.C||"UNSUPPORTED"};
g.k.UR=function(){return this.I||""};
g.k.zQ=function(){if(!isNaN(this.Jv())){var a=this.i.u;g.cr(a.i);a.start()}};
g.k.eX=function(a,b){d9(this,a,b);EVa(this)};
g.k.nI=function(){var a=g.ju("SID","")||"",b=g.ju("SAPISID","")||"",c=g.ju("__Secure-3PAPISID","")||"";if(!a&&!b&&!c)return"";a=g.xc(g.eb(a),2);b=g.xc(g.eb(b),2);c=g.xc(g.eb(c),2);return g.xc(g.eb(a+","+b+","+c),2)};
Y8.prototype.subscribe=Y8.prototype.subscribe;Y8.prototype.unsubscribeByKey=Y8.prototype.cg;Y8.prototype.getProxyState=Y8.prototype.YR;Y8.prototype.disconnect=Y8.prototype.Zr;Y8.prototype.getPlayerContextData=Y8.prototype.WR;Y8.prototype.setPlayerContextData=Y8.prototype.hX;Y8.prototype.getOtherConnectedRemoteId=Y8.prototype.yK;Y8.prototype.getReconnectTimeout=Y8.prototype.Jv;Y8.prototype.getAutoplayMode=Y8.prototype.TR;Y8.prototype.getAutoplayVideoId=Y8.prototype.UR;Y8.prototype.reconnect=Y8.prototype.zQ;
Y8.prototype.sendMessage=Y8.prototype.eX;Y8.prototype.getXsrfToken=Y8.prototype.nI;Y8.prototype.isCapabilitySupportedOnConnectedDevices=Y8.prototype.hL;g.w(e9,X7);g.k=e9.prototype;g.k.Fh=function(a){return this.Re.$_gs(a)};
g.k.contains=function(a){return!!this.Re.$_c(a)};
g.k.get=function(a){return this.Re.$_g(a)};
g.k.start=function(){this.Re.$_st()};
g.k.add=function(a,b,c){this.Re.$_a(a,b,c)};
g.k.remove=function(a,b,c){this.Re.$_r(a,b,c)};
g.k.rB=function(a,b,c,d){this.Re.$_un(a,b,c,d)};
g.k.xa=function(){for(var a=0,b=this.i.length;a<b;++a)this.Re.$_ubk(this.i[a]);this.i.length=0;this.Re=null;X7.prototype.xa.call(this)};
g.k.AQ=function(){this.ea("screenChange")};
g.k.VU=function(){this.ea("onlineScreenChange")};
g8.prototype.$_st=g8.prototype.start;g8.prototype.$_gspc=g8.prototype.uQ;g8.prototype.$_gsppc=g8.prototype.jI;g8.prototype.$_c=g8.prototype.contains;g8.prototype.$_g=g8.prototype.get;g8.prototype.$_a=g8.prototype.add;g8.prototype.$_un=g8.prototype.rB;g8.prototype.$_r=g8.prototype.remove;g8.prototype.$_gs=g8.prototype.Fh;g8.prototype.$_gos=g8.prototype.iI;g8.prototype.$_s=g8.prototype.subscribe;g8.prototype.$_ubk=g8.prototype.cg;var r9=null,x9=!1,f9=null,g9=null,w9=null,k9=[];g.w(y9,g.E);g.k=y9.prototype;g.k.xa=function(){g.E.prototype.xa.call(this);this.i.stop();this.B.stop();this.S.stop();this.oa();var a=this.Tb;a.unsubscribe("proxyStateChange",this.LM,this);a.unsubscribe("remotePlayerChange",this.Ew,this);a.unsubscribe("remoteQueueChange",this.qA,this);a.unsubscribe("previousNextChange",this.IM,this);a.unsubscribe("nowAutoplaying",this.CM,this);a.unsubscribe("autoplayDismissed",this.fM,this);this.Tb=this.u=null};
g.k.qj=function(a){var b=g.Ba.apply(1,arguments);if(2!=this.Tb.B)if(z9(this)){var c=a;if(!R8(this.Tb).isAdPlaying()||"control_seek"!==c)switch(c){case "control_toggle_play_pause":R8(this.Tb).Ec()?this.Tb.pause():this.Tb.play();break;case "control_play":this.Tb.play();break;case "control_pause":this.Tb.pause();break;case "control_seek":this.K.hI(b[0],b[1]);break;case "control_subtitles_set_track":A9(this,b[0]);break;case "control_set_audio_track":this.setAudioTrack(b[0])}}else switch(a){case "control_toggle_play_pause":case "control_play":case "control_pause":b=
this.J.getCurrentTime();B9(this,0===b?void 0:b);break;case "control_seek":B9(this,b[0]);break;case "control_subtitles_set_track":A9(this,b[0]);break;case "control_set_audio_track":this.setAudioTrack(b[0])}};
g.k.UT=function(a){this.S.oQ(a)};
g.k.MX=function(a){this.qj("control_subtitles_set_track",g.De(a)?null:a)};
g.k.bO=function(){var a=this.J.getOption("captions","track");g.De(a)||A9(this,a)};
g.k.Xb=function(a){this.u.Xb(a,this.J.getVideoData().lengthSeconds)};
g.k.GU=function(){g.De(this.C)||YVa(this,this.C);this.D=!1};
g.k.LM=function(a,b){this.B.stop();2===b&&this.VN()};
g.k.Ew=function(){if(z9(this)){this.i.stop();var a=R8(this.Tb);switch(a.playerState){case 1080:case 1081:case 1084:case 1085:this.u.vf=1;break;case 1082:case 1083:this.u.vf=0;break;default:this.u.vf=-1}switch(a.playerState){case 1081:case 1:this.Ub(new g.CJ(8));this.UN();break;case 1085:case 3:this.Ub(new g.CJ(9));break;case 1083:case 0:this.Ub(new g.CJ(2));this.K.stop();this.Xb(this.J.getVideoData().lengthSeconds);break;case 1084:this.Ub(new g.CJ(4));break;case 2:this.Ub(new g.CJ(4));this.Xb(M8(a));
break;case -1:this.Ub(new g.CJ(64));break;case -1E3:this.Ub(new g.CJ(128,{errorCode:"mdx.remoteerror",errorMessage:"\u0412\u0438\u0434\u0435\u043e \u043d\u0435\u0434\u043e\u0441\u0442\u0443\u043f\u043d\u043e \u0434\u043b\u044f \u0443\u0434\u0430\u043b\u0435\u043d\u043d\u043e\u0433\u043e \u0432\u043e\u0441\u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0434\u0435\u043d\u0438\u044f."}))}a=R8(this.Tb).trackData;var b=this.C;(a||b?a&&b&&a.trackName==b.trackName&&a.languageCode==b.languageCode&&a.languageName==
b.languageName&&a.kind==b.kind:1)||(this.C=a,YVa(this,a));a=R8(this.Tb);-1===a.volume||Math.round(this.J.getVolume())===a.volume&&this.J.isMuted()===a.muted||this.X.isActive()||this.DO()}else XVa(this)};
g.k.IM=function(){this.J.ea("mdxpreviousnextchange")};
g.k.qA=function(){z9(this)||XVa(this)};
g.k.CM=function(a){isNaN(a)||this.J.ea("mdxnowautoplaying",a)};
g.k.fM=function(){this.J.ea("mdxautoplaycanceled")};
g.k.setAudioTrack=function(a){z9(this)&&this.Tb.setAudioTrack(this.J.getVideoData(1).videoId,a)};
g.k.seekTo=function(a,b){-1===R8(this.Tb).playerState?B9(this,a):b&&this.Tb.seekTo(a)};
g.k.DO=function(){var a=this;if(z9(this)){var b=R8(this.Tb);this.events.pc(this.Z);b.muted?this.J.mute():this.J.unMute();this.J.setVolume(b.volume);this.Z=this.events.T(this.J,"onVolumeChange",function(c){WVa(a,c)})}};
g.k.UN=function(){this.i.stop();if(!this.Tb.isDisposed()){var a=R8(this.Tb);a.Ec()&&this.Ub(new g.CJ(8));this.Xb(M8(a));this.i.start()}};
g.k.VN=function(){this.B.stop();this.i.stop();var a=this.Tb.C.getReconnectTimeout();2==this.Tb.B&&!isNaN(a)&&this.B.start()};
g.k.Ub=function(a){this.B.stop();var b=this.I;if(!g.HJ(b,a)){var c=g.T(a,2);c!==g.T(this.I,2)&&this.J.Et(c);this.I=a;$Va(this.u,b,a)}};g.w(C9,g.X);C9.prototype.zd=function(){this.i.show()};
C9.prototype.Fb=function(){this.i.hide()};
C9.prototype.u=function(){S6("mdx-privacy-popup-cancel");this.Fb()};
C9.prototype.B=function(){S6("mdx-privacy-popup-confirm");this.Fb()};g.w(D9,g.X);D9.prototype.onStateChange=function(a){ZVa(this,a.state)};g.w(E9,g.BP);E9.prototype.D=function(){var a=this.J.getOption("remote","receivers");a&&1<a.length&&!this.J.getOption("remote","quickCast")?(this.Co=g.kc(a,this.i,this),g.CP(this,g.Mm(a,this.i)),a=this.J.getOption("remote","currentReceiver"),a=this.i(a),this.options[a]&&this.Vh(a),this.enable(!0)):this.enable(!1)};
E9.prototype.i=function(a){return a.key};
E9.prototype.ij=function(a){return"cast-selector-receiver"===a?"\u0414\u043e\u0431\u0430\u0432\u0438\u0442\u044c":this.Co[a].name};
E9.prototype.zf=function(a){g.BP.prototype.zf.call(this,a);this.J.setOption("remote","currentReceiver",this.Co[a]);this.Ab.Fb()};g.w(F9,g.LM);g.k=F9.prototype;
g.k.create=function(){var a=this.player.V(),b=g.DE(a);a={device:"Desktop",app:"youtube-desktop",loadCastApiSetupScript:a.N("mdx_load_cast_api_bootstrap_script"),enableDialLoungeToken:a.N("enable_dial_short_lived_lounge_token"),enableCastLoungeToken:a.N("enable_cast_short_lived_lounge_token")};RVa(b,a);this.subscriptions.push(g.Dv("yt-remote-before-disconnect",this.TT,this));this.subscriptions.push(g.Dv("yt-remote-connection-change",this.uV,this));this.subscriptions.push(g.Dv("yt-remote-receiver-availability-change",this.KM,
this));this.subscriptions.push(g.Dv("yt-remote-auto-connect",this.sV,this));this.subscriptions.push(g.Dv("yt-remote-receiver-resumed",this.rV,this));this.subscriptions.push(g.Dv("mdx-privacy-popup-confirm",this.IW,this));this.subscriptions.push(g.Dv("mdx-privacy-popup-cancel",this.HW,this));this.KM()};
g.k.load=function(){this.player.cancelPlayback();g.LM.prototype.load.call(this);this.Zh=new y9(this,this.player,this.Tb);var a=(a=VVa())?a.currentTime:0;var b=v9()?new Q8(p9(),void 0):null;0==a&&b&&(a=M8(R8(b)));0!==a&&this.Xb(a);$Va(this,this.Ad,this.Ad);this.player.Vk(6)};
g.k.unload=function(){this.player.ea("mdxautoplaycanceled");this.dn=this.Ok;(0,g.ge)(this.Zh,this.Tb);this.Tb=this.Zh=null;g.LM.prototype.unload.call(this);this.player.Vk(5);G9(this)};
g.k.xa=function(){g.Ev(this.subscriptions);g.LM.prototype.xa.call(this)};
g.k.Pk=function(a){var b=g.Ba.apply(1,arguments);this.loaded&&this.Zh.qj.apply(this.Zh,[a].concat(g.la(b)))};
g.k.getAdState=function(){return this.vf};
g.k.Hk=function(){return this.Tb?R8(this.Tb).Hk:!1};
g.k.hasNext=function(){return this.Tb?R8(this.Tb).hasNext:!1};
g.k.Xb=function(a,b){this.xL=a||0;this.player.ea("progresssync",a,b);this.player.Na("onVideoProgress",a||0)};
g.k.getCurrentTime=function(){return this.xL};
g.k.getProgressState=function(){var a=R8(this.Tb),b=this.player.getVideoData();return{airingStart:0,airingEnd:0,allowSeeking:this.player.V().N("web_player_mdx_allow_seeking_change_killswitch")?this.player.sf():!a.isAdPlaying()&&this.player.sf(),clipEnd:b.clipEnd,clipStart:b.clipStart,current:this.getCurrentTime(),displayedStart:-1,duration:a.getDuration(),ingestionTime:a.u?a.B+K8(a):a.B,isAtLiveHead:1>=(a.u?a.i+K8(a):a.i)-this.getCurrentTime(),loaded:a.S,seekableEnd:a.u?a.i+K8(a):a.i,seekableStart:0<
a.C?a.C+K8(a):a.C}};
g.k.nextVideo=function(){this.Tb&&this.Tb.nextVideo()};
g.k.EA=function(){this.Tb&&this.Tb.EA()};
g.k.TT=function(a){1===a&&(this.OF=this.Tb?R8(this.Tb):null)};
g.k.uV=function(){var a=v9()?new Q8(p9(),void 0):null;if(a){var b=this.dn;this.loaded&&this.unload();this.Tb=a;this.OF=null;b.key!==this.Ok.key&&(this.dn=b,this.load())}else(0,g.ee)(this.Tb),this.Tb=null,this.loaded&&(this.unload(),(a=this.OF)&&a.videoId===this.player.getVideoData().videoId&&this.player.cueVideoById(a.videoId,M8(a)));this.player.ea("videodatachange","newdata",this.player.getVideoData(),3)};
g.k.KM=function(){var a=[this.Ok],b=a.concat,c=SVa();E8()&&g.Ay("yt-remote-cast-available")&&c.push({key:"cast-selector-receiver",name:"Cast..."});this.Co=b.call(a,c);a=q9()||this.Ok;H9(this,a);this.player.Na("onMdxReceiversChange")};
g.k.sV=function(){var a=q9();H9(this,a)};
g.k.rV=function(){this.dn=q9()};
g.k.IW=function(){this.Mw=!0;G9(this);x9=!1;r9&&t9(r9,1);r9=null};
g.k.HW=function(){this.Mw=!1;G9(this);H9(this,this.Ok);this.dn=this.Ok;x9=!1;r9=null;this.player.playVideo()};
g.k.jf=function(a,b){switch(a){case "casting":return this.loaded;case "receivers":return this.Co;case "currentReceiver":return b&&("cast-selector-receiver"===b.key?G8():H9(this,b)),this.loaded?this.dn:this.Ok;case "quickCast":return 2===this.Co.length&&"cast-selector-receiver"===this.Co[1].key?(b&&G8(),!0):!1}};
g.k.KG=function(){this.Tb.KG()};
g.k.Pi=function(){return!1};
g.k.getOptions=function(){return["casting","receivers","currentReceiver","quickCast"]};g.KM("remote",F9);})(_yt_player);
