@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,35 +1,35 @@
1
1
  import { toContentKitError as e } from "../../client/errors.js";
2
2
  import { useMessages as t } from "../../i18n/context.js";
3
3
  import { useContentKitClient as n, useErrorReporter as r } from "../../react/context.js";
4
- import { Alert as i, AlertDescription as a } from "../../ui/alert.js";
5
- import { Button as o, buttonVariants as s } from "../../ui/button.js";
6
- import { keyOf as c, useContentScope as l, usePaged as ee } from "../../react/use-resource.js";
7
- import { Badge as te } from "../../ui/badge.js";
8
- import { Input as u } from "../../ui/input.js";
9
- import { Label as d } from "../../ui/label.js";
10
- import { Select as ne, SelectContent as re, SelectItem as f, SelectTrigger as ie, SelectValue as ae } from "../../ui/select.js";
11
- import { Skeleton as p } from "../../ui/skeleton.js";
12
- import { Textarea as m } from "../../ui/textarea.js";
13
- import { ErrorLine as h, RelativeTime as g, contentError as _, formatDate as oe, useAction as se } from "../social/parts.js";
14
- import { AdminRoot as v, LoadFailed as ce, NoAccess as y, Pager as le, Rows as b, pageOf as x, useConfirm as ue } from "./shell.js";
15
- import { localInput as de } from "../social/bans.js";
16
- import { imageRefs as S } from "../../client/contents.js";
17
- import { useAdminLocation as C, useFlowClient as w, useStaffAccess as T } from "../../react/admin.js";
18
- import { ContentSections as E } from "../content/editors.js";
19
- import { useContent as D } from "../../react/contents.js";
20
- import { useEffect as O, useId as k, useMemo as A, useRef as j, useState as M } from "react";
21
- import { Fragment as N, jsx as P, jsxs as F } from "react/jsx-runtime";
4
+ import { keyOf as i, useContentScope as a, usePaged as o } from "../../react/use-resource.js";
5
+ import { Alert as s, AlertDescription as c } from "../../ui/alert.js";
6
+ import { Button as l, buttonVariants as ee } from "../../ui/button.js";
7
+ import { Badge as u } from "../../ui/badge.js";
8
+ import { Input as d } from "../../ui/input.js";
9
+ import { Label as f } from "../../ui/label.js";
10
+ import { Select as te, SelectContent as ne, SelectItem as p, SelectTrigger as re, SelectValue as ie } from "../../ui/select.js";
11
+ import { Skeleton as m } from "../../ui/skeleton.js";
12
+ import { Textarea as h } from "../../ui/textarea.js";
13
+ import { ErrorLine as ae, RelativeTime as g, contentError as _, formatDate as oe, useAction as se } from "../social/parts.js";
14
+ import { AdminRoot as v, LoadFailed as ce, NoAccess as y, Pager as b, Rows as x, pageOf as S, useConfirm as le } from "./shell.js";
15
+ import { localInput as ue } from "../social/bans.js";
16
+ import { imageRefs as C } from "../../client/contents.js";
17
+ import { useAdminLocation as w, useFlowClient as T, useStaffAccess as E } from "../../react/admin.js";
18
+ import { ContentSections as D } from "../content/editors.js";
19
+ import { useContent as O } from "../../react/contents.js";
20
+ import { useEffect as k, useId as A, useMemo as j, useRef as M, useState as N } from "react";
21
+ import { Fragment as P, jsx as F, jsxs as I } from "react/jsx-runtime";
22
22
  //#region src/components/admin/content-manager.tsx
