import{bU as j,P as x,D as r,q as c,aE as $,aM as k,j as y,ah as w,aR as C,S as g,dR as n,a_ as I,aL as v,aQ as M,ag as S,bT as P,$ as d,ab as _,av as z}from"./index-CNZMR1GT.js";import{b as E}from"./style-Cn-hRd7R.js";import{J as K}from"./index-DsSWFirV.js";import{I as W}from"./ImageWithError-BqB24ruv.js";import{g as O,O as b}from"./icon-BZFY9fuK.js";import{I as A,u as D}from"./helper-Dlk8y7oL.js";const q=e=>{const{isHide:m}=j();if(m(e.obj))return null;const{setPathAs:h}=x(),i=r(k,{get color(){return $()},get boxSize(){return"".concat(parseInt(c.grid_item_size)-30,"px")},get as(){return O(e.obj)}}),{show:f}=E({id:1}),{pushHref:o,to:l}=y(),{openWithDoubleClick:a,toggleWithClick:s,restoreSelectionCache:u}=D();return r(z.div,{initial:{opacity:0,scale:.9},animate:{opacity:1,scale:1},transition:{duration:.2},style:{width:"100%"},get children(){return r(w,{get classList(){return{selected:!!e.obj.selected}},class:"grid-item viselect-item",get"data-index"(){return e.index},w:"$full",p:"$1",spacing:"$1",rounded:"$lg",transition:"all 0.3s",get _hover(){return{transform:"scale(1.06)",bgColor:d()}},as:K,get href(){return e.obj.name},get cursor(){return a()||s()?"default":"pointer"},get bgColor(){return _(()=>!!e.obj.selected)()?d():void 0},"on:dblclick":()=>{a()&&(n(e.index,!0,!0),l(o(e.obj.name)))},"on:click":t=>{if(t.preventDefault(),!a()&&!(t.ctrlKey||t.metaKey||t.shiftKey)&&u()){if(s())return n(e.index,!e.obj.selected);l(o(e.obj.name))}},onMouseEnter:()=>{h(e.obj.name,e.obj.is_dir,!0)},onContextMenu:t=>{P(()=>{n(e.index,!0,!0)}),f(t,{props:e.obj})},get children(){return[r(C,{class:"item-thumbnail",get h(){return"".concat(parseInt(c.grid_item_size),"px")},w:"$full",get cursor(){return e.obj.type!==b.IMAGE?"inherit":"pointer"},"on:click":t=>{e.obj.type===b.IMAGE&&(t.ctrlKey||t.metaKey||t.shiftKey||u()&&(M.emit("gallery",e.obj.name),t.preventDefault(),t.stopPropagation()))},pos:"relative",get children(){return[r(g,{get when(){return I()},get children(){return r(A,{pos:"absolute",left:"$1",top:"$1","on:mousedown":t=>{t.stopPropagation()},"on:click":t=>{t.stopPropagation()},get checked(){return e.obj.selected},onChange:t=>{n(e.index,t.target.checked)}})}}),r(g,{get when(){return e.obj.thumb},fallback:i,get children(){return r(W,{maxH:"$full",maxW:"$full",rounded:"$lg",shadow:"$md",get fallback(){return r(v,{size:"lg"})},fallbackErr:i,get src(){return e.obj.thumb},loading:"lazy"})}})]}}),r(S,{css:{whiteSpace:"nowrap",textOverflow:"ellipsis"},w:"$full",overflow:"hidden",textAlign:"center",fontSize:"$sm",get title(){return e.obj.name},get children(){return e.obj.name}})]}})}})};export{q as G};
