(function(g){var window=this;'use strict';var rVu=function(X){X.publish("autonavvisibility")},v48=function(X,J){X.GH("onAutonavCoundownStarted",J)},jiI=function(X){var J,L,x; return X==null?void 0:(J=X.playerOverlays)==null?void 0:(L=J.playerOverlayRenderer)==null?void 0:(x=L.autoplay)==null?void 0:x.playerOverlayAutoplayRenderer},qm=function(X){var J=X.G(),L=J.T; g.R.call(this,{V:"a",U:"ytp-autonav-suggestion-card",X:{href:"{{url}}",target:L?J.D:"","aria-label":"{{aria_label}}","data-is-live":"{{is_live}}","data-is-list":"{{is_list}}","data-is-mix":"{{is_mix}}","data-is-upcoming":"{{is_upcoming}}"},C:[{V:"div",Ql:["ytp-autonav-endscreen-upnext-thumbnail","ytp-autonav-thumbnail-small"],X:{style:"{{background}}"},C:[{V:"div",X:{"aria-label":"{{timestamp}}"},Ql:["ytp-autonav-timestamp"],iB:"{{duration}}"},{V:"div",Ql:["ytp-autonav-live-stamp"],iB:"Live"},{V:"div", Ql:["ytp-autonav-upcoming-stamp"],iB:"Upcoming"},{V:"div",U:"ytp-autonav-list-overlay",C:[{V:"div",U:"ytp-autonav-mix-text",iB:"Mix"},{V:"div",U:"ytp-autonav-mix-icon"}]}]},{V:"div",Ql:["ytp-autonav-endscreen-upnext-title","ytp-autonav-title-card"],iB:"{{title}}"},{V:"div",Ql:["ytp-autonav-endscreen-upnext-author","ytp-autonav-author-card"],iB:"{{author}}"},{V:"div",Ql:["ytp-autonav-endscreen-upnext-author","ytp-autonav-view-and-date-card"],iB:"{{views_and_publish_time}}"}]});this.Z=X;this.suggestion= null;this.L=L;this.listen("click",this.onClick);this.listen("keypress",this.onKeyPress)},II=function(X,J){J=J===void 0?!1:J; g.R.call(this,{V:"div",U:"ytp-autonav-endscreen-countdown-overlay"});var L=this;this.W=J;this.cancelCommand=this.B=void 0;this.N=0;this.container=new g.R({V:"div",U:"ytp-autonav-endscreen-countdown-container"});g.f(this,this.container);this.container.zH(this.element);J=X.G();var x=J.T;this.Z=X;this.suggestion=null;this.onVideoDataChange("newdata",this.Z.getVideoData());this.J(X,"videodatachange",this.onVideoDataChange);this.L=new g.R({V:"div",U:"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}}"},C:[{V:"div",U:"ytp-autonav-endscreen-upnext-header"},{V:"div",U:"ytp-autonav-endscreen-upnext-alternative-header",iB:"{{autoplayAlternativeHeader}}"},{V:"a",U:"ytp-autonav-endscreen-link-container",X:{href:"{{url}}",target:x?J.D:""},C:[{V:"div",U:"ytp-autonav-endscreen-upnext-thumbnail",X:{style:"{{background}}"},C:[{V:"div",X:{"aria-label":"{{timestamp}}"},Ql:["ytp-autonav-timestamp"], iB:"{{duration}}"},{V:"div",Ql:["ytp-autonav-live-stamp"],iB:"Live"},{V:"div",Ql:["ytp-autonav-upcoming-stamp"],iB:"Upcoming"}]},{V:"div",U:"ytp-autonav-endscreen-video-info",C:[{V:"div",U:"ytp-autonav-endscreen-premium-badge"},{V:"div",U:"ytp-autonav-endscreen-upnext-title",iB:"{{title}}"},{V:"div",U:"ytp-autonav-endscreen-upnext-author",iB:"{{author}}"},{V:"div",U:"ytp-autonav-view-and-date",iB:"{{views_and_publish_time}}"},{V:"div",U:"ytp-autonav-author-and-view",iB:"{{author_and_views}}"}]}]}]}); g.f(this,this.L);this.L.zH(this.container.element);x||this.J(this.L.kq("ytp-autonav-endscreen-link-container"),"click",this.WG);this.Z.createClientVe(this.container.element,this,115127);this.Z.createClientVe(this.L.kq("ytp-autonav-endscreen-link-container"),this,115128);this.overlay=new g.R({V:"div",U:"ytp-autonav-overlay"});g.f(this,this.overlay);this.overlay.zH(this.container.element);this.K=new g.R({V:"div",U:"ytp-autonav-endscreen-button-container"});g.f(this,this.K);this.K.zH(this.container.element); this.cancelButton=new g.R({V:"button",Ql:["ytp-autonav-endscreen-upnext-button","ytp-autonav-endscreen-upnext-cancel-button",J.Y("web_modern_buttons")?"ytp-autonav-endscreen-upnext-button-rounded":""],X:{"aria-label":"Cancel autoplay"},iB:"Cancel"});g.f(this,this.cancelButton);this.cancelButton.zH(this.K.element);this.cancelButton.listen("click",this.Kf,this);this.Z.createClientVe(this.cancelButton.element,this,115129);this.playButton=new g.R({V:"a",Ql:["ytp-autonav-endscreen-upnext-button","ytp-autonav-endscreen-upnext-play-button", J.Y("web_modern_buttons")?"ytp-autonav-endscreen-upnext-button-rounded":""],X:{href:"{{url}}",role:"button","aria-label":"Play next video"},iB:"Play Now"});g.f(this,this.playButton);this.playButton.zH(this.K.element);this.playButton.listen("click",this.WG,this);this.Z.createServerVe(this.playButton.element,this.playButton,!0);(J=this.Z.getVideoData())&&TAH(this,J);this.T=new g.sn(function(){GFH(L)},500); g.f(this,this.T);this.HG();this.J(X,"autonavvisibility",this.HG);this.Z.Y("web_autonav_color_transition")&&(this.J(X,"autonavchange",this.Lf),this.J(X,"onAutonavCoundownStarted",this.Ui6))},g9=function(X){var J=X.Z.wg(!0,X.Z.isFullscreen()); g.q8(X.container.element,"ytp-autonav-endscreen-small-mode",X.cD(J));g.q8(X.container.element,"ytp-autonav-endscreen-is-premium",!!X.suggestion&&!!X.suggestion.AOM);g.q8(X.Z.getRootNode(),"ytp-autonav-endscreen-cancelled-state",!X.Z.QD());g.q8(X.Z.getRootNode(),"countdown-running",X.zB());g.q8(X.container.element,"ytp-player-content",X.Z.QD());g.lF(X.overlay.element,{width:J.width+"px"});if(!X.zB()){X.Z.QD()?fku(X,Math.round(eHv(X)/1E3)):fku(X);J=!!X.suggestion&&!!X.suggestion.mV;var L=X.Z.QD()|| !J;g.q8(X.container.element,"ytp-autonav-endscreen-upnext-alternative-header-only",!L&&J);g.q8(X.container.element,"ytp-autonav-endscreen-upnext-no-alternative-header",L&&!J);X.K.LO(X.Z.QD());g.q8(X.element,"ytp-enable-w2w-color-transitions",FCC(X))}},GFH=function(X){var J=eHv(X),L=Math,x=L.min; var Q=X.N?Date.now()-X.N:0;L=x.call(L,Q,J);fku(X,Math.ceil((J-L)/1E3));J-L<=500&&X.zB()?X.select(!0):X.zB()&&X.T.start()},eHv=function(X){if(X.Z.isFullscreen()){var J; X=(J=X.Z.getVideoData())==null?void 0:J.Qd;return X===-1||X===void 0?8E3:X}return X.Z.qG()>=0?X.Z.qG():g.J_(X.Z.G().experiments,"autoplay_time")||1E4},TAH=function(X,J){J=J.getWatchNextResponse(); var L,x;J=(L=jiI(J))==null?void 0:(x=L.nextButton)==null?void 0:x.buttonRenderer;X.B=J==null?void 0:J.navigationEndpoint;L=J==null?void 0:J.trackingParams;X.playButton&&L&&X.Z.setTrackingParams(X.playButton.element,L)},FCC=function(X){var J; return!((J=X.Z.getVideoData())==null||!J.watchToWatchTransitionRenderer)},fku=function(X,J){J=J===void 0?-1:J; X=X.L.kq("ytp-autonav-endscreen-upnext-header");g.HB(X);if(J>=0){J=String(J);var L="Up next in $SECONDS".match(RegExp("\\$SECONDS","gi"))[0],x="Up next in $SECONDS".indexOf(L);if(x>=0){X.appendChild(g.nj("Up next in $SECONDS".slice(0,x)));var Q=g.MG("span");g.JJ(Q,"ytp-autonav-endscreen-upnext-header-countdown-number");g.tw(Q,J);X.appendChild(Q);X.appendChild(g.nj("Up next in $SECONDS".slice(x+L.length)));return}}g.tw(X,"Up next")},D_=function(X,J){g.R.call(this,{V:"div", Ql:["html5-endscreen","ytp-player-content",J||"base-endscreen"]});this.created=!1;this.player=X},$K=function(X){g.R.call(this,{V:"div", Ql:["ytp-upnext","ytp-player-content"],X:{"aria-label":"{{aria_label}}"},C:[{V:"div",U:"ytp-cued-thumbnail-overlay-image",X:{style:"{{background}}"}},{V:"span",U:"ytp-upnext-top",C:[{V:"span",U:"ytp-upnext-header",iB:"Up Next"},{V:"span",U:"ytp-upnext-title",iB:"{{title}}"},{V:"span",U:"ytp-upnext-author",iB:"{{author}}"}]},{V:"a",U:"ytp-upnext-autoplay-icon",X:{role:"button",href:"{{url}}","aria-label":"Play next video"},C:[{V:"svg",X:{height:"100%",version:"1.1",viewBox:"0 0 72 72",width:"100%"}, C:[{V:"circle",U:"ytp-svg-autoplay-circle",X:{cx:"36",cy:"36",fill:"#fff","fill-opacity":"0.3",r:"31.5"}},{V:"circle",U:"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)"}},{V:"path",U:"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"}}]}]},{V:"span",U:"ytp-upnext-bottom",C:[{V:"span",U:"ytp-upnext-cancel"},{V:"span",U:"ytp-upnext-paused", iB:"Autoplay is paused"}]}]});this.api=X;this.cancelButton=null;this.B=this.kq("ytp-svg-autoplay-ring");this.N=this.notification=this.L=this.suggestion=null;this.T=new g.sn(this.a4,5E3,this);this.K=0;var J=this.kq("ytp-upnext-cancel");this.cancelButton=new g.R({V:"button",Ql:["ytp-upnext-cancel-button","ytp-button"],X:{tabindex:"0","aria-label":"Cancel autoplay"},iB:"Cancel"});g.f(this,this.cancelButton);this.cancelButton.listen("click",this.aM,this);this.cancelButton.zH(J);this.cancelButton&&this.api.createClientVe(this.cancelButton.element, this,115129);g.f(this,this.T);this.api.createClientVe(this.element,this,18788);J=this.kq("ytp-upnext-autoplay-icon");this.J(J,"click",this.i9);this.api.createClientVe(J,this,115130);this.xs();this.J(X,"autonavvisibility",this.xs);this.J(X,"mdxnowautoplaying",this.Ve6);this.J(X,"mdxautoplaycanceled",this.Zpm);g.q8(this.element,"ytp-upnext-mobile",this.api.G().K)},lku=function(X,J){if(J)return J; if(X.api.isFullscreen()){var L;X=(L=X.api.getVideoData())==null?void 0:L.Qd;return X===-1||X===void 0?8E3:X}return X.api.qG()>=0?X.api.qG():g.J_(X.api.G().experiments,"autoplay_time")||1E4},RHS=function(X,J){J=lku(X,J); var L=Math,x=L.min;var Q=(0,g.uT)()-X.K;L=x.call(L,Q,J);J=J===0?1:Math.min(L/J,1);X.B.setAttribute("stroke-dashoffset",""+-211*(J+1));J>=1&&X.zB()&&X.api.getPresentingPlayerType()!==3?X.select(!0):X.zB()&&X.L.start()},CN=function(X){D_.call(this,X,"autonav-endscreen"); this.overlay=this.videoData=null;this.table=new g.R({V:"div",U:"ytp-suggestion-panel",C:[{V:"div",Ql:["ytp-autonav-endscreen-upnext-header","ytp-autonav-endscreen-more-videos"],iB:"More videos"}]});this.S=new g.R({V:"div",U:"ytp-suggestions-container"});this.videos=[];this.N=null;this.B=this.W=!1;this.K=new II(this.player);g.f(this,this.K);this.K.zH(this.element);X.getVideoData().RT?this.L=this.K:(this.L=new $K(X),g.l0(this.player,this.L.element,4),g.f(this,this.L));this.overlay=new g.R({V:"div", U:"ytp-autonav-overlay-cancelled-state"});g.f(this,this.overlay);this.overlay.zH(this.element);this.T=new g.dS(this);g.f(this,this.T);g.f(this,this.table);this.table.zH(this.element);this.table.show();g.f(this,this.S);this.S.zH(this.table.element);this.hide()},Mm=function(X){var J=X.QD(); J!==X.B&&(X.B=J,rVu(X.player),X.B?(X.K!==X.L&&X.K.hide(),X.table.hide()):(X.K!==X.L&&X.K.show(),X.table.show()))},BAI=function(X){D_.call(this,X,"videowall-endscreen"); var J=this;this.Z=X;this.stills=[];this.N=this.videoData=null;this.T=this.W=!1;this.S=null;g.xq(this.element,"modern-videowall-endscreen");this.K=new g.dS(this);g.f(this,this.K);this.B=new g.sn(function(){g.xq(J.element,"ytp-show-tiles")},0); g.f(this,this.B);this.table=new g.iA({V:"div",U:"ytp-modern-endscreen-content"});g.f(this,this.table);this.table.zH(this.element);X.getVideoData().RT?this.L=new II(X,!0):this.L=new $K(X);g.f(this,this.L);g.l0(this.player,this.L.element,4);X.createClientVe(this.element,this,158789);this.hide()},yW=function(X){return g.Rq(X.player)&&X.r6()&&!X.N},nN=function(X){var J=X.QD(); J!==X.W&&(X.W=J,rVu(X.player))},si3=function(X){D_.call(this,X,"subscribecard-endscreen"); this.L=new g.R({V:"div",U:"ytp-subscribe-card",C:[{V:"img",U:"ytp-author-image",X:{src:"{{profilePicture}}"}},{V:"div",U:"ytp-subscribe-card-right",C:[{V:"div",U:"ytp-author-name",iB:"{{author}}"},{V:"div",U:"html5-subscribe-button-container"}]}]});g.f(this,this.L);this.L.zH(this.element);var J=X.getVideoData();this.subscribeButton=new g.iQ("Subscribe",null,"Unsubscribe",null,!0,!1,J.OY,J.subscribed,"trailer-endscreen",null,X,!1);g.f(this,this.subscribeButton);this.subscribeButton.zH(this.L.kq("html5-subscribe-button-container")); this.J(X,"videodatachange",this.Wl);this.Wl();this.hide()},VW=function(X){var J=X.G(),L=g.Oc||g.ej?{style:"will-change: opacity"}:void 0,x=J.T,Q=["ytp-videowall-still"]; J.K&&Q.push("ytp-videowall-show-text");g.R.call(this,{V:"a",Ql:Q,X:{href:"{{url}}",target:x?J.D:"","aria-label":"{{aria_label}}","data-is-live":"{{is_live}}","data-is-list":"{{is_list}}","data-is-mix":"{{is_mix}}"},C:[{V:"div",U:"ytp-videowall-still-image",X:{style:"{{background}}"}},{V:"span",U:"ytp-videowall-still-info",X:{"aria-hidden":"true"},C:[{V:"span",U:"ytp-videowall-still-info-bg",C:[{V:"span",U:"ytp-videowall-still-info-content",X:L,C:[{V:"span",U:"ytp-videowall-still-info-title",iB:"{{title}}"}, {V:"span",U:"ytp-videowall-still-info-author",iB:"{{author_and_views}}"},{V:"span",U:"ytp-videowall-still-info-live",iB:"Live"},{V:"span",U:"ytp-videowall-still-info-duration",iB:"{{duration}}"}]}]}]},{V:"span",Ql:["ytp-videowall-still-listlabel-regular","ytp-videowall-still-listlabel"],X:{"aria-hidden":"true"},C:[{V:"span",U:"ytp-videowall-still-listlabel-icon"},"Playlist",{V:"span",U:"ytp-videowall-still-listlabel-length",C:[" (",{V:"span",iB:"{{playlist_length}}"},")"]}]},{V:"span",Ql:["ytp-videowall-still-listlabel-mix", "ytp-videowall-still-listlabel"],X:{"aria-hidden":"true"},C:[{V:"span",U:"ytp-videowall-still-listlabel-mix-icon"},"Mix",{V:"span",U:"ytp-videowall-still-listlabel-length",iB:" (50+)"}]}]});this.suggestion=null;this.K=x;this.api=X;this.L=new g.dS(this);g.f(this,this.L);this.listen("click",this.onClick);this.listen("keypress",this.onKeyPress);this.L.J(X,"videodatachange",this.onVideoDataChange);X.createServerVe(this.element,this);this.onVideoDataChange()},Hg=function(X){D_.call(this,X,"videowall-endscreen"); var J=this;this.Z=X;this.N=0;this.stills=[];this.T=this.videoData=null;this.B=this.S=!1;this.D=null;this.K=new g.dS(this);g.f(this,this.K);this.W=new g.sn(function(){g.xq(J.element,"ytp-show-tiles")},0); g.f(this,this.W);var L=new g.R({V:"button",Ql:["ytp-button","ytp-endscreen-previous"],X:{"aria-label":"Previous"},C:[g.My()]});g.f(this,L);L.zH(this.element);L.listen("click",this.zv,this);this.table=new g.iA({V:"div",U:"ytp-endscreen-content"});g.f(this,this.table);this.table.zH(this.element);L=new g.R({V:"button",Ql:["ytp-button","ytp-endscreen-next"],X:{"aria-label":"Next"},C:[g.yp()]});g.f(this,L);L.zH(this.element);L.listen("click",this.Fz,this);X.getVideoData().RT?this.L=new II(X,!0):this.L= new $K(X);g.f(this,this.L);g.l0(this.player,this.L.element,4);X.createClientVe(this.element,this,158789);this.hide()},O$=function(X){return g.Rq(X.player)&&X.r6()&&!X.T},aI=function(X){var J=X.QD(); J!==X.S&&(X.S=J,rVu(X.player))},NAu=function(X,J){g.R.call(this,{V:"button", Ql:["ytp-watch-on-youtube-button","ytp-button"],iB:"{{content}}"});this.Z=X;this.buttonType=this.buttonType=J;this.UN();this.buttonType===2&&g.xq(this.element,"ytp-continue-watching-button");this.listen("click",this.onClick);this.listen("videodatachange",this.UN);this.LO(!0)},w9=function(X){D_.call(this,X,"watch-again-on-youtube-endscreen"); this.watchButton=new NAu(X,1);g.f(this,this.watchButton);this.watchButton.zH(this.element);g.TIv(X)&&(this.L=new g.iz(X),g.f(this,this.L),this.K=new g.R({V:"div",Ql:["ytp-watch-again-on-youtube-endscreen-more-videos-container"],X:{tabIndex:"-1"},C:[this.L]}),g.f(this,this.K),this.L.zH(this.K.element),this.K.zH(this.element));X.createClientVe(this.element,this,156914);this.hide()},Z3S=function(X){g.bf.call(this,X); var J=this;this.endScreen=null;this.L=this.K=this.N=!1;this.listeners=new g.dS(this);g.f(this,this.listeners);var L=X.G();X.isEmbedsShortsMode()?this.endScreen=new w9(X):UJC(X)?(this.N=!0,mJ0(this),this.L?this.endScreen=new CN(X):L.Y("delhi_modern_endscreen")?this.endScreen=new BAI(X):this.endScreen=new Hg(X)):L.Vq?this.endScreen=new si3(X):this.endScreen=new D_(X);g.f(this,this.endScreen);g.l0(X,this.endScreen.element,4);kFu(this);this.listeners.J(X,"videodatachange",this.onVideoDataChange,this); this.listeners.J(X,g.sq("endscreen"),function(x){J.onCueRangeEnter(x)}); this.listeners.J(X,g.N2("endscreen"),function(x){J.onCueRangeExit(x)})},mJ0=function(X){var J=X.player.getVideoData(); if(!J||X.L===J.cf&&X.K===J.RT)return!1;X.L=J.cf;X.K=J.RT;return!0},UJC=function(X){X=X.G(); return X.oT&&!X.Vq&&!X.disableOrganicUi},kFu=function(X){X.player.Q0("endscreen"); var J=X.player.getVideoData();J=new g.Rw(Math.max((J.lengthSeconds-10)*1E3,0),0x8000000000000,{id:"preload",namespace:"endscreen"});var L=new g.Rw(0x8000000000000,0x8000000000000,{id:"load",priority:8,namespace:"endscreen"});X.player.tj([J,L])}; g.rB.prototype.qG=g.iv(6,function(){return this.app.qG()}); g.tG.prototype.qG=g.iv(5,function(){return this.getVideoData().V3}); g.hz.prototype.Iq=g.iv(4,function(X){this.gZ().Iq(X)}); g.kC.prototype.Iq=g.iv(3,function(X){this.bS!==X&&(this.bS=X,this.XW())}); g.w(qm,g.R);qm.prototype.select=function(){this.Z.G7(this.suggestion.videoId,this.suggestion.sessionData,this.suggestion.playlistId,void 0,void 0,this.suggestion.Z0||void 0)&&this.Z.logClick(this.element)}; qm.prototype.onClick=function(X){g.nG(X,this.Z,this.L,this.suggestion.sessionData||void 0)&&this.select()}; qm.prototype.onKeyPress=function(X){switch(X.keyCode){case 13:case 32:X.defaultPrevented||(this.select(),X.preventDefault())}};g.w(II,g.R);g.a=II.prototype;g.a.IE=function(X){this.suggestion!==X&&(this.suggestion=X,g.Mg(this.L,X),this.playButton.updateValue("url",this.suggestion.Ve()),g9(this))}; g.a.zB=function(){return this.N>0}; g.a.K6=function(){this.zB()||(this.N=Date.now(),GFH(this),v48(this.Z,eHv(this)),g.q8(this.Z.getRootNode(),"countdown-running",this.zB()))}; g.a.vk=function(){this.iT();GFH(this);var X=this.L.kq("ytp-autonav-endscreen-upnext-header");X&&g.tw(X,"Up next")}; g.a.iT=function(){this.zB()&&(this.T.stop(),this.N=0)}; g.a.select=function(X){this.Z.nextVideo(!1,X===void 0?!1:X);this.iT()}; g.a.WG=function(X){g.nG(X,this.Z)&&(X.currentTarget===this.playButton.element?this.Z.logClick(this.playButton.element):X.currentTarget===this.L.kq("ytp-autonav-endscreen-link-container")&&(X=this.L.kq("ytp-autonav-endscreen-link-container"),this.Z.logVisibility(X,!0),this.Z.logClick(X)),this.B?(this.Z.GH("innertubeCommand",this.B),this.iT()):this.select())}; g.a.Kf=function(){this.Z.logClick(this.cancelButton.element);g.jy(this.Z,!0);this.cancelCommand&&this.Z.GH("innertubeCommand",this.cancelCommand)}; g.a.onVideoDataChange=function(X,J){TAH(this,J);X=J.getWatchNextResponse();var L,x;X=(L=jiI(X))==null?void 0:(x=L.cancelButton)==null?void 0:x.buttonRenderer;this.cancelCommand=X==null?void 0:X.command}; g.a.Ui6=function(X){if(FCC(this)){var J=this.Z.getVideoData().watchToWatchTransitionRenderer,L=J==null?void 0:J.fromColorPaletteDark;J=J==null?void 0:J.toColorPaletteDark;if(L&&J){var x=this.element;x.style.setProperty("--w2w-start-background-color",g.W8(L.surgeColor));x.style.setProperty("--w2w-start-primary-text-color",g.W8(L.primaryTitleColor));x.style.setProperty("--w2w-start-secondary-text-color",g.W8(L.secondaryTitleColor));x.style.setProperty("--w2w-end-background-color",g.W8(J.surgeColor)); x.style.setProperty("--w2w-end-primary-text-color",g.W8(J.primaryTitleColor));x.style.setProperty("--w2w-end-secondary-text-color",g.W8(J.secondaryTitleColor));x.style.setProperty("--w2w-animation-duration",X+"ms")}g.q8(this.element,"ytp-w2w-animate",!0)}}; g.a.Lf=function(X){this.Z.Y("web_autonav_color_transition")&&X!==2&&g.q8(this.element,"ytp-w2w-animate",!1)}; g.a.HG=function(){var X=this.Z.QD();this.W&&this.RB!==X&&this.LO(X);g9(this);this.Z.logVisibility(this.container.element,X);this.Z.logVisibility(this.cancelButton.element,X);this.Z.logVisibility(this.L.kq("ytp-autonav-endscreen-link-container"),X);this.Z.logVisibility(this.playButton.element,X)}; g.a.cD=function(X){return X.width<400||X.height<459};g.w(D_,g.R);g.a=D_.prototype;g.a.create=function(){this.created=!0}; g.a.destroy=function(){this.created=!1}; g.a.r6=function(){return!1}; g.a.QD=function(){return!1}; g.a.Pg=function(){return!1};g.w($K,g.R);g.a=$K.prototype;g.a.a4=function(){this.notification&&(this.T.stop(),this.VO(this.N),this.N=null,this.notification.close(),this.notification=null)}; g.a.IE=function(X){this.suggestion=X;g.Mg(this,X,"hqdefault.jpg")}; g.a.xs=function(){this.LO(this.api.QD());this.api.logVisibility(this.element,this.api.QD());this.api.logVisibility(this.kq("ytp-upnext-autoplay-icon"),this.api.QD());this.cancelButton&&this.api.logVisibility(this.cancelButton.element,this.api.QD())}; g.a.dxi=function(){window.focus();this.a4()}; g.a.K6=function(X){var J=this;this.zB()||(g.AP("a11y-announce","Up Next "+this.suggestion.title),this.K=(0,g.uT)(),this.L=new g.sn(function(){RHS(J,X)},25),RHS(this,X),v48(this.api,lku(this,X))); g.Qd(this.element,"ytp-upnext-autoplay-paused")}; g.a.hide=function(){g.R.prototype.hide.call(this)}; g.a.zB=function(){return!!this.L}; g.a.vk=function(){this.iT();this.K=(0,g.uT)();RHS(this);g.xq(this.element,"ytp-upnext-autoplay-paused")}; g.a.iT=function(){this.zB()&&(this.L.dispose(),this.L=null)}; g.a.select=function(X){X=X===void 0?!1:X;if(this.api.G().Y("autonav_notifications")&&X&&window.Notification&&typeof document.hasFocus==="function"){var J=Notification.permission;J==="default"?Notification.requestPermission():J!=="granted"||document.hasFocus()||(this.a4(),this.notification=new Notification("Up Next",{body:this.suggestion.title,icon:this.suggestion.TC()}),this.N=this.J(this.notification,"click",this.dxi),this.T.start())}this.iT();this.api.nextVideo(!1,X)}; g.a.i9=function(X){!g.w0(this.cancelButton.element,X.target)&&g.nG(X,this.api)&&(this.api.QD()&&this.api.logClick(this.kq("ytp-upnext-autoplay-icon")),this.select())}; g.a.aM=function(){this.api.QD()&&this.cancelButton&&this.api.logClick(this.cancelButton.element);g.jy(this.api,!0)}; g.a.Ve6=function(X){this.api.getPresentingPlayerType();this.show();this.K6(X)}; g.a.Zpm=function(){this.api.getPresentingPlayerType();this.iT();this.hide()}; g.a.uB=function(){this.iT();this.a4();g.R.prototype.uB.call(this)};g.w(CN,D_);g.a=CN.prototype;g.a.create=function(){D_.prototype.create.call(this);this.T.J(this.player,"appresize",this.dC);this.T.J(this.player,"onVideoAreaChange",this.dC);this.T.J(this.player,"videodatachange",this.onVideoDataChange);this.T.J(this.player,"autonavchange",this.pU);this.T.J(this.player,"onAutonavCancelled",this.u9);this.onVideoDataChange()}; g.a.show=function(){D_.prototype.show.call(this);(this.W||this.N&&this.N!==this.videoData.clientPlaybackNonce)&&g.jy(this.player,!1);g.Rq(this.player)&&this.r6()&&!this.N?(Mm(this),this.videoData.autonavState===2?this.player.getVisibilityState()===3?this.L.select(!0):this.L.K6():this.videoData.autonavState===3&&this.L.vk()):(g.jy(this.player,!0),Mm(this));this.dC()}; g.a.hide=function(){D_.prototype.hide.call(this);this.L.vk();Mm(this)}; g.a.dC=function(){var X=this.player.wg(!0,this.player.isFullscreen());Mm(this);g9(this.K);g.q8(this.element,"ytp-autonav-cancelled-small-mode",this.cD(X));g.q8(this.element,"ytp-autonav-cancelled-tiny-mode",this.Ca(X));g.q8(this.element,"ytp-autonav-cancelled-mini-mode",X.width<=400||X.height<=360);this.overlay&&g.lF(this.overlay.element,{width:X.width+"px"});if(!this.B)for(X=0;X0&&(X= n*4,H=J<=C-2&&M>=y*4;if((y+1)/n*x/q>q/(y/(n+1)*x)&&H)M-=y*4,J+=2;else if(V)M-=n*4,X+=2;else if(H)M-=y*4,J+=2;else break}x=!1;M>=12&&L*4-M<=6&&(J>=4||X>=4)&&(x=!0);M=X*96;D=J*54;q=M/D=X-2&&y>=J-2?H=1:y%2===0&&C%2===0&&(y<2&&C<2?y===0&&C===0&&(H=2):H=2),n=g.ev(n+this.N,L),H!==0){V=this.stills[q];V||(V=new VW(this.player),this.stills[q]=V,K.appendChild(V.element));var O=Math.floor(D*y/J),u=Math.floor(M*C/X),S=Math.floor(D*(y+H)/J)-O-4,Y=Math.floor(M*(C+H)/X)-u-4;g.m9(V.element,u,O);g.X9(V.element,Y,S);g.lF(V.element,"transitionDelay",(y+C)/20+"s");g.q8(V.element,"ytp-videowall-still-mini", H===1);g.q8(V.element,"ytp-videowall-still-large",H>2);H=Math.max(Y,S);g.q8(V.element,"ytp-videowall-still-round-large",H>=256);g.q8(V.element,"ytp-videowall-still-round-medium",H>96&&H<256);g.q8(V.element,"ytp-videowall-still-round-small",H<=96);n=Q[n];V.suggestion!==n&&(V.suggestion=n,H=V.api.G(),O=g.Ls(V.element,"ytp-videowall-still-large")?"hqdefault.jpg":"mqdefault.jpg",g.Mg(V,n,O),g.lb(H)&&!V.api.Y("web_player_log_click_before_generating_ve_conversion_params")&&(H=n.Ve(),O={},g.wB(V.api,"addEmbedsConversionTrackingParams", [O]),H=g.Hw(H,O),V.updateValue("url",H)),(n=(n=n.sessionData)&&n.itct)&&V.api.setTrackingParams(V.element,n));q++}K.ariaBusy="false";g.q8(this.element,"ytp-endscreen-paginate",q=q;Q--)X=this.stills[Q],g.aW(X.element),g.Lq(X);this.stills.length=q}}; g.a.onVideoDataChange=function(){var X=this.player.getVideoData(1);this.videoData!==X&&(X!=null&&g.yh(X)?(this.N=0,this.videoData=X,this.f7()):this.player.Ni("missg",{vid:(X==null?void 0:X.videoId)||"",cpn:(X==null?void 0:X.clientPlaybackNonce)||""}))}; g.a.Fz=function(){this.N+=this.stills.length;this.f7()}; g.a.zv=function(){this.N-=this.stills.length;this.f7()}; g.a.Pg=function(){return this.L.zB()}; g.a.zG=function(X){X===1?(this.B=!1,this.T=this.videoData.clientPlaybackNonce,this.L.iT(),this.RB&&this.f7()):(this.B=!0,this.RB&&O$(this)&&(X===2?this.L.K6():X===3&&this.L.vk()))}; g.a.gx=function(X){if(X){for(X=0;X0||X.endSeconds>0||X.mutedAutoplayDurationMode!==2);if(this.player.isEmbedsShortsMode()&&!J)return!0;var L;var x=!!((X==null?0:g.yh(X))||(X==null?0:(L=X.suggestions)==null?0:L.length));x=!UJC(this.player)||x;X=X.Uv;L=this.player.QF();return x&&!X&&!L&&!J}; g.a.QD=function(){return this.endScreen.QD()}; g.a.QI=function(){return this.QD()?this.endScreen.Pg():!1}; g.a.uB=function(){this.player.Q0("endscreen");g.bf.prototype.uB.call(this)}; g.a.load=function(){var X=this.player.getVideoData();var J=X.transitionEndpointAtEndOfStream;if(J&&J.videoId){var L=this.player.h_().Aj.get("heartbeat"),x=g.yh(X);!x||J.videoId!==x.videoId||X.V4?(this.player.G7(J.videoId,void 0,void 0,!0,!0,J),L&&L.iG("HEARTBEAT_ACTION_TRIGGER_AT_STREAM_END","HEARTBEAT_ACTION_TRANSITION_REASON_HAS_NEW_STREAM_TRANSITION_ENDPOINT"),X=!0):X=!1}else X=!1;X||(g.bf.prototype.load.call(this),this.endScreen.show())}; g.a.unload=function(){g.bf.prototype.unload.call(this);this.endScreen.hide();this.endScreen.destroy()}; g.a.onCueRangeEnter=function(X){this.yX()&&(this.endScreen.created||this.endScreen.create(),X.getId()==="load"&&this.load())}; g.a.onCueRangeExit=function(X){X.getId()==="load"&&this.loaded&&this.unload()}; g.a.onVideoDataChange=function(){kFu(this);this.N&&mJ0(this)&&(this.endScreen&&(this.endScreen.hide(),this.endScreen.created&&this.endScreen.destroy(),this.endScreen.dispose()),this.L?this.endScreen=new CN(this.player):this.endScreen=new Hg(this.player),g.f(this,this.endScreen),g.l0(this.player,this.endScreen.element,4))};g.oE("endscreen",Z3S);})(_yt_player);