@univerjs/docs-hyper-link-ui 0.5.5 → 0.6.0-experimental.20250125-1d060b9

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,52 +1,23 @@
1
- var Ke = Object.defineProperty;
2
- var Fe = (n, e, t) => e in n ? Ke(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t;
3
- var P = (n, e, t) => Fe(n, typeof e != "symbol" ? e + "" : e, t);
4
- import { CommandType as E, ICommandService as x, generateRandomId as Ve, CustomRangeType as D, IUniverInstanceService as O, UniverInstanceType as I, getBodySlice as Pe, useDependency as S, LocaleService as Re, useObservable as Ye, Tools as Ze, BuildTextUtils as _e, Disposable as N, Inject as v, DOCS_ZEN_EDITOR_UNIT_ID_KEY as We, DOCS_NORMAL_EDITOR_UNIT_ID_KEY as Ge, DependentOn as qe, Injector as Je, Plugin as ze, merge as Qe, IConfigService as Xe } from "@univerjs/core";
5
- import { UniverDocsHyperLinkPlugin as en } from "@univerjs/docs-hyper-link";
6
- import { IRenderManagerService as nn } from "@univerjs/engine-render";
7
- import { addCustomRangeBySelectionFactory as tn, DocSelectionManagerService as b, replaceSelectionFactory as rn, deleteCustomRangeFactory as on, SetTextSelectionsOperation as sn, DocSkeletonManagerService as cn, DocInterceptorService as dn, DOC_INTERCEPTOR_POINT as an } from "@univerjs/docs";
8
- import { DocCanvasPopManagerService as ln, DocEventManagerService as un, DocRenderController as pn, whenDocAndEditorFocused as fn } from "@univerjs/docs-ui";
9
- import { BehaviorSubject as ve, distinctUntilChanged as gn, pairwise as hn, Observable as mn, debounceTime as _n } from "rxjs";
10
- import vn, { useState as J, useEffect as In, forwardRef as j, useRef as Cn, createElement as U } from "react";
11
- import { FormLayout as Ie, Input as Ce, Button as Se, Tooltip as B, MessageType as Sn } from "@univerjs/design";
12
- import { KeyCode as te, IMessageService as Ln, useObservable as yn, MetaKeys as kn, MenuItemType as xn, getMenuHiddenObservable as On, RibbonStartGroup as Pn, ContextMenuPosition as Rn, ContextMenuGroup as En, ComponentManager as bn, IMenuManagerService as Mn, IShortcutService as wn } from "@univerjs/ui";
13
- const Dn = "docs-hyper-link-ui.config", Le = {};
14
- var z = { exports: {} }, M = {};
15
- /**
16
- * @license React
17
- * react-jsx-runtime.production.min.js
18
- *
19
- * Copyright (c) Facebook, Inc. and its affiliates.
20
- *
21
- * This source code is licensed under the MIT license found in the
22
- * LICENSE file in the root directory of this source tree.
23
- */
24
- var ye;
25
- function Nn() {
26
- if (ye) return M;
27
- ye = 1;
28
- var n = vn, e = Symbol.for("react.element"), t = Symbol.for("react.fragment"), i = Object.prototype.hasOwnProperty, r = n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, o = { key: !0, ref: !0, __self: !0, __source: !0 };
29
- function s(c, d, p) {
30
- var l, h = {}, f = null, a = null;
31
- p !== void 0 && (f = "" + p), d.key !== void 0 && (f = "" + d.key), d.ref !== void 0 && (a = d.ref);
32
- for (l in d) i.call(d, l) && !o.hasOwnProperty(l) && (h[l] = d[l]);
33
- if (c && c.defaultProps) for (l in d = c.defaultProps, d) h[l] === void 0 && (h[l] = d[l]);
34
- return { $$typeof: e, type: c, key: f, ref: a, props: h, _owner: r.current };
35
- }
36
- return M.Fragment = t, M.jsx = s, M.jsxs = s, M;
37
- }
38
- var ke;
39
- function jn() {
40
- return ke || (ke = 1, z.exports = Nn()), z.exports;
41
- }
42
- var u = jn();
43
- const Ee = {
44
- type: E.COMMAND,
1
+ var je = Object.defineProperty;
2
+ var Ae = (n, e, t) => e in n ? je(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t;
3
+ var P = (n, e, t) => Ae(n, typeof e != "symbol" ? e + "" : e, t);
4
+ import { CommandType as b, ICommandService as O, generateRandomId as Be, CustomRangeType as D, IUniverInstanceService as x, UniverInstanceType as I, getBodySlice as ye, useDependency as S, LocaleService as Oe, useObservable as Ke, Tools as Fe, BuildTextUtils as me, Disposable as N, Inject as _, DOCS_ZEN_EDITOR_UNIT_ID_KEY as Ve, DOCS_NORMAL_EDITOR_UNIT_ID_KEY as Ye, DependentOn as Ze, Injector as We, Plugin as Ge, merge as ze, IConfigService as qe } from "@univerjs/core";
5
+ import { UniverDocsHyperLinkPlugin as Je } from "@univerjs/docs-hyper-link";
6
+ import { IRenderManagerService as Qe } from "@univerjs/engine-render";
7
+ import { addCustomRangeBySelectionFactory as Xe, DocSelectionManagerService as M, replaceSelectionFactory as en, deleteCustomRangeFactory as nn, SetTextSelectionsOperation as tn, DocSkeletonManagerService as rn, DocInterceptorService as on, DOC_INTERCEPTOR_POINT as sn } from "@univerjs/docs";
8
+ import { DocCanvasPopManagerService as cn, DocEventManagerService as dn, DocRenderController as an, whenDocAndEditorFocused as ln } from "@univerjs/docs-ui";
9
+ import { BehaviorSubject as ve, distinctUntilChanged as un, pairwise as pn, Observable as fn, debounceTime as gn } from "rxjs";
10
+ import { jsxs as E, jsx as g } from "react/jsx-runtime";
11
+ import { FormLayout as _e, Input as Ie, Button as Ce, Tooltip as B, MessageType as hn } from "@univerjs/design";
12
+ import { KeyCode as ne, IMessageService as mn, useObservable as vn, MetaKeys as _n, MenuItemType as In, getMenuHiddenObservable as Cn, RibbonStartGroup as Sn, ContextMenuPosition as Ln, ContextMenuGroup as kn, ComponentManager as yn, IMenuManagerService as On, IShortcutService as xn } from "@univerjs/ui";
13
+ import { useState as q, useEffect as Pn, forwardRef as U, useRef as En, createElement as $ } from "react";
14
+ const Rn = "docs-hyper-link-ui.config", Se = {}, xe = {
15
+ type: b.COMMAND,
45
16
  id: "docs.command.add-hyper-link",
46
17
  async handler(n, e) {
47
18
  if (!e)
48
19
  return !1;
49
- const { payload: t, unitId: i, selections: r } = e, o = n.get(x), s = Ve(), c = tn(
20
+ const { payload: t, unitId: i, selections: r } = e, o = n.get(O), s = Be(), c = Xe(
50
21
  n,
51
22
  {
52
23
  rangeId: s,
@@ -60,19 +31,19 @@ const Ee = {
60
31
  );
61
32
  return c ? o.syncExecuteCommand(c.id, c.params) : !1;
62
33
  }
63
- }, be = {
34
+ }, Pe = {
64
35
  id: "docs.command.update-hyper-link",
65
- type: E.COMMAND,
36
+ type: b.COMMAND,
66
37
  handler(n, e) {
67
- var m;
38
+ var p;
68
39
  if (!e)
69
40
  return !1;
70
- const { unitId: t, payload: i, segmentId: r, linkId: o } = e, s = n.get(x), c = n.get(O), p = n.get(b).getActiveTextRange(), l = c.getUnit(t, I.UNIVER_DOC);
71
- if (!p || !l)
41
+ const { unitId: t, payload: i, segmentId: r, linkId: o } = e, s = n.get(O), c = n.get(x), u = n.get(M).getActiveTextRange(), h = c.getUnit(t, I.UNIVER_DOC);
42
+ if (!u || !h)
72
43
  return !1;
73
- const f = (m = Pe(l.getSelfOrHeaderFooterModel(r).getBody(), p.startOffset, p.endOffset).textRuns) == null ? void 0 : m[0];
44
+ const f = (p = ye(h.getSelfOrHeaderFooterModel(r).getBody(), u.startOffset, u.endOffset).textRuns) == null ? void 0 : p[0];
74
45
  f && (f.ed = e.label.length + 1);
75
- const a = rn(n, {
46
+ const d = en(n, {
76
47
  unitId: t,
77
48
  body: {
78
49
  dataStream: `${e.label}`,
@@ -88,120 +59,120 @@ const Ee = {
88
59
  textRuns: f ? [f] : void 0
89
60
  },
90
61
  selection: {
91
- startOffset: p.startOffset,
92
- endOffset: p.endOffset,
62
+ startOffset: u.startOffset,
63
+ endOffset: u.endOffset,
93
64
  collapsed: !1,
94
65
  segmentId: r
95
66
  }
96
67
  });
97
- return a ? s.syncExecuteCommand(a.id, a.params) : !1;
98
- }
99
- }, Un = "univer-docs-link-edit", $n = "univer-docs-link-edit-title", Tn = "univer-docs-link-edit-close", Hn = "univer-docs-link-edit-buttons", An = "univer-docs-link-edit-button", K = {
100
- docsLinkEdit: Un,
101
- docsLinkEditTitle: $n,
102
- docsLinkEditClose: Tn,
103
- docsLinkEditButtons: Hn,
104
- docsLinkEditButton: An
68
+ return d ? s.syncExecuteCommand(d.id, d.params) : !1;
69
+ }
70
+ }, bn = "univer-docs-link-edit", Mn = "univer-docs-link-edit-title", wn = "univer-docs-link-edit-close", Dn = "univer-docs-link-edit-buttons", Nn = "univer-docs-link-edit-button", K = {
71
+ docsLinkEdit: bn,
72
+ docsLinkEditTitle: Mn,
73
+ docsLinkEditClose: wn,
74
+ docsLinkEditButtons: Dn,
75
+ docsLinkEditButton: Nn
105
76
  };
106
- function Bn(n) {
77
+ function Un(n) {
107
78
  return /^[a-zA-Z]+:\/\//.test(n);
108
79
  }
109
- function Kn(n) {
80
+ function $n(n) {
110
81
  return /^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$/.test(n);
111
82
  }
112
- function Fn(n) {
113
- return Bn(n) ? n : Kn(n) ? `mailto://${n}` : `https://${n}`;
83
+ function Tn(n) {
84
+ return Un(n) ? n : $n(n) ? `mailto://${n}` : `https://${n}`;
114
85
  }
115
86
  const V = () => {
116
- const n = S(L), e = S(Re), t = Ye(n.editingLink$), i = S(x), r = S(O), o = S(b), [s, c] = J(""), [d, p] = J(""), [l, h] = J(!1), f = Ze.isLegalUrl(s), a = t ? r.getUnit(t.unitId, I.UNIVER_DOC) : r.getCurrentUnitForType(I.UNIVER_DOC);
117
- In(() => {
118
- var de, ae, le, ue, pe, fe, ge, he, me;
119
- const g = o.getActiveTextRange();
120
- if (!g)
87
+ const n = S(L), e = S(Oe), t = Ke(n.editingLink$), i = S(O), r = S(x), o = S(M), [s, c] = q(""), [l, u] = q(""), [h, m] = q(!1), f = Fe.isLegalUrl(s), d = t ? r.getUnit(t.unitId, I.UNIVER_DOC) : r.getCurrentUnitForType(I.UNIVER_DOC);
88
+ Pn(() => {
89
+ var ce, de, ae, le, ue, pe, fe, ge, he;
90
+ const a = o.getActiveTextRange();
91
+ if (!a)
121
92
  return;
122
93
  if (t) {
123
- const H = (de = a == null ? void 0 : a.getSelfOrHeaderFooterModel(t.segmentId)) == null ? void 0 : de.getBody(), A = (ae = H == null ? void 0 : H.customRanges) == null ? void 0 : ae.find((q) => (t == null ? void 0 : t.linkId) === q.rangeId && q.startIndex === t.startIndex && q.endIndex === t.endIndex);
124
- a && A && (c((ue = (le = A.properties) == null ? void 0 : le.url) != null ? ue : ""), p(_e.transform.getPlainText(Pe(H, A.startIndex, A.endIndex + 1).dataStream)));
94
+ const j = (ce = d == null ? void 0 : d.getSelfOrHeaderFooterModel(t.segmentId)) == null ? void 0 : ce.getBody(), A = (de = j == null ? void 0 : j.customRanges) == null ? void 0 : de.find((z) => (t == null ? void 0 : t.linkId) === z.rangeId && z.startIndex === t.startIndex && z.endIndex === t.endIndex);
95
+ d && A && (c((le = (ae = A.properties) == null ? void 0 : ae.url) != null ? le : ""), u(me.transform.getPlainText(ye(j, A.startIndex, A.endIndex + 1).dataStream)));
125
96
  return;
126
97
  }
127
- const y = (pe = a == null ? void 0 : a.getSelfOrHeaderFooterModel(g.segmentId)) == null ? void 0 : pe.getBody(), ce = y ? g : null, T = ce && ((ge = _e.customRange.getCustomRangesInterestsWithSelection(ce, (fe = y == null ? void 0 : y.customRanges) != null ? fe : [])) == null ? void 0 : ge[0]);
128
- a && T && c((me = (he = T == null ? void 0 : T.properties) == null ? void 0 : he.url) != null ? me : "");
129
- }, [a, t, o, r]);
130
- const m = () => {
98
+ const k = (ue = d == null ? void 0 : d.getSelfOrHeaderFooterModel(a.segmentId)) == null ? void 0 : ue.getBody(), se = k ? a : null, H = se && ((fe = me.customRange.getCustomRangesInterestsWithSelection(se, (pe = k == null ? void 0 : k.customRanges) != null ? pe : [])) == null ? void 0 : fe[0]);
99
+ d && H && c((he = (ge = H == null ? void 0 : H.properties) == null ? void 0 : ge.url) != null ? he : "");
100
+ }, [d, t, o, r]);
101
+ const p = () => {
131
102
  n.hideEditPopup();
132
103
  }, C = () => {
133
- if (h(!0), !f || !a)
104
+ if (m(!0), !f || !d)
134
105
  return;
135
- const g = Fn(s);
106
+ const a = Tn(s);
136
107
  if (!t)
137
- i.executeCommand(Ee.id, {
138
- unitId: a.getUnitId(),
139
- payload: g
108
+ i.executeCommand(xe.id, {
109
+ unitId: d.getUnitId(),
110
+ payload: a
140
111
  });
141
112
  else {
142
- if (!d)
113
+ if (!l)
143
114
  return;
144
- i.executeCommand(be.id, {
145
- unitId: a.getUnitId(),
146
- payload: g,
115
+ i.executeCommand(Pe.id, {
116
+ unitId: d.getUnitId(),
117
+ payload: a,
147
118
  linkId: t.linkId,
148
- label: d,
119
+ label: l,
149
120
  segmentId: t.segmentId
150
121
  });
151
122
  }
152
123
  n.hideEditPopup();
153
124
  };
154
- if (a)
155
- return /* @__PURE__ */ u.jsxs("div", { className: K.docsLinkEdit, children: [
156
- /* @__PURE__ */ u.jsxs("div", { children: [
157
- t ? /* @__PURE__ */ u.jsx(
158
- Ie,
125
+ if (d)
126
+ return /* @__PURE__ */ E("div", { className: K.docsLinkEdit, children: [
127
+ /* @__PURE__ */ E("div", { children: [
128
+ t ? /* @__PURE__ */ g(
129
+ _e,
159
130
  {
160
131
  label: e.t("docLink.edit.label"),
161
- error: l && !d ? e.t("docLink.edit.labelError") : "",
162
- children: /* @__PURE__ */ u.jsx(
163
- Ce,
132
+ error: h && !l ? e.t("docLink.edit.labelError") : "",
133
+ children: /* @__PURE__ */ g(
134
+ Ie,
164
135
  {
165
- value: d,
166
- onChange: p,
136
+ value: l,
137
+ onChange: u,
167
138
  autoFocus: !0,
168
- onKeyDown: (g) => {
169
- g.keyCode === te.ENTER && C();
139
+ onKeyDown: (a) => {
140
+ a.keyCode === ne.ENTER && C();
170
141
  }
171
142
  }
172
143
  )
173
144
  }
174
145
  ) : null,
175
- /* @__PURE__ */ u.jsx(
176
- Ie,
146
+ /* @__PURE__ */ g(
147
+ _e,
177
148
  {
178
149
  label: e.t("docLink.edit.address"),
179
- error: l && !f ? e.t("docLink.edit.addressError") : "",
180
- children: /* @__PURE__ */ u.jsx(
181
- Ce,
150
+ error: h && !f ? e.t("docLink.edit.addressError") : "",
151
+ children: /* @__PURE__ */ g(
152
+ Ie,
182
153
  {
183
154
  value: s,
184
155
  onChange: c,
185
156
  autoFocus: !0,
186
- onKeyDown: (g) => {
187
- g.keyCode === te.ENTER && C();
157
+ onKeyDown: (a) => {
158
+ a.keyCode === ne.ENTER && C();
188
159
  }
189
160
  }
190
161
  )
191
162
  }
192
163
  )
193
164
  ] }),
194
- /* @__PURE__ */ u.jsxs("div", { className: K.docsLinkEditButtons, children: [
195
- /* @__PURE__ */ u.jsx(
196
- Se,
165
+ /* @__PURE__ */ E("div", { className: K.docsLinkEditButtons, children: [
166
+ /* @__PURE__ */ g(
167
+ Ce,
197
168
  {
198
169
  className: K.docsLinkEditButton,
199
- onClick: m,
170
+ onClick: p,
200
171
  children: e.t("docLink.edit.cancel")
201
172
  }
202
173
  ),
203
- /* @__PURE__ */ u.jsx(
204
- Se,
174
+ /* @__PURE__ */ g(
175
+ Ce,
205
176
  {
206
177
  disabled: !s,
207
178
  className: K.docsLinkEditButton,
@@ -214,32 +185,32 @@ const V = () => {
214
185
  ] });
215
186
  };
216
187
  V.componentKey = "docs-hyper-link-edit";
217
- var _ = function() {
218
- return _ = Object.assign || function(n) {
188
+ var v = function() {
189
+ return v = Object.assign || function(n) {
219
190
  for (var e, t = 1, i = arguments.length; t < i; t++) {
220
191
  e = arguments[t];
221
192
  for (var r in e) Object.prototype.hasOwnProperty.call(e, r) && (n[r] = e[r]);
222
193
  }
223
194
  return n;
224
- }, _.apply(this, arguments);
225
- }, Vn = function(n, e) {
195
+ }, v.apply(this, arguments);
196
+ }, Hn = function(n, e) {
226
197
  var t = {};
227
198
  for (var i in n) Object.prototype.hasOwnProperty.call(n, i) && e.indexOf(i) < 0 && (t[i] = n[i]);
228
199
  if (n != null && typeof Object.getOwnPropertySymbols == "function")
229
200
  for (var r = 0, i = Object.getOwnPropertySymbols(n); r < i.length; r++)
230
201
  e.indexOf(i[r]) < 0 && Object.prototype.propertyIsEnumerable.call(n, i[r]) && (t[i[r]] = n[i[r]]);
231
202
  return t;
232
- }, $ = j(function(n, e) {
233
- var t = n.icon, i = n.id, r = n.className, o = n.extend, s = Vn(n, ["icon", "id", "className", "extend"]), c = "univerjs-icon univerjs-icon-".concat(i, " ").concat(r || "").trim(), d = Cn("_".concat(Wn()));
234
- return Me(t, "".concat(i), { defIds: t.defIds, idSuffix: d.current }, _({ ref: e, className: c }, s), o);
203
+ }, T = U(function(n, e) {
204
+ var t = n.icon, i = n.id, r = n.className, o = n.extend, s = Hn(n, ["icon", "id", "className", "extend"]), c = "univerjs-icon univerjs-icon-".concat(i, " ").concat(r || "").trim(), l = En("_".concat(Bn()));
205
+ return Ee(t, "".concat(i), { defIds: t.defIds, idSuffix: l.current }, v({ ref: e, className: c }, s), o);
235
206
  });
236
- function Me(n, e, t, i, r) {
237
- return U(n.tag, _(_({ key: e }, Yn(n, t, r)), i), (Zn(n, t).children || []).map(function(o, s) {
238
- return Me(o, "".concat(e, "-").concat(n.tag, "-").concat(s), t, void 0, r);
207
+ function Ee(n, e, t, i, r) {
208
+ return $(n.tag, v(v({ key: e }, jn(n, t, r)), i), (An(n, t).children || []).map(function(o, s) {
209
+ return Ee(o, "".concat(e, "-").concat(n.tag, "-").concat(s), t, void 0, r);
239
210
  }));
240
211
  }
241
- function Yn(n, e, t) {
242
- var i = _({}, n.attrs);
212
+ function jn(n, e, t) {
213
+ var i = v({}, n.attrs);
243
214
  t != null && t.colorChannel1 && i.fill === "colorChannel1" && (i.fill = t.colorChannel1);
244
215
  var r = e.defIds;
245
216
  return !r || r.length === 0 || (n.tag === "use" && i["xlink:href"] && (i["xlink:href"] = i["xlink:href"] + e.idSuffix), Object.entries(i).forEach(function(o) {
@@ -247,172 +218,172 @@ function Yn(n, e, t) {
247
218
  typeof c == "string" && (i[s] = c.replace(/url\(#(.*)\)/, "url(#$1".concat(e.idSuffix, ")")));
248
219
  })), i;
249
220
  }
250
- function Zn(n, e) {
221
+ function An(n, e) {
251
222
  var t, i = e.defIds;
252
- return !i || i.length === 0 ? n : n.tag === "defs" && (!((t = n.children) === null || t === void 0) && t.length) ? _(_({}, n), { children: n.children.map(function(r) {
253
- return typeof r.attrs.id == "string" && i && i.indexOf(r.attrs.id) > -1 ? _(_({}, r), { attrs: _(_({}, r.attrs), { id: r.attrs.id + e.idSuffix }) }) : r;
223
+ return !i || i.length === 0 ? n : n.tag === "defs" && (!((t = n.children) === null || t === void 0) && t.length) ? v(v({}, n), { children: n.children.map(function(r) {
224
+ return typeof r.attrs.id == "string" && i && i.indexOf(r.attrs.id) > -1 ? v(v({}, r), { attrs: v(v({}, r.attrs), { id: r.attrs.id + e.idSuffix }) }) : r;
254
225
  }) }) : n;
255
226
  }
256
- function Wn() {
227
+ function Bn() {
257
228
  return Math.random().toString(36).substring(2, 8);
258
229
  }
259
- $.displayName = "UniverIcon";
260
- var Gn = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 16 16", width: "1em", height: "1em" }, children: [{ tag: "path", attrs: { fill: "currentColor", d: "M4.1302 12.4251C4.25802 13.7417 5.36779 14.7708 6.71792 14.7708H11.7179C13.1539 14.7708 14.3179 13.6067 14.3179 12.1708V6.1708C14.3179 4.78586 13.2351 3.65383 11.8698 3.57517C11.742 2.25858 10.6323 1.22949 9.28213 1.22949H4.28213C2.84619 1.22949 1.68213 2.39355 1.68213 3.82949V9.82949C1.68213 11.2144 2.76497 12.3465 4.1302 12.4251ZM10.6583 3.5708H6.71792C5.28198 3.5708 4.11792 4.73486 4.11792 6.1708V11.22C3.4221 11.1387 2.88213 10.5471 2.88213 9.82949V3.82949C2.88213 3.05629 3.50893 2.42949 4.28213 2.42949H9.28213C9.96695 2.42949 10.5369 2.92119 10.6583 3.5708ZM13.1179 6.1708C13.1179 5.3976 12.4911 4.7708 11.7179 4.7708H6.71792C5.94472 4.7708 5.31792 5.3976 5.31792 6.1708V12.1708C5.31792 12.944 5.94472 13.5708 6.71792 13.5708H11.7179C12.4911 13.5708 13.1179 12.944 13.1179 12.1708V6.1708Z", fillRule: "evenodd", clipRule: "evenodd" } }] }, we = j(function(n, e) {
261
- return U($, Object.assign({}, n, {
230
+ T.displayName = "UniverIcon";
231
+ var Kn = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 16 16", width: "1em", height: "1em" }, children: [{ tag: "path", attrs: { fill: "currentColor", d: "M4.1302 12.4251C4.25802 13.7417 5.36779 14.7708 6.71792 14.7708H11.7179C13.1539 14.7708 14.3179 13.6067 14.3179 12.1708V6.1708C14.3179 4.78586 13.2351 3.65383 11.8698 3.57517C11.742 2.25858 10.6323 1.22949 9.28213 1.22949H4.28213C2.84619 1.22949 1.68213 2.39355 1.68213 3.82949V9.82949C1.68213 11.2144 2.76497 12.3465 4.1302 12.4251ZM10.6583 3.5708H6.71792C5.28198 3.5708 4.11792 4.73486 4.11792 6.1708V11.22C3.4221 11.1387 2.88213 10.5471 2.88213 9.82949V3.82949C2.88213 3.05629 3.50893 2.42949 4.28213 2.42949H9.28213C9.96695 2.42949 10.5369 2.92119 10.6583 3.5708ZM13.1179 6.1708C13.1179 5.3976 12.4911 4.7708 11.7179 4.7708H6.71792C5.94472 4.7708 5.31792 5.3976 5.31792 6.1708V12.1708C5.31792 12.944 5.94472 13.5708 6.71792 13.5708H11.7179C12.4911 13.5708 13.1179 12.944 13.1179 12.1708V6.1708Z", fillRule: "evenodd", clipRule: "evenodd" } }] }, Re = U(function(n, e) {
232
+ return $(T, Object.assign({}, n, {
262
233
  id: "copy-single",
263
234
  ref: e,
264
- icon: Gn
235
+ icon: Kn
265
236
  }));
266
237
  });
267
- we.displayName = "CopySingle";
268
- var qn = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 16 16", width: "1em", height: "1em" }, children: [{ tag: "path", attrs: { fill: "currentColor", d: "M9.8816 1.97978C11.0177 0.843607 12.862 0.884962 14.0004 2.02342C15.1389 3.16188 15.1803 5.00612 14.0441 6.14228L11.399 8.78737C11.1608 9.02559 10.7746 9.02559 10.5363 8.78737C10.2981 8.54915 10.2981 8.16292 10.5363 7.9247L13.1814 5.2796C13.8195 4.64155 13.8217 3.57006 13.1378 2.8861C12.4538 2.20211 11.3823 2.20438 10.7443 2.84245L7.6976 5.88911L7.69317 5.89349C7.05959 6.53211 7.05894 7.60014 7.74132 8.28252C7.97954 8.52074 7.97954 8.90697 7.74132 9.14519C7.5031 9.38341 7.11687 9.38341 6.87865 9.14519C5.74016 8.00671 5.69884 6.16251 6.83497 5.02633L6.84021 5.02116L9.8816 1.97978Z" } }, { tag: "path", attrs: { fill: "currentColor", d: "M4.61426 7.2364C4.85248 6.99818 5.23871 6.99818 5.47693 7.2364C5.71515 7.47462 5.71515 7.86085 5.47693 8.09907L2.83183 10.7442C2.19375 11.3823 2.1915 12.4537 2.87547 13.1377C3.55945 13.8217 4.6309 13.8194 5.26899 13.1813L8.31566 10.1347C8.32262 10.1277 8.32971 10.121 8.33691 10.1144C8.34408 10.1064 8.3515 10.0986 8.35916 10.091C8.99721 9.45291 8.99949 8.38145 8.3155 7.69746C8.07728 7.45924 8.07728 7.07301 8.3155 6.83479C8.55372 6.59657 8.93995 6.59657 9.17817 6.83479C10.3166 7.97327 10.358 9.81748 9.22183 10.9536C9.21487 10.9606 9.20779 10.9673 9.20058 10.9739C9.19341 10.9819 9.18599 10.9897 9.17833 10.9973L6.13166 14.044C4.99548 15.1802 3.15127 15.1389 2.01279 14.0004C0.874362 12.8619 0.83297 11.0177 1.96916 9.8815L4.61426 7.2364Z" } }] }, se = j(function(n, e) {
269
- return U($, Object.assign({}, n, {
238
+ Re.displayName = "CopySingle";
239
+ var Fn = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 16 16", width: "1em", height: "1em" }, children: [{ tag: "path", attrs: { fill: "currentColor", d: "M9.8816 1.97978C11.0177 0.843607 12.862 0.884962 14.0004 2.02342C15.1389 3.16188 15.1803 5.00612 14.0441 6.14228L11.399 8.78737C11.1608 9.02559 10.7746 9.02559 10.5363 8.78737C10.2981 8.54915 10.2981 8.16292 10.5363 7.9247L13.1814 5.2796C13.8195 4.64155 13.8217 3.57006 13.1378 2.8861C12.4538 2.20211 11.3823 2.20438 10.7443 2.84245L7.6976 5.88911L7.69317 5.89349C7.05959 6.53211 7.05894 7.60014 7.74132 8.28252C7.97954 8.52074 7.97954 8.90697 7.74132 9.14519C7.5031 9.38341 7.11687 9.38341 6.87865 9.14519C5.74016 8.00671 5.69884 6.16251 6.83497 5.02633L6.84021 5.02116L9.8816 1.97978Z" } }, { tag: "path", attrs: { fill: "currentColor", d: "M4.61426 7.2364C4.85248 6.99818 5.23871 6.99818 5.47693 7.2364C5.71515 7.47462 5.71515 7.86085 5.47693 8.09907L2.83183 10.7442C2.19375 11.3823 2.1915 12.4537 2.87547 13.1377C3.55945 13.8217 4.6309 13.8194 5.26899 13.1813L8.31566 10.1347C8.32262 10.1277 8.32971 10.121 8.33691 10.1144C8.34408 10.1064 8.3515 10.0986 8.35916 10.091C8.99721 9.45291 8.99949 8.38145 8.3155 7.69746C8.07728 7.45924 8.07728 7.07301 8.3155 6.83479C8.55372 6.59657 8.93995 6.59657 9.17817 6.83479C10.3166 7.97327 10.358 9.81748 9.22183 10.9536C9.21487 10.9606 9.20779 10.9673 9.20058 10.9739C9.19341 10.9819 9.18599 10.9897 9.17833 10.9973L6.13166 14.044C4.99548 15.1802 3.15127 15.1389 2.01279 14.0004C0.874362 12.8619 0.83297 11.0177 1.96916 9.8815L4.61426 7.2364Z" } }] }, oe = U(function(n, e) {
240
+ return $(T, Object.assign({}, n, {
270
241
  id: "link-single",
271
242
  ref: e,
272
- icon: qn
243
+ icon: Fn
273
244
  }));
274
245
  });
275
- se.displayName = "LinkSingle";
276
- var Jn = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 16 17", width: "1em", height: "1em" }, children: [{ tag: "path", attrs: { fill: "currentColor", d: "M12.5935 3.47302C11.6354 2.51492 10.082 2.51492 9.12388 3.47302L7.83534 4.76157C7.60102 4.99588 7.22112 4.99588 6.98681 4.76157 6.75249 4.52725 6.75249 4.14735 6.98681 3.91304L8.27535 2.62449C9.70209 1.19776 12.0153 1.19776 13.442 2.62449 14.8688 4.05123 14.8688 6.36442 13.442 7.79116L12.1535 9.0797C11.9192 9.31402 11.5393 9.31402 11.3049 9.0797 11.0706 8.84539 11.0706 8.46549 11.3049 8.23117L12.5935 6.94263C13.5516 5.98452 13.5516 4.43113 12.5935 3.47302zM3.40637 12.6606C2.44827 11.7025 2.44827 10.1491 3.40637 9.19102L4.69492 7.90248C4.92923 7.66816 4.92923 7.28826 4.69492 7.05395 4.4606 6.81963 4.0807 6.81963 3.84639 7.05395L2.55784 8.34249C1.13111 9.76923 1.13111 12.0824 2.55784 13.5092 3.98458 14.9359 6.29777 14.9359 7.72451 13.5092L9.01305 12.2206C9.24737 11.9863 9.24737 11.6064 9.01305 11.3721 8.77874 11.1378 8.39884 11.1378 8.16452 11.3721L6.87598 12.6606C5.91787 13.6187 4.36448 13.6187 3.40637 12.6606zM3.5852 2.80332C3.35088 2.569 2.97098 2.569 2.73667 2.80332 2.50235 3.03763 2.50235 3.41753 2.73667 3.65185L12.4151 13.3302C12.6494 13.5646 13.0293 13.5646 13.2636 13.3302 13.4979 13.0959 13.4979 12.716 13.2636 12.4817L3.5852 2.80332z" } }] }, De = j(function(n, e) {
277
- return U($, Object.assign({}, n, {
246
+ oe.displayName = "LinkSingle";
247
+ var Vn = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 16 17", width: "1em", height: "1em" }, children: [{ tag: "path", attrs: { fill: "currentColor", d: "M12.5935 3.47302C11.6354 2.51492 10.082 2.51492 9.12388 3.47302L7.83534 4.76157C7.60102 4.99588 7.22112 4.99588 6.98681 4.76157 6.75249 4.52725 6.75249 4.14735 6.98681 3.91304L8.27535 2.62449C9.70209 1.19776 12.0153 1.19776 13.442 2.62449 14.8688 4.05123 14.8688 6.36442 13.442 7.79116L12.1535 9.0797C11.9192 9.31402 11.5393 9.31402 11.3049 9.0797 11.0706 8.84539 11.0706 8.46549 11.3049 8.23117L12.5935 6.94263C13.5516 5.98452 13.5516 4.43113 12.5935 3.47302zM3.40637 12.6606C2.44827 11.7025 2.44827 10.1491 3.40637 9.19102L4.69492 7.90248C4.92923 7.66816 4.92923 7.28826 4.69492 7.05395 4.4606 6.81963 4.0807 6.81963 3.84639 7.05395L2.55784 8.34249C1.13111 9.76923 1.13111 12.0824 2.55784 13.5092 3.98458 14.9359 6.29777 14.9359 7.72451 13.5092L9.01305 12.2206C9.24737 11.9863 9.24737 11.6064 9.01305 11.3721 8.77874 11.1378 8.39884 11.1378 8.16452 11.3721L6.87598 12.6606C5.91787 13.6187 4.36448 13.6187 3.40637 12.6606zM3.5852 2.80332C3.35088 2.569 2.97098 2.569 2.73667 2.80332 2.50235 3.03763 2.50235 3.41753 2.73667 3.65185L12.4151 13.3302C12.6494 13.5646 13.0293 13.5646 13.2636 13.3302 13.4979 13.0959 13.4979 12.716 13.2636 12.4817L3.5852 2.80332z" } }] }, be = U(function(n, e) {
248
+ return $(T, Object.assign({}, n, {
278
249
  id: "unlink-single",
279
250
  ref: e,
280
- icon: Jn
251
+ icon: Vn
281
252
  }));
282
253
  });
283
- De.displayName = "UnlinkSingle";
284
- var zn = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 17 16", width: "1em", height: "1em" }, children: [{ tag: "path", attrs: { fill: "currentColor", d: "M12.6551 1.98906C11.7476 1.08113 10.2757 1.08149 9.3686 1.98987L4.82542 6.53955C4.75087 6.61421 4.69336 6.70411 4.65682 6.80309L3.2461 10.625C3.16506 10.8446 3.21909 11.0912 3.3845 11.2568C3.54991 11.4224 3.79651 11.4767 4.01616 11.3959L7.85031 9.98517C7.94979 9.94856 8.04014 9.89077 8.11508 9.81579L12.6552 5.27327C13.5618 4.36621 13.5618 2.89607 12.6551 1.98906ZM10.2177 2.83779C10.6562 2.39869 11.3677 2.39851 11.8064 2.8374C12.2447 3.27584 12.2447 3.9865 11.8065 4.42497L7.3392 8.89457L4.82213 9.82068L5.74706 7.31487L10.2177 2.83779Z", fillRule: "evenodd", clipRule: "evenodd" } }, { tag: "path", attrs: { fill: "currentColor", d: "M1.79238 13.2999C1.46101 13.2999 1.19238 13.5685 1.19238 13.8999C1.19238 14.2313 1.46101 14.4999 1.79238 14.4999H14.4924C14.8238 14.4999 15.0924 14.2313 15.0924 13.8999C15.0924 13.5685 14.8238 13.2999 14.4924 13.2999H1.79238Z" } }] }, Ne = j(function(n, e) {
285
- return U($, Object.assign({}, n, {
254
+ be.displayName = "UnlinkSingle";
255
+ var Yn = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 17 16", width: "1em", height: "1em" }, children: [{ tag: "path", attrs: { fill: "currentColor", d: "M12.6551 1.98906C11.7476 1.08113 10.2757 1.08149 9.3686 1.98987L4.82542 6.53955C4.75087 6.61421 4.69336 6.70411 4.65682 6.80309L3.2461 10.625C3.16506 10.8446 3.21909 11.0912 3.3845 11.2568C3.54991 11.4224 3.79651 11.4767 4.01616 11.3959L7.85031 9.98517C7.94979 9.94856 8.04014 9.89077 8.11508 9.81579L12.6552 5.27327C13.5618 4.36621 13.5618 2.89607 12.6551 1.98906ZM10.2177 2.83779C10.6562 2.39869 11.3677 2.39851 11.8064 2.8374C12.2447 3.27584 12.2447 3.9865 11.8065 4.42497L7.3392 8.89457L4.82213 9.82068L5.74706 7.31487L10.2177 2.83779Z", fillRule: "evenodd", clipRule: "evenodd" } }, { tag: "path", attrs: { fill: "currentColor", d: "M1.79238 13.2999C1.46101 13.2999 1.19238 13.5685 1.19238 13.8999C1.19238 14.2313 1.46101 14.4999 1.79238 14.4999H14.4924C14.8238 14.4999 15.0924 14.2313 15.0924 13.8999C15.0924 13.5685 14.8238 13.2999 14.4924 13.2999H1.79238Z" } }] }, Me = U(function(n, e) {
256
+ return $(T, Object.assign({}, n, {
286
257
  id: "write-single",
287
258
  ref: e,
288
- icon: zn
259
+ icon: Yn
289
260
  }));
290
261
  });
291
- Ne.displayName = "WriteSingle";
292
- function je(n) {
262
+ Me.displayName = "WriteSingle";
263
+ function we(n) {
293
264
  var e, t, i = "";
294
265
  if (typeof n == "string" || typeof n == "number") i += n;
295
266
  else if (typeof n == "object") if (Array.isArray(n)) {
296
267
  var r = n.length;
297
- for (e = 0; e < r; e++) n[e] && (t = je(n[e])) && (i && (i += " "), i += t);
268
+ for (e = 0; e < r; e++) n[e] && (t = we(n[e])) && (i && (i += " "), i += t);
298
269
  } else for (t in n) n[t] && (i && (i += " "), i += t);
299
270
  return i;
300
271
  }
301
- function xe() {
302
- for (var n, e, t = 0, i = "", r = arguments.length; t < r; t++) (n = arguments[t]) && (e = je(n)) && (i && (i += " "), i += e);
272
+ function Le() {
273
+ for (var n, e, t = 0, i = "", r = arguments.length; t < r; t++) (n = arguments[t]) && (e = we(n)) && (i && (i += " "), i += e);
303
274
  return i;
304
275
  }
305
- const Ue = {
306
- type: E.COMMAND,
276
+ const De = {
277
+ type: b.COMMAND,
307
278
  id: "docs.command.delete-hyper-link",
308
279
  async handler(n, e) {
309
280
  if (!e)
310
281
  return !1;
311
- const { unitId: t, linkId: i, segmentId: r } = e, o = n.get(x), s = on(n, { unitId: t, rangeId: i, segmentId: r });
282
+ const { unitId: t, linkId: i, segmentId: r } = e, o = n.get(O), s = nn(n, { unitId: t, rangeId: i, segmentId: r });
312
283
  return s ? await o.syncExecuteCommand(s.id, s.params) : !1;
313
284
  }
314
- }, $e = (n) => {
315
- const e = n.get(b), t = n.get(O), i = e.getTextRanges();
285
+ }, Ne = (n) => {
286
+ const e = n.get(M), t = n.get(x), i = e.getTextRanges();
316
287
  if (!(i != null && i.length))
317
288
  return !0;
318
289
  const r = i[0];
319
290
  return !!(!t.getCurrentUnitForType(I.UNIVER_DOC) || !r || r.collapsed);
320
291
  }, R = {
321
- type: E.OPERATION,
292
+ type: b.OPERATION,
322
293
  id: "doc.operation.show-hyper-link-edit-popup",
323
294
  handler(n, e) {
324
295
  var s;
325
- const t = e == null ? void 0 : e.link, i = n.get(O);
326
- if ($e(n) && !t)
296
+ const t = e == null ? void 0 : e.link, i = n.get(x);
297
+ if (Ne(n) && !t)
327
298
  return !1;
328
299
  const r = n.get(L), o = (t == null ? void 0 : t.unitId) || ((s = i.getCurrentUnitForType(I.UNIVER_DOC)) == null ? void 0 : s.getUnitId());
329
300
  return o ? (r.showEditPopup(o, t), !0) : !1;
330
301
  }
331
- }, ie = {
332
- type: E.OPERATION,
302
+ }, te = {
303
+ type: b.OPERATION,
333
304
  id: "doc.operation.toggle-hyper-link-info-popup",
334
305
  handler(n, e) {
335
306
  const t = n.get(L);
336
307
  return e ? (t.showInfoPopup(e), !0) : (t.hideInfoPopup(), !0);
337
308
  }
338
- }, Te = {
339
- type: E.OPERATION,
309
+ }, Ue = {
310
+ type: b.OPERATION,
340
311
  id: "doc.operation.click-hyper-link",
341
312
  handler(n, e) {
342
- var p, l, h;
313
+ var u, h, m;
343
314
  if (!e)
344
315
  return !1;
345
- const { unitId: t, linkId: i, segmentId: r } = e, s = n.get(O).getUnit(t, I.UNIVER_DOC), c = s == null ? void 0 : s.getSelfOrHeaderFooterModel(r).getBody(), d = (h = (l = (p = c == null ? void 0 : c.customRanges) == null ? void 0 : p.find((f) => f.rangeId === i && f.rangeType === D.HYPERLINK)) == null ? void 0 : l.properties) == null ? void 0 : h.url;
346
- return d && window.open(d, "_blank", "noopener noreferrer"), !0;
347
- }
348
- }, Qn = "univer-doc-link", Xn = "univer-doc-link-type", et = "univer-doc-link-content", nt = "univer-doc-link-content-error", tt = "univer-doc-link-url", it = "univer-doc-link-operations", rt = "univer-doc-link-operation", ot = "univer-doc-link-operation-error", k = {
349
- docLink: Qn,
350
- docLinkType: Xn,
351
- docLinkContent: et,
352
- docLinkContentError: nt,
353
- docLinkUrl: tt,
354
- docLinkOperations: it,
355
- docLinkOperation: rt,
356
- docLinkOperationError: ot
316
+ const { unitId: t, linkId: i, segmentId: r } = e, s = n.get(x).getUnit(t, I.UNIVER_DOC), c = s == null ? void 0 : s.getSelfOrHeaderFooterModel(r).getBody(), l = (m = (h = (u = c == null ? void 0 : c.customRanges) == null ? void 0 : u.find((f) => f.rangeId === i && f.rangeType === D.HYPERLINK)) == null ? void 0 : h.properties) == null ? void 0 : m.url;
317
+ return l && window.open(l, "_blank", "noopener noreferrer"), !0;
318
+ }
319
+ }, Zn = "univer-doc-link", Wn = "univer-doc-link-type", Gn = "univer-doc-link-content", zn = "univer-doc-link-content-error", qn = "univer-doc-link-url", Jn = "univer-doc-link-operations", Qn = "univer-doc-link-operation", Xn = "univer-doc-link-operation-error", y = {
320
+ docLink: Zn,
321
+ docLinkType: Wn,
322
+ docLinkContent: Gn,
323
+ docLinkContentError: zn,
324
+ docLinkUrl: qn,
325
+ docLinkOperations: Jn,
326
+ docLinkOperation: Qn,
327
+ docLinkOperationError: Xn
357
328
  }, Y = () => {
358
- var C, g;
359
- const n = S(L), e = S(x), t = S(Ln), i = S(Re), r = yn(n.showingLink$), o = S(O);
329
+ var C, a;
330
+ const n = S(L), e = S(O), t = S(mn), i = S(Oe), r = vn(n.showingLink$), o = S(x);
360
331
  if (!r)
361
332
  return null;
362
- const { unitId: s, linkId: c, segmentId: d, startIndex: p, endIndex: l } = r, h = o.getUnit(s, I.UNIVER_DOC), f = h == null ? void 0 : h.getSelfOrHeaderFooterModel(d).getBody(), a = (C = f == null ? void 0 : f.customRanges) == null ? void 0 : C.find((y) => y.rangeId === c && y.rangeType === D.HYPERLINK && y.startIndex === p && y.endIndex === l);
363
- if (!a)
333
+ const { unitId: s, linkId: c, segmentId: l, startIndex: u, endIndex: h } = r, m = o.getUnit(s, I.UNIVER_DOC), f = m == null ? void 0 : m.getSelfOrHeaderFooterModel(l).getBody(), d = (C = f == null ? void 0 : f.customRanges) == null ? void 0 : C.find((k) => k.rangeId === c && k.rangeType === D.HYPERLINK && k.startIndex === u && k.endIndex === h);
334
+ if (!d)
364
335
  return null;
365
- const m = (g = a.properties) == null ? void 0 : g.url;
366
- return /* @__PURE__ */ u.jsxs(
336
+ const p = (a = d.properties) == null ? void 0 : a.url;
337
+ return /* @__PURE__ */ E(
367
338
  "div",
368
339
  {
369
- className: k.docLink,
340
+ className: y.docLink,
370
341
  onClick: () => {
371
342
  n.hideInfoPopup();
372
343
  },
373
344
  children: [
374
- /* @__PURE__ */ u.jsxs("div", { className: xe(k.docLinkContent), onClick: () => window.open(m), children: [
375
- /* @__PURE__ */ u.jsx("div", { className: k.docLinkType, children: /* @__PURE__ */ u.jsx(se, {}) }),
376
- /* @__PURE__ */ u.jsx(B, { showIfEllipsis: !0, title: m, children: /* @__PURE__ */ u.jsx("span", { className: k.docLinkUrl, children: m }) })
345
+ /* @__PURE__ */ E("div", { className: Le(y.docLinkContent), onClick: () => window.open(p), children: [
346
+ /* @__PURE__ */ g("div", { className: y.docLinkType, children: /* @__PURE__ */ g(oe, {}) }),
347
+ /* @__PURE__ */ g(B, { showIfEllipsis: !0, title: p, children: /* @__PURE__ */ g("span", { className: y.docLinkUrl, children: p }) })
377
348
  ] }),
378
- /* @__PURE__ */ u.jsxs("div", { className: k.docLinkOperations, children: [
379
- /* @__PURE__ */ u.jsx(
349
+ /* @__PURE__ */ E("div", { className: y.docLinkOperations, children: [
350
+ /* @__PURE__ */ g(
380
351
  "div",
381
352
  {
382
- className: xe(k.docLinkOperation),
353
+ className: Le(y.docLinkOperation),
383
354
  onClick: () => {
384
- navigator.clipboard.writeText(m), t.show({
355
+ navigator.clipboard.writeText(p), t.show({
385
356
  content: i.t("docLink.info.coped"),
386
- type: Sn.Info
357
+ type: hn.Info
387
358
  });
388
359
  },
389
- children: /* @__PURE__ */ u.jsx(B, { placement: "bottom", title: i.t("docLink.info.copy"), children: /* @__PURE__ */ u.jsx(we, {}) })
360
+ children: /* @__PURE__ */ g(B, { placement: "bottom", title: i.t("docLink.info.copy"), children: /* @__PURE__ */ g(Re, {}) })
390
361
  }
391
362
  ),
392
- /* @__PURE__ */ u.jsx(
363
+ /* @__PURE__ */ g(
393
364
  "div",
394
365
  {
395
- className: k.docLinkOperation,
366
+ className: y.docLinkOperation,
396
367
  onClick: () => {
397
368
  e.executeCommand(R.id, {
398
369
  link: r
399
370
  });
400
371
  },
401
- children: /* @__PURE__ */ u.jsx(B, { placement: "bottom", title: i.t("docLink.info.edit"), children: /* @__PURE__ */ u.jsx(Ne, {}) })
372
+ children: /* @__PURE__ */ g(B, { placement: "bottom", title: i.t("docLink.info.edit"), children: /* @__PURE__ */ g(Me, {}) })
402
373
  }
403
374
  ),
404
- /* @__PURE__ */ u.jsx(
375
+ /* @__PURE__ */ g(
405
376
  "div",
406
377
  {
407
- className: k.docLinkOperation,
378
+ className: y.docLinkOperation,
408
379
  onClick: () => {
409
- e.executeCommand(Ue.id, {
380
+ e.executeCommand(De.id, {
410
381
  unitId: s,
411
- linkId: a.rangeId,
412
- segmentId: d
382
+ linkId: d.rangeId,
383
+ segmentId: l
413
384
  });
414
385
  },
415
- children: /* @__PURE__ */ u.jsx(B, { placement: "bottom", title: i.t("docLink.info.cancel"), children: /* @__PURE__ */ u.jsx(De, {}) })
386
+ children: /* @__PURE__ */ g(B, { placement: "bottom", title: i.t("docLink.info.cancel"), children: /* @__PURE__ */ g(be, {}) })
416
387
  }
417
388
  )
418
389
  ] })
@@ -421,11 +392,11 @@ const Ue = {
421
392
  );
422
393
  };
423
394
  Y.componentKey = "univer.doc.link-info-popup";
424
- var st = Object.defineProperty, ct = Object.getOwnPropertyDescriptor, dt = (n, e, t, i) => {
425
- for (var r = i > 1 ? void 0 : i ? ct(e, t) : e, o = n.length - 1, s; o >= 0; o--)
395
+ var et = Object.defineProperty, nt = Object.getOwnPropertyDescriptor, tt = (n, e, t, i) => {
396
+ for (var r = i > 1 ? void 0 : i ? nt(e, t) : e, o = n.length - 1, s; o >= 0; o--)
426
397
  (s = n[o]) && (r = (i ? s(e, t, r) : s(r)) || r);
427
- return i && r && st(e, t, r), r;
428
- }, Q = (n, e) => (t, i) => e(t, i, n);
398
+ return i && r && et(e, t, r), r;
399
+ }, J = (n, e) => (t, i) => e(t, i, n);
429
400
  let L = class extends N {
430
401
  constructor(e, t, i) {
431
402
  super();
@@ -450,16 +421,16 @@ let L = class extends N {
450
421
  const i = this._textSelectionManagerService.getTextRanges({ unitId: e, subUnitId: e });
451
422
  let r = i == null ? void 0 : i[i.length - 1];
452
423
  if (t) {
453
- const { segmentId: o, segmentPage: s, startIndex: c, endIndex: d } = t;
424
+ const { segmentId: o, segmentPage: s, startIndex: c, endIndex: l } = t;
454
425
  r = {
455
426
  collapsed: !1,
456
427
  startOffset: c,
457
- endOffset: d + 1,
428
+ endOffset: l + 1,
458
429
  segmentId: o,
459
430
  segmentPage: s
460
431
  }, this._textSelectionManagerService.replaceDocRanges([{
461
432
  startOffset: c,
462
- endOffset: d + 1
433
+ endOffset: l + 1
463
434
  }]);
464
435
  }
465
436
  return r ? (this._editPopup = this._docCanvasPopupManagerService.attachPopupToRange(
@@ -476,9 +447,9 @@ let L = class extends N {
476
447
  this._editingLink$.next(null), (e = this._editPopup) == null || e.dispose();
477
448
  }
478
449
  showInfoPopup(e) {
479
- var p, l, h, f, a, m;
450
+ var u, h, m, f, d, p;
480
451
  const { linkId: t, unitId: i, segmentId: r, segmentPage: o, startIndex: s, endIndex: c } = e;
481
- if (!(((p = this.showing) == null ? void 0 : p.linkId) === t && ((l = this.showing) == null ? void 0 : l.unitId) === i && ((h = this.showing) == null ? void 0 : h.segmentId) === r && ((f = this.showing) == null ? void 0 : f.segmentPage) === o && ((a = this.showing) == null ? void 0 : a.startIndex) === s && ((m = this.showing) == null ? void 0 : m.endIndex) === c || (this._infoPopup && this._infoPopup.dispose(), !this._univerInstanceService.getUnit(i, I.UNIVER_DOC))))
452
+ if (!(((u = this.showing) == null ? void 0 : u.linkId) === t && ((h = this.showing) == null ? void 0 : h.unitId) === i && ((m = this.showing) == null ? void 0 : m.segmentId) === r && ((f = this.showing) == null ? void 0 : f.segmentPage) === o && ((d = this.showing) == null ? void 0 : d.startIndex) === s && ((p = this.showing) == null ? void 0 : p.endIndex) === c || (this._infoPopup && this._infoPopup.dispose(), !this._univerInstanceService.getUnit(i, I.UNIVER_DOC))))
482
453
  return this._showingLink$.next({ unitId: i, linkId: t, segmentId: r, segmentPage: o, startIndex: s, endIndex: c }), this._infoPopup = this._docCanvasPopupManagerService.attachPopupToRange(
483
454
  {
484
455
  collapsed: !1,
@@ -503,16 +474,16 @@ let L = class extends N {
503
474
  this._showingLink$.next(null), (e = this._infoPopup) == null || e.dispose();
504
475
  }
505
476
  };
506
- L = dt([
507
- Q(0, v(ln)),
508
- Q(1, v(b)),
509
- Q(2, O)
477
+ L = tt([
478
+ J(0, _(cn)),
479
+ J(1, _(M)),
480
+ J(2, x)
510
481
  ], L);
511
- var at = Object.defineProperty, lt = Object.getOwnPropertyDescriptor, ut = (n, e, t, i) => {
512
- for (var r = i > 1 ? void 0 : i ? lt(e, t) : e, o = n.length - 1, s; o >= 0; o--)
482
+ var it = Object.defineProperty, rt = Object.getOwnPropertyDescriptor, ot = (n, e, t, i) => {
483
+ for (var r = i > 1 ? void 0 : i ? rt(e, t) : e, o = n.length - 1, s; o >= 0; o--)
513
484
  (s = n[o]) && (r = (i ? s(e, t, r) : s(r)) || r);
514
- return i && r && at(e, t, r), r;
515
- }, X = (n, e) => (t, i) => e(t, i, n);
485
+ return i && r && it(e, t, r), r;
486
+ }, Q = (n, e) => (t, i) => e(t, i, n);
516
487
  let Z = class extends N {
517
488
  constructor(n, e, t) {
518
489
  super(), this._commandService = n, this._univerInstanceService = e, this._docHyperLinkService = t, this._initSelectionChange();
@@ -521,18 +492,18 @@ let Z = class extends N {
521
492
  this.disposeWithMe(
522
493
  this._commandService.onCommandExecuted((n) => {
523
494
  var e, t, i;
524
- if (n.id === sn.id) {
525
- const r = n.params, { unitId: o, ranges: s, segmentId: c } = r, d = this._univerInstanceService.getUnit(o, I.UNIVER_DOC), p = s[0];
526
- if (p && d) {
527
- const { startOffset: l, endOffset: h, collapsed: f, segmentPage: a } = p, m = (t = (e = d.getSelfOrHeaderFooterModel(c)) == null ? void 0 : e.getBody()) == null ? void 0 : t.customRanges;
495
+ if (n.id === tn.id) {
496
+ const r = n.params, { unitId: o, ranges: s, segmentId: c } = r, l = this._univerInstanceService.getUnit(o, I.UNIVER_DOC), u = s[0];
497
+ if (u && l) {
498
+ const { startOffset: h, endOffset: m, collapsed: f, segmentPage: d } = u, p = (t = (e = l.getSelfOrHeaderFooterModel(c)) == null ? void 0 : e.getBody()) == null ? void 0 : t.customRanges;
528
499
  if (f) {
529
- const C = (i = m == null ? void 0 : m.findIndex((g) => g.startIndex < l && g.endIndex > h - 1)) != null ? i : -1;
500
+ const C = (i = p == null ? void 0 : p.findIndex((a) => a.startIndex < h && a.endIndex > m - 1)) != null ? i : -1;
530
501
  if (C > -1) {
531
- const g = m[C];
532
- this._docHyperLinkService.showInfoPopup({ unitId: o, linkId: g.rangeId, segmentId: c, segmentPage: a, startIndex: g.startIndex, endIndex: g.endIndex });
502
+ const a = p[C];
503
+ this._docHyperLinkService.showInfoPopup({ unitId: o, linkId: a.rangeId, segmentId: c, segmentPage: d, startIndex: a.startIndex, endIndex: a.endIndex });
533
504
  return;
534
505
  }
535
- } else if (m == null ? void 0 : m.find((g) => g.startIndex <= l && g.endIndex >= h - 1))
506
+ } else if (p == null ? void 0 : p.find((a) => a.startIndex <= h && a.endIndex >= m - 1))
536
507
  return;
537
508
  }
538
509
  this._docHyperLinkService.hideInfoPopup(), this._docHyperLinkService.hideEditPopup();
@@ -541,26 +512,26 @@ let Z = class extends N {
541
512
  );
542
513
  }
543
514
  };
544
- Z = ut([
545
- X(0, x),
546
- X(1, O),
547
- X(2, v(L))
515
+ Z = ot([
516
+ Q(0, O),
517
+ Q(1, x),
518
+ Q(2, _(L))
548
519
  ], Z);
549
- var pt = Object.defineProperty, ft = Object.getOwnPropertyDescriptor, gt = (n, e, t, i) => {
550
- for (var r = i > 1 ? void 0 : i ? ft(e, t) : e, o = n.length - 1, s; o >= 0; o--)
520
+ var st = Object.defineProperty, ct = Object.getOwnPropertyDescriptor, dt = (n, e, t, i) => {
521
+ for (var r = i > 1 ? void 0 : i ? ct(e, t) : e, o = n.length - 1, s; o >= 0; o--)
551
522
  (s = n[o]) && (r = (i ? s(e, t, r) : s(r)) || r);
552
- return i && r && pt(e, t, r), r;
523
+ return i && r && st(e, t, r), r;
553
524
  }, w = (n, e) => (t, i) => e(t, i, n);
554
- let re = class extends N {
525
+ let ie = class extends N {
555
526
  constructor(n, e, t, i, r, o) {
556
- super(), this._context = n, this._docEventManagerService = e, this._commandService = t, this._hyperLinkPopupService = i, this._docSkeletonManagerService = r, this._docSelectionManagerService = o, !(this._context.unitId === We || this._context.unitId === Ge) && (this._initHover(), this._initClick());
527
+ super(), this._context = n, this._docEventManagerService = e, this._commandService = t, this._hyperLinkPopupService = i, this._docSkeletonManagerService = r, this._docSelectionManagerService = o, !(this._context.unitId === Ve || this._context.unitId === Ye) && (this._initHover(), this._initClick());
557
528
  }
558
529
  get _skeleton() {
559
530
  return this._docSkeletonManagerService.getSkeleton();
560
531
  }
561
532
  _hideInfoPopup() {
562
533
  this._hyperLinkPopupService.showing && this._commandService.executeCommand(
563
- ie.id
534
+ te.id
564
535
  );
565
536
  }
566
537
  _initHover() {
@@ -573,7 +544,7 @@ let re = class extends N {
573
544
  return;
574
545
  }
575
546
  e ? this._commandService.executeCommand(
576
- ie.id,
547
+ te.id,
577
548
  {
578
549
  unitId: this._context.unitId,
579
550
  linkId: e.range.rangeId,
@@ -592,7 +563,7 @@ let re = class extends N {
592
563
  this._docEventManagerService.clickCustomRanges$.subscribe((n) => {
593
564
  const e = n.range;
594
565
  e && this._commandService.executeCommand(
595
- Te.id,
566
+ Ue.id,
596
567
  {
597
568
  unitId: this._context.unitId,
598
569
  linkId: e.rangeId,
@@ -603,24 +574,24 @@ let re = class extends N {
603
574
  );
604
575
  }
605
576
  };
606
- re = gt([
607
- w(1, v(un)),
608
- w(2, x),
609
- w(3, v(L)),
610
- w(4, v(cn)),
611
- w(5, v(b))
612
- ], re);
613
- var ht = Object.defineProperty, mt = Object.getOwnPropertyDescriptor, _t = (n, e, t, i) => {
614
- for (var r = i > 1 ? void 0 : i ? mt(e, t) : e, o = n.length - 1, s; o >= 0; o--)
577
+ ie = dt([
578
+ w(1, _(dn)),
579
+ w(2, O),
580
+ w(3, _(L)),
581
+ w(4, _(rn)),
582
+ w(5, _(M))
583
+ ], ie);
584
+ var at = Object.defineProperty, lt = Object.getOwnPropertyDescriptor, ut = (n, e, t, i) => {
585
+ for (var r = i > 1 ? void 0 : i ? lt(e, t) : e, o = n.length - 1, s; o >= 0; o--)
615
586
  (s = n[o]) && (r = (i ? s(e, t, r) : s(r)) || r);
616
- return i && r && ht(e, t, r), r;
617
- }, ee = (n, e) => (t, i) => e(t, i, n);
618
- let oe = class extends N {
587
+ return i && r && at(e, t, r), r;
588
+ }, X = (n, e) => (t, i) => e(t, i, n);
589
+ let re = class extends N {
619
590
  constructor(n, e, t, i) {
620
591
  super(), this._context = n, this._docInterceptorService = e, this._hyperLinkService = t, this._docRenderController = i, this._init(), this._initReRender();
621
592
  }
622
593
  _init() {
623
- this._docInterceptorService.intercept(an.CUSTOM_RANGE, {
594
+ this._docInterceptorService.intercept(sn.CUSTOM_RANGE, {
624
595
  handler: (n, e, t) => {
625
596
  if (!n)
626
597
  return t(n);
@@ -630,40 +601,40 @@ let oe = class extends N {
630
601
  ...n,
631
602
  active: !1
632
603
  });
633
- const { linkId: s, unitId: c, startIndex: d, endIndex: p } = o, l = c === i && n.rangeId === s && r >= d && r <= p;
604
+ const { linkId: s, unitId: c, startIndex: l, endIndex: u } = o, h = c === i && n.rangeId === s && r >= l && r <= u;
634
605
  return t({
635
606
  ...n,
636
- active: l
607
+ active: h
637
608
  });
638
609
  }
639
610
  });
640
611
  }
641
612
  _initReRender() {
642
613
  this.disposeWithMe(this._hyperLinkService.showingLink$.pipe(
643
- gn((n, e) => (n == null ? void 0 : n.linkId) === (e == null ? void 0 : e.linkId) && (n == null ? void 0 : n.unitId) === (e == null ? void 0 : e.unitId) && (n == null ? void 0 : n.startIndex) === (e == null ? void 0 : e.startIndex)),
644
- hn()
614
+ un((n, e) => (n == null ? void 0 : n.linkId) === (e == null ? void 0 : e.linkId) && (n == null ? void 0 : n.unitId) === (e == null ? void 0 : e.unitId) && (n == null ? void 0 : n.startIndex) === (e == null ? void 0 : e.startIndex)),
615
+ pn()
645
616
  ).subscribe(([n, e]) => {
646
617
  e ? e.unitId === this._context.unitId && this._docRenderController.reRender(e.unitId) : n && n.unitId === this._context.unitId && this._docRenderController.reRender(n.unitId);
647
618
  }));
648
619
  }
649
620
  };
650
- oe = _t([
651
- ee(1, v(dn)),
652
- ee(2, v(L)),
653
- ee(3, v(pn))
654
- ], oe);
655
- const He = "doc-hyper-link-icon";
656
- function Oe(n) {
621
+ re = ut([
622
+ X(1, _(on)),
623
+ X(2, _(L)),
624
+ X(3, _(an))
625
+ ], re);
626
+ const $e = "doc-hyper-link-icon";
627
+ function ke(n) {
657
628
  return {
658
629
  id: R.id,
659
- type: xn.BUTTON,
660
- icon: He,
630
+ type: In.BUTTON,
631
+ icon: $e,
661
632
  title: "docLink.menu.tooltip",
662
633
  tooltip: "docLink.menu.tooltip",
663
- hidden$: On(n, I.UNIVER_DOC),
664
- disabled$: new mn(function(e) {
665
- const i = n.get(b).textSelection$.pipe(_n(16)).subscribe(() => {
666
- e.next($e(n));
634
+ hidden$: Cn(n, I.UNIVER_DOC),
635
+ disabled$: new fn(function(e) {
636
+ const i = n.get(M).textSelection$.pipe(gn(16)).subscribe(() => {
637
+ e.next(Ne(n));
667
638
  });
668
639
  return () => {
669
640
  i.unsubscribe();
@@ -671,31 +642,31 @@ function Oe(n) {
671
642
  })
672
643
  };
673
644
  }
674
- const vt = {
645
+ const pt = {
675
646
  id: R.id,
676
- binding: kn.CTRL_COMMAND | te.K,
647
+ binding: _n.CTRL_COMMAND | ne.K,
677
648
  description: "docLink.menu.tooltip",
678
- preconditions: fn
679
- }, It = {
680
- [Pn.OTHERS]: {
649
+ preconditions: ln
650
+ }, ft = {
651
+ [Sn.OTHERS]: {
681
652
  [R.id]: {
682
653
  order: 0,
683
- menuItemFactory: Oe
654
+ menuItemFactory: ke
684
655
  }
685
656
  },
686
- [Rn.MAIN_AREA]: {
687
- [En.DATA]: {
657
+ [Ln.MAIN_AREA]: {
658
+ [kn.DATA]: {
688
659
  [R.id]: {
689
660
  order: 0,
690
- menuItemFactory: Oe
661
+ menuItemFactory: ke
691
662
  }
692
663
  }
693
664
  }
694
665
  };
695
- var Ct = Object.defineProperty, St = Object.getOwnPropertyDescriptor, Lt = (n, e, t, i) => {
696
- for (var r = i > 1 ? void 0 : i ? St(e, t) : e, o = n.length - 1, s; o >= 0; o--)
666
+ var gt = Object.defineProperty, ht = Object.getOwnPropertyDescriptor, mt = (n, e, t, i) => {
667
+ for (var r = i > 1 ? void 0 : i ? ht(e, t) : e, o = n.length - 1, s; o >= 0; o--)
697
668
  (s = n[o]) && (r = (i ? s(e, t, r) : s(r)) || r);
698
- return i && r && Ct(e, t, r), r;
669
+ return i && r && gt(e, t, r), r;
699
670
  }, F = (n, e) => (t, i) => e(t, i, n);
700
671
  let W = class extends N {
701
672
  constructor(n, e, t, i) {
@@ -705,53 +676,53 @@ let W = class extends N {
705
676
  [
706
677
  [V, V.componentKey],
707
678
  [Y, Y.componentKey],
708
- [se, He]
679
+ [oe, $e]
709
680
  ].forEach(([n, e]) => {
710
681
  this._componentManager.register(e, n);
711
682
  });
712
683
  }
713
684
  _initCommands() {
714
685
  [
715
- Ee,
716
- be,
717
- Ue,
686
+ xe,
687
+ Pe,
688
+ De,
718
689
  R,
719
- ie,
720
- Te
690
+ te,
691
+ Ue
721
692
  ].forEach((n) => {
722
693
  this._commandService.registerCommand(n);
723
694
  });
724
695
  }
725
696
  _initShortcut() {
726
- [vt].forEach((n) => {
697
+ [pt].forEach((n) => {
727
698
  this._shortcutService.registerShortcut(n);
728
699
  });
729
700
  }
730
701
  _initMenus() {
731
- this._menuManagerService.mergeMenu(It);
702
+ this._menuManagerService.mergeMenu(ft);
732
703
  }
733
704
  };
734
- W = Lt([
735
- F(0, v(bn)),
736
- F(1, x),
737
- F(2, Mn),
738
- F(3, wn)
705
+ W = mt([
706
+ F(0, _(yn)),
707
+ F(1, O),
708
+ F(2, On),
709
+ F(3, xn)
739
710
  ], W);
740
- const yt = "DOC_HYPER_LINK_UI_PLUGIN";
741
- var Ae = Object.defineProperty, kt = Object.getOwnPropertyDescriptor, xt = (n, e, t) => e in n ? Ae(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t, Ot = (n, e, t, i) => {
742
- for (var r = i > 1 ? void 0 : i ? kt(e, t) : e, o = n.length - 1, s; o >= 0; o--)
711
+ const vt = "DOC_HYPER_LINK_UI_PLUGIN";
712
+ var Te = Object.defineProperty, _t = Object.getOwnPropertyDescriptor, It = (n, e, t) => e in n ? Te(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t, Ct = (n, e, t, i) => {
713
+ for (var r = i > 1 ? void 0 : i ? _t(e, t) : e, o = n.length - 1, s; o >= 0; o--)
743
714
  (s = n[o]) && (r = (i ? s(e, t, r) : s(r)) || r);
744
- return i && r && Ae(e, t, r), r;
745
- }, ne = (n, e) => (t, i) => e(t, i, n), Be = (n, e, t) => xt(n, typeof e != "symbol" ? e + "" : e, t);
746
- let G = class extends ze {
747
- constructor(n = Le, e, t, i) {
715
+ return i && r && Te(e, t, r), r;
716
+ }, ee = (n, e) => (t, i) => e(t, i, n), He = (n, e, t) => It(n, typeof e != "symbol" ? e + "" : e, t);
717
+ let G = class extends Ge {
718
+ constructor(n = Se, e, t, i) {
748
719
  super(), this._config = n, this._injector = e, this._renderManagerSrv = t, this._configService = i;
749
- const { menu: r, ...o } = Qe(
720
+ const { menu: r, ...o } = ze(
750
721
  {},
751
- Le,
722
+ Se,
752
723
  this._config
753
724
  );
754
- r && this._configService.setConfig("menu", r, { merge: !0 }), this._configService.setConfig(Dn, o);
725
+ r && this._configService.setConfig("menu", r, { merge: !0 }), this._configService.setConfig(Rn, o);
755
726
  }
756
727
  onStarting() {
757
728
  [
@@ -770,20 +741,20 @@ let G = class extends ze {
770
741
  }
771
742
  _initRenderModule() {
772
743
  [
773
- [oe],
774
- [re]
744
+ [re],
745
+ [ie]
775
746
  ].forEach((n) => {
776
747
  this._renderManagerSrv.registerRenderModule(I.UNIVER_DOC, n);
777
748
  });
778
749
  }
779
750
  };
780
- Be(G, "pluginName", yt);
781
- Be(G, "type", I.UNIVER_DOC);
782
- G = Ot([
783
- qe(en),
784
- ne(1, v(Je)),
785
- ne(2, nn),
786
- ne(3, Xe)
751
+ He(G, "pluginName", vt);
752
+ He(G, "type", I.UNIVER_DOC);
753
+ G = Ct([
754
+ Ze(Je),
755
+ ee(1, _(We)),
756
+ ee(2, Qe),
757
+ ee(3, qe)
787
758
  ], G);
788
759
  export {
789
760
  G as UniverDocsHyperLinkUIPlugin