@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,274 +1,277 @@
1
- import { useMessages as e } from "../../i18n/context.js";
2
- import { useContentKitClient as t } from "../../react/context.js";
3
- import { Button as n } from "../../ui/button.js";
4
- import { SortableList as r } from "../sortable-list.js";
5
- import { MediaFolderEditor as i } from "../media-folder-editor.js";
6
- import { Badge as a } from "../../ui/badge.js";
7
- import { Input as o } from "../../ui/input.js";
8
- import { Label as s } from "../../ui/label.js";
9
- import { Select as c, SelectContent as l, SelectItem as u, SelectTrigger as d, SelectValue as f } from "../../ui/select.js";
10
- import { ErrorLine as p, useAction as m } from "../social/parts.js";
11
- import { Switch as h } from "../../ui/switch.js";
12
- import { fromLocalInput as g, parseAttributes as _, toLocalInput as v } from "../../client/group-fields.js";
13
- import { useKinds as y } from "../../react/groups.js";
14
- import { GroupPicker as b, labelOf as x, useGroupNames as S, useLanguageName as C } from "../groups/parts.js";
15
- import { OfferFields as w } from "./offer-fields.js";
16
- import { AttributeFields as T, formOf as E } from "../groups/fields.js";
17
- import { MembershipEditor as D } from "../groups/memberships.js";
18
- import { ReaderManifestEditor as O } from "../admin/reader-manifest.js";
19
- import { useEffect as k, useId as A, useMemo as j, useState as M } from "react";
20
- import { jsx as N, jsxs as P } from "react/jsx-runtime";
21
- import { cn as F } from "cn";
1
+ import { useLanguageName as e, useMessages as t } from "../../i18n/context.js";
2
+ import { useContentKitClient as n } from "../../react/context.js";
3
+ import { useKinds as r } from "../../react/groups.js";
4
+ import { useMediaRead as i } from "../../react/read.js";
5
+ import { Button as a } from "../../ui/button.js";
6
+ import { SortableList as o } from "../sortable-list.js";
7
+ import { MediaFolderEditor as s } from "../media-folder-editor.js";
8
+ import { Badge as c } from "../../ui/badge.js";
9
+ import { Input as l } from "../../ui/input.js";
10
+ import { Label as u } from "../../ui/label.js";
11
+ import { Select as d, SelectContent as f, SelectItem as p, SelectTrigger as m, SelectValue as h } from "../../ui/select.js";
12
+ import { Skeleton as g } from "../../ui/skeleton.js";
13
+ import { ErrorLine as _, useAction as v } from "../social/parts.js";
14
+ import { Switch as y } from "../../ui/switch.js";
15
+ import { fromLocalInput as b, parseAttributes as x, toLocalInput as S } from "../../client/group-fields.js";
16
+ import { GroupPicker as C, labelOf as w, useGroupNames as T } from "../groups/parts.js";
17
+ import { OfferFields as E } from "./offer-fields.js";
18
+ import { AttributeFields as D, formOf as O } from "../groups/fields.js";
19
+ import { MembershipEditor as k } from "../groups/memberships.js";
20
+ import { ReaderManifestEditor as A } from "../admin/reader-manifest.js";
21
+ import { VideoMediaEditor as j, videoPaths as M } from "../admin/media-item-panel.js";
22
+ import { useEffect as N, useId as P, useMemo as F, useState as I } from "react";
23
+ import { jsx as L, jsxs as R } from "react/jsx-runtime";
24
+ import { cn as z } from "cn";
22
25
  //#region src/components/content/editors.tsx
