import"./rolldown-runtime-BM3Ffeng.js";import{a as e,ot as t}from"./element-plus-vendor-BF9PNysW.js";import{A as n,D as r,E as i,I as a,N as o,O as s,P as c,Tt as l,Xt as u,et as d,gt as f,ht as p,k as m,nt as h,pt as g,x as _}from"./vue-vendor-DMUmTARL.js";import{Ao as v,jo as y,ko as b}from"./icons-vendor-Db5MGAkr.js";import{I as x,v as S}from"./index-BcZTP2Ia.js";import{t as C}from"./_plugin-vue_export-helper-CWyGVBf-.js";import{t as w}from"./ZDialog-D5yc_FjB.js";import{t as T}from"./Breadcrumb-Bw6yH0PL.js";var E={class:`mt-3 text-sm text-secondary`},D={class:`zf-storage-folder-picker__list max-h-96 overflow-y-auto py-3`},O={role:`list`,class:`space-y-1`,"aria-label":`文件夹列表`},k=[`onClick`],A={class:`select-none truncate`},j={key:0,class:`flex min-h-48 w-full select-none flex-col items-center justify-center p-6 text-center`},M={class:`mb-4 flex h-16 w-16 items-center justify-center rounded-full bg-zp/10 dark:bg-zp/15`},N={class:`flex flex-1 items-center justify-between gap-3`},P={class:`truncate text-sm text-placeholder`},F={class:`flex shrink-0 gap-2.5`},I=C(a({__name:`StorageFolderPickerDialog`,props:{modelValue:{type:Boolean},loadFolders:{},title:{default:`选择文件夹`},initPath:{default:`/`}},emits:[`update:modelValue`,`confirm`],setup(a,{emit:C}){let I=S(),L=a,R=C,z=i({get:()=>L.modelValue,set:e=>R(`update:modelValue`,e)}),B=l(`/`),V=l([]),H=l(!1),U=i(()=>{let e=[{name:`根目录`,href:`/`,disable:!1}];return B.value.split(`/`).filter(Boolean).forEach((t,n,r)=>{e.push({name:t,href:x(`/`,r.slice(0,n+1).join(`/`)),disable:n===r.length-1})}),e}),W=async()=>{H.value=!0;try{V.value=await L.loadFolders(B.value)}catch(e){I.error(e?.message||`加载目录失败，请检查存储源是否可用`),V.value=[]}finally{H.value=!1}},G=e=>{B.value=e.fullPath,W()},K=e=>{e.href&&(B.value=decodeURI(e.href),W())},q=()=>{R(`confirm`,B.value),z.value=!1},J=()=>{z.value=!1},Y=()=>{z.value=!1};return g(()=>L.modelValue,e=>{e&&(B.value=L.initPath?.startsWith(`/`)?L.initPath:`/`,W())},{immediate:!0}),(i,l)=>{let g=T,x=b,S=v,C=y,I=t,L=w,R=e;return d(),s(L,{modelValue:z.value,"onUpdate:modelValue":l[0]||=e=>z.value=e,width:`420px`,"hidden-full-btn":!0,title:a.title,onClose:Y},{footer:p(()=>[r(`div`,N,[r(`span`,P,`当前：`+u(B.value),1),r(`div`,F,[c(I,{onClick:J},{default:p(()=>[...l[3]||=[o(`取消`,-1)]]),_:1}),c(I,{type:`primary`,onClick:q},{default:p(()=>[...l[4]||=[o(`选择当前目录`,-1)]]),_:1})])])]),default:p(()=>[r(`div`,E,[c(g,{items:U.value,onBreadcrumbClick:K},null,8,[`items`])]),f((d(),n(`div`,D,[r(`div`,O,[(d(!0),n(_,null,h(V.value,e=>(d(),n(`button`,{key:e.fullPath,type:`button`,class:`group flex w-full cursor-pointer select-none items-center rounded-lg py-2.5 text-left text-sm font-medium text-regular transition-colors duration-150 hover:bg-zf-hover hover:text-primary`,onClick:t=>G(e)},[c(x,{class:`mr-3 h-6 w-6 flex-shrink-0 text-2xl`}),r(`span`,A,u(e.name),1),c(S,{class:`ml-auto h-4 w-4 -translate-x-2 opacity-0 transition-all duration-200 group-hover:translate-x-0 group-hover:opacity-100`})],8,k))),128)),!H.value&&V.value.length===0?(d(),n(`div`,j,[r(`div`,M,[c(C,{class:`h-8 w-8 text-zp`})]),l[1]||=r(`h3`,{class:`mb-1.5 text-base font-medium text-regular`},`暂无子文件夹`,-1),l[2]||=r(`p`,{class:`text-sm text-placeholder`},`当前目录下没有更多子文件夹，可直接选择此目录`,-1)])):m(``,!0)])])),[[R,H.value]])]),_:1},8,[`modelValue`,`title`])}}}),[[`__scopeId`,`data-v-3a49afc1`]]);export{I as t};