@openrails/contentkit-ui 0.85.1 → 0.87.0-rc.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +28 -7
- package/dist/client/beacons.d.ts +13 -4
- package/dist/client/beacons.js +14 -7
- package/dist/client/beacons.js.map +1 -1
- package/dist/client/client.d.ts +3 -0
- package/dist/client/client.js +29 -27
- package/dist/client/client.js.map +1 -1
- package/dist/client/codes.d.ts +6 -1
- package/dist/client/codes.js +4 -1
- package/dist/client/codes.js.map +1 -1
- package/dist/client/content/types.d.ts +4 -2
- package/dist/client/content/types.js.map +1 -1
- package/dist/client/discovery.js +3 -0
- package/dist/client/discovery.js.map +1 -1
- package/dist/client/errors.d.ts +6 -0
- package/dist/client/errors.js +6 -2
- package/dist/client/errors.js.map +1 -1
- package/dist/client/gallery.d.ts +3 -5
- package/dist/client/gallery.js +16 -20
- package/dist/client/gallery.js.map +1 -1
- package/dist/client/generated/error-codes.d.ts +1 -1
- package/dist/client/generated/error-codes.js +9 -1
- package/dist/client/generated/error-codes.js.map +1 -1
- package/dist/client/generated/routes.d.ts +29 -3
- package/dist/client/generated/routes.js +44 -3
- package/dist/client/generated/routes.js.map +1 -1
- package/dist/client/generated/wire.d.ts +60 -10
- package/dist/client/generated/wire.js.map +1 -1
- package/dist/client/index.d.ts +2 -1
- package/dist/client/media/queue.d.ts +4 -2
- package/dist/client/media/queue.js +18 -12
- package/dist/client/media/queue.js.map +1 -1
- package/dist/client/media/rules.d.ts +7 -1
- package/dist/client/media/rules.js +27 -21
- package/dist/client/media/rules.js.map +1 -1
- package/dist/client/media/windows.js +1 -1
- package/dist/client/media/windows.js.map +1 -1
- package/dist/client/stats.d.ts +32 -0
- package/dist/client/stats.js +35 -0
- package/dist/client/stats.js.map +1 -0
- package/dist/client/versions.d.ts +6 -4
- package/dist/client/versions.js +24 -26
- package/dist/client/versions.js.map +1 -1
- package/dist/client.js +30 -29
- package/dist/components/admin/content-manager.js +206 -206
- package/dist/components/admin/content-manager.js.map +1 -1
- package/dist/components/admin/group-manager.js +71 -70
- package/dist/components/admin/group-manager.js.map +1 -1
- package/dist/components/admin/media-item-panel.d.ts +24 -7
- package/dist/components/admin/media-item-panel.js +209 -197
- package/dist/components/admin/media-item-panel.js.map +1 -1
- package/dist/components/admin/poll-manager.js +25 -25
- package/dist/components/admin/stats-dashboard.d.ts +22 -0
- package/dist/components/admin/stats-dashboard.js +257 -0
- package/dist/components/admin/stats-dashboard.js.map +1 -0
- package/dist/components/content/card.d.ts +5 -3
- package/dist/components/content/card.js +155 -133
- package/dist/components/content/card.js.map +1 -1
- package/dist/components/content/download-button.d.ts +26 -0
- package/dist/components/content/download-button.js +51 -0
- package/dist/components/content/download-button.js.map +1 -0
- package/dist/components/content/editors.js +455 -427
- package/dist/components/content/editors.js.map +1 -1
- package/dist/components/content/grid.d.ts +8 -1
- package/dist/components/content/grid.js +153 -104
- package/dist/components/content/grid.js.map +1 -1
- package/dist/components/content/index.d.ts +4 -2
- package/dist/components/content/listing.d.ts +3 -1
- package/dist/components/content/listing.js +34 -34
- package/dist/components/content/listing.js.map +1 -1
- package/dist/components/content/paywall.d.ts +17 -5
- package/dist/components/content/paywall.js +115 -100
- package/dist/components/content/paywall.js.map +1 -1
- package/dist/components/content/reader-stats.d.ts +12 -0
- package/dist/components/content/reader-stats.js +47 -0
- package/dist/components/content/reader-stats.js.map +1 -0
- package/dist/components/groups/banner.js +33 -33
- package/dist/components/groups/directory.js +11 -11
- package/dist/components/groups/editor.js +293 -293
- package/dist/components/groups/editor.js.map +1 -1
- package/dist/components/groups/header.js +27 -27
- package/dist/components/groups/header.js.map +1 -1
- package/dist/components/groups/memberships.js +180 -180
- package/dist/components/groups/parts.d.ts +0 -2
- package/dist/components/groups/parts.js +9 -27
- package/dist/components/groups/parts.js.map +1 -1
- package/dist/components/media-folder-editor.js +239 -189
- package/dist/components/media-folder-editor.js.map +1 -1
- package/dist/components/media-gallery.d.ts +1 -4
- package/dist/components/media-gallery.js +19 -34
- package/dist/components/media-gallery.js.map +1 -1
- package/dist/components/notifications.js +17 -17
- package/dist/components/slot-upload.d.ts +2 -2
- package/dist/components/slot-upload.js +84 -79
- package/dist/components/slot-upload.js.map +1 -1
- package/dist/components/social/bans.js +34 -34
- package/dist/components/social/comments.js +1 -1
- package/dist/components/social/comments.js.map +1 -1
- package/dist/components/social/engagement.d.ts +2 -1
- package/dist/components/social/engagement.js +5 -3
- package/dist/components/social/engagement.js.map +1 -1
- package/dist/components/social/moderation.js +52 -48
- package/dist/components/social/moderation.js.map +1 -1
- package/dist/components/video-player.d.ts +2 -0
- package/dist/components/video-player.js +318 -314
- package/dist/components/video-player.js.map +1 -1
- package/dist/i18n/context.d.ts +2 -0
- package/dist/i18n/context.js +23 -5
- package/dist/i18n/context.js.map +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +13 -10
- package/dist/locales/admin/de.js +27 -0
- package/dist/locales/admin/de.js.map +1 -1
- package/dist/locales/admin/en.d.ts +27 -0
- package/dist/locales/admin/en.js +27 -0
- package/dist/locales/admin/en.js.map +1 -1
- package/dist/locales/admin/es.js +27 -0
- package/dist/locales/admin/es.js.map +1 -1
- package/dist/locales/admin/ja.js +27 -0
- package/dist/locales/admin/ja.js.map +1 -1
- package/dist/locales/admin/ko.js +27 -0
- package/dist/locales/admin/ko.js.map +1 -1
- package/dist/locales/admin/zh.js +27 -0
- package/dist/locales/admin/zh.js.map +1 -1
- package/dist/locales/content/de.js +6 -0
- package/dist/locales/content/de.js.map +1 -1
- package/dist/locales/content/en.d.ts +6 -0
- package/dist/locales/content/en.js +6 -0
- package/dist/locales/content/en.js.map +1 -1
- package/dist/locales/content/es.js +6 -0
- package/dist/locales/content/es.js.map +1 -1
- package/dist/locales/content/ja.js +6 -0
- package/dist/locales/content/ja.js.map +1 -1
- package/dist/locales/content/ko.js +6 -0
- package/dist/locales/content/ko.js.map +1 -1
- package/dist/locales/content/zh.js +6 -0
- package/dist/locales/content/zh.js.map +1 -1
- package/dist/locales/de.js +14 -2
- package/dist/locales/de.js.map +1 -1
- package/dist/locales/discovery/de.js +3 -0
- package/dist/locales/discovery/de.js.map +1 -1
- package/dist/locales/discovery/en.d.ts +3 -0
- package/dist/locales/discovery/en.js +3 -0
- package/dist/locales/discovery/en.js.map +1 -1
- package/dist/locales/discovery/es.js +3 -0
- package/dist/locales/discovery/es.js.map +1 -1
- package/dist/locales/discovery/ja.js +3 -0
- package/dist/locales/discovery/ja.js.map +1 -1
- package/dist/locales/discovery/ko.js +3 -0
- package/dist/locales/discovery/ko.js.map +1 -1
- package/dist/locales/discovery/zh.js +3 -0
- package/dist/locales/discovery/zh.js.map +1 -1
- package/dist/locales/en.d.ts +50 -2
- package/dist/locales/en.js +14 -2
- package/dist/locales/en.js.map +1 -1
- package/dist/locales/es.js +14 -2
- package/dist/locales/es.js.map +1 -1
- package/dist/locales/ja.js +14 -2
- package/dist/locales/ja.js.map +1 -1
- package/dist/locales/ko.js +14 -2
- package/dist/locales/ko.js.map +1 -1
- package/dist/locales/zh.js +14 -2
- package/dist/locales/zh.js.map +1 -1
- package/dist/react/admin.js +22 -23
- package/dist/react/admin.js.map +1 -1
- package/dist/react/canonical.d.ts +4 -3
- package/dist/react/canonical.js +34 -33
- package/dist/react/canonical.js.map +1 -1
- package/dist/react/comments.d.ts +1 -1
- package/dist/react/comments.js +3 -2
- package/dist/react/comments.js.map +1 -1
- package/dist/react/contents.js +144 -144
- package/dist/react/contents.js.map +1 -1
- package/dist/react/context.d.ts +1 -1
- package/dist/react/context.js.map +1 -1
- package/dist/react/detail.d.ts +12 -6
- package/dist/react/detail.js +31 -24
- package/dist/react/detail.js.map +1 -1
- package/dist/react/discovery.d.ts +11 -0
- package/dist/react/discovery.js +49 -30
- package/dist/react/discovery.js.map +1 -1
- package/dist/react/engagement.d.ts +6 -2
- package/dist/react/engagement.js +2 -6
- package/dist/react/engagement.js.map +1 -1
- package/dist/react/folder.d.ts +7 -2
- package/dist/react/folder.js +165 -147
- package/dist/react/folder.js.map +1 -1
- package/dist/react/groups.d.ts +0 -1
- package/dist/react/groups.js +13 -12
- package/dist/react/groups.js.map +1 -1
- package/dist/react/index.d.ts +6 -4
- package/dist/react/location.d.ts +11 -0
- package/dist/react/location.js +18 -0
- package/dist/react/location.js.map +1 -0
- package/dist/react/public.d.ts +8 -0
- package/dist/react/public.js +32 -27
- package/dist/react/public.js.map +1 -1
- package/dist/react/stats.d.ts +24 -0
- package/dist/react/stats.js +28 -0
- package/dist/react/stats.js.map +1 -0
- package/dist/react/use-resource.js +8 -7
- package/dist/react/use-resource.js.map +1 -1
- package/dist/react/versions.d.ts +25 -5
- package/dist/react/versions.js +61 -40
- package/dist/react/versions.js.map +1 -1
- package/dist/react.js +26 -24
- package/dist/styles.css +1 -1
- package/dist/urls/index.d.ts +35 -10
- package/dist/urls.js +100 -70
- package/dist/urls.js.map +1 -1
- 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 {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
22
|
-
import {
|
|
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
|
-
|
|
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),
|
|
28
|
-
function
|
|
29
|
-
let l =
|
|
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__ */
|
|
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__ */
|
|
51
|
+
children: /* @__PURE__ */ B(K, {
|
|
42
52
|
...c,
|
|
43
53
|
client: l
|
|
44
54
|
})
|
|
45
55
|
});
|
|
46
56
|
}
|
|
47
|
-
function
|
|
48
|
-
let
|
|
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:
|
|
51
|
-
}),
|
|
52
|
-
if (!
|
|
53
|
-
error:
|
|
54
|
-
message:
|
|
55
|
-
retry:
|
|
56
|
-
}) : /* @__PURE__ */
|
|
57
|
-
if (!
|
|
58
|
-
let
|
|
59
|
-
return /* @__PURE__ */
|
|
60
|
-
/* @__PURE__ */
|
|
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__ */
|
|
73
|
+
/* @__PURE__ */ B("h2", {
|
|
64
74
|
className: "text-base font-semibold",
|
|
65
|
-
children:
|
|
75
|
+
children: v("mediaPanel.title")
|
|
66
76
|
}),
|
|
67
|
-
/* @__PURE__ */
|
|
68
|
-
variant:
|
|
77
|
+
/* @__PURE__ */ B(y, {
|
|
78
|
+
variant: L === "failed" ? "destructive" : L === "ready" ? "outline" : "secondary",
|
|
69
79
|
"data-ckui": "media-state",
|
|
70
|
-
"data-state":
|
|
71
|
-
children:
|
|
80
|
+
"data-state": L,
|
|
81
|
+
children: v(`mediaPanel.${L}`)
|
|
72
82
|
}),
|
|
73
|
-
/* @__PURE__ */
|
|
83
|
+
/* @__PURE__ */ B(m, {
|
|
74
84
|
size: "sm",
|
|
75
85
|
variant: "outline",
|
|
76
86
|
className: "ms-auto",
|
|
77
|
-
disabled:
|
|
78
|
-
onClick: () => void
|
|
79
|
-
children:
|
|
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__ */
|
|
84
|
-
|
|
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__ */
|
|
97
|
+
children: /* @__PURE__ */ B(p, { children: v("mediaPanel.failedFile", {
|
|
88
98
|
name: e.path.split("/").pop(),
|
|
89
|
-
reason:
|
|
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__ */
|
|
106
|
+
T && /* @__PURE__ */ B(Y, {
|
|
97
107
|
item: e,
|
|
98
|
-
path:
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
108
|
+
path: T,
|
|
109
|
+
accept: N(T) ?? "video/*",
|
|
110
|
+
video: F,
|
|
111
|
+
client: b,
|
|
112
|
+
onError: g
|
|
102
113
|
}),
|
|
103
|
-
|
|
114
|
+
T && E && F && /* @__PURE__ */ B(X, {
|
|
104
115
|
item: e,
|
|
105
|
-
path:
|
|
106
|
-
video:
|
|
107
|
-
preset:
|
|
108
|
-
client:
|
|
109
|
-
onError:
|
|
116
|
+
path: E,
|
|
117
|
+
video: T,
|
|
118
|
+
preset: d,
|
|
119
|
+
client: b,
|
|
120
|
+
onError: g
|
|
110
121
|
}),
|
|
111
|
-
|
|
122
|
+
k && /* @__PURE__ */ B(Z, {
|
|
112
123
|
item: e,
|
|
113
|
-
pattern:
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
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
|
|
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
|
|
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
|
|
132
|
-
let { t: f } =
|
|
133
|
-
|
|
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
|
|
147
|
+
await v(() => u.media.put(r, {
|
|
136
148
|
ref: t,
|
|
137
|
-
path:
|
|
149
|
+
path: n,
|
|
138
150
|
wait: !1,
|
|
139
|
-
onProgress:
|
|
151
|
+
onProgress: g
|
|
140
152
|
}));
|
|
141
153
|
} catch (t) {
|
|
142
154
|
let n = e(t);
|
|
143
|
-
|
|
155
|
+
b(n), _(n, "media.save");
|
|
144
156
|
} finally {
|
|
145
|
-
|
|
157
|
+
g(null);
|
|
146
158
|
}
|
|
147
|
-
},
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
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__ */
|
|
164
|
+
return /* @__PURE__ */ V("section", {
|
|
153
165
|
className: "grid gap-2",
|
|
154
166
|
"data-ckui": "media-source",
|
|
155
167
|
children: [
|
|
156
|
-
/* @__PURE__ */
|
|
168
|
+
/* @__PURE__ */ B("h3", {
|
|
157
169
|
className: "font-medium",
|
|
158
170
|
children: f("mediaPanel.source")
|
|
159
171
|
}),
|
|
160
|
-
/* @__PURE__ */
|
|
172
|
+
/* @__PURE__ */ V("div", {
|
|
161
173
|
className: "flex flex-wrap items-center gap-3",
|
|
162
174
|
children: [
|
|
163
|
-
/* @__PURE__ */
|
|
175
|
+
/* @__PURE__ */ B("span", {
|
|
164
176
|
className: "min-w-0 flex-1 text-muted-foreground",
|
|
165
|
-
children:
|
|
177
|
+
children: a ? S || a.path : f("mediaPanel.noSource")
|
|
166
178
|
}),
|
|
167
|
-
/* @__PURE__ */
|
|
179
|
+
/* @__PURE__ */ B(m, {
|
|
168
180
|
size: "sm",
|
|
169
181
|
variant: "outline",
|
|
170
|
-
disabled: !!
|
|
182
|
+
disabled: !!h,
|
|
171
183
|
onClick: () => p.current?.click(),
|
|
172
|
-
children: f(
|
|
184
|
+
children: f(a ? "mediaPanel.replace" : "mediaPanel.upload")
|
|
173
185
|
}),
|
|
174
|
-
/* @__PURE__ */
|
|
186
|
+
/* @__PURE__ */ B("input", {
|
|
175
187
|
ref: p,
|
|
176
188
|
type: "file",
|
|
177
|
-
accept:
|
|
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 &&
|
|
194
|
+
e.target.value = "", t && x(t);
|
|
183
195
|
}
|
|
184
196
|
})
|
|
185
197
|
]
|
|
186
198
|
}),
|
|
187
|
-
|
|
199
|
+
h && /* @__PURE__ */ V("div", {
|
|
188
200
|
className: "grid gap-1",
|
|
189
201
|
role: "status",
|
|
190
|
-
children: [/* @__PURE__ */
|
|
202
|
+
children: [/* @__PURE__ */ B("div", {
|
|
191
203
|
className: "h-1.5 overflow-hidden rounded-full bg-muted",
|
|
192
|
-
children: /* @__PURE__ */
|
|
204
|
+
children: /* @__PURE__ */ B("div", {
|
|
193
205
|
className: "h-full bg-primary transition-[width]",
|
|
194
|
-
style: { width: `${
|
|
206
|
+
style: { width: `${h.total ? Math.round(h.loaded / h.total * 100) : 0}%` }
|
|
195
207
|
})
|
|
196
|
-
}), /* @__PURE__ */
|
|
208
|
+
}), /* @__PURE__ */ B("span", {
|
|
197
209
|
className: "text-xs text-muted-foreground",
|
|
198
|
-
children: f(`mediaPanel.phase_${
|
|
210
|
+
children: f(`mediaPanel.phase_${h.phase}`)
|
|
199
211
|
})]
|
|
200
212
|
}),
|
|
201
|
-
|
|
202
|
-
/* @__PURE__ */
|
|
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
|
|
207
|
-
let { t: s } =
|
|
208
|
-
return /* @__PURE__ */
|
|
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__ */
|
|
224
|
+
/* @__PURE__ */ B("h3", {
|
|
213
225
|
className: "font-medium",
|
|
214
226
|
children: s("mediaPanel.poster")
|
|
215
227
|
}),
|
|
216
|
-
/* @__PURE__ */
|
|
228
|
+
/* @__PURE__ */ V("div", {
|
|
217
229
|
className: "flex flex-wrap items-center gap-3",
|
|
218
|
-
children: [/* @__PURE__ */
|
|
230
|
+
children: [/* @__PURE__ */ B("div", {
|
|
219
231
|
className: "w-40 overflow-hidden rounded-md border border-border",
|
|
220
|
-
children: /* @__PURE__ */
|
|
221
|
-
image:
|
|
222
|
-
fallback: /* @__PURE__ */
|
|
232
|
+
children: /* @__PURE__ */ B(h, {
|
|
233
|
+
image: u,
|
|
234
|
+
fallback: /* @__PURE__ */ B("div", { className: "aspect-video bg-muted" })
|
|
223
235
|
})
|
|
224
|
-
}), /* @__PURE__ */
|
|
236
|
+
}), /* @__PURE__ */ B(m, {
|
|
225
237
|
size: "sm",
|
|
226
238
|
variant: "outline",
|
|
227
|
-
onClick: () =>
|
|
239
|
+
onClick: () => l(!0),
|
|
228
240
|
children: s("mediaPanel.choosePoster")
|
|
229
241
|
})]
|
|
230
242
|
}),
|
|
231
|
-
/* @__PURE__ */
|
|
232
|
-
open:
|
|
233
|
-
onOpenChange:
|
|
243
|
+
/* @__PURE__ */ B(g, {
|
|
244
|
+
open: c,
|
|
245
|
+
onOpenChange: l,
|
|
234
246
|
item: e,
|
|
235
|
-
video:
|
|
247
|
+
video: n,
|
|
236
248
|
path: t,
|
|
237
|
-
image:
|
|
249
|
+
image: u,
|
|
238
250
|
client: a,
|
|
239
251
|
onError: o,
|
|
240
|
-
onChange: () =>
|
|
252
|
+
onChange: () => f()
|
|
241
253
|
})
|
|
242
254
|
]
|
|
243
255
|
});
|
|
244
256
|
}
|
|
245
|
-
function
|
|
246
|
-
let { t:
|
|
247
|
-
if (!
|
|
248
|
-
let n =
|
|
249
|
-
await
|
|
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() || (
|
|
256
|
-
forced:
|
|
267
|
+
label: p.trim() || (u.find((e) => e.value === n)?.label ?? n),
|
|
268
|
+
forced: g
|
|
257
269
|
}
|
|
258
|
-
})) && (
|
|
259
|
-
},
|
|
260
|
-
await
|
|
261
|
-
title:
|
|
262
|
-
confirm:
|
|
263
|
-
}) && await
|
|
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__ */
|
|
280
|
+
return /* @__PURE__ */ V("section", {
|
|
269
281
|
className: "grid gap-2",
|
|
270
282
|
"data-ckui": "media-subtitles",
|
|
271
283
|
children: [
|
|
272
|
-
/* @__PURE__ */
|
|
284
|
+
/* @__PURE__ */ B("h3", {
|
|
273
285
|
className: "font-medium",
|
|
274
|
-
children:
|
|
286
|
+
children: c("mediaPanel.subtitles")
|
|
275
287
|
}),
|
|
276
|
-
r.length ? /* @__PURE__ */
|
|
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__ */
|
|
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__ */
|
|
294
|
+
/* @__PURE__ */ B(y, {
|
|
283
295
|
variant: "outline",
|
|
284
296
|
children: String(e.meta?.lang ?? "?")
|
|
285
297
|
}),
|
|
286
|
-
/* @__PURE__ */
|
|
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__ */
|
|
302
|
+
e.meta?.forced === !0 && /* @__PURE__ */ B(y, {
|
|
291
303
|
variant: "secondary",
|
|
292
|
-
children:
|
|
304
|
+
children: c("mediaPanel.forced")
|
|
293
305
|
}),
|
|
294
|
-
e.failed && /* @__PURE__ */
|
|
306
|
+
e.failed && /* @__PURE__ */ B(y, {
|
|
295
307
|
variant: "destructive",
|
|
296
|
-
children:
|
|
308
|
+
children: c("mediaPanel.failed")
|
|
297
309
|
}),
|
|
298
|
-
/* @__PURE__ */
|
|
310
|
+
/* @__PURE__ */ B(m, {
|
|
299
311
|
size: "xs",
|
|
300
312
|
variant: "ghost",
|
|
301
|
-
disabled:
|
|
302
|
-
onClick: () => void
|
|
303
|
-
children:
|
|
313
|
+
disabled: M.pending,
|
|
314
|
+
onClick: () => void W(e),
|
|
315
|
+
children: c("common.remove")
|
|
304
316
|
})
|
|
305
317
|
]
|
|
306
318
|
}, e.path))
|
|
307
|
-
}) : /* @__PURE__ */
|
|
319
|
+
}) : /* @__PURE__ */ B("p", {
|
|
308
320
|
className: "text-muted-foreground",
|
|
309
|
-
children:
|
|
321
|
+
children: c("mediaPanel.noSubtitles")
|
|
310
322
|
}),
|
|
311
|
-
/* @__PURE__ */
|
|
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__ */
|
|
329
|
+
/* @__PURE__ */ V("div", {
|
|
318
330
|
className: "grid gap-1.5",
|
|
319
|
-
children: [/* @__PURE__ */
|
|
320
|
-
htmlFor: `${
|
|
321
|
-
children:
|
|
322
|
-
}), /* @__PURE__ */
|
|
323
|
-
id: `${
|
|
324
|
-
ref:
|
|
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) =>
|
|
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__ */
|
|
342
|
+
/* @__PURE__ */ V("div", {
|
|
331
343
|
className: "grid gap-1.5",
|
|
332
|
-
children: [/* @__PURE__ */
|
|
333
|
-
htmlFor: `${
|
|
334
|
-
children:
|
|
335
|
-
}),
|
|
336
|
-
value:
|
|
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__ */
|
|
339
|
-
id: `${
|
|
350
|
+
children: [/* @__PURE__ */ B(T, {
|
|
351
|
+
id: `${l}-lang`,
|
|
340
352
|
className: "w-full",
|
|
341
|
-
children: /* @__PURE__ */
|
|
342
|
-
}), /* @__PURE__ */
|
|
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__ */
|
|
347
|
-
id: `${
|
|
348
|
-
value:
|
|
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__ */
|
|
365
|
+
/* @__PURE__ */ V("div", {
|
|
354
366
|
className: "grid gap-1.5",
|
|
355
|
-
children: [/* @__PURE__ */
|
|
356
|
-
htmlFor: `${
|
|
357
|
-
children:
|
|
358
|
-
}), /* @__PURE__ */
|
|
359
|
-
id: `${
|
|
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:
|
|
362
|
-
onChange: (e) =>
|
|
373
|
+
placeholder: c("mediaPanel.labelPlaceholder"),
|
|
374
|
+
onChange: (e) => h(e.target.value)
|
|
363
375
|
})]
|
|
364
376
|
}),
|
|
365
|
-
/* @__PURE__ */
|
|
377
|
+
/* @__PURE__ */ V("div", {
|
|
366
378
|
className: "flex items-center gap-2 self-end",
|
|
367
|
-
children: [/* @__PURE__ */
|
|
368
|
-
id: `${
|
|
369
|
-
checked:
|
|
370
|
-
onCheckedChange:
|
|
371
|
-
}), /* @__PURE__ */
|
|
372
|
-
htmlFor: `${
|
|
373
|
-
children:
|
|
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__ */
|
|
377
|
-
error:
|
|
388
|
+
/* @__PURE__ */ B(D, {
|
|
389
|
+
error: j.error,
|
|
378
390
|
className: "sm:col-span-2"
|
|
379
391
|
}),
|
|
380
|
-
/* @__PURE__ */
|
|
392
|
+
/* @__PURE__ */ B(m, {
|
|
381
393
|
type: "submit",
|
|
382
394
|
size: "sm",
|
|
383
395
|
className: "justify-self-start",
|
|
384
|
-
disabled:
|
|
385
|
-
children:
|
|
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__ */
|
|
390
|
-
|
|
401
|
+
/* @__PURE__ */ B(D, { error: M.error }),
|
|
402
|
+
z
|
|
391
403
|
]
|
|
392
404
|
});
|
|
393
405
|
}
|
|
394
406
|
//#endregion
|
|
395
|
-
export {
|
|
407
|
+
export { G as MediaItemPanel, K as VideoMediaEditor, H as videoPaths };
|
|
396
408
|
|
|
397
409
|
//# sourceMappingURL=media-item-panel.js.map
|