@openrails/contentkit-ui 0.95.1 → 0.97.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (61) hide show
  1. package/README.md +9 -1
  2. package/dist/client/discovery.d.ts +2 -1
  3. package/dist/client/discovery.js.map +1 -1
  4. package/dist/client/entities.d.ts +6 -0
  5. package/dist/client/entities.js +13 -0
  6. package/dist/client/entities.js.map +1 -1
  7. package/dist/client/generated/routes.d.ts +26 -0
  8. package/dist/client/generated/routes.js +44 -0
  9. package/dist/client/generated/routes.js.map +1 -1
  10. package/dist/client/generated/wire.d.ts +7 -11
  11. package/dist/client/generated/wire.js.map +1 -1
  12. package/dist/client/http.d.ts +1 -0
  13. package/dist/client/http.js +5 -4
  14. package/dist/client/http.js.map +1 -1
  15. package/dist/client/index.d.ts +1 -1
  16. package/dist/client/reader-preferences.js +3 -7
  17. package/dist/client/reader-preferences.js.map +1 -1
  18. package/dist/components/admin/content-manager.d.ts +3 -1
  19. package/dist/components/admin/content-manager.js +241 -239
  20. package/dist/components/admin/content-manager.js.map +1 -1
  21. package/dist/components/admin/group-manager.js +133 -119
  22. package/dist/components/admin/group-manager.js.map +1 -1
  23. package/dist/components/content/editors.d.ts +1 -0
  24. package/dist/components/content/editors.js +1 -0
  25. package/dist/components/content/editors.js.map +1 -1
  26. package/dist/components/content/filters.d.ts +1 -1
  27. package/dist/components/content/filters.js +1 -1
  28. package/dist/components/content/filters.js.map +1 -1
  29. package/dist/components/groups/banner.d.ts +3 -1
  30. package/dist/components/groups/banner.js +29 -26
  31. package/dist/components/groups/banner.js.map +1 -1
  32. package/dist/components/groups/editor.d.ts +4 -1
  33. package/dist/components/groups/editor.js +369 -315
  34. package/dist/components/groups/editor.js.map +1 -1
  35. package/dist/components/groups/memberships.d.ts +2 -0
  36. package/dist/components/groups/memberships.js +1 -0
  37. package/dist/components/groups/memberships.js.map +1 -1
  38. package/dist/components/groups/parts.d.ts +4 -1
  39. package/dist/components/groups/parts.js +32 -30
  40. package/dist/components/groups/parts.js.map +1 -1
  41. package/dist/locales/en.d.ts +2 -0
  42. package/dist/locales/groups/de.js +2 -0
  43. package/dist/locales/groups/de.js.map +1 -1
  44. package/dist/locales/groups/en.d.ts +2 -0
  45. package/dist/locales/groups/en.js +2 -0
  46. package/dist/locales/groups/en.js.map +1 -1
  47. package/dist/locales/groups/es.js +2 -0
  48. package/dist/locales/groups/es.js.map +1 -1
  49. package/dist/locales/groups/ja.js +2 -0
  50. package/dist/locales/groups/ja.js.map +1 -1
  51. package/dist/locales/groups/ko.js +2 -0
  52. package/dist/locales/groups/ko.js.map +1 -1
  53. package/dist/locales/groups/zh.js +2 -0
  54. package/dist/locales/groups/zh.js.map +1 -1
  55. package/dist/react/discovery.d.ts +2 -1
  56. package/dist/react/discovery.js +54 -29
  57. package/dist/react/discovery.js.map +1 -1
  58. package/dist/react/groups.d.ts +3 -1
  59. package/dist/react/groups.js +7 -7
  60. package/dist/react/groups.js.map +1 -1
  61. package/package.json +1 -1
