import{a as e,S as t,P as n,N as a}from"./chunk-C68fSiJm.js";import{d as s}from"./chunk-D1JGNTfG.js";import{D as l}from"./chunk-xF6SoLGd.js";import{r as o,C as i,b as u,o as r,P as c,S as d,R as h,N as p,B as v,O as m,H as f,U as y,M as x,u as j,W as k}from"./chunk-BRI0aX6c.js";import{b as g}from"./souav-I_ihqEhP.js";import"./chunk-C2rd06Pa.js";import"./chunk-cn7T4ICr.js";import"./chunk-CiYjHJ2H.js";import"./chunk-9PZSJnHb.js";import"./chunk-Bf-nSo-6.js";import"./chunk-DwkOxDMO.js";import"./chunk-CMQyd8eO.js";import"./chunk-a7obrEbD.js";import"./chunk-DQhVL27x.js";import"./chunk-Bh3yC0yB.js";import"./chunk-DjdYu-xF.js";import"./chunk-BHPWSuhB.js";/* empty css              */const w=s("ShortVideo",()=>{const e=o(0),t=o([]),n=new Map,a=new Map;let s=!1;function i(e,t){const a="shortVideoPlayerId_".concat(e),s=l.initPlayer(a,t);c(e,s),function(e){let t=n.get(e);t&&(t.on("loadedmetadata",()=>{}),t.on("canplay",()=>{h(e)}),t.on("play",()=>{t.video.muted=!1}),t.on("pause",()=>{}),t.on("timeupdate",()=>{null==t||t.video.currentTime}),t.on("seeked",()=>{}),t.on("error",e=>{}))}(e);const o=document.querySelector("#".concat(a)).querySelector(".dplayer-controller");if(o){o.style.padding="0px 5px";const e=o.children;for(let n=0;n<Math.min(3,e.length);n++)e[n].style.display="none";const t=o.querySelector(".dplayer-bar-wrap");t.style.width="calc(100% - 10px)",t.style.bottom="0px"}return s}function u(){var t;n.has(e.value)&&a.has(e.value)&&(null==(t=n.get(e.value))||t.play())}function r(){if(n.size>3)return;const a=[e.value-1,e.value,e.value+1];for(let e of a)e>=0&&!n.has(e)&&i(e,t.value[e])}function c(e,t){n.set(e,t)}function d(e){if(n.has(e)){const t=n.get(e);null==t||t.destroy(),n.delete(e),a.delete(e)}}function h(t){a.set(t,!0),t===e.value&&u()}return{pageIndex:e,videoList:t,init:function(){r()},loadPlayer:i,onPageChange:function(l){var o;n.has(e.value)&&a.has(e.value)&&(null==(o=n.get(e.value))||o.pause()),e.value=l,u(),r(),function(){if(n.size<=3)return;const t=[e.value-1,e.value,e.value+1];n.forEach((e,n)=>{t.includes(n)||d(n)})}(),!s&&l>=t.value.length-2&&(s=!0)},addPlayer:c,removePlayer:d,onPlayerReady:h}}),P={class:"relative h-full w-full"},b={class:"absolute bottom-1 text-white"},S=i({__name:"ShortVideoItemView",props:{url:{},index:{}},setup(e){const t=e,n=w(),a="shortVideoPlayerId_".concat(t.index);return u(()=>{t.index===n.pageIndex&&n.init()}),r(()=>{}),(e,n)=>(p(),c("div",P,[d("div",{id:a,class:"h-full w-full"}),d("div",b,"播放页: "+h(t.index),1)]))}}),_={class:"w-full overflow-hidden"},I={class:"slide-inner flex h-full w-full items-center justify-center bg-blue-400"},z=g(i({__name:"index",setup(s){const l=[n,a],i=o(),h=w(),g=e=>{i.value=e},P=()=>{h.onPageChange(i.value.activeIndex)},b=o({height:"0px"});return u(()=>{const e=window.innerHeight;b.value.height=e-56+"px";for(let t=0;t<10;t++)h.videoList.push("https://test-streams.mux.dev/x36xhzz/x36xhzz.m3u8")}),r(()=>{}),(n,a)=>(p(),c("div",_,[v(j(t),{class:"",style:k(b.value),direction:"vertical",initialSlide:0,"slides-per-view":1,"space-between":0,speed:300,onSwiper:g,onSlideChange:P,modules:l},{default:m(()=>[(p(!0),c(f,null,y(j(h).videoList,(t,n)=>(p(),x(j(e),{key:n},{default:m(()=>[d("div",I,[v(S,{url:t,index:n},null,8,["url","index"])])]),_:2},1024))),128))]),_:1},8,["style"])]))}}),[["__scopeId","data-v-c1903c20"]]);export{z as default};
