(function(g){var window=this;/* SPDX-License-Identifier: Apache-2.0 */ /* Copyright 2017 Google LLC SPDX-License-Identifier: BSD-3-Clause */ 'use strict';var otb=function(a){a.mutedAutoplay=!1;a.endSeconds=NaN;a.limitedPlaybackDurationInSeconds=NaN;g.DS(a)},ptb=function(a){g.wv(a); for(var b=0;bb;)a.pop()},vtb=function(a){a=Array(a); e5(a,0);return a},wtb=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)}},ytb=function(a,b,c){a=a.style; if(typeof c==="string")a.cssText=c;else{a.cssText="";for(var d in c)if(xtb.call(c,d)){b=a;var e=d,f=c[d];e.indexOf("-")>=0?b.setProperty(e,f):b[e]=f}}},ztb=function(a,b,c){var d=typeof c; d==="object"||d==="function"?a[b]=c:wtb(a,b,c)},Atb=function(){var a=new utb; a.__default=ztb;a.style=ytb;return a},Btb=function(a,b,c,d){(d[b]||d.__default)(a,b,c)},Ctb=function(a){this.created=[]; this.j=[];this.node=a},Dtb=function(a,b){this.j=null; this.B=a;this.key=b;this.text=void 0},Etb=function(a,b,c){b=new Dtb(b,c); return a.__incrementalDOMData=b},f5=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=Etb(a,c,a.nodeType===1?d||b:null);if(a.nodeType===1&&(a=a.attributes,c=a.length)){d=b.j||(b.j=vtb(c*2));for(var e=0,f=0;e=0)for(b=g5,c=a.nextSibling, d=k5;d!==null&&d!==a;)e=d.nextSibling,b.insertBefore(d,c),d=e;else g5.insertBefore(a,k5);k5=a}},Htb=function(a,b){Gtb(a,b); g5=k5;k5=null;return g5},Jtb=function(a,b){b=b===void 0?{}:b; var c=b.matches===void 0?Ftb:b.matches;return function(d,e,f){var h=i5,l=m5,m=n5,n=o5,p=k5,q=g5,r=l5;m5=d.ownerDocument;i5=new Ctb(d);l5=c;o5=[];k5=null;var t=g5=d.parentNode,u,w=Itb.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=[];n5=t;try{return a(d,e,f)}finally{d=i5,p5&&d.j.length>0&&p5(d.j),m5=l,i5=h,l5=r,o5=n,k5=p,g5=q,n5=m}}},Ktb=function(a,b,c,d){q5.push(Btb); q5.push(a);q5.push(b);q5.push(c);q5.push(d)},Ltb=function(a){Gtb("#text",null); var b=k5;var c=f5(b);if(c.text!==a){c=c.text=a;for(var d=1;d0&&r5.splice(-a)}},Ntb=function(a){var b=r5; if(b.length!==0&&!a[Otb]){b=b.slice(-20).reverse().map(function(c){return c.name}).join(" > "); b=a.message+"\n\nComponent stack: "+b;try{a.stack&&(a.stack=a.stack.replace(a.message,b)),a.message=b,a[Otb]=!0}catch(c){}}},v5=function(a){this.props=a; this.C=!1},x5=function(a,b){var c=w5; w5=a;try{return b()}finally{w5=c}},y5=function(a){var b=w5; if(b&&b!==Ptb){var c=r5.slice();b.cE||(b.cE=[]);b.cE.push(function(){return void u5(function(){return void a()},{stack:c})})}},A5=function(a){var b=!!w5,c=Qtb(b===void 0?!0:b); x5(c,function(){return void a(c)}); return function(){return void z5(c)}},Qtb=function(a){var b={}; (a===void 0||a)&&Rtb(b);return b},Rtb=function(a){var b=w5; b&&(b.Ma||y5(function(){return void z5(a)}))},Stb=function(a){a.cE&&(d5(g.Mlb,function(){for(var b=g.v(a.cE),c=b.next();!c.done;c=b.next())c=c.value,c()}),a.cE=[])},z5=function(a){if(!a.Ma){a.Ma=!0; var b;(b=a.F_)==null||b.call(a);Stb(a)}},Ttb=function(){if(s5())throw Error("Reactive components are not allowed to use useState or other memoization based hooks."); return B5},C5=function(a){v5.call(this,a); var b=this;this.uA=[];this.D=0;this.G=A5(function(c){b.cJ=c;y5(function(){Utb(b,b.el)})})},Utb=function(a,b){if(!a.C&&b){a.C=!0; try{a.YI()}catch(e){var c,d;(d=t5.pA)==null||d.call(t5,(c=a.j)==null?void 0:c.cw,e)}D5.YI(a);a.el=null;b.__instance&&delete b.__instance}},Vtb=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 v5&&(b=a.__instance,Utb(b,a),b instanceof C5&&b.G());for(b=0;b=0;d--)c.removeChild(a[d])}else c.textContent="",c.appendChild(b);return b},aub=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=Fub(a,b);return f===!1?Gub(a,b):f}}); var d=document.createElement(a),e;for(e in b)U5(d,e,b[e]);Dub(d,b);oub(c,d);Bub(d,b,{KA:!0});return d},Fub=function(a,b){if(a.nqb||a.KA)return!1; b||(b={});var c=new C5(b);c.B=a;var d=d5(g.Nlb,function(){return c.sy(b)}); if(!(d instanceof HTMLElement))return d;d.__instance=c;c.el=d;c.j=a;a.cw=d.tagName.toLowerCase();D5.kE(c);return d},Iub=function(a){a=iub(fub,a,!1); fub(a)},Jub=function(a){Iub(function(){d5(null,a)})},Kub=function(a){var b=null,c; return{value:null,Iba:function(d){if(c&&d!==c){var e;(e=b)==null||e();c._disposeRef=void 0}c=d;b=a(d)||null}, wca:function(){var d;(d=b)==null||d()}}},Lub=function(a){var b=Ttb(); 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.uA||(b.uA=[]);var d=b.uA;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]}, Mub=function(a,b){return!a||a.length!==(b==null?void 0:b.length)||a.some(function(c,d){return c!==b[d]})},Nub=function(a,b){var c=Lub("onChange"),d=Ttb(); Mub(c.fh,b)&&(c.fh=b,c.o0=a,d.pz||(d.pz=[]),d.pz.push(c))},V5=function(a,b){Nub(function(){return d5(null,a)},b)},Oub=function(a){s5()?Jub(function(){d5(null,a)}):Nub(function(){return d5(null,a)},[])},Qub=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;Pub(b);var c=b.o0;b.o0=null;if(c=c==null?void 0:c())b.n0=c}},Pub=function(a){var b=a.n0; a.n0=null;b==null||b()},W5=function(a){var b=[]; if(s5())return a();var c=Lub("useMemoInternal");Mub(c.fh,b)&&(c.fh=b,c.value=a());return c.value},X5=function(){var a=W5(function(){return Kub(function(b){a.value=b; var c=d5(null,function(){}); return function(){c==null||c();a.value=null}})}); return a},Rub=function(a){var b=w5,c=r5.slice(); return{cY:function(){return function(d){b.Ma||u5(function(){return a(d)},{stack:c})!==!0&&d.stopPropagation()}}}},Sub=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},Uub=function(a,b,c){c=c===void 0?!1:c; u5(function(){return Tub(a,b,c)})},Tub=function(a,b,c){c=((c===void 0?0:c)?Vub:Wub)(a,function(){Y5(b)}); return c===null?a:c},Y5=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())Y5(b.value)}else if(a instanceof g.Yd||a instanceof g.ce||a instanceof g.oe)Ltb(a.toString());else if(O5(a)){if(h5()!==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);k5=h5()}else{var c=typeof a;if(c==="boolean"||c==="number"||c==="string")Ltb(a);else if(typeof a==="function"){b=g5;var d=h5();if(!d|| !d._isSignalTextNode){var e=b.insertBefore,f=document.createTextNode("");Eub(f,a);e.call(b,f,d)}k5=h5()}else{if(typeof a.type==="string"){a.Zq||Htb(a.type,a.props.idomKey);b=g5;for(e in a.props)a.props[e]!==Xub&&(f=a.props[e],c=o5,c.push(e),c.push(f));e=t5.attributes;e=e===void 0?Yub:e;f=g5;var h=f5(f);c=e;e=o5;h=h.j||(h.j=vtb(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=Htb(c,a.props.idomKey);a.Zq=!0;var f=e.__instance}f||(f=bvb(b,a.props),f.props=null,e&&(e.__instance=f,f.el=e));var h;c=((h=f.FN)!=null?h:{iR:f.state,rZ:!1}).iR;f.FN=void 0;b.J8&&(c=b.J8(a.props,c));f.props=a.props;f.state=c;h=function(){var l=f;D5.PW(l);var m=l.sy(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=Y5(m),a.Zq=m.Zq,!b.cw)if(l)b.cw=l.tagName.toLowerCase(),l.__instance=f,f.el=l;else{var n;if((n=f.uA)==null?0:n.length){var p;(p=t5.pA)==null||p.call(t5,"unknown",Error("A component used hooks, but failed to return a host element"))}}f.kE();D5.kE(f)}; (c=f.B)?Mtb({component:c,debugInstance:f.props.debugInstance,ym:h}):h()}},$ub=function(a){var b=a.type; if(!b.KA)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(h5()&&((e=h5()[R5])==null?void 0:e.key)===d){d=h5();c=d[R5];if(!c)throw Error("Reactive data has been lost on node. Tag name: "+d.tagName);if(!b.T2){var f;(f=c.Trb)==null||f.call(c,a.props);cvb(c);return!0}f=w5;b=b.T2(a.props,c.props,f!==null?f:c.owner,c.P9);f=dvb(b);evb(a.props,c.props);f>0?Y5(b):k5=h5();return!0}(b=Mtb({component:a.type,debugInstance:a.props.debugInstance, ym:function(){return Gub(a.type,a.props)}}))&&fvb(b); return!0},dvb=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===F5?b+c.children.length:b+1);return b}if(a.type===F5)return a.children.length}else return 0;return 1},evb=function(a,b){b&&(b.children=a.children,b.g8=a.g8,b.fallback=a.fallback)},gvb=function(a){for(var b=0;b0&&h(g.HF(w,4)&&!g.HF(w,2)&&!g.HF(w,1024))}} function c(){b(a.J.getPlayerStateObject())} function d(w){b(w.state)} var e=g.v(ovb(!1)),f=e.next().value,h=e.next().value,l=g.v(ovb(!1));e=l.next().value;var m=l.next().value,n=X5(),p=rvb(a.J,a.Re),q=X5();l=jvb();var r=jvb();V5(function(){var w=a.J,A=w.fd()?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.Xv(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]); V5(function(){var w;(w=p.value)==null||w.Ja(n.value)},[p]); var t=a.J;if(f)if(g.Xv(t.getRootNode(),"ytp-expand-pause-overlay",!e),e)l.value.focus();else{var u=p.value;g.h2(u);u.show();q.value.focus()}q.value&&t.logVisibility(q.value,f&&!e);return H5("ytp-pause-overlay",{el:q,class:"ytp-pause-overlay","aria-hidden":!f},H5(pvb,{J:a.J,Re:a.Re,action:function(){m(!0)}}),H5(qvb,{J:a.J, Re:a.Re,action:function(){m(!1)}, SB:l}),H5("div",{el:n,skip:!0}))},tvb=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.TJ(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.bF()]});this.qa=new g.f2(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.cF()]});g.M(this,this.G);a=a.U();this.api.L("embeds_web_enable_pause_overlay_rounding")&&g.Tv(this.element,"ytp-error-overlay-round-corners");this.Y=a.D;g.M(this,this.title);this.title.Ja(this.element);this.suggestions=new g.W({I:"div",S:"ytp-suggestions"});g.M(this,this.suggestions);this.suggestions.Ja(this.element);g.M(this,this.previous);this.previous.Ja(this.element); this.previous.listen("click",this.R4,this);g.M(this,this.qa);for(var c={yA:0};c.yA<16;c={yA:c.yA},c.yA++){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.M(this,d);d.Ja(this.suggestions.element); var e=d.Ga("ytp-suggestion-link");g.Js(e,"transitionDelay",c.yA/20+"s");this.G.T(e,"click",function(f){return function(h){var l=f.yA,m=b.suggestionData[l],n=m.sessionData;g.wR(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.wYa(b.api,m,"emb_rel_err"),l=g.uo(l,m),g.iU(l,b.api,h)):g.hU(h,b.api,b.Y,n||void 0)&&b.api.ip(m.videoId,n,m.playlistId)}}(c)); this.j.push(d)}g.M(this,this.next);this.next.Ja(this.element);this.next.listen("click",this.Q4,this);this.G.T(this.api,"videodatachange",this.onVideoDataChange);this.resize(this.api.qb().getPlayerSize());this.onVideoDataChange();this.show()},uvb=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)},vvb=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.Xv(a.element,"ytp-scroll-min",b>=0);g.Xv(a.element,"ytp-scroll-max",b<=c)},wvb=function(a){for(var b=0;b