(function(g){var window=this;'use strict';var sib=function(a,b){a.ib("onAutonavCoundownStarted",b)},i5=function(a,b,c){g.Xo(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.lP&&(b.lengthText?(e=b.lengthText||null,f=b.Mx||null):b.lengthSeconds&&(e=g.oy(b.lengthSeconds),f=g.oy(b.lengthSeconds,!0)));var h=!!d;d=h&&g.jP(d).type==="RD";var l=b instanceof g.lP?b.isLivePlayback:null,m=b instanceof g.lP?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.YC("Watch $TITLE",{TITLE:b.title}),duration:e,timestamp:f,url:b.Fl(),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.Dt};b instanceof g.kP&&(c.playlist_length=b.playlistLength);a.update(c)},j5=function(a){var b=a.U(),c=b.D; g.U.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.U.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.U({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.U({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.TU);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.U({I:"div",S:"ytp-autonav-overlay"});g.P(this,this.overlay);this.overlay.Ja(this.container.element);this.B=new g.U({I:"div",S:"ytp-autonav-endscreen-button-container"});g.P(this,this.B);this.B.Ja(this.container.element); this.cancelButton=new g.U({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.J4,this);this.J.createClientVe(this.cancelButton.element,this,115129);this.playButton=new g.U({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.TU,this);this.J.L("web_player_autonav_next_button_renderer")?(this.J.createServerVe(this.playButton.element,this.playButton,!0),(b=this.J.getVideoData())&&tib(this,b)):this.J.createClientVe(this.playButton.element,this,115130);this.D=new g.Lo(function(){uib(c)}, 500); g.P(this,this.D);this.SU();this.T(a,"autonavvisibility",this.SU);this.J.L("web_autonav_color_transition")&&(this.T(a,"autonavchange",this.I4),this.T(a,"onAutonavCoundownStarted",this.taa))},l5=function(a){var b=a.J.ao(!0,a.J.isFullscreen()); g.Xo(a.container.element,"ytp-autonav-endscreen-small-mode",a.Pg(b));g.Xo(a.container.element,"ytp-autonav-endscreen-is-premium",!!a.suggestion&&!!a.suggestion.GM);g.Xo(a.J.getRootNode(),"ytp-autonav-endscreen-cancelled-state",!a.J.Ef());g.Xo(a.J.getRootNode(),"countdown-running",a.Jl());g.Xo(a.container.element,"ytp-player-content",a.J.Ef());g.Vl(a.overlay.element,{width:b.width+"px"});if(!a.Jl()){a.J.Ef()?vib(a,Math.round(wib(a)/1E3)):vib(a);b=!!a.suggestion&&!!a.suggestion.Dt;var c=a.J.Ef()||!b; g.Xo(a.container.element,"ytp-autonav-endscreen-upnext-alternative-header-only",!c&&b);g.Xo(a.container.element,"ytp-autonav-endscreen-upnext-no-alternative-header",c&&!b);g.dx(a.B,a.J.Ef());g.Xo(a.element,"ytp-enable-w2w-color-transitions",xib(a))}},uib=function(a){var b=wib(a),c=Math,d=c.min; var e=a.C?Date.now()-a.C:0;c=d.call(c,e,b);vib(a,Math.ceil((b-c)/1E3));b-c<=500&&a.Jl()?a.select(!0):a.Jl()&&a.D.start()},wib=function(a){if(a.J.isFullscreen()){var b; a=(b=a.J.getVideoData())==null?void 0:b.ED;return a===-1||a===void 0?8E3:a}return a.J.Ut()>=0?a.J.Ut():g.VB(a.J.U().experiments,"autoplay_time")||1E4},tib=function(a,b){a.J.L("web_player_autonav_next_button_renderer"); b=b.i4;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)},xib=function(a){var b; return!((b=a.J.getVideoData())==null||!b.watchToWatchTransitionRenderer)},vib=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.ie("Up next in $SECONDS".slice(0,d)));var e=g.he("span");g.Ro(e,"ytp-autonav-endscreen-upnext-header-countdown-number");g.qe(e,b);a.appendChild(e);a.appendChild(g.ie("Up next in $SECONDS".slice(d+c.length)));return}}g.qe(a,"Up next")},m5=function(a,b){g.U.call(this,{I:"div", Na:["html5-endscreen","ytp-player-content",b||"base-endscreen"]});this.created=!1;this.player=a},n5=function(a){g.U.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.Lo(this.oJ,5E3,this);this.B=0;var b=this.Ea("ytp-upnext-cancel");this.cancelButton=new g.U({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.K4,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.L4);this.api.createClientVe(b,this,115130);this.UU();this.T(a,"autonavvisibility",this.UU);this.T(a,"mdxnowautoplaying",this.fba);this.T(a,"mdxautoplaycanceled",this.hba);g.Xo(this.element,"ytp-upnext-mobile",this.api.U().B)},yib=function(a,b){if(b)return b; if(a.api.isFullscreen()){var c;a=(c=a.api.getVideoData())==null?void 0:c.ED;return a===-1||a===void 0?8E3:a}return a.api.Ut()>=0?a.api.Ut():g.VB(a.api.U().experiments,"autoplay_time")||1E4},zib=function(a,b){b=yib(a,b); var c=Math,d=c.min;var e=(0,g.T)()-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.Jl()&&a.api.getPresentingPlayerType()!==3?a.select(!0):a.Jl()&&a.j.start()},o5=function(a){m5.call(this,a,"autonav-endscreen"); this.overlay=this.videoData=null;this.table=new g.U({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.U({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().Tf?this.j=this.B:(this.j=new n5(a),g.oR(this.player,this.j.element,4),g.P(this,this.j));this.overlay=new g.U({I:"div", S:"ytp-autonav-overlay-cancelled-state"});g.P(this,this.overlay);this.overlay.Ja(this.element);this.D=new g.iE(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.Ef(); 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.U.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.To(this.element,"ytp-continue-watching-button");this.listen("click",this.onClick);this.listen("videodatachange",this.n2);g.dx(this,!0)},r5=function(a,b){m5.call(this,a,"embeds-lite-endscreen"); this.J=a;this.Oe=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()},Aib=function(a){m5.call(this,a,"subscribecard-endscreen"); this.j=new g.U({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.SU("Subscribe",null,"Unsubscribe",null,!0,!1,b.Xl,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.eE||g.oO?{style:"will-change: opacity"}:void 0,d=b.D,e=["ytp-videowall-still"]; b.B&&e.push("ytp-videowall-show-text");g.U.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.iE(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.iE(this);g.P(this,this.B);this.K=new g.Lo(function(){g.To(b.element,"ytp-show-tiles")},0); g.P(this,this.K);var c=new g.U({I:"button",Na:["ytp-button","ytp-endscreen-previous"],X:{"aria-label":"Previous"},V:[g.kx()]});g.P(this,c);c.Ja(this.element);c.listen("click",this.P4,this);this.table=new g.ax({I:"div",S:"ytp-endscreen-content"});g.P(this,this.table);this.table.Ja(this.element);c=new g.U({I:"button",Na:["ytp-button","ytp-endscreen-next"],X:{"aria-label":"Next"},V:[g.lx()]});g.P(this,c);c.Ja(this.element);c.listen("click",this.O4,this);a.getVideoData().Tf?this.j=new k5(a,!0):this.j= new n5(a);g.P(this,this.j);g.oR(this.player,this.j.element,4);a.createClientVe(this.element,this,158789);this.hide()},u5=function(a){return g.pR(a.player)&&a.mE()&&!a.D},v5=function(a){var b=a.Ef(); 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.m8a(a)&&(this.j=new g.a1(a),g.P(this,this.j),this.B=new g.U({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()},Eib=function(a){g.ST.call(this,a); var b=this;this.endScreen=null;this.B=this.j=this.C=this.D=!1;this.listeners=new g.iE(this);g.P(this,this.listeners);var c=a.U(),d=a.getVideoData();d=d&&d.limitedPlaybackDurationInSeconds!==0;g.Xr(g.zO(c))&&d&&!g.kR(a)?(this.B=!0,this.endScreen=new r5(a,g.WQ(a))):a.jd()?this.endScreen=new w5(a):Bib(a)?(this.D=!0,Cib(this),this.j?this.endScreen=new o5(a):this.endScreen=new t5(a)):c.Jg?this.endScreen=new Aib(a):this.endScreen=new m5(a);g.P(this,this.endScreen);g.oR(a,this.endScreen.element,4);Dib(this); this.listeners.T(a,"videodatachange",this.onVideoDataChange,this);this.listeners.T(a,g.NC("endscreen"),function(e){b.onCueRangeEnter(e)}); this.listeners.T(a,g.OC("endscreen"),function(e){b.onCueRangeExit(e)})},Cib=function(a){var b=a.player.getVideoData(); if(!b||a.j===b.hm&&a.C===b.Tf)return!1;a.j=b.hm;a.C=b.Tf;return!0},Bib=function(a){a=a.U(); return a.Ed&&!a.Jg},Dib=function(a){a.player.sf("endscreen"); var b=a.player.getVideoData();b=new g.LC(Math.max((b.lengthSeconds-10)*1E3,0),0x8000000000000,{id:"preload",namespace:"endscreen"});var c=new g.LC(0x8000000000000,0x8000000000000,{id:"load",priority:8,namespace:"endscreen"});a.player.mf([b,c])}; g.gR.prototype.Ut=g.da(14,function(){return this.app.Ut()}); g.E_.prototype.Ut=g.da(13,function(){return this.getVideoData().PZ}); g.cR.prototype.Ms=g.da(12,function(a){this.Ki().Ms(a)}); g.gV.prototype.Ms=g.da(11,function(a){this.j!==a&&(this.j=a,this.Ta())}); g.mW.prototype.Ms=g.da(10,function(a){this.overflowButton&&this.overflowButton.Ms(a)}); g.cR.prototype.Ns=g.da(9,function(a){this.Ki().Ns(a)}); g.lV.prototype.Ns=g.da(8,function(a){this.j!==a&&(this.j=a,this.Ta())}); g.mW.prototype.Ns=g.da(7,function(a){this.shareButton&&this.shareButton.Ns(a)}); g.cR.prototype.rC=g.da(6,function(a){this.Ki().rC(a)}); g.LU.prototype.rC=g.da(5,function(a){this.BS!==a&&(this.BS=a,this.Wq())}); g.cR.prototype.qC=g.da(4,function(a){this.Ki().qC(a)}); g.mW.prototype.qC=g.da(3,function(a){this.AS!==a&&(this.AS=a,this.Vq())});g.z(j5,g.U);j5.prototype.select=function(){this.J.tp(this.suggestion.videoId,this.suggestion.sessionData,this.suggestion.playlistId,void 0,void 0,this.suggestion.RE||void 0)&&this.J.logClick(this.element)}; j5.prototype.onClick=function(a){g.iS(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.U);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.Fl()),l5(this))}; g.k.Jl=function(){return this.C>0}; g.k.zC=function(){this.Jl()||(this.C=Date.now(),uib(this),sib(this.J,wib(this)),g.Xo(this.J.getRootNode(),"countdown-running",this.Jl()))}; g.k.wy=function(){this.Pq();uib(this);var a=this.j.Ea("ytp-autonav-endscreen-upnext-header");a&&g.qe(a,"Up next")}; g.k.Pq=function(){this.Jl()&&(this.D.stop(),this.C=0)}; g.k.select=function(a){this.J.nextVideo(!1,a===void 0?!1:a);this.Pq()}; g.k.TU=function(a){g.iS(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.Pq()):this.select())}; g.k.J4=function(){this.J.logClick(this.cancelButton.element);g.iR(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")&&tib(this,b);var c;this.cancelCommand=(c=b.yfa)==null?void 0:c.command}; g.k.taa=function(a){if(xib(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.Ay(c.surgeColor));d.style.setProperty("--w2w-start-primary-text-color",g.Ay(c.primaryTitleColor));d.style.setProperty("--w2w-start-secondary-text-color",g.Ay(c.secondaryTitleColor));d.style.setProperty("--w2w-end-background-color",g.Ay(b.surgeColor)); d.style.setProperty("--w2w-end-primary-text-color",g.Ay(b.primaryTitleColor));d.style.setProperty("--w2w-end-secondary-text-color",g.Ay(b.secondaryTitleColor));d.style.setProperty("--w2w-animation-duration",a+"ms")}g.Xo(this.element,"ytp-w2w-animate",!0)}}; g.k.I4=function(a){this.J.L("web_autonav_color_transition")&&a!==2&&g.Xo(this.element,"ytp-w2w-animate",!1)}; g.k.SU=function(){var a=this.J.Ef();this.K&&this.Gb!==a&&g.dx(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.U);g.k=m5.prototype;g.k.create=function(){this.created=!0}; g.k.destroy=function(){this.created=!1}; g.k.mE=function(){return!1}; g.k.Ef=function(){return!1}; g.k.OZ=function(){return!1};g.z(n5,g.U);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.UU=function(){g.dx(this,this.api.Ef());this.api.logVisibility(this.element,this.api.Ef());this.api.logVisibility(this.Ea("ytp-upnext-autoplay-icon"),this.api.Ef());this.cancelButton&&this.api.logVisibility(this.cancelButton.element,this.api.Ef())}; g.k.qba=function(){window.focus();this.oJ()}; g.k.zC=function(a){var b=this;this.Jl()||(g.av("a11y-announce","Up Next "+this.suggestion.title),this.B=(0,g.T)(),this.j=new g.Lo(function(){zib(b,a)},25),zib(this,a),sib(this.api,yib(this,a))); g.Vo(this.element,"ytp-upnext-autoplay-paused")}; g.k.hide=function(){g.U.prototype.hide.call(this)}; g.k.Jl=function(){return!!this.j}; g.k.wy=function(){this.Pq();this.B=(0,g.T)();zib(this);g.To(this.element,"ytp-upnext-autoplay-paused")}; g.k.Pq=function(){this.Jl()&&(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.qba),this.D.start())}this.Pq();this.api.nextVideo(!1,a)}; g.k.L4=function(a){!g.pe(this.cancelButton.element,a.target)&&g.iS(a,this.api)&&(this.api.Ef()&&this.api.logClick(this.Ea("ytp-upnext-autoplay-icon")),this.select())}; g.k.K4=function(){this.api.Ef()&&this.cancelButton&&this.api.logClick(this.cancelButton.element);g.iR(this.api,!0)}; g.k.fba=function(a){this.api.getPresentingPlayerType();this.show();this.zC(a)}; g.k.hba=function(){this.api.getPresentingPlayerType();this.Pq();this.hide()}; g.k.xa=function(){this.Pq();this.oJ();g.U.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.lD);this.D.T(this.player,"onVideoAreaChange",this.lD);this.D.T(this.player,"videodatachange",this.onVideoDataChange);this.D.T(this.player,"autonavchange",this.VU);this.D.T(this.player,"onAutonavCancelled",this.M4);this.onVideoDataChange()}; g.k.show=function(){m5.prototype.show.call(this);(this.K||this.C&&this.C!==this.videoData.clientPlaybackNonce)&&g.iR(this.player,!1);g.pR(this.player)&&this.mE()&&!this.C?(p5(this),this.videoData.autonavState===2?this.player.getVisibilityState()===3?this.j.select(!0):this.j.zC():this.videoData.autonavState===3&&this.j.wy()):(g.iR(this.player,!0),p5(this));this.lD()}; g.k.hide=function(){m5.prototype.hide.call(this);this.j.wy();p5(this)}; g.k.lD=function(){var a=this.player.ao(!0,this.player.isFullscreen());p5(this);l5(this.B);g.Xo(this.element,"ytp-autonav-cancelled-small-mode",this.Pg(a));g.Xo(this.element,"ytp-autonav-cancelled-tiny-mode",this.MK(a));g.Xo(this.element,"ytp-autonav-cancelled-mini-mode",a.width<=400||a.height<=360);this.overlay&&g.Vl(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.Cd(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.bm(r.element,y,u);g.fm(r.element,D,A);g.Vl(r.element,"transitionDelay", (m+l)/20+"s");g.Xo(r.element,"ytp-videowall-still-mini",t===1);g.Xo(r.element,"ytp-videowall-still-large",t>2);t=Math.max(D,A);g.Xo(r.element,"ytp-videowall-still-round-large",t>=256);g.Xo(r.element,"ytp-videowall-still-round-medium",t>96&&t<256);g.Xo(r.element,"ytp-videowall-still-round-small",t<=96);q=e[q];r.suggestion!==q&&(r.suggestion=q,t=r.api.U(),u=g.So(r.element,"ytp-videowall-still-large")?"hqdefault.jpg":"mqdefault.jpg",i5(r,q,u),g.qO(t)&&!r.api.L("web_player_log_click_before_generating_ve_conversion_params")&& (t=q.Fl(),u={},g.RQ(r.api,"addEmbedsConversionTrackingParams",[u]),r.api.L("embeds_web_enable_referring_feature_deprecation")||g.HK(u,"emb_rel_end"),t=g.Hi(t,u),r.updateValue("url",t)),(q=(q=q.sessionData)&&q.itct)&&r.api.setTrackingParams(r.element,q));h++}f.ariaBusy="false";g.Xo(this.element,"ytp-endscreen-paginate",h=h;e--)a=this.stills[e],g.oe(a.element),g.gb(a);this.stills.length=h}}; g.k.onVideoDataChange=function(){var a=this.player.getVideoData(1);this.videoData!==a&&(a!=null&&g.WP(a)?(this.C=0,this.videoData=a,this.ir()):this.player.oa("missg",{vid:(a==null?void 0:a.videoId)||"",cpn:(a==null?void 0:a.clientPlaybackNonce)||""}))}; g.k.O4=function(){this.C+=this.stills.length;this.ir()}; g.k.P4=function(){this.C-=this.stills.length;this.ir()}; g.k.OZ=function(){return this.j.Jl()}; g.k.nN=function(a){a===1?(this.G=!1,this.D=this.videoData.clientPlaybackNonce,this.j.Pq(),this.Gb&&this.ir()):(this.G=!0,this.Gb&&u5(this)&&(a===2?this.j.zC():a===3&&this.j.wy()))}; g.k.N4=function(a){if(a){for(a=0;a0;g.Xo(this.element,"ytp-shorts-branded-ui",b);b?a.show():a.hide()}var c;(c=g.WQ(this.player))==null||c.rC(!0);this.player.logVisibility(this.element,!0);this.watchButton.Mc(!0)}}; w5.prototype.hide=function(){m5.prototype.hide.call(this);var a;(a=g.WQ(this.player))==null||a.rC(!1);this.player.logVisibility(this.element,!1);this.watchButton.Mc(!1)};g.z(Eib,g.ST);g.k=Eib.prototype;g.k.xv=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.WP(a))||(a==null?0:(c=a.suggestions)==null?0:c.length));d=!Bib(this.player)||d;a=a.Oj;c=this.player.dF();return d&&!a&&!c&&!b}; g.k.Ef=function(){return this.endScreen.Ef()}; g.k.h$=function(){return this.Ef()?this.endScreen.OZ():!1}; g.k.xa=function(){this.player.sf("endscreen");g.ST.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().Ie.get("heartbeat"),d=g.WP(a);!d||b.videoId!==d.videoId||a.pW?(this.player.tp(b.videoId,void 0,void 0,!0,!0,b),c&&c.VK("HEARTBEAT_ACTION_TRIGGER_AT_STREAM_END","HEARTBEAT_ACTION_TRANSITION_REASON_HAS_NEW_STREAM_TRANSITION_ENDPOINT"),a=!0):a=!1}else a=!1;a||(g.ST.prototype.load.call(this),this.endScreen.show())}; g.k.unload=function(){g.ST.prototype.unload.call(this);this.endScreen.hide();this.endScreen.destroy()}; g.k.onCueRangeEnter=function(a){this.xv()&&(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(){Dib(this);this.D&&Cib(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.oR(this.player,this.endScreen.element,4))};g.RT("endscreen",Eib);})(_yt_player);