@openrails/contentkit-ui 0.103.2 → 0.104.0-rc.2

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 (253) hide show
  1. package/README.md +111 -49
  2. package/dist/client/beacons.d.ts +3 -13
  3. package/dist/client/beacons.js +8 -46
  4. package/dist/client/beacons.js.map +1 -1
  5. package/dist/client/client.d.ts +3 -0
  6. package/dist/client/client.js +45 -43
  7. package/dist/client/client.js.map +1 -1
  8. package/dist/client/content/favorites.d.ts +2 -0
  9. package/dist/client/content/favorites.js.map +1 -1
  10. package/dist/client/content/types.d.ts +3 -0
  11. package/dist/client/content/types.js.map +1 -1
  12. package/dist/client/contents.d.ts +7 -1
  13. package/dist/client/contents.js +8 -0
  14. package/dist/client/contents.js.map +1 -1
  15. package/dist/client/discovery.d.ts +34 -5
  16. package/dist/client/discovery.js +23 -2
  17. package/dist/client/discovery.js.map +1 -1
  18. package/dist/client/engagement.d.ts +70 -0
  19. package/dist/client/engagement.js +191 -0
  20. package/dist/client/engagement.js.map +1 -0
  21. package/dist/client/generated/routes.d.ts +74 -35
  22. package/dist/client/generated/routes.js +119 -60
  23. package/dist/client/generated/routes.js.map +1 -1
  24. package/dist/client/generated/wire.d.ts +88 -85
  25. package/dist/client/generated/wire.js.map +1 -1
  26. package/dist/client/guest-reading-history.d.ts +40 -0
  27. package/dist/client/guest-reading-history.js +144 -0
  28. package/dist/client/guest-reading-history.js.map +1 -0
  29. package/dist/client/index.d.ts +5 -3
  30. package/dist/client/media/windows.d.ts +2 -0
  31. package/dist/client/media/windows.js +4 -1
  32. package/dist/client/media/windows.js.map +1 -1
  33. package/dist/client/stats.d.ts +4 -20
  34. package/dist/client/stats.js +0 -11
  35. package/dist/client/stats.js.map +1 -1
  36. package/dist/client/versions.d.ts +8 -6
  37. package/dist/client/versions.js +15 -10
  38. package/dist/client/versions.js.map +1 -1
  39. package/dist/client.js +24 -22
  40. package/dist/components/admin/bulk-drafts.d.ts +17 -0
  41. package/dist/components/admin/bulk-drafts.js +41 -0
  42. package/dist/components/admin/bulk-drafts.js.map +1 -0
  43. package/dist/components/admin/content-admin.d.ts +1 -1
  44. package/dist/components/admin/content-admin.js.map +1 -1
  45. package/dist/components/admin/content-manager.d.ts +11 -3
  46. package/dist/components/admin/content-manager.js +751 -394
  47. package/dist/components/admin/content-manager.js.map +1 -1
  48. package/dist/components/admin/group-manager.d.ts +8 -3
  49. package/dist/components/admin/group-manager.js +218 -146
  50. package/dist/components/admin/group-manager.js.map +1 -1
  51. package/dist/components/admin/page-notices.d.ts +16 -0
  52. package/dist/components/admin/page-notices.js +113 -0
  53. package/dist/components/admin/page-notices.js.map +1 -0
  54. package/dist/components/admin/page-picker.d.ts +38 -0
  55. package/dist/components/admin/page-picker.js +159 -0
  56. package/dist/components/admin/page-picker.js.map +1 -0
  57. package/dist/components/admin/quick-search.d.ts +14 -0
  58. package/dist/components/admin/quick-search.js +60 -0
  59. package/dist/components/admin/quick-search.js.map +1 -0
  60. package/dist/components/admin/reader-content-editor.js +382 -321
  61. package/dist/components/admin/reader-content-editor.js.map +1 -1
  62. package/dist/components/admin/reader-manifest.js +181 -179
  63. package/dist/components/admin/reader-manifest.js.map +1 -1
  64. package/dist/components/admin/shell.d.ts +10 -2
  65. package/dist/components/admin/shell.js +114 -42
  66. package/dist/components/admin/shell.js.map +1 -1
  67. package/dist/components/admin/stats-dashboard.d.ts +4 -9
  68. package/dist/components/admin/stats-dashboard.js +303 -207
  69. package/dist/components/admin/stats-dashboard.js.map +1 -1
  70. package/dist/components/admin/upload-queue.d.ts +14 -0
  71. package/dist/components/admin/upload-queue.js +115 -98
  72. package/dist/components/admin/upload-queue.js.map +1 -1
  73. package/dist/components/content/card.d.ts +31 -3
  74. package/dist/components/content/card.js +324 -158
  75. package/dist/components/content/card.js.map +1 -1
  76. package/dist/components/content/daily-releases.js +144 -190
  77. package/dist/components/content/daily-releases.js.map +1 -1
  78. package/dist/components/content/editor-save.js +27 -25
  79. package/dist/components/content/editor-save.js.map +1 -1
  80. package/dist/components/content/editors.js +274 -253
  81. package/dist/components/content/editors.js.map +1 -1
  82. package/dist/components/content/favorites.d.ts +6 -0
  83. package/dist/components/content/favorites.js +47 -0
  84. package/dist/components/content/favorites.js.map +1 -0
  85. package/dist/components/content/filter-dialog.js +19 -15
  86. package/dist/components/content/filter-dialog.js.map +1 -1
  87. package/dist/components/content/filters.d.ts +2 -0
  88. package/dist/components/content/filters.js +5 -1
  89. package/dist/components/content/filters.js.map +1 -1
  90. package/dist/components/content/grid.d.ts +44 -16
  91. package/dist/components/content/grid.js +308 -270
  92. package/dist/components/content/grid.js.map +1 -1
  93. package/dist/components/content/history.d.ts +6 -0
  94. package/dist/components/content/history.js +111 -0
  95. package/dist/components/content/history.js.map +1 -0
  96. package/dist/components/content/index.d.ts +6 -3
  97. package/dist/components/content/listing.d.ts +14 -3
  98. package/dist/components/content/listing.js +65 -56
  99. package/dist/components/content/listing.js.map +1 -1
  100. package/dist/components/content/offer-fields.js +6 -6
  101. package/dist/components/content/paged-grid.d.ts +10 -0
  102. package/dist/components/content/paged-grid.js +116 -0
  103. package/dist/components/content/paged-grid.js.map +1 -0
  104. package/dist/components/content/pagination.d.ts +19 -0
  105. package/dist/components/content/pagination.js +97 -0
  106. package/dist/components/content/pagination.js.map +1 -0
  107. package/dist/components/content/paywall.d.ts +9 -0
  108. package/dist/components/content/paywall.js +27 -3
  109. package/dist/components/content/paywall.js.map +1 -1
  110. package/dist/components/content/post-list.d.ts +37 -0
  111. package/dist/components/content/post-list.js +203 -0
  112. package/dist/components/content/post-list.js.map +1 -0
  113. package/dist/components/content/reader-settings.d.ts +2 -0
  114. package/dist/components/content/reader-settings.js +1 -1
  115. package/dist/components/content/reader-settings.js.map +1 -1
  116. package/dist/components/content/search.d.ts +11 -4
  117. package/dist/components/content/search.js +22 -11
  118. package/dist/components/content/search.js.map +1 -1
  119. package/dist/components/content/summary-tile.d.ts +14 -0
  120. package/dist/components/content/summary-tile.js +63 -0
  121. package/dist/components/content/summary-tile.js.map +1 -0
  122. package/dist/components/groups/banner.d.ts +6 -2
  123. package/dist/components/groups/banner.js +79 -61
  124. package/dist/components/groups/banner.js.map +1 -1
  125. package/dist/components/groups/directory.d.ts +12 -2
  126. package/dist/components/groups/directory.js +168 -105
  127. package/dist/components/groups/directory.js.map +1 -1
  128. package/dist/components/groups/editor.js +10 -10
  129. package/dist/components/groups/editor.js.map +1 -1
  130. package/dist/components/groups/entity-chips.d.ts +61 -0
  131. package/dist/components/groups/entity-chips.js +382 -0
  132. package/dist/components/groups/entity-chips.js.map +1 -0
  133. package/dist/components/groups/group-members.d.ts +29 -0
  134. package/dist/components/groups/group-members.js +474 -0
  135. package/dist/components/groups/group-members.js.map +1 -0
  136. package/dist/components/groups/header.js +53 -45
  137. package/dist/components/groups/header.js.map +1 -1
  138. package/dist/components/groups/index.d.ts +3 -1
  139. package/dist/components/groups/memberships.d.ts +3 -36
  140. package/dist/components/groups/memberships.js +105 -480
  141. package/dist/components/groups/memberships.js.map +1 -1
  142. package/dist/components/groups/scoped.d.ts +23 -0
  143. package/dist/components/groups/scoped.js +92 -0
  144. package/dist/components/groups/scoped.js.map +1 -0
  145. package/dist/components/media-folder-editor.d.ts +5 -0
  146. package/dist/components/media-folder-editor.js +419 -231
  147. package/dist/components/media-folder-editor.js.map +1 -1
  148. package/dist/components/sortable-list.d.ts +5 -1
  149. package/dist/components/sortable-list.js +97 -81
  150. package/dist/components/sortable-list.js.map +1 -1
  151. package/dist/components/video-mini-player.d.ts +4 -1
  152. package/dist/components/video-mini-player.js +77 -71
  153. package/dist/components/video-mini-player.js.map +1 -1
  154. package/dist/components/video-player.d.ts +4 -1
  155. package/dist/components/video-player.js +280 -276
  156. package/dist/components/video-player.js.map +1 -1
  157. package/dist/index.d.ts +2 -1
  158. package/dist/index.js +41 -34
  159. package/dist/locales/admin/de.js +80 -47
  160. package/dist/locales/admin/de.js.map +1 -1
  161. package/dist/locales/admin/en.d.ts +74 -41
  162. package/dist/locales/admin/en.js +80 -47
  163. package/dist/locales/admin/en.js.map +1 -1
  164. package/dist/locales/admin/es.js +80 -47
  165. package/dist/locales/admin/es.js.map +1 -1
  166. package/dist/locales/admin/ja.js +80 -47
  167. package/dist/locales/admin/ja.js.map +1 -1
  168. package/dist/locales/admin/ko.js +80 -47
  169. package/dist/locales/admin/ko.js.map +1 -1
  170. package/dist/locales/admin/zh.js +80 -47
  171. package/dist/locales/admin/zh.js.map +1 -1
  172. package/dist/locales/de.js +1 -0
  173. package/dist/locales/de.js.map +1 -1
  174. package/dist/locales/discovery/de.js +25 -2
  175. package/dist/locales/discovery/de.js.map +1 -1
  176. package/dist/locales/discovery/en.d.ts +24 -1
  177. package/dist/locales/discovery/en.js +25 -2
  178. package/dist/locales/discovery/en.js.map +1 -1
  179. package/dist/locales/discovery/es.js +25 -2
  180. package/dist/locales/discovery/es.js.map +1 -1
  181. package/dist/locales/discovery/ja.js +25 -2
  182. package/dist/locales/discovery/ja.js.map +1 -1
  183. package/dist/locales/discovery/ko.js +25 -2
  184. package/dist/locales/discovery/ko.js.map +1 -1
  185. package/dist/locales/discovery/zh.js +25 -2
  186. package/dist/locales/discovery/zh.js.map +1 -1
  187. package/dist/locales/en.d.ts +119 -44
  188. package/dist/locales/en.js +1 -0
  189. package/dist/locales/en.js.map +1 -1
  190. package/dist/locales/es.js +1 -0
  191. package/dist/locales/es.js.map +1 -1
  192. package/dist/locales/groups/de.js +22 -4
  193. package/dist/locales/groups/de.js.map +1 -1
  194. package/dist/locales/groups/en.d.ts +20 -2
  195. package/dist/locales/groups/en.js +22 -4
  196. package/dist/locales/groups/en.js.map +1 -1
  197. package/dist/locales/groups/es.js +22 -4
  198. package/dist/locales/groups/es.js.map +1 -1
  199. package/dist/locales/groups/ja.js +22 -4
  200. package/dist/locales/groups/ja.js.map +1 -1
  201. package/dist/locales/groups/ko.js +22 -4
  202. package/dist/locales/groups/ko.js.map +1 -1
  203. package/dist/locales/groups/zh.js +22 -4
  204. package/dist/locales/groups/zh.js.map +1 -1
  205. package/dist/locales/ja.js +1 -0
  206. package/dist/locales/ja.js.map +1 -1
  207. package/dist/locales/ko.js +1 -0
  208. package/dist/locales/ko.js.map +1 -1
  209. package/dist/locales/zh.js +1 -0
  210. package/dist/locales/zh.js.map +1 -1
  211. package/dist/react/discovery.d.ts +36 -17
  212. package/dist/react/discovery.js +305 -221
  213. package/dist/react/discovery.js.map +1 -1
  214. package/dist/react/groups.d.ts +19 -3
  215. package/dist/react/groups.js +49 -22
  216. package/dist/react/groups.js.map +1 -1
  217. package/dist/react/index.d.ts +7 -4
  218. package/dist/react/page-notices.d.ts +13 -0
  219. package/dist/react/page-notices.js +38 -0
  220. package/dist/react/page-notices.js.map +1 -0
  221. package/dist/react/post-reads.d.ts +23 -0
  222. package/dist/react/post-reads.js +90 -0
  223. package/dist/react/post-reads.js.map +1 -0
  224. package/dist/react/remembered-sort.d.ts +5 -0
  225. package/dist/react/remembered-sort.js +29 -0
  226. package/dist/react/remembered-sort.js.map +1 -0
  227. package/dist/react/resources.d.ts +3 -1
  228. package/dist/react/resources.js +6 -2
  229. package/dist/react/resources.js.map +1 -1
  230. package/dist/react/stats.d.ts +3 -7
  231. package/dist/react/stats.js +2 -6
  232. package/dist/react/stats.js.map +1 -1
  233. package/dist/react/use-engagement.d.ts +28 -0
  234. package/dist/react/use-engagement.js +226 -0
  235. package/dist/react/use-engagement.js.map +1 -0
  236. package/dist/react/use-resource.d.ts +4 -3
  237. package/dist/react/use-resource.js +2 -1
  238. package/dist/react/use-resource.js.map +1 -1
  239. package/dist/react.js +29 -26
  240. package/dist/styles.css +1 -1
  241. package/dist/ui/dialog.d.ts +2 -1
  242. package/dist/ui/dialog.js +23 -20
  243. package/dist/ui/dialog.js.map +1 -1
  244. package/dist/urls/index.d.ts +1 -1
  245. package/dist/urls.js +2 -2
  246. package/dist/urls.js.map +1 -1
  247. package/package.json +1 -1
  248. package/dist/components/admin/page-review.d.ts +0 -13
  249. package/dist/components/admin/page-review.js +0 -225
  250. package/dist/components/admin/page-review.js.map +0 -1
  251. package/dist/react/page-review.d.ts +0 -14
  252. package/dist/react/page-review.js +0 -37
  253. package/dist/react/page-review.js.map +0 -1
