import"./rolldown-runtime-BM3Ffeng.js";import{D as e,dt as t,ot as ee}from"./element-plus-vendor-BF9PNysW.js";import{A as n,D as r,G as te,I as i,J as a,N as ne,O as o,P as s,Pt as c,Tt as l,Xt as re,_ as u,bt as ie,et as d,gt as ae,ht as f,k as p,o as m,pt as h,q as g,qt as oe,s as _,y as se}from"./vue-vendor-DMUmTARL.js";import{si as ce}from"./icons-vendor-Buq6V-Ga.js";import{Tt as v,l as y,lt as b,p as le,y as x}from"./index-y6crcKNt.js";import{C as S,w as C,y as w}from"./useFileData-qOOvmLNB.js";import{t as T}from"./useShareData-DPa2I9UF.js";import ue from"./MobileActionBar-BGm2XYkb.js";import{t as E}from"./route-block-O8f67cnX.js";import{_ as de,a as fe,c as pe,d as D,f as O,g as k,i as A,l as j,n as M,o as N,r as P,s as F,t as I,u as L}from"./ImagePreviewDialog-CM4Kdrgi.js";import{n as R,t as z}from"./ShareInvalidPanel-Deh2r6Sf.js";var B=i({__name:`ShareContextmenu`,setup(e){return(e,t)=>(d(),o(N,{mode:`share`}))}}),me={key:0,class:`mx-auto flex w-full max-w-md flex-1 flex-col items-center justify-center gap-4 text-center`,role:`status`,"aria-live":`polite`},he={key:2,class:`mx-auto flex w-full max-w-md flex-1 flex-col justify-center space-y-8`},ge={class:`space-y-2`},V={__name:`[shareKey]`,setup(i){let v=x(),{toolbarEnabled:E}=S();A();let{shareInitializing:N,shareVerified:V,sharePassword:H,initShare:_e,verifySharePassword:ve,loadShareFiles:U,shareInvalid:W,shareErrorMsg:ye,clearShareRuntime:be}=T(),G=b(),xe=y(),{showFileMenu:K}=w(),q=l();fe(q);let{zfileSettingCache:J}=C(),Y=m(),Se=_(),X=l(``),Z=l(),Q=l(!1);g(async()=>{Y.query.pwd&&(X.value=String(Y.query.pwd)),await _e(),te(()=>{!V.value&&!W.value&&Z.value?.focus?.()})});let $=async()=>{if(!X.value.trim()){v.warning(`请输入访问密码`);return}Q.value=!0;try{await ve(X.value)?(H.value=X.value,V.value=!0,await Se.replace({path:Y.path,query:{...Y.query||{},pwd:X.value}}),await U(Y.query.path||`/`)):v.error(`密码错误，请重新输入`)}finally{Q.value=!1}};h(()=>Y.query.path,e=>{V.value&&U(e||`/`)});let Ce=()=>window.location.href=`/`;return a(()=>{be(`share-page-unmount`)}),(te,i)=>{let a=ce,l=t,m=ee,h=e,g=B,_=F,v=pe,y=j,b=L,x=D,S=O,C=I,w=k,T=de;return d(),n(`div`,{class:`zf-file-index__body h-full`,onContextmenu:i[1]||=(...e)=>c(K)&&c(K)(...e)},[c(N)||c(W)||!c(V)?(d(),o(R,{key:0},{default:f(()=>[c(N)?(d(),n(`div`,me,[s(a,{class:`h-8 w-8 animate-spin text-zp`}),i[2]||=r(`div`,null,[r(`h2`,{class:`mb-2 text-xl font-bold text-primary`},`正在打开分享`),r(`p`,{class:`text-secondary`},`正在确认分享状态，请稍候`)],-1)])):c(W)?(d(),o(z,{key:1,msg:c(ye),"action-text":`返回首页`,onAction:Ce},null,8,[`msg`])):(d(),n(`div`,he,[i[4]||=r(`div`,{class:`text-center md:text-left`},[r(`h2`,{class:`mb-2 text-2xl font-bold text-primary`},`访问受限`),r(`p`,{class:`text-secondary`},`此分享受密码保护，请输入访问密码`)],-1),s(h,{class:`space-y-6`,onSubmit:se($,[`prevent`])},{default:f(()=>[r(`div`,ge,[i[3]||=r(`label`,{class:`ml-0.5 block text-sm font-medium text-regular`},`访问密码`,-1),s(l,{ref_key:`passwordInputRef`,ref:Z,modelValue:c(X),"onUpdate:modelValue":i[0]||=e=>ie(X)?X.value=e:null,type:`password`,placeholder:`请输入密码`,"show-password":``,size:`large`,class:`zf-ds-clean-input`},null,8,[`modelValue`])]),s(m,{type:`primary`,size:`large`,loading:c(Q),class:`!h-[48px] w-full !rounded-lg !text-[15px] !font-semibold !tracking-wide transition-all active:!scale-[0.99]`,onClick:$},{default:f(()=>[ne(re(c(Q)?`验证中...`:`查看文件`),1)]),_:1},8,[`loading`])]),_:1})]))]),_:1})):(d(),n(`div`,{key:1,ref_key:`fileIndexBodyRef`,ref:q,class:oe(`zf-file-index__table--`+(c(le)?c(G).globalConfig?.mobileLayout:c(G).globalConfig?.layout))},[c(J).view.type===`table`?(d(),o(P,{key:0,"share-mode":!0,class:`zf-file-view`})):p(``,!0),c(J).view.type===`card`?(d(),o(M,{key:1,"share-mode":!0,class:`zf-file-view`})):p(``,!0),s(g),s(_),s(v),s(y),s(b),s(x),s(S),s(C),s(w),ae(s(T,null,null,512),[[u,c(xe).zfileConfig.gallery.showBackTop]]),c(E)?(d(),o(ue,{key:2,mode:`share`})):p(``,!0)],2))],32)}}};typeof E==`function`&&E(V);var H=v(V,[[`__scopeId`,`data-v-f40177b8`]]);export{H as default};