(function(g){var window=this;/* SPDX-License-Identifier: Apache-2.0 */ /* Copyright 2017 Google LLC SPDX-License-Identifier: BSD-3-Clause */ 'use strict';var mgb=function(a){a.mutedAutoplay=!1;a.endSeconds=NaN;a.limitedPlaybackDurationInSeconds=NaN;g.WQ(a)},ngb=function(a){g.Po(a); for(var b=0;bb;)a.pop()},tgb=function(a){a=Array(a); a4(a,0);return a},ugb=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)}},wgb=function(a,b,c){a=a.style; if(typeof c==="string")a.cssText=c;else{a.cssText="";for(var d in c)if(vgb.call(c,d)){b=a;var e=d,f=c[d];e.indexOf("-")>=0?b.setProperty(e,f):b[e]=f}}},xgb=function(a,b,c){var d=typeof c; d==="object"||d==="function"?a[b]=c:ugb(a,b,c)},ygb=function(){var a=new sgb; a.__default=xgb;a.style=wgb;return a},zgb=function(a,b,c,d){(d[b]||d.__default)(a,b,c)},Agb=function(a){this.created=[]; this.j=[];this.node=a},Bgb=function(a,b){this.j=null; this.B=a;this.key=b;this.text=void 0},Cgb=function(a,b,c){b=new Bgb(b,c); return a.__incrementalDOMData=b},b4=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=Cgb(a,c,a.nodeType===1?d||b:null);if(a.nodeType===1&&(a=a.attributes,c=a.length)){d=b.j||(b.j=tgb(c*2));for(var e=0,f=0;e=0)for(b=c4,c=a.nextSibling, d=g4;d!==null&&d!==a;)e=d.nextSibling,b.insertBefore(d,c),d=e;else c4.insertBefore(a,g4);g4=a}},Fgb=function(a,b){Egb(a,b); c4=g4;g4=null;return c4},Hgb=function(a,b){b=b===void 0?{}:b; var c=b.matches===void 0?Dgb:b.matches;return function(d,e,f){var h=e4,l=i4,m=j4,n=k4,p=g4,q=c4,r=h4;i4=d.ownerDocument;e4=new Agb(d);h4=c;k4=[];g4=null;var t=c4=d.parentNode,u,x=Ggb.call(d);if((u=x.nodeType===11||x.nodeType===9?x.activeElement:null)&&d.contains(u)){for(x=[];u!==t;)x.push(u),u=u.parentNode||(t?u.host:null);t=x}else t=[];j4=t;try{return a(d,e,f)}finally{d=e4,l4&&d.j.length>0&&l4(d.j),i4=l,e4=h,h4=r,k4=n,g4=p,c4=q,j4=m}}},Igb=function(a,b,c,d){m4.push(zgb); m4.push(a);m4.push(b);m4.push(c);m4.push(d)},Jgb=function(a){Egb("#text",null); var b=g4;var c=b4(b);if(c.text!==a){c=c.text=a;for(var d=1;d0&&n4.splice(-a)}},Lgb=function(a){var b=n4; if(b.length!==0&&!a.dJ){var c=b.slice(-20).reverse().map(function(d){return d.name}).join(" > "); c=a.message+"\n\nComponent stack: "+c;try{a.dJ=b.slice(),q4.U7&&(a.stack&&(a.stack=a.stack.replace(a.message,c)),a.message=c)}catch(d){}}},s4=function(a){var b=r4; if(b&&b!==Mgb&&!b[Ngb]){var c=n4.slice();b.AE||(b.AE=[]);b.AE.push(function(){return void p4(function(){return void a()},{stack:c})})}},Pgb=function(a){var b=r4; b&&!b.Ma&&(s4(function(){return void Ogb(a)}),a.parent=b)},Qgb=function(a){a.AE&&($3(g.N$a,function(){for(var b=g.v(a.AE),c=b.next();!c.done;c=b.next())c=c.value,c()}),a.AE.length=0)},Ogb=function(a){if(!a.Ma){a.Ma=!0; var b;(b=a[t4])==null||b.call(a);delete a.parent;Qgb(a)}},u4=function(a,b){var c=r4; r4=a;try{return b()}finally{r4=c}},v4=function(a){var b=!!r4,c={}; (b===void 0||b)&&Pgb(c);u4(c,function(){return void a(c)}); return function(){return void Ogb(c)}},Rgb=function(a){for(var b=g.v(a),c=b.next();!c.done;c=b.next())c=c.value,a.delete(c),w4(c)},Sgb=function(){ogb(this); x4.delete(this);Ogb(this)},Tgb=function(a){a.Ma||x4.add(a)},Ugb=function(a){return g.H(function(b){if(b.j==1)return a.Ma?b.return():g.G(b,Promise.resolve(),2); w4(a);g.va(b)})},w4=function(a){if(a.LS!==null&&!a.Ma){if(g.Ko)throw Error("Schedulers cannot synchronously execute effects while scheduling."); a.jl=!1;if(!a.tF||ngb(a)){a.tF=!0;Vgb++;Qgb(a);var b=r4;r4=a;var c=g.Lo(a);try{p4(a.LS,{stack:a.dJ})}finally{g.Oo(a,c),r4=b}}}},Wgb=function(a){for(var b=g.v(a),c=b.next();!c.done;c=b.next())c=c.value,a.delete(c),c.Js()},Xgb=function(a){a.Ma||y4.add(a)},Ygb=function(a){return g.H(function(b){if(b.j==1)return a.Ma?b.return():g.G(b,Promise.resolve(),2); a.Js();g.va(b)})},$gb=function(a,b,c){function d(){return void p4(b,{stack:e})} Zgb++;var e=n4.slice(),f=pgb(function(){f.Ma||(Vgb++,Qgb(f),u4(f,d))},function(){return void a(f)},c===void 0?!1:c); f.DZ=!0;Pgb(f);f[t4]=function(){f.destroy();y4.delete(f)}; return f},ahb=function(a,b,c,d){d=d===void 0?!1:d; q4.RM?(Zgb++,b=Object.create(b),b.dJ=n4.slice(),b.LS=a,Pgb(b),a=b):a=$gb(c,a,d);return a},chb=function(a){a=ahb(a,bhb,Ygb); q4.RM?Ugb(a):Ygb(a)},fhb=function(a,b,c){if(Object.hasOwnProperty.call(dhb,a)&&(a=dhb[a],Object.hasOwnProperty.call(a,b)&&(a=a[b],a instanceof Array))){for(var d=null,e=!1,f=0,h=a.length;f=0;d--)c.removeChild(a[d])}else c.textContent="",c.appendChild(b);return b},yhb=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=Hhb(a,b);return f===!1?Ihb(a,b):f}}); var d=document.createElement(a),e;for(e in b)z4(d,e,b[e]);Fhb(d,b);R4(c,d);ohb(d,b,{QA:!0});return d},Hhb=function(a,b){if(a.hoa||a.QA)return!1; b||(b={});var c=new C4(b);c.B=a;var d=$3(g.O$a,function(){return c.Dy(b)}); if(!(d instanceof HTMLElement))return d;d.__instance=c;c.el=d;c.j=a;a.qw=d.tagName.toLowerCase();D4.wE(c);return d},Khb=function(a){chb(function(){$3(null,a)})},Lhb=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 A4&&(b=a.__instance,qhb(b,a),b instanceof C4&&b.G());for(b=0;b0&&(a.props.children=a.children);var d;(d=a.props).idomKey||(d.idomKey=b);if(c){var e=Fgb(c,a.props.idomKey);a.lr=!0;var f=e.__instance}f||(f=gib(b,a.props),f.props=null,e&&(e.__instance=f,f.el=e));var h;c=((h=f.QN)!=null?h:{uR:f.state,BZ:!1}).uR;f.QN=void 0;b.z8&&(c=b.z8(a.props,c));f.props=a.props;f.state=c;h=function(){var l=f;D4.YW(l);var m=l.Dy(l.props);m?(l.props.idomKey&&(m.props.idomKey=l.props.idomKey),l=m):l=void 0; if(m=l)if(m.lr=a.lr,l=W4(m),a.lr=m.lr,!b.qw)if(l)b.qw=l.tagName.toLowerCase(),l.__instance=f,f.el=l;else{var n;if((n=f.AA)==null?0:n.length){var p;(p=q4.vA)==null||p.call(q4,"unknown",Error("A component used hooks, but failed to return a host element"))}}f.wE();D4.wE(f)}; (c=f.B)?Kgb({component:c,debugInstance:f.props.debugInstance,Cm:h}):h()}},eib=function(a){var b=a.type; if(!b.QA)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(d4()&&((e=d4()[P4])==null?void 0:e.key)===d){d=d4();c=d[P4];if(!c)throw Error("Reactive data has been lost on node. Tag name: "+d.tagName);if(!b.n3){var f;(f=c.Gpa)==null||f.call(c,a.props);hib(c);return!0}f=r4;b=b.n3(a.props,c.props,f!==null?f:c.context,c.E9);f=iib(b);jib(a.props,c.props);f>0?W4(b):g4=d4();return!0}if(kib.has(b.name)&&a.props.allowIdomInterop!==lib)throw Error(b.name+ " can not be called from a IDOM component. See go/cow-errors#control-flow-component-called-from-Idom-Component");(b=Kgb({component:a.type,debugInstance:a.props.debugInstance,Cm:function(){return Ihb(a.type,a.props)}}))&&mib(b); return!0},iib=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===F4?b+c.children.length:b+1);return b}if(a.type===F4)return a.children.length}else return 0;return 1},jib=function(a,b){b&&(b.children=a.children,b.S7=a.S7,b.fallback=a.fallback)},nib=function(a){for(var b=0;b0&&h(g.U(x,4)&&!g.U(x,2)&&!g.U(x,1024))}} function c(){b(a.J.getPlayerStateObject())} function d(x){b(x.state)} var e=g.v(vib(!1)),f=e.next().value,h=e.next().value,l=g.v(vib(!1));e=l.next().value;var m=l.next().value,n=V4(),p=yib(a.J,a.Ne),q=V4();l=qib();var r=qib();T4(function(){var x=a.J,B=x.Zc()?157212:172777;r.value=new g.K;x.createClientVe(q.value,r.value,B);x.addEventListener("presentingplayerstatechange",d);x.addEventListener("videodatachange",c);B=x.U().controlsType==="0";g.rp(x.getRootNode(),"ytp-pause-overlay-controls-hidden",B);return function(){x.removeEventListener("videodatachange",c);x.removeEventListener("presentingplayerstatechange", d);var E;(E=r.value)==null||E.dispose()}},[a.J]); T4(function(){var x;(x=p.value)==null||x.Ja(n.value)},[p]); var t=a.J;if(f)if(g.rp(t.getRootNode(),"ytp-expand-pause-overlay",!e),e)l.value.focus();else{var u=p.value;g.f1(u);u.show();q.value.focus()}q.value&&t.logVisibility(q.value,f&&!e);return S4("ytp-pause-overlay",{el:q,class:"ytp-pause-overlay","aria-hidden":!f},S4(wib,{J:a.J,Ne:a.Ne,action:function(){m(!0)}}),S4(xib,{J:a.J, Ne:a.Ne,action:function(){m(!1)}, aC:l}),S4("div",{el:n,skip:!0}))},Aib=function(a){g.T.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.EF(this);this.j=[];this.suggestionData=[];this.columns=this.containerWidth=0;this.title=new g.T({I:"h2",S:"ytp-related-title",va:"{{title}}"});this.previous=new g.T({I:"button",La:["ytp-button","ytp-previous"],W:{"aria-label":"Show previous suggested videos"},V:[g.yy()]});this.qa=new g.d1(function(f){b.suggestions.element.scrollLeft=-f}); this.D=this.C=0;this.N=!0;this.next=new g.T({I:"button",La:["ytp-button","ytp-next"],W:{"aria-label":"Show more suggested videos"},V:[g.zy()]});g.Q(this,this.G);a=a.U();this.api.L("embeds_web_enable_pause_overlay_rounding")&&g.np(this.element,"ytp-error-overlay-round-corners");this.Y=a.D;g.Q(this,this.title);this.title.Ja(this.element);this.suggestions=new g.T({I:"div",S:"ytp-suggestions"});g.Q(this,this.suggestions);this.suggestions.Ja(this.element);g.Q(this,this.previous);this.previous.Ja(this.element); this.previous.listen("click",this.s4,this);g.Q(this,this.qa);for(var c={EA:0};c.EA<16;c={EA:c.EA},c.EA++){var d=new g.T({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.Q(this,d);d.Ja(this.suggestions.element); var e=d.Ea("ytp-suggestion-link");g.km(e,"transitionDelay",c.EA/20+"s");this.G.T(e,"click",function(f){return function(h){var l=f.EA,m=b.suggestionData[l],n=m.sessionData;g.EP(b.api.U())&&b.api.L("web_player_log_click_before_generating_ve_conversion_params")?(b.api.logClick(b.j[l].element),l=m.xl(),m={},g.BMa(b.api,m,"emb_rel_err"),l=g.aj(l,m),g.bT(l,b.api,h)):g.aT(h,b.api,b.Y,n||void 0)&&b.api.mp(m.videoId,n,m.playlistId)}}(c)); this.j.push(d)}g.Q(this,this.next);this.next.Ja(this.element);this.next.listen("click",this.r4,this);this.G.T(this.api,"videodatachange",this.onVideoDataChange);this.resize(this.api.qb().getPlayerSize());this.onVideoDataChange();this.show()},Bib=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)},Cib=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.rp(a.element,"ytp-scroll-min",b>=0);g.rp(a.element,"ytp-scroll-max",b<=c)},Dib=function(a){for(var b=0;b