@univerjs/thread-comment-ui 0.1.17 → 0.2.1

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/es/index.js CHANGED
@@ -1,31 +1,36 @@
1
- var Pe = Object.defineProperty;
2
- var $e = (t, e, n) => e in t ? Pe(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n;
3
- var P = (t, e, n) => $e(t, typeof e != "symbol" ? e + "" : e, n);
4
- import { UniverThreadCommentPlugin as He, ThreadCommentModel as de, AddCommentCommand as we, UpdateCommentCommand as De, ResolveCommentCommand as Re, DeleteCommentTreeCommand as ce, DeleteCommentCommand as Le } from "@univerjs/thread-comment";
5
- import { Disposable as ue, UniverInstanceType as he, IUniverInstanceService as ke, CommandType as Ce, OnLifecycle as je, LifecycleStages as Ae, LocaleService as J, Plugin as Ve, mergeOverrideWithDependencies as Be, DependentOn as We, ICommandService as Q, CustomRangeType as Fe, UserManagerService as ee, Tools as ze } from "@univerjs/core";
6
- import { Inject as te, createIdentifier as Ze, Injector as Ye } from "@wendellhu/redi";
7
- import { ISidebarService as ve, useObservable as j } from "@univerjs/ui";
8
- import { BehaviorSubject as re, filter as Ge } from "rxjs";
9
- import o, { forwardRef as H, useRef as X, createElement as L, useState as $, useImperativeHandle as Ke, useMemo as ae, useEffect as oe } from "react";
10
- import { useDependency as E } from "@wendellhu/redi/react-bindings";
11
- import { Mentions as qe, Mention as Je, Button as G, Dropdown as Qe, Menu as Xe, MenuItem as ie, Select as le } from "@univerjs/design";
12
- import et from "dayjs";
13
- import tt from "clsx";
14
- const nt = "thread-comment-panel", rt = "THREAD_COMMENT_UI_PLUGIN";
15
- var at = Object.defineProperty, ot = Object.getOwnPropertyDescriptor, it = (t, e, n, r) => {
16
- for (var a = r > 1 ? void 0 : r ? ot(e, n) : e, i = t.length - 1, s; i >= 0; i--)
17
- (s = t[i]) && (a = (r ? s(e, n, a) : s(a)) || a);
18
- return r && a && at(e, n, a), a;
19
- }, se = (t, e) => (n, r) => e(n, r, t);
20
- let A = class extends ue {
1
+ var je = Object.defineProperty;
2
+ var Ve = (t, e, n) => e in t ? je(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n;
3
+ var w = (t, e, n) => Ve(t, typeof e != "symbol" ? e + "" : e, n);
4
+ import Be from "dayjs";
5
+ import { UniverThreadCommentPlugin as Fe, ThreadCommentModel as Se, AddCommentCommand as We, UpdateCommentCommand as ze, ResolveCommentCommand as Ze, DeleteCommentTreeCommand as Ee, DeleteCommentCommand as Ye } from "@univerjs/thread-comment";
6
+ import { Disposable as ye, UniverInstanceType as he, IUniverInstanceService as Ge, CommandType as xe, OnLifecycle as Ke, LifecycleStages as qe, LocaleService as se, Plugin as Je, mergeOverrideWithDependencies as Qe, DependentOn as Xe, ICommandService as J, CustomRangeType as et, UserManagerService as Ce, Tools as tt } from "@univerjs/core";
7
+ import { Inject as ve, createIdentifier as nt, Injector as rt } from "@wendellhu/redi";
8
+ import { ISidebarService as _e, useObservable as L } from "@univerjs/ui";
9
+ import { BehaviorSubject as fe, filter as ot } from "rxjs";
10
+ import a, { forwardRef as A, useRef as me, createElement as V, useState as k, useImperativeHandle as at, useEffect as ue, useMemo as ce } from "react";
11
+ import { useDependency as S } from "@wendellhu/redi/react-bindings";
12
+ import { Mentions as it, Mention as lt, Button as ae, Dropdown as st, Menu as mt, MenuItem as ge, Select as pe } from "@univerjs/design";
13
+ import dt from "clsx";
14
+ import { ITextSelectionRenderManager as ct } from "@univerjs/engine-render";
15
+ import { TextSelectionManagerService as ut } from "@univerjs/docs";
16
+ function ht() {
17
+ return Be().format("YYYY/MM/DD HH:mm");
18
+ }
19
+ const Ct = "thread-comment-panel", vt = "THREAD_COMMENT_UI_PLUGIN";
20
+ var ft = Object.defineProperty, gt = Object.getOwnPropertyDescriptor, pt = (t, e, n, r) => {
21
+ for (var o = r > 1 ? void 0 : r ? gt(e, n) : e, l = t.length - 1, m; l >= 0; l--)
22
+ (m = t[l]) && (o = (r ? m(e, n, o) : m(o)) || o);
23
+ return r && o && ft(e, n, o), o;
24
+ }, Ie = (t, e) => (n, r) => e(n, r, t);
25
+ let F = class extends ye {
21
26
  constructor(e, n) {
22
27
  super();
23
- P(this, "_panelVisible", !1);
24
- P(this, "_panelVisible$", new re(!1));
25
- P(this, "_activeCommentId");
26
- P(this, "_activeCommentId$", new re(void 0));
27
- P(this, "panelVisible$", this._panelVisible$.asObservable());
28
- P(this, "activeCommentId$", this._activeCommentId$.asObservable());
28
+ w(this, "_panelVisible", !1);
29
+ w(this, "_panelVisible$", new fe(!1));
30
+ w(this, "_activeCommentId");
31
+ w(this, "_activeCommentId$", new fe(void 0));
32
+ w(this, "panelVisible$", this._panelVisible$.asObservable());
33
+ w(this, "activeCommentId$", this._activeCommentId$.asObservable());
29
34
  this._sidebarService = e, this._univerInstanceService = n, this._init();
30
35
  }
31
36
  _init() {
@@ -34,7 +39,7 @@ let A = class extends ue {
34
39
  e.visible || this.setPanelVisible(!1);
35
40
  })
36
41
  ), this.disposeWithMe(
37
- this._univerInstanceService.getCurrentTypeOfUnit$(he.UNIVER_SHEET).pipe(Ge((e) => !e)).subscribe(() => {
42
+ this._univerInstanceService.getCurrentTypeOfUnit$(he.UNIVER_SHEET).pipe(ot((e) => !e)).subscribe(() => {
38
43
  this._sidebarService.close();
39
44
  })
40
45
  );
@@ -52,224 +57,226 @@ let A = class extends ue {
52
57
  this._activeCommentId = e, this._activeCommentId$.next(e);
53
58
  }
54
59
  };
55
- A = it([
56
- se(0, te(ve)),
57
- se(1, ke)
58
- ], A);
59
- const lt = {
60
+ F = pt([
61
+ Ie(0, ve(_e)),
62
+ Ie(1, Ge)
63
+ ], F);
64
+ const It = {
60
65
  id: "thread-comment-ui.operation.toggle-panel",
61
- type: Ce.OPERATION,
66
+ type: xe.OPERATION,
62
67
  handler(t) {
63
- const e = t.get(ve), n = t.get(A);
68
+ const e = t.get(_e), n = t.get(F);
64
69
  return n.panelVisible ? (e.close(), n.setPanelVisible(!1)) : (e.open({
65
70
  header: { title: "threadCommentUI.panel.title" },
66
- children: { label: nt },
71
+ children: { label: Ct },
67
72
  width: 320
68
73
  }), n.setPanelVisible(!0)), !0;
69
74
  }
70
- }, fe = {
75
+ }, j = {
71
76
  id: "thread-comment-ui.operation.set-active-comment",
72
- type: Ce.OPERATION,
77
+ type: xe.OPERATION,
73
78
  handler(t, e) {
74
- return t.get(A).setActiveComment(e), !0;
79
+ return t.get(F).setActiveComment(e), !0;
75
80
  }
76
81
  };
77
- var st = Object.defineProperty, mt = Object.getOwnPropertyDescriptor, dt = (t, e, n, r) => {
78
- for (var a = r > 1 ? void 0 : r ? mt(e, n) : e, i = t.length - 1, s; i >= 0; i--)
79
- (s = t[i]) && (a = (r ? s(e, n, a) : s(a)) || a);
80
- return r && a && st(e, n, a), a;
81
- }, ct = (t, e) => (n, r) => e(n, r, t);
82
- let Y = class extends ue {
82
+ var bt = Object.defineProperty, St = Object.getOwnPropertyDescriptor, Et = (t, e, n, r) => {
83
+ for (var o = r > 1 ? void 0 : r ? St(e, n) : e, l = t.length - 1, m; l >= 0; l--)
84
+ (m = t[l]) && (o = (r ? m(e, n, o) : m(o)) || o);
85
+ return r && o && bt(e, n, o), o;
86
+ }, yt = (t, e) => (n, r) => e(n, r, t);
87
+ let oe = class extends ye {
83
88
  constructor(t) {
84
89
  super(), this._localeService = t;
85
90
  }
86
91
  };
87
- Y = dt([
88
- je(Ae.Starting, Y),
89
- ct(0, te(J))
90
- ], Y);
91
- class ut {
92
+ oe = Et([
93
+ Ke(qe.Starting, oe),
94
+ yt(0, ve(se))
95
+ ], oe);
96
+ class xt {
92
97
  constructor() {
93
- P(this, "trigger", "@");
98
+ w(this, "dataSource");
99
+ w(this, "renderSuggestion");
100
+ w(this, "trigger", "@");
94
101
  }
95
- async getMentions(e) {
96
- return [];
102
+ async getMentions(e, n, r) {
103
+ return this.dataSource ? this.dataSource.getMentions(e, n, r) : [];
97
104
  }
98
105
  }
99
- const ge = Ze("thread-comment.mention-data.service");
100
- var pe = Object.defineProperty, ht = Object.getOwnPropertyDescriptor, Ct = (t, e, n) => e in t ? pe(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n, vt = (t, e, n, r) => {
101
- for (var a = r > 1 ? void 0 : r ? ht(e, n) : e, i = t.length - 1, s; i >= 0; i--)
102
- (s = t[i]) && (a = (r ? s(e, n, a) : s(a)) || a);
103
- return r && a && pe(e, n, a), a;
104
- }, me = (t, e) => (n, r) => e(n, r, t), Ie = (t, e, n) => Ct(t, typeof e != "symbol" ? e + "" : e, n);
105
- let K = class extends Ve {
106
+ const Te = nt("thread-comment.mention-data.service");
107
+ var Ne = Object.defineProperty, _t = Object.getOwnPropertyDescriptor, Tt = (t, e, n) => e in t ? Ne(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n, Nt = (t, e, n, r) => {
108
+ for (var o = r > 1 ? void 0 : r ? _t(e, n) : e, l = t.length - 1, m; l >= 0; l--)
109
+ (m = t[l]) && (o = (r ? m(e, n, o) : m(o)) || o);
110
+ return r && o && Ne(e, n, o), o;
111
+ }, be = (t, e) => (n, r) => e(n, r, t), Me = (t, e, n) => Tt(t, typeof e != "symbol" ? e + "" : e, n);
112
+ let ie = class extends Je {
106
113
  constructor(t, e, n) {
107
114
  super(), this._config = t, this._injector = e, this._commandService = n;
108
115
  }
109
116
  onStarting(t) {
110
117
  var e;
111
- Be([
112
- [Y],
113
- [A],
114
- [ge, { useClass: ut }]
118
+ Qe([
119
+ [oe],
120
+ [F],
121
+ [Te, { useClass: xt }]
115
122
  ], (e = this._config) == null ? void 0 : e.overrides).forEach((n) => {
116
123
  t.add(n);
117
- }), [lt, fe].forEach((n) => {
124
+ }), [It, j].forEach((n) => {
118
125
  this._commandService.registerCommand(n);
119
126
  });
120
127
  }
121
128
  };
122
- Ie(K, "pluginName", rt);
123
- Ie(K, "type", he.UNIVER_UNKNOWN);
124
- K = vt([
125
- We(He),
126
- me(1, te(Ye)),
127
- me(2, Q)
128
- ], K);
129
- var _ = function() {
130
- return _ = Object.assign || function(t) {
129
+ Me(ie, "pluginName", vt);
130
+ Me(ie, "type", he.UNIVER_UNKNOWN);
131
+ ie = Nt([
132
+ Xe(Fe),
133
+ be(1, ve(rt)),
134
+ be(2, J)
135
+ ], ie);
136
+ var T = function() {
137
+ return T = Object.assign || function(t) {
131
138
  for (var e, n = 1, r = arguments.length; n < r; n++) {
132
139
  e = arguments[n];
133
- for (var a in e) Object.prototype.hasOwnProperty.call(e, a) && (t[a] = e[a]);
140
+ for (var o in e) Object.prototype.hasOwnProperty.call(e, o) && (t[o] = e[o]);
134
141
  }
135
142
  return t;
136
- }, _.apply(this, arguments);
137
- }, ft = function(t, e) {
143
+ }, T.apply(this, arguments);
144
+ }, Mt = function(t, e) {
138
145
  var n = {};
139
146
  for (var r in t) Object.prototype.hasOwnProperty.call(t, r) && e.indexOf(r) < 0 && (n[r] = t[r]);
140
147
  if (t != null && typeof Object.getOwnPropertySymbols == "function")
141
- for (var a = 0, r = Object.getOwnPropertySymbols(t); a < r.length; a++)
142
- e.indexOf(r[a]) < 0 && Object.prototype.propertyIsEnumerable.call(t, r[a]) && (n[r[a]] = t[r[a]]);
148
+ for (var o = 0, r = Object.getOwnPropertySymbols(t); o < r.length; o++)
149
+ e.indexOf(r[o]) < 0 && Object.prototype.propertyIsEnumerable.call(t, r[o]) && (n[r[o]] = t[r[o]]);
143
150
  return n;
144
- }, k = H(function(t, e) {
145
- var n = t.icon, r = t.id, a = t.className, i = t.extend, s = ft(t, ["icon", "id", "className", "extend"]), c = "univerjs-icon univerjs-icon-".concat(r, " ").concat(a || "").trim(), d = X("_".concat(It()));
146
- return be(n, "".concat(r), { defIds: n.defIds, idSuffix: d.current }, _({ ref: e, className: c }, s), i);
151
+ }, B = A(function(t, e) {
152
+ var n = t.icon, r = t.id, o = t.className, l = t.extend, m = Mt(t, ["icon", "id", "className", "extend"]), c = "univerjs-icon univerjs-icon-".concat(r, " ").concat(o || "").trim(), f = me("_".concat(Ot()));
153
+ return Ue(n, "".concat(r), { defIds: n.defIds, idSuffix: f.current }, T({ ref: e, className: c }, m), l);
147
154
  });
148
- function be(t, e, n, r, a) {
149
- return L(t.tag, _(_({ key: e }, gt(t, n, a)), r), (pt(t, n).children || []).map(function(i, s) {
150
- return be(i, "".concat(e, "-").concat(t.tag, "-").concat(s), n, void 0, a);
155
+ function Ue(t, e, n, r, o) {
156
+ return V(t.tag, T(T({ key: e }, Ut(t, n, o)), r), (Pt(t, n).children || []).map(function(l, m) {
157
+ return Ue(l, "".concat(e, "-").concat(t.tag, "-").concat(m), n, void 0, o);
151
158
  }));
152
159
  }
153
- function gt(t, e, n) {
154
- var r = _({}, t.attrs);
160
+ function Ut(t, e, n) {
161
+ var r = T({}, t.attrs);
155
162
  n != null && n.colorChannel1 && r.fill === "colorChannel1" && (r.fill = n.colorChannel1);
156
- var a = e.defIds;
157
- return !a || a.length === 0 || (t.tag === "use" && r["xlink:href"] && (r["xlink:href"] = r["xlink:href"] + e.idSuffix), Object.entries(r).forEach(function(i) {
158
- var s = i[0], c = i[1];
159
- typeof c == "string" && (r[s] = c.replace(/url\(#(.*)\)/, "url(#$1".concat(e.idSuffix, ")")));
163
+ var o = e.defIds;
164
+ return !o || o.length === 0 || (t.tag === "use" && r["xlink:href"] && (r["xlink:href"] = r["xlink:href"] + e.idSuffix), Object.entries(r).forEach(function(l) {
165
+ var m = l[0], c = l[1];
166
+ typeof c == "string" && (r[m] = c.replace(/url\(#(.*)\)/, "url(#$1".concat(e.idSuffix, ")")));
160
167
  })), r;
161
168
  }
162
- function pt(t, e) {
169
+ function Pt(t, e) {
163
170
  var n, r = e.defIds;
164
- return !r || r.length === 0 ? t : t.tag === "defs" && (!((n = t.children) === null || n === void 0) && n.length) ? _(_({}, t), { children: t.children.map(function(a) {
165
- return typeof a.attrs.id == "string" && r && r.indexOf(a.attrs.id) > -1 ? _(_({}, a), { attrs: _(_({}, a.attrs), { id: a.attrs.id + e.idSuffix }) }) : a;
171
+ return !r || r.length === 0 ? t : t.tag === "defs" && (!((n = t.children) === null || n === void 0) && n.length) ? T(T({}, t), { children: t.children.map(function(o) {
172
+ return typeof o.attrs.id == "string" && r && r.indexOf(o.attrs.id) > -1 ? T(T({}, o), { attrs: T(T({}, o.attrs), { id: o.attrs.id + e.idSuffix }) }) : o;
166
173
  }) }) : t;
167
174
  }
168
- function It() {
175
+ function Ot() {
169
176
  return Math.random().toString(36).substring(2, 8);
170
177
  }
171
- k.displayName = "UniverIcon";
172
- var bt = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 16 16", width: "1em", height: "1em" }, children: [{ tag: "path", attrs: { fill: "currentColor", d: "M5.3313 1.4667C5.3313 1.13533 5.59993.866699 5.9313.866699H10.069C10.4004.866699 10.669 1.13533 10.669 1.4667 10.669 1.79807 10.4004 2.0667 10.069 2.0667H5.9313C5.59993 2.0667 5.3313 1.79807 5.3313 1.4667zM1.09985 3.64443C1.09985 3.31306 1.36848 3.04443 1.69985 3.04443H14.2999C14.6312 3.04443 14.8999 3.31306 14.8999 3.64443 14.8999 3.9758 14.6312 4.24443 14.2999 4.24443H1.69985C1.36848 4.24443 1.09985 3.9758 1.09985 3.64443zM6.12398 8.30171C6.35829 8.0674 6.73819 8.0674 6.97251 8.30171L8.00007 9.32928 9.02764 8.30171C9.26195 8.0674 9.64185 8.0674 9.87617 8.30171 10.1105 8.53603 10.1105 8.91593 9.87617 9.15024L8.8486 10.1778 9.87617 11.2054C10.1105 11.4397 10.1105 11.8196 9.87617 12.0539 9.64185 12.2882 9.26195 12.2882 9.02764 12.0539L8.00007 11.0263 6.97251 12.0539C6.73819 12.2882 6.35829 12.2882 6.12398 12.0539 5.88966 11.8196 5.88966 11.4397 6.12398 11.2054L7.15154 10.1778 6.12398 9.15024C5.88966 8.91593 5.88966 8.53603 6.12398 8.30171z" } }, { tag: "path", attrs: { fill: "currentColor", d: "M4.75332 5.22217C3.86966 5.22217 3.15332 5.93851 3.15332 6.82217V12.5331C3.15332 13.9691 4.31738 15.1332 5.75332 15.1332H10.2465C11.6825 15.1332 12.8465 13.9691 12.8465 12.5331V6.82217C12.8465 5.93851 12.1302 5.22217 11.2465 5.22217H4.75332ZM4.35332 6.82217C4.35332 6.60125 4.53241 6.42217 4.75332 6.42217H11.2465C11.4674 6.42217 11.6465 6.60125 11.6465 6.82217V12.5331C11.6465 13.3063 11.0197 13.9332 10.2465 13.9332H5.75332C4.98012 13.9332 4.35332 13.3063 4.35332 12.5331V6.82217Z", fillRule: "evenodd", clipRule: "evenodd" } }] }, Ee = H(function(t, e) {
173
- return L(k, Object.assign({}, t, {
178
+ B.displayName = "UniverIcon";
179
+ var $t = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 16 16", width: "1em", height: "1em" }, children: [{ tag: "path", attrs: { fill: "currentColor", d: "M5.3313 1.4667C5.3313 1.13533 5.59993.866699 5.9313.866699H10.069C10.4004.866699 10.669 1.13533 10.669 1.4667 10.669 1.79807 10.4004 2.0667 10.069 2.0667H5.9313C5.59993 2.0667 5.3313 1.79807 5.3313 1.4667zM1.09985 3.64443C1.09985 3.31306 1.36848 3.04443 1.69985 3.04443H14.2999C14.6312 3.04443 14.8999 3.31306 14.8999 3.64443 14.8999 3.9758 14.6312 4.24443 14.2999 4.24443H1.69985C1.36848 4.24443 1.09985 3.9758 1.09985 3.64443zM6.12398 8.30171C6.35829 8.0674 6.73819 8.0674 6.97251 8.30171L8.00007 9.32928 9.02764 8.30171C9.26195 8.0674 9.64185 8.0674 9.87617 8.30171 10.1105 8.53603 10.1105 8.91593 9.87617 9.15024L8.8486 10.1778 9.87617 11.2054C10.1105 11.4397 10.1105 11.8196 9.87617 12.0539 9.64185 12.2882 9.26195 12.2882 9.02764 12.0539L8.00007 11.0263 6.97251 12.0539C6.73819 12.2882 6.35829 12.2882 6.12398 12.0539 5.88966 11.8196 5.88966 11.4397 6.12398 11.2054L7.15154 10.1778 6.12398 9.15024C5.88966 8.91593 5.88966 8.53603 6.12398 8.30171z" } }, { tag: "path", attrs: { fill: "currentColor", d: "M4.75332 5.22217C3.86966 5.22217 3.15332 5.93851 3.15332 6.82217V12.5331C3.15332 13.9691 4.31738 15.1332 5.75332 15.1332H10.2465C11.6825 15.1332 12.8465 13.9691 12.8465 12.5331V6.82217C12.8465 5.93851 12.1302 5.22217 11.2465 5.22217H4.75332ZM4.35332 6.82217C4.35332 6.60125 4.53241 6.42217 4.75332 6.42217H11.2465C11.4674 6.42217 11.6465 6.60125 11.6465 6.82217V12.5331C11.6465 13.3063 11.0197 13.9332 10.2465 13.9332H5.75332C4.98012 13.9332 4.35332 13.3063 4.35332 12.5331V6.82217Z", fillRule: "evenodd", clipRule: "evenodd" } }] }, Pe = A(function(t, e) {
180
+ return V(B, Object.assign({}, t, {
174
181
  id: "delete-single",
175
182
  ref: e,
176
- icon: bt
183
+ icon: $t
177
184
  }));
178
185
  });
179
- Ee.displayName = "DeleteSingle";
180
- var Et = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 16 16", width: "1em", height: "1em" }, children: [{ tag: "path", attrs: { fill: "currentColor", 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" } }] }, ye = H(function(t, e) {
181
- return L(k, Object.assign({}, t, {
186
+ Pe.displayName = "DeleteSingle";
187
+ var wt = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 16 16", width: "1em", height: "1em" }, children: [{ tag: "path", attrs: { fill: "currentColor", 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" } }] }, Oe = A(function(t, e) {
188
+ return V(B, Object.assign({}, t, {
182
189
  id: "increase-single",
183
190
  ref: e,
184
- icon: Et
191
+ icon: wt
185
192
  }));
186
193
  });
187
- ye.displayName = "IncreaseSingle";
188
- var yt = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 16 16", width: "1em", height: "1em" }, children: [{ tag: "path", attrs: { fill: "currentColor", d: "M3 9C3.55228 9 4 8.55228 4 8 4 7.44772 3.55228 7 3 7 2.44772 7 2 7.44772 2 8 2 8.55228 2.44772 9 3 9zM8 9C8.55228 9 9 8.55228 9 8 9 7.44772 8.55228 7 8 7 7.44772 7 7 7.44772 7 8 7 8.55228 7.44772 9 8 9zM13 9C13.5523 9 14 8.55228 14 8 14 7.44772 13.5523 7 13 7 12.4477 7 12 7.44772 12 8 12 8.55228 12.4477 9 13 9z" } }] }, Se = H(function(t, e) {
189
- return L(k, Object.assign({}, t, {
194
+ Oe.displayName = "IncreaseSingle";
195
+ var Ht = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 16 16", width: "1em", height: "1em" }, children: [{ tag: "path", attrs: { fill: "currentColor", d: "M3 9C3.55228 9 4 8.55228 4 8 4 7.44772 3.55228 7 3 7 2.44772 7 2 7.44772 2 8 2 8.55228 2.44772 9 3 9zM8 9C8.55228 9 9 8.55228 9 8 9 7.44772 8.55228 7 8 7 7.44772 7 7 7.44772 7 8 7 8.55228 7.44772 9 8 9zM13 9C13.5523 9 14 8.55228 14 8 14 7.44772 13.5523 7 13 7 12.4477 7 12 7.44772 12 8 12 8.55228 12.4477 9 13 9z" } }] }, $e = A(function(t, e) {
196
+ return V(B, Object.assign({}, t, {
190
197
  id: "more-horizontal-single",
191
198
  ref: e,
192
- icon: yt
199
+ icon: Ht
193
200
  }));
194
201
  });
195
- Se.displayName = "MoreHorizontalSingle";
196
- var St = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 16 16", width: "1em", height: "1em" }, children: [{ tag: "path", attrs: { stroke: "currentColor", d: "M7.48389 10.3267V12.1905C7.48389 12.7428 7.9316 13.1905 8.48389 13.1905H11.2216L12.2955 14.2644L13.3695 13.1905H14.1593C14.7116 13.1905 15.1593 12.7428 15.1593 12.1905V8.46289C15.1593 7.91061 14.7116 7.46289 14.1593 7.46289H12.2955", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 1.2 } }, { tag: "path", attrs: { stroke: "currentColor", d: "M0.840332 3.73535C0.840332 2.63078 1.73576 1.73535 2.84033 1.73535H10.2955C11.4001 1.73535 12.2955 2.63078 12.2955 3.73535V8.32676C12.2955 9.43132 11.4001 10.3268 10.2955 10.3268H5.6014L4.1695 11.7587L3.05978 10.3268H2.84033C1.73576 10.3268 0.840332 9.43133 0.840332 8.32676V3.73535Z", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 1.2 } }, { tag: "path", attrs: { stroke: "currentColor", d: "M6.41016 6.1311H6.76813M8.91626 6.1311H9.27424M3.90454 6.1311H4.26252", strokeLinecap: "round", strokeWidth: 1.2 } }] }, _e = H(function(t, e) {
197
- return L(k, Object.assign({}, t, {
202
+ $e.displayName = "MoreHorizontalSingle";
203
+ var Rt = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 16 16", width: "1em", height: "1em" }, children: [{ tag: "path", attrs: { stroke: "currentColor", d: "M7.48389 10.3267V12.1905C7.48389 12.7428 7.9316 13.1905 8.48389 13.1905H11.2216L12.2955 14.2644L13.3695 13.1905H14.1593C14.7116 13.1905 15.1593 12.7428 15.1593 12.1905V8.46289C15.1593 7.91061 14.7116 7.46289 14.1593 7.46289H12.2955", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 1.2 } }, { tag: "path", attrs: { stroke: "currentColor", d: "M0.840332 3.73535C0.840332 2.63078 1.73576 1.73535 2.84033 1.73535H10.2955C11.4001 1.73535 12.2955 2.63078 12.2955 3.73535V8.32676C12.2955 9.43132 11.4001 10.3268 10.2955 10.3268H5.6014L4.1695 11.7587L3.05978 10.3268H2.84033C1.73576 10.3268 0.840332 9.43133 0.840332 8.32676V3.73535Z", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 1.2 } }, { tag: "path", attrs: { stroke: "currentColor", d: "M6.41016 6.1311H6.76813M8.91626 6.1311H9.27424M3.90454 6.1311H4.26252", strokeLinecap: "round", strokeWidth: 1.2 } }] }, we = A(function(t, e) {
204
+ return V(B, Object.assign({}, t, {
198
205
  id: "reply-to-comment-single",
199
206
  ref: e,
200
- icon: St
207
+ icon: Rt
201
208
  }));
202
209
  });
203
- _e.displayName = "ReplyToCommentSingle";
204
- var _t = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 17 17", width: "1em", height: "1em" }, children: [{ tag: "path", attrs: { fill: "currentColor", d: "M8.6106 15.4036C12.4766 15.4036 15.6106 12.2696 15.6106 8.40356C15.6106 4.53757 12.4766 1.40356 8.6106 1.40356C4.7446 1.40356 1.6106 4.53757 1.6106 8.40356C1.6106 12.2696 4.7446 15.4036 8.6106 15.4036ZM12.3351 6.82773C12.5694 6.59342 12.5694 6.21352 12.3351 5.9792C12.1007 5.74489 11.7208 5.74489 11.4865 5.9792L7.91079 9.55494L6.33506 7.9792C6.10074 7.74489 5.72084 7.74489 5.48653 7.9792C5.25221 8.21352 5.25221 8.59342 5.48653 8.82773L7.48653 10.8277C7.72084 11.062 8.10074 11.062 8.33506 10.8277L12.3351 6.82773Z", fillRule: "evenodd", clipRule: "evenodd" } }] }, xe = H(function(t, e) {
205
- return L(k, Object.assign({}, t, {
210
+ we.displayName = "ReplyToCommentSingle";
211
+ var Dt = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 17 17", width: "1em", height: "1em" }, children: [{ tag: "path", attrs: { fill: "currentColor", d: "M8.6106 15.4036C12.4766 15.4036 15.6106 12.2696 15.6106 8.40356C15.6106 4.53757 12.4766 1.40356 8.6106 1.40356C4.7446 1.40356 1.6106 4.53757 1.6106 8.40356C1.6106 12.2696 4.7446 15.4036 8.6106 15.4036ZM12.3351 6.82773C12.5694 6.59342 12.5694 6.21352 12.3351 5.9792C12.1007 5.74489 11.7208 5.74489 11.4865 5.9792L7.91079 9.55494L6.33506 7.9792C6.10074 7.74489 5.72084 7.74489 5.48653 7.9792C5.25221 8.21352 5.25221 8.59342 5.48653 8.82773L7.48653 10.8277C7.72084 11.062 8.10074 11.062 8.33506 10.8277L12.3351 6.82773Z", fillRule: "evenodd", clipRule: "evenodd" } }] }, He = A(function(t, e) {
212
+ return V(B, Object.assign({}, t, {
206
213
  id: "resolved-single",
207
214
  ref: e,
208
- icon: _t
215
+ icon: Dt
209
216
  }));
210
217
  });
211
- xe.displayName = "ResolvedSingle";
212
- var xt = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 17 17", width: "1em", height: "1em" }, children: [{ tag: "circle", attrs: { cx: 8.73, cy: 8.4, r: 6.4, stroke: "currentColor", strokeWidth: 1.2 } }, { tag: "path", attrs: { stroke: "currentColor", d: "M6.02637 8.40356L8.02637 10.4036L12.0264 6.40356", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 1.2 } }] }, Ne = H(function(t, e) {
213
- return L(k, Object.assign({}, t, {
218
+ He.displayName = "ResolvedSingle";
219
+ var kt = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 17 17", width: "1em", height: "1em" }, children: [{ tag: "circle", attrs: { cx: 8.73, cy: 8.4, r: 6.4, stroke: "currentColor", strokeWidth: 1.2 } }, { tag: "path", attrs: { stroke: "currentColor", d: "M6.02637 8.40356L8.02637 10.4036L12.0264 6.40356", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 1.2 } }] }, Re = A(function(t, e) {
220
+ return V(B, Object.assign({}, t, {
214
221
  id: "solve-single",
215
222
  ref: e,
216
- icon: xt
223
+ icon: kt
217
224
  }));
218
225
  });
219
- Ne.displayName = "SolveSingle";
220
- const Nt = "univer-thread-comment-editor-buttons", Tt = "univer-thread-comment-editor-suggestion", Mt = "univer-thread-comment-editor-suggestionActive", Ut = "univer-thread-comment-editor-suggestion-icon", q = {
221
- threadCommentEditorButtons: Nt,
222
- threadCommentEditorSuggestion: Tt,
223
- threadCommentEditorSuggestionActive: Mt,
224
- threadCommentEditorSuggestionIcon: Ut
225
- }, Ot = (t) => {
226
+ Re.displayName = "SolveSingle";
227
+ const At = "univer-thread-comment-editor-buttons", Lt = "univer-thread-comment-editor-suggestion", jt = "univer-thread-comment-editor-suggestionActive", Vt = "univer-thread-comment-editor-suggestion-icon", le = {
228
+ threadCommentEditorButtons: At,
229
+ threadCommentEditorSuggestion: Lt,
230
+ threadCommentEditorSuggestionActive: jt,
231
+ threadCommentEditorSuggestionIcon: Vt
232
+ }, Bt = (t) => {
226
233
  const e = /@\[(.*?)\]\((.*?)\)|(\w+)/g;
227
234
  let n, r = 0;
228
- const a = [];
235
+ const o = [];
229
236
  for (; (n = e.exec(t)) !== null; )
230
- n.index > r && a.push({
237
+ n.index > r && o.push({
231
238
  type: "text",
232
239
  content: t.substring(r, n.index)
233
- }), n[1] && n[2] ? a.push({
240
+ }), n[1] && n[2] ? o.push({
234
241
  type: "mention",
235
242
  content: {
236
243
  label: n[1],
237
244
  id: n[2]
238
245
  }
239
- }) : n[3] && a.push({
246
+ }) : n[3] && o.push({
240
247
  type: "text",
241
248
  content: n[3]
242
249
  }), r = e.lastIndex;
243
- return r < t.length && a.push({
250
+ return r < t.length && o.push({
244
251
  type: "text",
245
252
  content: t.substring(r)
246
- }), a;
247
- }, Pt = (t) => t.map((e) => {
253
+ }), o;
254
+ }, Ft = (t) => t.map((e) => {
248
255
  switch (e.type) {
249
256
  case "mention":
250
257
  return `@[${e.content.label}](${e.content.id})`;
251
258
  default:
252
259
  return e.content;
253
260
  }
254
- }).join(""), Te = (t) => {
255
- const { dataStream: e, customRanges: n } = t, r = e.length - 2, a = [];
256
- let i = 0;
257
- return n == null || n.forEach((s) => {
258
- i < s.startIndex && a.push({
261
+ }).join(""), De = (t) => {
262
+ const { dataStream: e, customRanges: n } = t, r = e.length - 2, o = [];
263
+ let l = 0;
264
+ return n == null || n.forEach((m) => {
265
+ l < m.startIndex && o.push({
259
266
  type: "text",
260
- content: e.slice(i, s.startIndex)
261
- }), a.push({
267
+ content: e.slice(l, m.startIndex)
268
+ }), o.push({
262
269
  type: "mention",
263
270
  content: {
264
- label: e.slice(s.startIndex, s.endIndex).slice(1, -1),
265
- id: s.rangeId
271
+ label: e.slice(m.startIndex, m.endIndex).slice(1, -1),
272
+ id: m.rangeId
266
273
  }
267
- }), i = s.endIndex;
268
- }), a.push({
274
+ }), l = m.endIndex;
275
+ }), o.push({
269
276
  type: "text",
270
- content: e.slice(i, r)
271
- }), a;
272
- }, Me = (t) => {
277
+ content: e.slice(l, r)
278
+ }), o;
279
+ }, ke = (t) => {
273
280
  let e = "";
274
281
  const n = [];
275
282
  return t.forEach((r) => {
@@ -278,14 +285,14 @@ const Nt = "univer-thread-comment-editor-buttons", Tt = "univer-thread-comment-e
278
285
  e += r.content;
279
286
  break;
280
287
  case "mention": {
281
- const a = e.length;
288
+ const o = e.length;
282
289
  e += `${r.content.label}`;
283
- const i = e.length;
290
+ const l = e.length;
284
291
  n.push({
285
292
  rangeId: r.content.id,
286
- rangeType: Fe.MENTION,
287
- startIndex: a,
288
- endIndex: i
293
+ rangeType: et.MENTION,
294
+ startIndex: o,
295
+ endIndex: l
289
296
  });
290
297
  break;
291
298
  }
@@ -307,401 +314,452 @@ const Nt = "univer-thread-comment-editor-buttons", Tt = "univer-thread-comment-e
307
314
  dataStream: e,
308
315
  customRanges: n
309
316
  };
310
- }, $t = (t) => ({
317
+ }, Wt = (t) => ({
311
318
  display: t.label,
312
319
  id: `${t.id}`,
313
320
  raw: t
314
- }), Ht = (t, e, n, r, a) => {
315
- var s, c;
316
- const i = (s = t.raw) == null ? void 0 : s.icon;
317
- return /* @__PURE__ */ o.createElement("div", { className: q.threadCommentEditorSuggestion }, i ? /* @__PURE__ */ o.createElement("img", { className: q.threadCommentEditorSuggestionIcon, src: i }) : null, /* @__PURE__ */ o.createElement("div", null, (c = t.display) != null ? c : t.id));
318
- }, Ue = H((t, e) => {
319
- var u;
320
- const { comment: n, onSave: r, id: a, onCancel: i, autoFocus: s } = t, c = E(ge), d = E(J), [f, g] = $({ ...n }), [x, p] = $(!1), I = X(null);
321
- return Ke(e, () => ({
322
- reply(b) {
323
- var h;
324
- g({
321
+ }), zt = (t, e, n, r, o) => {
322
+ var m, c;
323
+ const l = (m = t.raw) == null ? void 0 : m.icon;
324
+ return /* @__PURE__ */ a.createElement("div", { className: le.threadCommentEditorSuggestion }, l ? /* @__PURE__ */ a.createElement("img", { className: le.threadCommentEditorSuggestionIcon, src: l }) : null, /* @__PURE__ */ a.createElement("div", null, (c = t.display) != null ? c : t.id));
325
+ }, Ae = A((t, e) => {
326
+ var C;
327
+ const { comment: n, onSave: r, id: o, onCancel: l, autoFocus: m, unitId: c, subUnitId: f } = t, y = S(Te), P = S(J), _ = S(se), [I, h] = k({ ...n }), [g, b] = k(!1), N = me(null), E = S(ct), H = S(ut);
328
+ return at(e, () => ({
329
+ reply(v) {
330
+ var d;
331
+ h({
325
332
  ...n,
326
- text: b,
333
+ text: v,
327
334
  attachments: []
328
- }), (h = I.current) == null || h.inputElement.focus();
335
+ }), (d = N.current) == null || d.inputElement.focus();
329
336
  }
330
- })), /* @__PURE__ */ o.createElement("div", { className: q.threadCommentEditor, onClick: (b) => b.preventDefault() }, /* @__PURE__ */ o.createElement(
331
- qe,
337
+ })), /* @__PURE__ */ a.createElement("div", { className: le.threadCommentEditor, onClick: (v) => v.preventDefault() }, /* @__PURE__ */ a.createElement(
338
+ it,
332
339
  {
333
- ref: I,
334
- autoFocus: s,
340
+ ref: N,
341
+ autoFocus: m,
335
342
  style: { width: "100%" },
336
- placeholder: d.t("threadCommentUI.editor.placeholder"),
337
- value: f != null && f.text ? Pt(Te(f.text)) : "",
338
- onChange: (b) => {
339
- b.target.value || g({ ...n, text: void 0 }), g == null || g({ ...n, text: Me(Ot(b.target.value)) });
343
+ placeholder: _.t("threadCommentUI.editor.placeholder"),
344
+ value: I != null && I.text ? Ft(De(I.text)) : "",
345
+ onChange: (v) => {
346
+ v.target.value || h({ ...n, text: void 0 }), h == null || h({ ...n, text: ke(Bt(v.target.value)) });
340
347
  },
341
348
  onFocus: () => {
342
- p(!0);
349
+ const v = H.getActiveRange();
350
+ v && v.collapsed && E.removeAllTextRanges(), E.blur(), b(!0);
343
351
  }
344
352
  },
345
- /* @__PURE__ */ o.createElement(
346
- Je,
353
+ /* @__PURE__ */ a.createElement(
354
+ lt,
347
355
  {
348
- key: c.trigger,
349
- trigger: c.trigger,
350
- data: (b, h) => c.getMentions(b).then((N) => N.map($t)).then(h),
351
- displayTransform: (b, h) => `@${h} `,
352
- renderSuggestion: (u = c.renderSuggestion) != null ? u : Ht
356
+ key: y.trigger,
357
+ trigger: y.trigger,
358
+ data: (v, d) => y.getMentions(v, c, f).then((s) => s.map(Wt)).then(d),
359
+ displayTransform: (v, d) => `@${d} `,
360
+ renderSuggestion: (C = y.renderSuggestion) != null ? C : zt
353
361
  }
354
362
  )
355
- ), x ? /* @__PURE__ */ o.createElement("div", { className: q.threadCommentEditorButtons }, /* @__PURE__ */ o.createElement(
356
- G,
363
+ ), g ? /* @__PURE__ */ a.createElement("div", { className: le.threadCommentEditorButtons }, /* @__PURE__ */ a.createElement(
364
+ ae,
357
365
  {
358
366
  style: { marginRight: 12 },
359
367
  onClick: () => {
360
- i == null || i(), p(!1), g({ text: void 0 });
368
+ l == null || l(), b(!1), h({ text: void 0 }), P.executeCommand(j.id);
361
369
  }
362
370
  },
363
- d.t("threadCommentUI.editor.cancel")
364
- ), /* @__PURE__ */ o.createElement(
365
- G,
371
+ _.t("threadCommentUI.editor.cancel")
372
+ ), /* @__PURE__ */ a.createElement(
373
+ ae,
366
374
  {
367
375
  type: "primary",
368
- disabled: !f.text,
376
+ disabled: !I.text,
369
377
  onClick: () => {
370
- f.text && (r == null || r({
371
- ...f,
372
- text: f.text
373
- }), p(!1), g({ text: void 0 }));
378
+ I.text && (r == null || r({
379
+ ...I,
380
+ text: I.text
381
+ }), b(!1), h({ text: void 0 }));
374
382
  }
375
383
  },
376
- d.t(a ? "threadCommentUI.editor.save" : "threadCommentUI.editor.reply")
384
+ _.t(o ? "threadCommentUI.editor.save" : "threadCommentUI.editor.reply")
377
385
  )) : null);
378
- }), wt = "univer-thread-comment", Dt = "univer-thread-comment-active", Rt = "univer-thread-comment-content", Lt = "univer-thread-comment-highlight", kt = "univer-thread-comment-icon-container", jt = "univer-thread-comment-icon", At = "univer-thread-comment-title", Vt = "univer-thread-comment-title-position", Bt = "univer-thread-comment-title-highlight", Wt = "univer-thread-comment-username", Ft = "univer-thread-comment-item", zt = "univer-thread-comment-item-head", Zt = "univer-thread-comment-item-title", Yt = "univer-thread-comment-item-title-position", Gt = "univer-thread-comment-item-title-highlight", Kt = "univer-thread-comment-item-time", qt = "univer-thread-comment-item-content", Jt = "univer-thread-comment-item-at", v = {
379
- threadComment: wt,
380
- threadCommentActive: Dt,
381
- threadCommentContent: Rt,
382
- threadCommentHighlight: Lt,
383
- threadCommentIconContainer: kt,
384
- threadCommentIcon: jt,
385
- threadCommentTitle: At,
386
- threadCommentTitlePosition: Vt,
387
- threadCommentTitleHighlight: Bt,
388
- threadCommentUsername: Wt,
389
- threadCommentItem: Ft,
390
- threadCommentItemHead: zt,
391
- threadCommentItemTitle: Zt,
392
- threadCommentItemTitlePosition: Yt,
393
- threadCommentItemTitleHighlight: Gt,
394
- threadCommentItemTime: Kt,
395
- threadCommentItemContent: qt,
396
- threadCommentItemAt: Jt
397
- }, Oe = "__mock__", Qt = (t) => {
398
- const { item: e, unitId: n, subUnitId: r, editing: a, onEditingChange: i, onReply: s, resolved: c, isRoot: d, onClose: f } = t, g = E(Q), x = E(J), p = E(ee), I = p.getUser(e.personId), u = j(p.currentUser$), b = (u == null ? void 0 : u.userID) === e.personId, h = e.id === Oe, [N, w] = $(!1), m = () => {
399
- g.executeCommand(
400
- d ? ce.id : Le.id,
386
+ }), Zt = "univer-thread-comment", Yt = "univer-thread-comment-active", Gt = "univer-thread-comment-content", Kt = "univer-thread-comment-highlight", qt = "univer-thread-comment-icon-container", Jt = "univer-thread-comment-icon", Qt = "univer-thread-comment-title", Xt = "univer-thread-comment-title-position", en = "univer-thread-comment-title-highlight", tn = "univer-thread-comment-title-position-text", nn = "univer-thread-comment-username", rn = "univer-thread-comment-item", on = "univer-thread-comment-item-head", an = "univer-thread-comment-item-title", ln = "univer-thread-comment-item-title-position", sn = "univer-thread-comment-item-title-highlight", mn = "univer-thread-comment-item-time", dn = "univer-thread-comment-item-content", cn = "univer-thread-comment-item-at", u = {
387
+ threadComment: Zt,
388
+ threadCommentActive: Yt,
389
+ threadCommentContent: Gt,
390
+ threadCommentHighlight: Kt,
391
+ threadCommentIconContainer: qt,
392
+ threadCommentIcon: Jt,
393
+ threadCommentTitle: Qt,
394
+ threadCommentTitlePosition: Xt,
395
+ threadCommentTitleHighlight: en,
396
+ threadCommentTitlePositionText: tn,
397
+ threadCommentUsername: nn,
398
+ threadCommentItem: rn,
399
+ threadCommentItemHead: on,
400
+ threadCommentItemTitle: an,
401
+ threadCommentItemTitlePosition: ln,
402
+ threadCommentItemTitleHighlight: sn,
403
+ threadCommentItemTime: mn,
404
+ threadCommentItemContent: dn,
405
+ threadCommentItemAt: cn
406
+ }, Le = "__mock__", un = (t) => {
407
+ const { item: e, unitId: n, subUnitId: r, editing: o, onEditingChange: l, onReply: m, resolved: c, isRoot: f, onClose: y, onDeleteComment: P } = t, _ = S(J), I = S(se), h = S(Ce), g = h.getUser(e.personId), b = L(h.currentUser$), N = (b == null ? void 0 : b.userID) === e.personId, E = e.id === Le, [H, C] = k(!1), v = () => {
408
+ (P == null ? void 0 : P(e)) !== !1 && (_.executeCommand(
409
+ f ? Ee.id : Ye.id,
401
410
  {
402
411
  unitId: n,
403
412
  subUnitId: r,
404
413
  commentId: e.id
405
414
  }
406
- ), d && (f == null || f());
415
+ ), f && (y == null || y()));
407
416
  };
408
- return /* @__PURE__ */ o.createElement("div", { className: v.threadCommentItem, onMouseLeave: () => w(!1), onMouseEnter: () => w(!0) }, /* @__PURE__ */ o.createElement("img", { className: v.threadCommentItemHead, src: I == null ? void 0 : I.avatar }), /* @__PURE__ */ o.createElement("div", { className: v.threadCommentItemTitle }, /* @__PURE__ */ o.createElement("div", { className: v.threadCommentUsername }, (I == null ? void 0 : I.name) || " "), /* @__PURE__ */ o.createElement("div", null, h || c ? null : N ? /* @__PURE__ */ o.createElement("div", { className: v.threadCommentIcon, onClick: () => s(I) }, /* @__PURE__ */ o.createElement(_e, null)) : null, b && !h && !c ? /* @__PURE__ */ o.createElement(
409
- Qe,
417
+ return /* @__PURE__ */ a.createElement("div", { className: u.threadCommentItem, onMouseLeave: () => C(!1), onMouseEnter: () => C(!0) }, /* @__PURE__ */ a.createElement("img", { className: u.threadCommentItemHead, src: g == null ? void 0 : g.avatar }), /* @__PURE__ */ a.createElement("div", { className: u.threadCommentItemTitle }, /* @__PURE__ */ a.createElement("div", { className: u.threadCommentUsername }, (g == null ? void 0 : g.name) || " "), /* @__PURE__ */ a.createElement("div", null, E || c ? null : H ? /* @__PURE__ */ a.createElement("div", { className: u.threadCommentIcon, onClick: () => m(g) }, /* @__PURE__ */ a.createElement(we, null)) : null, N && !E && !c ? /* @__PURE__ */ a.createElement(
418
+ st,
410
419
  {
411
- overlay: /* @__PURE__ */ o.createElement(Xe, null, /* @__PURE__ */ o.createElement(ie, { key: "edit", onClick: () => i == null ? void 0 : i(!0) }, x.t("threadCommentUI.item.edit")), /* @__PURE__ */ o.createElement(ie, { key: "delete", onClick: m }, x.t("threadCommentUI.item.delete")))
420
+ overlay: /* @__PURE__ */ a.createElement(mt, null, /* @__PURE__ */ a.createElement(ge, { key: "edit", onClick: () => l == null ? void 0 : l(!0) }, I.t("threadCommentUI.item.edit")), /* @__PURE__ */ a.createElement(ge, { key: "delete", onClick: v }, I.t("threadCommentUI.item.delete")))
412
421
  },
413
- /* @__PURE__ */ o.createElement("div", { className: v.threadCommentIcon }, /* @__PURE__ */ o.createElement(Se, null))
414
- ) : null)), /* @__PURE__ */ o.createElement("div", { className: v.threadCommentItemTime }, e.dT), a ? /* @__PURE__ */ o.createElement(
415
- Ue,
422
+ /* @__PURE__ */ a.createElement("div", { className: u.threadCommentIcon }, /* @__PURE__ */ a.createElement($e, null))
423
+ ) : null)), /* @__PURE__ */ a.createElement("div", { className: u.threadCommentItemTime }, e.dT), o ? /* @__PURE__ */ a.createElement(
424
+ Ae,
416
425
  {
417
426
  id: e.id,
418
427
  comment: e,
419
- onCancel: () => i == null ? void 0 : i(!1),
428
+ onCancel: () => l == null ? void 0 : l(!1),
420
429
  autoFocus: !0,
421
- onSave: ({ text: C, attachments: D }) => {
422
- i == null || i(!1), g.executeCommand(
423
- De.id,
430
+ unitId: n,
431
+ subUnitId: r,
432
+ onSave: ({ text: d, attachments: s }) => {
433
+ l == null || l(!1), _.executeCommand(
434
+ ze.id,
424
435
  {
425
436
  unitId: n,
426
437
  subUnitId: r,
427
438
  payload: {
428
439
  commentId: e.id,
429
- text: C,
430
- attachments: D
440
+ text: d,
441
+ attachments: s
431
442
  }
432
443
  }
433
444
  );
434
445
  }
435
446
  }
436
- ) : /* @__PURE__ */ o.createElement("div", { className: v.threadCommentItemContent }, Te(e.text).map((C, D) => {
437
- switch (C.type) {
447
+ ) : /* @__PURE__ */ a.createElement("div", { className: u.threadCommentItemContent }, De(e.text).map((d, s) => {
448
+ switch (d.type) {
438
449
  case "mention":
439
- return /* @__PURE__ */ o.createElement("a", { className: v.threadCommentItemAt, key: D }, "@", C.content.label, " ");
450
+ return /* @__PURE__ */ a.createElement("a", { className: u.threadCommentItemAt, key: s }, "@", d.content.label, " ");
440
451
  default:
441
- return C.content;
452
+ return d.content;
442
453
  }
443
454
  })));
444
- }, Xt = (t) => {
445
- var R, B, z;
455
+ }, hn = (t) => {
456
+ var Y, G, K;
446
457
  const {
447
458
  id: e,
448
459
  unitId: n,
449
460
  subUnitId: r,
450
- refStr: a,
451
- showEdit: i = !0,
452
- onClick: s,
461
+ refStr: o,
462
+ showEdit: l = !0,
463
+ onClick: m,
453
464
  showHighlight: c,
454
- onClose: d,
455
- getSubUnitName: f,
456
- prefix: g,
457
- autoFocus: x,
458
- onMouseEnter: p,
459
- onMouseLeave: I
460
- } = t, u = E(de), [b, h] = $(!1), [N, w] = $("");
461
- j(u.commentMap$);
462
- const m = e ? u.getCommentWithChildren(n, r, e) : null, C = E(Q), D = E(ee), U = m == null ? void 0 : m.root.resolved, y = j(D.currentUser$), T = X(null), V = [
463
- ...m ? [m.root] : (
465
+ onClose: f,
466
+ getSubUnitName: y,
467
+ prefix: P,
468
+ autoFocus: _,
469
+ onMouseEnter: I,
470
+ onMouseLeave: h,
471
+ onAddComment: g,
472
+ onDeleteComment: b,
473
+ onResolve: N
474
+ } = t, E = S(Se), [H, C] = k(!1), [v, d] = k("");
475
+ L(E.commentMap$);
476
+ const s = e ? E.getCommentWithChildren(n, r, e) : null, R = S(J), de = S(Ce), p = s == null ? void 0 : s.root.resolved, M = L(de.currentUser$), W = me(null), Q = [
477
+ ...s ? [s.root] : (
464
478
  // mock empty comment
465
479
  [{
466
- id: Oe,
480
+ id: Le,
467
481
  text: {
468
482
  dataStream: `
469
483
  \r`
470
484
  },
471
- personId: (R = y == null ? void 0 : y.userID) != null ? R : "",
472
- ref: a != null ? a : "",
485
+ personId: (Y = M == null ? void 0 : M.userID) != null ? Y : "",
486
+ ref: o != null ? o : "",
473
487
  dT: "",
474
488
  unitId: n,
475
- subUnitId: r
489
+ subUnitId: r,
490
+ threadId: ""
476
491
  }]
477
492
  ),
478
- ...(B = m == null ? void 0 : m.children) != null ? B : []
479
- ], F = () => {
480
- C.executeCommand(Re.id, {
493
+ ...(G = s == null ? void 0 : s.children) != null ? G : []
494
+ ], z = (x) => {
495
+ x.stopPropagation(), p ? R.executeCommand(j.id, {
496
+ unitId: n,
497
+ subUnitId: r,
498
+ commentId: e
499
+ }) : R.executeCommand(j.id), R.executeCommand(Ze.id, {
481
500
  unitId: n,
482
501
  subUnitId: r,
483
502
  commentId: e,
484
- resolved: !U
485
- }), d == null || d();
486
- }, O = () => {
487
- C.executeCommand(
488
- ce.id,
503
+ resolved: !p
504
+ }), N == null || N(!p);
505
+ }, X = (x) => {
506
+ x.stopPropagation(), R.executeCommand(j.id), !(s != null && s.root && (b == null ? void 0 : b(s.root)) === !1) && (R.executeCommand(
507
+ Ee.id,
489
508
  {
490
509
  unitId: n,
491
510
  subUnitId: r,
492
511
  commentId: e
493
512
  }
494
- ), d == null || d();
513
+ ), f == null || f());
495
514
  };
496
- return /* @__PURE__ */ o.createElement(
515
+ ue(() => h == null ? void 0 : h(), []);
516
+ const O = y((K = s == null ? void 0 : s.root.subUnitId) != null ? K : r), Z = l && !v && !p, D = `${o || (s == null ? void 0 : s.root.ref)}${O ? " · " : ""}${O}`;
517
+ return /* @__PURE__ */ a.createElement(
497
518
  "div",
498
519
  {
499
- className: tt(v.threadComment, {
500
- [v.threadCommentActive]: !U && (c || b || g === "cell")
520
+ className: dt(u.threadComment, {
521
+ [u.threadCommentActive]: !p && (c || H || P === "cell")
501
522
  }),
502
- onClick: s,
503
- id: `${g}-${n}-${r}-${e}`,
523
+ onClick: m,
524
+ id: `${P}-${n}-${r}-${e}`,
504
525
  onMouseEnter: () => {
505
- p == null || p(), h(!0);
526
+ I == null || I(), C(!0);
506
527
  },
507
528
  onMouseLeave: () => {
508
- I == null || I(), h(!1);
529
+ h == null || h(), C(!1);
509
530
  }
510
531
  },
511
- !U && c ? /* @__PURE__ */ o.createElement("div", { className: v.threadCommentHighlight }) : null,
512
- /* @__PURE__ */ o.createElement("div", { className: v.threadCommentTitle }, /* @__PURE__ */ o.createElement("div", { className: v.threadCommentTitlePosition }, /* @__PURE__ */ o.createElement("div", { className: v.threadCommentTitleHighlight }), a || (m == null ? void 0 : m.root.ref), " · ", f((z = m == null ? void 0 : m.root.subUnitId) != null ? z : r)), m ? /* @__PURE__ */ o.createElement("div", { className: v.threadCommentIconContainer }, /* @__PURE__ */ o.createElement(
532
+ !p && c ? /* @__PURE__ */ a.createElement("div", { className: u.threadCommentHighlight }) : null,
533
+ /* @__PURE__ */ a.createElement("div", { className: u.threadCommentTitle }, /* @__PURE__ */ a.createElement("div", { className: u.threadCommentTitlePosition }, /* @__PURE__ */ a.createElement("div", { className: u.threadCommentTitleHighlight }), /* @__PURE__ */ a.createElement("div", { className: u.threadCommentTitlePositionText }, D)), s ? /* @__PURE__ */ a.createElement("div", { className: u.threadCommentIconContainer }, /* @__PURE__ */ a.createElement(
513
534
  "div",
514
535
  {
515
- onClick: F,
516
- className: v.threadCommentIcon,
517
- style: { color: U ? "rgb(var(--green-500))" : "" }
536
+ onClick: z,
537
+ className: u.threadCommentIcon,
538
+ style: { color: p ? "rgb(var(--green-500))" : "" }
518
539
  },
519
- U ? /* @__PURE__ */ o.createElement(xe, null) : /* @__PURE__ */ o.createElement(Ne, null)
520
- ), (y == null ? void 0 : y.userID) === m.root.personId ? /* @__PURE__ */ o.createElement("div", { className: v.threadCommentIcon, onClick: O }, /* @__PURE__ */ o.createElement(Ee, null)) : null) : null),
521
- /* @__PURE__ */ o.createElement("div", { className: v.threadCommentContent }, V.map(
522
- (l) => /* @__PURE__ */ o.createElement(
523
- Qt,
540
+ p ? /* @__PURE__ */ a.createElement(He, null) : /* @__PURE__ */ a.createElement(Re, null)
541
+ ), (M == null ? void 0 : M.userID) === s.root.personId ? /* @__PURE__ */ a.createElement("div", { className: u.threadCommentIcon, onClick: X }, /* @__PURE__ */ a.createElement(Pe, null)) : null) : null),
542
+ /* @__PURE__ */ a.createElement("div", { className: u.threadCommentContent }, Q.map(
543
+ (x) => /* @__PURE__ */ a.createElement(
544
+ un,
524
545
  {
525
- onClose: d,
546
+ onClose: f,
526
547
  unitId: n,
527
548
  subUnitId: r,
528
- item: l,
529
- key: l.id,
530
- isRoot: l.id === (m == null ? void 0 : m.root.id),
531
- editing: N === l.id,
532
- resolved: m == null ? void 0 : m.root.resolved,
533
- onEditingChange: (S) => {
534
- w(S ? l.id : "");
549
+ item: x,
550
+ key: x.id,
551
+ isRoot: x.id === (s == null ? void 0 : s.root.id),
552
+ editing: v === x.id,
553
+ resolved: s == null ? void 0 : s.root.resolved,
554
+ onEditingChange: (i) => {
555
+ d(i ? x.id : "");
535
556
  },
536
- onReply: (S) => {
537
- var M;
538
- S && ((M = T.current) == null || M.reply(Me([{
539
- type: "mention",
540
- content: {
541
- id: S.userID,
542
- label: S.name
543
- }
544
- }])));
545
- }
557
+ onReply: (i) => {
558
+ i && requestAnimationFrame(() => {
559
+ var U;
560
+ (U = W.current) == null || U.reply(ke([{
561
+ type: "mention",
562
+ content: {
563
+ id: i.userID,
564
+ label: i.name
565
+ }
566
+ }]));
567
+ });
568
+ },
569
+ onAddComment: g,
570
+ onDeleteComment: b
546
571
  }
547
572
  )
548
573
  )),
549
- i && !N && !U ? /* @__PURE__ */ o.createElement("div", null, /* @__PURE__ */ o.createElement(
550
- Ue,
574
+ Z ? /* @__PURE__ */ a.createElement("div", null, /* @__PURE__ */ a.createElement(
575
+ Ae,
551
576
  {
552
- key: `${x}`,
553
- ref: T,
554
- onSave: ({ text: l, attachments: S }) => {
555
- C.executeCommand(
556
- we.id,
577
+ key: `${_}`,
578
+ ref: W,
579
+ unitId: n,
580
+ subUnitId: r,
581
+ onSave: ({ text: x, attachments: i }) => {
582
+ const U = {
583
+ text: x,
584
+ attachments: i,
585
+ dT: ht(),
586
+ id: tt.generateRandomId(),
587
+ ref: o,
588
+ personId: M == null ? void 0 : M.userID,
589
+ parentId: s == null ? void 0 : s.root.id,
590
+ unitId: n,
591
+ subUnitId: r,
592
+ threadId: s == null ? void 0 : s.root.threadId
593
+ };
594
+ (g == null ? void 0 : g(U)) !== !1 && R.executeCommand(
595
+ We.id,
557
596
  {
558
597
  unitId: n,
559
598
  subUnitId: r,
560
- comment: {
561
- text: l,
562
- attachments: S,
563
- dT: et().format("YYYY/MM/DD HH:mm"),
564
- id: ze.generateRandomId(),
565
- ref: a,
566
- personId: y == null ? void 0 : y.userID,
567
- parentId: m == null ? void 0 : m.root.id,
568
- unitId: n,
569
- subUnitId: r
570
- }
599
+ comment: U
571
600
  }
572
601
  );
573
602
  },
574
- autoFocus: x || !m,
603
+ autoFocus: _ || !s,
575
604
  onCancel: () => {
576
- m || d == null || d();
605
+ s || f == null || f();
577
606
  }
578
607
  }
579
608
  )) : null
580
609
  );
581
- }, en = "univer-thread-comment-panel", tn = "univer-thread-comment", nn = "univer-thread-comment-panel-forms", rn = "univer-select", an = "univer-thread-comment-panel-empty", on = "univer-thread-comment-panel-add", Z = {
582
- threadCommentPanel: en,
583
- threadComment: tn,
584
- threadCommentPanelForms: nn,
585
- select: rn,
586
- threadCommentPanelEmpty: an,
587
- threadCommentPanelAdd: on
588
- }, pn = (t) => {
589
- const { unitId: e, subUnitId$: n, type: r, onAdd: a, getSubUnitName: i, onResolve: s, sortComments: c, onItemLeave: d, onItemEnter: f } = t, [g, x] = $("all"), [p, I] = $("all"), u = E(J), b = E(ee), h = E(de), [N, w] = $(() => h.getUnit(e)), m = E(A), C = j(m.activeCommentId$), D = j(h.commentUpdate$), U = E(Q), y = j(n), T = b.getCurrentUser(), V = X(!0), F = "panel", O = ae(() => {
590
- var l, S;
591
- if (g === "all") {
592
- const M = N.map((W) => W[1]).flat().filter((W) => !W.parentId);
593
- return c ? c(M) : M;
610
+ }, Cn = "univer-thread-comment-panel", vn = "univer-thread-comment", fn = "univer-thread-comment-panel-forms", gn = "univer-select", pn = "univer-thread-comment-panel-empty", In = "univer-thread-comment-panel-add", re = {
611
+ threadCommentPanel: Cn,
612
+ threadComment: vn,
613
+ threadCommentPanelForms: fn,
614
+ select: gn,
615
+ threadCommentPanelEmpty: pn,
616
+ threadCommentPanelAdd: In
617
+ }, wn = (t) => {
618
+ const {
619
+ unitId: e,
620
+ subUnitId$: n,
621
+ type: r,
622
+ onAdd: o,
623
+ getSubUnitName: l,
624
+ onResolve: m,
625
+ sortComments: c,
626
+ onItemLeave: f,
627
+ onItemEnter: y,
628
+ disableAdd: P,
629
+ tempComment: _,
630
+ onAddComment: I,
631
+ onDeleteComment: h,
632
+ showComments: g
633
+ } = t, [b, N] = k("all"), [E, H] = k("all"), C = S(se), v = S(Ce), d = S(Se), [s, R] = k(() => d.getUnit(e)), de = S(F), p = L(de.activeCommentId$), M = L(d.commentUpdate$), W = S(J), Q = L(n), z = me(!0), X = "panel", O = L(v.currentUser$), Z = ce(() => {
634
+ var te, q;
635
+ const i = (b === "all" ? s.map(($) => $[1]).flat() : (q = (te = s.find(($) => $[0] === Q)) == null ? void 0 : te[1]) != null ? q : []).filter(($) => !$.parentId), U = c != null ? c : ($) => $, ee = i;
636
+ if (g) {
637
+ const $ = /* @__PURE__ */ new Map();
638
+ return ee.forEach((ne) => {
639
+ $.set(ne.id, ne);
640
+ }), [...g, ""].map((ne) => $.get(ne)).filter(Boolean);
594
641
  } else
595
- return (S = (l = N.find((M) => M[0] === y)) == null ? void 0 : l[1]) != null ? S : [];
596
- }, [g, N, y, c]), R = ae(() => p === "resolved" ? O.filter((l) => l.resolved) : p === "unsolved" ? O.filter((l) => !l.resolved) : p === "concern_me" && T != null && T.userID ? O.map((l) => h.getCommentWithChildren(l.unitId, l.subUnitId, l.id)).map((l) => l != null && l.relativeUsers.has(T.userID) ? l.root : null).filter(Boolean) : O, [O, T == null ? void 0 : T.userID, p, h]), B = p !== "all" || g !== "all", z = () => {
597
- I("all"), x("all");
642
+ return U(ee);
643
+ }, [g, b, s, c, Q]), D = ce(() => [
644
+ ...Z.filter((i) => !i.resolved),
645
+ ...Z.filter((i) => i.resolved)
646
+ ], [Z]), Y = ce(() => E === "resolved" ? D.filter((i) => i.resolved) : E === "unsolved" ? D.filter((i) => !i.resolved) : E === "concern_me" && O != null && O.userID ? D.map((i) => d.getCommentWithChildren(i.unitId, i.subUnitId, i.id)).map((i) => i != null && i.relativeUsers.has(O.userID) ? i.root : null).filter(Boolean) : D, [D, O == null ? void 0 : O.userID, E, d]), G = _ ? [_, ...Y] : Y, K = E !== "all" || b !== "all", x = () => {
647
+ H("all"), N("all");
598
648
  };
599
- return oe(() => {
600
- e && w(
601
- h.getUnit(e)
649
+ return ue(() => {
650
+ e && R(
651
+ d.getUnit(e)
602
652
  );
603
- }, [e, h, D]), oe(() => {
604
- var ne;
605
- if (!C)
653
+ }, [e, d, M]), ue(() => {
654
+ var q;
655
+ if (!p)
606
656
  return;
607
- if (!V.current) {
608
- V.current = !0;
657
+ if (!z.current) {
658
+ z.current = !0;
609
659
  return;
610
660
  }
611
- const { unitId: l, subUnitId: S, commentId: M } = C, W = `${F}-${l}-${S}-${M}`;
612
- (ne = document.getElementById(W)) == null || ne.scrollIntoView({ block: "center" });
613
- }, [C]), /* @__PURE__ */ o.createElement("div", { className: Z.threadCommentPanel }, /* @__PURE__ */ o.createElement("div", { className: Z.threadCommentPanelForms }, /* @__PURE__ */ o.createElement(
614
- le,
661
+ const { unitId: i, subUnitId: U, commentId: ee } = p, te = `${X}-${i}-${U}-${ee}`;
662
+ (q = document.getElementById(te)) == null || q.scrollIntoView({ block: "center" });
663
+ }, [p]), /* @__PURE__ */ a.createElement("div", { className: re.threadCommentPanel }, /* @__PURE__ */ a.createElement("div", { className: re.threadCommentPanelForms }, r === he.UNIVER_SHEET ? /* @__PURE__ */ a.createElement(
664
+ pe,
615
665
  {
616
666
  borderless: !0,
617
- value: g,
618
- onChange: (l) => x(l),
667
+ value: b,
668
+ onChange: (i) => N(i),
619
669
  options: [
620
670
  {
621
671
  value: "current",
622
- label: u.t("threadCommentUI.filter.sheet.current")
672
+ label: C.t("threadCommentUI.filter.sheet.current")
623
673
  },
624
674
  {
625
675
  value: "all",
626
- label: u.t("threadCommentUI.filter.sheet.all")
676
+ label: C.t("threadCommentUI.filter.sheet.all")
627
677
  }
628
678
  ]
629
679
  }
630
- ), /* @__PURE__ */ o.createElement(
631
- le,
680
+ ) : null, /* @__PURE__ */ a.createElement(
681
+ pe,
632
682
  {
633
683
  borderless: !0,
634
- value: p,
635
- onChange: (l) => I(l),
684
+ value: E,
685
+ onChange: (i) => H(i),
636
686
  options: [
637
687
  {
638
688
  value: "all",
639
- label: u.t("threadCommentUI.filter.status.all")
689
+ label: C.t("threadCommentUI.filter.status.all")
640
690
  },
641
691
  {
642
692
  value: "resolved",
643
- label: u.t("threadCommentUI.filter.status.resolved")
693
+ label: C.t("threadCommentUI.filter.status.resolved")
644
694
  },
645
695
  {
646
696
  value: "unsolved",
647
- label: u.t("threadCommentUI.filter.status.unsolved")
697
+ label: C.t("threadCommentUI.filter.status.unsolved")
648
698
  },
649
699
  {
650
700
  value: "concern_me",
651
- label: u.t("threadCommentUI.filter.status.concernMe")
701
+ label: C.t("threadCommentUI.filter.status.concernMe")
652
702
  }
653
703
  ]
654
704
  }
655
- )), R == null ? void 0 : R.map((l) => /* @__PURE__ */ o.createElement(
656
- Xt,
705
+ )), G.map((i) => /* @__PURE__ */ a.createElement(
706
+ hn,
657
707
  {
658
- prefix: F,
659
- getSubUnitName: i,
660
- key: l.id,
661
- id: l.id,
662
- unitId: l.unitId,
663
- subUnitId: l.subUnitId,
708
+ prefix: X,
709
+ getSubUnitName: l,
710
+ key: i.id,
711
+ id: i.id,
712
+ unitId: i.unitId,
713
+ subUnitId: i.subUnitId,
714
+ refStr: i.ref,
664
715
  type: r,
665
- showEdit: (C == null ? void 0 : C.commentId) === l.id,
666
- showHighlight: (C == null ? void 0 : C.commentId) === l.id,
716
+ showEdit: (p == null ? void 0 : p.commentId) === i.id,
717
+ showHighlight: (p == null ? void 0 : p.commentId) === i.id,
667
718
  onClick: () => {
668
- V.current = !1, U.executeCommand(fe.id, {
669
- unitId: l.unitId,
670
- subUnitId: l.subUnitId,
671
- commentId: l.id,
672
- temp: !0
673
- });
719
+ z.current = !1, i.resolved ? W.executeCommand(j.id) : W.executeCommand(
720
+ j.id,
721
+ {
722
+ unitId: i.unitId,
723
+ subUnitId: i.subUnitId,
724
+ commentId: i.id,
725
+ temp: !1
726
+ }
727
+ );
674
728
  },
675
- onClose: () => s == null ? void 0 : s(l.id),
676
- onMouseEnter: () => f == null ? void 0 : f(l),
677
- onMouseLeave: () => d == null ? void 0 : d(l)
729
+ onMouseEnter: () => y == null ? void 0 : y(i),
730
+ onMouseLeave: () => f == null ? void 0 : f(i),
731
+ onAddComment: I,
732
+ onDeleteComment: h,
733
+ onResolve: (U) => m == null ? void 0 : m(i.id, U)
678
734
  }
679
- )), R.length ? null : /* @__PURE__ */ o.createElement("div", { className: Z.threadCommentPanelEmpty }, B ? u.t("threadCommentUI.panel.filterEmpty") : u.t("threadCommentUI.panel.empty"), B ? /* @__PURE__ */ o.createElement(
680
- G,
735
+ )), G.length ? null : /* @__PURE__ */ a.createElement("div", { className: re.threadCommentPanelEmpty }, K ? C.t("threadCommentUI.panel.filterEmpty") : C.t("threadCommentUI.panel.empty"), K ? /* @__PURE__ */ a.createElement(
736
+ ae,
681
737
  {
682
- onClick: z,
738
+ onClick: x,
683
739
  type: "link"
684
740
  },
685
- u.t("threadCommentUI.panel.reset")
686
- ) : /* @__PURE__ */ o.createElement(
687
- G,
741
+ C.t("threadCommentUI.panel.reset")
742
+ ) : /* @__PURE__ */ a.createElement(
743
+ ae,
688
744
  {
689
745
  id: "thread-comment-add",
690
- className: Z.threadCommentPanelAdd,
746
+ className: re.threadCommentPanelAdd,
691
747
  type: "primary",
692
- onClick: a
748
+ onClick: o,
749
+ disabled: P
693
750
  },
694
- /* @__PURE__ */ o.createElement(ye, null),
695
- u.t("threadCommentUI.panel.addComment")
751
+ /* @__PURE__ */ a.createElement(Oe, null),
752
+ C.t("threadCommentUI.panel.addComment")
696
753
  )));
697
754
  };
698
755
  export {
699
- ge as IThreadCommentMentionDataService,
700
- fe as SetActiveCommentOperation,
701
- nt as THREAD_COMMENT_PANEL,
702
- pn as ThreadCommentPanel,
703
- A as ThreadCommentPanelService,
704
- Xt as ThreadCommentTree,
705
- lt as ToggleSheetCommentPanelOperation,
706
- K as UniverThreadCommentUIPlugin
756
+ Te as IThreadCommentMentionDataService,
757
+ j as SetActiveCommentOperation,
758
+ Ct as THREAD_COMMENT_PANEL,
759
+ wn as ThreadCommentPanel,
760
+ F as ThreadCommentPanelService,
761
+ hn as ThreadCommentTree,
762
+ It as ToggleSheetCommentPanelOperation,
763
+ ie as UniverThreadCommentUIPlugin,
764
+ ht as getDT
707
765
  };