import{r as f,j as p}from"./index-D2K-duz6.js";function y({props:m,paused:c,onMediaLoadingChange:r}){const v=m,s=String(v.videoSrc??"").trim(),S=String(v.posterSrc??"").trim(),u=f.useRef(null);return f.useEffect(()=>{const t=u.current;if(!t)return;if(c){t.pause();return}const l=t.play();l&&typeof l.catch=="function"&&l.catch(()=>{})},[c,s]),f.useEffect(()=>{if(!s){r==null||r(!1);return}return r==null||r(!0),()=>{r==null||r(!1);const t=u.current;t&&(t.pause(),t.currentTime=0)}},[r,s]),p.jsx("article",{className:`square-video ${c?"square-video--paused":""}`,children:p.jsx("div",{className:"square-video__frame",children:p.jsx("video",{ref:u,className:"square-video__media",src:s,poster:S||void 0,autoPlay:!0,preload:"metadata",playsInline:!0,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)})})})}export{y as default};