@@ -1,602 +1,959 @@
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 { keyOf as i, useContentScope as a, usePaged as o } from "../../react/use-resource.js";
5
- import { useKinds as s } from "../../react/groups.js";
6
- import { Alert as c, AlertDescription as l } from "../../ui/alert.js";
7
- import { Button as u, buttonVariants as d } from "../../ui/button.js";
8
- import { Badge as f } from "../../ui/badge.js";
9
- import { Input as p } from "../../ui/input.js";
10
- import { Label as m } from "../../ui/label.js";
11
- import { Select as ee, SelectContent as te, SelectItem as h, SelectTrigger as ne, SelectValue as re } from "../../ui/select.js";
12
- import { Skeleton as g } from "../../ui/skeleton.js";
13
- import { Textarea as _ } from "../../ui/textarea.js";
14
- import { ErrorLine as ie, RelativeTime as v, contentError as y, formatDate as ae, useAction as oe } from "../social/parts.js";
15
- import { AdminRoot as b, LoadFailed as x, NoAccess as S, Pager as se, Rows as C, pageOf as ce, useConfirm as le } from "./shell.js";
16
- import { localInput as w } from "../social/bans.js";
17
- import { imageRefs as T } from "../../client/contents.js";
18
- import { useAdminLocation as E, useFlowClient as D, useStaffAccess as O } from "../../react/admin.js";
19
- import { ContentSections as k } from "../content/editors.js";
20
- import { useContent as A } from "../../react/contents.js";
21
- import { ReaderContentEditor as j } from "./reader-content-editor.js";
22
- import { useEffect as ue, useId as de, useMemo as fe, useRef as M, useState as N } from "react";
23
- import { Fragment as P, jsx as F, jsxs as I } from "react/jsx-runtime";
4
+ import { keyOf as i, useContentScope as a, usePaged as o, useResource as s } from "../../react/use-resource.js";
5
+ import { useKinds as c } from "../../react/groups.js";
6
+ import { Alert as l, AlertDescription as u } from "../../ui/alert.js";
7
+ import { Button as d, buttonVariants as ee } from "../../ui/button.js";
8
+ import { Badge as te } from "../../ui/badge.js";
9
+ import { Input as f } from "../../ui/input.js";
10
+ import { Label as p } from "../../ui/label.js";
11
+ import { Select as ne, SelectContent as re, SelectItem as m, SelectTrigger as ie, SelectValue as ae } from "../../ui/select.js";
12
+ import { Skeleton as h } from "../../ui/skeleton.js";
13
+ import { Textarea as oe } from "../../ui/textarea.js";
14
+ import { ErrorLine as se, RelativeTime as ce, contentError as le, formatDate as ue, useAction as de } from "../social/parts.js";
15
+ import { AdminRoot as g, LoadFailed as fe, NoAccess as _, Pager as pe, Rows as v, pageOf as me, useConfirm as he } from "./shell.js";
16
+ import { localInput as ge } from "../social/bans.js";
17
+ import { imageRefs as _e } from "../../client/contents.js";
18
+ import { useAdminLocation as y, useFlowClient as b, useStaffAccess as x } from "../../react/admin.js";
19
+ import { labelOf as S } from "../groups/parts.js";
20
+ import { useContent as ve } from "../../react/contents.js";
21
+ import { ContentSections as C } from "../content/editors.js";
22
+ import { createDraft as w, uploadTarget as T } from "./bulk-drafts.js";
23
+ import { ReaderContentEditor as E } from "./reader-content-editor.js";
24
+ import { UploadQueueBody as D } from "./upload-queue.js";
25
+ import { useEffect as O, useId as ye, useMemo as k, useRef as A, useState as j } from "react";
26
+ import { Fragment as be, jsx as M, jsxs as N } from "react/jsx-runtime";
27
+ import { Image01Icon as P } from "@hugeicons/core-free-icons";
28
+ import { HugeiconsIcon as F } from "@hugeicons/react";
24
29
  //#region src/components/admin/content-manager.tsx
