import{E as e,Tt as t}from"./vue-vendor-DMUmTARL.js";import{n}from"./file-data-DI5vTYMf.js";function r(){let e=JSON.parse(localStorage.getItem(`_h5_player_play_progress_`)||`{}`),t=!1;for(let n of Object.keys(e)){let r=e[n]?.progress;r!==void 0&&n.endsWith(String(r))&&(delete e[n],t=!0)}t&&localStorage.setItem(`_h5_player_play_progress_`,JSON.stringify(e))}function i(){let r=n(),i=t(null),a=e(()=>r.filterFileByType(`video`)),o=e(()=>{let e=i.value;return e?a.value.findIndex(t=>t.name===e.name):-1}),s=e(()=>o.value<=0?null:a.value[o.value-1]||null),c=e(()=>o.value<0||o.value>=a.value.length-1?null:a.value[o.value+1]||null),l=e(()=>!!s.value),u=e(()=>!!c.value);function d(e,t){i.value={name:e,url:t}}return{currentVideo:i,videoList:a,currentIndex:o,prevVideo:s,nextVideo:c,hasPrev:l,hasNext:u,setCurrentVideo:d}}var a=[`.vtt`,`.srt`,`.ass`],o=`.xml`;function s(e){let t=e.lastIndexOf(`.`);return t>0?e.substring(0,t):e}function c(e,t){let n=s(t),r=e.toLowerCase(),i=t.toLowerCase(),o=n.toLowerCase();for(let e of a){let t=e.toLowerCase();if(r===i+t||r===o+t)return!0;if(!r.endsWith(t))continue;let n=r.slice(0,-t.length),a=[i,o];for(let e of a){if(!n.startsWith(e))continue;let t=n.charAt(e.length);if(t===`.`||t===`_`||t===`-`)return!0}}return!1}function l(e,t){let n=s(t);return e===t+o||e===n+o}var u=e=>e.name||``;function d(){let e=n();function t(t){let n=[];for(let r of e.fileList){let e=u(r);!e||!r.url||c(e,t)&&n.push({default:n.length===0,url:r.url,name:e,html:e})}return n}function r(t){return e.fileList.find(e=>{let n=u(e);return n?l(n,t):!1})?.url||null}function i(t){return e.fileList.some(e=>{let n=u(e);return n?c(n,t):!1})}function a(t){return e.fileList.some(e=>{let n=u(e);return n?l(n,t):!1})}return{getSubtitles:t,getDanmukuUrl:r,hasSubtitle:i,hasDanmuku:a}}export{r as n,i as r,d as t};