@openrails/contentkit-ui 0.85.1 → 0.86.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 (154) hide show
  1. package/README.md +7 -4
  2. package/dist/client/beacons.d.ts +13 -4
  3. package/dist/client/beacons.js +14 -7
  4. package/dist/client/beacons.js.map +1 -1
  5. package/dist/client/client.d.ts +3 -0
  6. package/dist/client/client.js +29 -27
  7. package/dist/client/client.js.map +1 -1
  8. package/dist/client/codes.d.ts +6 -1
  9. package/dist/client/codes.js +4 -1
  10. package/dist/client/codes.js.map +1 -1
  11. package/dist/client/generated/error-codes.js +1 -1
  12. package/dist/client/generated/error-codes.js.map +1 -1
  13. package/dist/client/generated/routes.d.ts +14 -1
  14. package/dist/client/generated/routes.js +17 -1
  15. package/dist/client/generated/routes.js.map +1 -1
  16. package/dist/client/generated/wire.d.ts +29 -0
  17. package/dist/client/generated/wire.js.map +1 -1
  18. package/dist/client/index.d.ts +2 -1
  19. package/dist/client/media/queue.d.ts +4 -2
  20. package/dist/client/media/queue.js +18 -12
  21. package/dist/client/media/queue.js.map +1 -1
  22. package/dist/client/media/rules.d.ts +7 -1
  23. package/dist/client/media/rules.js +27 -21
  24. package/dist/client/media/rules.js.map +1 -1
  25. package/dist/client/stats.d.ts +32 -0
  26. package/dist/client/stats.js +35 -0
  27. package/dist/client/stats.js.map +1 -0
  28. package/dist/client.js +30 -29
  29. package/dist/components/admin/content-manager.js +206 -206
  30. package/dist/components/admin/content-manager.js.map +1 -1
  31. package/dist/components/admin/group-manager.js +71 -70
  32. package/dist/components/admin/group-manager.js.map +1 -1
  33. package/dist/components/admin/media-item-panel.d.ts +24 -7
  34. package/dist/components/admin/media-item-panel.js +209 -197
  35. package/dist/components/admin/media-item-panel.js.map +1 -1
  36. package/dist/components/admin/poll-manager.js +25 -25
  37. package/dist/components/admin/stats-dashboard.d.ts +22 -0
  38. package/dist/components/admin/stats-dashboard.js +257 -0
  39. package/dist/components/admin/stats-dashboard.js.map +1 -0
  40. package/dist/components/content/card.js +42 -42
  41. package/dist/components/content/card.js.map +1 -1
  42. package/dist/components/content/editors.js +455 -427
  43. package/dist/components/content/editors.js.map +1 -1
  44. package/dist/components/content/grid.js +47 -47
  45. package/dist/components/content/index.d.ts +2 -1
  46. package/dist/components/content/listing.js +34 -34
  47. package/dist/components/content/listing.js.map +1 -1
  48. package/dist/components/content/paywall.d.ts +17 -5
  49. package/dist/components/content/paywall.js +115 -100
  50. package/dist/components/content/paywall.js.map +1 -1
  51. package/dist/components/content/reader-stats.d.ts +12 -0
  52. package/dist/components/content/reader-stats.js +47 -0
  53. package/dist/components/content/reader-stats.js.map +1 -0
  54. package/dist/components/groups/banner.js +33 -33
  55. package/dist/components/groups/directory.js +11 -11
  56. package/dist/components/groups/editor.js +293 -293
  57. package/dist/components/groups/editor.js.map +1 -1
  58. package/dist/components/groups/header.js +27 -27
  59. package/dist/components/groups/header.js.map +1 -1
  60. package/dist/components/groups/memberships.js +180 -180
  61. package/dist/components/groups/parts.d.ts +0 -2
  62. package/dist/components/groups/parts.js +9 -27
  63. package/dist/components/groups/parts.js.map +1 -1
  64. package/dist/components/media-folder-editor.js +239 -189
  65. package/dist/components/media-folder-editor.js.map +1 -1
  66. package/dist/components/notifications.js +17 -17
  67. package/dist/components/slot-upload.d.ts +2 -2
  68. package/dist/components/slot-upload.js +84 -79
  69. package/dist/components/slot-upload.js.map +1 -1
  70. package/dist/components/social/bans.js +34 -34
  71. package/dist/components/social/moderation.js +52 -48
  72. package/dist/components/social/moderation.js.map +1 -1
  73. package/dist/components/video-player.d.ts +2 -0
  74. package/dist/components/video-player.js +318 -314
  75. package/dist/components/video-player.js.map +1 -1
  76. package/dist/i18n/context.d.ts +2 -0
  77. package/dist/i18n/context.js +23 -5
  78. package/dist/i18n/context.js.map +1 -1
  79. package/dist/index.d.ts +2 -1
  80. package/dist/index.js +12 -10
  81. package/dist/locales/admin/de.js +27 -0
  82. package/dist/locales/admin/de.js.map +1 -1
  83. package/dist/locales/admin/en.d.ts +27 -0
  84. package/dist/locales/admin/en.js +27 -0
  85. package/dist/locales/admin/en.js.map +1 -1
  86. package/dist/locales/admin/es.js +27 -0
  87. package/dist/locales/admin/es.js.map +1 -1
  88. package/dist/locales/admin/ja.js +27 -0
  89. package/dist/locales/admin/ja.js.map +1 -1
  90. package/dist/locales/admin/ko.js +27 -0
  91. package/dist/locales/admin/ko.js.map +1 -1
  92. package/dist/locales/admin/zh.js +27 -0
  93. package/dist/locales/admin/zh.js.map +1 -1
  94. package/dist/locales/content/de.js +6 -0
  95. package/dist/locales/content/de.js.map +1 -1
  96. package/dist/locales/content/en.d.ts +6 -0
  97. package/dist/locales/content/en.js +6 -0
  98. package/dist/locales/content/en.js.map +1 -1
  99. package/dist/locales/content/es.js +6 -0
  100. package/dist/locales/content/es.js.map +1 -1
  101. package/dist/locales/content/ja.js +6 -0
  102. package/dist/locales/content/ja.js.map +1 -1
  103. package/dist/locales/content/ko.js +6 -0
  104. package/dist/locales/content/ko.js.map +1 -1
  105. package/dist/locales/content/zh.js +6 -0
  106. package/dist/locales/content/zh.js.map +1 -1
  107. package/dist/locales/de.js +1 -0
  108. package/dist/locales/de.js.map +1 -1
  109. package/dist/locales/en.d.ts +34 -0
  110. package/dist/locales/en.js +1 -0
  111. package/dist/locales/en.js.map +1 -1
  112. package/dist/locales/es.js +1 -0
  113. package/dist/locales/es.js.map +1 -1
  114. package/dist/locales/ja.js +1 -0
  115. package/dist/locales/ja.js.map +1 -1
  116. package/dist/locales/ko.js +1 -0
  117. package/dist/locales/ko.js.map +1 -1
  118. package/dist/locales/zh.js +1 -0
  119. package/dist/locales/zh.js.map +1 -1
  120. package/dist/react/admin.js +22 -23
  121. package/dist/react/admin.js.map +1 -1
  122. package/dist/react/canonical.d.ts +4 -3
  123. package/dist/react/canonical.js +34 -33
  124. package/dist/react/canonical.js.map +1 -1
  125. package/dist/react/contents.js +144 -144
  126. package/dist/react/contents.js.map +1 -1
  127. package/dist/react/detail.d.ts +12 -6
  128. package/dist/react/detail.js +31 -24
  129. package/dist/react/detail.js.map +1 -1
  130. package/dist/react/folder.d.ts +7 -2
  131. package/dist/react/folder.js +165 -147
  132. package/dist/react/folder.js.map +1 -1
  133. package/dist/react/groups.d.ts +0 -1
  134. package/dist/react/groups.js +13 -12
  135. package/dist/react/groups.js.map +1 -1
  136. package/dist/react/index.d.ts +4 -2
  137. package/dist/react/location.d.ts +11 -0
  138. package/dist/react/location.js +18 -0
  139. package/dist/react/location.js.map +1 -0
  140. package/dist/react/public.d.ts +8 -0
  141. package/dist/react/public.js +32 -27
  142. package/dist/react/public.js.map +1 -1
  143. package/dist/react/stats.d.ts +24 -0
  144. package/dist/react/stats.js +28 -0
  145. package/dist/react/stats.js.map +1 -0
  146. package/dist/react/use-resource.js +8 -7
  147. package/dist/react/use-resource.js.map +1 -1
  148. package/dist/react/versions.js +20 -20
  149. package/dist/react.js +26 -24
  150. package/dist/styles.css +1 -1
  151. package/dist/urls/index.d.ts +35 -10
  152. package/dist/urls.js +100 -70
  153. package/dist/urls.js.map +1 -1
  154. package/package.json +1 -1
