@questpie/admin 3.2.3 → 3.2.5

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.
Files changed (244) hide show
  1. package/dist/client/blocks/block-renderer.d.mts +2 -2
  2. package/dist/client/blocks/block-renderer.mjs +164 -339
  3. package/dist/client/components/actions/action-button.mjs +9 -9
  4. package/dist/client/components/actions/action-dialog.mjs +195 -493
  5. package/dist/client/components/actions/confirmation-dialog.mjs +44 -159
  6. package/dist/client/components/actions/header-actions.mjs +73 -165
  7. package/dist/client/components/admin-link.d.mts +2 -2
  8. package/dist/client/components/admin-link.mjs +40 -126
  9. package/dist/client/components/auth/auth-loading.mjs +9 -44
  10. package/dist/client/components/blocks/block-canvas.mjs +31 -95
  11. package/dist/client/components/blocks/block-editor-context.mjs +13 -57
  12. package/dist/client/components/blocks/block-editor-layout.mjs +72 -166
  13. package/dist/client/components/blocks/block-editor-provider.mjs +184 -245
  14. package/dist/client/components/blocks/block-fields-renderer.mjs +54 -229
  15. package/dist/client/components/blocks/block-insert-button.mjs +49 -165
  16. package/dist/client/components/blocks/block-item-menu.mjs +102 -301
  17. package/dist/client/components/blocks/block-item.mjs +136 -370
  18. package/dist/client/components/blocks/block-library-sidebar.mjs +106 -220
  19. package/dist/client/components/blocks/block-tree.mjs +12 -68
  20. package/dist/client/components/blocks/block-type-icon.mjs +14 -56
  21. package/dist/client/components/brand-logo.mjs +35 -149
  22. package/dist/client/components/component-renderer.mjs +42 -118
  23. package/dist/client/components/error-boundary.mjs +14 -58
  24. package/dist/client/components/fields/array-field.mjs +209 -521
  25. package/dist/client/components/fields/asset-preview-field.mjs +41 -141
  26. package/dist/client/components/fields/blocks-field/blocks-field.mjs +60 -156
  27. package/dist/client/components/fields/boolean-field.mjs +29 -59
  28. package/dist/client/components/fields/date-field.mjs +7 -37
  29. package/dist/client/components/fields/datetime-field.mjs +7 -38
  30. package/dist/client/components/fields/email-field.mjs +25 -54
  31. package/dist/client/components/fields/field-wrapper.mjs +30 -105
  32. package/dist/client/components/fields/json-field.mjs +107 -313
  33. package/dist/client/components/fields/locale-badge.mjs +6 -15
  34. package/dist/client/components/fields/number-field.mjs +27 -60
  35. package/dist/client/components/fields/object-array-field.mjs +283 -659
  36. package/dist/client/components/fields/object-field.mjs +165 -633
  37. package/dist/client/components/fields/relation/displays/cards-display.mjs +106 -220
  38. package/dist/client/components/fields/relation/displays/chips-display.mjs +78 -150
  39. package/dist/client/components/fields/relation/displays/grid-display.mjs +92 -186
  40. package/dist/client/components/fields/relation/displays/list-display.mjs +122 -239
  41. package/dist/client/components/fields/relation/displays/table-display.mjs +70 -244
  42. package/dist/client/components/fields/relation/relation-items-display.mjs +30 -126
  43. package/dist/client/components/fields/relation-field.mjs +10 -66
  44. package/dist/client/components/fields/relation-picker.mjs +18 -18
  45. package/dist/client/components/fields/relation-select.mjs +12 -12
  46. package/dist/client/components/fields/rich-text-editor/bubble-menu.mjs +80 -182
  47. package/dist/client/components/fields/rich-text-editor/image-popover.mjs +8 -19
  48. package/dist/client/components/fields/rich-text-editor/image-upload.mjs +13 -29
  49. package/dist/client/components/fields/rich-text-editor/index.mjs +196 -530
  50. package/dist/client/components/fields/rich-text-editor/slash-commands.mjs +61 -111
  51. package/dist/client/components/fields/rich-text-editor/table-controls.mjs +105 -415
  52. package/dist/client/components/fields/rich-text-editor/toolbar.mjs +256 -511
  53. package/dist/client/components/fields/rich-text-field.mjs +14 -53
  54. package/dist/client/components/fields/select-field.mjs +39 -74
  55. package/dist/client/components/fields/text-field.mjs +26 -59
  56. package/dist/client/components/fields/textarea-field.mjs +26 -58
  57. package/dist/client/components/fields/time-field.mjs +7 -35
  58. package/dist/client/components/fields/upload-field.mjs +47 -165
  59. package/dist/client/components/filter-builder/columns-tab.mjs +80 -280
  60. package/dist/client/components/filter-builder/filter-builder-sheet.mjs +197 -540
  61. package/dist/client/components/filter-builder/filters-tab.mjs +96 -386
  62. package/dist/client/components/filter-builder/saved-views-tab.mjs +133 -351
  63. package/dist/client/components/history-sidebar.mjs +306 -611
  64. package/dist/client/components/layout/field-layout-renderer.mjs +106 -254
  65. package/dist/client/components/locale-switcher.mjs +106 -228
  66. package/dist/client/components/media/media-grid.mjs +84 -273
  67. package/dist/client/components/media/media-picker-dialog.mjs +177 -494
  68. package/dist/client/components/preview/live-preview-mode.mjs +240 -438
  69. package/dist/client/components/preview/preview-pane.mjs +22 -22
  70. package/dist/client/components/primitives/asset-preview.mjs +290 -666
  71. package/dist/client/components/primitives/checkbox-input.mjs +9 -35
  72. package/dist/client/components/primitives/date-input.mjs +109 -327
  73. package/dist/client/components/primitives/dropzone.mjs +209 -336
  74. package/dist/client/components/primitives/field-select-control.mjs +12 -80
  75. package/dist/client/components/primitives/number-input.mjs +4 -4
  76. package/dist/client/components/primitives/select-multi.mjs +200 -559
  77. package/dist/client/components/primitives/select-single.mjs +165 -499
  78. package/dist/client/components/primitives/time-input.mjs +43 -117
  79. package/dist/client/components/primitives/toggle-input.mjs +9 -29
  80. package/dist/client/components/sheets/resource-sheet.mjs +61 -70
  81. package/dist/client/components/ui/accordion.mjs +35 -155
  82. package/dist/client/components/ui/alert.mjs +13 -68
  83. package/dist/client/components/ui/badge.mjs +9 -51
  84. package/dist/client/components/ui/button.mjs +8 -54
  85. package/dist/client/components/ui/card.mjs +37 -193
  86. package/dist/client/components/ui/checkbox.mjs +12 -68
  87. package/dist/client/components/ui/command.mjs +48 -219
  88. package/dist/client/components/ui/dialog.mjs +50 -262
  89. package/dist/client/components/ui/drawer.mjs +55 -259
  90. package/dist/client/components/ui/dropdown-menu.mjs +86 -427
  91. package/dist/client/components/ui/empty-state.mjs +28 -98
  92. package/dist/client/components/ui/field.mjs +73 -309
  93. package/dist/client/components/ui/input-group.mjs +42 -167
  94. package/dist/client/components/ui/input.mjs +7 -37
  95. package/dist/client/components/ui/kbd.mjs +6 -36
  96. package/dist/client/components/ui/label.mjs +7 -37
  97. package/dist/client/components/ui/popover.mjs +34 -169
  98. package/dist/client/components/ui/responsive-dialog.mjs +67 -273
  99. package/dist/client/components/ui/scroll-fade.mjs +63 -158
  100. package/dist/client/components/ui/search-input.mjs +33 -100
  101. package/dist/client/components/ui/select.mjs +72 -393
  102. package/dist/client/components/ui/separator.mjs +7 -38
  103. package/dist/client/components/ui/sheet.mjs +49 -269
  104. package/dist/client/components/ui/sidebar.mjs +171 -690
  105. package/dist/client/components/ui/skeleton.mjs +7 -38
  106. package/dist/client/components/ui/sonner.mjs +11 -42
  107. package/dist/client/components/ui/switch.mjs +9 -45
  108. package/dist/client/components/ui/table.mjs +48 -266
  109. package/dist/client/components/ui/tabs.mjs +26 -139
  110. package/dist/client/components/ui/textarea.mjs +6 -32
  111. package/dist/client/components/ui/tooltip.mjs +27 -129
  112. package/dist/client/components/widgets/chart-widget.mjs +174 -522
  113. package/dist/client/components/widgets/progress-widget.mjs +66 -172
  114. package/dist/client/components/widgets/quick-actions-widget.mjs +102 -261
  115. package/dist/client/components/widgets/recent-items-widget.mjs +69 -195
  116. package/dist/client/components/widgets/stats-widget.mjs +41 -175
  117. package/dist/client/components/widgets/table-widget.mjs +9 -9
  118. package/dist/client/components/widgets/timeline-widget.mjs +86 -226
  119. package/dist/client/components/widgets/value-widget.mjs +74 -381
  120. package/dist/client/components/widgets/widget-empty-state.mjs +26 -76
  121. package/dist/client/components/widgets/widget-skeletons.mjs +138 -421
  122. package/dist/client/contexts/focus-context.d.mts +4 -0
  123. package/dist/client/contexts/focus-context.mjs +87 -150
  124. package/dist/client/hooks/typed-hooks.mjs +241 -701
  125. package/dist/client/hooks/use-action.mjs +62 -198
  126. package/dist/client/hooks/use-admin-config.mjs +5 -35
  127. package/dist/client/hooks/use-admin-preferences.mjs +16 -88
  128. package/dist/client/hooks/use-admin-routes.mjs +22 -56
  129. package/dist/client/hooks/use-audit-history.mjs +21 -69
  130. package/dist/client/hooks/use-brand.mjs +1 -9
  131. package/dist/client/hooks/use-collection-fields.mjs +17 -57
  132. package/dist/client/hooks/use-collection-meta.mjs +12 -44
  133. package/dist/client/hooks/use-collection-schema.mjs +10 -33
  134. package/dist/client/hooks/use-collection-validation.mjs +23 -53
  135. package/dist/client/hooks/use-collection.mjs +194 -614
  136. package/dist/client/hooks/use-current-user.mjs +0 -1
  137. package/dist/client/hooks/use-field-hooks.mjs +10 -10
  138. package/dist/client/hooks/use-field-options.mjs +61 -202
  139. package/dist/client/hooks/use-global-fields.mjs +14 -46
  140. package/dist/client/hooks/use-global-meta.mjs +9 -30
  141. package/dist/client/hooks/use-global-schema.mjs +9 -30
  142. package/dist/client/hooks/use-global.mjs +63 -219
  143. package/dist/client/hooks/use-locks.mjs +117 -325
  144. package/dist/client/hooks/use-media-query.mjs +16 -36
  145. package/dist/client/hooks/use-prefill-params.mjs +0 -1
  146. package/dist/client/hooks/use-questpie-query-options.mjs +12 -29
  147. package/dist/client/hooks/use-reactive-fields.mjs +1 -1
  148. package/dist/client/hooks/use-reactive-prop.mjs +65 -223
  149. package/dist/client/hooks/use-realtime-highlight.mjs +51 -114
  150. package/dist/client/hooks/use-saved-views.mjs +22 -103
  151. package/dist/client/hooks/use-search-param-toggle.mjs +28 -79
  152. package/dist/client/hooks/use-search.mjs +31 -143
  153. package/dist/client/hooks/use-server-actions.mjs +18 -50
  154. package/dist/client/hooks/use-server-validation.mjs +72 -166
  155. package/dist/client/hooks/use-server-widget-data.mjs +7 -33
  156. package/dist/client/hooks/use-setup-status.mjs +12 -25
  157. package/dist/client/hooks/use-sidebar-search-param.mjs +33 -78
  158. package/dist/client/hooks/use-transition-stage.mjs +8 -38
  159. package/dist/client/hooks/use-upload.mjs +54 -152
  160. package/dist/client/hooks/use-validation-error-map.mjs +6 -26
  161. package/dist/client/hooks/use-view-state.mjs +187 -437
  162. package/dist/client/i18n/hooks.mjs +65 -197
  163. package/dist/client/lib/render-profiler.mjs +14 -41
  164. package/dist/client/preview/block-scope-context.d.mts +2 -2
  165. package/dist/client/preview/block-scope-context.mjs +14 -36
  166. package/dist/client/preview/diff.mjs +110 -0
  167. package/dist/client/preview/preview-banner.mjs +42 -108
  168. package/dist/client/preview/preview-field.d.mts +4 -4
  169. package/dist/client/preview/preview-field.mjs +166 -409
  170. package/dist/client/preview/use-collection-preview.mjs +135 -201
  171. package/dist/client/runtime/content-locales-provider.mjs +31 -83
  172. package/dist/client/runtime/locale-scope.mjs +22 -63
  173. package/dist/client/runtime/provider.mjs +100 -255
  174. package/dist/client/runtime/translations-provider.mjs +41 -107
  175. package/dist/client/scope/picker.d.mts +2 -2
  176. package/dist/client/scope/picker.mjs +86 -321
  177. package/dist/client/scope/provider.d.mts +2 -2
  178. package/dist/client/scope/provider.mjs +8 -17
  179. package/dist/client/views/auth/accept-invite-form.d.mts +2 -2
  180. package/dist/client/views/auth/accept-invite-form.mjs +121 -412
  181. package/dist/client/views/auth/auth-layout.d.mts +3 -3
  182. package/dist/client/views/auth/auth-layout.mjs +104 -284
  183. package/dist/client/views/auth/forgot-password-form.d.mts +2 -2
  184. package/dist/client/views/auth/forgot-password-form.mjs +94 -325
  185. package/dist/client/views/auth/invite-form.mjs +107 -442
  186. package/dist/client/views/auth/login-form.d.mts +2 -2
  187. package/dist/client/views/auth/login-form.mjs +116 -337
  188. package/dist/client/views/auth/reset-password-form.mjs +128 -453
  189. package/dist/client/views/auth/setup-form.mjs +140 -478
  190. package/dist/client/views/collection/auto-form-fields.mjs +243 -615
  191. package/dist/client/views/collection/bulk-action-toolbar.mjs +212 -400
  192. package/dist/client/views/collection/cells/complex-cells.mjs +183 -611
  193. package/dist/client/views/collection/cells/primitive-cells.mjs +109 -363
  194. package/dist/client/views/collection/cells/relation-cells.mjs +86 -233
  195. package/dist/client/views/collection/cells/shared/asset-thumbnail.mjs +142 -371
  196. package/dist/client/views/collection/cells/shared/relation-chip.mjs +35 -131
  197. package/dist/client/views/collection/cells/upload-cells.mjs +60 -177
  198. package/dist/client/views/collection/columns/build-columns.mjs +8 -48
  199. package/dist/client/views/collection/field-renderer.mjs +11 -24
  200. package/dist/client/views/collection/form-view.mjs +288 -560
  201. package/dist/client/views/collection/table-view.mjs +239 -469
  202. package/dist/client/views/collection/view-skeletons.mjs +112 -237
  203. package/dist/client/views/common/global-search.mjs +241 -543
  204. package/dist/client/views/dashboard/dashboard-grid.mjs +256 -775
  205. package/dist/client/views/dashboard/dashboard-widget.mjs +38 -126
  206. package/dist/client/views/dashboard/widget-card.mjs +61 -269
  207. package/dist/client/views/globals/global-form-view.mjs +478 -1298
  208. package/dist/client/views/layout/admin-layout-provider.mjs +28 -88
  209. package/dist/client/views/layout/admin-layout.mjs +83 -246
  210. package/dist/client/views/layout/admin-router.mjs +457 -1289
  211. package/dist/client/views/layout/admin-sidebar.mjs +510 -1292
  212. package/dist/client/views/layout/admin-theme.mjs +30 -64
  213. package/dist/client/views/layout/admin-view-layout.mjs +40 -144
  214. package/dist/client/views/pages/accept-invite-page.mjs +95 -290
  215. package/dist/client/views/pages/dashboard-page.mjs +11 -57
  216. package/dist/client/views/pages/forgot-password-page.mjs +31 -83
  217. package/dist/client/views/pages/invite-page.mjs +35 -90
  218. package/dist/client/views/pages/login-page.mjs +41 -121
  219. package/dist/client/views/pages/reset-password-page.d.mts +2 -2
  220. package/dist/client/views/pages/reset-password-page.mjs +46 -173
  221. package/dist/client/views/pages/setup-page.d.mts +2 -2
  222. package/dist/client/views/pages/setup-page.mjs +33 -95
  223. package/dist/components/rich-text/rich-text-renderer.d.mts +2 -2
  224. package/dist/components/rich-text/rich-text-renderer.mjs +9 -33
  225. package/dist/server/modules/admin/collections/account.d.mts +50 -50
  226. package/dist/server/modules/admin/collections/admin-locks.d.mts +54 -54
  227. package/dist/server/modules/admin/collections/admin-preferences.d.mts +39 -39
  228. package/dist/server/modules/admin/collections/admin-saved-views.d.mts +47 -47
  229. package/dist/server/modules/admin/collections/apikey.d.mts +68 -68
  230. package/dist/server/modules/admin/collections/assets.d.mts +34 -34
  231. package/dist/server/modules/admin/collections/session.d.mts +42 -42
  232. package/dist/server/modules/admin/collections/user.d.mts +53 -53
  233. package/dist/server/modules/admin/collections/verification.d.mts +36 -36
  234. package/dist/server/modules/admin/index.d.mts +21 -20
  235. package/dist/server/modules/admin/routes/admin-config.d.mts +2 -2
  236. package/dist/server/modules/admin/routes/execute-action.d.mts +9 -9
  237. package/dist/server/modules/admin/routes/locales.d.mts +2 -2
  238. package/dist/server/modules/admin/routes/preview.d.mts +11 -11
  239. package/dist/server/modules/admin/routes/reactive.d.mts +9 -9
  240. package/dist/server/modules/admin/routes/setup.d.mts +7 -7
  241. package/dist/server/modules/admin/routes/translations.d.mts +4 -4
  242. package/dist/server/modules/admin/routes/widget-data.d.mts +5 -5
  243. package/dist/server/modules/admin-preferences/collections/saved-views.d.mts +27 -27
  244. package/package.json +3 -5