@@ -12,53 +12,58 @@ import { Select as _, SelectContent as v, SelectItem as y, SelectTrigger as b, S
12
12
  import { Skeleton as S } from "../../ui/skeleton.js";
13
13
  import { Textarea as C } from "../../ui/textarea.js";
14
14
  import { ErrorLine as w, contentError as T, useAction as E } from "../social/parts.js";
15
- import { parseAttributes as D, slugify as O } from "../../client/group-fields.js";
16
- import { GroupPicker as k, labelOf as A, useGroupNames as j } from "./parts.js";
17
- import { OfferFields as M } from "../content/offer-fields.js";
18
- import { AttributeFields as N, formOf as P } from "./fields.js";
19
- import { GroupImageEditor as F } from "./banner.js";
20
- import { useCallback as I, useEffect as L, useId as R, useRef as z, useState as B } from "react";
21
- import { Fragment as V, jsx as H, jsxs as U } from "react/jsx-runtime";
22
- import { cn as W } from "cn";
15
+ import { Switch as D } from "../../ui/switch.js";
16
+ import { parseAttributes as O, slugify as k } from "../../client/group-fields.js";
17
+ import { GroupPicker as A, labelOf as j, useGroupNames as M } from "./parts.js";
18
+ import { OfferFields as N } from "../content/offer-fields.js";
19
+ import { AttributeFields as P, formOf as F } from "./fields.js";
20
+ import { GroupImageEditor as I } from "./banner.js";
21
+ import { useCallback as L, useEffect as R, useId as z, useRef as B, useState as V } from "react";
22
+ import { Fragment as H, jsx as U, jsxs as W } from "react/jsx-runtime";
23
+ import { cn as G } from "cn";
23
24
  //#region src/components/groups/editor.tsx
24
- function G(e) {
25
- let { t } = n(), { kinds: i, loading: c } = o({ client: e.client }), l = a(e.id, { client: e.client }), u = e.languages ?? i?.languages ?? ["en"], d = l.group?.kind ?? e.kind, f = i?.entity_kinds?.[d] ?? {}, p = (t) => /* @__PURE__ */ H(r, {
25
+ function K(e) {
26
+ let { t } = n(), { kinds: i, loading: c } = o({ client: e.client }), l = a(e.id, {
27
+ client: e.client,
28
+ management: e.management
29
+ }), u = e.languages ?? i?.languages ?? ["en"], d = l.group?.kind ?? e.kind, f = i?.entity_kinds?.[d] ?? {}, p = (t) => /* @__PURE__ */ U(r, {
26
30
  appearance: e.appearance,
27
- className: W("grid gap-6 text-sm", e.className),
31
+ className: G("grid gap-6 text-sm", e.className),
28
32
  "data-ckui": "group-editor",
29
33
  "data-kind": d,
30
34
  children: t
31
35
  });
32
- if (c) return p(/* @__PURE__ */ H(S, { className: "h-40 w-full" }));
33
- if (!e.id && !l.group && !l.loading) return p(/* @__PURE__ */ H(Q, {
36
+ if (c) return p(/* @__PURE__ */ U(S, { className: "h-40 w-full" }));
37
+ if (!e.id && !l.group && !l.loading) return p(/* @__PURE__ */ U(ee, {
34
38
  ...e,
35
39
  kind: d,
36
40
  spec: f,
37
41
  languages: u,
38
42
  g: l
39
43
  }));
40
- if (l.deleted) return p(/* @__PURE__ */ H(J, {
44
+ if (l.deleted) return p(/* @__PURE__ */ U(Y, {
41
45
  group: l.deleted,
42
46
  onRestore: () => l.restore(),
43
47
  onError: e.onError,
44
48
  name: l.deleted.slug
45
49
  }));
46
- if (!l.group) return l.error ? p(/* @__PURE__ */ U("div", {
50
+ if (!l.group) return l.error ? p(/* @__PURE__ */ W("div", {
47
51
  role: "alert",
48
52
  className: "grid justify-items-start gap-2",
49
- children: [/* @__PURE__ */ H("p", {
53
+ children: [/* @__PURE__ */ U("p", {
50
54
  className: "text-destructive",
51
55
  children: t("groupEditor.loadFailed")
52
- }), /* @__PURE__ */ H(s, {
56
+ }), /* @__PURE__ */ U(s, {
53
57
  size: "sm",
54
58
  variant: "outline",
55
59
  onClick: l.reload,
56
60
  children: t("common.retry")
57
61
  })]
58
- })) : p(/* @__PURE__ */ H(S, { className: "h-40 w-full" }));
62
+ })) : p(/* @__PURE__ */ U(S, { className: "h-40 w-full" }));
59
63
  let m = l.group;
60
- return p(/* @__PURE__ */ U(V, { children: [
61
- /* @__PURE__ */ H(Y, {
64
+ return p(/* @__PURE__ */ W(H, { children: [
65
+ /* @__PURE__ */ U(X, {
66
+ management: e.management,
62
67
  group: m,
63
68
  g: l,
64
69
  labels: e.labels,
@@ -67,7 +72,8 @@ function G(e) {
67
72
  onError: e.onError,
68
73
  client: e.client
69
74
  }),
70
- /* @__PURE__ */ H($, {
75
+ /* @__PURE__ */ U(te, {
76
+ management: e.management,
71
77
  group: m,
72
78
  spec: f,
73
79
  g: l,
@@ -75,30 +81,32 @@ function G(e) {
75
81
  onError: e.onError,
76
82
  client: e.client
77
83
  }, m.id),
78
- /* @__PURE__ */ H(ee, {
84
+ /* @__PURE__ */ U(ne, {
79
85
  group: m,
80
86
  g: l,
81
87
  languages: u,
82
88
  onError: e.onError
83
89
  }),
84
- /* @__PURE__ */ H(te, {
90
+ /* @__PURE__ */ U(re, {
85
91
  group: m,
86
92
  g: l,
87
93
  languages: u,
88
94
  onError: e.onError
89
95
  }, m.id),
90
- /* @__PURE__ */ H(ne, {
96
+ /* @__PURE__ */ U(ie, {
97
+ management: e.management,
91
98
  group: m,
92
99
  spec: f,
93
100
  onError: e.onError,
94
101
  client: e.client
95
102
  }),
96
- f.sellable && /* @__PURE__ */ H(re, {
103
+ f.sellable && /* @__PURE__ */ U(ae, {
97
104
  group: m,
98
105
  onError: e.onError,
99
106
  client: e.client
100
107
  }),
101
- /* @__PURE__ */ H(ae, {
108
+ /* @__PURE__ */ U(se, {
109
+ management: e.management,
102
110
  group: m,
103
111
  g: l,
104
112
  kinds: i,
@@ -109,212 +117,215 @@ function G(e) {
109
117
  e.children?.(m)
110
118
  ] }));
111
119
  }
112
- function K(e, t) {
113
- let [n, r] = B(e), i = z(!1), a = z(e);
114
- return a.current = e, L(() => {
120
+ function q(e, t) {
121
+ let [n, r] = V(e), i = B(!1), a = B(e);
122
+ return a.current = e, R(() => {
115
123
  i.current || r(a.current());
116
124
  }, [t]), [
117
125
  n,
118
- I((e) => {
126
+ L((e) => {
119
127
  i.current = !0, r(e);
120
128
  }, []),
121
- I(() => {
129
+ L(() => {
122
130
  i.current = !1;
123
131
  }, [])
124
132
  ];
125
133
  }
126
- function q({ title: e, children: t, ckui: n, action: r }) {
127
- return /* @__PURE__ */ U("section", {
134
+ function J({ title: e, children: t, ckui: n, action: r }) {
135
+ return /* @__PURE__ */ W("section", {
128
136
  className: "grid gap-3",
129
137
  "data-ckui": n,
130
- children: [/* @__PURE__ */ U("div", {
138
+ children: [/* @__PURE__ */ W("div", {
131
139
  className: "flex flex-wrap items-center justify-between gap-2",
132
- children: [/* @__PURE__ */ H("h3", {
140
+ children: [/* @__PURE__ */ U("h3", {
133
141
  className: "font-medium",
134
142
  children: e
135
143
  }), r]
136
144
  }), t]
137
145
  });
138
146
  }
139
- function J({ group: e, name: t, onRestore: r, onError: i }) {
147
+ function Y({ group: e, name: t, onRestore: r, onError: i }) {
140
148
  let { t: a } = n(), o = E("group.save", i);
141
- return /* @__PURE__ */ U("div", {
149
+ return /* @__PURE__ */ W("div", {
142
150
  className: "grid justify-items-start gap-2",
143
151
  "data-ckui": "group-deleted",
144
152
  "data-state": e.state,
145
153
  children: [
146
- /* @__PURE__ */ H("p", { children: a("groupEditor.deletedNotice", { name: t }) }),
147
- /* @__PURE__ */ H(s, {
154
+ /* @__PURE__ */ U("p", { children: a("groupEditor.deletedNotice", { name: t }) }),
155
+ /* @__PURE__ */ U(s, {
148
156
  size: "sm",
149
157
  variant: "outline",
150
158
  disabled: o.pending,
151
159
  onClick: () => void o.run(r),
152
160
  children: a("groupEditor.restore")
153
161
  }),
154
- /* @__PURE__ */ H(w, { error: o.error })
162
+ /* @__PURE__ */ U(w, { error: o.error })
155
163
  ]
156
164
  });
157
165
  }
158
- function Y({ group: e, g: t, labels: r, onMerged: i, onDeleted: a, onError: o, client: h }) {
159
- let { t: g } = n(), [_, v] = B(!1), [y, b] = B(!1), x = E("group.save", o);
160
- return /* @__PURE__ */ U("div", {
166
+ function X({ group: e, g: t, labels: r, onMerged: i, onDeleted: a, onError: o, client: h, management: g }) {
167
+ let { t: _ } = n(), [v, y] = V(!1), [b, x] = V(!1), S = E("group.save", o);
168
+ return /* @__PURE__ */ W("div", {
161
169
  className: "flex flex-wrap items-center gap-2",
162
170
  "data-ckui": "group-head",
163
171
  children: [
164
- /* @__PURE__ */ H("h2", {
172
+ /* @__PURE__ */ U("h2", {
165
173
  className: "text-base font-semibold break-words",
166
174
  children: e.name || e.slug
167
175
  }),
168
- /* @__PURE__ */ H(m, {
176
+ /* @__PURE__ */ U(m, {
169
177
  variant: "outline",
170
- children: A(r, e.kind)
178
+ children: j(r, e.kind)
171
179
  }),
172
- /* @__PURE__ */ U("div", {
180
+ /* @__PURE__ */ W("div", {
173
181
  className: "ms-auto flex flex-wrap gap-2",
174
- children: [/* @__PURE__ */ H(s, {
182
+ children: [/* @__PURE__ */ U(s, {
175
183
  size: "sm",
176
184
  variant: "outline",
177
- onClick: () => v(!0),
178
- children: g("groupEditor.merge")
179
- }), /* @__PURE__ */ H(s, {
185
+ onClick: () => y(!0),
186
+ children: _("groupEditor.merge")
187
+ }), /* @__PURE__ */ U(s, {
180
188
  size: "sm",
181
189
  variant: "destructive",
182
- disabled: x.pending,
183
- onClick: () => b(!0),
184
- children: g("groupEditor.delete")
190
+ disabled: S.pending,
191
+ onClick: () => x(!0),
192
+ children: _("groupEditor.delete")
185
193
  })]
186
194
  }),
187
- /* @__PURE__ */ H(w, {
188
- error: x.error,
195
+ /* @__PURE__ */ U(w, {
196
+ error: S.error,
189
197
  className: "basis-full"
190
198
  }),
191
- /* @__PURE__ */ H(X, {
192
- open: _,
193
- onOpenChange: v,
199
+ /* @__PURE__ */ U(Z, {
200
+ open: v,
201
+ onOpenChange: y,
194
202
  group: e,
203
+ management: g,
195
204
  client: h,
196
205
  onMerge: async (e) => {
197
206
  let n = await t.merge(e.id);
198
207
  return i?.(n), n;
199
208
  }
200
209
  }),
201
- /* @__PURE__ */ H(c, {
202
- open: y,
203
- onOpenChange: b,
204
- children: /* @__PURE__ */ U(l, {
210
+ /* @__PURE__ */ U(c, {
211
+ open: b,
212
+ onOpenChange: x,
213
+ children: /* @__PURE__ */ W(l, {
205
214
  "data-ckui": "group-delete-dialog",
206
- children: [/* @__PURE__ */ U(f, { children: [/* @__PURE__ */ H(p, { children: g("groupEditor.deleteTitle", { name: e.name || e.slug }) }), /* @__PURE__ */ H(u, { children: g("groupEditor.deleteBody") })] }), /* @__PURE__ */ U(d, { children: [/* @__PURE__ */ H(s, {
215
+ children: [/* @__PURE__ */ W(f, { children: [/* @__PURE__ */ U(p, { children: _("groupEditor.deleteTitle", { name: e.name || e.slug }) }), /* @__PURE__ */ U(u, { children: _("groupEditor.deleteBody") })] }), /* @__PURE__ */ W(d, { children: [/* @__PURE__ */ U(s, {
207
216
  variant: "outline",
208
- onClick: () => b(!1),
209
- children: g("common.cancel")
210
- }), /* @__PURE__ */ H(s, {
217
+ onClick: () => x(!1),
218
+ children: _("common.cancel")
219
+ }), /* @__PURE__ */ U(s, {
211
220
  variant: "destructive",
212
- disabled: x.pending,
221
+ disabled: S.pending,
213
222
  onClick: () => {
214
- b(!1), x.run(t.remove).then((e) => e && a?.(e));
223
+ x(!1), S.run(t.remove).then((e) => e && a?.(e));
215
224
  },
216
- children: g("groupEditor.delete")
225
+ children: _("groupEditor.delete")
217
226
  })] })]
218
227
  })
219
228
  })
220
229
  ]
221
230
  });
222
231
  }
223
- function X({ open: t, onOpenChange: r, group: i, onMerge: a, language: o, client: m }) {
224
- let _ = n(), { t: v } = _, y = R(), [b, x] = B(null), [S, C] = B(""), [E, D] = B(!1), [O, A] = B(null);
225
- L(() => {
226
- t && (x(null), C(""), A(null));
232
+ function Z({ open: t, onOpenChange: r, group: i, onMerge: a, language: o, client: m, management: _ }) {
233
+ let v = n(), { t: y } = v, b = z(), [x, S] = V(null), [C, E] = V(""), [D, O] = V(!1), [k, j] = V(null);
234
+ R(() => {
235
+ t && (S(null), E(""), j(null));
227
236
  }, [t]);
228
- let j = v("groupEditor.mergeWord"), M = !!b && S.trim().toLowerCase() === j.toLowerCase(), N = i.name || i.slug;
229
- return /* @__PURE__ */ H(c, {
237
+ let M = y("groupEditor.mergeWord"), N = !!x && C.trim().toLowerCase() === M.toLowerCase(), P = i.name || i.slug;
238
+ return /* @__PURE__ */ U(c, {
230
239
  open: t,
231
240
  onOpenChange: r,
232
- children: /* @__PURE__ */ U(l, {
241
+ children: /* @__PURE__ */ W(l, {
233
242
  "data-ckui": "group-merge-dialog",
234
243
  children: [
235
- /* @__PURE__ */ U(f, { children: [/* @__PURE__ */ H(p, { children: v("groupEditor.mergeTitle", { name: N }) }), /* @__PURE__ */ H(u, { children: v("groupEditor.mergeBody") })] }),
236
- b ? /* @__PURE__ */ U("div", {
244
+ /* @__PURE__ */ W(f, { children: [/* @__PURE__ */ U(p, { children: y("groupEditor.mergeTitle", { name: P }) }), /* @__PURE__ */ U(u, { children: y("groupEditor.mergeBody") })] }),
245
+ x ? /* @__PURE__ */ W("div", {
237
246
  className: "flex flex-wrap items-center gap-2",
238
247
  "data-ckui": "merge-target",
239
- children: [/* @__PURE__ */ H("span", { children: v("groupEditor.mergeInto", { name: b.name || b.slug }) }), /* @__PURE__ */ H(s, {
248
+ children: [/* @__PURE__ */ U("span", { children: y("groupEditor.mergeInto", { name: x.name || x.slug }) }), /* @__PURE__ */ U(s, {
240
249
  size: "xs",
241
250
  variant: "ghost",
242
- onClick: () => x(null),
243
- children: v("groupEditor.change")
251
+ onClick: () => S(null),
252
+ children: y("groupEditor.change")
244
253
  })]
245
- }) : /* @__PURE__ */ H(k, {
254
+ }) : /* @__PURE__ */ U(A, {
255
+ management: _,
246
256
  kind: i.kind,
247
257
  language: o,
248
258
  exclude: [i.id],
249
- label: v("groupEditor.mergeTarget"),
250
- onPick: x,
259
+ label: y("groupEditor.mergeTarget"),
260
+ onPick: S,
251
261
  client: m,
252
262
  autoFocus: !0
253
263
  }),
254
- /* @__PURE__ */ U("div", {
264
+ /* @__PURE__ */ W("div", {
255
265
  className: "grid gap-1.5",
256
- children: [/* @__PURE__ */ H(g, {
257
- htmlFor: `${y}-typed`,
258
- children: v("admin.typeToConfirm", { word: j })
259
- }), /* @__PURE__ */ H(h, {
260
- id: `${y}-typed`,
261
- value: S,
266
+ children: [/* @__PURE__ */ U(g, {
267
+ htmlFor: `${b}-typed`,
268
+ children: y("admin.typeToConfirm", { word: M })
269
+ }), /* @__PURE__ */ U(h, {
270
+ id: `${b}-typed`,
271
+ value: C,
262
272
  autoComplete: "off",
263
- onChange: (e) => C(e.target.value)
273
+ onChange: (e) => E(e.target.value)
264
274
  })]
265
275
  }),
266
- O && /* @__PURE__ */ H(w, { children: T(_, O) }),
267
- /* @__PURE__ */ U(d, { children: [/* @__PURE__ */ H(s, {
276
+ k && /* @__PURE__ */ U(w, { children: T(v, k) }),
277
+ /* @__PURE__ */ W(d, { children: [/* @__PURE__ */ U(s, {
268
278
  variant: "outline",
269
279
  onClick: () => r(!1),
270
- children: v("common.cancel")
271
- }), /* @__PURE__ */ H(s, {
280
+ children: y("common.cancel")
281
+ }), /* @__PURE__ */ U(s, {
272
282
  variant: "destructive",
273
- disabled: !M || E,
283
+ disabled: !N || D,
274
284
  onClick: async () => {
275
- if (b) {
276
- D(!0), A(null);
285
+ if (x) {
286
+ O(!0), j(null);
277
287
  try {
278
- await a(b), r(!1);
288
+ await a(x), r(!1);
279
289
  } catch (t) {
280
- A(e(t));
290
+ j(e(t));
281
291
  } finally {
282
- D(!1);
292
+ O(!1);
283
293
  }
284
294
  }
285
295
  },
286
- children: v("groupEditor.merge")
296
+ children: y("groupEditor.merge")
287
297
  })] })
288
298
  ]
289
299
  })
290
300
  });
291
301
  }
292
- function Z({ label: e, kind: t, value: r, onChange: i, exclude: a, required: o, client: c }) {
293
- let { t: l } = n();
294
- return /* @__PURE__ */ U("div", {
302
+ function Q({ label: e, kind: t, value: r, onChange: i, exclude: a, required: o, client: c, management: l }) {
303
+ let { t: u } = n();
304
+ return /* @__PURE__ */ W("div", {
295
305
  className: "grid gap-1.5",
296
306
  "data-ckui": "group-field",
297
- children: [/* @__PURE__ */ U("span", {
307
+ children: [/* @__PURE__ */ W("span", {
298
308
  className: "text-sm font-medium",
299
- children: [e, o && /* @__PURE__ */ H("span", {
309
+ children: [e, o && /* @__PURE__ */ U("span", {
300
310
  "aria-hidden": !0,
301
311
  children: " *"
302
312
  })]
303
- }), r ? /* @__PURE__ */ U("div", {
313
+ }), r ? /* @__PURE__ */ W("div", {
304
314
  className: "flex flex-wrap items-center gap-2",
305
- children: [/* @__PURE__ */ H("span", {
315
+ children: [/* @__PURE__ */ U("span", {
306
316
  className: "rounded-md border border-border px-2 py-0.5",
307
317
  "data-ckui": "group-field-value",
308
318
  children: r.name || r.slug
309
- }), /* @__PURE__ */ H(s, {
319
+ }), /* @__PURE__ */ U(s, {
310
320
  type: "button",
311
321
  size: "xs",
312
322
  variant: "ghost",
313
323
  onClick: () => i(null),
314
- "aria-label": l("groupEditor.clearField", { field: e }),
315
- children: l(o ? "groupEditor.change" : "common.remove")
324
+ "aria-label": u("groupEditor.clearField", { field: e }),
325
+ children: u(o ? "groupEditor.change" : "common.remove")
316
326
  })]
317
- }) : /* @__PURE__ */ H(k, {
327
+ }) : /* @__PURE__ */ U(A, {
328
+ management: l,
318
329
  kind: t,
319
330
  label: e,
320
331
  exclude: a,
@@ -323,233 +334,270 @@ function Z({ label: e, kind: t, value: r, onChange: i, exclude: a, required: o,
323
334
  })]
324
335
  });
325
336
  }
326
- function Q({ kind: e, spec: r, languages: i, labels: a, g: o, onCreated: c, onError: l, client: u }) {
327
- let d = n(), { t: f } = d, p = R(), m = t(), [_, v] = B({}), [y, b] = B(""), [x, S] = B(!1), [C, k] = B(null), [j, M] = B(null), F = r.attributes ?? {}, [I, z] = B(() => P(F, {})), [V, W] = B(null), G = E("group.save", l), K = _[i[0]] ?? "";
328
- L(() => {
329
- x || b(O(K));
330
- }, [K, x]);
331
- let q = async () => {
332
- W(null);
337
+ function ee({ kind: e, spec: r, languages: i, labels: a, g: o, onCreated: c, onError: l, client: u, management: d }) {
338
+ let f = n(), { t: p } = f, m = z(), _ = t(), [v, y] = V({}), [b, x] = V(""), [S, C] = V(!1), [D, A] = V(!1), [M, N] = V(null), [I, L] = V(null), B = r.attributes ?? {}, [H, G] = V(() => F(B, {})), [K, q] = V(null), J = E("group.save", l), Y = v[i[0]] ?? "";
339
+ R(() => {
340
+ S || x(k(Y));
341
+ }, [Y, S]);
342
+ let X = async () => {
343
+ q(null);
333
344
  let t;
334
345
  try {
335
- t = D(F, I);
346
+ t = O(B, H);
336
347
  } catch (e) {
337
- W(e.message);
348
+ q(e.message);
338
349
  return;
339
350
  }
340
- let n = i.filter((e) => _[e]?.trim()).map((e) => ({
351
+ let n = i.filter((e) => v[e]?.trim()).map((e) => ({
341
352
  language: e,
342
353
  kind: "name",
343
- name: _[e].trim()
344
- })), r = await G.run(() => o.create({
354
+ name: v[e].trim()
355
+ })), r = await J.run(() => o.create({
345
356
  kind: e,
346
- slug: y.trim(),
357
+ slug: b.trim(),
358
+ ...d ? { internal: D } : {},
347
359
  names: n,
348
- parent_id: C?.id,
349
- scope_id: j?.id,
360
+ parent_id: M?.id,
361
+ scope_id: I?.id,
350
362
  attributes: Object.keys(t).length ? t : void 0
351
363
  }));
352
364
  r && c?.(r);
353
365
  };
354
- return /* @__PURE__ */ U("form", {
366
+ return /* @__PURE__ */ W("form", {
355
367
  className: "grid gap-4",
356
368
  "data-ckui": "group-create",
357
369
  onSubmit: (e) => {
358
- e.preventDefault(), q();
370
+ e.preventDefault(), X();
359
371
  },
360
372
  children: [
361
- /* @__PURE__ */ H("h2", {
373
+ /* @__PURE__ */ U("h2", {
362
374
  className: "text-base font-semibold",
363
- children: f("groupEditor.newTitle", { kind: A(a, e) })
375
+ children: p("groupEditor.newTitle", { kind: j(a, e) })
364
376
  }),
365
- i.map((e, t) => /* @__PURE__ */ U("div", {
377
+ i.map((e, t) => /* @__PURE__ */ W("div", {
366
378
  className: "grid gap-1.5",
367
- children: [/* @__PURE__ */ H(g, {
368
- htmlFor: `${p}-${e}`,
369
- children: f("groupEditor.nameIn", { language: m(e) })
370
- }), /* @__PURE__ */ H(h, {
371
- id: `${p}-${e}`,
379
+ children: [/* @__PURE__ */ U(g, {
380
+ htmlFor: `${m}-${e}`,
381
+ children: p("groupEditor.nameIn", { language: _(e) })
382
+ }), /* @__PURE__ */ U(h, {
383
+ id: `${m}-${e}`,
372
384
  className: "h-8",
373
385
  lang: e,
374
386
  required: t === 0,
375
- value: _[e] ?? "",
376
- onChange: (t) => v((n) => ({
387
+ value: v[e] ?? "",
388
+ onChange: (t) => y((n) => ({
377
389
  ...n,
378
390
  [e]: t.target.value
379
391
  }))
380
392
  })]
381
393
  }, e)),
382
- /* @__PURE__ */ U("div", {
394
+ /* @__PURE__ */ W("div", {
383
395
  className: "grid gap-1.5",
384
- children: [/* @__PURE__ */ H(g, {
385
- htmlFor: `${p}-slug`,
386
- children: f("groupEditor.slug")
387
- }), /* @__PURE__ */ H(h, {
388
- id: `${p}-slug`,
396
+ children: [/* @__PURE__ */ U(g, {
397
+ htmlFor: `${m}-slug`,
398
+ children: p("groupEditor.slug")
399
+ }), /* @__PURE__ */ U(h, {
400
+ id: `${m}-slug`,
389
401
  className: "h-8",
390
402
  required: !0,
391
- value: y,
403
+ value: b,
392
404
  onChange: (e) => {
393
- S(!0), b(e.target.value);
405
+ C(!0), x(e.target.value);
394
406
  }
395
407
  })]
396
408
  }),
397
- r.scoped_by && /* @__PURE__ */ H(Z, {
398
- label: A(a, r.scoped_by),
409
+ r.scoped_by && /* @__PURE__ */ U(Q, {
410
+ management: d,
411
+ label: j(a, r.scoped_by),
399
412
  kind: r.scoped_by,
400
- value: j,
401
- onChange: M,
413
+ value: I,
414
+ onChange: L,
402
415
  required: !0,
403
416
  client: u
404
417
  }),
405
- r.parent && /* @__PURE__ */ H(Z, {
406
- label: f("groupEditor.parent"),
418
+ r.parent && /* @__PURE__ */ U(Q, {
419
+ management: d,
420
+ label: p("groupEditor.parent"),
407
421
  kind: r.parent,
408
- value: C,
409
- onChange: k,
422
+ value: M,
423
+ onChange: N,
410
424
  client: u
411
425
  }),
412
- /* @__PURE__ */ H(N, {
413
- declared: F,
414
- form: I,
415
- onChange: (e, t) => z((n) => ({
426
+ d && /* @__PURE__ */ U($, {
427
+ id: `${m}-internal`,
428
+ checked: D,
429
+ onChange: A
430
+ }),
431
+ /* @__PURE__ */ U(P, {
432
+ declared: B,
433
+ form: H,
434
+ onChange: (e, t) => G((n) => ({
416
435
  ...n,
417
436
  [e]: t
418
437
  })),
419
438
  labels: a
420
439
  }),
421
- V && /* @__PURE__ */ H(w, { children: V }),
422
- G.error && /* @__PURE__ */ H(w, { children: T(d, G.error) }),
423
- /* @__PURE__ */ H(s, {
440
+ K && /* @__PURE__ */ U(w, { children: K }),
441
+ J.error && /* @__PURE__ */ U(w, { children: T(f, J.error) }),
442
+ /* @__PURE__ */ U(s, {
424
443
  type: "submit",
425
444
  className: "justify-self-start",
426
- disabled: G.pending || !K.trim() || !y.trim() || !!r.scoped_by && !j,
427
- children: G.pending ? f("common.saving") : f("groupEditor.create")
445
+ disabled: J.pending || !Y.trim() || !b.trim() || !!r.scoped_by && !I,
446
+ children: J.pending ? p("common.saving") : p("groupEditor.create")
428
447
  })
429
448
  ]
430
449
  });
431
450
  }
432
- function $({ group: e, spec: t, g: r, labels: i, onError: a, client: o }) {
433
- let { t: c } = n(), l = R(), u = t.attributes ?? {}, [d, f, p] = K(() => ({
451
+ function $({ id: e, checked: t, onChange: r }) {
452
+ let { t: i } = n();
453
+ return /* @__PURE__ */ W("div", {
454
+ className: "flex items-start gap-3",
455
+ children: [/* @__PURE__ */ U(D, {
456
+ id: e,
457
+ checked: t,
458
+ onCheckedChange: r
459
+ }), /* @__PURE__ */ W("div", {
460
+ className: "grid gap-1",
461
+ children: [/* @__PURE__ */ U(g, {
462
+ htmlFor: e,
463
+ children: i("groupEditor.internal")
464
+ }), /* @__PURE__ */ U("p", {
465
+ className: "text-xs text-muted-foreground",
466
+ children: i("groupEditor.internalHint")
467
+ })]
468
+ })]
469
+ });
470
+ }
471
+ function te({ group: e, spec: t, g: r, labels: i, onError: a, client: o, management: c }) {
472
+ let { t: l } = n(), u = z(), d = t.attributes ?? {}, [f, p, m] = q(() => ({
434
473
  slug: e.slug,
474
+ internal: e.internal ?? !1,
435
475
  parent: e.parent ?? null,
436
476
  scope: e.scope ?? null,
437
- attrs: P(u, e.attributes)
438
- }), e.revision), { slug: m, parent: _, scope: v, attrs: y } = d, b = (e) => {
439
- M(!1), f((t) => ({
477
+ attrs: F(d, e.attributes)
478
+ }), e.revision), { slug: _, internal: v, parent: y, scope: b, attrs: x } = f, S = (e) => {
479
+ I(!1), p((t) => ({
440
480
  ...t,
441
481
  ...e
442
482
  }));
443
- }, x = (e) => b({ slug: e }), S = (e) => b({ parent: e }), C = (e) => b({ scope: e }), T = (e) => b({ attrs: e(y) }), [O, k] = B(null), [j, M] = B(!1), F = E("group.save", a), I = async () => {
444
- k(null), M(!1);
483
+ }, C = (e) => S({ slug: e }), T = (e) => S({ parent: e }), D = (e) => S({ scope: e }), k = (e) => S({ attrs: e(x) }), [A, M] = V(null), [N, I] = V(!1), L = E("group.save", a), R = async () => {
484
+ M(null), I(!1);
445
485
  let e;
446
486
  try {
447
- e = D(u, y);
487
+ e = O(d, x);
448
488
  } catch (e) {
449
- k(e.message);
489
+ M(e.message);
450
490
  return;
451
491
  }
452
- await F.run(() => r.update({
453
- slug: m.trim(),
492
+ await L.run(() => r.update({
493
+ slug: _.trim(),
494
+ ...c ? { internal: v } : {},
454
495
  attributes: e,
455
- ...t.parent ? { parent_id: _?.id ?? "" } : {},
456
- ...t.scoped_by && v ? { scope_id: v.id } : {}
457
- })) && (p(), M(!0));
496
+ ...t.parent ? { parent_id: y?.id ?? "" } : {},
497
+ ...t.scoped_by && b ? { scope_id: b.id } : {}
498
+ })) && (m(), I(!0));
458
499
  };
459
- return /* @__PURE__ */ H(q, {
460
- title: c("groupEditor.details"),
500
+ return /* @__PURE__ */ U(J, {
501
+ title: l("groupEditor.details"),
461
502
  ckui: "group-details",
462
- children: /* @__PURE__ */ U("form", {
503
+ children: /* @__PURE__ */ W("form", {
463
504
  className: "grid gap-3",
464
505
  onSubmit: (e) => {
465
- e.preventDefault(), I();
506
+ e.preventDefault(), R();
466
507
  },
467
508
  children: [
468
- /* @__PURE__ */ U("div", {
509
+ /* @__PURE__ */ W("div", {
469
510
  className: "grid gap-1.5",
470
- children: [/* @__PURE__ */ H(g, {
471
- htmlFor: `${l}-slug`,
472
- children: c("groupEditor.slug")
473
- }), /* @__PURE__ */ H(h, {
474
- id: `${l}-slug`,
511
+ children: [/* @__PURE__ */ U(g, {
512
+ htmlFor: `${u}-slug`,
513
+ children: l("groupEditor.slug")
514
+ }), /* @__PURE__ */ U(h, {
515
+ id: `${u}-slug`,
475
516
  className: "h-8",
476
517
  required: !0,
477
- value: m,
478
- onChange: (e) => x(e.target.value)
518
+ value: _,
519
+ onChange: (e) => C(e.target.value)
479
520
  })]
480
521
  }),
481
- t.scoped_by && /* @__PURE__ */ H(Z, {
482
- label: A(i, t.scoped_by),
522
+ t.scoped_by && /* @__PURE__ */ U(Q, {
523
+ management: c,
524
+ label: j(i, t.scoped_by),
483
525
  kind: t.scoped_by,
484
- value: v,
485
- onChange: C,
526
+ value: b,
527
+ onChange: D,
486
528
  required: !0,
487
529
  client: o
488
530
  }),
489
- t.parent && /* @__PURE__ */ H(Z, {
490
- label: c("groupEditor.parent"),
531
+ t.parent && /* @__PURE__ */ U(Q, {
532
+ management: c,
533
+ label: l("groupEditor.parent"),
491
534
  kind: t.parent,
492
- value: _,
493
- onChange: S,
535
+ value: y,
536
+ onChange: T,
494
537
  exclude: [e.id],
495
538
  client: o
496
539
  }),
497
- /* @__PURE__ */ H(N, {
498
- declared: u,
499
- form: y,
500
- onChange: (e, t) => T((n) => ({
540
+ c && /* @__PURE__ */ U($, {
541
+ id: `${u}-internal`,
542
+ checked: v,
543
+ onChange: (e) => S({ internal: e })
544
+ }),
545
+ /* @__PURE__ */ U(P, {
546
+ declared: d,
547
+ form: x,
548
+ onChange: (e, t) => k((n) => ({
501
549
  ...n,
502
550
  [e]: t
503
551
  })),
504
552
  labels: i
505
553
  }),
506
- O && /* @__PURE__ */ H(w, { children: O }),
507
- /* @__PURE__ */ H(w, { error: F.error }),
508
- /* @__PURE__ */ U("div", {
554
+ A && /* @__PURE__ */ U(w, { children: A }),
555
+ /* @__PURE__ */ U(w, { error: L.error }),
556
+ /* @__PURE__ */ W("div", {
509
557
  className: "flex items-center gap-3",
510
- children: [/* @__PURE__ */ H(s, {
558
+ children: [/* @__PURE__ */ U(s, {
511
559
  type: "submit",
512
560
  size: "sm",
513
- disabled: F.pending || !m.trim() || !!t.scoped_by && !v,
514
- children: F.pending ? c("common.saving") : c("common.save")
515
- }), j && /* @__PURE__ */ H("span", {
561
+ disabled: L.pending || !_.trim() || !!t.scoped_by && !b,
562
+ children: L.pending ? l("common.saving") : l("common.save")
563
+ }), N && /* @__PURE__ */ U("span", {
516
564
  role: "status",
517
565
  className: "text-muted-foreground",
518
- children: c("groupEditor.saved")
566
+ children: l("groupEditor.saved")
519
567
  })]
520
568
  })
521
569
  ]
522
570
  })
523
571
  });
524
572
  }
525
- function ee({ group: e, g: r, languages: i, onError: a }) {
526
- let { t: o } = n(), c = R(), l = t(), [u, d] = B(i[0]), [f, p] = B("alias"), [S, C] = B(""), T = E("group.save", a), D = [...e.names].sort((e, t) => e.language.localeCompare(t.language) || (e.kind === t.kind ? e.name.localeCompare(t.name) : e.kind === "name" ? -1 : 1)), O = [.../* @__PURE__ */ new Set([...i, ...e.names.map((e) => e.language)])];
527
- return /* @__PURE__ */ U(q, {
573
+ function ne({ group: e, g: r, languages: i, onError: a }) {
574
+ let { t: o } = n(), c = z(), l = t(), [u, d] = V(i[0]), [f, p] = V("alias"), [S, C] = V(""), T = E("group.save", a), D = [...e.names].sort((e, t) => e.language.localeCompare(t.language) || (e.kind === t.kind ? e.name.localeCompare(t.name) : e.kind === "name" ? -1 : 1)), O = [.../* @__PURE__ */ new Set([...i, ...e.names.map((e) => e.language)])];
575
+ return /* @__PURE__ */ W(J, {
528
576
  title: o("groupEditor.names"),
529
577
  ckui: "group-names-editor",
530
578
  children: [
531
- D.length ? /* @__PURE__ */ H("ul", {
579
+ D.length ? /* @__PURE__ */ U("ul", {
532
580
  className: "grid divide-y divide-border rounded-lg border border-border",
533
- children: D.map((e) => /* @__PURE__ */ U("li", {
581
+ children: D.map((e) => /* @__PURE__ */ W("li", {
534
582
  className: "flex flex-wrap items-center gap-2 p-2.5",
535
583
  "data-ckui": "group-name",
536
584
  "data-kind": e.kind,
537
585
  "data-language": e.language,
538
586
  children: [
539
- /* @__PURE__ */ H(m, {
587
+ /* @__PURE__ */ U(m, {
540
588
  variant: "outline",
541
589
  children: l(e.language)
542
590
  }),
543
- /* @__PURE__ */ H("span", {
591
+ /* @__PURE__ */ U("span", {
544
592
  className: "min-w-0 flex-1 break-words",
545
593
  lang: e.language,
546
594
  children: e.name
547
595
  }),
548
- /* @__PURE__ */ H("span", {
596
+ /* @__PURE__ */ U("span", {
549
597
  className: "text-xs text-muted-foreground",
550
598
  children: o(e.kind === "name" ? "groupEditor.canonical" : "groupEditor.alias")
551
599
  }),
552
- e.kind === "alias" && /* @__PURE__ */ H(s, {
600
+ e.kind === "alias" && /* @__PURE__ */ U(s, {
553
601
  size: "xs",
554
602
  variant: "ghost",
555
603
  disabled: T.pending,
@@ -559,7 +607,7 @@ function ee({ group: e, g: r, languages: i, onError: a }) {
559
607
  }])),
560
608
  children: o("groupEditor.makeCanonical")
561
609
  }),
562
- /* @__PURE__ */ H(s, {
610
+ /* @__PURE__ */ U(s, {
563
611
  size: "xs",
564
612
  variant: "ghost",
565
613
  disabled: T.pending,
@@ -569,11 +617,11 @@ function ee({ group: e, g: r, languages: i, onError: a }) {
569
617
  })
570
618
  ]
571
619
  }, `${e.language}:${e.kind}:${e.name}`))
572
- }) : /* @__PURE__ */ H("p", {
620
+ }) : /* @__PURE__ */ U("p", {
573
621
  className: "text-muted-foreground",
574
622
  children: o("groupEditor.noNames")
575
623
  }),
576
- /* @__PURE__ */ U("form", {
624
+ /* @__PURE__ */ W("form", {
577
625
  className: "flex flex-wrap items-end gap-2",
578
626
  onSubmit: (e) => {
579
627
  e.preventDefault();
@@ -585,39 +633,39 @@ function ee({ group: e, g: r, languages: i, onError: a }) {
585
633
  }])).then((e) => e && C(""));
586
634
  },
587
635
  children: [
588
- O.length > 1 && /* @__PURE__ */ U(_, {
636
+ O.length > 1 && /* @__PURE__ */ W(_, {
589
637
  value: u,
590
638
  onValueChange: (e) => d(String(e)),
591
- children: [/* @__PURE__ */ H(b, {
639
+ children: [/* @__PURE__ */ U(b, {
592
640
  size: "sm",
593
641
  "aria-label": o("groupEditor.language"),
594
- children: /* @__PURE__ */ H(x, { children: (e) => l(e) })
595
- }), /* @__PURE__ */ H(v, { children: O.map((e) => /* @__PURE__ */ H(y, {
642
+ children: /* @__PURE__ */ U(x, { children: (e) => l(e) })
643
+ }), /* @__PURE__ */ U(v, { children: O.map((e) => /* @__PURE__ */ U(y, {
596
644
  value: e,
597
645
  children: l(e)
598
646
  }, e)) })]
599
647
  }),
600
- /* @__PURE__ */ U(_, {
648
+ /* @__PURE__ */ W(_, {
601
649
  value: f,
602
650
  onValueChange: (e) => p(e),
603
- children: [/* @__PURE__ */ H(b, {
651
+ children: [/* @__PURE__ */ U(b, {
604
652
  size: "sm",
605
653
  "aria-label": o("groupEditor.nameKind"),
606
- children: /* @__PURE__ */ H(x, { children: (e) => o(e === "name" ? "groupEditor.canonical" : "groupEditor.alias") })
607
- }), /* @__PURE__ */ U(v, { children: [/* @__PURE__ */ H(y, {
654
+ children: /* @__PURE__ */ U(x, { children: (e) => o(e === "name" ? "groupEditor.canonical" : "groupEditor.alias") })
655
+ }), /* @__PURE__ */ W(v, { children: [/* @__PURE__ */ U(y, {
608
656
  value: "alias",
609
657
  children: o("groupEditor.alias")
610
- }), /* @__PURE__ */ H(y, {
658
+ }), /* @__PURE__ */ U(y, {
611
659
  value: "name",
612
660
  children: o("groupEditor.canonical")
613
661
  })] })]
614
662
  }),
615
- /* @__PURE__ */ H(g, {
663
+ /* @__PURE__ */ U(g, {
616
664
  htmlFor: `${c}-name`,
617
665
  className: "sr-only",
618
666
  children: o("groupEditor.newName")
619
667
  }),
620
- /* @__PURE__ */ H(h, {
668
+ /* @__PURE__ */ U(h, {
621
669
  id: `${c}-name`,
622
670
  className: "h-8 min-w-40 flex-1",
623
671
  lang: u,
@@ -625,7 +673,7 @@ function ee({ group: e, g: r, languages: i, onError: a }) {
625
673
  placeholder: o("groupEditor.newName"),
626
674
  onChange: (e) => C(e.target.value)
627
675
  }),
628
- /* @__PURE__ */ H(s, {
676
+ /* @__PURE__ */ U(s, {
629
677
  type: "submit",
630
678
  size: "sm",
631
679
  variant: "outline",
@@ -634,12 +682,12 @@ function ee({ group: e, g: r, languages: i, onError: a }) {
634
682
  })
635
683
  ]
636
684
  }),
637
- /* @__PURE__ */ H(w, { error: T.error })
685
+ /* @__PURE__ */ U(w, { error: T.error })
638
686
  ]
639
687
  });
640
688
  }
641
- function te({ group: e, g: r, languages: i, onError: a }) {
642
- let { t: o } = n(), c = R(), l = t(), u = [.../* @__PURE__ */ new Set([...i, ...e.text.map((e) => e.language)])], [d, f, p] = K(() => Object.fromEntries(u.map((t) => [t, e.text.find((e) => e.language === t) ?? { language: t }])), e.revision), [m, _] = B(!1), v = E("group.save", a), y = (e, t) => {
689
+ function re({ group: e, g: r, languages: i, onError: a }) {
690
+ let { t: o } = n(), c = z(), l = t(), u = [.../* @__PURE__ */ new Set([...i, ...e.text.map((e) => e.language)])], [d, f, p] = q(() => Object.fromEntries(u.map((t) => [t, e.text.find((e) => e.language === t) ?? { language: t }])), e.revision), [m, _] = V(!1), v = E("group.save", a), y = (e, t) => {
643
691
  _(!1), f((n) => ({
644
692
  ...n,
645
693
  [e]: {
@@ -648,10 +696,10 @@ function te({ group: e, g: r, languages: i, onError: a }) {
648
696
  }
649
697
  }));
650
698
  };
651
- return /* @__PURE__ */ H(q, {
699
+ return /* @__PURE__ */ U(J, {
652
700
  title: o("groupEditor.text"),
653
701
  ckui: "group-text",
654
- children: /* @__PURE__ */ U("form", {
702
+ children: /* @__PURE__ */ W("form", {
655
703
  className: "grid gap-4",
656
704
  onSubmit: (e) => {
657
705
  e.preventDefault();
@@ -665,20 +713,20 @@ function te({ group: e, g: r, languages: i, onError: a }) {
665
713
  });
666
714
  },
667
715
  children: [
668
- u.map((e) => /* @__PURE__ */ U("fieldset", {
716
+ u.map((e) => /* @__PURE__ */ W("fieldset", {
669
717
  className: "grid gap-2",
670
718
  "data-language": e,
671
719
  children: [
672
- /* @__PURE__ */ H("legend", {
720
+ /* @__PURE__ */ U("legend", {
673
721
  className: "mb-1 text-xs font-medium text-muted-foreground",
674
722
  children: l(e)
675
723
  }),
676
- /* @__PURE__ */ H(g, {
724
+ /* @__PURE__ */ U(g, {
677
725
  htmlFor: `${c}-${e}-d`,
678
726
  className: "sr-only",
679
727
  children: o("groupEditor.descriptionIn", { language: l(e) })
680
728
  }),
681
- /* @__PURE__ */ H(C, {
729
+ /* @__PURE__ */ U(C, {
682
730
  id: `${c}-${e}-d`,
683
731
  lang: e,
684
732
  rows: 3,
@@ -686,12 +734,12 @@ function te({ group: e, g: r, languages: i, onError: a }) {
686
734
  value: d[e]?.description ?? "",
687
735
  onChange: (t) => y(e, { description: t.target.value })
688
736
  }),
689
- /* @__PURE__ */ H(g, {
737
+ /* @__PURE__ */ U(g, {
690
738
  htmlFor: `${c}-${e}-s`,
691
739
  className: "sr-only",
692
740
  children: o("groupEditor.sortKeyIn", { language: l(e) })
693
741
  }),
694
- /* @__PURE__ */ H(h, {
742
+ /* @__PURE__ */ U(h, {
695
743
  id: `${c}-${e}-s`,
696
744
  className: "h-8",
697
745
  lang: e,
@@ -701,15 +749,15 @@ function te({ group: e, g: r, languages: i, onError: a }) {
701
749
  })
702
750
  ]
703
751
  }, e)),
704
- /* @__PURE__ */ H(w, { error: v.error }),
705
- /* @__PURE__ */ U("div", {
752
+ /* @__PURE__ */ U(w, { error: v.error }),
753
+ /* @__PURE__ */ W("div", {
706
754
  className: "flex items-center gap-3",
707
- children: [/* @__PURE__ */ H(s, {
755
+ children: [/* @__PURE__ */ U(s, {
708
756
  type: "submit",
709
757
  size: "sm",
710
758
  disabled: v.pending,
711
759
  children: v.pending ? o("common.saving") : o("common.save")
712
- }), m && /* @__PURE__ */ H("span", {
760
+ }), m && /* @__PURE__ */ U("span", {
713
761
  role: "status",
714
762
  className: "text-muted-foreground",
715
763
  children: o("groupEditor.saved")
@@ -719,24 +767,26 @@ function te({ group: e, g: r, languages: i, onError: a }) {
719
767
  })
720
768
  });
721
769
  }
722
- function ne({ group: e, spec: t, onError: r, client: i }) {
723
- let { t: a } = n(), o = e.cover, s = o?.image ? "image" : o?.content_id && !o.auto ? "content" : "auto";
724
- return /* @__PURE__ */ U(q, {
725
- title: a(t.owner === "user" ? "groupEditor.images" : "groupEditor.cover"),
770
+ function ie({ group: e, spec: t, onError: r, client: i, management: a }) {
771
+ let { t: o } = n(), s = e.cover, c = s?.image ? "image" : s?.content_id && !s.auto ? "content" : "auto";
772
+ return /* @__PURE__ */ W(J, {
773
+ title: o(t.owner === "user" ? "groupEditor.images" : "groupEditor.cover"),
726
774
  ckui: "group-cover-editor",
727
775
  children: [
728
- /* @__PURE__ */ H("p", {
776
+ /* @__PURE__ */ U("p", {
729
777
  className: "text-muted-foreground",
730
778
  "data-ckui": "cover-mode",
731
- children: a(s === "image" ? "groupEditor.coverImage" : s === "content" ? "groupEditor.coverContent" : "groupEditor.coverAuto")
779
+ children: o(c === "image" ? "groupEditor.coverImage" : c === "content" ? "groupEditor.coverContent" : "groupEditor.coverAuto")
732
780
  }),
733
- /* @__PURE__ */ H(F, {
781
+ /* @__PURE__ */ U(I, {
782
+ management: a,
734
783
  group: e,
735
784
  slot: "cover",
736
785
  client: i,
737
786
  onError: r
738
787
  }),
739
- t.owner === "user" && /* @__PURE__ */ H(F, {
788
+ t.owner === "user" && /* @__PURE__ */ U(I, {
789
+ management: a,
740
790
  group: e,
741
791
  slot: "avatar",
742
792
  client: i,
@@ -745,116 +795,120 @@ function ne({ group: e, spec: t, onError: r, client: i }) {
745
795
  ]
746
796
  });
747
797
  }
748
- function re({ group: e, onError: t, client: r }) {
798
+ function ae({ group: e, onError: t, client: r }) {
749
799
  let { t: a } = n(), o = i(r), s = E("offer.save", t);
750
- return /* @__PURE__ */ U(q, {
800
+ return /* @__PURE__ */ W(J, {
751
801
  title: a("groupEditor.membershipPrice"),
752
802
  ckui: "group-offer",
753
- children: [/* @__PURE__ */ H(M, {
803
+ children: [/* @__PURE__ */ U(N, {
754
804
  offer: e.offer,
755
805
  pending: s.pending,
756
806
  onSell: (t) => void s.run(() => o.offers.sellGroup(e.id, t)),
757
807
  onWithdraw: () => void s.run(() => o.offers.withdrawGroup(e.id))
758
- }, e.offer?.revision), /* @__PURE__ */ H(w, { error: s.error })]
808
+ }, e.offer?.revision), /* @__PURE__ */ U(w, { error: s.error })]
759
809
  });
760
810
  }
761
- var ie = /^[a-z][a-z0-9_]*$/;
762
- function ae({ group: e, g: t, kinds: r, labels: i, onError: a, client: o }) {
763
- let { t: c } = n(), l = R(), u = E("group.save", a), d = j(e.edges.map((t) => t.from === e.id ? t.to : t.from), { client: o }), f = Object.keys(r?.entity_kinds ?? {}).sort(), [p, S] = B(""), [C, T] = B(f[0] ?? e.kind), D = e.edges.filter((t) => t.from === e.id), O = e.edges.filter((t) => t.to === e.id), M = (e) => {
764
- let t = d.get(e);
811
+ var oe = /^[a-z][a-z0-9_]*$/;
812
+ function se({ group: e, g: t, kinds: r, labels: i, onError: a, client: o, management: c }) {
813
+ let { t: l } = n(), u = z(), d = E("group.save", a), f = M(e.edges.map((t) => t.from === e.id ? t.to : t.from), {
814
+ client: o,
815
+ management: c
816
+ }), p = Object.keys(r?.entity_kinds ?? {}).sort(), [S, C] = V(""), [T, D] = V(p[0] ?? e.kind), O = e.edges.filter((t) => t.from === e.id), k = e.edges.filter((t) => t.to === e.id), N = (e) => {
817
+ let t = f.get(e);
765
818
  return t ? t.name || t.slug : e;
766
- }, N = ie.test(p.trim());
767
- return /* @__PURE__ */ U(q, {
768
- title: c("groupEditor.edges"),
819
+ }, P = oe.test(S.trim());
820
+ return /* @__PURE__ */ W(J, {
821
+ title: l("groupEditor.edges"),
769
822
  ckui: "group-edges",
770
823
  children: [
771
- D.length + O.length ? /* @__PURE__ */ U("ul", {
824
+ O.length + k.length ? /* @__PURE__ */ W("ul", {
772
825
  className: "grid gap-1.5",
773
- children: [D.map((e) => /* @__PURE__ */ U("li", {
826
+ children: [O.map((e) => /* @__PURE__ */ W("li", {
774
827
  className: "flex flex-wrap items-center gap-2",
775
828
  "data-ckui": "group-edge",
776
829
  "data-relation": e.relation,
777
830
  children: [
778
- /* @__PURE__ */ H(m, {
831
+ /* @__PURE__ */ U(m, {
779
832
  variant: "secondary",
780
- children: A(i, e.relation)
833
+ children: j(i, e.relation)
781
834
  }),
782
- /* @__PURE__ */ H("span", { children: M(e.to) }),
783
- /* @__PURE__ */ H(s, {
835
+ /* @__PURE__ */ U("span", { children: N(e.to) }),
836
+ /* @__PURE__ */ U(s, {
784
837
  size: "xs",
785
838
  variant: "ghost",
786
- disabled: u.pending,
787
- "aria-label": c("groupEditor.removeEdge", { name: M(e.to) }),
788
- onClick: () => void u.run(() => t.edges("remove", [{
839
+ disabled: d.pending,
840
+ "aria-label": l("groupEditor.removeEdge", { name: N(e.to) }),
841
+ onClick: () => void d.run(() => t.edges("remove", [{
789
842
  relation: e.relation,
790
843
  to: e.to
791
844
  }])),
792
- children: c("common.remove")
845
+ children: l("common.remove")
793
846
  })
794
847
  ]
795
- }, `${e.relation}:${e.to}`)), O.map((e) => /* @__PURE__ */ U("li", {
848
+ }, `${e.relation}:${e.to}`)), k.map((e) => /* @__PURE__ */ W("li", {
796
849
  className: "flex flex-wrap items-center gap-2 text-muted-foreground",
797
850
  "data-ckui": "group-edge",
798
851
  "data-relation": `inverse:${e.relation}`,
799
- children: [/* @__PURE__ */ H("span", {
852
+ children: [/* @__PURE__ */ U("span", {
800
853
  className: "text-foreground",
801
- children: M(e.from)
802
- }), /* @__PURE__ */ H(m, {
854
+ children: N(e.from)
855
+ }), /* @__PURE__ */ U(m, {
803
856
  variant: "outline",
804
- children: A(i, e.relation)
857
+ children: j(i, e.relation)
805
858
  })]
806
859
  }, `in:${e.relation}:${e.from}`))]
807
- }) : /* @__PURE__ */ H("p", {
860
+ }) : /* @__PURE__ */ U("p", {
808
861
  className: "text-muted-foreground",
809
- children: c("groupEditor.noEdges")
862
+ children: l("groupEditor.noEdges")
810
863
  }),
811
- /* @__PURE__ */ U("div", {
864
+ /* @__PURE__ */ W("div", {
812
865
  className: "flex flex-wrap items-end gap-2",
813
866
  children: [
814
- /* @__PURE__ */ U("div", {
867
+ /* @__PURE__ */ W("div", {
815
868
  className: "grid gap-1",
816
- children: [/* @__PURE__ */ H(g, {
817
- htmlFor: `${l}-rel`,
869
+ children: [/* @__PURE__ */ U(g, {
870
+ htmlFor: `${u}-rel`,
818
871
  className: "text-xs text-muted-foreground",
819
- children: c("groupEditor.relation")
820
- }), /* @__PURE__ */ H(h, {
821
- id: `${l}-rel`,
872
+ children: l("groupEditor.relation")
873
+ }), /* @__PURE__ */ U(h, {
874
+ id: `${u}-rel`,
822
875
  className: "h-8 w-40",
823
- value: p,
876
+ value: S,
824
877
  placeholder: "member_of",
825
- "aria-invalid": !!p && !N,
826
- onChange: (e) => S(e.target.value)
878
+ "aria-invalid": !!S && !P,
879
+ onChange: (e) => C(e.target.value)
827
880
  })]
828
881
  }),
829
- f.length > 1 && /* @__PURE__ */ U(_, {
830
- value: C,
831
- onValueChange: (e) => T(String(e)),
832
- children: [/* @__PURE__ */ H(b, {
882
+ p.length > 1 && /* @__PURE__ */ W(_, {
883
+ value: T,
884
+ onValueChange: (e) => D(String(e)),
885
+ children: [/* @__PURE__ */ U(b, {
833
886
  size: "sm",
834
- "aria-label": c("groupEditor.edgeKind"),
835
- children: /* @__PURE__ */ H(x, { children: (e) => A(i, e) })
836
- }), /* @__PURE__ */ H(v, { children: f.map((e) => /* @__PURE__ */ H(y, {
887
+ "aria-label": l("groupEditor.edgeKind"),
888
+ children: /* @__PURE__ */ U(x, { children: (e) => j(i, e) })
889
+ }), /* @__PURE__ */ U(v, { children: p.map((e) => /* @__PURE__ */ U(y, {
837
890
  value: e,
838
- children: A(i, e)
891
+ children: j(i, e)
839
892
  }, e)) })]
840
893
  }),
841
- N && /* @__PURE__ */ H(k, {
842
- kind: C,
843
- label: c("groupEditor.edgeTarget"),
894
+ P && /* @__PURE__ */ U(A, {
895
+ management: c,
896
+ kind: T,
897
+ label: l("groupEditor.edgeTarget"),
844
898
  exclude: [e.id],
845
899
  client: o,
846
- onPick: (e) => void u.run(() => t.edges("add", [{
847
- relation: p.trim(),
900
+ onPick: (e) => void d.run(() => t.edges("add", [{
901
+ relation: S.trim(),
848
902
  to: e.id
849
- }])).then((e) => e && S(""))
850
- }, C)
903
+ }])).then((e) => e && C(""))
904
+ }, T)
851
905
  ]
852
906
  }),
853
- /* @__PURE__ */ H(w, { error: u.error })
907
+ /* @__PURE__ */ U(w, { error: d.error })
854
908
  ]
855
909
  });
856
910
  }
857
911
  //#endregion
858
- export { G as GroupEditor, X as GroupMergeDialog };
912
+ export { K as GroupEditor, Z as GroupMergeDialog };
859
913
 
860
914
  //# sourceMappingURL=editor.js.map