@univerjs/docs-ui 0.1.2 → 0.1.3

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,16 +1,16 @@
1
- var Et = Object.defineProperty;
2
- var Dt = (i, e, t) => e in i ? Et(i, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : i[e] = t;
3
- var S = (i, e, t) => (Dt(i, typeof e != "symbol" ? e + "" : e, t), t);
4
- import { FOCUSING_DOC as ye, FOCUSING_UNIVER_EDITOR as ze, FOCUSING_UNIVER_EDITOR_SINGLE_MODE as xt, Direction as j, EDITOR_ACTIVATED as _t, LocaleService as Ve, RxDisposable as ce, ICommandService as O, BooleanNumber as m, UniverInstanceType as I, BaselineOffset as K, ThemeService as Pt, IUniverInstanceService as M, OnLifecycle as P, LifecycleStages as U, Disposable as H, Tools as pt, LRUMap as Ut, ColorKit as qe, ILogService as gt, toDisposable as N, CommandType as ke, IContextService as Lt, IConfigService as Nt, DEFAULT_DOCUMENT_SUB_COMPONENT_ID as $t, IFloatingObjectManagerService as At, Plugin as wt, PluginType as Bt } from "@univerjs/core";
5
- import { Inject as v, Injector as Ee, Optional as Ft, createIdentifier as jt } from "@wendellhu/redi";
6
- import { KeyCode as T, MetaKeys as ae, ILayoutService as ft, MenuGroup as y, MenuItemType as E, MenuPosition as D, getMenuHiddenObservable as x, FONT_FAMILY_LIST as Ke, FONT_SIZE_LIST as Wt, ComponentManager as zt, FontFamily as Vt, FontFamilyItem as kt, FontSize as Ht, IEditorService as $, IMenuService as Yt, IUIController as Xt, IClipboardInterfaceService as He, PLAIN_TEXT_CLIPBOARD_MIME_TYPE as Gt, HTML_CLIPBOARD_MIME_TYPE as Zt, CopyCommand as qt, CutCommand as Kt, PasteCommand as Jt, SetEditorResizeOperation as Qt, IShortcutService as en } from "@univerjs/ui";
7
- import { MoveCursorOperation as De, MoveSelectionOperation as xe, SelectAllOperation as tn, SetInlineFormatBoldCommand as nn, SetTextSelectionsOperation as W, SetInlineFormatCommand as J, SetInlineFormatItalicCommand as rn, SetInlineFormatUnderlineCommand as on, SetInlineFormatStrikethroughCommand as sn, SetInlineFormatSubscriptCommand as cn, SetInlineFormatSuperscriptCommand as an, SetInlineFormatFontFamilyCommand as Je, SetInlineFormatFontSizeCommand as Qe, SetInlineFormatTextColorCommand as et, OrderListCommand as ln, BulletListCommand as dn, TextSelectionManagerService as le, BreakLineCommand as un, DeleteLeftCommand as hn, DeleteRightCommand as _n, CutContentCommand as St, InnerPasteCommand as mt, DocSkeletonManagerService as Q, VIEWPORT_KEY as Pe, CoverContentCommand as pn, RichTextEditingMutation as Ye, DOCS_COMPONENT_MAIN_LAYER_INDEX as tt, DOCS_COMPONENT_HEADER_LAYER_INDEX as gn, DOCS_VIEW_KEY as nt, DOCS_COMPONENT_DEFAULT_Z_INDEX as fn, SetDocZoomRatioOperation as Xe, SetDocZoomRatioCommand as Sn, getDocObject as vt, getDocObjectById as mn } from "@univerjs/docs";
8
- import { ITextSelectionRenderManager as de, ptToPixel as rt, ScrollBar as Fe, PageLayoutType as it, IRenderManagerService as Y, Viewport as vn, EVENT_TYPE as Cn, Layer as ot, Documents as On, Liquid as Rn, Rect as bn, CURSOR_TYPE as st, NodePositionConvertToCursor as In, getAnchorBounding as Tn } from "@univerjs/engine-render";
9
- import { connectInjector as Mn } from "@wendellhu/redi/react-bindings";
10
- import { ColorPicker as yn } from "@univerjs/design";
11
- import En from "react";
12
- import { Observable as A, takeUntil as oe, BehaviorSubject as Dn } from "rxjs";
13
- const xn = {
1
+ var Ut = Object.defineProperty;
2
+ var Lt = (r, e, t) => e in r ? Ut(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t;
3
+ var S = (r, e, t) => (Lt(r, typeof e != "symbol" ? e + "" : e, t), t);
4
+ import { FOCUSING_DOC as ye, FOCUSING_UNIVER_EDITOR as Ve, FOCUSING_UNIVER_EDITOR_SINGLE_MODE as Nt, Direction as j, EDITOR_ACTIVATED as St, LocaleService as ke, RxDisposable as ce, ICommandService as O, BooleanNumber as m, UniverInstanceType as T, BaselineOffset as J, ThemeService as $t, IUniverInstanceService as M, OnLifecycle as P, LifecycleStages as U, Disposable as Y, Tools as He, LRUMap as At, ColorKit as Je, ILogService as mt, toDisposable as N, CommandType as Ye, IContextService as wt, checkForSubstrings as Ft, IConfigService as Bt, DEFAULT_DOCUMENT_SUB_COMPONENT_ID as jt, IFloatingObjectManagerService as Wt, Plugin as zt, PluginType as Vt } from "@univerjs/core";
5
+ import { Inject as v, Injector as Ee, Optional as kt, createIdentifier as Ht } from "@wendellhu/redi";
6
+ import { KeyCode as I, MetaKeys as ae, ILayoutService as vt, MenuGroup as y, MenuItemType as E, MenuPosition as D, getMenuHiddenObservable as x, FONT_FAMILY_LIST as Qe, FONT_SIZE_LIST as Yt, ComponentManager as Xt, FontFamily as Gt, FontFamilyItem as Zt, FontSize as qt, IEditorService as $, IMenuService as Kt, IUIController as Jt, IClipboardInterfaceService as Xe, PLAIN_TEXT_CLIPBOARD_MIME_TYPE as Qt, HTML_CLIPBOARD_MIME_TYPE as en, CopyCommand as tn, CutCommand as nn, PasteCommand as rn, SetEditorResizeOperation as on, IShortcutService as sn } from "@univerjs/ui";
7
+ import { MoveCursorOperation as De, MoveSelectionOperation as xe, SelectAllOperation as cn, SetInlineFormatBoldCommand as an, SetTextSelectionsOperation as W, SetInlineFormatCommand as ee, SetInlineFormatItalicCommand as ln, SetInlineFormatUnderlineCommand as dn, SetInlineFormatStrikethroughCommand as un, SetInlineFormatSubscriptCommand as hn, SetInlineFormatSuperscriptCommand as _n, SetInlineFormatFontFamilyCommand as et, SetInlineFormatFontSizeCommand as tt, SetInlineFormatTextColorCommand as nt, OrderListCommand as gn, BulletListCommand as pn, TextSelectionManagerService as le, BreakLineCommand as fn, DeleteLeftCommand as Sn, DeleteRightCommand as mn, CutContentCommand as Ct, InnerPasteCommand as Ot, DocSkeletonManagerService as te, VIEWPORT_KEY as Pe, CoverContentCommand as vn, RichTextEditingMutation as Ge, DOCS_COMPONENT_MAIN_LAYER_INDEX as rt, DOCS_COMPONENT_HEADER_LAYER_INDEX as Cn, DOCS_VIEW_KEY as it, DOCS_COMPONENT_DEFAULT_Z_INDEX as On, SetDocZoomRatioOperation as Ze, SetDocZoomRatioCommand as Rn, getDocObject as Rt, getDocObjectById as bn } from "@univerjs/docs";
8
+ import { ITextSelectionRenderManager as de, pixelToPt as Tn, ptToPixel as ot, ScrollBar as je, IRenderManagerService as z, PageLayoutType as st, Viewport as In, EVENT_TYPE as Mn, Layer as ct, Documents as yn, Liquid as En, Rect as Dn, CURSOR_TYPE as at, NodePositionConvertToCursor as xn, getAnchorBounding as Pn } from "@univerjs/engine-render";
9
+ import { connectInjector as Un } from "@wendellhu/redi/react-bindings";
10
+ import { ColorPicker as Ln } from "@univerjs/design";
11
+ import Nn from "react";
12
+ import { Observable as A, takeUntil as se, fromEvent as lt, BehaviorSubject as $n } from "rxjs";
13
+ const An = {
14
14
  undo: !0,
15
15
  redo: !0,
16
16
  // Undo redo
@@ -38,7 +38,7 @@ const xn = {
38
38
  // 'Wrap mode'
39
39
  textRotateMode: !0
40
40
  // 'Text Rotation Mode'
41
- }, Pn = {
41
+ }, wn = {
42
42
  outerLeft: !1,
43
43
  outerRight: !1,
44
44
  header: !0,
@@ -51,90 +51,90 @@ const xn = {
51
51
  frozenContent: !1,
52
52
  infoBar: !0,
53
53
  toolbar: !0
54
- }, Un = {
54
+ }, Fn = {
55
55
  layout: {
56
- docContainerConfig: Pn,
57
- toolbarConfig: xn
56
+ docContainerConfig: wn,
57
+ toolbarConfig: An
58
58
  }
59
- }, Ln = "DocUI";
60
- function L(i) {
61
- return i.getContextValue(ye) && i.getContextValue(ze);
59
+ }, Bn = "DocUI";
60
+ function L(r) {
61
+ return r.getContextValue(ye) && r.getContextValue(Ve);
62
62
  }
63
- function Nn(i) {
64
- return i.getContextValue(ye) && i.getContextValue(ze) && !i.getContextValue(xt);
63
+ function jn(r) {
64
+ return r.getContextValue(ye) && r.getContextValue(Ve) && !r.getContextValue(Nt);
65
65
  }
66
- const $n = {
66
+ const Wn = {
67
67
  id: De.id,
68
- binding: T.ARROW_UP,
68
+ binding: I.ARROW_UP,
69
69
  preconditions: L,
70
70
  staticParameters: {
71
71
  direction: j.UP
72
72
  }
73
- }, An = {
73
+ }, zn = {
74
74
  id: De.id,
75
- binding: T.ARROW_DOWN,
75
+ binding: I.ARROW_DOWN,
76
76
  preconditions: L,
77
77
  staticParameters: {
78
78
  direction: j.DOWN
79
79
  }
80
- }, wn = {
80
+ }, Vn = {
81
81
  id: De.id,
82
- binding: T.ARROW_LEFT,
82
+ binding: I.ARROW_LEFT,
83
83
  preconditions: L,
84
84
  staticParameters: {
85
85
  direction: j.LEFT
86
86
  }
87
- }, Bn = {
87
+ }, kn = {
88
88
  id: De.id,
89
- binding: T.ARROW_RIGHT,
89
+ binding: I.ARROW_RIGHT,
90
90
  preconditions: L,
91
91
  staticParameters: {
92
92
  direction: j.RIGHT
93
93
  }
94
- }, Fn = {
94
+ }, Hn = {
95
95
  id: xe.id,
96
- binding: T.ARROW_UP | ae.SHIFT,
96
+ binding: I.ARROW_UP | ae.SHIFT,
97
97
  preconditions: L,
98
98
  staticParameters: {
99
99
  direction: j.UP
100
100
  }
101
- }, jn = {
101
+ }, Yn = {
102
102
  id: xe.id,
103
- binding: T.ARROW_DOWN | ae.SHIFT,
103
+ binding: I.ARROW_DOWN | ae.SHIFT,
104
104
  preconditions: L,
105
105
  staticParameters: {
106
106
  direction: j.DOWN
107
107
  }
108
- }, Wn = {
108
+ }, Xn = {
109
109
  id: xe.id,
110
- binding: T.ARROW_LEFT | ae.SHIFT,
110
+ binding: I.ARROW_LEFT | ae.SHIFT,
111
111
  preconditions: L,
112
112
  staticParameters: {
113
113
  direction: j.LEFT
114
114
  }
115
- }, zn = {
115
+ }, Gn = {
116
116
  id: xe.id,
117
- binding: T.ARROW_RIGHT | ae.SHIFT,
117
+ binding: I.ARROW_RIGHT | ae.SHIFT,
118
118
  preconditions: L,
119
119
  staticParameters: {
120
120
  direction: j.RIGHT
121
121
  }
122
- }, Vn = {
123
- id: tn.id,
124
- binding: T.A | ae.CTRL_COMMAND,
125
- preconditions: (i) => i.getContextValue(ze) && (i.getContextValue(ye) || i.getContextValue(_t))
122
+ }, Zn = {
123
+ id: cn.id,
124
+ binding: I.A | ae.CTRL_COMMAND,
125
+ preconditions: (r) => r.getContextValue(Ve) && (r.getContextValue(ye) || r.getContextValue(St))
126
126
  };
127
- var kn = Object.defineProperty, Hn = Object.getOwnPropertyDescriptor, Yn = (i, e, t, n) => {
128
- for (var r = n > 1 ? void 0 : n ? Hn(e, t) : e, s = i.length - 1, o; s >= 0; s--)
129
- (o = i[s]) && (r = (n ? o(e, t, r) : o(r)) || r);
130
- return n && r && kn(e, t, r), r;
131
- }, ct = (i, e) => (t, n) => e(t, n, i);
132
- let je = class {
133
- constructor(i, e, t) {
127
+ var qn = Object.defineProperty, Kn = Object.getOwnPropertyDescriptor, Jn = (r, e, t, n) => {
128
+ for (var i = n > 1 ? void 0 : n ? Kn(e, t) : e, s = r.length - 1, o; s >= 0; s--)
129
+ (o = r[s]) && (i = (n ? o(e, t, i) : o(i)) || i);
130
+ return n && i && qn(e, t, i), i;
131
+ }, dt = (r, e) => (t, n) => e(t, n, r);
132
+ let We = class {
133
+ constructor(r, e, t) {
134
134
  S(this, "_docContainer");
135
135
  // 获取SheetContainer组件
136
- S(this, "getComponent", (i) => {
137
- if (this._docContainer = i, !i.getContentRef().current)
136
+ S(this, "getComponent", (r) => {
137
+ if (this._docContainer = r, !r.getContentRef().current)
138
138
  throw new Error("container is not ready");
139
139
  });
140
140
  /**
@@ -144,10 +144,10 @@ let je = class {
144
144
  * e: {target: HTMLSelectElement } reference from https://stackoverflow.com/a/48443771
145
145
  *
146
146
  */
147
- S(this, "changeLocale", (i) => {
148
- this._localeService.setLocale(i);
147
+ S(this, "changeLocale", (r) => {
148
+ this._localeService.setLocale(r);
149
149
  });
150
- this._config = i, this._localeService = e, this._injector = t;
150
+ this._config = r, this._localeService = e, this._injector = t;
151
151
  }
152
152
  getUIConfig() {
153
153
  return {
@@ -160,25 +160,25 @@ let je = class {
160
160
  getContentRef() {
161
161
  return this._docContainer.getContentRef();
162
162
  }
163
- UIDidMount(i) {
163
+ UIDidMount(r) {
164
164
  if (this._docContainer)
165
- return i(this._docContainer);
165
+ return r(this._docContainer);
166
166
  }
167
167
  getDocContainer() {
168
168
  return this._docContainer;
169
169
  }
170
170
  };
171
- je = Yn([
172
- ct(1, v(Ve)),
173
- ct(2, v(Ee))
174
- ], je);
175
- var Xn = Object.defineProperty, Gn = Object.getOwnPropertyDescriptor, Zn = (i, e, t, n) => {
176
- for (var r = n > 1 ? void 0 : n ? Gn(e, t) : e, s = i.length - 1, o; s >= 0; s--)
177
- (o = i[s]) && (r = (n ? o(e, t, r) : o(r)) || r);
178
- return n && r && Xn(e, t, r), r;
179
- }, pe = (i, e) => (t, n) => e(t, n, i);
180
- let ie = class extends ce {
181
- constructor(e, t, n, r, s) {
171
+ We = Jn([
172
+ dt(1, v(ke)),
173
+ dt(2, v(Ee))
174
+ ], We);
175
+ var Qn = Object.defineProperty, er = Object.getOwnPropertyDescriptor, tr = (r, e, t, n) => {
176
+ for (var i = n > 1 ? void 0 : n ? er(e, t) : e, s = r.length - 1, o; s >= 0; s--)
177
+ (o = r[s]) && (i = (n ? o(e, t, i) : o(i)) || i);
178
+ return n && i && Qn(e, t, i), i;
179
+ }, ge = (r, e) => (t, n) => e(t, n, r);
180
+ let oe = class extends ce {
181
+ constructor(e, t, n, i, s) {
182
182
  super();
183
183
  S(this, "_docContainerController");
184
184
  /**
@@ -191,7 +191,7 @@ let ie = class extends ce {
191
191
  S(this, "changeLocale", (e) => {
192
192
  this._localeService.setLocale(e);
193
193
  });
194
- this._localeService = t, this._injector = n, this._textSelectionRenderManager = r, this._layoutService = s, this._docContainerController = this._injector.createInstance(je, e), this._registerContainer();
194
+ this._localeService = t, this._injector = n, this._textSelectionRenderManager = i, this._layoutService = s, this._docContainerController = this._injector.createInstance(We, e), this._registerContainer();
195
195
  }
196
196
  _registerContainer() {
197
197
  this._layoutService && this.disposeWithMe(
@@ -203,14 +203,14 @@ let ie = class extends ce {
203
203
  return this._docContainerController;
204
204
  }
205
205
  };
206
- ie = Zn([
207
- pe(1, v(Ve)),
208
- pe(2, v(Ee)),
209
- pe(3, de),
210
- pe(4, Ft(ft))
211
- ], ie);
212
- const Ue = "UI_PLUGIN_DOCS", Ct = `${Ue}_COLOR_PICKER_COMPONENT`, Ot = `${Ue}_FONT_FAMILY_COMPONENT`, Rt = `${Ue}_FONT_FAMILY_ITEM_COMPONENT`, bt = `${Ue}_FONT_SIZE_COMPONENT`;
213
- var It = { exports: {} }, Le = {};
206
+ oe = tr([
207
+ ge(1, v(ke)),
208
+ ge(2, v(Ee)),
209
+ ge(3, de),
210
+ ge(4, kt(vt))
211
+ ], oe);
212
+ const Ue = "UI_PLUGIN_DOCS", bt = `${Ue}_COLOR_PICKER_COMPONENT`, Tt = `${Ue}_FONT_FAMILY_COMPONENT`, It = `${Ue}_FONT_FAMILY_ITEM_COMPONENT`, Mt = `${Ue}_FONT_SIZE_COMPONENT`;
213
+ var yt = { exports: {} }, Le = {};
214
214
  /**
215
215
  * @license React
216
216
  * react-jsx-runtime.production.min.js
@@ -220,29 +220,29 @@ var It = { exports: {} }, Le = {};
220
220
  * This source code is licensed under the MIT license found in the
221
221
  * LICENSE file in the root directory of this source tree.
222
222
  */
223
- var qn = En, Kn = Symbol.for("react.element"), Jn = Symbol.for("react.fragment"), Qn = Object.prototype.hasOwnProperty, er = qn.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, tr = { key: !0, ref: !0, __self: !0, __source: !0 };
224
- function Tt(i, e, t) {
225
- var n, r = {}, s = null, o = null;
223
+ var nr = Nn, rr = Symbol.for("react.element"), ir = Symbol.for("react.fragment"), or = Object.prototype.hasOwnProperty, sr = nr.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, cr = { key: !0, ref: !0, __self: !0, __source: !0 };
224
+ function Et(r, e, t) {
225
+ var n, i = {}, s = null, o = null;
226
226
  t !== void 0 && (s = "" + t), e.key !== void 0 && (s = "" + e.key), e.ref !== void 0 && (o = e.ref);
227
227
  for (n in e)
228
- Qn.call(e, n) && !tr.hasOwnProperty(n) && (r[n] = e[n]);
229
- if (i && i.defaultProps)
230
- for (n in e = i.defaultProps, e)
231
- r[n] === void 0 && (r[n] = e[n]);
232
- return { $$typeof: Kn, type: i, key: s, ref: o, props: r, _owner: er.current };
228
+ or.call(e, n) && !cr.hasOwnProperty(n) && (i[n] = e[n]);
229
+ if (r && r.defaultProps)
230
+ for (n in e = r.defaultProps, e)
231
+ i[n] === void 0 && (i[n] = e[n]);
232
+ return { $$typeof: rr, type: r, key: s, ref: o, props: i, _owner: sr.current };
233
233
  }
234
- Le.Fragment = Jn;
235
- Le.jsx = Tt;
236
- Le.jsxs = Tt;
237
- It.exports = Le;
238
- var nr = It.exports;
239
- const rr = "univer-docs-ui-canvas-background", ir = {
240
- docsUiCanvasBackground: rr
241
- }, or = () => /* @__PURE__ */ nr.jsx("div", { className: ir.docsUiCanvasBackground });
242
- function sr(i) {
243
- const e = i.get(O);
234
+ Le.Fragment = ir;
235
+ Le.jsx = Et;
236
+ Le.jsxs = Et;
237
+ yt.exports = Le;
238
+ var ar = yt.exports;
239
+ const lr = "univer-docs-ui-canvas-background", dr = {
240
+ docsUiCanvasBackground: lr
241
+ }, ur = () => /* @__PURE__ */ ar.jsx("div", { className: dr.docsUiCanvasBackground });
242
+ function hr(r) {
243
+ const e = r.get(O);
244
244
  return {
245
- id: nn.id,
245
+ id: an.id,
246
246
  group: y.TOOLBAR_FORMAT,
247
247
  type: E.BUTTON,
248
248
  icon: "BoldSingle",
@@ -250,26 +250,26 @@ function sr(i) {
250
250
  tooltip: "toolbar.bold",
251
251
  positions: [D.TOOLBAR_START],
252
252
  activated$: new A((t) => {
253
- const n = e.onCommandExecuted((r) => {
253
+ const n = e.onCommandExecuted((i) => {
254
254
  var o;
255
- const s = r.id;
256
- if (s === W.id || s === J.id) {
257
- const c = z(i);
255
+ const s = i.id;
256
+ if (s === W.id || s === ee.id) {
257
+ const c = V(r);
258
258
  if (c == null)
259
259
  return;
260
- const l = (o = c.ts) == null ? void 0 : o.bl;
261
- t.next(l === m.TRUE);
260
+ const a = (o = c.ts) == null ? void 0 : o.bl;
261
+ t.next(a === m.TRUE);
262
262
  }
263
263
  });
264
264
  return t.next(!1), n.dispose;
265
265
  }),
266
- hidden$: x(i, I.DOC)
266
+ hidden$: x(r, T.DOC)
267
267
  };
268
268
  }
269
- function cr(i) {
270
- const e = i.get(O);
269
+ function _r(r) {
270
+ const e = r.get(O);
271
271
  return {
272
- id: rn.id,
272
+ id: ln.id,
273
273
  group: y.TOOLBAR_FORMAT,
274
274
  type: E.BUTTON,
275
275
  icon: "ItalicSingle",
@@ -277,26 +277,26 @@ function cr(i) {
277
277
  tooltip: "toolbar.italic",
278
278
  positions: [D.TOOLBAR_START],
279
279
  activated$: new A((t) => {
280
- const n = e.onCommandExecuted((r) => {
280
+ const n = e.onCommandExecuted((i) => {
281
281
  var o;
282
- const s = r.id;
283
- if (s === W.id || s === J.id) {
284
- const c = z(i);
282
+ const s = i.id;
283
+ if (s === W.id || s === ee.id) {
284
+ const c = V(r);
285
285
  if (c == null)
286
286
  return;
287
- const l = (o = c.ts) == null ? void 0 : o.it;
288
- t.next(l === m.TRUE);
287
+ const a = (o = c.ts) == null ? void 0 : o.it;
288
+ t.next(a === m.TRUE);
289
289
  }
290
290
  });
291
291
  return t.next(!1), n.dispose;
292
292
  }),
293
- hidden$: x(i, I.DOC)
293
+ hidden$: x(r, T.DOC)
294
294
  };
295
295
  }
296
- function ar(i) {
297
- const e = i.get(O);
296
+ function gr(r) {
297
+ const e = r.get(O);
298
298
  return {
299
- id: on.id,
299
+ id: dn.id,
300
300
  group: y.TOOLBAR_FORMAT,
301
301
  type: E.BUTTON,
302
302
  icon: "UnderlineSingle",
@@ -304,26 +304,26 @@ function ar(i) {
304
304
  tooltip: "toolbar.underline",
305
305
  positions: [D.TOOLBAR_START],
306
306
  activated$: new A((t) => {
307
- const n = e.onCommandExecuted((r) => {
307
+ const n = e.onCommandExecuted((i) => {
308
308
  var o;
309
- const s = r.id;
310
- if (s === W.id || s === J.id) {
311
- const c = z(i);
309
+ const s = i.id;
310
+ if (s === W.id || s === ee.id) {
311
+ const c = V(r);
312
312
  if (c == null)
313
313
  return;
314
- const l = (o = c.ts) == null ? void 0 : o.ul;
315
- t.next((l == null ? void 0 : l.s) === m.TRUE);
314
+ const a = (o = c.ts) == null ? void 0 : o.ul;
315
+ t.next((a == null ? void 0 : a.s) === m.TRUE);
316
316
  }
317
317
  });
318
318
  return t.next(!1), n.dispose;
319
319
  }),
320
- hidden$: x(i, I.DOC)
320
+ hidden$: x(r, T.DOC)
321
321
  };
322
322
  }
323
- function lr(i) {
324
- const e = i.get(O);
323
+ function pr(r) {
324
+ const e = r.get(O);
325
325
  return {
326
- id: sn.id,
326
+ id: un.id,
327
327
  group: y.TOOLBAR_FORMAT,
328
328
  type: E.BUTTON,
329
329
  icon: "StrikethroughSingle",
@@ -331,117 +331,117 @@ function lr(i) {
331
331
  tooltip: "toolbar.strikethrough",
332
332
  positions: [D.TOOLBAR_START],
333
333
  activated$: new A((t) => {
334
- const n = e.onCommandExecuted((r) => {
334
+ const n = e.onCommandExecuted((i) => {
335
335
  var o;
336
- const s = r.id;
337
- if (s === W.id || s === J.id) {
338
- const c = z(i);
336
+ const s = i.id;
337
+ if (s === W.id || s === ee.id) {
338
+ const c = V(r);
339
339
  if (c == null)
340
340
  return;
341
- const l = (o = c.ts) == null ? void 0 : o.st;
342
- t.next((l == null ? void 0 : l.s) === m.TRUE);
341
+ const a = (o = c.ts) == null ? void 0 : o.st;
342
+ t.next((a == null ? void 0 : a.s) === m.TRUE);
343
343
  }
344
344
  });
345
345
  return t.next(!1), n.dispose;
346
346
  }),
347
- hidden$: x(i, I.DOC)
347
+ hidden$: x(r, T.DOC)
348
348
  };
349
349
  }
350
- function dr(i) {
351
- const e = i.get(O);
350
+ function fr(r) {
351
+ const e = r.get(O);
352
352
  return {
353
- id: cn.id,
353
+ id: hn.id,
354
354
  group: y.TOOLBAR_FORMAT,
355
355
  type: E.BUTTON,
356
356
  icon: "SubscriptSingle",
357
357
  tooltip: "toolbar.subscript",
358
358
  positions: [D.TOOLBAR_START],
359
359
  activated$: new A((t) => {
360
- const n = e.onCommandExecuted((r) => {
360
+ const n = e.onCommandExecuted((i) => {
361
361
  var o;
362
- const s = r.id;
363
- if (s === W.id || s === J.id) {
364
- const c = z(i);
362
+ const s = i.id;
363
+ if (s === W.id || s === ee.id) {
364
+ const c = V(r);
365
365
  if (c == null)
366
366
  return;
367
- const l = (o = c.ts) == null ? void 0 : o.va;
368
- t.next(l === K.SUBSCRIPT);
367
+ const a = (o = c.ts) == null ? void 0 : o.va;
368
+ t.next(a === J.SUBSCRIPT);
369
369
  }
370
370
  });
371
371
  return t.next(!1), n.dispose;
372
372
  }),
373
- hidden$: x(i, I.DOC)
373
+ hidden$: x(r, T.DOC)
374
374
  };
375
375
  }
376
- function ur(i) {
377
- const e = i.get(O);
376
+ function Sr(r) {
377
+ const e = r.get(O);
378
378
  return {
379
- id: an.id,
379
+ id: _n.id,
380
380
  group: y.TOOLBAR_FORMAT,
381
381
  type: E.BUTTON,
382
382
  icon: "SuperscriptSingle",
383
383
  tooltip: "toolbar.superscript",
384
384
  positions: [D.TOOLBAR_START],
385
385
  activated$: new A((t) => {
386
- const n = e.onCommandExecuted((r) => {
386
+ const n = e.onCommandExecuted((i) => {
387
387
  var o;
388
- const s = r.id;
389
- if (s === W.id || s === J.id) {
390
- const c = z(i);
388
+ const s = i.id;
389
+ if (s === W.id || s === ee.id) {
390
+ const c = V(r);
391
391
  if (c == null)
392
392
  return;
393
- const l = (o = c.ts) == null ? void 0 : o.va;
394
- t.next(l === K.SUPERSCRIPT);
393
+ const a = (o = c.ts) == null ? void 0 : o.va;
394
+ t.next(a === J.SUPERSCRIPT);
395
395
  }
396
396
  });
397
397
  return t.next(!1), n.dispose;
398
398
  }),
399
- hidden$: x(i, I.DOC)
399
+ hidden$: x(r, T.DOC)
400
400
  };
401
401
  }
402
- function hr(i) {
403
- const e = i.get(O);
402
+ function mr(r) {
403
+ const e = r.get(O);
404
404
  return {
405
- id: Je.id,
405
+ id: et.id,
406
406
  tooltip: "toolbar.font",
407
407
  group: y.TOOLBAR_FORMAT,
408
408
  type: E.SELECTOR,
409
- label: Ot,
409
+ label: Tt,
410
410
  positions: [D.TOOLBAR_START],
411
- selections: Ke.map((t) => ({
411
+ selections: Qe.map((t) => ({
412
412
  label: {
413
- name: Rt,
413
+ name: It,
414
414
  hoverable: !0
415
415
  },
416
416
  value: t.value
417
417
  })),
418
418
  // disabled$: getCurrentSheetDisabled$(accessor),
419
419
  value$: new A((t) => {
420
- const n = Ke[0].value, r = e.onCommandExecuted((s) => {
420
+ const n = Qe[0].value, i = e.onCommandExecuted((s) => {
421
421
  var c;
422
422
  const o = s.id;
423
- if (o === W.id || o === Je.id) {
424
- const l = z(i);
425
- if (l == null)
423
+ if (o === W.id || o === et.id) {
424
+ const a = V(r);
425
+ if (a == null)
426
426
  return;
427
- const d = (c = l.ts) == null ? void 0 : c.ff;
427
+ const d = (c = a.ts) == null ? void 0 : c.ff;
428
428
  t.next(d != null ? d : n);
429
429
  }
430
430
  });
431
- return t.next(n), r.dispose;
431
+ return t.next(n), i.dispose;
432
432
  }),
433
- hidden$: x(i, I.DOC)
433
+ hidden$: x(r, T.DOC)
434
434
  };
435
435
  }
436
- function _r(i) {
437
- const e = i.get(O);
436
+ function vr(r) {
437
+ const e = r.get(O);
438
438
  return {
439
- id: Qe.id,
439
+ id: tt.id,
440
440
  group: y.TOOLBAR_FORMAT,
441
441
  type: E.SELECTOR,
442
442
  tooltip: "toolbar.fontSize",
443
443
  label: {
444
- name: bt,
444
+ name: Mt,
445
445
  props: {
446
446
  min: 1,
447
447
  max: 400
@@ -449,29 +449,29 @@ function _r(i) {
449
449
  }
450
450
  },
451
451
  positions: [D.TOOLBAR_START],
452
- selections: Wt,
452
+ selections: Yt,
453
453
  // disabled$,
454
454
  value$: new A((t) => {
455
- const r = e.onCommandExecuted((s) => {
455
+ const i = e.onCommandExecuted((s) => {
456
456
  var c;
457
457
  const o = s.id;
458
- if (o === W.id || o === Qe.id) {
459
- const l = z(i);
460
- if (l == null)
458
+ if (o === W.id || o === tt.id) {
459
+ const a = V(r);
460
+ if (a == null)
461
461
  return;
462
- const d = (c = l.ts) == null ? void 0 : c.fs;
462
+ const d = (c = a.ts) == null ? void 0 : c.fs;
463
463
  t.next(d != null ? d : 14);
464
464
  }
465
465
  });
466
- return t.next(14), r.dispose;
466
+ return t.next(14), i.dispose;
467
467
  }),
468
- hidden$: x(i, I.DOC)
468
+ hidden$: x(r, T.DOC)
469
469
  };
470
470
  }
471
- function pr(i) {
472
- const e = i.get(O), t = i.get(Pt);
471
+ function Cr(r) {
472
+ const e = r.get(O), t = r.get($t);
473
473
  return {
474
- id: et.id,
474
+ id: nt.id,
475
475
  icon: "FontColor",
476
476
  tooltip: "toolbar.textColor.main",
477
477
  group: y.TOOLBAR_FORMAT,
@@ -480,117 +480,117 @@ function pr(i) {
480
480
  selections: [
481
481
  {
482
482
  label: {
483
- name: Ct,
483
+ name: bt,
484
484
  hoverable: !1
485
485
  }
486
486
  }
487
487
  ],
488
488
  value$: new A((n) => {
489
- const r = t.getCurrentTheme().textColor, s = e.onCommandExecuted((o) => {
490
- if (o.id === et.id) {
489
+ const i = t.getCurrentTheme().textColor, s = e.onCommandExecuted((o) => {
490
+ if (o.id === nt.id) {
491
491
  const c = o.params.value;
492
- n.next(c != null ? c : r);
492
+ n.next(c != null ? c : i);
493
493
  }
494
494
  });
495
- return n.next(r), s.dispose;
495
+ return n.next(i), s.dispose;
496
496
  }),
497
- hidden$: x(i, I.DOC)
497
+ hidden$: x(r, T.DOC)
498
498
  // disabled$: getCurrentSheetDisabled$(accessor),
499
499
  };
500
500
  }
501
- function gr(i) {
501
+ function Or(r) {
502
502
  return {
503
- id: ln.id,
503
+ id: gn.id,
504
504
  group: y.TOOLBAR_LAYOUT,
505
505
  type: E.BUTTON,
506
506
  icon: "OrderSingle",
507
507
  tooltip: "toolbar.order",
508
508
  positions: [D.TOOLBAR_START],
509
- hidden$: x(i, I.DOC)
509
+ hidden$: x(r, T.DOC)
510
510
  };
511
511
  }
512
- function fr(i) {
512
+ function Rr(r) {
513
513
  return {
514
- id: dn.id,
514
+ id: pn.id,
515
515
  group: y.TOOLBAR_LAYOUT,
516
516
  type: E.BUTTON,
517
517
  icon: "UnorderSingle",
518
518
  tooltip: "toolbar.unorder",
519
519
  positions: [D.TOOLBAR_START],
520
- hidden$: x(i, I.DOC)
520
+ hidden$: x(r, T.DOC)
521
521
  };
522
522
  }
523
- function z(i) {
524
- var l;
525
- const e = i.get(M), t = i.get(le), n = e.getCurrentUniverDocInstance(), r = t.getActiveRange();
526
- if (n == null || r == null)
523
+ function V(r) {
524
+ var a;
525
+ const e = r.get(M), t = r.get(le), n = e.getCurrentUniverDocInstance(), i = t.getActiveRange();
526
+ if (n == null || i == null)
527
527
  return;
528
- const s = (l = n.getBody()) == null ? void 0 : l.textRuns;
528
+ const s = (a = n.getBody()) == null ? void 0 : a.textRuns;
529
529
  if (s == null)
530
530
  return;
531
- const { startOffset: o } = r;
531
+ const { startOffset: o } = i;
532
532
  return s.find(({ st: d, ed: u }) => o >= d && o < u);
533
533
  }
534
- var Sr = Object.defineProperty, mr = Object.getOwnPropertyDescriptor, vr = (i, e, t, n) => {
535
- for (var r = n > 1 ? void 0 : n ? mr(e, t) : e, s = i.length - 1, o; s >= 0; s--)
536
- (o = i[s]) && (r = (n ? o(e, t, r) : o(r)) || r);
537
- return n && r && Sr(e, t, r), r;
538
- }, V = (i, e) => (t, n) => e(t, n, i);
539
- let fe = class extends H {
540
- constructor(i, e, t, n, r, s, o) {
541
- super(), this._injector = i, this._componentManager = e, this._layoutService = t, this._editorService = n, this._menuService = r, this._uiController = s, this._currentUniverService = o, this._init();
534
+ var br = Object.defineProperty, Tr = Object.getOwnPropertyDescriptor, Ir = (r, e, t, n) => {
535
+ for (var i = n > 1 ? void 0 : n ? Tr(e, t) : e, s = r.length - 1, o; s >= 0; s--)
536
+ (o = r[s]) && (i = (n ? o(e, t, i) : o(i)) || i);
537
+ return n && i && br(e, t, i), i;
538
+ }, k = (r, e) => (t, n) => e(t, n, r);
539
+ let fe = class extends Y {
540
+ constructor(r, e, t, n, i, s, o) {
541
+ super(), this._injector = r, this._componentManager = e, this._layoutService = t, this._editorService = n, this._menuService = i, this._uiController = s, this._currentUniverService = o, this._init();
542
542
  }
543
543
  _initCustomComponents() {
544
- const i = this._componentManager;
545
- this.disposeWithMe(i.register(Ct, yn)), this.disposeWithMe(i.register(Ot, Vt)), this.disposeWithMe(i.register(Rt, kt)), this.disposeWithMe(i.register(bt, Ht));
544
+ const r = this._componentManager;
545
+ this.disposeWithMe(r.register(bt, Ln)), this.disposeWithMe(r.register(Tt, Gt)), this.disposeWithMe(r.register(It, Zt)), this.disposeWithMe(r.register(Mt, qt));
546
546
  }
547
547
  _initMenus() {
548
548
  [
549
- sr,
550
- cr,
551
- ar,
552
- lr,
553
- dr,
554
- ur,
555
- _r,
556
549
  hr,
557
- pr,
550
+ _r,
558
551
  gr,
559
- fr
560
- ].forEach((i) => {
561
- this.disposeWithMe(this._menuService.addMenuItem(this._injector.invoke(i)));
552
+ pr,
553
+ fr,
554
+ Sr,
555
+ vr,
556
+ mr,
557
+ Cr,
558
+ Or,
559
+ Rr
560
+ ].forEach((r) => {
561
+ this.disposeWithMe(this._menuService.addMenuItem(this._injector.invoke(r)));
562
562
  });
563
563
  }
564
564
  _init() {
565
- this._initCustomComponents(), this._initMenus(), this._initDocBackground();
565
+ this._initCustomComponents(), this._initMenus(), this._initDocBackground(), this._initFocusHandler();
566
566
  }
567
567
  _initDocBackground() {
568
- const i = this._currentUniverService.getAllUniverDocsInstance()[0].getUnitId();
569
- if (i == null)
568
+ const r = this._currentUniverService.getAllUniverDocsInstance()[0].getUnitId();
569
+ if (r == null)
570
570
  return;
571
- this._editorService.isEditor(i) || this.disposeWithMe(
572
- this._uiController.registerContentComponent(() => Mn(or, this._injector))
571
+ this._editorService.isEditor(r) || this.disposeWithMe(
572
+ this._uiController.registerContentComponent(() => Un(ur, this._injector))
573
573
  );
574
574
  }
575
575
  _initFocusHandler() {
576
576
  this.disposeWithMe(
577
- this._layoutService.registerFocusHandler(I.DOC, () => {
577
+ this._layoutService.registerFocusHandler(T.DOC, () => {
578
578
  this._injector.get(de).focus();
579
579
  })
580
580
  );
581
581
  }
582
582
  };
583
- fe = vr([
583
+ fe = Ir([
584
584
  P(U.Rendered, fe),
585
- V(0, v(Ee)),
586
- V(1, v(zt)),
587
- V(2, ft),
588
- V(3, $),
589
- V(4, Yt),
590
- V(5, Xt),
591
- V(6, M)
585
+ k(0, v(Ee)),
586
+ k(1, v(Xt)),
587
+ k(2, vt),
588
+ k(3, $),
589
+ k(4, Kt),
590
+ k(5, Jt),
591
+ k(6, M)
592
592
  ], fe);
593
- const xi = {
593
+ const $i = {
594
594
  toolbar: {
595
595
  undo: "Undo",
596
596
  redo: "Redo",
@@ -610,7 +610,7 @@ const xi = {
610
610
  order: "Ordered list",
611
611
  unorder: "Unordered list"
612
612
  }
613
- }, Cr = {
613
+ }, Mr = {
614
614
  toolbar: {
615
615
  undo: "撤销",
616
616
  redo: "重做",
@@ -630,29 +630,29 @@ const xi = {
630
630
  order: "有序列表",
631
631
  unorder: "无序列表"
632
632
  }
633
- }, Or = {
634
- id: un.id,
635
- preconditions: Nn,
636
- binding: T.ENTER
637
- }, Rr = {
638
- id: hn.id,
633
+ }, yr = {
634
+ id: fn.id,
635
+ preconditions: jn,
636
+ binding: I.ENTER
637
+ }, Er = {
638
+ id: Sn.id,
639
639
  preconditions: L,
640
- binding: T.BACKSPACE
641
- }, br = {
642
- id: _n.id,
640
+ binding: I.BACKSPACE
641
+ }, Dr = {
642
+ id: mn.id,
643
643
  preconditions: L,
644
- binding: T.DELETE
645
- }, Ir = 10, Tr = 6;
646
- function Mr() {
647
- return pt.generateRandomId(Tr);
644
+ binding: I.DELETE
645
+ }, xr = 10, Pr = 6;
646
+ function Ur() {
647
+ return He.generateRandomId(Pr);
648
648
  }
649
- function yr(i) {
650
- const e = i.match(/data-copy-id="([^\s]+)"/);
649
+ function Lr(r) {
650
+ const e = r.match(/data-copy-id="([^\s]+)"/);
651
651
  return e && e[1] ? e[1] : null;
652
652
  }
653
- class Er {
653
+ class Nr {
654
654
  constructor() {
655
- S(this, "_cache", new Ut(Ir));
655
+ S(this, "_cache", new At(xr));
656
656
  }
657
657
  set(e, t) {
658
658
  this._cache.set(e, t);
@@ -664,9 +664,9 @@ class Er {
664
664
  this._cache.clear();
665
665
  }
666
666
  }
667
- const at = new Er();
668
- function Ge(i) {
669
- const e = i.style, t = {}, n = i.tagName.toLowerCase();
667
+ const ut = new Nr();
668
+ function qe(r) {
669
+ const e = r.style, t = {}, n = r.tagName.toLowerCase();
670
670
  switch (n) {
671
671
  case "b":
672
672
  case "em":
@@ -692,12 +692,12 @@ function Ge(i) {
692
692
  }
693
693
  case "sub":
694
694
  case "sup": {
695
- t.va = n === "sup" ? K.SUPERSCRIPT : K.SUBSCRIPT;
695
+ t.va = n === "sup" ? J.SUPERSCRIPT : J.SUBSCRIPT;
696
696
  break;
697
697
  }
698
698
  }
699
- for (let r = 0; r < e.length; r++) {
700
- const s = e[r], o = e.getPropertyValue(s);
699
+ for (let i = 0; i < e.length; i++) {
700
+ const s = e[i], o = e.getPropertyValue(s);
701
701
  switch (s) {
702
702
  case "font-family": {
703
703
  t.ff = o;
@@ -705,7 +705,7 @@ function Ge(i) {
705
705
  }
706
706
  case "font-size": {
707
707
  const c = Number.parseInt(o);
708
- Number.isNaN(c) || o.endsWith("pt") && (t.fs = c);
708
+ Number.isNaN(c) || (o.endsWith("pt") ? t.fs = c : o.endsWith("px") && (t.fs = Tn(c)));
709
709
  break;
710
710
  }
711
711
  case "font-style": {
@@ -727,14 +727,14 @@ function Ge(i) {
727
727
  break;
728
728
  }
729
729
  case "color": {
730
- const c = new qe(o);
730
+ const c = new Je(o);
731
731
  c.isValid && (t.cl = {
732
732
  rgb: c.toRgbString()
733
733
  });
734
734
  break;
735
735
  }
736
736
  case "background-color": {
737
- const c = new qe(o);
737
+ const c = new Je(o);
738
738
  c.isValid && (t.bg = {
739
739
  rgb: c.toRgbString()
740
740
  });
@@ -744,13 +744,13 @@ function Ge(i) {
744
744
  }
745
745
  return t;
746
746
  }
747
- function Dr(i) {
748
- const e = new DOMParser(), t = `<x-univer id="univer-root">${i}</x-univer>`;
747
+ function $r(r) {
748
+ const e = new DOMParser(), t = `<x-univer id="univer-root">${r}</x-univer>`;
749
749
  return e.parseFromString(t, "text/html").querySelector("#univer-root");
750
750
  }
751
- function lt(i, e) {
752
- const t = i.tagName.toLowerCase();
753
- return typeof e == "string" ? t === e : Array.isArray(e) ? e.some((n) => n === t) : e(i);
751
+ function ht(r, e) {
752
+ const t = r.tagName.toLowerCase();
753
+ return typeof e == "string" ? t === e : Array.isArray(e) ? e.some((n) => n === t) : e(r);
754
754
  }
755
755
  const Me = class Me {
756
756
  constructor() {
@@ -764,17 +764,17 @@ const Me = class Me {
764
764
  this._pluginList.push(e);
765
765
  }
766
766
  convert(e) {
767
- const t = Me._pluginList.find((s) => s.checkPasteType(e)), n = Dr(e), r = {
767
+ const t = Me._pluginList.find((s) => s.checkPasteType(e)), n = $r(e), i = {
768
768
  dataStream: "",
769
769
  textRuns: []
770
770
  };
771
- return t && (this._styleRules = [...t.stylesRules], this._afterProcessRules = [...t.afterProcessRules]), this._styleCache.clear(), this._process(null, n == null ? void 0 : n.childNodes, r), this._styleCache.clear(), this._styleRules = [], this._afterProcessRules = [], r;
771
+ return t && (this._styleRules = [...t.stylesRules], this._afterProcessRules = [...t.afterProcessRules]), this._styleCache.clear(), this._process(null, n == null ? void 0 : n.childNodes, i), this._styleCache.clear(), this._styleRules = [], this._afterProcessRules = [], i;
772
772
  }
773
773
  _process(e, t, n) {
774
- var r;
774
+ var i;
775
775
  for (const s of t)
776
776
  if (s.nodeType === Node.TEXT_NODE) {
777
- const o = (r = s.nodeValue) == null ? void 0 : r.replace(/[\r\n]/g, "");
777
+ const o = (i = s.nodeValue) == null ? void 0 : i.replace(/[\r\n]/g, "");
778
778
  let c;
779
779
  e && this._styleCache.has(e) && (c = this._styleCache.get(e)), n.dataStream += o, c && Object.getOwnPropertyNames(c).length && n.textRuns.push({
780
780
  st: n.dataStream.length - o.length,
@@ -782,30 +782,30 @@ const Me = class Me {
782
782
  ts: c
783
783
  });
784
784
  } else if (s.nodeType === Node.ELEMENT_NODE) {
785
- const o = e ? this._styleCache.get(e) : {}, c = this._styleRules.find(({ filter: _ }) => lt(s, _)), l = c ? c.getStyle(s) : Ge(s);
786
- this._styleCache.set(s, { ...o, ...l });
785
+ const o = e ? this._styleCache.get(e) : {}, c = this._styleRules.find(({ filter: h }) => ht(s, h)), a = c ? c.getStyle(s) : qe(s);
786
+ this._styleCache.set(s, { ...o, ...a });
787
787
  const { childNodes: d } = s;
788
788
  this._process(s, d, n);
789
789
  const u = this._afterProcessRules.find(
790
- ({ filter: _ }) => lt(s, _)
790
+ ({ filter: h }) => ht(s, h)
791
791
  );
792
792
  u && u.handler(n, s);
793
793
  }
794
794
  }
795
795
  };
796
796
  S(Me, "_pluginList", []);
797
- let se = Me;
798
- const xr = {
797
+ let Q = Me;
798
+ const Ar = {
799
799
  name: "univer-doc-paste-plugin-lark",
800
- checkPasteType(i) {
801
- return /lark-record-clipboard/i.test(i);
800
+ checkPasteType(r) {
801
+ return /lark-record-clipboard/i.test(r);
802
802
  },
803
803
  // TODO: @JOCS, support inline code copy from lark.
804
804
  stylesRules: [
805
805
  {
806
806
  filter: ["s"],
807
- getStyle(i) {
808
- const e = Ge(i);
807
+ getStyle(r) {
808
+ const e = qe(r);
809
809
  return {
810
810
  st: {
811
811
  s: m.TRUE
@@ -817,111 +817,148 @@ const xr = {
817
817
  ],
818
818
  afterProcessRules: [
819
819
  {
820
- filter(i) {
821
- return i.tagName === "DIV" && /ace-line/i.test(i.className);
820
+ filter(r) {
821
+ return r.tagName === "DIV" && /ace-line/i.test(r.className);
822
822
  },
823
- handler(i) {
824
- i.paragraphs == null && (i.paragraphs = []), i.paragraphs.push({
825
- startIndex: i.dataStream.length
826
- }), i.dataStream += "\r";
823
+ handler(r) {
824
+ r.paragraphs == null && (r.paragraphs = []), r.paragraphs.push({
825
+ startIndex: r.dataStream.length
826
+ }), r.dataStream += "\r";
827
827
  }
828
828
  }
829
829
  ]
830
830
  };
831
- function Pr(i) {
832
- const e = i.style, t = {};
831
+ function Dt(r) {
832
+ const e = r.style, t = {};
833
833
  for (let n = 0; n < e.length; n++) {
834
- const r = e[n], s = e.getPropertyValue(r);
835
- switch (r) {
834
+ const i = e[n], s = e.getPropertyValue(i);
835
+ switch (i) {
836
836
  case "margin-top": {
837
837
  const o = Number.parseInt(s);
838
- t.spaceAbove = /pt/.test(s) ? rt(o) : o;
838
+ t.spaceAbove = /pt/.test(s) ? ot(o) : o;
839
839
  break;
840
840
  }
841
841
  case "margin-bottom": {
842
842
  const o = Number.parseInt(s);
843
- t.spaceBelow = /pt/.test(s) ? rt(o) : o;
843
+ t.spaceBelow = /pt/.test(s) ? ot(o) : o;
844
+ break;
845
+ }
846
+ case "line-height": {
847
+ const o = Number.parseFloat(s);
848
+ t.lineSpacing = o;
844
849
  break;
845
850
  }
846
851
  }
847
852
  }
848
853
  return Object.getOwnPropertyNames(t).length ? t : null;
849
854
  }
850
- const Ur = {
855
+ const wr = {
851
856
  name: "univer-doc-paste-plugin-word",
852
- checkPasteType(i) {
853
- return /word|mso/i.test(i);
857
+ checkPasteType(r) {
858
+ return /word|mso/i.test(r);
854
859
  },
855
860
  stylesRules: [
856
861
  {
857
862
  filter: ["b"],
858
- getStyle(i) {
859
- const e = Ge(i);
863
+ getStyle(r) {
864
+ const e = qe(r);
860
865
  return { bl: m.TRUE, ...e };
861
866
  }
862
867
  }
863
868
  ],
864
869
  afterProcessRules: [
865
870
  {
866
- filter(i) {
867
- return i.tagName === "P" && /mso/i.test(i.className);
871
+ filter(r) {
872
+ return r.tagName === "P" && /mso/i.test(r.className);
868
873
  },
869
- handler(i, e) {
870
- i.paragraphs == null && (i.paragraphs = []);
874
+ handler(r, e) {
875
+ r.paragraphs == null && (r.paragraphs = []);
871
876
  const t = {
872
- startIndex: i.dataStream.length
873
- }, n = Pr(e);
874
- n && (t.paragraphStyle = n), i.paragraphs.push(t), i.dataStream += "\r";
877
+ startIndex: r.dataStream.length
878
+ }, n = Dt(e);
879
+ n && (t.paragraphStyle = n), r.paragraphs.push(t), r.dataStream += "\r";
880
+ }
881
+ }
882
+ ]
883
+ }, Fr = {
884
+ name: "univer-doc-paste-plugin-univer",
885
+ checkPasteType(r) {
886
+ return /UniverNormal/i.test(r);
887
+ },
888
+ stylesRules: [],
889
+ afterProcessRules: [
890
+ {
891
+ filter(r) {
892
+ return r.tagName === "P" && /UniverNormal/i.test(r.className);
893
+ },
894
+ handler(r, e) {
895
+ r.paragraphs == null && (r.paragraphs = []);
896
+ const t = {
897
+ startIndex: r.dataStream.length
898
+ }, n = Dt(e);
899
+ n && (t.paragraphStyle = n), r.paragraphs.push(t), r.dataStream += "\r";
875
900
  }
876
901
  }
877
902
  ]
878
903
  };
879
- function Lr(i, e) {
880
- const { st: t, ed: n, ts: r = {} } = e, { ff: s, fs: o, it: c, bl: l, ul: d, st: u, ol: _, bg: g, cl: f, va: p } = r;
881
- let a = i.slice(t, n);
882
- const h = [];
883
- return c === m.TRUE && (a = `<i>${a}</i>`), p === K.SUPERSCRIPT ? a = `<sup>${a}</sup>` : p === K.SUBSCRIPT && (a = `<sub>${a}</sub>`), (d == null ? void 0 : d.s) === m.TRUE && (a = `<u>${a}</u>`), (u == null ? void 0 : u.s) === m.TRUE && (a = `<s>${a}</s>`), l === m.TRUE && (a = `<strong>${a}</strong>`), s && h.push(`font-family: ${s}`), f && h.push(`color: ${f.rgb}`), o && h.push(`font-size: ${o}px`), _ && h.push("text-decoration: overline"), g && h.push(`background: ${g.rgb}`), h.length ? `<span style="${h.join(";")}">${a}</span>` : a;
904
+ function _t(r, e) {
905
+ const { st: t, ed: n, ts: i = {} } = e, { ff: s, fs: o, it: c, bl: a, ul: d, st: u, ol: h, bg: p, cl: _, va: f } = i;
906
+ let l = r.slice(t, n);
907
+ const g = [];
908
+ return c === m.TRUE && (l = `<i>${l}</i>`), f === J.SUPERSCRIPT ? l = `<sup>${l}</sup>` : f === J.SUBSCRIPT && (l = `<sub>${l}</sub>`), (d == null ? void 0 : d.s) === m.TRUE && (l = `<u>${l}</u>`), (u == null ? void 0 : u.s) === m.TRUE && (l = `<s>${l}</s>`), a === m.TRUE && (l = `<strong>${l}</strong>`), s && g.push(`font-family: ${s}`), _ && g.push(`color: ${_.rgb}`), o && g.push(`font-size: ${o}pt`), h && g.push("text-decoration: overline"), p && g.push(`background: ${p.rgb}`), g.length ? `<span style="${g.join("; ")};">${l}</span>` : l;
884
909
  }
885
- function dt(i, e = !0) {
886
- const { dataStream: t, textRuns: n = [], paragraphs: r = [] } = i;
887
- let s = 0;
888
- const o = [], c = [];
889
- for (const l of n) {
890
- const { st: d, ed: u } = l;
891
- if (d !== s && o.push(t.slice(s, d)), o.push(Lr(t, l)), s = u, e)
892
- for (const _ of r) {
893
- const { startIndex: g, paragraphStyle: f = {} } = _;
894
- if (g >= d && g <= u) {
895
- const { spaceAbove: p, spaceBelow: a } = f, h = [];
896
- p != null && (typeof p == "number" ? h.push(`margin-top: ${p}px`) : h.push(`margin-top: ${p.v}px`)), a != null && (typeof a == "number" ? h.push(`margin-bottom: ${a}px`) : h.push(`margin-bottom: ${a.v}px`)), c.push(
897
- `<p className="UniverNormal" ${h.length ? `style="${h.join(";")}"` : ""}>${o.join("")}</p>`
898
- ), o.length = 0;
899
- }
900
- }
901
- }
902
- return s < t.length && o.push(t.slice(s, t.length)), c.join("") + o.join("");
910
+ function $e(r, e, t) {
911
+ const { dataStream: n, textRuns: i = [] } = r;
912
+ let s = e;
913
+ const o = [];
914
+ for (const c of i) {
915
+ const { st: a, ed: d } = c;
916
+ He.hasIntersectionBetweenTwoRanges(e, t, a, d) && (a > s ? (o.push(n.slice(s, a)), o.push(_t(n, {
917
+ ...c,
918
+ ed: Math.min(d, t)
919
+ }))) : o.push(_t(n, {
920
+ ...c,
921
+ st: s,
922
+ ed: Math.min(d, t)
923
+ }))), s = Math.max(e, Math.min(d, t));
924
+ }
925
+ return s !== t && o.push(n.slice(s, t)), o.join("");
903
926
  }
904
- class Nr {
927
+ function gt(r, e = !0) {
928
+ var t;
929
+ if (e && ((t = r.paragraphs) != null && t.length)) {
930
+ const { dataStream: n, paragraphs: i = [] } = r;
931
+ let s = "", o = -1;
932
+ for (const c of i) {
933
+ const { startIndex: a, paragraphStyle: d = {} } = c, { spaceAbove: u, spaceBelow: h, lineSpacing: p } = d, _ = [];
934
+ u != null && (typeof u == "number" ? _.push(`margin-top: ${u}px`) : _.push(`margin-top: ${u.v}px`)), h != null && (typeof h == "number" ? _.push(`margin-bottom: ${h}px`) : _.push(`margin-bottom: ${h.v}px`)), p != null && _.push(`line-height: ${p}`), a > o + 1 ? s += `<p class="UniverNormal" ${_.length ? `style="${_.join("; ")};"` : ""}>${$e(r, o + 1, a)}</p>` : s += `<p class="UniverNormal" ${_.length ? `style="${_.join("; ")};"` : ""}></p>`, o = a;
935
+ }
936
+ return o !== n.length && (s += $e(r, o, n.length)), s;
937
+ } else
938
+ return $e(r, 0, r.dataStream.length);
939
+ }
940
+ class Br {
905
941
  convert(e) {
906
942
  if (e.length === 0)
907
943
  throw new Error("The bodyList length at least to be 1");
908
944
  if (e.length === 1)
909
- return dt(e[0]);
945
+ return gt(e[0]);
910
946
  let t = "";
911
947
  for (const n of e)
912
- t += '<p className="UniverNormal">', t += dt(n, !1), t += "</p>";
948
+ t += '<p className="UniverNormal">', t += gt(n, !1), t += "</p>";
913
949
  return t;
914
950
  }
915
951
  }
916
- var $r = Object.defineProperty, Ar = Object.getOwnPropertyDescriptor, wr = (i, e, t, n) => {
917
- for (var r = n > 1 ? void 0 : n ? Ar(e, t) : e, s = i.length - 1, o; s >= 0; s--)
918
- (o = i[s]) && (r = (n ? o(e, t, r) : o(r)) || r);
919
- return n && r && $r(e, t, r), r;
920
- }, ee = (i, e) => (t, n) => e(t, n, i);
921
- se.use(Ur);
922
- se.use(xr);
923
- function Br(i) {
924
- const e = i.replace(/\n/g, "\r"), t = [];
952
+ var jr = Object.defineProperty, Wr = Object.getOwnPropertyDescriptor, zr = (r, e, t, n) => {
953
+ for (var i = n > 1 ? void 0 : n ? Wr(e, t) : e, s = r.length - 1, o; s >= 0; s--)
954
+ (o = r[s]) && (i = (n ? o(e, t, i) : o(i)) || i);
955
+ return n && i && jr(e, t, i), i;
956
+ }, ne = (r, e) => (t, n) => e(t, n, r);
957
+ Q.use(wr);
958
+ Q.use(Ar);
959
+ Q.use(Fr);
960
+ function Vr(r) {
961
+ const e = r.replace(/\n/g, "\r"), t = [];
925
962
  for (let n = 0; n < e.length; n++)
926
963
  e[n] === "\r" && t.push({ startIndex: n });
927
964
  return {
@@ -929,14 +966,14 @@ function Br(i) {
929
966
  paragraphs: t
930
967
  };
931
968
  }
932
- const ue = jt("doc.clipboard-service");
933
- let We = class extends H {
934
- constructor(e, t, n, r, s) {
969
+ const ue = Ht("doc.clipboard-service");
970
+ let ze = class extends Y {
971
+ constructor(e, t, n, i, s) {
935
972
  super();
936
973
  S(this, "_clipboardHooks", []);
937
- S(this, "_htmlToUDM", new se());
938
- S(this, "_umdToHtml", new Nr());
939
- this._currentUniverService = e, this._logService = t, this._commandService = n, this._clipboardInterfaceService = r, this._textSelectionManagerService = s;
974
+ S(this, "_htmlToUDM", new Q());
975
+ S(this, "_umdToHtml", new Br());
976
+ this._currentUniverService = e, this._logService = t, this._commandService = n, this._clipboardInterfaceService = i, this._textSelectionManagerService = s;
940
977
  }
941
978
  async copy() {
942
979
  const e = this._getDocumentBodyInRanges();
@@ -966,14 +1003,14 @@ let We = class extends H {
966
1003
  segmentId: e,
967
1004
  endOffset: t,
968
1005
  style: n
969
- } = (s = this._textSelectionManagerService.getActiveRange()) != null ? s : {}, r = this._textSelectionManagerService.getSelections();
970
- if (e == null && this._logService.error("[DocClipboardController] segmentId is not existed"), t == null || r == null)
1006
+ } = (s = this._textSelectionManagerService.getActiveRange()) != null ? s : {}, i = this._textSelectionManagerService.getSelections();
1007
+ if (e == null && this._logService.error("[DocClipboardController] segmentId is not existed"), t == null || i == null)
971
1008
  return !1;
972
1009
  this.copy();
973
1010
  try {
974
1011
  let o = t;
975
- for (const l of r) {
976
- const { startOffset: d, endOffset: u } = l;
1012
+ for (const a of i) {
1013
+ const { startOffset: d, endOffset: u } = a;
977
1014
  d == null || u == null || u <= t && (o -= u - d);
978
1015
  }
979
1016
  const c = [
@@ -983,39 +1020,39 @@ let We = class extends H {
983
1020
  style: n
984
1021
  }
985
1022
  ];
986
- return this._commandService.executeCommand(St.id, { segmentId: e, textRanges: c });
1023
+ return this._commandService.executeCommand(Ct.id, { segmentId: e, textRanges: c });
987
1024
  } catch {
988
1025
  return this._logService.error("[DocClipboardController] cut content failed"), !1;
989
1026
  }
990
1027
  }
991
1028
  async _paste(e) {
992
1029
  var o;
993
- const { segmentId: t, endOffset: n, style: r } = (o = this._textSelectionManagerService.getActiveRange()) != null ? o : {}, s = this._textSelectionManagerService.getSelections();
1030
+ const { segmentId: t, endOffset: n, style: i } = (o = this._textSelectionManagerService.getActiveRange()) != null ? o : {}, s = this._textSelectionManagerService.getSelections();
994
1031
  if (t == null && this._logService.error("[DocClipboardController] segmentId does not exist!"), n == null || s == null)
995
1032
  return !1;
996
1033
  try {
997
1034
  let c = n;
998
1035
  for (const d of s) {
999
- const { startOffset: u, endOffset: _ } = d;
1000
- u == null || _ == null || _ <= n && (c += e.dataStream.length - (_ - u));
1036
+ const { startOffset: u, endOffset: h } = d;
1037
+ u == null || h == null || h <= n && (c += e.dataStream.length - (h - u));
1001
1038
  }
1002
- const l = [
1039
+ const a = [
1003
1040
  {
1004
1041
  startOffset: c,
1005
1042
  endOffset: c,
1006
- style: r
1043
+ style: i
1007
1044
  }
1008
1045
  ];
1009
- return this._commandService.executeCommand(mt.id, { body: e, segmentId: t, textRanges: l });
1046
+ return this._commandService.executeCommand(Ot.id, { body: e, segmentId: t, textRanges: a });
1010
1047
  } catch {
1011
1048
  return this._logService.error("[DocClipboardController]", "clipboard is empty."), !1;
1012
1049
  }
1013
1050
  }
1014
1051
  async _setClipboardData(e) {
1015
- const t = Mr(), n = e.length > 1 ? e.map((s) => s.dataStream).join(`
1052
+ const t = Ur(), n = e.length > 1 ? e.map((s) => s.dataStream).join(`
1016
1053
  `) : e[0].dataStream;
1017
- let r = this._umdToHtml.convert(e);
1018
- return e.length === 1 && (r = r.replace(/(<[a-z]+)/, (s, o) => `${o} data-copy-id="${t}"`), at.set(t, e[0])), this._clipboardInterfaceService.write(n, r);
1054
+ let i = this._umdToHtml.convert(e);
1055
+ return e.length === 1 && (i = i.replace(/(<[a-z]+)/, (s, o) => `${o} data-copy-id="${t}"`), ut.set(t, e[0])), this._clipboardInterfaceService.write(n, i);
1019
1056
  }
1020
1057
  addClipboardHook(e) {
1021
1058
  return this._clipboardHooks.push(e), N(() => {
@@ -1027,21 +1064,21 @@ let We = class extends H {
1027
1064
  const e = this._textSelectionManagerService.getSelections(), t = this._currentUniverService.getCurrentUniverDocInstance(), n = [];
1028
1065
  if (e == null)
1029
1066
  return n;
1030
- for (const r of e) {
1031
- const { startOffset: s, endOffset: o, collapsed: c } = r;
1067
+ for (const i of e) {
1068
+ const { startOffset: s, endOffset: o, collapsed: c } = i;
1032
1069
  if (c || s == null || o == null)
1033
1070
  continue;
1034
- const l = t.sliceBody(s, o);
1035
- l != null && n.push(l);
1071
+ const a = t.sliceBody(s, o);
1072
+ a != null && n.push(a);
1036
1073
  }
1037
1074
  return n;
1038
1075
  }
1039
1076
  async _generateBodyFromClipboardItems(e) {
1040
1077
  try {
1041
1078
  let t = "", n = "";
1042
- for (const r of e)
1043
- for (const s of r.types)
1044
- s === Gt ? n = await r.getType(s).then((o) => o && o.text()) : s === Zt && (t = await r.getType(s).then((o) => o && o.text()));
1079
+ for (const i of e)
1080
+ for (const s of i.types)
1081
+ s === Qt ? n = await i.getType(s).then((o) => o && o.text()) : s === en && (t = await i.getType(s).then((o) => o && o.text()));
1045
1082
  return this._generateBodyFromHtmlAndText(t, n);
1046
1083
  } catch (t) {
1047
1084
  return Promise.reject(t);
@@ -1050,98 +1087,98 @@ let We = class extends H {
1050
1087
  _generateBodyFromHtmlAndText(e, t) {
1051
1088
  if (!e) {
1052
1089
  if (t)
1053
- return Br(t);
1090
+ return Vr(t);
1054
1091
  throw new Error("[DocClipboardService] html and text cannot be both empty!");
1055
1092
  }
1056
- const n = yr(e);
1093
+ const n = Lr(e);
1057
1094
  if (n) {
1058
- const r = at.get(n);
1059
- if (r)
1060
- return r;
1095
+ const i = ut.get(n);
1096
+ if (i)
1097
+ return i;
1061
1098
  }
1062
1099
  return this._htmlToUDM.convert(e);
1063
1100
  }
1064
1101
  };
1065
- We = wr([
1066
- ee(0, M),
1067
- ee(1, gt),
1068
- ee(2, O),
1069
- ee(3, He),
1070
- ee(4, v(le))
1071
- ], We);
1072
- function Ne(i) {
1073
- return i.getContextValue(ye) || i.getContextValue(_t);
1102
+ ze = zr([
1103
+ ne(0, M),
1104
+ ne(1, mt),
1105
+ ne(2, O),
1106
+ ne(3, Xe),
1107
+ ne(4, v(le))
1108
+ ], ze);
1109
+ function Ne(r) {
1110
+ return r.getContextValue(ye) || r.getContextValue(St);
1074
1111
  }
1075
- const Ze = 999, Fr = {
1076
- id: qt.id,
1112
+ const Ke = 999, kr = {
1113
+ id: tn.id,
1077
1114
  name: "doc.command.copy",
1078
- type: ke.COMMAND,
1115
+ type: Ye.COMMAND,
1079
1116
  multi: !0,
1080
- priority: Ze,
1117
+ priority: Ke,
1081
1118
  preconditions: Ne,
1082
- handler: async (i) => i.get(ue).copy()
1083
- }, jr = {
1084
- id: Kt.id,
1119
+ handler: async (r) => r.get(ue).copy()
1120
+ }, Hr = {
1121
+ id: nn.id,
1085
1122
  name: "doc.command.cut",
1086
- type: ke.COMMAND,
1123
+ type: Ye.COMMAND,
1087
1124
  multi: !0,
1088
- priority: Ze,
1125
+ priority: Ke,
1089
1126
  preconditions: Ne,
1090
- handler: async (i) => i.get(ue).cut()
1091
- }, Wr = {
1092
- id: Jt.id,
1127
+ handler: async (r) => r.get(ue).cut()
1128
+ }, Yr = {
1129
+ id: rn.id,
1093
1130
  name: "doc.command.paste",
1094
- type: ke.COMMAND,
1131
+ type: Ye.COMMAND,
1095
1132
  multi: !0,
1096
- priority: Ze,
1133
+ priority: Ke,
1097
1134
  preconditions: Ne,
1098
- handler: async (i) => {
1099
- const e = i.get(ue), n = await i.get(He).read();
1135
+ handler: async (r) => {
1136
+ const e = r.get(ue), n = await r.get(Xe).read();
1100
1137
  return n.length === 0 ? !1 : e.paste(n);
1101
1138
  }
1102
1139
  };
1103
- var zr = Object.defineProperty, Vr = Object.getOwnPropertyDescriptor, kr = (i, e, t, n) => {
1104
- for (var r = n > 1 ? void 0 : n ? Vr(e, t) : e, s = i.length - 1, o; s >= 0; s--)
1105
- (o = i[s]) && (r = (n ? o(e, t, r) : o(r)) || r);
1106
- return n && r && zr(e, t, r), r;
1107
- }, te = (i, e) => (t, n) => e(t, n, i);
1140
+ var Xr = Object.defineProperty, Gr = Object.getOwnPropertyDescriptor, Zr = (r, e, t, n) => {
1141
+ for (var i = n > 1 ? void 0 : n ? Gr(e, t) : e, s = r.length - 1, o; s >= 0; s--)
1142
+ (o = r[s]) && (i = (n ? o(e, t, i) : o(i)) || i);
1143
+ return n && i && Xr(e, t, i), i;
1144
+ }, re = (r, e) => (t, n) => e(t, n, r);
1108
1145
  let Se = class extends ce {
1109
- constructor(i, e, t, n, r) {
1110
- super(), this._commandService = i, this._clipboardInterfaceService = e, this._docClipboardService = t, this._textSelectionRenderManager = n, this._contextService = r, this._init();
1146
+ constructor(r, e, t, n, i) {
1147
+ super(), this._commandService = r, this._clipboardInterfaceService = e, this._docClipboardService = t, this._textSelectionRenderManager = n, this._contextService = i, this._init();
1111
1148
  }
1112
1149
  _init() {
1113
- [Fr, jr, Wr].forEach((i) => this.disposeWithMe(this._commandService.registerMultipleCommand(i))), [mt, St].forEach((i) => this.disposeWithMe(this._commandService.registerCommand(i))), this._initLegacyPasteCommand();
1150
+ [kr, Hr, Yr].forEach((r) => this.disposeWithMe(this._commandService.registerMultipleCommand(r))), [Ot, Ct].forEach((r) => this.disposeWithMe(this._commandService.registerCommand(r))), this._initLegacyPasteCommand();
1114
1151
  }
1115
1152
  _initLegacyPasteCommand() {
1116
- var i;
1117
- this._clipboardInterfaceService.supportClipboard || (i = this._textSelectionRenderManager) == null || i.onPaste$.pipe(oe(this.dispose$)).subscribe((e) => {
1153
+ var r;
1154
+ (r = this._textSelectionRenderManager) == null || r.onPaste$.pipe(se(this.dispose$)).subscribe((e) => {
1118
1155
  var s, o;
1119
1156
  if (!Ne(this._contextService))
1120
1157
  return;
1121
1158
  e.event.preventDefault();
1122
- const t = e.event, n = (s = t.clipboardData) == null ? void 0 : s.getData("text/html"), r = (o = t.clipboardData) == null ? void 0 : o.getData("text/plain");
1123
- this._docClipboardService.legacyPaste(n, r);
1159
+ const t = e.event, n = (s = t.clipboardData) == null ? void 0 : s.getData("text/html"), i = (o = t.clipboardData) == null ? void 0 : o.getData("text/plain");
1160
+ this._docClipboardService.legacyPaste(n, i);
1124
1161
  });
1125
1162
  }
1126
1163
  };
1127
- Se = kr([
1164
+ Se = Zr([
1128
1165
  P(U.Steady, Se),
1129
- te(0, O),
1130
- te(1, He),
1131
- te(2, ue),
1132
- te(3, de),
1133
- te(4, Lt)
1166
+ re(0, O),
1167
+ re(1, Xe),
1168
+ re(2, ue),
1169
+ re(3, de),
1170
+ re(4, wt)
1134
1171
  ], Se);
1135
- var Hr = Object.defineProperty, Yr = Object.getOwnPropertyDescriptor, Xr = (i, e, t, n) => {
1136
- for (var r = n > 1 ? void 0 : n ? Yr(e, t) : e, s = i.length - 1, o; s >= 0; s--)
1137
- (o = i[s]) && (r = (n ? o(e, t, r) : o(r)) || r);
1138
- return n && r && Hr(e, t, r), r;
1139
- }, ne = (i, e) => (t, n) => e(t, n, i);
1140
- let me = class extends H {
1141
- constructor(e, t, n, r, s) {
1172
+ var qr = Object.defineProperty, Kr = Object.getOwnPropertyDescriptor, Jr = (r, e, t, n) => {
1173
+ for (var i = n > 1 ? void 0 : n ? Kr(e, t) : e, s = r.length - 1, o; s >= 0; s--)
1174
+ (o = r[s]) && (i = (n ? o(e, t, i) : o(i)) || i);
1175
+ return n && i && qr(e, t, i), i;
1176
+ }, Z = (r, e) => (t, n) => e(t, n, r);
1177
+ let me = class extends Y {
1178
+ constructor(e, t, n, i, s, o) {
1142
1179
  super();
1143
1180
  S(this, "_initialEditors", /* @__PURE__ */ new Set());
1144
- this._currentUniverService = e, this._docSkeletonManagerService = t, this._editorService = n, this._commandService = r, this._textSelectionRenderManager = s, this._initialize();
1181
+ this._currentUniverService = e, this._docSkeletonManagerService = t, this._editorService = n, this._commandService = i, this._textSelectionRenderManager = s, this._renderManagerService = o, this._initialize();
1145
1182
  }
1146
1183
  _initialize() {
1147
1184
  this.disposeWithMe(
@@ -1154,30 +1191,31 @@ let me = class extends H {
1154
1191
  }), this._commandExecutedListener(), this._initialSetValue(), this._initialBlur(), this._initialFocus(), this._initialValueChange();
1155
1192
  }
1156
1193
  _resize(e) {
1157
- var w, B, F;
1194
+ var w, F, B;
1158
1195
  if (e == null)
1159
1196
  return;
1160
1197
  const t = this._editorService.getEditor(e);
1161
1198
  if ((t == null ? void 0 : t.cancelDefaultResizeListener) === !0)
1162
1199
  return;
1163
- const n = (w = this._docSkeletonManagerService.getSkeletonByUnitId(e)) == null ? void 0 : w.skeleton, r = this._currentUniverService.getUniverDocInstance(e);
1164
- if (t == null || t.render == null || n == null || r == null)
1200
+ const n = (w = this._docSkeletonManagerService.getSkeletonByUnitId(e)) == null ? void 0 : w.skeleton, i = this._currentUniverService.getUniverDocInstance(e);
1201
+ if (t == null || t.render == null || n == null || i == null)
1165
1202
  return;
1166
- const { marginTop: s = 0, marginBottom: o = 0, marginLeft: c = 0, marginRight: l = 0 } = r.getSnapshot().documentStyle, { scene: d, mainComponent: u } = t.render;
1167
- let { actualHeight: _, actualWidth: g } = n.getActualSize();
1168
- _ += s + o, g += c + l;
1169
- const { width: f, height: p } = t.getBoundingClientRect(), a = d.getViewport(Pe.VIEW_MAIN);
1170
- let h = a == null ? void 0 : a.getScrollBar();
1171
- const C = Math.max(g, f), R = Math.max(_, p);
1203
+ n.calculate();
1204
+ const { marginTop: s = 0, marginBottom: o = 0, marginLeft: c = 0, marginRight: a = 0 } = i.getSnapshot().documentStyle, { scene: d, mainComponent: u } = t.render;
1205
+ let { actualHeight: h, actualWidth: p } = n.getActualSize();
1206
+ h += s + o, p += c + a;
1207
+ const { width: _, height: f } = t.getBoundingClientRect(), l = d.getViewport(Pe.VIEW_MAIN);
1208
+ let g = l == null ? void 0 : l.getScrollBar();
1209
+ const C = Math.max(p, _), R = Math.max(h, f);
1172
1210
  d.transformByState({
1173
1211
  width: C,
1174
1212
  height: R
1175
- }), u == null || u.resize(C, R), t.isSingle() ? g > f ? h == null ? a && new Fe(a, { barSize: 8, enableVertical: !1 }) : a == null || a.resetSizeAndScrollBar() : (h = null, a == null || a.scrollTo({ x: 0, y: 0 }), (F = a == null ? void 0 : a.getScrollBar()) == null || F.dispose()) : _ > p ? h == null ? a && new Fe(a, { enableHorizontal: !1, barSize: 8 }) : a == null || a.resetSizeAndScrollBar() : (h = null, a == null || a.scrollTo({ x: 0, y: 0 }), (B = a == null ? void 0 : a.getScrollBar()) == null || B.dispose());
1213
+ }), u == null || u.resize(C, R), t.isSingle() ? p > _ ? g == null ? l && new je(l, { barSize: 8, enableVertical: !1 }) : l == null || l.resetSizeAndScrollBar() : (g = null, l == null || l.scrollTo({ x: 0, y: 0 }), (B = l == null ? void 0 : l.getScrollBar()) == null || B.dispose()) : h > f ? g == null ? l && new je(l, { enableHorizontal: !1, barSize: 8 }) : l == null || l.resetSizeAndScrollBar() : (g = null, l == null || l.scrollTo({ x: 0, y: 0 }), (F = l == null ? void 0 : l.getScrollBar()) == null || F.dispose());
1176
1214
  }
1177
1215
  _initialSetValue() {
1178
1216
  this.disposeWithMe(
1179
1217
  this._editorService.setValue$.subscribe((e) => {
1180
- this._commandService.executeCommand(pn.id, {
1218
+ this._commandService.executeCommand(vn.id, {
1181
1219
  unitId: e.editorUnitId,
1182
1220
  body: e.body,
1183
1221
  segmentId: null
@@ -1190,14 +1228,43 @@ let me = class extends H {
1190
1228
  this._editorService.blur$.subscribe(() => {
1191
1229
  this._textSelectionRenderManager.removeAllTextRanges(), this._textSelectionRenderManager.blur();
1192
1230
  })
1231
+ ), this.disposeWithMe(
1232
+ this._textSelectionRenderManager.onBlur$.subscribe(() => {
1233
+ const e = this._currentUniverService.getCurrentUniverDocInstance().getUnitId();
1234
+ if (e == null)
1235
+ return;
1236
+ const t = this._editorService.getEditor(e);
1237
+ t == null || t.isSheetEditor() || this._editorService.blur();
1238
+ })
1193
1239
  );
1194
1240
  }
1195
1241
  _initialFocus() {
1196
1242
  this.disposeWithMe(
1197
- this._editorService.focus$.subscribe((e) => {
1198
- this._textSelectionRenderManager.removeAllTextRanges(), this._textSelectionRenderManager.addTextRanges([e]);
1243
+ this._editorService.focus$.subscribe((n) => {
1244
+ this._textSelectionRenderManager.removeAllTextRanges(), this._textSelectionRenderManager.addTextRanges([n]);
1199
1245
  })
1200
1246
  );
1247
+ const e = [
1248
+ "univer-formula-search",
1249
+ "univer-formula-help",
1250
+ "formula-help-decorator",
1251
+ "univer-formula-help-param"
1252
+ ];
1253
+ this.disposeWithMe(
1254
+ lt(window, "mousedown").subscribe((n) => {
1255
+ const s = n.target.classList[0] || "";
1256
+ if (Ft(s, e)) {
1257
+ this._editorService.changeSpreadsheetFocusState(!0), n.stopPropagation();
1258
+ return;
1259
+ }
1260
+ this._editorService.changeSpreadsheetFocusState(!1);
1261
+ })
1262
+ ), this._currentUniverService.getAllUniverSheetsInstance().forEach((n) => {
1263
+ const i = n.getUnitId(), s = this._renderManagerService.getRenderById(i), o = s == null ? void 0 : s.engine.getCanvas().getCanvasEle();
1264
+ o != null && lt(o, "mousedown").subscribe((c) => {
1265
+ this._editorService.changeSpreadsheetFocusState(!0), c.stopPropagation();
1266
+ });
1267
+ });
1201
1268
  }
1202
1269
  _initialValueChange() {
1203
1270
  this.disposeWithMe(
@@ -1221,40 +1288,41 @@ let me = class extends H {
1221
1288
  * Listen to document edits to refresh the size of the normula editor.
1222
1289
  */
1223
1290
  _commandExecutedListener() {
1224
- const e = [Ye.id, Qt.id];
1291
+ const e = [Ge.id, on.id];
1225
1292
  this.disposeWithMe(
1226
1293
  this._commandService.onCommandExecuted((t) => {
1227
1294
  if (e.includes(t.id)) {
1228
- const n = t.params, { unitId: r } = n;
1229
- if (this._editorService.isSheetEditor(r))
1295
+ const n = t.params, { unitId: i } = n;
1296
+ if (this._editorService.isSheetEditor(i))
1230
1297
  return;
1231
- this._resize(r), this._valueChange();
1298
+ this._resize(i), this._valueChange();
1232
1299
  }
1233
1300
  })
1234
1301
  );
1235
1302
  }
1236
1303
  };
1237
- me = Xr([
1304
+ me = Jr([
1238
1305
  P(U.Rendered, me),
1239
- ne(0, M),
1240
- ne(1, v(Q)),
1241
- ne(2, $),
1242
- ne(3, O),
1243
- ne(4, de)
1306
+ Z(0, M),
1307
+ Z(1, v(te)),
1308
+ Z(2, $),
1309
+ Z(3, O),
1310
+ Z(4, de),
1311
+ Z(5, z)
1244
1312
  ], me);
1245
- var Gr = Object.defineProperty, Zr = Object.getOwnPropertyDescriptor, qr = (i, e, t, n) => {
1246
- for (var r = n > 1 ? void 0 : n ? Zr(e, t) : e, s = i.length - 1, o; s >= 0; s--)
1247
- (o = i[s]) && (r = (n ? o(e, t, r) : o(r)) || r);
1248
- return n && r && Gr(e, t, r), r;
1249
- }, ge = (i, e) => (t, n) => e(t, n, i);
1313
+ var Qr = Object.defineProperty, ei = Object.getOwnPropertyDescriptor, ti = (r, e, t, n) => {
1314
+ for (var i = n > 1 ? void 0 : n ? ei(e, t) : e, s = r.length - 1, o; s >= 0; s--)
1315
+ (o = r[s]) && (i = (n ? o(e, t, i) : o(i)) || i);
1316
+ return n && i && Qr(e, t, i), i;
1317
+ }, pe = (r, e) => (t, n) => e(t, n, r);
1250
1318
  let ve = class extends ce {
1251
- constructor(e, t, n, r) {
1319
+ constructor(e, t, n, i) {
1252
1320
  super();
1253
1321
  S(this, "_docRenderMap", /* @__PURE__ */ new Set());
1254
- this._docSkeletonManagerService = e, this._renderManagerService = t, this._commandService = n, this._editorService = r, this._initialRenderRefresh(), this._commandExecutedListener();
1322
+ this._docSkeletonManagerService = e, this._renderManagerService = t, this._commandService = n, this._editorService = i, this._initialRenderRefresh(), this._commandExecutedListener();
1255
1323
  }
1256
1324
  _initialRenderRefresh() {
1257
- this._docSkeletonManagerService.currentSkeletonBefore$.pipe(oe(this.dispose$)).subscribe((e) => {
1325
+ this._docSkeletonManagerService.currentSkeletonBefore$.pipe(se(this.dispose$)).subscribe((e) => {
1258
1326
  this._create(e);
1259
1327
  });
1260
1328
  }
@@ -1262,70 +1330,70 @@ let ve = class extends ce {
1262
1330
  if (e == null)
1263
1331
  return;
1264
1332
  const { skeleton: t, unitId: n } = e;
1265
- let r = this._renderManagerService.getRenderById(n);
1266
- r == null && (this._renderManagerService.create(n), r = this._renderManagerService.getRenderById(n));
1267
- const { mainComponent: s } = r;
1268
- s.changeSkeleton(t), this._recalculateSizeBySkeleton(r, t);
1333
+ let i = this._renderManagerService.getRenderById(n);
1334
+ i == null && (this._renderManagerService.create(n), i = this._renderManagerService.getRenderById(n));
1335
+ const { mainComponent: s } = i;
1336
+ s.changeSkeleton(t), this._recalculateSizeBySkeleton(i, t);
1269
1337
  }
1270
1338
  _recalculateSizeBySkeleton(e, t) {
1271
1339
  var u;
1272
- const { mainComponent: n, scene: r, unitId: s } = e, o = n, c = (u = t.getSkeletonData()) == null ? void 0 : u.pages;
1340
+ const { mainComponent: n, scene: i, unitId: s } = e, o = n, c = (u = t.getSkeletonData()) == null ? void 0 : u.pages;
1273
1341
  if (c == null)
1274
1342
  return;
1275
- let l = 0, d = 0;
1276
- for (let _ = 0, g = c.length; _ < g; _++) {
1277
- const f = c[_], { pageWidth: p, pageHeight: a } = f;
1278
- o.pageLayoutType === it.VERTICAL ? (d += a, d += o.pageMarginTop, _ === g - 1 && (d += o.pageMarginTop), l = Math.max(l, p)) : o.pageLayoutType === it.HORIZONTAL && (l += p, _ !== g - 1 && (l += o.pageMarginLeft), d = Math.max(d, a));
1343
+ let a = 0, d = 0;
1344
+ for (let h = 0, p = c.length; h < p; h++) {
1345
+ const _ = c[h], { pageWidth: f, pageHeight: l } = _;
1346
+ o.pageLayoutType === st.VERTICAL ? (d += l, d += o.pageMarginTop, h === p - 1 && (d += o.pageMarginTop), a = Math.max(a, f)) : o.pageLayoutType === st.HORIZONTAL && (a += f, h !== p - 1 && (a += o.pageMarginLeft), d = Math.max(d, l));
1279
1347
  }
1280
- o.resize(l, d), this._editorService.isEditor(s) || r.resize(l, d);
1348
+ o.resize(a, d), this._editorService.isEditor(s) || i.resize(a, d);
1281
1349
  }
1282
1350
  _commandExecutedListener() {
1283
- const e = [Ye.id];
1351
+ const e = [Ge.id];
1284
1352
  this.disposeWithMe(
1285
1353
  this._commandService.onCommandExecuted((t) => {
1286
1354
  var n;
1287
1355
  if (e.includes(t.id)) {
1288
- const r = t.params, { unitId: s } = r, o = this._docSkeletonManagerService.getSkeletonByUnitId(s);
1356
+ const i = t.params, { unitId: s } = i, o = this._docSkeletonManagerService.getSkeletonByUnitId(s);
1289
1357
  if (o == null)
1290
1358
  return;
1291
- const { skeleton: c } = o, l = this._renderManagerService.getRenderById(s);
1292
- if (l == null)
1359
+ const { skeleton: c } = o, a = this._renderManagerService.getRenderById(s);
1360
+ if (a == null)
1293
1361
  return;
1294
1362
  if (c.calculate(), this._editorService.isEditor(s)) {
1295
- (n = l.mainComponent) == null || n.makeDirty();
1363
+ (n = a.mainComponent) == null || n.makeDirty();
1296
1364
  return;
1297
1365
  }
1298
- this._recalculateSizeBySkeleton(l, c);
1366
+ this._recalculateSizeBySkeleton(a, c);
1299
1367
  }
1300
1368
  })
1301
1369
  );
1302
1370
  }
1303
1371
  };
1304
- ve = qr([
1372
+ ve = ti([
1305
1373
  P(U.Rendered, ve),
1306
- ge(0, v(Q)),
1307
- ge(1, Y),
1308
- ge(2, O),
1309
- ge(3, $)
1374
+ pe(0, v(te)),
1375
+ pe(1, z),
1376
+ pe(2, O),
1377
+ pe(3, $)
1310
1378
  ], ve);
1311
- var Kr = Object.defineProperty, Jr = Object.getOwnPropertyDescriptor, Qr = (i, e, t, n) => {
1312
- for (var r = n > 1 ? void 0 : n ? Jr(e, t) : e, s = i.length - 1, o; s >= 0; s--)
1313
- (o = i[s]) && (r = (n ? o(e, t, r) : o(r)) || r);
1314
- return n && r && Kr(e, t, r), r;
1315
- }, $e = (i, e) => (t, n) => e(t, n, i);
1379
+ var ni = Object.defineProperty, ri = Object.getOwnPropertyDescriptor, ii = (r, e, t, n) => {
1380
+ for (var i = n > 1 ? void 0 : n ? ri(e, t) : e, s = r.length - 1, o; s >= 0; s--)
1381
+ (o = r[s]) && (i = (n ? o(e, t, i) : o(i)) || i);
1382
+ return n && i && ni(e, t, i), i;
1383
+ }, Ae = (r, e) => (t, n) => e(t, n, r);
1316
1384
  let Ce = class extends ce {
1317
1385
  constructor(e, t, n) {
1318
1386
  super();
1319
1387
  S(this, "_scene");
1320
1388
  S(this, "_currentDocumentModel");
1321
- S(this, "_fps$", new Dn(""));
1389
+ S(this, "_fps$", new $n(""));
1322
1390
  S(this, "fps$", this._fps$.asObservable());
1323
1391
  this._renderManagerService = e, this._configService = t, this._currentUniverService = n, this._initialize();
1324
1392
  }
1325
1393
  _initialize() {
1326
- this._renderManagerService.createRender$.pipe(oe(this.dispose$)).subscribe((e) => {
1394
+ this._renderManagerService.createRender$.pipe(se(this.dispose$)).subscribe((e) => {
1327
1395
  this._create(e);
1328
- }), this._currentUniverService.currentDoc$.pipe(oe(this.dispose$)).subscribe((e) => {
1396
+ }), this._currentUniverService.currentDoc$.pipe(se(this.dispose$)).subscribe((e) => {
1329
1397
  this._create(e == null ? void 0 : e.getUnitId());
1330
1398
  }), this._currentUniverService.getAllUniverDocsInstance().forEach((e) => {
1331
1399
  this._create(e.getUnitId());
@@ -1341,62 +1409,62 @@ let Ce = class extends ce {
1341
1409
  t != null && (this._currentDocumentModel = t, this._renderManagerService.has(e) || this._addNewRender());
1342
1410
  }
1343
1411
  _addNewRender() {
1344
- const e = this._currentDocumentModel, t = e.getUnitId(), n = e.getContainer(), r = e.getParentRenderUnitId();
1345
- if (n != null && r != null)
1412
+ const e = this._currentDocumentModel, t = e.getUnitId(), n = e.getContainer(), i = e.getParentRenderUnitId();
1413
+ if (n != null && i != null)
1346
1414
  throw new Error("container or parentRenderUnitId can only exist one");
1347
- n == null && r != null ? this._renderManagerService.createRenderWithParent(t, r) : this._renderManagerService.createRender(t);
1415
+ n == null && i != null ? this._renderManagerService.createRenderWithParent(t, i) : this._renderManagerService.createRender(t);
1348
1416
  const s = this._renderManagerService.getRenderById(t);
1349
1417
  if (s == null)
1350
1418
  return;
1351
1419
  const { scene: o, engine: c } = s;
1352
1420
  o.openTransformer(), this._scene = o;
1353
- const l = new vn(Pe.VIEW_MAIN, o, {
1421
+ const a = new In(Pe.VIEW_MAIN, o, {
1354
1422
  left: 0,
1355
1423
  top: 0,
1356
1424
  bottom: 0,
1357
1425
  right: 0,
1358
1426
  isWheelPreventDefaultX: !0
1359
1427
  });
1360
- o.attachControl(), o.on(Cn.wheel, (_, g) => {
1361
- const f = _;
1362
- if (f.ctrlKey) {
1363
- const p = Math.abs(f.deltaX);
1364
- let a = p < 40 ? 0.2 : p < 80 ? 0.4 : 0.2;
1365
- a *= f.deltaY > 0 ? -1 : 1, o.scaleX < 1 && (a /= 2), o.scaleX + a > 4 ? o.scale(4, 4) : o.scaleX + a < 0.1 ? o.scale(0.1, 0.1) : f.preventDefault();
1428
+ o.attachControl(), o.on(Mn.wheel, (h, p) => {
1429
+ const _ = h;
1430
+ if (_.ctrlKey) {
1431
+ const f = Math.abs(_.deltaX);
1432
+ let l = f < 40 ? 0.2 : f < 80 ? 0.4 : 0.2;
1433
+ l *= _.deltaY > 0 ? -1 : 1, o.scaleX < 1 && (l /= 2), o.scaleX + l > 4 ? o.scale(4, 4) : o.scaleX + l < 0.1 ? o.scale(0.1, 0.1) : _.preventDefault();
1366
1434
  } else
1367
- l.onMouseWheel(f, g);
1368
- }), this._configService.getConfig("hasScroll") !== !1 && new Fe(l), o.addLayer(
1369
- new ot(o, [], tt),
1370
- new ot(o, [], gn)
1435
+ a.onMouseWheel(_, p);
1436
+ }), this._configService.getConfig("hasScroll") !== !1 && new je(a), o.addLayer(
1437
+ new ct(o, [], rt),
1438
+ new ct(o, [], Cn)
1371
1439
  ), this._addComponent(s), this._currentDocumentModel.getShouldRenderLoopImmediately() && c.runRenderLoop(() => {
1372
1440
  o.render(), this._fps$.next(Math.round(c.getFps()).toString());
1373
1441
  }), this._renderManagerService.setCurrent(t);
1374
1442
  }
1375
1443
  _addComponent(e) {
1376
- const t = this._scene, n = this._currentDocumentModel, r = new On(nt.MAIN, void 0, {
1444
+ const t = this._scene, n = this._currentDocumentModel, i = new yn(it.MAIN, void 0, {
1377
1445
  pageMarginLeft: n.documentStyle.marginLeft || 0,
1378
1446
  pageMarginTop: n.documentStyle.marginTop || 0
1379
1447
  });
1380
- r.zIndex = fn, e.mainComponent = r, e.components.set(nt.MAIN, r), t.addObjects([r], tt);
1448
+ i.zIndex = On, e.mainComponent = i, e.components.set(it.MAIN, i), t.addObjects([i], rt);
1381
1449
  }
1382
1450
  };
1383
- Ce = Qr([
1451
+ Ce = ii([
1384
1452
  P(U.Starting, Ce),
1385
- $e(0, Y),
1386
- $e(1, Nt),
1387
- $e(2, M)
1453
+ Ae(0, z),
1454
+ Ae(1, Bt),
1455
+ Ae(2, M)
1388
1456
  ], Ce);
1389
- var ei = Object.defineProperty, ti = Object.getOwnPropertyDescriptor, ni = (i, e, t, n) => {
1390
- for (var r = n > 1 ? void 0 : n ? ti(e, t) : e, s = i.length - 1, o; s >= 0; s--)
1391
- (o = i[s]) && (r = (n ? o(e, t, r) : o(r)) || r);
1392
- return n && r && ei(e, t, r), r;
1393
- }, Z = (i, e) => (t, n) => e(t, n, i);
1394
- let Oe = class extends H {
1395
- constructor(e, t, n, r, s, o) {
1457
+ var oi = Object.defineProperty, si = Object.getOwnPropertyDescriptor, ci = (r, e, t, n) => {
1458
+ for (var i = n > 1 ? void 0 : n ? si(e, t) : e, s = r.length - 1, o; s >= 0; s--)
1459
+ (o = r[s]) && (i = (n ? o(e, t, i) : o(i)) || i);
1460
+ return n && i && oi(e, t, i), i;
1461
+ }, q = (r, e) => (t, n) => e(t, n, r);
1462
+ let Oe = class extends Y {
1463
+ constructor(e, t, n, i, s, o) {
1396
1464
  super();
1397
- S(this, "_liquid", new Rn());
1465
+ S(this, "_liquid", new En());
1398
1466
  S(this, "_pageMarginCache", /* @__PURE__ */ new Map());
1399
- this._docSkeletonManagerService = e, this._currentUniverService = t, this._renderManagerService = n, this._commandService = r, this._floatingObjectManagerService = s, this._editorService = o, this._initialize(), this._commandExecutedListener();
1467
+ this._docSkeletonManagerService = e, this._currentUniverService = t, this._renderManagerService = n, this._commandService = i, this._floatingObjectManagerService = s, this._editorService = o, this._initialize(), this._commandExecutedListener();
1400
1468
  }
1401
1469
  _initialize() {
1402
1470
  this._initialRenderRefresh(), this._updateOnPluginChange();
@@ -1406,42 +1474,42 @@ let Oe = class extends H {
1406
1474
  const t = this._docSkeletonManagerService.getCurrent();
1407
1475
  if (t == null)
1408
1476
  return;
1409
- const { unitId: n, skeleton: r } = t, s = this._renderManagerService.getRenderById(n);
1477
+ const { unitId: n, skeleton: i } = t, s = this._renderManagerService.getRenderById(n);
1410
1478
  if (s == null)
1411
1479
  return;
1412
- const { mainComponent: o, components: c, scene: l } = s, d = o, { left: u, top: _ } = d;
1413
- e.forEach((g) => {
1414
- const { unitId: f, subUnitId: p, floatingObjectId: a, floatingObject: h } = g, { left: C = 0, top: R = 0, width: w = 0, height: B = 0, angle: F, flipX: X, flipY: G, skewX: he, skewY: _e } = h, b = this._pageMarginCache.get(a), Mt = (b == null ? void 0 : b.marginLeft) || 0, yt = (b == null ? void 0 : b.marginTop) || 0;
1415
- r == null || r.getViewModel().getDataModel().updateDrawing(a, {
1416
- left: C - u - Mt,
1417
- top: R - _ - yt,
1418
- height: B,
1480
+ const { mainComponent: o, components: c, scene: a } = s, d = o, { left: u, top: h } = d;
1481
+ e.forEach((p) => {
1482
+ const { unitId: _, subUnitId: f, floatingObjectId: l, floatingObject: g } = p, { left: C = 0, top: R = 0, width: w = 0, height: F = 0, angle: B, flipX: X, flipY: G, skewX: he, skewY: _e } = g, b = this._pageMarginCache.get(l), xt = (b == null ? void 0 : b.marginLeft) || 0, Pt = (b == null ? void 0 : b.marginTop) || 0;
1483
+ i == null || i.getViewModel().getDataModel().updateDrawing(l, {
1484
+ left: C - u - xt,
1485
+ top: R - h - Pt,
1486
+ height: F,
1419
1487
  width: w
1420
1488
  });
1421
- }), r == null || r.calculate(), o == null || o.makeDirty();
1489
+ }), i == null || i.calculate(), o == null || o.makeDirty();
1422
1490
  });
1423
1491
  }
1424
1492
  _initialRenderRefresh() {
1425
1493
  this._docSkeletonManagerService.currentSkeleton$.subscribe((e) => {
1426
1494
  if (e == null)
1427
1495
  return;
1428
- const { skeleton: t, unitId: n } = e, r = this._renderManagerService.getRenderById(n);
1429
- if (r == null)
1496
+ const { skeleton: t, unitId: n } = e, i = this._renderManagerService.getRenderById(n);
1497
+ if (i == null)
1430
1498
  return;
1431
- const { mainComponent: s } = r;
1432
- s.changeSkeleton(t), this._refreshFloatingObject(n, t, r);
1499
+ const { mainComponent: s } = i;
1500
+ s.changeSkeleton(t), this._refreshFloatingObject(n, t, i);
1433
1501
  });
1434
1502
  }
1435
1503
  _commandExecutedListener() {
1436
- const e = [Ye.id, Xe.id];
1504
+ const e = [Ge.id, Ze.id];
1437
1505
  this.disposeWithMe(
1438
1506
  this._commandService.onCommandExecuted((t) => {
1439
1507
  var n;
1440
1508
  if (e.includes(t.id)) {
1441
- const r = t.params, { unitId: s } = r, o = this._docSkeletonManagerService.getCurrent();
1509
+ const i = t.params, { unitId: s } = i, o = this._docSkeletonManagerService.getCurrent();
1442
1510
  if (o == null)
1443
1511
  return;
1444
- const { unitId: c, skeleton: l } = o;
1512
+ const { unitId: c, skeleton: a } = o;
1445
1513
  if (s !== c)
1446
1514
  return;
1447
1515
  const d = this._renderManagerService.getRenderById(c);
@@ -1451,27 +1519,27 @@ let Oe = class extends H {
1451
1519
  (n = d.mainComponent) == null || n.makeDirty();
1452
1520
  return;
1453
1521
  }
1454
- this._refreshFloatingObject(c, l, d);
1522
+ this._refreshFloatingObject(c, a, d);
1455
1523
  }
1456
1524
  })
1457
1525
  );
1458
1526
  }
1459
1527
  _refreshFloatingObject(e, t, n) {
1460
- const r = t == null ? void 0 : t.getSkeletonData(), { mainComponent: s, scene: o } = n, c = s;
1461
- if (!r)
1528
+ const i = t == null ? void 0 : t.getSkeletonData(), { mainComponent: s, scene: o } = n, c = s;
1529
+ if (!i)
1462
1530
  return;
1463
- const { left: l, top: d, pageLayoutType: u, pageMarginLeft: _, pageMarginTop: g } = c, { pages: f } = r, p = [];
1531
+ const { left: a, top: d, pageLayoutType: u, pageMarginLeft: h, pageMarginTop: p } = c, { pages: _ } = i, f = [];
1464
1532
  o.getAncestorScale(), this._liquid.reset(), this._pageMarginCache.clear();
1465
- for (let a = 0, h = f.length; a < h; a++) {
1466
- const C = f[a], { skeDrawings: R, marginLeft: w, marginTop: B } = C;
1467
- this._liquid.translatePagePadding(C), R.forEach((F) => {
1468
- const { aLeft: X, aTop: G, height: he, width: _e, objectId: b } = F;
1469
- p.push({
1533
+ for (let l = 0, g = _.length; l < g; l++) {
1534
+ const C = _[l], { skeDrawings: R, marginLeft: w, marginTop: F } = C;
1535
+ this._liquid.translatePagePadding(C), R.forEach((B) => {
1536
+ const { aLeft: X, aTop: G, height: he, width: _e, objectId: b } = B;
1537
+ f.push({
1470
1538
  unitId: e,
1471
- subUnitId: $t,
1539
+ subUnitId: jt,
1472
1540
  floatingObjectId: b,
1473
1541
  floatingObject: {
1474
- left: X + l + this._liquid.x,
1542
+ left: X + a + this._liquid.x,
1475
1543
  top: G + d + this._liquid.y,
1476
1544
  width: _e,
1477
1545
  height: he
@@ -1480,55 +1548,55 @@ let Oe = class extends H {
1480
1548
  marginLeft: this._liquid.x,
1481
1549
  marginTop: this._liquid.y
1482
1550
  });
1483
- }), this._liquid.translatePage(C, u, _, g);
1551
+ }), this._liquid.translatePage(C, u, h, p);
1484
1552
  }
1485
- this._floatingObjectManagerService.BatchAddOrUpdate(p);
1553
+ this._floatingObjectManagerService.BatchAddOrUpdate(f);
1486
1554
  }
1487
1555
  };
1488
- Oe = ni([
1556
+ Oe = ci([
1489
1557
  P(U.Steady, Oe),
1490
- Z(0, v(Q)),
1491
- Z(1, M),
1492
- Z(2, Y),
1493
- Z(3, O),
1494
- Z(4, At),
1495
- Z(5, $)
1558
+ q(0, v(te)),
1559
+ q(1, M),
1560
+ q(2, z),
1561
+ q(3, O),
1562
+ q(4, Wt),
1563
+ q(5, $)
1496
1564
  ], Oe);
1497
- var ri = Object.defineProperty, ii = Object.getOwnPropertyDescriptor, oi = (i, e, t, n) => {
1498
- for (var r = n > 1 ? void 0 : n ? ii(e, t) : e, s = i.length - 1, o; s >= 0; s--)
1499
- (o = i[s]) && (r = (n ? o(e, t, r) : o(r)) || r);
1500
- return n && r && ri(e, t, r), r;
1501
- }, Ae = (i, e) => (t, n) => e(t, n, i);
1502
- const si = "rgba(198, 198, 198, 1)", ci = "rgba(255, 255, 255, 1)";
1503
- let Re = class extends H {
1504
- constructor(i, e, t) {
1505
- super(), this._renderManagerService = i, this._editorService = e, this._currentUniverService = t, this._initialize(), this._commandExecutedListener();
1565
+ var ai = Object.defineProperty, li = Object.getOwnPropertyDescriptor, di = (r, e, t, n) => {
1566
+ for (var i = n > 1 ? void 0 : n ? li(e, t) : e, s = r.length - 1, o; s >= 0; s--)
1567
+ (o = r[s]) && (i = (n ? o(e, t, i) : o(i)) || i);
1568
+ return n && i && ai(e, t, i), i;
1569
+ }, we = (r, e) => (t, n) => e(t, n, r);
1570
+ const ui = "rgba(198, 198, 198, 1)", hi = "rgba(255, 255, 255, 1)";
1571
+ let Re = class extends Y {
1572
+ constructor(r, e, t) {
1573
+ super(), this._renderManagerService = r, this._editorService = e, this._currentUniverService = t, this._initialize(), this._commandExecutedListener();
1506
1574
  }
1507
1575
  _initialize() {
1508
1576
  this._initialRenderRefresh();
1509
1577
  }
1510
1578
  _initialRenderRefresh() {
1511
- this._renderManagerService.currentRender$.subscribe((i) => {
1579
+ this._renderManagerService.currentRender$.subscribe((r) => {
1512
1580
  var s;
1513
- if (i == null)
1581
+ if (r == null)
1514
1582
  return;
1515
- const e = this._renderManagerService.getRenderById(i);
1516
- if (this._editorService.isEditor(i) || this._currentUniverService.getUniverDocInstance(i) == null || e == null)
1583
+ const e = this._renderManagerService.getRenderById(r);
1584
+ if (this._editorService.isEditor(r) || this._currentUniverService.getUniverDocInstance(r) == null || e == null)
1517
1585
  return;
1518
- const { mainComponent: t } = e, n = t, r = (s = n.getSkeleton()) == null ? void 0 : s.getPageSize();
1586
+ const { mainComponent: t } = e, n = t, i = (s = n.getSkeleton()) == null ? void 0 : s.getPageSize();
1519
1587
  this.disposeWithMe(
1520
1588
  N(
1521
1589
  n.onPageRenderObservable.add((o) => {
1522
- var a, h, C, R;
1523
- if (this._editorService.isEditor(i))
1590
+ var l, g, C, R;
1591
+ if (this._editorService.isEditor(r))
1524
1592
  return;
1525
- const { page: c, pageLeft: l, pageTop: d, ctx: u } = o, { width: _, pageWidth: g, height: f, pageHeight: p } = c;
1526
- u.save(), u.translate(l - 0.5, d - 0.5), bn.drawWith(u, {
1527
- width: (h = (a = r == null ? void 0 : r.width) != null ? a : g) != null ? h : _,
1528
- height: (R = (C = r == null ? void 0 : r.height) != null ? C : p) != null ? R : f,
1593
+ const { page: c, pageLeft: a, pageTop: d, ctx: u } = o, { width: h, pageWidth: p, height: _, pageHeight: f } = c;
1594
+ u.save(), u.translate(a - 0.5, d - 0.5), Dn.drawWith(u, {
1595
+ width: (g = (l = i == null ? void 0 : i.width) != null ? l : p) != null ? g : h,
1596
+ height: (R = (C = i == null ? void 0 : i.height) != null ? C : f) != null ? R : _,
1529
1597
  strokeWidth: 1,
1530
- stroke: si,
1531
- fill: ci,
1598
+ stroke: ui,
1599
+ fill: hi,
1532
1600
  zIndex: 3
1533
1601
  }), u.restore();
1534
1602
  })
@@ -1539,22 +1607,22 @@ let Re = class extends H {
1539
1607
  _commandExecutedListener() {
1540
1608
  }
1541
1609
  };
1542
- Re = oi([
1610
+ Re = di([
1543
1611
  P(U.Rendered, Re),
1544
- Ae(0, Y),
1545
- Ae(1, $),
1546
- Ae(2, M)
1612
+ we(0, z),
1613
+ we(1, $),
1614
+ we(2, M)
1547
1615
  ], Re);
1548
- var ai = Object.defineProperty, li = Object.getOwnPropertyDescriptor, di = (i, e, t, n) => {
1549
- for (var r = n > 1 ? void 0 : n ? li(e, t) : e, s = i.length - 1, o; s >= 0; s--)
1550
- (o = i[s]) && (r = (n ? o(e, t, r) : o(r)) || r);
1551
- return n && r && ai(e, t, r), r;
1552
- }, q = (i, e) => (t, n) => e(t, n, i);
1553
- let be = class extends H {
1554
- constructor(e, t, n, r, s, o) {
1616
+ var _i = Object.defineProperty, gi = Object.getOwnPropertyDescriptor, pi = (r, e, t, n) => {
1617
+ for (var i = n > 1 ? void 0 : n ? gi(e, t) : e, s = r.length - 1, o; s >= 0; s--)
1618
+ (o = r[s]) && (i = (n ? o(e, t, i) : o(i)) || i);
1619
+ return n && i && _i(e, t, i), i;
1620
+ }, K = (r, e) => (t, n) => e(t, n, r);
1621
+ let be = class extends Y {
1622
+ constructor(e, t, n, i, s, o) {
1555
1623
  super();
1556
1624
  S(this, "_initializedRender", /* @__PURE__ */ new Set());
1557
- this._docSkeletonManagerService = e, this._currentUniverService = t, this._commandService = n, this._renderManagerService = r, this._textSelectionManagerService = s, this._editorService = o, this._initialize();
1625
+ this._docSkeletonManagerService = e, this._currentUniverService = t, this._commandService = n, this._renderManagerService = i, this._textSelectionManagerService = s, this._editorService = o, this._initialize();
1558
1626
  }
1559
1627
  dispose() {
1560
1628
  super.dispose();
@@ -1570,20 +1638,20 @@ let be = class extends H {
1570
1638
  if (n == null || this._initializedRender.has(t) || this._editorService.isEditor(t))
1571
1639
  return;
1572
1640
  this._initializedRender.add(t);
1573
- const { scene: r } = n;
1641
+ const { scene: i } = n;
1574
1642
  this.disposeWithMe(
1575
1643
  N(
1576
- r.onMouseWheelObserver.add((s) => {
1644
+ i.onMouseWheelObserver.add((s) => {
1577
1645
  if (!s.ctrlKey)
1578
1646
  return;
1579
1647
  const o = Math.abs(s.deltaX);
1580
1648
  let c = o < 40 ? 0.2 : o < 80 ? 0.4 : 0.2;
1581
- c *= s.deltaY > 0 ? -1 : 1, r.scaleX < 1 && (c /= 2);
1582
- const l = this._currentUniverService.getCurrentUniverDocInstance(), d = l.zoomRatio;
1649
+ c *= s.deltaY > 0 ? -1 : 1, i.scaleX < 1 && (c /= 2);
1650
+ const a = this._currentUniverService.getCurrentUniverDocInstance(), d = a.zoomRatio;
1583
1651
  let u = +Number.parseFloat(`${d + c}`).toFixed(1);
1584
- u = u >= 4 ? 4 : u <= 0.1 ? 0.1 : u, this._commandService.executeCommand(Sn.id, {
1652
+ u = u >= 4 ? 4 : u <= 0.1 ? 0.1 : u, this._commandService.executeCommand(Rn.id, {
1585
1653
  zoomRatio: u,
1586
- unitId: l.getUnitId()
1654
+ unitId: a.getUnitId()
1587
1655
  }), s.preventDefault();
1588
1656
  })
1589
1657
  )
@@ -1610,11 +1678,11 @@ let be = class extends H {
1610
1678
  );
1611
1679
  }
1612
1680
  _commandExecutedListener() {
1613
- const e = [Xe.id];
1681
+ const e = [Ze.id];
1614
1682
  this.disposeWithMe(
1615
1683
  this._commandService.onCommandExecuted((t) => {
1616
1684
  if (e.includes(t.id)) {
1617
- const n = this._currentUniverService.getCurrentUniverDocInstance(), r = t.params, { unitId: s } = r;
1685
+ const n = this._currentUniverService.getCurrentUniverDocInstance(), i = t.params, { unitId: s } = i;
1618
1686
  if (s !== n.getUnitId())
1619
1687
  return;
1620
1688
  const o = n.zoomRatio || 1;
@@ -1624,20 +1692,20 @@ let be = class extends H {
1624
1692
  );
1625
1693
  }
1626
1694
  _updateViewZoom(e, t = !0) {
1627
- var r;
1695
+ var i;
1628
1696
  const n = this._getDocObject();
1629
- n != null && (n.scene.scale(e, e), this._calculatePagePosition(n, e), t && this._textSelectionManagerService.refreshSelection(), (r = n.scene.getTransformer()) == null || r.hideControl());
1697
+ n != null && (n.scene.scale(e, e), this._calculatePagePosition(n, e), t && this._textSelectionManagerService.refreshSelection(), (i = n.scene.getTransformer()) == null || i.hideControl());
1630
1698
  }
1631
1699
  _calculatePagePosition(e, t) {
1632
- const { document: n, scene: r } = e, s = r == null ? void 0 : r.getParent(), { width: o, height: c, pageMarginLeft: l, pageMarginTop: d } = n;
1700
+ const { document: n, scene: i } = e, s = i == null ? void 0 : i.getParent(), { width: o, height: c, pageMarginLeft: a, pageMarginTop: d } = n;
1633
1701
  if (s == null || o === Number.POSITIVE_INFINITY || c === Number.POSITIVE_INFINITY)
1634
1702
  return;
1635
- const { width: u, height: _ } = s;
1636
- let g = 0, f = 0, p = 0, a = 0, h = Number.POSITIVE_INFINITY;
1637
- u > (o + l * 2) * t ? (g = u / 2 - o * t / 2, g /= t, p = (u - l * 2) / t, h = 0) : (g = l, p = o + l * 2, h = (p - u / t) / 2), _ > c ? (f = _ / 2 - c / 2, a = (_ - d * 2) / t) : (f = d, a = c + d * 2), r.resize(p, a + 200), n.translate(g, f);
1638
- const C = r.getViewport(Pe.VIEW_MAIN);
1639
- if (h !== Number.POSITIVE_INFINITY && C != null) {
1640
- const R = C.getBarScroll(h, 0).x;
1703
+ const { width: u, height: h } = s;
1704
+ let p = 0, _ = 0, f = 0, l = 0, g = Number.POSITIVE_INFINITY;
1705
+ u > (o + a * 2) * t ? (p = u / 2 - o * t / 2, p /= t, f = (u - a * 2) / t, g = 0) : (p = a, f = o + a * 2, g = (f - u / t) / 2), h > c ? (_ = h / 2 - c / 2, l = (h - d * 2) / t) : (_ = d, l = c + d * 2), i.resize(f, l + 200), n.translate(p, _);
1706
+ const C = i.getViewport(Pe.VIEW_MAIN);
1707
+ if (g !== Number.POSITIVE_INFINITY && C != null) {
1708
+ const R = C.getBarScroll(g, 0).x;
1641
1709
  C.scrollTo({
1642
1710
  x: R
1643
1711
  });
@@ -1645,28 +1713,28 @@ let be = class extends H {
1645
1713
  return this;
1646
1714
  }
1647
1715
  _getDocObject() {
1648
- return vt(this._currentUniverService, this._renderManagerService);
1716
+ return Rt(this._currentUniverService, this._renderManagerService);
1649
1717
  }
1650
1718
  };
1651
- be = di([
1719
+ be = pi([
1652
1720
  P(U.Rendered, be),
1653
- q(0, v(Q)),
1654
- q(1, M),
1655
- q(2, O),
1656
- q(3, Y),
1657
- q(4, v(le)),
1658
- q(5, $)
1721
+ K(0, v(te)),
1722
+ K(1, M),
1723
+ K(2, O),
1724
+ K(3, z),
1725
+ K(4, v(le)),
1726
+ K(5, $)
1659
1727
  ], be);
1660
- var ui = Object.defineProperty, hi = Object.getOwnPropertyDescriptor, _i = (i, e, t, n) => {
1661
- for (var r = n > 1 ? void 0 : n ? hi(e, t) : e, s = i.length - 1, o; s >= 0; s--)
1662
- (o = i[s]) && (r = (n ? o(e, t, r) : o(r)) || r);
1663
- return n && r && ui(e, t, r), r;
1664
- }, k = (i, e) => (t, n) => e(t, n, i);
1665
- let Ie = class extends H {
1666
- constructor(e, t, n, r, s, o, c) {
1728
+ var fi = Object.defineProperty, Si = Object.getOwnPropertyDescriptor, mi = (r, e, t, n) => {
1729
+ for (var i = n > 1 ? void 0 : n ? Si(e, t) : e, s = r.length - 1, o; s >= 0; s--)
1730
+ (o = r[s]) && (i = (n ? o(e, t, i) : o(i)) || i);
1731
+ return n && i && fi(e, t, i), i;
1732
+ }, H = (r, e) => (t, n) => e(t, n, r);
1733
+ let Te = class extends Y {
1734
+ constructor(e, t, n, i, s, o, c) {
1667
1735
  super();
1668
1736
  S(this, "_loadedMap", /* @__PURE__ */ new WeakSet());
1669
- this._docSkeletonManagerService = e, this._currentUniverService = t, this._commandService = n, this._renderManagerService = r, this._textSelectionRenderManager = s, this._textSelectionManagerService = o, this._editorService = c, this._initialize();
1737
+ this._docSkeletonManagerService = e, this._currentUniverService = t, this._commandService = n, this._renderManagerService = i, this._textSelectionRenderManager = s, this._textSelectionManagerService = o, this._editorService = c, this._initialize();
1670
1738
  }
1671
1739
  _initialize() {
1672
1740
  this._init(), this._skeletonListener(), this._commandExecutedListener();
@@ -1690,17 +1758,17 @@ let Ie = class extends H {
1690
1758
  const t = this._getDocObjectById(e);
1691
1759
  if (t == null)
1692
1760
  return;
1693
- const { document: n, scene: r } = t;
1761
+ const { document: n, scene: i } = t;
1694
1762
  this.disposeWithMe(
1695
1763
  N(
1696
1764
  n.onPointerEnterObserver.add(() => {
1697
- this._isEditorReadOnly(e) || (n.cursor = st.TEXT);
1765
+ this._isEditorReadOnly(e) || (n.cursor = at.TEXT);
1698
1766
  })
1699
1767
  )
1700
1768
  ), this.disposeWithMe(
1701
1769
  N(
1702
1770
  n.onPointerLeaveObserver.add(() => {
1703
- n.cursor = st.DEFAULT, r.resetCursor();
1771
+ n.cursor = at.DEFAULT, i.resetCursor();
1704
1772
  })
1705
1773
  )
1706
1774
  ), this.disposeWithMe(
@@ -1708,19 +1776,21 @@ let Ie = class extends H {
1708
1776
  n == null ? void 0 : n.onPointerDownObserver.add((s, o) => {
1709
1777
  if (this._isEditorReadOnly(e))
1710
1778
  return;
1711
- this._currentUniverService.getCurrentUniverDocInstance().getUnitId() !== e && this._currentUniverService.setCurrentUniverDocInstance(e), this._textSelectionRenderManager.eventTrigger(s), this._setEditorFocus(e), s.button !== 2 && o.stopPropagation();
1779
+ this._currentUniverService.getCurrentUniverDocInstance().getUnitId() !== e && this._currentUniverService.setCurrentUniverDocInstance(e), this._editorService.getEditor(e) ? setTimeout(() => {
1780
+ this._textSelectionRenderManager.eventTrigger(s), this._setEditorFocus(e);
1781
+ }, 0) : this._textSelectionRenderManager.eventTrigger(s), s.button !== 2 && o.stopPropagation();
1712
1782
  })
1713
1783
  )
1714
1784
  ), this.disposeWithMe(
1715
1785
  N(
1716
1786
  n == null ? void 0 : n.onDblclickObserver.add((s) => {
1717
- this._textSelectionRenderManager.handleDblClick(s);
1787
+ this._isEditorReadOnly(e) || this._textSelectionRenderManager.handleDblClick(s);
1718
1788
  })
1719
1789
  )
1720
1790
  ), this.disposeWithMe(
1721
1791
  N(
1722
1792
  n == null ? void 0 : n.onTripleClickObserver.add((s) => {
1723
- this._textSelectionRenderManager.handleTripleClick(s);
1793
+ this._isEditorReadOnly(e) || this._textSelectionRenderManager.handleTripleClick(s);
1724
1794
  })
1725
1795
  )
1726
1796
  );
@@ -1737,12 +1807,12 @@ let Ie = class extends H {
1737
1807
  this._editorService.focusStyle(e);
1738
1808
  }
1739
1809
  _commandExecutedListener() {
1740
- const e = [Xe.id];
1810
+ const e = [Ze.id];
1741
1811
  this.disposeWithMe(
1742
1812
  this._commandService.onCommandExecuted((t) => {
1743
1813
  var n;
1744
1814
  if (e.includes(t.id)) {
1745
- const r = t.params, { unitId: s } = r, o = (n = this._textSelectionManagerService.getCurrentSelection()) == null ? void 0 : n.unitId;
1815
+ const i = t.params, { unitId: s } = i, o = (n = this._textSelectionManagerService.getCurrentSelection()) == null ? void 0 : n.unitId;
1746
1816
  if (s !== o)
1747
1817
  return;
1748
1818
  this._textSelectionManagerService.refreshSelection();
@@ -1755,10 +1825,10 @@ let Ie = class extends H {
1755
1825
  this._docSkeletonManagerService.currentSkeleton$.subscribe((e) => {
1756
1826
  if (e == null)
1757
1827
  return;
1758
- const { unitId: t, skeleton: n } = e, r = this._renderManagerService.getRenderById(t);
1759
- if (r == null)
1828
+ const { unitId: t, skeleton: n } = e, i = this._renderManagerService.getRenderById(t);
1829
+ if (i == null)
1760
1830
  return;
1761
- const { scene: s, mainComponent: o } = r;
1831
+ const { scene: s, mainComponent: o } = i;
1762
1832
  this._textSelectionRenderManager.changeRuntime(n, s, o), this._textSelectionManagerService.setCurrentSelectionNotRefresh({
1763
1833
  unitId: t,
1764
1834
  subUnitId: ""
@@ -1767,83 +1837,83 @@ let Ie = class extends H {
1767
1837
  );
1768
1838
  }
1769
1839
  _getDocObjectById(e) {
1770
- return mn(e, this._renderManagerService);
1840
+ return bn(e, this._renderManagerService);
1771
1841
  }
1772
1842
  };
1773
- Ie = _i([
1774
- P(U.Rendered, Ie),
1775
- k(0, v(Q)),
1776
- k(1, M),
1777
- k(2, O),
1778
- k(3, Y),
1779
- k(4, de),
1780
- k(5, v(le)),
1781
- k(6, $)
1782
- ], Ie);
1783
- var pi = Object.defineProperty, gi = Object.getOwnPropertyDescriptor, fi = (i, e, t, n) => {
1784
- for (var r = n > 1 ? void 0 : n ? gi(e, t) : e, s = i.length - 1, o; s >= 0; s--)
1785
- (o = i[s]) && (r = (n ? o(e, t, r) : o(r)) || r);
1786
- return n && r && pi(e, t, r), r;
1787
- }, re = (i, e) => (t, n) => e(t, n, i);
1788
- const ut = 1.5;
1789
- let Te = class extends ce {
1790
- constructor(i, e, t, n, r) {
1791
- super(), this._docSkeletonManagerService = i, this._textSelectionManagerService = e, this._editorService = t, this._currentUniverService = n, this._renderManagerService = r, this._init();
1843
+ Te = mi([
1844
+ P(U.Rendered, Te),
1845
+ H(0, v(te)),
1846
+ H(1, M),
1847
+ H(2, O),
1848
+ H(3, z),
1849
+ H(4, de),
1850
+ H(5, v(le)),
1851
+ H(6, $)
1852
+ ], Te);
1853
+ var vi = Object.defineProperty, Ci = Object.getOwnPropertyDescriptor, Oi = (r, e, t, n) => {
1854
+ for (var i = n > 1 ? void 0 : n ? Ci(e, t) : e, s = r.length - 1, o; s >= 0; s--)
1855
+ (o = r[s]) && (i = (n ? o(e, t, i) : o(i)) || i);
1856
+ return n && i && vi(e, t, i), i;
1857
+ }, ie = (r, e) => (t, n) => e(t, n, r);
1858
+ const pt = 1.5;
1859
+ let Ie = class extends ce {
1860
+ constructor(r, e, t, n, i) {
1861
+ super(), this._docSkeletonManagerService = r, this._textSelectionManagerService = e, this._editorService = t, this._currentUniverService = n, this._renderManagerService = i, this._init();
1792
1862
  }
1793
1863
  _init() {
1794
- this._textSelectionManagerService.textSelection$.pipe(oe(this.dispose$)).subscribe((i) => {
1795
- if (i == null)
1864
+ this._textSelectionManagerService.textSelection$.pipe(se(this.dispose$)).subscribe((r) => {
1865
+ if (r == null)
1796
1866
  return;
1797
- const { isEditing: e, unitId: t } = i;
1867
+ const { isEditing: e, unitId: t } = r;
1798
1868
  e && this._scrollToSelection(t);
1799
1869
  });
1800
1870
  }
1801
1871
  // Let the selection show on the current screen.
1802
- _scrollToSelection(i) {
1872
+ _scrollToSelection(r) {
1803
1873
  var b;
1804
1874
  const e = this._textSelectionManagerService.getActiveRange(), t = this._getDocObject(), n = (b = this._docSkeletonManagerService.getCurrent()) == null ? void 0 : b.skeleton;
1805
1875
  if (e == null || t == null || n == null)
1806
1876
  return;
1807
- const { collapsed: r, startNodePosition: s } = e;
1808
- if (!r)
1877
+ const { collapsed: i, startNodePosition: s } = e;
1878
+ if (!i)
1809
1879
  return;
1810
- const o = t.document.getOffsetConfig(), { docsLeft: c, docsTop: l } = o, d = new In(o, n), { contentBoxPointGroup: u } = d.getRangePointData(s, s), { left: _, top: g, height: f } = Tn(u), p = _ + c, a = g + l, h = t.scene.getViewport(Pe.VIEW_MAIN), C = !!this._editorService.getEditor(i);
1811
- if (h == null)
1880
+ const o = t.document.getOffsetConfig(), { docsLeft: c, docsTop: a } = o, d = new xn(o, n), { contentBoxPointGroup: u } = d.getRangePointData(s, s), { left: h, top: p, height: _ } = Pn(u), f = h + c, l = p + a, g = t.scene.getViewport(Pe.VIEW_MAIN), C = !!this._editorService.getEditor(r);
1881
+ if (g == null)
1812
1882
  return;
1813
1883
  const {
1814
1884
  left: R,
1815
1885
  top: w,
1816
- right: B,
1817
- bottom: F
1818
- } = h.getBounding().viewBound;
1886
+ right: F,
1887
+ bottom: B
1888
+ } = g.getBounding().viewBound;
1819
1889
  let X = 0, G = 0;
1820
1890
  const he = C ? 0 : 100;
1821
- a < w ? X = a - w : a > F - f && (X = a - F + f + he), p < R ? G = p - R : p > B - ut && (G = p - B + ut);
1822
- const _e = h.getBarScroll(G, X);
1823
- h.scrollBy(_e);
1891
+ l < w ? X = l - w : l > B - _ && (X = l - B + _ + he), f < R ? G = f - R : f > F - pt && (G = f - F + pt);
1892
+ const _e = g.getBarScroll(G, X);
1893
+ g.scrollBy(_e);
1824
1894
  }
1825
1895
  _getDocObject() {
1826
- return vt(this._currentUniverService, this._renderManagerService);
1896
+ return Rt(this._currentUniverService, this._renderManagerService);
1827
1897
  }
1828
1898
  };
1829
- Te = fi([
1830
- P(U.Rendered, Te),
1831
- re(0, v(Q)),
1832
- re(1, v(le)),
1833
- re(2, $),
1834
- re(3, M),
1835
- re(4, Y)
1836
- ], Te);
1837
- var Si = Object.defineProperty, mi = Object.getOwnPropertyDescriptor, vi = (i, e, t, n) => {
1838
- for (var r = n > 1 ? void 0 : n ? mi(e, t) : e, s = i.length - 1, o; s >= 0; s--)
1839
- (o = i[s]) && (r = (n ? o(e, t, r) : o(r)) || r);
1840
- return n && r && Si(e, t, r), r;
1841
- }, we = (i, e) => (t, n) => e(t, n, i), Be;
1842
- let ht = (Be = class extends wt {
1843
- constructor(i, e, t, n) {
1844
- super(Ln), this._config = i, this._injector = e, this._localeService = t, this._logService = n, this._localeService.load({
1845
- zhCN: Cr
1846
- }), this._config = pt.deepMerge({}, Un, this._config), this._initDependencies(e), this._initializeCommands();
1899
+ Ie = Oi([
1900
+ P(U.Rendered, Ie),
1901
+ ie(0, v(te)),
1902
+ ie(1, v(le)),
1903
+ ie(2, $),
1904
+ ie(3, M),
1905
+ ie(4, z)
1906
+ ], Ie);
1907
+ var Ri = Object.defineProperty, bi = Object.getOwnPropertyDescriptor, Ti = (r, e, t, n) => {
1908
+ for (var i = n > 1 ? void 0 : n ? bi(e, t) : e, s = r.length - 1, o; s >= 0; s--)
1909
+ (o = r[s]) && (i = (n ? o(e, t, i) : o(i)) || i);
1910
+ return n && i && Ri(e, t, i), i;
1911
+ }, Fe = (r, e) => (t, n) => e(t, n, r), Be;
1912
+ let ft = (Be = class extends zt {
1913
+ constructor(r, e, t, n) {
1914
+ super(Bn), this._config = r, this._injector = e, this._localeService = t, this._logService = n, this._localeService.load({
1915
+ zhCN: Mr
1916
+ }), this._config = He.deepMerge({}, Fn, this._config), this._initDependencies(e), this._initializeCommands();
1847
1917
  }
1848
1918
  onRendered() {
1849
1919
  this._initModules(), this._markDocAsFocused();
@@ -1852,23 +1922,23 @@ let ht = (Be = class extends wt {
1852
1922
  }
1853
1923
  _initializeCommands() {
1854
1924
  [
1855
- $n,
1856
- An,
1857
- Bn,
1858
- wn,
1859
- Fn,
1860
- jn,
1861
1925
  Wn,
1862
1926
  zn,
1927
+ kn,
1863
1928
  Vn,
1864
- Rr,
1865
- br,
1866
- Or
1867
- ].forEach((i) => {
1868
- this._injector.get(en).registerShortcut(i);
1929
+ Hn,
1930
+ Yn,
1931
+ Xn,
1932
+ Gn,
1933
+ Zn,
1934
+ Er,
1935
+ Dr,
1936
+ yr
1937
+ ].forEach((r) => {
1938
+ this._injector.get(sn).registerShortcut(r);
1869
1939
  });
1870
1940
  }
1871
- _initDependencies(i) {
1941
+ _initDependencies(r) {
1872
1942
  [
1873
1943
  // Controller
1874
1944
  [fe],
@@ -1878,52 +1948,52 @@ let ht = (Be = class extends wt {
1878
1948
  [Oe],
1879
1949
  [Re],
1880
1950
  [be],
1881
- [Ie],
1882
1951
  [Te],
1952
+ [Ie],
1883
1953
  [
1884
1954
  // controllers
1885
- ie,
1955
+ oe,
1886
1956
  {
1887
- useFactory: () => this._injector.createInstance(ie, this._config)
1957
+ useFactory: () => this._injector.createInstance(oe, this._config)
1888
1958
  }
1889
1959
  ],
1890
1960
  [
1891
1961
  ue,
1892
1962
  {
1893
- useClass: We
1963
+ useClass: ze
1894
1964
  }
1895
1965
  ],
1896
1966
  // Render views
1897
1967
  [Ce]
1898
1968
  ].forEach((t) => {
1899
- i.add(t);
1969
+ r.add(t);
1900
1970
  });
1901
1971
  }
1902
1972
  _markDocAsFocused() {
1903
- const i = this._injector.get(M), e = this._injector.get($);
1973
+ const r = this._injector.get(M), e = this._injector.get($);
1904
1974
  try {
1905
- const t = i.getCurrentUniverDocInstance(), n = t.getUnitId();
1906
- e.isEditor(n) || i.focusUniverInstance(t.getUnitId());
1975
+ const t = r.getCurrentUniverDocInstance(), n = t.getUnitId();
1976
+ e.isEditor(n) || r.focusUniverInstance(t.getUnitId());
1907
1977
  } catch (t) {
1908
1978
  this._logService.warn(t);
1909
1979
  }
1910
1980
  }
1911
1981
  _initModules() {
1912
- this._injector.get(ie);
1913
- }
1914
- }, S(Be, "type", Bt.Doc), Be);
1915
- ht = vi([
1916
- we(1, v(Ee)),
1917
- we(2, v(Ve)),
1918
- we(3, gt)
1919
- ], ht);
1982
+ this._injector.get(oe);
1983
+ }
1984
+ }, S(Be, "type", Vt.Doc), Be);
1985
+ ft = Ti([
1986
+ Fe(1, v(Ee)),
1987
+ Fe(2, v(ke)),
1988
+ Fe(3, mt)
1989
+ ], ft);
1920
1990
  export {
1921
- Ln as DOC_UI_PLUGIN_NAME,
1922
- Pn as DefaultDocContainerConfig,
1923
- Un as DefaultDocUiConfig,
1924
- xn as DefaultToolbarConfig,
1991
+ Bn as DOC_UI_PLUGIN_NAME,
1992
+ wn as DefaultDocContainerConfig,
1993
+ Fn as DefaultDocUiConfig,
1994
+ An as DefaultToolbarConfig,
1925
1995
  Ce as DocCanvasView,
1926
- ht as UniverDocsUIPlugin,
1927
- xi as enUS,
1928
- Cr as zhCN
1996
+ ft as UniverDocsUIPlugin,
1997
+ $i as enUS,
1998
+ Mr as zhCN
1929
1999
  };