import{C as R,w as g,x as V,h as j}from"./index-BTglIPU2.js?v=1773287522785";import{_ as x}from"./index.vue_vue_type_script_setup_true_lang-D8O2mMsP.js?v=1773287522785";import{A as b,T as L,U as M,w as q}from"./FileIcon-eIHDRaxH.js?v=1773287522785";import{k as A,R as D,i as E,r as I,e as X,$ as G,a8 as H,a9 as o,_ as m,a0 as s,S as n,j as h,aa as f,X as J}from"./vue-core-DJjvd5ZC.js?v=1773287522785";import{a1 as K,a3 as O,a4 as Q,b as W}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 Y={class:"p-20px"},Z={class:"w-240px"},me=A({name:"PasteSingleConfirm",__name:"PasteSingleConfirm",setup(ee,{expose:$}){const{t:_}=D(),c=E("fileStore"),{currentPath:d,fileList:v,fileCopyCache:w,copiedFile:F,waitForPaste:T}=c,i=I(!1),a=X({type:"rename",name:"",size:0,modifyTime:""}),N=e=>{const t=b(v.value,w.value);t.length&&(e==="overwrite"?a.name=t[0].nm:e==="rename"&&(a.name=C(t[0].nm)))},C=e=>e.replace(/\.(?=[^.]+$)/," - copy.");function k(){i.value=!0;const e=b(v.value,w.value);e.length==1&&(a.type="rename",a.name=C(e[0].nm),a.size=e[0].sz,a.modifyTime=g(e[0].mt))}function p(){i.value=!1}async function u(){await M(F.value.path,d.value+"/"+a.name),T.value=!1,q(c)}async function z(){if(a.type=="rename")return await L(d.value,a.name)?j({title:_("file.pasteConfirm.overwriteTitle"),content:_("file.pasteConfirm.overwriteMessage",[a.name]),onConfirm:async({hide:t})=>{await u(),t(),p()}}):(await u(),p()),!1;await u()}return $({open:k,close:p}),(e,t)=>{const y=Q,P=O,r=K,S=W,U=x,B=V;return G(),H(B,{show:n(i),"onUpdate:show":t[2]||(t[2]=l=>J(i)?i.value=l:null),width:440,title:e.$t("file.pasteConfirm.title"),footer:!0,onConfirm:z},{default:o(()=>[m("div",Y,[s(U,null,{default:o(()=>[s(r,{label:e.$t("file.pasteConfirm.operationType")},{default:o(()=>[s(P,{value:n(a).type,"onUpdate:value":[t[0]||(t[0]=l=>n(a).type=l),N]},{default:o(()=>[s(y,{value:"overwrite"},{default:o(()=>[h(f(e.$t("file.pasteConfirm.overwriteFile")),1)]),_:1}),s(y,{value:"rename"},{default:o(()=>[h(f(e.$t("file.pasteConfirm.renameFile")),1)]),_:1})]),_:1},8,["value"])]),_:1},8,["label"]),s(r,{label:e.$t("file.pasteConfirm.fileName")},{default:o(()=>[m("div",Z,[s(S,{value:n(a).name,"onUpdate:value":t[1]||(t[1]=l=>n(a).name=l),disabled:n(a).type=="overwrite",placeholder:""},null,8,["value","disabled"])])]),_:1},8,["label"]),s(r,{label:e.$t("file.pasteConfirm.size")},{default:o(()=>[m("span",null,f(n(R)(n(a).size)),1)]),_:1},8,["label"]),s(r,{label:e.$t("file.pasteConfirm.lastModified"),"show-feedback":!1},{default:o(()=>[m("span",null,f(n(g)(n(a).modifyTime)),1)]),_:1},8,["label"])]),_:1})])]),_:1},8,["show","title"])}}});export{me as default};
