@gatewaze/admin-embed 0.1.0
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/README.md +42 -0
- package/dist/AiSkillsPicker-dbFhcanE.js +373 -0
- package/dist/ContentAccessPage-D0HRqPFc.js +264 -0
- package/dist/DataTable-fe6yRVpF.js +1984 -0
- package/dist/DetailPageHeader-D_v7924k.js +69 -0
- package/dist/EditionEmail-CyhC8232.js +8382 -0
- package/dist/GuideContent-DBXKCu7r.js +7580 -0
- package/dist/HostMediaTab-BsIBEQ1v.js +440 -0
- package/dist/InboxPage-C8ivCKdx.js +1112 -0
- package/dist/NewsletterCanvasEditor--B06apn3.js +11453 -0
- package/dist/NewsletterSetupWizard-BqV6-fa5.js +347 -0
- package/dist/NewsletterSignup-DRVZIpOs.js +224 -0
- package/dist/Page-D3u8IZ2a.js +14 -0
- package/dist/Toaster-Cde0i6IA.js +18 -0
- package/dist/Tooltip-CqxUlW1d.js +746 -0
- package/dist/_collectionSlug_-B3UN6M-Q.js +308 -0
- package/dist/_collection_-Qz4k_Qjl.js +139 -0
- package/dist/_edition_-DQXwkI_-.js +301 -0
- package/dist/_id_-CtT7rT9f.js +257 -0
- package/dist/_id_-CzScE4Qn.js +1197 -0
- package/dist/_virtual_gatewaze-modules-BeloWlOa.js +991 -0
- package/dist/admin-B0Mmrh_O.js +1239 -0
- package/dist/admin-CcfoK6vD.js +17 -0
- package/dist/admin-embed.js +21844 -0
- package/dist/admin.css +2 -0
- package/dist/block-editor-vXBShAue.js +226 -0
- package/dist/brand-DklYwIeA.js +11 -0
- package/dist/brick-editor-CmBitMMK.js +225 -0
- package/dist/broadcastService-CBqXNt_N.js +190 -0
- package/dist/classnames-uWIYaD6z.js +44 -0
- package/dist/contentAccessService-Cs7tdAo-.js +59 -0
- package/dist/context-jzuubYRz.js +5 -0
- package/dist/createSafeContext-P1pK0sAN.js +17 -0
- package/dist/detail-B8SVFJJr.js +26285 -0
- package/dist/detail-uFBxRbLF.js +2966 -0
- package/dist/dist-DTrOExw8.js +38806 -0
- package/dist/edition-slug-CARO24Bs.js +7 -0
- package/dist/export-edition-html-C_hdXQu5.js +18893 -0
- package/dist/floating-ui.dom-Cyv879E9.js +987 -0
- package/dist/hooks-C377EXJG.js +2974 -0
- package/dist/img/mlops-logo.png +0 -0
- package/dist/img/mlops-logo2.png +0 -0
- package/dist/index.d.ts +105 -0
- package/dist/jsx-runtime-CjozyJt-.js +180 -0
- package/dist/lib-CylJmhlJ.js +828 -0
- package/dist/list-C0cz0aQz.js +451 -0
- package/dist/list-CIVgIGsU.js +166 -0
- package/dist/logo/mlops-alt.png +0 -0
- package/dist/logo/mlops-logo.png +0 -0
- package/dist/new-r4KWpqa6.js +80 -0
- package/dist/outline-DwDYhYcF.js +6538 -0
- package/dist/pages-Ersfxcz7.js +216 -0
- package/dist/preview/12627f.jpg +0 -0
- package/dist/preview/af009d.jpg +0 -0
- package/dist/public-api-LD11kMxh.js +238 -0
- package/dist/react-DB2tPNit.js +933 -0
- package/dist/react-dom-giQNVXng.js +267 -0
- package/dist/registry-4XrV9iNG.js +7 -0
- package/dist/render-BtUWfMUt.js +59634 -0
- package/dist/resolvePeopleByEmail-hivX2l07.js +828 -0
- package/dist/runtime-config.js +10 -0
- package/dist/sends-BkPO6PG2.js +182 -0
- package/dist/server.browser-Pj3QUa7k.js +15227 -0
- package/dist/shim-BCerG8nb.js +6681 -0
- package/dist/sonnerHostBridge-CXuCMM3R.js +665 -0
- package/dist/src-BWDAOzZO.js +799 -0
- package/dist/starter-templates-CFs-QUdF.js +3077 -0
- package/dist/storage-VDSvnkvR.js +39 -0
- package/dist/templateParser-BQ2IsJ6c.js +49 -0
- package/dist/templates-rjQjWsRr.js +253 -0
- package/dist/theme/gatewaze/android-icon-144x144.png +0 -0
- package/dist/theme/gatewaze/android-icon-192x192.png +0 -0
- package/dist/theme/gatewaze/android-icon-36x36.png +0 -0
- package/dist/theme/gatewaze/android-icon-48x48.png +0 -0
- package/dist/theme/gatewaze/android-icon-72x72.png +0 -0
- package/dist/theme/gatewaze/android-icon-96x96.png +0 -0
- package/dist/theme/gatewaze/favicon-144x144.png +0 -0
- package/dist/theme/gatewaze/favicon-16x16.png +0 -0
- package/dist/theme/gatewaze/favicon-192x192.png +0 -0
- package/dist/theme/gatewaze/favicon-32x32.png +0 -0
- package/dist/theme/gatewaze/favicon-96x96.png +0 -0
- package/dist/theme/gatewaze/favicon.ico +0 -0
- package/dist/theme/gatewaze/gatewaze-icon-512.png +0 -0
- package/dist/theme/gatewaze/gatewaze-logo-black.svg +24 -0
- package/dist/theme/gatewaze/gatewaze-logo-white.svg +20 -0
- package/dist/theme/gatewaze/gatewaze-poweredby-black.svg +25 -0
- package/dist/theme/gatewaze/gatewaze-poweredby-white.svg +25 -0
- package/dist/theme/gatewaze/logo_black.svg +24 -0
- package/dist/theme/gatewaze/logo_white.svg +20 -0
- package/dist/theme-D6odw5nx.js +586 -0
- package/dist/ui-DRIo9Krs.js +9747 -0
- package/dist/upload-DMNfZ6FX.js +505 -0
- package/dist/useModuleFeature-DgsFIUpv.js +8 -0
- package/dist/utils-BcVvIjaY.js +36 -0
- package/dist/with-selector-B8eSdVx_.js +100 -0
- package/package.json +33 -0
|
@@ -0,0 +1,440 @@
|
|
|
1
|
+
import { c as e, i as t, t as n } from "./react-DB2tPNit.js";
|
|
2
|
+
import { d as r } from "./shim-BCerG8nb.js";
|
|
3
|
+
import { t as i } from "./jsx-runtime-CjozyJt-.js";
|
|
4
|
+
import { D as a, E as o, O as s, a as c, l, n as u, u as d } from "./ui-DRIo9Krs.js";
|
|
5
|
+
import { n as f } from "./sonnerHostBridge-CXuCMM3R.js";
|
|
6
|
+
import { t as p } from "./outline-DwDYhYcF.js";
|
|
7
|
+
//#region ../../../gatewaze-modules/modules/host-media/admin/utils/hostMediaService.ts
|
|
8
|
+
var m = /* @__PURE__ */ e(n()), h = p();
|
|
9
|
+
async function g(e, t) {
|
|
10
|
+
let n = globalThis.__GATEWAZE_CONFIG__.VITE_API_URL ?? "", { data: i } = await r.auth.getSession(), a = i.session?.access_token, o = new Headers(t?.headers);
|
|
11
|
+
return a && o.set("Authorization", `Bearer ${a}`), fetch(`${n}${e}`, {
|
|
12
|
+
...t,
|
|
13
|
+
headers: o
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
async function _(e, t, n = {}) {
|
|
17
|
+
let r = new URLSearchParams();
|
|
18
|
+
n.filter && n.filter !== "all" && r.set("filter", n.filter), n.album_id && r.set("album_id", n.album_id), n.search && r.set("search", n.search), n.limit && r.set("limit", String(n.limit));
|
|
19
|
+
let i = r.toString();
|
|
20
|
+
return g(`/api/admin/${e}/${t}/media${i ? `?${i}` : ""}`);
|
|
21
|
+
}
|
|
22
|
+
async function v(e, t, n, r = {}) {
|
|
23
|
+
let i = new FormData();
|
|
24
|
+
return Array.from(n).forEach((e) => i.append("files", e)), r.album_id && i.append("album_id", r.album_id), r.caption && i.append("caption", r.caption), g(`/api/admin/${e}/${t}/media`, {
|
|
25
|
+
method: "POST",
|
|
26
|
+
body: i
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
async function y(e, t, n) {
|
|
30
|
+
return g(`/api/admin/${e}/${t}/media/${n}`, { method: "DELETE" });
|
|
31
|
+
}
|
|
32
|
+
async function b(e, t, n, r) {
|
|
33
|
+
return g(`/api/admin/${e}/${t}/media/${n}`, {
|
|
34
|
+
method: "PATCH",
|
|
35
|
+
headers: { "Content-Type": "application/json" },
|
|
36
|
+
body: JSON.stringify(r)
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
async function x(e, t) {
|
|
40
|
+
return g(`/api/admin/${e}/${t}/albums`);
|
|
41
|
+
}
|
|
42
|
+
async function S(e, t, n) {
|
|
43
|
+
return g(`/api/admin/${e}/${t}/albums`, {
|
|
44
|
+
method: "POST",
|
|
45
|
+
headers: { "Content-Type": "application/json" },
|
|
46
|
+
body: JSON.stringify(n)
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
async function C(e, t, n) {
|
|
50
|
+
return g(`/api/admin/${e}/${t}/albums/${n}`, { method: "DELETE" });
|
|
51
|
+
}
|
|
52
|
+
async function w(e, t, n, r) {
|
|
53
|
+
return g(`/api/admin/${e}/${t}/albums/${n}/items`, {
|
|
54
|
+
method: "POST",
|
|
55
|
+
headers: { "Content-Type": "application/json" },
|
|
56
|
+
body: JSON.stringify({ media_id: r })
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
async function T(e, t, n, r) {
|
|
60
|
+
return g(`/api/admin/${e}/${t}/albums/${n}/items/${r}`, { method: "DELETE" });
|
|
61
|
+
}
|
|
62
|
+
//#endregion
|
|
63
|
+
//#region ../../../gatewaze-modules/modules/host-media/admin/components/HostMediaTab.tsx
|
|
64
|
+
var E = /* @__PURE__ */ t({
|
|
65
|
+
HostMediaTab: () => O,
|
|
66
|
+
default: () => O
|
|
67
|
+
}), D = i();
|
|
68
|
+
function O({ hostId: e, consumer: t }) {
|
|
69
|
+
let { hostKind: n } = t, [r, i] = (0, m.useState)([]), [p, g] = (0, m.useState)([]), [b, w] = (0, m.useState)(!0), [T, E] = (0, m.useState)(""), [O, A] = (0, m.useState)("all"), [j, M] = (0, m.useState)(null), [N, P] = (0, m.useState)(!1), [F, I] = (0, m.useState)(null), [L, R] = (0, m.useState)(!1), [z, B] = (0, m.useState)(""), V = (0, m.useRef)(null), H = (0, m.useMemo)(() => {
|
|
70
|
+
let e = [
|
|
71
|
+
"image/*",
|
|
72
|
+
"video/*",
|
|
73
|
+
"audio/*"
|
|
74
|
+
];
|
|
75
|
+
return t.enableZipUnpack && e.push("application/zip"), e.join(",");
|
|
76
|
+
}, [t.enableZipUnpack]), U = async () => {
|
|
77
|
+
w(!0);
|
|
78
|
+
try {
|
|
79
|
+
let t = await _(n, e, {
|
|
80
|
+
filter: O,
|
|
81
|
+
album_id: j ?? void 0,
|
|
82
|
+
search: T || void 0
|
|
83
|
+
});
|
|
84
|
+
if (t.ok) {
|
|
85
|
+
let e = await t.json();
|
|
86
|
+
i(e.items ?? []);
|
|
87
|
+
} else i([]);
|
|
88
|
+
} catch {
|
|
89
|
+
i([]);
|
|
90
|
+
}
|
|
91
|
+
w(!1);
|
|
92
|
+
}, W = async () => {
|
|
93
|
+
if (t.enableAlbums) try {
|
|
94
|
+
let t = await x(n, e);
|
|
95
|
+
if (t.ok) {
|
|
96
|
+
let e = await t.json();
|
|
97
|
+
g(e.albums ?? []);
|
|
98
|
+
}
|
|
99
|
+
} catch {
|
|
100
|
+
g([]);
|
|
101
|
+
}
|
|
102
|
+
};
|
|
103
|
+
(0, m.useEffect)(() => {
|
|
104
|
+
U();
|
|
105
|
+
}, [
|
|
106
|
+
n,
|
|
107
|
+
e,
|
|
108
|
+
O,
|
|
109
|
+
j
|
|
110
|
+
]), (0, m.useEffect)(() => {
|
|
111
|
+
W();
|
|
112
|
+
}, [
|
|
113
|
+
n,
|
|
114
|
+
e,
|
|
115
|
+
t.enableAlbums
|
|
116
|
+
]);
|
|
117
|
+
let G = async (t) => {
|
|
118
|
+
if (!(!t || t.length === 0)) {
|
|
119
|
+
P(!0);
|
|
120
|
+
try {
|
|
121
|
+
let r = await v(n, e, t, { album_id: j ?? void 0 }), i = await r.json();
|
|
122
|
+
if (r.status === 207) {
|
|
123
|
+
let e = i.items.filter((e) => e.status === "created").length, t = i.items.length - e;
|
|
124
|
+
f.warning(`Uploaded ${e} file${e === 1 ? "" : "s"}, ${t} failed`);
|
|
125
|
+
} else r.ok ? f.success(`Uploaded ${i.items.length} file${i.items.length === 1 ? "" : "s"}`) : f.error(i.message ?? "Upload failed");
|
|
126
|
+
U();
|
|
127
|
+
} catch (e) {
|
|
128
|
+
f.error(e instanceof Error ? e.message : "Upload failed");
|
|
129
|
+
}
|
|
130
|
+
P(!1);
|
|
131
|
+
}
|
|
132
|
+
}, K = async (t) => {
|
|
133
|
+
if (t.used_in.length > 0) {
|
|
134
|
+
f.error(`Cannot delete: used in ${t.used_in.length} place${t.used_in.length === 1 ? "" : "s"}`);
|
|
135
|
+
return;
|
|
136
|
+
}
|
|
137
|
+
if (window.confirm(`Delete ${t.filename}?`)) try {
|
|
138
|
+
let r = await y(n, e, t.id);
|
|
139
|
+
if (r.status === 204) f.success("Deleted"), I(null), U();
|
|
140
|
+
else {
|
|
141
|
+
let e = await r.json();
|
|
142
|
+
f.error(e.message ?? "Delete failed");
|
|
143
|
+
}
|
|
144
|
+
} catch (e) {
|
|
145
|
+
f.error(e instanceof Error ? e.message : "Delete failed");
|
|
146
|
+
}
|
|
147
|
+
}, q = async () => {
|
|
148
|
+
if (z.trim().length !== 0) try {
|
|
149
|
+
let t = await S(n, e, { name: z.trim() });
|
|
150
|
+
if (t.ok) f.success("Album created"), B(""), R(!1), W();
|
|
151
|
+
else {
|
|
152
|
+
let e = await t.json();
|
|
153
|
+
f.error(e.message ?? "Create failed");
|
|
154
|
+
}
|
|
155
|
+
} catch (e) {
|
|
156
|
+
f.error(e instanceof Error ? e.message : "Create failed");
|
|
157
|
+
}
|
|
158
|
+
}, J = async (t) => {
|
|
159
|
+
if (window.confirm(`Delete album "${t.name}"? Media will be moved to "All".`)) try {
|
|
160
|
+
let r = await C(n, e, t.id);
|
|
161
|
+
if (r.status === 204) f.success("Album deleted"), j === t.id && M(null), W(), U();
|
|
162
|
+
else {
|
|
163
|
+
let e = await r.json();
|
|
164
|
+
f.error(e.message ?? "Delete failed");
|
|
165
|
+
}
|
|
166
|
+
} catch (e) {
|
|
167
|
+
f.error(e instanceof Error ? e.message : "Delete failed");
|
|
168
|
+
}
|
|
169
|
+
}, Y = r.filter((e) => !T || e.filename.toLowerCase().includes(T.toLowerCase()));
|
|
170
|
+
return /* @__PURE__ */ (0, D.jsxs)("div", {
|
|
171
|
+
className: "space-y-4",
|
|
172
|
+
children: [
|
|
173
|
+
t.enableAlbums && p.length > 0 && /* @__PURE__ */ (0, D.jsx)(o, { children: /* @__PURE__ */ (0, D.jsxs)("div", {
|
|
174
|
+
className: "p-3 flex flex-wrap gap-2 items-center",
|
|
175
|
+
children: [
|
|
176
|
+
/* @__PURE__ */ (0, D.jsx)("span", {
|
|
177
|
+
className: "text-sm text-[var(--gray-a8)] mr-2",
|
|
178
|
+
children: "Albums:"
|
|
179
|
+
}),
|
|
180
|
+
/* @__PURE__ */ (0, D.jsx)("button", {
|
|
181
|
+
type: "button",
|
|
182
|
+
onClick: () => M(null),
|
|
183
|
+
className: `text-xs px-2 py-1 rounded ${j === null ? "bg-[var(--accent-9)] text-white" : "bg-[var(--gray-a3)]"}`,
|
|
184
|
+
children: "All"
|
|
185
|
+
}),
|
|
186
|
+
p.map((e) => /* @__PURE__ */ (0, D.jsx)("button", {
|
|
187
|
+
type: "button",
|
|
188
|
+
onClick: () => M(e.id),
|
|
189
|
+
onDoubleClick: () => J(e),
|
|
190
|
+
title: "Double-click to delete",
|
|
191
|
+
className: `text-xs px-2 py-1 rounded ${j === e.id ? "bg-[var(--accent-9)] text-white" : "bg-[var(--gray-a3)]"}`,
|
|
192
|
+
children: e.name
|
|
193
|
+
}, e.id)),
|
|
194
|
+
/* @__PURE__ */ (0, D.jsxs)(a, {
|
|
195
|
+
size: "1",
|
|
196
|
+
variant: "outlined",
|
|
197
|
+
onClick: () => R(!0),
|
|
198
|
+
children: [/* @__PURE__ */ (0, D.jsx)(h.FolderIcon, { className: "size-4" }), " + Album"]
|
|
199
|
+
})
|
|
200
|
+
]
|
|
201
|
+
}) }),
|
|
202
|
+
/* @__PURE__ */ (0, D.jsx)(o, { children: /* @__PURE__ */ (0, D.jsxs)("div", {
|
|
203
|
+
className: "p-4 flex items-center gap-3 flex-wrap",
|
|
204
|
+
children: [
|
|
205
|
+
/* @__PURE__ */ (0, D.jsxs)("div", {
|
|
206
|
+
className: "relative flex-1 min-w-[200px] max-w-sm",
|
|
207
|
+
children: [/* @__PURE__ */ (0, D.jsx)(h.MagnifyingGlassIcon, { className: "absolute left-3 top-1/2 -translate-y-1/2 size-4 text-[var(--gray-a8)] pointer-events-none" }), /* @__PURE__ */ (0, D.jsx)(d, {
|
|
208
|
+
placeholder: "Search media…",
|
|
209
|
+
value: T,
|
|
210
|
+
onChange: (e) => E(e.target.value),
|
|
211
|
+
className: "pl-9"
|
|
212
|
+
})]
|
|
213
|
+
}),
|
|
214
|
+
/* @__PURE__ */ (0, D.jsx)(l, {
|
|
215
|
+
value: O,
|
|
216
|
+
onChange: (e) => A(e.target.value),
|
|
217
|
+
data: [
|
|
218
|
+
{
|
|
219
|
+
value: "all",
|
|
220
|
+
label: "All"
|
|
221
|
+
},
|
|
222
|
+
{
|
|
223
|
+
value: "photo",
|
|
224
|
+
label: "Photos"
|
|
225
|
+
},
|
|
226
|
+
{
|
|
227
|
+
value: "video",
|
|
228
|
+
label: "Videos"
|
|
229
|
+
},
|
|
230
|
+
{
|
|
231
|
+
value: "audio",
|
|
232
|
+
label: "Audio"
|
|
233
|
+
}
|
|
234
|
+
]
|
|
235
|
+
}),
|
|
236
|
+
/* @__PURE__ */ (0, D.jsx)("input", {
|
|
237
|
+
ref: V,
|
|
238
|
+
type: "file",
|
|
239
|
+
multiple: !0,
|
|
240
|
+
accept: H,
|
|
241
|
+
className: "hidden",
|
|
242
|
+
onChange: (e) => G(e.target.files)
|
|
243
|
+
}),
|
|
244
|
+
/* @__PURE__ */ (0, D.jsxs)(a, {
|
|
245
|
+
onClick: () => V.current?.click(),
|
|
246
|
+
disabled: N,
|
|
247
|
+
children: [/* @__PURE__ */ (0, D.jsx)(h.ArrowUpTrayIcon, { className: "size-4" }), N ? "Uploading…" : "+ Upload"]
|
|
248
|
+
})
|
|
249
|
+
]
|
|
250
|
+
}) }),
|
|
251
|
+
b ? /* @__PURE__ */ (0, D.jsx)(o, { children: /* @__PURE__ */ (0, D.jsx)("div", {
|
|
252
|
+
className: "p-8 flex justify-center",
|
|
253
|
+
children: /* @__PURE__ */ (0, D.jsx)(u, {})
|
|
254
|
+
}) }) : Y.length === 0 ? /* @__PURE__ */ (0, D.jsx)(o, { children: /* @__PURE__ */ (0, D.jsxs)("div", {
|
|
255
|
+
className: "p-8 text-center",
|
|
256
|
+
children: [
|
|
257
|
+
/* @__PURE__ */ (0, D.jsx)(h.PhotoIcon, { className: "mx-auto size-12 text-[var(--gray-a6)]" }),
|
|
258
|
+
/* @__PURE__ */ (0, D.jsx)("h3", {
|
|
259
|
+
className: "mt-2 text-sm font-medium",
|
|
260
|
+
children: "No media yet"
|
|
261
|
+
}),
|
|
262
|
+
/* @__PURE__ */ (0, D.jsxs)("p", {
|
|
263
|
+
className: "mt-1 text-sm text-[var(--gray-a8)]",
|
|
264
|
+
children: [
|
|
265
|
+
"Upload images",
|
|
266
|
+
t.enableYouTube ? ", videos (uploaded to YouTube)" : " and videos",
|
|
267
|
+
t.enableZipUnpack ? ", or a zip of media" : "",
|
|
268
|
+
" for this ",
|
|
269
|
+
n,
|
|
270
|
+
"."
|
|
271
|
+
]
|
|
272
|
+
})
|
|
273
|
+
]
|
|
274
|
+
}) }) : /* @__PURE__ */ (0, D.jsx)("div", {
|
|
275
|
+
className: "grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-5 gap-3",
|
|
276
|
+
children: Y.map((e) => /* @__PURE__ */ (0, D.jsxs)("button", {
|
|
277
|
+
type: "button",
|
|
278
|
+
onClick: () => I(e),
|
|
279
|
+
className: "group relative aspect-square rounded-md overflow-hidden border border-[var(--gray-a4)] hover:border-[var(--accent-9)] transition-colors text-left bg-[var(--gray-a2)]",
|
|
280
|
+
children: [e.mime_type.startsWith("image/") ? /* @__PURE__ */ (0, D.jsx)("img", {
|
|
281
|
+
src: e.cdn_url,
|
|
282
|
+
alt: e.filename,
|
|
283
|
+
className: "w-full h-full object-cover",
|
|
284
|
+
loading: "lazy"
|
|
285
|
+
}) : e.mime_type.startsWith("video/") ? e.youtube_thumbnail_url ? /* @__PURE__ */ (0, D.jsx)("img", {
|
|
286
|
+
src: e.youtube_thumbnail_url,
|
|
287
|
+
alt: e.filename,
|
|
288
|
+
className: "w-full h-full object-cover",
|
|
289
|
+
loading: "lazy"
|
|
290
|
+
}) : /* @__PURE__ */ (0, D.jsx)("div", {
|
|
291
|
+
className: "w-full h-full flex items-center justify-center",
|
|
292
|
+
children: /* @__PURE__ */ (0, D.jsx)(h.VideoCameraIcon, { className: "size-12 text-[var(--gray-a6)]" })
|
|
293
|
+
}) : /* @__PURE__ */ (0, D.jsx)("div", {
|
|
294
|
+
className: "w-full h-full flex items-center justify-center",
|
|
295
|
+
children: /* @__PURE__ */ (0, D.jsx)(h.PhotoIcon, { className: "size-12 text-[var(--gray-a6)]" })
|
|
296
|
+
}), /* @__PURE__ */ (0, D.jsxs)("div", {
|
|
297
|
+
className: "absolute inset-x-0 bottom-0 p-2 bg-gradient-to-t from-black/70 to-transparent",
|
|
298
|
+
children: [/* @__PURE__ */ (0, D.jsx)("p", {
|
|
299
|
+
className: "text-xs text-white font-medium truncate",
|
|
300
|
+
children: e.filename
|
|
301
|
+
}), /* @__PURE__ */ (0, D.jsxs)("div", {
|
|
302
|
+
className: "flex items-center gap-1 text-[10px] text-white/80",
|
|
303
|
+
children: [
|
|
304
|
+
/* @__PURE__ */ (0, D.jsx)("span", { children: k(e.bytes) }),
|
|
305
|
+
e.used_in.length > 0 && /* @__PURE__ */ (0, D.jsxs)("span", { children: ["• used in ", e.used_in.length] }),
|
|
306
|
+
e.in_repo && /* @__PURE__ */ (0, D.jsx)(s, {
|
|
307
|
+
variant: "soft",
|
|
308
|
+
color: "blue",
|
|
309
|
+
size: "1",
|
|
310
|
+
children: "repo"
|
|
311
|
+
}),
|
|
312
|
+
e.youtube_upload_status && e.youtube_upload_status !== "completed" && /* @__PURE__ */ (0, D.jsxs)(s, {
|
|
313
|
+
variant: "soft",
|
|
314
|
+
color: "orange",
|
|
315
|
+
size: "1",
|
|
316
|
+
children: ["YT: ", e.youtube_upload_status]
|
|
317
|
+
})
|
|
318
|
+
]
|
|
319
|
+
})]
|
|
320
|
+
})]
|
|
321
|
+
}, e.id))
|
|
322
|
+
}),
|
|
323
|
+
/* @__PURE__ */ (0, D.jsx)(c, {
|
|
324
|
+
isOpen: !!F,
|
|
325
|
+
onClose: () => I(null),
|
|
326
|
+
title: F?.filename ?? "",
|
|
327
|
+
footer: /* @__PURE__ */ (0, D.jsxs)("div", {
|
|
328
|
+
className: "flex justify-end gap-2",
|
|
329
|
+
children: [/* @__PURE__ */ (0, D.jsxs)(a, {
|
|
330
|
+
variant: "outlined",
|
|
331
|
+
onClick: () => {
|
|
332
|
+
F && (navigator.clipboard.writeText(F.cdn_url), f.success("CDN URL copied"));
|
|
333
|
+
},
|
|
334
|
+
children: [/* @__PURE__ */ (0, D.jsx)(h.ClipboardIcon, { className: "size-4" }), " Copy CDN URL"]
|
|
335
|
+
}), /* @__PURE__ */ (0, D.jsxs)(a, {
|
|
336
|
+
color: "error",
|
|
337
|
+
variant: "outlined",
|
|
338
|
+
onClick: () => F && K(F),
|
|
339
|
+
disabled: !F || F.used_in.length > 0,
|
|
340
|
+
children: [/* @__PURE__ */ (0, D.jsx)(h.TrashIcon, { className: "size-4" }), " Delete"]
|
|
341
|
+
})]
|
|
342
|
+
}),
|
|
343
|
+
children: F && /* @__PURE__ */ (0, D.jsxs)("div", {
|
|
344
|
+
className: "space-y-4",
|
|
345
|
+
children: [
|
|
346
|
+
F.mime_type.startsWith("image/") && /* @__PURE__ */ (0, D.jsx)("img", {
|
|
347
|
+
src: F.cdn_url,
|
|
348
|
+
alt: F.filename,
|
|
349
|
+
className: "max-w-full rounded-md"
|
|
350
|
+
}),
|
|
351
|
+
F.youtube_embed_url && /* @__PURE__ */ (0, D.jsx)("iframe", {
|
|
352
|
+
title: F.filename,
|
|
353
|
+
className: "w-full aspect-video rounded-md",
|
|
354
|
+
src: F.youtube_embed_url,
|
|
355
|
+
allow: "autoplay; encrypted-media; picture-in-picture",
|
|
356
|
+
allowFullScreen: !0
|
|
357
|
+
}),
|
|
358
|
+
/* @__PURE__ */ (0, D.jsxs)("dl", {
|
|
359
|
+
className: "grid grid-cols-2 gap-x-4 gap-y-2 text-sm",
|
|
360
|
+
children: [
|
|
361
|
+
/* @__PURE__ */ (0, D.jsx)("dt", {
|
|
362
|
+
className: "text-[var(--gray-a8)]",
|
|
363
|
+
children: "Type"
|
|
364
|
+
}),
|
|
365
|
+
/* @__PURE__ */ (0, D.jsx)("dd", { children: F.mime_type }),
|
|
366
|
+
/* @__PURE__ */ (0, D.jsx)("dt", {
|
|
367
|
+
className: "text-[var(--gray-a8)]",
|
|
368
|
+
children: "Size"
|
|
369
|
+
}),
|
|
370
|
+
/* @__PURE__ */ (0, D.jsx)("dd", { children: k(F.bytes) }),
|
|
371
|
+
F.width !== null && F.height !== null && /* @__PURE__ */ (0, D.jsxs)(D.Fragment, { children: [/* @__PURE__ */ (0, D.jsx)("dt", {
|
|
372
|
+
className: "text-[var(--gray-a8)]",
|
|
373
|
+
children: "Dimensions"
|
|
374
|
+
}), /* @__PURE__ */ (0, D.jsxs)("dd", { children: [
|
|
375
|
+
F.width,
|
|
376
|
+
" × ",
|
|
377
|
+
F.height
|
|
378
|
+
] })] }),
|
|
379
|
+
F.duration !== null && /* @__PURE__ */ (0, D.jsxs)(D.Fragment, { children: [/* @__PURE__ */ (0, D.jsx)("dt", {
|
|
380
|
+
className: "text-[var(--gray-a8)]",
|
|
381
|
+
children: "Duration"
|
|
382
|
+
}), /* @__PURE__ */ (0, D.jsxs)("dd", { children: [Math.round(F.duration), " s"] })] }),
|
|
383
|
+
/* @__PURE__ */ (0, D.jsx)("dt", {
|
|
384
|
+
className: "text-[var(--gray-a8)]",
|
|
385
|
+
children: "Storage"
|
|
386
|
+
}),
|
|
387
|
+
/* @__PURE__ */ (0, D.jsx)("dd", { children: F.in_repo ? "In repo" : "CDN only" }),
|
|
388
|
+
F.youtube_upload_status && /* @__PURE__ */ (0, D.jsxs)(D.Fragment, { children: [/* @__PURE__ */ (0, D.jsx)("dt", {
|
|
389
|
+
className: "text-[var(--gray-a8)]",
|
|
390
|
+
children: "YouTube"
|
|
391
|
+
}), /* @__PURE__ */ (0, D.jsxs)("dd", { children: [F.youtube_upload_status, F.youtube_url ? ` — ${F.youtube_url}` : ""] })] })
|
|
392
|
+
]
|
|
393
|
+
}),
|
|
394
|
+
F.used_in.length > 0 && /* @__PURE__ */ (0, D.jsxs)("div", { children: [/* @__PURE__ */ (0, D.jsx)("p", {
|
|
395
|
+
className: "text-sm font-medium mb-2",
|
|
396
|
+
children: "Used in:"
|
|
397
|
+
}), /* @__PURE__ */ (0, D.jsx)("ul", {
|
|
398
|
+
className: "text-sm space-y-1",
|
|
399
|
+
children: F.used_in.map((e) => /* @__PURE__ */ (0, D.jsxs)("li", {
|
|
400
|
+
className: "text-[var(--gray-a8)]",
|
|
401
|
+
children: [
|
|
402
|
+
e.type,
|
|
403
|
+
": ",
|
|
404
|
+
e.name
|
|
405
|
+
]
|
|
406
|
+
}, `${e.type}:${e.id}`))
|
|
407
|
+
})] })
|
|
408
|
+
]
|
|
409
|
+
})
|
|
410
|
+
}),
|
|
411
|
+
t.enableAlbums && /* @__PURE__ */ (0, D.jsx)(c, {
|
|
412
|
+
isOpen: L,
|
|
413
|
+
onClose: () => R(!1),
|
|
414
|
+
title: "New album",
|
|
415
|
+
footer: /* @__PURE__ */ (0, D.jsxs)("div", {
|
|
416
|
+
className: "flex justify-end gap-2",
|
|
417
|
+
children: [/* @__PURE__ */ (0, D.jsx)(a, {
|
|
418
|
+
variant: "outlined",
|
|
419
|
+
onClick: () => R(!1),
|
|
420
|
+
children: "Cancel"
|
|
421
|
+
}), /* @__PURE__ */ (0, D.jsx)(a, {
|
|
422
|
+
onClick: q,
|
|
423
|
+
children: "Create"
|
|
424
|
+
})]
|
|
425
|
+
}),
|
|
426
|
+
children: /* @__PURE__ */ (0, D.jsx)(d, {
|
|
427
|
+
placeholder: "Album name",
|
|
428
|
+
value: z,
|
|
429
|
+
onChange: (e) => B(e.target.value),
|
|
430
|
+
autoFocus: !0
|
|
431
|
+
})
|
|
432
|
+
})
|
|
433
|
+
]
|
|
434
|
+
});
|
|
435
|
+
}
|
|
436
|
+
function k(e) {
|
|
437
|
+
return e < 1024 ? `${e} B` : e < 1048576 ? `${(e / 1024).toFixed(1)} KB` : e < 1073741824 ? `${(e / 1024 / 1024).toFixed(1)} MB` : `${(e / 1024 / 1024 / 1024).toFixed(1)} GB`;
|
|
438
|
+
}
|
|
439
|
+
//#endregion
|
|
440
|
+
export { C as a, _ as c, v as d, S as i, b as l, E as n, y as o, w as r, x as s, O as t, T as u };
|