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