@nice2dev/social 1.2.1 → 1.3.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.
package/dist/index.mjs CHANGED
@@ -1,181 +1,182 @@
1
- import { jsxs as l, jsx as e, Fragment as H } from "react/jsx-runtime";
2
- import { forwardRef as W, useState as L, useCallback as D, useMemo as P } from "react";
3
- const X = /* @__PURE__ */ W(
4
- function(u, A) {
5
- const {
6
- comments: m,
1
+ import { jsxs as r, jsx as e, Fragment as q } from "react/jsx-runtime";
2
+ import { useNiceTranslation as U } from "@nice2dev/ui-core";
3
+ import { forwardRef as O, useState as T, useCallback as W, useMemo as M } from "react";
4
+ const ie = /* @__PURE__ */ O(
5
+ function(_, L) {
6
+ const { t: c } = U(), {
7
+ comments: h,
7
8
  currentUserId: s,
8
- onSubmit: o,
9
- onEdit: _,
10
- onDelete: N,
11
- onReact: r,
12
- readOnly: w = !1,
13
- maxDepth: E = 4,
14
- reactions: $ = ["👍", "❤️", "😂", "😮", "😢"],
15
- placeholder: k = "Write a comment…",
16
- className: C,
17
- style: x
18
- } = u, [v, i] = L(""), [h, g] = L(null), [n, t] = L(""), [c, a] = L(null), [b, T] = L(""), F = /* @__PURE__ */ new Map();
19
- for (const d of m) {
20
- const M = d.parentId ?? "__root__";
21
- F.has(M) || F.set(M, []), F.get(M).push(d);
9
+ onSubmit: d,
10
+ onEdit: p,
11
+ onDelete: y,
12
+ onReact: o,
13
+ readOnly: C = !1,
14
+ maxDepth: $ = 4,
15
+ reactions: E = ["👍", "❤️", "😂", "😮", "😢"],
16
+ placeholder: w = c("comments.writeAComment", "Write a comment…"),
17
+ className: x,
18
+ style: S
19
+ } = _, [g, i] = T(""), [u, N] = T(null), [n, t] = T(""), [l, a] = T(null), [k, F] = T(""), I = /* @__PURE__ */ new Map();
20
+ for (const m of h) {
21
+ const D = m.parentId ?? "__root__";
22
+ I.has(D) || I.set(D, []), I.get(D).push(m);
22
23
  }
23
- const z = D(() => {
24
- !v.trim() || !o || (o(v.trim()), i(""));
25
- }, [v, o]), R = D(() => {
26
- !n.trim() || !o || !h || (o(n.trim(), h), t(""), g(null));
27
- }, [n, h, o]), S = D(() => {
28
- !c || !b.trim() || !_ || (_(c, b.trim()), a(null), T(""));
29
- }, [c, b, _]), O = (d, M) => {
30
- const j = s && d.authorId === s, p = F.get(d.id) ?? [];
31
- return /* @__PURE__ */ l("div", { className: "nice-comments__item", style: { marginLeft: M * 24 }, children: [
32
- /* @__PURE__ */ l("div", { className: "nice-comments__header", children: [
33
- d.authorAvatarUrl && /* @__PURE__ */ e("img", { src: d.authorAvatarUrl, alt: "", className: "nice-comments__avatar" }),
34
- /* @__PURE__ */ e("strong", { className: "nice-comments__author", children: d.authorName }),
35
- /* @__PURE__ */ e("time", { className: "nice-comments__time", children: d.createdAt }),
36
- d.isEdited && /* @__PURE__ */ e("span", { className: "nice-comments__edited", children: "(edited)" })
24
+ const z = W(() => {
25
+ !g.trim() || !d || (d(g.trim()), i(""));
26
+ }, [g, d]), B = W(() => {
27
+ !n.trim() || !d || !u || (d(n.trim(), u), t(""), N(null));
28
+ }, [n, u, d]), A = W(() => {
29
+ !l || !k.trim() || !p || (p(l, k.trim()), a(null), F(""));
30
+ }, [l, k, p]), R = (m, D) => {
31
+ const j = s && m.authorId === s, v = I.get(m.id) ?? [];
32
+ return /* @__PURE__ */ r("div", { className: "nice-comments__item", style: { marginLeft: D * 24 }, children: [
33
+ /* @__PURE__ */ r("div", { className: "nice-comments__header", children: [
34
+ m.authorAvatarUrl && /* @__PURE__ */ e("img", { src: m.authorAvatarUrl, alt: "", className: "nice-comments__avatar" }),
35
+ /* @__PURE__ */ e("strong", { className: "nice-comments__author", children: m.authorName }),
36
+ /* @__PURE__ */ e("time", { className: "nice-comments__time", children: m.createdAt }),
37
+ m.isEdited && /* @__PURE__ */ e("span", { className: "nice-comments__edited", children: c("comments.edited", "(edited)") })
37
38
  ] }),
38
- c === d.id ? /* @__PURE__ */ l("div", { className: "nice-comments__edit-form", children: [
39
- /* @__PURE__ */ e("textarea", { value: b, onChange: (y) => T(y.target.value) }),
40
- /* @__PURE__ */ e("button", { onClick: S, children: "Save" }),
41
- /* @__PURE__ */ e("button", { onClick: () => a(null), children: "Cancel" })
42
- ] }) : /* @__PURE__ */ e("p", { className: "nice-comments__content", children: d.isDeleted ? /* @__PURE__ */ e("em", { children: "Comment deleted" }) : d.content }),
43
- !d.isDeleted && d.reactions && /* @__PURE__ */ e("div", { className: "nice-comments__reactions", children: Object.entries(d.reactions).map(([y, f]) => /* @__PURE__ */ l(
39
+ l === m.id ? /* @__PURE__ */ r("div", { className: "nice-comments__edit-form", children: [
40
+ /* @__PURE__ */ e("textarea", { value: k, onChange: (b) => F(b.target.value) }),
41
+ /* @__PURE__ */ e("button", { onClick: A, children: c("comments.save", "Save") }),
42
+ /* @__PURE__ */ e("button", { onClick: () => a(null), children: c("comments.cancel", "Cancel") })
43
+ ] }) : /* @__PURE__ */ e("p", { className: "nice-comments__content", children: m.isDeleted ? /* @__PURE__ */ e("em", { children: c("comments.commentDeleted", "Comment deleted") }) : m.content }),
44
+ !m.isDeleted && m.reactions && /* @__PURE__ */ e("div", { className: "nice-comments__reactions", children: Object.entries(m.reactions).map(([b, f]) => /* @__PURE__ */ r(
44
45
  "button",
45
46
  {
46
47
  className: "nice-comments__reaction",
47
- onClick: () => r == null ? void 0 : r(d.id, y),
48
+ onClick: () => o == null ? void 0 : o(m.id, b),
48
49
  children: [
49
- y,
50
+ b,
50
51
  " ",
51
52
  f
52
53
  ]
53
54
  },
54
- y
55
+ b
55
56
  )) }),
56
- !d.isDeleted && !w && /* @__PURE__ */ l("div", { className: "nice-comments__actions", children: [
57
- r && $.map((y) => /* @__PURE__ */ e("button", { onClick: () => r(d.id, y), title: y, children: y }, y)),
58
- M < E && /* @__PURE__ */ e(
57
+ !m.isDeleted && !C && /* @__PURE__ */ r("div", { className: "nice-comments__actions", children: [
58
+ o && E.map((b) => /* @__PURE__ */ e("button", { onClick: () => o(m.id, b), title: b, children: b }, b)),
59
+ D < $ && /* @__PURE__ */ e(
59
60
  "button",
60
61
  {
61
62
  onClick: () => {
62
- g(d.id), t("");
63
+ N(m.id), t("");
63
64
  },
64
- children: "Reply"
65
+ children: c("comments.reply", "Reply")
65
66
  }
66
67
  ),
67
- j && _ && /* @__PURE__ */ e(
68
+ j && p && /* @__PURE__ */ e(
68
69
  "button",
69
70
  {
70
71
  onClick: () => {
71
- a(d.id), T(d.content);
72
+ a(m.id), F(m.content);
72
73
  },
73
- children: "Edit"
74
+ children: c("comments.edit", "Edit")
74
75
  }
75
76
  ),
76
- j && N && /* @__PURE__ */ e("button", { onClick: () => N(d.id), children: "Delete" })
77
+ j && y && /* @__PURE__ */ e("button", { onClick: () => y(m.id), children: c("comments.delete", "Delete") })
77
78
  ] }),
78
- h === d.id && /* @__PURE__ */ l("div", { className: "nice-comments__reply-form", children: [
79
+ u === m.id && /* @__PURE__ */ r("div", { className: "nice-comments__reply-form", children: [
79
80
  /* @__PURE__ */ e(
80
81
  "textarea",
81
82
  {
82
83
  value: n,
83
- onChange: (y) => t(y.target.value),
84
- placeholder: "Write a reply…"
84
+ onChange: (b) => t(b.target.value),
85
+ placeholder: c("comments.writeAReply", "Write a reply…")
85
86
  }
86
87
  ),
87
- /* @__PURE__ */ e("button", { onClick: R, disabled: !n.trim(), children: "Send" }),
88
- /* @__PURE__ */ e("button", { onClick: () => g(null), children: "Cancel" })
88
+ /* @__PURE__ */ e("button", { onClick: B, disabled: !n.trim(), children: c("comments.send", "Send") }),
89
+ /* @__PURE__ */ e("button", { onClick: () => N(null), children: c("comments.cancel", "Cancel") })
89
90
  ] }),
90
- p.map((y) => O(y, M + 1))
91
- ] }, d.id);
92
- }, U = F.get("__root__") ?? [];
93
- return /* @__PURE__ */ l("div", { ref: A, className: `nice-comments ${C ?? ""}`, style: x, children: [
94
- !w && /* @__PURE__ */ l("div", { className: "nice-comments__new", children: [
91
+ v.map((b) => R(b, D + 1))
92
+ ] }, m.id);
93
+ }, K = I.get("__root__") ?? [];
94
+ return /* @__PURE__ */ r("div", { ref: L, className: `nice-comments ${x ?? ""}`, style: S, children: [
95
+ !C && /* @__PURE__ */ r("div", { className: "nice-comments__new", children: [
95
96
  /* @__PURE__ */ e(
96
97
  "textarea",
97
98
  {
98
- value: v,
99
- onChange: (d) => i(d.target.value),
100
- placeholder: k
99
+ value: g,
100
+ onChange: (m) => i(m.target.value),
101
+ placeholder: w
101
102
  }
102
103
  ),
103
- /* @__PURE__ */ e("button", { onClick: z, disabled: !v.trim(), children: "Post" })
104
+ /* @__PURE__ */ e("button", { onClick: z, disabled: !g.trim(), children: c("comments.post", "Post") })
104
105
  ] }),
105
- U.length === 0 ? /* @__PURE__ */ e("p", { className: "nice-comments__empty", children: "No comments yet." }) : U.map((d) => O(d, 0))
106
+ K.length === 0 ? /* @__PURE__ */ e("p", { className: "nice-comments__empty", children: c("comments.noCommentsYet", "No comments yet.") }) : K.map((m) => R(m, 0))
106
107
  ] });
107
108
  }
108
- ), V = {
109
+ ), Y = {
109
110
  star: "polygon(50% 2%, 62% 36%, 98% 37%, 69% 59%, 79% 94%, 50% 73%, 21% 94%, 31% 59%, 2% 37%, 38% 36%)",
110
111
  heart: "polygon(50% 92%, 12% 54%, 4% 40%, 4% 25%, 10% 13%, 22% 6%, 34% 6%, 44% 12%, 50% 21%, 56% 12%, 66% 6%, 78% 6%, 90% 13%, 96% 25%, 96% 40%, 88% 54%)",
111
112
  share: "polygon(42% 8%, 92% 8%, 92% 58%, 75% 41%, 27% 89%, 11% 73%, 59% 25%)",
112
113
  // a thumbs-up: cuff on the left, fist with the thumb raised; thumb-down is it mirrored vertically
113
114
  thumb: "polygon(6% 46%, 24% 46%, 24% 40%, 40% 36%, 50% 8%, 58% 6%, 64% 12%, 62% 36%, 88% 38%, 94% 46%, 90% 56%, 94% 64%, 90% 74%, 92% 82%, 86% 92%, 24% 92%, 24% 90%, 6% 90%)",
114
115
  "thumb-down": "polygon(6% 54%, 24% 54%, 24% 60%, 40% 64%, 50% 92%, 58% 94%, 64% 88%, 62% 64%, 88% 62%, 94% 54%, 90% 44%, 94% 36%, 90% 26%, 92% 18%, 86% 8%, 24% 8%, 24% 10%, 6% 10%)"
115
- }, B = ({
116
- shape: I,
117
- filled: u = !0
116
+ }, H = ({
117
+ shape: P,
118
+ filled: _ = !0
118
119
  }) => /* @__PURE__ */ e(
119
120
  "span",
120
121
  {
121
122
  "aria-hidden": "true",
122
- className: `nice-social-shape nice-social-shape--${I}`,
123
+ className: `nice-social-shape nice-social-shape--${P}`,
123
124
  style: {
124
125
  display: "inline-block",
125
126
  width: "1em",
126
127
  height: "1em",
127
128
  verticalAlign: "-0.125em",
128
129
  background: "currentColor",
129
- clipPath: V[I],
130
- opacity: u ? 1 : 0.35
130
+ clipPath: Y[P],
131
+ opacity: _ ? 1 : 0.35
131
132
  }
132
133
  }
133
- ), Z = /* @__PURE__ */ W(
134
- function(u, A) {
135
- const {
136
- value: m,
134
+ ), te = /* @__PURE__ */ O(
135
+ function(_, L) {
136
+ const { t: c } = U(), {
137
+ value: h,
137
138
  max: s = 5,
138
- mode: o = "stars",
139
- aggregation: _,
140
- onChange: N,
141
- readOnly: r = !1,
142
- size: w = "md",
143
- showValue: E = !1,
144
- label: $,
145
- emojiSet: k = ["😢", "😕", "😐", "🙂", "😍"],
146
- className: C,
147
- style: x
148
- } = u, [v, i] = L(null), h = v !== null ? v + 1 : m ?? 0, g = D(
149
- (c) => {
150
- r || !N || N(c + 1);
139
+ mode: d = "stars",
140
+ aggregation: p,
141
+ onChange: y,
142
+ readOnly: o = !1,
143
+ size: C = "md",
144
+ showValue: $ = !1,
145
+ label: E,
146
+ emojiSet: w = ["😢", "😕", "😐", "🙂", "😍"],
147
+ className: x,
148
+ style: S
149
+ } = _, [g, i] = T(null), u = g !== null ? g + 1 : h ?? 0, N = W(
150
+ (l) => {
151
+ o || !y || y(l + 1);
151
152
  },
152
- [r, N]
153
+ [o, y]
153
154
  ), n = () => {
154
- const c = [];
155
+ const l = [];
155
156
  for (let a = 0; a < s; a++) {
156
- const b = a < h;
157
- let T;
158
- o === "emoji" ? T = k[a] ?? k[k.length - 1] : o === "hearts" ? T = /* @__PURE__ */ e(B, { shape: "heart", filled: b }) : o === "thumbs" ? T = /* @__PURE__ */ e(B, { shape: b ? "thumb" : "thumb-down", filled: b }) : T = /* @__PURE__ */ e(B, { shape: "star", filled: b }), c.push(
157
+ const k = a < u;
158
+ let F;
159
+ d === "emoji" ? F = w[a] ?? w[w.length - 1] : d === "hearts" ? F = /* @__PURE__ */ e(H, { shape: "heart", filled: k }) : d === "thumbs" ? F = /* @__PURE__ */ e(H, { shape: k ? "thumb" : "thumb-down", filled: k }) : F = /* @__PURE__ */ e(H, { shape: "star", filled: k }), l.push(
159
160
  /* @__PURE__ */ e(
160
161
  "span",
161
162
  {
162
- className: `nice-ratings__symbol ${b ? "nice-ratings__symbol--active" : ""}`,
163
- onClick: () => g(a),
164
- onMouseEnter: () => !r && i(a),
165
- onMouseLeave: () => !r && i(null),
166
- role: r ? void 0 : "button",
167
- tabIndex: r ? void 0 : 0,
168
- onKeyDown: (F) => {
169
- (F.key === "Enter" || F.key === " ") && g(a);
163
+ className: `nice-ratings__symbol ${k ? "nice-ratings__symbol--active" : ""}`,
164
+ onClick: () => N(a),
165
+ onMouseEnter: () => !o && i(a),
166
+ onMouseLeave: () => !o && i(null),
167
+ role: o ? void 0 : "button",
168
+ tabIndex: o ? void 0 : 0,
169
+ onKeyDown: (I) => {
170
+ (I.key === "Enter" || I.key === " ") && N(a);
170
171
  },
171
- children: T
172
+ children: F
172
173
  },
173
174
  a
174
175
  )
175
176
  );
176
177
  }
177
- return c;
178
- }, t = () => /* @__PURE__ */ l("div", { className: "nice-ratings__numeric", children: [
178
+ return l;
179
+ }, t = () => /* @__PURE__ */ r("div", { className: "nice-ratings__numeric", children: [
179
180
  /* @__PURE__ */ e(
180
181
  "input",
181
182
  {
@@ -183,105 +184,104 @@ const X = /* @__PURE__ */ W(
183
184
  min: 0,
184
185
  max: s,
185
186
  step: 0.5,
186
- value: m ?? 0,
187
- onChange: (c) => N == null ? void 0 : N(parseFloat(c.target.value) || 0),
188
- readOnly: r,
187
+ value: h ?? 0,
188
+ onChange: (l) => y == null ? void 0 : y(parseFloat(l.target.value) || 0),
189
+ readOnly: o,
189
190
  className: "nice-ratings__numeric-input"
190
191
  }
191
192
  ),
192
- /* @__PURE__ */ l("span", { className: "nice-ratings__numeric-max", children: [
193
+ /* @__PURE__ */ r("span", { className: "nice-ratings__numeric-max", children: [
193
194
  "/ ",
194
195
  s
195
196
  ] })
196
197
  ] });
197
- return /* @__PURE__ */ l(
198
+ return /* @__PURE__ */ r(
198
199
  "div",
199
200
  {
200
- ref: A,
201
- className: `nice-ratings nice-ratings--${w} nice-ratings--${o} ${r ? "nice-ratings--readonly" : ""} ${C ?? ""}`,
202
- style: x,
201
+ ref: L,
202
+ className: `nice-ratings nice-ratings--${C} nice-ratings--${d} ${o ? "nice-ratings--readonly" : ""} ${x ?? ""}`,
203
+ style: S,
203
204
  children: [
204
- $ && /* @__PURE__ */ e("span", { className: "nice-ratings__label", children: $ }),
205
- /* @__PURE__ */ l("div", { className: "nice-ratings__body", children: [
206
- o === "numeric" ? t() : n(),
207
- E && o !== "numeric" && /* @__PURE__ */ l("span", { className: "nice-ratings__value", children: [
208
- h,
205
+ E && /* @__PURE__ */ e("span", { className: "nice-ratings__label", children: E }),
206
+ /* @__PURE__ */ r("div", { className: "nice-ratings__body", children: [
207
+ d === "numeric" ? t() : n(),
208
+ $ && d !== "numeric" && /* @__PURE__ */ r("span", { className: "nice-ratings__value", children: [
209
+ u,
209
210
  " / ",
210
211
  s
211
212
  ] })
212
213
  ] }),
213
- _ && /* @__PURE__ */ l("div", { className: "nice-ratings__aggregation", children: [
214
- /* @__PURE__ */ e("span", { className: "nice-ratings__avg", children: _.average.toFixed(1) }),
215
- /* @__PURE__ */ l("span", { className: "nice-ratings__count", children: [
216
- "(",
217
- _.count,
218
- " ratings)"
219
- ] }),
220
- _.distribution && /* @__PURE__ */ e("div", { className: "nice-ratings__distribution", children: Object.entries(_.distribution).sort(([c], [a]) => +a - +c).map(([c, a]) => /* @__PURE__ */ l("div", { className: "nice-ratings__distribution-row", children: [
221
- /* @__PURE__ */ e("span", { children: c }),
214
+ p && /* @__PURE__ */ r("div", { className: "nice-ratings__aggregation", children: [
215
+ /* @__PURE__ */ e("span", { className: "nice-ratings__avg", children: p.average.toFixed(1) }),
216
+ /* @__PURE__ */ e("span", { className: "nice-ratings__count", children: c("ratings.ratings", "({count} ratings)").replace(
217
+ "{count}",
218
+ String(p.count)
219
+ ) }),
220
+ p.distribution && /* @__PURE__ */ e("div", { className: "nice-ratings__distribution", children: Object.entries(p.distribution).sort(([l], [a]) => +a - +l).map(([l, a]) => /* @__PURE__ */ r("div", { className: "nice-ratings__distribution-row", children: [
221
+ /* @__PURE__ */ e("span", { children: l }),
222
222
  /* @__PURE__ */ e("div", { className: "nice-ratings__bar", children: /* @__PURE__ */ e(
223
223
  "div",
224
224
  {
225
225
  className: "nice-ratings__bar-fill",
226
226
  style: {
227
- width: `${_.count ? a / _.count * 100 : 0}%`
227
+ width: `${p.count ? a / p.count * 100 : 0}%`
228
228
  }
229
229
  }
230
230
  ) }),
231
231
  /* @__PURE__ */ e("span", { children: a })
232
- ] }, c)) })
232
+ ] }, l)) })
233
233
  ] })
234
234
  ]
235
235
  }
236
236
  );
237
237
  }
238
- ), ee = /* @__PURE__ */ W(
239
- function(u, A) {
240
- const {
241
- stats: m,
238
+ ), ne = /* @__PURE__ */ O(
239
+ function(_, L) {
240
+ const { t: c } = U(), {
241
+ stats: h,
242
242
  userState: s,
243
- onLike: o,
244
- onShare: _,
245
- onBookmark: N,
246
- direction: r = "horizontal",
247
- size: w = "md",
248
- showCounts: E = !0,
249
- showLabels: $ = !1,
250
- className: k,
251
- style: C
252
- } = u, x = D((i) => i >= 1e6 ? (i / 1e6).toFixed(1) + "M" : i >= 1e3 ? (i / 1e3).toFixed(1) + "K" : i.toString(), []), v = [
243
+ onLike: d,
244
+ onShare: p,
245
+ onBookmark: y,
246
+ direction: o = "horizontal",
247
+ size: C = "md",
248
+ showCounts: $ = !0,
249
+ showLabels: E = !1,
250
+ className: w,
251
+ style: x
252
+ } = _, S = W((i) => i >= 1e6 ? (i / 1e6).toFixed(1) + "M" : i >= 1e3 ? (i / 1e3).toFixed(1) + "K" : i.toString(), []), g = [
253
253
  {
254
254
  key: "like",
255
255
  shape: "heart",
256
- label: "Like",
257
- count: m.likes,
256
+ label: c("socialPanel.like", "Like"),
257
+ count: h.likes,
258
258
  isActive: (s == null ? void 0 : s.liked) ?? !1,
259
- onClick: o
259
+ onClick: d
260
260
  },
261
261
  {
262
262
  key: "share",
263
263
  shape: "share",
264
- label: "Share",
265
- count: m.shares,
264
+ label: c("socialPanel.share", "Share"),
265
+ count: h.shares,
266
266
  isActive: (s == null ? void 0 : s.shared) ?? !1,
267
- onClick: _
267
+ onClick: p
268
268
  },
269
269
  {
270
270
  key: "bookmark",
271
271
  shape: "star",
272
- label: "Bookmark",
273
- count: m.bookmarks,
272
+ label: c("socialPanel.bookmark", "Bookmark"),
273
+ count: h.bookmarks,
274
274
  isActive: (s == null ? void 0 : s.bookmarked) ?? !1,
275
- onClick: N
275
+ onClick: y
276
276
  }
277
277
  ];
278
278
  return /* @__PURE__ */ e(
279
279
  "div",
280
280
  {
281
- ref: A,
282
- className: `nice-social-panel nice-social-panel--${r} nice-social-panel--${w} ${k ?? ""}`,
283
- style: C,
284
- children: v.map((i) => /* @__PURE__ */ l(
281
+ ref: L,
282
+ className: `nice-social-panel nice-social-panel--${o} nice-social-panel--${C} ${w ?? ""}`,
283
+ style: x,
284
+ children: g.map((i) => /* @__PURE__ */ r(
285
285
  "button",
286
286
  {
287
287
  className: `nice-social-panel__btn nice-social-panel__btn--${i.key} ${i.isActive ? "nice-social-panel__btn--active" : ""}`,
@@ -290,9 +290,9 @@ const X = /* @__PURE__ */ W(
290
290
  "aria-label": i.label,
291
291
  "aria-pressed": i.isActive,
292
292
  children: [
293
- /* @__PURE__ */ e("span", { className: "nice-social-panel__icon", children: /* @__PURE__ */ e(B, { shape: i.shape, filled: i.isActive || i.shape === "share" }) }),
294
- $ && /* @__PURE__ */ e("span", { className: "nice-social-panel__label", children: i.label }),
295
- E && /* @__PURE__ */ e("span", { className: "nice-social-panel__count", children: x(i.count) })
293
+ /* @__PURE__ */ e("span", { className: "nice-social-panel__icon", children: /* @__PURE__ */ e(H, { shape: i.shape, filled: i.isActive || i.shape === "share" }) }),
294
+ E && /* @__PURE__ */ e("span", { className: "nice-social-panel__label", children: i.label }),
295
+ $ && /* @__PURE__ */ e("span", { className: "nice-social-panel__count", children: S(i.count) })
296
296
  ]
297
297
  },
298
298
  i.key
@@ -300,48 +300,48 @@ const X = /* @__PURE__ */ W(
300
300
  }
301
301
  );
302
302
  }
303
- ), ie = /* @__PURE__ */ W(
304
- function(u, A) {
305
- const {
306
- tags: m,
303
+ ), ae = /* @__PURE__ */ O(
304
+ function(_, L) {
305
+ const { t: c } = U(), {
306
+ tags: h,
307
307
  onTagClick: s,
308
- minFontSize: o = 12,
309
- maxFontSize: _ = 36,
310
- sortBy: N = "weight",
311
- maxTags: r,
312
- selectedIds: w,
313
- className: E,
314
- style: $
315
- } = u, k = P(() => {
316
- let i = [...m];
317
- if (N === "weight")
318
- i.sort((h, g) => g.weight - h.weight);
319
- else if (N === "alphabetical")
320
- i.sort((h, g) => h.label.localeCompare(g.label));
308
+ minFontSize: d = 12,
309
+ maxFontSize: p = 36,
310
+ sortBy: y = "weight",
311
+ maxTags: o,
312
+ selectedIds: C,
313
+ className: $,
314
+ style: E
315
+ } = _, w = M(() => {
316
+ let i = [...h];
317
+ if (y === "weight")
318
+ i.sort((u, N) => N.weight - u.weight);
319
+ else if (y === "alphabetical")
320
+ i.sort((u, N) => u.label.localeCompare(N.label));
321
321
  else
322
- for (let h = i.length - 1; h > 0; h--) {
323
- const g = Math.floor(Math.random() * (h + 1));
324
- [i[h], i[g]] = [i[g], i[h]];
322
+ for (let u = i.length - 1; u > 0; u--) {
323
+ const N = Math.floor(Math.random() * (u + 1));
324
+ [i[u], i[N]] = [i[N], i[u]];
325
325
  }
326
- return r && i.length > r && (i = i.slice(0, r)), i;
327
- }, [m, N, r]), { minW: C, maxW: x } = P(() => {
328
- if (k.length === 0)
326
+ return o && i.length > o && (i = i.slice(0, o)), i;
327
+ }, [h, y, o]), { minW: x, maxW: S } = M(() => {
328
+ if (w.length === 0)
329
329
  return { minW: 0, maxW: 1 };
330
- const i = k.map((h) => h.weight);
330
+ const i = w.map((u) => u.weight);
331
331
  return { minW: Math.min(...i), maxW: Math.max(...i) };
332
- }, [k]), v = (i) => {
333
- if (x === C)
334
- return (o + _) / 2;
335
- const h = (i - C) / (x - C);
336
- return o + h * (_ - o);
332
+ }, [w]), g = (i) => {
333
+ if (S === x)
334
+ return (d + p) / 2;
335
+ const u = (i - x) / (S - x);
336
+ return d + u * (p - d);
337
337
  };
338
- return /* @__PURE__ */ e("div", { ref: A, className: `nice-tag-cloud ${E ?? ""}`, style: $, children: k.length === 0 ? /* @__PURE__ */ e("p", { className: "nice-tag-cloud__empty", children: "No tags." }) : k.map((i) => {
339
- const h = w == null ? void 0 : w.includes(i.id), g = v(i.weight);
338
+ return /* @__PURE__ */ e("div", { ref: L, className: `nice-tag-cloud ${$ ?? ""}`, style: E, children: w.length === 0 ? /* @__PURE__ */ e("p", { className: "nice-tag-cloud__empty", children: c("tagCloud.noTags", "No tags.") }) : w.map((i) => {
339
+ const u = C == null ? void 0 : C.includes(i.id), N = g(i.weight);
340
340
  return /* @__PURE__ */ e(
341
341
  "span",
342
342
  {
343
- className: `nice-tag-cloud__tag ${h ? "nice-tag-cloud__tag--selected" : ""}`,
344
- style: { fontSize: g, color: i.color },
343
+ className: `nice-tag-cloud__tag ${u ? "nice-tag-cloud__tag--selected" : ""}`,
344
+ style: { fontSize: N, color: i.color },
345
345
  onClick: () => s == null ? void 0 : s(i),
346
346
  role: s ? "button" : void 0,
347
347
  tabIndex: s ? 0 : void 0,
@@ -355,50 +355,50 @@ const X = /* @__PURE__ */ W(
355
355
  );
356
356
  }) });
357
357
  }
358
- ), q = {
358
+ ), G = {
359
359
  online: "#22c55e",
360
360
  away: "#eab308",
361
361
  busy: "#ef4444",
362
362
  offline: "#9ca3af"
363
- }, te = /* @__PURE__ */ W(
364
- function(u, A) {
365
- const {
366
- users: m,
363
+ }, se = /* @__PURE__ */ O(
364
+ function(_, L) {
365
+ const { t: c } = U(), {
366
+ users: h,
367
367
  onUserClick: s,
368
- onAction: o,
369
- actions: _ = [],
370
- searchable: N = !1,
371
- statusFilter: r,
372
- showStatus: w = !0,
373
- layout: E = "list",
374
- groupByRole: $ = !1,
375
- className: k,
376
- style: C
377
- } = u, [x, v] = L(""), i = P(() => {
378
- let n = m;
379
- if (r && r.length > 0 && (n = n.filter((t) => t.status && r.includes(t.status))), x.trim()) {
380
- const t = x.toLowerCase();
368
+ onAction: d,
369
+ actions: p = [],
370
+ searchable: y = !1,
371
+ statusFilter: o,
372
+ showStatus: C = !0,
373
+ layout: $ = "list",
374
+ groupByRole: E = !1,
375
+ className: w,
376
+ style: x
377
+ } = _, [S, g] = T(""), i = M(() => {
378
+ let n = h;
379
+ if (o && o.length > 0 && (n = n.filter((t) => t.status && o.includes(t.status))), S.trim()) {
380
+ const t = S.toLowerCase();
381
381
  n = n.filter(
382
- (c) => {
383
- var a, b;
384
- return c.name.toLowerCase().includes(t) || ((a = c.email) == null ? void 0 : a.toLowerCase().includes(t)) || ((b = c.role) == null ? void 0 : b.toLowerCase().includes(t));
382
+ (l) => {
383
+ var a, k;
384
+ return l.name.toLowerCase().includes(t) || ((a = l.email) == null ? void 0 : a.toLowerCase().includes(t)) || ((k = l.role) == null ? void 0 : k.toLowerCase().includes(t));
385
385
  }
386
386
  );
387
387
  }
388
388
  return n;
389
- }, [m, r, x]), h = P(() => {
390
- if (!$)
389
+ }, [h, o, S]), u = M(() => {
390
+ if (!E)
391
391
  return { "": i };
392
392
  const n = {};
393
393
  for (const t of i) {
394
- const c = t.role ?? "Other";
395
- n[c] || (n[c] = []), n[c].push(t);
394
+ const l = t.role ?? "Other";
395
+ n[l] || (n[l] = []), n[l].push(t);
396
396
  }
397
397
  return n;
398
- }, [i, $]), g = (n) => /* @__PURE__ */ l(
398
+ }, [i, E]), N = (n) => /* @__PURE__ */ r(
399
399
  "div",
400
400
  {
401
- className: `nice-user-list__item nice-user-list__item--${E}`,
401
+ className: `nice-user-list__item nice-user-list__item--${$}`,
402
402
  onClick: () => s == null ? void 0 : s(n),
403
403
  role: s ? "button" : void 0,
404
404
  tabIndex: s ? 0 : void 0,
@@ -406,28 +406,28 @@ const X = /* @__PURE__ */ W(
406
406
  t.key === "Enter" && s && s(n);
407
407
  },
408
408
  children: [
409
- /* @__PURE__ */ l("div", { className: "nice-user-list__avatar-wrap", children: [
409
+ /* @__PURE__ */ r("div", { className: "nice-user-list__avatar-wrap", children: [
410
410
  n.avatarUrl ? /* @__PURE__ */ e("img", { src: n.avatarUrl, alt: n.name, className: "nice-user-list__avatar" }) : /* @__PURE__ */ e("span", { className: "nice-user-list__avatar-placeholder", children: n.name.charAt(0).toUpperCase() }),
411
- w && n.status && /* @__PURE__ */ e(
411
+ C && n.status && /* @__PURE__ */ e(
412
412
  "span",
413
413
  {
414
414
  className: "nice-user-list__status-dot",
415
- style: { backgroundColor: q[n.status] },
415
+ style: { backgroundColor: G[n.status] },
416
416
  title: n.status
417
417
  }
418
418
  )
419
419
  ] }),
420
- /* @__PURE__ */ l("div", { className: "nice-user-list__info", children: [
420
+ /* @__PURE__ */ r("div", { className: "nice-user-list__info", children: [
421
421
  /* @__PURE__ */ e("span", { className: "nice-user-list__name", children: n.name }),
422
422
  n.email && /* @__PURE__ */ e("span", { className: "nice-user-list__email", children: n.email }),
423
423
  n.role && /* @__PURE__ */ e("span", { className: "nice-user-list__role", children: n.role })
424
424
  ] }),
425
- _.length > 0 && /* @__PURE__ */ e("div", { className: "nice-user-list__actions", children: _.map((t) => /* @__PURE__ */ e(
425
+ p.length > 0 && /* @__PURE__ */ e("div", { className: "nice-user-list__actions", children: p.map((t) => /* @__PURE__ */ e(
426
426
  "button",
427
427
  {
428
428
  className: "nice-user-list__action-btn",
429
- onClick: (c) => {
430
- c.stopPropagation(), o == null || o(n, t);
429
+ onClick: (l) => {
430
+ l.stopPropagation(), d == null || d(n, t);
431
431
  },
432
432
  children: t
433
433
  },
@@ -437,194 +437,204 @@ const X = /* @__PURE__ */ W(
437
437
  },
438
438
  n.id
439
439
  );
440
- return /* @__PURE__ */ l(
440
+ return /* @__PURE__ */ r(
441
441
  "div",
442
442
  {
443
- ref: A,
444
- className: `nice-user-list nice-user-list--${E} ${k ?? ""}`,
445
- style: C,
443
+ ref: L,
444
+ className: `nice-user-list nice-user-list--${$} ${w ?? ""}`,
445
+ style: x,
446
446
  children: [
447
- N && /* @__PURE__ */ e(
447
+ y && /* @__PURE__ */ e(
448
448
  "input",
449
449
  {
450
450
  type: "text",
451
- value: x,
452
- onChange: (n) => v(n.target.value),
453
- placeholder: "Search users…",
451
+ value: S,
452
+ onChange: (n) => g(n.target.value),
453
+ placeholder: c("userList.searchUsers", "Search users…"),
454
454
  className: "nice-user-list__search"
455
455
  }
456
456
  ),
457
- i.length === 0 ? /* @__PURE__ */ e("p", { className: "nice-user-list__empty", children: "No users found." }) : Object.entries(h).map(([n, t]) => /* @__PURE__ */ l("div", { className: "nice-user-list__group", children: [
458
- $ && n && /* @__PURE__ */ l("h4", { className: "nice-user-list__group-title", children: [
457
+ i.length === 0 ? /* @__PURE__ */ e("p", { className: "nice-user-list__empty", children: c("userList.noUsersFound", "No users found.") }) : Object.entries(u).map(([n, t]) => /* @__PURE__ */ r("div", { className: "nice-user-list__group", children: [
458
+ E && n && /* @__PURE__ */ r("h4", { className: "nice-user-list__group-title", children: [
459
459
  n,
460
460
  " (",
461
461
  t.length,
462
462
  ")"
463
463
  ] }),
464
- t.map(g)
464
+ t.map(N)
465
465
  ] }, n))
466
466
  ]
467
467
  }
468
468
  );
469
469
  }
470
470
  );
471
- function Y(I) {
472
- if (!I)
471
+ function J(P) {
472
+ if (!P)
473
473
  return "";
474
- let u = I;
475
- return u = u.replace(/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi, ""), u = u.replace(/\s+on\w+\s*=\s*(?:"[^"]*"|'[^']*'|[^\s>]+)/gi, ""), u = u.replace(/(href|src|action)\s*=\s*(?:"javascript:[^"]*"|'javascript:[^']*')/gi, '$1=""'), u = u.replace(/(href|src|action)\s*=\s*(?:"vbscript:[^"]*"|'vbscript:[^']*')/gi, '$1=""'), u = u.replace(/<\/?(iframe|object|embed|form)\b[^>]*>/gi, ""), u;
474
+ let _ = P;
475
+ return _ = _.replace(/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi, ""), _ = _.replace(/\s+on\w+\s*=\s*(?:"[^"]*"|'[^']*'|[^\s>]+)/gi, ""), _ = _.replace(/(href|src|action)\s*=\s*(?:"javascript:[^"]*"|'javascript:[^']*')/gi, '$1=""'), _ = _.replace(/(href|src|action)\s*=\s*(?:"vbscript:[^"]*"|'vbscript:[^']*')/gi, '$1=""'), _ = _.replace(/<\/?(iframe|object|embed|form)\b[^>]*>/gi, ""), _;
476
476
  }
477
- const ne = /* @__PURE__ */ W(
478
- function(u, A) {
479
- const {
480
- pages: m,
477
+ const ce = /* @__PURE__ */ O(
478
+ function(_, L) {
479
+ const { t: c } = U(), {
480
+ pages: h,
481
481
  selectedPageId: s,
482
- onSelectPage: o,
483
- onSavePage: _,
484
- onDeletePage: N,
485
- onCreatePage: r,
486
- editable: w = !1,
487
- searchable: E = !0,
488
- renderHtml: $ = !1,
489
- sidebarWidth: k = 260,
490
- className: C,
491
- style: x
492
- } = u, [v, i] = L(""), [h, g] = L(!1), [n, t] = L(""), [c, a] = L(""), [b, T] = L(""), [F, z] = L(!1), R = P(() => {
493
- if (m.some((f) => f.children && f.children.length > 0))
494
- return m.filter((f) => !f.parentId);
495
- const p = /* @__PURE__ */ new Map();
496
- for (const f of m)
497
- p.set(f.id, { ...f, children: [] });
498
- const y = [];
499
- for (const f of p.values())
500
- f.parentId && p.has(f.parentId) ? p.get(f.parentId).children.push(f) : y.push(f);
501
- return y;
502
- }, [m]), S = P(
503
- () => m.find((p) => p.id === s),
504
- [m, s]
505
- ), O = P(() => {
506
- if (!v.trim())
507
- return R;
508
- const p = v.toLowerCase(), y = new Set(
509
- m.filter((f) => f.title.toLowerCase().includes(p)).map((f) => f.id)
482
+ onSelectPage: d,
483
+ onSavePage: p,
484
+ onDeletePage: y,
485
+ onCreatePage: o,
486
+ editable: C = !1,
487
+ searchable: $ = !0,
488
+ renderHtml: E = !1,
489
+ sidebarWidth: w = 260,
490
+ className: x,
491
+ style: S
492
+ } = _, [g, i] = T(""), [u, N] = T(!1), [n, t] = T(""), [l, a] = T(""), [k, F] = T(""), [I, z] = T(!1), B = M(() => {
493
+ if (h.some((f) => f.children && f.children.length > 0))
494
+ return h.filter((f) => !f.parentId);
495
+ const v = /* @__PURE__ */ new Map();
496
+ for (const f of h)
497
+ v.set(f.id, { ...f, children: [] });
498
+ const b = [];
499
+ for (const f of v.values())
500
+ f.parentId && v.has(f.parentId) ? v.get(f.parentId).children.push(f) : b.push(f);
501
+ return b;
502
+ }, [h]), A = M(
503
+ () => h.find((v) => v.id === s),
504
+ [h, s]
505
+ ), R = M(() => {
506
+ if (!g.trim())
507
+ return B;
508
+ const v = g.toLowerCase(), b = new Set(
509
+ h.filter((f) => f.title.toLowerCase().includes(v)).map((f) => f.id)
510
510
  );
511
- return m.filter((f) => y.has(f.id));
512
- }, [R, m, v]), U = D(() => {
513
- S && (t(S.title), a(S.content ?? ""), g(!0));
514
- }, [S]), d = D(() => {
515
- !S || !_ || (_(S.id, c, n), g(!1));
516
- }, [S, c, n, _]), M = D(() => {
517
- !b.trim() || !r || (r(s ?? null, b.trim()), T(""), z(!1));
518
- }, [b, s, r]), j = (p, y = 0) => {
511
+ return h.filter((f) => b.has(f.id));
512
+ }, [B, h, g]), K = W(() => {
513
+ A && (t(A.title), a(A.content ?? ""), N(!0));
514
+ }, [A]), m = W(() => {
515
+ !A || !p || (p(A.id, l, n), N(!1));
516
+ }, [A, l, n, p]), D = W(() => {
517
+ !k.trim() || !o || (o(s ?? null, k.trim()), F(""), z(!1));
518
+ }, [k, s, o]), j = (v, b = 0) => {
519
519
  var f;
520
- return /* @__PURE__ */ l("div", { children: [
520
+ return /* @__PURE__ */ r("div", { children: [
521
521
  /* @__PURE__ */ e(
522
522
  "div",
523
523
  {
524
- className: `nice-wiki__page-item ${p.id === s ? "nice-wiki__page-item--active" : ""}`,
525
- style: { paddingLeft: 12 + y * 16 },
526
- onClick: () => o == null ? void 0 : o(p),
524
+ className: `nice-wiki__page-item ${v.id === s ? "nice-wiki__page-item--active" : ""}`,
525
+ style: { paddingLeft: 12 + b * 16 },
526
+ onClick: () => d == null ? void 0 : d(v),
527
527
  role: "button",
528
528
  tabIndex: 0,
529
- onKeyDown: (K) => {
530
- K.key === "Enter" && (o == null || o(p));
529
+ onKeyDown: (V) => {
530
+ V.key === "Enter" && (d == null || d(v));
531
531
  },
532
- children: p.title
532
+ children: v.title
533
533
  }
534
534
  ),
535
- (f = p.children) == null ? void 0 : f.map((K) => j(K, y + 1))
536
- ] }, p.id);
535
+ (f = v.children) == null ? void 0 : f.map((V) => j(V, b + 1))
536
+ ] }, v.id);
537
537
  };
538
- return /* @__PURE__ */ l(
538
+ return /* @__PURE__ */ r(
539
539
  "div",
540
540
  {
541
- ref: A,
542
- className: `nice-wiki ${C ?? ""}`,
543
- style: { display: "flex", ...x },
541
+ ref: L,
542
+ className: `nice-wiki ${x ?? ""}`,
543
+ style: { display: "flex", ...S },
544
544
  children: [
545
- /* @__PURE__ */ l("div", { className: "nice-wiki__sidebar", style: { width: k, minWidth: k }, children: [
546
- /* @__PURE__ */ l("div", { className: "nice-wiki__sidebar-header", children: [
547
- /* @__PURE__ */ e("strong", { children: "Wiki" }),
548
- w && r && /* @__PURE__ */ e("button", { onClick: () => z(!F), title: "New page", children: "+" })
545
+ /* @__PURE__ */ r("div", { className: "nice-wiki__sidebar", style: { width: w, minWidth: w }, children: [
546
+ /* @__PURE__ */ r("div", { className: "nice-wiki__sidebar-header", children: [
547
+ /* @__PURE__ */ e("strong", { children: c("wiki.wiki", "Wiki") }),
548
+ C && o && /* @__PURE__ */ e(
549
+ "button",
550
+ {
551
+ onClick: () => z(!I),
552
+ title: c("wiki.newPage", "New page"),
553
+ children: "+"
554
+ }
555
+ )
549
556
  ] }),
550
- F && /* @__PURE__ */ l("div", { className: "nice-wiki__new-page", children: [
557
+ I && /* @__PURE__ */ r("div", { className: "nice-wiki__new-page", children: [
551
558
  /* @__PURE__ */ e(
552
559
  "input",
553
560
  {
554
561
  type: "text",
555
- value: b,
556
- onChange: (p) => T(p.target.value),
557
- placeholder: "New page title"
562
+ value: k,
563
+ onChange: (v) => F(v.target.value),
564
+ placeholder: c("wiki.newPageTitle", "New page title")
558
565
  }
559
566
  ),
560
- /* @__PURE__ */ e("button", { onClick: M, disabled: !b.trim(), children: "Create" })
567
+ /* @__PURE__ */ e("button", { onClick: D, disabled: !k.trim(), children: c("wiki.create", "Create") })
561
568
  ] }),
562
- E && /* @__PURE__ */ e(
569
+ $ && /* @__PURE__ */ e(
563
570
  "input",
564
571
  {
565
572
  type: "text",
566
573
  className: "nice-wiki__search",
567
- value: v,
568
- onChange: (p) => i(p.target.value),
569
- placeholder: "Search pages…"
574
+ value: g,
575
+ onChange: (v) => i(v.target.value),
576
+ placeholder: c("wiki.searchPages", "Search pages…")
570
577
  }
571
578
  ),
572
- /* @__PURE__ */ e("div", { className: "nice-wiki__tree", children: O.length === 0 ? /* @__PURE__ */ e("p", { className: "nice-wiki__empty", children: "No pages." }) : O.map((p) => j(p)) })
579
+ /* @__PURE__ */ e("div", { className: "nice-wiki__tree", children: R.length === 0 ? /* @__PURE__ */ e("p", { className: "nice-wiki__empty", children: c("wiki.noPages", "No pages.") }) : R.map((v) => j(v)) })
573
580
  ] }),
574
- /* @__PURE__ */ e("div", { className: "nice-wiki__content", children: S ? h ? /* @__PURE__ */ l("div", { className: "nice-wiki__editor", children: [
581
+ /* @__PURE__ */ e("div", { className: "nice-wiki__content", children: A ? u ? /* @__PURE__ */ r("div", { className: "nice-wiki__editor", children: [
575
582
  /* @__PURE__ */ e(
576
583
  "input",
577
584
  {
578
585
  type: "text",
579
586
  className: "nice-wiki__edit-title",
580
587
  value: n,
581
- onChange: (p) => t(p.target.value)
588
+ onChange: (v) => t(v.target.value)
582
589
  }
583
590
  ),
584
591
  /* @__PURE__ */ e(
585
592
  "textarea",
586
593
  {
587
594
  className: "nice-wiki__edit-body",
588
- value: c,
589
- onChange: (p) => a(p.target.value),
595
+ value: l,
596
+ onChange: (v) => a(v.target.value),
590
597
  rows: 20
591
598
  }
592
599
  ),
593
- /* @__PURE__ */ l("div", { className: "nice-wiki__edit-actions", children: [
594
- /* @__PURE__ */ e("button", { onClick: d, children: "Save" }),
595
- /* @__PURE__ */ e("button", { onClick: () => g(!1), children: "Cancel" })
600
+ /* @__PURE__ */ r("div", { className: "nice-wiki__edit-actions", children: [
601
+ /* @__PURE__ */ e("button", { onClick: m, children: c("wiki.save", "Save") }),
602
+ /* @__PURE__ */ e("button", { onClick: () => N(!1), children: c("wiki.cancel", "Cancel") })
596
603
  ] })
597
- ] }) : /* @__PURE__ */ l("div", { className: "nice-wiki__viewer", children: [
598
- /* @__PURE__ */ l("div", { className: "nice-wiki__viewer-header", children: [
599
- /* @__PURE__ */ e("h2", { children: S.title }),
600
- /* @__PURE__ */ l("div", { className: "nice-wiki__viewer-meta", children: [
601
- S.lastEditedBy && /* @__PURE__ */ l("span", { children: [
602
- "Edited by ",
603
- S.lastEditedBy
604
- ] }),
605
- S.lastEditedAt && /* @__PURE__ */ l("span", { children: [
606
- " on ",
607
- S.lastEditedAt
604
+ ] }) : /* @__PURE__ */ r("div", { className: "nice-wiki__viewer", children: [
605
+ /* @__PURE__ */ r("div", { className: "nice-wiki__viewer-header", children: [
606
+ /* @__PURE__ */ e("h2", { children: A.title }),
607
+ /* @__PURE__ */ r("div", { className: "nice-wiki__viewer-meta", children: [
608
+ A.lastEditedBy && /* @__PURE__ */ e("span", { children: c("wiki.editedBy", "Edited by {lastEditedBy}").replace(
609
+ "{lastEditedBy}",
610
+ String(A.lastEditedBy)
611
+ ) }),
612
+ A.lastEditedAt && /* @__PURE__ */ r("span", { children: [
613
+ " ",
614
+ c("wiki.on", "on {lastEditedAt}").replace(
615
+ "{lastEditedAt}",
616
+ String(A.lastEditedAt)
617
+ )
608
618
  ] })
609
619
  ] }),
610
- w && /* @__PURE__ */ l("div", { className: "nice-wiki__viewer-actions", children: [
611
- /* @__PURE__ */ e("button", { onClick: U, children: "Edit" }),
612
- N && /* @__PURE__ */ e("button", { onClick: () => N(S.id), children: "Delete" })
620
+ C && /* @__PURE__ */ r("div", { className: "nice-wiki__viewer-actions", children: [
621
+ /* @__PURE__ */ e("button", { onClick: K, children: c("wiki.edit", "Edit") }),
622
+ y && /* @__PURE__ */ e("button", { onClick: () => y(A.id), children: c("wiki.delete", "Delete") })
613
623
  ] })
614
624
  ] }),
615
- $ ? /* @__PURE__ */ e(
625
+ E ? /* @__PURE__ */ e(
616
626
  "div",
617
627
  {
618
628
  className: "nice-wiki__viewer-body",
619
- dangerouslySetInnerHTML: { __html: Y(S.content ?? "") }
629
+ dangerouslySetInnerHTML: { __html: J(A.content ?? "") }
620
630
  }
621
- ) : /* @__PURE__ */ e("div", { className: "nice-wiki__viewer-body", children: S.content ?? /* @__PURE__ */ e("em", { children: "No content." }) })
622
- ] }) : /* @__PURE__ */ e("div", { className: "nice-wiki__placeholder", children: "Select a page from the sidebar." }) })
631
+ ) : /* @__PURE__ */ e("div", { className: "nice-wiki__viewer-body", children: A.content ?? /* @__PURE__ */ e("em", { children: c("wiki.noContent", "No content.") }) })
632
+ ] }) : /* @__PURE__ */ e("div", { className: "nice-wiki__placeholder", children: c("wiki.selectAPageFromThe", "Select a page from the sidebar.") }) })
623
633
  ]
624
634
  }
625
635
  );
626
636
  }
627
- ), G = {
637
+ ), Q = {
628
638
  comment: "var(--nice-color-primary, #3b82f6)",
629
639
  like: "var(--nice-color-error, #ef4444)",
630
640
  share: "var(--nice-color-info, #0ea5e9)",
@@ -636,75 +646,75 @@ const ne = /* @__PURE__ */ W(
636
646
  upload: "var(--nice-color-accent, #8b5cf6)",
637
647
  mention: "var(--nice-color-primary, #3b82f6)",
638
648
  custom: "var(--nice-text-muted, #6b7280)"
639
- }, ae = /* @__PURE__ */ W(
640
- function(u, A) {
641
- const {
642
- events: m,
649
+ }, le = /* @__PURE__ */ O(
650
+ function(_, L) {
651
+ const { t: c } = U(), {
652
+ events: h,
643
653
  onEventClick: s,
644
- groupByDate: o = !0,
645
- typeFilter: _,
646
- showFilters: N = !1,
647
- maxEvents: r,
648
- onLoadMore: w,
649
- hasMore: E = !1,
650
- className: $,
651
- style: k
652
- } = u, [C, x] = L(/* @__PURE__ */ new Set()), v = _ ?? (C.size > 0 ? Array.from(C) : void 0), i = P(() => {
653
- let t = m;
654
- if (v && v.length > 0) {
655
- const c = new Set(v);
656
- t = t.filter((a) => c.has(a.type));
654
+ groupByDate: d = !0,
655
+ typeFilter: p,
656
+ showFilters: y = !1,
657
+ maxEvents: o,
658
+ onLoadMore: C,
659
+ hasMore: $ = !1,
660
+ className: E,
661
+ style: w
662
+ } = _, [x, S] = T(/* @__PURE__ */ new Set()), g = p ?? (x.size > 0 ? Array.from(x) : void 0), i = M(() => {
663
+ let t = h;
664
+ if (g && g.length > 0) {
665
+ const l = new Set(g);
666
+ t = t.filter((a) => l.has(a.type));
657
667
  }
658
- return r && (t = t.slice(0, r)), t;
659
- }, [m, v, r]), h = P(() => {
660
- if (!o)
668
+ return o && (t = t.slice(0, o)), t;
669
+ }, [h, g, o]), u = M(() => {
670
+ if (!d)
661
671
  return [{ label: "", events: i }];
662
672
  const t = /* @__PURE__ */ new Map();
663
- for (const c of i) {
664
- const a = c.timestamp.slice(0, 10);
665
- t.has(a) || t.set(a, []), t.get(a).push(c);
673
+ for (const l of i) {
674
+ const a = l.timestamp.slice(0, 10);
675
+ t.has(a) || t.set(a, []), t.get(a).push(l);
666
676
  }
667
- return Array.from(t.entries()).map(([c, a]) => ({ label: c, events: a }));
668
- }, [i, o]), g = P(() => {
669
- const t = new Set(m.map((c) => c.type));
677
+ return Array.from(t.entries()).map(([l, a]) => ({ label: l, events: a }));
678
+ }, [i, d]), N = M(() => {
679
+ const t = new Set(h.map((l) => l.type));
670
680
  return Array.from(t).sort();
671
- }, [m]), n = (t) => {
672
- x((c) => {
673
- const a = new Set(c);
681
+ }, [h]), n = (t) => {
682
+ S((l) => {
683
+ const a = new Set(l);
674
684
  return a.has(t) ? a.delete(t) : a.add(t), a;
675
685
  });
676
686
  };
677
- return /* @__PURE__ */ l("div", { ref: A, className: `nice-activity-feed ${$ ?? ""}`, style: k, children: [
678
- N && !_ && /* @__PURE__ */ l("div", { className: "nice-activity-feed__filters", children: [
679
- g.map((t) => /* @__PURE__ */ e(
687
+ return /* @__PURE__ */ r("div", { ref: L, className: `nice-activity-feed ${E ?? ""}`, style: w, children: [
688
+ y && !p && /* @__PURE__ */ r("div", { className: "nice-activity-feed__filters", children: [
689
+ N.map((t) => /* @__PURE__ */ e(
680
690
  "button",
681
691
  {
682
- className: `nice-activity-feed__filter-chip ${C.has(t) ? "nice-activity-feed__filter-chip--active" : ""}`,
692
+ className: `nice-activity-feed__filter-chip ${x.has(t) ? "nice-activity-feed__filter-chip--active" : ""}`,
683
693
  onClick: () => n(t),
684
694
  children: t
685
695
  },
686
696
  t
687
697
  )),
688
- C.size > 0 && /* @__PURE__ */ e(
698
+ x.size > 0 && /* @__PURE__ */ e(
689
699
  "button",
690
700
  {
691
701
  className: "nice-activity-feed__filter-clear",
692
- onClick: () => x(/* @__PURE__ */ new Set()),
693
- children: "Clear"
702
+ onClick: () => S(/* @__PURE__ */ new Set()),
703
+ children: c("activityFeed.clear", "Clear")
694
704
  }
695
705
  )
696
706
  ] }),
697
- i.length === 0 ? /* @__PURE__ */ e("p", { className: "nice-activity-feed__empty", children: "No activity." }) : h.map(({ label: t, events: c }) => /* @__PURE__ */ l("div", { className: "nice-activity-feed__group", children: [
698
- o && t && /* @__PURE__ */ e("div", { className: "nice-activity-feed__date-label", children: t }),
699
- c.map((a) => /* @__PURE__ */ l(
707
+ i.length === 0 ? /* @__PURE__ */ e("p", { className: "nice-activity-feed__empty", children: c("activityFeed.noActivity", "No activity.") }) : u.map(({ label: t, events: l }) => /* @__PURE__ */ r("div", { className: "nice-activity-feed__group", children: [
708
+ d && t && /* @__PURE__ */ e("div", { className: "nice-activity-feed__date-label", children: t }),
709
+ l.map((a) => /* @__PURE__ */ r(
700
710
  "div",
701
711
  {
702
712
  className: "nice-activity-feed__event",
703
713
  onClick: () => s == null ? void 0 : s(a),
704
714
  role: s ? "button" : void 0,
705
715
  tabIndex: s ? 0 : void 0,
706
- onKeyDown: (b) => {
707
- b.key === "Enter" && s && s(a);
716
+ onKeyDown: (k) => {
717
+ k.key === "Enter" && s && s(a);
708
718
  },
709
719
  children: [
710
720
  /* @__PURE__ */ e(
@@ -713,10 +723,10 @@ const ne = /* @__PURE__ */ W(
713
723
  className: `nice-activity-feed__icon nice-activity-feed__icon--${a.type}`,
714
724
  title: a.type,
715
725
  "aria-hidden": "true",
716
- style: { background: G[a.type] }
726
+ style: { background: Q[a.type] }
717
727
  }
718
728
  ),
719
- /* @__PURE__ */ l("div", { className: "nice-activity-feed__body", children: [
729
+ /* @__PURE__ */ r("div", { className: "nice-activity-feed__body", children: [
720
730
  a.actorAvatarUrl && /* @__PURE__ */ e(
721
731
  "img",
722
732
  {
@@ -725,11 +735,11 @@ const ne = /* @__PURE__ */ W(
725
735
  className: "nice-activity-feed__avatar"
726
736
  }
727
737
  ),
728
- /* @__PURE__ */ l("span", { className: "nice-activity-feed__message", children: [
738
+ /* @__PURE__ */ r("span", { className: "nice-activity-feed__message", children: [
729
739
  /* @__PURE__ */ e("strong", { children: a.actorName }),
730
740
  " ",
731
741
  a.message,
732
- a.targetLabel && /* @__PURE__ */ l(H, { children: [
742
+ a.targetLabel && /* @__PURE__ */ r(q, { children: [
733
743
  " ",
734
744
  /* @__PURE__ */ e("em", { children: a.targetLabel })
735
745
  ] })
@@ -741,16 +751,16 @@ const ne = /* @__PURE__ */ W(
741
751
  a.id
742
752
  ))
743
753
  ] }, t || "__all")),
744
- E && w && /* @__PURE__ */ e("button", { className: "nice-activity-feed__load-more", onClick: w, children: "Load more" })
754
+ $ && C && /* @__PURE__ */ e("button", { className: "nice-activity-feed__load-more", onClick: C, children: c("activityFeed.loadMore", "Load more") })
745
755
  ] });
746
756
  }
747
757
  );
748
758
  export {
749
- ae as NiceActivityFeed,
750
- X as NiceComments,
751
- Z as NiceRatings,
752
- ee as NiceSocialPanel,
753
- ie as NiceTagCloud,
754
- te as NiceUserList,
755
- ne as NiceWiki
759
+ le as NiceActivityFeed,
760
+ ie as NiceComments,
761
+ te as NiceRatings,
762
+ ne as NiceSocialPanel,
763
+ ae as NiceTagCloud,
764
+ se as NiceUserList,
765
+ ce as NiceWiki
756
766
  };