import{C as e,D as t,Q as n,Z as r,c as i,d as a,k as o,n as s}from"./index-7LYai_r-.js";var c=n(),l=r();function u(){return(0,l.jsxs)(`svg`,{viewBox:`0 0 64 64`,width:`72`,height:`72`,xmlns:`http://www.w3.org/2000/svg`,"aria-hidden":`true`,children:[(0,l.jsx)(`circle`,{cx:`32`,cy:`32`,r:`32`,fill:`rgba(var(--vitec-black), 0.55)`}),(0,l.jsx)(`polygon`,{points:`26,18 50,32 26,46`,fill:`rgba(var(--vitec-white), 1)`})]})}function d({element:n,className:r,nested:d,devInfoTags:f,uid:p,spaceBefore:m,spaceAfter:h}){let g=i(n),_=a(n),v=n.data?.youtube_code,y=!!n.data?.hide_controls,b=n.data?.poster?.[0]?.publicUrl,x=(n.data?.custom_video)?.[0]?.publicUrl,S=n.appearance?.frameClass?.split(`,`).map(e=>e.trim()).includes(`vitec-full-width`)??!1,[C,w]=(0,c.useState)(!1),T=b??(v?`https://img.youtube.com/vi/${v}/maxresdefault.jpg`:void 0),E=v?`https://www.youtube-nocookie.com/embed/${v}?controls=${y?`0`:`1`}&autoplay=${C?`1`:`0`}&rel=0&modestbranding=1`:void 0,D=y&&!C,O=!!(E||x);return(0,l.jsx)(s,{className:r,devInfoTags:f,fullWidth:S,nested:d,uid:p,spaceBefore:m,spaceAfter:h,children:(0,l.jsx)(`div`,{className:`vitec_video__inner`,children:(0,l.jsxs)(e,{spacing:2,children:[(g||_)&&(0,l.jsxs)(e,{spacing:.5,children:[g&&(0,l.jsx)(o,{variant:`h4`,children:g}),_&&(0,l.jsx)(o,{variant:`subtitle1`,color:`text.secondary`,children:_})]}),D&&O&&T&&(0,l.jsxs)(t,{className:`vitec_video__poster`,onClick:()=>w(!0),sx:{position:`relative`,borderRadius:2,overflow:`hidden`,cursor:`pointer`,"&:hover .vitec_video__play-btn":{transform:`scale(1.1)`}},children:[(0,l.jsx)(t,{component:`img`,src:T,alt:g??`Video`,sx:{width:`100%`,height:`auto`,display:`block`}}),(0,l.jsx)(t,{className:`vitec_video__play-btn`,sx:{position:`absolute`,inset:0,display:`flex`,alignItems:`center`,justifyContent:`center`,transition:`transform 0.15s ease`},children:(0,l.jsx)(u,{})})]}),D&&!O&&T&&(0,l.jsx)(t,{component:`img`,src:T,alt:g??`Video placeholder`,sx:{width:`100%`,borderRadius:2,display:`block`}}),(!y||C)&&E&&(0,l.jsx)(t,{className:`vitec_video__embed`,sx:{position:`relative`,paddingTop:`56.25%`,borderRadius:2,overflow:`hidden`},children:(0,l.jsx)(t,{component:`iframe`,src:E,title:g??`Video`,allow:`accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture`,allowFullScreen:!0,sx:{position:`absolute`,top:0,left:0,width:`100%`,height:`100%`,border:`none`}})}),!E&&x&&(!y||C)&&(0,l.jsx)(t,{component:`video`,src:x,poster:b,controls:!y,autoPlay:C,sx:{width:`100%`,borderRadius:2,display:`block`}})]})})})}export{d as VitecVideo};