import{c as e,d as a,h as l}from"./public.js?v=1763625242172";import{_ as t,c as s,a9 as i,p as n}from"./page_layout.js?v=1763625242172";import{b as o}from"./file.js?v=1763625242172";import{_ as c,dc as d,d5 as r,eh as p,aC as u,d9 as m}from"./naive.js?v=1763625242172";import{k as f,P as v,r as h,X as x,R as k,S as y,a3 as _,j as b,a4 as C,U as g,V as w,F as P,O as j}from"./vue.js?v=1763625242172";import"./common.js?v=1763625242172";import"./__commonjsHelpers__.js?v=1763625242172";const S={class:"flex flex-col h-full"},z={class:"flex-1 w-0 truncate"},I={class:"flex flex-1 overflow-hidden"},D={class:"w-160px py-12px overflow-auto"},E=["onClick"],F={class:"flex-1 ml-8px"},H={class:"flex-1","b-l":"1 solid #aaa"},L=n(f({__name:"index",props:{data:{}},setup(n,{expose:f}){const{t:L}=v(),O=n,{path:R,checkedType:T,callback:U}=O.data,$=h([]),A=h([]),K=h(R||"/"),{table:V,columns:X}=e([{key:"checkbox",title:"",width:36,render:e=>T.includes(e.type)?x("div",{onClick:e=>{e.stopPropagation()}},[x(c,{checked:e.filename===A.value[0],onUpdateChecked:a=>{A.value=a?[e.filename]:[]}},null)]):""},{key:"filename",title:L("Component.SelectPath.index_3"),render:e=>x("div",{class:"flex"},[x("div",{class:"flex items-center flex-1 cursor-pointer",onClick:a=>{"dir"===e.type&&(a.preventDefault(),K.value+="".concat("/"===K.value?"":"/").concat(e.filename),M(),a.stopPropagation())}},[x("div",null,["dir"===e.type?x(t,{name:"base-dir",size:"16"},null):"","file"===e.type?x(t,{name:"base-file",size:"16",color:"#666"},null):""]),x("div",{class:"ml-6px flex-1 w-0"},[x(d,null,{default:()=>[e.filename]})])])])},{key:"time",title:L("Component.SelectPath.index_4"),width:146},{key:"permission",title:L("Component.SelectPath.index_5"),width:86},{key:"owner",title:L("Component.SelectPath.index_6"),width:72}]),q=e=>({onClick:()=>{if(T.includes(e.type)){const a=p(A.value,(a=>a===e.filename));A.value=-1!==a?[]:[e.filename]}},onDblclick:()=>{T.includes(e.type)&&(K.value+="".concat("/"===K.value?"":"/").concat(e.filename),M())}}),B=()=>{const e=K.value.substring(0,K.value.lastIndexOf("/"));K.value=""===e?"/":e,M()},{loading:G,setLoading:J}=a(),M=async()=>{try{J(!0),V.data=[],A.value=[];const{message:e}=await o({path:K.value});if(s(e)){const a=[],l=r(e,"DIR",[]),t=r(e,"FILES",[]);l.forEach((e=>{a.push(N(e,"dir"))})),t.forEach((e=>{a.push(N(e,"file"))})),K.value=e.PATH,V.data=a,$.value=r(e,"DISK",[])}}finally{J(!1)}},N=(e,a)=>{const l=e.split(";"),t=l[0],s=i(l[2]),n=l[3],o=l[4];return{path:("/"!==K.value?K.value+"/":"")+t,filename:t,time:s,permission:n,owner:o,type:a}};return M(),f({onConfirm:({hide:e})=>{const a=A.value.length>0?A.value[0]:"",l=("/"!==K.value?K.value+"/":"")+a,t=V.data.find((e=>e.filename===a));null==U||U(l,t),e()}}),(e,a)=>{const s=u,i=m,n=l;return k(),y("div",S,[x(i,{class:"items-center h-50px px-12px","b-b":"1 solid #aaa"},{default:_((()=>[x(s,{onClick:B},{default:_((()=>[b(C(e.$t("Component.SelectPath.index_1")),1)])),_:1}),g("div",z,C(e.$t("Component.SelectPath.index_2"))+": "+C(w(K)),1)])),_:1}),g("div",I,[g("div",D,[(k(!0),y(P,null,j(w($),(e=>(k(),y("div",{key:e.path,class:"flex items-center p-8px pl-16px hover:bg-#ececec cursor-pointer transition-colors disk-item",onClick:a=>{return l=e.path,K.value=l,void M();var l}},[x(t,{name:"file-disk",size:"18",color:"#666"}),g("div",F,C(e.path)+" "+C(e.size[2]?"(".concat(e.size[2],")"):""),1)],8,E)))),128))]),g("div",H,[x(n,{loading:w(G),"loading-num":10,bordered:!1,"virtual-scroll":!0,"max-height":456,data:w(V).data,columns:w(X),"row-props":q},null,8,["loading","data","columns"])])])])}}}),[["__scopeId","data-v-b9968102"]]);export{L as default};
