@unciatech/file-manager 0.0.21 → 0.0.26

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