import{Ct as e,E as t,Tt as n}from"./vue-vendor-DMUmTARL.js";import{I as r,bt as i,m as a,v as o,vt as s,yt as c}from"./index-kSn5YXd0.js";import{n as l,t as u}from"./home-esSulirG.js";var d=e({expireTime:null,customKey:``}),f=n(``),{storageKey:p}=s(),{selectFiles:m}=i(),h=c(),g=n([]),_=t(()=>g.value.length>0?g.value[0]:null),v=n(!1),y=()=>({storageKey:``,files:[]}),b=n(y()),x=t(()=>b.value.files),S=t(()=>x.value.length);function C(){let e=o(),t=e=>String(e??b.value.storageKey??p.value??``),n=()=>({storageKey:String(p.value??``),files:m.value.map(e=>({name:e.name,size:e.size,time:e.time,path:e.path,type:e.type,icon:e.icon,fileType:e.fileType}))}),i=()=>{b.value=y()};return{currentLinkDialogType:f,openGenerateLinkDialog:t=>{let r=n();if(!r.files.length){e.warning(`请至少选择一个文件`);return}f.value=t,b.value=r,d.customKey=``,v.value=!0},generateLinkFormData:d,selectedLinkFiles:x,selectedLinkFileCount:S,generateLinkResultDialogVisible:v,closeGenerateLinkResultDialog:()=>{v.value=!1,g.value=[],i()},copyText:e=>{a(e)},data:_,dataList:g,batchGetFilePathLink:async(e,n)=>{let i=[],a=t(n),o={storageKey:a,paths:[],expireTime:0};return e.forEach(e=>{let t=r(e.path,e.name);o.paths.push(t)}),a?(((await u(o)).data||[]).forEach(e=>{i.push(e.address||``)}),i):(console.warn(`[file-link] 缺少 storageKey，已跳过批量生成直链`,{paths:o.paths}),i)},batchGetShortLink:async(e,n)=>{let i=[],a=t(n),o={storageKey:a,paths:[],expireTime:d.expireTime};return e.forEach(e=>{let t=r(e.path,e.name);o.paths.push(t)}),a?(h.permission.customShortLinkKey&&e.length===1&&d.customKey&&(o.customKey=d.customKey.trim()),((await l(o)).data||[]).forEach(e=>{i.push(e.address||``)}),i):(console.warn(`[file-link] 缺少 storageKey，已跳过批量生成短链`,{paths:o.paths}),i)}}}export{C as t};