import{e as m,f}from"./admin-storage.1997580a.js";import{G as g,r as n}from"./index.965ac11d.js";import{E as d}from"./request.2ccc188b.js";const t=g({toName:"",toKey:"",fromId:null}),y={toName:[{required:!0,message:"\u8BF7\u8F93\u5165\u65B0\u5B58\u50A8\u6E90\u540D\u79F0",trigger:"blur"}],toKey:[{required:!0,message:"\u8BF7\u8F93\u5165\u65B0\u5B58\u50A8\u6E90\u522B\u540D",trigger:"blur"},{validator:(l,e,r)=>{if(e==null||e===""){r("\u8BF7\u8F93\u5165\u5B58\u50A8\u6E90\u522B\u540D");return}if(["admin","file","login","install","s","onedrive","api","sharepoint","s3","webdav"].includes(e)){r(new Error("\u4E0D\u53EF\u5360\u7528\u7CFB\u7EDF\u7EA7\u540D\u79F0\uFF0C\u8BF7\u4FEE\u6539\u3002"));return}if(!/^[\w\-]+$/.test(e)){r(new Error("\u53EA\u5141\u8BB8\u4F7F\u7528\u5B57\u6BCD\u3001\u6570\u5B57\u3001\u4E0B\u5212\u7EBF\u3001\u6A2A\u6760"));return}m({storageKey:e}).then(i=>{i.data?r(new Error("\u8BE5\u5B58\u50A8\u6E90\u522B\u540D\u5DF2\u5B58\u5728\uFF0C\u8BF7\u4FEE\u6539\u3002")):r()})}}]},o=n(!1),a=n(!1);function K(){const l=s=>{o.value=!0,t.fromId=s.id,t.toKey=s.key,t.toName=s.name},e=()=>{o.value=!1},r=n(null);return{dialogVisible:o,openDialog:l,closeDialog:e,formData:t,rules:y,storageCopyFormRef:r,submitForm:s=>{a.value=!0,r.value.validate(i=>{i?f(t).then(p=>{d.success("\u590D\u5236\u6210\u529F"),o.value=!1,s("close")}).finally(()=>{a.value=!1}):a.value=!1})},saveLoading:a}}export{K as u};
