(function(g){var window=this;/* SPDX-License-Identifier: Apache-2.0 */ /* Copyright 2017 Google LLC SPDX-License-Identifier: BSD-3-Clause */ 'use strict';var $tb=function(a){a.mutedAutoplay=!1;a.endSeconds=NaN;a.limitedPlaybackDurationInSeconds=NaN;g.sS(a)},aub=function(a){g.cv(a); for(var b=0;bb;)a.pop()},gub=function(a){a=Array(a); $4(a,0);return a},hub=function(a,b,c){if(c==null)a.removeAttribute(b); else{var d=b.lastIndexOf("xml:",0)===0?"http://www.w3.org/XML/1998/namespace":b.lastIndexOf("xlink:",0)===0?"http://www.w3.org/1999/xlink":null;d?a.setAttributeNS(d,b,c):a.setAttribute(b,c)}},jub=function(a,b,c){a=a.style; if(typeof c==="string")a.cssText=c;else{a.cssText="";for(var d in c)if(iub.call(c,d)){b=a;var e=d,f=c[d];e.indexOf("-")>=0?b.setProperty(e,f):b[e]=f}}},kub=function(a,b,c){var d=typeof c; d==="object"||d==="function"?a[b]=c:hub(a,b,c)},lub=function(){var a=new fub; a.__default=kub;a.style=jub;return a},mub=function(a,b,c,d){(d[b]||d.__default)(a,b,c)},nub=function(a){this.created=[]; this.j=[];this.node=a},oub=function(a,b){this.j=null; this.B=a;this.key=b;this.text=void 0},pub=function(a,b,c){b=new oub(b,c); return a.__incrementalDOMData=b},a5=function(a,b){if(a.__incrementalDOMData)return a.__incrementalDOMData; var c=a.nodeType===1?a.localName:a.nodeName,d=a.nodeType===1?a.getAttribute("key"):null;b=pub(a,c,a.nodeType===1?d||b:null);if(a.nodeType===1&&(a=a.attributes,c=a.length)){d=b.j||(b.j=gub(c*2));for(var e=0,f=0;e=0)for(b=b5,c=a.nextSibling, d=f5;d!==null&&d!==a;)e=d.nextSibling,b.insertBefore(d,c),d=e;else b5.insertBefore(a,f5);f5=a}},sub=function(a,b){rub(a,b); b5=f5;f5=null;return b5},uub=function(a,b){b=b===void 0?{}:b; var c=b.matches===void 0?qub:b.matches;return function(d,e,f){var h=d5,l=h5,m=i5,n=j5,p=f5,q=b5,r=g5;h5=d.ownerDocument;d5=new nub(d);g5=c;j5=[];f5=null;var t=b5=d.parentNode,u,w=tub.call(d);if((u=w.nodeType===11||w.nodeType===9?w.activeElement:null)&&d.contains(u)){for(w=[];u!==t;)w.push(u),u=u.parentNode||(t?u.host:null);t=w}else t=[];i5=t;try{return a(d,e,f)}finally{d=d5,k5&&d.j.length>0&&k5(d.j),h5=l,d5=h,g5=r,j5=n,f5=p,b5=q,i5=m}}},vub=function(a,b,c,d){l5.push(mub); l5.push(a);l5.push(b);l5.push(c);l5.push(d)},wub=function(a){rub("#text",null); var b=f5;var c=a5(b);if(c.text!==a){c=c.text=a;for(var d=1;d0&&m5.splice(-a)}},yub=function(a){var b=m5; if(b.length!==0&&!a.WI){var c=b.slice(-20).reverse().map(function(d){return d.name}).join(" > "); c=a.message+"\n\nComponent stack: "+c;try{a.WI=b.slice(),p5.v8&&(a.stack&&(a.stack=a.stack.replace(a.message,c)),a.message=c)}catch(d){}}},zub=function(a,b){var c=g.Ja.apply(2,arguments),d; b=(d=b)!=null?d:{};d={};return d.type=a,d.props=b,d.children=c,d[q5]=!0,d},r5=function(a){return a.children},t5=function(a,b){var c=s5; s5=a;try{return b()}finally{s5=c}},Bub=function(a){function b(d,e,f){g.cs(d,Aub); for(var h=Math.min(e.length-f,d.length),l=0;l=0;d--)c.removeChild(a[d])}else c.textContent="",c.appendChild(b);return b},Eub=function(a,b){if(a[0].parentElement)for(var c=a[0].parentElement,d=b.length,e=a.length,f=d,h=0,l=0,m=a[e-1].nextSibling,n=null;hp-l)for(q=a[h];l0&&(b.children=c.length===1?c[0]:c);var f=rvb(a,b);return f===!1?svb(a,b):f}}); var d=document.createElement(a),e;for(e in b)L5(d,e,b[e]);pvb(d,b);K5(c,d);lvb(d,b,{PA:!0});return d},rvb=function(a,b){if(a.Wqb||a.PA)return!1; b||(b={});var c=new P5(b);c.B=a;var d=Z4(g.umb,function(){return c.wy(b)}); if(!(d instanceof HTMLElement))return d;d.__instance=c;c.el=d;c.j=a;a.lw=d.tagName.toLowerCase();Q5.pE(c);return d},vvb=function(a){a=Tub(a,uvb,Qub); p5.IM?Mub(a):Qub(a)},wvb=function(a){vvb(function(){Z4(null,a)})},xvb=function(a){if(a){var b; (b=a._disposeRef)==null||b.call(a);var c;(c=a._disposeEffects)==null||c.call(a);a.__instance&&a.__instance instanceof N5&&(b=a.__instance,nvb(b,a),b instanceof P5&&b.G());for(b=0;b0&&(a.props.children=a.children);var d;(d=a.props).idomKey||(d.idomKey=b);if(c){var e=sub(c,a.props.idomKey);a.Zq=!0;var f=e.__instance}f||(f=Svb(b,a.props),f.props=null,e&&(e.__instance=f,f.el=e));var h;c=((h=f.JN)!=null?h:{pR:f.state,CZ:!1}).pR;f.JN=void 0;b.a9&&(c=b.a9(a.props,c));f.props=a.props;f.state=c;h=function(){var l=f;Q5.ZW(l);var m=l.wy(l.props);m?(l.props.idomKey&&(m.props.idomKey=l.props.idomKey),l=m):l=void 0; if(m=l)if(m.Zq=a.Zq,l=V5(m),a.Zq=m.Zq,!b.lw)if(l)b.lw=l.tagName.toLowerCase(),l.__instance=f,f.el=l;else{var n;if((n=f.zA)==null?0:n.length){var p;(p=p5.uA)==null||p.call(p5,"unknown",Error("A component used hooks, but failed to return a host element"))}}f.pE();Q5.pE(f)}; (c=f.B)?xub({component:c,debugInstance:f.props.debugInstance,Am:h}):h()}},Qvb=function(a){var b=a.type; if(!b.PA)return!1;a.props.children=a.children.length>1?a.children:a.children[0];var c,d=(c=a.props.idomKey)!=null?c:a.type,e;if(c5()&&((e=c5()[I5])==null?void 0:e.key)===d){d=c5();c=d[I5];if(!c)throw Error("Reactive data has been lost on node. Tag name: "+d.tagName);if(!b.q3){var f;(f=c.Dsb)==null||f.call(c,a.props);Tvb(c);return!0}f=A5;b=b.q3(a.props,c.props,f!==null?f:c.context,c.f$);f=Uvb(b);Vvb(a.props,c.props);f>0?V5(b):f5=c5();return!0}if(Wvb.has(b.name)&&a.props.allowIdomInterop!==Xvb)throw Error(b.name+ " can not be called from a IDOM component. See go/cow-errors#control-flow-component-called-from-Idom-Component");(b=xub({component:a.type,debugInstance:a.props.debugInstance,Am:function(){return svb(a.type,a.props)}}))&&Yvb(b); return!0},Uvb=function(a){if(a){if(Array.isArray(a)){var b=0; a=g.v(a);for(var c=a.next();!c.done;c=a.next())(c=c.value)&&(b=c.type===r5?b+c.children.length:b+1);return b}if(a.type===r5)return a.children.length}else return 0;return 1},Vvb=function(a,b){b&&(b.children=a.children,b.t8=a.t8,b.fallback=a.fallback)},Zvb=function(a){for(var b=0;b0&&h(g.qF(w,4)&&!g.qF(w,2)&&!g.qF(w,1024))}} function c(){b(a.J.getPlayerStateObject())} function d(w){b(w.state)} var e=g.v(gwb(!1)),f=e.next().value,h=e.next().value,l=g.v(gwb(!1));e=l.next().value;var m=l.next().value,n=U5(),p=jwb(a.J,a.Oe),q=U5();l=bwb();var r=bwb();S5(function(){var w=a.J,A=w.hd()?157212:172777;r.value=new g.I;w.createClientVe(q.value,r.value,A);w.addEventListener("presentingplayerstatechange",d);w.addEventListener("videodatachange",c);A=w.U().controlsType==="0";g.Gv(w.getRootNode(),"ytp-pause-overlay-controls-hidden",A);return function(){w.removeEventListener("videodatachange",c);w.removeEventListener("presentingplayerstatechange", d);var C;(C=r.value)==null||C.dispose()}},[a.J]); S5(function(){var w;(w=p.value)==null||w.Ja(n.value)},[p]); var t=a.J;if(f)if(g.Gv(t.getRootNode(),"ytp-expand-pause-overlay",!e),e)l.value.focus();else{var u=p.value;g.c2(u);u.show();q.value.focus()}q.value&&t.logVisibility(q.value,f&&!e);return R5("ytp-pause-overlay",{el:q,class:"ytp-pause-overlay","aria-hidden":!f},R5(hwb,{J:a.J,Oe:a.Oe,action:function(){m(!0)}}),R5(iwb,{J:a.J, Oe:a.Oe,action:function(){m(!1)}, YB:l}),R5("div",{el:n,skip:!0}))},lwb=function(a){g.W.call(this,{I:"div", S:"ytp-related-on-error-overlay"});var b=this;this.api=a;this.K=this.B=0;this.G=new g.HJ(this);this.j=[];this.suggestionData=[];this.columns=this.containerWidth=0;this.title=new g.W({I:"h2",S:"ytp-related-title",va:"{{title}}"});this.previous=new g.W({I:"button",Ka:["ytp-button","ytp-previous"],W:{"aria-label":"Show previous suggested videos"},V:[g.LE()]});this.qa=new g.a2(function(f){b.suggestions.element.scrollLeft=-f}); this.D=this.C=0;this.N=!0;this.next=new g.W({I:"button",Ka:["ytp-button","ytp-next"],W:{"aria-label":"Show more suggested videos"},V:[g.ME()]});g.L(this,this.G);a=a.U();this.api.L("embeds_web_enable_pause_overlay_rounding")&&g.Cv(this.element,"ytp-error-overlay-round-corners");this.Y=a.D;g.L(this,this.title);this.title.Ja(this.element);this.suggestions=new g.W({I:"div",S:"ytp-suggestions"});g.L(this,this.suggestions);this.suggestions.Ja(this.element);g.L(this,this.previous);this.previous.Ja(this.element); this.previous.listen("click",this.l5,this);g.L(this,this.qa);for(var c={DA:0};c.DA<16;c={DA:c.DA},c.DA++){var d=new g.W({I:"a",S:"ytp-suggestion-link",W:{href:"{{link}}",target:a.Y,"aria-label":"{{aria_label}}"},V:[{I:"div",S:"ytp-suggestion-image",V:[{I:"div",W:{"data-is-live":"{{is_live}}"},S:"ytp-suggestion-duration",va:"{{duration}}"}]},{I:"div",S:"ytp-suggestion-title",W:{title:"{{hover_title}}"},va:"{{title}}"},{I:"div",S:"ytp-suggestion-author",va:"{{views_or_author}}"}]});g.L(this,d);d.Ja(this.suggestions.element); var e=d.Ea("ytp-suggestion-link");g.Ls(e,"transitionDelay",c.DA/20+"s");this.G.T(e,"click",function(f){return function(h){var l=f.DA,m=b.suggestionData[l],n=m.sessionData;g.kR(b.api.U())&&b.api.L("web_player_log_click_before_generating_ve_conversion_params")?(b.api.logClick(b.j[l].element),l=m.ll(),m={},g.aZa(b.api,m,"emb_rel_err"),l=g.yo(l,m),g.XT(l,b.api,h)):g.WT(h,b.api,b.Y,n||void 0)&&b.api.ip(m.videoId,n,m.playlistId)}}(c)); this.j.push(d)}g.L(this,this.next);this.next.Ja(this.element);this.next.listen("click",this.k5,this);this.G.T(this.api,"videodatachange",this.onVideoDataChange);this.resize(this.api.ob().getPlayerSize());this.onVideoDataChange();this.show()},mwb=function(a,b){if(a.api.U().L("web_player_log_click_before_generating_ve_conversion_params"))for(var c=Math.floor(-a.C/(a.D+a.B)),d=Math.min(c+a.columns,a.suggestionData.length)-1;c<=d;c++)a.api.logVisibility(a.j[c].element,b)},nwb=function(a){a.next.element.style.bottom= a.K+"px"; a.previous.element.style.bottom=a.K+"px";var b=a.C,c=a.containerWidth-a.suggestionData.length*(a.D+a.B);g.Gv(a.element,"ytp-scroll-min",b>=0);g.Gv(a.element,"ytp-scroll-max",b<=c)},owb=function(a){for(var b=0;b