(function(g){var window=this;/* Copyright 2017 Google LLC SPDX-License-Identifier: BSD-3-Clause */ 'use strict';var sib=function(a){a.mutedAutoplay=!1;a.endSeconds=NaN;a.limitedPlaybackDurationInSeconds=NaN;g.dR(a)},tib=function(a){g.bp(a); for(var b=0;bb;)a.pop()},uib=function(a){a=Array(a); p4(a,0);return a},vib=function(a,b,c,d){(d[b]||d.__default)(a,b,c)},wib=function(a,b){this.j=null; this.B=a;this.key=b;this.text=void 0},xib=function(a,b,c){b=new wib(b,c); return a.__incrementalDOMData=b},q4=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=xib(a,c,a.nodeType===1?d||b:null);if(a.nodeType===1&&(a=a.attributes,c=a.length)){d=b.j||(b.j=uib(c*2));for(var e=0,f=0;e=0)for(b= g.jp,c=a.nextSibling,d=g.np;d!==null&&d!==a;)e=d.nextSibling,b.insertBefore(d,c),d=e;else g.jp.insertBefore(a,g.np);g.np=a}},zib=function(a,b){yib(a,b); g.jp=g.np;g.np=null;return g.jp},Aib=function(a,b,c,d){r4.push(vib); r4.push(a);r4.push(b);r4.push(c);r4.push(d)},Bib=function(a){yib("#text",null); var b=g.np;var c=q4(b);if(c.text!==a){c=c.text=a;for(var d=1;d0;){d=c.pop();try{d.nz()}finally{a.delete(d)}}}Fib.delete(a)},Iib=function(){var a; g.J(function(b){if(b.j==1)return a=Hib,Hib=new Set,g.G(b,Promise.resolve(),2);Gib(a);g.va(b)})},Jib=function(){return Array.from(Fib).map(function(a){return Array.from(a)})},Kib=function(a){var b=a.component; var c=a.debugInstance;a=a.Bx;var d,e=(d=b.au)!=null?d:b.name;u4.push({name:c?e+" ("+c+")":e,CR:b.componentType!==v4});b=a();u4.pop();return b},w4=function(){var a=u4[u4.length-1]; return a?a.CR||!1:!1},x4=function(a,b){b=b===void 0?{}:b; var c=u4.length;b.stack&&(u4=[].concat(g.x(b.stack)));try{return a()}catch(d){throw a=d,Lib(a),a!==Mib&&(Nib=u4.slice()),Mib=a,a;}finally{c=u4.length-c,c>0&&u4.splice(-c)}},Lib=function(a){var b=u4; if(b.length!==0&&!a.ZE){var c=b.slice(-20).reverse().map(function(d){return d.name}).join(" > "); c=a.message+"\n\nComponent stack: "+c;try{a.ZE=b.slice(),g.tp.O8&&(a.stack&&(a.stack=a.stack.replace(a.message,c)),a.message=c)}catch(d){}}},y4=function(a){var b=s4; if(b){var c=u4.slice();b.oF||(b.oF=[]);b.oF.push(function(){return void x4(function(){return void a()},{stack:c})})}},Pib=function(a){var b=s4; b&&!b.Ia&&(y4(function(){return void Oib(a)}),a.parent=b)},Rib=function(a){if(a.oF){var b={stack:[], error:void 0,hasError:!1};try{g.cb(b,o4(Qib));for(var c=g.w(a.oF),d=c.next();!d.done;d=c.next()){var e=d.value;e()}}catch(f){b.error=f,b.hasError=!0}finally{g.eb(b)}a.oF.length=0}},Oib=function(a){if(!a.Ia){a.Ia=!0; var b;(b=a[Symbol.dispose])==null||b.call(a);delete a.parent;Rib(a)}},Sib=function(){g.bp(this); if(g.$o(this))for(var a=0;a=0;d--)c.removeChild(a[d])}else c.textContent="",c.appendChild(b);return b},ojb=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];l1)throw Error("Script tags can contain at most 1 child. Got "+c.length+": ["+c.map(ljb).join(", ")+"]");c=c[0]}if(c!=null){if(!(c instanceof g.dg)){var f,h;if((f=window)==null?0:(h=f.trustedTypes)==null?0:h.isScript(c))throw Error("Do not use a TrustedScript instance in a script tag directly. Use a SafeScript instead.");if(String(c).trim().length=== 0)break a;throw Error("Script tags must only contain SafeScript or LegacyScript instances. Got: "+ljb(c));}b.textContent=g.eg(c);g.fg(b)}}else{L4(a)&&(a=K4(a),d&&c&&(d[e]=a));M4(a)&&(a=K4(a.toString()),d&&c&&(d[e]=a));if(O4(a))return tjb(b,a);if(Array.isArray(a)){for(f=0;f0&&(b.children=c.length===1?c[0]:c);var f=b;if(a.componentType!==v4)var h=!1;else{f||(f={});h=new U4(f);h.j=a;b:{var l={stack:[],error:void 0,hasError:!1};try{g.cb(l,o4(g.F1));var m=h.jz(f);break b}catch(n){l.error=n,l.hasError=!0}finally{g.eb(l)}m=void 0}f=m;f instanceof HTMLElement?(f.__instance=h,h.el=f,h.B=a,a.Mt=f.tagName.toLowerCase(),V4.kF(h),h=f):h=f}return h=== !1?Ajb(a,b):h}}); var d=document.createElement(a),e;for(e in b)D4(d,e,b[e]);yjb(d,b);R4(c,d);ijb(d,b,{CR:!0});return d},Cjb=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 S4&&(b=a.__instance,xjb(b,a),b instanceof U4&&b.G());for(b=0;b0&&(a.props.children=a.children);var d;(d=a.props).idomKey||(d.idomKey=b);if(c){var e=zib(c,a.props.idomKey);a.Ir=!0;var f=e.__instance}f||(f=Wjb(b,a.props),f.props=null,e&&(e.__instance=f,f.el=e));var h;c=((h=f.CO)!=null?h:{nS:f.state,q_:!1}).nS;f.CO=void 0;b.C9&&(c=b.C9(a.props,c));f.props=a.props;f.state=c;h=function(){var l=f;V4.PX(l);var m=l.jz(l.props);m?(l.props.idomKey&&(m.props.idomKey=l.props.idomKey),l=m):l=void 0; if(m=l)if(m.Ir=a.Ir,l=$4(m),a.Ir=m.Ir,!b.Mt)if(l)b.Mt=l.tagName.toLowerCase(),l.__instance=f,f.el=l;else{var n;if((n=f.aB)==null?0:n.length){var p;(p=g.tp.handleError)==null||p.call.apply(p,[g.tp].concat(g.x(B4(Error("A component used hooks, but failed to return a host element")))))}}f.kF();V4.kF(f)}; (c=f.j)?Kib({component:c,debugInstance:f.props.debugInstance,Bx:h}):h()}},Tjb=function(a){var b=a.type; if(!Vjb(b)||b===Ojb||b.componentType===v4)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(g.kp()&&((e=g.kp()[P4])==null?void 0:e.key)===d){d=g.kp();c=d[P4];if(!c)throw Error("Reactive data has been lost on node. Tag name: "+d.tagName);if(!b.b4){var f;(f=c.Kqa)==null||f.call(c,a.props);Xjb(c);return!0}f=s4;b=b.b4(a.props,c.props,f!==null?f:c.context,c.F$);f=Yjb(b);Zjb(a.props,c.props);f>0?$4(b):g.np=g.kp();return!0}if($jb.has(b.name)&& a.props.allowIdomInterop!==akb)throw Error(b.name+" can not be called from a IDOM component. See go/cow-errors#control-flow-component-called-from-Idom-Component");(b=Kib({component:a.type,debugInstance:a.props.debugInstance,Bx:function(){return Ajb(a.type,a.props)}}))&&bkb(b); return!0},Yjb=function(a){if(a){if(Array.isArray(a)){var b=0; a=g.w(a);for(var c=a.next();!c.done;c=a.next())(c=c.value)&&(b=c.type===G4?b+c.children.length:b+1);return b}if(a.type===G4)return a.children.length}else return 0;return 1},Zjb=function(a,b){b&&(b.children=a.children,b.M8=a.M8,b.fallback=a.fallback)},ckb=function(a){for(var b=0;b0&&h(g.U(y,4)&&!g.U(y,2)&&!g.U(y,1024))}} function c(){b(a.J.getPlayerStateObject())} function d(y){b(y.state)} var e=g.w(kkb(!1)),f=e.next().value,h=e.next().value,l=g.w(kkb(!1));e=l.next().value;var m=l.next().value,n=Z4(),p=nkb(a.J,a.Se),q=Z4();l=fkb();var r=fkb();X4(function(){var y=a.J,A=y.fd()?157212:172777;r.value=new g.O;y.createClientVe(q.value,r.value,A);y.addEventListener("presentingplayerstatechange",d);y.addEventListener("videodatachange",c);A=y.U().controlsType==="0";g.Qp(y.getRootNode(),"ytp-pause-overlay-controls-hidden",A);return function(){y.removeEventListener("videodatachange",c);y.removeEventListener("presentingplayerstatechange", d);var C;(C=r.value)==null||C.dispose()}},[a.J]); X4(function(){var y;(y=p.value)==null||y.Ha(n.value)},[p]); var t=a.J;if(f)if(g.Qp(t.getRootNode(),"ytp-expand-pause-overlay",!e),e)l.value.focus();else{var u=p.value;g.p1(u);u.show();q.value.focus()}q.value&&t.logVisibility(q.value,f&&!e);return W4("ytp-pause-overlay",{el:q,class:"ytp-pause-overlay","aria-hidden":!f},W4(lkb,{J:a.J,Se:a.Se,action:function(){m(!0)}}),W4(mkb,{J:a.J, Se:a.Se,action:function(){m(!1)}, TM:l}),W4("div",{el:n,skip:!0}))},pkb=function(a){g.S.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.jG(this);this.j=[];this.suggestionData=[];this.columns=this.containerWidth=0;this.title=new g.S({I:"h2",S:"ytp-related-title",va:"{{title}}"});this.previous=new g.S({I:"button",La:["ytp-button","ytp-previous"],X:{"aria-label":"Show previous suggested videos"},V:[g.dy()]});this.oa=new g.n1(function(f){b.suggestions.element.scrollLeft=-f}); this.D=this.C=0;this.N=!0;this.next=new g.S({I:"button",La:["ytp-button","ytp-next"],X:{"aria-label":"Show more suggested videos"},V:[g.ey()]});g.P(this,this.G);a=a.U();this.api.L("embeds_web_enable_pause_overlay_rounding")&&g.Mp(this.element,"ytp-error-overlay-round-corners");this.W=a.D;g.P(this,this.title);this.title.Ha(this.element);this.suggestions=new g.S({I:"div",S:"ytp-suggestions"});g.P(this,this.suggestions);this.suggestions.Ha(this.element);g.P(this,this.previous);this.previous.Ha(this.element); this.previous.listen("click",this.p5,this);g.P(this,this.oa);for(var c={eB:0};c.eB<16;c={eB:c.eB},c.eB++){var d=new g.S({I:"a",S:"ytp-suggestion-link",X:{href:"{{link}}",target:a.W,"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.P(this,d);d.Ha(this.suggestions.element); var e=d.Da("ytp-suggestion-link");g.Fm(e,"transitionDelay",c.eB/20+"s");this.G.T(e,"click",function(f){return function(h){var l=f.eB,m=b.suggestionData[l],n=m.sessionData;g.LP(b.api.U())&&b.api.L("web_player_log_click_before_generating_ve_conversion_params")?(b.api.logClick(b.j[l].element),l=m.Pl(),m={},g.aNa(b.api,m),l=g.gj(l,m),g.jT(l,b.api,h)):g.iT(h,b.api,b.W,n||void 0)&&b.api.Hp(m.videoId,n,m.playlistId)}}(c)); this.j.push(d)}g.P(this,this.next);this.next.Ha(this.element);this.next.listen("click",this.o5,this);this.G.T(this.api,"videodatachange",this.onVideoDataChange);this.resize(this.api.ob().getPlayerSize());this.onVideoDataChange();this.show()},qkb=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)},rkb=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.Qp(a.element,"ytp-scroll-min",b>=0);g.Qp(a.element,"ytp-scroll-max",b<=c)},skb=function(a){for(var b=0;b