@univerjs/thread-comment-ui 0.12.4 → 0.13.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/lib/index.js CHANGED
@@ -1,16 +1,16 @@
1
1
  var He = Object.defineProperty;
2
2
  var Ve = (n, e, t) => e in n ? He(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t;
3
3
  var W = (n, e, t) => Ve(n, typeof e != "symbol" ? e + "" : e, t);
4
- import { Inject as ye, IUniverInstanceService as je, Disposable as Pe, UniverInstanceType as de, CommandType as we, DependentOn as Ae, Injector as Be, ICommandService as te, IConfigService as We, Plugin as Ze, merge as Fe, mergeOverrideWithDependencies as Ge, LocaleService as he, DOCS_NORMAL_EDITOR_UNIT_ID_KEY as Ke, BuildTextUtils as ue, Tools as ze, CustomRangeType as Ye, getBodySlice as qe, UserManagerService as fe, generateRandomId as Je } from "@univerjs/core";
5
- import { ISidebarService as _e, useDependency as S, KeyCode as pe, useObservable as Z, useConfigValue as Qe, UI_PLUGIN_CONFIG_KEY as Xe } from "@univerjs/ui";
6
- import { BehaviorSubject as Ce, filter as et, debounceTime as tt } from "rxjs";
7
- import { UniverThreadCommentPlugin as nt, ThreadCommentModel as Se, getDT as rt, AddCommentCommand as it, ResolveCommentCommand as ot, DeleteCommentTreeCommand as Ne, UpdateCommentCommand as st, DeleteCommentCommand as lt } from "@univerjs/thread-comment";
4
+ import { Inject as ye, IUniverInstanceService as je, Disposable as Pe, UniverInstanceType as de, CommandType as we, DependentOn as Ae, Injector as Be, ICommandService as te, IConfigService as We, Plugin as Ze, merge as Fe, mergeOverrideWithDependencies as Ke, LocaleService as he, DOCS_NORMAL_EDITOR_UNIT_ID_KEY as Ge, BuildTextUtils as ue, DOCS_COMMENT_EDITOR_UNIT_ID_KEY as ze, Tools as Ye, CustomRangeType as qe, getBodySlice as Je, UserManagerService as fe, generateRandomId as Qe } from "@univerjs/core";
5
+ import { ISidebarService as _e, useDependency as N, KeyCode as pe, useObservable as Z, useConfigValue as Xe, UI_PLUGIN_CONFIG_KEY as et } from "@univerjs/ui";
6
+ import { BehaviorSubject as Ce, filter as tt, debounceTime as nt } from "rxjs";
7
+ import { UniverThreadCommentPlugin as rt, ThreadCommentModel as Ne, getDT as it, AddCommentCommand as ot, ResolveCommentCommand as st, DeleteCommentTreeCommand as Se, UpdateCommentCommand as lt, DeleteCommentCommand as at } from "@univerjs/thread-comment";
8
8
  import { jsxs as I, jsx as l } from "react/jsx-runtime";
9
- import { Button as le, clsx as ve, Tooltip as at, scrollbarClassName as ct, borderClassName as dt, Dropdown as ut, Select as ge } from "@univerjs/design";
10
- import { useRef as ee, createElement as G, forwardRef as K, useState as P, useEffect as ae, useMemo as X, useImperativeHandle as vt } from "react";
11
- import { IEditorService as mt, BreakLineCommand as ht, RichTextEditor as ft } from "@univerjs/docs-ui";
12
- var pt = Object.getOwnPropertyDescriptor, Ct = (n, e, t, r) => {
13
- for (var i = r > 1 ? void 0 : r ? pt(e, t) : e, o = n.length - 1, c; o >= 0; o--)
9
+ import { Button as le, clsx as ve, Tooltip as ct, scrollbarClassName as dt, borderClassName as ut, Dropdown as vt, Select as ge } from "@univerjs/design";
10
+ import { useRef as ee, createElement as K, forwardRef as G, useState as P, useEffect as ae, useMemo as X, useImperativeHandle as mt } from "react";
11
+ import { IEditorService as ht, BreakLineCommand as ft, RichTextEditor as pt } from "@univerjs/docs-ui";
12
+ var Ct = Object.getOwnPropertyDescriptor, gt = (n, e, t, r) => {
13
+ for (var i = r > 1 ? void 0 : r ? Ct(e, t) : e, o = n.length - 1, c; o >= 0; o--)
14
14
  (c = n[o]) && (i = c(i) || i);
15
15
  return i;
16
16
  }, Ie = (n, e) => (t, r) => e(t, r, n);
@@ -33,7 +33,7 @@ let Y = class extends Pe {
33
33
  e.visible || this.setPanelVisible(!1);
34
34
  })
35
35
  ), this.disposeWithMe(
36
- this._univerInstanceService.getCurrentTypeOfUnit$(de.UNIVER_SHEET).pipe(et((e) => !e)).subscribe(() => {
36
+ this._univerInstanceService.getCurrentTypeOfUnit$(de.UNIVER_SHEET).pipe(tt((e) => !e)).subscribe(() => {
37
37
  this._sidebarService.close();
38
38
  })
39
39
  );
@@ -51,18 +51,18 @@ let Y = class extends Pe {
51
51
  this._activeCommentId = e, this._activeCommentId$.next(e);
52
52
  }
53
53
  };
54
- Y = Ct([
54
+ Y = gt([
55
55
  Ie(0, ye(_e)),
56
56
  Ie(1, je)
57
57
  ], Y);
58
- const gt = "thread-comment-panel", It = "UNIVER_THREAD_COMMENT_UI_PLUGIN", xt = {
58
+ const It = "thread-comment-panel", xt = "UNIVER_THREAD_COMMENT_UI_PLUGIN", bt = {
59
59
  id: "thread-comment-ui.operation.toggle-panel",
60
60
  type: we.OPERATION,
61
61
  handler(n) {
62
62
  const e = n.get(_e), t = n.get(Y);
63
63
  return t.panelVisible ? (e.close(), t.setPanelVisible(!1)) : (e.open({
64
64
  header: { title: "threadCommentUI.panel.title" },
65
- children: { label: gt },
65
+ children: { label: It },
66
66
  width: 330
67
67
  }), t.setPanelVisible(!0)), !0;
68
68
  }
@@ -72,12 +72,12 @@ const gt = "thread-comment-panel", It = "UNIVER_THREAD_COMMENT_UI_PLUGIN", xt =
72
72
  handler(n, e) {
73
73
  return n.get(Y).setActiveComment(e), !0;
74
74
  }
75
- }, bt = "thread-comment-ui.config", xe = {};
76
- var yt = Object.defineProperty, wt = Object.getOwnPropertyDescriptor, _t = (n, e, t) => e in n ? yt(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t, St = (n, e, t, r) => {
77
- for (var i = r > 1 ? void 0 : r ? wt(e, t) : e, o = n.length - 1, c; o >= 0; o--)
75
+ }, yt = "thread-comment-ui.config", xe = {};
76
+ var wt = Object.defineProperty, _t = Object.getOwnPropertyDescriptor, Nt = (n, e, t) => e in n ? wt(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t, St = (n, e, t, r) => {
77
+ for (var i = r > 1 ? void 0 : r ? _t(e, t) : e, o = n.length - 1, c; o >= 0; o--)
78
78
  (c = n[o]) && (i = c(i) || i);
79
79
  return i;
80
- }, me = (n, e) => (t, r) => e(t, r, n), $e = (n, e, t) => _t(n, typeof e != "symbol" ? e + "" : e, t);
80
+ }, me = (n, e) => (t, r) => e(t, r, n), $e = (n, e, t) => Nt(n, typeof e != "symbol" ? e + "" : e, t);
81
81
  let ce = class extends Ze {
82
82
  constructor(n = xe, e, t, r) {
83
83
  super(), this._config = n, this._injector = e, this._commandService = t, this._configService = r;
@@ -86,30 +86,30 @@ let ce = class extends Ze {
86
86
  xe,
87
87
  this._config
88
88
  );
89
- i && this._configService.setConfig("menu", i, { merge: !0 }), this._configService.setConfig(bt, o);
89
+ i && this._configService.setConfig("menu", i, { merge: !0 }), this._configService.setConfig(yt, o);
90
90
  }
91
91
  onStarting() {
92
92
  var n;
93
- Ge([
93
+ Ke([
94
94
  [Y]
95
95
  ], (n = this._config) == null ? void 0 : n.overrides).forEach((e) => {
96
96
  this._injector.add(e);
97
- }), [xt, F].forEach((e) => {
97
+ }), [bt, F].forEach((e) => {
98
98
  this._commandService.registerCommand(e);
99
99
  });
100
100
  }
101
101
  };
102
- $e(ce, "pluginName", It);
102
+ $e(ce, "pluginName", xt);
103
103
  $e(ce, "type", de.UNIVER_UNKNOWN);
104
104
  ce = St([
105
- Ae(nt),
105
+ Ae(rt),
106
106
  me(1, ye(Be)),
107
107
  me(2, te),
108
108
  me(3, We)
109
109
  ], ce);
110
110
  function z({ ref: n, ...e }) {
111
111
  const { icon: t, id: r, className: i, extend: o, ...c } = e, x = `univerjs-icon univerjs-icon-${r} ${i || ""}`.trim(), h = ee(`_${kt()}`);
112
- return ke(t, `${r}`, {
112
+ return Ue(t, `${r}`, {
113
113
  defIds: t.defIds,
114
114
  idSuffix: h.current
115
115
  }, {
@@ -118,14 +118,14 @@ function z({ ref: n, ...e }) {
118
118
  ...c
119
119
  }, o);
120
120
  }
121
- function ke(n, e, t, r, i) {
122
- return G(n.tag, {
121
+ function Ue(n, e, t, r, i) {
122
+ return K(n.tag, {
123
123
  key: e,
124
- ...Nt(n, t, i),
124
+ ...$t(n, t, i),
125
125
  ...r
126
- }, ($t(n, t).children || []).map((o, c) => ke(o, `${e}-${n.tag}-${c}`, t, void 0, i)));
126
+ }, (Ut(n, t).children || []).map((o, c) => Ue(o, `${e}-${n.tag}-${c}`, t, void 0, i)));
127
127
  }
128
- function Nt(n, e, t) {
128
+ function $t(n, e, t) {
129
129
  const r = { ...n.attrs };
130
130
  t != null && t.colorChannel1 && r.fill === "colorChannel1" && (r.fill = t.colorChannel1), n.tag === "mask" && r.id && (r.id = r.id + e.idSuffix), Object.entries(r).forEach(([o, c]) => {
131
131
  o === "mask" && typeof c == "string" && (r[o] = c.replace(/url\(#(.*)\)/, `url(#$1${e.idSuffix})`));
@@ -135,7 +135,7 @@ function Nt(n, e, t) {
135
135
  typeof c == "string" && (r[o] = c.replace(/url\(#(.*)\)/, `url(#$1${e.idSuffix})`));
136
136
  })), r;
137
137
  }
138
- function $t(n, e) {
138
+ function Ut(n, e) {
139
139
  var r;
140
140
  const { defIds: t } = e;
141
141
  return !t || t.length === 0 ? n : n.tag === "defs" && ((r = n.children) != null && r.length) ? {
@@ -153,7 +153,7 @@ function kt() {
153
153
  return Math.random().toString(36).substring(2, 8);
154
154
  }
155
155
  z.displayName = "UniverIcon";
156
- const Ut = {
156
+ const Tt = {
157
157
  tag: "svg",
158
158
  attrs: {
159
159
  xmlns: "http://www.w3.org/2000/svg",
@@ -194,15 +194,15 @@ const Ut = {
194
194
  }
195
195
  }
196
196
  ]
197
- }, Ue = K(function(e, t) {
198
- return G(z, Object.assign({}, e, {
197
+ }, ke = G(function(e, t) {
198
+ return K(z, Object.assign({}, e, {
199
199
  id: "delete-icon",
200
200
  ref: t,
201
- icon: Ut
201
+ icon: Tt
202
202
  }));
203
203
  });
204
- Ue.displayName = "DeleteIcon";
205
- const Tt = {
204
+ ke.displayName = "DeleteIcon";
205
+ const Dt = {
206
206
  tag: "svg",
207
207
  attrs: {
208
208
  xmlns: "http://www.w3.org/2000/svg",
@@ -218,15 +218,15 @@ const Tt = {
218
218
  d: "M8.6 1.99991C8.60001 1.66854 8.33138 1.39991 8.00001 1.3999C7.66864 1.3999 7.40001 1.66853 7.4 1.9999L7.39996 7.3999H1.9999C1.66853 7.3999 1.3999 7.66853 1.3999 7.9999C1.3999 8.33127 1.66853 8.5999 1.9999 8.5999H7.39995L7.3999 13.9999C7.3999 14.3313 7.66853 14.5999 7.9999 14.5999C8.33127 14.5999 8.5999 14.3313 8.5999 13.9999L8.59995 8.5999H13.9999C14.3313 8.5999 14.5999 8.33127 14.5999 7.9999C14.5999 7.66853 14.3313 7.3999 13.9999 7.3999H8.59996L8.6 1.99991Z"
219
219
  }
220
220
  }]
221
- }, Te = K(function(e, t) {
222
- return G(z, Object.assign({}, e, {
221
+ }, Te = G(function(e, t) {
222
+ return K(z, Object.assign({}, e, {
223
223
  id: "increase-icon",
224
224
  ref: t,
225
- icon: Tt
225
+ icon: Dt
226
226
  }));
227
227
  });
228
228
  Te.displayName = "IncreaseIcon";
229
- const Dt = {
229
+ const Et = {
230
230
  tag: "svg",
231
231
  attrs: {
232
232
  xmlns: "http://www.w3.org/2000/svg",
@@ -258,15 +258,15 @@ const Dt = {
258
258
  }
259
259
  }
260
260
  ]
261
- }, De = K(function(e, t) {
262
- return G(z, Object.assign({}, e, {
261
+ }, De = G(function(e, t) {
262
+ return K(z, Object.assign({}, e, {
263
263
  id: "more-horizontal-icon",
264
264
  ref: t,
265
- icon: Dt
265
+ icon: Et
266
266
  }));
267
267
  });
268
268
  De.displayName = "MoreHorizontalIcon";
269
- const Et = {
269
+ const Mt = {
270
270
  tag: "svg",
271
271
  attrs: {
272
272
  xmlns: "http://www.w3.org/2000/svg",
@@ -324,15 +324,15 @@ const Et = {
324
324
  }
325
325
  }
326
326
  ]
327
- }, Ee = K(function(e, t) {
328
- return G(z, Object.assign({}, e, {
327
+ }, Ee = G(function(e, t) {
328
+ return K(z, Object.assign({}, e, {
329
329
  id: "reply-to-comment-icon",
330
330
  ref: t,
331
- icon: Et
331
+ icon: Mt
332
332
  }));
333
333
  });
334
334
  Ee.displayName = "ReplyToCommentIcon";
335
- const Mt = {
335
+ const Ot = {
336
336
  tag: "svg",
337
337
  attrs: {
338
338
  xmlns: "http://www.w3.org/2000/svg",
@@ -350,11 +350,11 @@ const Mt = {
350
350
  clipRule: "evenodd"
351
351
  }
352
352
  }]
353
- }, Me = K(function(e, t) {
354
- return G(z, Object.assign({}, e, {
353
+ }, Me = G(function(e, t) {
354
+ return K(z, Object.assign({}, e, {
355
355
  id: "resolved-icon",
356
356
  ref: t,
357
- icon: Mt
357
+ icon: Ot
358
358
  }));
359
359
  });
360
360
  Me.displayName = "ResolvedIcon";
@@ -386,14 +386,14 @@ const Rt = {
386
386
  strokeWidth: 1.2
387
387
  }
388
388
  }]
389
- }, Re = K(function(e, t) {
390
- return G(z, Object.assign({}, e, {
389
+ }, Oe = G(function(e, t) {
390
+ return K(z, Object.assign({}, e, {
391
391
  id: "solve-icon",
392
392
  ref: t,
393
393
  icon: Rt
394
394
  }));
395
395
  });
396
- Re.displayName = "SolveIcon";
396
+ Oe.displayName = "SolveIcon";
397
397
  function be(n) {
398
398
  return {
399
399
  id: "d",
@@ -401,9 +401,9 @@ function be(n) {
401
401
  documentStyle: {}
402
402
  };
403
403
  }
404
- const Oe = K((n, e) => {
405
- var R;
406
- const { comment: t, onSave: r, id: i, onCancel: o, autoFocus: c, unitId: x, type: h } = n, N = S(te), k = S(he), [V, U] = P(!1), b = S(mt), u = ee(null), v = h === de.UNIVER_DOC ? Ke : x, [T, y] = P(() => {
404
+ const Re = G((n, e) => {
405
+ var O;
406
+ const { comment: t, onSave: r, id: i, onCancel: o, autoFocus: c, unitId: x, type: h } = n, S = N(te), U = N(he), [V, k] = P(!1), b = N(ht), u = ee(null), v = h === de.UNIVER_DOC ? Ge : x, [T, y] = P(() => {
407
407
  var d, m, f;
408
408
  return ue.transform.getPlainText((f = (m = (d = u.current) == null ? void 0 : d.getDocumentData().body) == null ? void 0 : m.dataStream) != null ? f : "");
409
409
  });
@@ -415,16 +415,16 @@ const Oe = K((n, e) => {
415
415
  y(ue.transform.getPlainText((A = (_ = (s = u.current) == null ? void 0 : s.getDocumentData().body) == null ? void 0 : _.dataStream) != null ? A : ""));
416
416
  });
417
417
  return () => d == null ? void 0 : d.unsubscribe();
418
- }, [(R = u.current) == null ? void 0 : R.selectionChange$]);
418
+ }, [(O = u.current) == null ? void 0 : O.selectionChange$]);
419
419
  const j = X(() => ({
420
420
  keyCodes: [{ keyCode: pe.ENTER }],
421
421
  handler: (d) => {
422
- d === pe.ENTER && N.executeCommand(
423
- ht.id
422
+ d === pe.ENTER && S.executeCommand(
423
+ ft.id
424
424
  );
425
425
  }
426
- }), [N]);
427
- vt(e, () => ({
426
+ }), [S]);
427
+ mt(e, () => ({
428
428
  reply(d) {
429
429
  var f, w;
430
430
  if (!u.current)
@@ -440,8 +440,8 @@ const Oe = K((n, e) => {
440
440
  }));
441
441
  const C = () => {
442
442
  if (u.current) {
443
- const d = ze.deepClone(u.current.getDocumentData().body);
444
- U(!1), r == null || r({
443
+ const d = Ye.deepClone(u.current.getDocumentData().body);
444
+ k(!1), r == null || r({
445
445
  ...t,
446
446
  text: d
447
447
  }), u.current.replaceText(""), setTimeout(() => {
@@ -452,15 +452,16 @@ const Oe = K((n, e) => {
452
452
  };
453
453
  return /* @__PURE__ */ I("div", { onClick: (d) => d.preventDefault(), children: [
454
454
  /* @__PURE__ */ l(
455
- ft,
455
+ pt,
456
456
  {
457
457
  className: "univer-w-full",
458
458
  editorRef: u,
459
+ editorId: ze,
459
460
  autoFocus: c,
460
461
  keyboardEventConfig: j,
461
- placeholder: k.t("threadCommentUI.editor.placeholder"),
462
+ placeholder: U.t("threadCommentUI.editor.placeholder"),
462
463
  initialValue: (t == null ? void 0 : t.text) && be(t.text),
463
- onFocusChange: (d) => d && U(d),
464
+ onFocusChange: (d) => d && k(d),
464
465
  isSingle: !1,
465
466
  maxHeight: 64,
466
467
  onClickOutside: () => {
@@ -476,9 +477,9 @@ const Oe = K((n, e) => {
476
477
  {
477
478
  onClick: () => {
478
479
  var d;
479
- o == null || o(), U(!1), (d = u.current) == null || d.replaceText("", !0), N.executeCommand(F.id);
480
+ o == null || o(), k(!1), (d = u.current) == null || d.replaceText("", !0), S.executeCommand(F.id);
480
481
  },
481
- children: k.t("threadCommentUI.editor.cancel")
482
+ children: U.t("threadCommentUI.editor.cancel")
482
483
  }
483
484
  ),
484
485
  /* @__PURE__ */ l(
@@ -487,12 +488,12 @@ const Oe = K((n, e) => {
487
488
  variant: "primary",
488
489
  disabled: !T,
489
490
  onClick: C,
490
- children: k.t(i ? "threadCommentUI.editor.save" : "threadCommentUI.editor.reply")
491
+ children: U.t(i ? "threadCommentUI.editor.save" : "threadCommentUI.editor.reply")
491
492
  }
492
493
  )
493
494
  ] }) : null
494
495
  ] });
495
- }), Ot = (n) => {
496
+ }), Lt = (n) => {
496
497
  const { dataStream: e, customRanges: t } = n, r = e.endsWith(`\r
497
498
  `) ? e.length - 2 : e.length, i = [];
498
499
  let o = 0;
@@ -511,14 +512,14 @@ const Oe = K((n, e) => {
511
512
  type: "text",
512
513
  content: e.slice(o, r)
513
514
  }), i;
514
- }, Lt = (n) => {
515
+ }, Ht = (n) => {
515
516
  const { paragraphs: e = [] } = n;
516
517
  let t = 0;
517
518
  return e.map((r) => {
518
- const i = qe(n, t, r.startIndex);
519
- return t = r.startIndex + 1, Ot(i);
519
+ const i = Je(n, t, r.startIndex);
520
+ return t = r.startIndex + 1, Lt(i);
520
521
  });
521
- }, Ht = (n) => {
522
+ }, Vt = (n) => {
522
523
  let e = "";
523
524
  const t = [];
524
525
  return n.forEach((r) => {
@@ -532,7 +533,7 @@ const Oe = K((n, e) => {
532
533
  const o = e.length - 1;
533
534
  t.push({
534
535
  rangeId: r.content.id,
535
- rangeType: Ye.MENTION,
536
+ rangeType: qe.MENTION,
536
537
  startIndex: i,
537
538
  endIndex: o,
538
539
  properties: {},
@@ -558,18 +559,18 @@ const Oe = K((n, e) => {
558
559
  dataStream: e,
559
560
  customRanges: t
560
561
  };
561
- }, Le = "__mock__", Vt = (n) => {
562
- const { item: e, unitId: t, subUnitId: r, editing: i, onEditingChange: o, onReply: c, resolved: x, isRoot: h, onClose: N, onDeleteComment: k, type: V } = n, U = S(te), b = S(he), u = S(fe), v = u.getUser(e.personId), T = Z(u.currentUser$), y = (T == null ? void 0 : T.userID) === e.personId, j = e.id === Le, [C, R] = P(!1), d = Qe(Xe), m = d == null ? void 0 : d.avatarFallback, f = () => {
563
- (k == null ? void 0 : k(e)) !== !1 && (U.executeCommand(
564
- h ? Ne.id : lt.id,
562
+ }, Le = "__mock__", jt = (n) => {
563
+ const { item: e, unitId: t, subUnitId: r, editing: i, onEditingChange: o, onReply: c, resolved: x, isRoot: h, onClose: S, onDeleteComment: U, type: V } = n, k = N(te), b = N(he), u = N(fe), v = u.getUser(e.personId), T = Z(u.currentUser$), y = (T == null ? void 0 : T.userID) === e.personId, j = e.id === Le, [C, O] = P(!1), d = Xe(et), m = d == null ? void 0 : d.avatarFallback, f = () => {
564
+ (U == null ? void 0 : U(e)) !== !1 && (k.executeCommand(
565
+ h ? Se.id : at.id,
565
566
  {
566
567
  unitId: t,
567
568
  subUnitId: r,
568
569
  commentId: e.id
569
570
  }
570
- ), h && (N == null || N()));
571
+ ), h && (S == null || S()));
571
572
  };
572
- return /* @__PURE__ */ I("div", { className: "univer-relative univer-mb-3 univer-pl-[30px]", onMouseLeave: () => R(!1), onMouseEnter: () => R(!0), children: [
573
+ return /* @__PURE__ */ I("div", { className: "univer-relative univer-mb-3 univer-pl-[30px]", onMouseLeave: () => O(!1), onMouseEnter: () => O(!0), children: [
573
574
  /* @__PURE__ */ l(
574
575
  "div",
575
576
  {
@@ -591,7 +592,7 @@ const Oe = K((n, e) => {
591
592
  }
592
593
  ) : null,
593
594
  y && !j && !x ? /* @__PURE__ */ l(
594
- ut,
595
+ vt,
595
596
  {
596
597
  overlay: /* @__PURE__ */ l("div", { className: "univer-rounded-lg", children: /* @__PURE__ */ I(
597
598
  "ul",
@@ -636,7 +637,7 @@ const Oe = K((n, e) => {
636
637
  }
637
638
  ),
638
639
  i ? /* @__PURE__ */ l(
639
- Oe,
640
+ Re,
640
641
  {
641
642
  type: V,
642
643
  id: e.id,
@@ -646,8 +647,8 @@ const Oe = K((n, e) => {
646
647
  unitId: t,
647
648
  subUnitId: r,
648
649
  onSave: ({ text: w, attachments: p }) => {
649
- o == null || o(!1), U.executeCommand(
650
- st.id,
650
+ o == null || o(!1), k.executeCommand(
651
+ lt.id,
651
652
  {
652
653
  unitId: t,
653
654
  subUnitId: r,
@@ -664,7 +665,7 @@ const Oe = K((n, e) => {
664
665
  "div",
665
666
  {
666
667
  className: "univer-text-sm univer-text-gray-900 dark:!univer-text-white",
667
- children: Lt(e.text).map((w, p) => /* @__PURE__ */ l("div", { className: "univer-break-words", children: w.map((s, _) => {
668
+ children: Ht(e.text).map((w, p) => /* @__PURE__ */ l("div", { className: "univer-break-words", children: w.map((s, _) => {
668
669
  switch (s.type) {
669
670
  case "mention":
670
671
  return /* @__PURE__ */ I("a", { className: "univer-text-primary-600", children: [
@@ -678,7 +679,7 @@ const Oe = K((n, e) => {
678
679
  }
679
680
  )
680
681
  ] });
681
- }, jt = (n) => {
682
+ }, Pt = (n) => {
682
683
  var se, Q, a;
683
684
  const {
684
685
  id: e,
@@ -689,10 +690,10 @@ const Oe = K((n, e) => {
689
690
  onClick: c,
690
691
  showHighlight: x,
691
692
  onClose: h,
692
- getSubUnitName: N,
693
- prefix: k,
693
+ getSubUnitName: S,
694
+ prefix: U,
694
695
  autoFocus: V,
695
- onMouseEnter: U,
696
+ onMouseEnter: k,
696
697
  onMouseLeave: b,
697
698
  onAddComment: u,
698
699
  onDeleteComment: v,
@@ -700,9 +701,9 @@ const Oe = K((n, e) => {
700
701
  type: y,
701
702
  style: j,
702
703
  full: C
703
- } = n, R = S(Se), [d, m] = P(!1), [f, w] = P(""), p = X(() => R.commentUpdate$.pipe(tt(16)), [R]);
704
+ } = n, O = N(Ne), [d, m] = P(!1), [f, w] = P(""), p = X(() => O.commentUpdate$.pipe(nt(16)), [O]);
704
705
  Z(p);
705
- const s = e ? R.getCommentWithChildren(t, r, e) : null, _ = S(te), A = S(fe), D = s == null ? void 0 : s.root.resolved, E = Z(A.currentUser$), L = ee(null), q = [
706
+ const s = e ? O.getCommentWithChildren(t, r, e) : null, _ = N(te), A = N(fe), D = s == null ? void 0 : s.root.resolved, E = Z(A.currentUser$), L = ee(null), q = [
706
707
  ...s ? [s.root] : (
707
708
  // mock empty comment
708
709
  [{
@@ -720,12 +721,12 @@ const Oe = K((n, e) => {
720
721
  }]
721
722
  ),
722
723
  ...(Q = s == null ? void 0 : s.children) != null ? Q : []
723
- ], O = ee(null), ne = (g) => {
724
+ ], R = ee(null), ne = (g) => {
724
725
  g.stopPropagation(), D ? _.executeCommand(F.id, {
725
726
  unitId: t,
726
727
  subUnitId: r,
727
728
  commentId: e
728
- }) : _.executeCommand(F.id), _.executeCommand(ot.id, {
729
+ }) : _.executeCommand(F.id), _.executeCommand(st.id, {
729
730
  unitId: t,
730
731
  subUnitId: r,
731
732
  commentId: e,
@@ -733,7 +734,7 @@ const Oe = K((n, e) => {
733
734
  }), T == null || T(!D);
734
735
  }, J = (g) => {
735
736
  g.stopPropagation(), _.executeCommand(F.id), !(s != null && s.root && (v == null ? void 0 : v(s.root)) === !1) && (_.executeCommand(
736
- Ne.id,
737
+ Se.id,
737
738
  {
738
739
  unitId: t,
739
740
  subUnitId: r,
@@ -742,20 +743,20 @@ const Oe = K((n, e) => {
742
743
  ), h == null || h());
743
744
  };
744
745
  ae(() => b == null ? void 0 : b(), []);
745
- const re = N((a = s == null ? void 0 : s.root.subUnitId) != null ? a : r), ie = o && !f && !D, oe = `${i || (s == null ? void 0 : s.root.ref) || ""}${re ? " · " : ""}${re}`;
746
+ const re = S((a = s == null ? void 0 : s.root.subUnitId) != null ? a : r), ie = o && !f && !D, oe = `${i || (s == null ? void 0 : s.root.ref) || ""}${re ? " · " : ""}${re}`;
746
747
  return /* @__PURE__ */ I(
747
748
  "div",
748
749
  {
749
- id: `${k}-${t}-${r}-${e}`,
750
- className: ve("univer-relative univer-box-border univer-rounded-md univer-bg-white univer-p-4 dark:!univer-bg-gray-900 dark:!univer-text-white", dt, {
750
+ id: `${U}-${t}-${r}-${e}`,
751
+ className: ve("univer-relative univer-box-border univer-rounded-md univer-bg-white univer-p-4 dark:!univer-bg-gray-900 dark:!univer-text-white", ut, {
751
752
  "univer-w-[278px]": !C,
752
753
  "univer-w-full": C,
753
- "univer-shadow": !D && (x || d || k === "cell")
754
+ "univer-shadow": !D && (x || d || U === "cell")
754
755
  }),
755
756
  style: j,
756
757
  onClick: c,
757
758
  onMouseEnter: () => {
758
- U == null || U(), m(!0);
759
+ k == null || k(), m(!0);
759
760
  },
760
761
  onMouseLeave: () => {
761
762
  b == null || b(), m(!1);
@@ -779,7 +780,7 @@ const Oe = K((n, e) => {
779
780
  className: "univer-mr-2 univer-h-3.5 univer-w-[3px] univer-flex-shrink-0 univer-flex-grow-0 univer-rounded-sm univer-bg-yellow-500"
780
781
  }
781
782
  ),
782
- /* @__PURE__ */ l(at, { showIfEllipsis: !0, title: oe, children: /* @__PURE__ */ l(
783
+ /* @__PURE__ */ l(ct, { showIfEllipsis: !0, title: oe, children: /* @__PURE__ */ l(
783
784
  "span",
784
785
  {
785
786
  className: "univer-flex-1 univer-truncate",
@@ -795,7 +796,7 @@ const Oe = K((n, e) => {
795
796
  "univer-text-green-500": D
796
797
  }),
797
798
  onClick: ne,
798
- children: D ? /* @__PURE__ */ l(Me, {}) : /* @__PURE__ */ l(Re, {})
799
+ children: D ? /* @__PURE__ */ l(Me, {}) : /* @__PURE__ */ l(Oe, {})
799
800
  }
800
801
  ),
801
802
  (E == null ? void 0 : E.userID) === s.root.personId ? /* @__PURE__ */ l(
@@ -803,7 +804,7 @@ const Oe = K((n, e) => {
803
804
  {
804
805
  className: "univer-ml-1 univer-inline-flex univer-h-6 univer-w-6 univer-cursor-pointer univer-items-center univer-justify-center univer-rounded-[3px] univer-text-base hover:univer-bg-gray-50 dark:hover:!univer-bg-gray-800",
805
806
  onClick: J,
806
- children: /* @__PURE__ */ l(Ue, {})
807
+ children: /* @__PURE__ */ l(ke, {})
807
808
  }
808
809
  ) : null
809
810
  ] })
@@ -813,11 +814,11 @@ const Oe = K((n, e) => {
813
814
  /* @__PURE__ */ l(
814
815
  "div",
815
816
  {
816
- ref: O,
817
- className: ve("univer-max-h-80 univer-overflow-y-auto univer-overflow-x-hidden", ct),
817
+ ref: R,
818
+ className: ve("univer-max-h-80 univer-overflow-y-auto univer-overflow-x-hidden", dt),
818
819
  children: q.map(
819
820
  (g) => /* @__PURE__ */ l(
820
- Vt,
821
+ jt,
821
822
  {
822
823
  unitId: t,
823
824
  subUnitId: r,
@@ -833,7 +834,7 @@ const Oe = K((n, e) => {
833
834
  onReply: (M) => {
834
835
  M && requestAnimationFrame(() => {
835
836
  var H;
836
- (H = L.current) == null || H.reply(Ht([
837
+ (H = L.current) == null || H.reply(Vt([
837
838
  {
838
839
  type: "mention",
839
840
  content: {
@@ -857,7 +858,7 @@ const Oe = K((n, e) => {
857
858
  }
858
859
  ),
859
860
  ie && /* @__PURE__ */ l("div", { children: /* @__PURE__ */ l(
860
- Oe,
861
+ Re,
861
862
  {
862
863
  ref: L,
863
864
  type: y,
@@ -867,8 +868,8 @@ const Oe = K((n, e) => {
867
868
  const H = {
868
869
  text: g,
869
870
  attachments: M,
870
- dT: rt(),
871
- id: Je(),
871
+ dT: it(),
872
+ id: Qe(),
872
873
  ref: i,
873
874
  personId: E == null ? void 0 : E.userID,
874
875
  parentId: s == null ? void 0 : s.root.id,
@@ -877,13 +878,13 @@ const Oe = K((n, e) => {
877
878
  threadId: s == null ? void 0 : s.root.threadId
878
879
  };
879
880
  (u == null ? void 0 : u(H)) !== !1 && (await _.executeCommand(
880
- it.id,
881
+ ot.id,
881
882
  {
882
883
  unitId: t,
883
884
  subUnitId: r,
884
885
  comment: H
885
886
  }
886
- ), O.current && (O.current.scrollTop = O.current.scrollHeight));
887
+ ), R.current && (R.current.scrollTop = R.current.scrollHeight));
887
888
  },
888
889
  autoFocus: V || !s,
889
890
  onCancel: () => {
@@ -895,7 +896,7 @@ const Oe = K((n, e) => {
895
896
  ]
896
897
  }
897
898
  );
898
- }, Yt = (n) => {
899
+ }, qt = (n) => {
899
900
  const {
900
901
  unitId: e,
901
902
  subUnitId$: t,
@@ -905,13 +906,13 @@ const Oe = K((n, e) => {
905
906
  onResolve: c,
906
907
  sortComments: x,
907
908
  onItemLeave: h,
908
- onItemEnter: N,
909
- disableAdd: k,
909
+ onItemEnter: S,
910
+ disableAdd: U,
910
911
  tempComment: V,
911
- onAddComment: U,
912
+ onAddComment: k,
912
913
  onDeleteComment: b,
913
914
  showComments: u
914
- } = n, [v, T] = P("all"), [y, j] = P("all"), C = S(he), R = S(fe), d = S(Se), [m, f] = P(() => d.getUnit(e)), w = S(Y), p = Z(w.activeCommentId$), s = Z(d.commentUpdate$), _ = S(te), A = Z(t), D = ee(!0), E = "panel", L = Z(R.currentUser$), q = X(() => {
915
+ } = n, [v, T] = P("all"), [y, j] = P("all"), C = N(he), O = N(fe), d = N(Ne), [m, f] = P(() => d.getUnit(e)), w = N(Y), p = Z(w.activeCommentId$), s = Z(d.commentUpdate$), _ = N(te), A = Z(t), D = ee(!0), E = "panel", L = Z(O.currentUser$), q = X(() => {
915
916
  var H;
916
917
  const a = v === "all" ? m : (H = m.filter(($) => $.subUnitId === A)) != null ? H : [], g = x != null ? x : (($) => $), M = a.map(($) => {
917
918
  var B;
@@ -924,10 +925,10 @@ const Oe = K((n, e) => {
924
925
  }), [...u, ""].map((B) => $.get(B)).filter(Boolean);
925
926
  } else
926
927
  return g(M);
927
- }, [u, v, m, x, A]), O = X(() => [
928
+ }, [u, v, m, x, A]), R = X(() => [
928
929
  ...q.filter((a) => !a.resolved),
929
930
  ...q.filter((a) => a.resolved)
930
- ], [q]), ne = X(() => y === "resolved" ? O.filter((a) => a.resolved) : y === "unsolved" ? O.filter((a) => !a.resolved) : y === "concern_me" && L != null && L.userID ? O.filter((a) => a == null ? void 0 : a.users.has(L.userID)) : O, [O, L == null ? void 0 : L.userID, y]), J = V ? [V, ...ne] : ne, re = J.filter((a) => !a.resolved), ie = J.filter((a) => a.resolved), oe = y !== "all" || v !== "all", se = () => {
931
+ ], [q]), ne = X(() => y === "resolved" ? R.filter((a) => a.resolved) : y === "unsolved" ? R.filter((a) => !a.resolved) : y === "concern_me" && L != null && L.userID ? R.filter((a) => a == null ? void 0 : a.users.has(L.userID)) : R, [R, L == null ? void 0 : L.userID, y]), J = V ? [V, ...ne] : ne, re = J.filter((a) => !a.resolved), ie = J.filter((a) => a.resolved), oe = y !== "all" || v !== "all", se = () => {
931
932
  j("all"), T("all");
932
933
  };
933
934
  ae(() => {
@@ -946,7 +947,7 @@ const Oe = K((n, e) => {
946
947
  ($ = document.getElementById(H)) == null || $.scrollIntoView({ block: "center" });
947
948
  }, [p]);
948
949
  const Q = (a) => /* @__PURE__ */ l(
949
- jt,
950
+ Pt,
950
951
  {
951
952
  prefix: E,
952
953
  getSubUnitName: o,
@@ -968,9 +969,9 @@ const Oe = K((n, e) => {
968
969
  }
969
970
  );
970
971
  },
971
- onMouseEnter: () => N == null ? void 0 : N(a),
972
+ onMouseEnter: () => S == null ? void 0 : S(a),
972
973
  onMouseLeave: () => h == null ? void 0 : h(a),
973
- onAddComment: U,
974
+ onAddComment: k,
974
975
  onDeleteComment: b,
975
976
  onResolve: (g) => c == null ? void 0 : c(a.id, g)
976
977
  },
@@ -1029,7 +1030,7 @@ const Oe = K((n, e) => {
1029
1030
  className: "univer-flex univer-flex-1 univer-flex-col univer-items-center univer-justify-center univer-text-sm univer-text-gray-600 dark:!univer-text-gray-200",
1030
1031
  children: [
1031
1032
  C.t("threadCommentUI.panel.empty"),
1032
- oe ? /* @__PURE__ */ l("div", { className: "univer-mt-2 univer-flex univer-flex-row", children: /* @__PURE__ */ l(le, { onClick: se, children: C.t("threadCommentUI.panel.reset") }) }) : k ? null : /* @__PURE__ */ l("div", { className: "univer-mt-2 univer-flex univer-flex-row", children: /* @__PURE__ */ I(le, { onClick: i, children: [
1033
+ oe ? /* @__PURE__ */ l("div", { className: "univer-mt-2 univer-flex univer-flex-row", children: /* @__PURE__ */ l(le, { onClick: se, children: C.t("threadCommentUI.panel.reset") }) }) : U ? null : /* @__PURE__ */ l("div", { className: "univer-mt-2 univer-flex univer-flex-row", children: /* @__PURE__ */ I(le, { onClick: i, children: [
1033
1034
  /* @__PURE__ */ l(Te, { className: "univer-mr-1.5" }),
1034
1035
  C.t("threadCommentUI.panel.addComment")
1035
1036
  ] }) })
@@ -1044,10 +1045,10 @@ const Oe = K((n, e) => {
1044
1045
  };
1045
1046
  export {
1046
1047
  F as SetActiveCommentOperation,
1047
- gt as THREAD_COMMENT_PANEL,
1048
- Yt as ThreadCommentPanel,
1048
+ It as THREAD_COMMENT_PANEL,
1049
+ qt as ThreadCommentPanel,
1049
1050
  Y as ThreadCommentPanelService,
1050
- jt as ThreadCommentTree,
1051
- xt as ToggleSheetCommentPanelOperation,
1051
+ Pt as ThreadCommentTree,
1052
+ bt as ToggleSheetCommentPanelOperation,
1052
1053
  ce as UniverThreadCommentUIPlugin
1053
1054
  };