; (self.AMP=self.AMP||[]).push({m:1,v:"2406131415000",n:"amp-youtube",ev:"0.1",l:!0,f:function(t,i){(()=>{var i;function n(){return i||(i=Promise.resolve(void 0))}var e=class{constructor(){this.promise=new Promise(((t,i)=>{this.resolve=t,this.reject=i}))}};function s(t){return new Promise((i=>{i(t())}))}var{isArray:o}=Array;function r(t){return o(t)?t:[t]}var{hasOwnProperty:a,toString:l}=Object.prototype;function h(t){return"[object Object]"===l.call(t)}function u(t){const i=Object.create(null);return t&&Object.assign(i,t),i}function c(t){return"number"==typeof t&&isFinite(t)}function d(t,i,n,e,s,o,r,a,l,h,u){return t}function f(t,i){try{return function(t){return JSON.parse(t)}(t)}catch(t){return null==i||i(t),null}}function m(t){return(t.ownerDocument||t).defaultView}var p,v,_={bubbles:!0,cancelable:!0};function g(t){var i;null===(i=t.parentElement)||void 0===i||i.removeChild(t)}function P(t,i,n,e){const s=n||{};d(t.ownerDocument);const{bubbles:o,cancelable:r}=e||_,a=new MessageEvent(i,{data:s,bubbles:o,cancelable:r});t.dispatchEvent(a)}function A(t,i){t.classList.add("i-amphtml-fill-content"),i&&t.classList.add("i-amphtml-replaced-content")}function y(t,i,n,e){const s=r(t);for(const t of s){const s=i.getAttribute(t);null!==s?n.setAttribute(t,s):e&&n.removeAttribute(t)}}function b(t){const i=t.ownerDocument||t;return p&&p.ownerDocument===i||(p=i.createElement("div")),M}function M(t){return function(t,i){if(d(1===i.length),d(Array.isArray(i)||(n=i,a.call(n,"raw"))),self.trustedTypes&&self.trustedTypes.createPolicy){const n=self.trustedTypes.createPolicy("static-template#createNode",{createHTML:function(t){return i[0]}});t.innerHTML=n.createHTML("ignored")}else t.innerHTML=i[0];var n;const e=t.firstElementChild;return d(e),d(!e.nextElementSibling),t.removeChild(e),e}(p,t)}function w(t){const i=Object.getOwnPropertyDescriptor(t,"message");if(null!=i&&i.writable)return t;const{message:n,stack:e}=t,s=new Error(n);for(const i in t)s[i]=t[i];return s.stack=e,s}function E(t){let i=null,n="";for(const t of arguments)t instanceof Error&&!i?i=w(t):(n&&(n+=" "),n+=t);return i?n&&(i.message=n+": "+i.message):i=new Error(n),i}function I(t){var i,n;null===(i=(n=self).__AMP_REPORT_ERROR)||void 0===i||i.call(n,t)}function R(t,...i){try{return t.apply(null,i)}catch(t){!function(t){const i=E.apply(null,arguments);setTimeout((()=>{throw I(i),i}))}(t)}}function T(t){const i=E.apply(null,arguments);return i.expected=!0,i}function V(t,...i){I(T.apply(null,i))}var k=["Webkit","webkit","Moz","moz","ms","O","o"],C={"getPropertyPriority":()=>"","getPropertyValue":()=>""};function S(t,i,n,e,s){const o=function(t,i,n){if(i.startsWith("--"))return i;v||(v=u());let e=v[i];if(!e||n){if(e=i,void 0===t[i]){const n=function(t){return t.charAt(0).toUpperCase()+t.slice(1)}(i),s=function(t,i){for(let n=0;n"-"+t.toLowerCase()));return k.some((t=>i.startsWith(t+"-")))?`-${i}`:i}(o),r)}function x(t,i){for(const n in i)S(t,n,i[n])}var q=/vertical/,O=new WeakMap,$=new WeakMap,F=new WeakMap;function j(t){let i=O.get(t);return i||(i=new t.ResizeObserver(U),O.set(t,i)),i}function U(t){const i=new Set;for(let n=t.length-1;n>=0;n--){const e=t[n],{target:s}=e;if(i.has(s))continue;i.add(s);const o=$.get(s);if(o){F.set(s,e);for(let t=0;t0?t[0]:{inlineSize:0,blockSize:0};else{const{target:t}=n,i=m(t),s=q.test(function(t,i){return t.getComputedStyle(i)||C}(i,t).writingMode),{offsetHeight:o,offsetWidth:r}=t;let a,l;s?(l=r,a=o):(a=r,l=o),e={inlineSize:a,blockSize:l}}R(i,e)}}function z(t){let i=!1,n=null,e=t;return(...t)=>(i||(n=e.apply(self,t),i=!0,e=null),n)}self.__AMP_LOG=self.__AMP_LOG||{user:null,dev:null,userForEmbed:null};var N=self.__AMP_LOG;function D(t){return N.user||(N.user=L()),function(t,i){return i&&i.ownerDocument.defaultView!=t}(N.user.win,t)?N.userForEmbed||(N.userForEmbed=L()):N.user}function L(t){return function(t,i){throw new Error("failed to call initLogConstructor")}()}function B(t,i,n,e,s,o,r,a,l,h,u){return t}function W(t,i,n,e,s,o,r,a,l,h,u){return D().assert(t,i,n,e,s,o,r,a,l,h,u)}function J(t,i){return Q(t=function(t){return t.__AMP_TOP||(t.__AMP_TOP=t)}(t),i)}function H(t,i){return Q(K(G(t)),i)}function Z(t,i){const n=K(G(t));return tt(n,i)?Q(n,i):null}function G(t){return t.nodeType?(i=m(t),J(i,"ampdoc")).getAmpDoc(t):t;var i}function K(t){const i=G(t);return i.isSingleDoc()?i.win:i}function Q(t,i){B(tt(t,i));const n=X(t)[i];return n.obj||(B(n.ctor),B(n.context),n.obj=new n.ctor(n.context),B(n.obj),n.context=null,n.resolve&&n.resolve(n.obj)),n.obj}function X(t){let i=t.__AMP_SERVICES;return i||(i=t.__AMP_SERVICES={}),i}function tt(t,i){const n=t.__AMP_SERVICES&&t.__AMP_SERVICES[i];return!(!n||!n.ctor)}var it,nt,et,st=t=>Z(t,"action"),ot=t=>J(t,"platform"),rt=t=>Q(t,"timer"),at=t=>Z(t,"url"),lt=t=>H(t,"viewport");function ht(t,i,n={}){const{needsRootBounds:e,rootMargin:s,threshold:o}=n,r=function(t){return t.parent&&t.parent!=t}(i)&&(e||s)?i.document:void 0;return new i.IntersectionObserver(t,{threshold:o,root:r,rootMargin:s})}function ut(t){var i;let n=null===(i=it)||void 0===i?void 0:i.get(t);if(!n){const i=function(t){it||(it=new WeakMap,nt=new WeakMap),d(nt);let i=nt.get(t);return i||(i=ht((t=>{const n=new Set;for(let s=t.length-1;s>=0;s--){var e;const{target:o}=t[s];n.has(o)||(n.add(o),d(i),i.unobserve(o),d(it),null===(e=it.get(o))||void 0===e||e.resolve(t[s]),it.delete(o))}}),t,{needsRootBounds:!0}),nt.set(t,i)),i}(m(t));d(it),i.observe(t),n=new e,it.set(t,n)}return n.promise}function ct(t){return null==t.__AMP_AUTOPLAY&&(t.__AMP_AUTOPLAY=function(t){const i=t.document.createElement("video");var n;return i.setAttribute("muted",""),i.setAttribute("playsinline",""),i.setAttribute("webkit-playsinline",""),i.setAttribute("height","0"),i.setAttribute("width","0"),i.muted=!0,i.playsInline=!0,i.playsinline=!0,i.webkitPlaysinline=!0,x(i,{position:"fixed",top:"0",width:"0",height:"0",opacity:"0"}),n=i,s((()=>n.play())).catch((()=>{})),Promise.resolve(!i.paused)}(t)),t.__AMP_AUTOPLAY}function dt(t){return t.querySelector("video, iframe")}function ft(t,i){const n=s((()=>t.play(!!i)));return n.catch((t=>{V(0,t)})),n}function mt(t,i,n,e){let s=t,o=n,r=t=>{try{return o(t)}catch(t){var i,n;throw null===(i=(n=self).__AMP_REPORT_ERROR)||void 0===i||i.call(n,t),t}};const a=function(){if(void 0!==et)return et;et=!1;try{const t={get capture(){return et=!0,!1}};self.addEventListener("test-options",null,t),self.removeEventListener("test-options",null,t)}catch(t){}return et}(),l=!(null==e||!e.capture);return s.addEventListener(i,r,a?e:l),()=>{null==s||s.removeEventListener(i,r,a?e:l),o=null,s=null,r=null}}function pt(t,i,n,e){const s={detail:n};return Object.assign(s,e),new t.CustomEvent(i,s)}function vt(t,i,n,e){return mt(t,i,n,e)}function _t(t){return t.data}var gt=[''],Pt=["
"];function At(t,i,n){if(i[n])return i[n];const e=t.querySelector(`style[${n}], link[${n}]`);return e?(i[n]=e,e):null}function yt(t,i){const n=t.styleSheets;for(let t=0;t{this.remove(t)}}remove(t){this.Vt&&function(t,i){const n=t.indexOf(i);-1!=n&&t.splice(n,1)}(this.Vt,t)}removeAll(){this.Vt&&(this.Vt.length=0)}fire(t){if(this.Vt)for(const i of this.Vt.slice())i(t)}getHandlerCount(){var t,i;return null!==(t=null===(i=this.Vt)||void 0===i?void 0:i.length)&&void 0!==t?t:0}}}onSessionEnd(t){this.iP.add(t)}beginSession(){this.tP=!0}endSession(){this.tP&&this.iP.fire(),this.tP=!1}isSessionActive(){return this.tP}},Mt={"title":"","artist":"","album":"","artwork":[{"src":""}]},wt="registered",Et="load",It="playing",Rt="pause",Tt="ended",Vt="muted",kt="unmuted",Ct="ad_start",St="ad_end",xt="playing_manual",qt="paused",Ot="video-play",$t="user-interacted";function Ft(t){t.signals().signal($t)}var jt="video-manager",Ut=(t,i)=>!!t&&(t.video===i||t.video.element===i);function Yt(t,i){const n=i.top+i.height/2,e=t.getSize().height/2;return Math.abs(n-e)}function zt(t){return 10*t*5}var Nt=t=>!!t&&!isNaN(t)&&t>1;function Dt(t,i,n){const{video:e}=t;t.getAnalyticsDetails().then((t=>{n&&Object.assign(t,n),P(e.element,i,t)}))}function Lt(t){!function(t,i,e,s){const r=G(t),a=K(r);!function(t,i,n,e,s,o){const r=X(t);let a=r[n];a||(a=r[n]={obj:null,promise:null,resolve:null,reject:null,context:null,ctor:null,sharedInstance:!1}),a.ctor||(a.ctor=e,a.context=i,a.sharedInstance=!1,a.resolve&&Q(t,n))}(a,r,i,class{constructor(t){this.ampdoc=t,this.installAutoplayStyles=z((()=>function(t){!function(t,i,n,e,s){const o=t.getHeadNode(),r=function(t,i,n,e){let s=t.__AMP_CSS_SM;s||(s=t.__AMP_CSS_SM=u());const o=!n&&e&&"amp-custom"!=e&&"amp-keyframes"!=e,r=n?"amp-runtime":o?`amp-extension=${e}`:null;if(r){const n=At(t,s,r);if(n)return"STYLE"==n.tagName&&n.textContent!==i&&(n.textContent=i),n}const a=(t.ownerDocument||t).createElement("style");a.textContent=i;let l=null;return n?a.setAttribute("amp-runtime",""):o?(a.setAttribute("amp-extension",e||""),l=At(t,s,"amp-runtime")):(e&&a.setAttribute(e,""),l=t.lastChild),function(t,i,n=null){if(!n)return void function(t,i){t.insertBefore(i,t.firstChild)}(t,i);const e=n.nextSibling;t.insertBefore(i,e)}(t,a,l),r&&(s[r]=a),a}(o,function(t,i){const n=t.__AMP_CSS_TR;return n?n(i):i}(o,i),e||!1,s||null);if(n){const i=t.getRootNode();if(yt(i,r))return n(r),r;const e=setInterval((()=>{yt(i,r)&&(clearInterval(e),n(r))}),4)}}(t,".i-amphtml-video-mask{display:block;z-index:1;-webkit-appearance:none;appearance:none;background:transparent;border:none}.amp-video-eq{display:none}.i-amphtml-video-interface:not(amp-video) .amp-video-eq,amp-story .amp-video-eq,amp-video[controls] .amp-video-eq{display:-ms-flexbox;display:flex}[noaudio] .amp-video-eq{display:none!important}.amp-video-eq{pointer-events:none!important;-ms-flex-align:end;align-items:flex-end;bottom:7px;height:12px;opacity:0.8;overflow:hidden;position:absolute;right:7px;width:20px;z-index:1}.amp-video-eq-col{-ms-flex:1;flex:1;height:100%;margin-right:1px;position:relative}.amp-video-eq-col div{animation-name:amp-video-eq-animation;animation-timing-function:linear;animation-iteration-count:infinite;animation-direction:alternate;background-color:#fafafa;height:100%;position:absolute;width:100%;will-change:transform;animation-play-state:paused}.amp-video-eq-play .amp-video-eq-col div{animation-play-state:running}.amp-video-eq-1-1{animation-duration:0.3s;transform:translateY(60%)}.amp-video-eq-1-2{animation-duration:0.45s;transform:translateY(60%)}.amp-video-eq-2-1{animation-duration:0.5s;transform:translateY(30%)}.amp-video-eq-2-2{animation-duration:0.4s;transform:translateY(30%)}.amp-video-eq-3-1{animation-duration:0.3s;transform:translateY(70%)}.amp-video-eq-3-2{animation-duration:0.35s;transform:translateY(70%)}.amp-video-eq-4-1{animation-duration:0.4s;transform:translateY(50%)}.amp-video-eq-4-2{animation-duration:0.25s;transform:translateY(50%)}@keyframes amp-video-eq-animation{0%{transform:translateY(100%)}to{transform:translateY(0)}}\n/*# sourceURL=/css/video-autoplay.css*/",null,!1,"amp-video-autoplay")}(this.ampdoc))),this.nP=null,this.eP=null,this.sP=null,this.Re=rt(t.win),this.oP=st(t.getHeadNode()),this.rP=()=>this.aP(),this.lP=z((()=>new class{constructor(t,i){this.hP=i,this.Ni=t,this.uP=null,this.cP=null,this.nP=[],this.P_=[],this.dP=()=>this.fP(),this.mP=t=>this.pP(t)==xt,this.vP=(t,i)=>this._P(t,i),this.gP(),this.PP()}dispose(){this.P_.forEach((t=>t())),this.P_.length=0}register(t){const{video:i}=t,{element:n}=i;this.AP(n)&&(this.nP.push(i),vt(n,Rt,this.dP),vt(n,It,this.dP),vt(n,Tt,this.dP),i.signals().whenSignal($t).then(this.dP),this.fP())}PP(){const t=this.Ni.getRootNode(),i=()=>this.yP();this.P_.push(vt(t,"webkitfullscreenchange",i),vt(t,"mozfullscreenchange",i),vt(t,"fullscreenchange",i),vt(t,"MSFullscreenChange",i))}isInLandscape(){return(t=this.Ni.win).screen&&"orientation"in t.screen?t.screen.orientation.type.startsWith("landscape"):90==Math.abs(t.orientation);var t}AP(t){if("video"==dt(t).tagName.toLowerCase())return!0;const i=ot(this.Ni.win);return!i.isIos()&&!i.isSafari()||function(t){return!!{"amp-dailymotion":!0,"amp-ima-video":!0}[t.tagName.toLowerCase()]}(t)}yP(){this.uP=null}gP(){const{win:t}=this.Ni,{screen:i}=t;if(i&&"orientation"in i){const t=i.orientation;this.P_.push(vt(t,"change",(()=>this.bP())))}this.P_.push(vt(t,"orientationchange",(()=>this.bP())))}bP(){this.isInLandscape()?null!=this.cP&&this.MP(this.cP):this.uP&&this.EP(this.uP)}MP(t){const i=ot(this.Ni.win);this.uP=t,i.isAndroid()&&i.isChrome()?t.fullscreenEnter():this.IP(t).then((()=>t.fullscreenEnter()))}EP(t){this.uP=null,this.IP(t,"center").then((()=>t.fullscreenExit()))}IP(t,i=null){const{element:e}=t,s=this.RP();return this.TP().then((()=>ut(e))).then((({boundingClientRect:t})=>{const{bottom:o,top:r}=t,a=s.getSize().height;if(r>=0&&o<=a)return n();const l=i||(o>a?"bottom":"top");return s.animateScrollIntoView(e,l)}))}RP(){return lt(this.Ni)}TP(){return rt(this.Ni.win).promise(330)}fP(){if(this.isInLandscape())return Promise.resolve(this.cP);this.cP=null;const t=this.nP.filter(this.mP).map((t=>ut(t.element)));return Promise.all(t).then((t=>{const i=t.sort(this.vP)[0];return i&&i.intersectionRatio>.5?i.target.getImpl().then((t=>this.cP=t)):this.cP}))}_P(t,i){const{boundingClientRect:n,intersectionRatio:e}=t,{boundingClientRect:s,intersectionRatio:o}=i,r=e-o;if(Math.abs(r)>.1)return r;const a=lt(this.Ni),l=Yt(a,n),h=Yt(a,s);return lh?l-h:n.top-s.top}pP(t){return this.hP.getPlayingState(t)}}(this.ampdoc,this))),this.Re.delay(this.rP,1e3)}dispose(){if(this.lP().dispose(),this.eP.disconnect(),this.eP=null,this.nP)for(let t=0;t0){const s=n/e,o=pt(this.ampdoc.win,`${jt}.${i}`,{"time":n,"percent":s});this.oP.trigger(t.video.element,i,o,1)}}register(t){B(t);const i=t;if(this.wP(t),!t.supportsPlatform())return;if(this.kP(t))return;if(!this.eP){const t=t=>t.forEach((({isIntersecting:t,target:i})=>{this.CP(i).updateVisibility(t)}));this.eP=ht(t,this.ampdoc.win,{threshold:.5})}this.eP.observe(i.element),vt(i.element,"reloaded",(()=>n.videoLoaded())),this.nP=this.nP||[];const n=new class{constructor(t,i){this.hP=t,this.Ni=t.ampdoc,this.video=i,this.qP=!0,this.xP=!1,this.kg=!1,this.SP=!1,this.rs=!1,this.OP=new bt,this.OP.onSessionEnd((()=>Dt(this,"video-session"))),this.FP=new bt,this.FP.onSessionEnd((()=>Dt(this,"video-session-visible"))),this.$P=z((()=>new class{constructor(t,i){this.Re=rt(t),this.jP=i,this.P_=null,this.LP=0,this.YP=0}start(){const{element:t}=this.jP.video;this.stop(),this.P_=this.P_||[],this.UP()?this.zP(this.YP):this.P_.push(function(t,i,n,e){let s=n;const o=mt(t,"loadedmetadata",(t=>{try{s(t)}finally{s=null,o()}}),void 0);return o}(t,0,(()=>{this.UP()&&this.zP(this.YP)}))),this.P_.push(vt(t,Tt,(()=>{this.UP()&&this.NP(100)})))}stop(){if(this.P_){for(;this.P_.length>0;)this.P_.pop()();this.YP++}}UP(){const{video:t}=this.jP,i=t.getDuration();if(!Nt(i))return!1;if(zt(i)<250){const i=Math.ceil(5);this.DP("This video is too short for `video-percentage-played`. Reports may be innacurate. For best results, use videos over",i,"seconds long.",t.element)}return!0}DP(...t){D().warn.apply(D(),[jt].concat(t))}zP(t){if(t!=this.YP)return;const{jP:i,Re:n}=this,{video:e}=i,s=()=>this.zP(t);if(i.getPlayingState()==qt)return void n.delay(s,500);const o=e.getDuration();if(!Nt(o))return void n.delay(s,500);const r=(h=zt(o),d(!0),Math.min(Math.max(h,250),4e3)),a=e.getCurrentTime()/o*100,l=5*Math.floor(a/5);var h;B(c(l)),this.NP(l),n.delay(s,r)}NP(t){t<=0||this.LP!=t&&(this.LP=t,this.BP(t))}BP(t){Dt(this.jP,"video-percentage-played",{"normalizedPercentage":t.toString()})}}(this.Ni.win,this))),this.JP=!1,this.WP=!1,this.HP=null,this.dt=!1,this.GP=!1,this.hasAutoplay=i.element.hasAttribute("autoplay"),this.hasAutoplay&&this.hP.installAutoplayStyles(),this.Qv=Mt,this.ZP=()=>{ft(this.video,!1)},this.KP=()=>{this.video.pause()},vt(i.element,Et,(()=>this.videoLoaded())),vt(i.element,Rt,(()=>this.QP())),vt(i.element,"play",(()=>{this.GP=!0,Dt(this,Ot)})),vt(i.element,It,(()=>this.XP())),vt(i.element,Vt,(()=>this.dt=!0)),vt(i.element,kt,(()=>{this.dt=!1,this.hP.pauseOtherVideos(this)})),vt(i.element,"amp:video:tick",(t=>{const i=_t(t),n=i.eventType;n&&this.tA(n,i.vars)})),vt(i.element,Tt,(()=>{this.SP=!1,Dt(this,"video-ended")})),vt(i.element,Ct,(()=>{this.SP=!0,Dt(this,"video-ad-start")})),vt(i.element,St,(()=>{this.SP=!1,Dt(this,"video-ad-end")})),i.signals().whenSignal(wt).then((()=>this.iA())),this.nA=z((()=>{const t="firstPlay",i=pt(this.Ni.win,t,{}),{element:n}=this.video;st(n).trigger(n,t,i,1)})),this.eA()}dispose(){this.$P().stop()}tA(t,i){const n={"__amp:eventType":t};Object.keys(i).forEach((t=>{n[`custom_${t}`]=i[t]})),Dt(this,"video-hosted-custom",n)}eA(){this.video.signals().whenSignal("playback-delegated").then((()=>{this.qP=!1,this.kg&&this.video.pause()}))}isMuted(){return this.dt}isPlaybackManaged(){return this.qP}iA(){this.sA()&&this.hP.registerForAutoFullscreen(this),this.hasAutoplay&&this.oA()}sA(){const{element:t}=this.video;return!(this.video.preimplementsAutoFullscreen()||!t.hasAttribute("rotate-to-fullscreen"))&&W(this.video.isInteractive(),"Only interactive videos are allowed to enter fullscreen on rotate. Set the `controls` attribute on %s to enable.",t)}XP(){this.kg=!0,this.getPlayingState()==xt&&(this.nA(),this.hP.pauseOtherVideos(this));const{video:t}=this,{element:i}=t;t.preimplementsMediaSessionAPI()||i.classList.contains("i-amphtml-disable-mediasession")||(function(t,i){const n=at(t);if(i&&i.artwork){const{artwork:t}=i;B(o(t)),t.forEach((t=>{if(t){const i=h(t)?t.src:t;W(n.isProtocolValid(i))}}))}}(i,this.Qv),function(t,i,n,e){const{navigator:s}=t;"mediaSession"in s&&t.MediaMetadata&&(s.mediaSession.metadata=new t.MediaMetadata(Mt),s.mediaSession.metadata=new t.MediaMetadata(i),s.mediaSession.setActionHandler("play",n),s.mediaSession.setActionHandler("pause",e))}(this.Ni.win,this.Qv,this.ZP,this.KP)),this.OP.beginSession(),this.rs&&this.FP.beginSession(),this.GP||Dt(this,Ot)}QP(){Dt(this,"video-pause"),this.kg=!1,this.WP?this.WP=!1:this.OP.endSession()}videoLoaded(){this.xP=!0,this.HP=dt(this.video.element),this.rA(),this.$P().start(),this.rs&&this.aA()}rA(){if(this.video.preimplementsMediaSessionAPI())return;this.video.getMetadata()&&(this.Qv=u(this.video.getMetadata()));const t=this.Ni.win.document;if(!this.Qv.artwork||0==this.Qv.artwork.length){const i=function(t){const i=t.querySelector('script[type="application/ld+json"]');if(!i)return;const n=f(i.textContent);return n&&n.image?"string"==typeof n.image?n.image:n.image["@list"]&&"string"==typeof n.image["@list"][0]?n.image["@list"][0]:"string"==typeof n.image.url?n.image.url:"string"==typeof n.image[0]?n.image[0]:void 0:void 0}(t)||function(t){const i=t.querySelector('meta[property="og:image"]');return i?i.getAttribute("content"):void 0}(t)||function(t){const i=t.querySelector('link[rel="shortcut icon"]')||t.querySelector('link[rel="icon"]');return i?i.getAttribute("href"):void 0}(t);i&&(this.Qv.artwork=[{"src":i}])}if(!this.Qv.title){const i=this.video.element.getAttribute("title")||this.video.element.getAttribute("aria-label")||this.HP.getAttribute("title")||this.HP.getAttribute("aria-label")||t.title;i&&(this.Qv.title=i)}}lA(){this.xP&&this.aA()}aA(){this.Ni.isVisible()&&ct(this.Ni.win).then((t=>{this.hasAutoplay&&!this.userInteracted()&&t?this.hA():this.uA()}))}oA(){this.video.isInteractive()&&this.video.hideControls(),ct(this.Ni.win).then((t=>{t||!this.video.isInteractive()?(this.video.mute(),this.cA()):this.video.showControls()}))}cA(){const{video:t}=this,{element:i,win:n}=this.video;if(i.hasAttribute("noaudio")||i.signals().get($t))return;const e=function(t,i){const n=b(i)(Pt),e=n.firstElementChild;for(let t=0;t<4;t++){const i=e.cloneNode(!0),s=i.children;for(let i=0;i{s.forEach((t=>{!function(t,i){void 0===i&&(i=t.hasAttribute("hidden")),i?t.removeAttribute("hidden"):t.setAttribute("hidden","")}(t,i)}))}))}function r(i){t.mutateElementSkipRemeasure((()=>e.classList.toggle("amp-video-eq-play",i)))}const a=[vt(i,Rt,(()=>r(!1))),vt(i,It,(()=>r(!0))),vt(i,Ct,(()=>{o(!1),t.showControls()})),vt(i,St,(()=>{o(!0),t.hideControls()})),vt(i,kt,(()=>Ft(t)))];if(t.isInteractive()){t.hideControls();const n=function(t,i){const n=b(t)(gt);return i&&i.title&&n.setAttribute("aria-label",i.title),n}(i,this.Qv);s.push(n),a.push(vt(n,"click",(()=>Ft(t))))}t.mutateElementSkipRemeasure((()=>{s.forEach((t=>{i.appendChild(t)}))})),this.SP&&o(!1),t.signals().whenSignal($t).then((()=>{this.nA(),t.isInteractive()&&t.showControls(),t.unmute(),a.forEach((t=>{t()})),t.mutateElementSkipRemeasure((()=>{s.forEach((t=>{g(t)}))}))}))}hA(){this.qP&&(this.rs?(this.FP.beginSession(),ft(this.video,!0),this.JP=!0):(this.kg&&this.FP.endSession(),this.video.pause(),this.WP=!0))}uA(){this.rs?this.FP.beginSession():this.kg&&this.FP.endSession()}updateVisibility(t){const i=this.rs;this.rs=t,t!=i&&this.lA()}getPlayingState(){return this.kg?this.kg&&this.JP&&!this.userInteracted()?"playing_auto":xt:qt}isRollingAd(){return this.SP}userInteracted(){return null!=this.video.signals().get($t)}getAnalyticsDetails(){const{video:t}=this;return Promise.all([ct(this.Ni.win),ut(t.element)]).then((i=>{const n=i[0],e=i[1],{height:s,width:o}=e.boundingClientRect,r=this.hasAutoplay&&n,a=t.getPlayedRanges(),l=a.reduce(((t,i)=>t+i[1]-i[0]),0);return{"autoplay":r,"currentTime":t.getCurrentTime(),"duration":t.getDuration(),"height":s,"id":t.element.id,"muted":this.dt,"playedTotal":l,"playedRangesJson":JSON.stringify(a),"state":this.getPlayingState(),"width":o}}))}}(this,t);this.nP.push(n);const{element:e}=n.video;P(e,wt),function(t){t.classList.add("i-amphtml-media-component")}(e),t.signals().signal(wt),e.classList.add("i-amphtml-video-interface")}wP(t){n("play",(()=>ft(t,!1))),n("pause",(()=>t.pause())),n("mute",(()=>t.mute())),n("unmute",(()=>t.unmute()));const i=()=>t.fullscreenEnter();function n(i,n){t.registerAction(i,(()=>{Ft(t),n()}),1)}n("fullscreenenter",i),n("fullscreen",i)}kP(t){if(Ut(this.sP,t))return this.sP;for(let i=0;this.nP&&it?t[i]:""))}getPlayingState(t){return this.CP(t).getPlayingState()}isMuted(t){return this.CP(t).isMuted()}userInteracted(t){return this.CP(t).userInteracted()}isRollingAd(t){return this.CP(t).isRollingAd()}pauseOtherVideos(t){this.nP.forEach((i=>{i.isPlaybackManaged()&&i!==t&&i.getPlayingState()==xt&&i.video.pause()}))}})}(t,"video-manager")}var Bt=[""],Wt=[""],Jt="amp-youtube",Ht=class extends t.BaseElement{constructor(t){super(t),this.kv=null,this.eq=null,this.dt=!1,this.sq=!1,this.vg=!1,this.gg=null,this.Po=null,this.zv=null,this.gA=null,this.AA=null,this.gv=null,this.oq=null,this.wg=new class{constructor(t){this.yf=t,this.kg=!1,this.Sg=!1,this.Pg=this.Pg.bind(this)}updatePlaying(t){t!==this.kg&&(this.kg=t,t?(this.Sg=!1,function(t,i){!function(t,i,n){const e=t.ownerDocument.defaultView;if(!e)return;let s=$.get(t);if(s||(s=[],$.set(t,s),j(e).observe(t)),!s.some((t=>t.callback===n&&1===t.type))){s.push({type:1,callback:n});const i=F.get(t);i&&setTimeout((()=>Y(1,n,i)))}}(t,0,i)}(this.yf,this.Pg)):function(t,i){!function(t,i,n){const e=$.get(t);if(e&&(function(t,i){const e=[];let s=0;for(let i=0;i0&&t>0;if(n===this.Sg)return;this.Sg=n;const e=this.yf;n||e.pause()}}(this.element)}preconnectCallback(t){const i=J(this.win,"preconnect"),n=this.getAmpDoc();i.url(n,this.tb()),i.url(n,"https://i.ytimg.com",t)}isLayoutSupported(t){return function(t){return"fixed"==t||"fixed-height"==t||"responsive"==t||"fill"==t||"flex-item"==t||"fluid"==t||"intrinsic"==t}(t)}renderOutsideViewport(){return.75}buildCallback(){this.kv=this.fA(),this.eq=this.rq(),this.aq();const t=new e;this.gA=t.promise,this.AA=t.resolve,Lt(this.element)}lq(){return this.aq(),`https://www.youtube${"omit"===this.hq()?"-nocookie":""}.com/embed/${this.kv?`${encodeURIComponent(this.kv||"")}?`:`live_stream?channel=${encodeURIComponent(this.eq||"")}&`}enablejsapi=1&=1`}tb(){if(this.zv)return this.zv;let t=this.lq();const{element:i}=this,n=function(t,i,n){const{dataset:e}=t,s={},o=/^param(.+)/;for(const t in e){const i=t.match(o);i&&(s[i[1][0].toLowerCase()+i[1].substr(1)]=e[t])}return s}(i);return"autoplay"in n&&(delete n.autoplay,this.user().error("AMP-YOUTUBE","Use autoplay attribute instead of data-param-autoplay")),"playsinline"in n||(n.playsinline="1"),i.hasAttribute("autoplay")&&("iv_load_policy"in n||(n.iv_load_policy="3"),n.playsinline="1"),"loop"in n&&this.user().warn("AMP-YOUTUBE","Use loop attribute instead of the deprecated data-param-loop"),this.sq=i.hasAttribute("loop")||"loop"in n&&"1"==n.loop,this.vg="playlist"in n,this.sq&&(this.vg?n.loop="1":"loop"in n&&delete n.loop),t=function(t,i){return function(t,i,n){if(!i)return t;const e=t.split("#",2),s=e[0].split("?",2);let o=s[0]+(s[1]?`?${s[1]}&${i}`:`?${i}`);return o+=e[1]?`#${e[1]}`:"",o}(t,function(t){const i=[];for(const s in t){let o=t[s];if(null!=o){o=r(o);for(let t=0;tthis.play(!1))));const n=this.loadPromise(this.gg).then((()=>rt(this.win).promise(300))).then((()=>{this.xA(),P(this.element,Et)}));return this.AA(n),n}unlayoutCallback(){this.gg&&(g(this.gg),this.gg=null),this.gv&&this.gv(),this.oq&&this.oq();const t=new e;return this.gA=t.promise,this.AA=t.resolve,this.wg.updatePlaying(!1),!0}pauseCallback(){this.gg&&this.gg.contentWindow&&this.pause()}mutatedAttributesCallback(t){null!=t["data-videoid"]&&(this.kv=this.fA(),this.gg&&this.pA("loadVideoById",[this.kv]))}rq(){return this.element.getAttribute("data-live-channelid")}fA(){return this.element.getAttribute("data-videoid")}hq(){return this.element.getAttribute("credentials")||"include"}aq(){W(!(this.kv&&this.eq)&&(this.kv||this.eq),"Exactly one of data-videoid or data-live-channelid should be present for %s",this.element)}pA(t,i){this.gA.then((()=>{if(this.gg&&this.gg.contentWindow){const n=JSON.stringify({"event":"command","func":t,"args":i||""});this.gg.contentWindow.postMessage(n,"*")}}))}uq(t){if(!function(t,i,n){return!(!i||t.source!=i.contentWindow)&&"https://www.youtube.com"==t.origin}(t,this.gg))return;const i=_t(t);if(!(n=i)||!h(n)&&!n.startsWith("{"))return;var n;const e=h(s=i)?s:f(s);var s;if(null==e)return;const r=e.event,a=e.info||{},{element:l}=this,u=a.playerState;if("infoDelivery"==r&&null!=u){switch(u){case 1:this.wg.updatePlaying(!0);break;case 2:case 0:this.wg.updatePlaying(!1)}return void function(t,i,n){if(null==n[i])return!1;const e=n[i];(o(e)?e:[e]).forEach((i=>{P(t,i)}))}(l,u.toString(),{1:It,2:Rt,0:[Tt,Rt]})}const c=a.muted;if("infoDelivery"==r&&a&&null!=c){if(this.dt==c)return;return this.dt=c,void P(l,(d=this.dt,d?Vt:kt))}var d;if("initialDelivery"==r)return this.Po=a,void P(l,"loadedmetadata");"infoDelivery"!=r||void 0===a.currentTime||(this.Po.currentTime=a.currentTime)}xA(){this.gg&&this.gg.contentWindow.postMessage(JSON.stringify({"event":"listening"}),"*")}createPlaceholderCallback(){if(!this.kv)return null;const{element:t}=this,i=b(t)(Wt),n=this.kv;return x(i,{"object-fit":"cover","visibility":"hidden"}),y(["aria-label"],this.element,i),i.src=`https://i.ytimg.com/vi/${encodeURIComponent(n)}/sddefault.jpg#404_is_fine`,i.hasAttribute("aria-label")?i.setAttribute("alt","Loading video - "+i.getAttribute("aria-label")):i.setAttribute("alt","Loading video"),A(i),this.loadPromise(i).then((()=>{if(120==i.naturalWidth&&90==i.naturalHeight)throw new Error("sddefault.jpg is not found")})).catch((()=>(i.src=`https://i.ytimg.com/vi/${encodeURIComponent(n)}/hqdefault.jpg`,this.loadPromise(i)))).then((()=>{this.getVsync().mutate((()=>{x(i,{"visibility":""})}))})),i}supportsPlatform(){return!0}isInteractive(){return!0}play(t){this.pA("playVideo")}pause(){this.pA("pauseVideo")}mute(){this.pA("mute")}unmute(){this.pA("unMute")}showControls(){}hideControls(){}fullscreenEnter(){this.gg&&function(t){const i=t.requestFullscreen||t.requestFullScreen||t.webkitRequestFullscreen||t.webkitEnterFullscreen||t.msRequestFullscreen||t.mozRequestFullScreen;i&&i.call(t)}(this.gg)}fullscreenExit(){this.gg&&function(t){const i=t.cancelFullScreen||t.exitFullscreen||t.webkitExitFullscreen||t.webkitCancelFullScreen||t.mozCancelFullScreen||t.msExitFullscreen;if(i)return void i.call(t);const{ownerDocument:n}=t;if(!n)return;const e=n.cancelFullScreen||n.exitFullscreen||n.webkitExitFullscreen||n.webkitCancelFullScreen||n.mozCancelFullScreen||n.msExitFullscreen;e&&e.call(n)}(this.gg)}isFullscreen(){return!!this.gg&&function(t){const{webkitDisplayingFullscreen:i}=t;if(void 0!==i)return i;const{ownerDocument:n}=t;return!!n&&(n.fullscreenElement||n.webkitFullscreenElement||n.mozFullScreenElement||n.webkitCurrentFullScreenElement)==t}(this.gg)}getMetadata(){}preimplementsMediaSessionAPI(){return!0}preimplementsAutoFullscreen(){return!1}getCurrentTime(){return this.Po?this.Po.currentTime:NaN}getDuration(){return this.Po?this.Po.duration:NaN}getPlayedRanges(){return[]}seekTo(t){this.user().error(Jt,"`seekTo` not supported.")}};t.registerElement(Jt,Ht)})(); /*! https://mths.be/cssescape v1.5.1 by @mathias | MIT license */}}); //# sourceMappingURL=amp-youtube-0.1.mjs.map