23
- function I(e = {}) {
24
- return T(["contents"], e);
23
+ function L(e = {}) {
24
+ return E(["contents"], e);
25
25
  }
26
- function L(e) {
26
+ function R(e) {
27
27
  return e.moderation === "rejected" ? "rejected" : e.moderation === "held" ? "held" : e.state === "draft" ? "draft" : e.live ? "published" : "scheduled";
28
28
  }
29
- var fe = (e) => (e ?? []).map((e) => typeof e == "string" ? {
29
+ var de = (e) => (e ?? []).map((e) => typeof e == "string" ? {
30
30
  value: e,
31
31
  label: e
32
- } : e), R = {
32
+ } : e), fe = {
33
33
  published: "default",
34
34
  scheduled: "secondary",
35
35
  draft: "outline",
@@ -41,208 +41,208 @@ var fe = (e) => (e ?? []).map((e) => typeof e == "string" ? {
41
41
  "published"
42
42
  ];
43
43
  function B({ client: e, baseUrl: t, auth: n, guard: r, appearance: i, className: a, language: o, messages: s, ...c }) {
44
- let l = w({
44
+ let l = T({
45
45
  client: e,
46
46
  baseUrl: t,
47
47
  auth: n
48
48
  });
49
- return /* @__PURE__ */ P(v, {
49
+ return /* @__PURE__ */ F(v, {
50
50
  flow: "content-manager",
51
51
  appearance: i,
52
52
  className: a,
53
53
  language: o,
54
54
  messages: s,
55
55
  guard: r,
56
- children: /* @__PURE__ */ P(V, {
56
+ children: /* @__PURE__ */ F(V, {
57
57
  ...c,
58
58
  client: l
59
59
  })
60
60
  });
61
61
  }
62
62
  function V({ basePath: e, navigation: n, ...r }) {
63
- let { t: i } = t(), a = C(e, n), s = I({ client: r.client });
64
- return s.loading ? /* @__PURE__ */ P(b, {}) : s.allowed.contents ? a.view ? /* @__PURE__ */ F(N, { children: [/* @__PURE__ */ P(o, {
63
+ let { t: i } = t(), a = w(e, n), o = L({ client: r.client });
64
+ return o.loading ? /* @__PURE__ */ F(x, {}) : o.allowed.contents ? a.view ? /* @__PURE__ */ I(P, { children: [/* @__PURE__ */ F(l, {
65
65
  variant: "ghost",
66
66
  size: "sm",
67
67
  className: "justify-self-start",
68
68
  onClick: () => a.go(""),
69
69
  children: i("contentManager.back")
70
- }), /* @__PURE__ */ P(W, {
70
+ }), /* @__PURE__ */ F(W, {
71
71
  ...r,
72
72
  id: a.view === "new" ? null : a.view,
73
73
  onCreated: (e) => a.go(e.id, void 0, { replace: !0 }),
74
74
  onDeleted: () => a.go("", void 0, { replace: !0 })
75
- }, a.view)] }) : /* @__PURE__ */ P(H, {
75
+ }, a.view)] }) : /* @__PURE__ */ F(H, {
76
76
  ...r,
77
77
  loc: a
78
- }) : /* @__PURE__ */ P(y, { children: i("contentManager.noAccess") });
78
+ }) : /* @__PURE__ */ F(y, { children: i("contentManager.noAccess") });
79
79
  }
80
- function H({ loc: e, client: n, kind: r, languages: i, contentHref: a, pageSize: p = 20, onError: m }) {
81
- let _ = t(), { t: v } = _, y = k(), de = fe(i)[0]?.value, S = e.query.get("q") ?? "", C = z.find((t) => t === e.query.get("status")) ?? "", w = e.query.get("deleted") === "1", T = x(e.query), E = {
82
- q: S,
83
- status: C,
84
- deleted: w ? "1" : void 0
85
- }, D = (t) => e.go("", {
86
- ...E,
80
+ function H({ loc: e, client: n, kind: r, languages: s, contentHref: c, pageSize: m = 20, onError: h }) {
81
+ let _ = t(), { t: v } = _, y = A(), ue = de(s)[0]?.value, C = e.query.get("q") ?? "", w = z.find((t) => t === e.query.get("status")) ?? "", T = e.query.get("deleted") === "1", E = S(e.query), D = {
82
+ q: C,
83
+ status: w,
84
+ deleted: T ? "1" : void 0
85
+ }, O = (t) => e.go("", {
86
+ ...D,
87
87
  ...t
88
- }), [A, j] = M(S);
89
- O(() => j(S), [S]);
90
- let { store: I, scope: B } = l(n), V = w ? "deleted" : C || void 0, H = ee(I, c("contents-page", B, r, S, V, p), {
88
+ }), [j, M] = N(C);
89
+ k(() => M(C), [C]);
90
+ let { store: L, scope: B } = a(n), V = T ? "deleted" : w || void 0, H = o(L, i("contents-page", B, r, C, V, m), {
91
91
  type: "contents",
92
- scope: w ? "deleted" : void 0
93
- }, T, p, (e, t) => n.contents.manage({
92
+ scope: T ? "deleted" : void 0
93
+ }, E, m, (e, t) => n.contents.manage({
94
94
  ...e,
95
95
  kind: r,
96
- q: S || void 0,
96
+ q: C || void 0,
97
97
  state: V,
98
- language: de
99
- }, t)), U = se("content.save", m), { confirm: W, dialog: pe } = ue(), G = async (e) => {
98
+ language: ue
99
+ }, t)), U = se("content.save", h), { confirm: W, dialog: pe } = le(), G = async (e) => {
100
100
  await W({
101
101
  title: v("contentManager.deleteTitle", { title: e.title }),
102
102
  description: v("contentManager.deleteBody"),
103
103
  confirm: v("contentManager.delete")
104
104
  }) && await U.run(() => n.contents.remove(e.id));
105
105
  };
106
- return /* @__PURE__ */ F("div", {
106
+ return /* @__PURE__ */ I("div", {
107
107
  className: "grid gap-4",
108
108
  children: [
109
- /* @__PURE__ */ F("div", {
109
+ /* @__PURE__ */ I("div", {
110
110
  className: "flex flex-wrap items-center justify-between gap-2",
111
- children: [/* @__PURE__ */ P("h2", {
111
+ children: [/* @__PURE__ */ F("h2", {
112
112
  className: "text-base font-semibold",
113
113
  children: v("contentManager.title")
114
- }), /* @__PURE__ */ P(o, {
114
+ }), /* @__PURE__ */ F(l, {
115
115
  size: "sm",
116
116
  onClick: () => e.go("new"),
117
117
  children: v("contentManager.new")
118
118
  })]
119
119
  }),
120
- /* @__PURE__ */ F("div", {
120
+ /* @__PURE__ */ I("div", {
121
121
  className: "flex gap-2",
122
122
  role: "group",
123
123
  "aria-label": v("contentManager.title"),
124
- children: [/* @__PURE__ */ P(o, {
124
+ children: [/* @__PURE__ */ F(l, {
125
125
  size: "sm",
126
- variant: w ? "outline" : "default",
127
- "aria-pressed": !w,
128
- onClick: () => e.go("", { q: S }),
126
+ variant: T ? "outline" : "default",
127
+ "aria-pressed": !T,
128
+ onClick: () => e.go("", { q: C }),
129
129
  children: v("contentManager.items")
130
- }), /* @__PURE__ */ P(o, {
130
+ }), /* @__PURE__ */ F(l, {
131
131
  size: "sm",
132
- variant: w ? "default" : "outline",
133
- "aria-pressed": w,
132
+ variant: T ? "default" : "outline",
133
+ "aria-pressed": T,
134
134
  onClick: () => e.go("", {
135
- q: S,
135
+ q: C,
136
136
  deleted: "1"
137
137
  }),
138
138
  children: v("contentManager.deleted")
139
139
  })]
140
140
  }),
141
- /* @__PURE__ */ F("div", {
141
+ /* @__PURE__ */ I("div", {
142
142
  className: "grid gap-2 sm:grid-cols-[minmax(0,1fr)_auto]",
143
- children: [/* @__PURE__ */ F("form", {
143
+ children: [/* @__PURE__ */ I("form", {
144
144
  className: "flex gap-2",
145
145
  role: "search",
146
146
  onSubmit: (e) => {
147
- e.preventDefault(), D({ q: A.trim() });
147
+ e.preventDefault(), O({ q: j.trim() });
148
148
  },
149
149
  children: [
150
- /* @__PURE__ */ P(d, {
150
+ /* @__PURE__ */ F(f, {
151
151
  htmlFor: `${y}-q`,
152
152
  className: "sr-only",
153
153
  children: v("contentManager.search")
154
154
  }),
155
- /* @__PURE__ */ P(u, {
155
+ /* @__PURE__ */ F(d, {
156
156
  id: `${y}-q`,
157
157
  className: "h-8",
158
158
  type: "search",
159
- value: A,
159
+ value: j,
160
160
  placeholder: v("contentManager.search"),
161
- onChange: (e) => j(e.target.value)
161
+ onChange: (e) => M(e.target.value)
162
162
  }),
163
- /* @__PURE__ */ P(o, {
163
+ /* @__PURE__ */ F(l, {
164
164
  type: "submit",
165
165
  size: "sm",
166
166
  variant: "outline",
167
167
  children: v("moderation.filter")
168
168
  })
169
169
  ]
170
- }), !w && /* @__PURE__ */ F(ne, {
171
- value: C,
172
- onValueChange: (e) => D({ status: String(e ?? "") }),
173
- children: [/* @__PURE__ */ P(ie, {
170
+ }), !T && /* @__PURE__ */ I(te, {
171
+ value: w,
172
+ onValueChange: (e) => O({ status: String(e ?? "") }),
173
+ children: [/* @__PURE__ */ F(re, {
174
174
  size: "sm",
175
175
  "aria-label": v("contentManager.status"),
176
- children: /* @__PURE__ */ P(ae, { children: (e) => v(e ? `contentManager.${e}` : "contentManager.allStatuses") })
177
- }), /* @__PURE__ */ F(re, { children: [/* @__PURE__ */ P(f, {
176
+ children: /* @__PURE__ */ F(ie, { children: (e) => v(e ? `contentManager.${e}` : "contentManager.allStatuses") })
177
+ }), /* @__PURE__ */ I(ne, { children: [/* @__PURE__ */ F(p, {
178
178
  value: "",
179
179
  children: v("contentManager.allStatuses")
180
- }), z.map((e) => /* @__PURE__ */ P(f, {
180
+ }), z.map((e) => /* @__PURE__ */ F(p, {
181
181
  value: e,
182
182
  children: v(`contentManager.${e}`)
183
183
  }, e))] })]
184
184
  })]
185
185
  }),
186
- /* @__PURE__ */ P(h, { error: U.error }),
187
- H.loading && !H.items.length ? /* @__PURE__ */ P(b, {}) : H.error && !H.items.length ? /* @__PURE__ */ P(ce, {
186
+ /* @__PURE__ */ F(ae, { error: U.error }),
187
+ H.loading && !H.items.length ? /* @__PURE__ */ F(x, {}) : H.error && !H.items.length ? /* @__PURE__ */ F(ce, {
188
188
  error: H.error,
189
189
  message: v("contentManager.loadFailed"),
190
190
  retry: H.reload
191
- }) : H.items.length ? /* @__PURE__ */ P("ul", {
191
+ }) : H.items.length ? /* @__PURE__ */ F("ul", {
192
192
  className: "grid divide-y divide-border rounded-lg border border-border",
193
193
  "aria-busy": H.loading,
194
194
  children: H.items.map((t) => {
195
- let r = L(t), i = r === "published" ? a?.(t) : void 0;
196
- return /* @__PURE__ */ F("li", {
195
+ let r = R(t), i = r === "published" ? c?.(t) : void 0;
196
+ return /* @__PURE__ */ I("li", {
197
197
  className: "flex flex-wrap items-start gap-3 p-3",
198
198
  "data-ckui": "content-row",
199
- "data-status": w ? "deleted" : r,
200
- children: [/* @__PURE__ */ F("div", {
199
+ "data-status": T ? "deleted" : r,
200
+ children: [/* @__PURE__ */ I("div", {
201
201
  className: "grid min-w-0 flex-1 gap-1",
202
- children: [w ? /* @__PURE__ */ P("span", {
202
+ children: [T ? /* @__PURE__ */ F("span", {
203
203
  className: "font-medium break-words",
204
204
  children: t.title
205
- }) : /* @__PURE__ */ P("button", {
205
+ }) : /* @__PURE__ */ F("button", {
206
206
  type: "button",
207
207
  className: "text-left font-medium break-words hover:underline",
208
208
  onClick: () => e.go(t.id),
209
209
  children: t.title
210
- }), /* @__PURE__ */ F("div", {
210
+ }), /* @__PURE__ */ I("div", {
211
211
  className: "flex flex-wrap items-center gap-x-2 gap-y-1 text-xs text-muted-foreground",
212
212
  children: [
213
- !w && /* @__PURE__ */ P(te, {
214
- variant: R[r],
213
+ !T && /* @__PURE__ */ F(u, {
214
+ variant: fe[r],
215
215
  children: v(`contentManager.${r}`)
216
216
  }),
217
- /* @__PURE__ */ P("span", { children: t.language }),
218
- /* @__PURE__ */ P(g, { at: w && t.deleted_at ? t.deleted_at : t.updated_at }),
219
- r === "scheduled" && t.publish_at && /* @__PURE__ */ P("span", { children: v("pollManager.goesLive", { date: oe(_, t.publish_at) }) })
217
+ /* @__PURE__ */ F("span", { children: t.language }),
218
+ /* @__PURE__ */ F(g, { at: T && t.deleted_at ? t.deleted_at : t.updated_at }),
219
+ r === "scheduled" && t.publish_at && /* @__PURE__ */ F("span", { children: v("pollManager.goesLive", { date: oe(_, t.publish_at) }) })
220
220
  ]
221
221
  })]
222
- }), /* @__PURE__ */ P("div", {
222
+ }), /* @__PURE__ */ F("div", {
223
223
  className: "flex flex-wrap gap-2",
224
- children: w ? /* @__PURE__ */ P(o, {
224
+ children: T ? /* @__PURE__ */ F(l, {
225
225
  size: "sm",
226
226
  variant: "outline",
227
227
  disabled: U.pending,
228
228
  onClick: () => void U.run(() => n.contents.restore(t.id)),
229
229
  children: v("moderation.restore")
230
- }) : /* @__PURE__ */ F(N, { children: [
231
- i && /* @__PURE__ */ P("a", {
232
- className: s({
230
+ }) : /* @__PURE__ */ I(P, { children: [
231
+ i && /* @__PURE__ */ F("a", {
232
+ className: ee({
233
233
  size: "sm",
234
234
  variant: "ghost"
235
235
  }),
236
236
  href: i,
237
237
  children: v("contentManager.view")
238
238
  }),
239
- /* @__PURE__ */ P(o, {
239
+ /* @__PURE__ */ F(l, {
240
240
  size: "sm",
241
241
  variant: "outline",
242
242
  onClick: () => e.go(t.id),
243
243
  children: v("comments.edit")
244
244
  }),
245
- /* @__PURE__ */ P(o, {
245
+ /* @__PURE__ */ F(l, {
246
246
  size: "sm",
247
247
  variant: "destructive",
248
248
  disabled: U.pending,
@@ -253,16 +253,16 @@ function H({ loc: e, client: n, kind: r, languages: i, contentHref: a, pageSize:
253
253
  })]
254
254
  }, t.id);
255
255
  })
256
- }) : /* @__PURE__ */ P("p", {
256
+ }) : /* @__PURE__ */ F("p", {
257
257
  className: "text-muted-foreground",
258
- children: v(w ? "contentManager.noDeleted" : "contentManager.empty")
258
+ children: v(T ? "contentManager.noDeleted" : "contentManager.empty")
259
259
  }),
260
- /* @__PURE__ */ P(le, {
261
- page: T,
260
+ /* @__PURE__ */ F(b, {
261
+ page: E,
262
262
  hasNext: H.hasNext,
263
263
  disabled: H.loading,
264
264
  onPage: (t) => e.go("", {
265
- ...E,
265
+ ...D,
266
266
  page: t > 1 ? t : void 0
267
267
  })
268
268
  }),
@@ -277,31 +277,31 @@ var U = {
277
277
  publishAt: "",
278
278
  body: ""
279
279
  };
280
- function W({ id: s, client: c, kind: l, languages: ee, renderEditor: g, contentHref: oe, labels: se, ownerGroup: v, onCreated: y, onDeleted: le, onError: b }) {
281
- let x = n(c), C = t(), { t: w } = C, T = k(), j = fe(ee), [I, z] = M(j[0]?.value ?? "en"), B = D(s, l, I, { client: x }), V = r(b), [H, W] = M(s ? null : U), [G, K] = M(null), [me, q] = M(null), { confirm: he, dialog: ge } = ue(), J = B.content;
282
- O(() => {
280
+ function W({ id: i, client: a, kind: o, languages: ee, renderEditor: g, contentHref: oe, labels: se, ownerGroup: v, onCreated: y, onDeleted: b, onError: x }) {
281
+ let S = n(a), w = t(), { t: T } = w, E = A(), M = de(ee), [L, z] = N(M[0]?.value ?? "en"), B = O(i, o, L, { client: S }), V = r(x), [H, W] = N(i ? null : U), [G, K] = N(null), [me, q] = N(null), { confirm: he, dialog: ge } = le(), J = B.content;
282
+ k(() => {
283
283
  if (!J) return;
284
- let e = J.text?.[I];
284
+ let e = J.text?.[L];
285
285
  W((t) => t ?? {
286
286
  title: e?.title ?? "",
287
287
  slug: e?.slug ?? "",
288
288
  description: e?.description ?? "",
289
289
  body: e?.body ?? "",
290
- publishAt: J.publish_at && !J.live ? de(new Date(J.publish_at)) : ""
290
+ publishAt: J.publish_at && !J.live ? ue(new Date(J.publish_at)) : ""
291
291
  });
292
- }, [J, I]);
293
- let { imageSrc: _e } = B, ve = A(() => (H?.body ?? "").replace(S(), (e, t) => {
292
+ }, [J, L]);
293
+ let { imageSrc: _e } = B, ve = j(() => (H?.body ?? "").replace(C(), (e, t) => {
294
294
  let n = _e(t);
295
295
  return n && n !== t ? n.replaceAll("&", "&") : e;
296
296
  }), [H?.body, _e]);
297
- if (s && !H) return B.error ? /* @__PURE__ */ P(ce, {
297
+ if (i && !H) return B.error ? /* @__PURE__ */ F(ce, {
298
298
  error: B.error,
299
- message: w("contentManager.loadFailed"),
299
+ message: T("contentManager.loadFailed"),
300
300
  retry: B.reload
301
- }) : /* @__PURE__ */ F("div", {
301
+ }) : /* @__PURE__ */ I("div", {
302
302
  className: "grid gap-3",
303
303
  "aria-busy": !0,
304
- children: [/* @__PURE__ */ P(p, { className: "h-9 w-full" }), /* @__PURE__ */ P(p, { className: "h-48 w-full" })]
304
+ children: [/* @__PURE__ */ F(m, { className: "h-9 w-full" }), /* @__PURE__ */ F(m, { className: "h-48 w-full" })]
305
305
  });
306
306
  let Y = H, X = (e) => W((t) => ({
307
307
  ...t,
@@ -315,21 +315,21 @@ function W({ id: s, client: c, kind: l, languages: ee, renderEditor: g, contentH
315
315
  description: Y.description.trim(),
316
316
  body: Y.body
317
317
  }), be = async () => {
318
- if (K(null), q(null), !Y.title.trim()) return K(w("contentManager.titleRequired"));
318
+ if (K(null), q(null), !Y.title.trim()) return K(T("contentManager.titleRequired"));
319
319
  try {
320
320
  if (!J) {
321
321
  let e = await B.create({
322
- kind: l,
323
- text: { [I]: ye() },
322
+ kind: o,
323
+ text: { [L]: ye() },
324
324
  owner_group_id: v
325
325
  });
326
326
  y?.(e);
327
327
  return;
328
328
  }
329
329
  let e = await B.putText(ye());
330
- q(w("pollEditor.saved")), W((t) => ({
330
+ q(T("pollEditor.saved")), W((t) => ({
331
331
  ...t,
332
- slug: e.text?.[I]?.slug ?? t.slug
332
+ slug: e.text?.[L]?.slug ?? t.slug
333
333
  }));
334
334
  } catch (e) {
335
335
  Z(e);
@@ -337,229 +337,229 @@ function W({ id: s, client: c, kind: l, languages: ee, renderEditor: g, contentH
337
337
  }, xe = async (e) => {
338
338
  K(null), q(null);
339
339
  try {
340
- e ? await B.publish(Y.publishAt ? new Date(Y.publishAt).toISOString() : void 0) : await B.unpublish(), q(w(e ? "contentManager.publishedNotice" : "contentManager.unpublishedNotice"));
340
+ e ? await B.publish(Y.publishAt ? new Date(Y.publishAt).toISOString() : void 0) : await B.unpublish(), q(T(e ? "contentManager.publishedNotice" : "contentManager.unpublishedNotice"));
341
341
  } catch (e) {
342
342
  Z(e);
343
343
  }
344
344
  }, Se = async () => {
345
345
  if (J && await he({
346
- title: w("contentManager.deleteTitle", { title: J.title }),
347
- description: w("contentManager.deleteBody"),
348
- confirm: w("contentManager.delete")
346
+ title: T("contentManager.deleteTitle", { title: J.title }),
347
+ description: T("contentManager.deleteBody"),
348
+ confirm: T("contentManager.delete")
349
349
  })) try {
350
- await B.remove(), le?.(J);
350
+ await B.remove(), b?.(J);
351
351
  } catch (e) {
352
352
  Z(e);
353
353
  }
354
- }, Q = J ? L(J) : "draft", Ce = J && Q === "published" ? oe?.(J) : void 0, $ = {
354
+ }, Q = J ? R(J) : "draft", Ce = J && Q === "published" ? oe?.(J) : void 0, $ = {
355
355
  value: ve,
356
356
  onChange: (e) => X({ body: B.storedBody(e) }),
357
357
  uploadImage: J ? (e) => B.uploadImage(e) : void 0,
358
358
  disabled: B.saving,
359
- placeholder: w("contentManager.bodyPlaceholder"),
360
- "aria-label": w("contentManager.body")
359
+ placeholder: T("contentManager.bodyPlaceholder"),
360
+ "aria-label": T("contentManager.body")
361
361
  };
362
- return /* @__PURE__ */ F(N, { children: [/* @__PURE__ */ F("form", {
362
+ return /* @__PURE__ */ I(P, { children: [/* @__PURE__ */ I("form", {
363
363
  className: "grid gap-4",
364
364
  "data-ckui": "content-form",
365
365
  onSubmit: (e) => {
366
366
  e.preventDefault(), be();
367
367
  },
368
368
  children: [
369
- /* @__PURE__ */ F("div", {
369
+ /* @__PURE__ */ I("div", {
370
370
  className: "flex flex-wrap items-center gap-2",
371
371
  children: [
372
- /* @__PURE__ */ P("h2", {
372
+ /* @__PURE__ */ F("h2", {
373
373
  className: "text-base font-semibold",
374
- children: w(J ? "contentManager.editTitle" : "contentManager.newTitle")
374
+ children: T(J ? "contentManager.editTitle" : "contentManager.newTitle")
375
375
  }),
376
- J && /* @__PURE__ */ P(te, {
377
- variant: R[Q],
378
- children: w(`contentManager.${Q}`)
376
+ J && /* @__PURE__ */ F(u, {
377
+ variant: fe[Q],
378
+ children: T(`contentManager.${Q}`)
379
379
  }),
380
- Ce && /* @__PURE__ */ P("a", {
380
+ Ce && /* @__PURE__ */ F("a", {
381
381
  className: "text-xs text-muted-foreground hover:underline",
382
382
  href: Ce,
383
- children: w("contentManager.view")
383
+ children: T("contentManager.view")
384
384
  })
385
385
  ]
386
386
  }),
387
- J?.moderation && /* @__PURE__ */ P(i, {
387
+ J?.moderation && /* @__PURE__ */ F(s, {
388
388
  variant: J.moderation === "rejected" ? "destructive" : "default",
389
- children: /* @__PURE__ */ P(a, { children: J.moderation_reason ? w(`contentManager.${J.moderation === "rejected" ? "rejectedBecause" : "heldBecause"}`, { reason: J.moderation_reason }) : w(`contentManager.${J.moderation === "rejected" ? "rejectedNote" : "heldNote"}`) })
389
+ children: /* @__PURE__ */ F(c, { children: J.moderation_reason ? T(`contentManager.${J.moderation === "rejected" ? "rejectedBecause" : "heldBecause"}`, { reason: J.moderation_reason }) : T(`contentManager.${J.moderation === "rejected" ? "rejectedNote" : "heldNote"}`) })
390
390
  }),
391
- j.length > 1 && /* @__PURE__ */ F("div", {
391
+ M.length > 1 && /* @__PURE__ */ I("div", {
392
392
  className: "grid gap-1.5",
393
- children: [/* @__PURE__ */ P(d, {
394
- htmlFor: `${T}-lang`,
395
- children: w("contentManager.language")
396
- }), /* @__PURE__ */ F(ne, {
397
- value: I,
393
+ children: [/* @__PURE__ */ F(f, {
394
+ htmlFor: `${E}-lang`,
395
+ children: T("contentManager.language")
396
+ }), /* @__PURE__ */ I(te, {
397
+ value: L,
398
398
  onValueChange: (e) => {
399
399
  z(String(e ?? "")), W(J ? null : U);
400
400
  },
401
- children: [/* @__PURE__ */ P(ie, {
402
- id: `${T}-lang`,
401
+ children: [/* @__PURE__ */ F(re, {
402
+ id: `${E}-lang`,
403
403
  className: "w-full",
404
- children: /* @__PURE__ */ P(ae, { children: (e) => j.find((t) => t.value === e)?.label ?? e })
405
- }), /* @__PURE__ */ P(re, { children: j.map((e) => /* @__PURE__ */ P(f, {
404
+ children: /* @__PURE__ */ F(ie, { children: (e) => M.find((t) => t.value === e)?.label ?? e })
405
+ }), /* @__PURE__ */ F(ne, { children: M.map((e) => /* @__PURE__ */ F(p, {
406
406
  value: e.value,
407
407
  children: e.label
408
408
  }, e.value)) })]
409
409
  })]
410
410
  }),
411
- /* @__PURE__ */ F("div", {
411
+ /* @__PURE__ */ I("div", {
412
412
  className: "grid gap-1.5",
413
- children: [/* @__PURE__ */ P(d, {
414
- htmlFor: `${T}-title`,
415
- children: w("contentManager.itemTitle")
416
- }), /* @__PURE__ */ P(u, {
417
- id: `${T}-title`,
413
+ children: [/* @__PURE__ */ F(f, {
414
+ htmlFor: `${E}-title`,
415
+ children: T("contentManager.itemTitle")
416
+ }), /* @__PURE__ */ F(d, {
417
+ id: `${E}-title`,
418
418
  value: Y.title,
419
419
  required: !0,
420
420
  maxLength: 300,
421
421
  onChange: (e) => X({ title: e.target.value })
422
422
  })]
423
423
  }),
424
- /* @__PURE__ */ F("div", {
424
+ /* @__PURE__ */ I("div", {
425
425
  className: "grid gap-4 sm:grid-cols-2",
426
- children: [/* @__PURE__ */ F("div", {
426
+ children: [/* @__PURE__ */ I("div", {
427
427
  className: "grid gap-1.5",
428
- children: [/* @__PURE__ */ P(d, {
429
- htmlFor: `${T}-slug`,
430
- children: w("contentManager.slug")
431
- }), /* @__PURE__ */ P(u, {
432
- id: `${T}-slug`,
428
+ children: [/* @__PURE__ */ F(f, {
429
+ htmlFor: `${E}-slug`,
430
+ children: T("contentManager.slug")
431
+ }), /* @__PURE__ */ F(d, {
432
+ id: `${E}-slug`,
433
433
  value: Y.slug,
434
- placeholder: w("contentManager.slugAuto"),
434
+ placeholder: T("contentManager.slugAuto"),
435
435
  onChange: (e) => X({ slug: e.target.value })
436
436
  })]
437
- }), /* @__PURE__ */ F("div", {
437
+ }), /* @__PURE__ */ I("div", {
438
438
  className: "grid gap-1.5",
439
- children: [/* @__PURE__ */ P(d, {
440
- htmlFor: `${T}-publish`,
441
- children: w("contentManager.publishAt")
442
- }), /* @__PURE__ */ P(u, {
443
- id: `${T}-publish`,
439
+ children: [/* @__PURE__ */ F(f, {
440
+ htmlFor: `${E}-publish`,
441
+ children: T("contentManager.publishAt")
442
+ }), /* @__PURE__ */ F(d, {
443
+ id: `${E}-publish`,
444
444
  type: "datetime-local",
445
445
  value: Y.publishAt,
446
446
  onChange: (e) => X({ publishAt: e.target.value })
447
447
  })]
448
448
  })]
449
449
  }),
450
- /* @__PURE__ */ F("div", {
450
+ /* @__PURE__ */ I("div", {
451
451
  className: "grid gap-1.5",
452
- children: [/* @__PURE__ */ P(d, {
453
- htmlFor: `${T}-description`,
454
- children: w("contentManager.description")
455
- }), /* @__PURE__ */ P(m, {
456
- id: `${T}-description`,
452
+ children: [/* @__PURE__ */ F(f, {
453
+ htmlFor: `${E}-description`,
454
+ children: T("contentManager.description")
455
+ }), /* @__PURE__ */ F(h, {
456
+ id: `${E}-description`,
457
457
  rows: 2,
458
458
  value: Y.description,
459
459
  onChange: (e) => X({ description: e.target.value })
460
460
  })]
461
461
  }),
462
- /* @__PURE__ */ P(pe, {
462
+ /* @__PURE__ */ F(pe, {
463
463
  item: J,
464
464
  src: B.coverSrc,
465
465
  saving: B.saving,
466
466
  onFile: (e) => void B.setCover(e).catch(Z)
467
467
  }),
468
- /* @__PURE__ */ F("div", {
468
+ /* @__PURE__ */ I("div", {
469
469
  className: "grid gap-1.5",
470
470
  children: [
471
- /* @__PURE__ */ P("span", {
471
+ /* @__PURE__ */ F("span", {
472
472
  className: "text-sm font-medium",
473
- children: w("contentManager.body")
473
+ children: T("contentManager.body")
474
474
  }),
475
- g ? g($) : /* @__PURE__ */ P(m, {
475
+ g ? g($) : /* @__PURE__ */ F(h, {
476
476
  "aria-label": $["aria-label"],
477
477
  rows: 12,
478
478
  value: Y.body,
479
479
  placeholder: $.placeholder,
480
480
  onChange: (e) => X({ body: e.target.value })
481
481
  }),
482
- !J && /* @__PURE__ */ P("p", {
482
+ !J && /* @__PURE__ */ F("p", {
483
483
  className: "text-xs text-muted-foreground",
484
- children: w("contentManager.imagesAfterCreate")
484
+ children: T("contentManager.imagesAfterCreate")
485
485
  })
486
486
  ]
487
487
  }),
488
- G && /* @__PURE__ */ P(h, { children: typeof G == "string" ? G : _(C, G) }),
489
- me && !G && /* @__PURE__ */ P("p", {
488
+ G && /* @__PURE__ */ F(ae, { children: typeof G == "string" ? G : _(w, G) }),
489
+ me && !G && /* @__PURE__ */ F("p", {
490
490
  role: "status",
491
491
  className: "text-sm text-muted-foreground",
492
492
  children: me
493
493
  }),
494
- /* @__PURE__ */ F("div", {
494
+ /* @__PURE__ */ I("div", {
495
495
  className: "flex flex-wrap gap-2 border-t border-border pt-4",
496
496
  children: [
497
- /* @__PURE__ */ P(o, {
497
+ /* @__PURE__ */ F(l, {
498
498
  type: "submit",
499
499
  disabled: B.saving,
500
- children: B.saving ? w("common.saving") : w(J ? "common.save" : "contentManager.createDraft")
500
+ children: B.saving ? T("common.saving") : T(J ? "common.save" : "contentManager.createDraft")
501
501
  }),
502
- J && !J.live && /* @__PURE__ */ P(o, {
502
+ J && !J.live && /* @__PURE__ */ F(l, {
503
503
  type: "button",
504
504
  variant: "outline",
505
505
  disabled: B.saving,
506
506
  onClick: () => void xe(!0),
507
- children: w("contentManager.publish")
507
+ children: T("contentManager.publish")
508
508
  }),
509
- J?.state === "published" && /* @__PURE__ */ P(o, {
509
+ J?.state === "published" && /* @__PURE__ */ F(l, {
510
510
  type: "button",
511
511
  variant: "outline",
512
512
  disabled: B.saving,
513
513
  onClick: () => void xe(!1),
514
- children: w("contentManager.unpublish")
514
+ children: T("contentManager.unpublish")
515
515
  }),
516
- J && /* @__PURE__ */ P(o, {
516
+ J && /* @__PURE__ */ F(l, {
517
517
  type: "button",
518
518
  variant: "destructive",
519
519
  className: "ms-auto",
520
520
  disabled: B.saving,
521
521
  onClick: () => void Se(),
522
- children: w("contentManager.delete")
522
+ children: T("contentManager.delete")
523
523
  })
524
524
  ]
525
525
  }),
526
526
  ge
527
527
  ]
528
- }), J && /* @__PURE__ */ P(E, {
528
+ }), J && /* @__PURE__ */ F(D, {
529
529
  content: J,
530
- client: x,
531
- onError: b,
530
+ client: S,
531
+ onError: x,
532
532
  labels: se
533
533
  })] });
534
534
  }
535
535
  function pe({ item: e, src: n, saving: r, onFile: i }) {
536
- let { t: a } = t(), s = j(null);
537
- return /* @__PURE__ */ F("div", {
536
+ let { t: a } = t(), o = M(null);
537
+ return /* @__PURE__ */ I("div", {
538
538
  className: "grid gap-1.5",
539
539
  "data-ckui": "content-cover",
540
- children: [/* @__PURE__ */ P("span", {
540
+ children: [/* @__PURE__ */ F("span", {
541
541
  className: "text-sm font-medium",
542
542
  children: a("contentManager.cover")
543
- }), e ? /* @__PURE__ */ F("div", {
543
+ }), e ? /* @__PURE__ */ I("div", {
544
544
  className: "flex flex-wrap items-center gap-3",
545
545
  children: [
546
- n ? /* @__PURE__ */ P("img", {
546
+ n ? /* @__PURE__ */ F("img", {
547
547
  src: n,
548
548
  alt: "",
549
549
  className: "h-20 w-36 rounded-md border border-border object-cover"
550
- }) : /* @__PURE__ */ P("span", {
550
+ }) : /* @__PURE__ */ F("span", {
551
551
  className: "text-muted-foreground",
552
552
  children: a("contentManager.noCover")
553
553
  }),
554
- /* @__PURE__ */ P(o, {
554
+ /* @__PURE__ */ F(l, {
555
555
  type: "button",
556
556
  size: "sm",
557
557
  variant: "outline",
558
558
  disabled: r,
559
- onClick: () => s.current?.click(),
559
+ onClick: () => o.current?.click(),
560
560
  children: a(n ? "pollEditor.replaceImage" : "contentManager.addCover")
561
561
  }),
562
- n && /* @__PURE__ */ P(o, {
562
+ n && /* @__PURE__ */ F(l, {
563
563
  type: "button",
564
564
  size: "sm",
565
565
  variant: "ghost",
@@ -567,8 +567,8 @@ function pe({ item: e, src: n, saving: r, onFile: i }) {
567
567
  onClick: () => i(null),
568
568
  children: a("pollEditor.removeImage")
569
569
  }),
570
- /* @__PURE__ */ P("input", {
571
- ref: s,
570
+ /* @__PURE__ */ F("input", {
571
+ ref: o,
572
572
  type: "file",
573
573
  accept: "image/*",
574
574
  hidden: !0,
@@ -579,13 +579,13 @@ function pe({ item: e, src: n, saving: r, onFile: i }) {
579
579
  }
580
580
  })
581
581
  ]
582
- }) : /* @__PURE__ */ P("p", {
582
+ }) : /* @__PURE__ */ F("p", {
583
583
  className: "text-xs text-muted-foreground",
584
584
  children: a("contentManager.imagesAfterCreate")
585
585
  })]
586
586
  });
587
587
  }
588
588
  //#endregion
589
- export { W as ContentEditor, B as ContentManager, L as contentStatus, I as useContentManagerAccess };
589
+ export { W as ContentEditor, B as ContentManager, R as contentStatus, L as useContentManagerAccess };
590
590
 
591
591
  //# sourceMappingURL=content-manager.js.map