@chaibuilder/pages 0.4.6 → 0.4.7
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/{B4MFY5CR-CJ_zQjzE.cjs → B4MFY5CR-0MVmdo7C.cjs} +1 -1
- package/dist/{B4MFY5CR-94OKrKm9.js → B4MFY5CR-B0gjiEA3.js} +1 -1
- package/dist/{HO4MOOFI-CRSNiC7G.js → HO4MOOFI-CIV6iAkb.js} +2 -2
- package/dist/{HO4MOOFI-BHGee8_h.cjs → HO4MOOFI-r2V7_ve4.cjs} +1 -1
- package/dist/{HUY7CZI3-DfVfYgpJ.js → HUY7CZI3-Chau07Me.js} +2 -2
- package/dist/{HUY7CZI3-DpGRfHvo.cjs → HUY7CZI3-D-0djGVi.cjs} +1 -1
- package/dist/asset-metadata-editor-r5vYHUfm.js +108 -0
- package/dist/asset-metadata-editor-zw9u1BB9.cjs +1 -0
- package/dist/digital-asset-manager-BopT8BhD.cjs +1 -0
- package/dist/digital-asset-manager-CBaY202W.js +481 -0
- package/dist/{index-Dq_xGZ55.js → index-CSVDtkP9.js} +160 -158
- package/dist/{index-Dhwd3gtU.cjs → index-Cv2dcnN-.cjs} +2 -2
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/dist/server.cjs +1 -1
- package/dist/server.d.ts +17 -6
- package/dist/server.js +84 -65
- package/package.json +3 -2
- package/dist/asset-metadata-editor-CEFwXx62.js +0 -91
- package/dist/asset-metadata-editor-YXDey62L.cjs +0 -1
- package/dist/digital-asset-manager-B3G7kQ5a.cjs +0 -1
- package/dist/digital-asset-manager-DS4mu-dP.js +0 -462
|
@@ -0,0 +1,481 @@
|
|
|
1
|
+
import { jsxs as a, Fragment as B, jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import W, { useState as S, useCallback as A, useMemo as re, useRef as oe, Suspense as O } from "react";
|
|
3
|
+
import { mergeClasses as Y } from "@chaibuilder/sdk";
|
|
4
|
+
import { Tabs as ce, TabsList as de, TabsTrigger as $, Button as f, TabsContent as H, Input as ue, Card as me, CardContent as he, Dialog as ge, DialogContent as pe, DialogHeader as fe, DialogTitle as ye, DialogDescription as ve, DialogFooter as xe } from "@chaibuilder/sdk/ui";
|
|
5
|
+
import { debounce as Ne, find as Ae, merge as we } from "lodash-es";
|
|
6
|
+
import { Search as Se, Film as be, ImageIcon as Ce, Edit as Ee, Trash2 as Te, Loader2 as V, Upload as De } from "lucide-react";
|
|
7
|
+
import { useDropzone as Pe } from "react-dropzone";
|
|
8
|
+
import { useQueryClient as Q, useMutation as R, useQuery as Ue } from "@tanstack/react-query";
|
|
9
|
+
import { toast as b } from "sonner";
|
|
10
|
+
import { W as z, X as F, Y as y, Z as ze } from "./index-CSVDtkP9.js";
|
|
11
|
+
const Fe = () => {
|
|
12
|
+
const t = z(), r = Q(), o = F();
|
|
13
|
+
return R({
|
|
14
|
+
mutationFn: async ({
|
|
15
|
+
file: i,
|
|
16
|
+
folderId: d,
|
|
17
|
+
name: u
|
|
18
|
+
}) => o(t, {
|
|
19
|
+
action: y.UPLOAD_ASSET,
|
|
20
|
+
data: { file: i, folderId: d, name: u }
|
|
21
|
+
}),
|
|
22
|
+
onSuccess: () => {
|
|
23
|
+
r.invalidateQueries({
|
|
24
|
+
queryKey: [y.GET_ASSETS]
|
|
25
|
+
}), b.success("Asset uploaded successfully");
|
|
26
|
+
},
|
|
27
|
+
onError: () => {
|
|
28
|
+
b.error("Failed to upload asset");
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
}, Me = () => {
|
|
32
|
+
const t = z(), r = Q(), o = F();
|
|
33
|
+
return R({
|
|
34
|
+
mutationFn: async (i) => o(t, {
|
|
35
|
+
action: y.DELETE_ASSET,
|
|
36
|
+
data: { id: i }
|
|
37
|
+
}),
|
|
38
|
+
onSuccess: () => {
|
|
39
|
+
r.invalidateQueries({
|
|
40
|
+
queryKey: [y.GET_ASSETS]
|
|
41
|
+
}), b.success("Asset deleted successfully");
|
|
42
|
+
},
|
|
43
|
+
onError: () => {
|
|
44
|
+
b.error("Failed to delete asset");
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
}, Ie = () => {
|
|
48
|
+
const t = z(), r = Q(), o = F();
|
|
49
|
+
return R({
|
|
50
|
+
mutationFn: async (i) => o(t, {
|
|
51
|
+
action: y.UPDATE_ASSET,
|
|
52
|
+
data: i
|
|
53
|
+
}),
|
|
54
|
+
onSuccess: () => {
|
|
55
|
+
r.invalidateQueries({
|
|
56
|
+
queryKey: [y.GET_ASSETS]
|
|
57
|
+
}), b.success("Asset updated successfully");
|
|
58
|
+
},
|
|
59
|
+
onError: () => {
|
|
60
|
+
b.error("Failed to update asset");
|
|
61
|
+
}
|
|
62
|
+
});
|
|
63
|
+
}, ke = (t = {}) => {
|
|
64
|
+
const r = z(), o = F(), { search: i, page: d = 1, limit: u = 10 } = t;
|
|
65
|
+
return Ue({
|
|
66
|
+
queryKey: [ze, y.GET_ASSETS, i, d, u],
|
|
67
|
+
queryFn: async () => (await o(r, {
|
|
68
|
+
action: y.GET_ASSETS,
|
|
69
|
+
data: {
|
|
70
|
+
search: i,
|
|
71
|
+
page: d,
|
|
72
|
+
limit: u
|
|
73
|
+
}
|
|
74
|
+
})).data,
|
|
75
|
+
retry: 1
|
|
76
|
+
});
|
|
77
|
+
};
|
|
78
|
+
function qe() {
|
|
79
|
+
const [r, o] = S([]), [i, d] = S({
|
|
80
|
+
query: "",
|
|
81
|
+
page: 1,
|
|
82
|
+
pageSize: 10
|
|
83
|
+
}), u = Ne(() => i.query, 300)(), { data: n, isLoading: C } = ke({
|
|
84
|
+
search: (u == null ? void 0 : u.toLowerCase().trim()) || "",
|
|
85
|
+
page: i.page,
|
|
86
|
+
limit: i.pageSize
|
|
87
|
+
}), v = n ? Math.ceil(n.total / n.pageSize) : 0, c = (n == null ? void 0 : n.page) || 1, g = c < v, m = c > 1, { mutate: E, isPending: M } = Ie(), { mutate: w, isPending: p } = Fe(), { mutate: T, isPending: D } = Me(), x = A(
|
|
88
|
+
(h) => {
|
|
89
|
+
h >= 1 && h <= v && d((N) => ({
|
|
90
|
+
...N,
|
|
91
|
+
page: h
|
|
92
|
+
}));
|
|
93
|
+
},
|
|
94
|
+
[v]
|
|
95
|
+
), I = A(() => {
|
|
96
|
+
g && x(c + 1);
|
|
97
|
+
}, [c, g, x]), k = A(() => {
|
|
98
|
+
m && x(c - 1);
|
|
99
|
+
}, [c, m, x]), q = A((h) => {
|
|
100
|
+
d((N) => ({
|
|
101
|
+
...N,
|
|
102
|
+
query: h,
|
|
103
|
+
page: 1
|
|
104
|
+
// Reset to first page on new search
|
|
105
|
+
}));
|
|
106
|
+
}, []), P = A(
|
|
107
|
+
(h) => {
|
|
108
|
+
o((N) => Ae(N, { id: h.id }) ? [] : [h]);
|
|
109
|
+
},
|
|
110
|
+
[!1]
|
|
111
|
+
), j = A(() => {
|
|
112
|
+
o([]);
|
|
113
|
+
}, []);
|
|
114
|
+
return {
|
|
115
|
+
// Data
|
|
116
|
+
query: (i == null ? void 0 : i.query) || "",
|
|
117
|
+
selectedAssets: r,
|
|
118
|
+
assets: (n == null ? void 0 : n.assets) || [],
|
|
119
|
+
currentPage: c,
|
|
120
|
+
totalPages: v,
|
|
121
|
+
hasNextPage: g,
|
|
122
|
+
hasPreviousPage: m,
|
|
123
|
+
// Mutations
|
|
124
|
+
uploadAsset: w,
|
|
125
|
+
updateAsset: E,
|
|
126
|
+
deleteAsset: T,
|
|
127
|
+
goToPage: x,
|
|
128
|
+
nextPage: I,
|
|
129
|
+
previousPage: k,
|
|
130
|
+
updateSearchQuery: q,
|
|
131
|
+
clearSelectedAssets: j,
|
|
132
|
+
updateSelectedAssets: P,
|
|
133
|
+
// Loading
|
|
134
|
+
isLoadingAssets: C,
|
|
135
|
+
isUploadingAsset: p,
|
|
136
|
+
isUpdatingAsset: M,
|
|
137
|
+
isDeletingAsset: D
|
|
138
|
+
};
|
|
139
|
+
}
|
|
140
|
+
const je = W.lazy(() => import("./asset-metadata-editor-r5vYHUfm.js")), _e = W.lazy(() => import("./image-editor-CwVua57o.js"));
|
|
141
|
+
function Xe({
|
|
142
|
+
close: t,
|
|
143
|
+
onSelect: r,
|
|
144
|
+
mode: o = "image"
|
|
145
|
+
}) {
|
|
146
|
+
const d = re(() => [o], [o]), [u, n] = S("browse"), [C, v] = S(null), [c, g] = S(null), [m, E] = S({ show: !1, file: "" }), {
|
|
147
|
+
// Data
|
|
148
|
+
query: M,
|
|
149
|
+
assets: w,
|
|
150
|
+
selectedAssets: p,
|
|
151
|
+
// Mutations
|
|
152
|
+
uploadAsset: T,
|
|
153
|
+
updateAsset: D,
|
|
154
|
+
deleteAsset: x,
|
|
155
|
+
updateSearchQuery: I,
|
|
156
|
+
clearSelectedAssets: k,
|
|
157
|
+
updateSelectedAssets: q,
|
|
158
|
+
// Loading
|
|
159
|
+
isLoadingAssets: P,
|
|
160
|
+
isUploadingAsset: j,
|
|
161
|
+
isUpdatingAsset: h
|
|
162
|
+
// isDeletingAsset,
|
|
163
|
+
} = qe(), N = oe(null), K = A(
|
|
164
|
+
async (s) => new Promise((l, _) => {
|
|
165
|
+
const G = s[0], U = new FileReader();
|
|
166
|
+
U.readAsDataURL(G), U.onload = async () => {
|
|
167
|
+
const L = await T({
|
|
168
|
+
file: U.result,
|
|
169
|
+
folderId: null,
|
|
170
|
+
name: G.name
|
|
171
|
+
});
|
|
172
|
+
n("browse"), l(L);
|
|
173
|
+
}, U.onerror = (L) => _(L);
|
|
174
|
+
}),
|
|
175
|
+
[T]
|
|
176
|
+
), { getRootProps: X, getInputProps: Z, isDragActive: J } = Pe({
|
|
177
|
+
onDrop: K,
|
|
178
|
+
accept: {
|
|
179
|
+
"image/*": d.includes("image") ? [] : [],
|
|
180
|
+
"video/*": d.includes("video") ? [] : []
|
|
181
|
+
},
|
|
182
|
+
maxSize: 10 * 1024 * 1024
|
|
183
|
+
}), ee = () => {
|
|
184
|
+
r([p[0].url]), t();
|
|
185
|
+
}, se = async (s) => {
|
|
186
|
+
g(s);
|
|
187
|
+
}, ae = async () => {
|
|
188
|
+
c && (await x(c.id), g(null));
|
|
189
|
+
}, te = (s) => {
|
|
190
|
+
v(s);
|
|
191
|
+
}, le = async (s, l) => {
|
|
192
|
+
await D(we(s, l)), t();
|
|
193
|
+
}, ie = (s) => {
|
|
194
|
+
I(s.target.value);
|
|
195
|
+
}, ne = async (s, l) => {
|
|
196
|
+
try {
|
|
197
|
+
l ? await T({
|
|
198
|
+
file: s,
|
|
199
|
+
folderId: null,
|
|
200
|
+
name: m.name || ""
|
|
201
|
+
}) : await D({
|
|
202
|
+
id: m.id || "",
|
|
203
|
+
file: s
|
|
204
|
+
}), E({ show: !1, file: "" }), n("browse");
|
|
205
|
+
} catch (_) {
|
|
206
|
+
console.error("Error saving edited image:", _);
|
|
207
|
+
}
|
|
208
|
+
};
|
|
209
|
+
return /* @__PURE__ */ a(B, { children: [
|
|
210
|
+
/* @__PURE__ */ a("div", { className: "min-w-[700px] min-h-[600px] w-[900px] max-w-[900px]", children: [
|
|
211
|
+
/* @__PURE__ */ e("h1", { className: "text-lg font-medium pb-4", children: "Digital Asset Manager" }),
|
|
212
|
+
/* @__PURE__ */ a(
|
|
213
|
+
ce,
|
|
214
|
+
{
|
|
215
|
+
value: u,
|
|
216
|
+
onValueChange: (s) => n(s),
|
|
217
|
+
className: "flex-1 flex flex-col h-full",
|
|
218
|
+
children: [
|
|
219
|
+
/* @__PURE__ */ a("div", { className: "flex justify-between items-center mb-2", children: [
|
|
220
|
+
/* @__PURE__ */ a(de, { children: [
|
|
221
|
+
/* @__PURE__ */ e($, { value: "browse", children: "Browse Assets" }),
|
|
222
|
+
/* @__PURE__ */ e($, { value: "upload", children: "Upload" })
|
|
223
|
+
] }),
|
|
224
|
+
/* @__PURE__ */ a("div", { className: "flex items-center gap-2", children: [
|
|
225
|
+
p.length > 0 && /* @__PURE__ */ e(B, { children: /* @__PURE__ */ e(
|
|
226
|
+
f,
|
|
227
|
+
{
|
|
228
|
+
variant: "outline",
|
|
229
|
+
size: "sm",
|
|
230
|
+
onClick: () => k(),
|
|
231
|
+
title: "Clear selection",
|
|
232
|
+
children: "Clear"
|
|
233
|
+
}
|
|
234
|
+
) }),
|
|
235
|
+
/* @__PURE__ */ e(
|
|
236
|
+
f,
|
|
237
|
+
{
|
|
238
|
+
size: "sm",
|
|
239
|
+
onClick: ee,
|
|
240
|
+
disabled: p.length === 0,
|
|
241
|
+
children: "Select Asset"
|
|
242
|
+
}
|
|
243
|
+
)
|
|
244
|
+
] })
|
|
245
|
+
] }),
|
|
246
|
+
/* @__PURE__ */ a(H, { value: "browse", className: "flex-1 flex flex-col", children: [
|
|
247
|
+
/* @__PURE__ */ e("div", { className: "flex items-center gap-2 mb-2", children: /* @__PURE__ */ a("div", { className: "relative w-full", children: [
|
|
248
|
+
/* @__PURE__ */ e(Se, { className: "absolute left-2 top-2.5 h-4 w-4 text-muted-foreground" }),
|
|
249
|
+
/* @__PURE__ */ e(
|
|
250
|
+
ue,
|
|
251
|
+
{
|
|
252
|
+
placeholder: "Search assets...",
|
|
253
|
+
value: M,
|
|
254
|
+
onChange: ie,
|
|
255
|
+
className: "pl-8"
|
|
256
|
+
}
|
|
257
|
+
)
|
|
258
|
+
] }) }),
|
|
259
|
+
P && w.length === 0 ? /* @__PURE__ */ a("div", { className: "grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-5 gap-2 overflow-y-auto max-h-[550px] p-1", children: [
|
|
260
|
+
/* @__PURE__ */ e("div", { className: "bg-gray-200 h-64 w-full animate-pulse rounded" }),
|
|
261
|
+
/* @__PURE__ */ e("div", { className: "bg-gray-200 h-64 w-full animate-pulse rounded" }),
|
|
262
|
+
/* @__PURE__ */ e("div", { className: "bg-gray-200 h-64 w-full animate-pulse rounded" }),
|
|
263
|
+
/* @__PURE__ */ e("div", { className: "bg-gray-200 h-64 w-full animate-pulse rounded" }),
|
|
264
|
+
/* @__PURE__ */ e("div", { className: "bg-gray-200 h-64 w-full animate-pulse rounded" }),
|
|
265
|
+
/* @__PURE__ */ e("div", { className: "bg-gray-200 h-64 w-full animate-pulse rounded" }),
|
|
266
|
+
/* @__PURE__ */ e("div", { className: "bg-gray-200 h-64 w-full animate-pulse rounded" }),
|
|
267
|
+
/* @__PURE__ */ e("div", { className: "bg-gray-200 h-64 w-full animate-pulse rounded" }),
|
|
268
|
+
/* @__PURE__ */ e("div", { className: "bg-gray-200 h-64 w-full animate-pulse rounded" }),
|
|
269
|
+
/* @__PURE__ */ e("div", { className: "bg-gray-200 h-64 w-full animate-pulse rounded" })
|
|
270
|
+
] }) : w.length === 0 ? /* @__PURE__ */ a("div", { className: "flex flex-col items-center justify-center h-full text-center p-12 h-[380px]", children: [
|
|
271
|
+
/* @__PURE__ */ a("div", { className: "text-muted-foreground mb-2", children: [
|
|
272
|
+
/* @__PURE__ */ e("h3", { className: "text-gray-800 font-medium", children: "No assets to display" }),
|
|
273
|
+
/* @__PURE__ */ e("p", { className: "text-sm", children: "You haven't uploaded any assets yet. Start by uploading your first asset." })
|
|
274
|
+
] }),
|
|
275
|
+
/* @__PURE__ */ e("div", { className: "flex gap-2 pt-4", children: /* @__PURE__ */ e(f, { size: "lg", onClick: () => n("upload"), children: "Upload Assets" }) })
|
|
276
|
+
] }) : /* @__PURE__ */ a(
|
|
277
|
+
"div",
|
|
278
|
+
{
|
|
279
|
+
ref: N,
|
|
280
|
+
className: "grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-5 gap-2 overflow-y-auto max-h-[550px] p-1",
|
|
281
|
+
children: [
|
|
282
|
+
w.map((s) => /* @__PURE__ */ e(
|
|
283
|
+
me,
|
|
284
|
+
{
|
|
285
|
+
className: Y(
|
|
286
|
+
"cursor-pointer overflow-hidden transition-all",
|
|
287
|
+
p.some((l) => l.id === s.id) ? "ring-2 ring-primary" : "hover:ring-2 hover:ring-primary/20"
|
|
288
|
+
),
|
|
289
|
+
onClick: () => q(s),
|
|
290
|
+
children: /* @__PURE__ */ a(he, { className: "p-0 relative group", children: [
|
|
291
|
+
/* @__PURE__ */ a("div", { className: "aspect-square relative overflow-hidden bg-muted", children: [
|
|
292
|
+
s.type === "image" ? /* @__PURE__ */ e(
|
|
293
|
+
"img",
|
|
294
|
+
{
|
|
295
|
+
src: s.thumbnailUrl || "/placeholder.svg",
|
|
296
|
+
alt: s.name,
|
|
297
|
+
className: "object-cover w-full h-full"
|
|
298
|
+
}
|
|
299
|
+
) : /* @__PURE__ */ a("div", { className: "flex items-center justify-center h-full", children: [
|
|
300
|
+
/* @__PURE__ */ e(be, { className: "h-12 w-12 text-muted-foreground" }),
|
|
301
|
+
s.thumbnailUrl && /* @__PURE__ */ e(
|
|
302
|
+
"img",
|
|
303
|
+
{
|
|
304
|
+
src: s.thumbnailUrl || "/placeholder.svg",
|
|
305
|
+
alt: s.name,
|
|
306
|
+
className: "absolute inset-0 object-cover w-full h-full"
|
|
307
|
+
}
|
|
308
|
+
)
|
|
309
|
+
] }),
|
|
310
|
+
/* @__PURE__ */ a("div", { className: "absolute inset-0 bg-black/50 opacity-0 group-hover:opacity-100 transition-opacity flex items-center justify-center gap-2", children: [
|
|
311
|
+
/* @__PURE__ */ e(
|
|
312
|
+
f,
|
|
313
|
+
{
|
|
314
|
+
variant: "secondary",
|
|
315
|
+
size: "icon",
|
|
316
|
+
className: "h-8 w-8",
|
|
317
|
+
onClick: (l) => {
|
|
318
|
+
l.stopPropagation(), te(s);
|
|
319
|
+
},
|
|
320
|
+
children: /* @__PURE__ */ e(Ce, { className: "h-4 w-4" })
|
|
321
|
+
}
|
|
322
|
+
),
|
|
323
|
+
/* @__PURE__ */ e(
|
|
324
|
+
f,
|
|
325
|
+
{
|
|
326
|
+
variant: "secondary",
|
|
327
|
+
size: "icon",
|
|
328
|
+
className: "h-8 w-8",
|
|
329
|
+
onClick: (l) => {
|
|
330
|
+
l.stopPropagation(), E({
|
|
331
|
+
id: s.id,
|
|
332
|
+
show: !0,
|
|
333
|
+
file: s.url,
|
|
334
|
+
name: s.name
|
|
335
|
+
});
|
|
336
|
+
},
|
|
337
|
+
children: /* @__PURE__ */ e(Ee, { className: "h-4 w-4" })
|
|
338
|
+
}
|
|
339
|
+
),
|
|
340
|
+
/* @__PURE__ */ e(
|
|
341
|
+
f,
|
|
342
|
+
{
|
|
343
|
+
variant: "destructive",
|
|
344
|
+
size: "icon",
|
|
345
|
+
className: "h-8 w-8",
|
|
346
|
+
onClick: (l) => {
|
|
347
|
+
l.stopPropagation(), se(s);
|
|
348
|
+
},
|
|
349
|
+
children: /* @__PURE__ */ e(Te, { className: "h-4 w-4" })
|
|
350
|
+
}
|
|
351
|
+
)
|
|
352
|
+
] }),
|
|
353
|
+
p.some((l) => l.id === s.id) && /* @__PURE__ */ e("div", { className: "absolute top-2 left-2", children: /* @__PURE__ */ e(
|
|
354
|
+
"input",
|
|
355
|
+
{
|
|
356
|
+
type: "checkbox",
|
|
357
|
+
checked: p.some(
|
|
358
|
+
(l) => l.id === s.id
|
|
359
|
+
),
|
|
360
|
+
readOnly: !0,
|
|
361
|
+
className: "rounded-full"
|
|
362
|
+
}
|
|
363
|
+
) })
|
|
364
|
+
] }),
|
|
365
|
+
/* @__PURE__ */ a("div", { className: "p-2", children: [
|
|
366
|
+
/* @__PURE__ */ e(
|
|
367
|
+
"div",
|
|
368
|
+
{
|
|
369
|
+
className: "text-sm font-medium truncate",
|
|
370
|
+
title: s.name,
|
|
371
|
+
children: s.name
|
|
372
|
+
}
|
|
373
|
+
),
|
|
374
|
+
/* @__PURE__ */ a("div", { className: "text-xs text-muted-foreground flex items-center justify-between", children: [
|
|
375
|
+
/* @__PURE__ */ e("span", { children: Le((s == null ? void 0 : s.size) || 0) }),
|
|
376
|
+
/* @__PURE__ */ e("span", { children: Be(s.createdAt) })
|
|
377
|
+
] })
|
|
378
|
+
] })
|
|
379
|
+
] })
|
|
380
|
+
},
|
|
381
|
+
s.id
|
|
382
|
+
)),
|
|
383
|
+
P && w.length > 0 && /* @__PURE__ */ e("div", { className: "col-span-full flex justify-center py-4", children: /* @__PURE__ */ e(V, { className: "h-6 w-6 animate-spin text-muted-foreground" }) })
|
|
384
|
+
]
|
|
385
|
+
}
|
|
386
|
+
)
|
|
387
|
+
] }),
|
|
388
|
+
/* @__PURE__ */ e(H, { value: "upload", className: "flex-1 ", children: /* @__PURE__ */ a(
|
|
389
|
+
"div",
|
|
390
|
+
{
|
|
391
|
+
...X(),
|
|
392
|
+
className: Y(
|
|
393
|
+
"border-2 border-dashed rounded-lg h-[380px] flex flex-col items-center justify-center text-center cursor-pointer hover:bg-gray-50",
|
|
394
|
+
J ? "border-primary bg-primary/5" : "border-muted-foreground/20"
|
|
395
|
+
),
|
|
396
|
+
children: [
|
|
397
|
+
/* @__PURE__ */ e("input", { ...Z() }),
|
|
398
|
+
h || j ? /* @__PURE__ */ a("div", { className: "flex flex-col items-center", children: [
|
|
399
|
+
/* @__PURE__ */ e(V, { className: "h-12 w-12 text-primary animate-spin mb-4" }),
|
|
400
|
+
/* @__PURE__ */ e("h3", { className: "text-lg font-medium mb-1", children: "Uploading files..." }),
|
|
401
|
+
/* @__PURE__ */ e("p", { className: "text-sm text-muted-foreground", children: "Please wait while your files are being processed." })
|
|
402
|
+
] }) : /* @__PURE__ */ a(B, { children: [
|
|
403
|
+
/* @__PURE__ */ e(De, { className: "h-12 w-12 text-muted-foreground mb-4" }),
|
|
404
|
+
/* @__PURE__ */ e("h3", { className: "text-lg font-medium mb-1", children: "Drag & drop files here" }),
|
|
405
|
+
/* @__PURE__ */ e("p", { className: "text-sm text-muted-foreground mb-4", children: "or click to browse your files" }),
|
|
406
|
+
/* @__PURE__ */ a("div", { className: "text-xs text-muted-foreground", children: [
|
|
407
|
+
/* @__PURE__ */ a("p", { children: [
|
|
408
|
+
"Accepted file types: ",
|
|
409
|
+
d.join(", ")
|
|
410
|
+
] }),
|
|
411
|
+
/* @__PURE__ */ a("p", { children: [
|
|
412
|
+
"Maximum file size: ",
|
|
413
|
+
10,
|
|
414
|
+
"MB"
|
|
415
|
+
] })
|
|
416
|
+
] })
|
|
417
|
+
] })
|
|
418
|
+
]
|
|
419
|
+
}
|
|
420
|
+
) })
|
|
421
|
+
]
|
|
422
|
+
}
|
|
423
|
+
)
|
|
424
|
+
] }),
|
|
425
|
+
C && /* @__PURE__ */ e(O, { fallback: /* @__PURE__ */ e("div", { children: "Loading..." }), children: /* @__PURE__ */ e(
|
|
426
|
+
je,
|
|
427
|
+
{
|
|
428
|
+
asset: C,
|
|
429
|
+
onSave: (s) => le(C, s),
|
|
430
|
+
onCancel: () => {
|
|
431
|
+
v(null);
|
|
432
|
+
}
|
|
433
|
+
}
|
|
434
|
+
) }),
|
|
435
|
+
m.show && /* @__PURE__ */ e(O, { fallback: /* @__PURE__ */ e("div", { children: "Loading..." }), children: /* @__PURE__ */ e(
|
|
436
|
+
_e,
|
|
437
|
+
{
|
|
438
|
+
imageUrl: m.file,
|
|
439
|
+
onSave: ne,
|
|
440
|
+
onClose: () => E({ show: !1, file: "" }),
|
|
441
|
+
defaultSavedImageName: m.name,
|
|
442
|
+
isEditing: !!m.id
|
|
443
|
+
}
|
|
444
|
+
) }),
|
|
445
|
+
c && /* @__PURE__ */ e(
|
|
446
|
+
ge,
|
|
447
|
+
{
|
|
448
|
+
open: !!c,
|
|
449
|
+
onOpenChange: () => g(null),
|
|
450
|
+
children: /* @__PURE__ */ a(pe, { children: [
|
|
451
|
+
/* @__PURE__ */ a(fe, { children: [
|
|
452
|
+
/* @__PURE__ */ e(ye, { children: "Delete Asset" }),
|
|
453
|
+
/* @__PURE__ */ a(ve, { children: [
|
|
454
|
+
'Are you sure you want to delete "',
|
|
455
|
+
c.name,
|
|
456
|
+
'"? This action cannot be undone.'
|
|
457
|
+
] })
|
|
458
|
+
] }),
|
|
459
|
+
/* @__PURE__ */ a(xe, { className: "gap-2 sm:gap-0", children: [
|
|
460
|
+
/* @__PURE__ */ e(f, { variant: "outline", onClick: () => g(null), children: "Cancel" }),
|
|
461
|
+
/* @__PURE__ */ e(f, { variant: "destructive", onClick: ae, children: "Delete" })
|
|
462
|
+
] })
|
|
463
|
+
] })
|
|
464
|
+
}
|
|
465
|
+
)
|
|
466
|
+
] });
|
|
467
|
+
}
|
|
468
|
+
function Le(t) {
|
|
469
|
+
return t < 1024 ? `${t.toFixed(2)} KB` : `${(t / 1024).toFixed(2)} MB`;
|
|
470
|
+
}
|
|
471
|
+
function Be(t) {
|
|
472
|
+
const r = new Date(t);
|
|
473
|
+
return new Intl.DateTimeFormat("en-US", {
|
|
474
|
+
month: "short",
|
|
475
|
+
day: "numeric",
|
|
476
|
+
year: "numeric"
|
|
477
|
+
}).format(r);
|
|
478
|
+
}
|
|
479
|
+
export {
|
|
480
|
+
Xe as default
|
|
481
|
+
};
|