@hkyhy/marsun-components-core 0.1.153 → 0.1.155

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.
@@ -1,305 +1,313 @@
1
- import { jsxs as d, jsx as a } from "react/jsx-runtime";
2
- import { notification as Ue, Badge as Fe, Button as D, Drawer as ze, Space as Ee, Checkbox as oe, message as $ } from "antd";
3
- import R from "classnames";
4
- import { forwardRef as Ge, useState as f, useRef as T, useMemo as Se, useCallback as N, useImperativeHandle as $e, useEffect as b } from "react";
1
+ import { jsxs as u, jsx as a } from "react/jsx-runtime";
2
+ import { notification as Fe, Badge as ze, Button as I, Drawer as $e, Space as Ee, Checkbox as se, message as K } from "antd";
3
+ import D from "classnames";
4
+ import { forwardRef as je, useState as f, useRef as N, useMemo as Le, useCallback as L, useImperativeHandle as Ge, useEffect as S } from "react";
5
5
  import { createPortal as Ke } from "react-dom";
6
- import { sanitizeInboxHtml as je } from "../sanitizeInboxHtml.js";
7
- import { INBOX_BADGE_REFRESH_EVENT as Le } from "../requestInboxBadgeRefresh.js";
8
- import { emphasizeQuoted as le } from "./emphasizeQuoted.js";
9
- import { filterInboxActionsForHost as Ve, resolveInboxItemActions as We, isInboxButtonDriven as Qe } from "./inboxItemActions.js";
10
- import { approvalPendingCtaLabel as Dt, inboxSceneLabel as Mt, isTerminalActionStatus as Ot, normalizeInboxActions as It, resolveInboxSceneKey as Ht, shouldShowApprovalPendingCta as Ut } from "./inboxItemActions.js";
11
- import { loadInboxToastPrefs as Xe, shouldToastForMessageType as Ye, saveInboxToastPrefs as Je } from "./toastPrefs.js";
12
- import { DEFAULT_INBOX_TOAST_PREFS as zt } from "./toastPrefs.js";
6
+ import { sanitizeInboxHtml as Ve } from "../sanitizeInboxHtml.js";
7
+ import { INBOX_BADGE_REFRESH_EVENT as Be } from "../requestInboxBadgeRefresh.js";
8
+ import { emphasizeQuoted as ie } from "./emphasizeQuoted.js";
9
+ import { filterInboxActionsForHost as We, resolveInboxItemActions as Qe, isInboxButtonDriven as Xe } from "./inboxItemActions.js";
10
+ import { approvalPendingCtaLabel as Mt, inboxSceneLabel as It, isTerminalActionStatus as Ot, normalizeInboxActions as Ht, resolveInboxSceneKey as Ut, shouldShowApprovalPendingCta as Ft } from "./inboxItemActions.js";
11
+ import { loadInboxToastPrefs as Ye, shouldToastForMessageType as Je, saveInboxToastPrefs as qe } from "./toastPrefs.js";
12
+ import { DEFAULT_INBOX_TOAST_PREFS as $t } from "./toastPrefs.js";
13
13
  import r from "./style.module.scss.js";