23
- var I = "__none__", L = [
26
+ var B = "__none__", V = [
24
27
  "listed",
25
28
  "members",
26
29
  "unlisted"
27
- ], R = [
30
+ ], H = [
28
31
  "open",
29
32
  "closed",
30
33
  "hidden"
31
- ], z = [
34
+ ], U = [
32
35
  "public",
33
36
  "tier",
34
37
  "ppv",
35
38
  "group",
36
39
  "group_ppv"
37
- ], B = (e) => e === "group" || e === "group_ppv";
38
- function V({ title: e, ckui: t, children: n }) {
39
- return /* @__PURE__ */ P("section", {
40
+ ], W = (e) => e === "group" || e === "group_ppv";
41
+ function G({ title: e, ckui: t, children: n }) {
42
+ return /* @__PURE__ */ R("section", {
40
43
  className: "grid gap-3 border-t border-border pt-4",
41
44
  "data-ckui": t,
42
- children: [/* @__PURE__ */ N("h3", {
45
+ children: [/* @__PURE__ */ L("h3", {
43
46
  className: "font-medium",
44
47
  children: e
45
48
  }), n]
46
49
  });
47
50
  }
48
- function H({ show: t }) {
49
- let { t: n } = e();
50
- return t ? /* @__PURE__ */ N("span", {
51
+ function K({ show: e }) {
52
+ let { t: n } = t();
53
+ return e ? /* @__PURE__ */ L("span", {
51
54
  role: "status",
52
55
  className: "text-muted-foreground",
53
56
  children: n("contentEditor.saved")
54
57
  }) : null;
55
58
  }
56
- function U(e, t) {
57
- let { kinds: n } = y({ client: t });
59
+ function q(e, t) {
60
+ let { kinds: n } = r({ client: t });
58
61
  return {
59
62
  model: n,
60
63
  spec: n?.kinds[e]
61
64
  };
62
65
  }
63
- function W({ content: r, ...i }) {
64
- let { t: a } = e(), o = t(i.client), { spec: h } = U(r.kind, i.client), g = j(() => h?.attributes ?? {}, [h]), [v, y] = M(r.listing), [b, x] = M(r.comments), [S, C] = M({});
65
- k(() => {
66
- y(r.listing), x(r.comments), C(E(g, r.attributes));
66
+ function J({ content: e, ...r }) {
67
+ let { t: i } = t(), o = n(r.client), { spec: s } = q(e.kind, r.client), c = F(() => s?.attributes ?? {}, [s]), [l, g] = I(e.listing), [y, b] = I(e.comments), [S, C] = I({});
68
+ N(() => {
69
+ g(e.listing), b(e.comments), C(O(c, e.attributes));
67
70
  }, [
68
- r.revision,
69
- r.listing,
70
- r.comments,
71
- r.attributes,
72
- g
71
+ e.revision,
72
+ e.listing,
73
+ e.comments,
74
+ e.attributes,
75
+ c
73
76
  ]);
74
- let [w, D] = M(null), [O, A] = M(!1), F = m("content.save", i.onError);
75
- return /* @__PURE__ */ N(V, {
76
- title: a("contentEditor.details"),
77
+ let [w, T] = I(null), [E, k] = I(!1), A = v("content.save", r.onError);
78
+ return /* @__PURE__ */ L(G, {
79
+ title: i("contentEditor.details"),
77
80
  ckui: "content-details",
78
- children: /* @__PURE__ */ P("form", {
81
+ children: /* @__PURE__ */ R("form", {
79
82
  className: "grid gap-3",
80
- onSubmit: (e) => {
81
- e.preventDefault(), D(null), A(!1);
82
- let t;
83
+ onSubmit: (t) => {
84
+ t.preventDefault(), T(null), k(!1);
85
+ let n;
83
86
  try {
84
- t = _(g, S);
87
+ n = x(c, S);
85
88
  } catch (e) {
86
- return D(e.message);
89
+ return T(e.message);
87
90
  }
88
- F.run(() => o.contents.update(r.id, {
89
- listing: v,
90
- comments: b,
91
- attributes: t,
92
- revision: r.revision
93
- })).then((e) => e && A(!0));
91
+ A.run(() => o.contents.update(e.id, {
92
+ listing: l,
93
+ comments: y,
94
+ attributes: n,
95
+ revision: e.revision
96
+ })).then((e) => e && k(!0));
94
97
  },
95
98
  children: [
96
- /* @__PURE__ */ P("div", {
99
+ /* @__PURE__ */ R("div", {
97
100
  className: "grid gap-1.5 sm:max-w-xs",
98
- children: [/* @__PURE__ */ N(s, { children: a("contentEditor.listing") }), /* @__PURE__ */ P(c, {
99
- value: v,
100
- onValueChange: (e) => y(e),
101
- children: [/* @__PURE__ */ N(d, {
101
+ children: [/* @__PURE__ */ L(u, { children: i("contentEditor.listing") }), /* @__PURE__ */ R(d, {
102
+ value: l,
103
+ onValueChange: (e) => g(e),
104
+ children: [/* @__PURE__ */ L(m, {
102
105
  size: "sm",
103
- "aria-label": a("contentEditor.listing"),
104
- children: /* @__PURE__ */ N(f, { children: (e) => a(`contentEditor.listing_${e}`) })
105
- }), /* @__PURE__ */ N(l, { children: L.map((e) => /* @__PURE__ */ N(u, {
106
+ "aria-label": i("contentEditor.listing"),
107
+ children: /* @__PURE__ */ L(h, { children: (e) => i(`contentEditor.listing_${e}`) })
108
+ }), /* @__PURE__ */ L(f, { children: V.map((e) => /* @__PURE__ */ L(p, {
106
109
  value: e,
107
- children: a(`contentEditor.listing_${e}`)
110
+ children: i(`contentEditor.listing_${e}`)
108
111
  }, e)) })]
109
112
  })]
110
113
  }),
111
- /* @__PURE__ */ P("div", {
114
+ /* @__PURE__ */ R("div", {
112
115
  className: "grid gap-1.5 sm:max-w-xs",
113
- children: [/* @__PURE__ */ N(s, { children: a("contentEditor.comments") }), /* @__PURE__ */ P(c, {
114
- value: b,
115
- onValueChange: (e) => x(e),
116
- children: [/* @__PURE__ */ N(d, {
116
+ children: [/* @__PURE__ */ L(u, { children: i("contentEditor.comments") }), /* @__PURE__ */ R(d, {
117
+ value: y,
118
+ onValueChange: (e) => b(e),
119
+ children: [/* @__PURE__ */ L(m, {
117
120
  size: "sm",
118
- "aria-label": a("contentEditor.comments"),
119
- children: /* @__PURE__ */ N(f, { children: (e) => a(`contentEditor.comments_${e}`) })
120
- }), /* @__PURE__ */ N(l, { children: R.map((e) => /* @__PURE__ */ N(u, {
121
+ "aria-label": i("contentEditor.comments"),
122
+ children: /* @__PURE__ */ L(h, { children: (e) => i(`contentEditor.comments_${e}`) })
123
+ }), /* @__PURE__ */ L(f, { children: H.map((e) => /* @__PURE__ */ L(p, {
121
124
  value: e,
122
- children: a(`contentEditor.comments_${e}`)
125
+ children: i(`contentEditor.comments_${e}`)
123
126
  }, e)) })]
124
127
  })]
125
128
  }),
126
- /* @__PURE__ */ N(T, {
127
- declared: g,
129
+ /* @__PURE__ */ L(D, {
130
+ declared: c,
128
131
  form: S,
129
132
  onChange: (e, t) => C((n) => ({
130
133
  ...n,
131
134
  [e]: t
132
135
  })),
133
- labels: i.labels
136
+ labels: r.labels
134
137
  }),
135
- w && /* @__PURE__ */ N(p, { children: w }),
136
- /* @__PURE__ */ N(p, { error: F.error }),
137
- /* @__PURE__ */ P("div", {
138
+ w && /* @__PURE__ */ L(_, { children: w }),
139
+ /* @__PURE__ */ L(_, { error: A.error }),
140
+ /* @__PURE__ */ R("div", {
138
141
  className: "flex items-center gap-3",
139
- children: [/* @__PURE__ */ N(n, {
142
+ children: [/* @__PURE__ */ L(a, {
140
143
  type: "submit",
141
144
  size: "sm",
142
- disabled: F.pending,
143
- children: F.pending ? a("common.saving") : a("common.save")
144
- }), /* @__PURE__ */ N(H, { show: O })]
145
+ disabled: A.pending,
146
+ children: A.pending ? i("common.saving") : i("common.save")
147
+ }), /* @__PURE__ */ L(K, { show: E })]
145
148
  })
146
149
  ]
147
150
  })
148
151
  });
149
152
  }
150
- function G({ value: t, onChange: n, model: r, kind: i, owner: a, labels: p, client: m }) {
151
- let { t: _ } = e(), y = A(), C = r?.tiers ?? [], w = r?.kinds[i], T = Object.entries(r?.group_kinds ?? {}).filter(([, e]) => e.sellable || e.auth_scope).map(([e]) => e), [E, D] = M(), O = E ?? T[0] ?? "", k = S(t.group_id ? [t.group_id] : [], { client: m }), j = t.group_id ? k.get(t.group_id) : void 0, F = (e) => n({
152
- ...t,
153
- ...e
154
- }), I = w?.presentation === "reader", L = !!w?.segments;
155
- return /* @__PURE__ */ P("div", {
153
+ function Y({ value: e, onChange: n, model: r, kind: i, owner: a, labels: o, client: s }) {
154
+ let { t: c } = t(), g = P(), _ = r?.tiers ?? [], v = r?.kinds[i], x = Object.entries(r?.group_kinds ?? {}).filter(([, e]) => e.sellable || e.auth_scope).map(([e]) => e), [E, D] = I(), O = E ?? x[0] ?? "", k = T(e.group_id ? [e.group_id] : [], { client: s }), A = e.group_id ? k.get(e.group_id) : void 0, j = (t) => n({
155
+ ...e,
156
+ ...t
157
+ }), M = v?.presentation === "reader", N = !!v?.segments;
158
+ return /* @__PURE__ */ R("div", {
156
159
  className: "grid gap-3",
157
160
  "data-ckui": "rule-fields",
158
161
  children: [
159
- /* @__PURE__ */ P("div", {
162
+ /* @__PURE__ */ R("div", {
160
163
  className: "grid gap-1.5 sm:max-w-xs",
161
- children: [/* @__PURE__ */ N(s, { children: _("contentEditor.access") }), /* @__PURE__ */ P(c, {
162
- value: t.level,
163
- onValueChange: (e) => {
164
- let r = e;
164
+ children: [/* @__PURE__ */ L(u, { children: c("contentEditor.access") }), /* @__PURE__ */ R(d, {
165
+ value: e.level,
166
+ onValueChange: (t) => {
167
+ let r = t;
165
168
  n({
166
169
  level: r,
167
- group_id: B(r) ? t.group_id || a : void 0,
168
- preview: t.preview,
169
- free_after: t.free_after
170
+ group_id: W(r) ? e.group_id || a : void 0,
171
+ preview: e.preview,
172
+ free_after: e.free_after
170
173
  });
171
174
  },
172
- children: [/* @__PURE__ */ N(d, {
175
+ children: [/* @__PURE__ */ L(m, {
173
176
  size: "sm",
174
- "aria-label": _("contentEditor.access"),
175
- children: /* @__PURE__ */ N(f, { children: (e) => _(`contentEditor.level_${e}`) })
176
- }), /* @__PURE__ */ N(l, { children: z.filter((e) => (e !== "tier" || C.length) && (!e.startsWith("group") || T.length)).map((e) => /* @__PURE__ */ N(u, {
177
+ "aria-label": c("contentEditor.access"),
178
+ children: /* @__PURE__ */ L(h, { children: (e) => c(`contentEditor.level_${e}`) })
179
+ }), /* @__PURE__ */ L(f, { children: U.filter((e) => (e !== "tier" || _.length) && (!e.startsWith("group") || x.length)).map((e) => /* @__PURE__ */ L(p, {
177
180
  value: e,
178
- children: _(`contentEditor.level_${e}`)
181
+ children: c(`contentEditor.level_${e}`)
179
182
  }, e)) })]
180
183
  })]
181
184
  }),
182
- t.level === "tier" && /* @__PURE__ */ P("fieldset", {
185
+ e.level === "tier" && /* @__PURE__ */ R("fieldset", {
183
186
  className: "flex flex-wrap gap-3",
184
- children: [/* @__PURE__ */ N("legend", {
187
+ children: [/* @__PURE__ */ L("legend", {
185
188
  className: "sr-only",
186
- children: _("contentEditor.tiers")
187
- }), C.map((e) => /* @__PURE__ */ P("label", {
189
+ children: c("contentEditor.tiers")
190
+ }), _.map((t) => /* @__PURE__ */ R("label", {
188
191
  className: "flex items-center gap-2",
189
- children: [/* @__PURE__ */ N(h, {
190
- checked: t.tiers?.includes(e) ?? !1,
191
- onCheckedChange: (n) => F({ tiers: n ? [...t.tiers ?? [], e] : (t.tiers ?? []).filter((t) => t !== e) }),
192
- "aria-label": x(p, e)
193
- }), x(p, e)]
194
- }, e))]
192
+ children: [/* @__PURE__ */ L(y, {
193
+ checked: e.tiers?.includes(t) ?? !1,
194
+ onCheckedChange: (n) => j({ tiers: n ? [...e.tiers ?? [], t] : (e.tiers ?? []).filter((e) => e !== t) }),
195
+ "aria-label": w(o, t)
196
+ }), w(o, t)]
197
+ }, t))]
195
198
  }),
196
- B(t.level) && /* @__PURE__ */ P("div", {
199
+ W(e.level) && /* @__PURE__ */ R("div", {
197
200
  className: "flex flex-wrap items-end gap-2",
198
201
  children: [
199
- j || t.group_id ? /* @__PURE__ */ N("span", {
202
+ A || e.group_id ? /* @__PURE__ */ L("span", {
200
203
  className: "rounded-md border border-border px-2 py-0.5",
201
204
  "data-ckui": "rule-group",
202
- children: j ? j.name || j.slug : t.group_id
205
+ children: A ? A.name || A.slug : e.group_id
203
206
  }) : null,
204
- T.length > 1 && /* @__PURE__ */ P(c, {
207
+ x.length > 1 && /* @__PURE__ */ R(d, {
205
208
  value: O,
206
209
  onValueChange: (e) => D(String(e)),
207
- children: [/* @__PURE__ */ N(d, {
210
+ children: [/* @__PURE__ */ L(m, {
208
211
  size: "sm",
209
- "aria-label": _("groupEditor.edgeKind"),
210
- children: /* @__PURE__ */ N(f, { children: (e) => x(p, e) })
211
- }), /* @__PURE__ */ N(l, { children: T.map((e) => /* @__PURE__ */ N(u, {
212
+ "aria-label": c("groupEditor.edgeKind"),
213
+ children: /* @__PURE__ */ L(h, { children: (e) => w(o, e) })
214
+ }), /* @__PURE__ */ L(f, { children: x.map((e) => /* @__PURE__ */ L(p, {
212
215
  value: e,
213
- children: x(p, e)
216
+ children: w(o, e)
214
217
  }, e)) })]
215
218
  }),
216
- O && /* @__PURE__ */ N(b, {
219
+ O && /* @__PURE__ */ L(C, {
217
220
  kind: O,
218
- label: _("contentEditor.group"),
219
- client: m,
220
- onPick: (e) => F({ group_id: e.id })
221
+ label: c("contentEditor.group"),
222
+ client: s,
223
+ onPick: (e) => j({ group_id: e.id })
221
224
  }, O)
222
225
  ]
223
226
  }),
224
- t.level !== "public" && /* @__PURE__ */ P("div", {
227
+ e.level !== "public" && /* @__PURE__ */ R("div", {
225
228
  className: "grid gap-3 sm:grid-cols-3",
226
229
  children: [
227
- I && /* @__PURE__ */ P("div", {
230
+ M && /* @__PURE__ */ R("div", {
228
231
  className: "grid gap-1.5",
229
- children: [/* @__PURE__ */ N(s, {
230
- htmlFor: `${y}-pages`,
231
- children: _("contentEditor.previewPages")
232
- }), /* @__PURE__ */ N(o, {
233
- id: `${y}-pages`,
232
+ children: [/* @__PURE__ */ L(u, {
233
+ htmlFor: `${g}-pages`,
234
+ children: c("contentEditor.previewPages")
235
+ }), /* @__PURE__ */ L(l, {
236
+ id: `${g}-pages`,
234
237
  className: "h-8",
235
238
  type: "number",
236
239
  min: 0,
237
- value: t.preview?.pages ?? "",
238
- onChange: (e) => F({ preview: {
239
- ...t.preview,
240
- pages: e.target.value ? Math.max(0, Math.trunc(Number(e.target.value))) : void 0
240
+ value: e.preview?.pages ?? "",
241
+ onChange: (t) => j({ preview: {
242
+ ...e.preview,
243
+ pages: t.target.value ? Math.max(0, Math.trunc(Number(t.target.value))) : void 0
241
244
  } })
242
245
  })]
243
246
  }),
244
- L && /* @__PURE__ */ P("div", {
247
+ N && /* @__PURE__ */ R("div", {
245
248
  className: "grid gap-1.5",
246
- children: [/* @__PURE__ */ N(s, {
247
- htmlFor: `${y}-segments`,
248
- children: _("contentEditor.previewSegments")
249
- }), /* @__PURE__ */ N(o, {
250
- id: `${y}-segments`,
249
+ children: [/* @__PURE__ */ L(u, {
250
+ htmlFor: `${g}-segments`,
251
+ children: c("contentEditor.previewSegments")
252
+ }), /* @__PURE__ */ L(l, {
253
+ id: `${g}-segments`,
251
254
  className: "h-8",
252
255
  type: "number",
253
256
  min: 0,
254
- value: t.preview?.segments ?? "",
255
- onChange: (e) => F({ preview: {
256
- ...t.preview,
257
- segments: e.target.value ? Math.max(0, Math.trunc(Number(e.target.value))) : void 0
257
+ value: e.preview?.segments ?? "",
258
+ onChange: (t) => j({ preview: {
259
+ ...e.preview,
260
+ segments: t.target.value ? Math.max(0, Math.trunc(Number(t.target.value))) : void 0
258
261
  } })
259
262
  })]
260
263
  }),
261
- /* @__PURE__ */ P("div", {
264
+ /* @__PURE__ */ R("div", {
262
265
  className: "grid gap-1.5",
263
- children: [/* @__PURE__ */ N(s, {
264
- htmlFor: `${y}-free`,
265
- children: _("contentEditor.freeAfter")
266
- }), /* @__PURE__ */ N(o, {
267
- id: `${y}-free`,
266
+ children: [/* @__PURE__ */ L(u, {
267
+ htmlFor: `${g}-free`,
268
+ children: c("contentEditor.freeAfter")
269
+ }), /* @__PURE__ */ L(l, {
270
+ id: `${g}-free`,
268
271
  className: "h-8",
269
272
  type: "datetime-local",
270
- value: v(t.free_after),
271
- onChange: (e) => F({ free_after: g(e.target.value) })
273
+ value: S(e.free_after),
274
+ onChange: (e) => j({ free_after: b(e.target.value) })
272
275
  })]
273
276
  })
274
277
  ]
@@ -276,8 +279,8 @@ function G({ value: t, onChange: n, model: r, kind: i, owner: a, labels: p, clie
276
279
  ]
277
280
  });
278
281
  }
279
- var K = (e) => !B(e.level) || !!e.group_id;
280
- function q(e) {
282
+ var X = (e) => !W(e.level) || !!e.group_id;
283
+ function Z(e) {
281
284
  let t = e.preview && (e.preview.pages || e.preview.segments) ? {
282
285
  pages: e.preview.pages || void 0,
283
286
  segments: e.preview.segments || void 0
@@ -290,430 +293,455 @@ function q(e) {
290
293
  free_after: e.level === "public" ? void 0 : e.free_after
291
294
  };
292
295
  }
293
- function J({ content: r, ...i }) {
294
- let { t: a } = e(), o = t(i.client), { model: s } = U(r.kind, i.client), [c, l] = M(r.access);
295
- k(() => l(r.access), [r.revision, r.access]);
296
- let [u, d] = M(!1), f = m("content.save", i.onError), h = m("offer.save", i.onError);
297
- return /* @__PURE__ */ P(V, {
298
- title: a("contentEditor.accessTitle"),
296
+ function ee({ content: e, ...r }) {
297
+ let { t: i } = t(), o = n(r.client), { model: s } = q(e.kind, r.client), [c, l] = I(e.access);
298
+ N(() => l(e.access), [e.revision, e.access]);
299
+ let [u, d] = I(!1), f = v("content.save", r.onError), p = v("offer.save", r.onError);
300
+ return /* @__PURE__ */ R(G, {
301
+ title: i("contentEditor.accessTitle"),
299
302
  ckui: "access-editor",
300
303
  children: [
301
- /* @__PURE__ */ P("form", {
304
+ /* @__PURE__ */ R("form", {
302
305
  className: "grid gap-3",
303
- onSubmit: (e) => {
304
- e.preventDefault(), d(!1), f.run(() => o.contents.update(r.id, {
305
- access: q(c),
306
- revision: r.revision
306
+ onSubmit: (t) => {
307
+ t.preventDefault(), d(!1), f.run(() => o.contents.update(e.id, {
308
+ access: Z(c),
309
+ revision: e.revision
307
310
  })).then((e) => e && d(!0));
308
311
  },
309
312
  children: [
310
- /* @__PURE__ */ N(G, {
313
+ /* @__PURE__ */ L(Y, {
311
314
  value: c,
312
315
  onChange: l,
313
316
  model: s,
314
- kind: r.kind,
315
- owner: r.owner_group_id,
316
- labels: i.labels,
317
+ kind: e.kind,
318
+ owner: e.owner_group_id,
319
+ labels: r.labels,
317
320
  client: o
318
321
  }),
319
- /* @__PURE__ */ N(p, { error: f.error }),
320
- /* @__PURE__ */ P("div", {
322
+ /* @__PURE__ */ L(_, { error: f.error }),
323
+ /* @__PURE__ */ R("div", {
321
324
  className: "flex items-center gap-3",
322
- children: [/* @__PURE__ */ N(n, {
325
+ children: [/* @__PURE__ */ L(a, {
323
326
  type: "submit",
324
327
  size: "sm",
325
- disabled: f.pending || !K(c),
326
- children: f.pending ? a("common.saving") : a("common.save")
327
- }), /* @__PURE__ */ N(H, { show: u })]
328
+ disabled: f.pending || !X(c),
329
+ children: f.pending ? i("common.saving") : i("common.save")
330
+ }), /* @__PURE__ */ L(K, { show: u })]
328
331
  })
329
332
  ]
330
333
  }),
331
- /* @__PURE__ */ N(w, {
332
- offer: r.offer,
333
- pending: h.pending,
334
- onSell: (e) => void h.run(() => o.offers.sell({ content: r.id }, e)),
335
- onWithdraw: () => void h.run(() => o.offers.withdraw({ content: r.id }))
334
+ /* @__PURE__ */ L(E, {
335
+ offer: e.offer,
336
+ pending: p.pending,
337
+ onSell: (t) => void p.run(() => o.offers.sell({ content: e.id }, t)),
338
+ onWithdraw: () => void p.run(() => o.offers.withdraw({ content: e.id }))
336
339
  }),
337
- /* @__PURE__ */ N(p, { error: h.error })
340
+ /* @__PURE__ */ L(_, { error: p.error })
338
341
  ]
339
342
  });
340
343
  }
341
- function Y(e, t, n) {
342
- return e.label || [...e.languages.map(t), ...e.traits.map((e) => x(n, e))].join(" · ");
344
+ function Q(e, t, n) {
345
+ return e.label || [...e.languages.map(t), ...e.traits.map((e) => w(n, e))].join(" · ");
343
346
  }
344
- function X({ content: o, media: s = !0, ...c }) {
345
- let { t: l } = e(), u = t(c.client), d = C(), { model: f, spec: h } = U(o.kind, c.client), g = m("content.save", c.onError), _ = m("content.save", c.onError), [v, y] = M(null), b = j(() => [...o.versions].sort((e, t) => e.position - t.position), [o.versions]);
346
- if (!h) return null;
347
- if (h.versions.hidden) {
347
+ function te({ content: r, media: i = !0, ...s }) {
348
+ let { t: l } = t(), u = n(s.client), d = e(), { model: f, spec: p } = q(r.kind, s.client), m = v("content.save", s.onError), h = v("content.save", s.onError), [g, y] = I(null), b = F(() => [...r.versions].sort((e, t) => e.position - t.position), [r.versions]);
349
+ if (!p) return null;
350
+ if (p.versions.hidden) {
348
351
  let e = b[0];
349
- return !e || !s && !h.segments ? null : /* @__PURE__ */ P(V, {
352
+ return !e || !i && !p.segments ? null : /* @__PURE__ */ R(G, {
350
353
  title: l("contentEditor.media"),
351
354
  ckui: "version-media",
352
- children: [h.segments && /* @__PURE__ */ N($, {
353
- content: o,
355
+ children: [p.segments && /* @__PURE__ */ L($, {
356
+ content: r,
354
357
  version: e,
355
- ...c
356
- }), s && /* @__PURE__ */ N(i, {
357
- item: {
358
- kind: o.kind,
359
- id: o.id,
360
- version: e.id
361
- },
362
- label: l("contentEditor.media")
358
+ ...s
359
+ }), i && /* @__PURE__ */ L(ae, {
360
+ content: r,
361
+ version: e,
362
+ model: f,
363
+ ...s
363
364
  })]
364
365
  });
365
366
  }
366
367
  let x = f?.languages ?? [];
367
- return /* @__PURE__ */ P(V, {
368
+ return /* @__PURE__ */ R(G, {
368
369
  title: l("contentEditor.versions"),
369
370
  ckui: "versions-editor",
370
371
  children: [
371
- /* @__PURE__ */ N(r, {
372
+ /* @__PURE__ */ L(o, {
372
373
  items: b,
373
374
  id: (e) => e.id,
374
- name: (e) => Y(e, d, c.labels),
375
+ name: (e) => Q(e, d, s.labels),
375
376
  label: l("contentEditor.versions"),
376
- disabled: g.pending || b.length < 2,
377
+ disabled: m.pending || b.length < 2,
377
378
  onMove: (e, t) => {
378
- let n = b.map((e) => e.id), [r] = n.splice(e, 1);
379
- n.splice(t, 0, r), g.run(() => u.contents.orderVersions(o.id, n));
379
+ let n = b.map((e) => e.id), [i] = n.splice(e, 1);
380
+ n.splice(t, 0, i), m.run(() => u.contents.orderVersions(r.id, n));
380
381
  },
381
- children: (e, t) => /* @__PURE__ */ P("div", {
382
+ children: (e, t) => /* @__PURE__ */ R("div", {
382
383
  className: "grid gap-2 rounded-md border border-border p-2",
383
384
  "data-ckui": "version-row",
384
385
  "data-version": e.id,
385
- children: [/* @__PURE__ */ P("div", {
386
+ children: [/* @__PURE__ */ R("div", {
386
387
  className: "flex flex-wrap items-center gap-2",
387
388
  children: [
388
389
  b.length > 1 && t,
389
- /* @__PURE__ */ N("span", {
390
+ /* @__PURE__ */ L("span", {
390
391
  className: "min-w-0 flex-1 font-medium break-words",
391
- children: Y(e, d, c.labels)
392
+ children: Q(e, d, s.labels)
392
393
  }),
393
- /* @__PURE__ */ N(a, {
394
+ /* @__PURE__ */ L(c, {
394
395
  variant: e.live ? "default" : "outline",
395
396
  children: l(e.live ? "contentEditor.live" : e.state === "draft" ? "contentManager.draft" : "contentManager.scheduled")
396
397
  }),
397
- e.access && /* @__PURE__ */ N(a, {
398
+ e.access && /* @__PURE__ */ L(c, {
398
399
  variant: "secondary",
399
400
  children: l(`contentEditor.level_${e.access.level}`)
400
401
  }),
401
- e.pages ? /* @__PURE__ */ N("span", {
402
+ e.pages ? /* @__PURE__ */ L("span", {
402
403
  className: "text-xs text-muted-foreground",
403
404
  children: l("contentEditor.pageCount", { count: e.pages })
404
405
  }) : null,
405
- /* @__PURE__ */ N(n, {
406
+ /* @__PURE__ */ L(a, {
406
407
  type: "button",
407
408
  size: "xs",
408
409
  variant: "ghost",
409
- "aria-expanded": v === e.id,
410
- onClick: () => y(v === e.id ? null : e.id),
411
- children: l(v === e.id ? "contentEditor.close" : "contentEditor.edit")
410
+ "aria-expanded": g === e.id,
411
+ onClick: () => y(g === e.id ? null : e.id),
412
+ children: l(g === e.id ? "contentEditor.close" : "contentEditor.edit")
412
413
  })
413
414
  ]
414
- }), v === e.id && /* @__PURE__ */ N(ee, {
415
- content: o,
415
+ }), g === e.id && /* @__PURE__ */ L(ie, {
416
+ content: r,
416
417
  version: e,
417
418
  model: f,
418
- media: s,
419
- ...c
419
+ media: i,
420
+ ...s
420
421
  })]
421
422
  })
422
423
  }),
423
- /* @__PURE__ */ N(p, { error: g.error }),
424
- /* @__PURE__ */ N(Q, {
424
+ /* @__PURE__ */ L(_, { error: m.error }),
425
+ /* @__PURE__ */ L(re, {
425
426
  languages: x,
426
- many: h?.versions.languages === "many",
427
- pending: _.pending,
428
- onAdd: (e) => void _.run(() => u.contents.addVersion(o.id, e))
427
+ many: p?.versions.languages === "many",
428
+ pending: h.pending,
429
+ onAdd: (e) => void h.run(() => u.contents.addVersion(r.id, e)).then((e) => e && y(e.id))
429
430
  }),
430
- /* @__PURE__ */ N(p, { error: _.error })
431
+ /* @__PURE__ */ L(_, { error: h.error })
431
432
  ]
432
433
  });
433
434
  }
434
- function Z({ languages: t, value: n, many: r, onChange: i }) {
435
- let { t: a } = e(), o = C();
436
- return r ? /* @__PURE__ */ P("fieldset", {
435
+ function ne({ languages: n, value: r, many: i, onChange: a }) {
436
+ let { t: o } = t(), s = e();
437
+ return i ? /* @__PURE__ */ R("fieldset", {
437
438
  className: "flex flex-wrap gap-3",
438
- children: [/* @__PURE__ */ N("legend", {
439
+ children: [/* @__PURE__ */ L("legend", {
439
440
  className: "sr-only",
440
- children: a("contentEditor.versionLanguages")
441
- }), t.map((e) => /* @__PURE__ */ P("label", {
441
+ children: o("contentEditor.versionLanguages")
442
+ }), n.map((e) => /* @__PURE__ */ R("label", {
442
443
  className: "flex items-center gap-1.5",
443
- children: [/* @__PURE__ */ N(h, {
444
+ children: [/* @__PURE__ */ L(y, {
444
445
  size: "sm",
445
- checked: n.includes(e),
446
- onCheckedChange: (t) => i(t ? [...n, e] : n.filter((t) => t !== e)),
447
- "aria-label": o(e)
448
- }), o(e)]
446
+ checked: r.includes(e),
447
+ onCheckedChange: (t) => a(t ? [...r, e] : r.filter((t) => t !== e)),
448
+ "aria-label": s(e)
449
+ }), s(e)]
449
450
  }, e))]
450
- }) : /* @__PURE__ */ P(c, {
451
- value: n[0] ?? I,
452
- onValueChange: (e) => i(e === I ? [] : [String(e)]),
453
- children: [/* @__PURE__ */ N(d, {
451
+ }) : /* @__PURE__ */ R(d, {
452
+ value: r[0] ?? B,
453
+ onValueChange: (e) => a(e === B ? [] : [String(e)]),
454
+ children: [/* @__PURE__ */ L(m, {
454
455
  size: "sm",
455
- "aria-label": a("contentEditor.versionLanguage"),
456
- children: /* @__PURE__ */ N(f, { children: (e) => e === I ? a("contentEditor.chooseLanguage") : o(e) })
457
- }), /* @__PURE__ */ N(l, { children: t.map((e) => /* @__PURE__ */ N(u, {
456
+ "aria-label": o("contentEditor.versionLanguage"),
457
+ children: /* @__PURE__ */ L(h, { children: (e) => e === B ? o("contentEditor.chooseLanguage") : s(e) })
458
+ }), /* @__PURE__ */ L(f, { children: n.map((e) => /* @__PURE__ */ L(p, {
458
459
  value: e,
459
- children: o(e)
460
+ children: s(e)
460
461
  }, e)) })]
461
462
  });
462
463
  }
463
- function Q({ languages: t, many: r, pending: i, onAdd: a }) {
464
- let { t: o } = e(), [s, c] = M([]);
465
- return /* @__PURE__ */ P("div", {
464
+ function re({ languages: e, many: n, pending: r, onAdd: i }) {
465
+ let { t: o } = t(), [s, c] = I([]);
466
+ return /* @__PURE__ */ R("div", {
466
467
  className: "flex flex-wrap items-center gap-2",
467
468
  "data-ckui": "add-version",
468
- children: [/* @__PURE__ */ N(Z, {
469
- languages: t,
469
+ children: [/* @__PURE__ */ L(ne, {
470
+ languages: e,
470
471
  value: s,
471
- many: r,
472
+ many: n,
472
473
  onChange: c
473
- }), /* @__PURE__ */ N(n, {
474
+ }), /* @__PURE__ */ L(a, {
474
475
  type: "button",
475
476
  size: "sm",
476
477
  variant: "outline",
477
- disabled: i || !s.length,
478
+ disabled: r || !s.length,
478
479
  onClick: () => {
479
- a({ languages: s }), c([]);
480
+ i({ languages: s }), c([]);
480
481
  },
481
482
  children: o("contentEditor.addVersion")
482
483
  })]
483
484
  });
484
485
  }
485
- function ee({ content: r, version: a, model: c, media: l, ...u }) {
486
- let { t: d } = e(), f = A(), _ = t(u.client), y = c?.kinds[r.kind], [b, S] = M(a.languages), [C, T] = M(a.traits), [E, D] = M(a.label ?? ""), [k, j] = M(a.state === "draft"), [F, I] = M(v(a.publish_at)), [L, R] = M(!!a.access), [z, B] = M(a.access ?? r.access), [V, U] = M(!1), W = m("content.save", u.onError), J = m("content.save", u.onError), Y = m("offer.save", u.onError);
487
- return /* @__PURE__ */ P("div", {
486
+ function ie({ content: e, version: r, model: i, media: o, ...s }) {
487
+ let { t: c } = t(), d = P(), f = n(s.client), p = i?.kinds[e.kind], [m, h] = I(r.languages), [g, x] = I(r.traits), [C, T] = I(r.label ?? ""), [D, O] = I(r.state === "draft"), [k, j] = I(S(r.publish_at)), [M, N] = I(!!r.access), [F, z] = I(r.access ?? e.access), [B, V] = I(!1), H = v("content.save", s.onError), U = v("content.save", s.onError), W = v("offer.save", s.onError);
488
+ return /* @__PURE__ */ R("div", {
488
489
  className: "grid gap-4 pt-2",
489
490
  children: [
490
- /* @__PURE__ */ P("form", {
491
+ /* @__PURE__ */ R("form", {
491
492
  className: "grid gap-3",
492
- onSubmit: (e) => {
493
- e.preventDefault(), U(!1), W.run(() => _.contents.updateVersion(r.id, a.id, {
494
- languages: b,
495
- traits: C,
496
- label: E.trim(),
497
- state: k ? "draft" : "published",
498
- publish_at: g(F),
499
- ...L ? { access: q(z) } : { clear_access: !!a.access }
500
- })).then((e) => e && U(!0));
493
+ onSubmit: (t) => {
494
+ t.preventDefault(), V(!1), H.run(() => f.contents.updateVersion(e.id, r.id, {
495
+ languages: m,
496
+ traits: g,
497
+ label: C.trim(),
498
+ state: D ? "draft" : "published",
499
+ publish_at: b(k),
500
+ ...M ? { access: Z(F) } : { clear_access: !!r.access }
501
+ })).then((e) => e && V(!0));
501
502
  },
502
503
  children: [
503
- /* @__PURE__ */ N(Z, {
504
- languages: c?.languages ?? [],
505
- value: b,
506
- many: y?.versions.languages === "many",
507
- onChange: S
504
+ /* @__PURE__ */ L(ne, {
505
+ languages: i?.languages ?? [],
506
+ value: m,
507
+ many: p?.versions.languages === "many",
508
+ onChange: h
508
509
  }),
509
- !!y?.versions.traits?.length && /* @__PURE__ */ P("fieldset", {
510
+ !!p?.versions.traits?.length && /* @__PURE__ */ R("fieldset", {
510
511
  className: "flex flex-wrap gap-3",
511
- children: [/* @__PURE__ */ N("legend", {
512
+ children: [/* @__PURE__ */ L("legend", {
512
513
  className: "sr-only",
513
- children: d("contentEditor.traits")
514
- }), y.versions.traits.map((e) => /* @__PURE__ */ P("label", {
514
+ children: c("contentEditor.traits")
515
+ }), p.versions.traits.map((e) => /* @__PURE__ */ R("label", {
515
516
  className: "flex items-center gap-1.5",
516
- children: [/* @__PURE__ */ N(h, {
517
+ children: [/* @__PURE__ */ L(y, {
517
518
  size: "sm",
518
- checked: C.includes(e),
519
- onCheckedChange: (t) => T(t ? [...C, e] : C.filter((t) => t !== e)),
520
- "aria-label": x(u.labels, e)
521
- }), x(u.labels, e)]
519
+ checked: g.includes(e),
520
+ onCheckedChange: (t) => x(t ? [...g, e] : g.filter((t) => t !== e)),
521
+ "aria-label": w(s.labels, e)
522
+ }), w(s.labels, e)]
522
523
  }, e))]
523
524
  }),
524
- /* @__PURE__ */ P("div", {
525
+ /* @__PURE__ */ R("div", {
525
526
  className: "grid gap-3 sm:grid-cols-2",
526
- children: [/* @__PURE__ */ P("div", {
527
+ children: [/* @__PURE__ */ R("div", {
527
528
  className: "grid gap-1.5",
528
- children: [/* @__PURE__ */ N(s, {
529
- htmlFor: `${f}-label`,
530
- children: d("contentEditor.versionLabel")
531
- }), /* @__PURE__ */ N(o, {
532
- id: `${f}-label`,
529
+ children: [/* @__PURE__ */ L(u, {
530
+ htmlFor: `${d}-label`,
531
+ children: c("contentEditor.versionLabel")
532
+ }), /* @__PURE__ */ L(l, {
533
+ id: `${d}-label`,
533
534
  className: "h-8",
534
- value: E,
535
- onChange: (e) => D(e.target.value)
535
+ value: C,
536
+ onChange: (e) => T(e.target.value)
536
537
  })]
537
- }), /* @__PURE__ */ P("div", {
538
+ }), /* @__PURE__ */ R("div", {
538
539
  className: "grid gap-1.5",
539
- children: [/* @__PURE__ */ N(s, {
540
- htmlFor: `${f}-at`,
541
- children: d("contentEditor.versionPublishAt")
542
- }), /* @__PURE__ */ N(o, {
543
- id: `${f}-at`,
540
+ children: [/* @__PURE__ */ L(u, {
541
+ htmlFor: `${d}-at`,
542
+ children: c("contentEditor.versionPublishAt")
543
+ }), /* @__PURE__ */ L(l, {
544
+ id: `${d}-at`,
544
545
  className: "h-8",
545
546
  type: "datetime-local",
546
- value: F,
547
- onChange: (e) => I(e.target.value)
547
+ value: k,
548
+ onChange: (e) => j(e.target.value)
548
549
  })]
549
550
  })]
550
551
  }),
551
- /* @__PURE__ */ P("label", {
552
+ /* @__PURE__ */ R("label", {
552
553
  className: "flex items-center gap-2",
553
- children: [/* @__PURE__ */ N(h, {
554
+ children: [/* @__PURE__ */ L(y, {
554
555
  size: "sm",
555
- checked: k,
556
- onCheckedChange: j
557
- }), d("contentEditor.versionDraft")]
556
+ checked: D,
557
+ onCheckedChange: O
558
+ }), c("contentEditor.versionDraft")]
558
559
  }),
559
- /* @__PURE__ */ P("label", {
560
+ /* @__PURE__ */ R("label", {
560
561
  className: "flex items-center gap-2",
561
- children: [/* @__PURE__ */ N(h, {
562
+ children: [/* @__PURE__ */ L(y, {
562
563
  size: "sm",
563
- checked: L,
564
- onCheckedChange: R
565
- }), d("contentEditor.ownAccess")]
564
+ checked: M,
565
+ onCheckedChange: N
566
+ }), c("contentEditor.ownAccess")]
566
567
  }),
567
- L && /* @__PURE__ */ N(G, {
568
- value: z,
569
- onChange: B,
570
- model: c,
571
- kind: r.kind,
572
- owner: r.owner_group_id,
573
- labels: u.labels,
574
- client: _
568
+ M && /* @__PURE__ */ L(Y, {
569
+ value: F,
570
+ onChange: z,
571
+ model: i,
572
+ kind: e.kind,
573
+ owner: e.owner_group_id,
574
+ labels: s.labels,
575
+ client: f
575
576
  }),
576
- /* @__PURE__ */ N(p, { error: W.error }),
577
- /* @__PURE__ */ P("div", {
577
+ /* @__PURE__ */ L(_, { error: H.error }),
578
+ /* @__PURE__ */ R("div", {
578
579
  className: "flex flex-wrap items-center gap-3",
579
580
  children: [
580
- /* @__PURE__ */ N(n, {
581
+ /* @__PURE__ */ L(a, {
581
582
  type: "submit",
582
583
  size: "sm",
583
- disabled: W.pending || !b.length || L && !K(z),
584
- children: W.pending ? d("common.saving") : d("common.save")
584
+ disabled: H.pending || !m.length || M && !X(F),
585
+ children: H.pending ? c("common.saving") : c("common.save")
585
586
  }),
586
- /* @__PURE__ */ N(H, { show: V }),
587
- /* @__PURE__ */ N(n, {
587
+ /* @__PURE__ */ L(K, { show: B }),
588
+ /* @__PURE__ */ L(a, {
588
589
  type: "button",
589
590
  size: "sm",
590
591
  variant: "destructive",
591
592
  className: "ms-auto",
592
- disabled: J.pending,
593
- onClick: () => void J.run(() => _.contents.removeVersion(r.id, a.id)),
594
- children: d("contentEditor.deleteVersion")
593
+ disabled: U.pending,
594
+ onClick: () => void U.run(() => f.contents.removeVersion(e.id, r.id)),
595
+ children: c("contentEditor.deleteVersion")
595
596
  })
596
597
  ]
597
598
  }),
598
- /* @__PURE__ */ N(p, { error: J.error })
599
+ /* @__PURE__ */ L(_, { error: U.error })
599
600
  ]
600
601
  }),
601
- /* @__PURE__ */ N(w, {
602
- offer: a.offer,
603
- pending: Y.pending,
604
- onSell: (e) => void Y.run(() => _.offers.sell({
605
- content: r.id,
606
- version: a.id
607
- }, e)),
608
- onWithdraw: () => void Y.run(() => _.offers.withdraw({
609
- content: r.id,
610
- version: a.id
602
+ /* @__PURE__ */ L(E, {
603
+ offer: r.offer,
604
+ pending: W.pending,
605
+ onSell: (t) => void W.run(() => f.offers.sell({
606
+ content: e.id,
607
+ version: r.id
608
+ }, t)),
609
+ onWithdraw: () => void W.run(() => f.offers.withdraw({
610
+ content: e.id,
611
+ version: r.id
611
612
  }))
612
613
  }),
613
- /* @__PURE__ */ N(p, { error: Y.error }),
614
- y?.segments && /* @__PURE__ */ N($, {
615
- content: r,
616
- version: a,
617
- ...u
614
+ /* @__PURE__ */ L(_, { error: W.error }),
615
+ p?.segments && /* @__PURE__ */ L($, {
616
+ content: e,
617
+ version: r,
618
+ ...s
618
619
  }),
619
- l && /* @__PURE__ */ N(i, {
620
- item: {
621
- kind: r.kind,
622
- id: r.id,
623
- version: a.id
624
- },
625
- label: d("contentEditor.media")
620
+ o && /* @__PURE__ */ L(ae, {
621
+ content: e,
622
+ version: r,
623
+ model: i,
624
+ ...s
626
625
  }),
627
- l && y?.presentation === "reader" && /* @__PURE__ */ N(O, {
628
- content: r.id,
629
- version: a.id,
630
- client: u.client,
631
- onError: u.onError
626
+ o && p?.presentation === "reader" && /* @__PURE__ */ L(A, {
627
+ content: e.id,
628
+ version: r.id,
629
+ client: s.client,
630
+ onError: s.onError
632
631
  })
633
632
  ]
634
633
  });
635
634
  }
636
- function $({ content: r, version: i, ...a }) {
637
- let { t: s } = e(), c = t(a.client), l = () => i.segments.map((e) => ({
635
+ function ae({ content: n, version: r, model: a, ...o }) {
636
+ let { t: c } = t(), l = e(), u = F(() => ({
637
+ kind: n.kind,
638
+ id: n.id,
639
+ version: r.id
640
+ }), [
641
+ n.kind,
642
+ n.id,
643
+ r.id
644
+ ]), d = i(u, {
645
+ editor: !0,
646
+ client: o.client
647
+ }), f = F(() => (a?.languages ?? []).map((e) => ({
648
+ value: e,
649
+ label: l(e)
650
+ })), [a, l]);
651
+ return !d.read && d.loading ? /* @__PURE__ */ L(g, { className: "h-24 w-full" }) : d.read?.uploads && M(d.read.uploads).source ? /* @__PURE__ */ L(j, {
652
+ item: u,
653
+ languages: f,
654
+ client: o.client,
655
+ onError: o.onError
656
+ }) : /* @__PURE__ */ L(s, {
657
+ item: u,
658
+ commit: r.live ? "manual" : "auto",
659
+ label: c("contentEditor.media"),
660
+ client: o.client,
661
+ onError: o.onError
662
+ });
663
+ }
664
+ function $({ content: e, version: r, ...i }) {
665
+ let { t: o } = t(), s = n(i.client), c = () => r.segments.map((e) => ({
638
666
  title: e.title ?? "",
639
667
  start: String(e.start),
640
668
  end: String(e.end),
641
- release: v(e.release_at)
642
- })), [u, d] = M(l);
643
- k(() => d(l()), [JSON.stringify(i.segments)]);
644
- let [f, h] = M(!1), _ = m("content.save", a.onError), y = (e, t) => {
645
- h(!1), d((n) => n.map((n, r) => r === e ? {
669
+ release: S(e.release_at)
670
+ })), [u, d] = I(c);
671
+ N(() => d(c()), [JSON.stringify(r.segments)]);
672
+ let [f, p] = I(!1), m = v("content.save", i.onError), h = (e, t) => {
673
+ p(!1), d((n) => n.map((n, r) => r === e ? {
646
674
  ...n,
647
675
  ...t
648
676
  } : n));
649
- }, b = u.every((e) => /^\d+$/.test(e.start) && /^\d+$/.test(e.end) && Number(e.end) > Number(e.start));
650
- return /* @__PURE__ */ P("div", {
677
+ }, g = u.every((e) => /^\d+$/.test(e.start) && /^\d+$/.test(e.end) && Number(e.end) > Number(e.start));
678
+ return /* @__PURE__ */ R("div", {
651
679
  className: "grid gap-2",
652
680
  "data-ckui": "segments-editor",
653
681
  children: [
654
- /* @__PURE__ */ N("h4", {
682
+ /* @__PURE__ */ L("h4", {
655
683
  className: "text-sm font-medium",
656
- children: s("contentEditor.segments")
684
+ children: o("contentEditor.segments")
657
685
  }),
658
- u.length === 0 && /* @__PURE__ */ N("p", {
686
+ u.length === 0 && /* @__PURE__ */ L("p", {
659
687
  className: "text-muted-foreground",
660
- children: s("contentEditor.noSegments")
688
+ children: o("contentEditor.noSegments")
661
689
  }),
662
- u.map((e, t) => /* @__PURE__ */ P("div", {
690
+ u.map((e, t) => /* @__PURE__ */ R("div", {
663
691
  className: "flex flex-wrap items-center gap-2",
664
692
  "data-ckui": "segment-row",
665
693
  children: [
666
- /* @__PURE__ */ N("span", {
694
+ /* @__PURE__ */ L("span", {
667
695
  className: "w-6 text-xs text-muted-foreground tabular-nums",
668
696
  children: t + 1
669
697
  }),
670
- /* @__PURE__ */ N(o, {
698
+ /* @__PURE__ */ L(l, {
671
699
  className: "h-8 w-40",
672
- "aria-label": s("contentEditor.segmentTitle", { n: t + 1 }),
673
- placeholder: s("contentEditor.segmentTitlePlaceholder"),
700
+ "aria-label": o("contentEditor.segmentTitle", { n: t + 1 }),
701
+ placeholder: o("contentEditor.segmentTitlePlaceholder"),
674
702
  value: e.title,
675
- onChange: (e) => y(t, { title: e.target.value })
703
+ onChange: (e) => h(t, { title: e.target.value })
676
704
  }),
677
- /* @__PURE__ */ N(o, {
705
+ /* @__PURE__ */ L(l, {
678
706
  className: "h-8 w-20",
679
707
  type: "number",
680
708
  min: 0,
681
- "aria-label": s("contentEditor.segmentStart", { n: t + 1 }),
709
+ "aria-label": o("contentEditor.segmentStart", { n: t + 1 }),
682
710
  value: e.start,
683
- onChange: (e) => y(t, { start: e.target.value })
711
+ onChange: (e) => h(t, { start: e.target.value })
684
712
  }),
685
- /* @__PURE__ */ N("span", {
713
+ /* @__PURE__ */ L("span", {
686
714
  "aria-hidden": !0,
687
715
  children: "–"
688
716
  }),
689
- /* @__PURE__ */ N(o, {
717
+ /* @__PURE__ */ L(l, {
690
718
  className: "h-8 w-20",
691
719
  type: "number",
692
720
  min: 1,
693
- "aria-label": s("contentEditor.segmentEnd", { n: t + 1 }),
721
+ "aria-label": o("contentEditor.segmentEnd", { n: t + 1 }),
694
722
  value: e.end,
695
- onChange: (e) => y(t, { end: e.target.value })
723
+ onChange: (e) => h(t, { end: e.target.value })
696
724
  }),
697
- /* @__PURE__ */ N(o, {
725
+ /* @__PURE__ */ L(l, {
698
726
  className: "h-8 w-48",
699
727
  type: "datetime-local",
700
- "aria-label": s("contentEditor.segmentRelease", { n: t + 1 }),
728
+ "aria-label": o("contentEditor.segmentRelease", { n: t + 1 }),
701
729
  value: e.release,
702
- onChange: (e) => y(t, { release: e.target.value })
730
+ onChange: (e) => h(t, { release: e.target.value })
703
731
  }),
704
- /* @__PURE__ */ N(n, {
732
+ /* @__PURE__ */ L(a, {
705
733
  type: "button",
706
734
  size: "xs",
707
735
  variant: "ghost",
708
736
  onClick: () => d((e) => e.filter((e, n) => n !== t)),
709
- children: s("common.remove")
737
+ children: o("common.remove")
710
738
  })
711
739
  ]
712
740
  }, t)),
713
- /* @__PURE__ */ P("div", {
741
+ /* @__PURE__ */ R("div", {
714
742
  className: "flex flex-wrap items-center gap-2",
715
743
  children: [
716
- /* @__PURE__ */ N(n, {
744
+ /* @__PURE__ */ L(a, {
717
745
  type: "button",
718
746
  size: "sm",
719
747
  variant: "outline",
@@ -726,74 +754,74 @@ function $({ content: r, version: i, ...a }) {
726
754
  release: ""
727
755
  }]);
728
756
  },
729
- children: s("contentEditor.addSegment")
757
+ children: o("contentEditor.addSegment")
730
758
  }),
731
- /* @__PURE__ */ N(n, {
759
+ /* @__PURE__ */ L(a, {
732
760
  type: "button",
733
761
  size: "sm",
734
- disabled: _.pending || !b,
762
+ disabled: m.pending || !g,
735
763
  onClick: () => {
736
- h(!1);
737
- let e = u.map((e, t) => ({
764
+ p(!1);
765
+ let t = u.map((e, t) => ({
738
766
  position: t + 1,
739
767
  title: e.title.trim() || void 0,
740
768
  start: Number(e.start),
741
769
  end: Number(e.end),
742
- release_at: g(e.release),
770
+ release_at: b(e.release),
743
771
  released: !1
744
772
  }));
745
- _.run(() => c.contents.setSegments(r.id, i.id, e)).then((e) => e && h(!0));
773
+ m.run(() => s.contents.setSegments(e.id, r.id, t)).then((e) => e && p(!0));
746
774
  },
747
- children: s("contentEditor.saveSegments")
775
+ children: o("contentEditor.saveSegments")
748
776
  }),
749
- /* @__PURE__ */ N(H, { show: f })
777
+ /* @__PURE__ */ L(K, { show: f })
750
778
  ]
751
779
  }),
752
- /* @__PURE__ */ N(p, { error: _.error })
780
+ /* @__PURE__ */ L(_, { error: m.error })
753
781
  ]
754
782
  });
755
783
  }
756
- function te({ content: e, ...t }) {
757
- let n = C(), r = j(() => e.versions.map((e) => ({
784
+ function oe({ content: t, ...n }) {
785
+ let r = e(), i = F(() => t.versions.map((e) => ({
758
786
  id: e.id,
759
- label: Y(e, n, t.labels)
787
+ label: Q(e, r, n.labels)
760
788
  })), [
761
- e.versions,
762
- n,
763
- t.labels
764
- ]), { spec: i } = U(e.kind, t.client);
765
- return /* @__PURE__ */ P("div", {
766
- className: F("grid gap-6", t.className),
789
+ t.versions,
790
+ r,
791
+ n.labels
792
+ ]), { spec: a } = q(t.kind, n.client);
793
+ return /* @__PURE__ */ R("div", {
794
+ className: z("grid gap-6", n.className),
767
795
  "data-ckui": "content-sections",
768
796
  children: [
769
- /* @__PURE__ */ N(W, {
770
- content: e,
771
- ...t
797
+ /* @__PURE__ */ L(J, {
798
+ content: t,
799
+ ...n
772
800
  }),
773
- /* @__PURE__ */ N(J, {
774
- content: e,
775
- ...t
801
+ /* @__PURE__ */ L(ee, {
802
+ content: t,
803
+ ...n
776
804
  }),
777
- /* @__PURE__ */ N(X, {
778
- content: e,
779
- ...t
805
+ /* @__PURE__ */ L(te, {
806
+ content: t,
807
+ ...n
780
808
  }),
781
- !!i?.groups?.length && /* @__PURE__ */ N("section", {
809
+ !!a?.groups?.length && /* @__PURE__ */ L("section", {
782
810
  className: "grid gap-3 border-t border-border pt-4",
783
811
  "data-ckui": "content-groups",
784
- children: /* @__PURE__ */ N(D, {
785
- content: e.id,
786
- contentKind: e.kind,
787
- versions: i.versions.hidden ? void 0 : r,
788
- labels: t.labels,
789
- client: t.client,
790
- onError: t.onError
812
+ children: /* @__PURE__ */ L(k, {
813
+ content: t.id,
814
+ contentKind: t.kind,
815
+ versions: a.versions.hidden ? void 0 : i,
816
+ labels: n.labels,
817
+ client: n.client,
818
+ onError: n.onError
791
819
  })
792
820
  })
793
821
  ]
794
822
  });
795
823
  }
796
824
  //#endregion
797
- export { J as AccessEditor, W as ContentDetailsEditor, te as ContentSections, $ as SegmentsEditor, X as VersionsEditor, Y as versionLabel };
825
+ export { ee as AccessEditor, J as ContentDetailsEditor, oe as ContentSections, $ as SegmentsEditor, te as VersionsEditor, Q as versionLabel };
798
826
 
799
827
  //# sourceMappingURL=editors.js.map