@lunora/studio 0.0.0 → 1.0.0-alpha.2
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/LICENSE.md +105 -0
- package/README.md +123 -9
- package/__assets__/package-og.svg +14 -0
- package/dist/index.d.ts +1402 -0
- package/dist/index.js +41 -0
- package/dist/mount.d.ts +21 -0
- package/dist/mount.js +26 -0
- package/dist/packem_shared/ADMIN_FUNCTION_PREFIX-DmBqMZ-z.js +45 -0
- package/dist/packem_shared/ApiDocsPanel-DpRjJhG5.js +842 -0
- package/dist/packem_shared/ApiReferencePanel-DMIUp-kK.js +229 -0
- package/dist/packem_shared/ApiTab-DURGU15e.js +251 -0
- package/dist/packem_shared/AuditPanel-BC59Nhst.js +212 -0
- package/dist/packem_shared/CommandPalette-Dx_CoB9i.js +373 -0
- package/dist/packem_shared/ConfirmButton-WQVUoGFb.js +59 -0
- package/dist/packem_shared/ConnectionBadge-Bxagrip8.js +111 -0
- package/dist/packem_shared/DEFAULT_AUTO_REFRESH_MS-Vxwaxx51.js +50 -0
- package/dist/packem_shared/DEFAULT_INSIGHT_THRESHOLDS-DjF0h-gA.js +89 -0
- package/dist/packem_shared/DataBrowser-Coz6jJE6.js +4542 -0
- package/dist/packem_shared/DataFilters-FNquMaiu.js +249 -0
- package/dist/packem_shared/ErrorBoundary-BzAApI7J.js +66 -0
- package/dist/packem_shared/ExportImportPanel-WO34fJxy.js +193 -0
- package/dist/packem_shared/FileBrowser-Zcr-Qgxo.js +2932 -0
- package/dist/packem_shared/FunctionRunner-j0Rd5m9t.js +343 -0
- package/dist/packem_shared/FunctionStatsPanel-DboBl-XL.js +432 -0
- package/dist/packem_shared/GlobalDataBrowser-9MhPEfgN.js +318 -0
- package/dist/packem_shared/HealthPanel-DOIgbUtx.js +640 -0
- package/dist/packem_shared/HomePanel-bdOCNA-p.js +1273 -0
- package/dist/packem_shared/InsightsPanel-DaZPnSgt.js +423 -0
- package/dist/packem_shared/LogsPanel-CWdqAGpQ.js +839 -0
- package/dist/packem_shared/MailPanel-D_EGtDnS.js +447 -0
- package/dist/packem_shared/MetricsPanel-E4Gv6wTO.js +1625 -0
- package/dist/packem_shared/MigrationsPanel-DQdPY9io.js +246 -0
- package/dist/packem_shared/OpenRpcReferencePanel-j2p3HB0s.js +191 -0
- package/dist/packem_shared/PitrPanel-BbBkQR6t.js +252 -0
- package/dist/packem_shared/STUDIO_ROOT_CLASS-D12gX2dV.js +3 -0
- package/dist/packem_shared/ScheduledJobs-Ok1CYYwI.js +159 -0
- package/dist/packem_shared/SchemaViewer-D8XGnp-X.js +2512 -0
- package/dist/packem_shared/SecurityAdvisorPanel-Cdm2IxLW.js +79 -0
- package/dist/packem_shared/SettingsPanel-D3WF2mBU.js +176 -0
- package/dist/packem_shared/ShardInput-DNCsT1KW.js +107 -0
- package/dist/packem_shared/SqlEditorPanel-BuQ7f2Hs.js +13 -0
- package/dist/packem_shared/Studio-D36od9Oz.js +33 -0
- package/dist/packem_shared/StudioApp-dvywkJ8I.js +383 -0
- package/dist/packem_shared/StudioI18nProvider-Dcajsznk.js +48 -0
- package/dist/packem_shared/TableEditor-DIVDk3vT.js +371 -0
- package/dist/packem_shared/advisor-view-DBlzJi6C.js +159 -0
- package/dist/packem_shared/aggregateMetrics-D4nUHEKU.js +108 -0
- package/dist/packem_shared/app.d-CCmwDEVs.d.ts +300 -0
- package/dist/packem_shared/badge-B2PKA1-5.js +49 -0
- package/dist/packem_shared/bar-chart-CzJAgqkp.js +3245 -0
- package/dist/packem_shared/button-BhsN2uZH.js +49 -0
- package/dist/packem_shared/card-DURq3ElK.js +175 -0
- package/dist/packem_shared/cf-links-BZfRdxSE.js +8 -0
- package/dist/packem_shared/checkbox-UNkzAxl-.js +63 -0
- package/dist/packem_shared/createStudioI18n-CgvlmDkN.js +27 -0
- package/dist/packem_shared/data-grid-CCh2Couo.js +183 -0
- package/dist/packem_shared/dropdown-menu-WY4B_eJO.js +280 -0
- package/dist/packem_shared/empty-state-DY_oe0k6.js +98 -0
- package/dist/packem_shared/grid-features-DTjG6Sex.js +840 -0
- package/dist/packem_shared/input-XH4r1Pt1.js +53 -0
- package/dist/packem_shared/internal-BBZYexre.js +68 -0
- package/dist/packem_shared/label-D8ykjn5J.js +46 -0
- package/dist/packem_shared/live-status-bPff1O7Y.js +44 -0
- package/dist/packem_shared/reference-view-BCKIoai7.js +2180 -0
- package/dist/packem_shared/shard-history-DyebH1R5.js +38 -0
- package/dist/packem_shared/sparkline-10dG-_f0.js +93 -0
- package/dist/packem_shared/sql-editor-panel-CW2y2x9h.js +2562 -0
- package/dist/packem_shared/storage-tier-CL98eOvn.js +85 -0
- package/dist/packem_shared/studio-BDVd7rIV.js +10303 -0
- package/dist/packem_shared/table-_RzNvy3R.js +246 -0
- package/dist/packem_shared/table-list-sidebar-aZHLq70w.js +832 -0
- package/dist/packem_shared/textarea-D3gaCU_-.js +46 -0
- package/dist/packem_shared/use-live-admin-D1h1Fzsd.js +73 -0
- package/dist/packem_shared/use-live-shard-seed-B74RYcOy.js +76 -0
- package/dist/packem_shared/useDebounced-Dxncpg6z.js +32 -0
- package/dist/packem_shared/utils-B05Dmz_H.js +8 -0
- package/dist/packem_shared/virtual-rect-CVMUskSm.js +10 -0
- package/dist/standalone/studio.js +356 -0
- package/dist/styles.css +2 -0
- package/package.json +77 -17
- package/src/theme.css +59 -0
|
@@ -0,0 +1,2932 @@
|
|
|
1
|
+
import { c } from 'react/compiler-runtime';
|
|
2
|
+
import { useState, useEffect, useMemo, useCallback, useRef } from 'react';
|
|
3
|
+
import { ShardInput } from './ShardInput-DNCsT1KW.js';
|
|
4
|
+
import { B as Button } from './button-BhsN2uZH.js';
|
|
5
|
+
import { E as EmptyState } from './empty-state-DY_oe0k6.js';
|
|
6
|
+
import { useT } from './createStudioI18n-CgvlmDkN.js';
|
|
7
|
+
import { S as SelectionBar } from './grid-features-DTjG6Sex.js';
|
|
8
|
+
import { C as Card, a as CardContent } from './card-DURq3ElK.js';
|
|
9
|
+
import { C as Checkbox } from './checkbox-UNkzAxl-.js';
|
|
10
|
+
import { c as TableHead, a as TableHeader, b as TableRow, d as TableBody, T as Table, e as TableCell } from './table-_RzNvy3R.js';
|
|
11
|
+
import { g as formatBytes, f as fireAndForget, e as errorMessage, c as callOptions, a as adminRef } from './internal-BBZYexre.js';
|
|
12
|
+
import { ConfirmButton } from './ConfirmButton-WQVUoGFb.js';
|
|
13
|
+
import { B as Badge } from './badge-B2PKA1-5.js';
|
|
14
|
+
import { jsxDEV, Fragment } from 'react/jsx-dev-runtime';
|
|
15
|
+
import { I as Input } from './input-XH4r1Pt1.js';
|
|
16
|
+
import { d as CLOUDFLARE_R2_URL } from './cf-links-BZfRdxSE.js';
|
|
17
|
+
import { useLunora } from '@lunora/react';
|
|
18
|
+
import { useAutoRefresh } from './DEFAULT_AUTO_REFRESH_MS-Vxwaxx51.js';
|
|
19
|
+
import { ADMIN_FUNCTIONS } from './ADMIN_FUNCTION_PREFIX-DmBqMZ-z.js';
|
|
20
|
+
|
|
21
|
+
const useFileItem = (object, prefix, handlers) => {
|
|
22
|
+
const $ = c(21);
|
|
23
|
+
const {
|
|
24
|
+
onCopy,
|
|
25
|
+
onDelete,
|
|
26
|
+
onDownload,
|
|
27
|
+
onToggleSelect
|
|
28
|
+
} = handlers;
|
|
29
|
+
let t0;
|
|
30
|
+
if ($[0] !== object.key || $[1] !== onCopy) {
|
|
31
|
+
t0 = () => {
|
|
32
|
+
onCopy(object.key);
|
|
33
|
+
};
|
|
34
|
+
$[0] = object.key;
|
|
35
|
+
$[1] = onCopy;
|
|
36
|
+
$[2] = t0;
|
|
37
|
+
} else {
|
|
38
|
+
t0 = $[2];
|
|
39
|
+
}
|
|
40
|
+
const copy = t0;
|
|
41
|
+
let t1;
|
|
42
|
+
if ($[3] !== object.key || $[4] !== onDownload) {
|
|
43
|
+
t1 = () => {
|
|
44
|
+
onDownload(object.key);
|
|
45
|
+
};
|
|
46
|
+
$[3] = object.key;
|
|
47
|
+
$[4] = onDownload;
|
|
48
|
+
$[5] = t1;
|
|
49
|
+
} else {
|
|
50
|
+
t1 = $[5];
|
|
51
|
+
}
|
|
52
|
+
const download = t1;
|
|
53
|
+
let t2;
|
|
54
|
+
if ($[6] !== object.key || $[7] !== onDelete) {
|
|
55
|
+
t2 = () => {
|
|
56
|
+
onDelete(object.key);
|
|
57
|
+
};
|
|
58
|
+
$[6] = object.key;
|
|
59
|
+
$[7] = onDelete;
|
|
60
|
+
$[8] = t2;
|
|
61
|
+
} else {
|
|
62
|
+
t2 = $[8];
|
|
63
|
+
}
|
|
64
|
+
const remove = t2;
|
|
65
|
+
let t3;
|
|
66
|
+
if ($[9] !== object.key || $[10] !== onToggleSelect) {
|
|
67
|
+
t3 = () => {
|
|
68
|
+
onToggleSelect(object.key);
|
|
69
|
+
};
|
|
70
|
+
$[9] = object.key;
|
|
71
|
+
$[10] = onToggleSelect;
|
|
72
|
+
$[11] = t3;
|
|
73
|
+
} else {
|
|
74
|
+
t3 = $[11];
|
|
75
|
+
}
|
|
76
|
+
const toggle = t3;
|
|
77
|
+
let t4;
|
|
78
|
+
if ($[12] !== object.key || $[13] !== prefix.length) {
|
|
79
|
+
t4 = object.key.slice(prefix.length);
|
|
80
|
+
$[12] = object.key;
|
|
81
|
+
$[13] = prefix.length;
|
|
82
|
+
$[14] = t4;
|
|
83
|
+
} else {
|
|
84
|
+
t4 = $[14];
|
|
85
|
+
}
|
|
86
|
+
let t5;
|
|
87
|
+
if ($[15] !== copy || $[16] !== download || $[17] !== remove || $[18] !== t4 || $[19] !== toggle) {
|
|
88
|
+
t5 = {
|
|
89
|
+
copy,
|
|
90
|
+
download,
|
|
91
|
+
name: t4,
|
|
92
|
+
remove,
|
|
93
|
+
toggle
|
|
94
|
+
};
|
|
95
|
+
$[15] = copy;
|
|
96
|
+
$[16] = download;
|
|
97
|
+
$[17] = remove;
|
|
98
|
+
$[18] = t4;
|
|
99
|
+
$[19] = toggle;
|
|
100
|
+
$[20] = t5;
|
|
101
|
+
} else {
|
|
102
|
+
t5 = $[20];
|
|
103
|
+
}
|
|
104
|
+
return t5;
|
|
105
|
+
};
|
|
106
|
+
const FileActions = (t0) => {
|
|
107
|
+
const $ = c(31);
|
|
108
|
+
const {
|
|
109
|
+
busy,
|
|
110
|
+
buttonClassName,
|
|
111
|
+
copied,
|
|
112
|
+
objectKey,
|
|
113
|
+
onCopy,
|
|
114
|
+
onDelete,
|
|
115
|
+
onDownload,
|
|
116
|
+
t
|
|
117
|
+
} = t0;
|
|
118
|
+
const t1 = `storage-copy-${objectKey}`;
|
|
119
|
+
let t2;
|
|
120
|
+
if ($[0] !== copied || $[1] !== t) {
|
|
121
|
+
t2 = copied ? t("Copied") : t("Copy URL");
|
|
122
|
+
$[0] = copied;
|
|
123
|
+
$[1] = t;
|
|
124
|
+
$[2] = t2;
|
|
125
|
+
} else {
|
|
126
|
+
t2 = $[2];
|
|
127
|
+
}
|
|
128
|
+
let t3;
|
|
129
|
+
if ($[3] !== busy || $[4] !== buttonClassName || $[5] !== onCopy || $[6] !== t1 || $[7] !== t2) {
|
|
130
|
+
t3 = /* @__PURE__ */ jsxDEV(Button, {
|
|
131
|
+
className: buttonClassName,
|
|
132
|
+
"data-testid": t1,
|
|
133
|
+
disabled: busy,
|
|
134
|
+
onClick: onCopy,
|
|
135
|
+
size: "sm",
|
|
136
|
+
type: "button",
|
|
137
|
+
variant: "ghost",
|
|
138
|
+
children: t2
|
|
139
|
+
}, void 0, false);
|
|
140
|
+
$[3] = busy;
|
|
141
|
+
$[4] = buttonClassName;
|
|
142
|
+
$[5] = onCopy;
|
|
143
|
+
$[6] = t1;
|
|
144
|
+
$[7] = t2;
|
|
145
|
+
$[8] = t3;
|
|
146
|
+
} else {
|
|
147
|
+
t3 = $[8];
|
|
148
|
+
}
|
|
149
|
+
const t4 = `storage-download-${objectKey}`;
|
|
150
|
+
let t5;
|
|
151
|
+
if ($[9] !== t) {
|
|
152
|
+
t5 = t("Download");
|
|
153
|
+
$[9] = t;
|
|
154
|
+
$[10] = t5;
|
|
155
|
+
} else {
|
|
156
|
+
t5 = $[10];
|
|
157
|
+
}
|
|
158
|
+
let t6;
|
|
159
|
+
if ($[11] !== busy || $[12] !== buttonClassName || $[13] !== onDownload || $[14] !== t4 || $[15] !== t5) {
|
|
160
|
+
t6 = /* @__PURE__ */ jsxDEV(Button, {
|
|
161
|
+
className: buttonClassName,
|
|
162
|
+
"data-testid": t4,
|
|
163
|
+
disabled: busy,
|
|
164
|
+
onClick: onDownload,
|
|
165
|
+
size: "sm",
|
|
166
|
+
type: "button",
|
|
167
|
+
variant: "ghost",
|
|
168
|
+
children: t5
|
|
169
|
+
}, void 0, false);
|
|
170
|
+
$[11] = busy;
|
|
171
|
+
$[12] = buttonClassName;
|
|
172
|
+
$[13] = onDownload;
|
|
173
|
+
$[14] = t4;
|
|
174
|
+
$[15] = t5;
|
|
175
|
+
$[16] = t6;
|
|
176
|
+
} else {
|
|
177
|
+
t6 = $[16];
|
|
178
|
+
}
|
|
179
|
+
let t7;
|
|
180
|
+
if ($[17] !== t) {
|
|
181
|
+
t7 = t("Delete object?");
|
|
182
|
+
$[17] = t;
|
|
183
|
+
$[18] = t7;
|
|
184
|
+
} else {
|
|
185
|
+
t7 = $[18];
|
|
186
|
+
}
|
|
187
|
+
const t8 = `storage-delete-${objectKey}`;
|
|
188
|
+
let t9;
|
|
189
|
+
if ($[19] !== t) {
|
|
190
|
+
t9 = t("Delete");
|
|
191
|
+
$[19] = t;
|
|
192
|
+
$[20] = t9;
|
|
193
|
+
} else {
|
|
194
|
+
t9 = $[20];
|
|
195
|
+
}
|
|
196
|
+
let t10;
|
|
197
|
+
if ($[21] !== busy || $[22] !== onDelete || $[23] !== t7 || $[24] !== t8 || $[25] !== t9) {
|
|
198
|
+
t10 = /* @__PURE__ */ jsxDEV(ConfirmButton, {
|
|
199
|
+
confirmLabel: t7,
|
|
200
|
+
disabled: busy,
|
|
201
|
+
onConfirm: onDelete,
|
|
202
|
+
testId: t8,
|
|
203
|
+
children: t9
|
|
204
|
+
}, void 0, false);
|
|
205
|
+
$[21] = busy;
|
|
206
|
+
$[22] = onDelete;
|
|
207
|
+
$[23] = t7;
|
|
208
|
+
$[24] = t8;
|
|
209
|
+
$[25] = t9;
|
|
210
|
+
$[26] = t10;
|
|
211
|
+
} else {
|
|
212
|
+
t10 = $[26];
|
|
213
|
+
}
|
|
214
|
+
let t11;
|
|
215
|
+
if ($[27] !== t10 || $[28] !== t3 || $[29] !== t6) {
|
|
216
|
+
t11 = /* @__PURE__ */ jsxDEV(Fragment, {
|
|
217
|
+
children: [t3, t6, t10]
|
|
218
|
+
}, void 0, true);
|
|
219
|
+
$[27] = t10;
|
|
220
|
+
$[28] = t3;
|
|
221
|
+
$[29] = t6;
|
|
222
|
+
$[30] = t11;
|
|
223
|
+
} else {
|
|
224
|
+
t11 = $[30];
|
|
225
|
+
}
|
|
226
|
+
return t11;
|
|
227
|
+
};
|
|
228
|
+
const FileReferences = (t0) => {
|
|
229
|
+
const $ = c(14);
|
|
230
|
+
const {
|
|
231
|
+
objectKey,
|
|
232
|
+
references,
|
|
233
|
+
t
|
|
234
|
+
} = t0;
|
|
235
|
+
if (references === void 0) {
|
|
236
|
+
return null;
|
|
237
|
+
}
|
|
238
|
+
if (references.length === 0) {
|
|
239
|
+
const t12 = `storage-orphan-${objectKey}`;
|
|
240
|
+
let t22;
|
|
241
|
+
if ($[0] !== t) {
|
|
242
|
+
t22 = t("Orphan");
|
|
243
|
+
$[0] = t;
|
|
244
|
+
$[1] = t22;
|
|
245
|
+
} else {
|
|
246
|
+
t22 = $[1];
|
|
247
|
+
}
|
|
248
|
+
let t32;
|
|
249
|
+
if ($[2] !== t12 || $[3] !== t22) {
|
|
250
|
+
t32 = /* @__PURE__ */ jsxDEV(Badge, {
|
|
251
|
+
"data-testid": t12,
|
|
252
|
+
variant: "warning",
|
|
253
|
+
children: t22
|
|
254
|
+
}, void 0, false);
|
|
255
|
+
$[2] = t12;
|
|
256
|
+
$[3] = t22;
|
|
257
|
+
$[4] = t32;
|
|
258
|
+
} else {
|
|
259
|
+
t32 = $[4];
|
|
260
|
+
}
|
|
261
|
+
return t32;
|
|
262
|
+
}
|
|
263
|
+
let t1;
|
|
264
|
+
if ($[5] !== references) {
|
|
265
|
+
t1 = references.map(_temp$2).join("\n");
|
|
266
|
+
$[5] = references;
|
|
267
|
+
$[6] = t1;
|
|
268
|
+
} else {
|
|
269
|
+
t1 = $[6];
|
|
270
|
+
}
|
|
271
|
+
const owners = t1;
|
|
272
|
+
const t2 = `storage-refs-${objectKey}`;
|
|
273
|
+
let t3;
|
|
274
|
+
if ($[7] !== references.length || $[8] !== t) {
|
|
275
|
+
t3 = references.length === 1 ? t("1 record") : t("{count} records", {
|
|
276
|
+
count: references.length
|
|
277
|
+
});
|
|
278
|
+
$[7] = references.length;
|
|
279
|
+
$[8] = t;
|
|
280
|
+
$[9] = t3;
|
|
281
|
+
} else {
|
|
282
|
+
t3 = $[9];
|
|
283
|
+
}
|
|
284
|
+
let t4;
|
|
285
|
+
if ($[10] !== owners || $[11] !== t2 || $[12] !== t3) {
|
|
286
|
+
t4 = /* @__PURE__ */ jsxDEV(Badge, {
|
|
287
|
+
"data-testid": t2,
|
|
288
|
+
title: owners,
|
|
289
|
+
variant: "secondary",
|
|
290
|
+
children: t3
|
|
291
|
+
}, void 0, false);
|
|
292
|
+
$[10] = owners;
|
|
293
|
+
$[11] = t2;
|
|
294
|
+
$[12] = t3;
|
|
295
|
+
$[13] = t4;
|
|
296
|
+
} else {
|
|
297
|
+
t4 = $[13];
|
|
298
|
+
}
|
|
299
|
+
return t4;
|
|
300
|
+
};
|
|
301
|
+
const FileSelect = (t0) => {
|
|
302
|
+
const $ = c(7);
|
|
303
|
+
const {
|
|
304
|
+
objectKey,
|
|
305
|
+
onToggle,
|
|
306
|
+
selected,
|
|
307
|
+
t
|
|
308
|
+
} = t0;
|
|
309
|
+
let t1;
|
|
310
|
+
if ($[0] !== t) {
|
|
311
|
+
t1 = t("Select row");
|
|
312
|
+
$[0] = t;
|
|
313
|
+
$[1] = t1;
|
|
314
|
+
} else {
|
|
315
|
+
t1 = $[1];
|
|
316
|
+
}
|
|
317
|
+
const t2 = `storage-select-${objectKey}`;
|
|
318
|
+
let t3;
|
|
319
|
+
if ($[2] !== onToggle || $[3] !== selected || $[4] !== t1 || $[5] !== t2) {
|
|
320
|
+
t3 = /* @__PURE__ */ jsxDEV(Checkbox, {
|
|
321
|
+
"aria-label": t1,
|
|
322
|
+
checked: selected,
|
|
323
|
+
"data-testid": t2,
|
|
324
|
+
onCheckedChange: onToggle
|
|
325
|
+
}, void 0, false);
|
|
326
|
+
$[2] = onToggle;
|
|
327
|
+
$[3] = selected;
|
|
328
|
+
$[4] = t1;
|
|
329
|
+
$[5] = t2;
|
|
330
|
+
$[6] = t3;
|
|
331
|
+
} else {
|
|
332
|
+
t3 = $[6];
|
|
333
|
+
}
|
|
334
|
+
return t3;
|
|
335
|
+
};
|
|
336
|
+
function _temp$2(reference) {
|
|
337
|
+
return `${reference.table}·${reference.id}`;
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
const FolderRow = (t0) => {
|
|
341
|
+
const $ = c(10);
|
|
342
|
+
const {
|
|
343
|
+
colSpan,
|
|
344
|
+
name,
|
|
345
|
+
onEnter
|
|
346
|
+
} = t0;
|
|
347
|
+
let t1;
|
|
348
|
+
if ($[0] !== name || $[1] !== onEnter) {
|
|
349
|
+
t1 = () => {
|
|
350
|
+
onEnter(name);
|
|
351
|
+
};
|
|
352
|
+
$[0] = name;
|
|
353
|
+
$[1] = onEnter;
|
|
354
|
+
$[2] = t1;
|
|
355
|
+
} else {
|
|
356
|
+
t1 = $[2];
|
|
357
|
+
}
|
|
358
|
+
const enter = t1;
|
|
359
|
+
let t2;
|
|
360
|
+
if ($[3] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
|
|
361
|
+
t2 = /* @__PURE__ */ jsxDEV("svg", {
|
|
362
|
+
"aria-hidden": "true",
|
|
363
|
+
className: "size-4 text-muted-foreground",
|
|
364
|
+
fill: "none",
|
|
365
|
+
stroke: "currentColor",
|
|
366
|
+
strokeLinecap: "round",
|
|
367
|
+
strokeLinejoin: "round",
|
|
368
|
+
strokeWidth: 1.6,
|
|
369
|
+
viewBox: "0 0 24 24",
|
|
370
|
+
children: /* @__PURE__ */ jsxDEV("path", {
|
|
371
|
+
d: "M3 7a2 2 0 0 1 2-2h4l2 2h8a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V7Z"
|
|
372
|
+
}, void 0, false)
|
|
373
|
+
}, void 0, false);
|
|
374
|
+
$[3] = t2;
|
|
375
|
+
} else {
|
|
376
|
+
t2 = $[3];
|
|
377
|
+
}
|
|
378
|
+
let t3;
|
|
379
|
+
if ($[4] !== enter || $[5] !== name) {
|
|
380
|
+
t3 = /* @__PURE__ */ jsxDEV("button", {
|
|
381
|
+
className: "inline-flex items-center gap-2 font-mono text-xs outline-none hover:text-foreground focus-visible:text-foreground",
|
|
382
|
+
"data-testid": "fb-folder",
|
|
383
|
+
onClick: enter,
|
|
384
|
+
type: "button",
|
|
385
|
+
children: [t2, name]
|
|
386
|
+
}, void 0, true);
|
|
387
|
+
$[4] = enter;
|
|
388
|
+
$[5] = name;
|
|
389
|
+
$[6] = t3;
|
|
390
|
+
} else {
|
|
391
|
+
t3 = $[6];
|
|
392
|
+
}
|
|
393
|
+
let t4;
|
|
394
|
+
if ($[7] !== colSpan || $[8] !== t3) {
|
|
395
|
+
t4 = /* @__PURE__ */ jsxDEV(TableRow, {
|
|
396
|
+
children: /* @__PURE__ */ jsxDEV(TableCell, {
|
|
397
|
+
colSpan,
|
|
398
|
+
children: t3
|
|
399
|
+
}, void 0, false)
|
|
400
|
+
}, void 0, false);
|
|
401
|
+
$[7] = colSpan;
|
|
402
|
+
$[8] = t3;
|
|
403
|
+
$[9] = t4;
|
|
404
|
+
} else {
|
|
405
|
+
t4 = $[9];
|
|
406
|
+
}
|
|
407
|
+
return t4;
|
|
408
|
+
};
|
|
409
|
+
const FileRow = (t0) => {
|
|
410
|
+
const $ = c(33);
|
|
411
|
+
const {
|
|
412
|
+
busy,
|
|
413
|
+
copiedKey,
|
|
414
|
+
handlers,
|
|
415
|
+
object,
|
|
416
|
+
prefix,
|
|
417
|
+
references,
|
|
418
|
+
selected,
|
|
419
|
+
showReferences,
|
|
420
|
+
t
|
|
421
|
+
} = t0;
|
|
422
|
+
const {
|
|
423
|
+
copy,
|
|
424
|
+
download,
|
|
425
|
+
name,
|
|
426
|
+
remove,
|
|
427
|
+
toggle
|
|
428
|
+
} = useFileItem(object, prefix, handlers);
|
|
429
|
+
let t1;
|
|
430
|
+
if ($[0] !== object.key || $[1] !== selected || $[2] !== t || $[3] !== toggle) {
|
|
431
|
+
t1 = /* @__PURE__ */ jsxDEV(TableCell, {
|
|
432
|
+
className: "w-8",
|
|
433
|
+
children: /* @__PURE__ */ jsxDEV(FileSelect, {
|
|
434
|
+
objectKey: object.key,
|
|
435
|
+
onToggle: toggle,
|
|
436
|
+
selected,
|
|
437
|
+
t
|
|
438
|
+
}, void 0, false)
|
|
439
|
+
}, void 0, false);
|
|
440
|
+
$[0] = object.key;
|
|
441
|
+
$[1] = selected;
|
|
442
|
+
$[2] = t;
|
|
443
|
+
$[3] = toggle;
|
|
444
|
+
$[4] = t1;
|
|
445
|
+
} else {
|
|
446
|
+
t1 = $[4];
|
|
447
|
+
}
|
|
448
|
+
let t2;
|
|
449
|
+
if ($[5] !== name) {
|
|
450
|
+
t2 = /* @__PURE__ */ jsxDEV(TableCell, {
|
|
451
|
+
className: "font-mono text-xs",
|
|
452
|
+
children: name
|
|
453
|
+
}, void 0, false);
|
|
454
|
+
$[5] = name;
|
|
455
|
+
$[6] = t2;
|
|
456
|
+
} else {
|
|
457
|
+
t2 = $[6];
|
|
458
|
+
}
|
|
459
|
+
let t3;
|
|
460
|
+
if ($[7] !== object.size) {
|
|
461
|
+
t3 = formatBytes(object.size);
|
|
462
|
+
$[7] = object.size;
|
|
463
|
+
$[8] = t3;
|
|
464
|
+
} else {
|
|
465
|
+
t3 = $[8];
|
|
466
|
+
}
|
|
467
|
+
let t4;
|
|
468
|
+
if ($[9] !== t3) {
|
|
469
|
+
t4 = /* @__PURE__ */ jsxDEV(TableCell, {
|
|
470
|
+
className: "tabular-nums text-muted-foreground",
|
|
471
|
+
children: t3
|
|
472
|
+
}, void 0, false);
|
|
473
|
+
$[9] = t3;
|
|
474
|
+
$[10] = t4;
|
|
475
|
+
} else {
|
|
476
|
+
t4 = $[10];
|
|
477
|
+
}
|
|
478
|
+
const t5 = object.httpMetadata?.contentType ?? "";
|
|
479
|
+
let t6;
|
|
480
|
+
if ($[11] !== t5) {
|
|
481
|
+
t6 = /* @__PURE__ */ jsxDEV(TableCell, {
|
|
482
|
+
children: t5
|
|
483
|
+
}, void 0, false);
|
|
484
|
+
$[11] = t5;
|
|
485
|
+
$[12] = t6;
|
|
486
|
+
} else {
|
|
487
|
+
t6 = $[12];
|
|
488
|
+
}
|
|
489
|
+
let t7;
|
|
490
|
+
if ($[13] !== object.key || $[14] !== references || $[15] !== showReferences || $[16] !== t) {
|
|
491
|
+
t7 = showReferences && /* @__PURE__ */ jsxDEV(TableCell, {
|
|
492
|
+
children: /* @__PURE__ */ jsxDEV(FileReferences, {
|
|
493
|
+
objectKey: object.key,
|
|
494
|
+
references,
|
|
495
|
+
t
|
|
496
|
+
}, void 0, false)
|
|
497
|
+
}, void 0, false);
|
|
498
|
+
$[13] = object.key;
|
|
499
|
+
$[14] = references;
|
|
500
|
+
$[15] = showReferences;
|
|
501
|
+
$[16] = t;
|
|
502
|
+
$[17] = t7;
|
|
503
|
+
} else {
|
|
504
|
+
t7 = $[17];
|
|
505
|
+
}
|
|
506
|
+
const t8 = copiedKey === object.key;
|
|
507
|
+
let t9;
|
|
508
|
+
if ($[18] !== busy || $[19] !== copy || $[20] !== download || $[21] !== object.key || $[22] !== remove || $[23] !== t || $[24] !== t8) {
|
|
509
|
+
t9 = /* @__PURE__ */ jsxDEV(TableCell, {
|
|
510
|
+
className: "text-right",
|
|
511
|
+
children: /* @__PURE__ */ jsxDEV("span", {
|
|
512
|
+
className: "inline-flex items-center gap-1",
|
|
513
|
+
children: /* @__PURE__ */ jsxDEV(FileActions, {
|
|
514
|
+
busy,
|
|
515
|
+
copied: t8,
|
|
516
|
+
objectKey: object.key,
|
|
517
|
+
onCopy: copy,
|
|
518
|
+
onDelete: remove,
|
|
519
|
+
onDownload: download,
|
|
520
|
+
t
|
|
521
|
+
}, void 0, false)
|
|
522
|
+
}, void 0, false)
|
|
523
|
+
}, void 0, false);
|
|
524
|
+
$[18] = busy;
|
|
525
|
+
$[19] = copy;
|
|
526
|
+
$[20] = download;
|
|
527
|
+
$[21] = object.key;
|
|
528
|
+
$[22] = remove;
|
|
529
|
+
$[23] = t;
|
|
530
|
+
$[24] = t8;
|
|
531
|
+
$[25] = t9;
|
|
532
|
+
} else {
|
|
533
|
+
t9 = $[25];
|
|
534
|
+
}
|
|
535
|
+
let t10;
|
|
536
|
+
if ($[26] !== t1 || $[27] !== t2 || $[28] !== t4 || $[29] !== t6 || $[30] !== t7 || $[31] !== t9) {
|
|
537
|
+
t10 = /* @__PURE__ */ jsxDEV(TableRow, {
|
|
538
|
+
"data-testid": "fb-row",
|
|
539
|
+
children: [t1, t2, t4, t6, t7, t9]
|
|
540
|
+
}, void 0, true);
|
|
541
|
+
$[26] = t1;
|
|
542
|
+
$[27] = t2;
|
|
543
|
+
$[28] = t4;
|
|
544
|
+
$[29] = t6;
|
|
545
|
+
$[30] = t7;
|
|
546
|
+
$[31] = t9;
|
|
547
|
+
$[32] = t10;
|
|
548
|
+
} else {
|
|
549
|
+
t10 = $[32];
|
|
550
|
+
}
|
|
551
|
+
return t10;
|
|
552
|
+
};
|
|
553
|
+
const FileBrowserList = (t0) => {
|
|
554
|
+
const $ = c(65);
|
|
555
|
+
const {
|
|
556
|
+
allSelected,
|
|
557
|
+
busy,
|
|
558
|
+
copiedKey,
|
|
559
|
+
files,
|
|
560
|
+
folders,
|
|
561
|
+
handlers,
|
|
562
|
+
onEnterFolder,
|
|
563
|
+
prefix,
|
|
564
|
+
references,
|
|
565
|
+
selected,
|
|
566
|
+
showReferences,
|
|
567
|
+
someSelected,
|
|
568
|
+
t,
|
|
569
|
+
toggleSelectAll
|
|
570
|
+
} = t0;
|
|
571
|
+
let t1;
|
|
572
|
+
if ($[0] !== t) {
|
|
573
|
+
t1 = t("Select all rows");
|
|
574
|
+
$[0] = t;
|
|
575
|
+
$[1] = t1;
|
|
576
|
+
} else {
|
|
577
|
+
t1 = $[1];
|
|
578
|
+
}
|
|
579
|
+
let t2;
|
|
580
|
+
if ($[2] !== allSelected || $[3] !== someSelected || $[4] !== t1 || $[5] !== toggleSelectAll) {
|
|
581
|
+
t2 = /* @__PURE__ */ jsxDEV(TableHead, {
|
|
582
|
+
className: "w-8",
|
|
583
|
+
children: /* @__PURE__ */ jsxDEV(Checkbox, {
|
|
584
|
+
"aria-label": t1,
|
|
585
|
+
checked: allSelected,
|
|
586
|
+
"data-testid": "storage-select-all",
|
|
587
|
+
indeterminate: someSelected,
|
|
588
|
+
onCheckedChange: toggleSelectAll
|
|
589
|
+
}, void 0, false)
|
|
590
|
+
}, void 0, false);
|
|
591
|
+
$[2] = allSelected;
|
|
592
|
+
$[3] = someSelected;
|
|
593
|
+
$[4] = t1;
|
|
594
|
+
$[5] = toggleSelectAll;
|
|
595
|
+
$[6] = t2;
|
|
596
|
+
} else {
|
|
597
|
+
t2 = $[6];
|
|
598
|
+
}
|
|
599
|
+
let t3;
|
|
600
|
+
if ($[7] !== t) {
|
|
601
|
+
t3 = t("key");
|
|
602
|
+
$[7] = t;
|
|
603
|
+
$[8] = t3;
|
|
604
|
+
} else {
|
|
605
|
+
t3 = $[8];
|
|
606
|
+
}
|
|
607
|
+
let t4;
|
|
608
|
+
if ($[9] !== t3) {
|
|
609
|
+
t4 = /* @__PURE__ */ jsxDEV(TableHead, {
|
|
610
|
+
children: t3
|
|
611
|
+
}, void 0, false);
|
|
612
|
+
$[9] = t3;
|
|
613
|
+
$[10] = t4;
|
|
614
|
+
} else {
|
|
615
|
+
t4 = $[10];
|
|
616
|
+
}
|
|
617
|
+
let t5;
|
|
618
|
+
if ($[11] !== t) {
|
|
619
|
+
t5 = t("size");
|
|
620
|
+
$[11] = t;
|
|
621
|
+
$[12] = t5;
|
|
622
|
+
} else {
|
|
623
|
+
t5 = $[12];
|
|
624
|
+
}
|
|
625
|
+
let t6;
|
|
626
|
+
if ($[13] !== t5) {
|
|
627
|
+
t6 = /* @__PURE__ */ jsxDEV(TableHead, {
|
|
628
|
+
children: t5
|
|
629
|
+
}, void 0, false);
|
|
630
|
+
$[13] = t5;
|
|
631
|
+
$[14] = t6;
|
|
632
|
+
} else {
|
|
633
|
+
t6 = $[14];
|
|
634
|
+
}
|
|
635
|
+
let t7;
|
|
636
|
+
if ($[15] !== t) {
|
|
637
|
+
t7 = t("content-type");
|
|
638
|
+
$[15] = t;
|
|
639
|
+
$[16] = t7;
|
|
640
|
+
} else {
|
|
641
|
+
t7 = $[16];
|
|
642
|
+
}
|
|
643
|
+
let t8;
|
|
644
|
+
if ($[17] !== t7) {
|
|
645
|
+
t8 = /* @__PURE__ */ jsxDEV(TableHead, {
|
|
646
|
+
children: t7
|
|
647
|
+
}, void 0, false);
|
|
648
|
+
$[17] = t7;
|
|
649
|
+
$[18] = t8;
|
|
650
|
+
} else {
|
|
651
|
+
t8 = $[18];
|
|
652
|
+
}
|
|
653
|
+
let t9;
|
|
654
|
+
if ($[19] !== showReferences || $[20] !== t) {
|
|
655
|
+
t9 = showReferences && /* @__PURE__ */ jsxDEV(TableHead, {
|
|
656
|
+
children: t("used by")
|
|
657
|
+
}, void 0, false);
|
|
658
|
+
$[19] = showReferences;
|
|
659
|
+
$[20] = t;
|
|
660
|
+
$[21] = t9;
|
|
661
|
+
} else {
|
|
662
|
+
t9 = $[21];
|
|
663
|
+
}
|
|
664
|
+
let t10;
|
|
665
|
+
if ($[22] !== t) {
|
|
666
|
+
t10 = t("Actions");
|
|
667
|
+
$[22] = t;
|
|
668
|
+
$[23] = t10;
|
|
669
|
+
} else {
|
|
670
|
+
t10 = $[23];
|
|
671
|
+
}
|
|
672
|
+
let t11;
|
|
673
|
+
if ($[24] !== t10) {
|
|
674
|
+
t11 = /* @__PURE__ */ jsxDEV(TableHead, {
|
|
675
|
+
"aria-label": t10
|
|
676
|
+
}, void 0, false);
|
|
677
|
+
$[24] = t10;
|
|
678
|
+
$[25] = t11;
|
|
679
|
+
} else {
|
|
680
|
+
t11 = $[25];
|
|
681
|
+
}
|
|
682
|
+
let t12;
|
|
683
|
+
if ($[26] !== t11 || $[27] !== t2 || $[28] !== t4 || $[29] !== t6 || $[30] !== t8 || $[31] !== t9) {
|
|
684
|
+
t12 = /* @__PURE__ */ jsxDEV(TableHeader, {
|
|
685
|
+
children: /* @__PURE__ */ jsxDEV(TableRow, {
|
|
686
|
+
children: [t2, t4, t6, t8, t9, t11]
|
|
687
|
+
}, void 0, true)
|
|
688
|
+
}, void 0, false);
|
|
689
|
+
$[26] = t11;
|
|
690
|
+
$[27] = t2;
|
|
691
|
+
$[28] = t4;
|
|
692
|
+
$[29] = t6;
|
|
693
|
+
$[30] = t8;
|
|
694
|
+
$[31] = t9;
|
|
695
|
+
$[32] = t12;
|
|
696
|
+
} else {
|
|
697
|
+
t12 = $[32];
|
|
698
|
+
}
|
|
699
|
+
let t13;
|
|
700
|
+
if ($[33] !== folders || $[34] !== onEnterFolder || $[35] !== showReferences) {
|
|
701
|
+
let t142;
|
|
702
|
+
if ($[37] !== onEnterFolder || $[38] !== showReferences) {
|
|
703
|
+
t142 = (folder) => /* @__PURE__ */ jsxDEV(FolderRow, {
|
|
704
|
+
colSpan: showReferences ? 6 : 5,
|
|
705
|
+
name: folder,
|
|
706
|
+
onEnter: onEnterFolder
|
|
707
|
+
}, folder, false);
|
|
708
|
+
$[37] = onEnterFolder;
|
|
709
|
+
$[38] = showReferences;
|
|
710
|
+
$[39] = t142;
|
|
711
|
+
} else {
|
|
712
|
+
t142 = $[39];
|
|
713
|
+
}
|
|
714
|
+
t13 = folders.map(t142);
|
|
715
|
+
$[33] = folders;
|
|
716
|
+
$[34] = onEnterFolder;
|
|
717
|
+
$[35] = showReferences;
|
|
718
|
+
$[36] = t13;
|
|
719
|
+
} else {
|
|
720
|
+
t13 = $[36];
|
|
721
|
+
}
|
|
722
|
+
let t14;
|
|
723
|
+
if ($[40] !== busy || $[41] !== copiedKey || $[42] !== files || $[43] !== handlers || $[44] !== prefix || $[45] !== references || $[46] !== selected || $[47] !== showReferences || $[48] !== t) {
|
|
724
|
+
let t152;
|
|
725
|
+
if ($[50] !== busy || $[51] !== copiedKey || $[52] !== handlers || $[53] !== prefix || $[54] !== references || $[55] !== selected || $[56] !== showReferences || $[57] !== t) {
|
|
726
|
+
t152 = (object) => /* @__PURE__ */ jsxDEV(FileRow, {
|
|
727
|
+
busy,
|
|
728
|
+
copiedKey,
|
|
729
|
+
handlers,
|
|
730
|
+
object,
|
|
731
|
+
prefix,
|
|
732
|
+
references: references[object.key],
|
|
733
|
+
selected: selected.has(object.key),
|
|
734
|
+
showReferences,
|
|
735
|
+
t
|
|
736
|
+
}, object.key, false);
|
|
737
|
+
$[50] = busy;
|
|
738
|
+
$[51] = copiedKey;
|
|
739
|
+
$[52] = handlers;
|
|
740
|
+
$[53] = prefix;
|
|
741
|
+
$[54] = references;
|
|
742
|
+
$[55] = selected;
|
|
743
|
+
$[56] = showReferences;
|
|
744
|
+
$[57] = t;
|
|
745
|
+
$[58] = t152;
|
|
746
|
+
} else {
|
|
747
|
+
t152 = $[58];
|
|
748
|
+
}
|
|
749
|
+
t14 = files.map(t152);
|
|
750
|
+
$[40] = busy;
|
|
751
|
+
$[41] = copiedKey;
|
|
752
|
+
$[42] = files;
|
|
753
|
+
$[43] = handlers;
|
|
754
|
+
$[44] = prefix;
|
|
755
|
+
$[45] = references;
|
|
756
|
+
$[46] = selected;
|
|
757
|
+
$[47] = showReferences;
|
|
758
|
+
$[48] = t;
|
|
759
|
+
$[49] = t14;
|
|
760
|
+
} else {
|
|
761
|
+
t14 = $[49];
|
|
762
|
+
}
|
|
763
|
+
let t15;
|
|
764
|
+
if ($[59] !== t13 || $[60] !== t14) {
|
|
765
|
+
t15 = /* @__PURE__ */ jsxDEV(TableBody, {
|
|
766
|
+
children: [t13, t14]
|
|
767
|
+
}, void 0, true);
|
|
768
|
+
$[59] = t13;
|
|
769
|
+
$[60] = t14;
|
|
770
|
+
$[61] = t15;
|
|
771
|
+
} else {
|
|
772
|
+
t15 = $[61];
|
|
773
|
+
}
|
|
774
|
+
let t16;
|
|
775
|
+
if ($[62] !== t12 || $[63] !== t15) {
|
|
776
|
+
t16 = /* @__PURE__ */ jsxDEV(Card, {
|
|
777
|
+
className: "overflow-hidden py-0",
|
|
778
|
+
children: /* @__PURE__ */ jsxDEV(CardContent, {
|
|
779
|
+
className: "px-0",
|
|
780
|
+
children: /* @__PURE__ */ jsxDEV(Table, {
|
|
781
|
+
"data-testid": "fb-table",
|
|
782
|
+
children: [t12, t15]
|
|
783
|
+
}, void 0, true)
|
|
784
|
+
}, void 0, false)
|
|
785
|
+
}, void 0, false);
|
|
786
|
+
$[62] = t12;
|
|
787
|
+
$[63] = t15;
|
|
788
|
+
$[64] = t16;
|
|
789
|
+
} else {
|
|
790
|
+
t16 = $[64];
|
|
791
|
+
}
|
|
792
|
+
return t16;
|
|
793
|
+
};
|
|
794
|
+
|
|
795
|
+
const SHARE_LIFETIMES = [{
|
|
796
|
+
label: "15m",
|
|
797
|
+
seconds: 900
|
|
798
|
+
}, {
|
|
799
|
+
label: "1h",
|
|
800
|
+
seconds: 3600
|
|
801
|
+
}, {
|
|
802
|
+
label: "24h",
|
|
803
|
+
seconds: 86400
|
|
804
|
+
}, {
|
|
805
|
+
label: "7d",
|
|
806
|
+
seconds: 604800
|
|
807
|
+
}];
|
|
808
|
+
const DEFAULT_SHARE_LIFETIME = 3600;
|
|
809
|
+
const fileSortValue = (object, key) => {
|
|
810
|
+
if (key === "size") {
|
|
811
|
+
return object.size;
|
|
812
|
+
}
|
|
813
|
+
if (key === "type") {
|
|
814
|
+
return object.httpMetadata?.contentType ?? "";
|
|
815
|
+
}
|
|
816
|
+
if (key === "date") {
|
|
817
|
+
if (object.uploaded === void 0) {
|
|
818
|
+
return 0;
|
|
819
|
+
}
|
|
820
|
+
const time = new Date(object.uploaded).getTime();
|
|
821
|
+
return Number.isNaN(time) ? 0 : time;
|
|
822
|
+
}
|
|
823
|
+
if (key.startsWith("tag:")) {
|
|
824
|
+
return object.customMetadata?.[key.slice(4)] ?? "";
|
|
825
|
+
}
|
|
826
|
+
return object.key;
|
|
827
|
+
};
|
|
828
|
+
const sortFiles = (files, key, direction) => {
|
|
829
|
+
const factor = direction === "desc" ? -1 : 1;
|
|
830
|
+
return files.toSorted((a, b) => {
|
|
831
|
+
const av = fileSortValue(a, key);
|
|
832
|
+
const bv = fileSortValue(b, key);
|
|
833
|
+
const cmp = typeof av === "number" && typeof bv === "number" ? av - bv : String(av).localeCompare(String(bv));
|
|
834
|
+
return cmp * factor;
|
|
835
|
+
});
|
|
836
|
+
};
|
|
837
|
+
const deriveEntries = (objects, prefix) => {
|
|
838
|
+
const folders = /* @__PURE__ */ new Set();
|
|
839
|
+
const files = [];
|
|
840
|
+
for (const object of objects) {
|
|
841
|
+
const rest = object.key.slice(prefix.length);
|
|
842
|
+
const slash = rest.indexOf("/");
|
|
843
|
+
if (slash === -1) {
|
|
844
|
+
files.push(object);
|
|
845
|
+
} else {
|
|
846
|
+
folders.add(rest.slice(0, slash + 1));
|
|
847
|
+
}
|
|
848
|
+
}
|
|
849
|
+
return {
|
|
850
|
+
files,
|
|
851
|
+
folders: [...folders].toSorted((a, b) => a.localeCompare(b))
|
|
852
|
+
};
|
|
853
|
+
};
|
|
854
|
+
|
|
855
|
+
const FileBrowserToolbar = (t0) => {
|
|
856
|
+
const $ = c(59);
|
|
857
|
+
const {
|
|
858
|
+
bucket,
|
|
859
|
+
buckets,
|
|
860
|
+
busy,
|
|
861
|
+
draftPrefix,
|
|
862
|
+
expiry,
|
|
863
|
+
fileInputRef,
|
|
864
|
+
onBucketChange,
|
|
865
|
+
onExpiryChange,
|
|
866
|
+
onFileChange,
|
|
867
|
+
onList,
|
|
868
|
+
onPrefixChange,
|
|
869
|
+
onUploadClick,
|
|
870
|
+
t
|
|
871
|
+
} = t0;
|
|
872
|
+
let t1;
|
|
873
|
+
if ($[0] !== onPrefixChange) {
|
|
874
|
+
t1 = (event) => {
|
|
875
|
+
onPrefixChange(event.target.value);
|
|
876
|
+
};
|
|
877
|
+
$[0] = onPrefixChange;
|
|
878
|
+
$[1] = t1;
|
|
879
|
+
} else {
|
|
880
|
+
t1 = $[1];
|
|
881
|
+
}
|
|
882
|
+
const onPrefixInput = t1;
|
|
883
|
+
let t2;
|
|
884
|
+
if ($[2] !== onBucketChange) {
|
|
885
|
+
t2 = (event_0) => {
|
|
886
|
+
onBucketChange(event_0.target.value);
|
|
887
|
+
};
|
|
888
|
+
$[2] = onBucketChange;
|
|
889
|
+
$[3] = t2;
|
|
890
|
+
} else {
|
|
891
|
+
t2 = $[3];
|
|
892
|
+
}
|
|
893
|
+
const onBucketSelect = t2;
|
|
894
|
+
let t3;
|
|
895
|
+
if ($[4] !== onExpiryChange) {
|
|
896
|
+
t3 = (event_1) => {
|
|
897
|
+
onExpiryChange(Number.parseInt(event_1.target.value, 10));
|
|
898
|
+
};
|
|
899
|
+
$[4] = onExpiryChange;
|
|
900
|
+
$[5] = t3;
|
|
901
|
+
} else {
|
|
902
|
+
t3 = $[5];
|
|
903
|
+
}
|
|
904
|
+
const onExpirySelect = t3;
|
|
905
|
+
let t4;
|
|
906
|
+
if ($[6] !== bucket || $[7] !== buckets || $[8] !== onBucketSelect || $[9] !== t) {
|
|
907
|
+
t4 = buckets.length > 0 && /* @__PURE__ */ jsxDEV("select", {
|
|
908
|
+
"aria-label": t("Bucket"),
|
|
909
|
+
className: "h-8 rounded-md border border-border bg-background px-1 outline-none focus-visible:border-ring",
|
|
910
|
+
"data-testid": "fb-bucket",
|
|
911
|
+
onChange: onBucketSelect,
|
|
912
|
+
value: bucket,
|
|
913
|
+
children: buckets.map(_temp$1)
|
|
914
|
+
}, void 0, false);
|
|
915
|
+
$[6] = bucket;
|
|
916
|
+
$[7] = buckets;
|
|
917
|
+
$[8] = onBucketSelect;
|
|
918
|
+
$[9] = t;
|
|
919
|
+
$[10] = t4;
|
|
920
|
+
} else {
|
|
921
|
+
t4 = $[10];
|
|
922
|
+
}
|
|
923
|
+
let t5;
|
|
924
|
+
if ($[11] !== t) {
|
|
925
|
+
t5 = t("Key prefix");
|
|
926
|
+
$[11] = t;
|
|
927
|
+
$[12] = t5;
|
|
928
|
+
} else {
|
|
929
|
+
t5 = $[12];
|
|
930
|
+
}
|
|
931
|
+
let t6;
|
|
932
|
+
if ($[13] !== t) {
|
|
933
|
+
t6 = t("key prefix (optional)");
|
|
934
|
+
$[13] = t;
|
|
935
|
+
$[14] = t6;
|
|
936
|
+
} else {
|
|
937
|
+
t6 = $[14];
|
|
938
|
+
}
|
|
939
|
+
let t7;
|
|
940
|
+
if ($[15] !== draftPrefix || $[16] !== onPrefixInput || $[17] !== t5 || $[18] !== t6) {
|
|
941
|
+
t7 = /* @__PURE__ */ jsxDEV(Input, {
|
|
942
|
+
"aria-label": t5,
|
|
943
|
+
className: "h-8 w-64 max-w-full",
|
|
944
|
+
"data-testid": "fb-prefix-input",
|
|
945
|
+
onChange: onPrefixInput,
|
|
946
|
+
placeholder: t6,
|
|
947
|
+
value: draftPrefix
|
|
948
|
+
}, void 0, false);
|
|
949
|
+
$[15] = draftPrefix;
|
|
950
|
+
$[16] = onPrefixInput;
|
|
951
|
+
$[17] = t5;
|
|
952
|
+
$[18] = t6;
|
|
953
|
+
$[19] = t7;
|
|
954
|
+
} else {
|
|
955
|
+
t7 = $[19];
|
|
956
|
+
}
|
|
957
|
+
let t8;
|
|
958
|
+
if ($[20] !== t) {
|
|
959
|
+
t8 = t("List");
|
|
960
|
+
$[20] = t;
|
|
961
|
+
$[21] = t8;
|
|
962
|
+
} else {
|
|
963
|
+
t8 = $[21];
|
|
964
|
+
}
|
|
965
|
+
let t9;
|
|
966
|
+
if ($[22] !== busy || $[23] !== onList || $[24] !== t8) {
|
|
967
|
+
t9 = /* @__PURE__ */ jsxDEV(Button, {
|
|
968
|
+
"data-testid": "fb-list",
|
|
969
|
+
disabled: busy,
|
|
970
|
+
onClick: onList,
|
|
971
|
+
size: "sm",
|
|
972
|
+
type: "button",
|
|
973
|
+
children: t8
|
|
974
|
+
}, void 0, false);
|
|
975
|
+
$[22] = busy;
|
|
976
|
+
$[23] = onList;
|
|
977
|
+
$[24] = t8;
|
|
978
|
+
$[25] = t9;
|
|
979
|
+
} else {
|
|
980
|
+
t9 = $[25];
|
|
981
|
+
}
|
|
982
|
+
let t10;
|
|
983
|
+
if ($[26] !== busy || $[27] !== t) {
|
|
984
|
+
t10 = busy ? t("Uploading…") : t("Upload");
|
|
985
|
+
$[26] = busy;
|
|
986
|
+
$[27] = t;
|
|
987
|
+
$[28] = t10;
|
|
988
|
+
} else {
|
|
989
|
+
t10 = $[28];
|
|
990
|
+
}
|
|
991
|
+
let t11;
|
|
992
|
+
if ($[29] !== busy || $[30] !== onUploadClick || $[31] !== t10) {
|
|
993
|
+
t11 = /* @__PURE__ */ jsxDEV(Button, {
|
|
994
|
+
"data-testid": "storage-upload",
|
|
995
|
+
disabled: busy,
|
|
996
|
+
onClick: onUploadClick,
|
|
997
|
+
size: "sm",
|
|
998
|
+
type: "button",
|
|
999
|
+
variant: "outline",
|
|
1000
|
+
children: t10
|
|
1001
|
+
}, void 0, false);
|
|
1002
|
+
$[29] = busy;
|
|
1003
|
+
$[30] = onUploadClick;
|
|
1004
|
+
$[31] = t10;
|
|
1005
|
+
$[32] = t11;
|
|
1006
|
+
} else {
|
|
1007
|
+
t11 = $[32];
|
|
1008
|
+
}
|
|
1009
|
+
let t12;
|
|
1010
|
+
if ($[33] !== fileInputRef || $[34] !== onFileChange) {
|
|
1011
|
+
t12 = /* @__PURE__ */ jsxDEV("input", {
|
|
1012
|
+
className: "hidden",
|
|
1013
|
+
"data-testid": "storage-file-input",
|
|
1014
|
+
onChange: onFileChange,
|
|
1015
|
+
ref: fileInputRef,
|
|
1016
|
+
type: "file"
|
|
1017
|
+
}, void 0, false);
|
|
1018
|
+
$[33] = fileInputRef;
|
|
1019
|
+
$[34] = onFileChange;
|
|
1020
|
+
$[35] = t12;
|
|
1021
|
+
} else {
|
|
1022
|
+
t12 = $[35];
|
|
1023
|
+
}
|
|
1024
|
+
let t13;
|
|
1025
|
+
if ($[36] !== t) {
|
|
1026
|
+
t13 = t("Link expiry");
|
|
1027
|
+
$[36] = t;
|
|
1028
|
+
$[37] = t13;
|
|
1029
|
+
} else {
|
|
1030
|
+
t13 = $[37];
|
|
1031
|
+
}
|
|
1032
|
+
let t14;
|
|
1033
|
+
if ($[38] !== t) {
|
|
1034
|
+
t14 = SHARE_LIFETIMES.map((lifetime) => /* @__PURE__ */ jsxDEV("option", {
|
|
1035
|
+
value: lifetime.seconds,
|
|
1036
|
+
children: t(lifetime.label)
|
|
1037
|
+
}, lifetime.seconds, false));
|
|
1038
|
+
$[38] = t;
|
|
1039
|
+
$[39] = t14;
|
|
1040
|
+
} else {
|
|
1041
|
+
t14 = $[39];
|
|
1042
|
+
}
|
|
1043
|
+
let t15;
|
|
1044
|
+
if ($[40] !== expiry || $[41] !== onExpirySelect || $[42] !== t14) {
|
|
1045
|
+
t15 = /* @__PURE__ */ jsxDEV("select", {
|
|
1046
|
+
className: "h-8 rounded-md border border-border bg-background px-1 tabular-nums outline-none focus-visible:border-ring",
|
|
1047
|
+
"data-testid": "storage-expiry",
|
|
1048
|
+
id: "storage-expiry",
|
|
1049
|
+
onChange: onExpirySelect,
|
|
1050
|
+
value: expiry,
|
|
1051
|
+
children: t14
|
|
1052
|
+
}, void 0, false);
|
|
1053
|
+
$[40] = expiry;
|
|
1054
|
+
$[41] = onExpirySelect;
|
|
1055
|
+
$[42] = t14;
|
|
1056
|
+
$[43] = t15;
|
|
1057
|
+
} else {
|
|
1058
|
+
t15 = $[43];
|
|
1059
|
+
}
|
|
1060
|
+
let t16;
|
|
1061
|
+
if ($[44] !== t13 || $[45] !== t15) {
|
|
1062
|
+
t16 = /* @__PURE__ */ jsxDEV("label", {
|
|
1063
|
+
className: "ml-auto flex items-center gap-1.5 text-xs text-muted-foreground",
|
|
1064
|
+
htmlFor: "storage-expiry",
|
|
1065
|
+
children: [t13, t15]
|
|
1066
|
+
}, void 0, true);
|
|
1067
|
+
$[44] = t13;
|
|
1068
|
+
$[45] = t15;
|
|
1069
|
+
$[46] = t16;
|
|
1070
|
+
} else {
|
|
1071
|
+
t16 = $[46];
|
|
1072
|
+
}
|
|
1073
|
+
let t17;
|
|
1074
|
+
if ($[47] !== t) {
|
|
1075
|
+
t17 = t("Open in Cloudflare");
|
|
1076
|
+
$[47] = t;
|
|
1077
|
+
$[48] = t17;
|
|
1078
|
+
} else {
|
|
1079
|
+
t17 = $[48];
|
|
1080
|
+
}
|
|
1081
|
+
let t18;
|
|
1082
|
+
if ($[49] !== t17) {
|
|
1083
|
+
t18 = /* @__PURE__ */ jsxDEV("a", {
|
|
1084
|
+
className: "text-sm text-primary underline-offset-4 hover:underline",
|
|
1085
|
+
"data-testid": "fb-cf-link",
|
|
1086
|
+
href: CLOUDFLARE_R2_URL,
|
|
1087
|
+
rel: "noreferrer",
|
|
1088
|
+
target: "_blank",
|
|
1089
|
+
children: t17
|
|
1090
|
+
}, void 0, false);
|
|
1091
|
+
$[49] = t17;
|
|
1092
|
+
$[50] = t18;
|
|
1093
|
+
} else {
|
|
1094
|
+
t18 = $[50];
|
|
1095
|
+
}
|
|
1096
|
+
let t19;
|
|
1097
|
+
if ($[51] !== t11 || $[52] !== t12 || $[53] !== t16 || $[54] !== t18 || $[55] !== t4 || $[56] !== t7 || $[57] !== t9) {
|
|
1098
|
+
t19 = /* @__PURE__ */ jsxDEV("div", {
|
|
1099
|
+
className: "flex flex-wrap items-center gap-2",
|
|
1100
|
+
children: [t4, t7, t9, t11, t12, t16, t18]
|
|
1101
|
+
}, void 0, true);
|
|
1102
|
+
$[51] = t11;
|
|
1103
|
+
$[52] = t12;
|
|
1104
|
+
$[53] = t16;
|
|
1105
|
+
$[54] = t18;
|
|
1106
|
+
$[55] = t4;
|
|
1107
|
+
$[56] = t7;
|
|
1108
|
+
$[57] = t9;
|
|
1109
|
+
$[58] = t19;
|
|
1110
|
+
} else {
|
|
1111
|
+
t19 = $[58];
|
|
1112
|
+
}
|
|
1113
|
+
return t19;
|
|
1114
|
+
};
|
|
1115
|
+
const FileBrowserControls = (t0) => {
|
|
1116
|
+
const $ = c(66);
|
|
1117
|
+
const {
|
|
1118
|
+
onSortKeyChange,
|
|
1119
|
+
onThumbSizeChange,
|
|
1120
|
+
showGrid,
|
|
1121
|
+
showList,
|
|
1122
|
+
sortDirection,
|
|
1123
|
+
sortKey,
|
|
1124
|
+
t,
|
|
1125
|
+
tagKeys,
|
|
1126
|
+
thumbSize,
|
|
1127
|
+
toggleSortDirection,
|
|
1128
|
+
view
|
|
1129
|
+
} = t0;
|
|
1130
|
+
let t1;
|
|
1131
|
+
if ($[0] !== onSortKeyChange) {
|
|
1132
|
+
t1 = (event) => {
|
|
1133
|
+
onSortKeyChange(event.target.value);
|
|
1134
|
+
};
|
|
1135
|
+
$[0] = onSortKeyChange;
|
|
1136
|
+
$[1] = t1;
|
|
1137
|
+
} else {
|
|
1138
|
+
t1 = $[1];
|
|
1139
|
+
}
|
|
1140
|
+
const onSortSelect = t1;
|
|
1141
|
+
let t2;
|
|
1142
|
+
if ($[2] !== onThumbSizeChange) {
|
|
1143
|
+
t2 = (event_0) => {
|
|
1144
|
+
onThumbSizeChange(Number.parseInt(event_0.target.value, 10));
|
|
1145
|
+
};
|
|
1146
|
+
$[2] = onThumbSizeChange;
|
|
1147
|
+
$[3] = t2;
|
|
1148
|
+
} else {
|
|
1149
|
+
t2 = $[3];
|
|
1150
|
+
}
|
|
1151
|
+
const onThumbInput = t2;
|
|
1152
|
+
const t3 = view === "list";
|
|
1153
|
+
let t4;
|
|
1154
|
+
if ($[4] !== t) {
|
|
1155
|
+
t4 = t("List");
|
|
1156
|
+
$[4] = t;
|
|
1157
|
+
$[5] = t4;
|
|
1158
|
+
} else {
|
|
1159
|
+
t4 = $[5];
|
|
1160
|
+
}
|
|
1161
|
+
let t5;
|
|
1162
|
+
if ($[6] !== showList || $[7] !== t3 || $[8] !== t4) {
|
|
1163
|
+
t5 = /* @__PURE__ */ jsxDEV("button", {
|
|
1164
|
+
"aria-pressed": t3,
|
|
1165
|
+
className: "px-2 py-1 outline-none transition-colors hover:bg-accent aria-pressed:bg-accent aria-pressed:text-accent-foreground",
|
|
1166
|
+
"data-testid": "fb-view-list",
|
|
1167
|
+
onClick: showList,
|
|
1168
|
+
type: "button",
|
|
1169
|
+
children: t4
|
|
1170
|
+
}, void 0, false);
|
|
1171
|
+
$[6] = showList;
|
|
1172
|
+
$[7] = t3;
|
|
1173
|
+
$[8] = t4;
|
|
1174
|
+
$[9] = t5;
|
|
1175
|
+
} else {
|
|
1176
|
+
t5 = $[9];
|
|
1177
|
+
}
|
|
1178
|
+
const t6 = view === "grid";
|
|
1179
|
+
let t7;
|
|
1180
|
+
if ($[10] !== t) {
|
|
1181
|
+
t7 = t("Grid");
|
|
1182
|
+
$[10] = t;
|
|
1183
|
+
$[11] = t7;
|
|
1184
|
+
} else {
|
|
1185
|
+
t7 = $[11];
|
|
1186
|
+
}
|
|
1187
|
+
let t8;
|
|
1188
|
+
if ($[12] !== showGrid || $[13] !== t6 || $[14] !== t7) {
|
|
1189
|
+
t8 = /* @__PURE__ */ jsxDEV("button", {
|
|
1190
|
+
"aria-pressed": t6,
|
|
1191
|
+
className: "border-s border-border px-2 py-1 outline-none transition-colors hover:bg-accent aria-pressed:bg-accent aria-pressed:text-accent-foreground",
|
|
1192
|
+
"data-testid": "fb-view-grid",
|
|
1193
|
+
onClick: showGrid,
|
|
1194
|
+
type: "button",
|
|
1195
|
+
children: t7
|
|
1196
|
+
}, void 0, false);
|
|
1197
|
+
$[12] = showGrid;
|
|
1198
|
+
$[13] = t6;
|
|
1199
|
+
$[14] = t7;
|
|
1200
|
+
$[15] = t8;
|
|
1201
|
+
} else {
|
|
1202
|
+
t8 = $[15];
|
|
1203
|
+
}
|
|
1204
|
+
let t9;
|
|
1205
|
+
if ($[16] !== t5 || $[17] !== t8) {
|
|
1206
|
+
t9 = /* @__PURE__ */ jsxDEV("div", {
|
|
1207
|
+
className: "inline-flex overflow-hidden rounded-md border border-border",
|
|
1208
|
+
children: [t5, t8]
|
|
1209
|
+
}, void 0, true);
|
|
1210
|
+
$[16] = t5;
|
|
1211
|
+
$[17] = t8;
|
|
1212
|
+
$[18] = t9;
|
|
1213
|
+
} else {
|
|
1214
|
+
t9 = $[18];
|
|
1215
|
+
}
|
|
1216
|
+
let t10;
|
|
1217
|
+
if ($[19] !== t) {
|
|
1218
|
+
t10 = t("Sort");
|
|
1219
|
+
$[19] = t;
|
|
1220
|
+
$[20] = t10;
|
|
1221
|
+
} else {
|
|
1222
|
+
t10 = $[20];
|
|
1223
|
+
}
|
|
1224
|
+
let t11;
|
|
1225
|
+
if ($[21] !== t) {
|
|
1226
|
+
t11 = t("Name");
|
|
1227
|
+
$[21] = t;
|
|
1228
|
+
$[22] = t11;
|
|
1229
|
+
} else {
|
|
1230
|
+
t11 = $[22];
|
|
1231
|
+
}
|
|
1232
|
+
let t12;
|
|
1233
|
+
if ($[23] !== t11) {
|
|
1234
|
+
t12 = /* @__PURE__ */ jsxDEV("option", {
|
|
1235
|
+
value: "name",
|
|
1236
|
+
children: t11
|
|
1237
|
+
}, void 0, false);
|
|
1238
|
+
$[23] = t11;
|
|
1239
|
+
$[24] = t12;
|
|
1240
|
+
} else {
|
|
1241
|
+
t12 = $[24];
|
|
1242
|
+
}
|
|
1243
|
+
let t13;
|
|
1244
|
+
if ($[25] !== t) {
|
|
1245
|
+
t13 = t("size");
|
|
1246
|
+
$[25] = t;
|
|
1247
|
+
$[26] = t13;
|
|
1248
|
+
} else {
|
|
1249
|
+
t13 = $[26];
|
|
1250
|
+
}
|
|
1251
|
+
let t14;
|
|
1252
|
+
if ($[27] !== t13) {
|
|
1253
|
+
t14 = /* @__PURE__ */ jsxDEV("option", {
|
|
1254
|
+
value: "size",
|
|
1255
|
+
children: t13
|
|
1256
|
+
}, void 0, false);
|
|
1257
|
+
$[27] = t13;
|
|
1258
|
+
$[28] = t14;
|
|
1259
|
+
} else {
|
|
1260
|
+
t14 = $[28];
|
|
1261
|
+
}
|
|
1262
|
+
let t15;
|
|
1263
|
+
if ($[29] !== t) {
|
|
1264
|
+
t15 = t("Type");
|
|
1265
|
+
$[29] = t;
|
|
1266
|
+
$[30] = t15;
|
|
1267
|
+
} else {
|
|
1268
|
+
t15 = $[30];
|
|
1269
|
+
}
|
|
1270
|
+
let t16;
|
|
1271
|
+
if ($[31] !== t15) {
|
|
1272
|
+
t16 = /* @__PURE__ */ jsxDEV("option", {
|
|
1273
|
+
value: "type",
|
|
1274
|
+
children: t15
|
|
1275
|
+
}, void 0, false);
|
|
1276
|
+
$[31] = t15;
|
|
1277
|
+
$[32] = t16;
|
|
1278
|
+
} else {
|
|
1279
|
+
t16 = $[32];
|
|
1280
|
+
}
|
|
1281
|
+
let t17;
|
|
1282
|
+
if ($[33] !== t) {
|
|
1283
|
+
t17 = t("Modified");
|
|
1284
|
+
$[33] = t;
|
|
1285
|
+
$[34] = t17;
|
|
1286
|
+
} else {
|
|
1287
|
+
t17 = $[34];
|
|
1288
|
+
}
|
|
1289
|
+
let t18;
|
|
1290
|
+
if ($[35] !== t17) {
|
|
1291
|
+
t18 = /* @__PURE__ */ jsxDEV("option", {
|
|
1292
|
+
value: "date",
|
|
1293
|
+
children: t17
|
|
1294
|
+
}, void 0, false);
|
|
1295
|
+
$[35] = t17;
|
|
1296
|
+
$[36] = t18;
|
|
1297
|
+
} else {
|
|
1298
|
+
t18 = $[36];
|
|
1299
|
+
}
|
|
1300
|
+
let t19;
|
|
1301
|
+
if ($[37] !== tagKeys) {
|
|
1302
|
+
t19 = tagKeys.map(_temp2);
|
|
1303
|
+
$[37] = tagKeys;
|
|
1304
|
+
$[38] = t19;
|
|
1305
|
+
} else {
|
|
1306
|
+
t19 = $[38];
|
|
1307
|
+
}
|
|
1308
|
+
let t20;
|
|
1309
|
+
if ($[39] !== onSortSelect || $[40] !== sortKey || $[41] !== t12 || $[42] !== t14 || $[43] !== t16 || $[44] !== t18 || $[45] !== t19) {
|
|
1310
|
+
t20 = /* @__PURE__ */ jsxDEV("select", {
|
|
1311
|
+
className: "h-8 rounded-md border border-border bg-background px-1 outline-none focus-visible:border-ring",
|
|
1312
|
+
"data-testid": "fb-sort",
|
|
1313
|
+
id: "fb-sort",
|
|
1314
|
+
onChange: onSortSelect,
|
|
1315
|
+
value: sortKey,
|
|
1316
|
+
children: [t12, t14, t16, t18, t19]
|
|
1317
|
+
}, void 0, true);
|
|
1318
|
+
$[39] = onSortSelect;
|
|
1319
|
+
$[40] = sortKey;
|
|
1320
|
+
$[41] = t12;
|
|
1321
|
+
$[42] = t14;
|
|
1322
|
+
$[43] = t16;
|
|
1323
|
+
$[44] = t18;
|
|
1324
|
+
$[45] = t19;
|
|
1325
|
+
$[46] = t20;
|
|
1326
|
+
} else {
|
|
1327
|
+
t20 = $[46];
|
|
1328
|
+
}
|
|
1329
|
+
let t21;
|
|
1330
|
+
if ($[47] !== t10 || $[48] !== t20) {
|
|
1331
|
+
t21 = /* @__PURE__ */ jsxDEV("label", {
|
|
1332
|
+
className: "flex items-center gap-1.5 text-muted-foreground",
|
|
1333
|
+
htmlFor: "fb-sort",
|
|
1334
|
+
children: [t10, t20]
|
|
1335
|
+
}, void 0, true);
|
|
1336
|
+
$[47] = t10;
|
|
1337
|
+
$[48] = t20;
|
|
1338
|
+
$[49] = t21;
|
|
1339
|
+
} else {
|
|
1340
|
+
t21 = $[49];
|
|
1341
|
+
}
|
|
1342
|
+
let t22;
|
|
1343
|
+
if ($[50] !== t) {
|
|
1344
|
+
t22 = t("Toggle sort direction");
|
|
1345
|
+
$[50] = t;
|
|
1346
|
+
$[51] = t22;
|
|
1347
|
+
} else {
|
|
1348
|
+
t22 = $[51];
|
|
1349
|
+
}
|
|
1350
|
+
const t23 = sortDirection === "asc" ? "↑" : "↓";
|
|
1351
|
+
let t24;
|
|
1352
|
+
if ($[52] !== t22 || $[53] !== t23 || $[54] !== toggleSortDirection) {
|
|
1353
|
+
t24 = /* @__PURE__ */ jsxDEV("button", {
|
|
1354
|
+
"aria-label": t22,
|
|
1355
|
+
className: "flex size-8 items-center justify-center rounded-md border border-border tabular-nums outline-none transition-colors hover:bg-accent focus-visible:bg-accent",
|
|
1356
|
+
"data-testid": "fb-sort-dir",
|
|
1357
|
+
onClick: toggleSortDirection,
|
|
1358
|
+
type: "button",
|
|
1359
|
+
children: t23
|
|
1360
|
+
}, void 0, false);
|
|
1361
|
+
$[52] = t22;
|
|
1362
|
+
$[53] = t23;
|
|
1363
|
+
$[54] = toggleSortDirection;
|
|
1364
|
+
$[55] = t24;
|
|
1365
|
+
} else {
|
|
1366
|
+
t24 = $[55];
|
|
1367
|
+
}
|
|
1368
|
+
let t25;
|
|
1369
|
+
if ($[56] !== onThumbInput || $[57] !== t || $[58] !== thumbSize || $[59] !== view) {
|
|
1370
|
+
t25 = view === "grid" && /* @__PURE__ */ jsxDEV("label", {
|
|
1371
|
+
className: "ml-auto flex items-center gap-1.5 text-muted-foreground",
|
|
1372
|
+
htmlFor: "fb-thumb-size",
|
|
1373
|
+
children: [t("Thumbnail size"), /* @__PURE__ */ jsxDEV("input", {
|
|
1374
|
+
className: "accent-primary",
|
|
1375
|
+
"data-testid": "fb-thumb-size",
|
|
1376
|
+
id: "fb-thumb-size",
|
|
1377
|
+
max: 240,
|
|
1378
|
+
min: 80,
|
|
1379
|
+
onChange: onThumbInput,
|
|
1380
|
+
step: 8,
|
|
1381
|
+
type: "range",
|
|
1382
|
+
value: thumbSize
|
|
1383
|
+
}, void 0, false)]
|
|
1384
|
+
}, void 0, true);
|
|
1385
|
+
$[56] = onThumbInput;
|
|
1386
|
+
$[57] = t;
|
|
1387
|
+
$[58] = thumbSize;
|
|
1388
|
+
$[59] = view;
|
|
1389
|
+
$[60] = t25;
|
|
1390
|
+
} else {
|
|
1391
|
+
t25 = $[60];
|
|
1392
|
+
}
|
|
1393
|
+
let t26;
|
|
1394
|
+
if ($[61] !== t21 || $[62] !== t24 || $[63] !== t25 || $[64] !== t9) {
|
|
1395
|
+
t26 = /* @__PURE__ */ jsxDEV("div", {
|
|
1396
|
+
className: "flex flex-wrap items-center gap-2 text-xs",
|
|
1397
|
+
"data-testid": "fb-controls",
|
|
1398
|
+
children: [t9, t21, t24, t25]
|
|
1399
|
+
}, void 0, true);
|
|
1400
|
+
$[61] = t21;
|
|
1401
|
+
$[62] = t24;
|
|
1402
|
+
$[63] = t25;
|
|
1403
|
+
$[64] = t9;
|
|
1404
|
+
$[65] = t26;
|
|
1405
|
+
} else {
|
|
1406
|
+
t26 = $[65];
|
|
1407
|
+
}
|
|
1408
|
+
return t26;
|
|
1409
|
+
};
|
|
1410
|
+
function _temp$1(name) {
|
|
1411
|
+
return /* @__PURE__ */ jsxDEV("option", {
|
|
1412
|
+
value: name,
|
|
1413
|
+
children: name
|
|
1414
|
+
}, name, false);
|
|
1415
|
+
}
|
|
1416
|
+
function _temp2(key) {
|
|
1417
|
+
return /* @__PURE__ */ jsxDEV("option", {
|
|
1418
|
+
value: `tag:${key}`,
|
|
1419
|
+
children: key
|
|
1420
|
+
}, key, false);
|
|
1421
|
+
}
|
|
1422
|
+
|
|
1423
|
+
const IMAGE_EXTENSION_RE = /\.(?:avif|bmp|gif|ico|jpe?g|png|svg|webp)$/iu;
|
|
1424
|
+
const isImage = (object) => (object.httpMetadata?.contentType ?? "").startsWith("image/") || IMAGE_EXTENSION_RE.test(object.key);
|
|
1425
|
+
const FileGlyph = () => {
|
|
1426
|
+
const $ = c(1);
|
|
1427
|
+
let t0;
|
|
1428
|
+
if ($[0] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
|
|
1429
|
+
t0 = /* @__PURE__ */ jsxDEV("svg", {
|
|
1430
|
+
"aria-hidden": "true",
|
|
1431
|
+
className: "size-8 text-muted-foreground/60",
|
|
1432
|
+
fill: "none",
|
|
1433
|
+
stroke: "currentColor",
|
|
1434
|
+
strokeLinecap: "round",
|
|
1435
|
+
strokeLinejoin: "round",
|
|
1436
|
+
strokeWidth: 1.4,
|
|
1437
|
+
viewBox: "0 0 24 24",
|
|
1438
|
+
children: /* @__PURE__ */ jsxDEV("path", {
|
|
1439
|
+
d: "M7 3h7l5 5v13a1 1 0 0 1-1 1H7a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1Zm7 0v5h5"
|
|
1440
|
+
}, void 0, false)
|
|
1441
|
+
}, void 0, false);
|
|
1442
|
+
$[0] = t0;
|
|
1443
|
+
} else {
|
|
1444
|
+
t0 = $[0];
|
|
1445
|
+
}
|
|
1446
|
+
return t0;
|
|
1447
|
+
};
|
|
1448
|
+
const Thumbnail = (t0) => {
|
|
1449
|
+
const $ = c(13);
|
|
1450
|
+
const {
|
|
1451
|
+
object,
|
|
1452
|
+
resolveUrl
|
|
1453
|
+
} = t0;
|
|
1454
|
+
const [url, setUrl] = useState(null);
|
|
1455
|
+
const [failed, setFailed] = useState(false);
|
|
1456
|
+
let t1;
|
|
1457
|
+
if ($[0] !== object) {
|
|
1458
|
+
t1 = isImage(object);
|
|
1459
|
+
$[0] = object;
|
|
1460
|
+
$[1] = t1;
|
|
1461
|
+
} else {
|
|
1462
|
+
t1 = $[1];
|
|
1463
|
+
}
|
|
1464
|
+
const image = t1;
|
|
1465
|
+
let t2;
|
|
1466
|
+
let t3;
|
|
1467
|
+
if ($[2] !== image || $[3] !== object.key || $[4] !== resolveUrl) {
|
|
1468
|
+
t2 = () => {
|
|
1469
|
+
if (!image) {
|
|
1470
|
+
return;
|
|
1471
|
+
}
|
|
1472
|
+
const token = {
|
|
1473
|
+
cancelled: false
|
|
1474
|
+
};
|
|
1475
|
+
fireAndForget((async () => {
|
|
1476
|
+
try {
|
|
1477
|
+
const resolved = await resolveUrl(object.key);
|
|
1478
|
+
if (!token.cancelled) {
|
|
1479
|
+
setUrl(resolved);
|
|
1480
|
+
}
|
|
1481
|
+
} catch {
|
|
1482
|
+
if (!token.cancelled) {
|
|
1483
|
+
setFailed(true);
|
|
1484
|
+
}
|
|
1485
|
+
}
|
|
1486
|
+
})());
|
|
1487
|
+
return () => {
|
|
1488
|
+
token.cancelled = true;
|
|
1489
|
+
};
|
|
1490
|
+
};
|
|
1491
|
+
t3 = [image, object.key, resolveUrl];
|
|
1492
|
+
$[2] = image;
|
|
1493
|
+
$[3] = object.key;
|
|
1494
|
+
$[4] = resolveUrl;
|
|
1495
|
+
$[5] = t2;
|
|
1496
|
+
$[6] = t3;
|
|
1497
|
+
} else {
|
|
1498
|
+
t2 = $[5];
|
|
1499
|
+
t3 = $[6];
|
|
1500
|
+
}
|
|
1501
|
+
useEffect(t2, t3);
|
|
1502
|
+
let t4;
|
|
1503
|
+
if ($[7] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
|
|
1504
|
+
t4 = () => {
|
|
1505
|
+
setFailed(true);
|
|
1506
|
+
};
|
|
1507
|
+
$[7] = t4;
|
|
1508
|
+
} else {
|
|
1509
|
+
t4 = $[7];
|
|
1510
|
+
}
|
|
1511
|
+
const onError = t4;
|
|
1512
|
+
let t5;
|
|
1513
|
+
if ($[8] !== failed || $[9] !== image || $[10] !== object.key || $[11] !== url) {
|
|
1514
|
+
t5 = /* @__PURE__ */ jsxDEV("div", {
|
|
1515
|
+
className: "flex aspect-square w-full items-center justify-center overflow-hidden rounded-md border border-border bg-muted/30",
|
|
1516
|
+
children: image && url !== null && !failed ? /* @__PURE__ */ jsxDEV("img", {
|
|
1517
|
+
alt: object.key,
|
|
1518
|
+
className: "size-full object-cover",
|
|
1519
|
+
loading: "lazy",
|
|
1520
|
+
onError,
|
|
1521
|
+
src: url
|
|
1522
|
+
}, void 0, false) : /* @__PURE__ */ jsxDEV(FileGlyph, {}, void 0, false)
|
|
1523
|
+
}, void 0, false);
|
|
1524
|
+
$[8] = failed;
|
|
1525
|
+
$[9] = image;
|
|
1526
|
+
$[10] = object.key;
|
|
1527
|
+
$[11] = url;
|
|
1528
|
+
$[12] = t5;
|
|
1529
|
+
} else {
|
|
1530
|
+
t5 = $[12];
|
|
1531
|
+
}
|
|
1532
|
+
return t5;
|
|
1533
|
+
};
|
|
1534
|
+
const GalleryTile = (t0) => {
|
|
1535
|
+
const $ = c(38);
|
|
1536
|
+
const {
|
|
1537
|
+
busy,
|
|
1538
|
+
copiedKey,
|
|
1539
|
+
handlers,
|
|
1540
|
+
object,
|
|
1541
|
+
prefix,
|
|
1542
|
+
references,
|
|
1543
|
+
resolveUrl,
|
|
1544
|
+
selected,
|
|
1545
|
+
showReferences,
|
|
1546
|
+
t
|
|
1547
|
+
} = t0;
|
|
1548
|
+
const {
|
|
1549
|
+
copy,
|
|
1550
|
+
download,
|
|
1551
|
+
name,
|
|
1552
|
+
remove,
|
|
1553
|
+
toggle
|
|
1554
|
+
} = useFileItem(object, prefix, handlers);
|
|
1555
|
+
let t1;
|
|
1556
|
+
if ($[0] !== object || $[1] !== resolveUrl) {
|
|
1557
|
+
t1 = /* @__PURE__ */ jsxDEV(Thumbnail, {
|
|
1558
|
+
object,
|
|
1559
|
+
resolveUrl
|
|
1560
|
+
}, void 0, false);
|
|
1561
|
+
$[0] = object;
|
|
1562
|
+
$[1] = resolveUrl;
|
|
1563
|
+
$[2] = t1;
|
|
1564
|
+
} else {
|
|
1565
|
+
t1 = $[2];
|
|
1566
|
+
}
|
|
1567
|
+
let t2;
|
|
1568
|
+
if ($[3] !== object.key || $[4] !== selected || $[5] !== t || $[6] !== toggle) {
|
|
1569
|
+
t2 = /* @__PURE__ */ jsxDEV("span", {
|
|
1570
|
+
className: "absolute left-1.5 top-1.5 rounded bg-background/80 p-0.5",
|
|
1571
|
+
children: /* @__PURE__ */ jsxDEV(FileSelect, {
|
|
1572
|
+
objectKey: object.key,
|
|
1573
|
+
onToggle: toggle,
|
|
1574
|
+
selected,
|
|
1575
|
+
t
|
|
1576
|
+
}, void 0, false)
|
|
1577
|
+
}, void 0, false);
|
|
1578
|
+
$[3] = object.key;
|
|
1579
|
+
$[4] = selected;
|
|
1580
|
+
$[5] = t;
|
|
1581
|
+
$[6] = toggle;
|
|
1582
|
+
$[7] = t2;
|
|
1583
|
+
} else {
|
|
1584
|
+
t2 = $[7];
|
|
1585
|
+
}
|
|
1586
|
+
let t3;
|
|
1587
|
+
if ($[8] !== t1 || $[9] !== t2) {
|
|
1588
|
+
t3 = /* @__PURE__ */ jsxDEV("div", {
|
|
1589
|
+
className: "relative",
|
|
1590
|
+
children: [t1, t2]
|
|
1591
|
+
}, void 0, true);
|
|
1592
|
+
$[8] = t1;
|
|
1593
|
+
$[9] = t2;
|
|
1594
|
+
$[10] = t3;
|
|
1595
|
+
} else {
|
|
1596
|
+
t3 = $[10];
|
|
1597
|
+
}
|
|
1598
|
+
let t4;
|
|
1599
|
+
if ($[11] !== name) {
|
|
1600
|
+
t4 = /* @__PURE__ */ jsxDEV("p", {
|
|
1601
|
+
className: "truncate font-mono text-xs",
|
|
1602
|
+
title: name,
|
|
1603
|
+
children: name
|
|
1604
|
+
}, void 0, false);
|
|
1605
|
+
$[11] = name;
|
|
1606
|
+
$[12] = t4;
|
|
1607
|
+
} else {
|
|
1608
|
+
t4 = $[12];
|
|
1609
|
+
}
|
|
1610
|
+
let t5;
|
|
1611
|
+
if ($[13] !== object.size) {
|
|
1612
|
+
t5 = formatBytes(object.size);
|
|
1613
|
+
$[13] = object.size;
|
|
1614
|
+
$[14] = t5;
|
|
1615
|
+
} else {
|
|
1616
|
+
t5 = $[14];
|
|
1617
|
+
}
|
|
1618
|
+
let t6;
|
|
1619
|
+
if ($[15] !== t5) {
|
|
1620
|
+
t6 = /* @__PURE__ */ jsxDEV("p", {
|
|
1621
|
+
className: "text-[11px] tabular-nums text-muted-foreground",
|
|
1622
|
+
children: t5
|
|
1623
|
+
}, void 0, false);
|
|
1624
|
+
$[15] = t5;
|
|
1625
|
+
$[16] = t6;
|
|
1626
|
+
} else {
|
|
1627
|
+
t6 = $[16];
|
|
1628
|
+
}
|
|
1629
|
+
let t7;
|
|
1630
|
+
if ($[17] !== object.key || $[18] !== references || $[19] !== showReferences || $[20] !== t) {
|
|
1631
|
+
t7 = showReferences && /* @__PURE__ */ jsxDEV("div", {
|
|
1632
|
+
className: "mt-1",
|
|
1633
|
+
children: /* @__PURE__ */ jsxDEV(FileReferences, {
|
|
1634
|
+
objectKey: object.key,
|
|
1635
|
+
references,
|
|
1636
|
+
t
|
|
1637
|
+
}, void 0, false)
|
|
1638
|
+
}, void 0, false);
|
|
1639
|
+
$[17] = object.key;
|
|
1640
|
+
$[18] = references;
|
|
1641
|
+
$[19] = showReferences;
|
|
1642
|
+
$[20] = t;
|
|
1643
|
+
$[21] = t7;
|
|
1644
|
+
} else {
|
|
1645
|
+
t7 = $[21];
|
|
1646
|
+
}
|
|
1647
|
+
let t8;
|
|
1648
|
+
if ($[22] !== t4 || $[23] !== t6 || $[24] !== t7) {
|
|
1649
|
+
t8 = /* @__PURE__ */ jsxDEV("div", {
|
|
1650
|
+
className: "min-w-0",
|
|
1651
|
+
children: [t4, t6, t7]
|
|
1652
|
+
}, void 0, true);
|
|
1653
|
+
$[22] = t4;
|
|
1654
|
+
$[23] = t6;
|
|
1655
|
+
$[24] = t7;
|
|
1656
|
+
$[25] = t8;
|
|
1657
|
+
} else {
|
|
1658
|
+
t8 = $[25];
|
|
1659
|
+
}
|
|
1660
|
+
const t9 = copiedKey === object.key;
|
|
1661
|
+
let t10;
|
|
1662
|
+
if ($[26] !== busy || $[27] !== copy || $[28] !== download || $[29] !== object.key || $[30] !== remove || $[31] !== t || $[32] !== t9) {
|
|
1663
|
+
t10 = /* @__PURE__ */ jsxDEV("div", {
|
|
1664
|
+
className: "flex items-center gap-1",
|
|
1665
|
+
children: /* @__PURE__ */ jsxDEV(FileActions, {
|
|
1666
|
+
busy,
|
|
1667
|
+
buttonClassName: "h-7 px-2 text-xs",
|
|
1668
|
+
copied: t9,
|
|
1669
|
+
objectKey: object.key,
|
|
1670
|
+
onCopy: copy,
|
|
1671
|
+
onDelete: remove,
|
|
1672
|
+
onDownload: download,
|
|
1673
|
+
t
|
|
1674
|
+
}, void 0, false)
|
|
1675
|
+
}, void 0, false);
|
|
1676
|
+
$[26] = busy;
|
|
1677
|
+
$[27] = copy;
|
|
1678
|
+
$[28] = download;
|
|
1679
|
+
$[29] = object.key;
|
|
1680
|
+
$[30] = remove;
|
|
1681
|
+
$[31] = t;
|
|
1682
|
+
$[32] = t9;
|
|
1683
|
+
$[33] = t10;
|
|
1684
|
+
} else {
|
|
1685
|
+
t10 = $[33];
|
|
1686
|
+
}
|
|
1687
|
+
let t11;
|
|
1688
|
+
if ($[34] !== t10 || $[35] !== t3 || $[36] !== t8) {
|
|
1689
|
+
t11 = /* @__PURE__ */ jsxDEV("div", {
|
|
1690
|
+
className: "flex flex-col gap-1.5",
|
|
1691
|
+
"data-testid": "fb-tile",
|
|
1692
|
+
children: [t3, t8, t10]
|
|
1693
|
+
}, void 0, true);
|
|
1694
|
+
$[34] = t10;
|
|
1695
|
+
$[35] = t3;
|
|
1696
|
+
$[36] = t8;
|
|
1697
|
+
$[37] = t11;
|
|
1698
|
+
} else {
|
|
1699
|
+
t11 = $[37];
|
|
1700
|
+
}
|
|
1701
|
+
return t11;
|
|
1702
|
+
};
|
|
1703
|
+
const FolderTile = (t0) => {
|
|
1704
|
+
const $ = c(9);
|
|
1705
|
+
const {
|
|
1706
|
+
name,
|
|
1707
|
+
onEnter
|
|
1708
|
+
} = t0;
|
|
1709
|
+
let t1;
|
|
1710
|
+
if ($[0] !== name || $[1] !== onEnter) {
|
|
1711
|
+
t1 = () => {
|
|
1712
|
+
onEnter(name);
|
|
1713
|
+
};
|
|
1714
|
+
$[0] = name;
|
|
1715
|
+
$[1] = onEnter;
|
|
1716
|
+
$[2] = t1;
|
|
1717
|
+
} else {
|
|
1718
|
+
t1 = $[2];
|
|
1719
|
+
}
|
|
1720
|
+
const enter = t1;
|
|
1721
|
+
let t2;
|
|
1722
|
+
if ($[3] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
|
|
1723
|
+
t2 = /* @__PURE__ */ jsxDEV("span", {
|
|
1724
|
+
className: "flex aspect-square w-full items-center justify-center rounded-md border border-border bg-muted/30 transition-colors hover:bg-accent",
|
|
1725
|
+
children: /* @__PURE__ */ jsxDEV("svg", {
|
|
1726
|
+
"aria-hidden": "true",
|
|
1727
|
+
className: "size-10 text-muted-foreground",
|
|
1728
|
+
fill: "none",
|
|
1729
|
+
stroke: "currentColor",
|
|
1730
|
+
strokeLinecap: "round",
|
|
1731
|
+
strokeLinejoin: "round",
|
|
1732
|
+
strokeWidth: 1.4,
|
|
1733
|
+
viewBox: "0 0 24 24",
|
|
1734
|
+
children: /* @__PURE__ */ jsxDEV("path", {
|
|
1735
|
+
d: "M3 7a2 2 0 0 1 2-2h4l2 2h8a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V7Z"
|
|
1736
|
+
}, void 0, false)
|
|
1737
|
+
}, void 0, false)
|
|
1738
|
+
}, void 0, false);
|
|
1739
|
+
$[3] = t2;
|
|
1740
|
+
} else {
|
|
1741
|
+
t2 = $[3];
|
|
1742
|
+
}
|
|
1743
|
+
let t3;
|
|
1744
|
+
if ($[4] !== name) {
|
|
1745
|
+
t3 = /* @__PURE__ */ jsxDEV("span", {
|
|
1746
|
+
className: "truncate font-mono text-xs",
|
|
1747
|
+
title: name,
|
|
1748
|
+
children: name
|
|
1749
|
+
}, void 0, false);
|
|
1750
|
+
$[4] = name;
|
|
1751
|
+
$[5] = t3;
|
|
1752
|
+
} else {
|
|
1753
|
+
t3 = $[5];
|
|
1754
|
+
}
|
|
1755
|
+
let t4;
|
|
1756
|
+
if ($[6] !== enter || $[7] !== t3) {
|
|
1757
|
+
t4 = /* @__PURE__ */ jsxDEV("button", {
|
|
1758
|
+
className: "flex flex-col gap-1.5 text-left outline-none",
|
|
1759
|
+
"data-testid": "fb-folder",
|
|
1760
|
+
onClick: enter,
|
|
1761
|
+
type: "button",
|
|
1762
|
+
children: [t2, t3]
|
|
1763
|
+
}, void 0, true);
|
|
1764
|
+
$[6] = enter;
|
|
1765
|
+
$[7] = t3;
|
|
1766
|
+
$[8] = t4;
|
|
1767
|
+
} else {
|
|
1768
|
+
t4 = $[8];
|
|
1769
|
+
}
|
|
1770
|
+
return t4;
|
|
1771
|
+
};
|
|
1772
|
+
const FileGallery = (t0) => {
|
|
1773
|
+
const $ = c(34);
|
|
1774
|
+
const {
|
|
1775
|
+
busy,
|
|
1776
|
+
copiedKey,
|
|
1777
|
+
files,
|
|
1778
|
+
folders,
|
|
1779
|
+
handlers,
|
|
1780
|
+
onEnterFolder,
|
|
1781
|
+
prefix,
|
|
1782
|
+
references,
|
|
1783
|
+
resolveUrl,
|
|
1784
|
+
selected,
|
|
1785
|
+
showReferences,
|
|
1786
|
+
size,
|
|
1787
|
+
t
|
|
1788
|
+
} = t0;
|
|
1789
|
+
let t1;
|
|
1790
|
+
if ($[0] !== size) {
|
|
1791
|
+
t1 = size.toString();
|
|
1792
|
+
$[0] = size;
|
|
1793
|
+
$[1] = t1;
|
|
1794
|
+
} else {
|
|
1795
|
+
t1 = $[1];
|
|
1796
|
+
}
|
|
1797
|
+
const t2 = `repeat(auto-fill, minmax(${t1}px, 1fr))`;
|
|
1798
|
+
let t3;
|
|
1799
|
+
if ($[2] !== t2) {
|
|
1800
|
+
t3 = {
|
|
1801
|
+
gridTemplateColumns: t2
|
|
1802
|
+
};
|
|
1803
|
+
$[2] = t2;
|
|
1804
|
+
$[3] = t3;
|
|
1805
|
+
} else {
|
|
1806
|
+
t3 = $[3];
|
|
1807
|
+
}
|
|
1808
|
+
const gridStyle = t3;
|
|
1809
|
+
let t4;
|
|
1810
|
+
if ($[4] !== folders || $[5] !== onEnterFolder) {
|
|
1811
|
+
let t52;
|
|
1812
|
+
if ($[7] !== onEnterFolder) {
|
|
1813
|
+
t52 = (folder) => /* @__PURE__ */ jsxDEV(FolderTile, {
|
|
1814
|
+
name: folder,
|
|
1815
|
+
onEnter: onEnterFolder
|
|
1816
|
+
}, folder, false);
|
|
1817
|
+
$[7] = onEnterFolder;
|
|
1818
|
+
$[8] = t52;
|
|
1819
|
+
} else {
|
|
1820
|
+
t52 = $[8];
|
|
1821
|
+
}
|
|
1822
|
+
t4 = folders.map(t52);
|
|
1823
|
+
$[4] = folders;
|
|
1824
|
+
$[5] = onEnterFolder;
|
|
1825
|
+
$[6] = t4;
|
|
1826
|
+
} else {
|
|
1827
|
+
t4 = $[6];
|
|
1828
|
+
}
|
|
1829
|
+
let t5;
|
|
1830
|
+
if ($[9] !== busy || $[10] !== copiedKey || $[11] !== files || $[12] !== handlers || $[13] !== prefix || $[14] !== references || $[15] !== resolveUrl || $[16] !== selected || $[17] !== showReferences || $[18] !== t) {
|
|
1831
|
+
let t62;
|
|
1832
|
+
if ($[20] !== busy || $[21] !== copiedKey || $[22] !== handlers || $[23] !== prefix || $[24] !== references || $[25] !== resolveUrl || $[26] !== selected || $[27] !== showReferences || $[28] !== t) {
|
|
1833
|
+
t62 = (object) => /* @__PURE__ */ jsxDEV(GalleryTile, {
|
|
1834
|
+
busy,
|
|
1835
|
+
copiedKey,
|
|
1836
|
+
handlers,
|
|
1837
|
+
object,
|
|
1838
|
+
prefix,
|
|
1839
|
+
references: references[object.key],
|
|
1840
|
+
resolveUrl,
|
|
1841
|
+
selected: selected.has(object.key),
|
|
1842
|
+
showReferences,
|
|
1843
|
+
t
|
|
1844
|
+
}, object.key, false);
|
|
1845
|
+
$[20] = busy;
|
|
1846
|
+
$[21] = copiedKey;
|
|
1847
|
+
$[22] = handlers;
|
|
1848
|
+
$[23] = prefix;
|
|
1849
|
+
$[24] = references;
|
|
1850
|
+
$[25] = resolveUrl;
|
|
1851
|
+
$[26] = selected;
|
|
1852
|
+
$[27] = showReferences;
|
|
1853
|
+
$[28] = t;
|
|
1854
|
+
$[29] = t62;
|
|
1855
|
+
} else {
|
|
1856
|
+
t62 = $[29];
|
|
1857
|
+
}
|
|
1858
|
+
t5 = files.map(t62);
|
|
1859
|
+
$[9] = busy;
|
|
1860
|
+
$[10] = copiedKey;
|
|
1861
|
+
$[11] = files;
|
|
1862
|
+
$[12] = handlers;
|
|
1863
|
+
$[13] = prefix;
|
|
1864
|
+
$[14] = references;
|
|
1865
|
+
$[15] = resolveUrl;
|
|
1866
|
+
$[16] = selected;
|
|
1867
|
+
$[17] = showReferences;
|
|
1868
|
+
$[18] = t;
|
|
1869
|
+
$[19] = t5;
|
|
1870
|
+
} else {
|
|
1871
|
+
t5 = $[19];
|
|
1872
|
+
}
|
|
1873
|
+
let t6;
|
|
1874
|
+
if ($[30] !== gridStyle || $[31] !== t4 || $[32] !== t5) {
|
|
1875
|
+
t6 = /* @__PURE__ */ jsxDEV("div", {
|
|
1876
|
+
className: "grid gap-4",
|
|
1877
|
+
"data-testid": "fb-gallery",
|
|
1878
|
+
style: gridStyle,
|
|
1879
|
+
children: [t4, t5]
|
|
1880
|
+
}, void 0, true);
|
|
1881
|
+
$[30] = gridStyle;
|
|
1882
|
+
$[31] = t4;
|
|
1883
|
+
$[32] = t5;
|
|
1884
|
+
$[33] = t6;
|
|
1885
|
+
} else {
|
|
1886
|
+
t6 = $[33];
|
|
1887
|
+
}
|
|
1888
|
+
return t6;
|
|
1889
|
+
};
|
|
1890
|
+
|
|
1891
|
+
const DanglingRow = (t0) => {
|
|
1892
|
+
const $ = c(23);
|
|
1893
|
+
const {
|
|
1894
|
+
reference,
|
|
1895
|
+
t
|
|
1896
|
+
} = t0;
|
|
1897
|
+
const t1 = `fb-dangling-${reference.table}-${reference.id}-${reference.column}`;
|
|
1898
|
+
const t2 = `${reference.table}·${reference.id}`;
|
|
1899
|
+
let t3;
|
|
1900
|
+
if ($[0] !== t2) {
|
|
1901
|
+
t3 = /* @__PURE__ */ jsxDEV(Badge, {
|
|
1902
|
+
variant: "secondary",
|
|
1903
|
+
children: t2
|
|
1904
|
+
}, void 0, false);
|
|
1905
|
+
$[0] = t2;
|
|
1906
|
+
$[1] = t3;
|
|
1907
|
+
} else {
|
|
1908
|
+
t3 = $[1];
|
|
1909
|
+
}
|
|
1910
|
+
let t4;
|
|
1911
|
+
if ($[2] !== reference.column) {
|
|
1912
|
+
t4 = /* @__PURE__ */ jsxDEV("span", {
|
|
1913
|
+
className: "text-muted-foreground",
|
|
1914
|
+
children: reference.column
|
|
1915
|
+
}, void 0, false);
|
|
1916
|
+
$[2] = reference.column;
|
|
1917
|
+
$[3] = t4;
|
|
1918
|
+
} else {
|
|
1919
|
+
t4 = $[3];
|
|
1920
|
+
}
|
|
1921
|
+
let t5;
|
|
1922
|
+
if ($[4] !== t) {
|
|
1923
|
+
t5 = t("→");
|
|
1924
|
+
$[4] = t;
|
|
1925
|
+
$[5] = t5;
|
|
1926
|
+
} else {
|
|
1927
|
+
t5 = $[5];
|
|
1928
|
+
}
|
|
1929
|
+
let t6;
|
|
1930
|
+
if ($[6] !== t5) {
|
|
1931
|
+
t6 = /* @__PURE__ */ jsxDEV("span", {
|
|
1932
|
+
className: "text-muted-foreground/60",
|
|
1933
|
+
children: t5
|
|
1934
|
+
}, void 0, false);
|
|
1935
|
+
$[6] = t5;
|
|
1936
|
+
$[7] = t6;
|
|
1937
|
+
} else {
|
|
1938
|
+
t6 = $[7];
|
|
1939
|
+
}
|
|
1940
|
+
let t7;
|
|
1941
|
+
if ($[8] !== reference.key) {
|
|
1942
|
+
t7 = /* @__PURE__ */ jsxDEV("code", {
|
|
1943
|
+
className: "rounded bg-muted px-1 py-0.5 font-mono text-foreground",
|
|
1944
|
+
children: reference.key
|
|
1945
|
+
}, void 0, false);
|
|
1946
|
+
$[8] = reference.key;
|
|
1947
|
+
$[9] = t7;
|
|
1948
|
+
} else {
|
|
1949
|
+
t7 = $[9];
|
|
1950
|
+
}
|
|
1951
|
+
let t8;
|
|
1952
|
+
if ($[10] !== t3 || $[11] !== t4 || $[12] !== t6 || $[13] !== t7) {
|
|
1953
|
+
t8 = /* @__PURE__ */ jsxDEV("span", {
|
|
1954
|
+
className: "flex flex-wrap items-center gap-1.5",
|
|
1955
|
+
children: [t3, t4, t6, t7]
|
|
1956
|
+
}, void 0, true);
|
|
1957
|
+
$[10] = t3;
|
|
1958
|
+
$[11] = t4;
|
|
1959
|
+
$[12] = t6;
|
|
1960
|
+
$[13] = t7;
|
|
1961
|
+
$[14] = t8;
|
|
1962
|
+
} else {
|
|
1963
|
+
t8 = $[14];
|
|
1964
|
+
}
|
|
1965
|
+
let t9;
|
|
1966
|
+
if ($[15] !== t) {
|
|
1967
|
+
t9 = t("Missing object");
|
|
1968
|
+
$[15] = t;
|
|
1969
|
+
$[16] = t9;
|
|
1970
|
+
} else {
|
|
1971
|
+
t9 = $[16];
|
|
1972
|
+
}
|
|
1973
|
+
let t10;
|
|
1974
|
+
if ($[17] !== t9) {
|
|
1975
|
+
t10 = /* @__PURE__ */ jsxDEV(Badge, {
|
|
1976
|
+
className: "border-destructive/40 text-destructive",
|
|
1977
|
+
variant: "outline",
|
|
1978
|
+
children: t9
|
|
1979
|
+
}, void 0, false);
|
|
1980
|
+
$[17] = t9;
|
|
1981
|
+
$[18] = t10;
|
|
1982
|
+
} else {
|
|
1983
|
+
t10 = $[18];
|
|
1984
|
+
}
|
|
1985
|
+
let t11;
|
|
1986
|
+
if ($[19] !== t1 || $[20] !== t10 || $[21] !== t8) {
|
|
1987
|
+
t11 = /* @__PURE__ */ jsxDEV("li", {
|
|
1988
|
+
className: "flex flex-wrap items-center justify-between gap-2 rounded-md border border-border/60 px-3 py-2 text-xs",
|
|
1989
|
+
"data-testid": t1,
|
|
1990
|
+
children: [t8, t10]
|
|
1991
|
+
}, void 0, true);
|
|
1992
|
+
$[19] = t1;
|
|
1993
|
+
$[20] = t10;
|
|
1994
|
+
$[21] = t8;
|
|
1995
|
+
$[22] = t11;
|
|
1996
|
+
} else {
|
|
1997
|
+
t11 = $[22];
|
|
1998
|
+
}
|
|
1999
|
+
return t11;
|
|
2000
|
+
};
|
|
2001
|
+
const OrphanedObjectsSection = (t0) => {
|
|
2002
|
+
const $ = c(37);
|
|
2003
|
+
const {
|
|
2004
|
+
busy,
|
|
2005
|
+
onCheck,
|
|
2006
|
+
references,
|
|
2007
|
+
t,
|
|
2008
|
+
truncated
|
|
2009
|
+
} = t0;
|
|
2010
|
+
let t1;
|
|
2011
|
+
if ($[0] !== t) {
|
|
2012
|
+
t1 = t("Integrity");
|
|
2013
|
+
$[0] = t;
|
|
2014
|
+
$[1] = t1;
|
|
2015
|
+
} else {
|
|
2016
|
+
t1 = $[1];
|
|
2017
|
+
}
|
|
2018
|
+
let t2;
|
|
2019
|
+
if ($[2] !== t1) {
|
|
2020
|
+
t2 = /* @__PURE__ */ jsxDEV("span", {
|
|
2021
|
+
className: "font-mono text-[11px] uppercase tracking-wide text-muted-foreground",
|
|
2022
|
+
children: t1
|
|
2023
|
+
}, void 0, false);
|
|
2024
|
+
$[2] = t1;
|
|
2025
|
+
$[3] = t2;
|
|
2026
|
+
} else {
|
|
2027
|
+
t2 = $[3];
|
|
2028
|
+
}
|
|
2029
|
+
let t3;
|
|
2030
|
+
if ($[4] !== t) {
|
|
2031
|
+
t3 = t("Orphaned objects");
|
|
2032
|
+
$[4] = t;
|
|
2033
|
+
$[5] = t3;
|
|
2034
|
+
} else {
|
|
2035
|
+
t3 = $[5];
|
|
2036
|
+
}
|
|
2037
|
+
let t4;
|
|
2038
|
+
if ($[6] !== t3) {
|
|
2039
|
+
t4 = /* @__PURE__ */ jsxDEV("span", {
|
|
2040
|
+
className: "text-sm font-medium text-foreground",
|
|
2041
|
+
children: t3
|
|
2042
|
+
}, void 0, false);
|
|
2043
|
+
$[6] = t3;
|
|
2044
|
+
$[7] = t4;
|
|
2045
|
+
} else {
|
|
2046
|
+
t4 = $[7];
|
|
2047
|
+
}
|
|
2048
|
+
let t5;
|
|
2049
|
+
if ($[8] !== t) {
|
|
2050
|
+
t5 = t("Find records whose file reference points at an object the bucket no longer has.");
|
|
2051
|
+
$[8] = t;
|
|
2052
|
+
$[9] = t5;
|
|
2053
|
+
} else {
|
|
2054
|
+
t5 = $[9];
|
|
2055
|
+
}
|
|
2056
|
+
let t6;
|
|
2057
|
+
if ($[10] !== t5) {
|
|
2058
|
+
t6 = /* @__PURE__ */ jsxDEV("span", {
|
|
2059
|
+
className: "text-xs text-muted-foreground",
|
|
2060
|
+
children: t5
|
|
2061
|
+
}, void 0, false);
|
|
2062
|
+
$[10] = t5;
|
|
2063
|
+
$[11] = t6;
|
|
2064
|
+
} else {
|
|
2065
|
+
t6 = $[11];
|
|
2066
|
+
}
|
|
2067
|
+
let t7;
|
|
2068
|
+
if ($[12] !== t2 || $[13] !== t4 || $[14] !== t6) {
|
|
2069
|
+
t7 = /* @__PURE__ */ jsxDEV("div", {
|
|
2070
|
+
className: "flex flex-col gap-1",
|
|
2071
|
+
children: [t2, t4, t6]
|
|
2072
|
+
}, void 0, true);
|
|
2073
|
+
$[12] = t2;
|
|
2074
|
+
$[13] = t4;
|
|
2075
|
+
$[14] = t6;
|
|
2076
|
+
$[15] = t7;
|
|
2077
|
+
} else {
|
|
2078
|
+
t7 = $[15];
|
|
2079
|
+
}
|
|
2080
|
+
let t8;
|
|
2081
|
+
if ($[16] !== busy || $[17] !== t) {
|
|
2082
|
+
t8 = busy ? t("Checking…") : t("Check for orphans");
|
|
2083
|
+
$[16] = busy;
|
|
2084
|
+
$[17] = t;
|
|
2085
|
+
$[18] = t8;
|
|
2086
|
+
} else {
|
|
2087
|
+
t8 = $[18];
|
|
2088
|
+
}
|
|
2089
|
+
let t9;
|
|
2090
|
+
if ($[19] !== busy || $[20] !== onCheck || $[21] !== t8) {
|
|
2091
|
+
t9 = /* @__PURE__ */ jsxDEV(Button, {
|
|
2092
|
+
"data-testid": "fb-orphans-check",
|
|
2093
|
+
disabled: busy,
|
|
2094
|
+
onClick: onCheck,
|
|
2095
|
+
size: "sm",
|
|
2096
|
+
type: "button",
|
|
2097
|
+
variant: "outline",
|
|
2098
|
+
children: t8
|
|
2099
|
+
}, void 0, false);
|
|
2100
|
+
$[19] = busy;
|
|
2101
|
+
$[20] = onCheck;
|
|
2102
|
+
$[21] = t8;
|
|
2103
|
+
$[22] = t9;
|
|
2104
|
+
} else {
|
|
2105
|
+
t9 = $[22];
|
|
2106
|
+
}
|
|
2107
|
+
let t10;
|
|
2108
|
+
if ($[23] !== t7 || $[24] !== t9) {
|
|
2109
|
+
t10 = /* @__PURE__ */ jsxDEV("div", {
|
|
2110
|
+
className: "flex flex-wrap items-center justify-between gap-2",
|
|
2111
|
+
children: [t7, t9]
|
|
2112
|
+
}, void 0, true);
|
|
2113
|
+
$[23] = t7;
|
|
2114
|
+
$[24] = t9;
|
|
2115
|
+
$[25] = t10;
|
|
2116
|
+
} else {
|
|
2117
|
+
t10 = $[25];
|
|
2118
|
+
}
|
|
2119
|
+
let t11;
|
|
2120
|
+
if ($[26] !== references?.length || $[27] !== t) {
|
|
2121
|
+
t11 = references?.length === 0 && /* @__PURE__ */ jsxDEV(EmptyState, {
|
|
2122
|
+
description: t("Every record's file reference points at an object that exists in the bucket."),
|
|
2123
|
+
testId: "fb-orphans-empty",
|
|
2124
|
+
title: t("No dangling references.")
|
|
2125
|
+
}, void 0, false);
|
|
2126
|
+
$[26] = references?.length;
|
|
2127
|
+
$[27] = t;
|
|
2128
|
+
$[28] = t11;
|
|
2129
|
+
} else {
|
|
2130
|
+
t11 = $[28];
|
|
2131
|
+
}
|
|
2132
|
+
let t12;
|
|
2133
|
+
if ($[29] !== references || $[30] !== t || $[31] !== truncated) {
|
|
2134
|
+
t12 = references !== void 0 && references.length > 0 && /* @__PURE__ */ jsxDEV(Fragment, {
|
|
2135
|
+
children: [truncated && /* @__PURE__ */ jsxDEV("p", {
|
|
2136
|
+
className: "text-xs text-warning",
|
|
2137
|
+
"data-testid": "fb-orphans-truncated",
|
|
2138
|
+
children: t("Showing the first {count} dangling references — the scan was truncated.", {
|
|
2139
|
+
count: references.length
|
|
2140
|
+
})
|
|
2141
|
+
}, void 0, false), /* @__PURE__ */ jsxDEV("ul", {
|
|
2142
|
+
className: "flex flex-col gap-1.5",
|
|
2143
|
+
"data-testid": "fb-orphans-list",
|
|
2144
|
+
children: references.map((reference) => /* @__PURE__ */ jsxDEV(DanglingRow, {
|
|
2145
|
+
reference,
|
|
2146
|
+
t
|
|
2147
|
+
}, `${reference.table}·${reference.id}·${reference.column}`, false))
|
|
2148
|
+
}, void 0, false)]
|
|
2149
|
+
}, void 0, true);
|
|
2150
|
+
$[29] = references;
|
|
2151
|
+
$[30] = t;
|
|
2152
|
+
$[31] = truncated;
|
|
2153
|
+
$[32] = t12;
|
|
2154
|
+
} else {
|
|
2155
|
+
t12 = $[32];
|
|
2156
|
+
}
|
|
2157
|
+
let t13;
|
|
2158
|
+
if ($[33] !== t10 || $[34] !== t11 || $[35] !== t12) {
|
|
2159
|
+
t13 = /* @__PURE__ */ jsxDEV("section", {
|
|
2160
|
+
className: "flex flex-col gap-2 rounded-lg border border-border/60 p-3",
|
|
2161
|
+
"data-testid": "fb-orphans",
|
|
2162
|
+
children: [t10, t11, t12]
|
|
2163
|
+
}, void 0, true);
|
|
2164
|
+
$[33] = t10;
|
|
2165
|
+
$[34] = t11;
|
|
2166
|
+
$[35] = t12;
|
|
2167
|
+
$[36] = t13;
|
|
2168
|
+
} else {
|
|
2169
|
+
t13 = $[36];
|
|
2170
|
+
}
|
|
2171
|
+
return t13;
|
|
2172
|
+
};
|
|
2173
|
+
|
|
2174
|
+
const useKeySelection = function(items, keyOf) {
|
|
2175
|
+
const $ = c(18);
|
|
2176
|
+
let t0;
|
|
2177
|
+
if ($[0] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
|
|
2178
|
+
t0 = /* @__PURE__ */ new Set();
|
|
2179
|
+
$[0] = t0;
|
|
2180
|
+
} else {
|
|
2181
|
+
t0 = $[0];
|
|
2182
|
+
}
|
|
2183
|
+
const [selected, setSelected] = useState(t0);
|
|
2184
|
+
let t1;
|
|
2185
|
+
if ($[1] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
|
|
2186
|
+
t1 = (key) => {
|
|
2187
|
+
setSelected((current) => {
|
|
2188
|
+
const next = new Set(current);
|
|
2189
|
+
if (next.has(key)) {
|
|
2190
|
+
next.delete(key);
|
|
2191
|
+
} else {
|
|
2192
|
+
next.add(key);
|
|
2193
|
+
}
|
|
2194
|
+
return next;
|
|
2195
|
+
});
|
|
2196
|
+
};
|
|
2197
|
+
$[1] = t1;
|
|
2198
|
+
} else {
|
|
2199
|
+
t1 = $[1];
|
|
2200
|
+
}
|
|
2201
|
+
const toggle = t1;
|
|
2202
|
+
let t2;
|
|
2203
|
+
if ($[2] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
|
|
2204
|
+
t2 = () => {
|
|
2205
|
+
setSelected(/* @__PURE__ */ new Set());
|
|
2206
|
+
};
|
|
2207
|
+
$[2] = t2;
|
|
2208
|
+
} else {
|
|
2209
|
+
t2 = $[2];
|
|
2210
|
+
}
|
|
2211
|
+
const clear = t2;
|
|
2212
|
+
let allSelected;
|
|
2213
|
+
let keys;
|
|
2214
|
+
let t3;
|
|
2215
|
+
if ($[3] !== items || $[4] !== keyOf || $[5] !== selected) {
|
|
2216
|
+
let t42;
|
|
2217
|
+
if ($[9] !== keyOf) {
|
|
2218
|
+
t42 = (item) => keyOf(item);
|
|
2219
|
+
$[9] = keyOf;
|
|
2220
|
+
$[10] = t42;
|
|
2221
|
+
} else {
|
|
2222
|
+
t42 = $[10];
|
|
2223
|
+
}
|
|
2224
|
+
keys = items.map(t42);
|
|
2225
|
+
allSelected = keys.length > 0 && keys.every((key_0) => selected.has(key_0));
|
|
2226
|
+
t3 = !allSelected && keys.some((key_1) => selected.has(key_1));
|
|
2227
|
+
$[3] = items;
|
|
2228
|
+
$[4] = keyOf;
|
|
2229
|
+
$[5] = selected;
|
|
2230
|
+
$[6] = allSelected;
|
|
2231
|
+
$[7] = keys;
|
|
2232
|
+
$[8] = t3;
|
|
2233
|
+
} else {
|
|
2234
|
+
allSelected = $[6];
|
|
2235
|
+
keys = $[7];
|
|
2236
|
+
t3 = $[8];
|
|
2237
|
+
}
|
|
2238
|
+
const someSelected = t3;
|
|
2239
|
+
let t4;
|
|
2240
|
+
if ($[11] !== keys) {
|
|
2241
|
+
t4 = () => {
|
|
2242
|
+
setSelected((current_0) => keys.every((key_2) => current_0.has(key_2)) ? /* @__PURE__ */ new Set() : new Set(keys));
|
|
2243
|
+
};
|
|
2244
|
+
$[11] = keys;
|
|
2245
|
+
$[12] = t4;
|
|
2246
|
+
} else {
|
|
2247
|
+
t4 = $[12];
|
|
2248
|
+
}
|
|
2249
|
+
const toggleAll = t4;
|
|
2250
|
+
let t5;
|
|
2251
|
+
if ($[13] !== allSelected || $[14] !== selected || $[15] !== someSelected || $[16] !== toggleAll) {
|
|
2252
|
+
t5 = {
|
|
2253
|
+
allSelected,
|
|
2254
|
+
clear,
|
|
2255
|
+
selected,
|
|
2256
|
+
someSelected,
|
|
2257
|
+
toggle,
|
|
2258
|
+
toggleAll
|
|
2259
|
+
};
|
|
2260
|
+
$[13] = allSelected;
|
|
2261
|
+
$[14] = selected;
|
|
2262
|
+
$[15] = someSelected;
|
|
2263
|
+
$[16] = toggleAll;
|
|
2264
|
+
$[17] = t5;
|
|
2265
|
+
} else {
|
|
2266
|
+
t5 = $[17];
|
|
2267
|
+
}
|
|
2268
|
+
return t5;
|
|
2269
|
+
};
|
|
2270
|
+
|
|
2271
|
+
const STORAGE_REFERENCES = adminRef(ADMIN_FUNCTIONS.storageReferences);
|
|
2272
|
+
const STORAGE_ORPHANS = adminRef(ADMIN_FUNCTIONS.storageOrphans);
|
|
2273
|
+
const ORPHAN_LIVE_KEY_CAP = 1e4;
|
|
2274
|
+
const ORPHAN_LIST_PAGE_SIZE = 1e3;
|
|
2275
|
+
const THUMBNAIL_URL_TTL = 3600;
|
|
2276
|
+
const triggerDownload = (url, filename) => {
|
|
2277
|
+
if (!("document" in globalThis)) {
|
|
2278
|
+
return;
|
|
2279
|
+
}
|
|
2280
|
+
const anchor = globalThis.document.createElement("a");
|
|
2281
|
+
anchor.href = url;
|
|
2282
|
+
anchor.download = filename;
|
|
2283
|
+
anchor.rel = "noopener";
|
|
2284
|
+
globalThis.document.body.append(anchor);
|
|
2285
|
+
anchor.click();
|
|
2286
|
+
anchor.remove();
|
|
2287
|
+
};
|
|
2288
|
+
const copyToClipboard = async (text) => {
|
|
2289
|
+
if ("navigator" in globalThis && "clipboard" in globalThis.navigator) {
|
|
2290
|
+
await globalThis.navigator.clipboard.writeText(text);
|
|
2291
|
+
}
|
|
2292
|
+
};
|
|
2293
|
+
const useFileBrowser = ({
|
|
2294
|
+
initialPrefix,
|
|
2295
|
+
pageSize
|
|
2296
|
+
}) => {
|
|
2297
|
+
const client = useLunora();
|
|
2298
|
+
const [prefix, setPrefix] = useState(initialPrefix ?? "");
|
|
2299
|
+
const [draftPrefix, setDraftPrefix] = useState(initialPrefix ?? "");
|
|
2300
|
+
const [expiry, setExpiry] = useState(DEFAULT_SHARE_LIFETIME);
|
|
2301
|
+
const [view, setView] = useState("list");
|
|
2302
|
+
const [thumbSize, setThumbSize] = useState(128);
|
|
2303
|
+
const [sortKey, setSortKey] = useState("name");
|
|
2304
|
+
const [sortDirection, setSortDirection] = useState("asc");
|
|
2305
|
+
const [objects, setObjects] = useState(void 0);
|
|
2306
|
+
const [error, setError] = useState(void 0);
|
|
2307
|
+
const [busy, setBusy] = useState(false);
|
|
2308
|
+
const [copiedKey, setCopiedKey] = useState(void 0);
|
|
2309
|
+
const [nextCursor, setNextCursor] = useState(void 0);
|
|
2310
|
+
const [referenceShard, setReferenceShard] = useState("");
|
|
2311
|
+
const [references, setReferences] = useState({});
|
|
2312
|
+
const [hasStorageColumns, setHasStorageColumns] = useState(false);
|
|
2313
|
+
const [danglingReferences, setDanglingReferences] = useState(void 0);
|
|
2314
|
+
const [danglingBusy, setDanglingBusy] = useState(false);
|
|
2315
|
+
const [danglingTruncated, setDanglingTruncated] = useState(false);
|
|
2316
|
+
const [buckets, setBuckets] = useState([]);
|
|
2317
|
+
const [bucket, setBucket] = useState("");
|
|
2318
|
+
useEffect(() => {
|
|
2319
|
+
const token = {
|
|
2320
|
+
cancelled: false
|
|
2321
|
+
};
|
|
2322
|
+
fireAndForget((async () => {
|
|
2323
|
+
try {
|
|
2324
|
+
const names = await client.listStorageBuckets();
|
|
2325
|
+
if (!token.cancelled) {
|
|
2326
|
+
setBuckets(names);
|
|
2327
|
+
const [first] = names;
|
|
2328
|
+
if (first !== void 0) {
|
|
2329
|
+
setBucket((current) => current === "" ? first : current);
|
|
2330
|
+
}
|
|
2331
|
+
}
|
|
2332
|
+
} catch {
|
|
2333
|
+
}
|
|
2334
|
+
})());
|
|
2335
|
+
return () => {
|
|
2336
|
+
token.cancelled = true;
|
|
2337
|
+
};
|
|
2338
|
+
}, [client]);
|
|
2339
|
+
const storageApi = useMemo(() => {
|
|
2340
|
+
return {
|
|
2341
|
+
list: (options) => client.listStorageObjects({
|
|
2342
|
+
...options,
|
|
2343
|
+
bucket
|
|
2344
|
+
}),
|
|
2345
|
+
remove: (key) => client.deleteStorageObject(key, {
|
|
2346
|
+
bucket
|
|
2347
|
+
}),
|
|
2348
|
+
signedUrl: (key_0, options_0) => client.signedStorageUrl(key_0, {
|
|
2349
|
+
...options_0,
|
|
2350
|
+
bucket
|
|
2351
|
+
}),
|
|
2352
|
+
upload: (options_1) => client.uploadStorageObject({
|
|
2353
|
+
...options_1,
|
|
2354
|
+
bucket
|
|
2355
|
+
})
|
|
2356
|
+
};
|
|
2357
|
+
}, [bucket, client]);
|
|
2358
|
+
const list = useCallback(async (searchPrefix, cursor, append) => {
|
|
2359
|
+
setError(void 0);
|
|
2360
|
+
setBusy(true);
|
|
2361
|
+
try {
|
|
2362
|
+
const page = await storageApi.list({
|
|
2363
|
+
cursor,
|
|
2364
|
+
limit: pageSize,
|
|
2365
|
+
prefix: searchPrefix
|
|
2366
|
+
});
|
|
2367
|
+
setObjects((previous) => append && previous !== void 0 ? [...previous, ...page.objects] : page.objects);
|
|
2368
|
+
setNextCursor(page.cursor);
|
|
2369
|
+
} catch (error_) {
|
|
2370
|
+
if (!append) {
|
|
2371
|
+
setObjects(void 0);
|
|
2372
|
+
}
|
|
2373
|
+
setError(errorMessage(error_));
|
|
2374
|
+
} finally {
|
|
2375
|
+
setBusy(false);
|
|
2376
|
+
}
|
|
2377
|
+
}, [pageSize, storageApi]);
|
|
2378
|
+
useEffect(() => {
|
|
2379
|
+
fireAndForget(list(initialPrefix ?? "", void 0, false));
|
|
2380
|
+
}, [list, initialPrefix]);
|
|
2381
|
+
const onFirstPage = (objects?.length ?? 0) <= pageSize;
|
|
2382
|
+
useAutoRefresh(() => {
|
|
2383
|
+
fireAndForget(list(prefix, void 0, false));
|
|
2384
|
+
}, onFirstPage);
|
|
2385
|
+
const {
|
|
2386
|
+
files,
|
|
2387
|
+
folders
|
|
2388
|
+
} = deriveEntries(objects ?? [], prefix);
|
|
2389
|
+
const tagKeys = useMemo(() => {
|
|
2390
|
+
const keys = /* @__PURE__ */ new Set();
|
|
2391
|
+
for (const file of files) {
|
|
2392
|
+
for (const key_1 of Object.keys(file.customMetadata ?? {})) {
|
|
2393
|
+
keys.add(key_1);
|
|
2394
|
+
}
|
|
2395
|
+
}
|
|
2396
|
+
return [...keys].toSorted((a, b) => a.localeCompare(b));
|
|
2397
|
+
}, [files]);
|
|
2398
|
+
const sortedFiles = sortFiles(files, sortKey, sortDirection);
|
|
2399
|
+
const keysSignature = useMemo(() => [...new Set(sortedFiles.map((file_0) => file_0.key))].toSorted((a_0, b_0) => a_0.localeCompare(b_0)).join("\n"), [sortedFiles]);
|
|
2400
|
+
useEffect(() => {
|
|
2401
|
+
const keys_0 = keysSignature === "" ? [] : keysSignature.split("\n");
|
|
2402
|
+
if (keys_0.length === 0) {
|
|
2403
|
+
setReferences({});
|
|
2404
|
+
return void 0;
|
|
2405
|
+
}
|
|
2406
|
+
const live = {
|
|
2407
|
+
current: true
|
|
2408
|
+
};
|
|
2409
|
+
fireAndForget((async () => {
|
|
2410
|
+
try {
|
|
2411
|
+
const result = await client.query(STORAGE_REFERENCES, {
|
|
2412
|
+
keys: keys_0
|
|
2413
|
+
}, callOptions(referenceShard));
|
|
2414
|
+
if (live.current) {
|
|
2415
|
+
setReferences(result.references ?? {});
|
|
2416
|
+
setHasStorageColumns(Object.keys(result.storageColumns ?? {}).length > 0);
|
|
2417
|
+
}
|
|
2418
|
+
} catch {
|
|
2419
|
+
if (live.current) {
|
|
2420
|
+
setReferences({});
|
|
2421
|
+
setHasStorageColumns(false);
|
|
2422
|
+
}
|
|
2423
|
+
}
|
|
2424
|
+
})());
|
|
2425
|
+
return () => {
|
|
2426
|
+
live.current = false;
|
|
2427
|
+
};
|
|
2428
|
+
}, [client, keysSignature, referenceShard]);
|
|
2429
|
+
const keyOf = (object) => object.key;
|
|
2430
|
+
const {
|
|
2431
|
+
allSelected,
|
|
2432
|
+
clear: clearSelection,
|
|
2433
|
+
selected,
|
|
2434
|
+
someSelected,
|
|
2435
|
+
toggle: toggleSelect,
|
|
2436
|
+
toggleAll: toggleSelectAll
|
|
2437
|
+
} = useKeySelection(sortedFiles, keyOf);
|
|
2438
|
+
const listFirst = () => {
|
|
2439
|
+
setPrefix(draftPrefix);
|
|
2440
|
+
clearSelection();
|
|
2441
|
+
fireAndForget(list(draftPrefix, void 0, false));
|
|
2442
|
+
};
|
|
2443
|
+
const loadMore = () => {
|
|
2444
|
+
fireAndForget(list(prefix, nextCursor, true));
|
|
2445
|
+
};
|
|
2446
|
+
const navigate = (target) => {
|
|
2447
|
+
setPrefix(target);
|
|
2448
|
+
setDraftPrefix(target);
|
|
2449
|
+
clearSelection();
|
|
2450
|
+
fireAndForget(list(target, void 0, false));
|
|
2451
|
+
};
|
|
2452
|
+
const enterFolder = (name) => {
|
|
2453
|
+
navigate(`${prefix}${name}`);
|
|
2454
|
+
};
|
|
2455
|
+
const resolveUrl = (key_2) => storageApi.signedUrl(key_2, {
|
|
2456
|
+
expiresInSeconds: THUMBNAIL_URL_TTL
|
|
2457
|
+
});
|
|
2458
|
+
const showList = () => {
|
|
2459
|
+
setView("list");
|
|
2460
|
+
};
|
|
2461
|
+
const showGrid = () => {
|
|
2462
|
+
setView("grid");
|
|
2463
|
+
};
|
|
2464
|
+
const onSortKeyChange = (key_3) => {
|
|
2465
|
+
setSortKey(key_3);
|
|
2466
|
+
};
|
|
2467
|
+
const toggleSortDirection = () => {
|
|
2468
|
+
setSortDirection((current_0) => current_0 === "asc" ? "desc" : "asc");
|
|
2469
|
+
};
|
|
2470
|
+
const onThumbSizeChange = (size) => {
|
|
2471
|
+
setThumbSize(size);
|
|
2472
|
+
};
|
|
2473
|
+
const onExpiryChange = (seconds) => {
|
|
2474
|
+
setExpiry(seconds);
|
|
2475
|
+
};
|
|
2476
|
+
const bulkDelete = () => {
|
|
2477
|
+
setError(void 0);
|
|
2478
|
+
setBusy(true);
|
|
2479
|
+
fireAndForget((async () => {
|
|
2480
|
+
try {
|
|
2481
|
+
for (const key_4 of selected) {
|
|
2482
|
+
await storageApi.remove(key_4);
|
|
2483
|
+
}
|
|
2484
|
+
await list(prefix, void 0, false);
|
|
2485
|
+
clearSelection();
|
|
2486
|
+
} catch (error__0) {
|
|
2487
|
+
setError(errorMessage(error__0));
|
|
2488
|
+
} finally {
|
|
2489
|
+
setBusy(false);
|
|
2490
|
+
}
|
|
2491
|
+
})());
|
|
2492
|
+
};
|
|
2493
|
+
const onCopy = (key_5) => {
|
|
2494
|
+
setError(void 0);
|
|
2495
|
+
fireAndForget((async () => {
|
|
2496
|
+
try {
|
|
2497
|
+
const url = await storageApi.signedUrl(key_5, {
|
|
2498
|
+
expiresInSeconds: expiry
|
|
2499
|
+
});
|
|
2500
|
+
await copyToClipboard(url);
|
|
2501
|
+
setCopiedKey(key_5);
|
|
2502
|
+
} catch (error__1) {
|
|
2503
|
+
setError(errorMessage(error__1));
|
|
2504
|
+
}
|
|
2505
|
+
})());
|
|
2506
|
+
};
|
|
2507
|
+
const onDownload = (key_6) => {
|
|
2508
|
+
setError(void 0);
|
|
2509
|
+
fireAndForget((async () => {
|
|
2510
|
+
try {
|
|
2511
|
+
const url_0 = await storageApi.signedUrl(key_6, {
|
|
2512
|
+
expiresInSeconds: expiry
|
|
2513
|
+
});
|
|
2514
|
+
const filename = key_6.slice(key_6.lastIndexOf("/") + 1) || key_6;
|
|
2515
|
+
triggerDownload(url_0, filename);
|
|
2516
|
+
} catch (error__2) {
|
|
2517
|
+
setError(errorMessage(error__2));
|
|
2518
|
+
}
|
|
2519
|
+
})());
|
|
2520
|
+
};
|
|
2521
|
+
useEffect(() => {
|
|
2522
|
+
if (copiedKey === void 0) {
|
|
2523
|
+
return void 0;
|
|
2524
|
+
}
|
|
2525
|
+
const timer = globalThis.setTimeout(() => {
|
|
2526
|
+
setCopiedKey(void 0);
|
|
2527
|
+
}, 2e3);
|
|
2528
|
+
return () => {
|
|
2529
|
+
globalThis.clearTimeout(timer);
|
|
2530
|
+
};
|
|
2531
|
+
}, [copiedKey]);
|
|
2532
|
+
const onDelete = (key_7) => {
|
|
2533
|
+
setError(void 0);
|
|
2534
|
+
setBusy(true);
|
|
2535
|
+
fireAndForget((async () => {
|
|
2536
|
+
try {
|
|
2537
|
+
await storageApi.remove(key_7);
|
|
2538
|
+
await list(prefix, void 0, false);
|
|
2539
|
+
} catch (error__3) {
|
|
2540
|
+
setError(errorMessage(error__3));
|
|
2541
|
+
} finally {
|
|
2542
|
+
setBusy(false);
|
|
2543
|
+
}
|
|
2544
|
+
})());
|
|
2545
|
+
};
|
|
2546
|
+
const onFile = (file_1) => {
|
|
2547
|
+
const key_8 = `${prefix}${file_1.name}`;
|
|
2548
|
+
setError(void 0);
|
|
2549
|
+
setBusy(true);
|
|
2550
|
+
fireAndForget((async () => {
|
|
2551
|
+
try {
|
|
2552
|
+
const body = await file_1.arrayBuffer();
|
|
2553
|
+
await storageApi.upload({
|
|
2554
|
+
body,
|
|
2555
|
+
contentType: file_1.type === "" ? void 0 : file_1.type,
|
|
2556
|
+
key: key_8
|
|
2557
|
+
});
|
|
2558
|
+
await list(prefix, void 0, false);
|
|
2559
|
+
} catch (error__4) {
|
|
2560
|
+
setError(errorMessage(error__4));
|
|
2561
|
+
} finally {
|
|
2562
|
+
setBusy(false);
|
|
2563
|
+
}
|
|
2564
|
+
})());
|
|
2565
|
+
};
|
|
2566
|
+
useEffect(() => {
|
|
2567
|
+
setDanglingReferences(void 0);
|
|
2568
|
+
setDanglingTruncated(false);
|
|
2569
|
+
}, [referenceShard]);
|
|
2570
|
+
const checkOrphans = () => {
|
|
2571
|
+
setError(void 0);
|
|
2572
|
+
setDanglingBusy(true);
|
|
2573
|
+
fireAndForget((async () => {
|
|
2574
|
+
try {
|
|
2575
|
+
const liveKeys = [];
|
|
2576
|
+
let cursor_0;
|
|
2577
|
+
do {
|
|
2578
|
+
const page_0 = await storageApi.list({
|
|
2579
|
+
cursor: cursor_0,
|
|
2580
|
+
limit: ORPHAN_LIST_PAGE_SIZE
|
|
2581
|
+
});
|
|
2582
|
+
for (const object_0 of page_0.objects) {
|
|
2583
|
+
liveKeys.push(object_0.key);
|
|
2584
|
+
}
|
|
2585
|
+
cursor_0 = liveKeys.length >= ORPHAN_LIVE_KEY_CAP ? void 0 : page_0.cursor;
|
|
2586
|
+
} while (cursor_0 !== void 0);
|
|
2587
|
+
const enumTruncated = liveKeys.length >= ORPHAN_LIVE_KEY_CAP;
|
|
2588
|
+
if (enumTruncated) {
|
|
2589
|
+
setDanglingReferences([]);
|
|
2590
|
+
setDanglingTruncated(true);
|
|
2591
|
+
} else {
|
|
2592
|
+
const result_0 = await client.query(STORAGE_ORPHANS, {
|
|
2593
|
+
liveKeys
|
|
2594
|
+
}, callOptions(referenceShard));
|
|
2595
|
+
setDanglingReferences(result_0.references ?? []);
|
|
2596
|
+
setDanglingTruncated(result_0.truncated === true);
|
|
2597
|
+
}
|
|
2598
|
+
} catch (error__5) {
|
|
2599
|
+
setDanglingReferences([]);
|
|
2600
|
+
setDanglingTruncated(false);
|
|
2601
|
+
setError(errorMessage(error__5));
|
|
2602
|
+
} finally {
|
|
2603
|
+
setDanglingBusy(false);
|
|
2604
|
+
}
|
|
2605
|
+
})());
|
|
2606
|
+
};
|
|
2607
|
+
const selectBucket = (name_0) => {
|
|
2608
|
+
setBucket(name_0);
|
|
2609
|
+
setPrefix(initialPrefix ?? "");
|
|
2610
|
+
setDraftPrefix(initialPrefix ?? "");
|
|
2611
|
+
setObjects(void 0);
|
|
2612
|
+
clearSelection();
|
|
2613
|
+
};
|
|
2614
|
+
return {
|
|
2615
|
+
allSelected,
|
|
2616
|
+
bucket,
|
|
2617
|
+
buckets,
|
|
2618
|
+
bulkDelete,
|
|
2619
|
+
busy,
|
|
2620
|
+
checkOrphans,
|
|
2621
|
+
clearSelection,
|
|
2622
|
+
copiedKey,
|
|
2623
|
+
danglingBusy,
|
|
2624
|
+
danglingReferences,
|
|
2625
|
+
danglingTruncated,
|
|
2626
|
+
draftPrefix,
|
|
2627
|
+
enterFolder,
|
|
2628
|
+
error,
|
|
2629
|
+
expiry,
|
|
2630
|
+
files: sortedFiles,
|
|
2631
|
+
folders,
|
|
2632
|
+
hasObjects: objects !== void 0 && objects.length > 0,
|
|
2633
|
+
hasStorageColumns,
|
|
2634
|
+
listFirst,
|
|
2635
|
+
loaded: objects !== void 0,
|
|
2636
|
+
loadMore,
|
|
2637
|
+
navigate,
|
|
2638
|
+
nextCursor,
|
|
2639
|
+
onCopy,
|
|
2640
|
+
onDelete,
|
|
2641
|
+
onDownload,
|
|
2642
|
+
onExpiryChange,
|
|
2643
|
+
onFile,
|
|
2644
|
+
onSortKeyChange,
|
|
2645
|
+
onThumbSizeChange,
|
|
2646
|
+
prefix,
|
|
2647
|
+
referenceShard,
|
|
2648
|
+
references,
|
|
2649
|
+
resolveUrl,
|
|
2650
|
+
selectBucket,
|
|
2651
|
+
selected,
|
|
2652
|
+
setDraftPrefix,
|
|
2653
|
+
setReferenceShard,
|
|
2654
|
+
showGrid,
|
|
2655
|
+
showList,
|
|
2656
|
+
someSelected,
|
|
2657
|
+
sortDirection,
|
|
2658
|
+
sortKey,
|
|
2659
|
+
tagKeys,
|
|
2660
|
+
thumbSize,
|
|
2661
|
+
toggleSelect,
|
|
2662
|
+
toggleSelectAll,
|
|
2663
|
+
toggleSortDirection,
|
|
2664
|
+
view
|
|
2665
|
+
};
|
|
2666
|
+
};
|
|
2667
|
+
|
|
2668
|
+
const DEFAULT_PAGE_SIZE = 100;
|
|
2669
|
+
const Crumb = (t0) => {
|
|
2670
|
+
const $ = c(6);
|
|
2671
|
+
const {
|
|
2672
|
+
label,
|
|
2673
|
+
onNavigate,
|
|
2674
|
+
target
|
|
2675
|
+
} = t0;
|
|
2676
|
+
let t1;
|
|
2677
|
+
if ($[0] !== onNavigate || $[1] !== target) {
|
|
2678
|
+
t1 = () => {
|
|
2679
|
+
onNavigate(target);
|
|
2680
|
+
};
|
|
2681
|
+
$[0] = onNavigate;
|
|
2682
|
+
$[1] = target;
|
|
2683
|
+
$[2] = t1;
|
|
2684
|
+
} else {
|
|
2685
|
+
t1 = $[2];
|
|
2686
|
+
}
|
|
2687
|
+
const go = t1;
|
|
2688
|
+
let t2;
|
|
2689
|
+
if ($[3] !== go || $[4] !== label) {
|
|
2690
|
+
t2 = /* @__PURE__ */ jsxDEV("button", {
|
|
2691
|
+
className: "rounded px-1 text-muted-foreground outline-none hover:text-foreground focus-visible:text-foreground",
|
|
2692
|
+
onClick: go,
|
|
2693
|
+
type: "button",
|
|
2694
|
+
children: label
|
|
2695
|
+
}, void 0, false);
|
|
2696
|
+
$[3] = go;
|
|
2697
|
+
$[4] = label;
|
|
2698
|
+
$[5] = t2;
|
|
2699
|
+
} else {
|
|
2700
|
+
t2 = $[5];
|
|
2701
|
+
}
|
|
2702
|
+
return t2;
|
|
2703
|
+
};
|
|
2704
|
+
const Breadcrumbs = (t0) => {
|
|
2705
|
+
const $ = c(11);
|
|
2706
|
+
const {
|
|
2707
|
+
onNavigate,
|
|
2708
|
+
prefix,
|
|
2709
|
+
t
|
|
2710
|
+
} = t0;
|
|
2711
|
+
let t1;
|
|
2712
|
+
if ($[0] !== onNavigate || $[1] !== prefix || $[2] !== t) {
|
|
2713
|
+
const segments = prefix.split("/").filter(_temp);
|
|
2714
|
+
let t2;
|
|
2715
|
+
if ($[4] !== t) {
|
|
2716
|
+
t2 = t("Folder path");
|
|
2717
|
+
$[4] = t;
|
|
2718
|
+
$[5] = t2;
|
|
2719
|
+
} else {
|
|
2720
|
+
t2 = $[5];
|
|
2721
|
+
}
|
|
2722
|
+
let t3;
|
|
2723
|
+
if ($[6] !== t) {
|
|
2724
|
+
t3 = t("root");
|
|
2725
|
+
$[6] = t;
|
|
2726
|
+
$[7] = t3;
|
|
2727
|
+
} else {
|
|
2728
|
+
t3 = $[7];
|
|
2729
|
+
}
|
|
2730
|
+
let t4;
|
|
2731
|
+
if ($[8] !== onNavigate || $[9] !== t3) {
|
|
2732
|
+
t4 = /* @__PURE__ */ jsxDEV(Crumb, {
|
|
2733
|
+
label: t3,
|
|
2734
|
+
onNavigate,
|
|
2735
|
+
target: ""
|
|
2736
|
+
}, void 0, false);
|
|
2737
|
+
$[8] = onNavigate;
|
|
2738
|
+
$[9] = t3;
|
|
2739
|
+
$[10] = t4;
|
|
2740
|
+
} else {
|
|
2741
|
+
t4 = $[10];
|
|
2742
|
+
}
|
|
2743
|
+
t1 = /* @__PURE__ */ jsxDEV("nav", {
|
|
2744
|
+
"aria-label": t2,
|
|
2745
|
+
className: "flex flex-wrap items-center gap-0.5 text-xs",
|
|
2746
|
+
"data-testid": "fb-breadcrumbs",
|
|
2747
|
+
children: [t4, segments.map((segment_0, index) => /* @__PURE__ */ jsxDEV("span", {
|
|
2748
|
+
className: "flex items-center gap-0.5",
|
|
2749
|
+
children: [/* @__PURE__ */ jsxDEV("span", {
|
|
2750
|
+
className: "text-muted-foreground/50",
|
|
2751
|
+
children: "/"
|
|
2752
|
+
}, void 0, false), /* @__PURE__ */ jsxDEV(Crumb, {
|
|
2753
|
+
label: segment_0,
|
|
2754
|
+
onNavigate,
|
|
2755
|
+
target: `${segments.slice(0, index + 1).join("/")}/`
|
|
2756
|
+
}, void 0, false)]
|
|
2757
|
+
}, `${segment_0}-${index.toString()}`, true))]
|
|
2758
|
+
}, void 0, true);
|
|
2759
|
+
$[0] = onNavigate;
|
|
2760
|
+
$[1] = prefix;
|
|
2761
|
+
$[2] = t;
|
|
2762
|
+
$[3] = t1;
|
|
2763
|
+
} else {
|
|
2764
|
+
t1 = $[3];
|
|
2765
|
+
}
|
|
2766
|
+
return t1;
|
|
2767
|
+
};
|
|
2768
|
+
const FileBrowser = ({
|
|
2769
|
+
initialPrefix,
|
|
2770
|
+
pageSize = DEFAULT_PAGE_SIZE
|
|
2771
|
+
}) => {
|
|
2772
|
+
const t = useT();
|
|
2773
|
+
const vm = useFileBrowser({
|
|
2774
|
+
initialPrefix,
|
|
2775
|
+
pageSize
|
|
2776
|
+
});
|
|
2777
|
+
const fileInputRef = useRef(null);
|
|
2778
|
+
const {
|
|
2779
|
+
onCopy,
|
|
2780
|
+
onDelete,
|
|
2781
|
+
onDownload,
|
|
2782
|
+
onFile,
|
|
2783
|
+
toggleSelect
|
|
2784
|
+
} = vm;
|
|
2785
|
+
const handlers = {
|
|
2786
|
+
onCopy,
|
|
2787
|
+
onDelete,
|
|
2788
|
+
onDownload,
|
|
2789
|
+
onToggleSelect: toggleSelect
|
|
2790
|
+
};
|
|
2791
|
+
const onUploadClick = () => {
|
|
2792
|
+
fileInputRef.current?.click();
|
|
2793
|
+
};
|
|
2794
|
+
const onFileChange = (event) => {
|
|
2795
|
+
const input = event.target;
|
|
2796
|
+
const file = input.files?.[0];
|
|
2797
|
+
input.value = "";
|
|
2798
|
+
if (file) {
|
|
2799
|
+
onFile(file);
|
|
2800
|
+
}
|
|
2801
|
+
};
|
|
2802
|
+
const empty = vm.loaded && !vm.hasObjects;
|
|
2803
|
+
return /* @__PURE__ */ jsxDEV("div", {
|
|
2804
|
+
className: "flex flex-col gap-3",
|
|
2805
|
+
"data-testid": "lunora-file-browser",
|
|
2806
|
+
children: [/* @__PURE__ */ jsxDEV(FileBrowserToolbar, {
|
|
2807
|
+
bucket: vm.bucket,
|
|
2808
|
+
buckets: vm.buckets,
|
|
2809
|
+
busy: vm.busy,
|
|
2810
|
+
draftPrefix: vm.draftPrefix,
|
|
2811
|
+
expiry: vm.expiry,
|
|
2812
|
+
fileInputRef,
|
|
2813
|
+
onBucketChange: vm.selectBucket,
|
|
2814
|
+
onExpiryChange: vm.onExpiryChange,
|
|
2815
|
+
onFileChange,
|
|
2816
|
+
onList: vm.listFirst,
|
|
2817
|
+
onPrefixChange: vm.setDraftPrefix,
|
|
2818
|
+
onUploadClick,
|
|
2819
|
+
t
|
|
2820
|
+
}, void 0, false), vm.loaded && /* @__PURE__ */ jsxDEV(Breadcrumbs, {
|
|
2821
|
+
onNavigate: vm.navigate,
|
|
2822
|
+
prefix: vm.prefix,
|
|
2823
|
+
t
|
|
2824
|
+
}, void 0, false), vm.hasObjects && /* @__PURE__ */ jsxDEV(FileBrowserControls, {
|
|
2825
|
+
onSortKeyChange: vm.onSortKeyChange,
|
|
2826
|
+
onThumbSizeChange: vm.onThumbSizeChange,
|
|
2827
|
+
showGrid: vm.showGrid,
|
|
2828
|
+
showList: vm.showList,
|
|
2829
|
+
sortDirection: vm.sortDirection,
|
|
2830
|
+
sortKey: vm.sortKey,
|
|
2831
|
+
t,
|
|
2832
|
+
tagKeys: vm.tagKeys,
|
|
2833
|
+
thumbSize: vm.thumbSize,
|
|
2834
|
+
toggleSortDirection: vm.toggleSortDirection,
|
|
2835
|
+
view: vm.view
|
|
2836
|
+
}, void 0, false), vm.hasStorageColumns && /* @__PURE__ */ jsxDEV("div", {
|
|
2837
|
+
className: "flex flex-wrap items-center gap-2",
|
|
2838
|
+
"data-testid": "fb-references-shard",
|
|
2839
|
+
children: [/* @__PURE__ */ jsxDEV("label", {
|
|
2840
|
+
className: "text-xs text-muted-foreground",
|
|
2841
|
+
htmlFor: "fb-reference-shard-input",
|
|
2842
|
+
children: t("References shard")
|
|
2843
|
+
}, void 0, false), /* @__PURE__ */ jsxDEV(ShardInput, {
|
|
2844
|
+
id: "fb-reference-shard-input",
|
|
2845
|
+
onChange: vm.setReferenceShard,
|
|
2846
|
+
testId: "fb-reference-shard-input",
|
|
2847
|
+
value: vm.referenceShard
|
|
2848
|
+
}, void 0, false), /* @__PURE__ */ jsxDEV("span", {
|
|
2849
|
+
className: "text-xs text-muted-foreground",
|
|
2850
|
+
children: t("Which shard's records are checked for references to these files. Empty = root shard.")
|
|
2851
|
+
}, void 0, false)]
|
|
2852
|
+
}, void 0, true), vm.hasStorageColumns && /* @__PURE__ */ jsxDEV(OrphanedObjectsSection, {
|
|
2853
|
+
busy: vm.danglingBusy,
|
|
2854
|
+
onCheck: vm.checkOrphans,
|
|
2855
|
+
references: vm.danglingReferences,
|
|
2856
|
+
t,
|
|
2857
|
+
truncated: vm.danglingTruncated
|
|
2858
|
+
}, void 0, false), vm.selected.size > 0 && /* @__PURE__ */ jsxDEV(SelectionBar, {
|
|
2859
|
+
count: vm.selected.size,
|
|
2860
|
+
editable: true,
|
|
2861
|
+
onClear: vm.clearSelection,
|
|
2862
|
+
onDelete: vm.bulkDelete
|
|
2863
|
+
}, void 0, false), vm.error !== void 0 && /* @__PURE__ */ jsxDEV("p", {
|
|
2864
|
+
className: "text-sm text-destructive",
|
|
2865
|
+
"data-testid": "storage-error",
|
|
2866
|
+
role: "alert",
|
|
2867
|
+
children: vm.error
|
|
2868
|
+
}, void 0, false), empty && /* @__PURE__ */ jsxDEV(EmptyState, {
|
|
2869
|
+
description: t("Objects you upload to your R2 buckets will appear here."),
|
|
2870
|
+
icon: /* @__PURE__ */ jsxDEV("svg", {
|
|
2871
|
+
"aria-hidden": "true",
|
|
2872
|
+
fill: "none",
|
|
2873
|
+
stroke: "currentColor",
|
|
2874
|
+
strokeLinecap: "round",
|
|
2875
|
+
strokeLinejoin: "round",
|
|
2876
|
+
strokeWidth: 1.6,
|
|
2877
|
+
viewBox: "0 0 24 24",
|
|
2878
|
+
children: [/* @__PURE__ */ jsxDEV("path", {
|
|
2879
|
+
d: "M3 7a2 2 0 0 1 2-2h4l2 2h8a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V7Z"
|
|
2880
|
+
}, void 0, false), /* @__PURE__ */ jsxDEV("path", {
|
|
2881
|
+
d: "M12 11v5m-2.5-2.5h5"
|
|
2882
|
+
}, void 0, false)]
|
|
2883
|
+
}, void 0, true),
|
|
2884
|
+
testId: "fb-empty",
|
|
2885
|
+
title: t("No objects.")
|
|
2886
|
+
}, void 0, false), vm.hasObjects && vm.view === "list" && /* @__PURE__ */ jsxDEV(FileBrowserList, {
|
|
2887
|
+
allSelected: vm.allSelected,
|
|
2888
|
+
busy: vm.busy,
|
|
2889
|
+
copiedKey: vm.copiedKey,
|
|
2890
|
+
files: vm.files,
|
|
2891
|
+
folders: vm.folders,
|
|
2892
|
+
handlers,
|
|
2893
|
+
onEnterFolder: vm.enterFolder,
|
|
2894
|
+
prefix: vm.prefix,
|
|
2895
|
+
references: vm.references,
|
|
2896
|
+
selected: vm.selected,
|
|
2897
|
+
showReferences: vm.hasStorageColumns,
|
|
2898
|
+
someSelected: vm.someSelected,
|
|
2899
|
+
t,
|
|
2900
|
+
toggleSelectAll: vm.toggleSelectAll
|
|
2901
|
+
}, void 0, false), vm.hasObjects && vm.view === "grid" && /* @__PURE__ */ jsxDEV(FileGallery, {
|
|
2902
|
+
busy: vm.busy,
|
|
2903
|
+
copiedKey: vm.copiedKey,
|
|
2904
|
+
files: vm.files,
|
|
2905
|
+
folders: vm.folders,
|
|
2906
|
+
handlers,
|
|
2907
|
+
onEnterFolder: vm.enterFolder,
|
|
2908
|
+
prefix: vm.prefix,
|
|
2909
|
+
references: vm.references,
|
|
2910
|
+
resolveUrl: vm.resolveUrl,
|
|
2911
|
+
selected: vm.selected,
|
|
2912
|
+
showReferences: vm.hasStorageColumns,
|
|
2913
|
+
size: vm.thumbSize,
|
|
2914
|
+
t
|
|
2915
|
+
}, void 0, false), vm.nextCursor !== void 0 && /* @__PURE__ */ jsxDEV("div", {
|
|
2916
|
+
children: /* @__PURE__ */ jsxDEV(Button, {
|
|
2917
|
+
"data-testid": "fb-next",
|
|
2918
|
+
disabled: vm.busy,
|
|
2919
|
+
onClick: vm.loadMore,
|
|
2920
|
+
size: "sm",
|
|
2921
|
+
type: "button",
|
|
2922
|
+
variant: "outline",
|
|
2923
|
+
children: t("Load more")
|
|
2924
|
+
}, void 0, false)
|
|
2925
|
+
}, void 0, false)]
|
|
2926
|
+
}, void 0, true);
|
|
2927
|
+
};
|
|
2928
|
+
function _temp(segment) {
|
|
2929
|
+
return segment !== "";
|
|
2930
|
+
}
|
|
2931
|
+
|
|
2932
|
+
export { FileBrowser };
|