import{d,b as c,j as m,n as f,x as v,o as y,O as _,bj as h,a as l,$ as x,N as b}from"./@vue-cb50a1c4.js";import{t as w,R as k}from"./index-ae60edf9.js";import{P as C,p as P,f as g,a as j,v as V,b as B,c as N,e as R,l as z,m as I,r as M,d as O}from"./xgplayer-8882c776.js";const $={class:"flex h-full flex-col items-center justify-center bg-black"},A=l("div",{id:"video_player",class:"flex-1"},null,-1),E={class:"flex w-full justify-between px-4 pb-4 pt-2"},T=d({__name:"PreviewVideo",props:{url:null,poster:null,onClose:null},setup(a){const o=a,e=c(),s=c(!0),p=()=>{e.value=new C({id:"video_player",url:o.url,poster:o.poster,controlPlugins:[P,g,j,V,B,N,R,z,I,M,O],pip:!0,fluid:!0,autoplay:!0,videoInit:!0,lang:"zh-cn",playbackRate:[.5,.75,1,1.5,2]})},r=()=>{s.value=!1,o.onClose()};return m(()=>{f(()=>{p()})}),v(()=>{var t;try{(t=e.value)==null||t.destroy()}catch{}}),(t,n)=>{const i=w,u=k;return y(),_(u,{show:s.value,onClick:n[0]||(n[0]=U=>({closeModal:r}))},{default:h(()=>[l("div",$,[A,l("div",E,[x(i,{name:"close",size:"24",color:"#fff",onClick:r})])])]),_:1},8,["show"])}}}),G=(a,o)=>{const e=document.createElement("div"),s=b(T,{url:a,poster:o,onClose(){s.unmount(),e.remove()}});s.mount(e),document.body.appendChild(e)};export{G as s};
