@openrails/contentkit-ui 0.104.0-rc.1 → 0.104.0-rc.3

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 (217) hide show
  1. package/README.md +6 -6
  2. package/dist/client/beacons.js +4 -1
  3. package/dist/client/beacons.js.map +1 -1
  4. package/dist/client/contents.d.ts +9 -1
  5. package/dist/client/contents.js +73 -55
  6. package/dist/client/contents.js.map +1 -1
  7. package/dist/client/discovery.d.ts +6 -2
  8. package/dist/client/discovery.js +1 -1
  9. package/dist/client/discovery.js.map +1 -1
  10. package/dist/client/generated/error-codes.d.ts +1 -1
  11. package/dist/client/generated/error-codes.js +4 -0
  12. package/dist/client/generated/error-codes.js.map +1 -1
  13. package/dist/client/generated/routes.d.ts +43 -30
  14. package/dist/client/generated/routes.js +70 -63
  15. package/dist/client/generated/routes.js.map +1 -1
  16. package/dist/client/generated/wire.d.ts +36 -74
  17. package/dist/client/generated/wire.js.map +1 -1
  18. package/dist/client/index.d.ts +1 -1
  19. package/dist/client/media/windows.d.ts +2 -0
  20. package/dist/client/media/windows.js +4 -1
  21. package/dist/client/media/windows.js.map +1 -1
  22. package/dist/client/stats.d.ts +4 -20
  23. package/dist/client/stats.js +0 -11
  24. package/dist/client/stats.js.map +1 -1
  25. package/dist/client/versions.d.ts +8 -6
  26. package/dist/client/versions.js +15 -10
  27. package/dist/client/versions.js.map +1 -1
  28. package/dist/components/admin/bulk-drafts.d.ts +17 -0
  29. package/dist/components/admin/bulk-drafts.js +41 -0
  30. package/dist/components/admin/bulk-drafts.js.map +1 -0
  31. package/dist/components/admin/content-admin.d.ts +1 -1
  32. package/dist/components/admin/content-admin.js.map +1 -1
  33. package/dist/components/admin/content-manager.d.ts +11 -3
  34. package/dist/components/admin/content-manager.js +739 -380
  35. package/dist/components/admin/content-manager.js.map +1 -1
  36. package/dist/components/admin/group-manager.d.ts +8 -3
  37. package/dist/components/admin/group-manager.js +218 -146
  38. package/dist/components/admin/group-manager.js.map +1 -1
  39. package/dist/components/admin/page-notices.d.ts +16 -0
  40. package/dist/components/admin/page-notices.js +113 -0
  41. package/dist/components/admin/page-notices.js.map +1 -0
  42. package/dist/components/admin/page-picker.d.ts +38 -0
  43. package/dist/components/admin/page-picker.js +159 -0
  44. package/dist/components/admin/page-picker.js.map +1 -0
  45. package/dist/components/admin/reader-content-editor.js +537 -500
  46. package/dist/components/admin/reader-content-editor.js.map +1 -1
  47. package/dist/components/admin/reader-manifest.js +181 -179
  48. package/dist/components/admin/reader-manifest.js.map +1 -1
  49. package/dist/components/admin/shell.d.ts +10 -2
  50. package/dist/components/admin/shell.js +114 -42
  51. package/dist/components/admin/shell.js.map +1 -1
  52. package/dist/components/admin/stats-dashboard.d.ts +4 -9
  53. package/dist/components/admin/stats-dashboard.js +300 -202
  54. package/dist/components/admin/stats-dashboard.js.map +1 -1
  55. package/dist/components/admin/upload-queue.d.ts +14 -0
  56. package/dist/components/admin/upload-queue.js +115 -98
  57. package/dist/components/admin/upload-queue.js.map +1 -1
  58. package/dist/components/content/card.d.ts +31 -3
  59. package/dist/components/content/card.js +324 -158
  60. package/dist/components/content/card.js.map +1 -1
  61. package/dist/components/content/daily-releases.js +14 -12
  62. package/dist/components/content/daily-releases.js.map +1 -1
  63. package/dist/components/content/editor-save.js +27 -25
  64. package/dist/components/content/editor-save.js.map +1 -1
  65. package/dist/components/content/editors.js +274 -253
  66. package/dist/components/content/editors.js.map +1 -1
  67. package/dist/components/content/favorites.d.ts +1 -1
  68. package/dist/components/content/favorites.js +36 -22
  69. package/dist/components/content/favorites.js.map +1 -1
  70. package/dist/components/content/grid.d.ts +11 -4
  71. package/dist/components/content/grid.js +52 -43
  72. package/dist/components/content/grid.js.map +1 -1
  73. package/dist/components/content/history.js +83 -63
  74. package/dist/components/content/history.js.map +1 -1
  75. package/dist/components/content/index.d.ts +5 -3
  76. package/dist/components/content/listing.d.ts +14 -3
  77. package/dist/components/content/listing.js +65 -56
  78. package/dist/components/content/listing.js.map +1 -1
  79. package/dist/components/content/offer-fields.js +6 -6
  80. package/dist/components/content/paged-grid.d.ts +10 -0
  81. package/dist/components/content/paged-grid.js +116 -0
  82. package/dist/components/content/paged-grid.js.map +1 -0
  83. package/dist/components/content/pagination.d.ts +19 -0
  84. package/dist/components/content/pagination.js +97 -0
  85. package/dist/components/content/pagination.js.map +1 -0
  86. package/dist/components/content/paywall.d.ts +9 -0
  87. package/dist/components/content/paywall.js +27 -3
  88. package/dist/components/content/paywall.js.map +1 -1
  89. package/dist/components/content/post-list.d.ts +37 -0
  90. package/dist/components/content/post-list.js +203 -0
  91. package/dist/components/content/post-list.js.map +1 -0
  92. package/dist/components/content/reader-settings.d.ts +2 -0
  93. package/dist/components/content/reader-settings.js +1 -1
  94. package/dist/components/content/reader-settings.js.map +1 -1
  95. package/dist/components/groups/banner.d.ts +6 -2
  96. package/dist/components/groups/banner.js +79 -61
  97. package/dist/components/groups/banner.js.map +1 -1
  98. package/dist/components/groups/directory.d.ts +12 -2
  99. package/dist/components/groups/directory.js +168 -105
  100. package/dist/components/groups/directory.js.map +1 -1
  101. package/dist/components/groups/editor.js +10 -10
  102. package/dist/components/groups/editor.js.map +1 -1
  103. package/dist/components/groups/entity-chips.d.ts +61 -0
  104. package/dist/components/groups/entity-chips.js +382 -0
  105. package/dist/components/groups/entity-chips.js.map +1 -0
  106. package/dist/components/groups/group-members.d.ts +29 -0
  107. package/dist/components/groups/group-members.js +474 -0
  108. package/dist/components/groups/group-members.js.map +1 -0
  109. package/dist/components/groups/header.js +53 -45
  110. package/dist/components/groups/header.js.map +1 -1
  111. package/dist/components/groups/index.d.ts +3 -1
  112. package/dist/components/groups/memberships.d.ts +3 -36
  113. package/dist/components/groups/memberships.js +105 -480
  114. package/dist/components/groups/memberships.js.map +1 -1
  115. package/dist/components/groups/scoped.d.ts +23 -0
  116. package/dist/components/groups/scoped.js +92 -0
  117. package/dist/components/groups/scoped.js.map +1 -0
  118. package/dist/components/media-folder-editor.d.ts +5 -0
  119. package/dist/components/media-folder-editor.js +418 -230
  120. package/dist/components/media-folder-editor.js.map +1 -1
  121. package/dist/components/social/poll.js +57 -48
  122. package/dist/components/social/poll.js.map +1 -1
  123. package/dist/components/sortable-list.d.ts +5 -1
  124. package/dist/components/sortable-list.js +97 -81
  125. package/dist/components/sortable-list.js.map +1 -1
  126. package/dist/index.d.ts +1 -1
  127. package/dist/index.js +41 -37
  128. package/dist/locales/admin/de.js +78 -45
  129. package/dist/locales/admin/de.js.map +1 -1
  130. package/dist/locales/admin/en.d.ts +74 -41
  131. package/dist/locales/admin/en.js +78 -45
  132. package/dist/locales/admin/en.js.map +1 -1
  133. package/dist/locales/admin/es.js +78 -45
  134. package/dist/locales/admin/es.js.map +1 -1
  135. package/dist/locales/admin/ja.js +78 -45
  136. package/dist/locales/admin/ja.js.map +1 -1
  137. package/dist/locales/admin/ko.js +78 -45
  138. package/dist/locales/admin/ko.js.map +1 -1
  139. package/dist/locales/admin/zh.js +78 -45
  140. package/dist/locales/admin/zh.js.map +1 -1
  141. package/dist/locales/de.js +2 -0
  142. package/dist/locales/de.js.map +1 -1
  143. package/dist/locales/discovery/de.js +25 -1
  144. package/dist/locales/discovery/de.js.map +1 -1
  145. package/dist/locales/discovery/en.d.ts +24 -0
  146. package/dist/locales/discovery/en.js +25 -1
  147. package/dist/locales/discovery/en.js.map +1 -1
  148. package/dist/locales/discovery/es.js +25 -1
  149. package/dist/locales/discovery/es.js.map +1 -1
  150. package/dist/locales/discovery/ja.js +25 -1
  151. package/dist/locales/discovery/ja.js.map +1 -1
  152. package/dist/locales/discovery/ko.js +25 -1
  153. package/dist/locales/discovery/ko.js.map +1 -1
  154. package/dist/locales/discovery/zh.js +25 -1
  155. package/dist/locales/discovery/zh.js.map +1 -1
  156. package/dist/locales/en.d.ts +120 -43
  157. package/dist/locales/en.js +2 -0
  158. package/dist/locales/en.js.map +1 -1
  159. package/dist/locales/es.js +2 -0
  160. package/dist/locales/es.js.map +1 -1
  161. package/dist/locales/groups/de.js +22 -4
  162. package/dist/locales/groups/de.js.map +1 -1
  163. package/dist/locales/groups/en.d.ts +20 -2
  164. package/dist/locales/groups/en.js +22 -4
  165. package/dist/locales/groups/en.js.map +1 -1
  166. package/dist/locales/groups/es.js +22 -4
  167. package/dist/locales/groups/es.js.map +1 -1
  168. package/dist/locales/groups/ja.js +22 -4
  169. package/dist/locales/groups/ja.js.map +1 -1
  170. package/dist/locales/groups/ko.js +22 -4
  171. package/dist/locales/groups/ko.js.map +1 -1
  172. package/dist/locales/groups/zh.js +22 -4
  173. package/dist/locales/groups/zh.js.map +1 -1
  174. package/dist/locales/ja.js +2 -0
  175. package/dist/locales/ja.js.map +1 -1
  176. package/dist/locales/ko.js +2 -0
  177. package/dist/locales/ko.js.map +1 -1
  178. package/dist/locales/zh.js +2 -0
  179. package/dist/locales/zh.js.map +1 -1
  180. package/dist/react/contents.js +1 -1
  181. package/dist/react/contents.js.map +1 -1
  182. package/dist/react/discovery.d.ts +16 -0
  183. package/dist/react/discovery.js +69 -37
  184. package/dist/react/discovery.js.map +1 -1
  185. package/dist/react/groups.d.ts +19 -3
  186. package/dist/react/groups.js +49 -22
  187. package/dist/react/groups.js.map +1 -1
  188. package/dist/react/index.d.ts +6 -4
  189. package/dist/react/page-notices.d.ts +13 -0
  190. package/dist/react/page-notices.js +38 -0
  191. package/dist/react/page-notices.js.map +1 -0
  192. package/dist/react/post-reads.d.ts +23 -0
  193. package/dist/react/post-reads.js +90 -0
  194. package/dist/react/post-reads.js.map +1 -0
  195. package/dist/react/remembered-sort.d.ts +5 -0
  196. package/dist/react/remembered-sort.js +29 -0
  197. package/dist/react/remembered-sort.js.map +1 -0
  198. package/dist/react/resources.js +2 -2
  199. package/dist/react/resources.js.map +1 -1
  200. package/dist/react/stats.d.ts +3 -7
  201. package/dist/react/stats.js +2 -6
  202. package/dist/react/stats.js.map +1 -1
  203. package/dist/react/use-engagement.d.ts +2 -0
  204. package/dist/react/use-engagement.js +40 -34
  205. package/dist/react/use-engagement.js.map +1 -1
  206. package/dist/react.js +29 -27
  207. package/dist/styles.css +1 -1
  208. package/dist/urls/index.d.ts +1 -1
  209. package/dist/urls.js +2 -2
  210. package/dist/urls.js.map +1 -1
  211. package/package.json +1 -1
  212. package/dist/components/admin/page-review.d.ts +0 -13
  213. package/dist/components/admin/page-review.js +0 -225
  214. package/dist/components/admin/page-review.js.map +0 -1
  215. package/dist/react/page-review.d.ts +0 -14
  216. package/dist/react/page-review.js +0 -37
  217. package/dist/react/page-review.js.map +0 -1
