@unciatech/file-manager 0.0.21 → 0.0.25

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/mock.js CHANGED
@@ -1,2 +1,1361 @@
1
- 'use strict';var chunkS4HRPNKF_js=require('./chunk-S4HRPNKF.js');var p=[{id:1,name:"Documents",pathId:1,path:"/1",parentId:null,fileCount:20,folderCount:0,createdAt:new Date("2024-01-01"),updatedAt:new Date("2024-01-01")},{id:2,name:"Images",pathId:2,path:"/2",parentId:null,fileCount:10,folderCount:3,createdAt:new Date("2024-01-01"),updatedAt:new Date("2024-01-01")},{id:3,name:"Videos",pathId:3,path:"/3",parentId:null,fileCount:5,folderCount:0,createdAt:new Date("2024-01-01"),updatedAt:new Date("2024-01-01")},{id:4,name:"Music Some Long Name Streched also so long to fit in the card Music Some Long Name Streched also so long to fit in the card",pathId:4,path:"/4",parentId:null,fileCount:5,folderCount:0,createdAt:new Date("2024-01-01"),updatedAt:new Date("2024-01-01")},{id:5,name:"Archives",pathId:5,path:"/5",parentId:null,fileCount:5,folderCount:0,createdAt:new Date("2024-01-01"),updatedAt:new Date("2024-01-01")},{id:6,name:"Album 01",pathId:6,path:"/2/6",parentId:2,fileCount:0,folderCount:0,createdAt:new Date("2024-01-01"),updatedAt:new Date("2024-01-01")},{id:7,name:"Album 02",pathId:7,path:"/2/7",parentId:2,fileCount:0,folderCount:0,createdAt:new Date("2024-01-01"),updatedAt:new Date("2024-01-01")},{id:8,name:"Squirrels",pathId:8,path:"/2/8",parentId:2,fileCount:1,folderCount:0,createdAt:new Date("2024-01-01"),updatedAt:new Date("2024-01-01")}],b=[{id:1,name:"Important",color:"#ef4444"},{id:2,name:"Work",color:"#3b82f6"},{id:3,name:"Personal",color:"#10b981"},{id:4,name:"Project",color:"#8b5cf6"},{id:5,name:"Archive",color:"#6b7280"}],m=[{id:101,name:"welcome.pdf",url:"/placeholder.svg?height=400&width=300",size:245e3,createdAt:new Date("2024-05-15T10:00:00Z"),updatedAt:new Date("2024-05-15T10:00:00Z"),folderId:null,tags:["important"],mime:"application/pdf",ext:".pdf",metaData:{pageCount:2,author:"Admin"}},{id:102,name:"desktop_wallpaper.jpg",url:"https://images.unsplash.com/photo-1557683316-973673baf926",size:42e5,createdAt:new Date("2024-05-14T15:30:00Z"),updatedAt:new Date("2024-05-14T15:30:00Z"),folderId:null,tags:["personal"],mime:"image/jpeg",ext:".jpg",width:5e3,height:3333,formats:{thumbnail:{ext:".jpg",url:"https://images.unsplash.com/photo-1557683316-973673baf926?w=156",hash:"thumbnail_desktop_wallpaper_abc123",mime:"image/jpeg",name:"thumbnail_desktop_wallpaper.jpg",path:null,size:5.57,width:156,height:104},small:{ext:".jpg",url:"https://images.unsplash.com/photo-1557683316-973673baf926?w=500",hash:"small_desktop_wallpaper_abc123",mime:"image/jpeg",name:"small_desktop_wallpaper.jpg",path:null,size:47.27,width:500,height:333},medium:{ext:".jpg",url:"https://images.unsplash.com/photo-1557683316-973673baf926?w=750",hash:"medium_desktop_wallpaper_abc123",mime:"image/jpeg",name:"medium_desktop_wallpaper.jpg",path:null,size:97.89,width:750,height:500},large:{ext:".jpg",url:"https://images.unsplash.com/photo-1557683316-973673baf926?w=1000",hash:"large_desktop_wallpaper_abc123",mime:"image/jpeg",name:"large_desktop_wallpaper.jpg",path:null,size:159.48,width:1e3,height:667}},metaData:{}},{id:103,name:"quick_notes.txt",url:"/placeholder.svg?height=400&width=300",size:3500,createdAt:new Date("2024-05-13T09:45:00Z"),updatedAt:new Date("2024-05-13T09:45:00Z"),folderId:null,tags:[],mime:"text/plain",ext:".txt",metaData:{}},{id:104,name:"intro_video.mp4",url:"https://docs.material-tailwind.com/demo.mp4",size:12e6,createdAt:new Date("2024-05-12T14:00:00Z"),updatedAt:new Date("2024-05-12T14:00:00Z"),folderId:null,tags:[],mime:"video/mp4",ext:".mp4",width:1920,height:1080,metaData:{duration:90,videoSource:"local"}},{id:105,name:"profile_photo.png",url:"https://images.unsplash.com/photo-1535713875002-d1d0cf377fde",size:85e4,createdAt:new Date("2024-05-11T11:20:00Z"),updatedAt:new Date("2024-05-11T11:20:00Z"),folderId:null,tags:["personal"],mime:"image/png",ext:".png",width:2e3,height:2e3,formats:{thumbnail:{ext:".png",url:"https://images.unsplash.com/photo-1535713875002-d1d0cf377fde?w=156",hash:"thumbnail_profile_photo_def456",mime:"image/png",name:"thumbnail_profile_photo.png",path:null,size:8.2,width:156,height:156},small:{ext:".png",url:"https://images.unsplash.com/photo-1535713875002-d1d0cf377fde?w=500",hash:"small_profile_photo_def456",mime:"image/png",name:"small_profile_photo.png",path:null,size:52.3,width:500,height:500},medium:{ext:".png",url:"https://images.unsplash.com/photo-1535713875002-d1d0cf377fde?w=750",hash:"medium_profile_photo_def456",mime:"image/png",name:"medium_profile_photo.png",path:null,size:110.5,width:750,height:750},large:{ext:".png",url:"https://images.unsplash.com/photo-1535713875002-d1d0cf377fde?w=1000",hash:"large_profile_photo_def456",mime:"image/png",name:"large_profile_photo.png",path:null,size:185.7,width:1e3,height:1e3}},metaData:{}},{id:106,name:"todo_list.md",url:"/placeholder.svg?height=400&width=300",size:6200,createdAt:new Date("2024-05-10T08:30:00Z"),updatedAt:new Date("2024-05-10T08:30:00Z"),folderId:null,tags:["important"],mime:"text/markdown",ext:".md",metaData:{}},{id:107,name:"app_settings.json",url:"/placeholder.svg?height=400&width=300",size:4800,createdAt:new Date("2024-05-09T16:15:00Z"),updatedAt:new Date("2024-05-09T16:15:00Z"),folderId:null,tags:[],mime:"application/json",ext:".json",metaData:{}},{id:108,name:"mountain_landscape.webp",url:"https://images.unsplash.com/photo-1506905925346-21bda4d32df4",size:12e5,createdAt:new Date("2024-05-08T13:00:00Z"),updatedAt:new Date("2024-05-08T13:00:00Z"),folderId:null,tags:["personal"],mime:"image/webp",ext:".webp",width:4e3,height:2667,metaData:{}},{id:1,name:"Key-Monastery-img.avif",url:"https://unciatrails.com/wp-content/uploads/2024/07/Key-Monastery-img.avif",size:2621440,createdAt:new Date("2023-10-26T10:30:00Z"),updatedAt:new Date("2023-10-26T10:30:00Z"),folderId:8,tags:["personal","important"],mime:"image/avif",ext:".avif",caption:"A cute squirrel in the park",alternativeText:"Gray squirrel sitting on wooden fence",width:3024,height:4032,metaData:{}},{id:2,name:"project_proposal thoda sa.pdf",url:"/placeholder.svg?height=400&width=300",size:1048576,createdAt:new Date("2024-05-10T14:20:00Z"),updatedAt:new Date("2024-05-10T14:20:00Z"),folderId:1,tags:["work","important"],mime:"application/pdf",ext:".pdf",metaData:{pageCount:15,author:"John Doe"}},{id:3,name:"quarterly_report.xlsx",url:"/placeholder.svg?height=400&width=300",size:524288,createdAt:new Date("2024-05-08T09:15:00Z"),updatedAt:new Date("2024-05-08T09:15:00Z"),folderId:1,tags:["work"],mime:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",ext:".xlsx",metaData:{pageCount:10}},{id:4,name:"presentation.pptx",url:"/placeholder.svg?height=400&width=300",size:2097152,createdAt:new Date("2024-05-05T16:45:00Z"),updatedAt:new Date("2024-05-05T16:45:00Z"),folderId:1,tags:["work","project"],mime:"application/vnd.openxmlformats-officedocument.presentationml.presentation",ext:".pptx",metaData:{pageCount:20}},{id:8,name:"documnet.doc",url:"/placeholder.svg?height=400&width=300",size:2097152,createdAt:new Date("2024-05-05T16:45:00Z"),updatedAt:new Date("2024-05-05T16:45:00Z"),folderId:1,tags:["work","project"],mime:"application/msword",ext:".doc",metaData:{pageCount:20}},{id:5,name:"demo_video.mp4",url:"https://docs.material-tailwind.com/demo.mp4",size:10485760,createdAt:new Date("2024-05-03T11:30:00Z"),updatedAt:new Date("2024-05-03T11:30:00Z"),folderId:3,tags:["project"],mime:"video/mp4",ext:".mp4",width:1920,height:1080,metaData:{duration:120,videoSource:"remote"}},{id:6,name:"podcast_episode.mp3",url:"/placeholder.svg?height=400&width=300",size:5242880,createdAt:new Date("2024-05-02T10:00:00Z"),updatedAt:new Date("2024-05-02T10:00:00Z"),folderId:4,tags:["personal"],mime:"audio/mpeg",ext:".mp3",metaData:{duration:3600}},{id:7,name:"notes.txt",url:"/placeholder.svg?height=400&width=300",size:1024,createdAt:new Date("2024-05-01T09:00:00Z"),updatedAt:new Date("2024-05-01T09:00:00Z"),folderId:1,tags:["work"],mime:"text/plain",ext:".txt",metaData:{}},{id:9,name:"data.json",url:"/placeholder.svg?height=400&width=300",size:2048,createdAt:new Date("2024-04-30T15:00:00Z"),updatedAt:new Date("2024-04-30T15:00:00Z"),folderId:1,tags:["project"],mime:"application/json",ext:".json",metaData:{}},{id:10,name:"archive.zip",url:"/placeholder.svg?height=400&width=300",size:104857600,createdAt:new Date("2024-04-29T12:00:00Z"),updatedAt:new Date("2024-04-29T12:00:00Z"),folderId:5,tags:["archive"],mime:"application/zip",ext:".zip",metaData:{description:"Project backup"}},{id:11,name:"setup.exe",url:"/placeholder.svg?height=400&width=300",size:52428800,createdAt:new Date("2024-04-28T11:00:00Z"),updatedAt:new Date("2024-04-28T11:00:00Z"),folderId:5,tags:["software"],mime:"application/x-msdownload",ext:".exe",metaData:{description:"Installer"}},{id:12,name:"old_stuff.rar",url:"/placeholder.svg?height=400&width=300",size:20971520,createdAt:new Date("2024-04-27T10:00:00Z"),updatedAt:new Date("2024-04-27T10:00:00Z"),folderId:5,tags:["archive"],mime:"application/x-rar-compressed",ext:".rar",metaData:{description:"Old files"}},{id:13,name:"meeting_notes_q1.pdf",url:"/placeholder.svg?height=400&width=300",size:856e3,createdAt:new Date("2024-03-15T09:00:00Z"),updatedAt:new Date("2024-03-15T09:00:00Z"),folderId:1,tags:["work"],mime:"application/pdf",ext:".pdf",metaData:{pageCount:8,author:"Sarah Johnson"}},{id:14,name:"budget_2024.xlsx",url:"/placeholder.svg?height=400&width=300",size:425e3,createdAt:new Date("2024-03-10T14:30:00Z"),updatedAt:new Date("2024-03-10T14:30:00Z"),folderId:1,tags:["work","important"],mime:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",ext:".xlsx",metaData:{pageCount:5}},{id:15,name:"team_photo.jpg",url:"https://images.unsplash.com/photo-1522071820081-009f0129c71c",size:32e5,createdAt:new Date("2024-02-28T11:00:00Z"),updatedAt:new Date("2024-02-28T11:00:00Z"),folderId:2,tags:["work"],mime:"image/jpeg",ext:".jpg",width:4e3,height:3e3,metaData:{}},{id:16,name:"logo_design.png",url:"https://images.unsplash.com/photo-1611162617474-5b21e879e113",size:15e5,createdAt:new Date("2024-02-20T10:00:00Z"),updatedAt:new Date("2024-02-20T10:00:00Z"),folderId:2,tags:["project"],mime:"image/png",ext:".png",width:2e3,height:2e3,metaData:{}},{id:17,name:"product_demo.mp4",url:"https://docs.material-tailwind.com/demo.mp4",size:15e6,createdAt:new Date("2024-02-15T16:00:00Z"),updatedAt:new Date("2024-02-15T16:00:00Z"),folderId:3,tags:["project"],mime:"video/mp4",ext:".mp4",width:1920,height:1080,metaData:{duration:180,videoSource:"local"}},{id:18,name:"training_video.mp4",url:"https://docs.material-tailwind.com/demo.mp4",size:25e6,createdAt:new Date("2024-02-10T09:30:00Z"),updatedAt:new Date("2024-02-10T09:30:00Z"),folderId:3,tags:["work"],mime:"video/mp4",ext:".mp4",width:1920,height:1080,metaData:{duration:300,videoSource:"local"}},{id:19,name:"background_music.mp3",url:"/placeholder.svg?height=400&width=300",size:45e5,createdAt:new Date("2024-02-05T14:00:00Z"),updatedAt:new Date("2024-02-05T14:00:00Z"),folderId:4,tags:["personal"],mime:"audio/mpeg",ext:".mp3",metaData:{duration:240}},{id:20,name:"contract_template.docx",url:"/placeholder.svg?height=400&width=300",size:65e4,createdAt:new Date("2024-01-30T11:00:00Z"),updatedAt:new Date("2024-01-30T11:00:00Z"),folderId:1,tags:["work"],mime:"application/vnd.openxmlformats-officedocument.wordprocessingml.document",ext:".docx",metaData:{pageCount:12}},{id:21,name:"invoice_jan.pdf",url:"/placeholder.svg?height=400&width=300",size:32e4,createdAt:new Date("2024-01-25T10:00:00Z"),updatedAt:new Date("2024-01-25T10:00:00Z"),folderId:1,tags:["work","important"],mime:"application/pdf",ext:".pdf",metaData:{pageCount:3}},{id:22,name:"vacation_photo1.jpg",url:"https://images.unsplash.com/photo-1506905925346-21bda4d32df4",size:28e5,createdAt:new Date("2024-01-20T15:00:00Z"),updatedAt:new Date("2024-01-20T15:00:00Z"),folderId:2,tags:["personal"],mime:"image/jpeg",ext:".jpg",width:3500,height:2500,metaData:{}},{id:23,name:"vacation_photo2.jpg",url:"https://images.unsplash.com/photo-1469474968028-56623f02e42e",size:31e5,createdAt:new Date("2024-01-20T15:05:00Z"),updatedAt:new Date("2024-01-20T15:05:00Z"),folderId:2,tags:["personal"],mime:"image/jpeg",ext:".jpg",width:4e3,height:2800,metaData:{}},{id:24,name:"project_backup.zip",url:"/placeholder.svg?height=400&width=300",size:85e6,createdAt:new Date("2024-01-15T12:00:00Z"),updatedAt:new Date("2024-01-15T12:00:00Z"),folderId:5,tags:["archive","project"],mime:"application/zip",ext:".zip",metaData:{description:"Full project backup"}},{id:25,name:"presentation_final.pptx",url:"/placeholder.svg?height=400&width=300",size:35e5,createdAt:new Date("2024-01-10T16:00:00Z"),updatedAt:new Date("2024-01-10T16:00:00Z"),folderId:1,tags:["work","important"],mime:"application/vnd.openxmlformats-officedocument.presentationml.presentation",ext:".pptx",metaData:{pageCount:35}},{id:26,name:"screenshot_001.png",url:"https://images.unsplash.com/photo-1517694712202-14dd9538aa97",size:12e5,createdAt:new Date("2024-01-05T09:00:00Z"),updatedAt:new Date("2024-01-05T09:00:00Z"),folderId:2,tags:["work"],mime:"image/png",ext:".png",width:1920,height:1080,metaData:{}},{id:27,name:"config.json",url:"/placeholder.svg?height=400&width=300",size:5e3,createdAt:new Date("2023-12-28T14:00:00Z"),updatedAt:new Date("2023-12-28T14:00:00Z"),folderId:1,tags:["project"],mime:"application/json",ext:".json",metaData:{}},{id:28,name:"readme.md",url:"/placeholder.svg?height=400&width=300",size:8500,createdAt:new Date("2023-12-20T10:00:00Z"),updatedAt:new Date("2023-12-20T10:00:00Z"),folderId:1,tags:["project"],mime:"text/markdown",ext:".md",metaData:{}},{id:29,name:"database_backup.sql",url:"/placeholder.svg?height=400&width=300",size:12e6,createdAt:new Date("2023-12-15T11:00:00Z"),updatedAt:new Date("2023-12-15T11:00:00Z"),folderId:5,tags:["archive","important"],mime:"application/sql",ext:".sql",metaData:{description:"Database backup"}},{id:30,name:"tutorial_video.mp4",url:"https://docs.material-tailwind.com/demo.mp4",size:18e6,createdAt:new Date("2023-12-10T13:00:00Z"),updatedAt:new Date("2023-12-10T13:00:00Z"),folderId:3,tags:["personal"],mime:"video/mp4",ext:".mp4",width:1920,height:1080,metaData:{duration:420,videoSource:"local"}},{id:31,name:"company_logo.svg",url:"/placeholder.svg?height=400&width=300",size:45e3,createdAt:new Date("2023-12-05T09:00:00Z"),updatedAt:new Date("2023-12-05T09:00:00Z"),folderId:2,tags:["work"],mime:"image/svg+xml",ext:".svg",metaData:{}},{id:32,name:"report_q4.pdf",url:"/placeholder.svg?height=400&width=300",size:18e5,createdAt:new Date("2023-12-01T15:00:00Z"),updatedAt:new Date("2023-12-01T15:00:00Z"),folderId:1,tags:["work","important"],mime:"application/pdf",ext:".pdf",metaData:{pageCount:25,author:"Finance Team"}},{id:33,name:"nature_photo.webp",url:"https://images.unsplash.com/photo-1441974231531-c6227db76b6e",size:95e4,createdAt:new Date("2023-11-25T12:00:00Z"),updatedAt:new Date("2023-11-25T12:00:00Z"),folderId:2,tags:["personal"],mime:"image/webp",ext:".webp",width:3e3,height:2e3,metaData:{}},{id:34,name:"podcast_intro.mp3",url:"/placeholder.svg?height=400&width=300",size:25e5,createdAt:new Date("2023-11-20T10:00:00Z"),updatedAt:new Date("2023-11-20T10:00:00Z"),folderId:4,tags:["personal"],mime:"audio/mpeg",ext:".mp3",metaData:{duration:180}},{id:35,name:"data_export.csv",url:"/placeholder.svg?height=400&width=300",size:85e4,createdAt:new Date("2023-11-15T14:00:00Z"),updatedAt:new Date("2023-11-15T14:00:00Z"),folderId:1,tags:["work"],mime:"text/csv",ext:".csv",metaData:{}},{id:36,name:"wireframes.pdf",url:"/placeholder.svg?height=400&width=300",size:42e5,createdAt:new Date("2023-11-10T11:00:00Z"),updatedAt:new Date("2023-11-10T11:00:00Z"),folderId:1,tags:["project"],mime:"application/pdf",ext:".pdf",metaData:{pageCount:45}},{id:37,name:"cityscape.jpg",url:"https://images.unsplash.com/photo-1449824913935-59a10b8d2000",size:38e5,createdAt:new Date("2023-11-05T16:00:00Z"),updatedAt:new Date("2023-11-05T16:00:00Z"),folderId:2,tags:["personal"],mime:"image/jpeg",ext:".jpg",width:4500,height:3e3,metaData:{}},{id:38,name:"interview_recording.mp3",url:"/placeholder.svg?height=400&width=300",size:85e5,createdAt:new Date("2023-11-01T09:00:00Z"),updatedAt:new Date("2023-11-01T09:00:00Z"),folderId:4,tags:["work"],mime:"audio/mpeg",ext:".mp3",metaData:{duration:1800}},{id:39,name:"client_files.rar",url:"/placeholder.svg?height=400&width=300",size:45e6,createdAt:new Date("2023-10-25T13:00:00Z"),updatedAt:new Date("2023-10-25T13:00:00Z"),folderId:5,tags:["archive","work"],mime:"application/x-rar-compressed",ext:".rar",metaData:{description:"Client deliverables"}},{id:40,name:"marketing_plan.docx",url:"/placeholder.svg?height=400&width=300",size:12e5,createdAt:new Date("2023-10-20T10:00:00Z"),updatedAt:new Date("2023-10-20T10:00:00Z"),folderId:1,tags:["work"],mime:"application/vnd.openxmlformats-officedocument.wordprocessingml.document",ext:".docx",metaData:{pageCount:18}},{id:41,name:"analytics_data.xlsx",url:"/placeholder.svg?height=400&width=300",size:21e5,createdAt:new Date("2023-10-15T15:00:00Z"),updatedAt:new Date("2023-10-15T15:00:00Z"),folderId:1,tags:["work"],mime:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",ext:".xlsx",metaData:{pageCount:8}},{id:42,name:"sunset_beach.jpg",url:"https://images.unsplash.com/photo-1507525428034-b723cf961d3e",size:32e5,createdAt:new Date("2023-10-10T17:00:00Z"),updatedAt:new Date("2023-10-10T17:00:00Z"),folderId:2,tags:["personal"],mime:"image/jpeg",ext:".jpg",width:4e3,height:2700,metaData:{}},{id:43,name:"webinar_recording.mp4",url:"https://docs.material-tailwind.com/demo.mp4",size:35e6,createdAt:new Date("2023-10-05T14:00:00Z"),updatedAt:new Date("2023-10-05T14:00:00Z"),folderId:3,tags:["work"],mime:"video/mp4",ext:".mp4",width:1920,height:1080,metaData:{duration:600,videoSource:"local"}},{id:44,name:"sound_effects.wav",url:"/placeholder.svg?height=400&width=300",size:15e6,createdAt:new Date("2023-10-01T11:00:00Z"),updatedAt:new Date("2023-10-01T11:00:00Z"),folderId:4,tags:["project"],mime:"audio/wav",ext:".wav",metaData:{duration:120}},{id:45,name:"legacy_system.zip",url:"/placeholder.svg?height=400&width=300",size:125e6,createdAt:new Date("2023-09-25T09:00:00Z"),updatedAt:new Date("2023-09-25T09:00:00Z"),folderId:5,tags:["archive"],mime:"application/zip",ext:".zip",metaData:{description:"Old system files"}}];var A=v=>new Promise(t=>setTimeout(t,v)),P=class{getFolder(t){if(t===null)return Promise.resolve(null);let a=p.find(i=>i.id===t);if(!a)return Promise.resolve(null);let e=chunkS4HRPNKF_js.a({},a),d=e;for(;d.parentId!==null;){let i=p.find(o=>o.id===d.parentId);if(i)d.parent=chunkS4HRPNKF_js.a({},i),d=d.parent;else break}return Promise.resolve(e)}async getFolders(t,a=1,e=20,d=""){await A(300);let i=t!==null?p.filter(l=>l.parentId===t):p.filter(l=>l.parentId===null),o=i;if(d&&d.trim()){let l=d.toLowerCase().trim();o=i.filter(w=>w.name.toLowerCase().includes(l));}let r=o.sort((l,w)=>new Date(l.createdAt).getTime()-new Date(w.createdAt).getTime()),s=r.length,h=Math.ceil(s/e),u=(a-1)*e;return {folders:r.slice(u,u+e),pagination:{currentPage:a,totalPages:h,totalFiles:s,filesPerPage:e}}}getTags(){return Promise.resolve(b.map(t=>t.name))}async getFiles(t,a,e,d,i){await A(500);let o=[...m];if(t!==null&&(o=o.filter(c=>c.folderId===t)),a&&a.length>0&&(o=o.filter(c=>{let f=chunkS4HRPNKF_js.H(c.mime,c.ext);return a.includes(f)})),i){let c=i==null?void 0:i.toLowerCase();o=o.filter(f=>f.name.toLowerCase().includes(c));}let r=o.sort((c,f)=>new Date(c.createdAt).getTime()-new Date(f.createdAt).getTime()),s=e!=null?e:1,h=d!=null?d:10,u=r.length,T=Math.ceil(u/h),l=(s-1)*h,w=r.slice(l,l+h);return Promise.resolve({files:w,pagination:{currentPage:s,totalPages:T,totalFiles:u,filesPerPage:h}})}async getItems(t,a,e=1,d=24,i=""){await A(300);let o=t!==null?p.filter(n=>n.parentId===t):p.filter(n=>n.parentId===null),r=t!==null?m.filter(n=>n.folderId===t):m.filter(n=>n.folderId===null);if(a&&a.length>0&&(r=r.filter(n=>{let g=chunkS4HRPNKF_js.H(n.mime,n.ext);return a.includes(g)})),i&&i.trim()){let n=i.toLowerCase().trim();o=o.filter(g=>g.name.toLowerCase().includes(n)),r=r.filter(g=>{var F,_;return g.name.toLowerCase().includes(n)||((_=(F=g.ext)==null?void 0:F.toLowerCase().includes(n))!=null?_:false)});}let s=o.sort((n,g)=>new Date(n.createdAt).getTime()-new Date(g.createdAt).getTime()),h=r.sort((n,g)=>new Date(n.createdAt).getTime()-new Date(g.createdAt).getTime()),u=s.length+h.length,T=Math.ceil(u/d)||1,l=(e-1)*d,w=l+d,c=s.slice(Math.max(0,l),Math.min(s.length,w)),f=c.length,C=d-f;Math.min(s.length,l);let Z=Math.max(0,l-s.length),k=h.slice(Z,Z+C);return {folders:c,files:k,pagination:{currentPage:e,totalPages:T,totalFiles:u,filesPerPage:d}}}async createFolder(t,a){await A(300);let e={id:Date.now(),name:t,parentId:a!=null?a:null,pathId:typeof a=="number"?a:0,path:"",fileCount:0,folderCount:0,createdAt:new Date,updatedAt:new Date};return p.push(e),e}getMetaDataType(t,a){return t.type.startsWith("image/")?{}:t.type.startsWith("video/")?{duration:0,videoSource:a!=null?a:chunkS4HRPNKF_js.g.LOCAL}:t.type.startsWith("audio/")?{duration:0}:{description:""}}getFileType(t){var e;let a="."+((e=t.name.split(".").pop())==null?void 0:e.toLowerCase());return chunkS4HRPNKF_js.H(t.type,a)}async uploadFiles(t,a){var d;await A(500);let e=[];for(let{file:i,videoSource:o}of t){let r=this.getFileType(i),s="."+((d=i.name.split(".").pop())==null?void 0:d.toLowerCase()),h={id:Date.now()+Math.random(),name:i.name,folderId:a!=null?a:null,size:i.size,url:URL.createObjectURL(i),mime:i.type||"application/octet-stream",ext:s,metaData:this.getMetaDataType(i,o),createdAt:new Date,updatedAt:new Date,tags:[],width:r===chunkS4HRPNKF_js.e.IMAGE?800:void 0,height:r===chunkS4HRPNKF_js.e.IMAGE?600:void 0};m.push(h),e.push(h);}return e}renameFolder(t,a){let e=p.find(d=>d.id===t);return e?(e.name=a,e.updatedAt=new Date,Promise.resolve(e)):Promise.reject(new Error("Folder not found"))}updateFileMetaData(t,a){let e=m.find(r=>r.id===t);if(!e)return Promise.reject(new Error("File not found"));let o=a,{metaData:d}=o,i=chunkS4HRPNKF_js.c(o,["metaData"]);return Object.assign(e,i),d&&(e.metaData=chunkS4HRPNKF_js.a(chunkS4HRPNKF_js.a({},e.metaData),d)),e.updatedAt=new Date,Promise.resolve(e)}deleteFiles(t){for(let a of t){let e=m.findIndex(d=>d.id===a);e!==-1&&m.splice(e,1);}return Promise.resolve()}deleteFolders(t){for(let a of t){let e=p.findIndex(d=>d.id===a);if(e!==-1){p.splice(e,1);for(let d=m.length-1;d>=0;d--)m[d].folderId===a&&m.splice(d,1);}}return Promise.resolve()}findFiles(t){let a=t==null?void 0:t.toLowerCase(),e=m.filter(d=>{var i;return d.name.toLowerCase().includes(a)||((i=d.tags)==null?void 0:i.some(o=>o.toLowerCase().includes(a)))});return Promise.resolve(e)}findFolders(t){let a=t==null?void 0:t.toLowerCase(),e=p.filter(d=>d.name.toLowerCase().includes(a));return Promise.resolve(e)}moveFiles(t,a){let e=[];for(let d of t){let i=m.find(o=>o.id===d);i&&(i.folderId=a,i.updatedAt=new Date,e.push(i));}return Promise.resolve(e)}moveFolders(t,a){let e=[];for(let d of t){let i=p.find(o=>o.id===d);i&&(i.parentId=a,i.updatedAt=new Date,e.push(i));}return Promise.resolve(e)}};
2
- exports.MockProvider=P;
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
3
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
4
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
5
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
6
+ var __spreadValues = (a, b) => {
7
+ for (var prop in b || (b = {}))
8
+ if (__hasOwnProp.call(b, prop))
9
+ __defNormalProp(a, prop, b[prop]);
10
+ if (__getOwnPropSymbols)
11
+ for (var prop of __getOwnPropSymbols(b)) {
12
+ if (__propIsEnum.call(b, prop))
13
+ __defNormalProp(a, prop, b[prop]);
14
+ }
15
+ return a;
16
+ };
17
+ var __objRest = (source, exclude) => {
18
+ var target = {};
19
+ for (var prop in source)
20
+ if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
21
+ target[prop] = source[prop];
22
+ if (source != null && __getOwnPropSymbols)
23
+ for (var prop of __getOwnPropSymbols(source)) {
24
+ if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
25
+ target[prop] = source[prop];
26
+ }
27
+ return target;
28
+ };
29
+
30
+ // data/data.ts
31
+ var mockFolders = [
32
+ {
33
+ id: 1,
34
+ name: "Documents",
35
+ pathId: 1,
36
+ path: "/1",
37
+ parentId: null,
38
+ fileCount: 20,
39
+ // Updated: now has 20 files
40
+ folderCount: 0,
41
+ createdAt: /* @__PURE__ */ new Date("2024-01-01"),
42
+ updatedAt: /* @__PURE__ */ new Date("2024-01-01")
43
+ },
44
+ {
45
+ id: 2,
46
+ name: "Images",
47
+ pathId: 2,
48
+ path: "/2",
49
+ parentId: null,
50
+ fileCount: 10,
51
+ // Updated: now has 10 image files
52
+ folderCount: 3,
53
+ createdAt: /* @__PURE__ */ new Date("2024-01-01"),
54
+ updatedAt: /* @__PURE__ */ new Date("2024-01-01")
55
+ },
56
+ {
57
+ id: 3,
58
+ name: "Videos",
59
+ pathId: 3,
60
+ path: "/3",
61
+ parentId: null,
62
+ fileCount: 5,
63
+ // Updated: now has 5 video files
64
+ folderCount: 0,
65
+ createdAt: /* @__PURE__ */ new Date("2024-01-01"),
66
+ updatedAt: /* @__PURE__ */ new Date("2024-01-01")
67
+ },
68
+ {
69
+ id: 4,
70
+ name: "Music Some Long Name Streched also so long to fit in the card Music Some Long Name Streched also so long to fit in the card",
71
+ pathId: 4,
72
+ path: "/4",
73
+ parentId: null,
74
+ fileCount: 5,
75
+ // Updated: now has 5 audio files
76
+ folderCount: 0,
77
+ createdAt: /* @__PURE__ */ new Date("2024-01-01"),
78
+ updatedAt: /* @__PURE__ */ new Date("2024-01-01")
79
+ },
80
+ {
81
+ id: 5,
82
+ name: "Archives",
83
+ pathId: 5,
84
+ path: "/5",
85
+ parentId: null,
86
+ fileCount: 5,
87
+ // Updated: now has 5 archive files
88
+ folderCount: 0,
89
+ createdAt: /* @__PURE__ */ new Date("2024-01-01"),
90
+ updatedAt: /* @__PURE__ */ new Date("2024-01-01")
91
+ },
92
+ {
93
+ id: 6,
94
+ name: "Album 01",
95
+ pathId: 6,
96
+ path: "/2/6",
97
+ parentId: 2,
98
+ fileCount: 0,
99
+ folderCount: 0,
100
+ createdAt: /* @__PURE__ */ new Date("2024-01-01"),
101
+ updatedAt: /* @__PURE__ */ new Date("2024-01-01")
102
+ },
103
+ {
104
+ id: 7,
105
+ name: "Album 02",
106
+ pathId: 7,
107
+ path: "/2/7",
108
+ parentId: 2,
109
+ fileCount: 0,
110
+ folderCount: 0,
111
+ createdAt: /* @__PURE__ */ new Date("2024-01-01"),
112
+ updatedAt: /* @__PURE__ */ new Date("2024-01-01")
113
+ },
114
+ {
115
+ id: 8,
116
+ name: "Squirrels",
117
+ pathId: 8,
118
+ path: "/2/8",
119
+ parentId: 2,
120
+ fileCount: 1,
121
+ folderCount: 0,
122
+ createdAt: /* @__PURE__ */ new Date("2024-01-01"),
123
+ updatedAt: /* @__PURE__ */ new Date("2024-01-01")
124
+ }
125
+ ];
126
+ var mockTags = [
127
+ { id: 1, name: "Important", color: "#ef4444" },
128
+ { id: 2, name: "Work", color: "#3b82f6" },
129
+ { id: 3, name: "Personal", color: "#10b981" },
130
+ { id: 4, name: "Project", color: "#8b5cf6" },
131
+ { id: 5, name: "Archive", color: "#6b7280" }
132
+ ];
133
+ var mockFiles = [
134
+ // Root level files (folderId: null)
135
+ {
136
+ id: 101,
137
+ name: "welcome.pdf",
138
+ url: "/placeholder.svg?height=400&width=300",
139
+ size: 245e3,
140
+ createdAt: /* @__PURE__ */ new Date("2024-05-15T10:00:00Z"),
141
+ updatedAt: /* @__PURE__ */ new Date("2024-05-15T10:00:00Z"),
142
+ folderId: null,
143
+ tags: ["important"],
144
+ mime: "application/pdf",
145
+ ext: ".pdf",
146
+ metaData: { pageCount: 2, author: "Admin" }
147
+ },
148
+ {
149
+ id: 102,
150
+ name: "desktop_wallpaper.jpg",
151
+ url: "https://images.unsplash.com/photo-1557683316-973673baf926",
152
+ size: 42e5,
153
+ createdAt: /* @__PURE__ */ new Date("2024-05-14T15:30:00Z"),
154
+ updatedAt: /* @__PURE__ */ new Date("2024-05-14T15:30:00Z"),
155
+ folderId: null,
156
+ tags: ["personal"],
157
+ mime: "image/jpeg",
158
+ ext: ".jpg",
159
+ width: 5e3,
160
+ height: 3333,
161
+ formats: {
162
+ thumbnail: {
163
+ ext: ".jpg",
164
+ url: "https://images.unsplash.com/photo-1557683316-973673baf926?w=156",
165
+ hash: "thumbnail_desktop_wallpaper_abc123",
166
+ mime: "image/jpeg",
167
+ name: "thumbnail_desktop_wallpaper.jpg",
168
+ path: null,
169
+ size: 5.57,
170
+ width: 156,
171
+ height: 104
172
+ },
173
+ small: {
174
+ ext: ".jpg",
175
+ url: "https://images.unsplash.com/photo-1557683316-973673baf926?w=500",
176
+ hash: "small_desktop_wallpaper_abc123",
177
+ mime: "image/jpeg",
178
+ name: "small_desktop_wallpaper.jpg",
179
+ path: null,
180
+ size: 47.27,
181
+ width: 500,
182
+ height: 333
183
+ },
184
+ medium: {
185
+ ext: ".jpg",
186
+ url: "https://images.unsplash.com/photo-1557683316-973673baf926?w=750",
187
+ hash: "medium_desktop_wallpaper_abc123",
188
+ mime: "image/jpeg",
189
+ name: "medium_desktop_wallpaper.jpg",
190
+ path: null,
191
+ size: 97.89,
192
+ width: 750,
193
+ height: 500
194
+ },
195
+ large: {
196
+ ext: ".jpg",
197
+ url: "https://images.unsplash.com/photo-1557683316-973673baf926?w=1000",
198
+ hash: "large_desktop_wallpaper_abc123",
199
+ mime: "image/jpeg",
200
+ name: "large_desktop_wallpaper.jpg",
201
+ path: null,
202
+ size: 159.48,
203
+ width: 1e3,
204
+ height: 667
205
+ }
206
+ },
207
+ metaData: {}
208
+ },
209
+ {
210
+ id: 103,
211
+ name: "quick_notes.txt",
212
+ url: "/placeholder.svg?height=400&width=300",
213
+ size: 3500,
214
+ createdAt: /* @__PURE__ */ new Date("2024-05-13T09:45:00Z"),
215
+ updatedAt: /* @__PURE__ */ new Date("2024-05-13T09:45:00Z"),
216
+ folderId: null,
217
+ tags: [],
218
+ mime: "text/plain",
219
+ ext: ".txt",
220
+ metaData: {}
221
+ },
222
+ {
223
+ id: 104,
224
+ name: "intro_video.mp4",
225
+ url: "https://docs.material-tailwind.com/demo.mp4",
226
+ size: 12e6,
227
+ createdAt: /* @__PURE__ */ new Date("2024-05-12T14:00:00Z"),
228
+ updatedAt: /* @__PURE__ */ new Date("2024-05-12T14:00:00Z"),
229
+ folderId: null,
230
+ tags: [],
231
+ mime: "video/mp4",
232
+ ext: ".mp4",
233
+ width: 1920,
234
+ height: 1080,
235
+ metaData: { duration: 90, videoSource: "local" }
236
+ },
237
+ {
238
+ id: 105,
239
+ name: "profile_photo.png",
240
+ url: "https://images.unsplash.com/photo-1535713875002-d1d0cf377fde",
241
+ size: 85e4,
242
+ createdAt: /* @__PURE__ */ new Date("2024-05-11T11:20:00Z"),
243
+ updatedAt: /* @__PURE__ */ new Date("2024-05-11T11:20:00Z"),
244
+ folderId: null,
245
+ tags: ["personal"],
246
+ mime: "image/png",
247
+ ext: ".png",
248
+ width: 2e3,
249
+ height: 2e3,
250
+ formats: {
251
+ thumbnail: {
252
+ ext: ".png",
253
+ url: "https://images.unsplash.com/photo-1535713875002-d1d0cf377fde?w=156",
254
+ hash: "thumbnail_profile_photo_def456",
255
+ mime: "image/png",
256
+ name: "thumbnail_profile_photo.png",
257
+ path: null,
258
+ size: 8.2,
259
+ width: 156,
260
+ height: 156
261
+ },
262
+ small: {
263
+ ext: ".png",
264
+ url: "https://images.unsplash.com/photo-1535713875002-d1d0cf377fde?w=500",
265
+ hash: "small_profile_photo_def456",
266
+ mime: "image/png",
267
+ name: "small_profile_photo.png",
268
+ path: null,
269
+ size: 52.3,
270
+ width: 500,
271
+ height: 500
272
+ },
273
+ medium: {
274
+ ext: ".png",
275
+ url: "https://images.unsplash.com/photo-1535713875002-d1d0cf377fde?w=750",
276
+ hash: "medium_profile_photo_def456",
277
+ mime: "image/png",
278
+ name: "medium_profile_photo.png",
279
+ path: null,
280
+ size: 110.5,
281
+ width: 750,
282
+ height: 750
283
+ },
284
+ large: {
285
+ ext: ".png",
286
+ url: "https://images.unsplash.com/photo-1535713875002-d1d0cf377fde?w=1000",
287
+ hash: "large_profile_photo_def456",
288
+ mime: "image/png",
289
+ name: "large_profile_photo.png",
290
+ path: null,
291
+ size: 185.7,
292
+ width: 1e3,
293
+ height: 1e3
294
+ }
295
+ },
296
+ metaData: {}
297
+ },
298
+ {
299
+ id: 106,
300
+ name: "todo_list.md",
301
+ url: "/placeholder.svg?height=400&width=300",
302
+ size: 6200,
303
+ createdAt: /* @__PURE__ */ new Date("2024-05-10T08:30:00Z"),
304
+ updatedAt: /* @__PURE__ */ new Date("2024-05-10T08:30:00Z"),
305
+ folderId: null,
306
+ tags: ["important"],
307
+ mime: "text/markdown",
308
+ ext: ".md",
309
+ metaData: {}
310
+ },
311
+ {
312
+ id: 107,
313
+ name: "app_settings.json",
314
+ url: "/placeholder.svg?height=400&width=300",
315
+ size: 4800,
316
+ createdAt: /* @__PURE__ */ new Date("2024-05-09T16:15:00Z"),
317
+ updatedAt: /* @__PURE__ */ new Date("2024-05-09T16:15:00Z"),
318
+ folderId: null,
319
+ tags: [],
320
+ mime: "application/json",
321
+ ext: ".json",
322
+ metaData: {}
323
+ },
324
+ {
325
+ id: 108,
326
+ name: "mountain_landscape.webp",
327
+ url: "https://images.unsplash.com/photo-1506905925346-21bda4d32df4",
328
+ size: 12e5,
329
+ createdAt: /* @__PURE__ */ new Date("2024-05-08T13:00:00Z"),
330
+ updatedAt: /* @__PURE__ */ new Date("2024-05-08T13:00:00Z"),
331
+ folderId: null,
332
+ tags: ["personal"],
333
+ mime: "image/webp",
334
+ ext: ".webp",
335
+ width: 4e3,
336
+ height: 2667,
337
+ metaData: {}
338
+ },
339
+ // Files in folders
340
+ {
341
+ id: 1,
342
+ name: "Key-Monastery-img.avif",
343
+ url: "https://unciatrails.com/wp-content/uploads/2024/07/Key-Monastery-img.avif",
344
+ size: 2621440,
345
+ // 2.5 MB
346
+ createdAt: /* @__PURE__ */ new Date("2023-10-26T10:30:00Z"),
347
+ updatedAt: /* @__PURE__ */ new Date("2023-10-26T10:30:00Z"),
348
+ folderId: 8,
349
+ tags: ["personal", "important"],
350
+ mime: "image/avif",
351
+ ext: ".avif",
352
+ caption: "A cute squirrel in the park",
353
+ alternativeText: "Gray squirrel sitting on wooden fence",
354
+ width: 3024,
355
+ height: 4032,
356
+ metaData: {}
357
+ },
358
+ {
359
+ id: 2,
360
+ name: "project_proposal thoda sa.pdf",
361
+ url: "/placeholder.svg?height=400&width=300",
362
+ size: 1048576,
363
+ // 1 MB
364
+ createdAt: /* @__PURE__ */ new Date("2024-05-10T14:20:00Z"),
365
+ updatedAt: /* @__PURE__ */ new Date("2024-05-10T14:20:00Z"),
366
+ folderId: 1,
367
+ tags: ["work", "important"],
368
+ mime: "application/pdf",
369
+ ext: ".pdf",
370
+ metaData: {
371
+ pageCount: 15,
372
+ author: "John Doe"
373
+ }
374
+ },
375
+ {
376
+ id: 3,
377
+ name: "quarterly_report.xlsx",
378
+ url: "/placeholder.svg?height=400&width=300",
379
+ size: 524288,
380
+ // 512 KB
381
+ createdAt: /* @__PURE__ */ new Date("2024-05-08T09:15:00Z"),
382
+ updatedAt: /* @__PURE__ */ new Date("2024-05-08T09:15:00Z"),
383
+ folderId: 1,
384
+ tags: ["work"],
385
+ mime: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
386
+ ext: ".xlsx",
387
+ metaData: {
388
+ pageCount: 10
389
+ }
390
+ },
391
+ {
392
+ id: 4,
393
+ name: "presentation.pptx",
394
+ url: "/placeholder.svg?height=400&width=300",
395
+ size: 2097152,
396
+ // 2 MB
397
+ createdAt: /* @__PURE__ */ new Date("2024-05-05T16:45:00Z"),
398
+ updatedAt: /* @__PURE__ */ new Date("2024-05-05T16:45:00Z"),
399
+ folderId: 1,
400
+ tags: ["work", "project"],
401
+ mime: "application/vnd.openxmlformats-officedocument.presentationml.presentation",
402
+ ext: ".pptx",
403
+ metaData: {
404
+ pageCount: 20
405
+ }
406
+ },
407
+ {
408
+ id: 8,
409
+ name: "documnet.doc",
410
+ url: "/placeholder.svg?height=400&width=300",
411
+ size: 2097152,
412
+ // 2 MB
413
+ createdAt: /* @__PURE__ */ new Date("2024-05-05T16:45:00Z"),
414
+ updatedAt: /* @__PURE__ */ new Date("2024-05-05T16:45:00Z"),
415
+ folderId: 1,
416
+ tags: ["work", "project"],
417
+ mime: "application/msword",
418
+ ext: ".doc",
419
+ metaData: {
420
+ pageCount: 20
421
+ }
422
+ },
423
+ {
424
+ id: 5,
425
+ name: "demo_video.mp4",
426
+ url: "https://docs.material-tailwind.com/demo.mp4",
427
+ size: 10485760,
428
+ // 10 MB
429
+ createdAt: /* @__PURE__ */ new Date("2024-05-03T11:30:00Z"),
430
+ updatedAt: /* @__PURE__ */ new Date("2024-05-03T11:30:00Z"),
431
+ folderId: 3,
432
+ tags: ["project"],
433
+ mime: "video/mp4",
434
+ ext: ".mp4",
435
+ width: 1920,
436
+ height: 1080,
437
+ metaData: {
438
+ duration: 120,
439
+ // 2 minutes
440
+ videoSource: "remote"
441
+ }
442
+ },
443
+ {
444
+ id: 6,
445
+ name: "podcast_episode.mp3",
446
+ url: "/placeholder.svg?height=400&width=300",
447
+ size: 5242880,
448
+ // 5 MB
449
+ createdAt: /* @__PURE__ */ new Date("2024-05-02T10:00:00Z"),
450
+ updatedAt: /* @__PURE__ */ new Date("2024-05-02T10:00:00Z"),
451
+ folderId: 4,
452
+ tags: ["personal"],
453
+ mime: "audio/mpeg",
454
+ ext: ".mp3",
455
+ metaData: {
456
+ duration: 3600
457
+ // 1 hour
458
+ }
459
+ },
460
+ {
461
+ id: 7,
462
+ name: "notes.txt",
463
+ url: "/placeholder.svg?height=400&width=300",
464
+ size: 1024,
465
+ // 1 KB
466
+ createdAt: /* @__PURE__ */ new Date("2024-05-01T09:00:00Z"),
467
+ updatedAt: /* @__PURE__ */ new Date("2024-05-01T09:00:00Z"),
468
+ folderId: 1,
469
+ tags: ["work"],
470
+ mime: "text/plain",
471
+ ext: ".txt",
472
+ metaData: {}
473
+ },
474
+ {
475
+ id: 9,
476
+ name: "data.json",
477
+ url: "/placeholder.svg?height=400&width=300",
478
+ size: 2048,
479
+ // 2 KB
480
+ createdAt: /* @__PURE__ */ new Date("2024-04-30T15:00:00Z"),
481
+ updatedAt: /* @__PURE__ */ new Date("2024-04-30T15:00:00Z"),
482
+ folderId: 1,
483
+ tags: ["project"],
484
+ mime: "application/json",
485
+ ext: ".json",
486
+ metaData: {}
487
+ },
488
+ {
489
+ id: 10,
490
+ name: "archive.zip",
491
+ url: "/placeholder.svg?height=400&width=300",
492
+ size: 104857600,
493
+ // 100 MB
494
+ createdAt: /* @__PURE__ */ new Date("2024-04-29T12:00:00Z"),
495
+ updatedAt: /* @__PURE__ */ new Date("2024-04-29T12:00:00Z"),
496
+ folderId: 5,
497
+ tags: ["archive"],
498
+ mime: "application/zip",
499
+ ext: ".zip",
500
+ metaData: {
501
+ description: "Project backup"
502
+ }
503
+ },
504
+ {
505
+ id: 11,
506
+ name: "setup.exe",
507
+ url: "/placeholder.svg?height=400&width=300",
508
+ size: 52428800,
509
+ // 50 MB
510
+ createdAt: /* @__PURE__ */ new Date("2024-04-28T11:00:00Z"),
511
+ updatedAt: /* @__PURE__ */ new Date("2024-04-28T11:00:00Z"),
512
+ folderId: 5,
513
+ tags: ["software"],
514
+ mime: "application/x-msdownload",
515
+ ext: ".exe",
516
+ metaData: {
517
+ description: "Installer"
518
+ }
519
+ },
520
+ {
521
+ id: 12,
522
+ name: "old_stuff.rar",
523
+ url: "/placeholder.svg?height=400&width=300",
524
+ size: 20971520,
525
+ // 20 MB
526
+ createdAt: /* @__PURE__ */ new Date("2024-04-27T10:00:00Z"),
527
+ updatedAt: /* @__PURE__ */ new Date("2024-04-27T10:00:00Z"),
528
+ folderId: 5,
529
+ tags: ["archive"],
530
+ mime: "application/x-rar-compressed",
531
+ ext: ".rar",
532
+ metaData: {
533
+ description: "Old files"
534
+ }
535
+ },
536
+ // Additional files for pagination testing
537
+ {
538
+ id: 13,
539
+ name: "meeting_notes_q1.pdf",
540
+ url: "/placeholder.svg?height=400&width=300",
541
+ size: 856e3,
542
+ createdAt: /* @__PURE__ */ new Date("2024-03-15T09:00:00Z"),
543
+ updatedAt: /* @__PURE__ */ new Date("2024-03-15T09:00:00Z"),
544
+ folderId: 1,
545
+ tags: ["work"],
546
+ mime: "application/pdf",
547
+ ext: ".pdf",
548
+ metaData: { pageCount: 8, author: "Sarah Johnson" }
549
+ },
550
+ {
551
+ id: 14,
552
+ name: "budget_2024.xlsx",
553
+ url: "/placeholder.svg?height=400&width=300",
554
+ size: 425e3,
555
+ createdAt: /* @__PURE__ */ new Date("2024-03-10T14:30:00Z"),
556
+ updatedAt: /* @__PURE__ */ new Date("2024-03-10T14:30:00Z"),
557
+ folderId: 1,
558
+ tags: ["work", "important"],
559
+ mime: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
560
+ ext: ".xlsx",
561
+ metaData: { pageCount: 5 }
562
+ },
563
+ {
564
+ id: 15,
565
+ name: "team_photo.jpg",
566
+ url: "https://images.unsplash.com/photo-1522071820081-009f0129c71c",
567
+ size: 32e5,
568
+ createdAt: /* @__PURE__ */ new Date("2024-02-28T11:00:00Z"),
569
+ updatedAt: /* @__PURE__ */ new Date("2024-02-28T11:00:00Z"),
570
+ folderId: 2,
571
+ tags: ["work"],
572
+ mime: "image/jpeg",
573
+ ext: ".jpg",
574
+ width: 4e3,
575
+ height: 3e3,
576
+ metaData: {}
577
+ },
578
+ {
579
+ id: 16,
580
+ name: "logo_design.png",
581
+ url: "https://images.unsplash.com/photo-1611162617474-5b21e879e113",
582
+ size: 15e5,
583
+ createdAt: /* @__PURE__ */ new Date("2024-02-20T10:00:00Z"),
584
+ updatedAt: /* @__PURE__ */ new Date("2024-02-20T10:00:00Z"),
585
+ folderId: 2,
586
+ tags: ["project"],
587
+ mime: "image/png",
588
+ ext: ".png",
589
+ width: 2e3,
590
+ height: 2e3,
591
+ metaData: {}
592
+ },
593
+ {
594
+ id: 17,
595
+ name: "product_demo.mp4",
596
+ url: "https://docs.material-tailwind.com/demo.mp4",
597
+ size: 15e6,
598
+ createdAt: /* @__PURE__ */ new Date("2024-02-15T16:00:00Z"),
599
+ updatedAt: /* @__PURE__ */ new Date("2024-02-15T16:00:00Z"),
600
+ folderId: 3,
601
+ tags: ["project"],
602
+ mime: "video/mp4",
603
+ ext: ".mp4",
604
+ width: 1920,
605
+ height: 1080,
606
+ metaData: { duration: 180, videoSource: "local" }
607
+ },
608
+ {
609
+ id: 18,
610
+ name: "training_video.mp4",
611
+ url: "https://docs.material-tailwind.com/demo.mp4",
612
+ size: 25e6,
613
+ createdAt: /* @__PURE__ */ new Date("2024-02-10T09:30:00Z"),
614
+ updatedAt: /* @__PURE__ */ new Date("2024-02-10T09:30:00Z"),
615
+ folderId: 3,
616
+ tags: ["work"],
617
+ mime: "video/mp4",
618
+ ext: ".mp4",
619
+ width: 1920,
620
+ height: 1080,
621
+ metaData: { duration: 300, videoSource: "local" }
622
+ },
623
+ {
624
+ id: 19,
625
+ name: "background_music.mp3",
626
+ url: "/placeholder.svg?height=400&width=300",
627
+ size: 45e5,
628
+ createdAt: /* @__PURE__ */ new Date("2024-02-05T14:00:00Z"),
629
+ updatedAt: /* @__PURE__ */ new Date("2024-02-05T14:00:00Z"),
630
+ folderId: 4,
631
+ tags: ["personal"],
632
+ mime: "audio/mpeg",
633
+ ext: ".mp3",
634
+ metaData: { duration: 240 }
635
+ },
636
+ {
637
+ id: 20,
638
+ name: "contract_template.docx",
639
+ url: "/placeholder.svg?height=400&width=300",
640
+ size: 65e4,
641
+ createdAt: /* @__PURE__ */ new Date("2024-01-30T11:00:00Z"),
642
+ updatedAt: /* @__PURE__ */ new Date("2024-01-30T11:00:00Z"),
643
+ folderId: 1,
644
+ tags: ["work"],
645
+ mime: "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
646
+ ext: ".docx",
647
+ metaData: { pageCount: 12 }
648
+ },
649
+ {
650
+ id: 21,
651
+ name: "invoice_jan.pdf",
652
+ url: "/placeholder.svg?height=400&width=300",
653
+ size: 32e4,
654
+ createdAt: /* @__PURE__ */ new Date("2024-01-25T10:00:00Z"),
655
+ updatedAt: /* @__PURE__ */ new Date("2024-01-25T10:00:00Z"),
656
+ folderId: 1,
657
+ tags: ["work", "important"],
658
+ mime: "application/pdf",
659
+ ext: ".pdf",
660
+ metaData: { pageCount: 3 }
661
+ },
662
+ {
663
+ id: 22,
664
+ name: "vacation_photo1.jpg",
665
+ url: "https://images.unsplash.com/photo-1506905925346-21bda4d32df4",
666
+ size: 28e5,
667
+ createdAt: /* @__PURE__ */ new Date("2024-01-20T15:00:00Z"),
668
+ updatedAt: /* @__PURE__ */ new Date("2024-01-20T15:00:00Z"),
669
+ folderId: 2,
670
+ tags: ["personal"],
671
+ mime: "image/jpeg",
672
+ ext: ".jpg",
673
+ width: 3500,
674
+ height: 2500,
675
+ metaData: {}
676
+ },
677
+ {
678
+ id: 23,
679
+ name: "vacation_photo2.jpg",
680
+ url: "https://images.unsplash.com/photo-1469474968028-56623f02e42e",
681
+ size: 31e5,
682
+ createdAt: /* @__PURE__ */ new Date("2024-01-20T15:05:00Z"),
683
+ updatedAt: /* @__PURE__ */ new Date("2024-01-20T15:05:00Z"),
684
+ folderId: 2,
685
+ tags: ["personal"],
686
+ mime: "image/jpeg",
687
+ ext: ".jpg",
688
+ width: 4e3,
689
+ height: 2800,
690
+ metaData: {}
691
+ },
692
+ {
693
+ id: 24,
694
+ name: "project_backup.zip",
695
+ url: "/placeholder.svg?height=400&width=300",
696
+ size: 85e6,
697
+ createdAt: /* @__PURE__ */ new Date("2024-01-15T12:00:00Z"),
698
+ updatedAt: /* @__PURE__ */ new Date("2024-01-15T12:00:00Z"),
699
+ folderId: 5,
700
+ tags: ["archive", "project"],
701
+ mime: "application/zip",
702
+ ext: ".zip",
703
+ metaData: { description: "Full project backup" }
704
+ },
705
+ {
706
+ id: 25,
707
+ name: "presentation_final.pptx",
708
+ url: "/placeholder.svg?height=400&width=300",
709
+ size: 35e5,
710
+ createdAt: /* @__PURE__ */ new Date("2024-01-10T16:00:00Z"),
711
+ updatedAt: /* @__PURE__ */ new Date("2024-01-10T16:00:00Z"),
712
+ folderId: 1,
713
+ tags: ["work", "important"],
714
+ mime: "application/vnd.openxmlformats-officedocument.presentationml.presentation",
715
+ ext: ".pptx",
716
+ metaData: { pageCount: 35 }
717
+ },
718
+ {
719
+ id: 26,
720
+ name: "screenshot_001.png",
721
+ url: "https://images.unsplash.com/photo-1517694712202-14dd9538aa97",
722
+ size: 12e5,
723
+ createdAt: /* @__PURE__ */ new Date("2024-01-05T09:00:00Z"),
724
+ updatedAt: /* @__PURE__ */ new Date("2024-01-05T09:00:00Z"),
725
+ folderId: 2,
726
+ tags: ["work"],
727
+ mime: "image/png",
728
+ ext: ".png",
729
+ width: 1920,
730
+ height: 1080,
731
+ metaData: {}
732
+ },
733
+ {
734
+ id: 27,
735
+ name: "config.json",
736
+ url: "/placeholder.svg?height=400&width=300",
737
+ size: 5e3,
738
+ createdAt: /* @__PURE__ */ new Date("2023-12-28T14:00:00Z"),
739
+ updatedAt: /* @__PURE__ */ new Date("2023-12-28T14:00:00Z"),
740
+ folderId: 1,
741
+ tags: ["project"],
742
+ mime: "application/json",
743
+ ext: ".json",
744
+ metaData: {}
745
+ },
746
+ {
747
+ id: 28,
748
+ name: "readme.md",
749
+ url: "/placeholder.svg?height=400&width=300",
750
+ size: 8500,
751
+ createdAt: /* @__PURE__ */ new Date("2023-12-20T10:00:00Z"),
752
+ updatedAt: /* @__PURE__ */ new Date("2023-12-20T10:00:00Z"),
753
+ folderId: 1,
754
+ tags: ["project"],
755
+ mime: "text/markdown",
756
+ ext: ".md",
757
+ metaData: {}
758
+ },
759
+ {
760
+ id: 29,
761
+ name: "database_backup.sql",
762
+ url: "/placeholder.svg?height=400&width=300",
763
+ size: 12e6,
764
+ createdAt: /* @__PURE__ */ new Date("2023-12-15T11:00:00Z"),
765
+ updatedAt: /* @__PURE__ */ new Date("2023-12-15T11:00:00Z"),
766
+ folderId: 5,
767
+ tags: ["archive", "important"],
768
+ mime: "application/sql",
769
+ ext: ".sql",
770
+ metaData: { description: "Database backup" }
771
+ },
772
+ {
773
+ id: 30,
774
+ name: "tutorial_video.mp4",
775
+ url: "https://docs.material-tailwind.com/demo.mp4",
776
+ size: 18e6,
777
+ createdAt: /* @__PURE__ */ new Date("2023-12-10T13:00:00Z"),
778
+ updatedAt: /* @__PURE__ */ new Date("2023-12-10T13:00:00Z"),
779
+ folderId: 3,
780
+ tags: ["personal"],
781
+ mime: "video/mp4",
782
+ ext: ".mp4",
783
+ width: 1920,
784
+ height: 1080,
785
+ metaData: { duration: 420, videoSource: "local" }
786
+ },
787
+ {
788
+ id: 31,
789
+ name: "company_logo.svg",
790
+ url: "/placeholder.svg?height=400&width=300",
791
+ size: 45e3,
792
+ createdAt: /* @__PURE__ */ new Date("2023-12-05T09:00:00Z"),
793
+ updatedAt: /* @__PURE__ */ new Date("2023-12-05T09:00:00Z"),
794
+ folderId: 2,
795
+ tags: ["work"],
796
+ mime: "image/svg+xml",
797
+ ext: ".svg",
798
+ metaData: {}
799
+ },
800
+ {
801
+ id: 32,
802
+ name: "report_q4.pdf",
803
+ url: "/placeholder.svg?height=400&width=300",
804
+ size: 18e5,
805
+ createdAt: /* @__PURE__ */ new Date("2023-12-01T15:00:00Z"),
806
+ updatedAt: /* @__PURE__ */ new Date("2023-12-01T15:00:00Z"),
807
+ folderId: 1,
808
+ tags: ["work", "important"],
809
+ mime: "application/pdf",
810
+ ext: ".pdf",
811
+ metaData: { pageCount: 25, author: "Finance Team" }
812
+ },
813
+ {
814
+ id: 33,
815
+ name: "nature_photo.webp",
816
+ url: "https://images.unsplash.com/photo-1441974231531-c6227db76b6e",
817
+ size: 95e4,
818
+ createdAt: /* @__PURE__ */ new Date("2023-11-25T12:00:00Z"),
819
+ updatedAt: /* @__PURE__ */ new Date("2023-11-25T12:00:00Z"),
820
+ folderId: 2,
821
+ tags: ["personal"],
822
+ mime: "image/webp",
823
+ ext: ".webp",
824
+ width: 3e3,
825
+ height: 2e3,
826
+ metaData: {}
827
+ },
828
+ {
829
+ id: 34,
830
+ name: "podcast_intro.mp3",
831
+ url: "/placeholder.svg?height=400&width=300",
832
+ size: 25e5,
833
+ createdAt: /* @__PURE__ */ new Date("2023-11-20T10:00:00Z"),
834
+ updatedAt: /* @__PURE__ */ new Date("2023-11-20T10:00:00Z"),
835
+ folderId: 4,
836
+ tags: ["personal"],
837
+ mime: "audio/mpeg",
838
+ ext: ".mp3",
839
+ metaData: { duration: 180 }
840
+ },
841
+ {
842
+ id: 35,
843
+ name: "data_export.csv",
844
+ url: "/placeholder.svg?height=400&width=300",
845
+ size: 85e4,
846
+ createdAt: /* @__PURE__ */ new Date("2023-11-15T14:00:00Z"),
847
+ updatedAt: /* @__PURE__ */ new Date("2023-11-15T14:00:00Z"),
848
+ folderId: 1,
849
+ tags: ["work"],
850
+ mime: "text/csv",
851
+ ext: ".csv",
852
+ metaData: {}
853
+ },
854
+ {
855
+ id: 36,
856
+ name: "wireframes.pdf",
857
+ url: "/placeholder.svg?height=400&width=300",
858
+ size: 42e5,
859
+ createdAt: /* @__PURE__ */ new Date("2023-11-10T11:00:00Z"),
860
+ updatedAt: /* @__PURE__ */ new Date("2023-11-10T11:00:00Z"),
861
+ folderId: 1,
862
+ tags: ["project"],
863
+ mime: "application/pdf",
864
+ ext: ".pdf",
865
+ metaData: { pageCount: 45 }
866
+ },
867
+ {
868
+ id: 37,
869
+ name: "cityscape.jpg",
870
+ url: "https://images.unsplash.com/photo-1449824913935-59a10b8d2000",
871
+ size: 38e5,
872
+ createdAt: /* @__PURE__ */ new Date("2023-11-05T16:00:00Z"),
873
+ updatedAt: /* @__PURE__ */ new Date("2023-11-05T16:00:00Z"),
874
+ folderId: 2,
875
+ tags: ["personal"],
876
+ mime: "image/jpeg",
877
+ ext: ".jpg",
878
+ width: 4500,
879
+ height: 3e3,
880
+ metaData: {}
881
+ },
882
+ {
883
+ id: 38,
884
+ name: "interview_recording.mp3",
885
+ url: "/placeholder.svg?height=400&width=300",
886
+ size: 85e5,
887
+ createdAt: /* @__PURE__ */ new Date("2023-11-01T09:00:00Z"),
888
+ updatedAt: /* @__PURE__ */ new Date("2023-11-01T09:00:00Z"),
889
+ folderId: 4,
890
+ tags: ["work"],
891
+ mime: "audio/mpeg",
892
+ ext: ".mp3",
893
+ metaData: { duration: 1800 }
894
+ },
895
+ {
896
+ id: 39,
897
+ name: "client_files.rar",
898
+ url: "/placeholder.svg?height=400&width=300",
899
+ size: 45e6,
900
+ createdAt: /* @__PURE__ */ new Date("2023-10-25T13:00:00Z"),
901
+ updatedAt: /* @__PURE__ */ new Date("2023-10-25T13:00:00Z"),
902
+ folderId: 5,
903
+ tags: ["archive", "work"],
904
+ mime: "application/x-rar-compressed",
905
+ ext: ".rar",
906
+ metaData: { description: "Client deliverables" }
907
+ },
908
+ {
909
+ id: 40,
910
+ name: "marketing_plan.docx",
911
+ url: "/placeholder.svg?height=400&width=300",
912
+ size: 12e5,
913
+ createdAt: /* @__PURE__ */ new Date("2023-10-20T10:00:00Z"),
914
+ updatedAt: /* @__PURE__ */ new Date("2023-10-20T10:00:00Z"),
915
+ folderId: 1,
916
+ tags: ["work"],
917
+ mime: "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
918
+ ext: ".docx",
919
+ metaData: { pageCount: 18 }
920
+ },
921
+ {
922
+ id: 41,
923
+ name: "analytics_data.xlsx",
924
+ url: "/placeholder.svg?height=400&width=300",
925
+ size: 21e5,
926
+ createdAt: /* @__PURE__ */ new Date("2023-10-15T15:00:00Z"),
927
+ updatedAt: /* @__PURE__ */ new Date("2023-10-15T15:00:00Z"),
928
+ folderId: 1,
929
+ tags: ["work"],
930
+ mime: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
931
+ ext: ".xlsx",
932
+ metaData: { pageCount: 8 }
933
+ },
934
+ {
935
+ id: 42,
936
+ name: "sunset_beach.jpg",
937
+ url: "https://images.unsplash.com/photo-1507525428034-b723cf961d3e",
938
+ size: 32e5,
939
+ createdAt: /* @__PURE__ */ new Date("2023-10-10T17:00:00Z"),
940
+ updatedAt: /* @__PURE__ */ new Date("2023-10-10T17:00:00Z"),
941
+ folderId: 2,
942
+ tags: ["personal"],
943
+ mime: "image/jpeg",
944
+ ext: ".jpg",
945
+ width: 4e3,
946
+ height: 2700,
947
+ metaData: {}
948
+ },
949
+ {
950
+ id: 43,
951
+ name: "webinar_recording.mp4",
952
+ url: "https://docs.material-tailwind.com/demo.mp4",
953
+ size: 35e6,
954
+ createdAt: /* @__PURE__ */ new Date("2023-10-05T14:00:00Z"),
955
+ updatedAt: /* @__PURE__ */ new Date("2023-10-05T14:00:00Z"),
956
+ folderId: 3,
957
+ tags: ["work"],
958
+ mime: "video/mp4",
959
+ ext: ".mp4",
960
+ width: 1920,
961
+ height: 1080,
962
+ metaData: { duration: 600, videoSource: "local" }
963
+ },
964
+ {
965
+ id: 44,
966
+ name: "sound_effects.wav",
967
+ url: "/placeholder.svg?height=400&width=300",
968
+ size: 15e6,
969
+ createdAt: /* @__PURE__ */ new Date("2023-10-01T11:00:00Z"),
970
+ updatedAt: /* @__PURE__ */ new Date("2023-10-01T11:00:00Z"),
971
+ folderId: 4,
972
+ tags: ["project"],
973
+ mime: "audio/wav",
974
+ ext: ".wav",
975
+ metaData: { duration: 120 }
976
+ },
977
+ {
978
+ id: 45,
979
+ name: "legacy_system.zip",
980
+ url: "/placeholder.svg?height=400&width=300",
981
+ size: 125e6,
982
+ createdAt: /* @__PURE__ */ new Date("2023-09-25T09:00:00Z"),
983
+ updatedAt: /* @__PURE__ */ new Date("2023-09-25T09:00:00Z"),
984
+ folderId: 5,
985
+ tags: ["archive"],
986
+ mime: "application/zip",
987
+ ext: ".zip",
988
+ metaData: { description: "Old system files" }
989
+ }
990
+ ];
991
+
992
+ // types/file-manager.ts
993
+ var MODE = {
994
+ PAGE: "page",
995
+ MODAL: "modal"
996
+ };
997
+ var MODES = Object.values(MODE);
998
+ var FILE_TYPE = {
999
+ IMAGE: "images",
1000
+ VIDEO: "videos",
1001
+ AUDIO: "audios",
1002
+ FILE: "files"
1003
+ };
1004
+ var FILE_TYPES = Object.values(FILE_TYPE);
1005
+ var SELECTION_MODE = {
1006
+ SINGLE: "single",
1007
+ MULTIPLE: "multiple"
1008
+ };
1009
+ var SELECTION_MODES = Object.values(SELECTION_MODE);
1010
+ var VIEW_MODE = {
1011
+ GRID: "grid",
1012
+ LIST: "list"
1013
+ };
1014
+ var VIEW_MODES = Object.values(VIEW_MODE);
1015
+ var VIDEO_SOURCE = {
1016
+ LOCAL: "local",
1017
+ REMOTE: "remote",
1018
+ YOUTUBE: "youtube",
1019
+ VIMEO: "vimeo"
1020
+ };
1021
+ var VIDEO_SOURCES = Object.values(VIDEO_SOURCE);
1022
+
1023
+ // lib/file-utils.tsx
1024
+ import mime from "mime";
1025
+ import { jsx } from "react/jsx-runtime";
1026
+ function getFileTypeFromMime(mimeType, extension) {
1027
+ if (typeof mimeType !== "string") {
1028
+ console.warn("getFileTypeFromMime: mimeType is not a string:", mimeType);
1029
+ return FILE_TYPE.FILE;
1030
+ }
1031
+ let effectiveMime = mimeType;
1032
+ if (extension) {
1033
+ const ext = extension.toLowerCase().replace(/^\./, "");
1034
+ const detectedMime = mime.getType(ext);
1035
+ if (detectedMime) {
1036
+ effectiveMime = detectedMime;
1037
+ }
1038
+ }
1039
+ if (effectiveMime.startsWith("image/")) {
1040
+ return FILE_TYPE.IMAGE;
1041
+ }
1042
+ if (effectiveMime.startsWith("video/")) {
1043
+ return FILE_TYPE.VIDEO;
1044
+ }
1045
+ if (effectiveMime.startsWith("audio/")) {
1046
+ return FILE_TYPE.AUDIO;
1047
+ }
1048
+ return FILE_TYPE.FILE;
1049
+ }
1050
+
1051
+ // providers/mock-provider.ts
1052
+ var delay = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
1053
+ var MockProvider = class {
1054
+ getFolder(folderId) {
1055
+ if (folderId === null) return Promise.resolve(null);
1056
+ const folder = mockFolders.find((f) => f.id === folderId);
1057
+ if (!folder) return Promise.resolve(null);
1058
+ const result = __spreadValues({}, folder);
1059
+ let current = result;
1060
+ while (current.parentId !== null) {
1061
+ const parent = mockFolders.find((f) => f.id === current.parentId);
1062
+ if (parent) {
1063
+ current.parent = __spreadValues({}, parent);
1064
+ current = current.parent;
1065
+ } else {
1066
+ break;
1067
+ }
1068
+ }
1069
+ return Promise.resolve(result);
1070
+ }
1071
+ async getFolders(folderId, page = 1, limit = 20, query = "") {
1072
+ await delay(300);
1073
+ const filteredFolders = folderId === null ? mockFolders.filter((folder) => folder.parentId === null) : mockFolders.filter((folder) => folder.parentId === folderId);
1074
+ let searchFiltered = filteredFolders;
1075
+ if (query == null ? void 0 : query.trim()) {
1076
+ const searchLower = query.toLowerCase().trim();
1077
+ searchFiltered = filteredFolders.filter(
1078
+ (folder) => folder.name.toLowerCase().includes(searchLower)
1079
+ );
1080
+ }
1081
+ const sortedFolders = searchFiltered.toSorted(
1082
+ (a, b) => new Date(a.createdAt).getTime() - new Date(b.createdAt).getTime()
1083
+ );
1084
+ const totalFolders = sortedFolders.length;
1085
+ const totalPages = Math.ceil(totalFolders / limit);
1086
+ const startIndex = (page - 1) * limit;
1087
+ const paginatedFolders = sortedFolders.slice(startIndex, startIndex + limit);
1088
+ return {
1089
+ folders: paginatedFolders,
1090
+ pagination: {
1091
+ currentPage: page,
1092
+ totalPages,
1093
+ totalFiles: totalFolders,
1094
+ filesPerPage: limit
1095
+ }
1096
+ };
1097
+ }
1098
+ getTags() {
1099
+ return Promise.resolve(mockTags.map((tag) => tag.name));
1100
+ }
1101
+ async getFiles(folderId, fileTypes, page, limit, query) {
1102
+ await delay(500);
1103
+ let filteredFiles = [...mockFiles];
1104
+ if (folderId !== null) {
1105
+ filteredFiles = filteredFiles.filter(
1106
+ (file) => file.folderId === folderId
1107
+ );
1108
+ }
1109
+ if (fileTypes && fileTypes.length > 0) {
1110
+ filteredFiles = filteredFiles.filter((file) => {
1111
+ const fileType = getFileTypeFromMime(file.mime, file.ext);
1112
+ return fileTypes.includes(fileType);
1113
+ });
1114
+ }
1115
+ if (query) {
1116
+ const searchLower = query == null ? void 0 : query.toLowerCase();
1117
+ filteredFiles = filteredFiles.filter(
1118
+ (file) => file.name.toLowerCase().includes(searchLower)
1119
+ );
1120
+ }
1121
+ const sortedFiles = filteredFiles.toSorted(
1122
+ (a, b) => new Date(a.createdAt).getTime() - new Date(b.createdAt).getTime()
1123
+ );
1124
+ const currentPage = page != null ? page : 1;
1125
+ const filesPerPage = limit != null ? limit : 10;
1126
+ const totalFiles = sortedFiles.length;
1127
+ const totalPages = Math.ceil(totalFiles / filesPerPage);
1128
+ const startIndex = (currentPage - 1) * filesPerPage;
1129
+ const paginatedFiles = sortedFiles.slice(
1130
+ startIndex,
1131
+ startIndex + filesPerPage
1132
+ );
1133
+ return {
1134
+ files: paginatedFiles,
1135
+ pagination: {
1136
+ currentPage,
1137
+ totalPages,
1138
+ totalFiles,
1139
+ filesPerPage
1140
+ }
1141
+ };
1142
+ }
1143
+ /**
1144
+ * Get files and folders separately (folders always come first)
1145
+ * Folders are not paginated (all folders in current directory are returned)
1146
+ * Files are paginated after folders
1147
+ */
1148
+ async getItems(folderId, fileTypes, page = 1, limit = 24, query = "") {
1149
+ await delay(300);
1150
+ let filteredFolders = folderId === null ? mockFolders.filter((folder) => folder.parentId === null) : mockFolders.filter((folder) => folder.parentId === folderId);
1151
+ let filteredFiles = folderId === null ? mockFiles.filter((file) => file.folderId === null) : mockFiles.filter((file) => file.folderId === folderId);
1152
+ if (fileTypes && fileTypes.length > 0) {
1153
+ filteredFiles = filteredFiles.filter((file) => {
1154
+ const fileType = getFileTypeFromMime(file.mime, file.ext);
1155
+ return fileTypes.includes(fileType);
1156
+ });
1157
+ }
1158
+ if (query == null ? void 0 : query.trim()) {
1159
+ const searchLower = query.toLowerCase().trim();
1160
+ filteredFolders = filteredFolders.filter(
1161
+ (folder) => folder.name.toLowerCase().includes(searchLower)
1162
+ );
1163
+ filteredFiles = filteredFiles.filter(
1164
+ (file) => {
1165
+ var _a, _b;
1166
+ return file.name.toLowerCase().includes(searchLower) || ((_b = (_a = file.ext) == null ? void 0 : _a.toLowerCase().includes(searchLower)) != null ? _b : false);
1167
+ }
1168
+ );
1169
+ }
1170
+ const sortedFolders = filteredFolders.toSorted(
1171
+ (a, b) => new Date(a.createdAt).getTime() - new Date(b.createdAt).getTime()
1172
+ );
1173
+ const sortedFiles = filteredFiles.toSorted(
1174
+ (a, b) => new Date(a.createdAt).getTime() - new Date(b.createdAt).getTime()
1175
+ );
1176
+ const totalItems = sortedFolders.length + sortedFiles.length;
1177
+ const totalPages = Math.ceil(totalItems / limit) || 1;
1178
+ const startIndex = (page - 1) * limit;
1179
+ const endIndex = startIndex + limit;
1180
+ const foldersToShow = sortedFolders.slice(
1181
+ Math.max(0, startIndex),
1182
+ Math.min(sortedFolders.length, endIndex)
1183
+ );
1184
+ const foldersTaken = foldersToShow.length;
1185
+ const fileSlots = limit - foldersTaken;
1186
+ const fileStartIndex = Math.max(0, startIndex - sortedFolders.length);
1187
+ const filesToShow = sortedFiles.slice(fileStartIndex, fileStartIndex + fileSlots);
1188
+ return {
1189
+ folders: foldersToShow,
1190
+ files: filesToShow,
1191
+ pagination: {
1192
+ currentPage: page,
1193
+ totalPages,
1194
+ totalFiles: totalItems,
1195
+ filesPerPage: limit
1196
+ }
1197
+ };
1198
+ }
1199
+ async createFolder(name, parentId) {
1200
+ await delay(300);
1201
+ const newFolder = {
1202
+ id: Date.now(),
1203
+ // simple unique id
1204
+ name,
1205
+ parentId: parentId != null ? parentId : null,
1206
+ pathId: typeof parentId === "number" ? parentId : 0,
1207
+ // Fallback logic
1208
+ path: "",
1209
+ fileCount: 0,
1210
+ folderCount: 0,
1211
+ createdAt: /* @__PURE__ */ new Date(),
1212
+ updatedAt: /* @__PURE__ */ new Date()
1213
+ };
1214
+ mockFolders.push(newFolder);
1215
+ return newFolder;
1216
+ }
1217
+ getMetaDataType(file, videoSource) {
1218
+ if (file.type.startsWith("image/")) {
1219
+ return {};
1220
+ } else if (file.type.startsWith("video/")) {
1221
+ return {
1222
+ duration: 0,
1223
+ // Mock
1224
+ videoSource: videoSource != null ? videoSource : VIDEO_SOURCE.LOCAL
1225
+ };
1226
+ } else if (file.type.startsWith("audio/")) {
1227
+ return {
1228
+ duration: 0
1229
+ };
1230
+ }
1231
+ return {
1232
+ description: ""
1233
+ };
1234
+ }
1235
+ getFileType(file) {
1236
+ var _a;
1237
+ const ext = "." + ((_a = file.name.split(".").pop()) == null ? void 0 : _a.toLowerCase());
1238
+ return getFileTypeFromMime(file.type, ext);
1239
+ }
1240
+ // Note: Static helper removed - use getFileTypeFromMime from lib/file-type-utils instead
1241
+ async uploadFiles(files, folderId) {
1242
+ var _a;
1243
+ await delay(500);
1244
+ const uploadedFiles = [];
1245
+ for (const { file, videoSource } of files) {
1246
+ const fileType = this.getFileType(file);
1247
+ const ext = "." + ((_a = file.name.split(".").pop()) == null ? void 0 : _a.toLowerCase());
1248
+ const newFile = {
1249
+ id: Date.now() + Math.random(),
1250
+ // Ensure unique IDs
1251
+ name: file.name,
1252
+ folderId: folderId != null ? folderId : null,
1253
+ size: file.size,
1254
+ url: URL.createObjectURL(file),
1255
+ // Mock URL
1256
+ // type field omitted - will be derived from mime/ext using getFileTypeFromMime
1257
+ mime: file.type || "application/octet-stream",
1258
+ ext,
1259
+ metaData: this.getMetaDataType(file, videoSource),
1260
+ createdAt: /* @__PURE__ */ new Date(),
1261
+ updatedAt: /* @__PURE__ */ new Date(),
1262
+ tags: [],
1263
+ // Mock default dims for images if needed, or leave undefined
1264
+ width: fileType === FILE_TYPE.IMAGE ? 800 : void 0,
1265
+ height: fileType === FILE_TYPE.IMAGE ? 600 : void 0
1266
+ };
1267
+ mockFiles.push(newFile);
1268
+ uploadedFiles.push(newFile);
1269
+ }
1270
+ return uploadedFiles;
1271
+ }
1272
+ renameFolder(folderId, newName) {
1273
+ const folder = mockFolders.find((f) => f.id === folderId);
1274
+ if (!folder) {
1275
+ return Promise.reject(new Error("Folder not found"));
1276
+ }
1277
+ folder.name = newName;
1278
+ folder.updatedAt = /* @__PURE__ */ new Date();
1279
+ return Promise.resolve(folder);
1280
+ }
1281
+ updateFileMetaData(fileId, updates) {
1282
+ const file = mockFiles.find((f) => f.id === fileId);
1283
+ if (!file) {
1284
+ return Promise.reject(new Error("File not found"));
1285
+ }
1286
+ const _a = updates, { metaData } = _a, rootUpdates = __objRest(_a, ["metaData"]);
1287
+ Object.assign(file, rootUpdates);
1288
+ if (metaData) {
1289
+ file.metaData = __spreadValues(__spreadValues({}, file.metaData), metaData);
1290
+ }
1291
+ file.updatedAt = /* @__PURE__ */ new Date();
1292
+ return Promise.resolve(file);
1293
+ }
1294
+ deleteFiles(fileIds) {
1295
+ for (const fileId of fileIds) {
1296
+ const fileIndex = mockFiles.findIndex((f) => f.id === fileId);
1297
+ if (fileIndex !== -1) {
1298
+ mockFiles.splice(fileIndex, 1);
1299
+ }
1300
+ }
1301
+ return Promise.resolve();
1302
+ }
1303
+ deleteFolders(folderIds) {
1304
+ for (const folderId of folderIds) {
1305
+ const folderIndex = mockFolders.findIndex((f) => f.id === folderId);
1306
+ if (folderIndex !== -1) {
1307
+ mockFolders.splice(folderIndex, 1);
1308
+ for (let i = mockFiles.length - 1; i >= 0; i--) {
1309
+ if (mockFiles[i].folderId === folderId) {
1310
+ mockFiles.splice(i, 1);
1311
+ }
1312
+ }
1313
+ }
1314
+ }
1315
+ return Promise.resolve();
1316
+ }
1317
+ findFiles(searchQuery) {
1318
+ const query = searchQuery == null ? void 0 : searchQuery.toLowerCase();
1319
+ const foundFiles = mockFiles.filter(
1320
+ (file) => {
1321
+ var _a;
1322
+ return file.name.toLowerCase().includes(query) || ((_a = file.tags) == null ? void 0 : _a.some((tag) => tag.toLowerCase().includes(query)));
1323
+ }
1324
+ );
1325
+ return Promise.resolve(foundFiles);
1326
+ }
1327
+ findFolders(searchQuery) {
1328
+ const query = searchQuery == null ? void 0 : searchQuery.toLowerCase();
1329
+ const foundFolders = mockFolders.filter(
1330
+ (folder) => folder.name.toLowerCase().includes(query)
1331
+ );
1332
+ return Promise.resolve(foundFolders);
1333
+ }
1334
+ moveFiles(fileIds, newFolderId) {
1335
+ const movedFiles = [];
1336
+ for (const fileId of fileIds) {
1337
+ const file = mockFiles.find((f) => f.id === fileId);
1338
+ if (file) {
1339
+ file.folderId = newFolderId;
1340
+ file.updatedAt = /* @__PURE__ */ new Date();
1341
+ movedFiles.push(file);
1342
+ }
1343
+ }
1344
+ return Promise.resolve(movedFiles);
1345
+ }
1346
+ moveFolders(folderIds, newParentId) {
1347
+ const movedFolders = [];
1348
+ for (const folderId of folderIds) {
1349
+ const folder = mockFolders.find((f) => f.id === folderId);
1350
+ if (folder) {
1351
+ folder.parentId = newParentId;
1352
+ folder.updatedAt = /* @__PURE__ */ new Date();
1353
+ movedFolders.push(folder);
1354
+ }
1355
+ }
1356
+ return Promise.resolve(movedFolders);
1357
+ }
1358
+ };
1359
+ export {
1360
+ MockProvider
1361
+ };