25
- function L(e = {}) {
26
- return O(["contents"], e);
30
+ function I(e = {}) {
31
+ return x(["contents"], e);
27
32
  }
28
- function R(e) {
33
+ function xe(e) {
29
34
  return e.moderation === "rejected" ? "rejected" : e.moderation === "held" ? "held" : e.state === "draft" ? "draft" : e.live ? "published" : "scheduled";
30
35
  }
31
- var pe = (e) => (e ?? []).map((e) => typeof e == "string" ? {
36
+ var Se = (e) => (e ?? []).map((e) => typeof e == "string" ? {
32
37
  value: e,
33
38
  label: e
34
- } : e), me = {
39
+ } : e), Ce = {
35
40
  published: "default",
36
41
  scheduled: "secondary",
37
42
  draft: "outline",
38
43
  held: "secondary",
39
44
  rejected: "destructive"
40
- }, z = [
45
+ }, L = [
41
46
  "draft",
42
47
  "scheduled",
43
48
  "published"
44
49
  ];
45
- function B({ client: e, baseUrl: t, auth: n, guard: r, appearance: i, className: a, language: o, messages: s, ...c }) {
46
- let l = D({
50
+ function R({ client: e, baseUrl: t, auth: n, guard: r, appearance: i, className: a, language: o, messages: s, ...c }) {
51
+ let l = b({
47
52
  client: e,
48
53
  baseUrl: t,
49
54
  auth: n
50
55
  });
51
- return /* @__PURE__ */ F(b, {
56
+ return /* @__PURE__ */ M(g, {
52
57
  flow: "content-manager",
53
58
  appearance: i,
54
59
  className: a,
55
60
  language: o,
56
61
  messages: s,
57
62
  guard: r,
58
- children: /* @__PURE__ */ F(V, {
63
+ children: /* @__PURE__ */ M(z, {
59
64
  ...c,
60
65
  client: l
61
66
  })
62
67
  });
63
68
  }
64
- function V({ basePath: e, navigation: n, ...r }) {
65
- let { t: i } = t(), a = E(e, n), o = L({ client: r.client });
66
- return o.loading ? /* @__PURE__ */ F(C, {}) : o.allowed.contents ? a.view ? /* @__PURE__ */ I(P, { children: [/* @__PURE__ */ F(u, {
69
+ function z({ basePath: e, navigation: n, ...r }) {
70
+ let { t: i } = t(), a = y(e, n), o = I({ client: r.client }), s = A(/* @__PURE__ */ new Map()).current, c = (e, t = !1) => {
71
+ s.set(e.code, e.id), a.go(e.code, void 0, t ? { replace: !0 } : void 0);
72
+ }, l = B(r.client, r.kind, a.view && a.view !== "new" ? a.view : null, s), u = H(r.client, a.view === "new" ? a.query.get("with") ?? "" : "");
73
+ return o.loading ? /* @__PURE__ */ M(v, {}) : o.allowed.contents ? a.view ? a.view !== "new" && !l.id ? l.error ? /* @__PURE__ */ M(fe, {
74
+ error: l.error,
75
+ message: i("contentManager.loadFailed"),
76
+ retry: l.retry
77
+ }) : l.missing ? /* @__PURE__ */ M(_, { children: i("contentManager.notFound") }) : /* @__PURE__ */ M(v, {}) : /* @__PURE__ */ N(be, { children: [/* @__PURE__ */ M(d, {
67
78
  variant: "ghost",
68
79
  size: "sm",
69
80
  className: "justify-self-start",
70
81
  onClick: () => a.go(""),
71
82
  children: i("contentManager.back")
72
- }), /* @__PURE__ */ F(W, {
83
+ }), /* @__PURE__ */ M(Y, {
73
84
  management: !0,
74
85
  ...r,
75
- id: a.view === "new" ? null : a.view,
76
- onCreated: (e) => a.go(e.id, void 0, { replace: !0 }),
86
+ id: a.view === "new" ? null : l.id,
87
+ entities: u,
88
+ onCreated: (e) => c(e, !0),
77
89
  onDeleted: () => a.go("", void 0, { replace: !0 })
78
- })] }) : /* @__PURE__ */ F(H, {
90
+ })] }) : /* @__PURE__ */ M(K, {
79
91
  ...r,
80
- loc: a
81
- }) : /* @__PURE__ */ F(S, { children: i("contentManager.noAccess") });
92
+ loc: a,
93
+ open: c
94
+ }) : /* @__PURE__ */ M(_, { children: i("contentManager.noAccess") });
82
95
  }
83
- function H({ loc: e, client: n, kind: r, languages: s, contentHref: c, pageSize: l = 20, onError: g }) {
84
- let _ = t(), { t: y } = _, b = de(), S = pe(s)[0]?.value, w = e.query.get("q") ?? "", T = z.find((t) => t === e.query.get("status")) ?? "", E = e.query.get("deleted") === "1", D = ce(e.query), O = {
85
- q: w,
86
- status: T,
87
- deleted: E ? "1" : void 0
88
- }, k = (t) => e.go("", {
89
- ...O,
90
- ...t
91
- }), [A, j] = N(w);
92
- ue(() => j(w), [w]);
93
- let { store: fe, scope: M } = a(n), L = E ? "deleted" : T || void 0, B = o(fe, i("contents-page", M, r, w, L, l), {
96
+ function B(t, n, r, i) {
97
+ let [a, o] = j(null), [s, c] = j(0), l = r ? i.get(r) : void 0;
98
+ O(() => {
99
+ if (!r || l) return;
100
+ let a = new AbortController();
101
+ return t.contents.manage({
102
+ kind: n,
103
+ code: r,
104
+ limit: 1
105
+ }, a.signal).then((e) => {
106
+ let t = e[0]?.id ?? null;
107
+ t && i.set(r, t), o({
108
+ code: r,
109
+ id: t
110
+ });
111
+ }, (t) => {
112
+ a.signal.aborted || o({
113
+ code: r,
114
+ id: null,
115
+ error: e(t)
116
+ });
117
+ }), () => a.abort();
118
+ }, [
119
+ t,
120
+ n,
121
+ r,
122
+ l,
123
+ i,
124
+ s
125
+ ]);
126
+ let u = () => c((e) => e + 1);
127
+ return r ? l ? {
128
+ id: l,
129
+ retry: u
130
+ } : a?.code === r ? {
131
+ id: a.id,
132
+ error: a.error,
133
+ missing: !a.id && !a.error,
134
+ retry: u
135
+ } : {
136
+ id: null,
137
+ retry: u
138
+ } : {
139
+ id: null,
140
+ retry: u
141
+ };
142
+ }
143
+ var V = (e) => ({
144
+ ...e,
145
+ count: 0
146
+ });
147
+ function H(e, t) {
148
+ let [n, r] = j(null);
149
+ return O(() => {
150
+ if (!t) return;
151
+ let n = new AbortController(), i = async (t) => {
152
+ let r = await e.codes.resolve(t, { signal: n.signal }), i = await e.entities.getForManagement(r.content_id, void 0, n.signal);
153
+ return i.scope ? [V(i), i.scope] : [V(i)];
154
+ };
155
+ return Promise.all(t.split(",").filter(Boolean).map((e) => i(e).catch(() => []))).then((e) => {
156
+ n.signal.aborted || r({
157
+ codes: t,
158
+ entities: e.flat()
159
+ });
160
+ }), () => n.abort();
161
+ }, [e, t]), t && n?.codes === t ? n.entities : void 0;
162
+ }
163
+ var we = [
164
+ 20,
165
+ 50,
166
+ 100
167
+ ], U = 4;
168
+ function W(e, t, n) {
169
+ switch (t.level) {
170
+ case "public": return e("contentManager.free");
171
+ case "tier": return (t.tiers ?? []).map((e) => S(n, e)).join(", ") || e("contentManager.premium");
172
+ case "ppv": return e("contentManager.ppv");
173
+ case "group": return e("contentManager.members");
174
+ case "group_ppv": return e("contentManager.membersPpv");
175
+ }
176
+ }
177
+ var Te = (e) => e ? e.startsWith("tier:") ? {
178
+ access: "tier",
179
+ tier: e.slice(5)
180
+ } : { access: e } : {};
181
+ async function G(e, t) {
182
+ let n = 0, r = 0;
183
+ return await Promise.all(Array.from({ length: Math.min(U, e.length) }, async () => {
184
+ for (; r < e.length;) {
185
+ let i = e[r++];
186
+ try {
187
+ await t(i);
188
+ } catch {
189
+ n++;
190
+ }
191
+ }
192
+ })), n;
193
+ }
194
+ function K({ loc: n, open: l, client: u, kind: h, languages: oe, contentHref: le, labels: g, pageSize: _ = 20, selectable: ge = !0, onError: _e }) {
195
+ let y = t(), { t: b } = y, x = ye(), ve = Se(oe)[0]?.value, C = n.query.get("q") ?? "", E = L.find((e) => e === n.query.get("status")) ?? "", k = n.query.get("access") ?? "", P = n.query.get("deleted") === "1", F = me(n.query), I = Number(n.query.get("size")), R = we.find((e) => e === I) ?? _, z = {
196
+ q: C,
197
+ status: E,
198
+ access: k || void 0,
199
+ deleted: P ? "1" : void 0,
200
+ size: R === _ ? void 0 : R
201
+ }, B = (e) => n.go("", {
202
+ ...z,
203
+ ...e
204
+ }), V = !!(C || E || k), [H, U] = j(C);
205
+ O(() => U(C), [C]), O(() => {
206
+ if (H.trim() === C) return;
207
+ let e = setTimeout(() => B({ q: H.trim() }), 300);
208
+ return () => clearTimeout(e);
209
+ }, [H]);
210
+ let { kinds: K } = c({ client: u }), J = K?.tiers ?? [], Y = K?.kinds[h]?.presentation, De = Y === "reader" || Y === "player", [Oe, ke] = j(!1), Ae = A(/* @__PURE__ */ new Map()).current, je = r(_e), Me = async (e) => {
211
+ let { content: t, ref: n } = await w(u, h, ve ?? K?.languages[0] ?? "en", e, b("readerEditor.untitled"));
212
+ return Ae.set(t.id, t), n;
213
+ }, Ne = (e) => {
214
+ let t = Ae.get(e.id);
215
+ if (t) return l(t);
216
+ u.contents.manage({
217
+ kind: h,
218
+ ids: [e.id],
219
+ limit: 1
220
+ }).then(([e]) => {
221
+ e && l(e);
222
+ }, (e) => je(e, "upload"));
223
+ }, { store: Pe, scope: Fe } = a(u), Ie = P ? "deleted" : E || void 0, Le = {
94
224
  type: "contents",
95
- scope: E ? "deleted" : void 0
96
- }, D, l, (e, t) => n.contents.manage({
225
+ scope: P ? "deleted" : void 0
226
+ }, Re = {
227
+ q: C || void 0,
228
+ state: Ie,
229
+ ...Te(k)
230
+ }, X = o(Pe, i("contents-page", Fe, h, C, Ie, k, ve, R), Le, F, R, (e, t) => u.contents.manage({
97
231
  ...e,
98
- kind: r,
99
- q: w || void 0,
100
- state: L,
101
- language: S
102
- }, t)), V = oe("content.save", g), { confirm: H, dialog: U } = le(), W = async (e) => {
103
- await H({
104
- title: y("contentManager.deleteTitle", { title: e.title }),
105
- description: y("contentManager.deleteBody"),
106
- confirm: y("contentManager.delete")
107
- }) && await V.run(() => n.contents.remove(e.id));
108
- };
109
- return /* @__PURE__ */ I("div", {
232
+ ...Re,
233
+ kind: h,
234
+ language: ve
235
+ }, t)), ze = s(Pe, i("contents-count", Fe, h, C, Ie, k), Le, (e) => u.contents.manageCount({
236
+ ...Re,
237
+ kind: h
238
+ }, e)), Z = X.items, Be = ze.data?.total, Ve = X.loading, He = de("content.save", _e), { confirm: Ue, dialog: We } = he(), [Ge, Ke] = j(/* @__PURE__ */ new Set());
239
+ O(() => Ke(/* @__PURE__ */ new Set()), [
240
+ h,
241
+ C,
242
+ Ie,
243
+ k,
244
+ F,
245
+ R
246
+ ]);
247
+ let [qe, Je] = j(/* @__PURE__ */ new Set()), [Ye, Xe] = j({}), [Q, Ze] = j({ pending: !1 }), Qe = J[0], $e = (e) => !!Qe && (e.access.level === "public" || e.access.level === "tier"), et = (e, t) => t ? {
248
+ level: "tier",
249
+ tiers: [Qe]
250
+ } : { level: "public" }, tt = async (t, n) => {
251
+ Je((e) => new Set(e).add(t.id)), Xe(({ [t.id]: e, ...n }) => n);
252
+ try {
253
+ await u.contents.update(t.id, { access: et(t, n) });
254
+ } catch (n) {
255
+ let r = e(n);
256
+ Xe((e) => ({
257
+ ...e,
258
+ [t.id]: r
259
+ }));
260
+ } finally {
261
+ Je((e) => {
262
+ let n = new Set(e);
263
+ return n.delete(t.id), n;
264
+ });
265
+ }
266
+ }, nt = async (e) => {
267
+ await Ue({
268
+ title: b("contentManager.deleteTitle", { title: e.title }),
269
+ description: b("contentManager.deleteBody"),
270
+ confirm: b("contentManager.delete")
271
+ }) && await He.run(() => u.contents.remove(e.id));
272
+ }, $ = Z.filter((e) => Ge.has(e.id)), rt = async (e, t) => {
273
+ Ze({ pending: !0 });
274
+ let n = await G(e, t), r = e.length - n;
275
+ Ke(/* @__PURE__ */ new Set()), Ze({
276
+ pending: !1,
277
+ summary: n ? b("contentManager.bulkPartial", {
278
+ done: r,
279
+ total: e.length,
280
+ failed: n
281
+ }) : y.plural("contentManager.bulkDone", r)
282
+ });
283
+ }, it = async () => {
284
+ await Ue({
285
+ title: y.plural("contentManager.bulkDeleteTitle", $.length),
286
+ description: b("contentManager.bulkDeleteBody"),
287
+ confirm: b("contentManager.delete")
288
+ }) && await rt($, (e) => u.contents.remove(e.id));
289
+ }, at = Z.length > 0 && $.length === Z.length;
290
+ return /* @__PURE__ */ N("div", {
110
291
  className: "grid gap-4",
111
292
  children: [
112
- /* @__PURE__ */ I("div", {
293
+ /* @__PURE__ */ N("div", {
113
294
  className: "flex flex-wrap items-center justify-between gap-2",
114
- children: [/* @__PURE__ */ F("h2", {
295
+ children: [/* @__PURE__ */ M("h2", {
115
296
  className: "text-base font-semibold",
116
- children: y("contentManager.title")
117
- }), /* @__PURE__ */ F(u, {
118
- size: "sm",
119
- onClick: () => e.go("new"),
120
- children: y("contentManager.new")
297
+ children: b("contentManager.title")
298
+ }), /* @__PURE__ */ N("div", {
299
+ className: "flex gap-2",
300
+ children: [De && !P && /* @__PURE__ */ M(d, {
301
+ size: "sm",
302
+ variant: "outline",
303
+ "aria-expanded": Oe,
304
+ onClick: () => ke((e) => !e),
305
+ children: b("contentManager.bulkUpload")
306
+ }), /* @__PURE__ */ M(d, {
307
+ size: "sm",
308
+ onClick: () => n.go("new"),
309
+ children: b("contentManager.new")
310
+ })]
121
311
  })]
122
312
  }),
123
- /* @__PURE__ */ I("div", {
313
+ De && Oe && !P && /* @__PURE__ */ N("section", {
314
+ className: "grid gap-3 rounded-lg border border-border p-3",
315
+ "aria-label": b("contentManager.bulkUpload"),
316
+ "data-ckui": "bulk-upload",
317
+ children: [/* @__PURE__ */ M("p", {
318
+ className: "text-sm text-muted-foreground",
319
+ children: b(Y === "reader" ? "contentManager.bulkHintArchive" : "contentManager.bulkHintFile")
320
+ }), /* @__PURE__ */ M(D, {
321
+ client: u,
322
+ createItem: Me,
323
+ target: (e, t, n) => T(u, e, t, n),
324
+ accept: Y === "reader" ? ".zip,application/zip" : "video/*",
325
+ concurrency: 2,
326
+ storageKey: `ckui.bulk.${h}`,
327
+ onOpen: Ne,
328
+ onError: _e
329
+ })]
330
+ }),
331
+ /* @__PURE__ */ N("div", {
124
332
  className: "flex gap-2",
125
333
  role: "group",
126
- "aria-label": y("contentManager.title"),
127
- children: [/* @__PURE__ */ F(u, {
334
+ "aria-label": b("contentManager.title"),
335
+ children: [/* @__PURE__ */ M(d, {
128
336
  size: "sm",
129
- variant: E ? "outline" : "default",
130
- "aria-pressed": !E,
131
- onClick: () => e.go("", { q: w }),
132
- children: y("contentManager.items")
133
- }), /* @__PURE__ */ F(u, {
337
+ variant: P ? "outline" : "default",
338
+ "aria-pressed": !P,
339
+ onClick: () => n.go("", { q: C }),
340
+ children: b("contentManager.items")
341
+ }), /* @__PURE__ */ M(d, {
134
342
  size: "sm",
135
- variant: E ? "default" : "outline",
136
- "aria-pressed": E,
137
- onClick: () => e.go("", {
138
- q: w,
343
+ variant: P ? "default" : "outline",
344
+ "aria-pressed": P,
345
+ onClick: () => n.go("", {
346
+ q: C,
139
347
  deleted: "1"
140
348
  }),
141
- children: y("contentManager.deleted")
349
+ children: b("contentManager.deleted")
142
350
  })]
143
351
  }),
144
- /* @__PURE__ */ I("div", {
145
- className: "grid gap-2 sm:grid-cols-[minmax(0,1fr)_auto]",
146
- children: [/* @__PURE__ */ I("form", {
147
- className: "flex gap-2",
148
- role: "search",
149
- onSubmit: (e) => {
150
- e.preventDefault(), k({ q: A.trim() });
151
- },
152
- children: [
153
- /* @__PURE__ */ F(m, {
154
- htmlFor: `${b}-q`,
352
+ /* @__PURE__ */ N("div", {
353
+ className: "flex flex-wrap items-center gap-2",
354
+ children: [
355
+ /* @__PURE__ */ N("form", {
356
+ className: "min-w-48 flex-1",
357
+ role: "search",
358
+ onSubmit: (e) => {
359
+ e.preventDefault(), B({ q: H.trim() });
360
+ },
361
+ children: [/* @__PURE__ */ M(p, {
362
+ htmlFor: `${x}-q`,
155
363
  className: "sr-only",
156
- children: y("contentManager.search")
157
- }),
158
- /* @__PURE__ */ F(p, {
159
- id: `${b}-q`,
364
+ children: b("contentManager.search")
365
+ }), /* @__PURE__ */ M(f, {
366
+ id: `${x}-q`,
160
367
  className: "h-8",
161
368
  type: "search",
162
- value: A,
163
- placeholder: y("contentManager.search"),
164
- onChange: (e) => j(e.target.value)
369
+ value: H,
370
+ placeholder: b("contentManager.search"),
371
+ onChange: (e) => U(e.target.value)
372
+ })]
373
+ }),
374
+ !P && /* @__PURE__ */ N(ne, {
375
+ value: E,
376
+ onValueChange: (e) => B({ status: String(e ?? "") }),
377
+ children: [/* @__PURE__ */ M(ie, {
378
+ size: "sm",
379
+ "aria-label": b("contentManager.status"),
380
+ children: /* @__PURE__ */ M(ae, { children: (e) => b(e ? `contentManager.${e}` : "contentManager.allStatuses") })
381
+ }), /* @__PURE__ */ N(re, { children: [/* @__PURE__ */ M(m, {
382
+ value: "",
383
+ children: b("contentManager.allStatuses")
384
+ }), L.map((e) => /* @__PURE__ */ M(m, {
385
+ value: e,
386
+ children: b(`contentManager.${e}`)
387
+ }, e))] })]
388
+ }),
389
+ /* @__PURE__ */ N(ne, {
390
+ value: k,
391
+ onValueChange: (e) => B({ access: String(e ?? "") || void 0 }),
392
+ children: [/* @__PURE__ */ M(ie, {
393
+ size: "sm",
394
+ "aria-label": b("contentManager.access"),
395
+ children: /* @__PURE__ */ M(ae, { children: (e) => e ? e.startsWith("tier:") ? S(g, e.slice(5)) : W(b, { level: e }, g) : b("contentManager.anyAccess") })
396
+ }), /* @__PURE__ */ N(re, { children: [
397
+ /* @__PURE__ */ M(m, {
398
+ value: "",
399
+ children: b("contentManager.anyAccess")
400
+ }),
401
+ /* @__PURE__ */ M(m, {
402
+ value: "public",
403
+ children: b("contentManager.free")
404
+ }),
405
+ J.length > 0 && /* @__PURE__ */ M(m, {
406
+ value: "tier",
407
+ children: b("contentManager.premium")
408
+ }),
409
+ J.length > 1 && J.map((e) => /* @__PURE__ */ M(m, {
410
+ value: `tier:${e}`,
411
+ children: S(g, e)
412
+ }, e)),
413
+ /* @__PURE__ */ M(m, {
414
+ value: "ppv",
415
+ children: b("contentManager.ppv")
416
+ })
417
+ ] })]
418
+ })
419
+ ]
420
+ }),
421
+ /* @__PURE__ */ M(se, { error: He.error }),
422
+ Q.summary && /* @__PURE__ */ M("p", {
423
+ role: "status",
424
+ className: "text-sm text-muted-foreground",
425
+ children: Q.summary
426
+ }),
427
+ ge && $.length > 0 && /* @__PURE__ */ N("div", {
428
+ className: "flex flex-wrap items-center gap-2 rounded-lg border border-border bg-muted/40 p-2 text-sm",
429
+ "data-ckui": "bulk-bar",
430
+ children: [
431
+ /* @__PURE__ */ M("span", {
432
+ className: "font-medium",
433
+ children: b("contentManager.selected", { count: $.length })
434
+ }),
435
+ P ? /* @__PURE__ */ M(d, {
436
+ size: "sm",
437
+ variant: "outline",
438
+ disabled: Q.pending,
439
+ onClick: () => void rt($, (e) => u.contents.restore(e.id)),
440
+ children: b("moderation.restore")
441
+ }) : /* @__PURE__ */ N(be, { children: [
442
+ Qe && /* @__PURE__ */ M(d, {
443
+ size: "sm",
444
+ variant: "outline",
445
+ disabled: Q.pending,
446
+ onClick: () => void rt($.filter($e), (e) => u.contents.update(e.id, { access: et(e, !0) })),
447
+ children: b("contentManager.makePremium")
165
448
  }),
166
- /* @__PURE__ */ F(u, {
167
- type: "submit",
449
+ Qe && /* @__PURE__ */ M(d, {
168
450
  size: "sm",
169
451
  variant: "outline",
170
- children: y("moderation.filter")
452
+ disabled: Q.pending,
453
+ onClick: () => void rt($.filter($e), (e) => u.contents.update(e.id, { access: et(e, !1) })),
454
+ children: b("contentManager.makeFree")
455
+ }),
456
+ /* @__PURE__ */ M(d, {
457
+ size: "sm",
458
+ variant: "destructive",
459
+ disabled: Q.pending,
460
+ onClick: () => void it(),
461
+ children: b("contentManager.delete")
171
462
  })
172
- ]
173
- }), !E && /* @__PURE__ */ I(ee, {
174
- value: T,
175
- onValueChange: (e) => k({ status: String(e ?? "") }),
176
- children: [/* @__PURE__ */ F(ne, {
463
+ ] }),
464
+ /* @__PURE__ */ M(d, {
177
465
  size: "sm",
178
- "aria-label": y("contentManager.status"),
179
- children: /* @__PURE__ */ F(re, { children: (e) => y(e ? `contentManager.${e}` : "contentManager.allStatuses") })
180
- }), /* @__PURE__ */ I(te, { children: [/* @__PURE__ */ F(h, {
181
- value: "",
182
- children: y("contentManager.allStatuses")
183
- }), z.map((e) => /* @__PURE__ */ F(h, {
184
- value: e,
185
- children: y(`contentManager.${e}`)
186
- }, e))] })]
187
- })]
466
+ variant: "ghost",
467
+ disabled: Q.pending,
468
+ onClick: () => Ke(/* @__PURE__ */ new Set()),
469
+ children: b("contentManager.clearSelection")
470
+ })
471
+ ]
188
472
  }),
189
- /* @__PURE__ */ F(ie, { error: V.error }),
190
- B.loading && !B.items.length ? /* @__PURE__ */ F(C, {}) : B.error && !B.items.length ? /* @__PURE__ */ F(x, {
191
- error: B.error,
192
- message: y("contentManager.loadFailed"),
193
- retry: B.reload
194
- }) : B.items.length ? /* @__PURE__ */ F("ul", {
473
+ Ve && !Z.length ? /* @__PURE__ */ M(v, {}) : X.error && !Z.length ? /* @__PURE__ */ M(fe, {
474
+ error: X.error,
475
+ message: b("contentManager.loadFailed"),
476
+ retry: X.reload
477
+ }) : Z.length ? /* @__PURE__ */ N("ul", {
195
478
  className: "grid divide-y divide-border rounded-lg border border-border",
196
- "aria-busy": B.loading,
197
- children: B.items.map((t) => {
198
- let r = R(t), i = r === "published" ? c?.(t) : void 0;
199
- return /* @__PURE__ */ I("li", {
479
+ "aria-busy": Ve,
480
+ children: [ge && /* @__PURE__ */ N("li", {
481
+ className: "flex items-center gap-3 px-3 py-2 text-xs text-muted-foreground",
482
+ children: [/* @__PURE__ */ M("input", {
483
+ type: "checkbox",
484
+ className: "size-4 shrink-0 accent-primary",
485
+ checked: at,
486
+ "aria-label": b("contentManager.selectPage"),
487
+ onChange: (e) => Ke(e.target.checked ? new Set(Z.map((e) => e.id)) : /* @__PURE__ */ new Set())
488
+ }), /* @__PURE__ */ M("span", { children: b("contentManager.selectPage") })]
489
+ }), Z.map((e) => {
490
+ let t = xe(e), n = t === "published" ? le?.(e) : void 0, r = qe.has(e.id), i = e.access.level === "tier";
491
+ return /* @__PURE__ */ N("li", {
200
492
  className: "flex flex-wrap items-start gap-3 p-3",
201
493
  "data-ckui": "content-row",
202
- "data-status": E ? "deleted" : r,
203
- children: [/* @__PURE__ */ I("div", {
204
- className: "grid min-w-0 flex-1 gap-1",
205
- children: [E ? /* @__PURE__ */ F("span", {
206
- className: "font-medium break-words",
207
- children: t.title
208
- }) : /* @__PURE__ */ F("button", {
209
- type: "button",
210
- className: "text-left font-medium break-words hover:underline",
211
- onClick: () => e.go(t.id),
212
- children: t.title
213
- }), /* @__PURE__ */ I("div", {
214
- className: "flex flex-wrap items-center gap-x-2 gap-y-1 text-xs text-muted-foreground",
494
+ "data-status": P ? "deleted" : t,
495
+ children: [
496
+ ge && /* @__PURE__ */ M("input", {
497
+ type: "checkbox",
498
+ className: "mt-1 size-4 shrink-0 accent-primary",
499
+ checked: Ge.has(e.id),
500
+ "aria-label": b("contentManager.select", { title: e.title }),
501
+ onChange: (t) => Ke((n) => {
502
+ let r = new Set(n);
503
+ return t.target.checked ? r.add(e.id) : r.delete(e.id), r;
504
+ })
505
+ }),
506
+ /* @__PURE__ */ M(q, { url: e.cover?.url }),
507
+ /* @__PURE__ */ N("div", {
508
+ className: "grid min-w-0 flex-1 gap-1",
215
509
  children: [
216
- !E && /* @__PURE__ */ F(f, {
217
- variant: me[r],
218
- children: y(`contentManager.${r}`)
510
+ P ? /* @__PURE__ */ M("span", {
511
+ className: "font-medium break-words line-through",
512
+ children: e.title
513
+ }) : /* @__PURE__ */ M("button", {
514
+ type: "button",
515
+ className: "text-left font-medium break-words hover:underline",
516
+ onClick: () => l(e),
517
+ children: e.title
219
518
  }),
220
- /* @__PURE__ */ F("span", { children: t.language }),
221
- /* @__PURE__ */ F(v, { at: E && t.deleted_at ? t.deleted_at : t.updated_at }),
222
- r === "scheduled" && t.publish_at && /* @__PURE__ */ F("span", { children: y("pollManager.goesLive", { date: ae(_, t.publish_at) }) })
223
- ]
224
- })]
225
- }), /* @__PURE__ */ F("div", {
226
- className: "flex flex-wrap gap-2",
227
- children: E ? /* @__PURE__ */ F(u, {
228
- size: "sm",
229
- variant: "outline",
230
- disabled: V.pending,
231
- onClick: () => void V.run(() => n.contents.restore(t.id)),
232
- children: y("moderation.restore")
233
- }) : /* @__PURE__ */ I(P, { children: [
234
- i && /* @__PURE__ */ F("a", {
235
- className: d({
236
- size: "sm",
237
- variant: "ghost"
519
+ /* @__PURE__ */ N("div", {
520
+ className: "flex flex-wrap items-center gap-x-2 gap-y-1 text-xs text-muted-foreground",
521
+ children: [
522
+ !P && /* @__PURE__ */ M(te, {
523
+ variant: Ce[t],
524
+ children: b(`contentManager.${t}`)
525
+ }),
526
+ /* @__PURE__ */ M(te, {
527
+ variant: i ? "secondary" : "outline",
528
+ "data-ckui": "access-badge",
529
+ children: W(b, e.access, g)
530
+ }),
531
+ /* @__PURE__ */ M("span", {
532
+ className: "font-mono",
533
+ children: e.code
534
+ }),
535
+ /* @__PURE__ */ M("span", { children: e.language }),
536
+ e.published_at && t === "published" ? /* @__PURE__ */ M("time", {
537
+ dateTime: e.published_at,
538
+ title: ue(y, e.published_at),
539
+ children: b("contentManager.liveOn", { date: ue(y, e.published_at, !1) })
540
+ }) : /* @__PURE__ */ M(ce, { at: P && e.deleted_at ? e.deleted_at : e.updated_at }),
541
+ t === "scheduled" && e.publish_at && /* @__PURE__ */ M("span", { children: b("pollManager.goesLive", { date: ue(y, e.publish_at) }) })
542
+ ]
238
543
  }),
239
- href: i,
240
- children: y("contentManager.view")
241
- }),
242
- /* @__PURE__ */ F(u, {
544
+ /* @__PURE__ */ M(se, { error: Ye[e.id] ?? null })
545
+ ]
546
+ }),
547
+ /* @__PURE__ */ M("div", {
548
+ className: "flex flex-wrap items-center gap-2",
549
+ children: P ? /* @__PURE__ */ M(d, {
243
550
  size: "sm",
244
551
  variant: "outline",
245
- onClick: () => e.go(t.id),
246
- children: y("comments.edit")
247
- }),
248
- /* @__PURE__ */ F(u, {
249
- size: "sm",
250
- variant: "destructive",
251
- disabled: V.pending,
252
- onClick: () => void W(t),
253
- children: y("comments.delete")
254
- })
255
- ] })
256
- })]
257
- }, t.id);
258
- })
259
- }) : /* @__PURE__ */ F("p", {
260
- className: "text-muted-foreground",
261
- children: y(E ? "contentManager.noDeleted" : "contentManager.empty")
552
+ disabled: He.pending,
553
+ onClick: () => void He.run(() => u.contents.restore(e.id)),
554
+ children: b("moderation.restore")
555
+ }) : /* @__PURE__ */ N(be, { children: [
556
+ $e(e) && /* @__PURE__ */ N(d, {
557
+ size: "sm",
558
+ variant: "outline",
559
+ disabled: r,
560
+ "aria-busy": r,
561
+ onClick: () => void tt(e, !i),
562
+ children: [r && /* @__PURE__ */ M(Ee, {}), b(i ? "contentManager.makeFree" : "contentManager.makePremium")]
563
+ }),
564
+ n && /* @__PURE__ */ M("a", {
565
+ className: ee({
566
+ size: "sm",
567
+ variant: "ghost"
568
+ }),
569
+ href: n,
570
+ children: b("contentManager.view")
571
+ }),
572
+ /* @__PURE__ */ M(d, {
573
+ size: "sm",
574
+ variant: "outline",
575
+ onClick: () => l(e),
576
+ children: b("comments.edit")
577
+ }),
578
+ /* @__PURE__ */ M(d, {
579
+ size: "sm",
580
+ variant: "destructive",
581
+ disabled: He.pending,
582
+ onClick: () => void nt(e),
583
+ children: b("comments.delete")
584
+ })
585
+ ] })
586
+ })
587
+ ]
588
+ }, e.id);
589
+ })]
590
+ }) : /* @__PURE__ */ N("div", {
591
+ className: "grid justify-items-start gap-2",
592
+ children: [/* @__PURE__ */ M("p", {
593
+ className: "text-muted-foreground",
594
+ children: b(V ? "contentManager.noMatches" : P ? "contentManager.noDeleted" : "contentManager.emptyAll")
595
+ }), V ? /* @__PURE__ */ M(d, {
596
+ size: "sm",
597
+ variant: "outline",
598
+ onClick: () => n.go("", { deleted: P ? "1" : void 0 }),
599
+ children: b("contentManager.clearFilters")
600
+ }) : !P && /* @__PURE__ */ M(d, {
601
+ size: "sm",
602
+ onClick: () => n.go("new"),
603
+ children: b("contentManager.new")
604
+ })]
262
605
  }),
263
- /* @__PURE__ */ F(se, {
264
- page: D,
265
- hasNext: B.hasNext,
266
- disabled: B.loading,
267
- onPage: (t) => e.go("", {
268
- ...O,
269
- page: t > 1 ? t : void 0
606
+ /* @__PURE__ */ M(pe, {
607
+ page: F,
608
+ hasNext: X.hasNext,
609
+ disabled: Ve,
610
+ total: Be,
611
+ truncated: ze.data?.truncated,
612
+ pageSize: R,
613
+ pageSizes: we,
614
+ onPageSize: (e) => n.go("", {
615
+ ...z,
616
+ size: e === _ ? void 0 : e,
617
+ page: void 0
618
+ }),
619
+ onPage: (e) => n.go("", {
620
+ ...z,
621
+ page: e > 1 ? e : void 0
270
622
  })
271
623
  }),
272
- U
624
+ We
273
625
  ]
274
626
  });
275
627
  }
276
- var U = {
628
+ function q({ url: e }) {
629
+ return e ? /* @__PURE__ */ M("img", {
630
+ src: e,
631
+ alt: "",
632
+ loading: "lazy",
633
+ className: "aspect-[7/10] w-12 shrink-0 rounded-sm bg-muted object-cover"
634
+ }) : /* @__PURE__ */ M("span", {
635
+ "aria-hidden": !0,
636
+ className: "grid aspect-[7/10] w-12 shrink-0 place-items-center rounded-sm bg-muted text-muted-foreground",
637
+ children: /* @__PURE__ */ M(F, {
638
+ icon: P,
639
+ strokeWidth: 1.5,
640
+ className: "size-5"
641
+ })
642
+ });
643
+ }
644
+ function Ee() {
645
+ return /* @__PURE__ */ M("span", {
646
+ "aria-hidden": !0,
647
+ className: "size-3 animate-spin rounded-full border-2 border-current border-t-transparent"
648
+ });
649
+ }
650
+ var J = {
277
651
  title: "",
278
- slug: "",
279
652
  description: "",
280
653
  publishAt: "",
281
654
  body: ""
282
655
  };
283
- function W(e) {
284
- let { client: n, scope: r } = a(e.client), [i, o] = N({
656
+ function Y(e) {
657
+ let { client: n, scope: r } = a(e.client), i = A(null), [o, s] = j({
285
658
  id: e.id,
286
659
  kind: e.kind,
287
660
  client: n,
288
661
  scope: r,
289
- key: 0,
290
- allocated: null
291
- }), c = i;
292
- if (i.id !== e.id || i.kind !== e.kind || i.client !== n || i.scope !== r) {
293
- let t = i.id == null && e.id === i.allocated && i.kind === e.kind && i.client === n && i.scope === r;
294
- c = {
662
+ key: 0
663
+ }), l = o;
664
+ if (o.id !== e.id || o.kind !== e.kind || o.client !== n || o.scope !== r) {
665
+ let t = o.id == null && e.id === i.current?.id && i.current?.session === o.key && o.kind === e.kind && o.client === n && o.scope === r;
666
+ l = {
295
667
  id: e.id,
296
668
  kind: e.kind,
297
669
  client: n,
298
670
  scope: r,
299
- key: t ? i.key : i.key + 1,
300
- allocated: null
301
- }, o(c);
671
+ key: t ? o.key : o.key + 1
672
+ }, s(l);
302
673
  }
303
- let { kinds: l, error: u, reload: d } = s({ client: n }), { t: f } = t();
304
- if (!l) return u ? /* @__PURE__ */ F(x, {
305
- error: u,
306
- message: f("contentManager.loadFailed"),
307
- retry: d
308
- }) : /* @__PURE__ */ F(C, {});
309
- let p = {
674
+ let { kinds: u, error: d, reload: ee } = c({ client: n }), { t: te } = t();
675
+ if (!u) return d ? /* @__PURE__ */ M(fe, {
676
+ error: d,
677
+ message: te("contentManager.loadFailed"),
678
+ retry: ee
679
+ }) : /* @__PURE__ */ M(v, {});
680
+ let f = {
310
681
  ...e,
311
682
  client: n,
312
683
  onCreated: (t) => {
313
- o((e) => ({
314
- ...e,
315
- allocated: t.id
316
- })), e.onCreated?.(t);
684
+ i.current = {
685
+ id: t.id,
686
+ session: l.key
687
+ }, e.onCreated?.(t);
317
688
  }
318
689
  };
319
- return l.kinds[e.kind]?.presentation === "reader" ? /* @__PURE__ */ F(j, {
320
- ...p,
321
- model: l
322
- }, c.key) : /* @__PURE__ */ F(G, { ...p }, c.key);
690
+ return u.kinds[e.kind]?.presentation === "reader" ? /* @__PURE__ */ M(E, {
691
+ ...f,
692
+ model: u
693
+ }, l.key) : /* @__PURE__ */ M(De, { ...f }, l.key);
323
694
  }
324
- function G({ id: i, client: a, kind: o, languages: d, renderEditor: v, contentHref: ae, labels: oe, ownerGroup: b, onCreated: S, onDeleted: se, onError: C, management: ce }) {
325
- let E = n(a), D = t(), { t: O } = D, j = de(), M = pe(d), [L, z] = N(M[0]?.value ?? "en"), B = A(i, o, L, { client: E }), V = !!s({ client: E }).kinds?.kinds[o]?.versions.hidden, H = r(C), [W, G] = N(i ? null : U), [K, q] = N(null), [ge, J] = N(null), { confirm: _e, dialog: ve } = le(), Y = B.content;
326
- ue(() => {
327
- if (!Y) return;
328
- let e = Y.text?.[L];
329
- G((t) => t ?? {
695
+ function De({ id: i, client: a, kind: o, languages: s, renderEditor: ee, contentHref: ce, labels: ue, ownerGroup: de, entities: g, onCreated: _, onDeleted: pe, onError: v, management: me }) {
696
+ let y = n(a), b = t(), { t: x } = b, S = ye(), w = Se(s), [T, E] = j(w[0]?.value ?? "en"), D = ve(i, o, T, { client: y }), A = c({ client: y }).kinds, P = !!A?.kinds[o]?.versions.hidden, F = r(v), [I, L] = j(i ? null : J), [R, z] = j(null), [B, V] = j(null), { confirm: H, dialog: we } = he(), U = D.content;
697
+ O(() => {
698
+ if (!U) return;
699
+ let e = U.text?.[T];
700
+ L((t) => t ?? {
330
701
  title: e?.title ?? "",
331
- slug: e?.slug ?? "",
332
702
  description: e?.description ?? "",
333
703
  body: e?.body ?? "",
334
- publishAt: Y.publish_at && !Y.live ? w(new Date(Y.publish_at)) : ""
704
+ publishAt: U.publish_at && !U.live ? ge(new Date(U.publish_at)) : ""
335
705
  });
336
- }, [Y, L]);
337
- let { imageSrc: ye } = B, be = fe(() => (W?.body ?? "").replace(T(), (e, t) => {
338
- let n = ye(t);
706
+ }, [U, T]);
707
+ let { imageSrc: W } = D, Te = k(() => (I?.body ?? "").replace(_e(), (e, t) => {
708
+ let n = W(t);
339
709
  return n && n !== t ? n.replaceAll("&", "&amp;") : e;
340
- }), [W?.body, ye]);
341
- if (i && !W) return B.error ? /* @__PURE__ */ F(x, {
342
- error: B.error,
343
- message: O("contentManager.loadFailed"),
344
- retry: B.reload
345
- }) : /* @__PURE__ */ I("div", {
710
+ }), [I?.body, W]);
711
+ if (i && !I) return D.error ? /* @__PURE__ */ M(fe, {
712
+ error: D.error,
713
+ message: x("contentManager.loadFailed"),
714
+ retry: D.reload
715
+ }) : /* @__PURE__ */ N("div", {
346
716
  className: "grid gap-3",
347
717
  "aria-busy": !0,
348
- children: [/* @__PURE__ */ F(g, { className: "h-9 w-full" }), /* @__PURE__ */ F(g, { className: "h-48 w-full" })]
718
+ children: [/* @__PURE__ */ M(h, { className: "h-9 w-full" }), /* @__PURE__ */ M(h, { className: "h-48 w-full" })]
349
719
  });
350
- let X = W, Z = (e) => G((t) => ({
720
+ let G = I, K = (e) => L((t) => ({
351
721
  ...t,
352
722
  ...e
353
- })), Q = (t) => {
723
+ })), q = (t) => {
354
724
  let n = e(t);
355
- q(n), H(n, "content.save");
356
- }, xe = () => ({
357
- title: X.title.trim(),
358
- slug: X.slug.trim() || void 0,
359
- description: X.description.trim(),
360
- body: X.body
361
- }), Se = async () => {
362
- if (q(null), J(null), !X.title.trim()) return q(O("contentManager.titleRequired"));
725
+ z(n), F(n, "content.save");
726
+ }, Ee = () => ({
727
+ title: G.title.trim(),
728
+ description: G.description.trim(),
729
+ body: G.body
730
+ }), Y = async () => {
731
+ if (z(null), V(null), !G.title.trim()) return z(x("contentManager.titleRequired"));
363
732
  try {
364
- if (!Y) {
365
- let e = await B.create({
733
+ if (!U) {
734
+ let e = await D.create({
366
735
  kind: o,
367
- text: { [L]: xe() },
368
- owner_group_id: b
369
- });
370
- S?.(e);
736
+ text: { [T]: Ee() },
737
+ owner_group_id: de
738
+ }), t = (g ?? []).filter((e) => A?.kinds[o]?.entities?.includes(e.kind) && !A.entity_kinds[e.kind]?.version_level);
739
+ t.length && await y.entities.setOfContent(e.id, {
740
+ kinds: [...new Set(t.map((e) => e.kind))],
741
+ memberships: t.map((e) => ({ group_id: e.id }))
742
+ }, T).catch(q), _?.(e);
371
743
  return;
372
744
  }
373
- let e = await B.putText(xe());
374
- J(O("pollEditor.saved")), G((t) => ({
375
- ...t,
376
- slug: e.text?.[L]?.slug ?? t.slug
377
- }));
745
+ await D.putText(Ee()), V(x("pollEditor.saved"));
378
746
  } catch (e) {
379
- Q(e);
747
+ q(e);
380
748
  }
381
- }, Ce = async (e) => {
382
- q(null), J(null);
749
+ }, De = async (e) => {
750
+ z(null), V(null);
383
751
  try {
384
- e ? await B.publish(X.publishAt ? new Date(X.publishAt).toISOString() : void 0) : await B.unpublish(), J(O(e ? "contentManager.publishedNotice" : "contentManager.unpublishedNotice"));
752
+ e ? await D.publish(G.publishAt ? new Date(G.publishAt).toISOString() : void 0) : await D.unpublish(), V(x(e ? "contentManager.publishedNotice" : "contentManager.unpublishedNotice"));
385
753
  } catch (e) {
386
- Q(e);
754
+ q(e);
387
755
  }
388
- }, we = async () => {
389
- if (Y && await _e({
390
- title: O("contentManager.deleteTitle", { title: Y.title }),
391
- description: O("contentManager.deleteBody"),
392
- confirm: O("contentManager.delete")
756
+ }, ke = async () => {
757
+ if (U && await H({
758
+ title: x("contentManager.deleteTitle", { title: U.title }),
759
+ description: x("contentManager.deleteBody"),
760
+ confirm: x("contentManager.delete")
393
761
  })) try {
394
- await B.remove(), se?.(Y);
762
+ await D.remove(), pe?.(U);
395
763
  } catch (e) {
396
- Q(e);
764
+ q(e);
397
765
  }
398
- }, $ = Y ? R(Y) : "draft", Te = Y && $ === "published" ? ae?.(Y) : void 0, Ee = {
399
- value: be,
400
- onChange: (e) => Z({ body: B.storedBody(e) }),
401
- uploadImage: Y ? (e) => B.uploadImage(e) : void 0,
402
- disabled: B.saving,
403
- placeholder: O("contentManager.bodyPlaceholder"),
404
- "aria-label": O("contentManager.body")
766
+ }, Ae = U ? xe(U) : "draft", je = U && Ae === "published" ? ce?.(U) : void 0, Me = {
767
+ value: Te,
768
+ onChange: (e) => K({ body: D.storedBody(e) }),
769
+ uploadImage: U ? (e) => D.uploadImage(e) : void 0,
770
+ disabled: D.saving,
771
+ placeholder: x("contentManager.bodyPlaceholder"),
772
+ "aria-label": x("contentManager.body")
405
773
  };
406
- return /* @__PURE__ */ I(P, { children: [/* @__PURE__ */ I("form", {
774
+ return /* @__PURE__ */ N(be, { children: [/* @__PURE__ */ N("form", {
407
775
  className: "grid gap-4",
408
776
  "data-ckui": "content-form",
409
777
  onSubmit: (e) => {
410
- e.preventDefault(), Se();
778
+ e.preventDefault(), Y();
411
779
  },
412
780
  children: [
413
- /* @__PURE__ */ I("div", {
781
+ /* @__PURE__ */ N("div", {
414
782
  className: "flex flex-wrap items-center gap-2",
415
783
  children: [
416
- /* @__PURE__ */ F("h2", {
784
+ /* @__PURE__ */ M("h2", {
417
785
  className: "text-base font-semibold",
418
- children: O(Y ? "contentManager.editTitle" : "contentManager.newTitle")
786
+ children: x(U ? "contentManager.editTitle" : "contentManager.newTitle")
419
787
  }),
420
- Y && /* @__PURE__ */ F(f, {
421
- variant: me[$],
422
- children: O(`contentManager.${$}`)
788
+ U && /* @__PURE__ */ M(te, {
789
+ variant: Ce[Ae],
790
+ children: x(`contentManager.${Ae}`)
423
791
  }),
424
- Te && /* @__PURE__ */ F("a", {
792
+ je && /* @__PURE__ */ M("a", {
425
793
  className: "text-xs text-muted-foreground hover:underline",
426
- href: Te,
427
- children: O("contentManager.view")
794
+ href: je,
795
+ children: x("contentManager.view")
428
796
  })
429
797
  ]
430
798
  }),
431
- Y?.moderation && /* @__PURE__ */ F(c, {
432
- variant: Y.moderation === "rejected" ? "destructive" : "default",
433
- children: /* @__PURE__ */ F(l, { children: Y.moderation_reason ? O(`contentManager.${Y.moderation === "rejected" ? "rejectedBecause" : "heldBecause"}`, { reason: Y.moderation_reason }) : O(`contentManager.${Y.moderation === "rejected" ? "rejectedNote" : "heldNote"}`) })
799
+ U?.moderation && /* @__PURE__ */ M(l, {
800
+ variant: U.moderation === "rejected" ? "destructive" : "default",
801
+ children: /* @__PURE__ */ M(u, { children: U.moderation_reason ? x(`contentManager.${U.moderation === "rejected" ? "rejectedBecause" : "heldBecause"}`, { reason: U.moderation_reason }) : x(`contentManager.${U.moderation === "rejected" ? "rejectedNote" : "heldNote"}`) })
434
802
  }),
435
- M.length > 1 && /* @__PURE__ */ I("div", {
803
+ w.length > 1 && /* @__PURE__ */ N("div", {
436
804
  className: "grid gap-1.5",
437
- children: [/* @__PURE__ */ F(m, {
438
- htmlFor: `${j}-lang`,
439
- children: O("contentManager.language")
440
- }), /* @__PURE__ */ I(ee, {
441
- value: L,
805
+ children: [/* @__PURE__ */ M(p, {
806
+ htmlFor: `${S}-lang`,
807
+ children: x("contentManager.language")
808
+ }), /* @__PURE__ */ N(ne, {
809
+ value: T,
442
810
  onValueChange: (e) => {
443
- z(String(e ?? "")), G(Y ? null : U);
811
+ E(String(e ?? "")), L(U ? null : J);
444
812
  },
445
- children: [/* @__PURE__ */ F(ne, {
446
- id: `${j}-lang`,
813
+ children: [/* @__PURE__ */ M(ie, {
814
+ id: `${S}-lang`,
447
815
  className: "w-full",
448
- children: /* @__PURE__ */ F(re, { children: (e) => M.find((t) => t.value === e)?.label ?? e })
449
- }), /* @__PURE__ */ F(te, { children: M.map((e) => /* @__PURE__ */ F(h, {
816
+ children: /* @__PURE__ */ M(ae, { children: (e) => w.find((t) => t.value === e)?.label ?? e })
817
+ }), /* @__PURE__ */ M(re, { children: w.map((e) => /* @__PURE__ */ M(m, {
450
818
  value: e.value,
451
819
  children: e.label
452
820
  }, e.value)) })]
453
821
  })]
454
822
  }),
455
- /* @__PURE__ */ I("div", {
823
+ /* @__PURE__ */ N("div", {
456
824
  className: "grid gap-1.5",
457
- children: [/* @__PURE__ */ F(m, {
458
- htmlFor: `${j}-title`,
459
- children: O("contentManager.itemTitle")
460
- }), /* @__PURE__ */ F(p, {
461
- id: `${j}-title`,
462
- value: X.title,
825
+ children: [/* @__PURE__ */ M(p, {
826
+ htmlFor: `${S}-title`,
827
+ children: x("contentManager.itemTitle")
828
+ }), /* @__PURE__ */ M(f, {
829
+ id: `${S}-title`,
830
+ value: G.title,
463
831
  required: !0,
464
832
  maxLength: 300,
465
- onChange: (e) => Z({ title: e.target.value })
833
+ onChange: (e) => K({ title: e.target.value })
466
834
  })]
467
835
  }),
468
- /* @__PURE__ */ I("div", {
836
+ /* @__PURE__ */ M("div", {
469
837
  className: "grid gap-4 sm:grid-cols-2",
470
- children: [/* @__PURE__ */ I("div", {
471
- className: "grid gap-1.5",
472
- children: [/* @__PURE__ */ F(m, {
473
- htmlFor: `${j}-slug`,
474
- children: O("contentManager.slug")
475
- }), /* @__PURE__ */ F(p, {
476
- id: `${j}-slug`,
477
- value: X.slug,
478
- placeholder: O("contentManager.slugAuto"),
479
- onChange: (e) => Z({ slug: e.target.value })
480
- })]
481
- }), /* @__PURE__ */ I("div", {
838
+ children: /* @__PURE__ */ N("div", {
482
839
  className: "grid gap-1.5",
483
- children: [/* @__PURE__ */ F(m, {
484
- htmlFor: `${j}-publish`,
485
- children: O("contentManager.publishAt")
486
- }), /* @__PURE__ */ F(p, {
487
- id: `${j}-publish`,
840
+ children: [/* @__PURE__ */ M(p, {
841
+ htmlFor: `${S}-publish`,
842
+ children: x("contentManager.publishAt")
843
+ }), /* @__PURE__ */ M(f, {
844
+ id: `${S}-publish`,
488
845
  type: "datetime-local",
489
- value: X.publishAt,
490
- onChange: (e) => Z({ publishAt: e.target.value })
846
+ value: G.publishAt,
847
+ onChange: (e) => K({ publishAt: e.target.value })
491
848
  })]
492
- })]
849
+ })
493
850
  }),
494
- /* @__PURE__ */ I("div", {
851
+ /* @__PURE__ */ N("div", {
495
852
  className: "grid gap-1.5",
496
- children: [/* @__PURE__ */ F(m, {
497
- htmlFor: `${j}-description`,
498
- children: O("contentManager.description")
499
- }), /* @__PURE__ */ F(_, {
500
- id: `${j}-description`,
853
+ children: [/* @__PURE__ */ M(p, {
854
+ htmlFor: `${S}-description`,
855
+ children: x("contentManager.description")
856
+ }), /* @__PURE__ */ M(oe, {
857
+ id: `${S}-description`,
501
858
  rows: 2,
502
- value: X.description,
503
- onChange: (e) => Z({ description: e.target.value })
859
+ value: G.description,
860
+ onChange: (e) => K({ description: e.target.value })
504
861
  })]
505
862
  }),
506
- (V || !Y) && /* @__PURE__ */ F(he, {
507
- item: Y,
508
- src: B.coverSrc,
509
- saving: B.saving,
510
- onFile: (e) => void B.setCover(e).catch(Q)
863
+ (P || !U) && /* @__PURE__ */ M(Oe, {
864
+ item: U,
865
+ src: D.coverSrc,
866
+ saving: D.saving,
867
+ onFile: (e) => void D.setCover(e).catch(q)
511
868
  }),
512
- /* @__PURE__ */ I("div", {
869
+ /* @__PURE__ */ N("div", {
513
870
  className: "grid gap-1.5",
514
871
  children: [
515
- /* @__PURE__ */ F("span", {
872
+ /* @__PURE__ */ M("span", {
516
873
  className: "text-sm font-medium",
517
- children: O("contentManager.body")
874
+ children: x("contentManager.body")
518
875
  }),
519
- v ? v(Ee) : /* @__PURE__ */ F(_, {
520
- "aria-label": Ee["aria-label"],
876
+ ee ? ee(Me) : /* @__PURE__ */ M(oe, {
877
+ "aria-label": Me["aria-label"],
521
878
  rows: 12,
522
- value: X.body,
523
- placeholder: Ee.placeholder,
524
- onChange: (e) => Z({ body: e.target.value })
879
+ value: G.body,
880
+ placeholder: Me.placeholder,
881
+ onChange: (e) => K({ body: e.target.value })
525
882
  }),
526
- !Y && /* @__PURE__ */ F("p", {
883
+ !U && /* @__PURE__ */ M("p", {
527
884
  className: "text-xs text-muted-foreground",
528
- children: O("contentManager.imagesAfterCreate")
885
+ children: x("contentManager.imagesAfterCreate")
529
886
  })
530
887
  ]
531
888
  }),
532
- K && /* @__PURE__ */ F(ie, { children: typeof K == "string" ? K : y(D, K) }),
533
- ge && !K && /* @__PURE__ */ F("p", {
889
+ R && /* @__PURE__ */ M(se, { children: typeof R == "string" ? R : le(b, R) }),
890
+ B && !R && /* @__PURE__ */ M("p", {
534
891
  role: "status",
535
892
  className: "text-sm text-muted-foreground",
536
- children: ge
893
+ children: B
537
894
  }),
538
- /* @__PURE__ */ I("div", {
895
+ /* @__PURE__ */ N("div", {
539
896
  className: "flex flex-wrap gap-2 border-t border-border pt-4",
540
897
  children: [
541
- /* @__PURE__ */ F(u, {
898
+ /* @__PURE__ */ M(d, {
542
899
  type: "submit",
543
- disabled: B.saving,
544
- children: B.saving ? O("common.saving") : O(Y ? "common.save" : "contentManager.createDraft")
900
+ disabled: D.saving,
901
+ children: D.saving ? x("common.saving") : x(U ? "common.save" : "contentManager.createDraft")
545
902
  }),
546
- Y && !Y.live && /* @__PURE__ */ F(u, {
903
+ U && !U.live && /* @__PURE__ */ M(d, {
547
904
  type: "button",
548
905
  variant: "outline",
549
- disabled: B.saving,
550
- onClick: () => void Ce(!0),
551
- children: O("contentManager.publish")
906
+ disabled: D.saving,
907
+ onClick: () => void De(!0),
908
+ children: x("contentManager.publish")
552
909
  }),
553
- Y?.state === "published" && /* @__PURE__ */ F(u, {
910
+ U?.state === "published" && /* @__PURE__ */ M(d, {
554
911
  type: "button",
555
912
  variant: "outline",
556
- disabled: B.saving,
557
- onClick: () => void Ce(!1),
558
- children: O("contentManager.unpublish")
913
+ disabled: D.saving,
914
+ onClick: () => void De(!1),
915
+ children: x("contentManager.unpublish")
559
916
  }),
560
- Y && /* @__PURE__ */ F(u, {
917
+ U && /* @__PURE__ */ M(d, {
561
918
  type: "button",
562
919
  variant: "destructive",
563
920
  className: "ms-auto",
564
- disabled: B.saving,
565
- onClick: () => void we(),
566
- children: O("contentManager.delete")
921
+ disabled: D.saving,
922
+ onClick: () => void ke(),
923
+ children: x("contentManager.delete")
567
924
  })
568
925
  ]
569
926
  }),
570
- ve
927
+ we
571
928
  ]
572
- }), Y && /* @__PURE__ */ F(k, {
573
- management: ce,
574
- content: Y,
575
- client: E,
576
- onError: C,
577
- labels: oe
929
+ }), U && /* @__PURE__ */ M(C, {
930
+ management: me,
931
+ content: U,
932
+ client: y,
933
+ onError: v,
934
+ labels: ue
578
935
  })] });
579
936
  }
580
- function he({ item: e, src: n, saving: r, onFile: i }) {
581
- let { t: a } = t(), o = M(null);
582
- return /* @__PURE__ */ I("div", {
937
+ function Oe({ item: e, src: n, saving: r, onFile: i }) {
938
+ let { t: a } = t(), o = A(null);
939
+ return /* @__PURE__ */ N("div", {
583
940
  className: "grid gap-1.5",
584
941
  "data-ckui": "content-cover",
585
- children: [/* @__PURE__ */ F("span", {
942
+ children: [/* @__PURE__ */ M("span", {
586
943
  className: "text-sm font-medium",
587
944
  children: a("contentManager.cover")
588
- }), e ? /* @__PURE__ */ I("div", {
945
+ }), e ? /* @__PURE__ */ N("div", {
589
946
  className: "flex flex-wrap items-center gap-3",
590
947
  children: [
591
- n ? /* @__PURE__ */ F("img", {
948
+ n ? /* @__PURE__ */ M("img", {
592
949
  src: n,
593
950
  alt: "",
594
951
  className: "h-20 w-36 rounded-md border border-border object-cover"
595
- }) : /* @__PURE__ */ F("span", {
952
+ }) : /* @__PURE__ */ M("span", {
596
953
  className: "text-muted-foreground",
597
954
  children: a("contentManager.noCover")
598
955
  }),
599
- /* @__PURE__ */ F(u, {
956
+ /* @__PURE__ */ M(d, {
600
957
  type: "button",
601
958
  size: "sm",
602
959
  variant: "outline",
@@ -604,7 +961,7 @@ function he({ item: e, src: n, saving: r, onFile: i }) {
604
961
  onClick: () => o.current?.click(),
605
962
  children: a(n ? "pollEditor.replaceImage" : "contentManager.addCover")
606
963
  }),
607
- n && /* @__PURE__ */ F(u, {
964
+ n && /* @__PURE__ */ M(d, {
608
965
  type: "button",
609
966
  size: "sm",
610
967
  variant: "ghost",
@@ -612,7 +969,7 @@ function he({ item: e, src: n, saving: r, onFile: i }) {
612
969
  onClick: () => i(null),
613
970
  children: a("pollEditor.removeImage")
614
971
  }),
615
- /* @__PURE__ */ F("input", {
972
+ /* @__PURE__ */ M("input", {
616
973
  ref: o,
617
974
  type: "file",
618
975
  accept: "image/*",
@@ -624,13 +981,13 @@ function he({ item: e, src: n, saving: r, onFile: i }) {
624
981
  }
625
982
  })
626
983
  ]
627
- }) : /* @__PURE__ */ F("p", {
984
+ }) : /* @__PURE__ */ M("p", {
628
985
  className: "text-xs text-muted-foreground",
629
986
  children: a("contentManager.imagesAfterCreate")
630
987
  })]
631
988
  });
632
989
  }
633
990
  //#endregion
634
- export { W as ContentEditor, B as ContentManager, R as contentStatus, L as useContentManagerAccess };
991
+ export { Y as ContentEditor, R as ContentManager, W as accessLabel, xe as contentStatus, I as useContentManagerAccess };
635
992
 
636
993
  //# sourceMappingURL=content-manager.js.map