@@ -1,7 +1,6 @@
1
1
  import { cn } from "../../lib/utils.mjs";
2
2
  import { Button } from "../ui/button.mjs";
3
3
  import { Skeleton } from "../ui/skeleton.mjs";
4
- import { c } from "react/compiler-runtime";
5
4
  import { Icon } from "@iconify/react";
6
5
  import * as React from "react";
7
6
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
@@ -67,13 +66,7 @@ function getExtension(filename, mimeType) {
67
66
  }
68
67
  return "";
69
68
  }
70
- function AssetPreview(t0) {
71
- const $ = c(154);
72
- const { asset, pendingFile, onRemove, onEdit, loading: t1, progress, disabled: t2, showDragHandle: t3, dragHandleProps, variant: t4, href, onClick, className } = t0;
73
- const loading = t1 === void 0 ? false : t1;
74
- const disabled = t2 === void 0 ? false : t2;
75
- const showDragHandle = t3 === void 0 ? false : t3;
76
- const variant = t4 === void 0 ? "card" : t4;
69
+ function AssetPreview({ asset, pendingFile, onRemove, onEdit, loading = false, progress, disabled = false, showDragHandle = false, dragHandleProps, variant = "card", href, onClick, className }) {
77
70
  const [imageError, setImageError] = React.useState(false);
78
71
  const hasAssetData = !!(asset.filename || asset.url || pendingFile);
79
72
  const isLoadingAsset = loading && !hasAssetData;
@@ -81,232 +74,113 @@ function AssetPreview(t0) {
81
74
  const mimeType = asset.mimeType || pendingFile?.type;
82
75
  const size = asset.size || pendingFile?.size;
83
76
  const isImageType = isImage(mimeType);
84
- let t5;
85
- if ($[0] !== mimeType) {
86
- t5 = getFileIconName(mimeType);
87
- $[0] = mimeType;
88
- $[1] = t5;
89
- } else t5 = $[1];
90
- const fileIconName = t5;
91
- let t6;
92
- if ($[2] !== filename || $[3] !== mimeType) {
93
- t6 = getExtension(filename, mimeType);
94
- $[2] = filename;
95
- $[3] = mimeType;
96
- $[4] = t6;
97
- } else t6 = $[4];
98
- const extension = t6;
99
- let t7;
100
- bb0: {
101
- if (pendingFile && isImageType) {
102
- let t8$1;
103
- if ($[5] !== pendingFile) {
104
- t8$1 = URL.createObjectURL(pendingFile);
105
- $[5] = pendingFile;
106
- $[6] = t8$1;
107
- } else t8$1 = $[6];
108
- t7 = t8$1;
109
- break bb0;
110
- }
111
- if (asset.url && isImageType) {
112
- t7 = asset.url;
113
- break bb0;
114
- }
115
- t7 = null;
116
- }
117
- const thumbnailUrl = t7;
118
- let t8;
119
- let t9;
120
- if ($[7] !== pendingFile || $[8] !== thumbnailUrl) {
121
- t8 = () => () => {
77
+ const fileIconName = getFileIconName(mimeType);
78
+ const extension = getExtension(filename, mimeType);
79
+ const thumbnailUrl = React.useMemo(() => {
80
+ if (pendingFile && isImageType) return URL.createObjectURL(pendingFile);
81
+ if (asset.url && isImageType) return asset.url;
82
+ return null;
83
+ }, [
84
+ pendingFile,
85
+ asset.url,
86
+ isImageType
87
+ ]);
88
+ React.useEffect(() => {
89
+ return () => {
122
90
  if (pendingFile && thumbnailUrl) URL.revokeObjectURL(thumbnailUrl);
123
91
  };
124
- t9 = [pendingFile, thumbnailUrl];
125
- $[7] = pendingFile;
126
- $[8] = thumbnailUrl;
127
- $[9] = t8;
128
- $[10] = t9;
129
- } else {
130
- t8 = $[9];
131
- t9 = $[10];
132
- }
133
- React.useEffect(t8, t9);
92
+ }, [pendingFile, thumbnailUrl]);
134
93
  if (variant === "thumbnail") {
135
- if (isLoadingAsset) {
136
- let t10$2;
137
- if ($[11] !== className) {
138
- t10$2 = cn("aspect-square w-full", className);
139
- $[11] = className;
140
- $[12] = t10$2;
141
- } else t10$2 = $[12];
142
- let t11$2;
143
- if ($[13] !== t10$2) {
144
- t11$2 = /* @__PURE__ */ jsx(Skeleton, { className: t10$2 });
145
- $[13] = t10$2;
146
- $[14] = t11$2;
147
- } else t11$2 = $[14];
148
- return t11$2;
149
- }
150
- const isInteractive = onClick && !disabled && asset.id;
151
- let t10$1;
152
- if ($[15] !== asset.id || $[16] !== isInteractive || $[17] !== onClick) {
153
- t10$1 = isInteractive ? {
154
- role: "button",
155
- tabIndex: 0,
156
- onClick: () => onClick(asset.id),
157
- onKeyDown: (e) => {
158
- if (e.key === "Enter" || e.key === " ") {
159
- e.preventDefault();
160
- onClick(asset.id);
161
- }
94
+ if (isLoadingAsset) return /* @__PURE__ */ jsx(Skeleton, { className: cn("aspect-square w-full", className) });
95
+ const interactiveProps = onClick && !disabled && asset.id ? {
96
+ role: "button",
97
+ tabIndex: 0,
98
+ onClick: () => onClick(asset.id),
99
+ onKeyDown: (e) => {
100
+ if (e.key === "Enter" || e.key === " ") {
101
+ e.preventDefault();
102
+ onClick(asset.id);
162
103
  }
163
- } : {};
164
- $[15] = asset.id;
165
- $[16] = isInteractive;
166
- $[17] = onClick;
167
- $[18] = t10$1;
168
- } else t10$1 = $[18];
169
- const interactiveProps = t10$1;
170
- const t11$1 = disabled && "opacity-60";
171
- const t12$1 = onClick && !disabled && "hover:border-border cursor-pointer";
172
- let t13$1;
173
- if ($[19] !== className || $[20] !== t11$1 || $[21] !== t12$1) {
174
- t13$1 = cn("group relative aspect-square overflow-hidden border", "bg-muted border-border", t11$1, t12$1, className);
175
- $[19] = className;
176
- $[20] = t11$1;
177
- $[21] = t12$1;
178
- $[22] = t13$1;
179
- } else t13$1 = $[22];
180
- let t14$1;
181
- if ($[23] !== asset.alt || $[24] !== fileIconName || $[25] !== filename || $[26] !== imageError || $[27] !== thumbnailUrl) {
182
- t14$1 = thumbnailUrl && !imageError ? /* @__PURE__ */ jsx("img", {
183
- src: thumbnailUrl,
184
- alt: asset.alt || filename,
185
- className: "image-outline h-full w-full object-cover",
186
- onError: () => setImageError(true)
187
- }) : /* @__PURE__ */ jsx("div", {
188
- className: "flex h-full w-full items-center justify-center",
189
- children: /* @__PURE__ */ jsx(Icon, {
190
- icon: fileIconName,
191
- className: "text-muted-foreground size-8"
192
- })
193
- });
194
- $[23] = asset.alt;
195
- $[24] = fileIconName;
196
- $[25] = filename;
197
- $[26] = imageError;
198
- $[27] = thumbnailUrl;
199
- $[28] = t14$1;
200
- } else t14$1 = $[28];
201
- let t15$1;
202
- if ($[29] !== loading || $[30] !== progress) {
203
- t15$1 = loading && /* @__PURE__ */ jsx("div", {
204
- className: "bg-background absolute inset-0 flex items-center justify-center",
205
- children: /* @__PURE__ */ jsxs("div", {
206
- className: "relative",
207
- children: [/* @__PURE__ */ jsx(Icon, {
208
- icon: "ph:spinner-gap",
209
- className: "text-muted-foreground size-6 animate-spin"
210
- }), typeof progress === "number" && /* @__PURE__ */ jsxs("span", {
211
- className: "text-muted-foreground absolute inset-0 flex items-center justify-center text-[10px] font-medium tabular-nums",
212
- children: [progress, "%"]
213
- })]
214
- })
215
- });
216
- $[29] = loading;
217
- $[30] = progress;
218
- $[31] = t15$1;
219
- } else t15$1 = $[31];
220
- let t16$1;
221
- if ($[32] !== disabled || $[33] !== href || $[34] !== loading || $[35] !== onEdit || $[36] !== onRemove) {
222
- t16$1 = !loading && !disabled && (onRemove || onEdit || href) && /* @__PURE__ */ jsxs("div", {
223
- className: "absolute inset-0 flex items-center justify-center gap-1 bg-black/50 opacity-0 transition-opacity group-hover:opacity-100",
224
- children: [
225
- href && /* @__PURE__ */ jsx(Button, {
226
- type: "button",
227
- variant: "secondary",
228
- size: "icon-xs",
229
- nativeButton: false,
230
- render: /* @__PURE__ */ jsx("a", {
231
- href,
232
- onClick: _temp
233
- }),
234
- children: /* @__PURE__ */ jsx(Icon, { icon: "ph:arrow-square-out-bold" })
235
- }),
236
- onEdit && /* @__PURE__ */ jsx(Button, {
237
- type: "button",
238
- variant: "secondary",
239
- size: "icon-xs",
240
- onClick: (e_1) => {
241
- e_1.stopPropagation();
242
- onEdit();
243
- },
244
- children: /* @__PURE__ */ jsx(Icon, { icon: "ph:pencil-bold" })
245
- }),
246
- onRemove && /* @__PURE__ */ jsx(Button, {
247
- type: "button",
248
- variant: "destructive",
249
- size: "icon-xs",
250
- onClick: (e_2) => {
251
- e_2.stopPropagation();
252
- onRemove();
253
- },
254
- children: /* @__PURE__ */ jsx(Icon, { icon: "ph:trash-bold" })
104
+ }
105
+ } : {};
106
+ return /* @__PURE__ */ jsxs("div", {
107
+ className: cn("group relative aspect-square overflow-hidden border", "bg-muted border-border", disabled && "opacity-60", onClick && !disabled && "hover:border-border cursor-pointer", className),
108
+ ...interactiveProps,
109
+ children: [
110
+ thumbnailUrl && !imageError ? /* @__PURE__ */ jsx("img", {
111
+ src: thumbnailUrl,
112
+ alt: asset.alt || filename,
113
+ className: "image-outline h-full w-full object-cover",
114
+ onError: () => setImageError(true)
115
+ }) : /* @__PURE__ */ jsx("div", {
116
+ className: "flex h-full w-full items-center justify-center",
117
+ children: /* @__PURE__ */ jsx(Icon, {
118
+ icon: fileIconName,
119
+ className: "text-muted-foreground size-8"
255
120
  })
256
- ]
257
- });
258
- $[32] = disabled;
259
- $[33] = href;
260
- $[34] = loading;
261
- $[35] = onEdit;
262
- $[36] = onRemove;
263
- $[37] = t16$1;
264
- } else t16$1 = $[37];
265
- let t17$1;
266
- if ($[38] !== interactiveProps || $[39] !== t13$1 || $[40] !== t14$1 || $[41] !== t15$1 || $[42] !== t16$1) {
267
- t17$1 = /* @__PURE__ */ jsxs("div", {
268
- className: t13$1,
269
- ...interactiveProps,
270
- children: [
271
- t14$1,
272
- t15$1,
273
- t16$1
274
- ]
275
- });
276
- $[38] = interactiveProps;
277
- $[39] = t13$1;
278
- $[40] = t14$1;
279
- $[41] = t15$1;
280
- $[42] = t16$1;
281
- $[43] = t17$1;
282
- } else t17$1 = $[43];
283
- return t17$1;
121
+ }),
122
+ loading && /* @__PURE__ */ jsx("div", {
123
+ className: "bg-background absolute inset-0 flex items-center justify-center",
124
+ children: /* @__PURE__ */ jsxs("div", {
125
+ className: "relative",
126
+ children: [/* @__PURE__ */ jsx(Icon, {
127
+ icon: "ph:spinner-gap",
128
+ className: "text-muted-foreground size-6 animate-spin"
129
+ }), typeof progress === "number" && /* @__PURE__ */ jsxs("span", {
130
+ className: "text-muted-foreground absolute inset-0 flex items-center justify-center text-[10px] font-medium tabular-nums",
131
+ children: [progress, "%"]
132
+ })]
133
+ })
134
+ }),
135
+ !loading && !disabled && (onRemove || onEdit || href) && /* @__PURE__ */ jsxs("div", {
136
+ className: "absolute inset-0 flex items-center justify-center gap-1 bg-black/50 opacity-0 transition-opacity group-hover:opacity-100",
137
+ children: [
138
+ href && /* @__PURE__ */ jsx(Button, {
139
+ type: "button",
140
+ variant: "secondary",
141
+ size: "icon-xs",
142
+ nativeButton: false,
143
+ render: /* @__PURE__ */ jsx("a", {
144
+ href,
145
+ onClick: (e) => e.stopPropagation()
146
+ }),
147
+ children: /* @__PURE__ */ jsx(Icon, { icon: "ph:arrow-square-out-bold" })
148
+ }),
149
+ onEdit && /* @__PURE__ */ jsx(Button, {
150
+ type: "button",
151
+ variant: "secondary",
152
+ size: "icon-xs",
153
+ onClick: (e) => {
154
+ e.stopPropagation();
155
+ onEdit();
156
+ },
157
+ children: /* @__PURE__ */ jsx(Icon, { icon: "ph:pencil-bold" })
158
+ }),
159
+ onRemove && /* @__PURE__ */ jsx(Button, {
160
+ type: "button",
161
+ variant: "destructive",
162
+ size: "icon-xs",
163
+ onClick: (e) => {
164
+ e.stopPropagation();
165
+ onRemove();
166
+ },
167
+ children: /* @__PURE__ */ jsx(Icon, { icon: "ph:trash-bold" })
168
+ })
169
+ ]
170
+ })
171
+ ]
172
+ });
284
173
  }
285
174
  if (variant === "compact") {
286
- if (isLoadingAsset) {
287
- let t10$2;
288
- if ($[44] !== className) {
289
- t10$2 = cn("panel-surface flex items-center gap-2 p-2", className);
290
- $[44] = className;
291
- $[45] = t10$2;
292
- } else t10$2 = $[45];
293
- let t11$2;
294
- if ($[46] !== showDragHandle) {
295
- t11$2 = showDragHandle && /* @__PURE__ */ jsx(Skeleton, {
175
+ if (isLoadingAsset) return /* @__PURE__ */ jsxs("div", {
176
+ className: cn("panel-surface flex items-center gap-2 p-2", className),
177
+ children: [
178
+ showDragHandle && /* @__PURE__ */ jsx(Skeleton, {
296
179
  variant: "text",
297
180
  className: "-ml-1 size-4"
298
- });
299
- $[46] = showDragHandle;
300
- $[47] = t11$2;
301
- } else t11$2 = $[47];
302
- let t12$2;
303
- if ($[48] === Symbol.for("react.memo_cache_sentinel")) {
304
- t12$2 = /* @__PURE__ */ jsx(Skeleton, { className: "size-8 shrink-0" });
305
- $[48] = t12$2;
306
- } else t12$2 = $[48];
307
- let t13$2;
308
- if ($[49] === Symbol.for("react.memo_cache_sentinel")) {
309
- t13$2 = /* @__PURE__ */ jsxs("div", {
181
+ }),
182
+ /* @__PURE__ */ jsx(Skeleton, { className: "size-8 shrink-0" }),
183
+ /* @__PURE__ */ jsxs("div", {
310
184
  className: "min-w-0 flex-1 space-y-1.5",
311
185
  children: [/* @__PURE__ */ jsx(Skeleton, {
312
186
  variant: "text",
@@ -315,471 +189,221 @@ function AssetPreview(t0) {
315
189
  variant: "text",
316
190
  className: "h-3 w-16"
317
191
  })]
318
- });
319
- $[49] = t13$2;
320
- } else t13$2 = $[49];
321
- let t14$2;
322
- if ($[50] !== t10$2 || $[51] !== t11$2) {
323
- t14$2 = /* @__PURE__ */ jsxs("div", {
324
- className: t10$2,
192
+ })
193
+ ]
194
+ });
195
+ const compactInteractiveProps = onClick && !disabled && asset.id ? {
196
+ role: "button",
197
+ tabIndex: 0,
198
+ onClick: () => onClick(asset.id),
199
+ onKeyDown: (e) => {
200
+ if (e.key === "Enter" || e.key === " ") {
201
+ e.preventDefault();
202
+ onClick(asset.id);
203
+ }
204
+ }
205
+ } : {};
206
+ return /* @__PURE__ */ jsxs("div", {
207
+ className: cn("panel-surface group flex items-center gap-2 p-2", disabled && "opacity-60", onClick && !disabled && "hover:bg-accent/20 cursor-pointer", className),
208
+ ...compactInteractiveProps,
209
+ children: [
210
+ showDragHandle && /* @__PURE__ */ jsx("button", {
211
+ type: "button",
212
+ className: "text-muted-foreground hover:text-foreground -ml-1 cursor-grab touch-none active:cursor-grabbing",
213
+ ...dragHandleProps,
214
+ children: /* @__PURE__ */ jsx(Icon, {
215
+ icon: "ph:dots-six-vertical-bold",
216
+ className: "size-4"
217
+ })
218
+ }),
219
+ /* @__PURE__ */ jsx("div", {
220
+ className: "bg-muted flex size-8 shrink-0 items-center justify-center overflow-hidden rounded-sm",
221
+ children: thumbnailUrl && !imageError ? /* @__PURE__ */ jsx("img", {
222
+ src: thumbnailUrl,
223
+ alt: asset.alt || filename,
224
+ className: "image-outline h-full w-full object-cover",
225
+ onError: () => setImageError(true)
226
+ }) : /* @__PURE__ */ jsx(Icon, {
227
+ icon: fileIconName,
228
+ className: "text-muted-foreground size-4"
229
+ })
230
+ }),
231
+ /* @__PURE__ */ jsxs("div", {
232
+ className: "min-w-0 flex-1",
233
+ children: [/* @__PURE__ */ jsx("p", {
234
+ className: "truncate text-sm font-medium",
235
+ children: filename
236
+ }), size != null && /* @__PURE__ */ jsx("p", {
237
+ className: "text-muted-foreground text-xs tabular-nums",
238
+ children: formatFileSize(size)
239
+ })]
240
+ }),
241
+ loading && /* @__PURE__ */ jsx(Icon, {
242
+ icon: "ph:spinner-gap",
243
+ className: "text-muted-foreground size-4 shrink-0 animate-spin"
244
+ }),
245
+ !loading && !disabled && (href || onEdit || onRemove) && /* @__PURE__ */ jsxs("div", {
246
+ className: "flex shrink-0 items-center gap-1",
325
247
  children: [
326
- t11$2,
327
- t12$2,
328
- t13$2
248
+ href && /* @__PURE__ */ jsx(Button, {
249
+ type: "button",
250
+ variant: "ghost",
251
+ size: "icon-xs",
252
+ nativeButton: false,
253
+ render: /* @__PURE__ */ jsx("a", {
254
+ href,
255
+ onClick: (e) => e.stopPropagation()
256
+ }),
257
+ children: /* @__PURE__ */ jsx(Icon, { icon: "ph:arrow-square-out-bold" })
258
+ }),
259
+ onEdit && /* @__PURE__ */ jsx(Button, {
260
+ type: "button",
261
+ variant: "ghost",
262
+ size: "icon-xs",
263
+ onClick: (e) => {
264
+ e.stopPropagation();
265
+ onEdit();
266
+ },
267
+ children: /* @__PURE__ */ jsx(Icon, { icon: "ph:pencil-bold" })
268
+ }),
269
+ onRemove && /* @__PURE__ */ jsx(Button, {
270
+ type: "button",
271
+ variant: "ghost",
272
+ size: "icon-xs",
273
+ onClick: (e) => {
274
+ e.stopPropagation();
275
+ onRemove();
276
+ },
277
+ className: "text-destructive hover:text-destructive",
278
+ children: /* @__PURE__ */ jsx(Icon, { icon: "ph:x-bold" })
279
+ })
329
280
  ]
330
- });
331
- $[50] = t10$2;
332
- $[51] = t11$2;
333
- $[52] = t14$2;
334
- } else t14$2 = $[52];
335
- return t14$2;
281
+ })
282
+ ]
283
+ });
284
+ }
285
+ if (isLoadingAsset) return /* @__PURE__ */ jsxs("div", {
286
+ className: cn("panel-surface overflow-hidden", className),
287
+ children: [/* @__PURE__ */ jsx(Skeleton, { className: "aspect-video w-full" }), /* @__PURE__ */ jsxs("div", {
288
+ className: "space-y-1.5 p-3",
289
+ children: [/* @__PURE__ */ jsx(Skeleton, {
290
+ variant: "text",
291
+ className: "h-4 w-3/4"
292
+ }), /* @__PURE__ */ jsx(Skeleton, {
293
+ variant: "text",
294
+ className: "h-3 w-1/2"
295
+ })]
296
+ })]
297
+ });
298
+ const cardInteractiveProps = onClick && !disabled && asset.id ? {
299
+ role: "button",
300
+ tabIndex: 0,
301
+ onClick: () => onClick(asset.id),
302
+ onKeyDown: (e) => {
303
+ if (e.key === "Enter" || e.key === " ") {
304
+ e.preventDefault();
305
+ onClick(asset.id);
306
+ }
336
307
  }
337
- const isCompactInteractive = onClick && !disabled && asset.id;
338
- let t10$1;
339
- if ($[53] !== asset.id || $[54] !== isCompactInteractive || $[55] !== onClick) {
340
- t10$1 = isCompactInteractive ? {
341
- role: "button",
342
- tabIndex: 0,
343
- onClick: () => onClick(asset.id),
344
- onKeyDown: (e_3) => {
345
- if (e_3.key === "Enter" || e_3.key === " ") {
346
- e_3.preventDefault();
347
- onClick(asset.id);
348
- }
349
- }
350
- } : {};
351
- $[53] = asset.id;
352
- $[54] = isCompactInteractive;
353
- $[55] = onClick;
354
- $[56] = t10$1;
355
- } else t10$1 = $[56];
356
- const compactInteractiveProps = t10$1;
357
- const t11$1 = disabled && "opacity-60";
358
- const t12$1 = onClick && !disabled && "hover:bg-accent/20 cursor-pointer";
359
- let t13$1;
360
- if ($[57] !== className || $[58] !== t11$1 || $[59] !== t12$1) {
361
- t13$1 = cn("panel-surface group flex items-center gap-2 p-2", t11$1, t12$1, className);
362
- $[57] = className;
363
- $[58] = t11$1;
364
- $[59] = t12$1;
365
- $[60] = t13$1;
366
- } else t13$1 = $[60];
367
- let t14$1;
368
- if ($[61] !== dragHandleProps || $[62] !== showDragHandle) {
369
- t14$1 = showDragHandle && /* @__PURE__ */ jsx("button", {
308
+ } : {};
309
+ return /* @__PURE__ */ jsxs("div", {
310
+ className: cn("panel-surface group relative overflow-hidden", disabled && "opacity-60", onClick && !disabled && "hover:bg-accent/20 cursor-pointer", className),
311
+ ...cardInteractiveProps,
312
+ children: [
313
+ showDragHandle && /* @__PURE__ */ jsx("button", {
370
314
  type: "button",
371
- className: "text-muted-foreground hover:text-foreground -ml-1 cursor-grab touch-none active:cursor-grabbing",
315
+ className: "text-muted-foreground hover:text-foreground absolute top-2 left-2 z-10 cursor-grab touch-none rounded p-1 active:cursor-grabbing",
372
316
  ...dragHandleProps,
373
317
  children: /* @__PURE__ */ jsx(Icon, {
374
318
  icon: "ph:dots-six-vertical-bold",
375
319
  className: "size-4"
376
320
  })
377
- });
378
- $[61] = dragHandleProps;
379
- $[62] = showDragHandle;
380
- $[63] = t14$1;
381
- } else t14$1 = $[63];
382
- let t15$1;
383
- if ($[64] !== asset.alt || $[65] !== fileIconName || $[66] !== filename || $[67] !== imageError || $[68] !== thumbnailUrl) {
384
- t15$1 = /* @__PURE__ */ jsx("div", {
385
- className: "bg-muted flex size-8 shrink-0 items-center justify-center overflow-hidden rounded-sm",
386
- children: thumbnailUrl && !imageError ? /* @__PURE__ */ jsx("img", {
387
- src: thumbnailUrl,
388
- alt: asset.alt || filename,
389
- className: "image-outline h-full w-full object-cover",
390
- onError: () => setImageError(true)
391
- }) : /* @__PURE__ */ jsx(Icon, {
392
- icon: fileIconName,
393
- className: "text-muted-foreground size-4"
394
- })
395
- });
396
- $[64] = asset.alt;
397
- $[65] = fileIconName;
398
- $[66] = filename;
399
- $[67] = imageError;
400
- $[68] = thumbnailUrl;
401
- $[69] = t15$1;
402
- } else t15$1 = $[69];
403
- let t16$1;
404
- if ($[70] !== filename) {
405
- t16$1 = /* @__PURE__ */ jsx("p", {
406
- className: "truncate text-sm font-medium",
407
- children: filename
408
- });
409
- $[70] = filename;
410
- $[71] = t16$1;
411
- } else t16$1 = $[71];
412
- let t17$1;
413
- if ($[72] !== size) {
414
- t17$1 = size && /* @__PURE__ */ jsx("p", {
415
- className: "text-muted-foreground text-xs tabular-nums",
416
- children: formatFileSize(size)
417
- });
418
- $[72] = size;
419
- $[73] = t17$1;
420
- } else t17$1 = $[73];
421
- let t18$1;
422
- if ($[74] !== t16$1 || $[75] !== t17$1) {
423
- t18$1 = /* @__PURE__ */ jsxs("div", {
424
- className: "min-w-0 flex-1",
425
- children: [t16$1, t17$1]
426
- });
427
- $[74] = t16$1;
428
- $[75] = t17$1;
429
- $[76] = t18$1;
430
- } else t18$1 = $[76];
431
- let t19$1;
432
- if ($[77] !== loading) {
433
- t19$1 = loading && /* @__PURE__ */ jsx(Icon, {
434
- icon: "ph:spinner-gap",
435
- className: "text-muted-foreground size-4 shrink-0 animate-spin"
436
- });
437
- $[77] = loading;
438
- $[78] = t19$1;
439
- } else t19$1 = $[78];
440
- let t20$1;
441
- if ($[79] !== disabled || $[80] !== href || $[81] !== loading || $[82] !== onEdit || $[83] !== onRemove) {
442
- t20$1 = !loading && !disabled && (href || onEdit || onRemove) && /* @__PURE__ */ jsxs("div", {
443
- className: "flex shrink-0 items-center gap-1",
321
+ }),
322
+ /* @__PURE__ */ jsxs("div", {
323
+ className: "bg-muted relative aspect-video w-full",
444
324
  children: [
445
- href && /* @__PURE__ */ jsx(Button, {
325
+ thumbnailUrl && !imageError ? /* @__PURE__ */ jsx("img", {
326
+ src: thumbnailUrl,
327
+ alt: asset.alt || filename,
328
+ className: "image-outline h-full w-full object-contain",
329
+ onError: () => setImageError(true)
330
+ }) : /* @__PURE__ */ jsxs("div", {
331
+ className: "flex h-full w-full flex-col items-center justify-center gap-2",
332
+ children: [/* @__PURE__ */ jsx(Icon, {
333
+ icon: fileIconName,
334
+ className: "text-muted-foreground size-12"
335
+ }), extension && /* @__PURE__ */ jsx("span", {
336
+ className: "item-surface border-border bg-muted text-muted-foreground px-2 py-0.5 text-xs font-medium",
337
+ children: extension
338
+ })]
339
+ }),
340
+ loading && /* @__PURE__ */ jsxs("div", {
341
+ className: "bg-background absolute inset-0 flex flex-col items-center justify-center gap-2",
342
+ children: [/* @__PURE__ */ jsx(Icon, {
343
+ icon: "ph:spinner-gap",
344
+ className: "text-muted-foreground size-8 animate-spin"
345
+ }), typeof progress === "number" && /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsxs("span", {
346
+ className: "text-muted-foreground text-sm font-medium tabular-nums",
347
+ children: [progress, "%"]
348
+ }), /* @__PURE__ */ jsx("div", {
349
+ className: "bg-muted h-1.5 w-24 overflow-hidden rounded-sm",
350
+ children: /* @__PURE__ */ jsx("div", {
351
+ className: "bg-primary h-full rounded-sm transition-[width] duration-300",
352
+ style: { width: `${progress}%` }
353
+ })
354
+ })] })]
355
+ }),
356
+ !loading && !disabled && onRemove && /* @__PURE__ */ jsx(Button, {
446
357
  type: "button",
447
- variant: "ghost",
358
+ variant: "secondary",
448
359
  size: "icon-xs",
360
+ className: "absolute top-2 right-2 opacity-0 transition-opacity group-hover:opacity-100",
361
+ onClick: (e) => {
362
+ e.stopPropagation();
363
+ onRemove();
364
+ },
365
+ children: /* @__PURE__ */ jsx(Icon, { icon: "ph:x-bold" })
366
+ })
367
+ ]
368
+ }),
369
+ /* @__PURE__ */ jsxs("div", {
370
+ className: "border-border flex items-center gap-2 border-t p-2",
371
+ children: [/* @__PURE__ */ jsxs("div", {
372
+ className: "min-w-0 flex-1",
373
+ children: [/* @__PURE__ */ jsx("p", {
374
+ className: "truncate text-sm font-medium",
375
+ title: filename,
376
+ children: filename
377
+ }), /* @__PURE__ */ jsxs("p", {
378
+ className: "text-muted-foreground text-xs tabular-nums",
379
+ children: [formatFileSize(size), mimeType && ` • ${mimeType.split("/")[1]?.toUpperCase()}`]
380
+ })]
381
+ }), !loading && !disabled && (href || onEdit) && /* @__PURE__ */ jsxs("div", {
382
+ className: "flex items-center gap-1",
383
+ children: [href && /* @__PURE__ */ jsx(Button, {
384
+ type: "button",
385
+ variant: "ghost",
386
+ size: "icon-sm",
449
387
  nativeButton: false,
450
388
  render: /* @__PURE__ */ jsx("a", {
451
389
  href,
452
- onClick: _temp2
390
+ onClick: (e) => e.stopPropagation()
453
391
  }),
454
392
  children: /* @__PURE__ */ jsx(Icon, { icon: "ph:arrow-square-out-bold" })
455
- }),
456
- onEdit && /* @__PURE__ */ jsx(Button, {
393
+ }), onEdit && /* @__PURE__ */ jsx(Button, {
457
394
  type: "button",
458
395
  variant: "ghost",
459
- size: "icon-xs",
460
- onClick: (e_5) => {
461
- e_5.stopPropagation();
396
+ size: "icon-sm",
397
+ onClick: (e) => {
398
+ e.stopPropagation();
462
399
  onEdit();
463
400
  },
464
401
  children: /* @__PURE__ */ jsx(Icon, { icon: "ph:pencil-bold" })
465
- }),
466
- onRemove && /* @__PURE__ */ jsx(Button, {
467
- type: "button",
468
- variant: "ghost",
469
- size: "icon-xs",
470
- onClick: (e_6) => {
471
- e_6.stopPropagation();
472
- onRemove();
473
- },
474
- className: "text-destructive hover:text-destructive",
475
- children: /* @__PURE__ */ jsx(Icon, { icon: "ph:x-bold" })
476
- })
477
- ]
478
- });
479
- $[79] = disabled;
480
- $[80] = href;
481
- $[81] = loading;
482
- $[82] = onEdit;
483
- $[83] = onRemove;
484
- $[84] = t20$1;
485
- } else t20$1 = $[84];
486
- let t21$1;
487
- if ($[85] !== compactInteractiveProps || $[86] !== t13$1 || $[87] !== t14$1 || $[88] !== t15$1 || $[89] !== t18$1 || $[90] !== t19$1 || $[91] !== t20$1) {
488
- t21$1 = /* @__PURE__ */ jsxs("div", {
489
- className: t13$1,
490
- ...compactInteractiveProps,
491
- children: [
492
- t14$1,
493
- t15$1,
494
- t18$1,
495
- t19$1,
496
- t20$1
497
- ]
498
- });
499
- $[85] = compactInteractiveProps;
500
- $[86] = t13$1;
501
- $[87] = t14$1;
502
- $[88] = t15$1;
503
- $[89] = t18$1;
504
- $[90] = t19$1;
505
- $[91] = t20$1;
506
- $[92] = t21$1;
507
- } else t21$1 = $[92];
508
- return t21$1;
509
- }
510
- if (isLoadingAsset) {
511
- let t10$1;
512
- if ($[93] !== className) {
513
- t10$1 = cn("panel-surface overflow-hidden", className);
514
- $[93] = className;
515
- $[94] = t10$1;
516
- } else t10$1 = $[94];
517
- let t11$1;
518
- if ($[95] === Symbol.for("react.memo_cache_sentinel")) {
519
- t11$1 = /* @__PURE__ */ jsx(Skeleton, { className: "aspect-video w-full" });
520
- $[95] = t11$1;
521
- } else t11$1 = $[95];
522
- let t12$1;
523
- if ($[96] === Symbol.for("react.memo_cache_sentinel")) {
524
- t12$1 = /* @__PURE__ */ jsxs("div", {
525
- className: "space-y-1.5 p-3",
526
- children: [/* @__PURE__ */ jsx(Skeleton, {
527
- variant: "text",
528
- className: "h-4 w-3/4"
529
- }), /* @__PURE__ */ jsx(Skeleton, {
530
- variant: "text",
531
- className: "h-3 w-1/2"
402
+ })]
532
403
  })]
533
- });
534
- $[96] = t12$1;
535
- } else t12$1 = $[96];
536
- let t13$1;
537
- if ($[97] !== t10$1) {
538
- t13$1 = /* @__PURE__ */ jsxs("div", {
539
- className: t10$1,
540
- children: [t11$1, t12$1]
541
- });
542
- $[97] = t10$1;
543
- $[98] = t13$1;
544
- } else t13$1 = $[98];
545
- return t13$1;
546
- }
547
- const isCardInteractive = onClick && !disabled && asset.id;
548
- let t10;
549
- if ($[99] !== asset.id || $[100] !== isCardInteractive || $[101] !== onClick) {
550
- t10 = isCardInteractive ? {
551
- role: "button",
552
- tabIndex: 0,
553
- onClick: () => onClick(asset.id),
554
- onKeyDown: (e_7) => {
555
- if (e_7.key === "Enter" || e_7.key === " ") {
556
- e_7.preventDefault();
557
- onClick(asset.id);
558
- }
559
- }
560
- } : {};
561
- $[99] = asset.id;
562
- $[100] = isCardInteractive;
563
- $[101] = onClick;
564
- $[102] = t10;
565
- } else t10 = $[102];
566
- const cardInteractiveProps = t10;
567
- const t11 = disabled && "opacity-60";
568
- const t12 = onClick && !disabled && "hover:bg-accent/20 cursor-pointer";
569
- let t13;
570
- if ($[103] !== className || $[104] !== t11 || $[105] !== t12) {
571
- t13 = cn("panel-surface group relative overflow-hidden", t11, t12, className);
572
- $[103] = className;
573
- $[104] = t11;
574
- $[105] = t12;
575
- $[106] = t13;
576
- } else t13 = $[106];
577
- let t14;
578
- if ($[107] !== dragHandleProps || $[108] !== showDragHandle) {
579
- t14 = showDragHandle && /* @__PURE__ */ jsx("button", {
580
- type: "button",
581
- className: "text-muted-foreground hover:text-foreground absolute top-2 left-2 z-10 cursor-grab touch-none rounded p-1 active:cursor-grabbing",
582
- ...dragHandleProps,
583
- children: /* @__PURE__ */ jsx(Icon, {
584
- icon: "ph:dots-six-vertical-bold",
585
- className: "size-4"
586
404
  })
587
- });
588
- $[107] = dragHandleProps;
589
- $[108] = showDragHandle;
590
- $[109] = t14;
591
- } else t14 = $[109];
592
- let t15;
593
- if ($[110] !== asset.alt || $[111] !== extension || $[112] !== fileIconName || $[113] !== filename || $[114] !== imageError || $[115] !== thumbnailUrl) {
594
- t15 = thumbnailUrl && !imageError ? /* @__PURE__ */ jsx("img", {
595
- src: thumbnailUrl,
596
- alt: asset.alt || filename,
597
- className: "image-outline h-full w-full object-contain",
598
- onError: () => setImageError(true)
599
- }) : /* @__PURE__ */ jsxs("div", {
600
- className: "flex h-full w-full flex-col items-center justify-center gap-2",
601
- children: [/* @__PURE__ */ jsx(Icon, {
602
- icon: fileIconName,
603
- className: "text-muted-foreground size-12"
604
- }), extension && /* @__PURE__ */ jsx("span", {
605
- className: "item-surface border-border bg-muted text-muted-foreground px-2 py-0.5 text-xs font-medium",
606
- children: extension
607
- })]
608
- });
609
- $[110] = asset.alt;
610
- $[111] = extension;
611
- $[112] = fileIconName;
612
- $[113] = filename;
613
- $[114] = imageError;
614
- $[115] = thumbnailUrl;
615
- $[116] = t15;
616
- } else t15 = $[116];
617
- let t16;
618
- if ($[117] !== loading || $[118] !== progress) {
619
- t16 = loading && /* @__PURE__ */ jsxs("div", {
620
- className: "bg-background absolute inset-0 flex flex-col items-center justify-center gap-2",
621
- children: [/* @__PURE__ */ jsx(Icon, {
622
- icon: "ph:spinner-gap",
623
- className: "text-muted-foreground size-8 animate-spin"
624
- }), typeof progress === "number" && /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsxs("span", {
625
- className: "text-muted-foreground text-sm font-medium tabular-nums",
626
- children: [progress, "%"]
627
- }), /* @__PURE__ */ jsx("div", {
628
- className: "bg-muted h-1.5 w-24 overflow-hidden rounded-sm",
629
- children: /* @__PURE__ */ jsx("div", {
630
- className: "bg-primary h-full rounded-sm transition-[width] duration-300",
631
- style: { width: `${progress}%` }
632
- })
633
- })] })]
634
- });
635
- $[117] = loading;
636
- $[118] = progress;
637
- $[119] = t16;
638
- } else t16 = $[119];
639
- let t17;
640
- if ($[120] !== disabled || $[121] !== loading || $[122] !== onRemove) {
641
- t17 = !loading && !disabled && onRemove && /* @__PURE__ */ jsx(Button, {
642
- type: "button",
643
- variant: "secondary",
644
- size: "icon-xs",
645
- className: "absolute top-2 right-2 opacity-0 transition-opacity group-hover:opacity-100",
646
- onClick: (e_8) => {
647
- e_8.stopPropagation();
648
- onRemove();
649
- },
650
- children: /* @__PURE__ */ jsx(Icon, { icon: "ph:x-bold" })
651
- });
652
- $[120] = disabled;
653
- $[121] = loading;
654
- $[122] = onRemove;
655
- $[123] = t17;
656
- } else t17 = $[123];
657
- let t18;
658
- if ($[124] !== t15 || $[125] !== t16 || $[126] !== t17) {
659
- t18 = /* @__PURE__ */ jsxs("div", {
660
- className: "bg-muted relative aspect-video w-full",
661
- children: [
662
- t15,
663
- t16,
664
- t17
665
- ]
666
- });
667
- $[124] = t15;
668
- $[125] = t16;
669
- $[126] = t17;
670
- $[127] = t18;
671
- } else t18 = $[127];
672
- let t19;
673
- if ($[128] !== filename) {
674
- t19 = /* @__PURE__ */ jsx("p", {
675
- className: "truncate text-sm font-medium",
676
- title: filename,
677
- children: filename
678
- });
679
- $[128] = filename;
680
- $[129] = t19;
681
- } else t19 = $[129];
682
- let t20;
683
- if ($[130] !== size) {
684
- t20 = formatFileSize(size);
685
- $[130] = size;
686
- $[131] = t20;
687
- } else t20 = $[131];
688
- let t21;
689
- if ($[132] !== mimeType) {
690
- t21 = mimeType && ` • ${mimeType.split("/")[1]?.toUpperCase()}`;
691
- $[132] = mimeType;
692
- $[133] = t21;
693
- } else t21 = $[133];
694
- let t22;
695
- if ($[134] !== t20 || $[135] !== t21) {
696
- t22 = /* @__PURE__ */ jsxs("p", {
697
- className: "text-muted-foreground text-xs tabular-nums",
698
- children: [t20, t21]
699
- });
700
- $[134] = t20;
701
- $[135] = t21;
702
- $[136] = t22;
703
- } else t22 = $[136];
704
- let t23;
705
- if ($[137] !== t19 || $[138] !== t22) {
706
- t23 = /* @__PURE__ */ jsxs("div", {
707
- className: "min-w-0 flex-1",
708
- children: [t19, t22]
709
- });
710
- $[137] = t19;
711
- $[138] = t22;
712
- $[139] = t23;
713
- } else t23 = $[139];
714
- let t24;
715
- if ($[140] !== disabled || $[141] !== href || $[142] !== loading || $[143] !== onEdit) {
716
- t24 = !loading && !disabled && (href || onEdit) && /* @__PURE__ */ jsxs("div", {
717
- className: "flex items-center gap-1",
718
- children: [href && /* @__PURE__ */ jsx(Button, {
719
- type: "button",
720
- variant: "ghost",
721
- size: "icon-sm",
722
- nativeButton: false,
723
- render: /* @__PURE__ */ jsx("a", {
724
- href,
725
- onClick: _temp3
726
- }),
727
- children: /* @__PURE__ */ jsx(Icon, { icon: "ph:arrow-square-out-bold" })
728
- }), onEdit && /* @__PURE__ */ jsx(Button, {
729
- type: "button",
730
- variant: "ghost",
731
- size: "icon-sm",
732
- onClick: (e_10) => {
733
- e_10.stopPropagation();
734
- onEdit();
735
- },
736
- children: /* @__PURE__ */ jsx(Icon, { icon: "ph:pencil-bold" })
737
- })]
738
- });
739
- $[140] = disabled;
740
- $[141] = href;
741
- $[142] = loading;
742
- $[143] = onEdit;
743
- $[144] = t24;
744
- } else t24 = $[144];
745
- let t25;
746
- if ($[145] !== t23 || $[146] !== t24) {
747
- t25 = /* @__PURE__ */ jsxs("div", {
748
- className: "border-border flex items-center gap-2 border-t p-2",
749
- children: [t23, t24]
750
- });
751
- $[145] = t23;
752
- $[146] = t24;
753
- $[147] = t25;
754
- } else t25 = $[147];
755
- let t26;
756
- if ($[148] !== cardInteractiveProps || $[149] !== t13 || $[150] !== t14 || $[151] !== t18 || $[152] !== t25) {
757
- t26 = /* @__PURE__ */ jsxs("div", {
758
- className: t13,
759
- ...cardInteractiveProps,
760
- children: [
761
- t14,
762
- t18,
763
- t25
764
- ]
765
- });
766
- $[148] = cardInteractiveProps;
767
- $[149] = t13;
768
- $[150] = t14;
769
- $[151] = t18;
770
- $[152] = t25;
771
- $[153] = t26;
772
- } else t26 = $[153];
773
- return t26;
774
- }
775
- function _temp3(e_9) {
776
- return e_9.stopPropagation();
777
- }
778
- function _temp2(e_4) {
779
- return e_4.stopPropagation();
780
- }
781
- function _temp(e_0) {
782
- return e_0.stopPropagation();
405
+ ]
406
+ });
783
407
  }
784
408
 
785
409
  //#endregion