@openrails/contentkit-ui 0.104.0 → 0.105.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.
@@ -45,7 +45,18 @@ var K = "__none__", oe = [
45
45
  "group",
46
46
  "group_ppv"
47
47
  ], q = (e) => e === "group" || e === "group_ppv";
48
- function J({ title: e, ckui: t, children: n }) {
48
+ function le(e, t) {
49
+ let n = e.kinds[t]?.access_levels, r = !n?.length || n.includes("public") ? "public" : n[0];
50
+ return {
51
+ level: r,
52
+ ...r === "tier" ? { tiers: e.tiers.slice(0, 1) } : {}
53
+ };
54
+ }
55
+ function J(e, t) {
56
+ let n = e?.kinds[t];
57
+ return !!n && (!n.access_levels?.length || n.access_levels.some((e) => e === "ppv" || e === "group_ppv"));
58
+ }
59
+ function Y({ title: e, ckui: t, children: n }) {
49
60
  return /* @__PURE__ */ G("section", {
50
61
  className: "grid gap-3 border-t border-border pt-4",
51
62
  "data-ckui": t,
@@ -55,7 +66,7 @@ function J({ title: e, ckui: t, children: n }) {
55
66
  }), n]
56
67
  });
57
68
  }
58
- function Y({ show: e }) {
69
+ function X({ show: e }) {
59
70
  let { t: n } = t();
60
71
  return e ? /* @__PURE__ */ W("span", {
61
72
  role: "status",
@@ -63,14 +74,14 @@ function Y({ show: e }) {
63
74
  children: n("contentEditor.saved")
64
75
  }) : null;
65
76
  }
66
- function X(e, t) {
77
+ function Z(e, t) {
67
78
  let { kinds: n } = i({ client: t });
68
79
  return {
69
80
  model: n,
70
81
  spec: n?.kinds[e]
71
82
  };
72
83
  }
73
- function le(e, t, n) {
84
+ function ue(e, t, n) {
74
85
  let [r, i] = H({
75
86
  id: e,
76
87
  client: t,
@@ -88,7 +99,7 @@ function le(e, t, n) {
88
99
  }
89
100
  return r.key;
90
101
  }
91
- function ue(e, t) {
102
+ function de(e, t) {
92
103
  let { client: n, store: i, scope: a, language: o } = r(t), s = V(!0);
93
104
  return z(() => (s.current = !0, () => {
94
105
  s.current = !1;
@@ -97,19 +108,19 @@ function ue(e, t) {
97
108
  return s.current && i.patch((t) => t.type === "content" && t.id === e.id && (t.readScope ?? "{}") === a, (e) => (e && e.revision > t.revision && (t = e), t)), t;
98
109
  };
99
110
  }
100
- function de(e) {
101
- let { client: t, scope: n } = r(e.client), i = le(e.content.id, t, n);
102
- return /* @__PURE__ */ W(fe, {
111
+ function fe(e) {
112
+ let { client: t, scope: n } = r(e.client), i = ue(e.content.id, t, n);
113
+ return /* @__PURE__ */ W(pe, {
103
114
  ...e,
104
115
  client: t
105
116
  }, i);
106
117
  }
107
- function fe({ content: e, ...r }) {
108
- let { t: i } = t(), a = n(r.client), { spec: o } = X(e.kind, r.client), c = B(() => o?.attributes ?? {}, [o]), l = O(B(() => ({
118
+ function pe({ content: e, ...r }) {
119
+ let { t: i } = t(), a = n(r.client), { spec: o } = Z(e.kind, r.client), c = B(() => o?.attributes ?? {}, [o]), l = O(B(() => ({
109
120
  listing: e.listing,
110
121
  comments: e.comments
111
- }), [e.listing, e.comments])), u = O(B(() => M(c, e.attributes), [c, e.attributes])), { listing: d, comments: v } = l.value, x = ue(e, r.client), [S, w] = H(null), [T, E] = H(!1), D = b("content.save", r.onError);
112
- return /* @__PURE__ */ W(J, {
122
+ }), [e.listing, e.comments])), u = O(B(() => M(c, e.attributes), [c, e.attributes])), { listing: d, comments: v } = l.value, x = de(e, r.client), [S, w] = H(null), [T, E] = H(!1), D = b("content.save", r.onError);
123
+ return /* @__PURE__ */ W(Y, {
113
124
  title: i("contentEditor.details"),
114
125
  ckui: "content-details",
115
126
  children: /* @__PURE__ */ G("form", {
@@ -158,7 +169,7 @@ function fe({ content: e, ...r }) {
158
169
  }, e)) })]
159
170
  })]
160
171
  }),
161
- /* @__PURE__ */ G("div", {
172
+ o?.comment_modes?.length !== 1 && /* @__PURE__ */ G("div", {
162
173
  className: "grid gap-1.5 sm:max-w-xs",
163
174
  children: [/* @__PURE__ */ W(f, { children: i("contentEditor.comments") }), /* @__PURE__ */ G(p, {
164
175
  value: v,
@@ -172,7 +183,7 @@ function fe({ content: e, ...r }) {
172
183
  size: "sm",
173
184
  "aria-label": i("contentEditor.comments"),
174
185
  children: /* @__PURE__ */ W(_, { children: (e) => i(`contentEditor.comments_${e}`) })
175
- }), /* @__PURE__ */ W(m, { children: se.map((e) => /* @__PURE__ */ W(h, {
186
+ }), /* @__PURE__ */ W(m, { children: se.filter((e) => !o?.comment_modes?.length || o.comment_modes.includes(e)).map((e) => /* @__PURE__ */ W(h, {
176
187
  value: e,
177
188
  children: i(`contentEditor.comments_${e}`)
178
189
  }, e)) })]
@@ -216,18 +227,18 @@ function fe({ content: e, ...r }) {
216
227
  },
217
228
  children: i("common.cancel")
218
229
  }),
219
- /* @__PURE__ */ W(Y, { show: T })
230
+ /* @__PURE__ */ W(X, { show: T })
220
231
  ]
221
232
  })
222
233
  ]
223
234
  })
224
235
  });
225
236
  }
226
- function pe({ value: e, onChange: n, model: r, kind: i, owner: a, labels: o, client: s }) {
227
- let { t: c } = t(), l = ie(), u = r?.tiers ?? [], v = r?.kinds[i], y = Object.entries(r?.entity_kinds ?? {}).filter(([, e]) => e.sellable || e.auth_scope).map(([e]) => e), [b, C] = H(), O = b ?? y[0] ?? "", ee = D(e.group_id ? [e.group_id] : [], { client: s }), k = e.group_id ? ee.get(e.group_id) : void 0, A = (t) => n({
237
+ function me({ value: e, onChange: n, model: r, kind: i, owner: a, labels: o, client: s }) {
238
+ let { t: c } = t(), l = ie(), u = r?.tiers ?? [], v = r?.kinds[i], y = v?.access_levels, b = !!y?.length && u.length === 1, C = y?.length ? ce.filter((e) => y.includes(e)) : ce, O = Object.entries(r?.entity_kinds ?? {}).filter(([, e]) => e.sellable || e.auth_scope).map(([e]) => e), [ee, k] = H(), A = ee ?? O[0] ?? "", j = D(e.group_id ? [e.group_id] : [], { client: s }), M = e.group_id ? j.get(e.group_id) : void 0, N = (t) => n({
228
239
  ...e,
229
240
  ...t
230
- }), j = v?.presentation === "reader", M = !!v?.segments;
241
+ }), P = v?.presentation === "reader", te = !!v?.segments;
231
242
  return /* @__PURE__ */ G("div", {
232
243
  className: "grid gap-3",
233
244
  "data-ckui": "rule-fields",
@@ -240,6 +251,7 @@ function pe({ value: e, onChange: n, model: r, kind: i, owner: a, labels: o, cli
240
251
  let r = t;
241
252
  n({
242
253
  level: r,
254
+ tiers: r === "tier" ? b ? [...u] : e.tiers : void 0,
243
255
  group_id: q(r) ? e.group_id || a : void 0,
244
256
  preview: e.preview,
245
257
  free_after: e.free_after
@@ -249,13 +261,13 @@ function pe({ value: e, onChange: n, model: r, kind: i, owner: a, labels: o, cli
249
261
  size: "sm",
250
262
  "aria-label": c("contentEditor.access"),
251
263
  children: /* @__PURE__ */ W(_, { children: (e) => c(`contentEditor.level_${e}`) })
252
- }), /* @__PURE__ */ W(m, { children: ce.filter((e) => (e !== "tier" || u.length) && (!e.startsWith("group") || y.length)).map((e) => /* @__PURE__ */ W(h, {
264
+ }), /* @__PURE__ */ W(m, { children: C.filter((e) => (e !== "tier" || u.length) && (!e.startsWith("group") || O.length)).map((e) => /* @__PURE__ */ W(h, {
253
265
  value: e,
254
266
  children: c(`contentEditor.level_${e}`)
255
267
  }, e)) })]
256
268
  })]
257
269
  }),
258
- e.level === "tier" && /* @__PURE__ */ G("fieldset", {
270
+ e.level === "tier" && !b && /* @__PURE__ */ G("fieldset", {
259
271
  className: "flex flex-wrap gap-3",
260
272
  children: [/* @__PURE__ */ W("legend", {
261
273
  className: "sr-only",
@@ -264,7 +276,7 @@ function pe({ value: e, onChange: n, model: r, kind: i, owner: a, labels: o, cli
264
276
  className: "flex items-center gap-2",
265
277
  children: [/* @__PURE__ */ W(x, {
266
278
  checked: e.tiers?.includes(t) ?? !1,
267
- onCheckedChange: (n) => A({ tiers: n ? [...e.tiers ?? [], t] : (e.tiers ?? []).filter((e) => e !== t) }),
279
+ onCheckedChange: (n) => N({ tiers: n ? [...e.tiers ?? [], t] : (e.tiers ?? []).filter((e) => e !== t) }),
268
280
  "aria-label": E(o, t)
269
281
  }), E(o, t)]
270
282
  }, t))]
@@ -272,35 +284,35 @@ function pe({ value: e, onChange: n, model: r, kind: i, owner: a, labels: o, cli
272
284
  q(e.level) && /* @__PURE__ */ G("div", {
273
285
  className: "flex flex-wrap items-end gap-2",
274
286
  children: [
275
- k || e.group_id ? /* @__PURE__ */ W("span", {
287
+ M || e.group_id ? /* @__PURE__ */ W("span", {
276
288
  className: "rounded-md border border-border px-2 py-0.5",
277
289
  "data-ckui": "rule-group",
278
- children: k ? k.name || k.slug : e.group_id
290
+ children: M ? M.name || M.slug : e.group_id
279
291
  }) : null,
280
- y.length > 1 && /* @__PURE__ */ G(p, {
281
- value: O,
282
- onValueChange: (e) => C(String(e)),
292
+ O.length > 1 && /* @__PURE__ */ G(p, {
293
+ value: A,
294
+ onValueChange: (e) => k(String(e)),
283
295
  children: [/* @__PURE__ */ W(g, {
284
296
  size: "sm",
285
297
  "aria-label": c("groupEditor.edgeKind"),
286
298
  children: /* @__PURE__ */ W(_, { children: (e) => E(o, e) })
287
- }), /* @__PURE__ */ W(m, { children: y.map((e) => /* @__PURE__ */ W(h, {
299
+ }), /* @__PURE__ */ W(m, { children: O.map((e) => /* @__PURE__ */ W(h, {
288
300
  value: e,
289
301
  children: E(o, e)
290
302
  }, e)) })]
291
303
  }),
292
- O && /* @__PURE__ */ W(T, {
293
- kind: O,
304
+ A && /* @__PURE__ */ W(T, {
305
+ kind: A,
294
306
  label: c("contentEditor.group"),
295
307
  client: s,
296
- onPick: (e) => A({ group_id: e.id })
297
- }, O)
308
+ onPick: (e) => N({ group_id: e.id })
309
+ }, A)
298
310
  ]
299
311
  }),
300
312
  e.level !== "public" && /* @__PURE__ */ G("div", {
301
313
  className: "grid gap-3 sm:grid-cols-3",
302
314
  children: [
303
- j && /* @__PURE__ */ G("div", {
315
+ P && /* @__PURE__ */ G("div", {
304
316
  className: "grid gap-1.5",
305
317
  children: [/* @__PURE__ */ W(f, {
306
318
  htmlFor: `${l}-pages`,
@@ -311,13 +323,13 @@ function pe({ value: e, onChange: n, model: r, kind: i, owner: a, labels: o, cli
311
323
  type: "number",
312
324
  min: 0,
313
325
  value: e.preview?.pages ?? "",
314
- onChange: (t) => A({ preview: {
326
+ onChange: (t) => N({ preview: {
315
327
  ...e.preview,
316
328
  pages: t.target.value ? Math.max(0, Math.trunc(Number(t.target.value))) : void 0
317
329
  } })
318
330
  })]
319
331
  }),
320
- M && /* @__PURE__ */ G("div", {
332
+ te && /* @__PURE__ */ G("div", {
321
333
  className: "grid gap-1.5",
322
334
  children: [/* @__PURE__ */ W(f, {
323
335
  htmlFor: `${l}-segments`,
@@ -328,7 +340,7 @@ function pe({ value: e, onChange: n, model: r, kind: i, owner: a, labels: o, cli
328
340
  type: "number",
329
341
  min: 0,
330
342
  value: e.preview?.segments ?? "",
331
- onChange: (t) => A({ preview: {
343
+ onChange: (t) => N({ preview: {
332
344
  ...e.preview,
333
345
  segments: t.target.value ? Math.max(0, Math.trunc(Number(t.target.value))) : void 0
334
346
  } })
@@ -344,7 +356,7 @@ function pe({ value: e, onChange: n, model: r, kind: i, owner: a, labels: o, cli
344
356
  className: "h-8",
345
357
  type: "datetime-local",
346
358
  value: w(e.free_after),
347
- onChange: (e) => A({ free_after: S(e.target.value) })
359
+ onChange: (e) => N({ free_after: S(e.target.value) })
348
360
  })]
349
361
  })
350
362
  ]
@@ -352,8 +364,8 @@ function pe({ value: e, onChange: n, model: r, kind: i, owner: a, labels: o, cli
352
364
  ]
353
365
  });
354
366
  }
355
- var Z = (e) => !q(e.level) || !!e.group_id;
356
- function me(e) {
367
+ var Q = (e) => !q(e.level) || !!e.group_id;
368
+ function he(e) {
357
369
  let t = e.preview && (e.preview.pages || e.preview.segments) ? {
358
370
  pages: e.preview.pages || void 0,
359
371
  segments: e.preview.segments || void 0
@@ -366,17 +378,17 @@ function me(e) {
366
378
  free_after: e.level === "public" ? void 0 : e.free_after
367
379
  };
368
380
  }
369
- function he(e) {
370
- let { client: t, scope: n } = r(e.client), i = le(e.content.id, t, n);
371
- return /* @__PURE__ */ W(ge, {
381
+ function ge(e) {
382
+ let { client: t, scope: n } = r(e.client), i = ue(e.content.id, t, n);
383
+ return /* @__PURE__ */ W(_e, {
372
384
  ...e,
373
385
  client: t
374
386
  }, i);
375
387
  }
376
- function ge({ content: e, ...r }) {
377
- let { t: i } = t(), a = n(r.client), { model: o } = X(e.kind, r.client), c = O(e.access), l = ue(e, r.client), [u, d] = H(!1), f = b("content.save", r.onError), p = b("offer.save", r.onError);
378
- return /* @__PURE__ */ G(J, {
379
- title: i("contentEditor.accessTitle"),
388
+ function _e({ content: e, ...r }) {
389
+ let { t: i } = t(), a = n(r.client), { model: o } = Z(e.kind, r.client), c = O(e.access), l = de(e, r.client), [u, d] = H(!1), f = b("content.save", r.onError), p = b("offer.save", r.onError);
390
+ return /* @__PURE__ */ G(Y, {
391
+ title: i(J(o, e.kind) ? "contentEditor.accessTitle" : "contentEditor.accessOnlyTitle"),
380
392
  ckui: "access-editor",
381
393
  children: [
382
394
  /* @__PURE__ */ G("form", {
@@ -385,12 +397,12 @@ function ge({ content: e, ...r }) {
385
397
  t.preventDefault(), d(!1);
386
398
  let n = c.checkpoint();
387
399
  f.run(() => a.contents.update(e.id, {
388
- access: me(c.value),
400
+ access: he(c.value),
389
401
  revision: e.revision
390
402
  })).then((e) => e && d(n(e.access)));
391
403
  },
392
404
  children: [
393
- /* @__PURE__ */ W(pe, {
405
+ /* @__PURE__ */ W(me, {
394
406
  value: c.value,
395
407
  onChange: (e) => {
396
408
  c.edit(e), d(!1);
@@ -408,7 +420,7 @@ function ge({ content: e, ...r }) {
408
420
  /* @__PURE__ */ W(s, {
409
421
  type: "submit",
410
422
  size: "sm",
411
- disabled: f.pending || !Z(c.value),
423
+ disabled: f.pending || !Q(c.value),
412
424
  children: f.pending ? i("common.saving") : i("common.save")
413
425
  }),
414
426
  /* @__PURE__ */ W(s, {
@@ -424,12 +436,12 @@ function ge({ content: e, ...r }) {
424
436
  },
425
437
  children: i("common.cancel")
426
438
  }),
427
- /* @__PURE__ */ W(Y, { show: u })
439
+ /* @__PURE__ */ W(X, { show: u })
428
440
  ]
429
441
  })
430
442
  ]
431
443
  }),
432
- /* @__PURE__ */ W(A, {
444
+ J(o, e.kind) && /* @__PURE__ */ W(A, {
433
445
  offer: e.offer,
434
446
  pending: p.pending,
435
447
  onSell: (t) => p.run(() => a.offers.sell({ content: e.id }, t)),
@@ -439,11 +451,11 @@ function ge({ content: e, ...r }) {
439
451
  ]
440
452
  });
441
453
  }
442
- function Q(e, t, n) {
454
+ function $(e, t, n) {
443
455
  return e.label || [...e.languages.map(t), ...e.traits.map((e) => E(n, e))].join(" · ");
444
456
  }
445
- function _e({ content: r, media: i = !0, activeVersion: a, ...o }) {
446
- let { t: l } = t(), d = n(o.client), f = e(), { model: p, spec: m } = X(r.kind, o.client), h = b("content.save", o.onError), g = b("content.save", o.onError), [_, v] = H(null), [x, S] = H([]), C = (e) => {
457
+ function ve({ content: r, media: i = !0, activeVersion: a, ...o }) {
458
+ let { t: l } = t(), d = n(o.client), f = e(), { model: p, spec: m } = Z(r.kind, o.client), h = b("content.save", o.onError), g = b("content.save", o.onError), [_, v] = H(null), [x, S] = H([]), C = (e) => {
447
459
  v(e), S((t) => t.includes(e) ? t : [...t, e]);
448
460
  };
449
461
  z(() => {
@@ -459,14 +471,14 @@ function _e({ content: r, media: i = !0, activeVersion: a, ...o }) {
459
471
  if (!m) return null;
460
472
  if (m.versions.hidden) {
461
473
  let e = w[0];
462
- return !e || !i && !m.segments ? null : /* @__PURE__ */ G(J, {
474
+ return !e || !i && !m.segments ? null : /* @__PURE__ */ G(Y, {
463
475
  title: l("contentEditor.media"),
464
476
  ckui: "version-media",
465
- children: [m.segments && /* @__PURE__ */ W($, {
477
+ children: [m.segments && /* @__PURE__ */ W(Te, {
466
478
  content: r,
467
479
  version: e,
468
480
  ...o
469
- }), i && /* @__PURE__ */ W(Se, {
481
+ }), i && /* @__PURE__ */ W(Ce, {
470
482
  content: r,
471
483
  version: e,
472
484
  model: p,
@@ -475,14 +487,14 @@ function _e({ content: r, media: i = !0, activeVersion: a, ...o }) {
475
487
  });
476
488
  }
477
489
  let T = p?.languages ?? [];
478
- return /* @__PURE__ */ G(J, {
490
+ return /* @__PURE__ */ G(Y, {
479
491
  title: l("contentEditor.versions"),
480
492
  ckui: "versions-editor",
481
493
  children: [
482
494
  /* @__PURE__ */ W(c, {
483
495
  items: w,
484
496
  id: (e) => e.id,
485
- name: (e) => Q(e, f, o.labels),
497
+ name: (e) => $(e, f, o.labels),
486
498
  label: l("contentEditor.versions"),
487
499
  disabled: h.pending || w.length < 2,
488
500
  onMove: (e, t) => {
@@ -499,7 +511,7 @@ function _e({ content: r, media: i = !0, activeVersion: a, ...o }) {
499
511
  w.length > 1 && t,
500
512
  /* @__PURE__ */ W("span", {
501
513
  className: "min-w-0 flex-1 font-medium break-words",
502
- children: Q(e, f, o.labels)
514
+ children: $(e, f, o.labels)
503
515
  }),
504
516
  /* @__PURE__ */ W(u, {
505
517
  variant: e.live ? "default" : "outline",
@@ -524,7 +536,7 @@ function _e({ content: r, media: i = !0, activeVersion: a, ...o }) {
524
536
  ]
525
537
  }), x.includes(e.id) && /* @__PURE__ */ W("div", {
526
538
  hidden: _ !== e.id,
527
- children: /* @__PURE__ */ W(be, {
539
+ children: /* @__PURE__ */ W(xe, {
528
540
  content: r,
529
541
  version: e,
530
542
  model: p,
@@ -535,7 +547,7 @@ function _e({ content: r, media: i = !0, activeVersion: a, ...o }) {
535
547
  })
536
548
  }),
537
549
  /* @__PURE__ */ W(y, { error: h.error }),
538
- /* @__PURE__ */ W(ye, {
550
+ /* @__PURE__ */ W(be, {
539
551
  languages: T,
540
552
  many: m?.versions.languages === "many",
541
553
  pending: g.pending,
@@ -545,7 +557,7 @@ function _e({ content: r, media: i = !0, activeVersion: a, ...o }) {
545
557
  ]
546
558
  });
547
559
  }
548
- function ve({ languages: n, value: r, many: i, onChange: a }) {
560
+ function ye({ languages: n, value: r, many: i, onChange: a }) {
549
561
  let { t: o } = t(), s = e();
550
562
  return i ? /* @__PURE__ */ G("fieldset", {
551
563
  className: "flex flex-wrap gap-3",
@@ -574,12 +586,12 @@ function ve({ languages: n, value: r, many: i, onChange: a }) {
574
586
  }, e)) })]
575
587
  });
576
588
  }
577
- function ye({ languages: e, many: n, pending: r, onAdd: i }) {
589
+ function be({ languages: e, many: n, pending: r, onAdd: i }) {
578
590
  let { t: a } = t(), [o, c] = H([]);
579
591
  return /* @__PURE__ */ G("div", {
580
592
  className: "flex flex-wrap items-center gap-2",
581
593
  "data-ckui": "add-version",
582
- children: [/* @__PURE__ */ W(ve, {
594
+ children: [/* @__PURE__ */ W(ye, {
583
595
  languages: e,
584
596
  value: o,
585
597
  many: n,
@@ -596,7 +608,7 @@ function ye({ languages: e, many: n, pending: r, onAdd: i }) {
596
608
  })]
597
609
  });
598
610
  }
599
- function be({ content: e, version: r, model: i, media: a, ...o }) {
611
+ function xe({ content: e, version: r, model: i, media: a, ...o }) {
600
612
  let { t: c } = t(), l = ie(), u = n(o.client), p = i?.kinds[e.kind], m = re((t) => ({
601
613
  langs: t.languages,
602
614
  traits: t.traits,
@@ -610,7 +622,7 @@ function be({ content: e, version: r, model: i, media: a, ...o }) {
610
622
  ...t,
611
623
  ...e
612
624
  })), F(!1);
613
- }, [N, P] = H(null), [te, F] = H(!1), I = b("content.save", o.onError), L = b("content.save", o.onError), R = b("offer.save", o.onError), z = g.length > 0 && (!D || Z(j)), V = async () => {
625
+ }, [N, P] = H(null), [te, F] = H(!1), I = b("content.save", o.onError), L = b("content.save", o.onError), R = b("offer.save", o.onError), z = g.length > 0 && (!D || Q(j)), V = async () => {
614
626
  if (!z) return !1;
615
627
  if (P(null), F(!1), p?.presentation === "reader" && r.state === "draft" && !C && !await ee(u, {
616
628
  kind: e.kind,
@@ -623,7 +635,7 @@ function be({ content: e, version: r, model: i, media: a, ...o }) {
623
635
  label: v.trim(),
624
636
  state: C ? "draft" : "published",
625
637
  publish_at: S(T),
626
- ...D ? { access: me(j) } : { clear_access: !!r.access }
638
+ ...D ? { access: he(j) } : { clear_access: !!r.access }
627
639
  }));
628
640
  if (!n) return !1;
629
641
  let i = t(m(n));
@@ -645,7 +657,7 @@ function be({ content: e, version: r, model: i, media: a, ...o }) {
645
657
  e.preventDefault(), V();
646
658
  },
647
659
  children: [
648
- /* @__PURE__ */ W(ve, {
660
+ /* @__PURE__ */ W(ye, {
649
661
  languages: i?.languages ?? [],
650
662
  value: g,
651
663
  many: p?.versions.languages === "many",
@@ -709,7 +721,7 @@ function be({ content: e, version: r, model: i, media: a, ...o }) {
709
721
  onCheckedChange: (e) => M({ own: e })
710
722
  }), c("contentEditor.ownAccess")]
711
723
  }),
712
- D && /* @__PURE__ */ W(pe, {
724
+ D && /* @__PURE__ */ W(me, {
713
725
  value: j,
714
726
  onChange: (e) => M({ rule: e }),
715
727
  model: i,
@@ -726,10 +738,10 @@ function be({ content: e, version: r, model: i, media: a, ...o }) {
726
738
  /* @__PURE__ */ W(s, {
727
739
  type: "submit",
728
740
  size: "sm",
729
- disabled: I.pending || !g.length || D && !Z(j),
741
+ disabled: I.pending || !g.length || D && !Q(j),
730
742
  children: I.pending ? c("common.saving") : c("common.save")
731
743
  }),
732
- /* @__PURE__ */ W(Y, { show: te }),
744
+ /* @__PURE__ */ W(X, { show: te }),
733
745
  /* @__PURE__ */ W(s, {
734
746
  type: "button",
735
747
  size: "sm",
@@ -744,7 +756,7 @@ function be({ content: e, version: r, model: i, media: a, ...o }) {
744
756
  /* @__PURE__ */ W(y, { error: L.error })
745
757
  ]
746
758
  }),
747
- /* @__PURE__ */ W(A, {
759
+ J(i, e.kind) && /* @__PURE__ */ W(A, {
748
760
  offer: r.offer,
749
761
  pending: R.pending,
750
762
  onSell: (t) => R.run(() => u.offers.sell({
@@ -757,17 +769,17 @@ function be({ content: e, version: r, model: i, media: a, ...o }) {
757
769
  }))
758
770
  }),
759
771
  /* @__PURE__ */ W(y, { error: R.error }),
760
- p?.segments && /* @__PURE__ */ W($, {
772
+ p?.segments && /* @__PURE__ */ W(Te, {
761
773
  content: e,
762
774
  version: r,
763
775
  ...o
764
776
  }),
765
- a && /* @__PURE__ */ W(xe, {
777
+ a && /* @__PURE__ */ W(Se, {
766
778
  content: e,
767
779
  version: r,
768
780
  ...o
769
781
  }),
770
- a && /* @__PURE__ */ W(Se, {
782
+ a && /* @__PURE__ */ W(Ce, {
771
783
  content: e,
772
784
  version: r,
773
785
  model: i,
@@ -782,7 +794,7 @@ function be({ content: e, version: r, model: i, media: a, ...o }) {
782
794
  ]
783
795
  });
784
796
  }
785
- function xe({ content: e, version: r, ...i }) {
797
+ function Se({ content: e, version: r, ...i }) {
786
798
  let { t: a } = t(), c = n(i.client), { presets: l } = o({ client: c }), u = b("content.save", i.onError), d = V(null), [f, p] = H(null);
787
799
  if (z(() => () => void (f && URL.revokeObjectURL(f)), [f]), !l.some((t) => t.kind === e.kind && t.name === "cover")) return null;
788
800
  let m = f ?? r.cover?.url, h = (t) => void u.run(async () => {
@@ -846,7 +858,7 @@ function xe({ content: e, version: r, ...i }) {
846
858
  ]
847
859
  });
848
860
  }
849
- function Se({ content: n, version: r, model: i, ...o }) {
861
+ function Ce({ content: n, version: r, model: i, ...o }) {
850
862
  let { t: s } = t(), c = e(), u = B(() => ({
851
863
  kind: n.kind,
852
864
  id: n.id,
@@ -880,14 +892,14 @@ function Se({ content: n, version: r, model: i, ...o }) {
880
892
  onError: o.onError
881
893
  })] });
882
894
  }
883
- var Ce = (e) => e.segments.map((e) => ({
895
+ var we = (e) => e.segments.map((e) => ({
884
896
  title: e.title ?? "",
885
897
  start: String(e.start),
886
898
  end: String(e.end),
887
899
  release: w(e.release_at)
888
900
  }));
889
- function $({ content: e, version: r, ...i }) {
890
- let { t: a } = t(), o = n(i.client), c = O(B(() => ({ rows: Ce(r) }), [r])), l = c.value.rows, u = (e) => c.edit((t) => ({ rows: typeof e == "function" ? e(t.rows) : e })), [f, p] = H(!1), m = b("content.save", i.onError), h = N(e.id, r.id, { client: o }), { pages: g } = te(h.plan, o), _ = (e, t) => {
901
+ function Te({ content: e, version: r, ...i }) {
902
+ let { t: a } = t(), o = n(i.client), c = O(B(() => ({ rows: we(r) }), [r])), l = c.value.rows, u = (e) => c.edit((t) => ({ rows: typeof e == "function" ? e(t.rows) : e })), [f, p] = H(!1), m = b("content.save", i.onError), h = N(e.id, r.id, { client: o }), { pages: g } = te(h.plan, o), _ = (e, t) => {
891
903
  p(!1), u((n) => n.map((n, r) => r === e ? {
892
904
  ...n,
893
905
  ...t
@@ -904,7 +916,7 @@ function $({ content: e, version: r, ...i }) {
904
916
  released: !1
905
917
  })), i = await m.run(() => o.contents.setSegments(e.id, r.id, n));
906
918
  if (!i) return !1;
907
- let a = t({ rows: Ce(i) });
919
+ let a = t({ rows: we(i) });
908
920
  return p(a), a;
909
921
  };
910
922
  return k(`segments:${r.id}`, {
@@ -1021,35 +1033,35 @@ function $({ content: e, version: r, ...i }) {
1021
1033
  onClick: () => void x(),
1022
1034
  children: a("contentEditor.saveSegments")
1023
1035
  }),
1024
- /* @__PURE__ */ W(Y, { show: f })
1036
+ /* @__PURE__ */ W(X, { show: f })
1025
1037
  ]
1026
1038
  }),
1027
1039
  /* @__PURE__ */ W(y, { error: m.error })
1028
1040
  ]
1029
1041
  });
1030
1042
  }
1031
- function we({ content: t, ...n }) {
1043
+ function Ee({ content: t, ...n }) {
1032
1044
  let r = e(), i = B(() => t.versions.map((e) => ({
1033
1045
  id: e.id,
1034
- label: Q(e, r, n.labels)
1046
+ label: $(e, r, n.labels)
1035
1047
  })), [
1036
1048
  t.versions,
1037
1049
  r,
1038
1050
  n.labels
1039
- ]), { spec: a } = X(t.kind, n.client);
1051
+ ]), { spec: a } = Z(t.kind, n.client);
1040
1052
  return /* @__PURE__ */ G("div", {
1041
1053
  className: ae("grid gap-6", n.className),
1042
1054
  "data-ckui": "content-sections",
1043
1055
  children: [
1044
- /* @__PURE__ */ W(de, {
1056
+ /* @__PURE__ */ W(fe, {
1045
1057
  content: t,
1046
1058
  ...n
1047
1059
  }),
1048
- /* @__PURE__ */ W(he, {
1060
+ /* @__PURE__ */ W(ge, {
1049
1061
  content: t,
1050
1062
  ...n
1051
1063
  }),
1052
- /* @__PURE__ */ W(_e, {
1064
+ /* @__PURE__ */ W(ve, {
1053
1065
  content: t,
1054
1066
  ...n
1055
1067
  }),
@@ -1070,6 +1082,6 @@ function we({ content: t, ...n }) {
1070
1082
  });
1071
1083
  }
1072
1084
  //#endregion
1073
- export { he as AccessEditor, de as ContentDetailsEditor, we as ContentSections, pe as RuleFields, $ as SegmentsEditor, xe as VersionCover, _e as VersionsEditor, me as cleanRule, Z as complete, Q as versionLabel };
1085
+ export { ge as AccessEditor, fe as ContentDetailsEditor, Ee as ContentSections, me as RuleFields, Te as SegmentsEditor, Se as VersionCover, ve as VersionsEditor, J as allowsIndividualSales, he as cleanRule, Q as complete, le as defaultAccessRule, $ as versionLabel };
1074
1086
 
1075
1087
  //# sourceMappingURL=editors.js.map