(function(g){var window=this;'use strict';var Gib=function(a,b){a.ib("onAutonavCoundownStarted",b)},i5=function(a,b,c){g.vp(a.element,"ytp-suggestion-set",!!b.videoId); var d=b.playlistId;c=b.hh(c?c:"mqdefault.jpg");var e=null,f=null;b instanceof g.JP&&(b.lengthText?(e=b.lengthText||null,f=b.Nx||null):b.lengthSeconds&&(e=g.ez(b.lengthSeconds),f=g.ez(b.lengthSeconds,!0)));var h=!!d;d=h&&g.HP(d).type==="RD";var l=b instanceof g.JP?b.isLivePlayback:null,m=b instanceof g.JP?b.isUpcoming:null,n=b.author,p=b.shortViewCount,q=b.publishedTimeText,r=[],t=[];n&&r.push(n);p&&(r.push(p),t.push(p));q&&t.push(q);c={title:b.title,author:n,author_and_views:r.join(" \u2022 "),aria_label:b.ariaLabel|| g.JD("Watch $TITLE",{TITLE:b.title}),duration:e,timestamp:f,url:b.Gl(),is_live:l,is_upcoming:m,is_list:h,is_mix:d,background:c?"background-image: url("+c+")":"",views_and_publish_time:t.join(" \u2022 "),autoplayAlternativeHeader:b.Ft};b instanceof g.IP&&(c.playlist_length=b.playlistLength);a.update(c)},j5=function(a){var b=a.U(),c=b.D; g.T.call(this,{I:"a",S:"ytp-autonav-suggestion-card",X:{href:"{{url}}",target:c?b.Y:"","aria-label":"{{aria_label}}","data-is-live":"{{is_live}}","data-is-list":"{{is_list}}","data-is-mix":"{{is_mix}}","data-is-upcoming":"{{is_upcoming}}"},V:[{I:"div",Na:["ytp-autonav-endscreen-upnext-thumbnail","ytp-autonav-thumbnail-small"],X:{style:"{{background}}"},V:[{I:"div",X:{"aria-label":"{{timestamp}}"},Na:["ytp-autonav-timestamp"],va:"{{duration}}"},{I:"div",Na:["ytp-autonav-live-stamp"],va:"Live"},{I:"div", Na:["ytp-autonav-upcoming-stamp"],va:"Upcoming"},{I:"div",S:"ytp-autonav-list-overlay",V:[{I:"div",S:"ytp-autonav-mix-text",va:"Mix"},{I:"div",S:"ytp-autonav-mix-icon"}]}]},{I:"div",Na:["ytp-autonav-endscreen-upnext-title","ytp-autonav-title-card"],va:"{{title}}"},{I:"div",Na:["ytp-autonav-endscreen-upnext-author","ytp-autonav-author-card"],va:"{{author}}"},{I:"div",Na:["ytp-autonav-endscreen-upnext-author","ytp-autonav-view-and-date-card"],va:"{{views_and_publish_time}}"}]});this.J=a;this.suggestion= null;this.j=c;this.listen("click",this.onClick);this.listen("keypress",this.onKeyPress)},k5=function(a,b){b=b===void 0?!1:b; g.T.call(this,{I:"div",S:"ytp-autonav-endscreen-countdown-overlay"});var c=this;this.K=b;this.cancelCommand=this.G=void 0;this.C=0;this.container=new g.T({I:"div",S:"ytp-autonav-endscreen-countdown-container"});g.P(this,this.container);this.container.Ja(this.element);b=a.U();var d=b.D;this.J=a;this.suggestion=null;this.onVideoDataChange("newdata",this.J.getVideoData());this.T(a,"videodatachange",this.onVideoDataChange);this.j=new g.T({I:"div",S:"ytp-autonav-endscreen-upnext-container",X:{"aria-label":"{{aria_label}}", "data-is-live":"{{is_live}}","data-is-list":"{{is_list}}","data-is-mix":"{{is_mix}}","data-is-upcoming":"{{is_upcoming}}"},V:[{I:"div",S:"ytp-autonav-endscreen-upnext-header"},{I:"div",S:"ytp-autonav-endscreen-upnext-alternative-header",va:"{{autoplayAlternativeHeader}}"},{I:"a",S:"ytp-autonav-endscreen-link-container",X:{href:"{{url}}",target:d?b.Y:""},V:[{I:"div",S:"ytp-autonav-endscreen-upnext-thumbnail",X:{style:"{{background}}"},V:[{I:"div",X:{"aria-label":"{{timestamp}}"},Na:["ytp-autonav-timestamp"], va:"{{duration}}"},{I:"div",Na:["ytp-autonav-live-stamp"],va:"Live"},{I:"div",Na:["ytp-autonav-upcoming-stamp"],va:"Upcoming"}]},{I:"div",S:"ytp-autonav-endscreen-video-info",V:[{I:"div",S:"ytp-autonav-endscreen-premium-badge"},{I:"div",S:"ytp-autonav-endscreen-upnext-title",va:"{{title}}"},{I:"div",S:"ytp-autonav-endscreen-upnext-author",va:"{{author}}"},{I:"div",S:"ytp-autonav-view-and-date",va:"{{views_and_publish_time}}"},{I:"div",S:"ytp-autonav-author-and-view",va:"{{author_and_views}}"}]}]}]}); g.P(this,this.j);this.j.Ja(this.container.element);d||this.T(this.j.Ea("ytp-autonav-endscreen-link-container"),"click",this.VU);this.J.createClientVe(this.container.element,this,115127);this.J.createClientVe(this.j.Ea("ytp-autonav-endscreen-link-container"),this,115128);this.overlay=new g.T({I:"div",S:"ytp-autonav-overlay"});g.P(this,this.overlay);this.overlay.Ja(this.container.element);this.B=new g.T({I:"div",S:"ytp-autonav-endscreen-button-container"});g.P(this,this.B);this.B.Ja(this.container.element); this.cancelButton=new g.T({I:"button",Na:["ytp-autonav-endscreen-upnext-button","ytp-autonav-endscreen-upnext-cancel-button",b.L("web_modern_buttons")?"ytp-autonav-endscreen-upnext-button-rounded":""],X:{"aria-label":"Cancel autoplay"},va:"Cancel"});g.P(this,this.cancelButton);this.cancelButton.Ja(this.B.element);this.cancelButton.listen("click",this.I4,this);this.J.createClientVe(this.cancelButton.element,this,115129);this.playButton=new g.T({I:"a",Na:["ytp-autonav-endscreen-upnext-button","ytp-autonav-endscreen-upnext-play-button", b.L("web_modern_buttons")?"ytp-autonav-endscreen-upnext-button-rounded":""],X:{href:"{{url}}",role:"button","aria-label":"Play next video"},va:"Play Now"});g.P(this,this.playButton);this.playButton.Ja(this.B.element);this.playButton.listen("click",this.VU,this);this.J.L("web_player_autonav_next_button_renderer")?(this.J.createServerVe(this.playButton.element,this.playButton,!0),(b=this.J.getVideoData())&&Hib(this,b)):this.J.createClientVe(this.playButton.element,this,115130);this.D=new g.jp(function(){Iib(c)}, 500); g.P(this,this.D);this.UU();this.T(a,"autonavvisibility",this.UU);this.J.L("web_autonav_color_transition")&&(this.T(a,"autonavchange",this.H4),this.T(a,"onAutonavCoundownStarted",this.saa))},l5=function(a){var b=a.J.oo(!0,a.J.isFullscreen()); g.vp(a.container.element,"ytp-autonav-endscreen-small-mode",a.Pg(b));g.vp(a.container.element,"ytp-autonav-endscreen-is-premium",!!a.suggestion&&!!a.suggestion.HM);g.vp(a.J.getRootNode(),"ytp-autonav-endscreen-cancelled-state",!a.J.Df());g.vp(a.J.getRootNode(),"countdown-running",a.Kl());g.vp(a.container.element,"ytp-player-content",a.J.Df());g.nm(a.overlay.element,{width:b.width+"px"});if(!a.Kl()){a.J.Df()?Jib(a,Math.round(Kib(a)/1E3)):Jib(a);b=!!a.suggestion&&!!a.suggestion.Ft;var c=a.J.Df()||!b; g.vp(a.container.element,"ytp-autonav-endscreen-upnext-alternative-header-only",!c&&b);g.vp(a.container.element,"ytp-autonav-endscreen-upnext-no-alternative-header",c&&!b);g.Sx(a.B,a.J.Df());g.vp(a.element,"ytp-enable-w2w-color-transitions",Lib(a))}},Iib=function(a){var b=Kib(a),c=Math,d=c.min; var e=a.C?Date.now()-a.C:0;c=d.call(c,e,b);Jib(a,Math.ceil((b-c)/1E3));b-c<=500&&a.Kl()?a.select(!0):a.Kl()&&a.D.start()},Kib=function(a){if(a.J.isFullscreen()){var b; a=(b=a.J.getVideoData())==null?void 0:b.GD;return a===-1||a===void 0?8E3:a}return a.J.Wt()>=0?a.J.Wt():g.GC(a.J.U().experiments,"autoplay_time")||1E4},Hib=function(a,b){a.J.L("web_player_autonav_next_button_renderer"); b=b.xfa;a.G=b==null?void 0:b.navigationEndpoint;b=b==null?void 0:b.trackingParams;a.playButton&&b&&a.J.setTrackingParams(a.playButton.element,b)},Lib=function(a){var b; return!((b=a.J.getVideoData())==null||!b.watchToWatchTransitionRenderer)},Jib=function(a,b){b=b===void 0?-1:b; a=a.j.Ea("ytp-autonav-endscreen-upnext-header");g.me(a);if(b>=0){b=String(b);var c="Up next in $SECONDS".match(RegExp("\\$SECONDS","gi"))[0],d="Up next in $SECONDS".indexOf(c);if(d>=0){a.appendChild(g.ke("Up next in $SECONDS".slice(0,d)));var e=g.je("span");g.pp(e,"ytp-autonav-endscreen-upnext-header-countdown-number");g.se(e,b);a.appendChild(e);a.appendChild(g.ke("Up next in $SECONDS".slice(d+c.length)));return}}g.se(a,"Up next")},m5=function(a,b){g.T.call(this,{I:"div", Na:["html5-endscreen","ytp-player-content",b||"base-endscreen"]});this.created=!1;this.player=a},n5=function(a){g.T.call(this,{I:"div", Na:["ytp-upnext","ytp-player-content"],X:{"aria-label":"{{aria_label}}"},V:[{I:"div",S:"ytp-cued-thumbnail-overlay-image",X:{style:"{{background}}"}},{I:"span",S:"ytp-upnext-top",V:[{I:"span",S:"ytp-upnext-header",va:"Up Next"},{I:"span",S:"ytp-upnext-title",va:"{{title}}"},{I:"span",S:"ytp-upnext-author",va:"{{author}}"}]},{I:"a",S:"ytp-upnext-autoplay-icon",X:{role:"button",href:"{{url}}","aria-label":"Play next video"},V:[{I:"svg",X:{height:"100%",version:"1.1",viewBox:"0 0 72 72",width:"100%"}, V:[{I:"circle",S:"ytp-svg-autoplay-circle",X:{cx:"36",cy:"36",fill:"#fff","fill-opacity":"0.3",r:"31.5"}},{I:"circle",S:"ytp-svg-autoplay-ring",X:{cx:"-36",cy:"36","fill-opacity":"0",r:"33.5",stroke:"#FFFFFF","stroke-dasharray":"211","stroke-dashoffset":"-211","stroke-width":"4",transform:"rotate(-90)"}},{I:"path",S:"ytp-svg-fill",X:{d:"M 24,48 41,36 24,24 V 48 z M 44,24 v 24 h 4 V 24 h -4 z"}}]}]},{I:"span",S:"ytp-upnext-bottom",V:[{I:"span",S:"ytp-upnext-cancel"},{I:"span",S:"ytp-upnext-paused", va:"Autoplay is paused"}]}]});this.api=a;this.cancelButton=null;this.G=this.Ea("ytp-svg-autoplay-ring");this.C=this.notification=this.j=this.suggestion=null;this.D=new g.jp(this.oJ,5E3,this);this.B=0;var b=this.Ea("ytp-upnext-cancel");this.cancelButton=new g.T({I:"button",Na:["ytp-upnext-cancel-button","ytp-button"],X:{tabindex:"0","aria-label":"Cancel autoplay"},va:"Cancel"});g.P(this,this.cancelButton);this.cancelButton.listen("click",this.J4,this);this.cancelButton.Ja(b);this.cancelButton&&this.api.createClientVe(this.cancelButton.element, this,115129);g.P(this,this.D);this.api.createClientVe(this.element,this,18788);b=this.Ea("ytp-upnext-autoplay-icon");this.T(b,"click",this.K4);this.api.createClientVe(b,this,115130);this.WU();this.T(a,"autonavvisibility",this.WU);this.T(a,"mdxnowautoplaying",this.eba);this.T(a,"mdxautoplaycanceled",this.fba);g.vp(this.element,"ytp-upnext-mobile",this.api.U().B)},Mib=function(a,b){if(b)return b; if(a.api.isFullscreen()){var c;a=(c=a.api.getVideoData())==null?void 0:c.GD;return a===-1||a===void 0?8E3:a}return a.api.Wt()>=0?a.api.Wt():g.GC(a.api.U().experiments,"autoplay_time")||1E4},Nib=function(a,b){b=Mib(a,b); var c=Math,d=c.min;var e=(0,g.eu)()-a.B;c=d.call(c,e,b);b=b===0?1:Math.min(c/b,1);a.G.setAttribute("stroke-dashoffset",""+-211*(b+1));b>=1&&a.Kl()&&a.api.getPresentingPlayerType()!==3?a.select(!0):a.Kl()&&a.j.start()},o5=function(a){m5.call(this,a,"autonav-endscreen"); this.overlay=this.videoData=null;this.table=new g.T({I:"div",S:"ytp-suggestion-panel",V:[{I:"div",Na:["ytp-autonav-endscreen-upnext-header","ytp-autonav-endscreen-more-videos"],va:"More videos"}]});this.N=new g.T({I:"div",S:"ytp-suggestions-container"});this.videos=[];this.C=null;this.G=this.K=!1;this.B=new k5(this.player);g.P(this,this.B);this.B.Ja(this.element);a.getVideoData().Sf?this.j=this.B:(this.j=new n5(a),g.MR(this.player,this.j.element,4),g.P(this,this.j));this.overlay=new g.T({I:"div", S:"ytp-autonav-overlay-cancelled-state"});g.P(this,this.overlay);this.overlay.Ja(this.element);this.D=new g.UE(this);g.P(this,this.D);g.P(this,this.table);this.table.Ja(this.element);this.table.show();g.P(this,this.N);this.N.Ja(this.table.element);this.hide()},p5=function(a){var b=a.Df(); b!==a.G&&(a.G=b,a.player.publish("autonavvisibility"),a.G?(a.B!==a.j&&a.B.hide(),a.table.hide()):(a.B!==a.j&&a.B.show(),a.table.show()))},q5=function(a,b){g.T.call(this,{I:"button", Na:["ytp-watch-on-youtube-button","ytp-button"],va:"{{content}}"});this.J=a;this.buttonType=this.buttonType=b;this.n2();this.buttonType===2&&g.rp(this.element,"ytp-continue-watching-button");this.listen("click",this.onClick);this.listen("videodatachange",this.n2);g.Sx(this,!0)},r5=function(a,b){m5.call(this,a,"embeds-lite-endscreen"); this.J=a;this.Ne=b;this.J.createClientVe(this.element,this,156943);this.watchButton=new q5(a,2);g.P(this,this.watchButton);this.watchButton.Ja(this.element);this.hide()},Oib=function(a){m5.call(this,a,"subscribecard-endscreen"); this.j=new g.T({I:"div",S:"ytp-subscribe-card",V:[{I:"img",S:"ytp-author-image",X:{src:"{{profilePicture}}"}},{I:"div",S:"ytp-subscribe-card-right",V:[{I:"div",S:"ytp-author-name",va:"{{author}}"},{I:"div",S:"html5-subscribe-button-container"}]}]});g.P(this,this.j);this.j.Ja(this.element);var b=a.getVideoData();this.subscribeButton=new g.PU("Subscribe",null,"Unsubscribe",null,!0,!1,b.Yl,b.subscribed,"trailer-endscreen",null,a,!1);g.P(this,this.subscribeButton);this.subscribeButton.Ja(this.j.Ea("html5-subscribe-button-container")); this.T(a,"videodatachange",this.Ta);this.Ta();this.hide()},s5=function(a){var b=a.U(),c=g.QE||g.MO?{style:"will-change: opacity"}:void 0,d=b.D,e=["ytp-videowall-still"]; b.B&&e.push("ytp-videowall-show-text");g.T.call(this,{I:"a",Na:e,X:{href:"{{url}}",target:d?b.Y:"","aria-label":"{{aria_label}}","data-is-live":"{{is_live}}","data-is-list":"{{is_list}}","data-is-mix":"{{is_mix}}"},V:[{I:"div",S:"ytp-videowall-still-image",X:{style:"{{background}}"}},{I:"span",S:"ytp-videowall-still-info",X:{"aria-hidden":"true"},V:[{I:"span",S:"ytp-videowall-still-info-bg",V:[{I:"span",S:"ytp-videowall-still-info-content",X:c,V:[{I:"span",S:"ytp-videowall-still-info-title",va:"{{title}}"}, {I:"span",S:"ytp-videowall-still-info-author",va:"{{author_and_views}}"},{I:"span",S:"ytp-videowall-still-info-live",va:"Live"},{I:"span",S:"ytp-videowall-still-info-duration",va:"{{duration}}"}]}]}]},{I:"span",Na:["ytp-videowall-still-listlabel-regular","ytp-videowall-still-listlabel"],X:{"aria-hidden":"true"},V:[{I:"span",S:"ytp-videowall-still-listlabel-icon"},"Playlist",{I:"span",S:"ytp-videowall-still-listlabel-length",V:[" (",{I:"span",va:"{{playlist_length}}"},")"]}]},{I:"span",Na:["ytp-videowall-still-listlabel-mix", "ytp-videowall-still-listlabel"],X:{"aria-hidden":"true"},V:[{I:"span",S:"ytp-videowall-still-listlabel-mix-icon"},"Mix",{I:"span",S:"ytp-videowall-still-listlabel-length",va:" (50+)"}]}]});this.suggestion=null;this.B=d;this.api=a;this.j=new g.UE(this);g.P(this,this.j);this.listen("click",this.onClick);this.listen("keypress",this.onKeyPress);this.j.T(a,"videodatachange",this.onVideoDataChange);a.createServerVe(this.element,this);this.onVideoDataChange()},t5=function(a){m5.call(this,a,"videowall-endscreen"); var b=this;this.J=a;this.C=0;this.stills=[];this.D=this.videoData=null;this.G=this.N=!1;this.Y=null;this.B=new g.UE(this);g.P(this,this.B);this.K=new g.jp(function(){g.rp(b.element,"ytp-show-tiles")},0); g.P(this,this.K);var c=new g.T({I:"button",Na:["ytp-button","ytp-endscreen-previous"],X:{"aria-label":"Previous"},V:[g.Zx()]});g.P(this,c);c.Ja(this.element);c.listen("click",this.O4,this);this.table=new g.Px({I:"div",S:"ytp-endscreen-content"});g.P(this,this.table);this.table.Ja(this.element);c=new g.T({I:"button",Na:["ytp-button","ytp-endscreen-next"],X:{"aria-label":"Next"},V:[g.$x()]});g.P(this,c);c.Ja(this.element);c.listen("click",this.N4,this);a.getVideoData().Sf?this.j=new k5(a,!0):this.j= new n5(a);g.P(this,this.j);g.MR(this.player,this.j.element,4);a.createClientVe(this.element,this,158789);this.hide()},u5=function(a){return g.NR(a.player)&&a.lE()&&!a.D},v5=function(a){var b=a.Df(); b!==a.N&&(a.N=b,a.player.publish("autonavvisibility"))},w5=function(a){m5.call(this,a,"watch-again-on-youtube-endscreen"); this.watchButton=new q5(a,1);g.P(this,this.watchButton);this.watchButton.Ja(this.element);g.C8a(a)&&(this.j=new g.a1(a),g.P(this,this.j),this.B=new g.T({I:"div",Na:["ytp-watch-again-on-youtube-endscreen-more-videos-container"],X:{tabIndex:"-1"},V:[this.j]}),g.P(this,this.B),this.j.Ja(this.B.element),this.B.Ja(this.element));a.createClientVe(this.element,this,156914);this.hide()},Sib=function(a){g.XT.call(this,a); var b=this;this.endScreen=null;this.B=this.j=this.C=this.D=!1;this.listeners=new g.UE(this);g.P(this,this.listeners);var c=a.U(),d=a.getVideoData();d=d&&d.limitedPlaybackDurationInSeconds!==0;g.Ls(g.XO(c))&&d&&!g.IR(a)?(this.B=!0,this.endScreen=new r5(a,g.yR(a))):a.jd()?this.endScreen=new w5(a):Pib(a)?(this.D=!0,Qib(this),this.j?this.endScreen=new o5(a):this.endScreen=new t5(a)):c.Jg?this.endScreen=new Oib(a):this.endScreen=new m5(a);g.P(this,this.endScreen);g.MR(a,this.endScreen.element,4);Rib(this); this.listeners.T(a,"videodatachange",this.onVideoDataChange,this);this.listeners.T(a,g.yD("endscreen"),function(e){b.onCueRangeEnter(e)}); this.listeners.T(a,g.zD("endscreen"),function(e){b.onCueRangeExit(e)})},Qib=function(a){var b=a.player.getVideoData(); if(!b||a.j===b.im&&a.C===b.Sf)return!1;a.j=b.im;a.C=b.Sf;return!0},Pib=function(a){a=a.U(); return a.Ed&&!a.Jg},Rib=function(a){a.player.rf("endscreen"); var b=a.player.getVideoData();b=new g.wD(Math.max((b.lengthSeconds-10)*1E3,0),0x8000000000000,{id:"preload",namespace:"endscreen"});var c=new g.wD(0x8000000000000,0x8000000000000,{id:"load",priority:8,namespace:"endscreen"});a.player.lf([b,c])}; g.ER.prototype.Wt=g.ba(14,function(){return this.app.Wt()}); g.C_.prototype.Wt=g.ba(13,function(){return this.getVideoData().mZ}); g.AR.prototype.Os=g.ba(12,function(a){this.Ki().Os(a)}); g.dV.prototype.Os=g.ba(11,function(a){this.j!==a&&(this.j=a,this.Ta())}); g.kW.prototype.Os=g.ba(10,function(a){this.overflowButton&&this.overflowButton.Os(a)}); g.AR.prototype.Ps=g.ba(9,function(a){this.Ki().Ps(a)}); g.iV.prototype.Ps=g.ba(8,function(a){this.j!==a&&(this.j=a,this.Ta())}); g.kW.prototype.Ps=g.ba(7,function(a){this.shareButton&&this.shareButton.Ps(a)}); g.AR.prototype.tC=g.ba(6,function(a){this.Ki().tC(a)}); g.IU.prototype.tC=g.ba(5,function(a){this.DS!==a&&(this.DS=a,this.Yq())}); g.AR.prototype.sC=g.ba(4,function(a){this.Ki().sC(a)}); g.kW.prototype.sC=g.ba(3,function(a){this.CS!==a&&(this.CS=a,this.Xq())});g.z(j5,g.T);j5.prototype.select=function(){this.J.wp(this.suggestion.videoId,this.suggestion.sessionData,this.suggestion.playlistId,void 0,void 0,this.suggestion.QE||void 0)&&this.J.logClick(this.element)}; j5.prototype.onClick=function(a){g.DS(a,this.J,this.j,this.suggestion.sessionData||void 0)&&this.select()}; j5.prototype.onKeyPress=function(a){switch(a.keyCode){case 13:case 32:a.defaultPrevented||(this.select(),a.preventDefault())}};g.z(k5,g.T);g.k=k5.prototype;g.k.uI=function(a){this.suggestion!==a&&(this.suggestion=a,i5(this.j,a),this.playButton.updateValue("url",this.suggestion.Gl()),l5(this))}; g.k.Kl=function(){return this.C>0}; g.k.BC=function(){this.Kl()||(this.C=Date.now(),Iib(this),Gib(this.J,Kib(this)),g.vp(this.J.getRootNode(),"countdown-running",this.Kl()))}; g.k.yy=function(){this.Rq();Iib(this);var a=this.j.Ea("ytp-autonav-endscreen-upnext-header");a&&g.se(a,"Up next")}; g.k.Rq=function(){this.Kl()&&(this.D.stop(),this.C=0)}; g.k.select=function(a){this.J.nextVideo(!1,a===void 0?!1:a);this.Rq()}; g.k.VU=function(a){g.DS(a,this.J)&&(a.currentTarget===this.playButton.element?this.J.logClick(this.playButton.element):a.currentTarget===this.j.Ea("ytp-autonav-endscreen-link-container")&&(a=this.j.Ea("ytp-autonav-endscreen-link-container"),this.J.logVisibility(a,!0),this.J.logClick(a)),this.J.L("web_player_autonav_next_button_renderer")&&this.G?(this.J.ib("innertubeCommand",this.G),this.Rq()):this.select())}; g.k.I4=function(){this.J.logClick(this.cancelButton.element);g.GR(this.J,!0);this.cancelCommand&&this.J.ib("innertubeCommand",this.cancelCommand)}; g.k.onVideoDataChange=function(a,b){this.J.L("web_player_autonav_next_button_renderer")&&Hib(this,b);var c;this.cancelCommand=(c=b.wfa)==null?void 0:c.command}; g.k.saa=function(a){if(Lib(this)){var b=this.J.getVideoData().watchToWatchTransitionRenderer,c=b==null?void 0:b.fromColorPaletteDark;b=b==null?void 0:b.toColorPaletteDark;if(c&&b){var d=this.element;d.style.setProperty("--w2w-start-background-color",g.pz(c.surgeColor));d.style.setProperty("--w2w-start-primary-text-color",g.pz(c.primaryTitleColor));d.style.setProperty("--w2w-start-secondary-text-color",g.pz(c.secondaryTitleColor));d.style.setProperty("--w2w-end-background-color",g.pz(b.surgeColor)); d.style.setProperty("--w2w-end-primary-text-color",g.pz(b.primaryTitleColor));d.style.setProperty("--w2w-end-secondary-text-color",g.pz(b.secondaryTitleColor));d.style.setProperty("--w2w-animation-duration",a+"ms")}g.vp(this.element,"ytp-w2w-animate",!0)}}; g.k.H4=function(a){this.J.L("web_autonav_color_transition")&&a!==2&&g.vp(this.element,"ytp-w2w-animate",!1)}; g.k.UU=function(){var a=this.J.Df();this.K&&this.Hb!==a&&g.Sx(this,a);l5(this);this.J.logVisibility(this.container.element,a);this.J.logVisibility(this.cancelButton.element,a);this.J.logVisibility(this.j.Ea("ytp-autonav-endscreen-link-container"),a);this.J.logVisibility(this.playButton.element,a)}; g.k.Pg=function(a){return a.width<400||a.height<459};g.z(m5,g.T);g.k=m5.prototype;g.k.create=function(){this.created=!0}; g.k.destroy=function(){this.created=!1}; g.k.lE=function(){return!1}; g.k.Df=function(){return!1}; g.k.QZ=function(){return!1};g.z(n5,g.T);g.k=n5.prototype;g.k.oJ=function(){this.notification&&(this.D.stop(),this.Oc(this.C),this.C=null,this.notification.close(),this.notification=null)}; g.k.uI=function(a){this.suggestion=a;i5(this,a,"hqdefault.jpg")}; g.k.WU=function(){g.Sx(this,this.api.Df());this.api.logVisibility(this.element,this.api.Df());this.api.logVisibility(this.Ea("ytp-upnext-autoplay-icon"),this.api.Df());this.cancelButton&&this.api.logVisibility(this.cancelButton.element,this.api.Df())}; g.k.pba=function(){window.focus();this.oJ()}; g.k.BC=function(a){var b=this;this.Kl()||(g.Ov("a11y-announce","Up Next "+this.suggestion.title),this.B=(0,g.eu)(),this.j=new g.jp(function(){Nib(b,a)},25),Nib(this,a),Gib(this.api,Mib(this,a))); g.tp(this.element,"ytp-upnext-autoplay-paused")}; g.k.hide=function(){g.T.prototype.hide.call(this)}; g.k.Kl=function(){return!!this.j}; g.k.yy=function(){this.Rq();this.B=(0,g.eu)();Nib(this);g.rp(this.element,"ytp-upnext-autoplay-paused")}; g.k.Rq=function(){this.Kl()&&(this.j.dispose(),this.j=null)}; g.k.select=function(a){a=a===void 0?!1:a;if(this.api.U().L("autonav_notifications")&&a&&window.Notification&&typeof document.hasFocus==="function"){var b=Notification.permission;b==="default"?Notification.requestPermission():b!=="granted"||document.hasFocus()||(this.oJ(),this.notification=new Notification("Up Next",{body:this.suggestion.title,icon:this.suggestion.hh()}),this.C=this.T(this.notification,"click",this.pba),this.D.start())}this.Rq();this.api.nextVideo(!1,a)}; g.k.K4=function(a){!g.re(this.cancelButton.element,a.target)&&g.DS(a,this.api)&&(this.api.Df()&&this.api.logClick(this.Ea("ytp-upnext-autoplay-icon")),this.select())}; g.k.J4=function(){this.api.Df()&&this.cancelButton&&this.api.logClick(this.cancelButton.element);g.GR(this.api,!0)}; g.k.eba=function(a){this.api.getPresentingPlayerType();this.show();this.BC(a)}; g.k.fba=function(){this.api.getPresentingPlayerType();this.Rq();this.hide()}; g.k.xa=function(){this.Rq();this.oJ();g.T.prototype.xa.call(this)};g.z(o5,m5);g.k=o5.prototype;g.k.create=function(){m5.prototype.create.call(this);this.D.T(this.player,"appresize",this.nD);this.D.T(this.player,"onVideoAreaChange",this.nD);this.D.T(this.player,"videodatachange",this.onVideoDataChange);this.D.T(this.player,"autonavchange",this.XU);this.D.T(this.player,"onAutonavCancelled",this.L4);this.onVideoDataChange()}; g.k.show=function(){m5.prototype.show.call(this);(this.K||this.C&&this.C!==this.videoData.clientPlaybackNonce)&&g.GR(this.player,!1);g.NR(this.player)&&this.lE()&&!this.C?(p5(this),this.videoData.autonavState===2?this.player.getVisibilityState()===3?this.j.select(!0):this.j.BC():this.videoData.autonavState===3&&this.j.yy()):(g.GR(this.player,!0),p5(this));this.nD()}; g.k.hide=function(){m5.prototype.hide.call(this);this.j.yy();p5(this)}; g.k.nD=function(){var a=this.player.oo(!0,this.player.isFullscreen());p5(this);l5(this.B);g.vp(this.element,"ytp-autonav-cancelled-small-mode",this.Pg(a));g.vp(this.element,"ytp-autonav-cancelled-tiny-mode",this.NK(a));g.vp(this.element,"ytp-autonav-cancelled-mini-mode",a.width<=400||a.height<=360);this.overlay&&g.nm(this.overlay.element,{width:a.width+"px"});if(!this.G)for(a=0;a0&&(a=r*n,u=b<=m-2&&p>=q*n;if((q+1)/r*d/h>h/(q/(r+1)*d)&&u)p-=q*n,b+=2;else if(t)p-=r*n,a+=2;else if(u)p-=q*n,b+=2;else break}d=!1;p>=3*n&&c*n-p<=6&&(b>=4||a>=4)&&(d=!0);n=a*96;p=b*54;h=n/p=a-2&&m>=b-2?t=1:m%2===0&&l%2===0&&(m<2&&l<2?m===0&&l===0&&(t=2):t=2),q=g.Ed(q+this.C,c),t!==0){r=this.stills[h];r||(r=new s5(this.player),this.stills[h]=r,f.appendChild(r.element));u=Math.floor(p*m/b);var y=Math.floor(n*l/a),A=Math.floor(p*(m+t)/b)-u-4,D=Math.floor(n*(l+t)/a)-y-4;g.um(r.element,y,u);g.Dm(r.element,D,A);g.nm(r.element,"transitionDelay", (m+l)/20+"s");g.vp(r.element,"ytp-videowall-still-mini",t===1);g.vp(r.element,"ytp-videowall-still-large",t>2);t=Math.max(D,A);g.vp(r.element,"ytp-videowall-still-round-large",t>=256);g.vp(r.element,"ytp-videowall-still-round-medium",t>96&&t<256);g.vp(r.element,"ytp-videowall-still-round-small",t<=96);q=e[q];r.suggestion!==q&&(r.suggestion=q,t=r.api.U(),u=g.qp(r.element,"ytp-videowall-still-large")?"hqdefault.jpg":"mqdefault.jpg",i5(r,q,u),g.OO(t)&&!r.api.L("web_player_log_click_before_generating_ve_conversion_params")&& (t=q.Gl(),u={},g.oR(r.api,"addEmbedsConversionTrackingParams",[u]),r.api.L("embeds_web_enable_referring_feature_deprecation")||g.eL(u,"emb_rel_end"),t=g.Wi(t,u),r.updateValue("url",t)),(q=(q=q.sessionData)&&q.itct)&&r.api.setTrackingParams(r.element,q));h++}f.ariaBusy="false";g.vp(this.element,"ytp-endscreen-paginate",h=h;e--)a=this.stills[e],g.pe(a.element),g.fb(a);this.stills.length=h}}; g.k.onVideoDataChange=function(){var a=this.player.getVideoData(1);this.videoData!==a&&(a!=null&&g.tQ(a)?(this.C=0,this.videoData=a,this.lr()):this.player.oa("missg",{vid:(a==null?void 0:a.videoId)||"",cpn:(a==null?void 0:a.clientPlaybackNonce)||""}))}; g.k.N4=function(){this.C+=this.stills.length;this.lr()}; g.k.O4=function(){this.C-=this.stills.length;this.lr()}; g.k.QZ=function(){return this.j.Kl()}; g.k.oN=function(a){a===1?(this.G=!1,this.D=this.videoData.clientPlaybackNonce,this.j.Rq(),this.Hb&&this.lr()):(this.G=!0,this.Hb&&u5(this)&&(a===2?this.j.BC():a===3&&this.j.yy()))}; g.k.M4=function(a){if(a){for(a=0;a0;g.vp(this.element,"ytp-shorts-branded-ui",b);b?a.show():a.hide()}var c;(c=g.yR(this.player))==null||c.tC(!0);this.player.logVisibility(this.element,!0);this.watchButton.Mc(!0)}}; w5.prototype.hide=function(){m5.prototype.hide.call(this);var a;(a=g.yR(this.player))==null||a.tC(!1);this.player.logVisibility(this.element,!1);this.watchButton.Mc(!1)};g.z(Sib,g.XT);g.k=Sib.prototype;g.k.Av=function(){var a=this.player.getVideoData(),b=a.mutedAutoplay;if((this.player.jd()||this.B)&&!b)return!0;var c;var d=!!((a==null?0:g.tQ(a))||(a==null?0:(c=a.suggestions)==null?0:c.length));d=!Pib(this.player)||d;a=a.Oj;c=this.player.cF();return d&&!a&&!c&&!b}; g.k.Df=function(){return this.endScreen.Df()}; g.k.f$=function(){return this.Df()?this.endScreen.QZ():!1}; g.k.xa=function(){this.player.rf("endscreen");g.XT.prototype.xa.call(this)}; g.k.load=function(){var a=this.player.getVideoData();var b=a.transitionEndpointAtEndOfStream;if(b&&b.videoId){var c=this.player.Bb().He.get("heartbeat"),d=g.tQ(a);!d||b.videoId!==d.videoId||a.qW?(this.player.wp(b.videoId,void 0,void 0,!0,!0,b),c&&c.WK("HEARTBEAT_ACTION_TRIGGER_AT_STREAM_END","HEARTBEAT_ACTION_TRANSITION_REASON_HAS_NEW_STREAM_TRANSITION_ENDPOINT"),a=!0):a=!1}else a=!1;a||(g.XT.prototype.load.call(this),this.endScreen.show())}; g.k.unload=function(){g.XT.prototype.unload.call(this);this.endScreen.hide();this.endScreen.destroy()}; g.k.onCueRangeEnter=function(a){this.Av()&&(this.endScreen.created||this.endScreen.create(),a.getId()==="load"&&this.load())}; g.k.onCueRangeExit=function(a){a.getId()==="load"&&this.loaded&&this.unload()}; g.k.onVideoDataChange=function(){Rib(this);this.D&&Qib(this)&&(this.endScreen&&(this.endScreen.hide(),this.endScreen.created&&this.endScreen.destroy(),this.endScreen.dispose()),this.j?this.endScreen=new o5(this.player):this.endScreen=new t5(this.player),g.P(this,this.endScreen),g.MR(this.player,this.endScreen.element,4))};g.WT("endscreen",Sib);})(_yt_player);