@openrails/contentkit-ui 0.0.0-stage → 0.68.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (367) hide show
  1. package/README.md +425 -2
  2. package/dist/appearance.d.ts +38 -0
  3. package/dist/appearance.js +15 -0
  4. package/dist/appearance.js.map +1 -0
  5. package/dist/assets/hash.worker-BYfo-7MQ.js.map +1 -0
  6. package/dist/client/aspect.d.ts +6 -0
  7. package/dist/client/aspect.js +17 -0
  8. package/dist/client/aspect.js.map +1 -0
  9. package/dist/client/client.d.ts +51 -0
  10. package/dist/client/client.js +35 -0
  11. package/dist/client/client.js.map +1 -0
  12. package/dist/client/codes.d.ts +12 -0
  13. package/dist/client/codes.js +19 -0
  14. package/dist/client/codes.js.map +1 -0
  15. package/dist/client/content/bans.d.ts +15 -0
  16. package/dist/client/content/bans.js +40 -0
  17. package/dist/client/content/bans.js.map +1 -0
  18. package/dist/client/content/comments.d.ts +36 -0
  19. package/dist/client/content/comments.js +93 -0
  20. package/dist/client/content/comments.js.map +1 -0
  21. package/dist/client/content/favorites.d.ts +14 -0
  22. package/dist/client/content/favorites.js +42 -0
  23. package/dist/client/content/favorites.js.map +1 -0
  24. package/dist/client/content/moderation.d.ts +18 -0
  25. package/dist/client/content/moderation.js +37 -0
  26. package/dist/client/content/moderation.js.map +1 -0
  27. package/dist/client/content/polls.d.ts +47 -0
  28. package/dist/client/content/polls.js +148 -0
  29. package/dist/client/content/polls.js.map +1 -0
  30. package/dist/client/content/posts.d.ts +44 -0
  31. package/dist/client/content/posts.js +91 -0
  32. package/dist/client/content/posts.js.map +1 -0
  33. package/dist/client/content/reactions.d.ts +12 -0
  34. package/dist/client/content/reactions.js +36 -0
  35. package/dist/client/content/reactions.js.map +1 -0
  36. package/dist/client/content/types.d.ts +91 -0
  37. package/dist/client/content/types.js +8 -0
  38. package/dist/client/content/types.js.map +1 -0
  39. package/dist/client/crop.d.ts +32 -0
  40. package/dist/client/crop.js +103 -0
  41. package/dist/client/crop.js.map +1 -0
  42. package/dist/client/errors.d.ts +54 -0
  43. package/dist/client/errors.js +80 -0
  44. package/dist/client/errors.js.map +1 -0
  45. package/dist/client/gallery.d.ts +43 -0
  46. package/dist/client/gallery.js +86 -0
  47. package/dist/client/gallery.js.map +1 -0
  48. package/dist/client/generated/error-codes.d.ts +5 -0
  49. package/dist/client/generated/error-codes.js +131 -0
  50. package/dist/client/generated/error-codes.js.map +1 -0
  51. package/dist/client/generated/routes.d.ts +1086 -0
  52. package/dist/client/generated/routes.js +1400 -0
  53. package/dist/client/generated/routes.js.map +1 -0
  54. package/dist/client/generated/wire.d.ts +630 -0
  55. package/dist/client/generated/wire.js +6 -0
  56. package/dist/client/generated/wire.js.map +1 -0
  57. package/dist/client/http.d.ts +79 -0
  58. package/dist/client/http.js +74 -0
  59. package/dist/client/http.js.map +1 -0
  60. package/dist/client/image.d.ts +24 -0
  61. package/dist/client/image.js +65 -0
  62. package/dist/client/image.js.map +1 -0
  63. package/dist/client/index.d.ts +33 -0
  64. package/dist/client/media/api.d.ts +36 -0
  65. package/dist/client/media/api.js +61 -0
  66. package/dist/client/media/api.js.map +1 -0
  67. package/dist/client/media/client.d.ts +247 -0
  68. package/dist/client/media/client.js +407 -0
  69. package/dist/client/media/client.js.map +1 -0
  70. package/dist/client/media/encode.d.ts +3 -0
  71. package/dist/client/media/encode.js +8 -0
  72. package/dist/client/media/encode.js.map +1 -0
  73. package/dist/client/media/hash-stream.d.ts +6 -0
  74. package/dist/client/media/hash-stream.js +16 -0
  75. package/dist/client/media/hash-stream.js.map +1 -0
  76. package/dist/client/media/hash.d.ts +12 -0
  77. package/dist/client/media/hash.js +48 -0
  78. package/dist/client/media/hash.js.map +1 -0
  79. package/dist/client/media/hash.worker-inline.js +18 -0
  80. package/dist/client/media/hash.worker-inline.js.map +1 -0
  81. package/dist/client/media/pacer.d.ts +21 -0
  82. package/dist/client/media/pacer.js +25 -0
  83. package/dist/client/media/pacer.js.map +1 -0
  84. package/dist/client/media/queue.d.ts +112 -0
  85. package/dist/client/media/queue.js +274 -0
  86. package/dist/client/media/queue.js.map +1 -0
  87. package/dist/client/media/ref.d.ts +6 -0
  88. package/dist/client/media/ref.js +10 -0
  89. package/dist/client/media/ref.js.map +1 -0
  90. package/dist/client/media/rules.d.ts +52 -0
  91. package/dist/client/media/rules.js +139 -0
  92. package/dist/client/media/rules.js.map +1 -0
  93. package/dist/client/media/transport.d.ts +13 -0
  94. package/dist/client/media/transport.js +33 -0
  95. package/dist/client/media/transport.js.map +1 -0
  96. package/dist/client/media/windows.d.ts +15 -0
  97. package/dist/client/media/windows.js +39 -0
  98. package/dist/client/media/windows.js.map +1 -0
  99. package/dist/client/playback.d.ts +200 -0
  100. package/dist/client/playback.js +142 -0
  101. package/dist/client/playback.js.map +1 -0
  102. package/dist/client/player.d.ts +102 -0
  103. package/dist/client/player.js +155 -0
  104. package/dist/client/player.js.map +1 -0
  105. package/dist/client/public.d.ts +25 -0
  106. package/dist/client/public.js +18 -0
  107. package/dist/client/public.js.map +1 -0
  108. package/dist/client/rendition.d.ts +19 -0
  109. package/dist/client/rendition.js +16 -0
  110. package/dist/client/rendition.js.map +1 -0
  111. package/dist/client/route.d.ts +39 -0
  112. package/dist/client/route.js +31 -0
  113. package/dist/client/route.js.map +1 -0
  114. package/dist/client/taxonomy.d.ts +30 -0
  115. package/dist/client/taxonomy.js +77 -0
  116. package/dist/client/taxonomy.js.map +1 -0
  117. package/dist/client.js +33 -0
  118. package/dist/components/encode-progress.d.ts +15 -0
  119. package/dist/components/encode-progress.js +49 -0
  120. package/dist/components/encode-progress.js.map +1 -0
  121. package/dist/components/hover-preview.d.ts +29 -0
  122. package/dist/components/hover-preview.js +49 -0
  123. package/dist/components/hover-preview.js.map +1 -0
  124. package/dist/components/image-crop-dialog.d.ts +48 -0
  125. package/dist/components/image-crop-dialog.js +359 -0
  126. package/dist/components/image-crop-dialog.js.map +1 -0
  127. package/dist/components/lazy-mount.d.ts +10 -0
  128. package/dist/components/lazy-mount.js +22 -0
  129. package/dist/components/lazy-mount.js.map +1 -0
  130. package/dist/components/media-folder-editor.d.ts +45 -0
  131. package/dist/components/media-folder-editor.js +564 -0
  132. package/dist/components/media-folder-editor.js.map +1 -0
  133. package/dist/components/media-gallery.d.ts +54 -0
  134. package/dist/components/media-gallery.js +597 -0
  135. package/dist/components/media-gallery.js.map +1 -0
  136. package/dist/components/media-readiness-notice.d.ts +24 -0
  137. package/dist/components/media-readiness-notice.js +61 -0
  138. package/dist/components/media-readiness-notice.js.map +1 -0
  139. package/dist/components/player-controls.d.ts +71 -0
  140. package/dist/components/player-controls.js +264 -0
  141. package/dist/components/player-controls.js.map +1 -0
  142. package/dist/components/progress.d.ts +5 -0
  143. package/dist/components/progress.js +14 -0
  144. package/dist/components/progress.js.map +1 -0
  145. package/dist/components/rendition-img.d.ts +34 -0
  146. package/dist/components/rendition-img.js +78 -0
  147. package/dist/components/rendition-img.js.map +1 -0
  148. package/dist/components/slot-editor.d.ts +95 -0
  149. package/dist/components/slot-editor.js +182 -0
  150. package/dist/components/slot-editor.js.map +1 -0
  151. package/dist/components/slot-image.d.ts +23 -0
  152. package/dist/components/slot-image.js +48 -0
  153. package/dist/components/slot-image.js.map +1 -0
  154. package/dist/components/slot-upload.d.ts +41 -0
  155. package/dist/components/slot-upload.js +213 -0
  156. package/dist/components/slot-upload.js.map +1 -0
  157. package/dist/components/social/bans.d.ts +42 -0
  158. package/dist/components/social/bans.js +300 -0
  159. package/dist/components/social/bans.js.map +1 -0
  160. package/dist/components/social/comments.d.ts +42 -0
  161. package/dist/components/social/comments.js +517 -0
  162. package/dist/components/social/comments.js.map +1 -0
  163. package/dist/components/social/engagement.d.ts +45 -0
  164. package/dist/components/social/engagement.js +129 -0
  165. package/dist/components/social/engagement.js.map +1 -0
  166. package/dist/components/social/index.d.ts +6 -0
  167. package/dist/components/social/moderation.d.ts +32 -0
  168. package/dist/components/social/moderation.js +383 -0
  169. package/dist/components/social/moderation.js.map +1 -0
  170. package/dist/components/social/parts.d.ts +50 -0
  171. package/dist/components/social/parts.js +106 -0
  172. package/dist/components/social/parts.js.map +1 -0
  173. package/dist/components/social/poll-editor.d.ts +34 -0
  174. package/dist/components/social/poll-editor.js +567 -0
  175. package/dist/components/social/poll-editor.js.map +1 -0
  176. package/dist/components/social/poll.d.ts +30 -0
  177. package/dist/components/social/poll.js +252 -0
  178. package/dist/components/social/poll.js.map +1 -0
  179. package/dist/components/sortable-list.d.ts +29 -0
  180. package/dist/components/sortable-list.js +121 -0
  181. package/dist/components/sortable-list.js.map +1 -0
  182. package/dist/components/video-mini-player.d.ts +35 -0
  183. package/dist/components/video-mini-player.js +236 -0
  184. package/dist/components/video-mini-player.js.map +1 -0
  185. package/dist/components/video-player.d.ts +146 -0
  186. package/dist/components/video-player.js +630 -0
  187. package/dist/components/video-player.js.map +1 -0
  188. package/dist/components/video-poster-picker.d.ts +59 -0
  189. package/dist/components/video-poster-picker.js +335 -0
  190. package/dist/components/video-poster-picker.js.map +1 -0
  191. package/dist/components/video-poster.d.ts +24 -0
  192. package/dist/components/video-poster.js +46 -0
  193. package/dist/components/video-poster.js.map +1 -0
  194. package/dist/i18n/context.d.ts +4 -0
  195. package/dist/i18n/context.js +11 -0
  196. package/dist/i18n/context.js.map +1 -0
  197. package/dist/i18n/messages.d.ts +40 -0
  198. package/dist/i18n/messages.js +94 -0
  199. package/dist/i18n/messages.js.map +1 -0
  200. package/dist/index.d.ts +23 -0
  201. package/dist/index.js +41 -0
  202. package/dist/locales/de.d.ts +2 -0
  203. package/dist/locales/de.js +271 -0
  204. package/dist/locales/de.js.map +1 -0
  205. package/dist/locales/en.d.ts +457 -0
  206. package/dist/locales/en.js +271 -0
  207. package/dist/locales/en.js.map +1 -0
  208. package/dist/locales/es.d.ts +2 -0
  209. package/dist/locales/es.js +271 -0
  210. package/dist/locales/es.js.map +1 -0
  211. package/dist/locales/ja.d.ts +2 -0
  212. package/dist/locales/ja.js +271 -0
  213. package/dist/locales/ja.js.map +1 -0
  214. package/dist/locales/ko.d.ts +2 -0
  215. package/dist/locales/ko.js +271 -0
  216. package/dist/locales/ko.js.map +1 -0
  217. package/dist/locales/social/de.d.ts +2 -0
  218. package/dist/locales/social/de.js +198 -0
  219. package/dist/locales/social/de.js.map +1 -0
  220. package/dist/locales/social/en.d.ts +195 -0
  221. package/dist/locales/social/en.js +198 -0
  222. package/dist/locales/social/en.js.map +1 -0
  223. package/dist/locales/social/es.d.ts +2 -0
  224. package/dist/locales/social/es.js +198 -0
  225. package/dist/locales/social/es.js.map +1 -0
  226. package/dist/locales/social/ja.d.ts +2 -0
  227. package/dist/locales/social/ja.js +198 -0
  228. package/dist/locales/social/ja.js.map +1 -0
  229. package/dist/locales/social/ko.d.ts +2 -0
  230. package/dist/locales/social/ko.js +198 -0
  231. package/dist/locales/social/ko.js.map +1 -0
  232. package/dist/locales/social/zh.d.ts +2 -0
  233. package/dist/locales/social/zh.js +198 -0
  234. package/dist/locales/social/zh.js.map +1 -0
  235. package/dist/locales/zh.d.ts +2 -0
  236. package/dist/locales/zh.js +271 -0
  237. package/dist/locales/zh.js.map +1 -0
  238. package/dist/provider.d.ts +22 -0
  239. package/dist/provider.js +59 -0
  240. package/dist/provider.js.map +1 -0
  241. package/dist/react/canonical.d.ts +33 -0
  242. package/dist/react/canonical.js +88 -0
  243. package/dist/react/canonical.js.map +1 -0
  244. package/dist/react/comments.d.ts +82 -0
  245. package/dist/react/comments.js +147 -0
  246. package/dist/react/comments.js.map +1 -0
  247. package/dist/react/config.d.ts +13 -0
  248. package/dist/react/config.js +14 -0
  249. package/dist/react/config.js.map +1 -0
  250. package/dist/react/context.d.ts +48 -0
  251. package/dist/react/context.js +37 -0
  252. package/dist/react/context.js.map +1 -0
  253. package/dist/react/crop.d.ts +49 -0
  254. package/dist/react/crop.js +107 -0
  255. package/dist/react/crop.js.map +1 -0
  256. package/dist/react/engagement.d.ts +38 -0
  257. package/dist/react/engagement.js +88 -0
  258. package/dist/react/engagement.js.map +1 -0
  259. package/dist/react/folder.d.ts +83 -0
  260. package/dist/react/folder.js +183 -0
  261. package/dist/react/folder.js.map +1 -0
  262. package/dist/react/gallery.d.ts +140 -0
  263. package/dist/react/gallery.js +477 -0
  264. package/dist/react/gallery.js.map +1 -0
  265. package/dist/react/index.d.ts +21 -0
  266. package/dist/react/inline-preview.d.ts +24 -0
  267. package/dist/react/inline-preview.js +76 -0
  268. package/dist/react/inline-preview.js.map +1 -0
  269. package/dist/react/player.d.ts +70 -0
  270. package/dist/react/player.js +214 -0
  271. package/dist/react/player.js.map +1 -0
  272. package/dist/react/polls.d.ts +74 -0
  273. package/dist/react/polls.js +176 -0
  274. package/dist/react/polls.js.map +1 -0
  275. package/dist/react/posts.d.ts +59 -0
  276. package/dist/react/posts.js +149 -0
  277. package/dist/react/posts.js.map +1 -0
  278. package/dist/react/provider.d.ts +23 -0
  279. package/dist/react/provider.js +35 -0
  280. package/dist/react/provider.js.map +1 -0
  281. package/dist/react/public.d.ts +39 -0
  282. package/dist/react/public.js +70 -0
  283. package/dist/react/public.js.map +1 -0
  284. package/dist/react/read.d.ts +52 -0
  285. package/dist/react/read.js +143 -0
  286. package/dist/react/read.js.map +1 -0
  287. package/dist/react/resources.d.ts +70 -0
  288. package/dist/react/resources.js +247 -0
  289. package/dist/react/resources.js.map +1 -0
  290. package/dist/react/slot.d.ts +102 -0
  291. package/dist/react/slot.js +181 -0
  292. package/dist/react/slot.js.map +1 -0
  293. package/dist/react/store.d.ts +51 -0
  294. package/dist/react/store.js +164 -0
  295. package/dist/react/store.js.map +1 -0
  296. package/dist/react/upload.d.ts +85 -0
  297. package/dist/react/upload.js +150 -0
  298. package/dist/react/upload.js.map +1 -0
  299. package/dist/react/use-resource.d.ts +43 -0
  300. package/dist/react/use-resource.js +66 -0
  301. package/dist/react/use-resource.js.map +1 -0
  302. package/dist/react/video.d.ts +118 -0
  303. package/dist/react/video.js +184 -0
  304. package/dist/react/video.js.map +1 -0
  305. package/dist/react/viewport.d.ts +19 -0
  306. package/dist/react/viewport.js +30 -0
  307. package/dist/react/viewport.js.map +1 -0
  308. package/dist/react.js +21 -0
  309. package/dist/scope.d.ts +14 -0
  310. package/dist/scope.js +30 -0
  311. package/dist/scope.js.map +1 -0
  312. package/dist/styles.css +3 -0
  313. package/dist/ui/alert-dialog.d.ts +18 -0
  314. package/dist/ui/alert-dialog.js +86 -0
  315. package/dist/ui/alert-dialog.js.map +1 -0
  316. package/dist/ui/alert.d.ts +10 -0
  317. package/dist/ui/alert.js +38 -0
  318. package/dist/ui/alert.js.map +1 -0
  319. package/dist/ui/avatar.d.ts +11 -0
  320. package/dist/ui/avatar.js +31 -0
  321. package/dist/ui/avatar.js.map +1 -0
  322. package/dist/ui/badge.d.ts +7 -0
  323. package/dist/ui/badge.js +31 -0
  324. package/dist/ui/badge.js.map +1 -0
  325. package/dist/ui/button.d.ts +8 -0
  326. package/dist/ui/button.js +46 -0
  327. package/dist/ui/button.js.map +1 -0
  328. package/dist/ui/dialog.d.ts +17 -0
  329. package/dist/ui/dialog.js +91 -0
  330. package/dist/ui/dialog.js.map +1 -0
  331. package/dist/ui/dropdown-menu.d.ts +15 -0
  332. package/dist/ui/dropdown-menu.js +105 -0
  333. package/dist/ui/dropdown-menu.js.map +1 -0
  334. package/dist/ui/input.d.ts +3 -0
  335. package/dist/ui/input.js +17 -0
  336. package/dist/ui/input.js.map +1 -0
  337. package/dist/ui/label.d.ts +3 -0
  338. package/dist/ui/label.js +15 -0
  339. package/dist/ui/label.js.map +1 -0
  340. package/dist/ui/progress.d.ts +7 -0
  341. package/dist/ui/progress.js +31 -0
  342. package/dist/ui/progress.js.map +1 -0
  343. package/dist/ui/select.d.ts +15 -0
  344. package/dist/ui/select.js +98 -0
  345. package/dist/ui/select.js.map +1 -0
  346. package/dist/ui/skeleton.d.ts +2 -0
  347. package/dist/ui/skeleton.js +14 -0
  348. package/dist/ui/skeleton.js.map +1 -0
  349. package/dist/ui/slider.d.ts +3 -0
  350. package/dist/ui/slider.js +35 -0
  351. package/dist/ui/slider.js.map +1 -0
  352. package/dist/ui/switch.d.ts +5 -0
  353. package/dist/ui/switch.js +20 -0
  354. package/dist/ui/switch.js.map +1 -0
  355. package/dist/ui/tabs.d.ts +10 -0
  356. package/dist/ui/tabs.js +47 -0
  357. package/dist/ui/tabs.js.map +1 -0
  358. package/dist/ui/textarea.d.ts +3 -0
  359. package/dist/ui/textarea.js +15 -0
  360. package/dist/ui/textarea.js.map +1 -0
  361. package/dist/ui/toggle-group.d.ts +5 -0
  362. package/dist/ui/toggle-group.js +23 -0
  363. package/dist/ui/toggle-group.js.map +1 -0
  364. package/dist/urls/index.d.ts +100 -0
  365. package/dist/urls.js +118 -0
  366. package/dist/urls.js.map +1 -0
  367. package/package.json +118 -3
