import{B as e,C as t,G as n,I as r,J as i,R as a,S as o,T as s,f as c,ht as l,k as u,n as d,pt as f,t as p,v as m,w as h,x as g}from"./folders.j8Vf02Wn.js";import{c as _,h as v,o as y}from"./style.BtGWTIRi.js";import{i as b,n as x,r as S}from"../options.C1oHSPEM.js";import{t as C}from"./LinkCard.BUwb4UH-.js";import{t as w}from"./Breadcrumbs.U9RvuAvq.js";var T={__name:`DropZone`,props:{targetFolderId:{type:String,required:!0},visible:{type:Boolean,default:!0}},emits:[`drop`],setup(e,{emit:t}){let n=e,a=t,o=ref(!1);function c(e){e.preventDefault(),o.value=!1;let t=e.dataTransfer.getData(`text/link-id`);t&&a(`drop`,t,n.targetFolderId)}return(t,n)=>e.visible?(r(),s(`div`,{key:0,onDragover:n[0]||=v(e=>o.value=!0,[`prevent`]),onDragleave:n[1]||=v(e=>o.value=!1,[`prevent`]),onDrop:c,class:f([`mb-2 rounded-md border-2 border-dashed border-border px-3 py-2 text-center text-xs text-muted-foreground transition-colors`,{"border-primary bg-accent/30":i(o)}])},` Drop links here to move to this folder `,34)):h(``,!0)}},E={class:`folder-view p-4`},D={key:0,class:`mb-4 flex items-center justify-between`},O={class:`text-lg font-medium text-foreground`},k={key:1,class:`mb-4 flex flex-wrap gap-2`},A=[`onClick`],j={key:3,class:`py-12 text-center`},M={class:`text-4xl mb-2`},N={class:`text-lg font-medium text-foreground mb-1`},P={__name:`FolderView`,setup(v){let P=x(),F=S(),I=d(),L=p(),R=_(),{captureActiveTab:z,captureAllTabs:ee}=y(),B=n([]),V=n(R.viewMode||c.LIST),H=n(null),U=g(()=>{let e=P.params.folderId;if(!e)return[];let t=L.getAllDescendantIds(e);return I.links.filter(n=>n.folderId===e||t.includes(n.folderId))}),W=g(()=>L.getFolder(P.params.folderId)),G=g(()=>P.params.folderId?L.getChildren(P.params.folderId):[]);function K(e){B.value.includes(e)?B.value=B.value.filter(t=>t!==e):B.value=[...B.value,e]}function q(){B.value=[]}function J(){B.value=U.value.map(e=>e.id)}let Y=g(()=>B.value.length),X=g(()=>B.value.length>0);function Z(e){window.open(e.url,`_blank`)}function Q(e){I.starLink(e.id,!e.starred)}function $(){V.value=V.value===c.LIST?c.GRID:c.LIST,R.update(`viewMode`,V.value)}return e(()=>P.fullPath,()=>{q()}),(e,n)=>(r(),s(`div`,E,[u(w,{"folder-id":i(P).params.folderId},null,8,[`folder-id`]),W.value?(r(),s(`div`,D,[o(`h2`,O,l(W.value.name),1),o(`button`,{onClick:$,class:`btn btn-ghost btn-sm`},l(V.value===i(c).LIST?`☰`:`⬜`),1)])):h(``,!0),G.value.length>0?(r(),s(`div`,k,[(r(!0),s(m,null,a(G.value,e=>(r(),s(`button`,{key:e.id,onClick:t=>i(F).push(`/organize/folder/${e.id}`),class:`btn btn-secondary btn-sm`},` 📁 `+l(e.name),9,A))),128))])):h(``,!0),X.value&&W.value?(r(),t(T,{key:2,"target-folder-id":W.value.id,class:f({"opacity-100":H.value===W.value.id,"opacity-50":!X.value})},null,8,[`target-folder-id`,`class`])):h(``,!0),U.value.length===0?(r(),s(`div`,j,[o(`div`,M,l(W.value?.icon===`inbox`?`📥`:`📭`),1),o(`h3`,N,l(W.value?.name||`Folder`)+` is empty `,1),n[0]||=o(`p`,{class:`text-sm text-muted-foreground`},`Capture some links to get started`,-1)])):(r(),s(`div`,{key:4,class:f([`gap-2`,V.value===i(c).GRID?`grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4`:`grid grid-cols-1`])},[(r(!0),s(m,null,a(U.value,e=>(r(),t(C,{key:e.id,link:e,selected:B.value.includes(e.id),"view-mode":V.value,onToggleSelect:t=>K(e.id),onToggleStar:t=>Q(e),onOpen:t=>Z(e)},null,8,[`link`,`selected`,`view-mode`,`onToggleSelect`,`onToggleStar`,`onOpen`]))),128))],2)),X.value?(r(),t(b,{key:5,count:Y.value,"selected-ids":B.value,onClear:q,onSelectAll:J},null,8,[`count`,`selected-ids`])):h(``,!0)]))}};export{P as default};