@openrails/contentkit-ui 0.82.0 → 0.85.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (124) hide show
  1. package/README.md +11 -3
  2. package/dist/client/beacons.d.ts +8 -5
  3. package/dist/client/beacons.js +15 -7
  4. package/dist/client/beacons.js.map +1 -1
  5. package/dist/client/content/moderation.d.ts +14 -2
  6. package/dist/client/content/moderation.js +34 -0
  7. package/dist/client/content/moderation.js.map +1 -1
  8. package/dist/client/content/types.d.ts +13 -0
  9. package/dist/client/content/types.js.map +1 -1
  10. package/dist/client/discovery.d.ts +7 -1
  11. package/dist/client/discovery.js.map +1 -1
  12. package/dist/client/generated/error-codes.d.ts +1 -1
  13. package/dist/client/generated/error-codes.js +8 -0
  14. package/dist/client/generated/error-codes.js.map +1 -1
  15. package/dist/client/generated/routes.d.ts +90 -12
  16. package/dist/client/generated/routes.js +118 -1
  17. package/dist/client/generated/routes.js.map +1 -1
  18. package/dist/client/generated/wire.d.ts +74 -0
  19. package/dist/client/generated/wire.js.map +1 -1
  20. package/dist/client/index.d.ts +2 -1
  21. package/dist/client/reader-meta.d.ts +27 -0
  22. package/dist/client/reader-meta.js +99 -0
  23. package/dist/client/reader-meta.js.map +1 -0
  24. package/dist/client/versions.d.ts +1 -1
  25. package/dist/client/versions.js +7 -2
  26. package/dist/client/versions.js.map +1 -1
  27. package/dist/client.js +2 -1
  28. package/dist/components/admin/reader-manifest.d.ts +18 -0
  29. package/dist/components/admin/reader-manifest.js +490 -0
  30. package/dist/components/admin/reader-manifest.js.map +1 -0
  31. package/dist/components/content/card.js +1 -1
  32. package/dist/components/content/card.js.map +1 -1
  33. package/dist/components/content/editors.d.ts +2 -1
  34. package/dist/components/content/editors.js +291 -256
  35. package/dist/components/content/editors.js.map +1 -1
  36. package/dist/components/groups/banner.d.ts +1 -1
  37. package/dist/components/groups/banner.js +1 -1
  38. package/dist/components/groups/banner.js.map +1 -1
  39. package/dist/components/groups/editor.js +3 -3
  40. package/dist/components/groups/editor.js.map +1 -1
  41. package/dist/components/groups/parts.d.ts +2 -2
  42. package/dist/components/groups/parts.js +71 -72
  43. package/dist/components/groups/parts.js.map +1 -1
  44. package/dist/components/social/comments.js +59 -45
  45. package/dist/components/social/comments.js.map +1 -1
  46. package/dist/components/social/index.d.ts +1 -0
  47. package/dist/components/social/moderation.d.ts +5 -4
  48. package/dist/components/social/moderation.js +143 -130
  49. package/dist/components/social/moderation.js.map +1 -1
  50. package/dist/components/social/parts.js +22 -14
  51. package/dist/components/social/parts.js.map +1 -1
  52. package/dist/components/social/rules.d.ts +23 -0
  53. package/dist/components/social/rules.js +261 -0
  54. package/dist/components/social/rules.js.map +1 -0
  55. package/dist/index.d.ts +1 -0
  56. package/dist/index.js +26 -24
  57. package/dist/locales/admin/de.js +78 -0
  58. package/dist/locales/admin/de.js.map +1 -1
  59. package/dist/locales/admin/en.d.ts +78 -0
  60. package/dist/locales/admin/en.js +78 -0
  61. package/dist/locales/admin/en.js.map +1 -1
  62. package/dist/locales/admin/es.js +78 -0
  63. package/dist/locales/admin/es.js.map +1 -1
  64. package/dist/locales/admin/ja.js +78 -0
  65. package/dist/locales/admin/ja.js.map +1 -1
  66. package/dist/locales/admin/ko.js +78 -0
  67. package/dist/locales/admin/ko.js.map +1 -1
  68. package/dist/locales/admin/zh.js +78 -0
  69. package/dist/locales/admin/zh.js.map +1 -1
  70. package/dist/locales/de.js +3 -1
  71. package/dist/locales/de.js.map +1 -1
  72. package/dist/locales/discovery/de.js +2 -0
  73. package/dist/locales/discovery/de.js.map +1 -1
  74. package/dist/locales/discovery/en.d.ts +2 -0
  75. package/dist/locales/discovery/en.js +2 -0
  76. package/dist/locales/discovery/en.js.map +1 -1
  77. package/dist/locales/discovery/es.js +2 -0
  78. package/dist/locales/discovery/es.js.map +1 -1
  79. package/dist/locales/discovery/ja.js +2 -0
  80. package/dist/locales/discovery/ja.js.map +1 -1
  81. package/dist/locales/discovery/ko.js +2 -0
  82. package/dist/locales/discovery/ko.js.map +1 -1
  83. package/dist/locales/discovery/zh.js +2 -0
  84. package/dist/locales/discovery/zh.js.map +1 -1
  85. package/dist/locales/en.d.ts +85 -0
  86. package/dist/locales/en.js +3 -1
  87. package/dist/locales/en.js.map +1 -1
  88. package/dist/locales/es.js +3 -1
  89. package/dist/locales/es.js.map +1 -1
  90. package/dist/locales/ja.js +3 -1
  91. package/dist/locales/ja.js.map +1 -1
  92. package/dist/locales/ko.js +3 -1
  93. package/dist/locales/ko.js.map +1 -1
  94. package/dist/locales/social/de.js +3 -0
  95. package/dist/locales/social/de.js.map +1 -1
  96. package/dist/locales/social/en.d.ts +3 -0
  97. package/dist/locales/social/en.js +3 -0
  98. package/dist/locales/social/en.js.map +1 -1
  99. package/dist/locales/social/es.js +3 -0
  100. package/dist/locales/social/es.js.map +1 -1
  101. package/dist/locales/social/ja.js +3 -0
  102. package/dist/locales/social/ja.js.map +1 -1
  103. package/dist/locales/social/ko.js +3 -0
  104. package/dist/locales/social/ko.js.map +1 -1
  105. package/dist/locales/social/zh.js +3 -0
  106. package/dist/locales/social/zh.js.map +1 -1
  107. package/dist/locales/zh.js +3 -1
  108. package/dist/locales/zh.js.map +1 -1
  109. package/dist/react/admin.d.ts +1 -1
  110. package/dist/react/admin.js +2 -0
  111. package/dist/react/admin.js.map +1 -1
  112. package/dist/react/comments.d.ts +29 -1
  113. package/dist/react/comments.js +30 -2
  114. package/dist/react/comments.js.map +1 -1
  115. package/dist/react/context.d.ts +1 -1
  116. package/dist/react/context.js.map +1 -1
  117. package/dist/react/discovery.js +1 -1
  118. package/dist/react/discovery.js.map +1 -1
  119. package/dist/react/index.d.ts +1 -1
  120. package/dist/react/resources.js +6 -0
  121. package/dist/react/resources.js.map +1 -1
  122. package/dist/react.js +14 -14
  123. package/dist/styles.css +1 -1
  124. package/package.json +1 -1