14
- import { Bell as qe } from "../../../Icons/Bell.js";
15
- import se, { SEMANTIC_COLORS as M } from "../../../Tag/SemanticTag.js";
16
- import Ze from "../../../StateBar/StateBar.js";
17
- import et from "../../../SegmentedRadio/SegmentedRadio.js";
18
- import tt from "../../../Layout/PageSpin/index.js";
19
- import nt from "../../../Empty/Empty.js";
20
- import rt from "../../../VirtualScrollbar/VirtualScrollbar/index.js";
21
- const at = 6e3, ot = [
14
+ import { Bell as Ze } from "../../../Icons/Bell.js";
15
+ import ce, { SEMANTIC_COLORS as O } from "../../../Tag/SemanticTag.js";
16
+ import et from "../../../StateBar/StateBar.js";
17
+ import tt from "../../../SegmentedRadio/SegmentedRadio.js";
18
+ import nt from "../../../Layout/PageSpin/index.js";
19
+ import rt from "../../../Empty/Empty.js";
20
+ import at from "../../../VirtualScrollbar/VirtualScrollbar/index.js";
21
+ const ot = 6e3, lt = [
22
22
  { key: "", label: "全部" },
23
23
  { key: "alert", label: "预警" },
24
24
  { key: "action", label: "行动" },
25
25
  { key: "remind", label: "提醒" }
26
- ], lt = {
26
+ ], st = {
27
27
  alert: "预警",
28
28
  action: "行动",
29
29
  remind: "提醒"
30
- }, st = 300, it = 1500, ct = 72;
31
- function Ce(u) {
32
- const o = String(u || "").trim().toLowerCase();
33
- return o ? lt[o] || o : "";
30
+ }, it = 300, ct = 1500, dt = 72;
31
+ function Ce(i) {
32
+ const o = String(i || "").trim().toLowerCase();
33
+ return o ? st[o] || o : "";
34
34
  }
35
- function ke(u) {
36
- const o = String(u || "").trim().toLowerCase();
37
- return o === "alert" ? M.DANGER : o === "action" ? M.PRIMARY : o === "remind" ? M.WARNING : M.DEFAULT;
35
+ function ke(i) {
36
+ const o = String(i || "").trim().toLowerCase();
37
+ return o === "alert" ? O.DANGER : o === "action" ? O.PRIMARY : o === "remind" ? O.WARNING : O.DEFAULT;
38
38
  }
39
- function dt(u) {
40
- return [u.factory, u.variety, u.metric].map((o) => String(o || "").trim()).filter(Boolean).join(" · ");
39
+ function xe(i) {
40
+ return String(i || "").replace(/,/g, "、").split("、").map((o) => o.trim()).filter(Boolean);
41
41
  }
42
- function ut(u) {
43
- return String(u || "").trim() || M.DEFAULT;
42
+ function ut(i) {
43
+ const o = String(i.factory || "").trim(), B = String(i.variety || "").trim(), v = String(i.metric || "").trim(), T = xe(B), R = xe(v);
44
+ if (T.length > 1 && T.length === R.length) {
45
+ const H = T.map((b, V) => `${b} · ${R[V]}`).join("、");
46
+ return [o, H].filter(Boolean).join(" · ");
47
+ }
48
+ return [o, B, v].filter(Boolean).join(" · ");
49
+ }
50
+ function mt(i) {
51
+ return String(i || "").trim() || O.DEFAULT;
44
52
  }
45
- function mt(u) {
53
+ function ft(i) {
46
54
  try {
47
- const o = JSON.parse(u);
55
+ const o = JSON.parse(i);
48
56
  if (!o || typeof o != "object") return null;
49
- const O = String(o.messageType || o.message_type || "").trim(), B = String(o.title || "").trim(), A = String(o.summary || "").trim();
50
- return !O && !B && !A ? null : {
51
- messageType: O || void 0,
52
- title: B || void 0,
53
- summary: A || void 0
57
+ const B = String(o.messageType || o.message_type || "").trim(), v = String(o.title || "").trim(), T = String(o.summary || "").trim();
58
+ return !B && !v && !T ? null : {
59
+ messageType: B || void 0,
60
+ title: v || void 0,
61
+ summary: T || void 0
54
62
  };
55
63
  } catch {
56
64
  return null;
57
65
  }
58
66
  }
59
- const Rt = Ge(function({
67
+ const At = je(function({
60
68
  fetchInbox: o,
61
- markRead: O,
62
- markAllRead: B,
63
- onNavigate: A,
64
- pollMs: K = 0,
65
- locationKey: ie,
66
- pageSize: E = 20,
67
- className: Be,
68
- title: xe = "站内信",
69
- streamPath: j = "/api/v1/msg-center/inbox/stream",
70
- getAccessToken: V,
71
- onItemAction: ce
72
- }, Pe) {
73
- const [W, x] = f(!1), [de, ue] = f(!1), [Q, me] = f(""), [I, H] = f([]), [S, U] = f(0), [fe, X] = f({}), [Y, Re] = f(""), [F, Ae] = f("all"), [_, _e] = f(() => Xe()), [De, pe] = f(!1), [J, ye] = f(!1), [p, q] = f(null), L = T(null), C = T(null), Z = T(null), y = T(null), ge = T(!1), he = T(_);
74
- he.current = _;
75
- const ee = T(1), te = T(!1), P = T(!1), z = Se(
69
+ markRead: B,
70
+ markAllRead: v,
71
+ onNavigate: T,
72
+ pollMs: R = 0,
73
+ locationKey: H,
74
+ pageSize: b = 20,
75
+ className: V,
76
+ title: Pe = "站内信",
77
+ streamPath: W = "/api/v1/msg-center/inbox/stream",
78
+ getAccessToken: Q,
79
+ onItemAction: de
80
+ }, Re) {
81
+ const [X, A] = f(!1), [ue, me] = f(!1), [Y, fe] = f(""), [U, F] = f([]), [C, z] = f(0), [pe, J] = f({}), [q, Ae] = f(""), [$, _e] = f("all"), [M, De] = f(() => Ye()), [Me, ye] = f(!1), [Z, ge] = f(!1), [p, ee] = f(null), k = N(null), x = N(null), te = N(null), y = N(null), he = N(!1), ve = N(M);
82
+ ve.current = M;
83
+ const ne = N(1), re = N(!1), _ = N(!1), j = Le(
76
84
  () => ({
77
- messageType: Y || void 0,
78
- unreadOnly: F === "unread" || void 0,
79
- readOnly: F === "read" || void 0
85
+ messageType: q || void 0,
86
+ unreadOnly: $ === "unread" || void 0,
87
+ readOnly: $ === "read" || void 0
80
88
  }),
81
- [Y, F]
82
- ), G = N(async () => {
83
- ue(!0), me(""), ee.current = 1, P.current = !1;
89
+ [q, $]
90
+ ), G = L(async () => {
91
+ me(!0), fe(""), ne.current = 1, _.current = !1;
84
92
  try {
85
93
  const e = await o({
86
94
  currentPage: 1,
87
- pageSize: E,
88
- ...z
95
+ pageSize: b,
96
+ ...j
89
97
  }), t = (e == null ? void 0 : e.pageData) || [], n = typeof (e == null ? void 0 : e.total) == "number" ? e.total : t.length;
90
- H(t), P.current = t.length > 0 && t.length < n, U(typeof (e == null ? void 0 : e.unreadTotal) == "number" ? e.unreadTotal : 0), X((e == null ? void 0 : e.unreadByMessageType) || {});
98
+ F(t), _.current = t.length > 0 && t.length < n, z(typeof (e == null ? void 0 : e.unreadTotal) == "number" ? e.unreadTotal : 0), J((e == null ? void 0 : e.unreadByMessageType) || {});
91
99
  } catch (e) {
92
- H([]), P.current = !1, me(e instanceof Error ? e.message : String(e));
100
+ F([]), _.current = !1, fe(e instanceof Error ? e.message : String(e));
93
101
  } finally {
94
- ue(!1);
102
+ me(!1);
95
103
  }
96
- }, [o, E, z]), ve = N(async () => {
97
- if (!(te.current || !P.current)) {
98
- te.current = !0, pe(!0);
104
+ }, [o, b, j]), Te = L(async () => {
105
+ if (!(re.current || !_.current)) {
106
+ re.current = !0, ye(!0);
99
107
  try {
100
- const e = ee.current + 1, t = await o({
108
+ const e = ne.current + 1, t = await o({
101
109
  currentPage: e,
102
- pageSize: E,
103
- ...z
110
+ pageSize: b,
111
+ ...j
104
112
  }), n = (t == null ? void 0 : t.pageData) || [], l = typeof (t == null ? void 0 : t.total) == "number" ? t.total : 0;
105
- H((i) => {
106
- const s = new Set(i.map((g) => g.id)), m = n.filter((g) => (g == null ? void 0 : g.id) && !s.has(g.id)), v = m.length ? [...i, ...m] : i;
107
- return P.current = m.length > 0 && (l > 0 ? v.length < l : m.length >= E), v;
108
- }), n.length && (ee.current = e), typeof (t == null ? void 0 : t.unreadTotal) == "number" && U(t.unreadTotal), t != null && t.unreadByMessageType && X(t.unreadByMessageType);
113
+ F((c) => {
114
+ const s = new Set(c.map((g) => g.id)), m = n.filter((g) => (g == null ? void 0 : g.id) && !s.has(g.id)), w = m.length ? [...c, ...m] : c;
115
+ return _.current = m.length > 0 && (l > 0 ? w.length < l : m.length >= b), w;
116
+ }), n.length && (ne.current = e), typeof (t == null ? void 0 : t.unreadTotal) == "number" && z(t.unreadTotal), t != null && t.unreadByMessageType && J(t.unreadByMessageType);
109
117
  } catch {
110
- P.current = !1;
118
+ _.current = !1;
111
119
  } finally {
112
- te.current = !1, pe(!1);
120
+ re.current = !1, ye(!1);
113
121
  }
114
122
  }
115
- }, [o, E, z]), Me = N(
123
+ }, [o, b, j]), Ie = L(
116
124
  (e) => {
117
125
  const t = e.currentTarget;
118
- t.scrollHeight - t.scrollTop - t.clientHeight <= ct && ve();
126
+ t.scrollHeight - t.scrollTop - t.clientHeight <= dt && Te();
119
127
  },
120
- [ve]
121
- ), h = N(async () => {
128
+ [Te]
129
+ ), h = L(async () => {
122
130
  try {
123
- const e = await o({ currentPage: 1, pageSize: E });
124
- U(typeof (e == null ? void 0 : e.unreadTotal) == "number" ? e.unreadTotal : 0), X((e == null ? void 0 : e.unreadByMessageType) || {});
131
+ const e = await o({ currentPage: 1, pageSize: b });
132
+ z(typeof (e == null ? void 0 : e.unreadTotal) == "number" ? e.unreadTotal : 0), J((e == null ? void 0 : e.unreadByMessageType) || {});
125
133
  } catch {
126
134
  }
127
- }, [o, E]), ne = N(() => {
128
- y.current != null && (window.clearTimeout(y.current), y.current = null), q(null);
129
- }, []), Te = N(() => {
130
- ne(), x(!0);
131
- }, [ne]), be = N(() => {
132
- const e = Z.current;
133
- if (Z.current = null, !e || !Ye(he.current, e.messageType)) return;
135
+ }, [o, b]), ae = L(() => {
136
+ y.current != null && (window.clearTimeout(y.current), y.current = null), ee(null);
137
+ }, []), be = L(() => {
138
+ ae(), A(!0);
139
+ }, [ae]), we = L(() => {
140
+ const e = te.current;
141
+ if (te.current = null, !e || !Je(ve.current, e.messageType)) return;
134
142
  y.current != null && (window.clearTimeout(y.current), y.current = null);
135
143
  const t = `inbox-badge-${e.messageType || "msg"}-${Date.now()}`;
136
- q({
144
+ ee({
137
145
  key: t,
138
146
  title: e.title || "新站内信",
139
147
  summary: e.summary || "",
140
148
  messageType: e.messageType
141
149
  }), y.current = window.setTimeout(() => {
142
- y.current = null, q(null);
143
- }, at);
144
- }, []), w = N(
150
+ y.current = null, ee(null);
151
+ }, ot);
152
+ }, []), E = L(
145
153
  (e) => {
146
- e && (Z.current = e, be()), C.current != null && window.clearTimeout(C.current), C.current = window.setTimeout(() => {
147
- C.current = null, h();
148
- }, it);
154
+ e && (te.current = e, we()), x.current != null && window.clearTimeout(x.current), x.current = window.setTimeout(() => {
155
+ x.current = null, h();
156
+ }, ct);
149
157
  },
150
- [h, be]
158
+ [h, we]
151
159
  );
152
- $e(Pe, () => ({ refreshBadge: h }), [h]), b(() => {
160
+ Ge(Re, () => ({ refreshBadge: h }), [h]), S(() => {
153
161
  h();
154
- }, [h]), b(() => {
155
- if (ie !== void 0) {
156
- if (!ge.current) {
157
- ge.current = !0;
162
+ }, [h]), S(() => {
163
+ if (H !== void 0) {
164
+ if (!he.current) {
165
+ he.current = !0;
158
166
  return;
159
167
  }
160
- w();
168
+ E();
161
169
  }
162
- }, [ie, w]), b(() => {
163
- if (K <= 0) return;
170
+ }, [H, E]), S(() => {
171
+ if (R <= 0) return;
164
172
  const e = window.setInterval(() => {
165
173
  h();
166
- }, K);
174
+ }, R);
167
175
  return () => window.clearInterval(e);
168
- }, [K, h]), b(() => {
176
+ }, [R, h]), S(() => {
169
177
  const e = () => {
170
- L.current != null && window.clearTimeout(L.current), L.current = window.setTimeout(() => {
171
- L.current = null, w();
172
- }, st);
178
+ k.current != null && window.clearTimeout(k.current), k.current = window.setTimeout(() => {
179
+ k.current = null, E();
180
+ }, it);
173
181
  }, t = () => {
174
182
  document.visibilityState === "visible" && e();
175
183
  };
176
184
  return window.addEventListener("focus", e), document.addEventListener("visibilitychange", t), () => {
177
- window.removeEventListener("focus", e), document.removeEventListener("visibilitychange", t), L.current != null && (window.clearTimeout(L.current), L.current = null);
185
+ window.removeEventListener("focus", e), document.removeEventListener("visibilitychange", t), k.current != null && (window.clearTimeout(k.current), k.current = null);
178
186
  };
179
- }, [w]), b(() => {
187
+ }, [E]), S(() => {
180
188
  const e = (t) => {
181
189
  const n = t.detail;
182
- w((n == null ? void 0 : n.preview) || void 0);
190
+ E((n == null ? void 0 : n.preview) || void 0);
183
191
  };
184
- return window.addEventListener(Le, e), () => window.removeEventListener(Le, e);
185
- }, [w]), b(() => {
186
- Ue.destroy();
187
- }, []), b(() => () => {
188
- C.current != null && (window.clearTimeout(C.current), C.current = null), y.current != null && (window.clearTimeout(y.current), y.current = null);
189
- }, []), b(() => {
190
- if (j === !1 || typeof V != "function" || typeof window > "u" || typeof EventSource > "u") return;
191
- const e = String(j || "/api/v1/msg-center/inbox/stream").trim();
192
- let t = !1, n = null, l = null, i = 0;
193
- const s = (c) => {
194
- const k = c, He = typeof (k == null ? void 0 : k.data) == "string" ? mt(k.data) : null;
195
- w(He);
192
+ return window.addEventListener(Be, e), () => window.removeEventListener(Be, e);
193
+ }, [E]), S(() => {
194
+ Fe.destroy();
195
+ }, []), S(() => () => {
196
+ x.current != null && (window.clearTimeout(x.current), x.current = null), y.current != null && (window.clearTimeout(y.current), y.current = null);
197
+ }, []), S(() => {
198
+ if (W === !1 || typeof Q != "function" || typeof window > "u" || typeof EventSource > "u") return;
199
+ const e = String(W || "/api/v1/msg-center/inbox/stream").trim();
200
+ let t = !1, n = null, l = null, c = 0;
201
+ const s = (d) => {
202
+ const P = d, Ue = typeof (P == null ? void 0 : P.data) == "string" ? ft(P.data) : null;
203
+ E(Ue);
196
204
  }, m = () => {
197
205
  l != null && (window.clearTimeout(l), l = null);
198
- }, v = () => {
206
+ }, w = () => {
199
207
  if (t || l != null) return;
200
- const c = Math.min(3e4, 1e3 * 2 ** Math.min(i, 5));
201
- i += 1, l = window.setTimeout(() => {
208
+ const d = Math.min(3e4, 1e3 * 2 ** Math.min(c, 5));
209
+ c += 1, l = window.setTimeout(() => {
202
210
  l = null, g();
203
- }, c);
211
+ }, d);
204
212
  }, g = () => {
205
213
  if (t) return;
206
- const c = String(V() || "").trim();
207
- if (!c) {
208
- v();
214
+ const d = String(Q() || "").trim();
215
+ if (!d) {
216
+ w();
209
217
  return;
210
218
  }
211
219
  n && (n.removeEventListener("badge", s), n.removeEventListener("inbox", s), n.close(), n = null);
212
- const k = new URL(e, window.location.origin);
213
- k.searchParams.set("access_token", c);
220
+ const P = new URL(e, window.location.origin);
221
+ P.searchParams.set("access_token", d);
214
222
  try {
215
- n = new EventSource(k.toString());
223
+ n = new EventSource(P.toString());
216
224
  } catch {
217
- v();
225
+ w();
218
226
  return;
219
227
  }
220
228
  n.addEventListener("badge", s), n.addEventListener("inbox", s), n.onopen = () => {
221
- i = 0;
229
+ c = 0;
222
230
  }, n.onerror = () => {
223
- t || (n == null || n.close(), n = null, v());
231
+ t || (n == null || n.close(), n = null, w());
224
232
  };
225
233
  };
226
234
  return g(), () => {
227
235
  t = !0, m(), n && (n.removeEventListener("badge", s), n.removeEventListener("inbox", s), n.close(), n = null);
228
236
  };
229
- }, [j, V, w]), b(() => {
230
- W && G();
231
- }, [W, G]);
232
- const Oe = Se(
233
- () => ot.map((e) => {
234
- const t = e.key ? fe[e.key] || 0 : S;
237
+ }, [W, Q, E]), S(() => {
238
+ X && G();
239
+ }, [X, G]);
240
+ const Oe = Le(
241
+ () => lt.map((e) => {
242
+ const t = e.key ? pe[e.key] || 0 : C;
235
243
  return {
236
244
  key: e.key || "all",
237
245
  label: t > 0 ? `${e.label} (${t})` : e.label
238
246
  };
239
247
  }),
240
- [fe, S]
241
- ), re = (e, t) => {
242
- _e((n) => {
248
+ [pe, C]
249
+ ), oe = (e, t) => {
250
+ De((n) => {
243
251
  const l = { ...n, [e]: t };
244
- return Je(l), l;
252
+ return qe(l), l;
245
253
  });
246
- }, ae = async (e, t) => {
254
+ }, le = async (e, t) => {
247
255
  if (!e.read)
248
256
  try {
249
- await O(e.id), H((l) => l.map((i) => i.id === e.id ? { ...i, read: !0 } : i)), U((l) => Math.max(0, l - 1));
257
+ await B(e.id), F((l) => l.map((c) => c.id === e.id ? { ...c, read: !0 } : c)), z((l) => Math.max(0, l - 1));
250
258
  } catch (l) {
251
- $.error(l instanceof Error ? l.message : "标记已读失败");
259
+ K.error(l instanceof Error ? l.message : "标记已读失败");
252
260
  return;
253
261
  }
254
262
  const n = String(e.href || "").trim();
255
263
  if (n) {
256
- if (A) {
257
- A(n, e), x(!1);
264
+ if (T) {
265
+ T(n, e), A(!1);
258
266
  return;
259
267
  }
260
- n.startsWith("http://") || n.startsWith("https://") ? window.open(n, "_blank", "noopener,noreferrer") : window.location.assign(n), x(!1);
268
+ n.startsWith("http://") || n.startsWith("https://") ? window.open(n, "_blank", "noopener,noreferrer") : window.location.assign(n), A(!1);
261
269
  }
262
- }, we = async (e, t) => {
270
+ }, Ne = async (e, t) => {
263
271
  if (!t.disabled) {
264
- if (ce) {
272
+ if (de) {
265
273
  try {
266
- await ce(t.kind, e), x(!1), G(), h();
274
+ await de(t.kind, e), A(!1), G(), h();
267
275
  } catch (n) {
268
- $.error(n instanceof Error ? n.message : "操作失败");
276
+ K.error(n instanceof Error ? n.message : "操作失败");
269
277
  }
270
278
  return;
271
279
  }
272
- await ae(e);
280
+ await le(e);
273
281
  }
274
- }, Ie = async () => {
275
- if (!(!B || S <= 0 || J)) {
276
- ye(!0);
282
+ }, He = async () => {
283
+ if (!(!v || C <= 0 || Z)) {
284
+ ge(!0);
277
285
  try {
278
- const e = await B(), t = typeof (e == null ? void 0 : e.updated) == "number" ? e.updated : void 0;
279
- $.success(typeof t == "number" ? `已清空 ${t} 条未读` : "已清空未读"), await G(), await h();
286
+ const e = await v(), t = typeof (e == null ? void 0 : e.updated) == "number" ? e.updated : void 0;
287
+ K.success(typeof t == "number" ? `已清空 ${t} 条未读` : "已清空未读"), await G(), await h();
280
288
  } catch (e) {
281
- $.error(e instanceof Error ? e.message : "清空未读失败");
289
+ K.error(e instanceof Error ? e.message : "清空未读失败");
282
290
  } finally {
283
- ye(!1);
291
+ ge(!1);
284
292
  }
285
293
  }
286
- }, Ne = p ? Ce(p.messageType) : "";
287
- return /* @__PURE__ */ d("div", { className: R(r.bellWrap, Be), children: [
288
- /* @__PURE__ */ a(Fe, { count: S, size: "small", overflowCount: 99, offset: [-4, 4], children: /* @__PURE__ */ a(
289
- D,
294
+ }, Se = p ? Ce(p.messageType) : "";
295
+ return /* @__PURE__ */ u("div", { className: D(r.bellWrap, V), children: [
296
+ /* @__PURE__ */ a(ze, { count: C, size: "small", overflowCount: 99, offset: [-4, 4], children: /* @__PURE__ */ a(
297
+ I,
290
298
  {
291
299
  type: "text",
292
300
  className: r.bellBtn,
293
- icon: /* @__PURE__ */ a(qe, { size: 16, "aria-hidden": !0 }),
294
- "aria-label": S > 0 ? `站内信,${S} 条未读` : "站内信",
295
- onClick: () => x(!0)
301
+ icon: /* @__PURE__ */ a(Ze, { size: 16, "aria-hidden": !0 }),
302
+ "aria-label": C > 0 ? `站内信,${C} 条未读` : "站内信",
303
+ onClick: () => A(!0)
296
304
  }
297
305
  ) }),
298
306
  p && typeof document < "u" ? Ke(
299
- /* @__PURE__ */ a("div", { className: r.toastHost, "data-testid": "inbox-live-toast-host", children: /* @__PURE__ */ d(
307
+ /* @__PURE__ */ a("div", { className: r.toastHost, "data-testid": "inbox-live-toast-host", children: /* @__PURE__ */ u(
300
308
  "div",
301
309
  {
302
- className: R(
310
+ className: D(
303
311
  "marsun-inbox-toast",
304
312
  r.toastNotice,
305
313
  p.messageType === "alert" && r.accentAlert,
@@ -308,7 +316,7 @@ const Rt = Ge(function({
308
316
  ),
309
317
  role: "alert",
310
318
  "data-testid": "inbox-live-toast",
311
- onClick: Te,
319
+ onClick: be,
312
320
  children: [
313
321
  /* @__PURE__ */ a(
314
322
  "button",
@@ -317,31 +325,31 @@ const Rt = Ge(function({
317
325
  className: r.toastClose,
318
326
  "aria-label": "关闭",
319
327
  onClick: (e) => {
320
- e.stopPropagation(), ne();
328
+ e.stopPropagation(), ae();
321
329
  },
322
330
  children: "×"
323
331
  }
324
332
  ),
325
- /* @__PURE__ */ d("div", { className: r.toastHead, children: [
326
- /* @__PURE__ */ a("span", { className: r.toastTitle, children: le(p.title) }),
327
- Ne ? /* @__PURE__ */ a(
328
- se,
333
+ /* @__PURE__ */ u("div", { className: r.toastHead, children: [
334
+ /* @__PURE__ */ a("span", { className: r.toastTitle, children: ie(p.title) }),
335
+ Se ? /* @__PURE__ */ a(
336
+ ce,
329
337
  {
330
338
  color: ke(p.messageType),
331
339
  className: r.typeTag,
332
- children: Ne
340
+ children: Se
333
341
  }
334
342
  ) : null
335
343
  ] }),
336
- /* @__PURE__ */ d("div", { className: r.toastBody, children: [
337
- p.summary ? /* @__PURE__ */ a("div", { className: r.toastDesc, children: le(p.summary) }) : null,
344
+ /* @__PURE__ */ u("div", { className: r.toastBody, children: [
345
+ p.summary ? /* @__PURE__ */ a("div", { className: r.toastDesc, children: ie(p.summary) }) : null,
338
346
  /* @__PURE__ */ a("div", { className: r.toastActions, children: /* @__PURE__ */ a(
339
- D,
347
+ I,
340
348
  {
341
349
  type: "primary",
342
350
  size: "small",
343
351
  onClick: (e) => {
344
- e.stopPropagation(), Te();
352
+ e.stopPropagation(), be();
345
353
  },
346
354
  children: "查看"
347
355
  }
@@ -353,12 +361,12 @@ const Rt = Ge(function({
353
361
  ) }),
354
362
  document.body
355
363
  ) : null,
356
- /* @__PURE__ */ d(
357
- ze,
364
+ /* @__PURE__ */ u(
365
+ $e,
358
366
  {
359
- title: xe,
360
- open: W,
361
- onClose: () => x(!1),
367
+ title: Pe,
368
+ open: X,
369
+ onClose: () => A(!1),
362
370
  size: 420,
363
371
  destroyOnClose: !1,
364
372
  className: r.drawer,
@@ -368,23 +376,23 @@ const Rt = Ge(function({
368
376
  },
369
377
  children: [
370
378
  /* @__PURE__ */ a(
371
- Ze,
379
+ et,
372
380
  {
373
381
  className: r.typeTabs,
374
382
  size: "small",
375
- activeKey: Y || "all",
376
- onChange: (e) => Re(e === "all" ? "" : e),
383
+ activeKey: q || "all",
384
+ onChange: (e) => Ae(e === "all" ? "" : e),
377
385
  stateOption: Oe,
378
386
  isInner: !0
379
387
  }
380
388
  ),
381
- /* @__PURE__ */ d("div", { className: r.filterRow, children: [
389
+ /* @__PURE__ */ u("div", { className: r.filterRow, children: [
382
390
  /* @__PURE__ */ a(
383
- et,
391
+ tt,
384
392
  {
385
393
  size: "small",
386
- value: F,
387
- onChange: (e) => Ae(e),
394
+ value: $,
395
+ onChange: (e) => _e(e),
388
396
  options: [
389
397
  { value: "all", label: "全部" },
390
398
  { value: "unread", label: "未读" },
@@ -392,83 +400,83 @@ const Rt = Ge(function({
392
400
  ]
393
401
  }
394
402
  ),
395
- B ? /* @__PURE__ */ a(
396
- D,
403
+ v ? /* @__PURE__ */ a(
404
+ I,
397
405
  {
398
406
  type: "link",
399
407
  size: "small",
400
408
  className: r.clearUnreadBtn,
401
409
  "data-testid": "inbox-clear-unread",
402
- loading: J,
403
- disabled: S <= 0 || J,
404
- onClick: () => void Ie(),
410
+ loading: Z,
411
+ disabled: C <= 0 || Z,
412
+ onClick: () => void He(),
405
413
  children: "清空未读"
406
414
  }
407
415
  ) : null
408
416
  ] }),
409
- /* @__PURE__ */ d("div", { className: r.toastPrefs, "data-testid": "inbox-toast-prefs", children: [
417
+ /* @__PURE__ */ u("div", { className: r.toastPrefs, "data-testid": "inbox-toast-prefs", children: [
410
418
  /* @__PURE__ */ a("div", { className: r.toastPrefsTitle, children: "消息提示" }),
411
419
  /* @__PURE__ */ a("p", { className: r.toastPrefsHint, children: "本机浏览器偏好,非租户策略" }),
412
- /* @__PURE__ */ d(Ee, { size: 12, wrap: !0, children: [
420
+ /* @__PURE__ */ u(Ee, { size: 12, wrap: !0, children: [
413
421
  /* @__PURE__ */ a(
414
- oe,
422
+ se,
415
423
  {
416
- checked: _.alert,
417
- onChange: (e) => re("alert", e.target.checked),
424
+ checked: M.alert,
425
+ onChange: (e) => oe("alert", e.target.checked),
418
426
  children: "预警弹出"
419
427
  }
420
428
  ),
421
429
  /* @__PURE__ */ a(
422
- oe,
430
+ se,
423
431
  {
424
- checked: _.action,
425
- onChange: (e) => re("action", e.target.checked),
432
+ checked: M.action,
433
+ onChange: (e) => oe("action", e.target.checked),
426
434
  children: "行动弹出"
427
435
  }
428
436
  ),
429
437
  /* @__PURE__ */ a(
430
- oe,
438
+ se,
431
439
  {
432
- checked: _.remind,
433
- onChange: (e) => re("remind", e.target.checked),
440
+ checked: M.remind,
441
+ onChange: (e) => oe("remind", e.target.checked),
434
442
  children: "提醒弹出"
435
443
  }
436
444
  )
437
445
  ] })
438
446
  ] }),
439
- Q ? /* @__PURE__ */ a("p", { className: r.error, children: Q }) : null,
440
- /* @__PURE__ */ a("div", { className: R("inbox-bell-list-pane", r.listPane), children: /* @__PURE__ */ a(tt, { spinning: de && I.length === 0, children: !de && !Q && I.length === 0 ? /* @__PURE__ */ a(nt, { description: "暂无站内信" }) : I.length === 0 ? null : /* @__PURE__ */ d(
441
- rt,
447
+ Y ? /* @__PURE__ */ a("p", { className: r.error, children: Y }) : null,
448
+ /* @__PURE__ */ a("div", { className: D("inbox-bell-list-pane", r.listPane), children: /* @__PURE__ */ a(nt, { spinning: ue && U.length === 0, children: !ue && !Y && U.length === 0 ? /* @__PURE__ */ a(rt, { description: "暂无站内信" }) : U.length === 0 ? null : /* @__PURE__ */ u(
449
+ at,
442
450
  {
443
- wrapperClassName: R("inbox-bell-list-scroll", r.listScroll),
451
+ wrapperClassName: D("inbox-bell-list-scroll", r.listScroll),
444
452
  className: r.listViewport,
445
453
  "data-testid": "inbox-bell-list-scroll",
446
- onScroll: Me,
454
+ onScroll: Ie,
447
455
  children: [
448
- /* @__PURE__ */ a("ul", { className: r.list, children: I.map((e) => {
449
- const t = Ce(e.messageType), n = String(e.levelLabel || e.level || "").trim(), l = !!n, i = je(e.bodyHtml), s = Ve(
450
- We(e)
451
- ), m = Qe(e), v = dt(e), g = !!s.primary;
452
- return /* @__PURE__ */ a("li", { children: /* @__PURE__ */ d(
456
+ /* @__PURE__ */ a("ul", { className: r.list, children: U.map((e) => {
457
+ const t = Ce(e.messageType), n = String(e.levelLabel || e.level || "").trim(), l = !!n, c = Ve(e.bodyHtml), s = We(
458
+ Qe(e)
459
+ ), m = Xe(e), w = ut(e), g = !!s.primary;
460
+ return /* @__PURE__ */ a("li", { children: /* @__PURE__ */ u(
453
461
  "div",
454
462
  {
455
- className: R(
463
+ className: D(
456
464
  r.item,
457
465
  !e.read && r.itemUnread,
458
466
  m && r.itemStatic
459
467
  ),
460
468
  role: m ? void 0 : "button",
461
469
  tabIndex: m ? void 0 : 0,
462
- onClick: m ? void 0 : () => void ae(e),
463
- onKeyDown: m ? void 0 : (c) => {
464
- (c.key === "Enter" || c.key === " ") && (c.preventDefault(), ae(e));
470
+ onClick: m ? void 0 : () => void le(e),
471
+ onKeyDown: m ? void 0 : (d) => {
472
+ (d.key === "Enter" || d.key === " ") && (d.preventDefault(), le(e));
465
473
  },
466
474
  children: [
467
- /* @__PURE__ */ d("div", { className: r.itemHeader, children: [
468
- /* @__PURE__ */ d("span", { className: r.itemHeaderLeft, children: [
475
+ /* @__PURE__ */ u("div", { className: r.itemHeader, children: [
476
+ /* @__PURE__ */ u("span", { className: r.itemHeaderLeft, children: [
469
477
  /* @__PURE__ */ a("span", { className: r.itemTitle, title: e.title || "(无标题)", children: e.title || "(无标题)" }),
470
478
  t ? /* @__PURE__ */ a(
471
- se,
479
+ ce,
472
480
  {
473
481
  color: ke(e.messageType),
474
482
  className: r.typeTag,
@@ -478,18 +486,18 @@ const Rt = Ge(function({
478
486
  ] }),
479
487
  /* @__PURE__ */ a("span", { className: r.itemTime, children: e.createdAt || "" })
480
488
  ] }),
481
- /* @__PURE__ */ a("div", { className: r.itemBody, children: i ? /* @__PURE__ */ a(
489
+ /* @__PURE__ */ a("div", { className: r.itemBody, children: c ? /* @__PURE__ */ a(
482
490
  "div",
483
491
  {
484
492
  className: r.itemBodyHtml,
485
- dangerouslySetInnerHTML: { __html: i }
493
+ dangerouslySetInnerHTML: { __html: c }
486
494
  }
487
- ) : e.summary ? /* @__PURE__ */ a("span", { className: r.itemSummary, children: le(e.summary) }) : null }),
488
- v ? /* @__PURE__ */ a("span", { className: r.itemMeta, children: v }) : null,
495
+ ) : e.summary ? /* @__PURE__ */ a("span", { className: r.itemSummary, children: ie(e.summary) }) : null }),
496
+ w ? /* @__PURE__ */ a("span", { className: r.itemMeta, children: w }) : null,
489
497
  l ? /* @__PURE__ */ a("div", { className: r.itemFooterTags, children: /* @__PURE__ */ a(
490
- se,
498
+ ce,
491
499
  {
492
- color: ut(e.levelColor),
500
+ color: mt(e.levelColor),
493
501
  selected: !0,
494
502
  className: r.typeTag,
495
503
  children: n
@@ -499,24 +507,24 @@ const Rt = Ge(function({
499
507
  "div",
500
508
  {
501
509
  className: r.itemActions,
502
- onClick: (c) => c.stopPropagation(),
503
- onKeyDown: (c) => c.stopPropagation(),
504
- children: /* @__PURE__ */ d(Ee, { size: 8, wrap: !0, children: [
510
+ onClick: (d) => d.stopPropagation(),
511
+ onKeyDown: (d) => d.stopPropagation(),
512
+ children: /* @__PURE__ */ u(Ee, { size: 8, wrap: !0, children: [
505
513
  /* @__PURE__ */ a(
506
- D,
514
+ I,
507
515
  {
508
516
  size: "small",
509
517
  type: "primary",
510
- onClick: () => void we(e, s.primary),
518
+ onClick: () => void Ne(e, s.primary),
511
519
  children: s.primary.label
512
520
  }
513
521
  ),
514
522
  s.secondary ? /* @__PURE__ */ a(
515
- D,
523
+ I,
516
524
  {
517
525
  size: "small",
518
526
  type: "link",
519
- onClick: () => void we(e, s.secondary),
527
+ onClick: () => void Ne(e, s.secondary),
520
528
  children: s.secondary.label
521
529
  }
522
530
  ) : null
@@ -527,7 +535,7 @@ const Rt = Ge(function({
527
535
  }
528
536
  ) }, e.id);
529
537
  }) }),
530
- De ? /* @__PURE__ */ a("p", { className: R("inbox-bell-list-footer", r.listFooter), children: "加载中…" }) : null
538
+ Me ? /* @__PURE__ */ a("p", { className: D("inbox-bell-list-footer", r.listFooter), children: "加载中…" }) : null
531
539
  ]
532
540
  }
533
541
  ) }) })
@@ -537,19 +545,19 @@ const Rt = Ge(function({
537
545
  ] });
538
546
  });
539
547
  export {
540
- zt as DEFAULT_INBOX_TOAST_PREFS,
541
- Dt as approvalPendingCtaLabel,
542
- Rt as default,
543
- Ve as filterInboxActionsForHost,
544
- Mt as inboxSceneLabel,
545
- Qe as isInboxButtonDriven,
548
+ $t as DEFAULT_INBOX_TOAST_PREFS,
549
+ Mt as approvalPendingCtaLabel,
550
+ At as default,
551
+ We as filterInboxActionsForHost,
552
+ It as inboxSceneLabel,
553
+ Xe as isInboxButtonDriven,
546
554
  Ot as isTerminalActionStatus,
547
- Xe as loadInboxToastPrefs,
548
- It as normalizeInboxActions,
549
- We as resolveInboxItemActions,
550
- Ht as resolveInboxSceneKey,
551
- Je as saveInboxToastPrefs,
552
- Ut as shouldShowApprovalPendingCta,
553
- Ye as shouldToastForMessageType
555
+ Ye as loadInboxToastPrefs,
556
+ Ht as normalizeInboxActions,
557
+ Qe as resolveInboxItemActions,
558
+ Ut as resolveInboxSceneKey,
559
+ qe as saveInboxToastPrefs,
560
+ Ft as shouldShowApprovalPendingCta,
561
+ Je as shouldToastForMessageType
554
562
  };
555
563
  //# sourceMappingURL=InboxBell.js.map