@nice2dev/social 1.2.0 → 1.2.2

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