import{d as H,s as J,a2 as K,o as r,k as g,c as n,x as o,z as e,A as V,l as c,B as X,t as m,m as $,v as z,L as Y,p as f,N as B,Q as Z,R as ee,V as te,q as se}from"./index-00b4fcdc.js";import{L as ie,R as le,f as ne,S as oe}from"./fullScreenContextMenu-abfd166b.js";import{g as ae,F as re}from"./FileItem-40e08df3.js";import{g as de}from"./db-6498d1af.js";import{c as ce,u as me}from"./hook-ec66b7e4.js";import{o as ue}from"./functionalCallableComp-fa3cc081.js";import"./index-9c72d52d.js";import"./index-57be937e.js";const pe={class:"hint"},ge={key:1},fe={class:"no-res-hint"},ve={class:"hint"},Ie={key:2,class:"preview-switch"},ke=H({__name:"MatchedImageGrid",props:{tabIdx:{},paneIdx:{},selectedTagIds:{},id:{}},setup(D){const v=D,u=ce(s=>de(v.selectedTagIds,s)),{queue:F,images:l,onContextMenuClickU:I,stackViewEl:R,previewIdx:a,previewing:k,onPreviewVisibleChange:N,previewImgMove:w,canPreview:C,itemSize:_,gridItems:A,showGenInfo:d,imageGenInfo:h,q:G,multiSelectedIdxs:x,onFileItemClick:E,scroller:y,showMenuIdx:p,onFileDragStart:P,onFileDragEnd:U,cellWidth:q,onScroll:b}=me(u);return J(()=>v.selectedTagIds,async()=>{var s;await u.reset(),await K(),(s=y.value)==null||s.scrollToItem(0),b()},{immediate:!0}),(s,t)=>{const L=Z,O=ee,Q=te,W=oe;return r(),g("div",{class:"container",ref_key:"stackViewEl",ref:R},[n(W,{size:"large",spinning:!e(F).isIdle},{default:o(()=>{var M,S;return[n(O,{visible:e(d),"onUpdate:visible":t[1]||(t[1]=i=>V(d)?d.value=i:null),width:"70vw","mask-closable":"",onOk:t[2]||(t[2]=i=>d.value=!1)},{cancelText:o(()=>[]),default:o(()=>[n(L,{active:"",loading:!e(G).isIdle},{default:o(()=>[c("div",{style:{width:"100%","word-break":"break-all","white-space":"pre-line","max-height":"70vh",overflow:"auto"},onDblclick:t[0]||(t[0]=i=>e(X)(e(h)))},[c("div",pe,m(s.$t("doubleClickToCopy")),1),$(" "+m(e(h)),1)],32)]),_:1},8,["loading"])]),_:1},8,["visible"]),(M=e(l))!=null&&M.length?(r(),z(e(ae),{key:0,ref_key:"scroller",ref:y,class:"file-list",items:e(l),"item-size":e(_).first,"key-field":"fullpath","item-secondary-size":e(_).second,gridItems:e(A),onScroll:e(b)},{default:o(({item:i,index:T})=>[n(re,{idx:T,file:i,"cell-width":e(q),"show-menu-idx":e(p),"onUpdate:showMenuIdx":t[3]||(t[3]=j=>V(p)?p.value=j:null),onDragstart:e(P),onDragend:e(U),onFileItemClick:e(E),"full-screen-preview-image-url":e(l)[e(a)]?e(Y)(e(l)[e(a)]):"",selected:e(x).includes(T),onContextMenuClick:e(I),onPreviewVisibleChange:e(N),"is-selected-mutil-files":e(x).length>1},null,8,["idx","file","cell-width","show-menu-idx","onDragstart","onDragend","onFileItemClick","full-screen-preview-image-url","selected","onContextMenuClick","onPreviewVisibleChange","is-selected-mutil-files"])]),_:1},8,["items","item-size","item-secondary-size","gridItems","onScroll"])):e(u).load&&s.selectedTagIds.and_tags.length===1&&!((S=s.selectedTagIds.folder_paths_str)!=null&&S.trim())?(r(),g("div",ge,[c("div",fe,[c("p",ve,m(s.$t("tagSearchNoResultsMessage")),1),n(Q,{onClick:t[4]||(t[4]=i=>e(ue)()),type:"primary"},{default:o(()=>[$(m(s.$t("rebuildImageIndex")),1)]),_:1})])])):f("",!0),e(k)?(r(),g("div",Ie,[n(e(ie),{onClick:t[5]||(t[5]=i=>e(w)("prev")),class:B({disable:!e(C)("prev")})},null,8,["class"]),n(e(le),{onClick:t[6]||(t[6]=i=>e(w)("next")),class:B({disable:!e(C)("next")})},null,8,["class"])])):f("",!0)]}),_:1},8,["spinning"]),e(k)&&e(l)&&e(l)[e(a)]?(r(),z(ne,{key:0,file:e(l)[e(a)],idx:e(a),onContextMenuClick:e(I)},null,8,["file","idx","onContextMenuClick"])):f("",!0)],512)}}});const Se=se(ke,[["__scopeId","data-v-c4827cd4"]]);export{Se as default};
