(function(g){var window=this;/* SPDX-License-Identifier: Apache-2.0 */ /* Copyright 2017 Google LLC SPDX-License-Identifier: BSD-3-Clause */ 'use strict';var ytb=function(a){a.mutedAutoplay=!1;a.endSeconds=NaN;a.limitedPlaybackDurationInSeconds=NaN;g.yS(a)},ztb=function(a){g.kv(a); for(var b=0;bb;)a.pop()},Ftb=function(a){a=Array(a); a5(a,0);return a},Gtb=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)}},Itb=function(a,b,c){a=a.style; if(typeof c==="string")a.cssText=c;else{a.cssText="";for(var d in c)if(Htb.call(c,d)){b=a;var e=d,f=c[d];e.indexOf("-")>=0?b.setProperty(e,f):b[e]=f}}},Jtb=function(a,b,c){var d=typeof c; d==="object"||d==="function"?a[b]=c:Gtb(a,b,c)},Ktb=function(){var a=new Etb; a.__default=Jtb;a.style=Itb;return a},Ltb=function(a,b,c,d){(d[b]||d.__default)(a,b,c)},Mtb=function(a){this.created=[]; this.j=[];this.node=a},Ntb=function(a,b){this.j=null; this.B=a;this.key=b;this.text=void 0},Otb=function(a,b,c){b=new Ntb(b,c); return a.__incrementalDOMData=b},b5=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=Otb(a,c,a.nodeType===1?d||b:null);if(a.nodeType===1&&(a=a.attributes,c=a.length)){d=b.j||(b.j=Ftb(c*2));for(var e=0,f=0;e=0)for(b=c5,c=a.nextSibling, d=g5;d!==null&&d!==a;)e=d.nextSibling,b.insertBefore(d,c),d=e;else c5.insertBefore(a,g5);g5=a}},Rtb=function(a,b){Qtb(a,b); c5=g5;g5=null;return c5},Ttb=function(a,b){b=b===void 0?{}:b; var c=b.matches===void 0?Ptb:b.matches;return function(d,e,f){var h=e5,l=i5,m=j5,n=k5,p=g5,q=c5,r=h5;i5=d.ownerDocument;e5=new Mtb(d);h5=c;k5=[];g5=null;var t=c5=d.parentNode,u,w=Stb.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=[];j5=t;try{return a(d,e,f)}finally{d=e5,l5&&d.j.length>0&&l5(d.j),i5=l,e5=h,h5=r,k5=n,g5=p,c5=q,j5=m}}},Utb=function(a,b,c,d){m5.push(Ltb); m5.push(a);m5.push(b);m5.push(c);m5.push(d)},Vtb=function(a){Qtb("#text",null); var b=g5;var c=b5(b);if(c.text!==a){c=c.text=a;for(var d=1;d0&&n5.splice(-a)}},Xtb=function(a){var b=n5; if(b.length!==0&&!a.VI){var c=b.slice(-20).reverse().map(function(d){return d.name}).join(" > "); c=a.message+"\n\nComponent stack: "+c;try{a.VI=b.slice(),a.stack&&(a.stack=a.stack.replace(a.message,c)),a.message=c}catch(d){}}},r5=function(a){this.props=a; this.C=!1},t5=function(a,b){var c=s5; s5=a;try{return b()}finally{s5=c}},u5=function(a){var b=s5; if(b&&b!==Ytb){var c=n5.slice();b.qE||(b.qE=[]);b.qE.push(function(){return void q5(function(){return void a()},{stack:c})})}},w5=function(a){var b=!!s5,c=Ztb(b===void 0?!0:b); t5(c,function(){return void a(c)}); return function(){return void v5(c)}},Ztb=function(a){var b={}; (a===void 0||a)&&$tb(b);return b},$tb=function(a){var b=s5; b&&(b.La||u5(function(){return void v5(a)}))},aub=function(a){a.qE&&($4(g.Wlb,function(){for(var b=g.v(a.qE),c=b.next();!c.done;c=b.next())c=c.value,c()}),a.qE=[])},v5=function(a){if(!a.La){a.La=!0; var b;(b=a[x5])==null||b.call(a);aub(a)}},bub=function(){if(o5())throw Error("Reactive components are not allowed to use useState or other memoization based hooks."); return y5},z5=function(a){r5.call(this,a); var b=this;this.vA=[];this.D=0;this.G=w5(function(c){b.jJ=c;u5(function(){cub(b,b.el)})})},cub=function(a,b){if(!a.C&&b){a.C=!0; try{a.gJ()}catch(e){var c,d;(d=p5.qA)==null||d.call(p5,(c=a.j)==null?void 0:c.dw,e)}A5.gJ(a);a.el=null;b.__instance&&delete b.__instance}},dub=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 r5&&(b=a.__instance,cub(b,a),b instanceof z5&&b.G());for(b=0;b=0;d--)c.removeChild(a[d])}else c.textContent="",c.appendChild(b);return b},lub=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=Rub(a,b);return f===!1?Sub(a,b):f}}); var d=document.createElement(a),e;for(e in b)T5(d,e,b[e]);Pub(d,b);S5(c,d);Nub(d,b,{LA:!0});return d},Rub=function(a,b){if(a.vqb||a.LA)return!1; b||(b={});var c=new z5(b);c.B=a;var d=$4(g.Xlb,function(){return c.vy(b)}); if(!(d instanceof HTMLElement))return d;d.__instance=c;c.el=d;c.j=a;a.dw=d.tagName.toLowerCase();A5.mE(c);return d},Vub=function(a){a=uub(a,Uub,rub); p5.KM?oub(a):rub(a)},Wub=function(a){Vub(function(){$4(null,a)})},Xub=function(a){var b=null,c; return{value:null,Jba:function(d){if(c&&d!==c){var e;(e=b)==null||e();c._disposeRef=void 0}c=d;b=a(d)||null}, xca:function(){var d;(d=b)==null||d()}}},Yub=function(a){var b=bub(); if(b==null)throw Error("A valid hook context was not found. Please ensure you are using components from TSX and not invoking the component function directly");var c=b.D++;b.vA||(b.vA=[]);var d=b.vA;d[c]||(d[c]={key:a,host:b});if(a!==d[c].key){var e,f;a=((e=b.j)==null?void 0:e.name)||((f=b.B)==null?void 0:f.name);throw Error("Hook called out of order in "+a+". Hooks must be invoked unconditionally and in the same order every render. This could happen if you conditionally invoke a hook.");}return d[c]}, Zub=function(a,b){return!a||a.length!==(b==null?void 0:b.length)||a.some(function(c,d){return c!==b[d]})},$ub=function(a,b){var c=Yub("onChange"),d=bub(); Zub(c.eh,b)&&(c.eh=b,c.s0=a,d.qz||(d.qz=[]),d.qz.push(c))},U5=function(a,b){$ub(function(){return $4(null,a)},b)},avb=function(a){o5()?Wub(function(){$4(null,a)}):$ub(function(){return $4(null,a)},[])},cvb=function(a){var b=[].concat(g.qa(a)); a.length=0;a=g.v(b);for(b=a.next();!b.done;b=a.next()){b=b.value;bvb(b);var c=b.s0;b.s0=null;if(c=c==null?void 0:c())b.r0=c}},bvb=function(a){var b=a.r0; a.r0=null;b==null||b()},V5=function(a){var b=[]; if(o5())return a();var c=Yub("useMemoInternal");Zub(c.eh,b)&&(c.eh=b,c.value=a());return c.value},W5=function(){var a=V5(function(){return Xub(function(b){a.value=b; var c=$4(null,function(){}); return function(){c==null||c();a.value=null}})}); return a},dvb=function(a){var b=s5,c=n5.slice(); return{hY:function(){return function(d){b.La||q5(function(){return a(d)},{stack:c})!==!0&&d.stopPropagation()}}}},evb=function(a){if(typeof a.children==="function")return a.children(),null; a=g.v(a.children);for(var b=a.next();!b.done;b=a.next())b=b.value,b();return null},gvb=function(a,b,c){c=c===void 0?!1:c; q5(function(){return fvb(a,b,c)})},fvb=function(a,b,c){c=((c===void 0?0:c)?hvb:ivb)(a,function(){X5(b)}); return c===null?a:c},X5=function(a){if(a!==void 0&&a!==null)if(Array.isArray(a)){a=g.v(a); for(var b=a.next();!b.done;b=a.next())X5(b.value)}else if(a instanceof g.Yd||a instanceof g.ce||a instanceof g.oe)Vtb(a.toString());else if(L5(a)){if(d5()!==a)throw Error("Encountered a real dom node where a vdom node was expected. Real dom nodes should only come from the reactive renderer, and they can't be passed in JSX expressions directly. Tag name: "+a.tagName);g5=d5()}else{var c=typeof a;if(c==="boolean"||c==="number"||c==="string")Vtb(a);else if(typeof a==="function"){b=c5;var d=d5();if(!d|| !d._isSignalTextNode){var e=b.insertBefore,f=document.createTextNode("");Qub(f,a);e.call(b,f,d)}g5=d5()}else{if(typeof a.type==="string"){a.er||Rtb(a.type,a.props.idomKey);b=c5;for(e in a.props)a.props[e]!==jvb&&(f=a.props[e],c=k5,c.push(e),c.push(f));e=p5.attributes;e=e===void 0?kvb:e;f=c5;var h=b5(f);c=e;e=k5;h=h.j||(h.j=Ftb(e.length));for(var l=!h.length||!1,m=0;m0&&(a.props.children=a.children);var d;(d=a.props).idomKey||(d.idomKey=b);if(c){var e=Rtb(c,a.props.idomKey);a.er=!0;var f=e.__instance}f||(f=ovb(b,a.props),f.props=null,e&&(e.__instance=f,f.el=e));var h;c=((h=f.JN)!=null?h:{mR:f.state,xZ:!1}).mR;f.JN=void 0;b.J8&&(c=b.J8(a.props,c));f.props=a.props;f.state=c;h=function(){var l=f;A5.VW(l);var m=l.vy(l.props);m?(l.props.idomKey&&(m.props.idomKey=l.props.idomKey),l=m):l=void 0; if(m=l)if(m.er=a.er,l=X5(m),a.er=m.er,!b.dw)if(l)b.dw=l.tagName.toLowerCase(),l.__instance=f,f.el=l;else{var n;if((n=f.vA)==null?0:n.length){var p;(p=p5.qA)==null||p.call(p5,"unknown",Error("A component used hooks, but failed to return a host element"))}}f.mE();A5.mE(f)}; (c=f.B)?Wtb({component:c,debugInstance:f.props.debugInstance,zm:h}):h()}},mvb=function(a){var b=a.type; if(!b.LA)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(d5()&&((e=d5()[Q5])==null?void 0:e.key)===d){d=d5();c=d[Q5];if(!c)throw Error("Reactive data has been lost on node. Tag name: "+d.tagName);if(!b.V2){var f;(f=c.bsb)==null||f.call(c,a.props);pvb(c);return!0}f=s5;b=b.V2(a.props,c.props,f!==null?f:c.owner,c.P9);f=qvb(b);rvb(a.props,c.props);f>0?X5(b):g5=d5();return!0}(b=Wtb({component:a.type,debugInstance:a.props.debugInstance, zm:function(){return Sub(a.type,a.props)}}))&&svb(b); return!0},qvb=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===C5?b+c.children.length:b+1);return b}if(a.type===C5)return a.children.length}else return 0;return 1},rvb=function(a,b){b&&(b.children=a.children,b.f8=a.f8,b.fallback=a.fallback)},tvb=function(a){for(var b=0;b0&&h(g.BF(w,4)&&!g.BF(w,2)&&!g.BF(w,1024))}} function c(){b(a.J.getPlayerStateObject())} function d(w){b(w.state)} var e=g.v(Bvb(!1)),f=e.next().value,h=e.next().value,l=g.v(Bvb(!1));e=l.next().value;var m=l.next().value,n=W5(),p=Evb(a.J,a.Pe),q=W5();l=wvb();var r=wvb();U5(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.Rv(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]); U5(function(){var w;(w=p.value)==null||w.Ja(n.value)},[p]); var t=a.J;if(f)if(g.Rv(t.getRootNode(),"ytp-expand-pause-overlay",!e),e)l.value.focus();else{var u=p.value;g.d2(u);u.show();q.value.focus()}q.value&&t.logVisibility(q.value,f&&!e);return E5("ytp-pause-overlay",{el:q,class:"ytp-pause-overlay","aria-hidden":!f},E5(Cvb,{J:a.J,Pe:a.Pe,action:function(){m(!0)}}),E5(Dvb,{J:a.J, Pe:a.Pe,action:function(){m(!1)}, UB:l}),E5("div",{el:n,skip:!0}))},Gvb=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.NJ(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"],X:{"aria-label":"Show previous suggested videos"},V:[g.WE()]});this.qa=new g.b2(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"],X:{"aria-label":"Show more suggested videos"},V:[g.XE()]});g.N(this,this.G);a=a.U();this.api.L("embeds_web_enable_pause_overlay_rounding")&&g.Nv(this.element,"ytp-error-overlay-round-corners");this.Y=a.D;g.N(this,this.title);this.title.Ja(this.element);this.suggestions=new g.W({I:"div",S:"ytp-suggestions"});g.N(this,this.suggestions);this.suggestions.Ja(this.element);g.N(this,this.previous);this.previous.Ja(this.element); this.previous.listen("click",this.V4,this);g.N(this,this.qa);for(var c={zA:0};c.zA<16;c={zA:c.zA},c.zA++){var d=new g.W({I:"a",S:"ytp-suggestion-link",X:{href:"{{link}}",target:a.Y,"aria-label":"{{aria_label}}"},V:[{I:"div",S:"ytp-suggestion-image",V:[{I:"div",X:{"data-is-live":"{{is_live}}"},S:"ytp-suggestion-duration",va:"{{duration}}"}]},{I:"div",S:"ytp-suggestion-title",X:{title:"{{hover_title}}"},va:"{{title}}"},{I:"div",S:"ytp-suggestion-author",va:"{{views_or_author}}"}]});g.N(this,d);d.Ja(this.suggestions.element); var e=d.Ga("ytp-suggestion-link");g.Is(e,"transitionDelay",c.zA/20+"s");this.G.T(e,"click",function(f){return function(h){var l=f.zA,m=b.suggestionData[l],n=m.sessionData;g.qR(b.api.U())&&b.api.L("web_player_log_click_before_generating_ve_conversion_params")?(b.api.logClick(b.j[l].element),l=m.jl(),m={},g.CYa(b.api,m,"emb_rel_err"),l=g.to(l,m),g.dU(l,b.api,h)):g.cU(h,b.api,b.Y,n||void 0)&&b.api.ip(m.videoId,n,m.playlistId)}}(c)); this.j.push(d)}g.N(this,this.next);this.next.Ja(this.element);this.next.listen("click",this.U4,this);this.G.T(this.api,"videodatachange",this.onVideoDataChange);this.resize(this.api.ob().getPlayerSize());this.onVideoDataChange();this.show()},Hvb=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)},Ivb=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.Rv(a.element,"ytp-scroll-min",b>=0);g.Rv(a.element,"ytp-scroll-max",b<=c)},Jvb=function(a){for(var b=0;b