@@ -1,169 +1,193 @@
1
1
  import { toContentKitError as e } from "../../client/errors.js";
2
2
  import { stem as t } from "../../client/media/client.js";
3
- import { useMessages as n } from "../../i18n/context.js";
4
- import { useErrorReporter as r, useGuarded as i } from "../../react/context.js";
5
- import { useContentScope as ee } from "../../react/use-resource.js";
6
- import { useContentGroups as te } from "../../react/groups.js";
7
- import { isProcessing as ne } from "../../client/media/windows.js";
8
- import { Button as a } from "../../ui/button.js";
9
- import { useMediaFolder as re } from "../../react/folder.js";
10
- import { MediaFolderEditor as ie } from "../media-folder-editor.js";
11
- import { Badge as ae } from "../../ui/badge.js";
12
- import { Input as o } from "../../ui/input.js";
13
- import { Label as s } from "../../ui/label.js";
14
- import { Select as c, SelectContent as l, SelectItem as u, SelectTrigger as oe, SelectValue as se } from "../../ui/select.js";
15
- import { Textarea as ce } from "../../ui/textarea.js";
16
- import { ErrorLine as d, contentError as le, useAction as ue } from "../social/parts.js";
17
- import { LoadFailed as de, Rows as fe, useConfirm as pe } from "./shell.js";
18
- import { localInput as me } from "../social/bans.js";
19
- import { imageRefs as he } from "../../client/contents.js";
20
- import { parseAttributes as ge } from "../../client/group-fields.js";
21
- import { GroupPicker as _e, labelOf as ve } from "../groups/parts.js";
22
- import { useDraft as f } from "../../react/use-draft.js";
23
- import { EditorSaveContext as ye, readerMediaReady as be, useEditorSaveCoordinator as xe } from "../content/editor-save.js";
24
- import { OfferFields as Se } from "../content/offer-fields.js";
25
- import { AttributeFields as Ce, formOf as we } from "../groups/fields.js";
26
- import { MembershipRow as Te } from "../groups/memberships.js";
27
- import { ReaderManifestEditor as Ee } from "./reader-manifest.js";
28
- import { usePageReview as De } from "../../react/page-review.js";
29
- import { PageReview as Oe } from "./page-review.js";
30
- import { RuleFields as ke, VersionsEditor as Ae, cleanRule as je, complete as Me, versionLabel as Ne } from "../content/editors.js";
31
- import { useContent as Pe } from "../../react/contents.js";
32
- import { contentStatus as Fe } from "./content-manager.js";
33
- import { useEffect as p, useId as Ie, useMemo as m, useRef as h, useState as g } from "react";
34
- import { jsx as _, jsxs as v } from "react/jsx-runtime";
35
- import { StarIcon as Le } from "@hugeicons/core-free-icons";
36
- import { HugeiconsIcon as Re } from "@hugeicons/react";
3
+ import { ruleFor as n } from "../../client/media/rules.js";
4
+ import { useMessages as r } from "../../i18n/context.js";
5
+ import { useErrorReporter as i, useGuarded as ee } from "../../react/context.js";
6
+ import { useContentScope as te } from "../../react/use-resource.js";
7
+ import { useContentGroups as ne } from "../../react/groups.js";
8
+ import { isProcessing as re, pageRemoved as a } from "../../client/media/windows.js";
9
+ import { Button as o } from "../../ui/button.js";
10
+ import { ImageCropDialog as s } from "../image-crop-dialog.js";
11
+ import { useEditorCrop as ie } from "../../react/crop.js";
12
+ import { useMediaFolder as ae } from "../../react/folder.js";
13
+ import { MediaFolderEditor as c, positionalName as oe } from "../media-folder-editor.js";
14
+ import { Badge as se } from "../../ui/badge.js";
15
+ import { Input as ce } from "../../ui/input.js";
16
+ import { Label as l } from "../../ui/label.js";
17
+ import { Select as u, SelectContent as le, SelectItem as ue, SelectTrigger as de, SelectValue as fe } from "../../ui/select.js";
18
+ import { Textarea as pe } from "../../ui/textarea.js";
19
+ import { ErrorLine as d, contentError as me, useAction as he } from "../social/parts.js";
20
+ import { LoadFailed as ge, Rows as _e, useConfirm as ve } from "./shell.js";
21
+ import { localInput as ye } from "../social/bans.js";
22
+ import { parseAttributes as be } from "../../client/group-fields.js";
23
+ import { labelOf as xe } from "../groups/parts.js";
24
+ import { useDraft as Se } from "../../react/use-draft.js";
25
+ import { EditorSaveContext as Ce, readerMediaReady as we, useEditorSaveCoordinator as Te } from "../content/editor-save.js";
26
+ import { OfferFields as Ee } from "../content/offer-fields.js";
27
+ import { AttributeFields as De, formOf as Oe } from "../groups/fields.js";
28
+ import { useContent as ke } from "../../react/contents.js";
29
+ import { usePageNotices as Ae } from "../../react/page-notices.js";
30
+ import { EntityChips as je } from "../groups/entity-chips.js";
31
+ import { ReaderManifestEditor as Me } from "./reader-manifest.js";
32
+ import { PageNotices as Ne } from "./page-notices.js";
33
+ import { RuleFields as Pe, VersionsEditor as Fe, cleanRule as Ie, complete as Le, versionLabel as Re } from "../content/editors.js";
34
+ import { fileTitle as ze } from "./bulk-drafts.js";
35
+ import { contentStatus as Be } from "./content-manager.js";
36
+ import { useEffect as f, useId as Ve, useMemo as p, useRef as m, useState as h } from "react";
37
+ import { jsx as g, jsxs as _ } from "react/jsx-runtime";
37
38
  //#region src/components/admin/reader-content-editor.tsx
