import{x as R,as as x}from"./index-BTglIPU2.js?v=1773287522785";import{_ as M}from"./index.vue_vue_type_script_setup_true_lang-D8O2mMsP.js?v=1773287522785";import{g as U}from"./check-CNel7fTH.js?v=1773287522785";import{Q as k,w as F}from"./FileIcon-eIHDRaxH.js?v=1773287522785";import{k as q,R as C,i as E,r as B,al as N,$ as T,a8 as y,a9 as s,_ as u,a0 as r,S as o,X as I}from"./vue-core-DJjvd5ZC.js?v=1773287522785";import{a1 as S,b as V}from"./naive-ui--dJnpVcV.js?v=1773287522785";import"./prismjs-BZPoR7_J.js?v=1773287522785";import"./soft-Cjyfamvm.js?v=1773287522785";import"./copy-D-wIKr0q.js?v=1773287522785";const $={class:"p-20px pt-28px"},j={class:"w-320px"},A={class:"w-320px"},L={class:"w-320px"},Y=q({__name:"RemoteDownload",setup(P,{expose:_}){const{t:l}=C(),d=E("fileStore"),{downloadFileFormData:e,currentPath:v}=d,n=B(!1),f=N("formRef"),c={url:{trigger:["input","blur"],validator:()=>e.value.url?U(e.value.url)?!0:new Error(l("file.remoteDownloadModal.validation.urlInvalid")):new Error(l("file.remoteDownloadModal.validation.urlRequired"))},path:{trigger:["input","blur"],validator:()=>e.value.path?!0:new Error(l("file.remoteDownloadModal.validation.pathRequired"))},filename:{trigger:["input","blur"],validator:()=>e.value.filename?!0:new Error(l("file.remoteDownloadModal.validation.filenameRequired"))}},w=i=>{const a=i.split("/").pop();e.value.filename=a||""},h=()=>{e.value.url="http://",e.value.path=v.value,e.value.filename=""};_({open(){h(),n.value=!0},close(){n.value=!1}});const b=async()=>{var i;await((i=f.value)==null?void 0:i.validate()),await x.post("/files?action=DownloadFile",{...e.value}),k(d),F(d)};return(i,a)=>{const m=V,p=S,g=M,D=R;return T(),y(D,{show:o(n),"onUpdate:show":a[3]||(a[3]=t=>I(n)?n.value=t:null),title:o(l)("file.remoteDownloadModal.title"),width:500,footer:!0,onConfirm:b},{default:s(()=>[u("div",$,[r(g,{ref_key:"formRef",ref:f,model:o(e),rules:c},{default:s(()=>[r(p,{label:o(l)("file.remoteDownloadModal.urlAddress"),path:"url"},{default:s(()=>[u("div",j,[r(m,{value:o(e).url,"onUpdate:value":[a[0]||(a[0]=t=>o(e).url=t),w]},null,8,["value"])])]),_:1},8,["label"]),r(p,{label:o(l)("file.remoteDownloadModal.downloadTo"),path:"path"},{default:s(()=>[u("div",A,[r(m,{value:o(e).path,"onUpdate:value":a[1]||(a[1]=t=>o(e).path=t)},null,8,["value"])])]),_:1},8,["label"]),r(p,{label:o(l)("file.remoteDownloadModal.fileName"),path:"filename"},{default:s(()=>[u("div",L,[r(m,{value:o(e).filename,"onUpdate:value":a[2]||(a[2]=t=>o(e).filename=t)},null,8,["value"])])]),_:1},8,["label"])]),_:1},8,["model"])])]),_:1},8,["show","title"])}}});export{Y as default};