@@ -0,0 +1,54 @@
1
+ import { ReactNode } from 'react';
2
+ import { ContentKitUiAppearance } from '../appearance.js';
3
+ import { GalleryItem } from '../client/gallery.js';
4
+ import { GalleryViewOptions, HlsPlayerOptions } from '../react/gallery.js';
5
+ import { PublicPreset } from '../client/public.js';
6
+ import { ContentKitClient } from '../client/client.js';
7
+ import { ReadResult, RefBody } from '../client/generated/wire.js';
8
+ export interface MediaGalleryProps extends GalleryViewOptions, Pick<HlsPlayerOptions, "xhrSetup" | "refresh" | "abr"> {
9
+ /**
10
+ * The item to show, read through the client: its read (refreshed before
11
+ * the URLs expire, after commits), HLS bases, playlist auth and grant
12
+ * refresh. Or pass `read` (and hlsBase, xhrSetup, refresh) yourself.
13
+ */
14
+ item?: RefBody;
15
+ /** With item: only files under this path prefix. */
16
+ prefix?: string;
17
+ /** With item: each audio file's download name signed into its URL. */
18
+ download?: boolean;
19
+ /**
20
+ * The read API result: files in manifest order with this viewer's access
21
+ * (scope it with a prefix). A download read adds each audio file's download.
22
+ * With `refresh`, the gallery reads again shortly before `read.expires`.
23
+ */
24
+ read?: ReadResult | null;
25
+ /** A ladder's HLS folder from the read's `hls` dir: client.media.hlsBase(ref, dir). */
26
+ hlsBase?: (dir: string) => string;
27
+ /** The item's poster (its public preset, or a URL), drawn on the first video. */
28
+ poster?: PublicPreset | string | null;
29
+ /** Where the first video's preview starts, seconds (e.g. the poster's frame); default 10% in. */
30
+ previewStart?: number;
31
+ /** Playable videos preview muted inline (hover, or in view on touch); default the provider's. */
32
+ inlinePreview?: boolean;
33
+ /** The host's unlock call to action, drawn over the locked item. */
34
+ renderLocked?: (locked: {
35
+ count: number;
36
+ videos: number;
37
+ }) => ReactNode;
38
+ /** Below the carousel, for its current item (e.g. downloads). */
39
+ renderDetails?: (item: GalleryItem) => ReactNode;
40
+ /** `sizes` for carousel images. Default "(min-width: 768px) 720px, 100vw". */
41
+ sizes?: string;
42
+ /** Tallest the carousel gets; taller media letterboxes. Default "80svh": every slide at its native aspect, full width, never taller than the screen; "none" lifts it. */
43
+ maxHeight?: string;
44
+ label?: string;
45
+ className?: string;
46
+ appearance?: ContentKitUiAppearance;
47
+ /** Overrides the provider's client (item). */
48
+ client?: ContentKitClient;
49
+ }
50
+ /**
51
+ * A post's images and videos as a swipeable carousel or a tile grid that opens
52
+ * a lightbox, with a view toggle. One item renders alone.
53
+ */
54
+ export declare function MediaGallery(given: MediaGalleryProps): import('react').JSX.Element | null;
@@ -0,0 +1,597 @@
1
+ import { useInlinePreview as e } from "../react/inline-preview.js";
2
+ import { RenditionImg as t } from "./rendition-img.js";
3
+ import { publicRenditions as n } from "../client/public.js";
4
+ import { useMessages as r } from "../i18n/context.js";
5
+ import { ContentKitUiRoot as i, useScopeProps as a } from "../scope.js";
6
+ import { useOptionalContentKitClient as o } from "../react/context.js";
7
+ import { useMediaRead as s } from "../react/read.js";
8
+ import { Button as c } from "../ui/button.js";
9
+ import { formatDuration as l, galleryItems as u, stageAspect as d } from "../client/gallery.js";
10
+ import { useCarousel as f, useGalleryView as p, useHlsPlayer as m, useRefreshBeforeExpiry as h } from "../react/gallery.js";
11
+ import { SpriteFrame as g, VideoPlayer as _, previewStartAt as v } from "./video-player.js";
12
+ import { ToggleGroup as y, ToggleGroupItem as b } from "../ui/toggle-group.js";
13
+ import { useCallback as x, useMemo as S, useState as C } from "react";
14
+ import { Fragment as w, jsx as T, jsxs as E } from "react/jsx-runtime";
15
+ import { cn as D } from "cn";
16
+ import { AlertCircleIcon as O, ArrowLeft01Icon as k, ArrowRight01Icon as A, Cancel01Icon as j, CarouselHorizontalIcon as M, Download01Icon as N, GridViewIcon as P, MusicNote01Icon as F, PlayIcon as I, SquareLock02Icon as L } from "@hugeicons/core-free-icons";
17
+ import { HugeiconsIcon as R } from "@hugeicons/react";
18
+ import { Dialog as z } from "@base-ui/react/dialog";
19
+ //#region src/components/media-gallery.tsx
20
+ function B(e, t) {
21
+ let n = e.items.find((e) => e.kind === "video") === t;
22
+ return {
23
+ poster: n ? e.poster ?? void 0 : void 0,
24
+ start: v(n ? e.previewStart : void 0, t.file.dur)
25
+ };
26
+ }
27
+ var V = (e, t) => t.dir && e.hlsBase ? e.hlsBase(t.dir) : null;
28
+ function H(e) {
29
+ let t = W(e), { read: n, label: a, className: o, appearance: s, view: c, defaultView: l, onViewChange: d, storageKey: f } = t, { t: m } = r(), g = S(() => u(n), [n]);
30
+ h(n?.expires, t.refresh);
31
+ let [_, v] = p({
32
+ view: c,
33
+ defaultView: l,
34
+ onViewChange: d,
35
+ storageKey: f
36
+ }), [x, O] = C(0), [k, A] = C(null);
37
+ if (g.length === 0) return null;
38
+ let j = {
39
+ ...t,
40
+ items: g
41
+ }, N = g.length > 1, F = Math.min(x, g.length - 1), I = N ? _ : "carousel";
42
+ return /* @__PURE__ */ E(i, {
43
+ appearance: s,
44
+ className: D("@container grid gap-2", o),
45
+ "data-ckui": "media-gallery",
46
+ "data-view": I,
47
+ role: "region",
48
+ "aria-label": a ?? m("gallery.label"),
49
+ children: [
50
+ N && /* @__PURE__ */ E("div", {
51
+ className: "flex items-center justify-between gap-2",
52
+ "data-ckui": "gallery-header",
53
+ children: [/* @__PURE__ */ T("span", {
54
+ className: "text-sm text-muted-foreground tabular-nums",
55
+ "data-ckui": "gallery-count",
56
+ children: I === "carousel" ? m("gallery.counter", {
57
+ current: F + 1,
58
+ total: g.length
59
+ }) : null
60
+ }), /* @__PURE__ */ E(y, {
61
+ "aria-label": m("gallery.view"),
62
+ value: [I],
63
+ onValueChange: (e) => e[0] && v(e[0]),
64
+ children: [/* @__PURE__ */ T(b, {
65
+ value: "carousel",
66
+ "aria-label": m("gallery.carousel"),
67
+ title: m("gallery.carousel"),
68
+ children: /* @__PURE__ */ T(R, {
69
+ icon: M,
70
+ strokeWidth: 2
71
+ })
72
+ }), /* @__PURE__ */ T(b, {
73
+ value: "grid",
74
+ "aria-label": m("gallery.grid"),
75
+ title: m("gallery.grid"),
76
+ children: /* @__PURE__ */ T(R, {
77
+ icon: P,
78
+ strokeWidth: 2
79
+ })
80
+ })]
81
+ })]
82
+ }),
83
+ I === "carousel" ? /* @__PURE__ */ E(w, { children: [/* @__PURE__ */ T(G, {
84
+ ctx: j,
85
+ index: F,
86
+ onIndex: O
87
+ }), t.renderDetails?.(g[F])] }) : /* @__PURE__ */ T(ee, {
88
+ ctx: j,
89
+ onOpen: A
90
+ }),
91
+ /* @__PURE__ */ T(re, {
92
+ ctx: j,
93
+ index: k,
94
+ onIndex: A
95
+ })
96
+ ]
97
+ });
98
+ }
99
+ var U = {
100
+ kind: "",
101
+ id: ""
102
+ };
103
+ function W(e) {
104
+ let t = o(e.client);
105
+ if (e.item && !t) throw Error("contentkit-ui: MediaGallery item needs `client` or a <ContentKitProvider>");
106
+ let n = s(e.item ?? U, {
107
+ prefix: e.prefix,
108
+ download: e.download,
109
+ read: e.item ? e.read : null,
110
+ refresh: !1,
111
+ client: t
112
+ }), r = e.item, i = x((e) => t.media.hlsBase(r, e), [t, r]);
113
+ return !r || !t ? e : {
114
+ ...e,
115
+ read: n.read,
116
+ hlsBase: e.hlsBase ?? i,
117
+ xhrSetup: e.xhrSetup ?? t.media.xhrSetup,
118
+ refresh: e.refresh ?? n.refresh
119
+ };
120
+ }
121
+ function G({ ctx: e, index: t, onIndex: n, lightbox: i }) {
122
+ let { t: a } = r(), { items: o } = e, s = f({
123
+ count: o.length,
124
+ index: t,
125
+ onIndexChange: n
126
+ }), { index: c } = s, l = o.length > 1, u = i ? {} : {
127
+ aspectRatio: String(d(o, c)),
128
+ maxHeight: e.maxHeight ?? "80svh"
129
+ };
130
+ return /* @__PURE__ */ E("div", {
131
+ className: D("group/carousel relative outline-none", i ? "size-full" : "grid gap-2"),
132
+ role: l ? "group" : void 0,
133
+ "aria-roledescription": l ? "carousel" : void 0,
134
+ "aria-label": l ? e.label ?? a("gallery.label") : void 0,
135
+ tabIndex: l && !i ? 0 : void 0,
136
+ onKeyDown: l && !i ? s.onKeyDown : void 0,
137
+ "data-ckui": "carousel",
138
+ children: [/* @__PURE__ */ E("div", {
139
+ className: D("relative w-full touch-pan-y overflow-hidden select-none", i ? "h-full" : "rounded-lg bg-muted transition-[aspect-ratio] duration-300 ease-out motion-reduce:transition-none"),
140
+ style: u,
141
+ "data-ckui": "stage",
142
+ ...l ? s.swipe : {},
143
+ children: [/* @__PURE__ */ T("div", {
144
+ className: D("flex h-full", s.dragging ? "transition-none" : "transition-transform duration-300 ease-out motion-reduce:transition-none"),
145
+ style: { transform: `translateX(calc(${-c * 100}% + ${s.offset}px))` },
146
+ children: o.map((t, n) => {
147
+ let r = Math.abs(n - c) <= 1;
148
+ return /* @__PURE__ */ T("div", {
149
+ className: "relative h-full w-full shrink-0 overflow-hidden",
150
+ role: l ? "group" : void 0,
151
+ "aria-roledescription": l ? "slide" : void 0,
152
+ "aria-label": l ? a("gallery.slide", {
153
+ current: n + 1,
154
+ total: o.length
155
+ }) : void 0,
156
+ "aria-hidden": n !== c || void 0,
157
+ inert: n !== c,
158
+ "data-ckui": "slide",
159
+ "data-current": n === c ? "" : void 0,
160
+ children: r && /* @__PURE__ */ T(q, {
161
+ ctx: e,
162
+ item: t,
163
+ position: n,
164
+ active: n === c,
165
+ lightbox: i
166
+ })
167
+ }, t.key);
168
+ })
169
+ }), l && /* @__PURE__ */ E(w, { children: [/* @__PURE__ */ T(K, {
170
+ side: "prev",
171
+ hidden: c === 0,
172
+ last: c === 1,
173
+ onClick: s.prev,
174
+ label: a("gallery.previous"),
175
+ lightbox: i
176
+ }), /* @__PURE__ */ T(K, {
177
+ side: "next",
178
+ hidden: c === o.length - 1,
179
+ last: c === o.length - 2,
180
+ onClick: s.next,
181
+ label: a("gallery.next"),
182
+ lightbox: i
183
+ })] })]
184
+ }), l && !i && o.length <= 12 && /* @__PURE__ */ T("div", {
185
+ className: "flex justify-center gap-0.5",
186
+ "data-ckui": "dots",
187
+ children: o.map((e, t) => /* @__PURE__ */ T("button", {
188
+ type: "button",
189
+ className: "group/dot flex size-4 items-center justify-center rounded-full outline-none focus-visible:ring-2 focus-visible:ring-ring",
190
+ "aria-label": a("gallery.goTo", { index: t + 1 }),
191
+ "aria-current": t === c || void 0,
192
+ onClick: () => s.go(t),
193
+ children: /* @__PURE__ */ T("span", { className: D("size-1.5 rounded-full transition-colors", t === c ? "bg-foreground" : "bg-foreground/25 group-hover/dot:bg-foreground/50") })
194
+ }, e.key))
195
+ })]
196
+ });
197
+ }
198
+ function K({ side: e, hidden: t, last: n, onClick: r, label: i, lightbox: a }) {
199
+ return t ? null : /* @__PURE__ */ T("button", {
200
+ type: "button",
201
+ "aria-label": i,
202
+ "data-ckui": "gallery-nav",
203
+ "data-side": e,
204
+ onClick: (e) => {
205
+ let t = e.currentTarget.closest("[data-ckui=lightbox], [data-ckui=carousel][tabindex]");
206
+ r(), n && document.activeElement === e.currentTarget && t?.focus({ preventScroll: !0 });
207
+ },
208
+ className: D("group/nav absolute top-0 bottom-14 z-10 flex items-center outline-none", a ? "w-16 sm:w-20" : "w-12", e === "prev" ? a ? "left-0 justify-start pl-3 sm:pl-5" : "left-0 justify-start pl-2" : a ? "right-0 justify-end pr-3 sm:pr-5" : "right-0 justify-end pr-2"),
209
+ children: /* @__PURE__ */ T("span", {
210
+ className: D("flex items-center justify-center rounded-full backdrop-blur-sm transition-colors group-focus-visible/nav:ring-3 group-focus-visible/nav:ring-ring/60", a ? "size-10 bg-white/10 text-white group-hover/nav:bg-white/20" : "size-8 bg-white/85 text-zinc-900 shadow-md group-hover/nav:bg-white"),
211
+ children: /* @__PURE__ */ T(R, {
212
+ icon: e === "prev" ? k : A,
213
+ strokeWidth: 2,
214
+ className: "size-4"
215
+ })
216
+ })
217
+ });
218
+ }
219
+ function q({ ctx: e, item: t, position: n, active: i, lightbox: a }) {
220
+ let { t: o } = r();
221
+ if (t.kind === "locked") return /* @__PURE__ */ T(Q, {
222
+ ctx: e,
223
+ item: t
224
+ });
225
+ let s = t.file;
226
+ if (t.kind === "audio") return /* @__PURE__ */ T(J, {
227
+ item: t,
228
+ position: n
229
+ });
230
+ if (t.kind === "image") {
231
+ if (!s.url) return s.failed ? /* @__PURE__ */ T(Y, { file: s }) : /* @__PURE__ */ T(X, { children: o("gallery.processingImage") });
232
+ let r = t.key.startsWith("preview/") && !a ? e.items.find((e) => e.kind === "locked") : void 0;
233
+ return /* @__PURE__ */ E(w, { children: [/* @__PURE__ */ T("img", {
234
+ src: s.url,
235
+ alt: o("gallery.image", { index: n + 1 }),
236
+ width: s.w,
237
+ height: s.h,
238
+ sizes: a ? "100vw" : e.sizes ?? "(min-width: 768px) 720px, 100vw",
239
+ loading: i ? "eager" : "lazy",
240
+ decoding: "async",
241
+ draggable: !1,
242
+ className: "absolute inset-0 size-full object-contain"
243
+ }), r && /* @__PURE__ */ T($, {
244
+ ctx: e,
245
+ item: r
246
+ })] });
247
+ }
248
+ let { poster: c, start: l } = B(e, t);
249
+ return /* @__PURE__ */ T(_, {
250
+ inlinePreview: !a && e.inlinePreview,
251
+ previewStart: l,
252
+ layout: "fill",
253
+ base: V(e, t),
254
+ poster: c,
255
+ width: s.w,
256
+ height: s.h,
257
+ duration: s.dur,
258
+ active: i,
259
+ xhrSetup: e.xhrSetup,
260
+ refresh: e.refresh,
261
+ expires: e.read?.expires,
262
+ abr: e.abr,
263
+ label: o("gallery.video", { index: n + 1 }),
264
+ className: a ? "bg-transparent" : void 0
265
+ });
266
+ }
267
+ function J({ item: e, position: t }) {
268
+ let { t: n } = r(), i = e.file, a = (e.dir ?? i.path).replace(/\/$/, "").split("/").pop(), o = n("gallery.audio", { index: t + 1 });
269
+ return /* @__PURE__ */ E("div", {
270
+ className: "absolute inset-0 flex flex-col items-center justify-center gap-3 bg-muted p-4",
271
+ "data-ckui": "audio",
272
+ children: [
273
+ /* @__PURE__ */ E("div", {
274
+ className: "flex min-w-0 items-center gap-2 text-sm text-muted-foreground",
275
+ children: [
276
+ /* @__PURE__ */ T(R, {
277
+ icon: F,
278
+ className: "size-5 shrink-0",
279
+ strokeWidth: 1.75
280
+ }),
281
+ a && /* @__PURE__ */ T("span", {
282
+ className: "truncate",
283
+ children: a
284
+ }),
285
+ i.dur ? /* @__PURE__ */ T("span", {
286
+ className: "tabular-nums",
287
+ children: l(i.dur)
288
+ }) : null
289
+ ]
290
+ }),
291
+ i.failed ? /* @__PURE__ */ T("p", {
292
+ className: "text-sm text-destructive",
293
+ role: "alert",
294
+ children: n("gallery.failedAudio")
295
+ }) : i.url ? /* @__PURE__ */ T("audio", {
296
+ src: i.url,
297
+ controls: !0,
298
+ preload: "metadata",
299
+ "aria-label": o,
300
+ className: "w-full max-w-md",
301
+ "data-ckui-noswipe": ""
302
+ }) : /* @__PURE__ */ T("p", {
303
+ className: "text-sm text-muted-foreground",
304
+ children: n("gallery.processingAudio")
305
+ }),
306
+ i.download && i.url && /* @__PURE__ */ E("a", {
307
+ href: i.url,
308
+ download: i.download,
309
+ className: "inline-flex items-center gap-1.5 text-sm underline-offset-4 hover:underline",
310
+ "data-ckui-noswipe": "",
311
+ children: [/* @__PURE__ */ T(R, {
312
+ icon: N,
313
+ className: "size-4",
314
+ strokeWidth: 2
315
+ }), n("gallery.download")]
316
+ })
317
+ ]
318
+ });
319
+ }
320
+ function Y({ file: e }) {
321
+ let { t, error: n } = r(), i = e.failed, a = i?.code ? n({
322
+ code: i.code,
323
+ message: i.message,
324
+ details: i.details,
325
+ refusal: !0
326
+ }) : t("gallery.failedImage");
327
+ return /* @__PURE__ */ E("div", {
328
+ className: "absolute inset-0 flex flex-col items-center justify-center gap-2 bg-muted p-4 text-center text-sm text-destructive",
329
+ role: "alert",
330
+ "data-ckui": "image-failed",
331
+ children: [/* @__PURE__ */ T(R, {
332
+ icon: O,
333
+ className: "size-6"
334
+ }), /* @__PURE__ */ T("p", {
335
+ className: "max-w-sm text-balance",
336
+ children: a
337
+ })]
338
+ });
339
+ }
340
+ function X({ children: e }) {
341
+ return /* @__PURE__ */ E("div", {
342
+ className: "absolute inset-0 flex items-center justify-center gap-2 bg-muted text-sm text-muted-foreground",
343
+ children: [/* @__PURE__ */ T("span", {
344
+ "aria-hidden": !0,
345
+ className: "size-4 rounded-full border-2 border-current/30 border-t-current motion-safe:animate-spin"
346
+ }), e]
347
+ });
348
+ }
349
+ function Z(e, t) {
350
+ return t === 1 ? e("gallery.lockedOne") : e("gallery.lockedMany", { count: t });
351
+ }
352
+ function Q({ ctx: e, item: t, tile: n }) {
353
+ let { t: i } = r();
354
+ return /* @__PURE__ */ E("div", {
355
+ className: "absolute inset-0 overflow-hidden bg-muted",
356
+ "data-ckui": "locked",
357
+ children: [t.backdrop && /* @__PURE__ */ T("img", {
358
+ src: t.backdrop,
359
+ alt: "",
360
+ draggable: !1,
361
+ className: "absolute inset-0 size-full scale-110 object-cover blur-xl"
362
+ }), /* @__PURE__ */ E("div", {
363
+ className: D("absolute inset-0 flex flex-col items-center justify-center gap-3 p-4 text-center", t.backdrop ? "bg-black/45 text-white" : "text-foreground"),
364
+ children: [/* @__PURE__ */ T(R, {
365
+ icon: L,
366
+ className: n ? "size-6" : "size-8",
367
+ strokeWidth: 1.75
368
+ }), n ? /* @__PURE__ */ E("span", {
369
+ className: "text-lg font-semibold tabular-nums",
370
+ children: ["+", t.count]
371
+ }) : /* @__PURE__ */ E(w, { children: [/* @__PURE__ */ T("p", {
372
+ className: "text-sm font-medium text-balance",
373
+ children: Z(i, t.count)
374
+ }), e.renderLocked && /* @__PURE__ */ T("div", {
375
+ "data-ckui-noswipe": "",
376
+ children: e.renderLocked({
377
+ count: t.count,
378
+ videos: t.videos
379
+ })
380
+ })] })]
381
+ })]
382
+ });
383
+ }
384
+ function $({ ctx: e, item: t }) {
385
+ let { t: n } = r();
386
+ return /* @__PURE__ */ E("div", {
387
+ className: "absolute inset-x-0 bottom-0 flex flex-wrap items-center justify-between gap-x-3 gap-y-2 bg-linear-to-t from-black/75 via-black/45 to-transparent px-4 pt-10 pb-4 text-white",
388
+ "data-ckui": "locked-bar",
389
+ children: [/* @__PURE__ */ E("span", {
390
+ className: "flex items-center gap-2 text-sm font-medium",
391
+ children: [/* @__PURE__ */ T(R, {
392
+ icon: L,
393
+ className: "size-5 shrink-0",
394
+ strokeWidth: 1.75
395
+ }), Z(n, t.count)]
396
+ }), e.renderLocked && /* @__PURE__ */ T("div", {
397
+ "data-ckui-noswipe": "",
398
+ children: e.renderLocked({
399
+ count: t.count,
400
+ videos: t.videos
401
+ })
402
+ })]
403
+ });
404
+ }
405
+ function ee({ ctx: e, onOpen: t }) {
406
+ let { t: n } = r(), i = e.items.length;
407
+ return /* @__PURE__ */ T("ul", {
408
+ className: D("grid gap-1", i === 2 || i === 4 ? "grid-cols-2" : "grid-cols-2 @md:grid-cols-3"),
409
+ "data-ckui": "grid",
410
+ children: e.items.map((r, a) => /* @__PURE__ */ T("li", { children: /* @__PURE__ */ T(te, {
411
+ ctx: e,
412
+ item: r,
413
+ label: n("gallery.open", {
414
+ index: a + 1,
415
+ total: i
416
+ }),
417
+ onOpen: () => t(a)
418
+ }) }, r.key))
419
+ });
420
+ }
421
+ function te({ ctx: e, item: r, label: i, onOpen: a }) {
422
+ let [o, s] = C(null), c;
423
+ if (r.kind === "locked") c = /* @__PURE__ */ T(Q, {
424
+ ctx: e,
425
+ item: r,
426
+ tile: !0
427
+ });
428
+ else if (r.kind === "audio") c = /* @__PURE__ */ E("span", {
429
+ className: "absolute inset-0 flex flex-col items-center justify-center gap-1 bg-muted text-muted-foreground",
430
+ children: [/* @__PURE__ */ T(R, {
431
+ icon: r.file.failed ? O : F,
432
+ className: D("size-7", r.file.failed && "text-destructive"),
433
+ strokeWidth: 1.75
434
+ }), r.file.dur ? /* @__PURE__ */ T("span", {
435
+ className: "text-[11px] font-medium tabular-nums",
436
+ children: l(r.file.dur)
437
+ }) : null]
438
+ });
439
+ else if (r.kind === "image") c = r.file.url ? /* @__PURE__ */ T("img", {
440
+ src: r.file.url,
441
+ alt: "",
442
+ loading: "lazy",
443
+ decoding: "async",
444
+ draggable: !1,
445
+ className: "absolute inset-0 size-full object-cover transition-transform duration-300 motion-safe:group-hover:scale-[1.03]"
446
+ }) : r.file.failed ? /* @__PURE__ */ T("span", {
447
+ className: "absolute inset-0 flex items-center justify-center bg-muted text-destructive",
448
+ children: /* @__PURE__ */ T(R, {
449
+ icon: O,
450
+ className: "size-6"
451
+ })
452
+ }) : /* @__PURE__ */ T(X, { children: "" });
453
+ else {
454
+ let i = r.file, { poster: a, start: s } = B(e, r), u = typeof a == "string" ? [] : n(a), d = V(e, r);
455
+ c = /* @__PURE__ */ E(w, { children: [
456
+ typeof a == "string" ? /* @__PURE__ */ T("img", {
457
+ src: a,
458
+ alt: "",
459
+ loading: "lazy",
460
+ decoding: "async",
461
+ className: "absolute inset-0 size-full object-cover"
462
+ }) : u.length ? /* @__PURE__ */ T(t, {
463
+ outputs: u,
464
+ loading: "lazy",
465
+ className: "absolute inset-0 size-full object-cover"
466
+ }) : d ? /* @__PURE__ */ T(g, {
467
+ vtt: `${d}sprite.vtt`,
468
+ xhrSetup: e.xhrSetup,
469
+ fit: "cover"
470
+ }) : null,
471
+ d && /* @__PURE__ */ T(ne, {
472
+ ctx: e,
473
+ base: d,
474
+ start: s,
475
+ target: o
476
+ }),
477
+ i.failed ? /* @__PURE__ */ T("span", {
478
+ className: "absolute inset-0 flex items-center justify-center bg-muted text-destructive",
479
+ children: /* @__PURE__ */ T(R, {
480
+ icon: O,
481
+ className: "size-6"
482
+ })
483
+ }) : d ? /* @__PURE__ */ T("span", {
484
+ className: "pointer-events-none absolute top-1/2 left-1/2 flex size-10 -translate-1/2 items-center justify-center rounded-full bg-black/55 text-white backdrop-blur-sm transition-opacity group-hover:opacity-0",
485
+ children: /* @__PURE__ */ T(R, {
486
+ icon: I,
487
+ className: "ml-0.5 size-5 fill-current",
488
+ strokeWidth: 1.5
489
+ })
490
+ }) : /* @__PURE__ */ T(X, { children: "" }),
491
+ i.dur ? /* @__PURE__ */ T("span", {
492
+ className: "pointer-events-none absolute right-1.5 bottom-1.5 rounded bg-black/65 px-1.5 py-0.5 text-[11px] font-medium text-white tabular-nums",
493
+ children: l(i.dur)
494
+ }) : null
495
+ ] });
496
+ }
497
+ return /* @__PURE__ */ T("button", {
498
+ type: "button",
499
+ "aria-label": i,
500
+ onClick: a,
501
+ ref: s,
502
+ className: "group relative block aspect-square w-full overflow-hidden rounded-md bg-muted outline-none focus-visible:ring-3 focus-visible:ring-ring/60",
503
+ "data-ckui": "tile",
504
+ "data-kind": r.kind,
505
+ children: c
506
+ });
507
+ }
508
+ function ne({ ctx: t, base: n, start: r, target: i }) {
509
+ let a = m({
510
+ src: `${n}master.m3u8`,
511
+ xhrSetup: t.xhrSetup,
512
+ refresh: t.refresh,
513
+ expires: t.read?.expires,
514
+ abr: t.abr,
515
+ qualityKey: null
516
+ });
517
+ return e({
518
+ setting: t.inlinePreview,
519
+ available: !0,
520
+ target: i,
521
+ start: () => a.preview(r),
522
+ stop: a.unload
523
+ }), /* @__PURE__ */ T("video", {
524
+ ref: a.ref,
525
+ muted: !0,
526
+ playsInline: !0,
527
+ preload: "none",
528
+ "aria-hidden": !0,
529
+ tabIndex: -1,
530
+ className: D("pointer-events-none absolute inset-0 size-full object-cover opacity-0 transition-opacity duration-300 motion-reduce:transition-none", a.previewing && a.status === "playing" && "opacity-100"),
531
+ "data-ckui": "tile-preview"
532
+ });
533
+ }
534
+ function re({ ctx: e, index: t, onIndex: n }) {
535
+ let { t: i } = r(), o = a(e.appearance), [s, l] = C(t ?? 0), [u, d] = C(t);
536
+ t !== u && (d(t), t !== null && l(t));
537
+ let p = t !== null, m = f({
538
+ count: e.items.length,
539
+ index: s,
540
+ onIndexChange: l
541
+ });
542
+ return /* @__PURE__ */ T(z.Root, {
543
+ open: p,
544
+ onOpenChange: (e) => !e && n(null),
545
+ children: /* @__PURE__ */ E(z.Portal, {
546
+ ...o,
547
+ "data-ckui-theme": "dark",
548
+ children: [/* @__PURE__ */ T(z.Backdrop, { className: "fixed inset-0 z-50 bg-black duration-150 data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0 motion-reduce:animate-none" }), /* @__PURE__ */ E(z.Popup, {
549
+ className: "fixed inset-0 z-50 flex flex-col bg-black text-white outline-none duration-150 data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0 motion-reduce:animate-none",
550
+ "data-ckui": "lightbox",
551
+ onKeyDown: m.onKeyDown,
552
+ children: [
553
+ /* @__PURE__ */ T(z.Title, {
554
+ className: "sr-only",
555
+ children: e.label ?? i("gallery.lightbox")
556
+ }),
557
+ /* @__PURE__ */ E("div", {
558
+ className: "flex h-14 shrink-0 items-center justify-between px-4",
559
+ children: [/* @__PURE__ */ T("span", {
560
+ className: "text-sm text-white/80 tabular-nums",
561
+ children: e.items.length > 1 ? i("gallery.counter", {
562
+ current: s + 1,
563
+ total: e.items.length
564
+ }) : null
565
+ }), /* @__PURE__ */ E(z.Close, {
566
+ render: /* @__PURE__ */ T(c, {
567
+ variant: "ghost",
568
+ size: "icon",
569
+ className: "rounded-full text-white hover:bg-white/10 hover:text-white"
570
+ }),
571
+ children: [/* @__PURE__ */ T(R, {
572
+ icon: j,
573
+ strokeWidth: 2
574
+ }), /* @__PURE__ */ T("span", {
575
+ className: "sr-only",
576
+ children: i("common.close")
577
+ })]
578
+ })]
579
+ }),
580
+ /* @__PURE__ */ T("div", {
581
+ className: "min-h-0 flex-1 pb-4 sm:px-4 sm:pb-6",
582
+ children: p && /* @__PURE__ */ T(G, {
583
+ ctx: e,
584
+ index: s,
585
+ onIndex: l,
586
+ lightbox: !0
587
+ })
588
+ })
589
+ ]
590
+ })]
591
+ })
592
+ });
593
+ }
594
+ //#endregion
595
+ export { H as MediaGallery };
596
+
597
+ //# sourceMappingURL=media-gallery.js.map