38
- var y = () => ({
39
+ var He = {
40
+ kind: "",
41
+ id: ""
42
+ }, v = () => ({
39
43
  title: "",
40
44
  slug: "",
41
45
  description: "",
42
46
  body: ""
43
- }), ze = (e, t) => e?.text?.[t] ?? (e?.language === t ? {
47
+ }), Ue = (e, t) => e?.text?.[t] ?? (e?.language === t ? {
44
48
  title: e.title,
45
49
  slug: e.slug,
46
50
  description: e.description,
47
51
  body: e.body
48
- } : y()), Be = (e) => e.replace(/\.[^.]+$/, "").replace(/[_-]+/g, " ").trim().slice(0, 300), Ve = (e) => ({
52
+ } : v()), We = (e) => ({
49
53
  ...e,
50
54
  title: e.title.trim(),
51
- slug: e.slug?.trim() || void 0,
52
55
  description: e.description?.trim()
53
- }), b = class extends Error {};
54
- function x({ title: e, children: t, className: n = "" }) {
55
- return /* @__PURE__ */ v("section", {
56
- className: `grid min-w-0 content-start gap-4 rounded-xl border border-border bg-card p-4 ${n}`,
57
- children: [/* @__PURE__ */ _("h2", {
56
+ }), y = class extends Error {};
57
+ function b({ title: e, label: t, children: n, className: r = "" }) {
58
+ return /* @__PURE__ */ _("section", {
59
+ "aria-label": e ? void 0 : t,
60
+ className: `grid min-w-0 content-start gap-4 rounded-xl border border-border bg-card p-4 ${r}`,
61
+ children: [e && /* @__PURE__ */ g("h2", {
58
62
  className: "text-base font-semibold",
59
63
  children: e
60
- }), t]
64
+ }), n]
61
65
  });
62
66
  }
63
- function S(S) {
64
- let { client: C, scope: He } = ee(S.client), Ue = n(), { t: w } = Ue, T = Ie(), We = i(), Ge = r(S.onError), E = S.model, D = E.kinds[S.kind], Ke = S.languages?.map((e) => typeof e == "string" ? {
67
+ function x(x) {
68
+ let { client: S, scope: Ge } = te(x.client), Ke = r(), { t: C } = Ke, w = Ve(), qe = ee(), Je = i(x.onError), T = x.model, E = T.kinds[x.kind], Ye = x.languages?.map((e) => typeof e == "string" ? {
65
69
  value: e,
66
70
  label: e
67
- } : e), O = Ke?.length ? Ke : E.languages.map((e) => ({
71
+ } : e), D = Ye?.length ? Ye : T.languages.map((e) => ({
68
72
  value: e,
69
73
  label: e
70
- })), qe = O.map((e) => e.value).join("|"), [k, Je] = g(O[0]?.value ?? "en"), [Ye, Xe] = g(""), A = Pe(S.id, S.kind, k, {
71
- client: C,
72
- version: Ye || void 0
73
- }), [Ze, Qe] = g(null), j = A.content ?? Ze, M = h({
74
- item: j,
75
- scope: He,
74
+ })), Xe = D.map((e) => e.value).join("|"), [O, Ze] = h(D[0]?.value ?? "en"), [Qe, $e] = h(""), k = ke(x.id, x.kind, O, {
75
+ client: S,
76
+ version: Qe || void 0
77
+ }), [et, tt] = h(null), A = k.content ?? et, j = m({
78
+ item: A,
79
+ scope: Ge,
76
80
  alive: !0
77
81
  });
78
- M.current.item = j, p(() => {
79
- let e = M.current;
82
+ j.current.item = A, f(() => {
83
+ let e = j.current;
80
84
  return e.alive = !0, () => {
81
85
  e.alive = !1;
82
86
  };
83
87
  }, []);
84
- let N = () => M.current.alive && M.current.scope === He, P = h(null), [$e, et] = g(!1), [F, tt] = g(!1), [nt, I] = g(), [rt, it] = g(""), at = f(m(() => ({ at: j?.publish_at ? me(new Date(j.publish_at)) : "" }), [j?.publish_at])), ot = at.value.at, st = (e) => at.edit({ at: e }), [ct, lt] = g(!1), [ut, dt] = g([]), [ft, pt] = g(!1), [mt, ht] = g(!1), L = m(() => [...j?.versions ?? []].sort((e, t) => e.position - t.position), [j?.versions]), R = L.find((e) => e.id === Ye) ?? L[0];
85
- p(() => {
86
- ft && R && dt((e) => e.includes(R.id) ? e : [...e, R.id]);
87
- }, [ft, R]);
88
- let z = te(j?.id, {
89
- language: k,
90
- client: C
91
- }), gt = m(() => new Map(z.entities), [z.entities]), [_t, vt] = g(/* @__PURE__ */ new Map()), yt = m(() => new Map([..._t, ...gt]), [gt, _t]), B = m(() => D.entities ?? [], [D.entities]), V = f(m(() => Object.fromEntries(qe.split("|").map((e) => [e, ze(j, e)])), [j, qe])), H = f(m(() => ({
92
- listing: j?.listing ?? "listed",
93
- comments: j?.comments ?? "open",
94
- attributes: we(D.attributes ?? {}, j?.attributes ?? {}),
95
- access: j?.access ?? { level: "public" }
88
+ let M = () => j.current.alive && j.current.scope === Ge, N = m(null), [nt, rt] = h(!1), [P, it] = h(!1), [F, I] = h(), [at, ot] = h(""), st = Se(p(() => ({ at: A?.publish_at ? ye(new Date(A.publish_at)) : "" }), [A?.publish_at])), ct = st.value.at, lt = (e) => st.edit({ at: e }), [ut, dt] = h(!1), [ft, pt] = h([]), [mt, ht] = h(!1), [L, gt] = h(null), [_t, vt] = h(null), R = p(() => [...A?.versions ?? []].sort((e, t) => e.position - t.position), [A?.versions]), z = R.find((e) => e.id === Qe) ?? R[0];
89
+ f(() => {
90
+ mt && z && pt((e) => e.includes(z.id) ? e : [...e, z.id]);
91
+ }, [mt, z]);
92
+ let B = ne(A?.id, {
93
+ language: O,
94
+ client: S
95
+ }), yt = p(() => new Map(B.entities), [B.entities]), [bt, xt] = h(/* @__PURE__ */ new Map()), St = p(() => new Map([...bt, ...yt]), [yt, bt]), V = p(() => E.entities ?? [], [E.entities]), H = Se(p(() => Object.fromEntries(Xe.split("|").map((e) => [e, Ue(A, e)])), [A, Xe])), U = Se(p(() => ({
96
+ listing: A?.listing ?? "listed",
97
+ comments: A?.comments ?? "open",
98
+ attributes: Oe(E.attributes ?? {}, A?.attributes ?? {}),
99
+ access: A?.access ?? { level: "public" }
96
100
  }), [
97
- j?.listing,
98
- j?.comments,
99
- j?.attributes,
100
- j?.access,
101
- D.attributes
102
- ])), U = f(m(() => ({ memberships: z.memberships.filter((e) => B.includes(z.entities.get(e.group_id ?? "")?.kind ?? "")) }), [
103
- z.memberships,
104
- z.entities,
105
- B
106
- ])), W = xe(), G = h({
107
- texts: V,
108
- details: H,
109
- associations: U,
110
- language: k
101
+ A?.listing,
102
+ A?.comments,
103
+ A?.attributes,
104
+ A?.access,
105
+ E.attributes
106
+ ])), W = Se(p(() => ({
107
+ memberships: B.memberships.filter((e) => V.includes(B.entities.get(e.group_id ?? "")?.kind ?? "")),
108
+ create: []
109
+ }), [
110
+ B.memberships,
111
+ B.entities,
112
+ V
113
+ ])), Ct = (e, t, n) => {
114
+ let r = T.entity_kinds[e]?.scoped_by;
115
+ if (r) return new Set(t.filter((e) => St.get(e.group_id ?? "")?.kind === r).map((e) => e.group_id)).size + n.filter((e) => e.kind === r).length === 1 ? void 0 : xe(x.labels, r);
116
+ }, G = Te(), K = m({
117
+ texts: H,
118
+ details: U,
119
+ associations: W,
120
+ language: O
111
121
  });
112
- G.current = {
113
- texts: V,
114
- details: H,
115
- associations: U,
116
- language: k
122
+ K.current = {
123
+ texts: H,
124
+ details: U,
125
+ associations: W,
126
+ language: O
117
127
  };
118
- let K = V.value[k] ?? y(), bt = (K.body ?? "").replace(he(), (e, t) => A.imageSrc(t) ?? e), q = (e) => V.edit((t) => ({
128
+ let wt = m(!1);
129
+ f(() => {
130
+ if (wt.current || x.id || !x.entities?.length) return;
131
+ wt.current = !0;
132
+ let e = x.entities.filter((e) => V.includes(e.kind));
133
+ e.length && (xt((t) => new Map([...t, ...e.map((e) => [e.id, e])])), K.current.associations.edit((t) => ({
134
+ ...t,
135
+ memberships: [...t.memberships, ...e.filter((e) => !t.memberships.some((t) => t.group_id === e.id)).map((e) => ({ group_id: e.id }))]
136
+ })));
137
+ }, [
138
+ x.id,
139
+ x.entities,
140
+ V
141
+ ]);
142
+ let Tt = H.value[O] ?? v(), Et = (e) => H.edit((t) => ({
119
143
  ...t,
120
- [k]: {
121
- ...t[k] ?? y(),
144
+ [O]: {
145
+ ...t[O] ?? v(),
122
146
  ...e
123
147
  }
124
- })), xt = (t) => {
125
- N() && (I(t instanceof b ? t.message : t), t instanceof b || Ge(e(t), "content.save"));
126
- }, St = async (e) => {
127
- if (M.current.item) return M.current.item;
128
- if (P.current) return P.current;
129
- et(!0);
130
- let t = G.current.language, n = G.current.texts.get()[t] ?? y(), r = n.title.trim() || Be(e ?? "") || w("readerEditor.untitled");
131
- n.title.trim() || G.current.texts.edit((e) => ({
148
+ })), Dt = (t) => {
149
+ M() && (I(t instanceof y ? t.message : t), t instanceof y || Je(e(t), "content.save"));
150
+ }, Ot = async (e) => {
151
+ if (j.current.item) return j.current.item;
152
+ if (N.current) return N.current;
153
+ rt(!0);
154
+ let t = K.current.language, n = K.current.texts.get()[t] ?? v(), r = n.title.trim() || ze(e ?? "") || C("readerEditor.untitled");
155
+ n.title.trim() || K.current.texts.edit((e) => ({
132
156
  ...e,
133
157
  [t]: {
134
- ...e[t] ?? y(),
158
+ ...e[t] ?? v(),
135
159
  title: r
136
160
  }
137
161
  }));
138
162
  let i = {
139
- kind: S.kind,
163
+ kind: x.kind,
140
164
  text: { [t]: {
141
165
  ...n,
142
166
  title: r
143
167
  } },
144
- owner_group_id: S.ownerGroup
168
+ owner_group_id: x.ownerGroup
145
169
  };
146
- return P.current = A.create(i).then((e) => (M.current.item = e, N() && (Qe(e), S.onCreated?.(e)), e)).finally(() => {
147
- P.current = null, N() && et(!1);
148
- }), P.current;
149
- }, J = m(() => j && R ? {
150
- kind: S.kind,
151
- id: j.id,
152
- version: R.id
170
+ return N.current = k.create(i).then((e) => (j.current.item = e, M() && (tt(e), x.onCreated?.(e)), e)).finally(() => {
171
+ N.current = null, M() && rt(!1);
172
+ }), N.current;
173
+ }, q = p(() => A && z ? {
174
+ kind: x.kind,
175
+ id: A.id,
176
+ version: z.id
153
177
  } : null, [
154
- S.kind,
155
- j,
156
- R
157
- ]), Y = ue("content.save", S.onError), X = ue("offer.save", S.onError), Z = ue("content.save", S.onError), Q = re(J, {
158
- commit: R?.live ? "manual" : "auto",
159
- client: C,
160
- onError: S.onError
161
- }), Ct = h(Q);
162
- Ct.current = Q;
163
- let wt = Q.read.read?.files ?? [], $ = De(j?.id, R?.id, { client: C }), Tt = $.reload, Et = J && Q.read.read ? JSON.stringify([
164
- J.id,
165
- J.version,
166
- wt.filter((e) => e.upload).map((e) => [
178
+ x.kind,
179
+ A,
180
+ z
181
+ ]), J = he("content.save", x.onError), Y = he("offer.save", x.onError), X = he("content.save", x.onError), Z = ae(q, {
182
+ commit: z?.live ? "manual" : "auto",
183
+ client: S,
184
+ onError: x.onError
185
+ }), kt = m(Z);
186
+ kt.current = Z;
187
+ let At = Z.read.read?.files ?? [], jt = Ae(A?.id, z?.id, { client: S }).reload, Mt = q && Z.read.read ? JSON.stringify([
188
+ q.id,
189
+ q.version,
190
+ At.filter((e) => e.upload).map((e) => [
167
191
  e.path,
168
192
  e.size,
169
193
  e.staged,
@@ -171,563 +195,576 @@ function S(S) {
171
195
  e.failed
172
196
  ])
173
197
  ]) : null;
174
- p(() => {
175
- Et && Tt();
176
- }, [Et, Tt]);
177
- let Dt = !!Q.error || Q.queue.items.some((e) => e.status === "failed") || wt.some((e) => e.failed), Ot = wt.some(ne), kt = $.review?.selected ?? 0, At = Q.busy || $e || Ot || Q.read.loading || $.loading || Y.pending, jt = At || Dt || !!Q.read.error || !!$.error || kt === 0 || W.pending || X.pending, Mt = (e) => {
198
+ f(() => {
199
+ Mt && jt();
200
+ }, [Mt, jt]);
201
+ let Q = Z.groups.filter((e) => e.rule?.page).flatMap((e) => e.files.filter((e) => !a(e)));
202
+ f(() => {
203
+ L && !Q.some((e) => e.path === L.path) && gt(null);
204
+ }, [L, Q]);
205
+ let Nt = Z.groups.flatMap((e) => e.rule ? [e.rule] : []), Pt = z?.cover?.image ? At.find((e) => e.upload && !n(Nt, e.path)?.page && t(e.path).split("/").at(-1) === z.cover?.image) : void 0, $ = ie(q ?? He, _t?.path, {
206
+ client: S,
207
+ onError: x.onError,
208
+ onSaved: () => vt(null)
209
+ }), Ft = (e) => vt({
210
+ path: e,
211
+ aspect: n(Nt, e)?.aspect ?? ""
212
+ }), It = !!Z.error || Z.queue.items.some((e) => e.status === "failed") || At.some((e) => e.failed), Lt = At.some(re), Rt = Q.length, zt = Z.busy || nt || Lt || Z.read.loading || J.pending, Bt = zt || It || !!Z.read.error || Rt === 0 || G.pending || Y.pending, Vt = (e) => {
178
213
  let t = [...e];
179
- t.length && (Q.add(t), St(t.find((e) => /\.zip$/i.test(e.name))?.name ?? t[0]?.name).catch(xt));
180
- }, Nt = at.dirty.length > 0 || V.dirty.length > 0 || H.dirty.length > 0 || U.dirty.length > 0 || W.dirty;
181
- p(() => {
182
- if (!Nt && !Q.busy) return;
214
+ t.length && (Z.add(t), Ot(t.find((e) => /\.zip$/i.test(e.name))?.name ?? t[0]?.name).catch(Dt));
215
+ }, Ht = st.dirty.length > 0 || H.dirty.length > 0 || U.dirty.length > 0 || W.dirty.length > 0 || G.dirty, Ut = Ht || Z.pending.length > 0 || Z.queue.items.some((e) => e.status === "uploaded");
216
+ f(() => {
217
+ if (!Ht && !Z.busy) return;
183
218
  let e = (e) => {
184
219
  e.preventDefault(), e.returnValue = "";
185
220
  };
186
221
  return addEventListener("beforeunload", e), () => removeEventListener("beforeunload", e);
187
- }, [Nt, Q.busy]);
188
- let Pt = async (e) => {
189
- if (F) return;
190
- I(void 0), it("");
191
- let t = G.current;
192
- if (!t.texts.get()[t.language]?.title.trim()) return I(w("contentManager.titleRequired"));
193
- let n = W.problem();
194
- if (n) return I(w("readerEditor.fixSection", { section: n }));
195
- if (!Me(t.details.get().access) || t.details.get().access.level === "tier" && !t.details.get().access.tiers?.length) return I(w("readerEditor.accessRequired"));
222
+ }, [Ht, Z.busy]);
223
+ let Wt = async (e) => {
224
+ if (P) return;
225
+ I(void 0), ot("");
226
+ let t = K.current;
227
+ if (!t.texts.get()[t.language]?.title.trim()) return I(C("contentManager.titleRequired"));
228
+ let n = G.problem();
229
+ if (n) return I(C("readerEditor.fixSection", { section: n }));
230
+ if (!Le(t.details.get().access) || t.details.get().access.level === "tier" && !t.details.get().access.tiers?.length) return I(C("readerEditor.accessRequired"));
196
231
  let r;
197
232
  try {
198
- r = ge(D.attributes ?? {}, t.details.get().attributes);
233
+ r = be(E.attributes ?? {}, t.details.get().attributes);
199
234
  } catch (e) {
200
- return xt(e);
235
+ return Dt(e);
201
236
  }
202
- if (e && jt) return I(w("readerEditor.filesNotReady"));
203
- tt(!0);
204
- let i = t.texts.checkpoint(), ee = t.details.checkpoint(), te = t.associations.checkpoint(), ne = t.texts.dirty.slice(), a = { ...t.texts.get() }, re = t.details.get(), ie = t.associations.get().memberships.slice(), ae = !0;
237
+ if (e && Bt) return I(C("readerEditor.filesNotReady"));
238
+ it(!0);
239
+ let i = t.texts.checkpoint(), ee = t.details.checkpoint(), te = t.associations.checkpoint(), ne = t.texts.dirty.slice(), re = { ...t.texts.get() }, a = t.details.get(), o = t.associations.get().memberships.slice(), s = t.associations.get().create.slice(), ie = (e) => !!Ct(e.kind, o, s), ae = !0;
205
240
  try {
206
- let n = await St();
207
- if (!N()) return;
208
- if (z.error) throw z.error;
209
- if (await We(async () => {
241
+ let n = await Ot();
242
+ if (!M()) return;
243
+ if (B.error) throw B.error;
244
+ if (await qe(async () => {
210
245
  for (let e of ne) {
211
- let t = String(e), r = a[t];
212
- if (!r?.title.trim()) throw new b(w("contentManager.titleRequired"));
213
- if (n = await C.contents.putText(n.id, t, Ve(r)), !N()) return;
246
+ let t = String(e), r = re[t];
247
+ if (!r?.title.trim()) throw new y(C("contentManager.titleRequired"));
248
+ if (n = await S.contents.putText(n.id, t, We(r)), !M()) return;
214
249
  }
215
- if (n = await C.contents.get(n.id, k), N() && (n = await C.contents.update(n.id, {
216
- listing: re.listing,
217
- comments: re.comments,
250
+ if (n = await S.contents.get(n.id, O), M() && (n = await S.contents.update(n.id, {
251
+ listing: a.listing,
252
+ comments: a.comments,
218
253
  attributes: r,
219
- access: je(re.access),
254
+ access: Ie(a.access),
220
255
  revision: n.revision
221
- }), N() && t.associations.dirty.length)) {
222
- let e = n.versions.find((e) => e.id === R?.id) ?? n.versions[0], t = ie.map((t) => {
223
- let n = yt.get(t.group_id ?? "")?.kind;
224
- return n && E.entity_kinds[n]?.version_level && !t.version_id ? {
256
+ }), M() && t.associations.dirty.length)) {
257
+ let e = n.versions.find((e) => e.id === z?.id) ?? n.versions[0], t = o.map((t) => {
258
+ let n = St.get(t.group_id ?? "")?.kind;
259
+ return n && T.entity_kinds[n]?.version_level && !t.version_id ? {
225
260
  ...t,
226
261
  version_id: e?.id
227
262
  } : t;
228
- }), r = await C.entities.setOfContent(n.id, {
229
- kinds: [...B],
230
- memberships: t
231
- }, k);
232
- ae = te({ memberships: r.memberships.filter((e) => B.includes(r.entities.find((t) => t.id === e.group_id)?.kind ?? "")) });
263
+ }), r = await S.entities.setOfContent(n.id, {
264
+ kinds: [...V],
265
+ memberships: t,
266
+ create: s.filter((e) => !ie(e))
267
+ }, O);
268
+ xt((e) => new Map([...e, ...r.entities.map((e) => [e.id, e])])), ae = te({
269
+ memberships: r.memberships.filter((e) => V.includes(r.entities.find((t) => t.id === e.group_id)?.kind ?? "")),
270
+ create: s.filter(ie)
271
+ });
233
272
  }
234
- }), !N()) return;
235
- let o = Ct.current;
236
- !o.busy && (o.pending.length || o.queue.items.some((e) => e.status === "uploaded")) && await o.commit();
237
- let s = await W.save(N);
238
- if (s) throw new b(w("readerEditor.fixSection", { section: s }));
239
- if (!N()) return;
240
- let c = i(Object.fromEntries(O.map((e) => [e.value, n.text?.[e.value] ?? a[e.value] ?? y()]))), l = ee({
273
+ }), !M()) return;
274
+ let c = kt.current;
275
+ !c.busy && (c.pending.length || c.queue.items.some((e) => e.status === "uploaded")) && await c.commit();
276
+ let oe = await G.save(M);
277
+ if (oe) throw new y(C("readerEditor.fixSection", { section: oe }));
278
+ if (!M()) return;
279
+ let se = i(Object.fromEntries(D.map((e) => [e.value, n.text?.[e.value] ?? re[e.value] ?? v()]))), ce = ee({
241
280
  listing: n.listing,
242
281
  comments: n.comments,
243
- attributes: we(D.attributes ?? {}, n.attributes),
282
+ attributes: Oe(E.attributes ?? {}, n.attributes),
244
283
  access: n.access
245
284
  });
246
285
  if (e) {
247
- if (!c || !l || !ae) throw new b(w("readerEditor.changedDuringSave"));
248
- let e = Ct.current;
249
- if (!J || e.busy || e.error || e.queue.items.some((e) => e.status === "failed") || !await be(C, J)) throw new b(w("readerEditor.filesNotReady"));
250
- if ((R ? await C.contents.version(n.id, R.id, k) : null)?.state !== "published") throw new b(w("readerEditor.versionDraft"));
251
- if (!N()) return;
252
- let t = at.checkpoint(), r = await We(() => C.contents.publish(n.id, ot ? new Date(ot).toISOString() : void 0));
253
- t({ at: r.publish_at ? me(new Date(r.publish_at)) : "" }), it(w("contentManager.publishedNotice"));
254
- } else it(w("pollEditor.saved"));
286
+ if (!se || !ce || !ae) throw new y(C("readerEditor.changedDuringSave"));
287
+ let e = kt.current;
288
+ if (!q || e.busy || e.error || e.queue.items.some((e) => e.status === "failed") || !await we(S, q)) throw new y(C("readerEditor.filesNotReady"));
289
+ if ((z ? await S.contents.version(n.id, z.id, O) : null)?.state !== "published") throw new y(C("readerEditor.versionDraft"));
290
+ if (!M()) return;
291
+ let t = st.checkpoint(), r = await qe(() => S.contents.publishWhenReady(n.id, ct ? new Date(ct).toISOString() : void 0));
292
+ t({ at: r.publish_at ? ye(new Date(r.publish_at)) : "" }), ot(C("contentManager.publishedNotice"));
293
+ } else ot(C("pollEditor.saved"));
255
294
  } catch (e) {
256
- xt(e);
295
+ Dt(e);
257
296
  } finally {
258
- N() && tt(!1);
297
+ M() && it(!1);
259
298
  }
260
- }, Ft = async (e) => {
261
- let t = await St(e.name), n = t.versions.find((e) => e.id === R?.id) ?? t.versions[0];
262
- if (!n || !N()) return;
299
+ }, Gt = async (e) => {
300
+ let t = await Ot(e.name), n = t.versions.find((e) => e.id === z?.id) ?? t.versions[0];
301
+ if (!n || !M()) return;
263
302
  let r = {
264
- kind: S.kind,
303
+ kind: x.kind,
265
304
  id: t.id,
266
305
  version: n.id
267
- }, i = await C.media.uploadNamed(r, e, { path: await C.media.presetPath(S.kind, "cover", e) });
268
- N() && await C.contents.setCover(t.id, n.id, i.name);
269
- }, It = async (e) => {
270
- if (!J || !j || !R) return;
271
- let n = await C.media.presetPath(S.kind, "cover", new File([], e.path.split("/").at(-1) ?? "cover", { type: e.type }));
272
- await C.media.commit(J, [{
306
+ }, i = await S.media.uploadNamed(r, e, { path: await S.media.presetPath(x.kind, "cover", e) });
307
+ M() && await S.contents.setCover(t.id, n.id, i.name);
308
+ }, Kt = async (e) => {
309
+ if (!q || !A || !z) return;
310
+ let n = /\.[^./]+$/.exec(e.path)?.[0] ?? "", r = await S.media.presetPath(x.kind, "cover", new File([], `i-${crypto.randomUUID()}${n}`, { type: e.type }));
311
+ await S.media.commit(q, [{
273
312
  op: "copy",
274
313
  from: {
275
- id: j.id,
276
- version: R.id,
314
+ id: A.id,
315
+ version: z.id,
277
316
  path: e.path
278
317
  },
279
- to: n
280
- }]), N() && await C.contents.setCover(j.id, R.id, t(n).split("/").at(-1));
281
- }, { confirm: Lt, dialog: Rt } = pe(), zt = async () => {
282
- j && await Lt({
283
- title: w("contentManager.deleteTitle", { title: j.title }),
284
- description: w("contentManager.deleteBody"),
285
- confirm: w("contentManager.delete")
286
- }) && await Z.run(async () => {
287
- Q.discard(), await C.contents.remove(j.id), N() && S.onDeleted?.(j);
318
+ to: r
319
+ }]), M() && (await S.contents.setCover(A.id, z.id, t(r).split("/").at(-1)), M() && Ft(r));
320
+ }, { confirm: qt, dialog: Jt } = ve(), Yt = async () => {
321
+ A && await qt({
322
+ title: C("contentManager.deleteTitle", { title: A.title }),
323
+ description: C("contentManager.deleteBody"),
324
+ confirm: C("contentManager.delete")
325
+ }) && await X.run(async () => {
326
+ Z.discard(), await S.contents.remove(A.id), M() && x.onDeleted?.(A);
288
327
  });
289
328
  };
290
- if (S.id && !j) return A.error ? /* @__PURE__ */ _(de, {
291
- error: A.error,
292
- message: w("contentManager.loadFailed"),
293
- retry: A.reload
294
- }) : /* @__PURE__ */ _(fe, {});
295
- let Bt = j ? Fe(j) : "draft", Vt = R?.id, Ht = (e) => H.edit((t) => ({
329
+ if (x.id && !A) return k.error ? /* @__PURE__ */ g(ge, {
330
+ error: k.error,
331
+ message: C("contentManager.loadFailed"),
332
+ retry: k.reload
333
+ }) : /* @__PURE__ */ g(_e, {});
334
+ let Xt = A ? Be(A) : "draft", Zt = z?.id, Qt = (e) => U.edit((t) => ({
296
335
  ...t,
297
336
  ...e
298
- })), Ut = L.map((e) => ({
337
+ })), $t = R.map((e) => ({
299
338
  id: e.id,
300
- label: Ne(e, (e) => O.find((t) => t.value === e)?.label ?? e, S.labels)
339
+ label: Re(e, (e) => D.find((t) => t.value === e)?.label ?? e, x.labels)
301
340
  }));
302
- return /* @__PURE__ */ _(ye.Provider, {
303
- value: W.context,
304
- children: /* @__PURE__ */ v("div", {
341
+ return /* @__PURE__ */ g(Ce.Provider, {
342
+ value: G.context,
343
+ children: /* @__PURE__ */ _("div", {
305
344
  className: "grid gap-5 text-base",
306
345
  "data-ckui": "reader-content-editor",
307
346
  children: [
308
- /* @__PURE__ */ v("div", {
347
+ /* @__PURE__ */ _("div", {
309
348
  className: "sticky top-0 z-10 flex flex-wrap items-center gap-3 rounded-xl border border-border bg-background/95 p-4 shadow-sm",
310
349
  children: [
311
- /* @__PURE__ */ v("div", {
350
+ /* @__PURE__ */ g("button", {
351
+ type: "button",
352
+ className: "h-20 shrink-0 overflow-hidden rounded-md border border-border bg-muted disabled:cursor-default",
353
+ style: { aspectRatio: .7071 },
354
+ disabled: !Pt || P,
355
+ title: C("readerEditor.thumbnail"),
356
+ "aria-label": C("readerEditor.editThumbnail"),
357
+ onClick: () => Pt && Ft(Pt.path),
358
+ "data-ckui": "editor-thumbnail",
359
+ children: z?.cover?.url && /* @__PURE__ */ g("img", {
360
+ src: z.cover.url,
361
+ alt: "",
362
+ className: "size-full object-cover"
363
+ })
364
+ }),
365
+ /* @__PURE__ */ _("div", {
312
366
  className: "min-w-0 flex-1",
313
- children: [/* @__PURE__ */ _("h1", {
314
- className: "truncate text-xl font-semibold",
315
- children: K.title || w("readerEditor.new")
316
- }), /* @__PURE__ */ v("div", {
317
- className: "mt-1 flex items-center gap-2 text-sm text-muted-foreground",
367
+ children: [/* @__PURE__ */ g("h1", {
368
+ className: "sr-only",
369
+ children: Tt.title || C("readerEditor.new")
370
+ }), /* @__PURE__ */ _("div", {
371
+ className: "flex items-center gap-2 text-sm text-muted-foreground",
318
372
  children: [
319
- /* @__PURE__ */ _(ae, {
320
- variant: j?.live ? "default" : "outline",
321
- children: w(`contentManager.${Bt}`)
373
+ /* @__PURE__ */ g(se, {
374
+ variant: A?.live ? "default" : "outline",
375
+ children: C(`contentManager.${Xt}`)
322
376
  }),
323
- R && /* @__PURE__ */ _("span", { children: w("contentEditor.pageCount", { count: $.review ? kt : R.pages ?? 0 }) }),
324
- $e && /* @__PURE__ */ _("span", {
377
+ z && /* @__PURE__ */ g("span", { children: C("contentEditor.pageCount", { count: Z.read.read ? Rt : z.pages ?? 0 }) }),
378
+ nt && /* @__PURE__ */ g("span", {
325
379
  role: "status",
326
- children: w("common.saving")
380
+ children: C("common.saving")
327
381
  })
328
382
  ]
329
383
  })]
330
384
  }),
331
- j?.live && S.contentHref?.(j) && /* @__PURE__ */ _("a", {
332
- href: S.contentHref(j),
385
+ A && x.contentHref?.(A) && /* @__PURE__ */ g("a", {
386
+ href: x.contentHref(A),
333
387
  className: "text-sm underline",
334
- children: w("contentManager.view")
388
+ ...A.live ? {} : {
389
+ target: "_blank",
390
+ rel: "noopener"
391
+ },
392
+ children: C(A.live ? "contentManager.view" : "readerEditor.preview")
335
393
  }),
336
- /* @__PURE__ */ _(a, {
337
- disabled: F || $e,
338
- onClick: () => void Pt(!1),
339
- children: w(F ? "common.saving" : j?.live ? "common.save" : "readerEditor.saveDraft")
394
+ A && !Ut && !P ? /* @__PURE__ */ g("span", {
395
+ role: "status",
396
+ className: "text-sm text-muted-foreground",
397
+ "data-ckui": "editor-saved",
398
+ children: C("readerEditor.allSaved")
399
+ }) : /* @__PURE__ */ g(o, {
400
+ disabled: P || nt || !Ut,
401
+ onClick: () => void Wt(!1),
402
+ children: C(P ? "common.saving" : A?.live ? "readerEditor.saveChanges" : "readerEditor.saveDraft")
340
403
  }),
341
- !j?.live && /* @__PURE__ */ _(a, {
404
+ !A?.live && /* @__PURE__ */ g(o, {
342
405
  variant: "outline",
343
- disabled: F || jt,
344
- onClick: () => void Pt(!0),
345
- children: w(ot ? "readerEditor.schedule" : "contentManager.publish")
406
+ disabled: P || Bt,
407
+ onClick: () => void Wt(!0),
408
+ children: C(ct ? "readerEditor.schedule" : "contentManager.publish")
346
409
  })
347
410
  ]
348
411
  }),
349
- nt != null && /* @__PURE__ */ _(d, { children: typeof nt == "string" ? nt : le(Ue, e(nt)) }),
350
- rt && /* @__PURE__ */ _("p", {
412
+ F != null && /* @__PURE__ */ g(d, { children: typeof F == "string" ? F : me(Ke, e(F)) }),
413
+ at && /* @__PURE__ */ g("p", {
351
414
  role: "status",
352
415
  className: "text-sm text-muted-foreground",
353
- children: rt
416
+ children: at
354
417
  }),
355
- /* @__PURE__ */ v("fieldset", {
356
- disabled: F,
418
+ /* @__PURE__ */ _("fieldset", {
419
+ disabled: P,
357
420
  className: "grid min-w-0 items-start gap-5 xl:grid-cols-[minmax(0,1fr)_minmax(18rem,24rem)]",
358
- children: [/* @__PURE__ */ v("div", {
421
+ children: [/* @__PURE__ */ _("div", {
359
422
  className: "grid min-w-0 gap-5",
360
423
  children: [
361
- /* @__PURE__ */ v(x, {
362
- title: w("readerEditor.details"),
424
+ /* @__PURE__ */ _(b, {
425
+ label: C("readerEditor.details"),
363
426
  children: [
364
- /* @__PURE__ */ v("div", {
427
+ /* @__PURE__ */ _("div", {
365
428
  className: "grid gap-4 sm:grid-cols-[minmax(0,1fr)_10rem]",
366
- children: [/* @__PURE__ */ v("div", {
429
+ children: [/* @__PURE__ */ _("div", {
367
430
  className: "grid gap-1.5",
368
- children: [/* @__PURE__ */ _(s, {
369
- htmlFor: `${T}-title`,
370
- children: w("contentManager.itemTitle")
371
- }), /* @__PURE__ */ _(o, {
372
- id: `${T}-title`,
431
+ children: [/* @__PURE__ */ g(l, {
432
+ htmlFor: `${w}-title`,
433
+ children: C("contentManager.itemTitle")
434
+ }), /* @__PURE__ */ g(ce, {
435
+ id: `${w}-title`,
373
436
  required: !0,
374
437
  maxLength: 300,
375
- value: K.title,
376
- onChange: (e) => q({ title: e.target.value })
438
+ value: Tt.title,
439
+ onChange: (e) => Et({ title: e.target.value })
377
440
  })]
378
- }), /* @__PURE__ */ v("div", {
441
+ }), /* @__PURE__ */ _("div", {
379
442
  className: "grid gap-1.5",
380
- children: [/* @__PURE__ */ _(s, {
381
- htmlFor: `${T}-language`,
382
- children: w("contentManager.language")
383
- }), /* @__PURE__ */ v(c, {
384
- value: k,
385
- onValueChange: (e) => e && Je(e),
386
- children: [/* @__PURE__ */ _(oe, {
387
- id: `${T}-language`,
388
- children: /* @__PURE__ */ _(se, { children: O.find((e) => e.value === k)?.label ?? k })
389
- }), /* @__PURE__ */ _(l, { children: O.map((e) => /* @__PURE__ */ _(u, {
443
+ children: [/* @__PURE__ */ g(l, {
444
+ htmlFor: `${w}-language`,
445
+ children: C("contentManager.language")
446
+ }), /* @__PURE__ */ _(u, {
447
+ value: O,
448
+ onValueChange: (e) => e && Ze(e),
449
+ children: [/* @__PURE__ */ g(de, {
450
+ id: `${w}-language`,
451
+ children: /* @__PURE__ */ g(fe, { children: D.find((e) => e.value === O)?.label ?? O })
452
+ }), /* @__PURE__ */ g(le, { children: D.map((e) => /* @__PURE__ */ g(ue, {
390
453
  value: e.value,
391
454
  children: e.label
392
455
  }, e.value)) })]
393
456
  })]
394
457
  })]
395
458
  }),
396
- /* @__PURE__ */ v("div", {
459
+ /* @__PURE__ */ _("div", {
397
460
  className: "grid gap-1.5",
398
- children: [/* @__PURE__ */ _(s, {
399
- htmlFor: `${T}-description`,
400
- children: w("contentManager.description")
401
- }), /* @__PURE__ */ _(ce, {
402
- id: `${T}-description`,
461
+ children: [/* @__PURE__ */ g(l, {
462
+ htmlFor: `${w}-description`,
463
+ children: C("readerEditor.headerText")
464
+ }), /* @__PURE__ */ g(pe, {
465
+ id: `${w}-description`,
403
466
  rows: 3,
404
- value: K.description ?? "",
405
- onChange: (e) => q({ description: e.target.value })
467
+ value: Tt.description ?? "",
468
+ onChange: (e) => Et({ description: e.target.value })
406
469
  })]
407
470
  }),
408
- /* @__PURE__ */ _(Ce, {
409
- declared: D.attributes ?? {},
410
- form: H.value.attributes,
411
- onChange: (e, t) => Ht({ attributes: {
412
- ...H.value.attributes,
471
+ /* @__PURE__ */ g(De, {
472
+ declared: E.attributes ?? {},
473
+ form: U.value.attributes,
474
+ onChange: (e, t) => Qt({ attributes: {
475
+ ...U.value.attributes,
413
476
  [e]: t
414
477
  } }),
415
- labels: S.labels
416
- }),
417
- /* @__PURE__ */ v("details", {
418
- className: "grid gap-3",
419
- children: [/* @__PURE__ */ _("summary", {
420
- className: "cursor-pointer text-sm text-muted-foreground",
421
- children: w("readerEditor.additionalText")
422
- }), /* @__PURE__ */ v("div", {
423
- className: "mt-3 grid gap-3",
424
- children: [
425
- /* @__PURE__ */ v("div", {
426
- className: "grid gap-1.5",
427
- children: [/* @__PURE__ */ _(s, {
428
- htmlFor: `${T}-slug`,
429
- children: w("contentManager.slug")
430
- }), /* @__PURE__ */ _(o, {
431
- id: `${T}-slug`,
432
- value: K.slug ?? "",
433
- placeholder: w("contentManager.slugAuto"),
434
- onChange: (e) => q({ slug: e.target.value })
435
- })]
436
- }),
437
- /* @__PURE__ */ _(s, {
438
- htmlFor: `${T}-body`,
439
- children: w("contentManager.body")
440
- }),
441
- S.renderEditor ? S.renderEditor({
442
- value: bt,
443
- onChange: (e) => q({ body: A.storedBody(e) }),
444
- uploadImage: j ? (e) => A.uploadImage(e) : void 0,
445
- disabled: F,
446
- "aria-label": w("contentManager.body")
447
- }) : /* @__PURE__ */ _(ce, {
448
- id: `${T}-body`,
449
- value: K.body ?? "",
450
- onChange: (e) => q({ body: e.target.value })
451
- })
452
- ]
453
- })]
478
+ labels: x.labels
454
479
  })
455
480
  ]
456
481
  }),
457
- /* @__PURE__ */ v(x, {
458
- title: w("readerEditor.files"),
482
+ /* @__PURE__ */ _(b, {
483
+ title: C("readerEditor.files"),
459
484
  children: [
460
- L.length > 1 && /* @__PURE__ */ v(c, {
461
- value: Vt ?? "",
462
- onValueChange: (e) => e && Xe(e),
463
- disabled: Q.busy || Q.pending.length > 0,
464
- children: [/* @__PURE__ */ _(oe, {
465
- "aria-label": w("contentEditor.versions"),
466
- children: /* @__PURE__ */ _(se, { children: Ut.find((e) => e.id === Vt)?.label })
467
- }), /* @__PURE__ */ _(l, { children: Ut.map((e) => /* @__PURE__ */ _(u, {
485
+ R.length > 1 && /* @__PURE__ */ _(u, {
486
+ value: Zt ?? "",
487
+ onValueChange: (e) => e && $e(e),
488
+ disabled: Z.busy || Z.pending.length > 0,
489
+ children: [/* @__PURE__ */ g(de, {
490
+ "aria-label": C("contentEditor.versions"),
491
+ children: /* @__PURE__ */ g(fe, { children: $t.find((e) => e.id === Zt)?.label })
492
+ }), /* @__PURE__ */ g(le, { children: $t.map((e) => /* @__PURE__ */ g(ue, {
468
493
  value: e.id,
469
494
  children: e.label
470
495
  }, e.id)) })]
471
496
  }),
472
- /* @__PURE__ */ _("p", {
497
+ /* @__PURE__ */ g("p", {
473
498
  className: "text-sm text-muted-foreground",
474
- children: w("readerEditor.fileHelp")
499
+ children: C("readerEditor.fileHelp")
500
+ }),
501
+ L && /* @__PURE__ */ _("div", {
502
+ className: "flex flex-wrap items-center gap-2 text-sm",
503
+ "data-ckui": "selected-page",
504
+ children: [/* @__PURE__ */ g("span", {
505
+ className: "text-muted-foreground",
506
+ children: C("readerEditor.pageSelected", { name: oe(Q.findIndex((e) => e.path === L.path) + 1, Q.length, L.path) })
507
+ }), /* @__PURE__ */ g(o, {
508
+ size: "sm",
509
+ variant: "secondary",
510
+ disabled: J.pending || P,
511
+ onClick: () => void J.run(() => Kt(L)),
512
+ children: C("readerEditor.setThumbnail")
513
+ })]
475
514
  }),
476
- /* @__PURE__ */ _(ie, {
515
+ /* @__PURE__ */ g(c, {
477
516
  folder: {
478
- ...Q,
479
- add: Mt
517
+ ...Z,
518
+ add: Vt
480
519
  },
481
520
  label: !1,
482
521
  layout: "grid",
483
- disabled: F,
484
- inputLabel: w("readerEditor.files"),
485
- rowActions: (e) => e.type.startsWith("image/") && Q.groups.some((t) => t.rule?.page && t.files.some((t) => t.path === e.path)) ? /* @__PURE__ */ _(a, {
486
- size: "icon-sm",
487
- variant: "ghost",
488
- title: w("readerEditor.useCover"),
489
- "aria-label": w("readerEditor.useCoverFor", { name: e.path.split("/").at(-1) ?? e.path }),
490
- disabled: Y.pending || F,
491
- onClick: () => void Y.run(() => It(e)),
492
- children: /* @__PURE__ */ _(Re, { icon: Le })
493
- }) : null
494
- }),
495
- Q.read.error && /* @__PURE__ */ _(de, {
496
- error: Q.read.error,
497
- message: w("contentManager.loadFailed"),
498
- retry: Q.read.reload
522
+ disabled: P,
523
+ inputLabel: C("readerEditor.files"),
524
+ selectedPage: L?.path ?? null,
525
+ onSelectPage: gt
499
526
  }),
500
- $.error && /* @__PURE__ */ _(de, {
501
- error: $.error,
502
- message: w("pageReview.loadFailed"),
503
- retry: $.reload
527
+ Z.read.error && /* @__PURE__ */ g(ge, {
528
+ error: Z.read.error,
529
+ message: C("contentManager.loadFailed"),
530
+ retry: Z.read.reload
504
531
  }),
505
- (Dt || At || !$.error && !Q.read.error && kt === 0) && /* @__PURE__ */ _("p", {
532
+ (It || zt || !Z.read.error && Rt === 0) && /* @__PURE__ */ g("p", {
506
533
  role: "status",
507
534
  className: "text-sm text-muted-foreground",
508
- children: w(Dt ? "readerEditor.filesFailed" : At ? "readerEditor.processing" : "readerEditor.addPages")
535
+ children: C(It ? "readerEditor.filesFailed" : zt ? "readerEditor.processing" : "readerEditor.addPages")
509
536
  }),
510
- j && R && /* @__PURE__ */ v("details", {
511
- onToggle: (e) => e.currentTarget.open && ht(!0),
512
- children: [/* @__PURE__ */ _("summary", {
513
- className: "cursor-pointer font-medium",
514
- children: w("pageReview.title")
515
- }), mt && /* @__PURE__ */ _(Oe, {
516
- content: j.id,
517
- version: R.id,
518
- client: C,
519
- onError: S.onError
520
- }, R.id)]
537
+ A && z && /* @__PURE__ */ g(Ne, {
538
+ content: A.id,
539
+ version: z.id,
540
+ client: S,
541
+ onError: x.onError
521
542
  })
522
543
  ]
523
544
  }),
524
- j && /* @__PURE__ */ v("details", {
545
+ A && /* @__PURE__ */ _("details", {
525
546
  className: "rounded-xl border border-border bg-card p-4",
526
- onToggle: (e) => e.currentTarget.open && lt(!0),
527
- children: [/* @__PURE__ */ _("summary", {
547
+ onToggle: (e) => e.currentTarget.open && dt(!0),
548
+ children: [/* @__PURE__ */ g("summary", {
528
549
  className: "cursor-pointer font-medium",
529
- children: w("readerEditor.versions")
530
- }), ct && /* @__PURE__ */ _(Ae, {
531
- content: j,
550
+ children: C("readerEditor.versions")
551
+ }), ut && /* @__PURE__ */ g(Fe, {
552
+ content: A,
532
553
  media: !1,
533
- activeVersion: Vt,
534
- client: C,
535
- labels: S.labels,
536
- onError: S.onError
554
+ activeVersion: Zt,
555
+ client: S,
556
+ labels: x.labels,
557
+ onError: x.onError
537
558
  })]
538
559
  }),
539
- j && R && /* @__PURE__ */ v("details", {
560
+ A && z && /* @__PURE__ */ _("details", {
540
561
  className: "rounded-xl border border-border bg-card p-4",
541
- onToggle: (e) => pt(e.currentTarget.open),
542
- children: [/* @__PURE__ */ _("summary", {
562
+ onToggle: (e) => ht(e.currentTarget.open),
563
+ children: [/* @__PURE__ */ g("summary", {
543
564
  className: "cursor-pointer font-medium",
544
- children: w("readerEditor.readerTools")
545
- }), ut.filter((e) => L.some((t) => t.id === e)).map((e) => /* @__PURE__ */ _("div", {
546
- hidden: e !== R.id,
547
- children: /* @__PURE__ */ _(Ee, {
548
- content: j.id,
565
+ children: C("readerEditor.readerTools")
566
+ }), ft.filter((e) => R.some((t) => t.id === e)).map((e) => /* @__PURE__ */ g("div", {
567
+ hidden: e !== z.id,
568
+ children: /* @__PURE__ */ g(Me, {
569
+ content: A.id,
549
570
  version: e,
550
- client: C,
551
- onError: S.onError
571
+ client: S,
572
+ onError: x.onError
552
573
  })
553
574
  }, e))]
554
575
  })
555
576
  ]
556
- }), /* @__PURE__ */ v("aside", {
577
+ }), /* @__PURE__ */ _("aside", {
557
578
  className: "grid min-w-0 gap-5",
558
579
  children: [
559
- /* @__PURE__ */ v(x, {
560
- title: w("readerEditor.entities"),
561
- children: [z.error && /* @__PURE__ */ _(d, { error: z.error }), B.map((e) => {
562
- let t = U.value.memberships.map((e, t) => ({
580
+ /* @__PURE__ */ _(b, {
581
+ title: C("readerEditor.entities"),
582
+ children: [B.error && /* @__PURE__ */ g(d, { error: B.error }), V.map((e) => {
583
+ let t = W.value.memberships.map((e, t) => ({
563
584
  a: e,
564
585
  index: t
565
- })).filter(({ a: t }) => yt.get(t.group_id ?? "")?.kind === e);
566
- return /* @__PURE__ */ v("fieldset", {
567
- disabled: !!j && z.loading,
568
- className: "grid min-w-0 gap-2",
569
- children: [
570
- /* @__PURE__ */ _("legend", {
571
- className: "mb-2 font-semibold",
572
- children: ve(S.labels, e)
573
- }),
574
- t.map(({ a: t, index: n }) => /* @__PURE__ */ _(Te, {
575
- m: t,
576
- card: yt.get(t.group_id ?? ""),
577
- spec: E.entity_kinds[e] ?? {},
578
- labels: S.labels,
579
- versions: Ut,
580
- versionLabel: (e) => Ut.find((t) => t.id === e)?.label ?? e,
581
- onChange: (e) => U.edit((t) => ({ memberships: t.memberships.map((t, r) => r === n ? {
582
- ...t,
583
- ...e
584
- } : t) })),
585
- onRemove: () => U.edit((e) => ({ memberships: e.memberships.filter((e, t) => t !== n) }))
586
- }, `${t.group_id}:${n}`)),
587
- /* @__PURE__ */ _(_e, {
586
+ })).filter(({ a: t }) => St.get(t.group_id ?? "")?.kind === e);
587
+ return /* @__PURE__ */ g(je, {
588
+ kind: e,
589
+ label: xe(x.labels, e),
590
+ memberships: t.map(({ a: e }) => e),
591
+ cards: St,
592
+ spec: T.entity_kinds[e] ?? {},
593
+ labels: x.labels,
594
+ versions: $t,
595
+ versionLabel: (e) => $t.find((t) => t.id === e)?.label ?? e,
596
+ language: O,
597
+ management: x.management,
598
+ client: S,
599
+ disabled: !!A && B.loading,
600
+ created: W.value.create.filter((t) => t.kind === e).map((e) => e.name),
601
+ needsScope: Ct(e, W.value.memberships, W.value.create),
602
+ onCreatedChange: (t) => W.edit((n) => ({
603
+ ...n,
604
+ create: [...n.create.filter((t) => t.kind !== e), ...t.map((t) => ({
588
605
  kind: e,
589
- management: S.management,
590
- language: k,
591
- exclude: t.filter(({ a: e }) => !e.version_id && !e.role).map(({ a: e }) => e.group_id),
592
- label: w("memberships.add", { kind: ve(S.labels, e) }),
593
- client: C,
594
- onPick: (t) => {
595
- vt((e) => new Map(e).set(t.id, t)), U.edit((n) => ({ memberships: [...n.memberships, {
596
- group_id: t.id,
597
- ...E.entity_kinds[e]?.version_level && R ? { version_id: R.id } : {}
598
- }] }));
599
- }
600
- })
601
- ]
606
+ name: t,
607
+ language: O
608
+ }))]
609
+ })),
610
+ onChange: (e, n) => W.edit((r) => ({
611
+ ...r,
612
+ memberships: r.memberships.map((r, i) => i === t[e].index ? {
613
+ ...r,
614
+ ...n
615
+ } : r)
616
+ })),
617
+ onRemove: (e) => W.edit((n) => ({
618
+ ...n,
619
+ memberships: n.memberships.filter((n, r) => r !== t[e].index)
620
+ })),
621
+ onAdd: (t) => {
622
+ xt((e) => new Map(e).set(t.id, t)), W.edit((n) => ({
623
+ ...n,
624
+ memberships: [...n.memberships, {
625
+ group_id: t.id,
626
+ ...T.entity_kinds[e]?.version_level && z ? { version_id: z.id } : {}
627
+ }]
628
+ }));
629
+ }
602
630
  }, e);
603
631
  })]
604
632
  }),
605
- /* @__PURE__ */ v(x, {
606
- title: w("contentManager.cover"),
633
+ /* @__PURE__ */ _(b, {
634
+ title: C("contentManager.cover"),
607
635
  children: [
608
- R?.cover?.url ? /* @__PURE__ */ _("img", {
609
- src: R.cover.url,
610
- alt: "",
611
- className: "mx-auto max-h-64 rounded-lg object-contain"
612
- }) : /* @__PURE__ */ _("p", {
636
+ /* @__PURE__ */ g("p", {
613
637
  className: "text-sm text-muted-foreground",
614
- children: w("readerEditor.firstPageCover")
638
+ children: C("readerEditor.thumbnailHelp")
615
639
  }),
616
- /* @__PURE__ */ v("label", {
640
+ /* @__PURE__ */ _("label", {
617
641
  className: "inline-flex cursor-pointer justify-center rounded-md border border-border px-3 py-2 text-sm font-medium hover:bg-muted",
618
- children: [w("contentManager.addCover"), /* @__PURE__ */ _("input", {
642
+ children: [C("contentManager.addCover"), /* @__PURE__ */ g("input", {
619
643
  type: "file",
620
644
  accept: "image/*",
621
645
  className: "sr-only",
622
- "aria-label": w("contentManager.cover"),
623
- disabled: Y.pending || F,
646
+ "aria-label": C("contentManager.cover"),
647
+ disabled: J.pending || P,
624
648
  onChange: (e) => {
625
649
  let t = e.target.files?.[0];
626
- e.target.value = "", t && Y.run(() => Ft(t));
650
+ e.target.value = "", t && J.run(() => Gt(t));
627
651
  }
628
652
  })]
629
653
  }),
630
- /* @__PURE__ */ _(d, { error: Y.error })
654
+ /* @__PURE__ */ g(d, { error: J.error })
631
655
  ]
632
656
  }),
633
- /* @__PURE__ */ v(x, {
634
- title: w("contentEditor.accessTitle"),
657
+ /* @__PURE__ */ _(b, {
658
+ title: C("contentEditor.accessTitle"),
635
659
  children: [
636
- /* @__PURE__ */ _(ke, {
637
- value: H.value.access,
638
- onChange: (e) => Ht({ access: e }),
639
- model: E,
640
- kind: S.kind,
641
- owner: j?.owner_group_id ?? S.ownerGroup,
642
- labels: S.labels,
643
- client: C
660
+ /* @__PURE__ */ g(Pe, {
661
+ value: U.value.access,
662
+ onChange: (e) => Qt({ access: e }),
663
+ model: T,
664
+ kind: x.kind,
665
+ owner: A?.owner_group_id ?? x.ownerGroup,
666
+ labels: x.labels,
667
+ client: S
644
668
  }),
645
- j && (H.value.access.level === "ppv" || H.value.access.level === "group_ppv" || j.offer) && /* @__PURE__ */ _(Se, {
646
- offer: j.offer,
647
- pending: X.pending,
648
- onSell: (e) => X.run(() => C.offers.sell({ content: j.id }, e)),
649
- onWithdraw: () => void X.run(() => C.offers.withdraw({ content: j.id }))
669
+ A && (U.value.access.level === "ppv" || U.value.access.level === "group_ppv" || A.offer) && /* @__PURE__ */ g(Ee, {
670
+ offer: A.offer,
671
+ pending: Y.pending,
672
+ onSell: (e) => Y.run(() => S.offers.sell({ content: A.id }, e)),
673
+ onWithdraw: () => void Y.run(() => S.offers.withdraw({ content: A.id }))
650
674
  }),
651
- /* @__PURE__ */ _(d, { error: X.error })
675
+ /* @__PURE__ */ g(d, { error: Y.error })
652
676
  ]
653
677
  }),
654
- /* @__PURE__ */ v(x, {
655
- title: w("readerEditor.publication"),
678
+ /* @__PURE__ */ _(b, {
679
+ title: C("readerEditor.publication"),
656
680
  children: [
657
- !j?.live && /* @__PURE__ */ v("div", {
681
+ !A?.live && /* @__PURE__ */ _("div", {
658
682
  className: "grid gap-1.5",
659
- children: [/* @__PURE__ */ _(s, {
660
- htmlFor: `${T}-publish`,
661
- children: w("contentManager.publishAt")
662
- }), /* @__PURE__ */ _(o, {
663
- id: `${T}-publish`,
683
+ children: [/* @__PURE__ */ g(l, {
684
+ htmlFor: `${w}-publish`,
685
+ children: C("contentManager.publishAt")
686
+ }), /* @__PURE__ */ g(ce, {
687
+ id: `${w}-publish`,
664
688
  type: "datetime-local",
665
- value: ot,
666
- onChange: (e) => st(e.target.value)
689
+ value: ct,
690
+ onChange: (e) => lt(e.target.value)
667
691
  })]
668
692
  }),
669
- /* @__PURE__ */ _(s, {
670
- htmlFor: `${T}-listing`,
671
- children: w("contentEditor.listing")
693
+ /* @__PURE__ */ g(l, {
694
+ htmlFor: `${w}-listing`,
695
+ children: C("contentEditor.listing")
672
696
  }),
673
- /* @__PURE__ */ v(c, {
674
- value: H.value.listing,
675
- onValueChange: (e) => e && Ht({ listing: e }),
676
- children: [/* @__PURE__ */ _(oe, {
677
- id: `${T}-listing`,
678
- children: /* @__PURE__ */ _(se, { children: w(`contentEditor.listing_${H.value.listing}`) })
679
- }), /* @__PURE__ */ _(l, { children: [
697
+ /* @__PURE__ */ _(u, {
698
+ value: U.value.listing,
699
+ onValueChange: (e) => e && Qt({ listing: e }),
700
+ children: [/* @__PURE__ */ g(de, {
701
+ id: `${w}-listing`,
702
+ children: /* @__PURE__ */ g(fe, { children: C(`contentEditor.listing_${U.value.listing}`) })
703
+ }), /* @__PURE__ */ g(le, { children: [
680
704
  "listed",
681
705
  "members",
682
706
  "unlisted"
683
- ].map((e) => /* @__PURE__ */ _(u, {
707
+ ].map((e) => /* @__PURE__ */ g(ue, {
684
708
  value: e,
685
- children: w(`contentEditor.listing_${e}`)
709
+ children: C(`contentEditor.listing_${e}`)
686
710
  }, e)) })]
687
711
  }),
688
- /* @__PURE__ */ _(s, {
689
- htmlFor: `${T}-comments`,
690
- children: w("contentEditor.comments")
712
+ /* @__PURE__ */ g(l, {
713
+ htmlFor: `${w}-comments`,
714
+ children: C("contentEditor.comments")
691
715
  }),
692
- /* @__PURE__ */ v(c, {
693
- value: H.value.comments,
694
- onValueChange: (e) => e && Ht({ comments: e }),
695
- children: [/* @__PURE__ */ _(oe, {
696
- id: `${T}-comments`,
697
- children: /* @__PURE__ */ _(se, { children: w(`contentEditor.comments_${H.value.comments}`) })
698
- }), /* @__PURE__ */ _(l, { children: [
716
+ /* @__PURE__ */ _(u, {
717
+ value: U.value.comments,
718
+ onValueChange: (e) => e && Qt({ comments: e }),
719
+ children: [/* @__PURE__ */ g(de, {
720
+ id: `${w}-comments`,
721
+ children: /* @__PURE__ */ g(fe, { children: C(`contentEditor.comments_${U.value.comments}`) })
722
+ }), /* @__PURE__ */ g(le, { children: [
699
723
  "open",
700
724
  "closed",
701
725
  "hidden"
702
- ].map((e) => /* @__PURE__ */ _(u, {
726
+ ].map((e) => /* @__PURE__ */ g(ue, {
703
727
  value: e,
704
- children: w(`contentEditor.comments_${e}`)
728
+ children: C(`contentEditor.comments_${e}`)
705
729
  }, e)) })]
706
730
  }),
707
- j?.state === "published" && /* @__PURE__ */ _(a, {
731
+ A?.state === "published" && /* @__PURE__ */ g(o, {
708
732
  variant: "outline",
709
- disabled: Z.pending,
710
- onClick: () => void Z.run(() => C.contents.unpublish(j.id)),
711
- children: w("contentManager.unpublish")
733
+ disabled: X.pending,
734
+ onClick: () => void X.run(() => S.contents.unpublish(A.id)),
735
+ children: C("contentManager.unpublish")
712
736
  }),
713
- j && /* @__PURE__ */ _(a, {
737
+ A && /* @__PURE__ */ g(o, {
714
738
  variant: "destructive",
715
- disabled: Z.pending,
716
- onClick: () => void zt(),
717
- children: w("contentManager.delete")
739
+ disabled: X.pending,
740
+ onClick: () => void Yt(),
741
+ children: C("contentManager.delete")
718
742
  }),
719
- /* @__PURE__ */ _(d, { error: Z.error })
743
+ /* @__PURE__ */ g(d, { error: X.error })
720
744
  ]
721
745
  })
722
746
  ]
723
747
  })]
724
748
  }),
725
- Rt
749
+ Jt,
750
+ /* @__PURE__ */ g(s, {
751
+ open: !!_t,
752
+ onOpenChange: (e) => !e && $.status !== "saving" && vt(null),
753
+ source: "source" in $ ? $.source ?? null : null,
754
+ aspect: _t?.aspect ?? "",
755
+ rotatable: !1,
756
+ initialEdit: "edit" in $ ? $.edit : null,
757
+ title: C("readerEditor.thumbnail"),
758
+ confirmLabel: C("readerEditor.setThumbnail"),
759
+ busy: $.status === "saving",
760
+ error: $.status === "error" ? me(Ke, $.error) : void 0,
761
+ onConfirm: (e) => void $.save(e)
762
+ })
726
763
  ]
727
764
  })
728
765
  });
729
766
  }
730
767
  //#endregion
731
- export { S as ReaderContentEditor };
768
+ export { x as ReaderContentEditor };
732
769
 
733
770
  //# sourceMappingURL=reader-content-editor.js.map