astroport/doc/Turning the database inside.../fU9hR3kiOK0_data/remote.js

541 lines
90 KiB
JavaScript

(function(g){var window=this;var Wva=function(a,b){return g.Jb(a,b)},X5=function(a,b,c){a.w.set(b,c)},Y5=function(a){X5(a,"zx",Math.floor(2147483648*Math.random()).toString(36)+Math.abs(Math.floor(2147483648*Math.random())^(0,g.H)()).toString(36));
return a},Z5=function(a,b,c){Array.isArray(c)||(c=[String(c)]);
g.an(a.w,b,c)},Xva=function(a,b){var c=[];
g.hk(b,function(d){try{var e=g.$n.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.Zn(e)&&c.push(d)},a);
return c},Yva=function(a,b){var c=Xva(a,b);
(0,g.y)(c,function(d){g.$n.prototype.remove.call(this,d)},a)},Zva=function(a){if(a.Sc){if(a.Sc.locationOverrideToken)return{locationOverrideToken:a.Sc.locationOverrideToken};
if(null!=a.Sc.latitudeE7&&null!=a.Sc.longitudeE7)return{latitudeE7:a.Sc.latitudeE7,longitudeE7:a.Sc.longitudeE7}}return null},$va=function(a,b){g.$a(a,b)||a.push(b)},$5=function(a){var b=0,c;
for(c in a)b++;return b},awa=function(a,b){var c=b instanceof g.tc?b:g.xc(b,/^data:image\//i.test(b));
a.src=g.uc(c)},a6=function(){},bwa=function(a){try{return g.v.JSON.parse(a)}catch(b){}a=String(a);
if(/^\s*$/.test(a)?0:/^[\],:{}\s\u2028\u2029]*$/.test(a.replace(/\\["\\\/bfnrtu]/g,"@").replace(/(?:"[^"\\\n\r\u2028\u2029\x00-\x08\x0a-\x1f]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?)[\s\u2028\u2029]*(?=:|,|]|}|$)/g,"]").replace(/(?:^|:|,)(?:[\s\u2028\u2029]*\[)+/g,"")))try{return eval("("+a+")")}catch(b){}throw Error("Invalid JSON string: "+a);},cwa=function(a){if(a.Ed&&"function"==typeof a.Ed)return a.Ed();
if("string"===typeof a)return a.split("");if(g.La(a)){for(var b=[],c=a.length,d=0;d<c;d++)b.push(a[d]);return b}return g.Fb(a)},dwa=function(a,b){if(a.forEach&&"function"==typeof a.forEach)a.forEach(b,void 0);
else if(g.La(a)||"string"===typeof a)(0,g.y)(a,b,void 0);else{if(a.te&&"function"==typeof a.te)var c=a.te();else if(a.Ed&&"function"==typeof a.Ed)c=void 0;else if(g.La(a)||"string"===typeof a){c=[];for(var d=a.length,e=0;e<d;e++)c.push(e)}else c=g.Gb(a);d=cwa(a);e=d.length;for(var f=0;f<e;f++)b.call(void 0,d[f],c&&c[f],a)}},ewa=function(a,b,c,d){var e=new g.Pm(null,void 0);
a&&g.Qm(e,a);b&&g.Rm(e,b);c&&g.Sm(e,c);d&&(e.u=d);return e},b6=function(a,b){g.Mo[a]=!0;
var c=g.Ko();c&&c.publish.apply(c,arguments);g.Mo[a]=!1},c6=function(a){this.app=this.name=this.id="";
this.type="REMOTE_CONTROL";this.obfuscatedGaiaId=this.avatar=this.username="";this.capabilities=new Set;this.experiments=new Set;this.theme="u";new g.Mm;a&&(this.id=a.id||a.name,this.name=a.name,this.app=a.app,this.type=a.type||"REMOTE_CONTROL",this.username=a.user||"",this.avatar=a.userAvatarUri||"",this.obfuscatedGaiaId=a.obfuscatedGaiaId||"",this.theme=a.theme||"u",fwa(this,a.capabilities||""),gwa(this,a.experiments||""))},fwa=function(a,b){a.capabilities.clear();
(0,g.ue)(b.split(","),g.Qa(Wva,hwa)).forEach(function(c){a.capabilities.add(c)})},gwa=function(a,b){a.experiments.clear();
b.split(",").forEach(function(c){a.experiments.add(c)})},d6=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||""},e6=function(a,b){return!!b&&(a.id==b||a.uuid==b)},iwa=function(a){return{name:a.name,
screenId:a.id,loungeToken:a.token,dialId:a.uuid}},jwa=function(a){return new d6(a)},kwa=function(a){return Array.isArray(a)?(0,g.Cc)(a,jwa):[]},f6=function(a){return a?'{name:"'+a.name+'",id:'+a.id.substr(0,6)+"..,token:"+(a.token?".."+a.token.slice(-6):"-")+",uuid:"+(a.uuid?".."+a.uuid.slice(-6):"-")+"}":"null"},g6=function(a){return Array.isArray(a)?"["+(0,g.Cc)(a,f6).join(",")+"]":"null"},h6=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)})},lwa=function(a){return(0,g.Cc)(a,function(b){return{key:b.id,
name:b.name}})},i6=function(a,b){return g.Xa(a,function(c){return c||b?!c!=!b?!1:c.id==b.id:!0})},j6=function(a,b){return g.Xa(a,function(c){return e6(c,b)})},k6=function(a){try{var b=(0,g.Cs)(),c=(0,g.Bs)();
b&&b.remove(a);c&&c.remove(a)}catch(d){}},mwa=function(){var a=(0,g.Bs)();
a&&Yva(a,a.o.Zf(!0))},l6=function(){var a=g.Es("yt-remote-connected-devices")||[];
g.rb(a);return a},nwa=function(a){if(g.ab(a))return[];
var b=a[0].indexOf("#"),c=-1==b?a[0]:a[0].substring(0,b);return(0,g.Cc)(a,function(d,e){return 0==e?d:d.substring(c.length)})},owa=function(a){g.Ds("yt-remote-connected-devices",a,86400)},n6=function(){if(m6)return m6;
var a=g.Es("yt-remote-device-id");a||(a=h6(),g.Ds("yt-remote-device-id",a,31536E3));for(var b=l6(),c=1,d=a;g.$a(b,d);)c++,d=a+"#"+c;return m6=d},o6=function(){var a=l6(),b=n6();
g.$a(a,b);g.Fs()&&g.ub(a,b);a=nwa(a);if(g.ab(a))try{g.Oq("remote_sid")}catch(c){}else try{g.Mq("remote_sid",a.join(","),-1)}catch(c){}},pwa=function(){return g.Es("yt-remote-session-browser-channel")},qwa=function(){return g.Es("yt-remote-local-screens")||[]},rwa=function(){g.Ds("yt-remote-lounge-token-expiration",!0,86400)},swa=function(a){5<a.length&&(a=a.slice(a.length-5));
var b=(0,g.Cc)(qwa(),function(d){return d.loungeToken}),c=(0,g.Cc)(a,function(d){return d.loungeToken});
(0,g.ti)(c,function(d){return!g.$a(b,d)})&&rwa();
g.Ds("yt-remote-local-screens",a,31536E3)},twa=function(a,b){g.Ds("yt-remote-session-browser-channel",a);
g.Ds("yt-remote-session-screen-id",b);var c=l6(),d=n6();g.$a(c,d)||c.push(d);owa(c);o6()},p6=function(a){a||(k6("yt-remote-session-screen-id"),k6("yt-remote-session-video-id"));
o6();a=l6();g.db(a,n6());owa(a)},uwa=function(){if(!q6){var a=g.ko();
a&&(q6=new g.Un(a))}return q6?!!q6.get("yt-remote-use-staging-server"):!1},vwa=function(a){return!!document.currentScript&&(-1!=document.currentScript.src.indexOf("?"+a)||-1!=document.currentScript.src.indexOf("&"+a))},wwa=function(){return"function"==typeof window.__onGCastApiAvailable?window.__onGCastApiAvailable:null},r6=function(a){a.length?xwa(a.shift(),function(){r6(a)}):s6()},ywa=function(a){return"chrome-extension://"+a+"/cast_sender.js"},xwa=function(a,b,c){var d=document.createElement("script");
d.onerror=b;c&&(d.onload=c);d.src=a;(document.head||document.documentElement).appendChild(d)},s6=function(){var a=wwa();
a&&a(!1,"No cast extension found")},Awa=function(){if(zwa){var a=2,b=wwa(),c=function(){a--;
0==a&&b&&b(!0)};
window.__onGCastApiAvailable=c;xwa("//www.gstatic.com/cast/sdk/libs/sender/1.0/cast_framework.js",s6,c)}},Bwa=function(){Awa();
var a=window.navigator.userAgent.match(/Chrome\/([0-9]+)/);r6(["//www.gstatic.com/eureka/clank/"+(a?parseInt(a[1],10):0)+"/cast_sender.js","//www.gstatic.com/eureka/clank/cast_sender.js"])},t6=function(a,b,c){g.A.call(this);
this.C=null!=c?(0,g.x)(a,c):a;this.Ad=b;this.B=(0,g.x)(this.kF,this);this.o=!1;this.u=0;this.w=this.Ga=null;this.A=[]},u6=function(a,b,c){g.A.call(this);
this.w=null!=c?(0,g.x)(a,c):a;this.Ad=b;this.u=(0,g.x)(this.lF,this);this.o=[]},v6=function(a){a.Ga=g.Uf(a.u,a.Ad);
a.w.apply(null,a.o)},w6=function(a){if(g.v.JSON)try{return g.v.JSON.parse(a)}catch(b){}return bwa(a)},x6=function(){},y6=function(){},Cwa=function(){},Ewa=function(a){return(a=Dwa(a))?new ActiveXObject(a):new XMLHttpRequest},Dwa=function(a){if(!a.u&&"undefined"==typeof XMLHttpRequest&&"undefined"!=typeof ActiveXObject){for(var b=["MSXML2.XMLHTTP.6.0",
"MSXML2.XMLHTTP.3.0","MSXML2.XMLHTTP","Microsoft.XMLHTTP"],c=0;c<b.length;c++){var d=b[c];try{return new ActiveXObject(d),a.u=d}catch(e){}}throw Error("Could not create ActiveXObject. ActiveX might be disabled, or MSXML might not be installed");}return a.u},z6=function(a,b,c,d){this.o=a;
this.w=b;this.G=c;this.F=d||1;this.B=45E3;this.A=new g.C1(this);this.u=new g.Tf;this.u.setInterval(250)},Gwa=function(a,b,c){a.Gj=1;
a.Vg=Y5(b.clone());a.Yi=c;a.C=!0;Fwa(a,null)},A6=function(a,b,c,d,e){a.Gj=1;
a.Vg=Y5(b.clone());a.Yi=null;a.C=c;e&&(a.ZB=!1);Fwa(a,d)},Fwa=function(a,b){a.wk=(0,g.H)();
B6(a);a.Ph=a.Vg.clone();Z5(a.Ph,"t",a.F);a.Sm=0;a.Lc=a.o.rr(a.o.Im()?b:null);0<a.ds&&(a.Ap=new u6((0,g.x)(a.VC,a,a.Lc),a.ds));a.A.ka(a.Lc,"readystatechange",a.cO);var c=a.zi?g.Pb(a.zi):{};a.Yi?(a.hq="POST",c["Content-Type"]="application/x-www-form-urlencoded",a.Lc.send(a.Ph,a.hq,a.Yi,c)):(a.hq="GET",a.ZB&&!g.je&&(c.Connection="close"),a.Lc.send(a.Ph,a.hq,null,c));a.o.bf(1)},Jwa=function(a,b,c){for(var d=!0;!a.hi&&a.Sm<c.length;){var e=Hwa(a,c);
if(e==C6){4==b&&(a.lh=4,D6(15),d=!1);break}else if(e==Iwa){a.lh=4;D6(16);d=!1;break}else E6(a,e)}4==b&&0==c.length&&(a.lh=1,D6(17),d=!1);a.df=a.df&&d;d||(F6(a),G6(a))},Hwa=function(a,b){var c=a.Sm,d=b.indexOf("\n",c);
if(-1==d)return C6;c=Number(b.substring(c,d));if(isNaN(c))return Iwa;d+=1;if(d+c>b.length)return C6;var e=b.substr(d,c);a.Sm=d+c;return e},Lwa=function(a,b){a.wk=(0,g.H)();
B6(a);var c=b?window.location.hostname:"";a.Ph=a.Vg.clone();X5(a.Ph,"DOMAIN",c);X5(a.Ph,"t",a.F);try{a.kf=new ActiveXObject("htmlfile")}catch(n){F6(a);a.lh=7;D6(22);G6(a);return}var d="<html><body>";if(b){for(var e="",f=0;f<c.length;f++){var k=c.charAt(f);if("<"==k)e+="\\x3c";else if(">"==k)e+="\\x3e";else{var l=k;if(l in H6)k=H6[l];else if(l in Kwa)k=H6[l]=Kwa[l];else{var m=l.charCodeAt(0);if(31<m&&127>m)k=l;else{if(256>m){if(k="\\x",16>m||256<m)k+="0"}else k="\\u",4096>m&&(k+="0");k+=m.toString(16).toUpperCase()}k=
H6[l]=k}e+=k}}d+='<script>document.domain="'+e+'"\x3c/script>'}c=g.Wc(g.Yb("b/12014412"),d+"</body></html>");a.kf.open();a.kf.write(g.Qc(c));a.kf.close();a.kf.parentWindow.m=(0,g.x)(a.wN,a);a.kf.parentWindow.d=(0,g.x)(a.hB,a,!0);a.kf.parentWindow.rpcClose=(0,g.x)(a.hB,a,!1);c=a.kf.createElement("DIV");a.kf.parentWindow.document.body.appendChild(c);d=g.wc(a.Ph.toString());d=g.dd(g.uc(d));d=g.Wc(g.Yb("b/12014412"),'<iframe src="'+d+'"></iframe>');g.Xc(c,d);a.o.bf(1)},B6=function(a){a.ev=(0,g.H)()+a.B;
Mwa(a,a.B)},Mwa=function(a,b){if(null!=a.Jk)throw Error("WatchDog timer not null");
a.Jk=I6((0,g.x)(a.EN,a),b)},J6=function(a){a.Jk&&(g.v.clearTimeout(a.Jk),a.Jk=null)},G6=function(a){a.o.Kx()||a.hi||a.o.fo(a)},F6=function(a){J6(a);
g.He(a.Ap);a.Ap=null;a.u.stop();g.Rqa(a.A);if(a.Lc){var b=a.Lc;a.Lc=null;b.abort();b.dispose()}a.kf&&(a.kf=null)},E6=function(a,b){try{a.o.ZA(a,b),a.o.bf(4)}catch(c){}},Owa=function(a,b,c,d,e){if(0==d)c(!1);
else{var f=e||0;d--;Nwa(a,b,function(k){k?c(!0):g.v.setTimeout(function(){Owa(a,b,c,d,f)},f)})}},Nwa=function(a,b,c){var d=new Image;
d.onload=function(){try{K6(d),c(!0)}catch(e){}};
d.onerror=function(){try{K6(d),c(!1)}catch(e){}};
d.onabort=function(){try{K6(d),c(!1)}catch(e){}};
d.ontimeout=function(){try{K6(d),c(!1)}catch(e){}};
g.v.setTimeout(function(){if(d.ontimeout)d.ontimeout()},b);
awa(d,a)},K6=function(a){a.onload=null;
a.onerror=null;a.onabort=null;a.ontimeout=null},Pwa=function(a){this.o=a;
this.u=new x6},Qwa=function(a){var b=L6(a.o,a.Vk,"/mail/images/cleardot.gif");
Y5(b);Owa(b.toString(),5E3,(0,g.x)(a.eE,a),3,2E3);a.bf(1)},N6=function(a){var b=a.o.I;
if(null!=b)D6(5),b?(D6(11),M6(a.o,a,!1)):(D6(12),M6(a.o,a,!0));else if(a.Vd=new z6(a,void 0,void 0,void 0),a.Vd.zi=a.Yr,b=a.o,b=L6(b,b.Im()?a.Cl:null,a.Zr),D6(5),!g.he||g.Ld(10))Z5(b,"TYPE","xmlhttp"),A6(a.Vd,b,!1,a.Cl,!1);else{Z5(b,"TYPE","html");var c=a.Vd;a=!!a.Cl;c.Gj=3;c.Vg=Y5(b.clone());Lwa(c,a)}},O6=function(a){g.gf.call(this);
this.headers=new g.Mm;this.U=a||null;this.w=!1;this.R=this.o=null;this.ha=this.I="";this.C=0;this.A="";this.B=this.Z=this.G=this.V=!1;this.F=0;this.P=null;this.da="";this.M=this.ba=!1},Rwa=function(a){return g.he&&g.Kd(9)&&"number"===typeof a.timeout&&void 0!==a.ontimeout},Swa=function(a){return"content-type"==a.toLowerCase()},Uwa=function(a,b){a.w=!1;
a.o&&(a.B=!0,a.o.abort(),a.B=!1);a.A=b;a.C=5;Twa(a);P6(a)},Twa=function(a){a.V||(a.V=!0,a.dispatchEvent("complete"),a.dispatchEvent("error"))},Wwa=function(a){if(a.w&&"undefined"!=typeof g.H1)if(a.R[1]&&4==Q6(a)&&2==a.getStatus())R6(a,"Local request error detected and ignored");
else if(a.G&&4==Q6(a))g.Uf(a.VA,0,a);else if(a.dispatchEvent("readystatechange"),4==Q6(a)){R6(a,"Request complete");a.w=!1;try{var b=a.getStatus();a:switch(b){case 200:case 201:case 202:case 204:case 206:case 304:case 1223:var c=!0;break a;default:c=!1}var d;if(!(d=c)){var e;if(e=0===b){var f=g.nd(1,String(a.I));if(!f&&g.v.self&&g.v.self.location){var k=g.v.self.location.protocol;f=k.substr(0,k.length-1)}e=!Vwa.test(f?f.toLowerCase():"")}d=e}if(d)a.dispatchEvent("complete"),a.dispatchEvent("success");
else{a.C=6;try{var l=2<Q6(a)?a.o.statusText:""}catch(m){l=""}a.A=l+" ["+a.getStatus()+"]";Twa(a)}}finally{P6(a)}}},P6=function(a,b){if(a.o){Xwa(a);
var c=a.o,d=a.R[0]?g.Ia:null;a.o=null;a.R=null;b||a.dispatchEvent("ready");try{c.onreadystatechange=d}catch(e){}}},Xwa=function(a){a.o&&a.M&&(a.o.ontimeout=null);
a.P&&(g.v.clearTimeout(a.P),a.P=null)},Q6=function(a){return a.o?a.o.readyState:0},S6=function(a){try{return a.o?a.o.responseText:""}catch(b){return""}},R6=function(a,b){return b+" ["+a.ha+" "+a.I+" "+a.getStatus()+"]"},T6=function(a,b,c){this.o=1;
this.u=[];this.A=[];this.B=new x6;this.G=a||null;this.I=null!=b?b:null;this.C=c||!1},Ywa=function(a,b){this.o=a;
this.map=b;this.context=null},Zwa=function(a){g.Je.call(this,"statevent",a)},$wa=function(a,b){g.Je.call(this,"timingevent",a);
this.size=b},axa=function(a){g.Je.call(this,"serverreachability",a)},dxa=function(a){bxa(a);
if(3==a.o){var b=a.lm++,c=a.Rn.clone();X5(c,"SID",a.w);X5(c,"RID",b);X5(c,"TYPE","terminate");U6(a,c);b=new z6(a,a.w,b,void 0);b.Gj=2;b.Vg=Y5(c.clone());awa(new Image,b.Vg.toString());b.wk=(0,g.H)();B6(b)}cxa(a)},exa=function(a){a.DE(1,0);
a.Rn=L6(a,null,a.Xr);V6(a)},bxa=function(a){a.Zg&&(a.Zg.abort(),a.Zg=null);
a.hc&&(a.hc.cancel(),a.hc=null);a.cg&&(g.v.clearTimeout(a.cg),a.cg=null);W6(a);a.Od&&(a.Od.cancel(),a.Od=null);a.eh&&(g.v.clearTimeout(a.eh),a.eh=null)},fxa=function(a,b){if(0==a.o)throw Error("Invalid operation: sending map when state is closed");
a.u.push(new Ywa(a.OJ++,b));2!=a.o&&3!=a.o||V6(a)},V6=function(a){a.Od||a.eh||(a.eh=I6((0,g.x)(a.gB,a),0),a.yj=0)},hxa=function(a,b){if(1==a.o){if(!b){a.lm=Math.floor(1E5*Math.random());
var c=a.lm++,d=new z6(a,"",c,void 0);d.zi=null;var e=X6(a),f=a.Rn.clone();X5(f,"RID",c);X5(f,"CVER","1");U6(a,f);Gwa(d,f,e);a.Od=d;a.o=2}}else 3==a.o&&(b?gxa(a,b):0==a.u.length||a.Od||gxa(a))},gxa=function(a,b){if(b)if(6<a.ii){a.u=a.A.concat(a.u);
a.A.length=0;var c=a.lm-1;var d=X6(a)}else c=b.G,d=b.Yi;else c=a.lm++,d=X6(a);var e=a.Rn.clone();X5(e,"SID",a.w);X5(e,"RID",c);X5(e,"AID",a.Tj);U6(a,e);c=new z6(a,a.w,c,a.yj+1);c.zi=null;c.setTimeout(1E4+Math.round(1E4*Math.random()));a.Od=c;Gwa(c,e,d)},U6=function(a,b){if(a.wd){var c=a.wd.gx();
c&&g.zb(c,function(d,e){X5(b,e,d)})}},X6=function(a){var b=Math.min(a.u.length,1E3),c=["count="+b];
if(6<a.ii&&0<b){var d=a.u[0].o;c.push("ofs="+d)}else d=0;for(var e=0;e<b;e++){var f=a.u[e].o,k=a.u[e].map;f=6>=a.ii?e:f-d;try{g.zb(k,function(l,m){c.push("req"+f+"_"+m+"="+encodeURIComponent(l))})}catch(l){c.push("req"+f+"_type="+encodeURIComponent("_badmap"))}}a.A=a.A.concat(a.u.splice(0,b));
return c.join("&")},ixa=function(a){a.hc||a.cg||(a.F=1,a.cg=I6((0,g.x)(a.fB,a),0),a.qj=0)},Y6=function(a){if(a.hc||a.cg||3<=a.qj)return!1;
a.F++;a.cg=I6((0,g.x)(a.fB,a),jxa(a,a.qj));a.qj++;return!0},M6=function(a,b,c){a.fq=c;
a.yf=b.rg;a.C||exa(a)},W6=function(a){null!=a.ni&&(g.v.clearTimeout(a.ni),a.ni=null)},jxa=function(a,b){var c=5E3+Math.floor(1E4*Math.random());
a.isActive()||(c*=2);return c*b},Z6=function(a,b){if(2==b||9==b){var c=null;
a.wd&&(c=null);var d=(0,g.x)(a.NO,a);c||(c=new g.Pm("//www.google.com/images/cleardot.gif"),Y5(c));Nwa(c.toString(),1E4,d)}else D6(2);kxa(a,b)},kxa=function(a,b){a.o=0;
a.wd&&a.wd.xw(b);cxa(a);bxa(a)},cxa=function(a){a.o=0;
a.yf=-1;if(a.wd)if(0==a.A.length&&0==a.u.length)a.wd.fr();else{g.gb(a.A);var b=g.gb(a.u);a.A.length=0;a.u.length=0;a.wd.fr(b)}},L6=function(a,b,c){var d=g.Xm(c);
if(""!=d.o)b&&g.Rm(d,b+"."+d.o),g.Sm(d,d.A);else{var e=window.location;d=ewa(e.protocol,b?b+"."+e.hostname:e.hostname,+e.port,c)}a.ql&&g.zb(a.ql,function(f,k){X5(d,k,f)});
X5(d,"VER",a.ii);U6(a,d);return d},I6=function(a,b){if(!g.Ma(a))throw Error("Fn must not be null and must be a function");
return g.v.setTimeout(function(){a()},b)},D6=function(a){$6.dispatchEvent(new Zwa($6,a))},lxa=function(){},mxa=function(){this.o=[];
this.u=[]},nxa=function(a,b){this.action=a;
this.params=b||{}},a7=function(a,b){g.A.call(this);
this.o=new g.I(this.pN,0,this);g.B(this,this.o);this.Ad=5E3;this.u=0;if(g.Ma(a))b&&(a=(0,g.x)(a,b));else if(a&&g.Ma(a.handleEvent))a=(0,g.x)(a.handleEvent,a);else throw Error("Invalid listener argument");this.w=a},b7=function(a,b,c){this.P=a;
this.C=b;this.w=new g.Tn;this.u=new a7(this.qO,this);this.o=null;this.ub=!1;this.B=null;this.I="";this.G=this.A=0;this.F=[];this.M=c||!1},oxa=function(a){return{firstTestResults:[""],
secondTestResults:!a.o.fq,sessionId:a.o.w,arrayId:a.o.Tj}},pxa=function(a,b){a.G=b||0;
a.u.stop();a.o&&(3==a.o.o&&hxa(a.o),dxa(a.o));a.G=0},c7=function(a){return!!a.o&&3==a.o.o},qxa=function(a,b){(a.C.loungeIdToken=b)||a.u.stop()},d7=function(a){this.port=this.domain="";
this.o="/api/lounge";this.u=!0;a=a||document.location.href;var b=Number(g.nd(4,a))||"";b&&(this.port=":"+b);this.domain=g.od(a)||"";a=g.Ic;0<=a.search("MSIE")&&(a=a.match(/MSIE ([\d.]+)/)[1],0>g.qc(a,"10.0")&&(this.u=!1))},e7=function(a,b){var c=a.o;
a.u&&(c="https://"+a.domain+a.port+a.o);return g.yd(c+b,{})},f7=function(a,b,c,d,e){a={format:"JSON",
method:"POST",context:a,timeout:5E3,withCredentials:!1,onSuccess:g.Qa(a.A,d,!0),onError:g.Qa(a.w,e),Ud:g.Qa(a.B,e)};c&&(a.sb=c,a.headers={"Content-Type":"application/x-www-form-urlencoded"});return g.Eq(b,a)},uxa=function(){var a=rxa;
sxa();g7.push(a);txa(g7)},h7=function(a,b){sxa();
var c=g7,d=vxa(a,String(b));g.ab(c)?wxa(d):(txa(c),(0,g.y)(c,function(e){e(d)}))},sxa=function(){g7||(g7=g.w("yt.mdx.remote.debug.handlers_")||[],g.Ga("yt.mdx.remote.debug.handlers_",g7,void 0))},wxa=function(a){var b=(i7+1)%50;
i7=b;j7[b]=a;k7||(k7=49==b)},txa=function(a){var b=j7;
if(b[0]){var c=i7,d=k7?c:-1;do{d=(d+1)%50;var e=b[d];(0,g.y)(a,function(f){f(e)})}while(d!=c);
j7=Array(50);i7=-1;k7=!1}},vxa=function(a,b){var c=((0,g.H)()-xxa)/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("")},l7=function(a){g.O.call(this);
this.F=a;this.o=[]},yxa=function(a,b){var c=a.get(b.uuid)||a.get(b.id);
if(c){var d=c.name;c.id=b.id||c.id;c.name=b.name;c.token=b.token;c.uuid=b.uuid||c.uuid;return c.name!=d}a.o.push(b);return!0},zxa=function(a,b){var c=a.o.length!=b.length;
a.o=(0,g.ue)(a.o,function(f){return!!i6(b,f)});
for(var d=0,e=b.length;d<e;d++)c=yxa(a,b[d])||c;return c},Axa=function(a,b){var c=a.o.length;
a.o=(0,g.ue)(a.o,function(d){return!(d||b?!d!=!b?0:d.id==b.id:1)});
return a.o.length<c},m7=function(a,b,c,d){g.O.call(this);
this.C=a;this.A=b;this.B=c;this.w=d;this.u=0;this.o=null;this.Ga=NaN},o7=function(a){l7.call(this,"LocalScreenService");
this.w=a;this.u=NaN;n7(this);this.info("Initializing with "+g6(this.o))},Bxa=function(a){if(a.o.length){var b=(0,g.Cc)(a.o,function(d){return d.id}),c=e7(a.w,"/pairing/get_lounge_token_batch");
f7(a.w,c,{screen_ids:b.join(",")},(0,g.x)(a.vF,a),(0,g.x)(a.uF,a))}},n7=function(a){var b=kwa(qwa());
b=(0,g.ue)(b,function(c){return!c.uuid});
return zxa(a,b)},p7=function(a,b){swa((0,g.Cc)(a.o,iwa));
b&&rwa()},r7=function(a,b){g.O.call(this);
this.C=b;var c=g.Es("yt-remote-online-screen-ids")||"";c=c?c.split(","):[];for(var d={},e=this.C(),f=0,k=e.length;f<k;++f){var l=e[f].id;d[l]=g.$a(c,l)}this.o=d;this.B=a;this.w=this.A=NaN;this.u=null;q7("Initialized with "+g.Jk(this.o))},Cxa=function(a,b,c){var d=e7(a.B,"/pairing/get_screen_availability");
f7(a.B,d,{lounge_token:b.token},(0,g.x)(function(e){e=e.screens||[];for(var f=0,k=e.length;f<k;++f)if(e[f].loungeToken==b.token){c("online"==e[f].status);return}c(!1)},a),(0,g.x)(function(){c(!1)},a))},s7=function(a,b){a:if($5(b)!=$5(a.o))var c=!1;
else{c=g.Gb(b);for(var d=0,e=c.length;d<e;++d)if(!a.o[c[d]]){c=!1;break a}c=!0}c||(q7("Updated online screens: "+g.Jk(a.o)),a.o=b,a.S("screenChange"));Dxa(a)},t7=function(a){isNaN(a.w)||g.Jo(a.w);
a.w=g.Ho((0,g.x)(a.vu,a),0<a.A&&a.A<(0,g.H)()?2E4:1E4)},q7=function(a){h7("OnlineScreenService",a)},Exa=function(a){var b={};
(0,g.y)(a.C(),function(c){c.token?b[c.token]=c.id:this.Ub("Requesting availability of screen w/o lounge token.")});
return b},Dxa=function(a){a=g.Gb(g.Ab(a.o,function(b){return b}));
g.rb(a);a.length?g.Ds("yt-remote-online-screen-ids",a.join(","),60):k6("yt-remote-online-screen-ids")},u7=function(a){l7.call(this,"ScreenService");
this.C=a;this.u=this.w=null;this.A=[];this.B={};Fxa(this)},Hxa=function(a,b,c,d,e,f){a.info("getAutomaticScreenByIds "+c+" / "+b);
c||(c=a.B[b]);var k=a.he();if(k=(c?j6(k,c):null)||j6(k,b)){k.uuid=b;var l=v7(a,k);Cxa(a.u,l,function(m){e(m?l:null)})}else c?Gxa(a,c,(0,g.x)(function(m){var n=v7(this,new d6({name:d,
screenId:c,loungeToken:m,dialId:b||""}));Cxa(this.u,n,function(p){e(p?n:null)})},a),f):e(null)},Ixa=function(a,b){for(var c=0,d=a.o.length;c<d;++c)if(a.o[c].name==b)return a.o[c];
return null},Gxa=function(a,b,c,d){a.info("requestLoungeToken_ for "+b);
var e={sb:{screen_ids:b},method:"POST",context:a,onSuccess:function(f,k){var l=k&&k.screens||[];l[0]&&l[0].screenId==b?c(l[0].loungeToken):d(Error("Missing lounge token in token response"))},
onError:function(){d(Error("Request screen lounge token failed"))}};
g.Eq(e7(a.C,"/pairing/get_lounge_token_batch"),e)},Jxa=function(a){a.o=a.w.he();
var b=a.B,c={},d;for(d in b)c[b[d]]=d;b=0;for(d=a.o.length;b<d;++b){var e=a.o[b];e.uuid=c[e.id]||""}a.info("Updated manual screens: "+g6(a.o))},Fxa=function(a){w7(a);
a.w=new o7(a.C);a.w.subscribe("screenChange",(0,g.x)(a.EF,a));Jxa(a);a.A=kwa(g.Es("yt-remote-automatic-screen-cache")||[]);w7(a);a.info("Initializing automatic screens: "+g6(a.A));a.u=new r7(a.C,(0,g.x)(a.he,a,!0));a.u.subscribe("screenChange",(0,g.x)(function(){this.S("onlineScreenChange")},a))},v7=function(a,b){var c=a.get(b.id);
c?(c.uuid=b.uuid,b=c):((c=j6(a.A,b.uuid))?(c.id=b.id,c.token=b.token,b=c):a.A.push(b),g.Ds("yt-remote-automatic-screen-cache",(0,g.Cc)(a.A,iwa)));w7(a);a.B[b.uuid]=b.id;g.Ds("yt-remote-device-id-map",a.B,31536E3);return b},w7=function(a){a.B=g.Es("yt-remote-device-id-map")||{}},x7=function(a,b,c){g.O.call(this);
this.R=c;this.I=a;this.u=b;this.w=null},y7=function(a,b){h7(a.R,b)},z7=function(a,b){x7.call(this,a,b,"CastSession");
this.o=null;this.A=0;this.C=(0,g.x)(this.xP,this);this.B=(0,g.x)(this.MN,this);this.A=g.Ho((0,g.x)(function(){Kxa(this,null)},this),12E4)},Lxa=function(a){a.info("sendYoutubeMessage_: getMdxSessionStatus "+g.Jk(void 0));
var b={type:"getMdxSessionStatus"};a.o?a.o.sendMessage("urn:x-cast:com.google.youtube.mdx",b,g.Ia,(0,g.x)(function(){y7(this,"Failed to send message: getMdxSessionStatus.")},a)):y7(a,"Sending yt message without session: "+g.Jk(b))},Kxa=function(a,b){g.Jo(a.A);
if(b){if(a.info("onConnectedScreenId_: Received screenId: "+b),!a.w||a.w.id!=b){var c=(0,g.x)(a.qp,a),d=(0,g.x)(a.le,a);a.Cx(b,c,d,5)}}else a.le(Error("Waiting for session status timed out."))},A7=function(a,b,c){x7.call(this,a,b,"DialSession");
this.A=this.G=null;this.P="";this.U=c;this.B=null;this.F=g.Ia;this.C=NaN;this.M=(0,g.x)(this.AP,this);this.o=g.Ia},Mxa=function(a){a.o=a.I.bD(a.P,a.u.label,a.u.friendlyName,(0,g.x)(function(b){this.o=g.Ia;
this.qp(b)},a),(0,g.x)(function(b){this.o=g.Ia;
this.le(b)},a))},Nxa=function(a){var b={};
b.pairingCode=a.P;b.theme=a.U;if(a.B){var c=a.B.currentTime||0;b.v=a.B.videoId;b.t=c}uwa()&&(b.env_useStageMdx=1);return g.wd(b)},B7=function(a,b){x7.call(this,a,b,"ManualSession");
this.o=g.Ho((0,g.x)(this.Uj,this,null),150)},C7=function(a,b,c,d){g.O.call(this);
this.u=a;this.F=b||"233637DE";this.C=c||"cl";this.G=d||!1;this.o=null;this.B=!1;this.w=[];this.A=(0,g.x)(this.zM,this)},Oxa=function(a,b){return b?g.Xa(a.w,function(c){return e6(b,c.label)},a):null},D7=function(a){h7("Controller",a)},rxa=function(a){window.chrome&&chrome.cast&&chrome.cast.logMessage&&chrome.cast.logMessage(a)},E7=function(a){return a.B||!!a.w.length||!!a.o},F7=function(a,b,c){b!=a.o&&(g.He(a.o),(a.o=b)?(c?a.S("yt-remote-cast2-receiver-resumed",b.u):a.S("yt-remote-cast2-receiver-selected",
b.u),b.subscribe("sessionScreen",(0,g.x)(a.eB,a,b)),b.w?a.S("yt-remote-cast2-session-change",b.w):c&&a.o.Uj(null)):a.S("yt-remote-cast2-session-change",null))},Pxa=function(a){var b=a.u.aD(),c=a.o&&a.o.u;
a=(0,g.Cc)(b,function(d){c&&e6(d,c.label)&&(c=null);var e=d.uuid?d.uuid:d.id,f=Oxa(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},Vxa=function(a,b,c,d,e,f,k){Qxa()?Rxa(b,e,f,k)&&(H7(!0),window.chrome&&chrome.cast&&chrome.cast.isAvailable?Sxa(a,c):(window.__onGCastApiAvailable=function(l,m){l?Sxa(a,c):(I7("Failed to load cast API: "+m),J7(!1),H7(!1),k6("yt-remote-cast-available"),k6("yt-remote-cast-receiver"),Txa(),c(!1))},d?g.To("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?Bwa():!window.chrome||!window.navigator.presentation||0<=window.navigator.userAgent.indexOf("Edge")?s6():(Awa(),r6(Uxa.map(ywa))))):G7("Cannot initialize because not running Chrome")},Txa=function(){G7("dispose");
var a=K7();a&&a.dispose();g.Ga("yt.mdx.remote.cloudview.instance_",null,void 0);Wxa(!1);g.Po(L7);L7.length=0},M7=function(){return!!g.Es("yt-remote-cast-installed")},Xxa=function(){var a=g.Es("yt-remote-cast-receiver");
return a?a.friendlyName:null},Yxa=function(){G7("clearCurrentReceiver");
k6("yt-remote-cast-receiver")},Zxa=function(){return M7()?K7()?K7().getCastSession():(I7("getCastSelector: Cast is not initialized."),null):(I7("getCastSelector: Cast API is not installed!"),null)},O7=function(){M7()?K7()?N7()?(G7("Requesting cast selector."),K7().requestSession()):(G7("Wait for cast API to be ready to request the session."),L7.push(g.Oo("yt-remote-cast2-api-ready",O7))):I7("requestCastSelector: Cast is not initialized."):I7("requestCastSelector: Cast API is not installed!")},P7=
function(a,b){N7()?K7().setConnectedScreenStatus(a,b):I7("setConnectedScreenStatus called before ready.")},Qxa=function(){var a=0<=g.Ic.search(/ (CrMo|Chrome|CriOS)\//);
return g.Dt||a},$xa=function(a,b){K7().init(a,b)},Rxa=function(a,b,c,d){var e=!1;
K7()||(a=new C7(a,b,c,d),a.subscribe("yt-remote-cast2-availability-change",function(f){g.Ds("yt-remote-cast-available",f);b6("yt-remote-cast2-availability-change",f)}),a.subscribe("yt-remote-cast2-receiver-selected",function(f){G7("onReceiverSelected: "+f.friendlyName);
g.Ds("yt-remote-cast-receiver",f);b6("yt-remote-cast2-receiver-selected",f)}),a.subscribe("yt-remote-cast2-receiver-resumed",function(f){G7("onReceiverResumed: "+f.friendlyName);
g.Ds("yt-remote-cast-receiver",f)}),a.subscribe("yt-remote-cast2-session-change",function(f){G7("onSessionChange: "+f6(f));
f||k6("yt-remote-cast-receiver");b6("yt-remote-cast2-session-change",f)}),g.Ga("yt.mdx.remote.cloudview.instance_",a,void 0),e=!0);
G7("cloudview.createSingleton_: "+e);return e},K7=function(){return g.w("yt.mdx.remote.cloudview.instance_")},Sxa=function(a,b){J7(!0);
H7(!1);$xa(a,function(c){c?(Wxa(!0),g.Qo("yt-remote-cast2-api-ready")):(I7("Failed to initialize cast API."),J7(!1),k6("yt-remote-cast-available"),k6("yt-remote-cast-receiver"),Txa());b(c)})},G7=function(a){h7("cloudview",a)},I7=function(a){h7("cloudview",a)},J7=function(a){G7("setCastInstalled_ "+a);
g.Ds("yt-remote-cast-installed",a)},N7=function(){return!!g.w("yt.mdx.remote.cloudview.apiReady_")},Wxa=function(a){G7("setApiReady_ "+a);
g.Ga("yt.mdx.remote.cloudview.apiReady_",a,void 0)},H7=function(a){g.Ga("yt.mdx.remote.cloudview.initializing_",a,void 0)},Q7=function(a){this.index=-1;
this.videoId=this.listId="";this.volume=this.playerState=-1;this.muted=!1;this.audioTrackId=null;this.C=this.F=0;this.o=null;this.hasNext=this.P=!1;this.I=this.G=this.u=this.B=0;this.A=NaN;this.w=!1;this.reset(a)},R7=function(a){a.audioTrackId=null;
a.o=null;a.playerState=-1;a.P=!1;a.hasNext=!1;a.F=0;a.C=(0,g.H)();a.B=0;a.u=0;a.G=0;a.I=0;a.A=NaN;a.w=!1},S7=function(a){return a.eb()?((0,g.H)()-a.C)/1E3:0},T7=function(a,b){a.F=b;
a.C=(0,g.H)()},U7=function(a){switch(a.playerState){case 1:case 1081:return((0,g.H)()-a.C)/1E3+a.F;
case -1E3:return 0}return a.F},V7=function(a,b,c){var d=a.videoId;
a.videoId=b;a.index=c;b!=d&&R7(a)},W7=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.Qb(a.o);b.hasPrevious=a.P;b.hasNext=a.hasNext;b.playerTime=a.F;b.playerTimeAt=a.C;b.seekableStart=a.B;b.seekableEnd=a.u;b.duration=a.G;b.loadedTime=a.I;b.liveIngestionTime=a.A;return b},Y7=function(a,b){g.O.call(this);
this.o=0;this.A=a;this.C=[];this.B=new mxa;this.w=this.u=null;this.I=(0,g.x)(this.wK,this);this.F=(0,g.x)(this.nm,this);this.G=(0,g.x)(this.vK,this);this.P=(0,g.x)(this.HK,this);var c=0;a?(c=a.getProxyState(),3!=c&&(a.subscribe("proxyStateChange",this.hv,this),aya(this))):c=3;0!=c&&(b?this.hv(c):g.Ho((0,g.x)(function(){this.hv(c)},this),0));
var d=Zxa();d&&X7(this,d);this.subscribe("yt-remote-cast2-session-change",this.P)},Z7=function(a){return new Q7(a.A.getPlayerContextData())},aya=function(a){(0,g.y)("nowAutoplaying autoplayDismissed remotePlayerChange remoteQueueChange autoplayModeChange autoplayUpNext previousNextChange".split(" "),function(b){this.C.push(this.A.subscribe(b,g.Qa(this.wM,b),this))},a)},bya=function(a){(0,g.y)(a.C,function(b){this.A.unsubscribeByKey(b)},a);
a.C.length=0},$7=function(a,b){var c=a.B;
50>c.o.length+c.u.length&&a.B.u.push(b)},b8=function(a,b,c){var d=Z7(a);
T7(d,c);-1E3!=d.playerState&&(d.playerState=b);a8(a,d)},c8=function(a,b,c){a.A.sendMessage(b,c)},a8=function(a,b){bya(a);
a.A.setPlayerContextData(W7(b));aya(a)},X7=function(a,b){a.w&&(a.w.removeUpdateListener(a.I),a.w.removeMediaListener(a.F),a.nm(null));
a.w=b;a.w&&(h7("CP","Setting cast session: "+a.w.sessionId),a.w.addUpdateListener(a.I),a.w.addMediaListener(a.F),a.w.media.length&&a.nm(a.w.media[0]))},cya=function(a){var b=a.u.media,c=a.u.customData;
if(b&&c){var d=Z7(a);b.contentId!=d.videoId&&h7("CP","Cast changing video to: "+b.contentId);d.videoId=b.contentId;d.playerState=c.playerState;T7(d,a.u.getEstimatedTime());a8(a,d)}else h7("CP","No cast media video. Ignoring state update.")},d8=function(a,b,c){return(0,g.x)(function(d){this.Ub("Failed to "+b+" with cast v2 channel. Error code: "+d.code);
d.code!=chrome.cast.ErrorCode.TIMEOUT&&(this.Ub("Retrying "+b+" using MDx browser channel."),c8(this,b,c))},a)},e8=function(a,b,c){g.O.call(this);
this.B=NaN;this.M=!1;this.G=this.F=this.I=this.P=NaN;this.R=[];this.A=this.C=this.w=this.Va=this.o=null;this.V=a;this.R.push(g.Ep(window,"beforeunload",(0,g.x)(this.nF,this)));this.u=[];this.Va=new Q7;this.U=b.id;this.o=dya(this,c);this.o.subscribe("handlerOpened",this.AK,this);this.o.subscribe("handlerClosed",this.xK,this);this.o.subscribe("handlerError",this.yK,this);this.o.subscribe("handlerMessage",this.zK,this);qxa(this.o,b.token);this.subscribe("remoteQueueChange",function(){var d=this.Va.videoId;
g.Fs()&&g.Ds("yt-remote-session-video-id",d)},this)},f8=function(a){h7("conn",a)},dya=function(a,b){return new b7(e7(a.V,"/bc"),b)},g8=function(a,b){a.S("proxyStateChange",b)},eya=function(a){a.B=g.Ho((0,g.x)(function(){f8("Connecting timeout");
this.wj(1)},a),2E4)},h8=function(a){g.Jo(a.B);
a.B=NaN},i8=function(a){g.Jo(a.P);
a.P=NaN},fya=function(a){j8(a);
a.I=g.Ho((0,g.x)(function(){k8(this,"getNowPlaying")},a),2E4)},j8=function(a){g.Jo(a.I);
a.I=NaN},hya=function(a,b){b&&(h8(a),i8(a));
b==(c7(a.o)&&isNaN(a.B))?b&&(g8(a,1),k8(a,"getSubtitlesTrack")):b?(a.Ax()&&a.Va.reset(),g8(a,1),k8(a,"getNowPlaying"),gya(a)):a.wj(1)},iya=function(a,b){var c=b.params.videoId;
delete b.params.videoId;c==a.Va.videoId&&(g.Mb(b.params)?a.Va.o=null:a.Va.o=b.params,a.S("remotePlayerChange"))},jya=function(a,b){var c=b.params.videoId||b.params.video_id,d=parseInt(b.params.currentIndex,10);
a.Va.listId=b.params.listId||a.Va.listId;V7(a.Va,c,d);a.S("remoteQueueChange")},lya=function(a,b){b.params=b.params||{};
jya(a,b);kya(a,b);a.S("autoplayDismissed")},kya=function(a,b){var c=parseInt(b.params.currentTime||b.params.current_time,10);
T7(a.Va,isNaN(c)?0:c);c=parseInt(b.params.state,10);c=isNaN(c)?-1:c;-1==c&&-1E3==a.Va.playerState&&(c=-1E3);a.Va.playerState=c;c=Number(b.params.loadedTime);a.Va.I=isNaN(c)?0:c;c=Number(b.params.duration);a.Va.G=isNaN(c)?0:c;c=a.Va;var d=Number(b.params.liveIngestionTime);c.A=d;c.w=isNaN(d)?!1:!0;c=a.Va;d=Number(b.params.seekableStartTime);var e=Number(b.params.seekableEndTime);c.B=isNaN(d)?0:d;c.u=isNaN(e)?0:e;1==a.Va.playerState?fya(a):j8(a);a.S("remotePlayerChange")},mya=function(a,b){if(-1E3!=
a.Va.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.Va.playerState=c;c=parseInt(b.params.currentTime,10);T7(a.Va,isNaN(c)?0:c);a.S("remotePlayerChange")}},nya=function(a,b){var c="true"==b.params.muted;
a.Va.volume=parseInt(b.params.volume,10);a.Va.muted=c;a.S("remotePlayerChange")},oya=function(a,b){a.C=b.params.videoId;
a.S("nowAutoplaying",parseInt(b.params.timeout,10))},pya=function(a,b){var c="true"==b.params.hasNext;
a.Va.P="true"==b.params.hasPrevious;a.Va.hasNext=c;a.S("previousNextChange")},gya=function(a){g.Jo(a.G);
a.G=g.Ho((0,g.x)(a.wj,a,1),864E5)},k8=function(a,b,c){c?f8("Sending: action="+b+", params="+g.Jk(c)):f8("Sending: action="+b);
a.o.sendMessage(b,c)},l8=function(a){l7.call(this,"ScreenServiceProxy");
this.zd=a;this.u=[];this.u.push(this.zd.$_s("screenChange",(0,g.x)(this.vP,this)));this.u.push(this.zd.$_s("onlineScreenChange",(0,g.x)(this.YL,this)))},uya=function(a){var b={device:"Desktop",
app:"youtube-desktop"};b=g.L("MDX_CONFIG")||b;mwa();o6();m8||(m8=new d7(b?b.loungeApiHost:void 0),uwa()&&(m8.o="/api/loungedev"));n8||(n8=g.w("yt.mdx.remote.deferredProxies_")||[],g.Ga("yt.mdx.remote.deferredProxies_",n8,void 0));qya();var c=o8();if(!c){var d=new u7(m8);g.Ga("yt.mdx.remote.screenService_",d,void 0);c=o8();var e=!1,f=void 0,k=void 0,l=!1;b&&(e=!!b.loadCastApiSetupScript,f=b.appId,k=b.theme,l=!!b.disableDial);Vxa(a,d,function(m){m?p8()&&P7(p8(),"YouTube TV"):d.subscribe("onlineScreenChange",
function(){b6("yt-remote-receiver-availability-change")})},e,f,k,l)}b&&!g.w("yt.mdx.remote.initialized_")&&(g.Ga("yt.mdx.remote.initialized_",!0,void 0),q8("Initializing: "+g.Jk(b)),r8.push(g.Oo("yt-remote-cast2-availability-change",function(){b6("yt-remote-receiver-availability-change")})),r8.push(g.Oo("yt-remote-cast2-receiver-selected",function(){s8(null);
b6("yt-remote-auto-connect","cast-selector-receiver")})),r8.push(g.Oo("yt-remote-cast2-receiver-resumed",function(){b6("yt-remote-receiver-resumed","cast-selector-receiver")})),r8.push(g.Oo("yt-remote-cast2-session-change",rya)),r8.push(g.Oo("yt-remote-connection-change",function(m){m?P7(p8(),"YouTube TV"):t8()||(P7(null,null),Yxa())})),a=u8(),b.isAuto&&(a.id+="#dial"),g.xo("desktop_enable_autoplay")&&(a.capabilities=["atp"]),a.name=b.device,a.app=b.app,(k=b.theme)&&(a.theme=k),q8(" -- with channel params: "+
g.Jk(a)),sya(a),c.start(),p8()||tya())},wya=function(){var a=vya();
M7()&&g.Es("yt-remote-cast-available")&&a.push({key:"cast-selector-receiver",name:"Cast..."});return a},vya=function(){var a=o8().zd.$_gos();
var b=v8();b&&w8()&&(i6(a,b)||a.push(b));return lwa(a)},x8=function(){var a=xya();
!a&&M7()&&Xxa()&&(a={key:"cast-selector-receiver",name:Xxa()});return a},xya=function(){var a=vya(),b=v8();
b||(b=t8());return g.Xa(a,function(c){return b&&e6(b,c.key)?!0:!1})},v8=function(){var a=p8();
if(!a)return null;var b=o8().he();return j6(b,a)},rya=function(a){q8("remote.onCastSessionChange_: "+f6(a));
if(a){var b=v8();b&&b.id==a.id?P7(b.id,"YouTube TV"):(b&&y8(),z8(a,1))}else w8()&&y8()},y8=function(){N7()?K7().stopSession():I7("stopSession called before API ready.");
var a=w8();a&&(a.disconnect(1),A8(null))},B8=function(){var a=w8();
return!!a&&3!=a.getProxyState()},q8=function(a){h7("remote",a)},o8=function(){if(!C8){var a=g.w("yt.mdx.remote.screenService_");
C8=a?new l8(a):null}return C8},p8=function(){return g.w("yt.mdx.remote.currentScreenId_")},yya=function(a){g.Ga("yt.mdx.remote.currentScreenId_",a,void 0)},zya=function(){return g.w("yt.mdx.remote.connectData_")},s8=function(a){g.Ga("yt.mdx.remote.connectData_",a,void 0)},w8=function(){return g.w("yt.mdx.remote.connection_")},A8=function(a){var b=w8();
s8(null);a||yya("");g.Ga("yt.mdx.remote.connection_",a,void 0);n8&&((0,g.y)(n8,function(c){c(a)}),n8.length=0);
b&&!a?b6("yt-remote-connection-change",!1):!b&&a&&b6("yt-remote-connection-change",!0)},t8=function(){var a=g.Fs();
if(!a)return null;var b=o8().he();return j6(b,a)},z8=function(a,b){p8();
v8()&&v8();if(D8)E8=a;else{yya(a.id);var c=new e8(m8,a,u8());c.connect(b,zya());c.subscribe("beforeDisconnect",function(d){b6("yt-remote-before-disconnect",d)});
c.subscribe("beforeDispose",function(){w8()&&(w8(),A8(null))});
A8(c)}},tya=function(){var a=t8();
a?(q8("Resume connection to: "+f6(a)),z8(a,0)):(p6(),Yxa(),q8("Skipping connecting because no session screen found."))},qya=function(){var a=u8();
if(g.Mb(a)){a=n6();var b=g.Es("yt-remote-session-name")||"",c=g.Es("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)}},u8=function(){return g.w("yt.mdx.remote.channelParams_")||{}},sya=function(a){a?(g.Ds("yt-remote-session-app",a.app),g.Ds("yt-remote-session-name",a.name)):(k6("yt-remote-session-app"),k6("yt-remote-session-name"));
g.Ga("yt.mdx.remote.channelParams_",a,void 0)},F8=function(a,b,c){g.A.call(this);
this.B=a;this.u=b;this.w=new g.Gr(this);g.B(this,this.w);this.w.L(b,"onCaptionsTrackListChanged",this.uL);this.w.L(b,"captionschanged",this.uK);this.w.L(b,"captionssettingschanged",this.oC);this.w.L(b,"videoplayerreset",this.rp);this.w.L(b,"mdxautoplaycancel",this.dE);this.U=this.w.L(b,"onVolumeChange",this.DA);this.G=!1;this.o=c;c.ea();c.subscribe("proxyStateChange",this.YA,this);c.subscribe("remotePlayerChange",this.sm,this);c.subscribe("remoteQueueChange",this.rp,this);c.subscribe("autoplayUpNext",
this.oA,this);c.subscribe("previousNextChange",this.UA,this);c.subscribe("nowAutoplaying",this.PA,this);c.subscribe("autoplayDismissed",this.nA,this);this.suggestion=null;this.I=new g.HC(64);this.A=new g.I(this.mC,500,this);g.B(this,this.A);this.C=new g.I(this.nC,1E3,this);g.B(this,this.C);this.M=new t6(this.WO,0,this);g.B(this,this.M);this.F={};this.R=new g.I(this.NC,1E3,this);g.B(this,this.R);this.P=new u6(this.FI,1E3,this);g.B(this,this.P);this.V=g.Ia;this.oC();this.rp();this.sm()},G8=function(a,
b){var c=a.B,d=a.u.getVideoData().lengthSeconds;
c.V=b||0;c.player.S("progresssync",b,d)},Aya=function(a){G8(a,0);
a.A.stop();H8(a,new g.HC(64))},J8=function(a,b){if(I8(a)&&!a.G){var c=null;
b&&(c={style:a.u.getSubtitlesUserSettings()},g.Sb(c,b));a.o.eC(a.u.getVideoData(1).videoId,c);a.F=Z7(a.o).o}},K8=function(a,b){var c=a.u.getPlaylist();
if(c){var d=c.index;var e=c.listId.toString()}c=a.u.getVideoData(1);a.o.playVideo(c.videoId,b,d,e,c.playerParams,c.Af,Zva(c));H8(a,new g.HC(1))},Bya=function(a,b){if(b){var c=a.u.getOption("captions","tracklist",{Zx:1});
c&&c.length?(a.u.setOption("captions","track",b),a.G=!1):(a.u.loadModule("captions"),a.G=!0)}else a.u.setOption("captions","track",{})},I8=function(a){return Z7(a.o).videoId==a.u.getVideoData(1).videoId},H8=function(a,b){a.C.stop();
var c=a.I;if(!g.NC(c,b)){var d=g.V(b,2);d!=g.V(a.I,2)&&g.TS(a.u.app,d);a.I=b;Cya(a.B,c,b)}},L8=function(a){g.R.call(this,{D:"div",
H:"ytp-remote",J:[{D:"div",H:"ytp-remote-display-status",J:[{D:"div",H:"ytp-remote-display-status-icon",J:[g.zM()]},{D:"div",H:"ytp-remote-display-status-text",W:"{{statustext}}"}]}]});this.u=new g.lN(this,250);g.B(this,this.u);this.w=a;this.L(a,"presentingplayerstatechange",this.A);Dya(this,g.PK(a))},Dya=function(a,b){if(3==a.w.getPresentingPlayerType()){var c={RECEIVER_NAME:a.w.getOption("remote","currentReceiver").name};
c=g.V(b,128)?g.gM("Erreur sur $RECEIVER_NAME",c):b.eb()||g.V(b,4)?g.gM("Lecture sur $RECEIVER_NAME",c):g.gM("Connect\u00e9 \u00e0 $RECEIVER_NAME",c);a.la("statustext",c);a.u.show()}else a.u.hide()},M8=function(){g.R.call(this,{D:"div",
H:"ytp-mdx-manual-pairing-popup-dialog",O:{role:"dialog"},J:[{D:"div",H:"ytp-mdx-manual-pairing-popup-dialog-inner-content",J:[{D:"div",H:"ytp-mdx-manual-pairing-popup-title",W:"Connecting to your TV on web using a code will be going away soon"},{D:"div",H:"ytp-mdx-manual-pairing-popup-buttons",J:[{D:"button",Y:["ytp-button","ytp-mdx-manual-pairing-popup-learn-more"],W:"En savoir plus"},{D:"button",Y:["ytp-button","ytp-mdx-manual-pairing-popup-ok"],W:"OK"}]}]}]});this.u=new g.lN(this,250);this.learnMoreButton=
this.o["ytp-mdx-manual-pairing-popup-learn-more"];this.okButton=this.o["ytp-mdx-manual-pairing-popup-ok"];g.B(this,this.u);this.L(this.learnMoreButton,"click",this.w);this.L(this.okButton,"click",this.A)},N8=function(){g.R.call(this,{D:"div",
H:"ytp-mdx-popup-dialog",O:{role:"dialog"},J:[{D:"div",H:"ytp-mdx-popup-dialog-inner-content",J:[{D:"div",H:"ytp-mdx-popup-title",W:"Vous \u00eates d\u00e9connect\u00e9"},{D:"div",H:"ytp-mdx-popup-description",W:"Les vid\u00e9os que vous visionnez peuvent \u00eatre ajout\u00e9es \u00e0 l'historique des vid\u00e9os regard\u00e9es sur votre t\u00e9l\u00e9viseur et avoir une influence sur les recommandations qui vous sont faites. Pour \u00e9viter ce probl\u00e8me, annulez et connectez-vous \u00e0 YouTube sur un ordinateur."},
{D:"div",H:"ytp-mdx-privacy-popup-buttons",J:[{D:"button",Y:["ytp-button","ytp-mdx-privacy-popup-cancel"],W:"Annuler"},{D:"button",Y:["ytp-button","ytp-mdx-privacy-popup-confirm"],W:"Confirmer"}]}]}]});this.u=new g.lN(this,250);this.cancelButton=this.o["ytp-mdx-privacy-popup-cancel"];this.confirmButton=this.o["ytp-mdx-privacy-popup-confirm"];g.B(this,this.u);this.L(this.cancelButton,"click",this.w);this.L(this.confirmButton,"click",this.A)},O8=function(a,b){g.iO.call(this,"Lire sur",0,a,b);
this.K=a;this.C={};this.L(a,"onMdxReceiversChange",this.G);this.L(a,"presentingplayerstatechange",this.G);this.G()},P8=function(a){g.vL.call(this,a);
this.u={key:h6(),name:"Cet ordinateur"};this.C=null;this.w=[];this.ba=this.o=null;this.U=[this.u];this.A=this.u;this.I=new g.HC(64);this.V=0;this.M=-1;this.F=null;this.P=this.R=!1;this.G=null;if(!g.az(this.player.N())){a=this.player;var b=g.dC(a);b&&(b=b.fm())&&(b=new O8(a,b),g.B(this,b));b=new L8(a);g.B(this,b);g.iL(a,b.element,4);this.G=new N8;g.B(this,this.G);g.iL(a,this.G.element,4);g.P(this.player.N().experiments,"pair_servlet_deprecation_warning_enabled")&&(this.F=new M8,g.B(this,this.F),g.iL(a,
this.F.element,4));this.P=!!t8();this.R=!!g.Es("yt-remote-manual-pairing-warning-shown")}this.B=null},Q8=function(a){a.B&&(a.player.removeEventListener("presentingplayerstatechange",a.B),a.B=null)},Cya=function(a,b,c){a.I=c;
a.player.S("presentingplayerstatechange",new g.$G(c,b))},Eya=function(a,b,c){var d=!1;
1==b?d=!a.P:2==b&&(d=!a.R);d&&g.bH(c,8)&&(a.player.pauseVideo(),Q8(a))},R8=function(a,b){if(b.key!=a.A.key)if(b.key==a.u.key)y8();
else{if(a.F&&!a.R&&b!=a.u&&"cast-selector-receiver"!=b.key&&g.jz(a.player.N()))Fya(a);else{var c;(c=!g.P(a.player.N().experiments,"mdx_enable_privacy_disclosure_ui"))||(c=((c=g.L("PLAYER_CONFIG"))&&c.args&&void 0!==c.args.authuser?!0:!(!g.L("SESSION_INDEX")&&!g.L("LOGGED_IN")))||a.P||!a.G);(c?0:g.jz(a.player.N())||"WEB_EMBEDDED_PLAYER"==a.player.N().deviceParams.c)&&Gya(a)}a.A=b;var d=a.player.getPlaylistId();c=a.player.getVideoData(1);var e=c.videoId;if(!d&&!e||(2==a.player.getAppState()||1==a.player.getAppState())&&
g.P(a.player.N().experiments,"should_clear_video_data_on_player_cued_unstarted"))c=null;else{var f=a.player.getPlaylist();if(f){var k=[];for(var l=0;l<f.getLength();l++)k[l]=f.ya(l).videoId}else k=[e];f=a.player.getCurrentTime(1);d={videoIds:k,listId:d,videoId:e,playerParams:c.playerParams,clickTrackingParams:c.Af,index:Math.max(a.player.getPlaylistIndex(),0),currentTime:0==f?void 0:f};(c=Zva(c))&&(d.locationInfo=c);c=d}q8("Connecting to: "+g.Jk(b));"cast-selector-receiver"==b.key?(s8(c||null),c=
c||null,N7()?K7().setLaunchParams(c):I7("setLaunchParams called before ready.")):!c&&B8()&&p8()==b.key?b6("yt-remote-connection-change",!0):(y8(),s8(c||null),c=o8().he(),(c=j6(c,b.key))&&z8(c,1))}},Gya=function(a){g.PK(a.player).eb()?a.player.pauseVideo():(a.B=function(b){return Eya(a,1,b)},a.player.addEventListener("presentingplayerstatechange",a.B));
a.G&&a.G.Qb();w8()||(D8=!0)},Fya=function(a){g.PK(a.player).eb()?a.player.pauseVideo():(a.B=function(b){return Eya(a,2,b)},a.player.addEventListener("presentingplayerstatechange",a.B));
a.F&&a.F.Qb();w8()||(D8=!0)},Kwa={"\x00":"\\0",
"\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r","\t":"\\t","\x0B":"\\x0B",'"':'\\"',"\\":"\\\\","<":"\\u003C"},H6={"'":"\\'"},Hya={},hwa={YP:"atp",KS:"ska",vS:"que",PR:"mus",JS:"sus",aR:"dsp",DS:"seq"},q6,m6="",zwa=vwa("loadCastFramework")||vwa("loadCastApplicationFramework"),Uxa=["pkedcjkdefgpdelpbcmbmeomcjbeemfm","enhhojjnijigcajfphajepfemndkmdlo"];/*
Copyright The Closure Library Authors.
SPDX-License-Identifier: Apache-2.0
*/
g.Sa(t6,g.A);g.h=t6.prototype;g.h.jF=function(a){this.A=arguments;this.o=!1;this.Ga?this.w=(0,g.H)()+this.Ad:this.Ga=g.Uf(this.B,this.Ad)};
g.h.stop=function(){this.Ga&&(g.v.clearTimeout(this.Ga),this.Ga=null);this.w=null;this.o=!1;this.A=[]};
g.h.pause=function(){++this.u};
g.h.resume=function(){this.u&&(--this.u,!this.u&&this.o&&(this.o=!1,this.C.apply(null,this.A)))};
g.h.X=function(){this.stop();t6.Gb.X.call(this)};
g.h.kF=function(){this.w?(this.Ga=g.Uf(this.B,this.w-(0,g.H)()),this.w=null):(this.Ga=null,this.u?this.o=!0:(this.o=!1,this.C.apply(null,this.A)))};g.Sa(u6,g.A);g.h=u6.prototype;g.h.Fj=!1;g.h.Bl=0;g.h.Ga=null;g.h.Jx=function(a){this.o=arguments;this.Ga||this.Bl?this.Fj=!0:v6(this)};
g.h.stop=function(){this.Ga&&(g.v.clearTimeout(this.Ga),this.Ga=null,this.Fj=!1,this.o=[])};
g.h.pause=function(){this.Bl++};
g.h.resume=function(){this.Bl--;this.Bl||!this.Fj||this.Ga||(this.Fj=!1,v6(this))};
g.h.X=function(){u6.Gb.X.call(this);this.stop()};
g.h.lF=function(){this.Ga=null;this.Fj&&!this.Bl&&(this.Fj=!1,v6(this))};x6.prototype.stringify=function(a){return g.v.JSON.stringify(a,void 0)};
x6.prototype.parse=function(a){return g.v.JSON.parse(a,void 0)};y6.prototype.o=null;y6.prototype.getOptions=function(){var a;(a=this.o)||(a={},Dwa(this)&&(a[0]=!0,a[1]=!0),a=this.o=a);return a};var S8;g.Sa(Cwa,y6);S8=new Cwa;g.h=z6.prototype;g.h.zi=null;g.h.df=!1;g.h.Jk=null;g.h.ev=null;g.h.wk=null;g.h.Gj=null;g.h.Vg=null;g.h.Ph=null;g.h.Yi=null;g.h.Lc=null;g.h.Sm=0;g.h.kf=null;g.h.hq=null;g.h.lh=null;g.h.Dl=-1;g.h.ZB=!0;g.h.hi=!1;g.h.ds=0;g.h.Ap=null;var Iwa={},C6={};g.h=z6.prototype;g.h.setTimeout=function(a){this.B=a};
g.h.cO=function(a){a=a.target;var b=this.Ap;b&&3==Q6(a)?b.Jx():this.VC(a)};
g.h.VC=function(a){try{if(a==this.Lc)a:{var b=Q6(this.Lc),c=this.Lc.C,d=this.Lc.getStatus();if(g.he&&!g.Ld(10)||g.je&&!g.Kd("420+")){if(4>b)break a}else if(3>b||3==b&&!g.vh&&!S6(this.Lc))break a;this.hi||4!=b||7==c||(8==c||0>=d?this.o.bf(3):this.o.bf(2));J6(this);var e=this.Lc.getStatus();this.Dl=e;var f=S6(this.Lc);(this.df=200==e)?(4==b&&F6(this),this.C?(Jwa(this,b,f),g.vh&&this.df&&3==b&&(this.A.ka(this.u,"tick",this.UN),this.u.start())):E6(this,f),this.df&&!this.hi&&(4==b?this.o.fo(this):(this.df=
!1,B6(this)))):(400==e&&0<f.indexOf("Unknown SID")?(this.lh=3,D6(13)):(this.lh=0,D6(14)),F6(this),G6(this))}}catch(k){this.Lc&&S6(this.Lc)}finally{}};
g.h.UN=function(){var a=Q6(this.Lc),b=S6(this.Lc);this.Sm<b.length&&(J6(this),Jwa(this,a,b),this.df&&4!=a&&B6(this))};
g.h.wN=function(a){I6((0,g.x)(this.vN,this,a),0)};
g.h.vN=function(a){this.hi||(J6(this),E6(this,a),B6(this))};
g.h.hB=function(a){I6((0,g.x)(this.uN,this,a),0)};
g.h.uN=function(a){this.hi||(F6(this),this.df=a,this.o.fo(this),this.o.bf(4))};
g.h.cancel=function(){this.hi=!0;F6(this)};
g.h.EN=function(){this.Jk=null;var a=(0,g.H)();0<=a-this.ev?(2!=this.Gj&&this.o.bf(3),F6(this),this.lh=2,D6(18),G6(this)):Mwa(this,this.ev-a)};
g.h.getLastError=function(){return this.lh};g.h=Pwa.prototype;g.h.Yr=null;g.h.Vd=null;g.h.Bp=!1;g.h.Lx=null;g.h.On=null;g.h.Ks=null;g.h.Zr=null;g.h.ye=null;g.h.rg=-1;g.h.Cl=null;g.h.Vk=null;g.h.connect=function(a){this.Zr=a;a=L6(this.o,null,this.Zr);D6(3);this.Lx=(0,g.H)();var b=this.o.G;null!=b?(this.Cl=b[0],(this.Vk=b[1])?(this.ye=1,Qwa(this)):(this.ye=2,N6(this))):(Z5(a,"MODE","init"),this.Vd=new z6(this,void 0,void 0,void 0),this.Vd.zi=this.Yr,A6(this.Vd,a,!1,null,!0),this.ye=0)};
g.h.eE=function(a){if(a)this.ye=2,N6(this);else{D6(4);var b=this.o;b.yf=b.Zg.rg;Z6(b,9)}a&&this.bf(2)};
g.h.rr=function(a){return this.o.rr(a)};
g.h.abort=function(){this.Vd&&(this.Vd.cancel(),this.Vd=null);this.rg=-1};
g.h.Kx=function(){return!1};
g.h.ZA=function(a,b){this.rg=a.Dl;if(0==this.ye)if(b){try{var c=this.u.parse(b)}catch(d){c=this.o;c.yf=this.rg;Z6(c,2);return}this.Cl=c[0];this.Vk=c[1]}else c=this.o,c.yf=this.rg,Z6(c,2);else if(2==this.ye)if(this.Bp)D6(7),this.Ks=(0,g.H)();else if("11111"==b){if(D6(6),this.Bp=!0,this.On=(0,g.H)(),c=this.On-this.Lx,!g.he||g.Ld(10)||500>c)this.rg=200,this.Vd.cancel(),D6(12),M6(this.o,this,!0)}else D6(8),this.On=this.Ks=(0,g.H)(),this.Bp=!1};
g.h.fo=function(){this.rg=this.Vd.Dl;if(this.Vd.df)0==this.ye?this.Vk?(this.ye=1,Qwa(this)):(this.ye=2,N6(this)):2==this.ye&&((!g.he||g.Ld(10)?!this.Bp:200>this.Ks-this.On)?(D6(11),M6(this.o,this,!1)):(D6(12),M6(this.o,this,!0)));else{0==this.ye?D6(9):2==this.ye&&D6(10);var a=this.o;this.Vd.getLastError();a.yf=this.rg;Z6(a,2)}};
g.h.Im=function(){return this.o.Im()};
g.h.isActive=function(){return this.o.isActive()};
g.h.bf=function(a){this.o.bf(a)};g.Sa(O6,g.gf);var Vwa=/^https?$/i,Iya=["POST","PUT"];g.h=O6.prototype;
g.h.send=function(a,b,c,d){if(this.o)throw Error("[goog.net.XhrIo] Object is active with another request="+this.I+"; newUri="+a);b=b?b.toUpperCase():"GET";this.I=a;this.A="";this.C=0;this.ha=b;this.V=!1;this.w=!0;this.o=this.U?Ewa(this.U):Ewa(S8);this.R=this.U?this.U.getOptions():S8.getOptions();this.o.onreadystatechange=(0,g.x)(this.VA,this);try{a6(R6(this,"Opening Xhr")),this.Z=!0,this.o.open(b,String(a),!0),this.Z=!1}catch(f){a6(R6(this,"Error opening Xhr: "+f.message));Uwa(this,f);return}a=c||
"";var e=this.headers.clone();d&&dwa(d,function(f,k){e.set(k,f)});
d=g.Xa(e.te(),Swa);c=g.v.FormData&&a instanceof g.v.FormData;!g.$a(Iya,b)||d||c||e.set("Content-Type","application/x-www-form-urlencoded;charset=utf-8");e.forEach(function(f,k){this.o.setRequestHeader(k,f)},this);
this.da&&(this.o.responseType=this.da);"withCredentials"in this.o&&this.o.withCredentials!==this.ba&&(this.o.withCredentials=this.ba);try{Xwa(this),0<this.F&&(this.M=Rwa(this.o),a6(R6(this,"Will abort after "+this.F+"ms if incomplete, xhr2 "+this.M)),this.M?(this.o.timeout=this.F,this.o.ontimeout=(0,g.x)(this.Mx,this)):this.P=g.Uf(this.Mx,this.F,this)),a6(R6(this,"Sending request")),this.G=!0,this.o.send(a),this.G=!1}catch(f){a6(R6(this,"Send error: "+f.message)),Uwa(this,f)}};
g.h.Mx=function(){"undefined"!=typeof g.H1&&this.o&&(this.A="Timed out after "+this.F+"ms, aborting",this.C=8,R6(this,this.A),this.dispatchEvent("timeout"),this.abort(8))};
g.h.abort=function(a){this.o&&this.w&&(R6(this,"Aborting"),this.w=!1,this.B=!0,this.o.abort(),this.B=!1,this.C=a||7,this.dispatchEvent("complete"),this.dispatchEvent("abort"),P6(this))};
g.h.X=function(){this.o&&(this.w&&(this.w=!1,this.B=!0,this.o.abort(),this.B=!1),P6(this,!0));O6.Gb.X.call(this)};
g.h.VA=function(){this.ea()||(this.Z||this.G||this.B?Wwa(this):this.yM())};
g.h.yM=function(){Wwa(this)};
g.h.isActive=function(){return!!this.o};
g.h.getStatus=function(){try{return 2<Q6(this)?this.o.status:-1}catch(a){return-1}};
g.h.getLastError=function(){return"string"===typeof this.A?this.A:String(this.A)};g.h=T6.prototype;g.h.ql=null;g.h.Od=null;g.h.hc=null;g.h.Xr=null;g.h.Rn=null;g.h.jw=null;g.h.eo=null;g.h.lm=0;g.h.OJ=0;g.h.wd=null;g.h.eh=null;g.h.cg=null;g.h.ni=null;g.h.Zg=null;g.h.fq=null;g.h.Tj=-1;g.h.ty=-1;g.h.yf=-1;g.h.yj=0;g.h.qj=0;g.h.ii=8;var $6=new g.gf;g.Sa(Zwa,g.Je);g.Sa($wa,g.Je);g.Sa(axa,g.Je);g.h=T6.prototype;g.h.connect=function(a,b,c,d,e){D6(0);this.Xr=b;this.ql=c||{};d&&void 0!==e&&(this.ql.OSID=d,this.ql.OAID=e);this.C?(I6((0,g.x)(this.Dw,this,a),100),exa(this)):this.Dw(a)};
g.h.Dw=function(a){this.Zg=new Pwa(this);this.Zg.Yr=null;this.Zg.u=this.B;this.Zg.connect(a)};
g.h.Kx=function(){return 0==this.o};
g.h.gB=function(a){this.eh=null;hxa(this,a)};
g.h.fB=function(){this.cg=null;this.hc=new z6(this,this.w,"rpc",this.F);this.hc.zi=null;this.hc.ds=0;var a=this.jw.clone();X5(a,"RID","rpc");X5(a,"SID",this.w);X5(a,"CI",this.fq?"0":"1");X5(a,"AID",this.Tj);U6(this,a);if(!g.he||g.Ld(10))X5(a,"TYPE","xmlhttp"),A6(this.hc,a,!0,this.eo,!1);else{X5(a,"TYPE","html");var b=this.hc,c=!!this.eo;b.Gj=3;b.Vg=Y5(a.clone());Lwa(b,c)}};
g.h.ZA=function(a,b){if(0!=this.o&&(this.hc==a||this.Od==a))if(this.yf=a.Dl,this.Od==a&&3==this.o)if(7<this.ii){try{var c=this.B.parse(b)}catch(f){c=null}if(Array.isArray(c)&&3==c.length)if(0==c[0])a:{if(!this.cg){if(this.hc)if(this.hc.wk+3E3<this.Od.wk)W6(this),this.hc.cancel(),this.hc=null;else break a;Y6(this);D6(19)}}else this.ty=c[1],0<this.ty-this.Tj&&37500>c[2]&&this.fq&&0==this.qj&&!this.ni&&(this.ni=I6((0,g.x)(this.qK,this),6E3));else Z6(this,11)}else b!=Hya.vQ.o&&Z6(this,11);else if(this.hc==
a&&W6(this),!g.ec(b)){c=this.B.parse(b);for(var d=0;d<c.length;d++){var e=c[d];this.Tj=e[0];e=e[1];2==this.o?"c"==e[0]?(this.w=e[1],this.eo=e[2],e=e[3],null!=e?this.ii=e:this.ii=6,this.o=3,this.wd&&this.wd.zw(),this.jw=L6(this,this.Im()?this.eo:null,this.Xr),ixa(this)):"stop"==e[0]&&Z6(this,7):3==this.o&&("stop"==e[0]?Z6(this,7):"noop"!=e[0]&&this.wd&&this.wd.yw(e),this.qj=0)}}};
g.h.qK=function(){null!=this.ni&&(this.ni=null,this.hc.cancel(),this.hc=null,Y6(this),D6(20))};
g.h.fo=function(a){if(this.hc==a){W6(this);this.hc=null;var b=2}else if(this.Od==a)this.Od=null,b=1;else return;this.yf=a.Dl;if(0!=this.o)if(a.df)1==b?(b=(0,g.H)()-a.wk,$6.dispatchEvent(new $wa($6,a.Yi?a.Yi.length:0,b,this.yj)),V6(this),this.A.length=0):ixa(this);else{var c=a.getLastError(),d;if(!(d=3==c||7==c||0==c&&0<this.yf)){if(d=1==b)this.Od||this.eh||1==this.o||2<=this.yj?d=!1:(this.eh=I6((0,g.x)(this.gB,this,a),jxa(this,this.yj)),this.yj++,d=!0);d=!(d||2==b&&Y6(this))}if(d)switch(c){case 1:Z6(this,
5);break;case 4:Z6(this,10);break;case 3:Z6(this,6);break;case 7:Z6(this,12);break;default:Z6(this,2)}}};
g.h.DE=function(a){if(!g.$a(arguments,this.o))throw Error("Unexpected channel state: "+this.o);};
g.h.NO=function(a){a?D6(2):(D6(1),kxa(this,8))};
g.h.rr=function(a){if(a)throw Error("Can't create secondary domain capable XhrIo object.");a=new O6;a.ba=!1;return a};
g.h.isActive=function(){return!!this.wd&&this.wd.isActive(this)};
g.h.bf=function(a){$6.dispatchEvent(new axa($6,a))};
g.h.Im=function(){return!(!g.he||g.Ld(10))};
g.h=lxa.prototype;g.h.zw=function(){};
g.h.yw=function(){};
g.h.xw=function(){};
g.h.fr=function(){};
g.h.gx=function(){return{}};
g.h.isActive=function(){return!0};g.h=mxa.prototype;g.h.isEmpty=function(){return g.ab(this.o)&&g.ab(this.u)};
g.h.clear=function(){this.o=[];this.u=[]};
g.h.contains=function(a){return g.$a(this.o,a)||g.$a(this.u,a)};
g.h.remove=function(a){var b=this.o;var c=(0,g.Wqa)(b,a);0<=c?(g.cb(b,c),b=!0):b=!1;return b||g.db(this.u,a)};
g.h.Ed=function(){for(var a=[],b=this.o.length-1;0<=b;--b)a.push(this.o[b]);var c=this.u.length;for(b=0;b<c;++b)a.push(this.u[b]);return a};g.Sa(a7,g.A);g.h=a7.prototype;g.h.pN=function(){this.Ad=Math.min(3E5,2*this.Ad);this.w();this.u&&this.start()};
g.h.start=function(){var a=this.Ad+15E3*Math.random();this.o.Ua(a);this.u=(0,g.H)()+a};
g.h.stop=function(){this.o.stop();this.u=0};
g.h.isActive=function(){return this.o.isActive()};
g.h.reset=function(){this.o.stop();this.Ad=5E3};g.Sa(b7,lxa);g.h=b7.prototype;g.h.subscribe=function(a,b,c){return this.w.subscribe(a,b,c)};
g.h.unsubscribe=function(a,b,c){return this.w.unsubscribe(a,b,c)};
g.h.Eh=function(a){return this.w.Ai(a)};
g.h.S=function(a,b){return this.w.S.apply(this.w,arguments)};
g.h.dispose=function(){this.ub||(this.ub=!0,g.He(this.w),pxa(this),g.He(this.u),this.u=null)};
g.h.ea=function(){return this.ub};
g.h.connect=function(a,b,c){if(!this.o||2!=this.o.o){this.I="";this.u.stop();this.B=a||null;this.A=b||0;a=this.P+"/test";b=this.P+"/bind";var d=new T6(c?c.firstTestResults:null,c?c.secondTestResults:null,this.M),e=this.o;e&&(e.wd=null);d.wd=this;this.o=d;e?this.o.connect(a,b,this.C,e.w,e.Tj):c?this.o.connect(a,b,this.C,c.sessionId,c.arrayId):this.o.connect(a,b,this.C)}};
g.h.sendMessage=function(a,b){var c={_sc:a};b&&g.Sb(c,b);this.u.isActive()||2==(this.o?this.o.o:0)?this.F.push(c):c7(this)&&fxa(this.o,c)};
g.h.zw=function(){this.u.reset();this.B=null;this.A=0;if(this.F.length){var a=this.F;this.F=[];for(var b=0,c=a.length;b<c;++b)fxa(this.o,a[b])}this.S("handlerOpened")};
g.h.xw=function(a){var b=2==a&&401==this.o.yf;4==a||b||this.u.start();this.S("handlerError",a)};
g.h.fr=function(a){if(!this.u.isActive())this.S("handlerClosed");else if(a)for(var b=0,c=a.length;b<c;++b){var d=a[b].map;d&&this.F.push(d)}};
g.h.gx=function(){var a={v:2};this.I&&(a.gsessionid=this.I);0!=this.A&&(a.ui=""+this.A);0!=this.G&&(a.ui=""+this.G);this.B&&g.Sb(a,this.B);return a};
g.h.yw=function(a){"S"==a[0]?this.I=a[1]:"gracefulReconnect"==a[0]?(this.u.start(),dxa(this.o)):this.S("handlerMessage",new nxa(a[0],a[1]))};
g.h.qO=function(){this.u.isActive();var a=this.o,b=0;a.hc&&b++;a.Od&&b++;0==b&&this.connect(this.B,this.A)};d7.prototype.A=function(a,b,c,d){b?a(d):a({text:c.responseText})};
d7.prototype.w=function(a,b){a(Error("Request error: "+b.status))};
d7.prototype.B=function(a){a(Error("request timed out"))};var xxa=(0,g.H)(),g7=null,j7=Array(50),i7=-1,k7=!1;g.Sa(l7,g.O);l7.prototype.he=function(){return this.o};
l7.prototype.contains=function(a){return!!i6(this.o,a)};
l7.prototype.get=function(a){return a?j6(this.o,a):null};
l7.prototype.info=function(a){h7(this.F,a)};g.r(m7,g.O);g.h=m7.prototype;g.h.start=function(){!this.o&&isNaN(this.Ga)&&this.ZC()};
g.h.stop=function(){this.o&&(this.o.abort(),this.o=null);isNaN(this.Ga)||(g.Jo(this.Ga),this.Ga=NaN)};
g.h.X=function(){this.stop();g.O.prototype.X.call(this)};
g.h.ZC=function(){this.Ga=NaN;this.o=g.Eq(e7(this.C,"/pairing/get_screen"),{method:"POST",sb:{pairing_code:this.A},timeout:5E3,onSuccess:(0,g.x)(this.tP,this),onError:(0,g.x)(this.sP,this),Ud:(0,g.x)(this.uP,this)})};
g.h.tP=function(a,b){this.o=null;var c=b.screen||{};c.dialId=this.B;c.name=this.w;this.S("pairingComplete",new d6(c))};
g.h.sP=function(a){this.o=null;a.status&&404==a.status?this.u>=Jya.length?this.S("pairingFailed",Error("DIAL polling timed out")):(a=Jya[this.u],this.Ga=g.Ho((0,g.x)(this.ZC,this),a),this.u++):this.S("pairingFailed",Error("Server error "+a.status))};
g.h.uP=function(){this.o=null;this.S("pairingFailed",Error("Server not responding"))};
var Jya=[2E3,2E3,1E3,1E3,1E3,2E3,2E3,5E3,5E3,1E4];g.Sa(o7,l7);g.h=o7.prototype;g.h.start=function(){n7(this)&&this.S("screenChange");!g.Es("yt-remote-lounge-token-expiration")&&Bxa(this);g.Jo(this.u);this.u=g.Ho((0,g.x)(this.start,this),1E4)};
g.h.add=function(a,b){n7(this);yxa(this,a);p7(this,!1);this.S("screenChange");b(a);a.token||Bxa(this)};
g.h.remove=function(a,b){var c=n7(this);Axa(this,a)&&(p7(this,!1),c=!0);b(a);c&&this.S("screenChange")};
g.h.cq=function(a,b,c,d){var e=n7(this),f=this.get(a.id);f?(f.name!=b&&(f.name=b,p7(this,!1),e=!0),c(a)):d(Error("no such local screen."));e&&this.S("screenChange")};
g.h.X=function(){g.Jo(this.u);o7.Gb.X.call(this)};
g.h.vF=function(a){n7(this);var b=this.o.length;a=a&&a.screens||[];for(var c=0,d=a.length;c<d;++c){var e=a[c],f=this.get(e.screenId);f&&(f.token=e.loungeToken,--b)}p7(this,!b);b&&h7(this.F,"Missed "+b+" lounge tokens.")};
g.h.uF=function(a){h7(this.F,"Requesting lounge tokens failed: "+a)};g.r(r7,g.O);g.h=r7.prototype;g.h.start=function(){var a=parseInt(g.Es("yt-remote-fast-check-period")||"0",10);(this.A=(0,g.H)()-144E5<a?0:a)?t7(this):(this.A=(0,g.H)()+3E5,g.Ds("yt-remote-fast-check-period",this.A),this.vu())};
g.h.isEmpty=function(){return g.Mb(this.o)};
g.h.update=function(){q7("Updating availability on schedule.");var a=this.C(),b=g.Ab(this.o,function(c,d){return c&&!!j6(a,d)},this);
s7(this,b)};
g.h.X=function(){g.Jo(this.w);this.w=NaN;this.u&&(this.u.abort(),this.u=null);g.O.prototype.X.call(this)};
g.h.vu=function(){g.Jo(this.w);this.w=NaN;this.u&&this.u.abort();var a=Exa(this);if($5(a)){var b=e7(this.B,"/pairing/get_screen_availability");this.u=f7(this.B,b,{lounge_token:g.Gb(a).join(",")},(0,g.x)(this.YM,this,a),(0,g.x)(this.XM,this))}else s7(this,{}),t7(this)};
g.h.YM=function(a,b){this.u=null;var c=g.Gb(Exa(this));if(g.sb(c,g.Gb(a))){c=b.screens||[];for(var d={},e=0,f=c.length;e<f;++e)d[a[c[e].loungeToken]]="online"==c[e].status;s7(this,d);t7(this)}else this.Ub("Changing Screen set during request."),this.vu()};
g.h.XM=function(a){this.Ub("Screen availability failed: "+a);this.u=null;t7(this)};
g.h.Ub=function(a){h7("OnlineScreenService",a)};g.Sa(u7,l7);g.h=u7.prototype;g.h.start=function(){this.w.start();this.u.start();this.o.length&&(this.S("screenChange"),this.u.isEmpty()||this.S("onlineScreenChange"))};
g.h.add=function(a,b,c){this.w.add(a,b,c)};
g.h.remove=function(a,b,c){this.w.remove(a,b,c);this.u.update()};
g.h.cq=function(a,b,c,d){this.w.contains(a)?this.w.cq(a,b,c,d):(a="Updating name of unknown screen: "+a.name,h7(this.F,a),d(Error(a)))};
g.h.he=function(a){return a?this.o:g.fb(this.o,(0,g.ue)(this.A,function(b){return!this.contains(b)},this))};
g.h.aD=function(){return(0,g.ue)(this.he(!0),function(a){return!!this.u.o[a.id]},this)};
g.h.bD=function(a,b,c,d,e){this.info("getDialScreenByPairingCode "+a+" / "+b);var f=new m7(this.C,a,b,c);f.subscribe("pairingComplete",(0,g.x)(function(k){g.He(f);d(v7(this,k))},this));
f.subscribe("pairingFailed",function(k){g.He(f);e(k)});
f.start();return(0,g.x)(f.stop,f)};
g.h.wP=function(a,b,c,d){g.Eq(e7(this.C,"/pairing/get_screen"),{method:"POST",sb:{pairing_code:a},timeout:5E3,onSuccess:(0,g.x)(function(e,f){var k=new d6(f.screen||{});if(!k.name||Ixa(this,k.name)){a:{var l=k.name;for(var m=2,n=b(l,m);Ixa(this,n);){m++;if(20<m)break a;n=b(l,m)}l=n}k.name=l}c(v7(this,k))},this),
onError:(0,g.x)(function(e){d(Error("pairing request failed: "+e.status))},this),
Ud:(0,g.x)(function(){d(Error("pairing request timed out."))},this)})};
g.h.X=function(){g.He(this.w);g.He(this.u);u7.Gb.X.call(this)};
g.h.EF=function(){Jxa(this);this.S("screenChange");this.u.update()};
u7.prototype.dispose=u7.prototype.dispose;g.Sa(x7,g.O);g.h=x7.prototype;g.h.qp=function(a){this.w=a;this.S("sessionScreen",this.w)};
g.h.le=function(a){this.ea()||(a&&y7(this,""+a),this.w=null,this.S("sessionScreen",null))};
g.h.info=function(a){h7(this.R,a)};
g.h.dD=function(){return null};
g.h.Eu=function(a){var b=this.u;a?(b.displayStatus=new chrome.cast.ReceiverDisplayStatus(a,[]),b.displayStatus.showStop=!0):b.displayStatus=null;chrome.cast.setReceiverDisplayStatus(b,(0,g.x)(function(){this.info("Updated receiver status for "+b.friendlyName+": "+a)},this),(0,g.x)(function(){y7(this,"Failed to update receiver status for: "+b.friendlyName)},this))};
g.h.X=function(){this.Eu("");x7.Gb.X.call(this)};g.Sa(z7,x7);g.h=z7.prototype;g.h.Du=function(a){if(this.o){if(this.o==a)return;y7(this,"Overriding cast sesison with new session object");this.o.removeUpdateListener(this.C);this.o.removeMessageListener("urn:x-cast:com.google.youtube.mdx",this.B)}this.o=a;this.o.addUpdateListener(this.C);this.o.addMessageListener("urn:x-cast:com.google.youtube.mdx",this.B);Lxa(this)};
g.h.Uj=function(a){this.info("launchWithParams no-op for Cast: "+g.Jk(a))};
g.h.stop=function(){this.o?this.o.stop((0,g.x)(function(){this.le()},this),(0,g.x)(function(){this.le(Error("Failed to stop receiver app."))},this)):this.le(Error("Stopping cast device witout session."))};
g.h.Eu=g.Ia;g.h.X=function(){this.info("disposeInternal");g.Jo(this.A);this.A=0;this.o&&(this.o.removeUpdateListener(this.C),this.o.removeMessageListener("urn:x-cast:com.google.youtube.mdx",this.B));this.o=null;z7.Gb.X.call(this)};
g.h.MN=function(a,b){if(!this.ea())if(b){var c=w6(b);if(g.Na(c)){var d=""+c.type;c=c.data||{};this.info("onYoutubeMessage_: "+d+" "+g.Jk(c));switch(d){case "mdxSessionStatus":Kxa(this,c.screenId);break;default:y7(this,"Unknown youtube message: "+d)}}else y7(this,"Unable to parse message.")}else y7(this,"No data in message.")};
g.h.Cx=function(a,b,c,d){Hxa(this.I,this.u.label,a,this.u.friendlyName,(0,g.x)(function(e){e?b(e):0<=d?(y7(this,"Screen "+a+" appears to be offline. "+d+" retries left."),g.Ho((0,g.x)(this.Cx,this,a,b,c,d-1),300)):c(Error("Unable to fetch screen."))},this),c)};
g.h.dD=function(){return this.o};
g.h.xP=function(a){this.ea()||a||(y7(this,"Cast session died."),this.le())};g.Sa(A7,x7);g.h=A7.prototype;g.h.Du=function(a){this.A=a;this.A.addUpdateListener(this.M)};
g.h.Uj=function(a){this.B=a;this.F()};
g.h.stop=function(){this.o();this.o=g.Ia;g.Jo(this.C);this.A?this.A.stop((0,g.x)(this.le,this,null),(0,g.x)(this.le,this,"Failed to stop DIAL device.")):this.le()};
g.h.X=function(){this.o();this.o=g.Ia;g.Jo(this.C);this.A&&this.A.removeUpdateListener(this.M);this.A=null;A7.Gb.X.call(this)};
g.h.AP=function(a){this.ea()||a||(y7(this,"DIAL session died."),this.o(),this.o=g.Ia,this.le())};
g.h.ws=function(a){this.P=h6();if(this.B){var b=new chrome.cast.DialLaunchResponse(!0,Nxa(this));a(b);Mxa(this)}else this.F=(0,g.x)(function(){g.Jo(this.C);this.F=g.Ia;this.C=NaN;var c=new chrome.cast.DialLaunchResponse(!0,Nxa(this));a(c);Mxa(this)},this),this.C=g.Ho((0,g.x)(function(){this.F()},this),100)};
g.h.XF=function(a,b,c){Hxa(this.I,this.G.receiver.label,a,this.u.friendlyName,(0,g.x)(function(d){d&&d.token?(this.qp(d),b(new chrome.cast.DialLaunchResponse(!1))):this.ws(b,c)},this),(0,g.x)(function(d){y7(this,"Failed to get DIAL screen: "+d);
this.ws(b,c)},this))};g.Sa(B7,x7);B7.prototype.stop=function(){this.le()};
B7.prototype.Du=g.Ia;B7.prototype.Uj=function(){g.Jo(this.o);this.o=NaN;var a=j6(this.I.he(),this.u.label);a?this.qp(a):this.le(Error("No such screen"))};
B7.prototype.X=function(){g.Jo(this.o);this.o=NaN;B7.Gb.X.call(this)};g.Sa(C7,g.O);g.h=C7.prototype;
g.h.init=function(a,b){chrome.cast.timeout.requestSession=3E4;var c=new chrome.cast.SessionRequest(this.F);this.G||(c.dialRequest=new chrome.cast.DialRequest("YouTube"));var d=chrome.cast.AutoJoinPolicy.TAB_AND_ORIGIN_SCOPED,e=a?chrome.cast.DefaultActionPolicy.CAST_THIS_TAB:chrome.cast.DefaultActionPolicy.CREATE_SESSION,f=(0,g.x)(this.DM,this);c=new chrome.cast.ApiConfig(c,(0,g.x)(this.cB,this),f,d,e);c.customDialLaunchCallback=(0,g.x)(this.OK,this);chrome.cast.initialize(c,(0,g.x)(function(){this.ea()||
(chrome.cast.addReceiverActionListener(this.A),uxa(),this.u.subscribe("onlineScreenChange",(0,g.x)(this.cD,this)),this.w=Pxa(this),chrome.cast.setCustomReceivers(this.w,g.Ia,(0,g.x)(function(k){this.Ub("Failed to set initial custom receivers: "+g.Jk(k))},this)),this.S("yt-remote-cast2-availability-change",E7(this)),b(!0))},this),(0,g.x)(function(k){this.Ub("Failed to initialize API: "+g.Jk(k));
b(!1)},this))};
g.h.xO=function(a,b){D7("Setting connected screen ID: "+a+" -> "+b);if(this.o){var c=this.o.w;if(!a||c&&c.id!=a)D7("Unsetting old screen status: "+this.o.u.friendlyName),F7(this,null)}if(a&&b){if(!this.o){c=j6(this.u.he(),a);if(!c){D7("setConnectedScreenStatus: Unknown screen.");return}var d=Oxa(this,c);d||(D7("setConnectedScreenStatus: Connected receiver not custom..."),d=new chrome.cast.Receiver(c.uuid?c.uuid:c.id,c.name),d.receiverType=chrome.cast.ReceiverType.CUSTOM,this.w.push(d),chrome.cast.setCustomReceivers(this.w,
g.Ia,(0,g.x)(function(e){this.Ub("Failed to set initial custom receivers: "+g.Jk(e))},this)));
D7("setConnectedScreenStatus: new active receiver: "+d.friendlyName);F7(this,new B7(this.u,d),!0)}this.o.Eu(b)}else D7("setConnectedScreenStatus: no screen.")};
g.h.yO=function(a){this.ea()?this.Ub("Setting connection data on disposed cast v2"):this.o?this.o.Uj(a):this.Ub("Setting connection data without a session")};
g.h.zP=function(){this.ea()?this.Ub("Stopping session on disposed cast v2"):this.o?(this.o.stop(),F7(this,null)):D7("Stopping non-existing session")};
g.h.requestSession=function(){chrome.cast.requestSession((0,g.x)(this.cB,this),(0,g.x)(this.cN,this))};
g.h.X=function(){this.u.unsubscribe("onlineScreenChange",(0,g.x)(this.cD,this));window.chrome&&chrome.cast&&chrome.cast.removeReceiverActionListener(this.A);var a=rxa,b=g.w("yt.mdx.remote.debug.handlers_");g.db(b||[],a);g.He(this.o);C7.Gb.X.call(this)};
g.h.Ub=function(a){h7("Controller",a)};
g.h.eB=function(a,b){this.o==a&&(b||F7(this,null),this.S("yt-remote-cast2-session-change",b))};
g.h.zM=function(a,b){if(!this.ea())if(a)switch(a.friendlyName=chrome.cast.unescape(a.friendlyName),D7("onReceiverAction_ "+a.label+" / "+a.friendlyName+"-- "+b),b){case chrome.cast.ReceiverAction.CAST:if(this.o)if(this.o.u.label!=a.label)D7("onReceiverAction_: Stopping active receiver: "+this.o.u.friendlyName),this.o.stop();else{D7("onReceiverAction_: Casting to active receiver.");this.o.w&&this.S("yt-remote-cast2-session-change",this.o.w);break}switch(a.receiverType){case chrome.cast.ReceiverType.CUSTOM:F7(this,
new B7(this.u,a));break;case chrome.cast.ReceiverType.DIAL:F7(this,new A7(this.u,a,this.C));break;case chrome.cast.ReceiverType.CAST:F7(this,new z7(this.u,a));break;default:this.Ub("Unknown receiver type: "+a.receiverType)}break;case chrome.cast.ReceiverAction.STOP:this.o&&this.o.u.label==a.label?this.o.stop():this.Ub("Stopping receiver w/o session: "+a.friendlyName)}else this.Ub("onReceiverAction_ called without receiver.")};
g.h.OK=function(a){if(this.ea())return Promise.reject(Error("disposed"));var b=a.receiver;b.receiverType!=chrome.cast.ReceiverType.DIAL&&(this.Ub("Not DIAL receiver: "+b.friendlyName),b.receiverType=chrome.cast.ReceiverType.DIAL);var c=this.o?this.o.u:null;if(!c||c.label!=b.label)return this.Ub("Receiving DIAL launch request for non-clicked DIAL receiver: "+b.friendlyName),Promise.reject(Error("illegal DIAL launch"));if(c&&c.label==b.label&&c.receiverType!=chrome.cast.ReceiverType.DIAL){if(this.o.w)return D7("Reselecting dial screen."),
this.S("yt-remote-cast2-session-change",this.o.w),Promise.resolve(new chrome.cast.DialLaunchResponse(!1));this.Ub('Changing CAST intent from "'+c.receiverType+'" to "dial" for '+b.friendlyName);F7(this,new A7(this.u,b,this.C))}b=this.o;b.G=a;return b.G.appState==chrome.cast.DialAppState.RUNNING?new Promise((0,g.x)(b.XF,b,(b.G.extraData||{}).screenId||null)):new Promise((0,g.x)(b.ws,b))};
g.h.cB=function(a){if(!this.ea()){D7("New cast session ID: "+a.sessionId);var b=a.receiver;if(b.receiverType!=chrome.cast.ReceiverType.CUSTOM){if(!this.o)if(b.receiverType==chrome.cast.ReceiverType.CAST)D7("Got resumed cast session before resumed mdx connection."),b.friendlyName=chrome.cast.unescape(b.friendlyName),F7(this,new z7(this.u,b),!0);else{this.Ub("Got non-cast session without previous mdx receiver event, or mdx resume.");return}var c=this.o.u,d=j6(this.u.he(),c.label);d&&e6(d,b.label)&&
c.receiverType!=chrome.cast.ReceiverType.CAST&&b.receiverType==chrome.cast.ReceiverType.CAST&&(D7("onSessionEstablished_: manual to cast session change "+b.friendlyName),g.He(this.o),this.o=new z7(this.u,b),this.o.subscribe("sessionScreen",(0,g.x)(this.eB,this,this.o)),this.o.Uj(null));this.o.Du(a)}}};
g.h.yP=function(){return this.o?this.o.dD():null};
g.h.cN=function(a){this.ea()||(this.Ub("Failed to estabilish a session: "+g.Jk(a)),a.code!=chrome.cast.ErrorCode.CANCEL&&F7(this,null))};
g.h.DM=function(a){D7("Receiver availability updated: "+a);if(!this.ea()){var b=E7(this);this.B=a==chrome.cast.ReceiverAvailability.AVAILABLE;E7(this)!=b&&this.S("yt-remote-cast2-availability-change",E7(this))}};
g.h.cD=function(){this.ea()||(this.w=Pxa(this),D7("Updating custom receivers: "+g.Jk(this.w)),chrome.cast.setCustomReceivers(this.w,g.Ia,(0,g.x)(function(){this.Ub("Failed to set custom receivers.")},this)),this.S("yt-remote-cast2-availability-change",E7(this)))};
C7.prototype.setLaunchParams=C7.prototype.yO;C7.prototype.setConnectedScreenStatus=C7.prototype.xO;C7.prototype.stopSession=C7.prototype.zP;C7.prototype.getCastSession=C7.prototype.yP;C7.prototype.requestSession=C7.prototype.requestSession;C7.prototype.init=C7.prototype.init;C7.prototype.dispose=C7.prototype.dispose;var L7=[];g.h=Q7.prototype;
g.h.reset=function(a){this.listId="";this.index=-1;this.videoId="";R7(this);this.volume=-1;this.muted=!1;a&&(this.index=a.index,this.listId=a.listId,this.videoId=a.videoId,this.playerState=a.playerState,this.volume=a.volume,this.muted=a.muted,this.audioTrackId=a.audioTrackId,this.o=a.trackData,this.P=a.hasPrevious,this.hasNext=a.hasNext,this.F=a.playerTime,this.C=a.playerTimeAt,this.B=a.seekableStart,this.u=a.seekableEnd,this.G=a.duration,this.I=a.loadedTime,this.A=a.liveIngestionTime,this.w=!isNaN(this.A))};
g.h.eb=function(){return 1==this.playerState};
g.h.isAdPlaying=function(){return 1081==this.playerState};
g.h.getDuration=function(){return this.w?this.G+S7(this):this.G};
g.h.clone=function(){return new Q7(W7(this))};g.r(Y7,g.O);g.h=Y7.prototype;g.h.play=function(){1==this.o?(this.u?this.u.play(null,g.Ia,d8(this,"play")):c8(this,"play"),b8(this,1,U7(Z7(this))),this.S("remotePlayerChange")):$7(this,this.play)};
g.h.pause=function(){1==this.o?(this.u?this.u.pause(null,g.Ia,d8(this,"pause")):c8(this,"pause"),b8(this,2,U7(Z7(this))),this.S("remotePlayerChange")):$7(this,this.pause)};
g.h.seekTo=function(a){if(1==this.o){if(this.u){var b=Z7(this),c=new chrome.cast.media.SeekRequest;c.currentTime=a;b.eb()||3==b.playerState?c.resumeState=chrome.cast.media.ResumeState.PLAYBACK_START:c.resumeState=chrome.cast.media.ResumeState.PLAYBACK_PAUSE;this.u.seek(c,g.Ia,d8(this,"seekTo",{newTime:a}))}else c8(this,"seekTo",{newTime:a});b8(this,3,a);this.S("remotePlayerChange")}else $7(this,g.Qa(this.seekTo,a))};
g.h.stop=function(){if(1==this.o){this.u?this.u.stop(null,g.Ia,d8(this,"stopVideo")):c8(this,"stopVideo");var a=Z7(this);a.index=-1;a.videoId="";R7(a);a8(this,a);this.S("remotePlayerChange")}else $7(this,this.stop)};
g.h.setVolume=function(a,b){if(1==this.o){var c=Z7(this);if(this.w){if(c.volume!=a){var d=Math.round(a)/100;this.w.setReceiverVolumeLevel(d,(0,g.x)(function(){h7("CP","set receiver volume: "+d)},this),(0,g.x)(function(){this.Ub("failed to set receiver volume.")},this))}c.muted!=b&&this.w.setReceiverMuted(b,(0,g.x)(function(){h7("CP","set receiver muted: "+b)},this),(0,g.x)(function(){this.Ub("failed to set receiver muted.")},this))}else{var e={volume:a,
muted:b};-1!=c.volume&&(e.delta=a-c.volume);c8(this,"setVolume",e)}c.muted=b;c.volume=a;a8(this,c)}else $7(this,g.Qa(this.setVolume,a,b))};
g.h.eC=function(a,b){if(1==this.o){var c=Z7(this),d={videoId:a};b&&(c.o={trackName:b.name,languageCode:b.languageCode,sourceLanguageCode:b.translationLanguage?b.translationLanguage.languageCode:"",languageName:b.languageName,kind:b.kind},d.style=g.Jk(b.style),g.Sb(d,c.o));c8(this,"setSubtitlesTrack",d);a8(this,c)}else $7(this,g.Qa(this.eC,a,b))};
g.h.setAudioTrack=function(a,b){if(1==this.o){var c=b.getLanguageInfo().getId();c8(this,"setAudioTrack",{videoId:a,audioTrackId:c});var d=Z7(this);d.audioTrackId=c;a8(this,d)}else $7(this,g.Qa(this.setAudioTrack,a,b))};
g.h.playVideo=function(a,b,c,d,e,f,k){var l=Z7(this);c=c||0;var m={videoId:a,currentIndex:c};V7(l,a,c);void 0!==b&&(T7(l,b),m.currentTime=b);void 0!==d&&(m.listId=d);null!=e&&(m.playerParams=e);null!=f&&(m.clickTrackingParams=f);null!=k&&(m.locationInfo=g.Jk(k));c8(this,"setPlaylist",m);d||a8(this,l)};
g.h.YC=function(a,b){if(1==this.o){if(a&&b){var c=Z7(this);V7(c,a,b);a8(this,c)}c8(this,"previous")}else $7(this,g.Qa(this.YC,a,b))};
g.h.nextVideo=function(a,b){if(1==this.o){if(a&&b){var c=Z7(this);V7(c,a,b);a8(this,c)}c8(this,"next")}else $7(this,g.Qa(this.nextVideo,a,b))};
g.h.Nw=function(){1==this.o?c8(this,"dismissAutoplay"):$7(this,this.Nw)};
g.h.dispose=function(){if(3!=this.o){var a=this.o;this.o=3;this.S("proxyStateChange",a,this.o)}g.O.prototype.dispose.call(this)};
g.h.X=function(){bya(this);this.A=null;this.B.clear();X7(this,null);g.O.prototype.X.call(this)};
g.h.hv=function(a){if((a!=this.o||2==a)&&3!=this.o&&0!=a){var b=this.o;this.o=a;this.S("proxyStateChange",b,a);if(1==a)for(;!this.B.isEmpty();)b=a=this.B,g.ab(b.o)&&(b.o=b.u,b.o.reverse(),b.u=[]),a.o.pop().apply(this);else 3==a&&this.dispose()}};
g.h.wM=function(a,b){this.S(a,b)};
g.h.wK=function(a){if(!a)this.nm(null),X7(this,null);else if(this.w.receiver.volume){a=this.w.receiver.volume;var b=Z7(this),c=Math.round(100*a.level||0);if(b.volume!=c||b.muted!=a.muted)h7("CP","Cast volume update: "+a.level+(a.muted?" muted":"")),b.volume=c,b.muted=!!a.muted,a8(this,b)}};
g.h.nm=function(a){h7("CP","Cast media: "+!!a);this.u&&this.u.removeUpdateListener(this.G);if(this.u=a)this.u.addUpdateListener(this.G),cya(this),this.S("remotePlayerChange")};
g.h.vK=function(a){a?(cya(this),this.S("remotePlayerChange")):this.nm(null)};
g.h.HK=function(){var a=Zxa();a&&X7(this,a)};
g.h.Ub=function(a){h7("CP",a)};g.r(e8,g.O);g.h=e8.prototype;
g.h.connect=function(a,b){if(b){var c=b.listId,d=b.videoId,e=b.playerParams,f=b.clickTrackingParams,k=b.index,l={videoId:d},m=b.currentTime,n=b.locationInfo;void 0!==m&&(l.currentTime=5>=m?0:m);e&&(l.playerParams=e);n&&(l.locationInfo=n);f&&(l.clickTrackingParams=f);c&&(l.listId=c);void 0!==k&&(l.currentIndex=k);c&&(this.Va.listId=c);this.Va.videoId=d;this.Va.index=k||0;this.Va.state=3;T7(this.Va,m);this.A="UNSUPPORTED";f8("Connecting with setPlaylist and params: "+g.Jk(l));this.o.connect({method:"setPlaylist",
params:g.Jk(l)},a,pwa())}else f8("Connecting without params"),this.o.connect({},a,pwa());eya(this)};
g.h.dispose=function(){this.ea()||(this.S("beforeDispose"),g8(this,3));g.O.prototype.dispose.call(this)};
g.h.X=function(){h8(this);j8(this);i8(this);g.Jo(this.F);this.F=NaN;g.Jo(this.G);this.G=NaN;this.w=null;g.Fp(this.R);this.R.length=0;this.o.dispose();g.O.prototype.X.call(this);this.A=this.C=this.u=this.Va=this.o=null};
g.h.nF=function(){this.wj(2)};
g.h.AK=function(){f8("Channel opened");this.M&&(this.M=!1,i8(this),this.P=g.Ho((0,g.x)(function(){f8("Timing out waiting for a screen.");this.wj(1)},this),15E3));
twa(oxa(this.o),this.U)};
g.h.xK=function(){f8("Channel closed");isNaN(this.B)?p6(!0):p6();this.dispose()};
g.h.yK=function(a){p6();isNaN(this.xl())?(f8("Channel error: "+a+" without reconnection"),this.dispose()):(this.M=!0,f8("Channel error: "+a+" with reconnection in "+this.xl()+" ms"),g8(this,2))};
g.h.zK=function(a){a.params?f8("Received: action="+a.action+", params="+g.Jk(a.params)):f8("Received: action="+a.action+" {}");switch(a.action){case "loungeStatus":a=w6(a.params.devices);this.u=(0,g.Cc)(a,function(c){return new c6(c)});
a=!!g.Xa(this.u,function(c){return"LOUNGE_SCREEN"==c.type});
hya(this,a);break;case "loungeScreenDisconnected":g.eb(this.u,function(c){return"LOUNGE_SCREEN"==c.type});
hya(this,!1);break;case "remoteConnected":var b=new c6(w6(a.params.device));g.Xa(this.u,function(c){return b?c.id==b.id:!1})||$va(this.u,b);
break;case "remoteDisconnected":b=new c6(w6(a.params.device));g.eb(this.u,function(c){return b?c.id==b.id:!1});
break;case "gracefulDisconnect":break;case "playlistModified":jya(this,a);break;case "nowPlaying":lya(this,a);break;case "onStateChange":kya(this,a);break;case "onAdStateChange":mya(this,a);break;case "onVolumeChanged":nya(this,a);break;case "onSubtitlesTrackChanged":iya(this,a);break;case "nowAutoplaying":oya(this,a);break;case "autoplayDismissed":this.S("autoplayDismissed");break;case "autoplayUpNext":this.C=a.params.videoId||null;this.S("autoplayUpNext",this.C);break;case "onAutoplayModeChanged":this.A=
a.params.autoplayMode;this.S("autoplayModeChange",this.A);"DISABLED"==this.A&&this.S("autoplayDismissed");break;case "onHasPreviousNextChanged":pya(this,a);break;case "requestAssistedSignIn":this.S("assistedSignInRequested",a.params.authCode);break;default:f8("Unrecognized action: "+a.action)}};
g.h.mO=function(){if(this.w){var a=this.w;this.w=null;this.Va.videoId!=a&&k8(this,"getNowPlaying")}};
g.h.dF=function(){var a=3;this.ea()||(a=0,isNaN(this.xl())?c7(this.o)&&isNaN(this.B)&&(a=1):a=2);return a};
g.h.wj=function(a){f8("Disconnecting with "+a);h8(this);this.S("beforeDisconnect",a);1==a&&p6();pxa(this.o,a);this.dispose()};
g.h.cF=function(){var a=this.Va;this.w&&(a=this.Va.clone(),V7(a,this.w,a.index));return W7(a)};
g.h.zO=function(a){var b=new Q7(a);b.videoId&&b.videoId!=this.Va.videoId&&(this.w=b.videoId,g.Jo(this.F),this.F=g.Ho((0,g.x)(this.mO,this),5E3));var c=[];this.Va.listId==b.listId&&this.Va.videoId==b.videoId&&this.Va.index==b.index||c.push("remoteQueueChange");this.Va.playerState==b.playerState&&this.Va.volume==b.volume&&this.Va.muted==b.muted&&U7(this.Va)==U7(b)&&g.Jk(this.Va.o)==g.Jk(b.o)||c.push("remotePlayerChange");this.Va.reset(a);(0,g.y)(c,function(d){this.S(d)},this)};
g.h.Ax=function(){var a=this.o.C.id,b=g.Xa(this.u,function(c){return"REMOTE_CONTROL"==c.type&&c.id!=a});
return b?b.id:""};
g.h.xl=function(){var a=this.o;return a.u.isActive()?a.u.u-(0,g.H)():NaN};
g.h.RE=function(){return this.A||"UNSUPPORTED"};
g.h.SE=function(){return this.C||""};
g.h.rP=function(){if(!isNaN(this.xl())){var a=this.o.u;g.un(a.o);a.start()}};
g.h.uO=function(a,b){k8(this,a,b);gya(this)};
e8.prototype.subscribe=e8.prototype.subscribe;e8.prototype.unsubscribeByKey=e8.prototype.Eh;e8.prototype.getProxyState=e8.prototype.dF;e8.prototype.disconnect=e8.prototype.wj;e8.prototype.getPlayerContextData=e8.prototype.cF;e8.prototype.setPlayerContextData=e8.prototype.zO;e8.prototype.getOtherConnectedRemoteId=e8.prototype.Ax;e8.prototype.getReconnectTimeout=e8.prototype.xl;e8.prototype.getAutoplayMode=e8.prototype.RE;e8.prototype.getAutoplayVideoId=e8.prototype.SE;e8.prototype.reconnect=e8.prototype.rP;
e8.prototype.sendMessage=e8.prototype.uO;g.r(l8,l7);g.h=l8.prototype;g.h.he=function(a){return this.zd.$_gs(a)};
g.h.contains=function(a){return!!this.zd.$_c(a)};
g.h.get=function(a){return this.zd.$_g(a)};
g.h.start=function(){this.zd.$_st()};
g.h.add=function(a,b,c){this.zd.$_a(a,b,c)};
g.h.remove=function(a,b,c){this.zd.$_r(a,b,c)};
g.h.cq=function(a,b,c,d){this.zd.$_un(a,b,c,d)};
g.h.X=function(){for(var a=0,b=this.u.length;a<b;++a)this.zd.$_ubk(this.u[a]);this.u.length=0;this.zd=null;l7.prototype.X.call(this)};
g.h.vP=function(){this.S("screenChange")};
g.h.YL=function(){this.S("onlineScreenChange")};
u7.prototype.$_st=u7.prototype.start;u7.prototype.$_gspc=u7.prototype.wP;u7.prototype.$_gsppc=u7.prototype.bD;u7.prototype.$_c=u7.prototype.contains;u7.prototype.$_g=u7.prototype.get;u7.prototype.$_a=u7.prototype.add;u7.prototype.$_un=u7.prototype.cq;u7.prototype.$_r=u7.prototype.remove;u7.prototype.$_gs=u7.prototype.he;u7.prototype.$_gos=u7.prototype.aD;u7.prototype.$_s=u7.prototype.subscribe;u7.prototype.$_ubk=u7.prototype.Eh;var E8=null,D8=!1,m8=null,n8=null,C8=null,r8=[];g.r(F8,g.A);g.h=F8.prototype;
g.h.X=function(){g.A.prototype.X.call(this);this.A.stop();this.C.stop();this.M.stop();this.V();this.o.unsubscribe("proxyStateChange",this.YA,this);this.o.unsubscribe("remotePlayerChange",this.sm,this);this.o.unsubscribe("remoteQueueChange",this.rp,this);this.o.unsubscribe("autoplayUpNext",this.oA,this);this.o.unsubscribe("previousNextChange",this.UA,this);this.o.unsubscribe("nowAutoplaying",this.PA,this);this.o.unsubscribe("autoplayDismissed",this.nA,this);this.o=this.B=null};
g.h.Az=function(a,b){for(var c=[],d=1;d<arguments.length;++d)c[d-1]=arguments[d];if(2!=this.o.o)if(I8(this)){if(!Z7(this.o).isAdPlaying()||"control_seek"!=a)switch(a){case "control_toggle_play_pause":Z7(this.o).eb()?this.o.pause():this.o.play();break;case "control_play":this.o.play();break;case "control_pause":this.o.pause();break;case "control_seek":this.P.Jx(c[0],c[1]);break;case "control_subtitles_set_track":J8(this,c[0]);break;case "control_set_audio_track":c=c[0],I8(this)&&this.o.setAudioTrack(this.u.getVideoData(1).videoId,
c)}}else switch(a){case "control_toggle_play_pause":case "control_play":case "control_pause":c=this.u.getCurrentTime();K8(this,0==c?void 0:c);break;case "control_seek":K8(this,c[0]);break;case "control_subtitles_set_track":J8(this,c[0]);break;case "control_set_audio_track":c=c[0],I8(this)&&this.o.setAudioTrack(this.u.getVideoData(1).videoId,c)}};
g.h.uK=function(a){this.M.jF(a)};
g.h.WO=function(a){this.Az("control_subtitles_set_track",g.Mb(a)?null:a)};
g.h.oC=function(){var a=this.u.getOption("captions","track");g.Mb(a)||J8(this,a)};
g.h.DA=function(a){if(I8(this)){this.o.unsubscribe("remotePlayerChange",this.sm,this);var b=Math.round(a.volume);a=!!a.muted;var c=Z7(this.o);if(b!=c.volume||a!=c.muted)this.o.setVolume(b,a),this.R.start();this.o.subscribe("remotePlayerChange",this.sm,this)}};
g.h.uL=function(){g.Mb(this.F)||Bya(this,this.F);this.G=!1};
g.h.YA=function(a,b){this.C.stop();2==b&&this.nC()};
g.h.sm=function(){if(I8(this)){this.A.stop();var a=Z7(this.o);switch(a.playerState){case 1080:case 1081:case 1084:case 1085:this.B.M=1;break;case 1082:case 1083:this.B.M=0;break;default:this.B.M=-1}switch(a.playerState){case 1081:case 1:H8(this,new g.HC(8));this.mC();break;case 1085:case 3:H8(this,new g.HC(9));break;case 1083:case 0:H8(this,new g.HC(2));this.P.stop();G8(this,this.u.getVideoData().lengthSeconds);break;case 1084:H8(this,new g.HC(4));break;case 2:H8(this,new g.HC(4));G8(this,U7(a));
break;case -1:H8(this,new g.HC(64));break;case -1E3:H8(this,new g.HC(128,{errorCode:"mdx.remoteerror",errorMessage:"Cette vid\u00e9o ne peut pas \u00eatre visionn\u00e9e \u00e0 distance."}))}a=Z7(this.o).o;var b=this.F;(a||b?a&&b&&a.trackName==b.trackName&&a.languageCode==b.languageCode&&a.languageName==b.languageName&&a.kind==b.kind:1)||(this.F=a,Bya(this,a));a=Z7(this.o);-1==a.volume||Math.round(this.u.getVolume())==a.volume&&this.u.isMuted()==a.muted||this.R.isActive()||this.NC()}else Aya(this)};
g.h.UA=function(){this.u.S("mdxpreviousnextchange")};
g.h.rp=function(){I8(this)||Aya(this)};
g.h.dE=function(){this.o.Nw()};
g.h.oA=function(){};
g.h.PA=function(a){isNaN(a)||this.u.S("mdxnowautoplaying",a)};
g.h.nA=function(){this.u.S("mdxautoplaycanceled")};
g.h.FI=function(a,b){-1==Z7(this.o).playerState?K8(this,a):b&&this.o.seekTo(a)};
g.h.NC=function(){if(I8(this)){var a=Z7(this.o);this.w.bb(this.U);a.muted?this.u.mute():this.u.unMute();this.u.setVolume(a.volume);this.U=this.w.L(this.u,"onVolumeChange",this.DA)}};
g.h.mC=function(){this.A.stop();if(!this.o.ea()){var a=Z7(this.o);a.eb()&&H8(this,new g.HC(8));G8(this,U7(a));this.A.start()}};
g.h.nC=function(){this.C.stop();this.A.stop();var a=this.o.A.getReconnectTimeout();2==this.o.o&&!isNaN(a)&&this.C.start()};g.r(L8,g.R);L8.prototype.A=function(a){Dya(this,a.state)};g.r(M8,g.R);M8.prototype.Qb=function(){this.u.show()};
M8.prototype.w=function(){g.GN("https://support.google.com/youtube/answer/7640706")};
M8.prototype.A=function(){b6("mdx-manual-pairing-popup-ok");this.u.hide()};g.r(N8,g.R);N8.prototype.Qb=function(){this.u.show()};
N8.prototype.w=function(){b6("mdx-privacy-popup-cancel");this.u.hide()};
N8.prototype.A=function(){b6("mdx-privacy-popup-confirm");this.u.hide()};g.r(O8,g.iO);O8.prototype.G=function(){var a=this.K.getOption("remote","receivers");a&&1<a.length&&!this.K.getOption("remote","quickCast")?(this.C=g.vb(a,this.w,this),g.kO(this,(0,g.Cc)(a,this.w)),a=this.K.getOption("remote","currentReceiver"),this.Db(this.w(a)),this.enable(!0)):this.enable(!1)};
O8.prototype.w=function(a){return a.key};
O8.prototype.Ze=function(a){return"cast-selector-receiver"===a?"Caster sur\u2026":this.C[a].name};
O8.prototype.fd=function(a){g.iO.prototype.fd.call(this,a);this.K.setOption("remote","currentReceiver",this.C[a]);this.u.gb()};g.r(P8,g.vL);g.h=P8.prototype;
g.h.create=function(){uya(g.Ry(this.player.N()));this.w.push(g.Oo("yt-remote-before-disconnect",this.rK,this));this.w.push(g.Oo("yt-remote-connection-change",this.EM,this));this.w.push(g.Oo("yt-remote-receiver-availability-change",this.WA,this));this.w.push(g.Oo("yt-remote-auto-connect",this.CM,this));this.w.push(g.Oo("yt-remote-receiver-resumed",this.BM,this));this.w.push(g.Oo("mdx-privacy-popup-confirm",this.YN,this));this.w.push(g.Oo("mdx-privacy-popup-cancel",this.XN,this));this.w.push(g.Oo("mdx-manual-pairing-popup-ok",
this.tG,this));this.WA()};
g.h.load=function(){this.player.cancelPlayback();g.vL.prototype.load.call(this);this.C=new F8(this,this.player,this.o);var a=(a=zya())?a.currentTime:0;var b=B8()?new Y7(w8(),void 0):null;0==a&&b&&(a=U7(Z7(b)));0!=a&&(this.V=a||0,this.player.S("progresssync",a,void 0));Cya(this,this.I,this.I);g.$S(this.player.app,6)};
g.h.unload=function(){this.player.S("mdxautoplaycanceled");this.A=this.u;g.Ie(this.C,this.o);this.o=this.C=null;g.vL.prototype.unload.call(this);g.$S(this.player.app,5);Q8(this)};
g.h.X=function(){g.Po(this.w);g.vL.prototype.X.call(this)};
g.h.Wl=function(a,b){for(var c=[],d=1;d<arguments.length;++d)c[d-1]=arguments[d];this.loaded&&this.C.Az.apply(this.C,[a].concat(g.ea(c)))};
g.h.getAdState=function(){return this.M};
g.h.fF=function(){return this.loaded?this.C.suggestion:null};
g.h.Qy=function(){return this.o?Z7(this.o).P:!1};
g.h.hasNext=function(){return this.o?Z7(this.o).hasNext:!1};
g.h.getCurrentTime=function(){return this.V};
g.h.getProgressState=function(){var a=Z7(this.o),b=this.player.getVideoData();return{allowSeeking:g.P(this.player.N().experiments,"web_player_mdx_allow_seeking_change_killswitch")?this.player.Qc():!a.isAdPlaying()&&this.player.Qc(),clipEnd:b.clipEnd,clipStart:b.clipStart,current:this.getCurrentTime(),displayedStart:-1,duration:a.getDuration(),ingestionTime:a.w?a.A+S7(a):a.A,isAtLiveHead:1>=(a.w?a.u+S7(a):a.u)-this.getCurrentTime(),loaded:a.I,seekableEnd:a.w?a.u+S7(a):a.u,seekableStart:0<a.B?a.B+S7(a):
a.B}};
g.h.nextVideo=function(){this.o&&this.o.nextVideo()};
g.h.BG=function(){this.o&&this.o.YC()};
g.h.rK=function(a){1==a&&(this.ba=this.o?Z7(this.o):null)};
g.h.EM=function(){var a=B8()?new Y7(w8(),void 0):null;if(a){var b=this.A;this.loaded&&this.unload();this.o=a;this.ba=null;b.key!=this.u.key&&(this.A=b,this.load())}else g.He(this.o),this.o=null,this.loaded&&(this.unload(),(a=this.ba)&&a.videoId==this.player.getVideoData().videoId&&this.player.cueVideoById(a.videoId,U7(a)));this.player.S("videodatachange","newdata",this.player.getVideoData(),3)};
g.h.WA=function(){this.U=[this.u].concat(wya());var a=x8()||this.u;R8(this,a);this.player.na("onMdxReceiversChange")};
g.h.CM=function(){var a=x8();R8(this,a)};
g.h.BM=function(){this.A=x8()};
g.h.YN=function(){this.P=!0;Q8(this);D8=!1;E8&&z8(E8,1);E8=null};
g.h.XN=function(){this.P=!1;Q8(this);R8(this,this.u);this.A=this.u;D8=!1;E8=null;this.player.playVideo()};
g.h.tG=function(){this.R=!0;Q8(this);g.Ds("yt-remote-manual-pairing-warning-shown",!0,2592E3);D8=!1;E8&&z8(E8,1);E8=null};
g.h.Oc=function(a,b){switch(a){case "casting":return this.loaded;case "receivers":return this.U;case "currentReceiver":return b&&("cast-selector-receiver"==b.key?O7():R8(this,b)),this.loaded?this.A:this.u;case "quickCast":return 2==this.U.length&&"cast-selector-receiver"==this.U[1].key?(b&&O7(),!0):!1}};
g.h.CG=function(){c8(this.o,"sendDebugCommand",{debugCommand:"stats4nerds "})};
g.h.Pf=function(){return!1};
g.h.getOptions=function(){return["casting","receivers","currentReceiver","quickCast"]};g.KL.remote=P8;})(_yt_player);