.e-floating-bars-var-2{--e-floating-bars-announcement-bg-color:#fff;--e-floating-bars-headline-text-color:#1c2448;--e-floating-bars-headline-text-color-hover:#467ff7;--e-floating-bars-headline-icon-color:#467ff7;--e-floating-bars-pause-play-icon-color:#495157;--e-floating-bars-pause-play-bg-color:#f3f5f8;--e-floating-bars-close-button-bg-color:#1c2448;--e-floating-bars-headlines-gap:16px;--e-floating-bars-headline-icon-size:16px;--e-floating-bars-vertical-padding:16px;--e-floating-bars-headline-icon-position:row;--e-floating-bars-controls-icon-size:16px;--e-floating-bars-scroll-duration:100s;--e-floating-bars-scroll-direction:forwards;--e-floating-bars-ticker-controls-order:1;--e-floating-bars-headline-icon-gap:10px;align-items:stretch;gap:0;padding:0}.e-floating-bars-var-2.has-close-button{padding:0}.e-floating-bars-var-2 .e-floating-bars__headlines{display:flex;flex-grow:1;gap:var(--e-floating-bars-headlines-gap);max-width:100vw;padding-block:var(--e-floating-bars-vertical-padding)}.e-floating-bars-var-2 .e-floating-bars__headlines-inner{display:flex;flex-wrap:nowrap;gap:var(--e-floating-bars-headlines-gap);width:-moz-max-content;width:max-content;z-index:1}.e-floating-bars-var-2 .e-floating-bars__headlines[data-animated=true]{overflow:hidden}.e-floating-bars-var-2 .e-floating-bars__headlines[data-animated=true] .e-floating-bars__headlines-inner{animation:scroll var(--e-floating-bars-scroll-duration) var(--e-floating-bars-scroll-direction) linear infinite}[dir=rtl] .e-floating-bars-var-2 .e-floating-bars__headlines[data-animated=true] .e-floating-bars__headlines-inner{animation:scroll-reverse var(--e-floating-bars-scroll-duration) var(--e-floating-bars-scroll-direction) linear infinite}.e-floating-bars-var-2 .e-floating-bars__headlines[data-animated=true].has-pause-hover:hover .e-floating-bars__headlines-inner,.e-floating-bars-var-2 .e-floating-bars__headlines[data-animated=true].is-paused .e-floating-bars__headlines-inner{animation-play-state:paused}.e-floating-bars-var-2 .e-floating-bars__headline,.e-floating-bars-var-2 .e-floating-bars__headline:not([href]):not([tabindex]){align-items:center;color:var(--e-floating-bars-headline-text-color);display:flex;flex-direction:var(--e-floating-bars-headline-icon-position);gap:var(--e-floating-bars-headline-icon-gap);position:relative;width:-moz-max-content;width:max-content;z-index:1}.e-floating-bars-var-2 .e-floating-bars__headline:focus,.e-floating-bars-var-2 .e-floating-bars__headline:hover,.e-floating-bars-var-2 .e-floating-bars__headline:not([href]):not([tabindex]):focus,.e-floating-bars-var-2 .e-floating-bars__headline:not([href]):not([tabindex]):hover{color:var(--e-floating-bars-headline-text-color-hover)}.e-floating-bars-var-2 .e-floating-bars__headline-icon{color:var(--e-floating-bars-headline-icon-color);display:flex}.e-floating-bars-var-2 .e-floating-bars__headline-icon svg{fill:var(--e-floating-bars-headline-icon-color);height:var(--e-floating-bars-headline-icon-size);width:var(--e-floating-bars-headline-icon-size)}.e-floating-bars-var-2 .e-floating-bars__headline-icon i{color:var(--e-floating-bars-headline-icon-color);font-size:var(--e-floating-bars-headline-icon-size)}.e-floating-bars-var-2 .e-floating-bars__ticker-controls{align-items:stretch;display:flex}.e-floating-bars-var-2 .e-floating-bars__pause-button,.e-floating-bars-var-2 .e-floating-bars__play-button{align-items:center;background-color:var(--e-floating-bars-pause-play-bg-color);border:0;border-radius:0;color:var(--e-floating-bars-pause-play-icon-color);display:flex;justify-content:center;padding:16px;width:100%;z-index:1}.e-floating-bars-var-2 .e-floating-bars__pause-button svg,.e-floating-bars-var-2 .e-floating-bars__play-button svg{fill:var(--e-floating-bars-pause-play-icon-color);height:var(--e-floating-bars-controls-icon-size);width:var(--e-floating-bars-controls-icon-size)}.e-floating-bars-var-2 .e-floating-bars__pause-button i,.e-floating-bars-var-2 .e-floating-bars__play-button i{color:var(--e-floating-bars-pause-play-icon-color);font-size:var(--e-floating-bars-controls-icon-size)}.e-floating-bars-var-2 .e-floating-bars__pause-button[aria-hidden=true],.e-floating-bars-var-2 .e-floating-bars__play-button[aria-hidden=true]{display:none}.e-floating-bars-var-2 .e-floating-bars__close-button,.e-floating-bars-var-2 .e-floating-bars__close-button[type=button]{align-items:center;align-self:stretch!important;background-color:var(--e-floating-bars-close-button-bg-color);border-radius:0;inset-inline-end:unset!important;inset-inline-start:unset!important;order:var(--e-floating-bars-ticker-controls-order);padding-inline:12px;position:relative;top:unset!important;z-index:1}.e-floating-bars-var-2 .e-floating-bars__close-button i,.e-floating-bars-var-2 .e-floating-bars__close-button[type=button] i{font-size:var(--e-floating-bars-controls-icon-size)}.e-floating-bars-var-2 .e-floating-bars__play-pause-controls{align-items:stretch;display:flex;position:relative}.e-floating-bars-var-2 .e-floating-bars__overlay{z-index:0}.e-floating-bars-var-2 .e-floating-bars__ticker-controls{order:var(--e-floating-bars-ticker-controls-order)}@keyframes scroll{to{transform:translate(-100%)}}@keyframes scroll-reverse{to{transform:translate(100%)}}@import '../base/variables'; @import '../base/mixins'; import{r as t,c as i,h as o,g as n}from"./p-d7399561.js";import{b as s}from"./p-52cc8856.js";const e=class{constructor(o){t(this,o),this.actionBarStateChange=i(this,"actionBarStateChange",7),this.ended=void 0,this.config=void 0,this.currentTime=void 0,this.duration=void 0,this.direction=void 0,this.youtube=void 0,this.show=!1,this.youtubeRenderKey=1,this.percentagePassed=0}componentWillLoad(){this.handleDuration()}handleDuration(){this.handleTime()}handleEnded(t){var o;if(t){if(100!==(null===(o=null==this?void 0:this.config)||void 0===o?void 0:o.percentage_start))return;this.show=!0}}handlePercentagePassed(){this.percentagePassed=this.currentTime/this.duration*100}handleTime(){this.checkTime()}checkTime(){var t,o;this.show=!!(null===(t=null===window||void 0===window?void 0:window.wp)||void 0===t?void 0:t.blocks)||s({current:this.currentTime,duration:this.duration,showAfter:null===(o=this.config)||void 0===o?void 0:o.percentage_start})}handleButtonCountChange(t,o){(null==t?void 0:t.button_count)!==(null==o?void 0:o.button_count)&&this.youtubeRenderKey++,(null==t?void 0:t.enabled)&&this.handleDuration()}youtubeButton(){var t,n,i,e;if("youtube"===(null===(t=this.config)||void 0===t?void 0:t.button_type)&&(null===(n=this.youtube)||void 0===n?void 0:n.channelId))return o("presto-youtube-subscribe-button",{key:this.youtubeRenderKey,channel:null===(i=this.youtube)||void 0===i?void 0:i.channelId,showCount:null===(e=this.config)||void 0===e?void 0:e.button_count})}customButton(){var t,n,i,e,a,s,r,d,l,u,c;if("custom"===(null===(t=this.config)||void 0===t?void 0:t.button_type))return o("presto-player-button",{type:"primary",size:"small",href:null===(i=null===(n=this.config)||void 0===n?void 0:n.button_link)||void 0===i?void 0:i.url,target:(null===(a=null===(e=this.config)||void 0===e?void 0:e.button_link)||void 0===a?void 0:a.opensInNewTab)?"_blank":"_self",style:Object.assign(Object.assign({"--presto-player-button-border-radius":`${null===(s=this.config)||void 0===s?void 0:s.button_radius}px`},(null===(r=this.config)||void 0===r?void 0:r.button_color)?{"--presto-player-button-color":`${null===(d=this.config)||void 0===d?void 0:d.button_color}`}:{}),(null===(l=this.config)||void 0===l?void 0:l.button_text_color)?{"--presto-player-button-text":`${null===(u=this.config)||void 0===u?void 0:u.button_text_color}`}:{})},null===(c=this.config)||void 0===c?void 0:c.button_text)}handleCtaStateChange(t){this.actionBarStateChange.emit(t)}render(){var t,n;return o("presto-action-bar-ui",{open:this.show,style:{"--presto-action-bar-background":(null===(t=this.config)||void 0===t?void 0:t.background_color)||"#1d1d1d"}},null===(n=this.config)||void 0===n?void 0:n.text,o("div",{slot:"button"},this.youtubeButton(),this.customButton()))}get el(){return n(this)}static get watchers(){return{duration:["handleDuration","handlePercentagePassed"],ended:["handleEnded"],currentTime:["handlePercentagePassed","handleTime"],config:["handleButtonCountChange"],show:["handleCtaStateChange"]}}};e.style=":host{display:block}";const a=class{constructor(o){t(this,o),this.open=void 0}render(){return o("div",{class:{bar:!0,"bar--open":this.open}},o("span",{part:"content",class:"bar__content"},o("slot",null)),o("span",{part:"button",class:"bar__button"},o("slot",{name:"button"})))}};a.style=":host{display:block;overflow:hidden}.bar{display:flex;flex-wrap:wrap;align-items:center;justify-content:center;background:var(--presto-action-bar-background, #1d1d1d);color:#fff;padding:0 var(--presto-action-bar-padding, 6px);line-height:1em;font-size:16px;margin-top:-100%;transition:margin var(--presto-action-bar-animation-speed, 0.5s) ease-in-out;transform:translate3d(0);border-radius:0px 0px var(--presto-player-border-radius) var(--presto-player-border-radius)}.bar.bar--open{margin-top:0}.bar__button{margin:var(--presto-action-bar-padding, 6px);display:flex;align-items:center}.bar__content{margin:var(--presto-action-bar-padding, 6px);width:100%;text-align:center}@media screen and (min-width: 480px){.bar__content{width:auto}}";const r=class{constructor(o){t(this,o),this.channel=void 0,this.layout="default",this.showCount=void 0}waitForApi(t){var o=setInterval((function(){var n;(null===(n=null===window||void 0===window?void 0:window.gapi)||void 0===n?void 0:n.ytsubscribe)&&(clearInterval(o),t())}),50)}componentDidLoad(){const t=document.createElement("script");t.type="text/javascript",t.async=!1,t.src="https://apis.google.com/js/platform.js";const o=document.getElementsByTagName("script")[0];o&&o.parentNode.insertBefore(t,o),this.waitForApi((()=>{window.gapi.ytsubscribe.render(this.textInput,{channelId:this.channel,layout:this.layout,count:this.showCount?"default":"hidden"})}))}render(){return o("div",{class:"g-ytsubscribe",ref:t=>this.textInput=t})}};r.style=":host{display:block}";export{e as presto_action_bar_controller,a as presto_action_bar_ui,r as presto_youtube_subscribe_button};