@@ -1,397 +1,409 @@
1
1
  import { toContentKitError as e } from "../../client/errors.js";
2
2
  import { samePath as t } from "../../client/media/client.js";
3
- import { useMessages as n } from "../../i18n/context.js";
4
- import { useErrorReporter as r, useGuarded as i } from "../../react/context.js";
5
- import { EncodeProgress as a } from "../encode-progress.js";
6
- import { isProcessing as o } from "../../client/media/windows.js";
7
- import { useMediaRead as s } from "../../react/read.js";
8
- import { usePublicImage as c } from "../../react/public.js";
9
- import { Alert as l, AlertDescription as u } from "../../ui/alert.js";
10
- import { Button as d } from "../../ui/button.js";
11
- import { SlotImage as f } from "../slot-image.js";
12
- import { VideoPosterPicker as p } from "../video-poster-picker.js";
13
- import { Badge as m } from "../../ui/badge.js";
14
- import { Input as h } from "../../ui/input.js";
15
- import { Label as g } from "../../ui/label.js";
16
- import { Select as _, SelectContent as v, SelectItem as y, SelectTrigger as b, SelectValue as x } from "../../ui/select.js";
17
- import { ErrorLine as S, useAction as C } from "../social/parts.js";
18
- import { AdminRoot as w, LoadFailed as T, NoAccess as E, Rows as D, useConfirm as O } from "./shell.js";
19
- import { Switch as k } from "../../ui/switch.js";
20
- import { useFlowClient as A } from "../../react/admin.js";
21
- import { useId as j, useRef as M, useState as N } from "react";
22
- import { Fragment as P, jsx as F, jsxs as I } from "react/jsx-runtime";
3
+ import { acceptOf as n, isPattern as r } from "../../client/media/rules.js";
4
+ import { useMessages as i } from "../../i18n/context.js";
5
+ import { useContentKitClient as a, useErrorReporter as o, useGuarded as s } from "../../react/context.js";
6
+ import { EncodeProgress as c } from "../encode-progress.js";
7
+ import { isProcessing as l } from "../../client/media/windows.js";
8
+ import { useMediaRead as u } from "../../react/read.js";
9
+ import { usePublicImage as d } from "../../react/public.js";
10
+ import { Alert as f, AlertDescription as p } from "../../ui/alert.js";
11
+ import { Button as m } from "../../ui/button.js";
12
+ import { SlotImage as h } from "../slot-image.js";
13
+ import { VideoPosterPicker as g } from "../video-poster-picker.js";
14
+ import { isSubtitleType as _, isVideoType as v } from "../../client/gallery.js";
15
+ import { Badge as y } from "../../ui/badge.js";
16
+ import { Input as b } from "../../ui/input.js";
17
+ import { Label as x } from "../../ui/label.js";
18
+ import { Select as S, SelectContent as C, SelectItem as w, SelectTrigger as T, SelectValue as E } from "../../ui/select.js";
19
+ import { ErrorLine as D, useAction as O } from "../social/parts.js";
20
+ import { AdminRoot as k, LoadFailed as A, NoAccess as j, Rows as M, useConfirm as N } from "./shell.js";
21
+ import { Switch as P } from "../../ui/switch.js";
22
+ import { useFlowClient as F } from "../../react/admin.js";
23
+ import { useId as I, useRef as L, useState as R } from "react";
24
+ import { Fragment as z, jsx as B, jsxs as V } from "react/jsx-runtime";
23
25
  //#region src/components/admin/media-item-panel.tsx
