text: (function(g){var window=this;'use strict';var FPa=function(a,b){a.Ma("onAutonavCoundownStarted",b)},w5=function(a,b,c){var d=b.ib();
  g.N(a.element,"ytp-suggestion-set",!!d.videoId);var e=b.getPlaylistId();c=b.Ue(c?c:"mqdefault.jpg");var f=null,h=null;b instanceof g.RG&&(b.lengthText?(f=b.lengthText||null,h=b.Iy||null):b.lengthSeconds&&(f=g.WL(b.lengthSeconds),h=g.WL(b.lengthSeconds,!0)));var l=!!e;e=l&&"RD"===(new g.aN(e.substr(0,2),e.substr(2))).type;var m=b instanceof g.RG?b.isLivePlayback:null,n=b instanceof g.RG?b.isUpcoming:null;d={title:b.title,author:b.author,author_and_views:d.shortViewCount?b.author+" \u2022 "+d.shortViewCount:
  b.author,aria_label:b.Yq||g.DI("Watch $TITLE",{TITLE:b.title}),duration:f,timestamp:h,url:b.qn(),is_live:m,is_upcoming:n,is_list:l,is_mix:e,background:c?"background-image: url("+c+")":"",views_and_publish_time:d.shortViewCount?d.shortViewCount+" \u2022 "+d.publishedTimeText:d.publishedTimeText,autoplayAlternativeHeader:b.Tt};b instanceof g.bN&&(d.playlist_length=b.length);a.update(d)},x5=function(a){var b=a.T(),c=b.l;
  g.V.call(this,{D:"a",K:"ytp-autonav-suggestion-card",V:{href:"{{url}}",target:c?b.I:"","aria-label":"{{aria_label}}","data-is-live":"{{is_live}}","data-is-list":"{{is_list}}","data-is-mix":"{{is_mix}}","data-is-upcoming":"{{is_upcoming}}"},S:[{D:"div",Ea:["ytp-autonav-endscreen-upnext-thumbnail","ytp-autonav-thumbnail-small"],V:{style:"{{background}}"},S:[{D:"div",V:{"aria-label":"{{timestamp}}"},Ea:["ytp-autonav-timestamp"],ra:"{{duration}}"},{D:"div",Ea:["ytp-autonav-live-stamp"],ra:"Live"},{D:"div",
  Ea:["ytp-autonav-upcoming-stamp"],ra:"Upcoming"},{D:"div",K:"ytp-autonav-list-overlay",S:[{D:"div",K:"ytp-autonav-mix-text",ra:"Mix"},{D:"div",K:"ytp-autonav-mix-icon"}]}]},{D:"div",Ea:["ytp-autonav-endscreen-upnext-title","ytp-autonav-title-card"],ra:"{{title}}"},{D:"div",Ea:["ytp-autonav-endscreen-upnext-author","ytp-autonav-author-card"],ra:"{{author}}"},{D:"div",Ea:["ytp-autonav-endscreen-upnext-author","ytp-autonav-view-and-date-card"],ra:"{{views_and_publish_time}}"}]});this.G=a;this.suggestion=
  null;this.i=c;this.Ra("click",this.onClick);this.Ra("keypress",this.l)},z5=function(a,b){b=void 0===b?!1:b;
  g.V.call(this,{D:"div",K:"ytp-autonav-endscreen-countdown-container"});var c=this;this.C=b;this.l=0;b=a.T();var d=b.l;this.G=a;this.suggestion=null;this.i=new g.V({D:"div",K:"ytp-autonav-endscreen-upnext-container",V:{"aria-label":"{{aria_label}}","data-is-live":"{{is_live}}","data-is-list":"{{is_list}}","data-is-mix":"{{is_mix}}","data-is-upcoming":"{{is_upcoming}}"},S:[{D:"div",K:"ytp-autonav-endscreen-upnext-header"},{D:"div",K:"ytp-autonav-endscreen-upnext-alternative-header",ra:"{{autoplayAlternativeHeader}}"},
  {D:"a",K:"ytp-autonav-endscreen-link-container",V:{href:"{{url}}",target:d?b.I:""},S:[{D:"div",K:"ytp-autonav-endscreen-upnext-thumbnail",V:{style:"{{background}}"},S:[{D:"div",V:{"aria-label":"{{timestamp}}"},Ea:["ytp-autonav-timestamp"],ra:"{{duration}}"},{D:"div",Ea:["ytp-autonav-live-stamp"],ra:"Live"},{D:"div",Ea:["ytp-autonav-upcoming-stamp"],ra:"Upcoming"}]},{D:"div",K:"ytp-autonav-endscreen-video-info",S:[{D:"div",K:"ytp-autonav-endscreen-premium-badge"},{D:"div",K:"ytp-autonav-endscreen-upnext-title",
  ra:"{{title}}"},{D:"div",K:"ytp-autonav-endscreen-upnext-author",ra:"{{author}}"},{D:"div",K:"ytp-autonav-view-and-date",ra:"{{views_and_publish_time}}"},{D:"div",K:"ytp-autonav-author-and-view",ra:"{{author_and_views}}"}]}]}]});g.J(this,this.i);this.i.Ba(this.element);d||this.N(this.i.Da("ytp-autonav-endscreen-link-container"),"click",this.CG);this.G.Zb(this.element,this,115127);this.G.Zb(this.i.Da("ytp-autonav-endscreen-link-container"),this,115128);this.overlay=new g.V({D:"div",K:"ytp-autonav-overlay"});
  g.J(this,this.overlay);this.overlay.Ba(this.element);this.u=new g.V({D:"div",K:"ytp-autonav-endscreen-button-container"});g.J(this,this.u);this.u.Ba(this.element);this.cancelButton=new g.V({D:"button",Ea:["ytp-autonav-endscreen-upnext-button","ytp-autonav-endscreen-upnext-cancel-button"],V:{"aria-label":"Cancel autoplay"},ra:"Cancel"});g.J(this,this.cancelButton);this.cancelButton.Ba(this.u.element);this.cancelButton.Ra("click",this.BO,this);this.G.Zb(this.cancelButton.element,this,115129);this.playButton=
  new g.V({D:"a",Ea:["ytp-autonav-endscreen-upnext-button","ytp-autonav-endscreen-upnext-play-button"],V:{href:"{{url}}",role:"button","aria-label":"Play next video"},ra:"Play now"});g.J(this,this.playButton);this.playButton.Ba(this.u.element);this.playButton.Ra("click",this.CG,this);this.G.Zb(this.playButton.element,this,115130);this.B=new g.K(function(){y5(c)},500);
  g.J(this,this.B);this.BG();this.N(a,"autonavvisibility",this.BG)},C5=function(a){var b=a.G.hj(!0,a.G.isFullscreen());
  g.N(a.element,"ytp-autonav-endscreen-small-mode",a.lf(b));g.N(a.element,"ytp-autonav-endscreen-is-premium",!!a.suggestion&&!!a.suggestion.Wz);g.N(a.G.getRootNode(),"ytp-autonav-endscreen-cancelled-state",!a.G.Qd());g.N(a.G.getRootNode(),"countdown-running",a.Jh());g.N(a.element,"ytp-player-content",a.G.Qd());g.vl(a.overlay.element,{width:b.width+"px"});if(!a.Jh()){a.G.Qd()?A5(a,Math.round(B5(a)/1E3)):A5(a);b=!!a.suggestion&&!!a.suggestion.Tt;var c=a.G.Qd()||!b;g.N(a.element,"ytp-autonav-endscreen-upnext-alternative-header-only",
  !c&&b);g.N(a.element,"ytp-autonav-endscreen-upnext-no-alternative-header",c&&!b);g.$K(a.u,a.G.Qd())}},y5=function(a){var b=B5(a),c=Math,d=c.min;
  var e=a.l?Date.now()-a.l:0;c=d.call(c,e,b);A5(a,Math.ceil((b-c)/1E3));500>=b-c&&a.Jh()?a.select(!0):a.Jh()&&a.B.start()},B5=function(a){var b=a.G.jp();
  return 0<=b?b:g.KE(a.G.T().experiments,"autoplay_time")||1E4},A5=function(a,b){b=void 0===b?-1:b;
  a=a.i.Da("ytp-autonav-endscreen-upnext-header");g.sg(a);if(0<=b){b=String(b);var c="Up next in $SECONDS".match(/\$SECONDS/gi)[0],d="Up next in $SECONDS".indexOf(c);if(0<=d){a.appendChild(g.rg("Up next in $SECONDS".slice(0,d)));var e=g.qg("span");g.Kq(e,"ytp-autonav-endscreen-upnext-header-countdown-number");g.xg(e,b);a.appendChild(e);a.appendChild(g.rg("Up next in $SECONDS".slice(d+c.length)));return}}g.xg(a,"Up next")},D5=function(a,b){g.V.call(this,{D:"div",
  Ea:["html5-endscreen","ytp-player-content",b||"base-endscreen"]});this.created=!1;this.player=a},F5=function(a){g.V.call(this,{D:"div",
  Ea:["ytp-upnext","ytp-player-content"],V:{"aria-label":"{{aria_label}}"},S:[{D:"div",K:"ytp-cued-thumbnail-overlay-image",V:{style:"{{background}}"}},{D:"span",K:"ytp-upnext-top",S:[{D:"span",K:"ytp-upnext-header",ra:"Up Next"},{D:"span",K:"ytp-upnext-title",ra:"{{title}}"},{D:"span",K:"ytp-upnext-author",ra:"{{author}}"}]},{D:"a",K:"ytp-upnext-autoplay-icon",V:{role:"button",href:"{{url}}","aria-label":"Play next video"},S:[{D:"svg",V:{height:"100%",version:"1.1",viewBox:"0 0 72 72",width:"100%"},
  S:[{D:"circle",K:"ytp-svg-autoplay-circle",V:{cx:"36",cy:"36",fill:"#fff","fill-opacity":"0.3",r:"31.5"}},{D:"circle",K:"ytp-svg-autoplay-ring",V:{cx:"-36",cy:"36","fill-opacity":"0",r:"33.5",stroke:"#FFFFFF","stroke-dasharray":"211","stroke-dashoffset":"-211","stroke-width":"4",transform:"rotate(-90)"}},{D:"path",K:"ytp-svg-fill",V:{d:"M 24,48 41,36 24,24 V 48 z M 44,24 v 24 h 4 V 24 h -4 z"}}]}]},{D:"span",K:"ytp-upnext-bottom",S:[{D:"span",K:"ytp-upnext-cancel"},{D:"span",K:"ytp-upnext-paused",
  ra:"Auto-play is paused"}]}]});this.api=a;this.cancelButton=null;this.C=this.Da("ytp-svg-autoplay-ring");this.u=this.notification=this.i=this.suggestion=null;this.B=new g.K(this.sx,5E3,this);this.l=0;var b=this.Da("ytp-upnext-cancel");this.cancelButton=new g.V({D:"button",Ea:["ytp-upnext-cancel-button","ytp-button"],V:{tabindex:"0","aria-label":"Cancel autoplay"},ra:"Cancel"});g.J(this,this.cancelButton);this.cancelButton.Ra("click",this.CO,this);this.cancelButton.Ba(b);this.cancelButton&&this.api.Zb(this.cancelButton.element,
  this,115129);g.J(this,this.B);this.api.Zb(this.element,this,18788);b=this.Da("ytp-upnext-autoplay-icon");this.N(b,"click",this.DO);this.api.Zb(b,this,115130);this.DG();this.N(a,"autonavvisibility",this.DG);this.N(a,"mdxnowautoplaying",this.vT);this.N(a,"mdxautoplaycanceled",this.wT);this.N(a,"mdxautoplayupnext",this.MM);E5(this)&&(a=(a=g.SM(this.api.sb()))?a.AQ():null)&&this.MM(a);g.N(this.element,"ytp-upnext-mobile",this.api.T().i)},E5=function(a){return 3===a.api.getPresentingPlayerType()},GPa=
  function(a,b){return b?b:0<=a.api.jp()?a.api.jp():g.KE(a.api.T().experiments,"autoplay_time")||1E4},G5=function(a,b){b=GPa(a,b);
  var c=Math,d=c.min;var e=(0,g.P)()-a.l;c=d.call(c,e,b);b=0===b?1:Math.min(c/b,1);a.C.setAttribute("stroke-dashoffset",""+-211*(b+1));1<=b&&a.Jh()&&!E5(a)?a.select(!0):a.Jh()&&a.i.start()},H5=function(a){D5.call(this,a,"autonav-endscreen");
  this.overlay=this.videoData=this.suggestions=null;this.table=new g.V({D:"div",K:"ytp-suggestion-panel",S:[{D:"div",Ea:["ytp-autonav-endscreen-upnext-header","ytp-autonav-endscreen-more-videos"],ra:"More videos"}]});this.J=new g.V({D:"div",K:"ytp-suggestions-container"});this.videos=[];this.u=null;this.C=this.I=!1;this.l=new z5(this.player);g.J(this,this.l);this.l.Ba(this.element);a.getVideoData().ac?this.i=this.l:(this.i=new F5(a),g.WM(this.player,this.i.element,4),g.J(this,this.i));this.overlay=
  new g.V({D:"div",K:"ytp-autonav-overlay-cancelled-state"});g.J(this,this.overlay);this.overlay.Ba(this.element);this.B=new g.ZM(this);g.J(this,this.B);g.J(this,this.table);this.table.Ba(this.element);this.table.show();g.J(this,this.J);this.J.Ba(this.table.element);this.hide()},HPa=function(a,b){return g.Pe(b.suggestions,function(c){c=g.xP(a.player.T(),c);
  g.J(a,c);return c})},I5=function(a){var b=a.Qd();
  b!==a.C&&(a.C=b,a.player.Y("autonavvisibility"),a.C?(a.l!==a.i&&a.l.hide(),a.table.hide()):(a.l!==a.i&&a.l.show(),a.table.show()))},J5=function(a){D5.call(this,a,"subscribecard-endscreen");
  this.i=new g.V({D:"div",K:"ytp-subscribe-card",S:[{D:"img",K:"ytp-author-image",V:{src:"{{profilePicture}}"}},{D:"div",K:"ytp-subscribe-card-right",S:[{D:"div",K:"ytp-author-name",ra:"{{author}}"},{D:"div",K:"html5-subscribe-button-container"}]}]});g.J(this,this.i);this.i.Ba(this.element);var b=a.getVideoData();this.subscribeButton=new g.lO("Subscribe",null,"Unsubscribe",null,!0,!1,b.Ti,b.subscribed,"trailer-endscreen",null,null,a);g.J(this,this.subscribeButton);this.subscribeButton.Ba(this.i.Da("html5-subscribe-button-container"));
  this.N(a,"videodatachange",this.Na);this.Na();this.hide()},K5=function(a){var b=a.T(),c=g.bj||g.nF?{style:"will-change: opacity"}:void 0,d=b.l,e=["ytp-videowall-still"];
  b.i&&e.push("ytp-videowall-show-text");g.V.call(this,{D:"a",Ea:e,V:{href:"{{url}}",target:d?b.I:"","aria-label":"{{aria_label}}","data-is-live":"{{is_live}}","data-is-list":"{{is_list}}","data-is-mix":"{{is_mix}}"},S:[{D:"div",K:"ytp-videowall-still-image",V:{style:"{{background}}"}},{D:"span",K:"ytp-videowall-still-info",S:[{D:"span",K:"ytp-videowall-still-info-bg",S:[{D:"span",K:"ytp-videowall-still-info-content",V:c,S:[{D:"span",K:"ytp-videowall-still-info-title",ra:"{{title}}"},{D:"span",K:"ytp-videowall-still-info-author",
  ra:"{{author_and_views}}"},{D:"span",K:"ytp-videowall-still-info-live",ra:"Live"},{D:"span",K:"ytp-videowall-still-info-duration",ra:"{{duration}}"}]}]}]},{D:"span",Ea:["ytp-videowall-still-listlabel-regular","ytp-videowall-still-listlabel"],S:[{D:"span",K:"ytp-videowall-still-listlabel-icon"},"Playlist",{D:"span",K:"ytp-videowall-still-listlabel-length",S:[" (",{D:"span",ra:"{{playlist_length}}"},")"]}]},{D:"span",Ea:["ytp-videowall-still-listlabel-mix","ytp-videowall-still-listlabel"],S:[{D:"span",
  K:"ytp-videowall-still-listlabel-mix-icon"},"Mix",{D:"span",K:"ytp-videowall-still-listlabel-length",ra:" (50+)"}]}]});this.suggestion=null;this.l=d;this.api=a;this.i=new g.ZM(this);g.J(this,this.i);this.Ra("click",this.onClick);this.Ra("keypress",this.u);this.i.N(a,"videodatachange",this.ob);a.Og(this.element,this);this.ob()},L5=function(a){D5.call(this,a,"videowall-endscreen");
  var b=this;this.G=a;this.u=0;this.stills=[];this.B=this.videoData=this.suggestions=null;this.C=this.J=!1;this.L=null;this.l=new g.ZM(this);g.J(this,this.l);this.I=new g.K(function(){g.M(b.element,"ytp-show-tiles")},0);
  g.J(this,this.I);var c=new g.V({D:"button",Ea:["ytp-button","ytp-endscreen-previous"],V:{"aria-label":"Previous"},S:[g.eL()]});g.J(this,c);c.Ba(this.element);c.Ra("click",this.HO,this);this.table=new g.XK({D:"div",K:"ytp-endscreen-content"});g.J(this,this.table);this.table.Ba(this.element);c=new g.V({D:"button",Ea:["ytp-button","ytp-endscreen-next"],V:{"aria-label":"Next"},S:[g.fL()]});g.J(this,c);c.Ba(this.element);c.Ra("click",this.GO,this);a.getVideoData().ac?this.i=new z5(a,!0):this.i=new F5(a);
  g.J(this,this.i);g.WM(this.player,this.i.element,4);this.hide()},M5=function(a){return g.XM(a.player)&&a.St()&&!a.B},IPa=function(a,b){return g.Pe(b.suggestions,function(c){c=g.xP(a.G.T(),c);
  g.J(a,c);return c})},N5=function(a){var b=a.Qd();
  b!==a.J&&(a.J=b,a.player.Y("autonavvisibility"))},O5=function(a){g.gN.call(this,a);
  var b=this;this.endScreen=null;this.i=this.l=this.u=!1;this.listeners=new g.ZM(this);g.J(this,this.listeners);this.env=a.T();JPa(a)?(this.u=!0,KPa(this),this.i?this.endScreen=new H5(a):this.endScreen=new L5(this.player)):this.env.Pc?this.endScreen=new J5(this.player):this.endScreen=new D5(this.player);g.J(this,this.endScreen);g.WM(this.player,this.endScreen.element,4);LPa(this);this.listeners.N(a,"videodatachange",this.ob,this);this.listeners.N(a,g.iA("endscreen"),function(c){b.Bd(c)});
  this.listeners.N(a,g.jA("endscreen"),function(c){b.qf(c)})},KPa=function(a){var b=a.player.getVideoData();
  if(!b||a.i===b.wi&&a.l===b.ac)return!1;a.i=b.wi;a.l=b.ac;return!0},JPa=function(a){a=a.T();
  return a.Ab&&!a.Pc},LPa=function(a){a.player.We("endscreen");
  var b=a.player.getVideoData();b=new g.fA(Math.max(1E3*(b.lengthSeconds-10),0),0x8000000000000,{id:"preload",namespace:"endscreen"});var c=new g.fA(0x8000000000000,0x8000000000000,{id:"load",priority:6,namespace:"endscreen"});a.player.Hd([b,c])};
  g.PM.prototype.jp=g.ca(2,function(){return this.app.jp()});
  g.PX.prototype.jp=g.ca(1,function(){return this.getVideoData().zH});
  g.w(x5,g.V);x5.prototype.select=function(){(this.G.Kj(this.suggestion.ib().videoId,this.suggestion.Xd,this.suggestion.getPlaylistId(),void 0,void 0,this.suggestion.vC||void 0)||this.G.X("web_player_endscreen_double_log_fix_killswitch"))&&this.G.Hb(this.element)};
  x5.prototype.onClick=function(a){g.FN(a,this.G,this.i,this.suggestion.Xd||void 0)&&this.select()};
  x5.prototype.l=function(a){switch(a.keyCode){case 13:case 32:g.ru(a)||(this.select(),g.qu(a))}};g.w(z5,g.V);g.k=z5.prototype;g.k.Et=function(a){this.suggestion!==a&&(this.suggestion=a,w5(this.i,a),this.playButton.Sa("url",this.suggestion.qn()),C5(this))};
  g.k.Jh=function(){return 0<this.l};
  g.k.Ks=function(){this.Jh()||(this.l=Date.now(),y5(this),FPa(this.G,B5(this)),g.N(this.G.getRootNode(),"countdown-running",this.Jh()))};
  g.k.Wp=function(){this.nm();y5(this);var a=this.i.Da("ytp-autonav-endscreen-upnext-header");a&&g.xg(a,"Up next")};
  g.k.nm=function(){this.Jh()&&(this.B.stop(),this.l=0)};
  g.k.select=function(a){this.G.nextVideo(!1,void 0===a?!1:a);this.nm()};
  g.k.CG=function(a){g.FN(a,this.G)&&(a.currentTarget===this.playButton.element?this.G.Hb(this.playButton.element):a.currentTarget===this.i.Da("ytp-autonav-endscreen-link-container")&&(a=this.i.Da("ytp-autonav-endscreen-link-container"),this.G.jb(a,!0),this.G.Hb(a)),this.select())};
  g.k.BO=function(){this.G.Hb(this.cancelButton.element);g.RM(this.G,!0)};
  g.k.BG=function(){var a=this.G.Qd();this.C&&this.yb!==a&&g.$K(this,a);C5(this);this.G.jb(this.element,a);this.G.jb(this.cancelButton.element,a);this.G.jb(this.i.Da("ytp-autonav-endscreen-link-container"),a);this.G.jb(this.playButton.element,a)};
  g.k.lf=function(a){return 400>a.width||459>a.height};g.w(D5,g.V);g.k=D5.prototype;g.k.create=function(){this.created=!0};
  g.k.destroy=function(){this.created=!1};
  g.k.St=function(){return!1};
  g.k.Qd=function(){return!1};
  g.k.LJ=function(){return!1};g.w(F5,g.V);g.k=F5.prototype;g.k.sx=function(){this.notification&&(this.B.stop(),this.jc(this.u),this.u=null,this.notification.close(),this.notification=null)};
  g.k.Et=function(a){this.suggestion=a;w5(this,a,"hqdefault.jpg")};
  g.k.DG=function(){g.$K(this,this.api.Qd());this.api.jb(this.element,this.api.Qd());this.api.jb(this.Da("ytp-upnext-autoplay-icon"),this.api.Qd());this.cancelButton&&this.api.jb(this.cancelButton.element,this.api.Qd())};
  g.k.FT=function(){window.focus();this.sx()};
  g.k.Ks=function(a){var b=this;this.Jh()||(g.Vu("a11y-announce","Up Next "+this.suggestion.title),this.l=(0,g.P)(),this.i=new g.K(function(){G5(b,a)},25),G5(this,a),FPa(this.api,GPa(this,a)));
  g.Nq(this.element,"ytp-upnext-autoplay-paused")};
  g.k.hide=function(){g.V.prototype.hide.call(this)};
  g.k.Jh=function(){return!!this.i};
  g.k.Wp=function(){this.nm();this.l=(0,g.P)();G5(this);g.M(this.element,"ytp-upnext-autoplay-paused")};
  g.k.nm=function(){this.Jh()&&(this.i.dispose(),this.i=null)};
  g.k.select=function(a){a=void 0===a?!1:a;if(g.T(this.api.T().experiments,"autonav_notifications")&&a&&window.Notification&&document.hasFocus){var b=Notification.permission;"default"===b?Notification.requestPermission():"granted"!==b||document.hasFocus()||(b=this.suggestion.ib(),this.sx(),this.notification=new Notification("Up Next",{body:b.title,icon:b.Ue()}),this.u=this.N(this.notification,"click",this.FT),this.B.start())}this.nm();this.api.nextVideo(!1,a)};
  g.k.DO=function(a){!g.wg(this.cancelButton.element,g.mu(a))&&g.FN(a,this.api)&&(this.api.Qd()&&this.api.Hb(this.Da("ytp-upnext-autoplay-icon")),this.select())};
  g.k.CO=function(){this.api.Qd()&&this.cancelButton&&this.api.Hb(this.cancelButton.element);g.RM(this.api,!0)};
  g.k.vT=function(a){E5(this);this.show();this.Ks(a)};
  g.k.MM=function(a){E5(this);this.suggestion&&this.suggestion.ib().videoId===a.ib().videoId||this.Et(a)};
  g.k.wT=function(){E5(this);this.nm();this.hide()};
  g.k.va=function(){this.nm();this.sx();g.V.prototype.va.call(this)};g.w(H5,D5);g.k=H5.prototype;g.k.create=function(){D5.prototype.create.call(this);this.B.N(this.player,"appresize",this.Dt);this.B.N(this.player,"onVideoAreaChange",this.Dt);this.B.N(this.player,"videodatachange",this.ob);this.B.N(this.player,"autonavchange",this.EG);this.B.N(this.player,"autonavcancel",this.EO);this.ob()};
  g.k.show=function(){D5.prototype.show.call(this);(this.I||this.u&&this.u!==this.videoData.clientPlaybackNonce)&&g.RM(this.player,!1);g.XM(this.player)&&this.St()&&!this.u?(I5(this),2===this.videoData.autonavState?this.player.T().X("fast_autonav_in_background")&&3===this.player.getVisibilityState()?this.i.select(!0):this.i.Ks():3===this.videoData.autonavState&&this.i.Wp()):(g.RM(this.player,!0),I5(this));this.Dt()};
  g.k.hide=function(){D5.prototype.hide.call(this);this.i.Wp();I5(this)};
  g.k.Dt=function(){var a=this.player.hj(!0,this.player.isFullscreen());I5(this);C5(this.l);g.N(this.element,"ytp-autonav-cancelled-small-mode",this.lf(a));g.N(this.element,"ytp-autonav-cancelled-tiny-mode",this.By(a));g.N(this.element,"ytp-autonav-cancelled-mini-mode",400>=a.width||360>=a.height);this.overlay&&g.vl(this.overlay.element,{width:a.width+"px"});if(!this.C){a=g.r(this.videos.entries());for(var b=a.next();!b.done;b=a.next()){var c=g.r(b.value);b=c.next().value;c=c.next().value;g.N(c.element,
  "ytp-suggestion-card-with-margin",1===b%2)}}};
  g.k.ob=function(){var a=this.player.getVideoData();if(this.videoData!==a&&a){this.videoData=a;if((this.suggestions=HPa(this,a))&&this.suggestions.length)for(this.i.Et(this.suggestions[0]),this.i!==this.l&&this.l.Et(this.suggestions[0]),a=0;a<MPa.length;++a){var b=MPa[a];if(this.suggestions&&this.suggestions[b]){this.videos[a]=new x5(this.player);var c=this.videos[a];b=this.suggestions[b];c.suggestion!==b&&(c.suggestion=b,w5(c,b));g.J(this,this.videos[a]);this.videos[a].Ba(this.J.element)}}this.Dt()}};
  g.k.EG=function(a){1===a?(this.I=!1,this.u=this.videoData.clientPlaybackNonce,this.i.nm(),this.yb&&this.Dt()):(this.I=!0,this.Qd()&&(2===a?this.i.Ks():3===a&&this.i.Wp()))};
  g.k.EO=function(a){a?this.EG(1):(this.u=null,this.I=!1)};
  g.k.St=function(){return 1!==this.videoData.autonavState};
  g.k.lf=function(a){return(910>a.width||459>a.height)&&!this.By(a)&&!(400>=a.width||360>=a.height)};
  g.k.By=function(a){return 800>a.width&&!(400>=a.width||360>=a.height)};
  g.k.Qd=function(){return this.yb&&g.XM(this.player)&&this.St()&&!this.u};
  var MPa=[1,3,2,4];g.w(J5,D5);J5.prototype.Na=function(){var a=this.player.getVideoData();this.i.update({profilePicture:a.Nh,author:a.author});this.subscribeButton.channelId=a.Ti;var b=this.subscribeButton;a.subscribed?b.l():b.u()};g.w(K5,g.V);K5.prototype.select=function(){(this.api.Kj(this.suggestion.ib().videoId,this.suggestion.Xd,this.suggestion.getPlaylistId(),void 0,void 0,this.suggestion.vC||void 0)||this.api.X("web_player_endscreen_double_log_fix_killswitch"))&&this.api.Hb(this.element)};
  K5.prototype.onClick=function(a){g.FN(a,this.api,this.l,this.suggestion.Xd||void 0)&&this.select()};
  K5.prototype.u=function(a){switch(a.keyCode){case 13:case 32:g.ru(a)||(this.select(),g.qu(a))}};
  K5.prototype.ob=function(){var a=this.api.getVideoData(),b=this.api.T();this.l=a.C?!1:b.l};g.w(L5,D5);g.k=L5.prototype;g.k.create=function(){D5.prototype.create.call(this);var a=this.player.getVideoData();a&&(this.suggestions=IPa(this,a),this.videoData=a);this.al();this.l.N(this.player,"appresize",this.al);this.l.N(this.player,"onVideoAreaChange",this.al);this.l.N(this.player,"videodatachange",this.ob);this.l.N(this.player,"autonavchange",this.hB);this.l.N(this.player,"autonavcancel",this.FO);a=this.videoData.autonavState;a!==this.L&&this.hB(a);this.l.N(this.element,"transitionend",this.XU)};
  g.k.destroy=function(){g.Mx(this.l);g.hf(this.stills);this.stills=[];this.suggestions=null;D5.prototype.destroy.call(this);g.Nq(this.element,"ytp-show-tiles");this.I.stop();this.L=this.videoData.autonavState};
  g.k.St=function(){return 1!==this.videoData.autonavState};
  g.k.show=function(){D5.prototype.show.call(this);g.Nq(this.element,"ytp-show-tiles");this.player.T().i?g.Gq(this.I):this.I.start();(this.C||this.B&&this.B!==this.videoData.clientPlaybackNonce)&&g.RM(this.player,!1);M5(this)?(N5(this),2===this.videoData.autonavState?this.player.T().X("fast_autonav_in_background")&&3===this.player.getVisibilityState()?this.i.select(!0):this.i.Ks():3===this.videoData.autonavState&&this.i.Wp()):(g.RM(this.player,!0),N5(this))};
  g.k.hide=function(){D5.prototype.hide.call(this);this.i.Wp();N5(this)};
  g.k.XU=function(a){g.mu(a)===this.element&&this.al()};
  g.k.al=function(){if(this.suggestions&&this.suggestions.length){g.M(this.element,"ytp-endscreen-paginate");var a=this.G.hj(!0,this.G.isFullscreen()),b=g.MM(this.G);b&&(b=b.Ne()?48:32,a.width-=2*b);var c=a.width/a.height,d=96/54,e=b=2,f=Math.max(a.width/96,2),h=Math.max(a.height/54,2),l=this.suggestions.length,m=Math.pow(2,2);var n=l*m+(Math.pow(2,2)-m);n+=Math.pow(2,2)-m;for(n-=m;0<n&&(b<f||e<h);){var p=b/2,q=e/2,t=b<=f-2&&n>=q*m,u=e<=h-2&&n>=p*m;if((p+1)/q*d/c>c/(p/(q+1)*d)&&u)n-=p*m,e+=2;else if(t)n-=
  q*m,b+=2;else if(u)n-=p*m,e+=2;else break}d=!1;n>=3*m&&6>=l*m-n&&(4<=e||4<=b)&&(d=!0);m=96*b;n=54*e;c=m/n<c?a.height/n:a.width/m;c=Math.min(c,2);m=Math.floor(Math.min(a.width,m*c));n=Math.floor(Math.min(a.height,n*c));a=this.table.element;g.Jl(a,m,n);g.vl(a,{marginLeft:m/-2+"px",marginTop:n/-2+"px"});this.i.Et(this.suggestions[0]);this.i instanceof z5&&C5(this.i);g.N(this.element,"ytp-endscreen-takeover",M5(this));N5(this);m+=4;n+=4;for(f=c=0;f<b;f++)for(h=0;h<e;h++)if(p=c,q=0,d&&f>=b-2&&h>=e-2?q=
  1:0===h%2&&0===f%2&&(2>h&&2>f?0===h&&0===f&&(q=2):q=2),p=g.Pf(p+this.u,l),0!==q){t=this.stills[c];t||(t=new K5(this.player),this.stills[c]=t,a.appendChild(t.element));u=Math.floor(n*h/e);var x=Math.floor(m*f/b),y=Math.floor(n*(h+q)/e)-u-4,B=Math.floor(m*(f+q)/b)-x-4;g.Cl(t.element,x,u);g.Jl(t.element,B,y);g.vl(t.element,"transitionDelay",(h+f)/20+"s");g.N(t.element,"ytp-videowall-still-mini",1===q);g.N(t.element,"ytp-videowall-still-large",2<q);q=t;p=this.suggestions[p];q.suggestion!==p&&(q.suggestion=
  p,t=q.api.T(),u=g.Lq(q.element,"ytp-videowall-still-large")?"hqdefault.jpg":"mqdefault.jpg",w5(q,p,u),g.pF(t)&&(t=p.qn(),t=g.ti(t,g.EM("emb_rel_end")),q.Sa("url",t)),(p=(p=p.Xd)&&p.itct)&&q.api.lm(q.element,p));c++}g.N(this.element,"ytp-endscreen-paginate",c<l);for(b=this.stills.length-1;b>=c;b--)e=this.stills[b],g.ug(e.element),g.ef(e);this.stills.length=c}};
  g.k.ob=function(){var a=this.player.getVideoData();this.videoData!==a&&(this.u=0,this.suggestions=IPa(this,a),this.videoData=a,this.al())};
  g.k.GO=function(){this.u+=this.stills.length;this.al()};
  g.k.HO=function(){this.u-=this.stills.length;this.al()};
  g.k.LJ=function(){return this.i.Jh()};
  g.k.hB=function(a){1===a?(this.C=!1,this.B=this.videoData.clientPlaybackNonce,this.i.nm(),this.yb&&this.al()):(this.C=!0,this.yb&&M5(this)&&(2===a?this.i.Ks():3===a&&this.i.Wp()))};
  g.k.FO=function(a){if(a){for(a=0;a<this.stills.length;a++)this.G.jb(this.stills[a].element,!0);this.hB(1)}else this.B=null,this.C=!1;this.al()};
  g.k.Qd=function(){return this.yb&&M5(this)};g.w(O5,g.gN);g.k=O5.prototype;g.k.kq=function(){var a=this.player.getVideoData(),b=!!(a&&a.suggestions&&a.suggestions.length);b=!JPa(this.player)||b;var c=a.Ce||g.AF(a.B),d=this.player.Fu();a=a.mutedAutoplay;return b&&!c&&!d&&!a};
  g.k.Qd=function(){return this.endScreen.Qd()};
  g.k.mR=function(){return this.Qd()?this.endScreen.LJ():!1};
  g.k.va=function(){this.player.We("endscreen");g.gN.prototype.va.call(this)};
  g.k.load=function(){var a=this.player.getVideoData();var b=a.yH;if(b&&b.videoId){var c=this.player.sb().td.get("heartbeat");a&&a.suggestions&&a.suggestions.length&&b.videoId===a.suggestions[0].id&&!a.aG?a=!1:(this.player.Kj(b.videoId,void 0,void 0,!0,!0,b),c&&c.Ly("HEARTBEAT_ACTION_TRIGGER_AT_STREAM_END","HEARTBEAT_ACTION_TRANSITION_REASON_HAS_NEW_STREAM_TRANSITION_ENDPOINT"),a=!0)}else a=!1;a||(g.gN.prototype.load.call(this),this.endScreen.show())};
  g.k.unload=function(){g.gN.prototype.unload.call(this);this.endScreen.hide();this.endScreen.destroy()};
  g.k.Bd=function(a){this.kq()&&(this.endScreen.created||this.endScreen.create(),"load"===a.getId()&&this.load())};
  g.k.qf=function(a){"load"===a.getId()&&this.loaded&&this.unload()};
  g.k.ob=function(){LPa(this);this.u&&KPa(this)&&(this.endScreen&&(this.endScreen.hide(),this.endScreen.created&&this.endScreen.destroy(),this.endScreen.dispose()),this.i?this.endScreen=new H5(this.player):this.endScreen=new L5(this.player),g.J(this,this.endScreen),g.WM(this.player,this.endScreen.element,4))};g.rN.endscreen=O5;})(_yt_player);
  