@@ -11,74 +11,79 @@ import { Select as f, SelectContent as p, SelectItem as m, SelectTrigger as h, S
11
11
  import { Skeleton as _ } from "../../ui/skeleton.js";
12
12
  import { ErrorLine as v, RelativeTime as y, UserAvatar as b, UserName as x, contentError as S } from "./parts.js";
13
13
  import { AdminRoot as C, NoAccess as w, Pager as T, Rows as E, pageOf as D } from "../admin/shell.js";
14
- import { CommentBanDialog as ee, CommentBans as O } from "./bans.js";
15
- import { useAdminLocation as k, useFlowClient as A, useStaffAccess as j } from "../../react/admin.js";
16
- import { Tabs as M, TabsContent as N, TabsList as P, TabsTrigger as F } from "../../ui/tabs.js";
17
- import { useEffect as I, useId as L, useMemo as R, useState as z } from "react";
18
- import { Fragment as B, jsx as V, jsxs as H } from "react/jsx-runtime";
19
- import { cn as te } from "cn";
14
+ import { CommentBanDialog as O, CommentBans as k } from "./bans.js";
15
+ import { useAdminLocation as A, useFlowClient as j, useStaffAccess as M } from "../../react/admin.js";
16
+ import { Tabs as N, TabsContent as P, TabsList as F, TabsTrigger as I } from "../../ui/tabs.js";
17
+ import { BannedWords as L, IPBans as R } from "./rules.js";
18
+ import { useEffect as z, useId as ee, useMemo as te, useState as B } from "react";
19
+ import { Fragment as V, jsx as H, jsxs as U } from "react/jsx-runtime";
20
+ import { cn as W } from "cn";
20
21
  //#region src/components/social/moderation.tsx
21
- var U = [
22
+ var G = [
22
23
  "comments",
23
24
  "queue",
24
- "bans"
25
+ "bans",
26
+ "words",
27
+ "ips"
25
28
  ];
26
- function W(e = {}) {
27
- return j(U, e);
29
+ function K(e = {}) {
30
+ return M(G, e);
28
31
  }
29
- function G({ client: e, baseUrl: t, auth: n, guard: r, appearance: i, className: a, language: o, messages: s, sections: c = U, ...l }) {
30
- let u = A({
32
+ function q({ client: e, baseUrl: t, auth: n, guard: r, appearance: i, className: a, language: o, messages: s, sections: c = G, ...l }) {
33
+ let u = j({
31
34
  client: e,
32
35
  baseUrl: t,
33
36
  auth: n
34
37
  });
35
- return /* @__PURE__ */ V(C, {
38
+ return /* @__PURE__ */ H(C, {
36
39
  flow: "comment-moderation",
37
40
  appearance: i,
38
41
  className: a,
39
42
  language: o,
40
43
  messages: s,
41
44
  guard: r,
42
- children: /* @__PURE__ */ V(K, {
45
+ children: /* @__PURE__ */ H(J, {
43
46
  ...l,
44
47
  client: u,
45
48
  sections: c
46
49
  })
47
50
  });
48
51
  }
49
- function K({ sections: e, basePath: n, navigation: r, ...i }) {
50
- let { t: a } = t(), o = k(n, r), s = W({ client: i.client }), c = e.filter((e) => s.allowed[e]), l = {
52
+ function J({ sections: e, basePath: n, navigation: r, ...i }) {
53
+ let { t: a } = t(), o = A(n, r), s = K({ client: i.client }), c = e.filter((e) => s.allowed[e]), l = {
51
54
  comments: a("moderation.all"),
52
55
  queue: a("moderation.queue"),
53
- bans: a("moderation.bans")
54
- }, u = /* @__PURE__ */ V("h2", {
56
+ bans: a("moderation.bans"),
57
+ words: a("moderationRules.words"),
58
+ ips: a("moderationRules.ips")
59
+ }, u = /* @__PURE__ */ H("h2", {
55
60
  className: "text-base font-semibold",
56
61
  children: a("moderation.title")
57
62
  });
58
- if (s.loading) return /* @__PURE__ */ H(B, { children: [u, /* @__PURE__ */ V(E, {})] });
59
- if (!c.length) return /* @__PURE__ */ H(B, { children: [u, /* @__PURE__ */ V(w, { children: a("moderation.noAccess") })] });
63
+ if (s.loading) return /* @__PURE__ */ U(V, { children: [u, /* @__PURE__ */ H(E, {})] });
64
+ if (!c.length) return /* @__PURE__ */ U(V, { children: [u, /* @__PURE__ */ H(w, { children: a("moderation.noAccess") })] });
60
65
  let d = (t) => t === e[0] ? "" : t, f = o.view || e[0], p = c.includes(f) ? f : c[0], m = d(p);
61
- return /* @__PURE__ */ H(B, { children: [u, /* @__PURE__ */ H(M, {
66
+ return /* @__PURE__ */ U(V, { children: [u, /* @__PURE__ */ U(N, {
62
67
  value: p,
63
68
  onValueChange: (e) => o.go(d(e)),
64
- children: [c.length > 1 && /* @__PURE__ */ V(P, { children: c.map((e) => /* @__PURE__ */ V(F, {
69
+ children: [c.length > 1 && /* @__PURE__ */ H(F, { children: c.map((e) => /* @__PURE__ */ H(I, {
65
70
  value: e,
66
71
  children: l[e]
67
- }, e)) }), /* @__PURE__ */ H(N, {
72
+ }, e)) }), /* @__PURE__ */ U(P, {
68
73
  value: p,
69
74
  className: "pt-3",
70
75
  children: [
71
- p === "comments" && /* @__PURE__ */ V(J, {
76
+ p === "comments" && /* @__PURE__ */ H(X, {
72
77
  ...i,
73
78
  loc: o,
74
79
  view: m
75
80
  }),
76
- p === "queue" && /* @__PURE__ */ V(Y, {
81
+ p === "queue" && /* @__PURE__ */ H(Z, {
77
82
  ...i,
78
83
  loc: o,
79
84
  view: m
80
85
  }),
81
- p === "bans" && /* @__PURE__ */ V(O, {
86
+ p === "bans" && /* @__PURE__ */ H(k, {
82
87
  scope: "global",
83
88
  pageSize: i.pageSize,
84
89
  page: D(o.query),
@@ -86,72 +91,80 @@ function K({ sections: e, basePath: n, navigation: r, ...i }) {
86
91
  userHref: i.userHref,
87
92
  client: i.client,
88
93
  onError: i.onError
94
+ }),
95
+ p === "words" && /* @__PURE__ */ H(L, {
96
+ client: i.client,
97
+ onError: i.onError
98
+ }),
99
+ p === "ips" && /* @__PURE__ */ H(R, {
100
+ client: i.client,
101
+ onError: i.onError
89
102
  })
90
103
  ]
91
104
  })]
92
105
  })] });
93
106
  }
94
- function q(e) {
107
+ function Y(e) {
95
108
  return e.deleted ? "deleted" : e.moderation === "held" ? "held" : e.moderation === "rejected" ? "rejected" : "published";
96
109
  }
97
- function J({ loc: c, view: _, client: S, ...C }) {
98
- let { t: w } = t(), E = L(), O = R(() => (C.contentKinds ?? []).map((e) => typeof e == "string" ? {
110
+ function X({ loc: c, view: _, client: S, ...C }) {
111
+ let { t: w } = t(), E = ee(), k = te(() => (C.contentKinds ?? []).map((e) => typeof e == "string" ? {
99
112
  value: e,
100
113
  label: e
101
- } : e), [C.contentKinds]), k = c.query.get("kind") ?? "", A = c.query.get("author") ?? "", j = D(c.query), M = C.pageSize ?? 25, N = (e) => c.go(_, {
102
- kind: k,
103
- author: A,
114
+ } : e), [C.contentKinds]), A = c.query.get("kind") ?? "", j = c.query.get("author") ?? "", M = D(c.query), N = C.pageSize ?? 25, P = (e) => c.go(_, {
115
+ kind: A,
116
+ author: j,
104
117
  ...e
105
- }), [P, F] = z(A);
106
- I(() => F(A), [A]);
107
- let { store: B, scope: U } = o(S), W = s(B, a("admin-comments-page", U, k, A, M), { type: "admin-comments" }, j, M, (e, t) => S.comments.adminList({
118
+ }), [F, I] = B(j);
119
+ z(() => I(j), [j]);
120
+ let { store: L, scope: R } = o(S), V = s(L, a("admin-comments-page", R, A, j, N), { type: "admin-comments" }, M, N, (e, t) => S.comments.adminList({
108
121
  ...e,
109
- contentKind: k || void 0,
110
- author: A || void 0
111
- }, t)), G = n(C.onError), K = r(), [J, Y] = z(null), [X, Q] = z(null), $ = (t, n) => {
112
- Y(null), K(n).catch((n) => {
122
+ contentKind: A || void 0,
123
+ author: j || void 0
124
+ }, t)), G = n(C.onError), K = r(), [q, J] = B(null), [X, Z] = B(null), Q = (t, n) => {
125
+ J(null), K(n).catch((n) => {
113
126
  let r = e(n);
114
- Y(r), G(r, t);
127
+ J(r), G(r, t);
115
128
  });
116
- }, ne = A ? W.items.find((e) => e.user_id === A)?.author?.username ?? A : "";
117
- return /* @__PURE__ */ H("div", {
129
+ }, ne = j ? V.items.find((e) => e.user_id === j)?.author?.username ?? j : "";
130
+ return /* @__PURE__ */ U("div", {
118
131
  className: "grid gap-3",
119
132
  children: [
120
- /* @__PURE__ */ H("div", {
133
+ /* @__PURE__ */ U("div", {
121
134
  className: "flex flex-wrap items-end gap-2",
122
- children: [O.length > 0 && /* @__PURE__ */ H(f, {
123
- value: k,
124
- onValueChange: (e) => N({ kind: String(e ?? "") }),
125
- children: [/* @__PURE__ */ V(h, {
135
+ children: [k.length > 0 && /* @__PURE__ */ U(f, {
136
+ value: A,
137
+ onValueChange: (e) => P({ kind: String(e ?? "") }),
138
+ children: [/* @__PURE__ */ H(h, {
126
139
  size: "sm",
127
140
  "aria-label": w("moderation.kind"),
128
- children: /* @__PURE__ */ V(g, { children: (e) => e ? O.find((t) => t.value === e)?.label ?? e : w("moderation.allKinds") })
129
- }), /* @__PURE__ */ H(p, { children: [/* @__PURE__ */ V(m, {
141
+ children: /* @__PURE__ */ H(g, { children: (e) => e ? k.find((t) => t.value === e)?.label ?? e : w("moderation.allKinds") })
142
+ }), /* @__PURE__ */ U(p, { children: [/* @__PURE__ */ H(m, {
130
143
  value: "",
131
144
  children: w("moderation.allKinds")
132
- }), O.map((e) => /* @__PURE__ */ V(m, {
145
+ }), k.map((e) => /* @__PURE__ */ H(m, {
133
146
  value: e.value,
134
147
  children: e.label
135
148
  }, e.value))] })]
136
- }), /* @__PURE__ */ H("form", {
149
+ }), /* @__PURE__ */ U("form", {
137
150
  className: "flex min-w-56 flex-1 items-end gap-2",
138
151
  onSubmit: (e) => {
139
- e.preventDefault(), N({ author: P.trim() });
152
+ e.preventDefault(), P({ author: F.trim() });
140
153
  },
141
- children: [/* @__PURE__ */ H("div", {
154
+ children: [/* @__PURE__ */ U("div", {
142
155
  className: "grid flex-1 gap-1",
143
- children: [/* @__PURE__ */ V(d, {
156
+ children: [/* @__PURE__ */ H(d, {
144
157
  htmlFor: `${E}-author`,
145
158
  className: "sr-only",
146
159
  children: w("moderation.author")
147
- }), /* @__PURE__ */ V(u, {
160
+ }), /* @__PURE__ */ H(u, {
148
161
  id: `${E}-author`,
149
162
  className: "h-8",
150
- value: P,
163
+ value: F,
151
164
  placeholder: w("moderation.authorPlaceholder"),
152
- onChange: (e) => F(e.target.value)
165
+ onChange: (e) => I(e.target.value)
153
166
  })]
154
- }), /* @__PURE__ */ V(i, {
167
+ }), /* @__PURE__ */ H(i, {
155
168
  type: "submit",
156
169
  size: "sm",
157
170
  variant: "outline",
@@ -159,64 +172,64 @@ function J({ loc: c, view: _, client: S, ...C }) {
159
172
  })]
160
173
  })]
161
174
  }),
162
- A && /* @__PURE__ */ H("div", {
175
+ j && /* @__PURE__ */ U("div", {
163
176
  className: "flex flex-wrap items-center gap-2",
164
177
  "data-ckui": "author-filter",
165
- children: [/* @__PURE__ */ V("span", { children: w("moderation.byAuthor", { name: ne }) }), /* @__PURE__ */ V(i, {
178
+ children: [/* @__PURE__ */ H("span", { children: w("moderation.byAuthor", { name: ne }) }), /* @__PURE__ */ H(i, {
166
179
  size: "sm",
167
180
  variant: "ghost",
168
- onClick: () => N({ author: "" }),
181
+ onClick: () => P({ author: "" }),
169
182
  children: w("moderation.clearAuthor")
170
183
  })]
171
184
  }),
172
- /* @__PURE__ */ V(v, { error: J }),
173
- /* @__PURE__ */ V(Z, {
174
- loading: W.loading,
175
- error: W.error,
185
+ /* @__PURE__ */ H(v, { error: q }),
186
+ /* @__PURE__ */ H($, {
187
+ loading: V.loading,
188
+ error: V.error,
176
189
  empty: w("moderation.empty"),
177
- count: W.items.length,
178
- reload: W.reload,
179
- children: W.items.map((e) => {
180
- let t = e.author?.username ?? e.anon_name ?? e.user_id ?? w("comments.anonymous"), n = q(e), r = C.itemHref?.({
190
+ count: V.items.length,
191
+ reload: V.reload,
192
+ children: V.items.map((e) => {
193
+ let t = e.author?.username ?? e.anon_name ?? e.user_id ?? w("comments.anonymous"), n = Y(e), r = C.itemHref?.({
181
194
  kind: e.content_kind,
182
195
  id: e.content_id
183
196
  });
184
- return /* @__PURE__ */ H("li", {
197
+ return /* @__PURE__ */ U("li", {
185
198
  className: "grid gap-2 p-3",
186
199
  "data-ckui": "admin-comment",
187
200
  "data-status": n,
188
201
  children: [
189
- /* @__PURE__ */ H("div", {
202
+ /* @__PURE__ */ U("div", {
190
203
  className: "flex flex-wrap items-center gap-x-2 gap-y-1",
191
204
  children: [
192
- /* @__PURE__ */ V(b, {
205
+ /* @__PURE__ */ H(b, {
193
206
  user: e.author,
194
207
  name: t,
195
208
  size: "sm"
196
209
  }),
197
- /* @__PURE__ */ V(x, {
210
+ /* @__PURE__ */ H(x, {
198
211
  user: e.author,
199
212
  name: t,
200
213
  href: C.userHref
201
214
  }),
202
- /* @__PURE__ */ V(y, {
215
+ /* @__PURE__ */ H(y, {
203
216
  at: e.created_at,
204
217
  className: "text-xs text-muted-foreground"
205
218
  }),
206
- /* @__PURE__ */ V(l, {
219
+ /* @__PURE__ */ H(l, {
207
220
  variant: n === "published" ? "outline" : n === "held" ? "secondary" : "destructive",
208
221
  children: w(`moderation.${n}`)
209
222
  }),
210
- e.reply_to_id && /* @__PURE__ */ V(l, {
223
+ e.reply_to_id && /* @__PURE__ */ H(l, {
211
224
  variant: "outline",
212
225
  children: w("moderation.reply")
213
226
  }),
214
- /* @__PURE__ */ H("span", {
227
+ /* @__PURE__ */ U("span", {
215
228
  className: "text-xs text-muted-foreground",
216
229
  children: [
217
230
  w("moderation.on"),
218
231
  " ",
219
- r ? /* @__PURE__ */ H("a", {
232
+ r ? /* @__PURE__ */ U("a", {
220
233
  className: "hover:underline",
221
234
  href: r,
222
235
  children: [
@@ -229,38 +242,38 @@ function J({ loc: c, view: _, client: S, ...C }) {
229
242
  })
230
243
  ]
231
244
  }),
232
- /* @__PURE__ */ V("p", {
233
- className: te("line-clamp-4 break-words whitespace-pre-wrap", e.deleted && "text-muted-foreground line-through"),
245
+ /* @__PURE__ */ H("p", {
246
+ className: W("line-clamp-4 break-words whitespace-pre-wrap", e.deleted && "text-muted-foreground line-through"),
234
247
  children: e.body
235
248
  }),
236
- e.moderation_reason && /* @__PURE__ */ V("p", {
249
+ e.moderation_reason && /* @__PURE__ */ H("p", {
237
250
  className: "text-xs text-muted-foreground",
238
251
  children: w("moderation.heldBecause", { reason: e.moderation_reason })
239
252
  }),
240
- /* @__PURE__ */ H("div", {
253
+ /* @__PURE__ */ U("div", {
241
254
  className: "flex flex-wrap gap-2",
242
255
  children: [
243
- e.deleted ? /* @__PURE__ */ V(i, {
256
+ e.deleted ? /* @__PURE__ */ H(i, {
244
257
  size: "sm",
245
258
  variant: "outline",
246
- onClick: () => $("comment.restore", () => S.comments.restore(e.id)),
259
+ onClick: () => Q("comment.restore", () => S.comments.restore(e.id)),
247
260
  children: w("moderation.restore")
248
- }) : /* @__PURE__ */ V(i, {
261
+ }) : /* @__PURE__ */ H(i, {
249
262
  size: "sm",
250
263
  variant: "destructive",
251
- onClick: () => $("comment.delete", () => S.comments.delete(e.id)),
264
+ onClick: () => Q("comment.delete", () => S.comments.delete(e.id)),
252
265
  children: w("moderation.delete")
253
266
  }),
254
- e.user_id && e.user_id !== A && /* @__PURE__ */ V(i, {
267
+ e.user_id && e.user_id !== j && /* @__PURE__ */ H(i, {
255
268
  size: "sm",
256
269
  variant: "ghost",
257
- onClick: () => N({ author: e.user_id }),
270
+ onClick: () => P({ author: e.user_id }),
258
271
  children: w("moderation.theirComments")
259
272
  }),
260
- e.user_id && /* @__PURE__ */ V(i, {
273
+ e.user_id && /* @__PURE__ */ H(i, {
261
274
  size: "sm",
262
275
  variant: "ghost",
263
- onClick: () => Q({
276
+ onClick: () => Z({
264
277
  id: e.user_id,
265
278
  name: t
266
279
  }),
@@ -272,19 +285,19 @@ function J({ loc: c, view: _, client: S, ...C }) {
272
285
  }, e.id);
273
286
  })
274
287
  }),
275
- /* @__PURE__ */ V(T, {
276
- page: j,
277
- hasNext: W.hasNext,
278
- disabled: W.loading,
288
+ /* @__PURE__ */ H(T, {
289
+ page: M,
290
+ hasNext: V.hasNext,
291
+ disabled: V.loading,
279
292
  onPage: (e) => c.go(_, {
280
- kind: k,
281
- author: A,
293
+ kind: A,
294
+ author: j,
282
295
  page: e > 1 ? e : void 0
283
296
  })
284
297
  }),
285
- X && /* @__PURE__ */ V(ee, {
298
+ X && /* @__PURE__ */ H(O, {
286
299
  open: !0,
287
- onOpenChange: (e) => !e && Q(null),
300
+ onOpenChange: (e) => !e && Z(null),
288
301
  user: X,
289
302
  scopes: ["global"],
290
303
  client: S,
@@ -293,20 +306,20 @@ function J({ loc: c, view: _, client: S, ...C }) {
293
306
  ]
294
307
  });
295
308
  }
296
- function Y({ loc: e, view: n, ...r }) {
309
+ function Z({ loc: e, view: n, ...r }) {
297
310
  let { t: a } = t(), o = e.query.get("kind") === "content" ? "content" : "comment", s = c({
298
311
  kind: o,
299
312
  pageSize: r.pageSize,
300
313
  client: r.client
301
314
  });
302
- return /* @__PURE__ */ H("div", {
315
+ return /* @__PURE__ */ U("div", {
303
316
  className: "grid gap-3",
304
317
  children: [
305
- /* @__PURE__ */ V("div", {
318
+ /* @__PURE__ */ H("div", {
306
319
  className: "flex gap-2",
307
320
  role: "group",
308
321
  "aria-label": a("moderation.queue"),
309
- children: ["comment", "content"].map((t) => /* @__PURE__ */ V(i, {
322
+ children: ["comment", "content"].map((t) => /* @__PURE__ */ H(i, {
310
323
  size: "sm",
311
324
  variant: o === t ? "default" : "outline",
312
325
  "aria-pressed": o === t,
@@ -314,13 +327,13 @@ function Y({ loc: e, view: n, ...r }) {
314
327
  children: a(t === "content" ? "moderation.queueContent" : "moderation.queueComments")
315
328
  }, t))
316
329
  }),
317
- /* @__PURE__ */ V(Z, {
330
+ /* @__PURE__ */ H($, {
318
331
  loading: s.loading,
319
332
  error: s.error,
320
333
  empty: a("moderation.queueEmpty"),
321
334
  count: s.items.length,
322
335
  reload: s.reload,
323
- children: s.items.map((e) => /* @__PURE__ */ V(X, {
336
+ children: s.items.map((e) => /* @__PURE__ */ H(Q, {
324
337
  item: e,
325
338
  itemHref: r.itemHref,
326
339
  userHref: r.userHref,
@@ -329,7 +342,7 @@ function Y({ loc: e, view: n, ...r }) {
329
342
  onError: r.onError
330
343
  }, e.id))
331
344
  }),
332
- s.hasMore && /* @__PURE__ */ V(i, {
345
+ s.hasMore && /* @__PURE__ */ H(i, {
333
346
  variant: "outline",
334
347
  className: "justify-self-center",
335
348
  disabled: s.loadingMore,
@@ -339,8 +352,8 @@ function Y({ loc: e, view: n, ...r }) {
339
352
  ]
340
353
  });
341
354
  }
342
- function X(a) {
343
- let o = t(), { t: s } = o, c = n(a.onError), l = r(), { item: d } = a, [f, p] = z(!1), [m, h] = z(""), [g, _] = z(!1), [C, w] = z(null), T = d.author?.username ?? d.anon_name ?? d.author_id ?? s("comments.anonymous"), E = a.itemHref?.({
355
+ function Q(a) {
356
+ let o = t(), { t: s } = o, c = n(a.onError), l = r(), { item: d } = a, [f, p] = B(!1), [m, h] = B(""), [g, _] = B(!1), [C, w] = B(null), T = d.author?.username ?? d.anon_name ?? d.author_id ?? s("comments.anonymous"), E = a.itemHref?.({
344
357
  kind: d.ref.content_kind,
345
358
  id: d.ref.content_id
346
359
  }), D = async (t) => {
@@ -354,28 +367,28 @@ function X(a) {
354
367
  _(!1);
355
368
  }
356
369
  };
357
- return /* @__PURE__ */ H("li", {
370
+ return /* @__PURE__ */ U("li", {
358
371
  className: "grid gap-2 p-3",
359
372
  "data-ckui": "held-item",
360
373
  children: [
361
- /* @__PURE__ */ H("div", {
374
+ /* @__PURE__ */ U("div", {
362
375
  className: "flex flex-wrap items-center gap-x-2 gap-y-1",
363
376
  children: [
364
- /* @__PURE__ */ V(b, {
377
+ /* @__PURE__ */ H(b, {
365
378
  user: d.author,
366
379
  name: T,
367
380
  size: "sm"
368
381
  }),
369
- /* @__PURE__ */ V(x, {
382
+ /* @__PURE__ */ H(x, {
370
383
  user: d.author,
371
384
  name: T,
372
385
  href: a.userHref
373
386
  }),
374
- /* @__PURE__ */ V(y, {
387
+ /* @__PURE__ */ H(y, {
375
388
  at: d.held_at,
376
389
  className: "text-xs text-muted-foreground"
377
390
  }),
378
- E && /* @__PURE__ */ H("a", {
391
+ E && /* @__PURE__ */ U("a", {
379
392
  className: "text-xs text-muted-foreground hover:underline",
380
393
  href: E,
381
394
  children: [
@@ -388,19 +401,19 @@ function X(a) {
388
401
  })
389
402
  ]
390
403
  }),
391
- d.title && /* @__PURE__ */ V("p", {
404
+ d.title && /* @__PURE__ */ H("p", {
392
405
  className: "font-medium",
393
406
  children: d.title
394
407
  }),
395
- /* @__PURE__ */ V("p", {
408
+ /* @__PURE__ */ H("p", {
396
409
  className: "line-clamp-6 break-words whitespace-pre-wrap",
397
410
  children: d.body
398
411
  }),
399
- (d.reason || d.error) && /* @__PURE__ */ V("p", {
412
+ (d.reason || d.error) && /* @__PURE__ */ H("p", {
400
413
  className: "text-xs text-muted-foreground",
401
414
  children: s("moderation.heldBecause", { reason: d.reason || d.error || "" })
402
415
  }),
403
- f && /* @__PURE__ */ V(u, {
416
+ f && /* @__PURE__ */ H(u, {
404
417
  value: m,
405
418
  maxLength: 500,
406
419
  placeholder: s("moderation.rejectReason"),
@@ -408,23 +421,23 @@ function X(a) {
408
421
  onChange: (e) => h(e.target.value),
409
422
  autoFocus: !0
410
423
  }),
411
- /* @__PURE__ */ H("div", {
424
+ /* @__PURE__ */ U("div", {
412
425
  className: "flex flex-wrap gap-2",
413
426
  children: [
414
- /* @__PURE__ */ V(i, {
427
+ /* @__PURE__ */ H(i, {
415
428
  size: "sm",
416
429
  disabled: g,
417
430
  onClick: () => void D("approve"),
418
431
  children: s("moderation.approve")
419
432
  }),
420
- /* @__PURE__ */ V(i, {
433
+ /* @__PURE__ */ H(i, {
421
434
  size: "sm",
422
435
  variant: "destructive",
423
436
  disabled: g,
424
437
  onClick: () => f ? void D("reject") : p(!0),
425
438
  children: s("moderation.reject")
426
439
  }),
427
- f && /* @__PURE__ */ V(i, {
440
+ f && /* @__PURE__ */ H(i, {
428
441
  size: "sm",
429
442
  variant: "ghost",
430
443
  onClick: () => p(!1),
@@ -432,33 +445,33 @@ function X(a) {
432
445
  })
433
446
  ]
434
447
  }),
435
- C && /* @__PURE__ */ V(v, { children: C })
448
+ C && /* @__PURE__ */ H(v, { children: C })
436
449
  ]
437
450
  });
438
451
  }
439
- function Z(e) {
452
+ function $(e) {
440
453
  let n = t(), { t: r } = n;
441
- return e.loading && !e.count ? /* @__PURE__ */ H("div", {
454
+ return e.loading && !e.count ? /* @__PURE__ */ U("div", {
442
455
  className: "grid gap-3",
443
456
  "aria-busy": !0,
444
- children: [/* @__PURE__ */ V(_, { className: "h-16 w-full" }), /* @__PURE__ */ V(_, { className: "h-16 w-full" })]
445
- }) : e.error && !e.count ? /* @__PURE__ */ H("div", {
457
+ children: [/* @__PURE__ */ H(_, { className: "h-16 w-full" }), /* @__PURE__ */ H(_, { className: "h-16 w-full" })]
458
+ }) : e.error && !e.count ? /* @__PURE__ */ U("div", {
446
459
  className: "grid justify-items-start gap-2",
447
- children: [/* @__PURE__ */ V(v, { children: e.error.code === "forbidden" || e.error.code === "unauthorized" ? S(n, e.error) : r("moderation.loadFailed") }), /* @__PURE__ */ V(i, {
460
+ children: [/* @__PURE__ */ H(v, { children: e.error.code === "forbidden" || e.error.code === "unauthorized" ? S(n, e.error) : r("moderation.loadFailed") }), /* @__PURE__ */ H(i, {
448
461
  size: "sm",
449
462
  variant: "outline",
450
463
  onClick: e.reload,
451
464
  children: r("common.retry")
452
465
  })]
453
- }) : e.count ? /* @__PURE__ */ V("ul", {
466
+ }) : e.count ? /* @__PURE__ */ H("ul", {
454
467
  className: "grid divide-y divide-border rounded-lg border border-border",
455
468
  children: e.children
456
- }) : /* @__PURE__ */ V("p", {
469
+ }) : /* @__PURE__ */ H("p", {
457
470
  className: "text-muted-foreground",
458
471
  children: e.empty
459
472
  });
460
473
  }
461
474
  //#endregion
462
- export { G as CommentModeration, W as useCommentModerationAccess };
475
+ export { q as CommentModeration, K as useCommentModerationAccess };
463
476
 
464
477
  //# sourceMappingURL=moderation.js.map