import{r as a,j as n}from"./vendor-react-wBh_31cN.js";import"./toast-wiGcevcF.js";import"./icon-button-BZeFL7T7.js";import{a4 as T,a0 as g,p as h}from"./index-dNe6i2rS.js";import{F as O}from"./fileUploader-Bkmyjd3t.js";import{u as k}from"./useNotifier-BGMn6HaH.js";import{j as v,u as y}from"./vendor-redux-CJZrIb6x.js";import{d as z}from"./index-B3Hxcv-8.js";import{a as G,b as N,c as U,F as i}from"./file-utils-B4k-DQmp.js";import{u as j,a as K}from"./utils-DDC-jqbJ.js";const H=({firstRef:r,fileUploaderProps:l,uploadingFiles:c,onUpdateData:u,onUploadSelect:e,setNewNameMapping:s,setUploadingFiles:p})=>{const m=a.useCallback(()=>{const t=Object.values(r.current.files);p(t),e==null||e(t)},[r,e,p]);return n.jsxs(n.Fragment,{children:[n.jsx("input",{ref:r,type:"file",multiple:!0,className:"hidden",onChange:m}),n.jsx(O,{helperForNewArr:u,...l,arrayToUpload:c,onChangeFileName:s})]})},J=()=>{const[r,l]=a.useState([]),[c,u]=a.useState(j()),e=v(),s=k(),p=y(o=>o.uploadProgress.nameMapping),m=y(o=>o.uploadProgress.progress),t=a.useCallback(o=>{l(o),e.uploadProgress.setFiles(o.map(d=>({name:d.name,size:d.size,uploadKey:d.uploadId})))},[e]),F=a.useCallback(o=>{e.uploadProgress.setNameMapping(o)},[e]),E=a.useCallback(o=>{l(d=>d.filter(I=>K(I)!==o)),e.uploadProgress.removeFile(o)},[e]),C=a.useCallback(()=>{u(j()),l([]),e.uploadProgress.clear()},[e]),P=a.useCallback(o=>{e.uploadProgress.updateProgress(o),!o.canceled&&(o.percentage===100&&e(z.invalidateTags([{type:T.ProjectTags.FileExplorer,id:G(o.path)}])),o.failed&&s.error({title:"Error",content:o.message,duration:6e3}))},[e,s]);return{componentKey:c,newNameMapping:p,uploadingFiles:r,uploadProgress:m,onClose:C,onRemoveFile:E,onUpdateData:P,setNewNameMapping:F,setUploadingFiles:t}},f="sm",Q=({isDir:r,isEmpty:l,fileName:c,isSharedFrom:u,isSharedWith:e,className:s})=>{if(r&&u)return n.jsx(g,{icon:"sharedFrom",color:"primary",size:f,className:s});if(r&&e)return n.jsx(g,{icon:"sharedWith",color:"primary",size:f,className:s});const p=N({isDir:r,fileName:c}),m=U({isDir:r,fileName:c}),t=h(m,M);if(t)return n.jsx(g,{...t,size:f,className:s});const F=h(p,w);return n.jsx(g,{...F,size:f,className:s})},M={ipynb:{icon:"jupyter",color:"labels.orange"},py:{icon:"python"}},w={[i.data]:{icon:"fileData",color:"labels.blue"},[i.db]:{icon:"db",color:"primary"},[i.file]:{icon:"file",color:"black"},[i.folder]:{icon:"folder",color:"primary"},[i.image]:{icon:"fileImage",color:"labels.purple"},[i.script]:{icon:"filecode",color:"labels.red"},[i.zip]:{icon:"fileZip",color:"labels.orange"}};let b=null,x=null;const V=r=>{b=r},X=r=>b?(b(r),!0):!1,Y=r=>{x=r},$=()=>x?(x(),!0):!1;export{Q as F,H as U,Y as a,$ as f,V as r,X as s,J as u};
