import{proxyCustomElement,HTMLElement,createEvent,h,Host}from"@stencil/core/internal/client";const prestoPlaylistOverlayCss=":host{display:block;cursor:pointer}.playlist__overlay{color:#fff;position:absolute;top:0;left:0;width:100%;height:100%;background:rgba(0, 0, 0, 0.7);z-index:999}.playlist__overlay h2,.playlist__overlay p{margin:0;padding:0;line-height:1}.playlist__overlay h2{margin-bottom:0.4em}.playlist__overlay .playlist__overlay-wrap{top:0;position:absolute;padding:25px;left:0;display:grid;gap:1em}.playlist__overlay .playlist__overlay-buttons{display:flex;gap:13px}.playlist__overlay .playlist__overlay-buttons button{background:rgba(255, 255, 255, 0.8);border-radius:5px;padding:10px 12px;border:1px solid #ffffff;font-weight:500;font-size:13px;line-height:15px;display:flex;justify-content:space-between;align-items:center;gap:16px;cursor:pointer}.playlist__overlay .playlist__overlay-buttons button.previous{background-color:transparent;border:1px solid #ffffff;margin-right:10px;color:#ffffff}.playlist__overlay .playlist__overlay-buttons button.next{background:linear-gradient(to right, white 50%, rgba(255, 255, 255, 0.8) 50%);background-size:200% 100%;background-position:right bottom}.playlist__overlay .playlist__overlay-buttons button.next.fill-button{transition:all var(--playlist-transition-duration, 5s) ease-out;background-position:left bottom}.playlist__overlay .playlist__overlay-buttons button.next.disabled{background-color:transparent;border:1px solid #ffffff;color:#ffffff;background:none}",PrestoPlaylistOverlay=proxyCustomElement(class extends HTMLElement{constructor(){super(),this.__registerHost(),this.__attachShadow(),this.rewatch=createEvent(this,"rewatch",7),this.next=createEvent(this,"next",7),this.nextItemTitle=void 0,this.nextItemString=void 0,this.transitionDuration=5,this.isLastItem=!1,this.animating=!1,this.show=!1}handleShow(){this.show&&!this.isLastItem?(setTimeout((()=>{this.animating=!0}),200),this.timeout=setTimeout((()=>{this.show&&this.handleNext()}),1e3*(this.transitionDuration||5)+200)):this.animating=!1}handleRewatch(){this.rewatch.emit()}handleNext(){this.next.emit()}disconnectedCallback(){clearTimeout(this.timeout)}handleAnimatingChange(t){t||clearTimeout(this.timeout)}render(){var t,i,e,l,o,n;if(!this.show)return h(Host,null,h("div",{style:{display:"none"}}));const a=(null===(i=null===(t=null===window||void 0===window?void 0:window.prestoPlayer)||void 0===t?void 0:t.i18n)||void 0===i?void 0:i.upNext)||"Up Nexts",s=(null===(l=null===(e=null===window||void 0===window?void 0:window.prestoPlayer)||void 0===e?void 0:e.i18n)||void 0===l?void 0:l.startOver)||"Start Over",r=(null===(n=null===(o=null===window||void 0===window?void 0:window.prestoPlayer)||void 0===o?void 0:o.i18n)||void 0===n?void 0:n.rewatch)||"Rewatch";return h("div",{class:"playlist__overlay",onClick:t=>{t.preventDefault(),t.stopImmediatePropagation(),this.animating=!1}},h("div",{class:"playlist__overlay-wrap"},this.isLastItem?h("p",null,s,":"):h("p",null,a,":"),h("h2",null,this.nextItemTitle),h("div",{class:"playlist__overlay-buttons"},h("button",{class:"previous",onClick:()=>this.handleRewatch()},h("svg",{width:"15",height:"9",viewBox:"0 0 15 9",fill:"none",xmlns:"http://www.w3.org/2000/svg"},h("path",{d:"M15 0V9L8 4.5L15 0Z",fill:"white"}),h("path",{d:"M7 0V9L0 4.5L7 0Z",fill:"white"})),r),h("button",{class:{next:!0,"fill-button":this.animating},onClick:t=>{t.preventDefault(),t.stopImmediatePropagation(),this.handleNext()}},h("svg",{width:"10",height:"12",viewBox:"0 0 10 12",fill:"none",xmlns:"http://www.w3.org/2000/svg"},h("path",{d:"M0 0V12L9.5 6L0 0Z",fill:"black"})),this.isLastItem?s:"Next "+((null==this?void 0:this.nextItemString)||"Video")))))}static get watchers(){return{show:["handleShow"],animating:["handleAnimatingChange"]}}static get style(){return prestoPlaylistOverlayCss}},[1,"presto-playlist-overlay",{nextItemTitle:[1,"next-item-title"],nextItemString:[1,"next-item-string"],transitionDuration:[2,"transition-duration"],isLastItem:[4,"is-last-item"],show:[4],animating:[32]}]);function defineCustomElement(){"undefined"!=typeof customElements&&["presto-playlist-overlay"].forEach((t=>{"presto-playlist-overlay"===t&&(customElements.get(t)||customElements.define(t,PrestoPlaylistOverlay))}))}defineCustomElement();export{PrestoPlaylistOverlay as P,defineCustomElement as d};