24
- var L = (e) => (e ?? []).map((e) => typeof e == "string" ? {
26
+ function H(e) {
27
+ let t = (e, t) => e.types.length > 0 && e.types.every(t), n = e.find((e) => !r(e.path) && t(e, v))?.path;
28
+ return {
29
+ source: n,
30
+ poster: n ? e.find((e) => !r(e.path) && e.frames === n)?.path : void 0,
31
+ subtitles: e.find((e) => r(e.path) && t(e, _))?.path
32
+ };
33
+ }
34
+ var U = (e) => (e ?? []).map((e) => typeof e == "string" ? {
25
35
  value: e,
26
36
  label: e
27
- } : e), R = (e) => e.slice(0, e.indexOf("{name}"));
28
- function z({ client: e, baseUrl: t, auth: n, guard: r, appearance: i, className: a, language: o, messages: s, ...c }) {
29
- let l = A({
37
+ } : e), W = (e) => e.slice(0, e.indexOf("{name}"));
38
+ function G({ client: e, baseUrl: t, auth: n, guard: r, appearance: i, className: a, language: o, messages: s, ...c }) {
39
+ let l = F({
30
40
  client: e,
31
41
  baseUrl: t,
32
42
  auth: n
33
43
  });
34
- return /* @__PURE__ */ F(w, {
44
+ return /* @__PURE__ */ B(k, {
35
45
  flow: "media-item-panel",
36
46
  appearance: i,
37
47
  className: a,
38
48
  language: o,
39
49
  messages: s,
40
50
  guard: r,
41
- children: /* @__PURE__ */ F(B, {
51
+ children: /* @__PURE__ */ B(K, {
42
52
  ...c,
43
53
  client: l
44
54
  })
45
55
  });
46
56
  }
47
- function B({ item: e, client: r, source: i = "source", subtitles: a = "subs/{name}", poster: c = "poster", posterPreset: f = "poster", languages: p, onError: h }) {
48
- let g = n(), { t: _ } = g, v = s(e, {
57
+ function K({ item: e, client: r, source: o, subtitles: s, poster: c, posterPreset: d = "poster", languages: h, onError: g }) {
58
+ let _ = i(), { t: v } = _, b = a(r), x = u(e, {
49
59
  editor: !0,
50
- client: r
51
- }), y = C("media.save", h);
52
- if (!v.read) return v.error?.code === "not_found" ? /* @__PURE__ */ F(E, { children: _("mediaPanel.noAccess") }) : v.error ? /* @__PURE__ */ F(T, {
53
- error: v.error,
54
- message: _("mediaPanel.loadFailed"),
55
- retry: v.reload
56
- }) : /* @__PURE__ */ F(D, { count: 2 });
57
- if (!v.read.uploads) return /* @__PURE__ */ F(E, { children: _("mediaPanel.noAccess") });
58
- let b = v.read.files.filter((e) => e.upload && !e.unattached), x = b.find((e) => t(e.path, i)), w = b.filter((e) => e.failed), O = x ? w.length ? "failed" : b.some(o) ? "processing" : "ready" : "empty", k = a === null ? [] : b.filter((e) => e.path.startsWith(R(a)));
59
- return /* @__PURE__ */ I(P, { children: [
60
- /* @__PURE__ */ I("div", {
60
+ client: b
61
+ }), S = O("media.save", g);
62
+ if (!x.read) return x.error?.code === "not_found" ? /* @__PURE__ */ B(j, { children: v("mediaPanel.noAccess") }) : x.error ? /* @__PURE__ */ B(A, {
63
+ error: x.error,
64
+ message: v("mediaPanel.loadFailed"),
65
+ retry: x.reload
66
+ }) : /* @__PURE__ */ B(M, { count: 2 });
67
+ if (!x.read.uploads) return /* @__PURE__ */ B(j, { children: v("mediaPanel.noAccess") });
68
+ let C = x.read.uploads, w = H(C), T = o ?? w.source, E = c === void 0 ? w.poster : c, k = s === void 0 ? w.subtitles : s, N = (e) => n(C.filter((t) => t.path === e)), P = x.read.files.filter((e) => e.upload && !e.unattached), F = T ? P.find((e) => t(e.path, T)) : void 0, I = P.filter((e) => e.failed), L = F ? I.length ? "failed" : P.some(l) ? "processing" : "ready" : "empty", R = k ? P.filter((e) => e.path.startsWith(W(k))) : [];
69
+ return /* @__PURE__ */ V(z, { children: [
70
+ /* @__PURE__ */ V("div", {
61
71
  className: "flex flex-wrap items-center gap-2",
62
72
  children: [
63
- /* @__PURE__ */ F("h2", {
73
+ /* @__PURE__ */ B("h2", {
64
74
  className: "text-base font-semibold",
65
- children: _("mediaPanel.title")
75
+ children: v("mediaPanel.title")
66
76
  }),
67
- /* @__PURE__ */ F(m, {
68
- variant: O === "failed" ? "destructive" : O === "ready" ? "outline" : "secondary",
77
+ /* @__PURE__ */ B(y, {
78
+ variant: L === "failed" ? "destructive" : L === "ready" ? "outline" : "secondary",
69
79
  "data-ckui": "media-state",
70
- "data-state": O,
71
- children: _(`mediaPanel.${O}`)
80
+ "data-state": L,
81
+ children: v(`mediaPanel.${L}`)
72
82
  }),
73
- /* @__PURE__ */ F(d, {
83
+ /* @__PURE__ */ B(m, {
74
84
  size: "sm",
75
85
  variant: "outline",
76
86
  className: "ms-auto",
77
- disabled: y.pending || !b.length,
78
- onClick: () => void y.run(() => r.media.commit(e, [{ op: "regenerate" }])),
79
- children: _("mediaPanel.regenerate")
87
+ disabled: S.pending || !P.length,
88
+ onClick: () => void S.run(() => b.media.commit(e, [{ op: "regenerate" }])),
89
+ children: v("mediaPanel.regenerate")
80
90
  })
81
91
  ]
82
92
  }),
83
- /* @__PURE__ */ F(S, { error: y.error }),
84
- w.map((e) => /* @__PURE__ */ F(l, {
93
+ /* @__PURE__ */ B(D, { error: S.error }),
94
+ I.map((e) => /* @__PURE__ */ B(f, {
85
95
  variant: "destructive",
86
96
  "data-ckui": "media-failure",
87
- children: /* @__PURE__ */ F(u, { children: _("mediaPanel.failedFile", {
97
+ children: /* @__PURE__ */ B(p, { children: v("mediaPanel.failedFile", {
88
98
  name: e.path.split("/").pop(),
89
- reason: g.error({
99
+ reason: _.error({
90
100
  code: e.failed.code,
91
101
  message: e.failed.message,
92
102
  status: 422
93
103
  })
94
104
  }) })
95
105
  }, e.path)),
96
- /* @__PURE__ */ F(U, {
106
+ T && /* @__PURE__ */ B(Y, {
97
107
  item: e,
98
- path: i,
99
- video: x,
100
- client: r,
101
- onError: h
108
+ path: T,
109
+ accept: N(T) ?? "video/*",
110
+ video: F,
111
+ client: b,
112
+ onError: g
102
113
  }),
103
- c !== null && x && /* @__PURE__ */ F(W, {
114
+ T && E && F && /* @__PURE__ */ B(X, {
104
115
  item: e,
105
- path: c,
106
- video: i,
107
- preset: f,
108
- client: r,
109
- onError: h
116
+ path: E,
117
+ video: T,
118
+ preset: d,
119
+ client: b,
120
+ onError: g
110
121
  }),
111
- a !== null && /* @__PURE__ */ F(G, {
122
+ k && /* @__PURE__ */ B(Z, {
112
123
  item: e,
113
- pattern: a,
114
- files: k,
115
- languages: p,
116
- client: r,
117
- onError: h
124
+ pattern: k,
125
+ accept: N(k),
126
+ files: R,
127
+ languages: h,
128
+ client: b,
129
+ onError: g
118
130
  })
119
131
  ] });
120
132
  }
121
- function V(e) {
133
+ function q(e) {
122
134
  if (!e) return "";
123
135
  let t = e / (1 << 20);
124
136
  return t >= 1024 ? `${(t / 1024).toFixed(1)} GB` : `${t.toFixed(+(t < 10))} MB`;
125
137
  }
126
- function H(e) {
138
+ function J(e) {
127
139
  if (!e) return "";
128
140
  let t = Math.floor(e / 60), n = Math.round(e - t * 60);
129
141
  return `${t}:${String(n).padStart(2, "0")}`;
130
142
  }
131
- function U({ item: t, path: s, video: c, client: l, onError: u }) {
132
- let { t: f } = n(), p = M(null), [m, h] = N(null), g = r(u), _ = i(), [v, y] = N(null), b = async (n) => {
133
- y(null);
143
+ function Y({ item: t, path: n, accept: r, video: a, client: u, onError: d }) {
144
+ let { t: f } = i(), p = L(null), [h, g] = R(null), _ = o(d), v = s(), [y, b] = R(null), x = async (r) => {
145
+ b(null);
134
146
  try {
135
- await _(() => l.media.put(n, {
147
+ await v(() => u.media.put(r, {
136
148
  ref: t,
137
- path: s,
149
+ path: n,
138
150
  wait: !1,
139
- onProgress: h
151
+ onProgress: g
140
152
  }));
141
153
  } catch (t) {
142
154
  let n = e(t);
143
- y(n), g(n, "media.save");
155
+ b(n), _(n, "media.save");
144
156
  } finally {
145
- h(null);
157
+ g(null);
146
158
  }
147
- }, x = c ? [
148
- c.w && c.h ? `${c.w}×${c.h}` : "",
149
- H(c.dur),
150
- V(c.size)
159
+ }, S = a ? [
160
+ a.w && a.h ? `${a.w}×${a.h}` : "",
161
+ J(a.dur),
162
+ q(a.size)
151
163
  ].filter(Boolean).join(" · ") : "";
152
- return /* @__PURE__ */ I("section", {
164
+ return /* @__PURE__ */ V("section", {
153
165
  className: "grid gap-2",
154
166
  "data-ckui": "media-source",
155
167
  children: [
156
- /* @__PURE__ */ F("h3", {
168
+ /* @__PURE__ */ B("h3", {
157
169
  className: "font-medium",
158
170
  children: f("mediaPanel.source")
159
171
  }),
160
- /* @__PURE__ */ I("div", {
172
+ /* @__PURE__ */ V("div", {
161
173
  className: "flex flex-wrap items-center gap-3",
162
174
  children: [
163
- /* @__PURE__ */ F("span", {
175
+ /* @__PURE__ */ B("span", {
164
176
  className: "min-w-0 flex-1 text-muted-foreground",
165
- children: c ? x || c.path : f("mediaPanel.noSource")
177
+ children: a ? S || a.path : f("mediaPanel.noSource")
166
178
  }),
167
- /* @__PURE__ */ F(d, {
179
+ /* @__PURE__ */ B(m, {
168
180
  size: "sm",
169
181
  variant: "outline",
170
- disabled: !!m,
182
+ disabled: !!h,
171
183
  onClick: () => p.current?.click(),
172
- children: f(c ? "mediaPanel.replace" : "mediaPanel.upload")
184
+ children: f(a ? "mediaPanel.replace" : "mediaPanel.upload")
173
185
  }),
174
- /* @__PURE__ */ F("input", {
186
+ /* @__PURE__ */ B("input", {
175
187
  ref: p,
176
188
  type: "file",
177
- accept: "video/*",
189
+ accept: r,
178
190
  hidden: !0,
179
191
  "aria-label": f("mediaPanel.source"),
180
192
  onChange: (e) => {
181
193
  let t = e.target.files?.[0];
182
- e.target.value = "", t && b(t);
194
+ e.target.value = "", t && x(t);
183
195
  }
184
196
  })
185
197
  ]
186
198
  }),
187
- m && /* @__PURE__ */ I("div", {
199
+ h && /* @__PURE__ */ V("div", {
188
200
  className: "grid gap-1",
189
201
  role: "status",
190
- children: [/* @__PURE__ */ F("div", {
202
+ children: [/* @__PURE__ */ B("div", {
191
203
  className: "h-1.5 overflow-hidden rounded-full bg-muted",
192
- children: /* @__PURE__ */ F("div", {
204
+ children: /* @__PURE__ */ B("div", {
193
205
  className: "h-full bg-primary transition-[width]",
194
- style: { width: `${m.total ? Math.round(m.loaded / m.total * 100) : 0}%` }
206
+ style: { width: `${h.total ? Math.round(h.loaded / h.total * 100) : 0}%` }
195
207
  })
196
- }), /* @__PURE__ */ F("span", {
208
+ }), /* @__PURE__ */ B("span", {
197
209
  className: "text-xs text-muted-foreground",
198
- children: f(`mediaPanel.phase_${m.phase}`)
210
+ children: f(`mediaPanel.phase_${h.phase}`)
199
211
  })]
200
212
  }),
201
- c && o(c) && !m && /* @__PURE__ */ F(a, { progress: c.progress }),
202
- /* @__PURE__ */ F(S, { error: v })
213
+ a && l(a) && !h && /* @__PURE__ */ B(c, { progress: a.progress }),
214
+ /* @__PURE__ */ B(D, { error: y })
203
215
  ]
204
216
  });
205
217
  }
206
- function W({ item: e, path: t, video: r, preset: i, client: a, onError: o }) {
207
- let { t: s } = n(), [l, u] = N(!1), { image: m, reload: h } = c(e, i, { client: a });
208
- return /* @__PURE__ */ I("section", {
218
+ function X({ item: e, path: t, video: n, preset: r, client: a, onError: o }) {
219
+ let { t: s } = i(), [c, l] = R(!1), { image: u, reload: f } = d(e, r, { client: a });
220
+ return /* @__PURE__ */ V("section", {
209
221
  className: "grid gap-2",
210
222
  "data-ckui": "media-poster",
211
223
  children: [
212
- /* @__PURE__ */ F("h3", {
224
+ /* @__PURE__ */ B("h3", {
213
225
  className: "font-medium",
214
226
  children: s("mediaPanel.poster")
215
227
  }),
216
- /* @__PURE__ */ I("div", {
228
+ /* @__PURE__ */ V("div", {
217
229
  className: "flex flex-wrap items-center gap-3",
218
- children: [/* @__PURE__ */ F("div", {
230
+ children: [/* @__PURE__ */ B("div", {
219
231
  className: "w-40 overflow-hidden rounded-md border border-border",
220
- children: /* @__PURE__ */ F(f, {
221
- image: m,
222
- fallback: /* @__PURE__ */ F("div", { className: "aspect-video bg-muted" })
232
+ children: /* @__PURE__ */ B(h, {
233
+ image: u,
234
+ fallback: /* @__PURE__ */ B("div", { className: "aspect-video bg-muted" })
223
235
  })
224
- }), /* @__PURE__ */ F(d, {
236
+ }), /* @__PURE__ */ B(m, {
225
237
  size: "sm",
226
238
  variant: "outline",
227
- onClick: () => u(!0),
239
+ onClick: () => l(!0),
228
240
  children: s("mediaPanel.choosePoster")
229
241
  })]
230
242
  }),
231
- /* @__PURE__ */ F(p, {
232
- open: l,
233
- onOpenChange: u,
243
+ /* @__PURE__ */ B(g, {
244
+ open: c,
245
+ onOpenChange: l,
234
246
  item: e,
235
- video: r,
247
+ video: n,
236
248
  path: t,
237
- image: m,
249
+ image: u,
238
250
  client: a,
239
251
  onError: o,
240
- onChange: () => h()
252
+ onChange: () => f()
241
253
  })
242
254
  ]
243
255
  });
244
256
  }
245
- function G({ item: e, pattern: t, files: r, languages: i, client: a, onError: o }) {
246
- let { t: s } = n(), c = j(), l = L(i), [u, f] = N(l[0]?.value ?? ""), [p, w] = N(""), [T, E] = N(!1), [D, A] = N(null), P = M(null), R = C("media.save", o), z = C("media.save", o), { confirm: B, dialog: V } = O(), H = async () => {
247
- if (!D || !u.trim()) return;
248
- let n = u.trim(), r = `${n}${T ? "-forced" : ""}`;
249
- await R.run(() => a.media.put(D, {
257
+ function Z({ item: e, pattern: t, accept: n, files: r, languages: a, client: o, onError: s }) {
258
+ let { t: c } = i(), l = I(), u = U(a), [d, f] = R(u[0]?.value ?? ""), [p, h] = R(""), [g, _] = R(!1), [v, k] = R(null), A = L(null), j = O("media.save", s), M = O("media.save", s), { confirm: F, dialog: z } = N(), H = async () => {
259
+ if (!v || !d.trim()) return;
260
+ let n = d.trim(), r = `${n}${g ? "-forced" : ""}`;
261
+ await j.run(() => o.media.put(v, {
250
262
  ref: e,
251
263
  path: t.replace("{name}", r),
252
264
  wait: !1,
253
265
  meta: {
254
266
  lang: n,
255
- label: p.trim() || (l.find((e) => e.value === n)?.label ?? n),
256
- forced: T
267
+ label: p.trim() || (u.find((e) => e.value === n)?.label ?? n),
268
+ forced: g
257
269
  }
258
- })) && (A(null), P.current && (P.current.value = ""), w(""), E(!1));
259
- }, U = async (t) => {
260
- await B({
261
- title: s("mediaPanel.removeSubtitleTitle", { name: String(t.meta?.label ?? t.path) }),
262
- confirm: s("common.remove")
263
- }) && await z.run(() => a.media.commit(e, [{
270
+ })) && (k(null), A.current && (A.current.value = ""), h(""), _(!1));
271
+ }, W = async (t) => {
272
+ await F({
273
+ title: c("mediaPanel.removeSubtitleTitle", { name: String(t.meta?.label ?? t.path) }),
274
+ confirm: c("common.remove")
275
+ }) && await M.run(() => o.media.commit(e, [{
264
276
  op: "remove",
265
277
  path: t.path
266
278
  }]));
267
279
  };
268
- return /* @__PURE__ */ I("section", {
280
+ return /* @__PURE__ */ V("section", {
269
281
  className: "grid gap-2",
270
282
  "data-ckui": "media-subtitles",
271
283
  children: [
272
- /* @__PURE__ */ F("h3", {
284
+ /* @__PURE__ */ B("h3", {
273
285
  className: "font-medium",
274
- children: s("mediaPanel.subtitles")
286
+ children: c("mediaPanel.subtitles")
275
287
  }),
276
- r.length ? /* @__PURE__ */ F("ul", {
288
+ r.length ? /* @__PURE__ */ B("ul", {
277
289
  className: "grid divide-y divide-border rounded-lg border border-border",
278
- children: r.map((e) => /* @__PURE__ */ I("li", {
290
+ children: r.map((e) => /* @__PURE__ */ V("li", {
279
291
  className: "flex flex-wrap items-center gap-2 p-2.5",
280
292
  "data-ckui": "subtitle",
281
293
  children: [
282
- /* @__PURE__ */ F(m, {
294
+ /* @__PURE__ */ B(y, {
283
295
  variant: "outline",
284
296
  children: String(e.meta?.lang ?? "?")
285
297
  }),
286
- /* @__PURE__ */ F("span", {
298
+ /* @__PURE__ */ B("span", {
287
299
  className: "min-w-0 flex-1 break-words",
288
300
  children: String(e.meta?.label ?? e.path.split("/").pop())
289
301
  }),
290
- e.meta?.forced === !0 && /* @__PURE__ */ F(m, {
302
+ e.meta?.forced === !0 && /* @__PURE__ */ B(y, {
291
303
  variant: "secondary",
292
- children: s("mediaPanel.forced")
304
+ children: c("mediaPanel.forced")
293
305
  }),
294
- e.failed && /* @__PURE__ */ F(m, {
306
+ e.failed && /* @__PURE__ */ B(y, {
295
307
  variant: "destructive",
296
- children: s("mediaPanel.failed")
308
+ children: c("mediaPanel.failed")
297
309
  }),
298
- /* @__PURE__ */ F(d, {
310
+ /* @__PURE__ */ B(m, {
299
311
  size: "xs",
300
312
  variant: "ghost",
301
- disabled: z.pending,
302
- onClick: () => void U(e),
303
- children: s("common.remove")
313
+ disabled: M.pending,
314
+ onClick: () => void W(e),
315
+ children: c("common.remove")
304
316
  })
305
317
  ]
306
318
  }, e.path))
307
- }) : /* @__PURE__ */ F("p", {
319
+ }) : /* @__PURE__ */ B("p", {
308
320
  className: "text-muted-foreground",
309
- children: s("mediaPanel.noSubtitles")
321
+ children: c("mediaPanel.noSubtitles")
310
322
  }),
311
- /* @__PURE__ */ I("form", {
323
+ /* @__PURE__ */ V("form", {
312
324
  className: "grid gap-2 rounded-lg border border-dashed border-border p-3 sm:grid-cols-2",
313
325
  onSubmit: (e) => {
314
326
  e.preventDefault(), H();
315
327
  },
316
328
  children: [
317
- /* @__PURE__ */ I("div", {
329
+ /* @__PURE__ */ V("div", {
318
330
  className: "grid gap-1.5",
319
- children: [/* @__PURE__ */ F(g, {
320
- htmlFor: `${c}-file`,
321
- children: s("mediaPanel.subtitleFile")
322
- }), /* @__PURE__ */ F(h, {
323
- id: `${c}-file`,
324
- ref: P,
331
+ children: [/* @__PURE__ */ B(x, {
332
+ htmlFor: `${l}-file`,
333
+ children: c("mediaPanel.subtitleFile")
334
+ }), /* @__PURE__ */ B(b, {
335
+ id: `${l}-file`,
336
+ ref: A,
325
337
  type: "file",
326
- accept: ".vtt,.srt,text/vtt,application/x-subrip",
327
- onChange: (e) => A(e.target.files?.[0] ?? null)
338
+ accept: n ?? ".vtt,.srt,text/vtt,application/x-subrip",
339
+ onChange: (e) => k(e.target.files?.[0] ?? null)
328
340
  })]
329
341
  }),
330
- /* @__PURE__ */ I("div", {
342
+ /* @__PURE__ */ V("div", {
331
343
  className: "grid gap-1.5",
332
- children: [/* @__PURE__ */ F(g, {
333
- htmlFor: `${c}-lang`,
334
- children: s("mediaPanel.language")
335
- }), l.length ? /* @__PURE__ */ I(_, {
336
- value: u,
344
+ children: [/* @__PURE__ */ B(x, {
345
+ htmlFor: `${l}-lang`,
346
+ children: c("mediaPanel.language")
347
+ }), u.length ? /* @__PURE__ */ V(S, {
348
+ value: d,
337
349
  onValueChange: (e) => f(String(e)),
338
- children: [/* @__PURE__ */ F(b, {
339
- id: `${c}-lang`,
350
+ children: [/* @__PURE__ */ B(T, {
351
+ id: `${l}-lang`,
340
352
  className: "w-full",
341
- children: /* @__PURE__ */ F(x, { children: (e) => l.find((t) => t.value === e)?.label ?? e })
342
- }), /* @__PURE__ */ F(v, { children: l.map((e) => /* @__PURE__ */ F(y, {
353
+ children: /* @__PURE__ */ B(E, { children: (e) => u.find((t) => t.value === e)?.label ?? e })
354
+ }), /* @__PURE__ */ B(C, { children: u.map((e) => /* @__PURE__ */ B(w, {
343
355
  value: e.value,
344
356
  children: e.label
345
357
  }, e.value)) })]
346
- }) : /* @__PURE__ */ F(h, {
347
- id: `${c}-lang`,
348
- value: u,
358
+ }) : /* @__PURE__ */ B(b, {
359
+ id: `${l}-lang`,
360
+ value: d,
349
361
  placeholder: "en",
350
362
  onChange: (e) => f(e.target.value)
351
363
  })]
352
364
  }),
353
- /* @__PURE__ */ I("div", {
365
+ /* @__PURE__ */ V("div", {
354
366
  className: "grid gap-1.5",
355
- children: [/* @__PURE__ */ F(g, {
356
- htmlFor: `${c}-label`,
357
- children: s("mediaPanel.label")
358
- }), /* @__PURE__ */ F(h, {
359
- id: `${c}-label`,
367
+ children: [/* @__PURE__ */ B(x, {
368
+ htmlFor: `${l}-label`,
369
+ children: c("mediaPanel.label")
370
+ }), /* @__PURE__ */ B(b, {
371
+ id: `${l}-label`,
360
372
  value: p,
361
- placeholder: s("mediaPanel.labelPlaceholder"),
362
- onChange: (e) => w(e.target.value)
373
+ placeholder: c("mediaPanel.labelPlaceholder"),
374
+ onChange: (e) => h(e.target.value)
363
375
  })]
364
376
  }),
365
- /* @__PURE__ */ I("div", {
377
+ /* @__PURE__ */ V("div", {
366
378
  className: "flex items-center gap-2 self-end",
367
- children: [/* @__PURE__ */ F(k, {
368
- id: `${c}-forced`,
369
- checked: T,
370
- onCheckedChange: E
371
- }), /* @__PURE__ */ F(g, {
372
- htmlFor: `${c}-forced`,
373
- children: s("mediaPanel.forcedLabel")
379
+ children: [/* @__PURE__ */ B(P, {
380
+ id: `${l}-forced`,
381
+ checked: g,
382
+ onCheckedChange: _
383
+ }), /* @__PURE__ */ B(x, {
384
+ htmlFor: `${l}-forced`,
385
+ children: c("mediaPanel.forcedLabel")
374
386
  })]
375
387
  }),
376
- /* @__PURE__ */ F(S, {
377
- error: R.error,
388
+ /* @__PURE__ */ B(D, {
389
+ error: j.error,
378
390
  className: "sm:col-span-2"
379
391
  }),
380
- /* @__PURE__ */ F(d, {
392
+ /* @__PURE__ */ B(m, {
381
393
  type: "submit",
382
394
  size: "sm",
383
395
  className: "justify-self-start",
384
- disabled: R.pending || !D || !u.trim(),
385
- children: R.pending ? s("common.saving") : s("mediaPanel.addSubtitle")
396
+ disabled: j.pending || !v || !d.trim(),
397
+ children: j.pending ? c("common.saving") : c("mediaPanel.addSubtitle")
386
398
  })
387
399
  ]
388
400
  }),
389
- /* @__PURE__ */ F(S, { error: z.error }),
390
- V
401
+ /* @__PURE__ */ B(D, { error: M.error }),
402
+ z
391
403
  ]
392
404
  });
393
405
  }
394
406
  //#endregion
395
- export { z as MediaItemPanel };
407
+ export { G as MediaItemPanel, K as VideoMediaEditor, H as videoPaths };
396
408
 
397
409
  //# sourceMappingURL=media-item-panel.js.map