import{D as e,H as t,K as n,T as r,Tt as i,W as a,b as o,f as s,nt as c,pt as l,v as u,w as d,x as f}from"./vue.runtime.esm-bundler-gHHLlCcd.js";import{a as p,t as m}from"./backend-BIDAMQu4.js";import{n as h,r as g,t as _}from"./_plugin-vue_export-helper-BgFcNt9i.js";var v=`剪辑视频`;async function y(){return(await m({url:`/clips/?dir=${v}`})).data?.data??[]}async function b(e){return(await m({url:`/clips/${e}/`,method:`DELETE`})).data}var x={class:`gallery`},S={class:`gallery-hd`},C={key:0,class:`hd-count`},w={key:0,class:`empty`},T={key:1,class:`empty`},E={key:2,class:`grid`},D=[`onClick`],O=[`src`],k={key:1,class:`thumb-placeholder`},A={key:2,class:`duration`},j={class:`info`},M=[`title`],N={class:`meta`},P={key:0},F={key:1},I={class:`actions`},L=[`onClick`],R=[`onClick`],z={class:`preview-modal`},B={class:`preview-title`},V=[`src`],H=_(e({name:`clip-gallery`,__name:`index`,setup(e){let m=l([]),_=l(!0),v=l(``),H=l(!1),U=l(``);t(async()=>{try{m.value=await y()}catch{m.value=[]}_.value=!1});function W(e){v.value=e.url,U.value=e.title,H.value=!0}let G=h;async function K(e){if(window.confirm(`确定删除"${e.title}"吗？此操作不可恢复。`))try{await b(e.id),m.value=m.value.filter(t=>t.id!==e.id),window.$message?.success(`已删除`)}catch{window.$message?.error(`删除失败`)}}function q(e){window.open(e.startsWith(`http`)?e:G+e,`_blank`)}function J(e){return e.startsWith(`http`)?e:G+e}function Y(e){let t=e?.trim();if(!t)return``;let n=Number(t);if(Number.isFinite(n))return n<1024?`${n.toFixed(0)} B`:n<1024*1024?`${(n/1024).toFixed(1)} KB`:`${(n/(1024*1024)).toFixed(1)} MB`;let r=t.match(/^(\d+(?:\.\d+)?)\s*(B|KB|MB|GB|TB|KIB|MIB|GIB)$/i);return r?`${r[1]} ${r[2].toUpperCase()}`:`大小未知`}function X(e){let t=e.createdAt?.trim(),n=e.title?.trim();return!!(t&&t!==n)}return(e,t)=>{let l=g,h=p;return a(),f(`div`,x,[u(`div`,S,[t[3]||=u(`span`,{class:`hd-line`},null,-1),t[4]||=u(`span`,{class:`hd-title`},`剪辑成品展示`,-1),m.value.length?(a(),f(`span`,C,`共 `+i(m.value.length)+` 个`,1)):o(``,!0)]),_.value?(a(),f(`div`,w,`加载中...`)):m.value.length?(a(),f(`div`,E,[(a(!0),f(s,null,n(m.value,e=>(a(),f(`div`,{key:e.id,class:`card`},[u(`div`,{class:`thumb`,onClick:t=>W(e)},[e.thumbnail?(a(),f(`img`,{key:0,src:J(e.thumbnail),class:`thumb-img`},null,8,O)):(a(),f(`div`,k,[...t[6]||=[u(`span`,{class:`play-icon`},`▶`,-1)]])),e.duration?(a(),f(`span`,A,i(e.duration),1)):o(``,!0)],8,D),u(`div`,j,[u(`div`,{class:`title`,title:e.title},i(e.title),9,M),u(`div`,N,[X(e)?(a(),f(`span`,P,i(e.createdAt),1)):o(``,!0),e.size?(a(),f(`span`,F,i(Y(e.size)),1)):o(``,!0)]),u(`div`,I,[u(`button`,{class:`act-btn primary`,onClick:t=>q(e.url)},`下载`,8,L),u(`button`,{class:`act-btn danger`,onClick:t=>K(e)},`删除`,8,R)])])]))),128))])):(a(),f(`div`,T,[...t[5]||=[u(`div`,{class:`empty-icon`},`🎬`,-1),u(`div`,{class:`empty-text`},`暂无成品视频`,-1),u(`div`,{class:`empty-tip`},`在首页完成视频剪辑后，成品将自动展示在这里`,-1)]])),r(h,{show:H.value,"onUpdate:show":t[2]||=e=>H.value=e,style:{width:`720px`}},{footer:c(()=>[r(l,{onClick:t[0]||=e=>H.value=!1},{default:c(()=>[...t[7]||=[d(`关闭`,-1)]]),_:1}),r(l,{type:`primary`,onClick:t[1]||=e=>q(v.value)},{default:c(()=>[...t[8]||=[d(`下载`,-1)]]),_:1})]),default:c(()=>[u(`div`,z,[u(`div`,B,i(U.value),1),v.value?(a(),f(`video`,{key:v.value,class:`preview-video`,controls:``,autoplay:``,src:J(v.value)},null,8,V)):o(``,!0)])]),_:1},8,[`show`])])}}}),[[`__scopeId`,`data-v-9bd7a8b3`]]);export{H as default};