import{_ as f,d as y,s as p,k as _,o as t,c as s,f as m,h as l,F as v,A as h,n as b,I as k,J as w,K as g,a as S}from"./entry-d195bacb.mjs";const I=y({name:"VideoPlayer",props:{poster:{type:String,default:""},src:{type:String,default:""},sources:{type:Array,default:()=>[]}},setup(c,{expose:a}){a();const o=c,e=p(()=>{if(o.src&&o.src.includes("youtube.com/watch")){const r=o.src.match(/\?v=([^&]*)/);return{name:"youtube",src:`https://www.youtube-nocookie.com/embed/${r[1]}?autoplay=1`,poster:o.poster||`https://i3.ytimg.com/vi/${r[1]}/hqdefault.jpg`}}}),n=_(!1);if(!o.src&&!o.sources.length)throw new Error("VideoPlayer: you need to provide either `src` or `sources` props");const i=p(()=>{var r,u;return o.src||((u=(r=o.sources)==null?void 0:r[0])==null?void 0:u.src)||!1}),d={props:o,provider:e,loaded:n,src:i};return Object.defineProperty(d,"__isScriptSetup",{enumerable:!1,value:!0}),d}}),V=c=>(w("data-v-1e0d2c6f"),c=c(),g(),c),x={key:1,class:"absolute top-0 left-0 w-full h-full video"},B=["poster"],C=["src"],P=["src","type"],j=["src"],N=V(()=>S("button",{class:"play"},null,-1)),A=[N];function E(c,a,o,e,n,i){const d=k;return t(),s("div",{class:b(["relative inline-block my-4 overflow-hidden bg-black bg-opacity-25 rounded-sm video-player",{loaded:e.loaded}])},[(e.provider?e.provider.poster:o.poster)?(t(),m(d,{key:0,"image-classes":"video absolute top-0 left-0 h-full w-full object-fit",src:e.provider?e.provider.poster:o.poster},null,8,["src"])):l("",!0),e.loaded?(t(),s("div",x,[e.provider?e.provider.name==="youtube"?(t(),s("iframe",{key:1,allow:"accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture",allowfullscreen:"true",class:"w-full h-full",src:e.provider.src},null,8,j)):l("",!0):(t(),s("video",{key:0,poster:o.poster,controls:"",autoplay:""},[e.src?(t(),s("source",{key:0,src:e.src},null,8,C)):l("",!0),(t(!0),s(v,null,h(o.sources,r=>(t(),s("source",{key:r.src||r,src:r.src||r,type:r.type},null,8,P))),128))],8,B))])):l("",!0),e.loaded?l("",!0):(t(),s("div",{key:2,class:"absolute top-0 left-0 w-full h-full cursor-pointer overlay",onClick:a[0]||(a[0]=r=>e.loaded=!0)},A))],2)}var q=f(I,[["render",E],["__scopeId","data-v-1e0d2c6f"]]);export{q as default};
