@univerjs/docs-ui 0.1.6 → 0.1.8

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