import{r as m,j as s}from"./index-D2K-duz6.js";function y({props:x,paused:u,onMediaLoadingChange:r}){const l=x,v=String(l.header??"").trim(),S=String(l.caption??"").trim(),c=String(l.videoSrc??"").trim(),_=String(l.posterSrc??"").trim(),f=m.useRef(null);return m.useEffect(()=>{const t=f.current;if(!t)return;if(u){t.pause();return}const p=t.play();p&&typeof p.catch=="function"&&p.catch(()=>{})},[u,c]),m.useEffect(()=>{if(!c){r==null||r(!1);return}return r==null||r(!0),()=>{r==null||r(!1);const t=f.current;t&&(t.pause(),t.currentTime=0)}},[r,c]),s.jsxs("article",{className:`fullscreen-video ${u?"fullscreen-video--paused":""}`,children:[s.jsx("video",{ref:f,className:"fullscreen-video__media",src:c,poster:_||void 0,autoPlay:!0,playsInline:!0,preload:"metadata",controls:!1,onLoadedData:()=>r==null?void 0:r(!1),onCanPlay:()=>r==null?void 0:r(!1),onPlaying:()=>r==null?void 0:r(!1),onLoadStart:()=>r==null?void 0:r(!0),onWaiting:()=>r==null?void 0:r(!0),onStalled:()=>r==null?void 0:r(!0),onSuspend:()=>r==null?void 0:r(!1),onEnded:()=>r==null?void 0:r(!1),onError:()=>r==null?void 0:r(!1)}),v?s.jsx("div",{className:"fullscreen-video__chrome",children:s.jsx("p",{className:"fullscreen-video__header",children:v})}):null,S?s.jsx("p",{className:"fullscreen-video__caption",children:S}):null]})}export{y as default};
