import{C as e,k as t,l as n,v as r}from"./dist-0RiHuA5w-BQ4dSt6u.js";import{C as i,_ as a,a as o,b as s,f as c,i as l,l as u,m as d,p as f,t as p,u as m,w as h,x as g}from"./connect-BSkeWkEI-qzWu76a7-c-ANI5Gp.js";import _,{useRef as v}from"react";import{jsx as y,jsxs as b}from"react/jsx-runtime";function x(e){return e.documentModel.global}function S(){let{isAllowedToCreateDocuments:e}=i(),t=f()?.filter(e=>e.documentModel.global.id!==`powerhouse/document-drive`);return e?b(`div`,{className:`px-6 py-4`,children:[y(`h3`,{className:`mb-3 text-xl font-bold text-gray-600`,children:`New document`}),y(`div`,{className:`flex w-full flex-wrap gap-4`,children:t?.map(e=>{let t=x(e),r=e.version?` v${e.version}`:``;return y(n,{color:`light`,title:`${t.name}${r}`,"aria-description":t.description,onClick:()=>c(t.id),children:b(`span`,{className:`text-sm`,children:[t.name,r]})},`${t.id}-v${e.version??1}`)})})]}):null}var C=8,w=256,T=48,E=420;function D(){let e=v(null),n=t().innerWidth-E,r=a().filter(e=>u(e)),i=Math.floor(n/(w+C))||1,o=h({count:Math.ceil(r.length/i),getScrollElement:()=>e.current,estimateSize:e=>e>0?T+C:T,overscan:5}),s=h({horizontal:!0,count:i,getScrollElement:()=>e.current,estimateSize:e=>e>0?w+C:w,overscan:5}),c=(e,t)=>e*i+t,d=(e,t)=>r[c(e,t)]||null;if(r.length===0)return y(`div`,{className:`mb-8 text-sm text-gray-400`,children:`No documents or files 📄`});let f=(e,t)=>{let n=d(e,t);return n?y(`div`,{style:{marginLeft:t===0?0:C},children:y(l,{fileNode:n},n.id)}):null};return y(`div`,{ref:e,style:{width:`100%`,overflow:`auto`},children:y(`div`,{style:{height:`${o.getTotalSize()}px`,width:`${s.getTotalSize()}px`,position:`relative`},children:o.getVirtualItems().map(e=>y(_.Fragment,{children:s.getVirtualItems().map(t=>y(`div`,{style:{position:`absolute`,top:0,left:0,marginTop:e.index===0?0:C,width:`${t.size}px`,height:`${T}px`,overflow:`hidden`,transform:`translateX(${t.start}px) translateY(${e.start}px)`},children:f(e.index,t.index)},t.key))},e.key))})})}function O({children:e,className:t,...n}){return y(O.Container,{className:t,...n,children:e})}O.Container=function({children:e,className:t,containerProps:n,...i}){return y(`div`,{className:r(`flex grow flex-col overflow-auto`,t),...n,...i,children:e})},O.Header=function({children:e,className:t,containerProps:n,...i}){return y(`div`,{className:r(`flex-0`,t),...n,...i,children:e})},O.Content=function({children:e,className:t,containerProps:n,...i}){return y(`div`,{className:r(`mb-5 flex-1 px-4`,t),...n,...i,children:e})},O.ContentSection=function({title:e,children:t,className:n,containerProps:i,...a}){return b(`div`,{className:r(n),...i,...a,children:[e&&y(`div`,{className:`mb-4 text-base font-semibold text-gray-600`,children:e}),y(`div`,{className:`flex flex-wrap gap-2`,children:t})]})},O.Footer=function({children:e,className:t,containerProps:n,...i}){return y(`div`,{className:r(`flex-0`,t),...n,...i,children:e})};function k(t){let{className:n}=t,r=a(),i=s(),c=r.filter(e=>m(e)),{isDropTarget:l,dropProps:u}=d({target:i});return b(`div`,{className:e(`rounded-md border-2 border-transparent p-2`,l&&`border-dashed border-blue-100`,n),...u,children:[y(O.ContentSection,{title:`Folders`,className:`mb-4`,children:c.length>0?c.map(e=>y(o,{folderNode:e},e.id)):y(`div`,{className:`mb-8 text-sm text-gray-400`,children:`No documents or files 📄`})}),y(O.ContentSection,{title:`Documents and files`,children:y(`div`,{className:`w-full`,children:y(D,{})})})]})}var A={allowedDocumentTypes:[],isDragAndDropEnabled:!0};function j(e){g(A);let{className:t,children:n}=e,{isDropTarget:r,dropProps:i}=d(),a=!!n;return b(O,{className:t,children:[!a&&y(O.Header,{children:y(p,{})}),a?n:y(O.Content,{...i,className:r?`rounded-xl bg-blue-100`:``,children:y(k,{})}),!a&&y(O.Footer,{children:y(S,{})})]})}export{j as default};
//# sourceMappingURL=editor-C0H0hEHd--dASE4vM.js.map