@univerjs/docs-ui 0.1.7 → 0.1.9

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
1
  var Bt = Object.defineProperty;
2
- var wt = (r, e, t) => e in r ? Bt(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t;
3
- var m = (r, e, t) => (wt(r, typeof e != "symbol" ? e + "" : e, t), t);
4
- import { FOCUSING_DOC as Ee, FOCUSING_UNIVER_EDITOR as Ge, FOCUSING_UNIVER_EDITOR_STANDALONE_SINGLE_MODE as Ft, Direction as W, EDITOR_ACTIVATED as Rt, LocaleService as Ze, RxDisposable as ce, ICommandService as S, BooleanNumber as v, UniverInstanceType as R, BaselineOffset as J, ThemeService as Tt, HorizontalAlign as xe, IUniverInstanceService as D, Disposable as Y, OnLifecycle as L, LifecycleStages as A, Tools as qe, LRUMap as jt, ColorKit as it, toDisposable as B, ILogService as bt, CommandType as Ke, IContextService as Wt, checkForSubstrings as zt, IConfigService as kt, DEFAULT_DOCUMENT_SUB_COMPONENT_ID as Vt, IFloatingObjectManagerService as Ht, Plugin as Yt, PluginType as Xt } from "@univerjs/core";
5
- import { Inject as C, Injector as De, Optional as Gt, createIdentifier as Zt } from "@wendellhu/redi";
6
- import { KeyCode as P, MetaKeys as le, ILayoutService as It, MenuGroup as b, MenuItemType as T, MenuPosition as I, getMenuHiddenObservable as M, FONT_FAMILY_LIST as ot, FONT_SIZE_LIST as qt, FontFamily as Kt, FontFamilyItem as Jt, FontSize as Qt, DesktopUIPart as en, ComponentManager as tn, IEditorService as N, IMenuService as nn, IUIController as rn, PLAIN_TEXT_CLIPBOARD_MIME_TYPE as on, HTML_CLIPBOARD_MIME_TYPE as sn, IClipboardInterfaceService as Je, CopyCommand as an, CutCommand as cn, PasteCommand as ln, SetEditorResizeOperation as dn, IShortcutService as un } from "@univerjs/ui";
7
- import { MoveCursorOperation as Pe, MoveSelectionOperation as Ue, SelectAllOperation as hn, SetInlineFormatBoldCommand as gn, SetTextSelectionsOperation as U, SetInlineFormatCommand as ee, SetInlineFormatItalicCommand as pn, SetInlineFormatUnderlineCommand as _n, SetInlineFormatStrikethroughCommand as fn, SetInlineFormatSubscriptCommand as mn, SetInlineFormatSuperscriptCommand as Sn, SetInlineFormatFontFamilyCommand as st, SetInlineFormatFontSizeCommand as at, SetInlineFormatTextColorCommand as ct, AlignLeftCommand as vn, AlignOperationCommand as Le, AlignCenterCommand as Cn, AlignRightCommand as On, AlignJustifyCommand as Rn, OrderListCommand as Tn, BulletListCommand as bn, ResetInlineFormatTextBackgroundColorCommand as In, SetInlineFormatTextBackgroundColorCommand as Ve, TextSelectionManagerService as te, BreakLineCommand as Mn, DeleteLeftCommand as yn, DeleteRightCommand as En, CutContentCommand as Mt, InnerPasteCommand as yt, VIEWPORT_KEY as Ae, CoverContentCommand as xn, RichTextEditingMutation as Qe, DocSkeletonManagerService as ne, DOCS_COMPONENT_MAIN_LAYER_INDEX as Fe, DOCS_COMPONENT_HEADER_LAYER_INDEX as Dn, DOCS_VIEW_KEY as lt, DOCS_COMPONENT_DEFAULT_Z_INDEX as Pn, SetDocZoomRatioOperation as et, SetDocZoomRatioCommand as Un, getDocObject as Et, getDocObjectById as Ln } from "@univerjs/docs";
8
- import { connectInjector as An } from "@wendellhu/redi/react-bindings";
9
- import { ITextSelectionRenderManager as de, pixelToPt as Nn, ptToPixel as dt, ScrollBar as He, IRenderManagerService as z, PageLayoutType as ut, Viewport as $n, EVENT_TYPE as Bn, Layer as ht, Documents as wn, Liquid as Fn, Rect as jn, CURSOR_TYPE as gt, NodePositionConvertToCursor as Wn, getAnchorBounding as zn } from "@univerjs/engine-render";
10
- import kn from "react";
11
- import { Observable as E, takeUntil as ae, fromEvent as pt, BehaviorSubject as Vn } from "rxjs";
12
- import { ColorPicker as Hn } from "@univerjs/design";
13
- const Yn = {
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
+ import Wn from "react";
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 Yn = {
38
38
  // 'Wrap mode'
39
39
  textRotateMode: !0
40
40
  // 'Text Rotation Mode'
41
- }, Xn = {
41
+ }, Yn = {
42
42
  outerLeft: !1,
43
43
  outerRight: !1,
44
44
  header: !0,
@@ -51,90 +51,90 @@ const Yn = {
51
51
  frozenContent: !1,
52
52
  infoBar: !0,
53
53
  toolbar: !0
54
- }, Gn = {
54
+ }, Xn = {
55
55
  layout: {
56
- docContainerConfig: Xn,
57
- toolbarConfig: Yn
56
+ docContainerConfig: Yn,
57
+ toolbarConfig: Hn
58
58
  }
59
- }, Zn = "DocUI";
60
- function $(r) {
61
- return r.getContextValue(Ee) && r.getContextValue(Ge);
59
+ }, Gn = "DocUI";
60
+ function B(i) {
61
+ return i.getContextValue(xe) && i.getContextValue(Ge);
62
62
  }
63
- function qn(r) {
64
- return r.getContextValue(Ee) && r.getContextValue(Ge) && !r.getContextValue(Ft);
63
+ function Zn(i) {
64
+ return i.getContextValue(xe) && i.getContextValue(Ge) && !i.getContextValue(wt);
65
65
  }
66
- const Kn = {
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
- }, Jn = {
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
- }, Qn = {
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
- }, er = {
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
- }, tr = {
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
- }, nr = {
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
- }, rr = {
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
- }, ir = {
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
- }, or = {
123
- id: hn.id,
122
+ }, ri = {
123
+ id: un.id,
124
124
  binding: P.A | le.CTRL_COMMAND,
125
- preconditions: (r) => r.getContextValue(Ge) && (r.getContextValue(Ee) || r.getContextValue(Rt))
125
+ preconditions: (i) => i.getContextValue(Ge) && (i.getContextValue(xe) || i.getContextValue(Rt))
126
126
  };
127
- var sr = Object.defineProperty, ar = Object.getOwnPropertyDescriptor, cr = (r, e, t, n) => {
128
- for (var i = n > 1 ? void 0 : n ? ar(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 && sr(e, t, i), i;
131
- }, _t = (r, e) => (t, n) => e(t, n, r);
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
132
  let Ye = class {
133
- constructor(r, e, t) {
133
+ constructor(i, e, t) {
134
134
  m(this, "_docContainer");
135
135
  // 获取SheetContainer组件
136
- m(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 Ye = class {
144
144
  * e: {target: HTMLSelectElement } reference from https://stackoverflow.com/a/48443771
145
145
  *
146
146
  */
147
- m(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,25 +160,25 @@ let Ye = 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
- Ye = cr([
172
- _t(1, C(Ze)),
173
- _t(2, C(De))
171
+ Ye = ai([
172
+ pt(1, O(Ze)),
173
+ pt(2, O(Pe))
174
174
  ], Ye);
175
- var lr = Object.defineProperty, dr = Object.getOwnPropertyDescriptor, ur = (r, e, t, n) => {
176
- for (var i = n > 1 ? void 0 : n ? dr(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 && lr(e, t, i), i;
179
- }, pe = (r, e) => (t, n) => e(t, n, r);
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
183
  m(this, "_docContainerController");
184
184
  /**
@@ -191,7 +191,7 @@ let se = class extends ce {
191
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(Ye, 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 = ur([
207
- pe(1, C(Ze)),
208
- pe(2, C(De)),
209
- pe(3, de),
210
- pe(4, Gt(It))
206
+ se = di([
207
+ _e(1, O(Ze)),
208
+ _e(2, O(Pe)),
209
+ _e(3, de),
210
+ _e(4, Xt(bt))
211
211
  ], se);
212
- const Ne = "UI_PLUGIN_DOCS", tt = `${Ne}_COLOR_PICKER_COMPONENT`, xt = `${Ne}_FONT_FAMILY_COMPONENT`, Dt = `${Ne}_FONT_FAMILY_ITEM_COMPONENT`, Pt = `${Ne}_FONT_SIZE_COMPONENT`;
213
- var Ut = { 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 Ut = { 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 hr = kn, gr = Symbol.for("react.element"), pr = Symbol.for("react.fragment"), _r = Object.prototype.hasOwnProperty, fr = hr.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, mr = { key: !0, ref: !0, __self: !0, __source: !0 };
224
- function Lt(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
- _r.call(e, n) && !mr.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: gr, type: r, key: s, ref: o, props: i, _owner: fr.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 = pr;
235
- $e.jsx = Lt;
236
- $e.jsxs = Lt;
237
- Ut.exports = $e;
238
- var Sr = Ut.exports;
239
- const vr = "univer-docs-ui-canvas-background", Cr = {
240
- docsUiCanvasBackground: vr
241
- }, Or = () => /* @__PURE__ */ Sr.jsx("div", { className: Cr.docsUiCanvasBackground });
242
- function Rr(r) {
243
- const e = r.get(S);
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
- id: gn.id,
246
- group: b.TOOLBAR_FORMAT,
245
+ id: hn.id,
246
+ group: I.TOOLBAR_FORMAT,
247
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 = k(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 Tr(r) {
270
- const e = r.get(S);
269
+ function Ri(i) {
270
+ const e = i.get(v);
271
271
  return {
272
- id: pn.id,
273
- group: b.TOOLBAR_FORMAT,
272
+ id: gn.id,
273
+ group: I.TOOLBAR_FORMAT,
274
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 = k(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 br(r) {
297
- const e = r.get(S);
296
+ function Ti(i) {
297
+ const e = i.get(v);
298
298
  return {
299
299
  id: _n.id,
300
- group: b.TOOLBAR_FORMAT,
300
+ group: I.TOOLBAR_FORMAT,
301
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 = k(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 Ir(r) {
324
- const e = r.get(S);
323
+ function Ii(i) {
324
+ const e = i.get(v);
325
325
  return {
326
- id: fn.id,
327
- group: b.TOOLBAR_FORMAT,
326
+ id: pn.id,
327
+ group: I.TOOLBAR_FORMAT,
328
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 = k(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 Mr(r) {
351
- const e = r.get(S);
350
+ function bi(i) {
351
+ const e = i.get(v);
352
352
  return {
353
- id: mn.id,
354
- group: b.TOOLBAR_FORMAT,
353
+ id: fn.id,
354
+ group: I.TOOLBAR_FORMAT,
355
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 = k(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 Mr(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 yr(r) {
377
- const e = r.get(S);
376
+ function Mi(i) {
377
+ const e = i.get(v);
378
378
  return {
379
- id: Sn.id,
380
- group: b.TOOLBAR_FORMAT,
379
+ id: mn.id,
380
+ group: I.TOOLBAR_FORMAT,
381
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 = k(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,18 +396,18 @@ function yr(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 Er(r) {
403
- const e = r.get(S);
402
+ function yi(i) {
403
+ const e = i.get(v);
404
404
  return {
405
405
  id: st.id,
406
406
  tooltip: "toolbar.font",
407
- group: b.TOOLBAR_FORMAT,
407
+ group: I.TOOLBAR_FORMAT,
408
408
  type: T.SELECTOR,
409
409
  label: xt,
410
- positions: [I.TOOLBAR_START],
410
+ positions: [b.TOOLBAR_START],
411
411
  selections: ot.map((t) => ({
412
412
  label: {
413
413
  name: Dt,
@@ -417,27 +417,27 @@ function Er(r) {
417
417
  })),
418
418
  // disabled$: getCurrentSheetDisabled$(accessor),
419
419
  value$: new E((t) => {
420
- const n = ot[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
423
  if (o === U.id || o === st.id) {
424
- const c = k(r);
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 xr(r) {
437
- const e = r.get(S);
436
+ function Ei(i) {
437
+ const e = i.get(v);
438
438
  return {
439
439
  id: at.id,
440
- group: b.TOOLBAR_FORMAT,
440
+ group: I.TOOLBAR_FORMAT,
441
441
  type: T.SELECTOR,
442
442
  tooltip: "toolbar.fontSize",
443
443
  label: {
@@ -448,35 +448,35 @@ function xr(r) {
448
448
  // disabled$,
449
449
  }
450
450
  },
451
- positions: [I.TOOLBAR_START],
452
- selections: qt,
451
+ positions: [b.TOOLBAR_START],
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
458
  if (o === U.id || o === at.id) {
459
- const c = k(r);
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 Dr(r) {
472
- const e = r.get(S), t = r.get(Tt);
471
+ function xi(i) {
472
+ const e = i.get(v), t = i.get(Tt);
473
473
  return {
474
474
  id: ct.id,
475
475
  icon: "FontColor",
476
476
  tooltip: "toolbar.textColor.main",
477
- group: b.TOOLBAR_FORMAT,
477
+ group: I.TOOLBAR_FORMAT,
478
478
  type: T.BUTTON_SELECTOR,
479
- positions: [I.TOOLBAR_START],
479
+ positions: [b.TOOLBAR_START],
480
480
  selections: [
481
481
  {
482
482
  label: {
@@ -486,161 +486,161 @@ function Dr(r) {
486
486
  }
487
487
  ],
488
488
  value$: new E((n) => {
489
- const i = t.getCurrentTheme().textColor, s = e.onCommandExecuted((o) => {
489
+ const r = t.getCurrentTheme().textColor, s = e.onCommandExecuted((o) => {
490
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 Pr(r) {
502
- const e = r.get(S);
501
+ function Di(i) {
502
+ const e = i.get(v);
503
503
  return {
504
- id: vn.id,
505
- group: b.TOOLBAR_LAYOUT,
504
+ id: Sn.id,
505
+ group: I.TOOLBAR_LAYOUT,
506
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 = Be(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 Ur(r) {
528
- const e = r.get(S);
527
+ function Pi(i) {
528
+ const e = i.get(v);
529
529
  return {
530
- id: Cn.id,
531
- group: b.TOOLBAR_LAYOUT,
530
+ id: vn.id,
531
+ group: I.TOOLBAR_LAYOUT,
532
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 = Be(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 Lr(r) {
554
- const e = r.get(S);
553
+ function Ui(i) {
554
+ const e = i.get(v);
555
555
  return {
556
- id: On.id,
557
- group: b.TOOLBAR_LAYOUT,
556
+ id: Cn.id,
557
+ group: I.TOOLBAR_LAYOUT,
558
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 = Be(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 Ar(r) {
580
- const e = r.get(S);
579
+ function Li(i) {
580
+ const e = i.get(v);
581
581
  return {
582
- id: Rn.id,
583
- group: b.TOOLBAR_LAYOUT,
582
+ id: On.id,
583
+ group: I.TOOLBAR_LAYOUT,
584
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 = Be(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 Nr(r) {
605
+ function Ni(i) {
606
606
  return {
607
- id: Tn.id,
608
- group: b.TOOLBAR_LAYOUT,
607
+ id: Rn.id,
608
+ group: I.TOOLBAR_LAYOUT,
609
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 $r(r) {
616
+ function Ai(i) {
617
617
  return {
618
- id: bn.id,
619
- group: b.TOOLBAR_LAYOUT,
618
+ id: Tn.id,
619
+ group: I.TOOLBAR_LAYOUT,
620
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 Br(r) {
627
+ function $i(i) {
628
628
  return {
629
629
  id: In.id,
630
630
  type: T.BUTTON,
631
631
  title: "toolbar.resetColor",
632
632
  icon: "NoColor",
633
- positions: Ve.id
633
+ positions: ke.id
634
634
  };
635
635
  }
636
- function wr(r) {
637
- const e = r.get(S), t = r.get(Tt);
636
+ function Bi(i) {
637
+ const e = i.get(v), t = i.get(Tt);
638
638
  return {
639
- id: Ve.id,
639
+ id: ke.id,
640
640
  tooltip: "toolbar.fillColor.main",
641
- group: b.TOOLBAR_FORMAT,
641
+ group: I.TOOLBAR_FORMAT,
642
642
  type: T.BUTTON_SELECTOR,
643
- positions: [I.TOOLBAR_START],
643
+ positions: [b.TOOLBAR_START],
644
644
  icon: "PaintBucket",
645
645
  selections: [
646
646
  {
@@ -651,37 +651,37 @@ function wr(r) {
651
651
  }
652
652
  ],
653
653
  value$: new E((n) => {
654
- const i = t.getCurrentTheme().primaryColor, s = e.onCommandExecuted((o) => {
655
- if (o.id === Ve.id) {
654
+ const r = t.getCurrentTheme().primaryColor, s = e.onCommandExecuted((o) => {
655
+ if (o.id === ke.id) {
656
656
  const a = o.params.value;
657
- n.next(a != null ? a : i);
657
+ n.next(a != null ? a : r);
658
658
  }
659
659
  });
660
- return n.next(i), s.dispose;
660
+ return n.next(r), s.dispose;
661
661
  }),
662
- hidden$: M(r, R.DOC)
662
+ hidden$: M(i, S.UNIVER_DOC)
663
663
  };
664
664
  }
665
- function k(r) {
665
+ function z(i) {
666
666
  var c;
667
- const e = r.get(D), t = r.get(te), n = e.getCurrentUniverDocInstance(), i = t.getActiveRange();
668
- 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)
669
669
  return;
670
670
  const s = (c = n.getBody()) == null ? void 0 : c.textRuns;
671
671
  if (s == null)
672
672
  return;
673
- const { startOffset: o } = i;
673
+ const { startOffset: o } = r;
674
674
  return s.find(({ st: d, ed: u }) => o >= d && o < u);
675
675
  }
676
- function Be(r) {
676
+ function Fe(i) {
677
677
  var c;
678
- const e = r.get(D), t = r.get(te), n = e.getCurrentUniverDocInstance(), i = t.getActiveRange();
679
- 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)
680
680
  return;
681
681
  const s = (c = n.getBody()) == null ? void 0 : c.paragraphs;
682
682
  if (s == null)
683
683
  return;
684
- const { startOffset: o } = i;
684
+ const { startOffset: o } = r;
685
685
  let a = -1;
686
686
  for (const d of s) {
687
687
  const { startIndex: u } = d;
@@ -691,72 +691,72 @@ function Be(r) {
691
691
  }
692
692
  return null;
693
693
  }
694
- var Fr = Object.defineProperty, jr = Object.getOwnPropertyDescriptor, Wr = (r, e, t, n) => {
695
- for (var i = n > 1 ? void 0 : n ? jr(e, t) : e, s = r.length - 1, o; s >= 0; s--)
696
- (o = r[s]) && (i = (n ? o(e, t, i) : o(i)) || i);
697
- return n && i && Fr(e, t, i), i;
698
- }, V = (r, e) => (t, n) => e(t, n, r);
699
- let me = class extends Y {
700
- constructor(r, e, t, n, i, s, o) {
701
- super(), this._injector = r, this._componentManager = e, this._layoutService = t, this._editorService = n, this._menuService = i, this._uiController = s, this._currentUniverService = o, this._init();
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);
699
+ let Se = class extends Y {
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();
702
702
  }
703
703
  _initCustomComponents() {
704
- const r = this._componentManager;
705
- this.disposeWithMe(r.register(tt, Hn)), this.disposeWithMe(r.register(xt, Kt)), this.disposeWithMe(r.register(Dt, Jt)), this.disposeWithMe(r.register(Pt, Qt));
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));
706
706
  }
707
707
  _initMenus() {
708
708
  [
709
- Rr,
710
- Tr,
711
- br,
712
- Ir,
713
- Mr,
714
- yr,
715
- xr,
716
- Er,
717
- Dr,
718
- Pr,
719
- Ur,
720
- Lr,
721
- Ar,
722
- Nr,
723
- $r,
724
- Br,
725
- wr
726
- ].forEach((r) => {
727
- 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)));
728
728
  });
729
729
  }
730
730
  _init() {
731
731
  this._initCustomComponents(), this._initMenus(), this._initDocBackground(), this._initFocusHandler();
732
732
  }
733
733
  _initDocBackground() {
734
- const r = this._currentUniverService.getAllUniverDocsInstance()[0].getUnitId();
735
- if (r == null)
734
+ const i = this._univerInstanceService.getAllUnitsForType(S.UNIVER_DOC)[0].getUnitId();
735
+ if (i == null)
736
736
  return;
737
- this._editorService.isEditor(r) || this.disposeWithMe(
738
- this._uiController.registerComponent(en.CONTENT, () => An(Or, this._injector))
737
+ this._editorService.isEditor(i) || this.disposeWithMe(
738
+ this._uiController.registerComponent(Qt.CONTENT, () => Ln(Ci, this._injector))
739
739
  );
740
740
  }
741
741
  _initFocusHandler() {
742
742
  this.disposeWithMe(
743
- this._layoutService.registerFocusHandler(R.DOC, () => {
743
+ this._layoutService.registerFocusHandler(S.UNIVER_DOC, () => {
744
744
  this._injector.get(de).focus();
745
745
  })
746
746
  );
747
747
  }
748
748
  };
749
- me = Wr([
750
- L(A.Rendered, me),
751
- V(0, C(De)),
752
- V(1, C(tn)),
753
- V(2, It),
754
- V(3, N),
755
- V(4, nn),
756
- V(5, rn),
757
- V(6, D)
758
- ], me);
759
- const zr = {
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, $),
755
+ k(4, tn),
756
+ k(5, nn),
757
+ k(6, D)
758
+ ], Se);
759
+ const Vi = {
760
760
  toolbar: {
761
761
  undo: "Undo",
762
762
  redo: "Redo",
@@ -784,7 +784,7 @@ const zr = {
784
784
  alignRight: "Align Right",
785
785
  alignJustify: "Justify"
786
786
  }
787
- }, no = zr, kr = {
787
+ }, to = Vi, Wi = {
788
788
  toolbar: {
789
789
  undo: "撤销",
790
790
  redo: "重做",
@@ -812,29 +812,29 @@ const zr = {
812
812
  alignRight: "右对齐",
813
813
  alignJustify: "两端对齐"
814
814
  }
815
- }, Vr = kr, Hr = {
816
- id: Mn.id,
817
- preconditions: qn,
815
+ }, zi = Wi, ki = {
816
+ id: bn.id,
817
+ preconditions: Zn,
818
818
  binding: P.ENTER
819
- }, Yr = {
820
- id: yn.id,
821
- preconditions: $,
819
+ }, Hi = {
820
+ id: Mn.id,
821
+ preconditions: B,
822
822
  binding: P.BACKSPACE
823
- }, Xr = {
824
- id: En.id,
825
- preconditions: $,
823
+ }, Yi = {
824
+ id: yn.id,
825
+ preconditions: B,
826
826
  binding: P.DELETE
827
- }, Gr = 10, Zr = 6;
828
- function qr() {
829
- return qe.generateRandomId(Zr);
827
+ }, Xi = 10, Gi = 6;
828
+ function Zi() {
829
+ return qe.generateRandomId(Gi);
830
830
  }
831
- function Kr(r) {
832
- const e = r.match(/data-copy-id="([^\s]+)"/);
831
+ function qi(i) {
832
+ const e = i.match(/data-copy-id="([^\s]+)"/);
833
833
  return e && e[1] ? e[1] : null;
834
834
  }
835
- class Jr {
835
+ class Ki {
836
836
  constructor() {
837
- m(this, "_cache", new jt(Gr));
837
+ m(this, "_cache", new jt(Xi));
838
838
  }
839
839
  set(e, t) {
840
840
  this._cache.set(e, t);
@@ -846,30 +846,30 @@ class Jr {
846
846
  this._cache.clear();
847
847
  }
848
848
  }
849
- const ft = new Jr();
850
- function nt(r) {
851
- 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();
852
852
  switch (n) {
853
853
  case "b":
854
854
  case "em":
855
855
  case "strong": {
856
- t.bl = v.TRUE;
856
+ t.bl = C.TRUE;
857
857
  break;
858
858
  }
859
859
  case "s": {
860
860
  t.st = {
861
- s: v.TRUE
861
+ s: C.TRUE
862
862
  };
863
863
  break;
864
864
  }
865
865
  case "u": {
866
866
  t.ul = {
867
- s: v.TRUE
867
+ s: C.TRUE
868
868
  };
869
869
  break;
870
870
  }
871
871
  case "i": {
872
- t.it = v.TRUE;
872
+ t.it = C.TRUE;
873
873
  break;
874
874
  }
875
875
  case "sub":
@@ -878,8 +878,8 @@ function nt(r) {
878
878
  break;
879
879
  }
880
880
  }
881
- for (let i = 0; i < e.length; i++) {
882
- 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);
883
883
  switch (s) {
884
884
  case "font-family": {
885
885
  t.ff = o;
@@ -891,32 +891,32 @@ function nt(r) {
891
891
  break;
892
892
  }
893
893
  case "font-style": {
894
- o === "italic" && (t.it = v.TRUE);
894
+ o === "italic" && (t.it = C.TRUE);
895
895
  break;
896
896
  }
897
897
  case "font-weight": {
898
- Number(o) > 400 && (t.bl = v.TRUE);
898
+ Number(o) > 400 && (t.bl = C.TRUE);
899
899
  break;
900
900
  }
901
901
  case "text-decoration": {
902
902
  /underline/.test(o) ? t.ul = {
903
- s: v.TRUE
903
+ s: C.TRUE
904
904
  } : /overline/.test(o) ? t.ol = {
905
- s: v.TRUE
905
+ s: C.TRUE
906
906
  } : /line-through/.test(o) && (t.st = {
907
- s: v.TRUE
907
+ s: C.TRUE
908
908
  });
909
909
  break;
910
910
  }
911
911
  case "color": {
912
- const a = new it(o);
912
+ const a = new rt(o);
913
913
  a.isValid && (t.cl = {
914
914
  rgb: a.toRgbString()
915
915
  });
916
916
  break;
917
917
  }
918
918
  case "background-color": {
919
- const a = new it(o);
919
+ const a = new rt(o);
920
920
  a.isValid && (t.bg = {
921
921
  rgb: a.toRgbString()
922
922
  });
@@ -926,15 +926,15 @@ function nt(r) {
926
926
  }
927
927
  return t;
928
928
  }
929
- function Qr(r) {
930
- 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>`;
931
931
  return e.parseFromString(t, "text/html").querySelector("#univer-root");
932
932
  }
933
- function mt(r, e) {
934
- const t = r.tagName.toLowerCase();
935
- 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);
936
936
  }
937
- const ye = class ye {
937
+ const Ee = class Ee {
938
938
  constructor() {
939
939
  m(this, "_styleCache", /* @__PURE__ */ new Map());
940
940
  m(this, "_styleRules", []);
@@ -946,17 +946,17 @@ const ye = class ye {
946
946
  this._pluginList.push(e);
947
947
  }
948
948
  convert(e) {
949
- const t = ye._pluginList.find((s) => s.checkPasteType(e)), n = Qr(e), i = {
949
+ const t = Ee._pluginList.find((s) => s.checkPasteType(e)), n = Ji(e), r = {
950
950
  dataStream: "",
951
951
  textRuns: []
952
952
  };
953
- 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;
954
954
  }
955
955
  _process(e, t, n) {
956
- var i;
956
+ var r;
957
957
  for (const s of t)
958
958
  if (s.nodeType === Node.TEXT_NODE) {
959
- 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, "");
960
960
  let a;
961
961
  e && this._styleCache.has(e) && (a = this._styleCache.get(e)), n.dataStream += o, a && Object.getOwnPropertyNames(a).length && n.textRuns.push({
962
962
  st: n.dataStream.length - o.length,
@@ -975,22 +975,22 @@ const ye = class ye {
975
975
  }
976
976
  }
977
977
  };
978
- m(ye, "_pluginList", []);
979
- let Q = ye;
980
- const ei = {
978
+ m(Ee, "_pluginList", []);
979
+ let Q = Ee;
980
+ const Qi = {
981
981
  name: "univer-doc-paste-plugin-lark",
982
- checkPasteType(r) {
983
- return /lark-record-clipboard/i.test(r);
982
+ checkPasteType(i) {
983
+ return /lark-record-clipboard/i.test(i);
984
984
  },
985
985
  // TODO: @JOCS, support inline code copy from lark.
986
986
  stylesRules: [
987
987
  {
988
988
  filter: ["s"],
989
- getStyle(r) {
990
- const e = nt(r);
989
+ getStyle(i) {
990
+ const e = nt(i);
991
991
  return {
992
992
  st: {
993
- s: v.TRUE
993
+ s: C.TRUE
994
994
  },
995
995
  ...e
996
996
  };
@@ -999,22 +999,22 @@ const ei = {
999
999
  ],
1000
1000
  afterProcessRules: [
1001
1001
  {
1002
- filter(r) {
1003
- return r.tagName === "DIV" && /ace-line/i.test(r.className);
1002
+ filter(i) {
1003
+ return i.tagName === "DIV" && /ace-line/i.test(i.className);
1004
1004
  },
1005
- handler(r) {
1006
- r.paragraphs == null && (r.paragraphs = []), r.paragraphs.push({
1007
- startIndex: r.dataStream.length
1008
- }), r.dataStream += "\r";
1005
+ handler(i) {
1006
+ i.paragraphs == null && (i.paragraphs = []), i.paragraphs.push({
1007
+ startIndex: i.dataStream.length
1008
+ }), i.dataStream += "\r";
1009
1009
  }
1010
1010
  }
1011
1011
  ]
1012
- }, ti = ei;
1013
- function At(r) {
1014
- const e = r.style, t = {};
1012
+ }, er = Qi;
1013
+ function Nt(i) {
1014
+ const e = i.style, t = {};
1015
1015
  for (let n = 0; n < e.length; n++) {
1016
- const i = e[n], s = e.getPropertyValue(i);
1017
- switch (i) {
1016
+ const r = e[n], s = e.getPropertyValue(r);
1017
+ switch (r) {
1018
1018
  case "margin-top": {
1019
1019
  const o = Number.parseInt(s);
1020
1020
  t.spaceAbove = /pt/.test(s) ? dt(o) : o;
@@ -1034,66 +1034,66 @@ function At(r) {
1034
1034
  }
1035
1035
  return Object.getOwnPropertyNames(t).length ? t : null;
1036
1036
  }
1037
- const ni = {
1037
+ const tr = {
1038
1038
  name: "univer-doc-paste-plugin-word",
1039
- checkPasteType(r) {
1040
- return /word|mso/i.test(r);
1039
+ checkPasteType(i) {
1040
+ return /word|mso/i.test(i);
1041
1041
  },
1042
1042
  stylesRules: [
1043
1043
  {
1044
1044
  filter: ["b"],
1045
- getStyle(r) {
1046
- const e = nt(r);
1047
- return { bl: v.TRUE, ...e };
1045
+ getStyle(i) {
1046
+ const e = nt(i);
1047
+ return { bl: C.TRUE, ...e };
1048
1048
  }
1049
1049
  }
1050
1050
  ],
1051
1051
  afterProcessRules: [
1052
1052
  {
1053
- filter(r) {
1054
- return r.tagName === "P" && /mso/i.test(r.className);
1053
+ filter(i) {
1054
+ return i.tagName === "P" && /mso/i.test(i.className);
1055
1055
  },
1056
- handler(r, e) {
1057
- r.paragraphs == null && (r.paragraphs = []);
1056
+ handler(i, e) {
1057
+ i.paragraphs == null && (i.paragraphs = []);
1058
1058
  const t = {
1059
- startIndex: r.dataStream.length
1060
- }, n = At(e);
1061
- 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";
1062
1062
  }
1063
1063
  }
1064
1064
  ]
1065
- }, ri = ni, ii = {
1065
+ }, nr = tr, ir = {
1066
1066
  name: "univer-doc-paste-plugin-univer",
1067
- checkPasteType(r) {
1068
- return /UniverNormal/i.test(r);
1067
+ checkPasteType(i) {
1068
+ return /UniverNormal/i.test(i);
1069
1069
  },
1070
1070
  stylesRules: [],
1071
1071
  afterProcessRules: [
1072
1072
  {
1073
- filter(r) {
1074
- return r.tagName === "P" && /UniverNormal/i.test(r.className);
1073
+ filter(i) {
1074
+ return i.tagName === "P" && /UniverNormal/i.test(i.className);
1075
1075
  },
1076
- handler(r, e) {
1077
- r.paragraphs == null && (r.paragraphs = []);
1076
+ handler(i, e) {
1077
+ i.paragraphs == null && (i.paragraphs = []);
1078
1078
  const t = {
1079
- startIndex: r.dataStream.length
1080
- }, n = At(e);
1081
- 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";
1082
1082
  }
1083
1083
  }
1084
1084
  ]
1085
- }, oi = ii;
1086
- function St(r, e) {
1087
- const { st: t, ed: n, ts: i = {} } = e, { ff: s, fs: o, it: a, bl: c, ul: d, st: u, ol: h, bg: _, cl: g, va: f } = i;
1088
- let l = r.slice(t, n);
1089
- const p = [];
1090
- 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 && p.push(`font-family: ${s}`), g && p.push(`color: ${g.rgb}`), o && p.push(`font-size: ${o}pt`), h && p.push("text-decoration: overline"), _ && p.push(`background: ${_.rgb}`), p.length ? `<span style="${p.join("; ")};">${l}</span>` : l;
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);
1089
+ const _ = [];
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;
1091
1091
  }
1092
- function je(r, e, t) {
1093
- const { dataStream: n, textRuns: i = [] } = r;
1092
+ function Ve(i, e, t) {
1093
+ const { dataStream: n, textRuns: r = [] } = i;
1094
1094
  let s = e;
1095
1095
  const o = [];
1096
- for (const a of i) {
1096
+ for (const a of r) {
1097
1097
  const { st: c, ed: d } = a;
1098
1098
  qe.hasIntersectionBetweenTwoRanges(e, t, c, d) && (c > s ? (o.push(n.slice(s, c)), o.push(St(n, {
1099
1099
  ...a,
@@ -1106,20 +1106,20 @@ function je(r, e, t) {
1106
1106
  }
1107
1107
  return s !== t && o.push(n.slice(s, t)), o.join("");
1108
1108
  }
1109
- function vt(r, e = !0) {
1109
+ function vt(i, e = !0) {
1110
1110
  var t;
1111
- if (e && ((t = r.paragraphs) != null && t.length)) {
1112
- const { dataStream: n, paragraphs: i = [] } = r;
1111
+ if (e && ((t = i.paragraphs) != null && t.length)) {
1112
+ const { dataStream: n, paragraphs: r = [] } = i;
1113
1113
  let s = "", o = -1;
1114
- for (const a of i) {
1115
- const { startIndex: c, paragraphStyle: d = {} } = a, { spaceAbove: u, spaceBelow: h, lineSpacing: _ } = d, g = [];
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`)), _ != null && g.push(`line-height: ${_}`), 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;
1114
+ for (const a of r) {
1115
+ const { startIndex: c, paragraphStyle: d = {} } = a, { spaceAbove: u, spaceBelow: h, lineSpacing: p } = d, g = [];
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;
1117
1117
  }
1118
- return o !== n.length && (s += je(r, o, n.length)), s;
1118
+ return o !== n.length && (s += Ve(i, o, n.length)), s;
1119
1119
  } else
1120
- return je(r, 0, r.dataStream.length);
1120
+ return Ve(i, 0, i.dataStream.length);
1121
1121
  }
1122
- class si {
1122
+ class or {
1123
1123
  convert(e) {
1124
1124
  if (e.length === 0)
1125
1125
  throw new Error("The bodyList length at least to be 1");
@@ -1131,16 +1131,16 @@ class si {
1131
1131
  return t;
1132
1132
  }
1133
1133
  }
1134
- var ai = Object.defineProperty, ci = Object.getOwnPropertyDescriptor, li = (r, e, t, n) => {
1135
- for (var i = n > 1 ? void 0 : n ? ci(e, t) : e, s = r.length - 1, o; s >= 0; s--)
1136
- (o = r[s]) && (i = (n ? o(e, t, i) : o(i)) || i);
1137
- return n && i && ai(e, t, i), i;
1138
- }, re = (r, e) => (t, n) => e(t, n, r);
1139
- Q.use(ri);
1140
- Q.use(ti);
1141
- Q.use(oi);
1142
- function di(r) {
1143
- 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 = [];
1144
1144
  for (let n = 0; n < e.length; n++)
1145
1145
  e[n] === "\r" && t.push({ startIndex: n });
1146
1146
  return {
@@ -1148,14 +1148,14 @@ function di(r) {
1148
1148
  paragraphs: t
1149
1149
  };
1150
1150
  }
1151
- const ue = Zt("doc.clipboard-service");
1151
+ const ue = Gt("doc.clipboard-service");
1152
1152
  let Xe = class extends Y {
1153
- constructor(e, t, n, i, s) {
1153
+ constructor(e, t, n, r, s) {
1154
1154
  super();
1155
1155
  m(this, "_clipboardHooks", []);
1156
1156
  m(this, "_htmlToUDM", new Q());
1157
- m(this, "_umdToHtml", new si());
1158
- this._currentUniverService = e, this._logService = t, this._commandService = n, this._clipboardInterfaceService = i, this._textSelectionManagerService = s;
1157
+ m(this, "_umdToHtml", new or());
1158
+ this._univerInstanceService = e, this._logService = t, this._commandService = n, this._clipboardInterfaceService = r, this._textSelectionManagerService = s;
1159
1159
  }
1160
1160
  async copy() {
1161
1161
  const e = this._getDocumentBodyInRanges();
@@ -1185,13 +1185,13 @@ let Xe = class extends Y {
1185
1185
  segmentId: e,
1186
1186
  endOffset: t,
1187
1187
  style: n
1188
- } = (s = this._textSelectionManagerService.getActiveRange()) != null ? s : {}, i = this._textSelectionManagerService.getSelections();
1189
- 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)
1190
1190
  return !1;
1191
1191
  this.copy();
1192
1192
  try {
1193
1193
  let o = t;
1194
- for (const c of i) {
1194
+ for (const c of r) {
1195
1195
  const { startOffset: d, endOffset: u } = c;
1196
1196
  d == null || u == null || u <= t && (o -= u - d);
1197
1197
  }
@@ -1209,7 +1209,7 @@ let Xe = class extends Y {
1209
1209
  }
1210
1210
  async _paste(e) {
1211
1211
  var o;
1212
- 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();
1213
1213
  if (t == null && this._logService.error("[DocClipboardController] segmentId does not exist!"), n == null || s == null)
1214
1214
  return !1;
1215
1215
  try {
@@ -1222,7 +1222,7 @@ let Xe = class extends Y {
1222
1222
  {
1223
1223
  startOffset: a,
1224
1224
  endOffset: a,
1225
- style: i
1225
+ style: r
1226
1226
  }
1227
1227
  ];
1228
1228
  return this._commandService.executeCommand(yt.id, { body: e, segmentId: t, textRanges: c });
@@ -1231,23 +1231,23 @@ let Xe = class extends Y {
1231
1231
  }
1232
1232
  }
1233
1233
  async _setClipboardData(e) {
1234
- const t = qr(), n = e.length > 1 ? e.map((s) => s.dataStream).join(`
1234
+ const t = Zi(), n = e.length > 1 ? e.map((s) => s.dataStream).join(`
1235
1235
  `) : e[0].dataStream;
1236
- let i = this._umdToHtml.convert(e);
1237
- return e.length === 1 && (i = i.replace(/(<[a-z]+)/, (s, o) => `${o} data-copy-id="${t}"`), ft.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);
1238
1238
  }
1239
1239
  addClipboardHook(e) {
1240
- return this._clipboardHooks.push(e), B(() => {
1240
+ return this._clipboardHooks.push(e), F(() => {
1241
1241
  const t = this._clipboardHooks.indexOf(e);
1242
1242
  t > -1 && this._clipboardHooks.splice(t, 1);
1243
1243
  });
1244
1244
  }
1245
1245
  _getDocumentBodyInRanges() {
1246
- const e = this._textSelectionManagerService.getSelections(), t = this._currentUniverService.getCurrentUniverDocInstance(), n = [];
1247
- if (e == null)
1246
+ const e = this._textSelectionManagerService.getSelections(), t = this._univerInstanceService.getCurrentUniverDocInstance(), n = [];
1247
+ if (e == null || !t)
1248
1248
  return n;
1249
- for (const i of e) {
1250
- const { startOffset: s, endOffset: o, collapsed: a } = i;
1249
+ for (const r of e) {
1250
+ const { startOffset: s, endOffset: o, collapsed: a } = r;
1251
1251
  if (a || s == null || o == null)
1252
1252
  continue;
1253
1253
  const c = t.sliceBody(s, o);
@@ -1258,9 +1258,9 @@ let Xe = class extends Y {
1258
1258
  async _generateBodyFromClipboardItems(e) {
1259
1259
  try {
1260
1260
  let t = "", n = "";
1261
- for (const i of e)
1262
- for (const s of i.types)
1263
- s === on ? n = await i.getType(s).then((o) => o && o.text()) : s === sn && (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()));
1264
1264
  return this._generateBodyFromHtmlAndText(t, n);
1265
1265
  } catch (t) {
1266
1266
  return Promise.reject(t);
@@ -1269,98 +1269,98 @@ let Xe = class extends Y {
1269
1269
  _generateBodyFromHtmlAndText(e, t) {
1270
1270
  if (!e) {
1271
1271
  if (t)
1272
- return di(t);
1272
+ return lr(t);
1273
1273
  throw new Error("[DocClipboardService] html and text cannot be both empty!");
1274
1274
  }
1275
- const n = Kr(e);
1275
+ const n = qi(e);
1276
1276
  if (n) {
1277
- const i = ft.get(n);
1278
- if (i)
1279
- return i;
1277
+ const r = ft.get(n);
1278
+ if (r)
1279
+ return r;
1280
1280
  }
1281
1281
  return this._htmlToUDM.convert(e);
1282
1282
  }
1283
1283
  };
1284
- Xe = li([
1285
- re(0, D),
1286
- re(1, bt),
1287
- re(2, S),
1288
- re(3, Je),
1289
- re(4, C(te))
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
1290
  ], Xe);
1291
- function we(r) {
1292
- return r.getContextValue(Ee) || r.getContextValue(Rt);
1291
+ function we(i) {
1292
+ return i.getContextValue(xe) || i.getContextValue(Rt);
1293
1293
  }
1294
- const rt = 999, ui = {
1295
- id: an.id,
1294
+ const it = 999, dr = {
1295
+ id: sn.id,
1296
1296
  name: "doc.command.copy",
1297
1297
  type: Ke.COMMAND,
1298
1298
  multi: !0,
1299
- priority: rt,
1299
+ priority: it,
1300
1300
  preconditions: we,
1301
- handler: async (r) => r.get(ue).copy()
1302
- }, hi = {
1303
- id: cn.id,
1301
+ handler: async (i) => i.get(ue).copy()
1302
+ }, ur = {
1303
+ id: an.id,
1304
1304
  name: "doc.command.cut",
1305
1305
  type: Ke.COMMAND,
1306
1306
  multi: !0,
1307
- priority: rt,
1307
+ priority: it,
1308
1308
  preconditions: we,
1309
- handler: async (r) => r.get(ue).cut()
1310
- }, gi = {
1311
- id: ln.id,
1309
+ handler: async (i) => i.get(ue).cut()
1310
+ }, hr = {
1311
+ id: cn.id,
1312
1312
  name: "doc.command.paste",
1313
1313
  type: Ke.COMMAND,
1314
1314
  multi: !0,
1315
- priority: rt,
1315
+ priority: it,
1316
1316
  preconditions: we,
1317
- handler: async (r) => {
1318
- const e = r.get(ue), n = await r.get(Je).read();
1317
+ handler: async (i) => {
1318
+ const e = i.get(ue), n = await i.get(Je).read();
1319
1319
  return n.length === 0 ? !1 : e.paste(n);
1320
1320
  }
1321
1321
  };
1322
- var pi = Object.defineProperty, _i = Object.getOwnPropertyDescriptor, fi = (r, e, t, n) => {
1323
- for (var i = n > 1 ? void 0 : n ? _i(e, t) : e, s = r.length - 1, o; s >= 0; s--)
1324
- (o = r[s]) && (i = (n ? o(e, t, i) : o(i)) || i);
1325
- return n && i && pi(e, t, i), i;
1326
- }, ie = (r, e) => (t, n) => e(t, n, r);
1327
- let Se = class extends ce {
1328
- constructor(r, e, t, n, i) {
1329
- 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();
1330
1330
  }
1331
1331
  _init() {
1332
- [ui, hi, gi].forEach((r) => this.disposeWithMe(this._commandService.registerMultipleCommand(r))), [yt, Mt].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();
1333
1333
  }
1334
1334
  _initLegacyPasteCommand() {
1335
- var r;
1336
- (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) => {
1337
1337
  var s, o;
1338
1338
  if (!we(this._contextService))
1339
1339
  return;
1340
1340
  e.event.preventDefault();
1341
- 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");
1342
- 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);
1343
1343
  });
1344
1344
  }
1345
1345
  };
1346
- Se = fi([
1347
- L(A.Rendered, Se),
1348
- ie(0, S),
1349
- ie(1, Je),
1350
- ie(2, ue),
1351
- ie(3, de),
1352
- ie(4, Wt)
1353
- ], Se);
1354
- var mi = Object.defineProperty, Si = Object.getOwnPropertyDescriptor, vi = (r, e, t, n) => {
1355
- for (var i = n > 1 ? void 0 : n ? Si(e, t) : e, s = r.length - 1, o; s >= 0; s--)
1356
- (o = r[s]) && (i = (n ? o(e, t, i) : o(i)) || i);
1357
- return n && i && mi(e, t, i), i;
1358
- }, Z = (r, e) => (t, n) => e(t, n, r);
1359
- let ve = class extends Y {
1360
- 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) {
1361
1361
  super();
1362
1362
  m(this, "_initialEditors", /* @__PURE__ */ new Set());
1363
- this._currentUniverService = e, this._docSkeletonManagerService = t, this._editorService = n, this._commandService = i, this._textSelectionRenderManager = s, this._renderManagerService = o, this._initialize();
1363
+ this._univerInstanceService = e, this._docSkeletonManagerService = t, this._editorService = n, this._commandService = r, this._textSelectionRenderManager = s, this._renderManagerService = o, this._initialize();
1364
1364
  }
1365
1365
  _initialize() {
1366
1366
  this.disposeWithMe(
@@ -1373,31 +1373,31 @@ let ve = class extends Y {
1373
1373
  }), this._commandExecutedListener(), this._initialSetValue(), this._initialBlur(), this._initialFocus(), this._initialValueChange();
1374
1374
  }
1375
1375
  _resize(e) {
1376
- var w, F, j;
1376
+ var L, w, j;
1377
1377
  if (e == null)
1378
1378
  return;
1379
1379
  const t = this._editorService.getEditor(e);
1380
1380
  if ((t == null ? void 0 : t.cancelDefaultResizeListener) === !0)
1381
1381
  return;
1382
- const n = (w = this._docSkeletonManagerService.getSkeletonByUnitId(e)) == null ? void 0 : w.skeleton, i = this._currentUniverService.getUniverDocInstance(e);
1383
- 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)
1384
1384
  return;
1385
1385
  n.calculate();
1386
- const { marginTop: s = 0, marginBottom: o = 0, marginLeft: a = 0, marginRight: c = 0 } = i.getSnapshot().documentStyle, { scene: d, mainComponent: u } = t.render;
1387
- let { actualHeight: h, actualWidth: _ } = n.getActualSize();
1388
- h += s + o, _ += a + c;
1386
+ const { marginTop: s = 0, marginBottom: o = 0, marginLeft: a = 0, marginRight: c = 0 } = r.getSnapshot().documentStyle, { scene: d, mainComponent: u } = t.render;
1387
+ let { actualHeight: h, actualWidth: p } = n.getActualSize();
1388
+ h += s + o, p += a + c;
1389
1389
  const { width: g, height: f } = t.getBoundingClientRect(), l = d.getViewport(Ae.VIEW_MAIN);
1390
- let p = l == null ? void 0 : l.getScrollBar();
1391
- const O = Math.max(_, g), y = Math.max(h, f);
1390
+ let _ = l == null ? void 0 : l.getScrollBar();
1391
+ const R = Math.max(p, g), y = Math.max(h, f);
1392
1392
  d.transformByState({
1393
- width: O,
1393
+ width: R,
1394
1394
  height: y
1395
- }), u == null || u.resize(O, y), t.isSingle() ? _ > g ? p == null ? l && new He(l, { barSize: 8, enableVertical: !1 }) : l == null || l.resetSizeAndScrollBar() : (p = null, l == null || l.scrollTo({ x: 0, y: 0 }), (j = l == null ? void 0 : l.getScrollBar()) == null || j.dispose()) : h > f ? p == null ? l && new He(l, { enableHorizontal: !1, barSize: 8 }) : l == null || l.resetSizeAndScrollBar() : (p = 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());
1396
1396
  }
1397
1397
  _initialSetValue() {
1398
1398
  this.disposeWithMe(
1399
1399
  this._editorService.setValue$.subscribe((e) => {
1400
- this._commandService.executeCommand(xn.id, {
1400
+ this._commandService.executeCommand(En.id, {
1401
1401
  unitId: e.editorUnitId,
1402
1402
  body: e.body,
1403
1403
  segmentId: null
@@ -1412,11 +1412,12 @@ let ve = class extends Y {
1412
1412
  })
1413
1413
  ), this.disposeWithMe(
1414
1414
  this._textSelectionRenderManager.onBlur$.subscribe(() => {
1415
- const e = this._currentUniverService.getCurrentUniverDocInstance().getUnitId();
1415
+ var r;
1416
+ const e = (r = this._univerInstanceService.getCurrentUniverDocInstance()) == null ? void 0 : r.getUnitId();
1416
1417
  if (e == null)
1417
1418
  return;
1418
- const t = this._editorService.getEditor(e);
1419
- 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();
1420
1421
  })
1421
1422
  );
1422
1423
  }
@@ -1433,17 +1434,17 @@ let ve = class extends Y {
1433
1434
  "univer-formula-help-param"
1434
1435
  ];
1435
1436
  this.disposeWithMe(
1436
- pt(window, "mousedown").subscribe((n) => {
1437
+ _t(window, "mousedown").subscribe((n) => {
1437
1438
  const s = n.target.classList[0] || "";
1438
- if (zt(s, e)) {
1439
+ if (Wt(s, e)) {
1439
1440
  this._editorService.changeSpreadsheetFocusState(!0), n.stopPropagation();
1440
1441
  return;
1441
1442
  }
1442
1443
  this._editorService.changeSpreadsheetFocusState(!1);
1443
1444
  })
1444
- ), this._currentUniverService.getAllUniverSheetsInstance().forEach((n) => {
1445
- const i = n.getUnitId(), s = this._renderManagerService.getRenderById(i), o = s == null ? void 0 : s.engine.getCanvas().getCanvasEle();
1446
- o != null && pt(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) => {
1447
1448
  this._editorService.changeSpreadsheetFocusState(!0), a.stopPropagation();
1448
1449
  });
1449
1450
  });
@@ -1460,7 +1461,8 @@ let ve = class extends Y {
1460
1461
  );
1461
1462
  }
1462
1463
  _valueChange() {
1463
- const e = this._currentUniverService.getCurrentUniverDocInstance().getUnitId();
1464
+ var n;
1465
+ const e = (n = this._univerInstanceService.getCurrentUniverDocInstance()) == null ? void 0 : n.getUnitId();
1464
1466
  if (e == null)
1465
1467
  return;
1466
1468
  const t = this._editorService.getEditor(e);
@@ -1470,38 +1472,38 @@ let ve = class extends Y {
1470
1472
  * Listen to document edits to refresh the size of the normula editor.
1471
1473
  */
1472
1474
  _commandExecutedListener() {
1473
- const e = [Qe.id, dn.id];
1475
+ const e = [Qe.id, ln.id];
1474
1476
  this.disposeWithMe(
1475
1477
  this._commandService.onCommandExecuted((t) => {
1476
1478
  if (e.includes(t.id)) {
1477
- const n = t.params, { unitId: i } = n;
1478
- if (this._editorService.isSheetEditor(i))
1479
+ const n = t.params, { unitId: r } = n;
1480
+ if (this._editorService.isSheetEditor(r))
1479
1481
  return;
1480
- this._resize(i), this._valueChange();
1482
+ this._resize(r), this._valueChange();
1481
1483
  }
1482
1484
  })
1483
1485
  );
1484
1486
  }
1485
1487
  };
1486
- ve = vi([
1487
- L(A.Rendered, ve),
1488
+ Ce = Sr([
1489
+ N(A.Rendered, Ce),
1488
1490
  Z(0, D),
1489
- Z(1, C(ne)),
1490
- Z(2, N),
1491
- Z(3, S),
1491
+ Z(1, O(ne)),
1492
+ Z(2, $),
1493
+ Z(3, v),
1492
1494
  Z(4, de),
1493
- Z(5, z)
1494
- ], ve);
1495
- var Ci = Object.defineProperty, Oi = Object.getOwnPropertyDescriptor, Ri = (r, e, t, n) => {
1496
- for (var i = n > 1 ? void 0 : n ? Oi(e, t) : e, s = r.length - 1, o; s >= 0; s--)
1497
- (o = r[s]) && (i = (n ? o(e, t, i) : o(i)) || i);
1498
- return n && i && Ci(e, t, i), i;
1499
- }, _e = (r, e) => (t, n) => e(t, n, r);
1500
- let Ce = class extends ce {
1501
- 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) {
1502
1504
  super();
1503
1505
  m(this, "_docRenderMap", /* @__PURE__ */ new Set());
1504
- this._docSkeletonManagerService = e, this._renderManagerService = t, this._commandService = n, this._editorService = i, this._initialRenderRefresh(), this._commandExecutedListener();
1506
+ this._docSkeletonManagerService = e, this._renderManagerService = t, this._commandService = n, this._editorService = r, this._initialRenderRefresh(), this._commandExecutedListener();
1505
1507
  }
1506
1508
  _initialRenderRefresh() {
1507
1509
  this._docSkeletonManagerService.currentSkeletonBefore$.pipe(ae(this.dispose$)).subscribe((e) => {
@@ -1512,22 +1514,22 @@ let Ce = class extends ce {
1512
1514
  if (e == null)
1513
1515
  return;
1514
1516
  const { skeleton: t, unitId: n } = e;
1515
- let i = this._renderManagerService.getRenderById(n);
1516
- i == null && (this._renderManagerService.create(n), i = this._renderManagerService.getRenderById(n));
1517
- const { mainComponent: s } = i;
1518
- 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);
1519
1521
  }
1520
1522
  _recalculateSizeBySkeleton(e, t) {
1521
1523
  var u;
1522
- 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;
1523
1525
  if (a == null)
1524
1526
  return;
1525
1527
  let c = 0, d = 0;
1526
- for (let h = 0, _ = a.length; h < _; h++) {
1528
+ for (let h = 0, p = a.length; h < p; h++) {
1527
1529
  const g = a[h], { pageWidth: f, pageHeight: l } = g;
1528
- o.pageLayoutType === ut.VERTICAL ? (d += l, d += o.pageMarginTop, h === _ - 1 && (d += o.pageMarginTop), c = Math.max(c, f)) : o.pageLayoutType === ut.HORIZONTAL && (c += f, h !== _ - 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));
1529
1531
  }
1530
- 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);
1531
1533
  }
1532
1534
  _commandExecutedListener() {
1533
1535
  const e = [Qe.id];
@@ -1535,7 +1537,7 @@ let Ce = class extends ce {
1535
1537
  this._commandService.onCommandExecuted((t) => {
1536
1538
  var n;
1537
1539
  if (e.includes(t.id)) {
1538
- 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);
1539
1541
  if (o == null)
1540
1542
  return;
1541
1543
  const { skeleton: a } = o, c = this._renderManagerService.getRenderById(s);
@@ -1551,33 +1553,33 @@ let Ce = class extends ce {
1551
1553
  );
1552
1554
  }
1553
1555
  };
1554
- Ce = Ri([
1555
- L(A.Rendered, Ce),
1556
- _e(0, C(ne)),
1557
- _e(1, z),
1558
- _e(2, S),
1559
- _e(3, N)
1560
- ], Ce);
1561
- var Ti = Object.defineProperty, bi = Object.getOwnPropertyDescriptor, Ii = (r, e, t, n) => {
1562
- for (var i = n > 1 ? void 0 : n ? bi(e, t) : e, s = r.length - 1, o; s >= 0; s--)
1563
- (o = r[s]) && (i = (n ? o(e, t, i) : o(i)) || i);
1564
- return n && i && Ti(e, t, i), i;
1565
- }, fe = (r, e) => (t, n) => e(t, n, r);
1566
- let Oe = class extends ce {
1567
- 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) {
1568
1570
  super();
1569
1571
  m(this, "_scene");
1570
1572
  m(this, "_currentDocumentModel");
1571
- m(this, "_fps$", new Vn(""));
1573
+ m(this, "_fps$", new zn(""));
1572
1574
  m(this, "fps$", this._fps$.asObservable());
1573
- this._renderManagerService = e, this._configService = t, this._currentUniverService = n, this._editorService = i, this._initialize();
1575
+ this._renderManagerService = e, this._configService = t, this._univerInstanceService = n, this._editorService = r, this._initialize();
1574
1576
  }
1575
1577
  _initialize() {
1576
1578
  this._renderManagerService.createRender$.pipe(ae(this.dispose$)).subscribe((e) => {
1577
1579
  this._create(e);
1578
- }), this._currentUniverService.currentDoc$.pipe(ae(this.dispose$)).subscribe((e) => {
1580
+ }), this._univerInstanceService.getCurrentTypeOfUnit$(S.UNIVER_DOC).pipe(ae(this.dispose$)).subscribe((e) => {
1579
1581
  this._create(e == null ? void 0 : e.getUnitId());
1580
- }), this._currentUniverService.getAllUniverDocsInstance().forEach((e) => {
1582
+ }), this._univerInstanceService.getAllUnitsForType(S.UNIVER_DOC).forEach((e) => {
1581
1583
  this._create(e.getUnitId());
1582
1584
  });
1583
1585
  }
@@ -1587,67 +1589,68 @@ let Oe = class extends ce {
1587
1589
  _create(e) {
1588
1590
  if (e == null)
1589
1591
  return;
1590
- const t = this._currentUniverService.getUniverDocInstance(e);
1592
+ const t = this._univerInstanceService.getUniverDocInstance(e);
1591
1593
  t != null && (this._currentDocumentModel = t, this._renderManagerService.has(e) || this._addNewRender());
1592
1594
  }
1595
+ // eslint-disable-next-line max-lines-per-function
1593
1596
  _addNewRender() {
1594
- const e = this._currentDocumentModel, t = e.getUnitId(), n = e.getContainer(), i = e.getParentRenderUnitId();
1595
- 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)
1596
1599
  throw new Error("container or parentRenderUnitId can only exist one");
1597
- 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);
1598
1601
  const s = this._renderManagerService.getRenderById(t);
1599
1602
  if (s == null)
1600
1603
  return;
1601
1604
  const { scene: o, engine: a } = s;
1602
1605
  o.openTransformer(), this._scene = o;
1603
- const c = new $n(Ae.VIEW_MAIN, o, {
1606
+ const c = new An(Ae.VIEW_MAIN, o, {
1604
1607
  left: 0,
1605
1608
  top: 0,
1606
1609
  bottom: 0,
1607
1610
  right: 0,
1608
1611
  isWheelPreventDefaultX: !0
1609
1612
  });
1610
- o.attachControl(), o.on(Bn.wheel, (h, _) => {
1613
+ o.attachControl(), o.on($n.wheel, (h, p) => {
1611
1614
  const g = h;
1612
1615
  if (g.ctrlKey) {
1613
1616
  const f = Math.abs(g.deltaX);
1614
1617
  let l = f < 40 ? 0.2 : f < 80 ? 0.4 : 0.2;
1615
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();
1616
1619
  } else
1617
- c.onMouseWheel(g, _);
1620
+ c.onMouseWheel(g, p);
1618
1621
  }), this._configService.getConfig("hasScroll") !== !1 && new He(c), o.addLayer(
1619
- new ht(o, [], Fe),
1620
- new ht(o, [], Dn)
1622
+ new ht(o, [], je),
1623
+ new ht(o, [], xn)
1621
1624
  ), this._addComponent(s), this._currentDocumentModel.getShouldRenderLoopImmediately() && a.runRenderLoop(() => {
1622
1625
  o.render(), this._fps$.next(Math.round(a.getFps()).toString());
1623
1626
  }), this._renderManagerService.setCurrent(t);
1624
1627
  }
1625
1628
  _addComponent(e) {
1626
- const t = this._scene, n = this._currentDocumentModel, i = new wn(lt.MAIN, void 0, {
1629
+ const t = this._scene, n = this._currentDocumentModel, r = new Bn(lt.MAIN, void 0, {
1627
1630
  pageMarginLeft: n.documentStyle.marginLeft || 0,
1628
1631
  pageMarginTop: n.documentStyle.marginTop || 0
1629
1632
  });
1630
- i.zIndex = Pn, e.mainComponent = i, e.components.set(lt.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);
1631
1634
  }
1632
1635
  };
1633
- Oe = Ii([
1634
- L(A.Starting, Oe),
1635
- fe(0, z),
1636
- fe(1, kt),
1636
+ Re = Ir([
1637
+ N(A.Starting, Re),
1638
+ fe(0, W),
1639
+ fe(1, zt),
1637
1640
  fe(2, D),
1638
- fe(3, N)
1639
- ], Oe);
1640
- var Mi = Object.defineProperty, yi = Object.getOwnPropertyDescriptor, Ei = (r, e, t, n) => {
1641
- for (var i = n > 1 ? void 0 : n ? yi(e, t) : e, s = r.length - 1, o; s >= 0; s--)
1642
- (o = r[s]) && (i = (n ? o(e, t, i) : o(i)) || i);
1643
- return n && i && Mi(e, t, i), i;
1644
- }, q = (r, e) => (t, n) => e(t, n, r);
1645
- let Re = class extends Y {
1646
- 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) {
1647
1650
  super();
1648
1651
  m(this, "_liquid", new Fn());
1649
1652
  m(this, "_pageMarginCache", /* @__PURE__ */ new Map());
1650
- this._docSkeletonManagerService = e, this._currentUniverService = t, this._renderManagerService = n, this._commandService = i, this._floatingObjectManagerService = s, this._editorService = o, this._initialize(), this._commandExecutedListener();
1653
+ this._docSkeletonManagerService = e, this._univerInstanceService = t, this._renderManagerService = n, this._commandService = r, this._floatingObjectManagerService = s, this._editorService = o, this._initialize(), this._commandExecutedListener();
1651
1654
  }
1652
1655
  _initialize() {
1653
1656
  this._initialRenderRefresh(), this._updateOnPluginChange();
@@ -1657,30 +1660,30 @@ let Re = class extends Y {
1657
1660
  const t = this._docSkeletonManagerService.getCurrent();
1658
1661
  if (t == null)
1659
1662
  return;
1660
- const { unitId: n, skeleton: i } = t, s = this._renderManagerService.getRenderById(n);
1663
+ const { unitId: n, skeleton: r } = t, s = this._renderManagerService.getRenderById(n);
1661
1664
  if (s == null)
1662
1665
  return;
1663
1666
  const { mainComponent: o, components: a, scene: c } = s, d = o, { left: u, top: h } = d;
1664
- e.forEach((_) => {
1665
- const { unitId: g, subUnitId: f, floatingObjectId: l, floatingObject: p } = _, { left: O = 0, top: y = 0, width: w = 0, height: F = 0, angle: j, flipX: X, flipY: G, skewX: he, skewY: ge } = p, x = this._pageMarginCache.get(l), Nt = (x == null ? void 0 : x.marginLeft) || 0, $t = (x == null ? void 0 : x.marginTop) || 0;
1666
- i == null || i.getViewModel().getDataModel().updateDrawing(l, {
1667
- left: O - u - Nt,
1667
+ e.forEach((p) => {
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,
1668
1671
  top: y - h - $t,
1669
- height: F,
1670
- width: w
1672
+ height: w,
1673
+ width: L
1671
1674
  });
1672
- }), i == null || i.calculate(), o == null || o.makeDirty();
1675
+ }), r == null || r.calculate(), o == null || o.makeDirty();
1673
1676
  });
1674
1677
  }
1675
1678
  _initialRenderRefresh() {
1676
1679
  this._docSkeletonManagerService.currentSkeleton$.subscribe((e) => {
1677
1680
  if (e == null)
1678
1681
  return;
1679
- const { skeleton: t, unitId: n } = e, i = this._renderManagerService.getRenderById(n);
1680
- if (i == null)
1682
+ const { skeleton: t, unitId: n } = e, r = this._renderManagerService.getRenderById(n);
1683
+ if (r == null)
1681
1684
  return;
1682
- const { mainComponent: s } = i;
1683
- s.changeSkeleton(t), this._refreshFloatingObject(n, t, i);
1685
+ const { mainComponent: s } = r;
1686
+ s.changeSkeleton(t), this._refreshFloatingObject(n, t, r);
1684
1687
  });
1685
1688
  }
1686
1689
  _commandExecutedListener() {
@@ -1689,7 +1692,7 @@ let Re = class extends Y {
1689
1692
  this._commandService.onCommandExecuted((t) => {
1690
1693
  var n;
1691
1694
  if (e.includes(t.id)) {
1692
- const i = t.params, { unitId: s } = i, o = this._docSkeletonManagerService.getCurrent();
1695
+ const r = t.params, { unitId: s } = r, o = this._docSkeletonManagerService.getCurrent();
1693
1696
  if (o == null)
1694
1697
  return;
1695
1698
  const { unitId: a, skeleton: c } = o;
@@ -1708,18 +1711,18 @@ let Re = class extends Y {
1708
1711
  );
1709
1712
  }
1710
1713
  _refreshFloatingObject(e, t, n) {
1711
- const i = t == null ? void 0 : t.getSkeletonData(), { mainComponent: s, scene: o } = n, a = s;
1712
- if (!i)
1714
+ const r = t == null ? void 0 : t.getSkeletonData(), { mainComponent: s, scene: o } = n, a = s;
1715
+ if (!r)
1713
1716
  return;
1714
- const { left: c, top: d, pageLayoutType: u, pageMarginLeft: h, pageMarginTop: _ } = a, { pages: g } = i, f = [];
1717
+ const { left: c, top: d, pageLayoutType: u, pageMarginLeft: h, pageMarginTop: p } = a, { pages: g } = r, f = [];
1715
1718
  o.getAncestorScale(), this._liquid.reset(), this._pageMarginCache.clear();
1716
- for (let l = 0, p = g.length; l < p; l++) {
1717
- const O = g[l], { skeDrawings: y, marginLeft: w, marginTop: F } = O;
1718
- this._liquid.translatePagePadding(O), y.forEach((j) => {
1719
+ for (let l = 0, _ = g.length; l < _; l++) {
1720
+ const R = g[l], { skeDrawings: y, marginLeft: L, marginTop: w } = R;
1721
+ this._liquid.translatePagePadding(R), y.forEach((j) => {
1719
1722
  const { aLeft: X, aTop: G, height: he, width: ge, objectId: x } = j;
1720
1723
  f.push({
1721
1724
  unitId: e,
1722
- subUnitId: Vt,
1725
+ subUnitId: kt,
1723
1726
  floatingObjectId: x,
1724
1727
  floatingObject: {
1725
1728
  left: X + c + this._liquid.x,
@@ -1731,57 +1734,59 @@ let Re = class extends Y {
1731
1734
  marginLeft: this._liquid.x,
1732
1735
  marginTop: this._liquid.y
1733
1736
  });
1734
- }), this._liquid.translatePage(O, u, h, _);
1737
+ }), this._liquid.translatePage(R, u, h, p);
1735
1738
  }
1736
1739
  this._floatingObjectManagerService.BatchAddOrUpdate(f);
1737
1740
  }
1738
1741
  };
1739
- Re = Ei([
1740
- L(A.Steady, Re),
1741
- q(0, C(ne)),
1742
+ Te = yr([
1743
+ N(A.Steady, Te),
1744
+ q(0, O(ne)),
1742
1745
  q(1, D),
1743
- q(2, z),
1744
- q(3, S),
1746
+ q(2, W),
1747
+ q(3, v),
1745
1748
  q(4, Ht),
1746
- q(5, N)
1747
- ], Re);
1748
- var xi = Object.defineProperty, Di = Object.getOwnPropertyDescriptor, Pi = (r, e, t, n) => {
1749
- for (var i = n > 1 ? void 0 : n ? Di(e, t) : e, s = r.length - 1, o; s >= 0; s--)
1750
- (o = r[s]) && (i = (n ? o(e, t, i) : o(i)) || i);
1751
- return n && i && xi(e, t, i), i;
1752
- }, We = (r, e) => (t, n) => e(t, n, r);
1753
- const Ui = "rgba(198, 198, 198, 1)", Li = "rgba(255, 255, 255, 1)";
1754
- let Te = class extends Y {
1755
- constructor(r, e, t) {
1756
- super(), this._renderManagerService = r, this._editorService = e, this._currentUniverService = t, this._initialize(), this._commandExecutedListener();
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();
1757
1760
  }
1758
1761
  _initialize() {
1759
1762
  this._initialRenderRefresh();
1760
1763
  }
1761
1764
  _initialRenderRefresh() {
1762
- this._renderManagerService.currentRender$.subscribe((r) => {
1765
+ this._renderManagerService.currentRender$.subscribe((i) => {
1763
1766
  var s;
1764
- if (r == null)
1767
+ if (i == null)
1765
1768
  return;
1766
- const e = this._renderManagerService.getRenderById(r);
1767
- 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)
1768
1771
  return;
1769
- 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();
1770
1773
  this.disposeWithMe(
1771
- B(
1774
+ F(
1772
1775
  n.onPageRenderObservable.add((o) => {
1773
- var l, p, O, y;
1774
- if (this._editorService.isEditor(r))
1776
+ var _, R, y, L;
1777
+ if (this._editorService.isEditor(i))
1775
1778
  return;
1776
- const { page: a, pageLeft: c, pageTop: d, ctx: u } = o, { width: h, pageWidth: _, height: g, pageHeight: f } = a;
1777
- u.save(), u.translate(c - 0.5, d - 0.5), jn.drawWith(u, {
1778
- width: (p = (l = i == null ? void 0 : i.width) != null ? l : _) != null ? p : h,
1779
- height: (y = (O = i == null ? void 0 : i.height) != null ? O : f) != null ? y : g,
1779
+ const { page: a, pageLeft: c, pageTop: d, ctx: u } = o, { width: h, pageWidth: p, height: g, pageHeight: f } = a;
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,
1780
1784
  strokeWidth: 1,
1781
- stroke: Ui,
1782
- fill: Li,
1785
+ stroke: Pr,
1786
+ fill: Ur,
1783
1787
  zIndex: 3
1784
- }), u.restore();
1788
+ };
1789
+ wn.drawWith(u, l), u.restore();
1785
1790
  })
1786
1791
  )
1787
1792
  );
@@ -1790,22 +1795,22 @@ let Te = class extends Y {
1790
1795
  _commandExecutedListener() {
1791
1796
  }
1792
1797
  };
1793
- Te = Pi([
1794
- L(A.Rendered, Te),
1795
- We(0, z),
1796
- We(1, N),
1798
+ Ie = Dr([
1799
+ N(A.Rendered, Ie),
1800
+ We(0, W),
1801
+ We(1, $),
1797
1802
  We(2, D)
1798
- ], Te);
1799
- var Ai = Object.defineProperty, Ni = Object.getOwnPropertyDescriptor, $i = (r, e, t, n) => {
1800
- for (var i = n > 1 ? void 0 : n ? Ni(e, t) : e, s = r.length - 1, o; s >= 0; s--)
1801
- (o = r[s]) && (i = (n ? o(e, t, i) : o(i)) || i);
1802
- return n && i && Ai(e, t, i), i;
1803
- }, 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);
1804
1809
  let be = class extends Y {
1805
- constructor(e, t, n, i, s, o) {
1810
+ constructor(e, t, n, r, s, o) {
1806
1811
  super();
1807
1812
  m(this, "_initializedRender", /* @__PURE__ */ new Set());
1808
- this._docSkeletonManagerService = e, this._currentUniverService = t, this._commandService = n, this._renderManagerService = i, this._textSelectionManagerService = s, this._editorService = o, this._initialize();
1813
+ this._docSkeletonManagerService = e, this._univerInstanceService = t, this._commandService = n, this._renderManagerService = r, this._textSelectionManagerService = s, this._editorService = o, this._initialize();
1809
1814
  }
1810
1815
  dispose() {
1811
1816
  super.dispose();
@@ -1821,20 +1826,23 @@ let be = class extends Y {
1821
1826
  if (n == null || this._initializedRender.has(t) || this._editorService.isEditor(t))
1822
1827
  return;
1823
1828
  this._initializedRender.add(t);
1824
- const { scene: i } = n;
1829
+ const { scene: r } = n;
1825
1830
  this.disposeWithMe(
1826
- B(
1827
- i.onMouseWheelObserver.add((s) => {
1831
+ F(
1832
+ r.onMouseWheelObserver.add((s) => {
1828
1833
  if (!s.ctrlKey)
1829
1834
  return;
1830
- const o = Math.abs(s.deltaX);
1831
- let a = o < 40 ? 0.2 : o < 80 ? 0.4 : 0.2;
1832
- a *= s.deltaY > 0 ? -1 : 1, i.scaleX < 1 && (a /= 2);
1833
- const c = this._currentUniverService.getCurrentUniverDocInstance(), d = c.zoomRatio;
1834
- let u = +Number.parseFloat(`${d + a}`).toFixed(1);
1835
- u = u >= 4 ? 4 : u <= 0.1 ? 0.1 : u, this._commandService.executeCommand(Un.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, {
1836
1844
  zoomRatio: u,
1837
- unitId: c.getUnitId()
1845
+ unitId: o.getUnitId()
1838
1846
  }), s.preventDefault();
1839
1847
  })
1840
1848
  )
@@ -1850,11 +1858,14 @@ let be = class extends Y {
1850
1858
  // }
1851
1859
  _skeletonListener() {
1852
1860
  this.disposeWithMe(
1853
- B(
1861
+ F(
1854
1862
  this._docSkeletonManagerService.currentSkeleton$.subscribe((e) => {
1855
1863
  if (e == null)
1856
1864
  return;
1857
- const n = this._currentUniverService.getCurrentUniverDocInstance().zoomRatio || 1;
1865
+ const t = this._univerInstanceService.getCurrentUniverDocInstance();
1866
+ if (!t)
1867
+ return;
1868
+ const n = t.zoomRatio || 1;
1858
1869
  this._updateViewZoom(n, !1);
1859
1870
  })
1860
1871
  )
@@ -1865,7 +1876,10 @@ let be = class extends Y {
1865
1876
  this.disposeWithMe(
1866
1877
  this._commandService.onCommandExecuted((t) => {
1867
1878
  if (e.includes(t.id)) {
1868
- 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;
1869
1883
  if (s !== n.getUnitId())
1870
1884
  return;
1871
1885
  const o = n.zoomRatio || 1;
@@ -1875,49 +1889,49 @@ let be = class extends Y {
1875
1889
  );
1876
1890
  }
1877
1891
  _updateViewZoom(e, t = !0) {
1878
- var i;
1892
+ var r;
1879
1893
  const n = this._getDocObject();
1880
- 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());
1881
1895
  }
1882
1896
  _calculatePagePosition(e, t) {
1883
- 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;
1884
1898
  if (s == null || o === Number.POSITIVE_INFINITY || a === Number.POSITIVE_INFINITY)
1885
1899
  return;
1886
1900
  const { width: u, height: h } = s;
1887
- let _ = 0, g = 0, f = 0, l = 0, p = Number.POSITIVE_INFINITY;
1888
- u > (o + c * 2) * t ? (_ = u / 2 - o * t / 2, _ /= t, f = (u - c * 2) / t, p = 0) : (_ = c, f = o + c * 2, p = (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(_, g);
1889
- const O = i.getViewport(Ae.VIEW_MAIN);
1890
- if (p !== Number.POSITIVE_INFINITY && O != null) {
1891
- const y = O.getBarScroll(p, 0).x;
1892
- O.scrollTo({
1901
+ let p = 0, g = 0, f = 0, l = 0, _ = Number.POSITIVE_INFINITY;
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({
1893
1907
  x: y
1894
1908
  });
1895
1909
  }
1896
1910
  return this;
1897
1911
  }
1898
1912
  _getDocObject() {
1899
- return Et(this._currentUniverService, this._renderManagerService);
1913
+ return Et(this._univerInstanceService, this._renderManagerService);
1900
1914
  }
1901
1915
  };
1902
- be = $i([
1903
- L(A.Rendered, be),
1904
- K(0, C(ne)),
1916
+ be = Ar([
1917
+ N(A.Rendered, be),
1918
+ K(0, O(ne)),
1905
1919
  K(1, D),
1906
- K(2, S),
1907
- K(3, z),
1908
- K(4, C(te)),
1909
- K(5, N)
1920
+ K(2, v),
1921
+ K(3, W),
1922
+ K(4, O(te)),
1923
+ K(5, $)
1910
1924
  ], be);
1911
- var Bi = Object.defineProperty, wi = Object.getOwnPropertyDescriptor, Fi = (r, e, t, n) => {
1912
- for (var i = n > 1 ? void 0 : n ? wi(e, t) : e, s = r.length - 1, o; s >= 0; s--)
1913
- (o = r[s]) && (i = (n ? o(e, t, i) : o(i)) || i);
1914
- return n && i && Bi(e, t, i), i;
1915
- }, H = (r, e) => (t, n) => e(t, n, r);
1916
- let Ie = class extends Y {
1917
- 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) {
1918
1932
  super();
1919
1933
  m(this, "_loadedMap", /* @__PURE__ */ new WeakSet());
1920
- this._docSkeletonManagerService = e, this._currentUniverService = t, this._commandService = n, this._renderManagerService = i, this._textSelectionRenderManager = s, this._textSelectionManagerService = o, this._editorService = a, this._initialize();
1934
+ this._docSkeletonManagerService = e, this._univerInstanceService = t, this._commandService = n, this._renderManagerService = r, this._textSelectionRenderManager = s, this._textSelectionManagerService = o, this._editorService = a, this._initialize();
1921
1935
  }
1922
1936
  _initialize() {
1923
1937
  this._init(), this._skeletonListener(), this._commandExecutedListener();
@@ -1932,7 +1946,7 @@ let Ie = class extends Y {
1932
1946
  });
1933
1947
  }
1934
1948
  _create(e) {
1935
- if (e == null || this._currentUniverService.getUniverDocInstance(e) == null)
1949
+ if (e == null || this._univerInstanceService.getUniverDocInstance(e) == null)
1936
1950
  return;
1937
1951
  const t = this._getDocObjectById(e);
1938
1952
  t == null || t.document == null || this._loadedMap.has(t.document) || (this._initialMain(e), this._loadedMap.add(t.document));
@@ -1941,25 +1955,26 @@ let Ie = class extends Y {
1941
1955
  const t = this._getDocObjectById(e);
1942
1956
  if (t == null)
1943
1957
  return;
1944
- const { document: n, scene: i } = t;
1958
+ const { document: n, scene: r } = t;
1945
1959
  this.disposeWithMe(
1946
- B(
1960
+ F(
1947
1961
  n.onPointerEnterObserver.add(() => {
1948
1962
  this._isEditorReadOnly(e) || (n.cursor = gt.TEXT);
1949
1963
  })
1950
1964
  )
1951
1965
  ), this.disposeWithMe(
1952
- B(
1966
+ F(
1953
1967
  n.onPointerLeaveObserver.add(() => {
1954
- n.cursor = gt.DEFAULT, i.resetCursor();
1968
+ n.cursor = gt.DEFAULT, r.resetCursor();
1955
1969
  })
1956
1970
  )
1957
1971
  ), this.disposeWithMe(
1958
- B(
1972
+ F(
1959
1973
  n == null ? void 0 : n.onPointerDownObserver.add((s, o) => {
1960
1974
  if (this._isEditorReadOnly(e))
1961
1975
  return;
1962
- 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);
1963
1978
  const { offsetX: c, offsetY: d } = s;
1964
1979
  this._editorService.getEditor(e) && setTimeout(() => {
1965
1980
  this._setEditorFocus(e), this._textSelectionRenderManager.setCursorManually(c, d);
@@ -1967,13 +1982,13 @@ let Ie = class extends Y {
1967
1982
  })
1968
1983
  )
1969
1984
  ), this.disposeWithMe(
1970
- B(
1985
+ F(
1971
1986
  n == null ? void 0 : n.onDblclickObserver.add((s) => {
1972
1987
  this._isEditorReadOnly(e) || this._textSelectionRenderManager.handleDblClick(s);
1973
1988
  })
1974
1989
  )
1975
1990
  ), this.disposeWithMe(
1976
- B(
1991
+ F(
1977
1992
  n == null ? void 0 : n.onTripleClickObserver.add((s) => {
1978
1993
  this._isEditorReadOnly(e) || this._textSelectionRenderManager.handleTripleClick(s);
1979
1994
  })
@@ -1985,8 +2000,8 @@ let Ie = class extends Y {
1985
2000
  return t ? t.isReadOnly() : !1;
1986
2001
  }
1987
2002
  _setEditorFocus(e) {
1988
- if (this._currentUniverService.getAllUniverSheetsInstance().length > 0) {
1989
- const n = this._currentUniverService.getCurrentUniverSheetInstance();
2003
+ if (this._univerInstanceService.getAllUnitsForType(S.UNIVER_SHEET).length > 0) {
2004
+ const n = this._univerInstanceService.getCurrentUnitForType(S.UNIVER_SHEET);
1990
2005
  this._editorService.setOperationSheetUnitId(n.getUnitId());
1991
2006
  }
1992
2007
  this._editorService.focusStyle(e);
@@ -1997,7 +2012,7 @@ let Ie = class extends Y {
1997
2012
  this._commandService.onCommandExecuted((t) => {
1998
2013
  var n;
1999
2014
  if (e.includes(t.id)) {
2000
- 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;
2001
2016
  if (s !== o)
2002
2017
  return;
2003
2018
  this._textSelectionManagerService.refreshSelection();
@@ -2010,10 +2025,10 @@ let Ie = class extends Y {
2010
2025
  this._docSkeletonManagerService.currentSkeleton$.subscribe((e) => {
2011
2026
  if (e == null)
2012
2027
  return;
2013
- const { unitId: t, skeleton: n } = e, i = this._renderManagerService.getRenderById(t);
2014
- if (i == null)
2028
+ const { unitId: t, skeleton: n } = e, r = this._renderManagerService.getRenderById(t);
2029
+ if (r == null)
2015
2030
  return;
2016
- const { scene: s, mainComponent: o } = i;
2031
+ const { scene: s, mainComponent: o } = r;
2017
2032
  this._textSelectionRenderManager.changeRuntime(n, s, o), this._textSelectionManagerService.setCurrentSelectionNotRefresh({
2018
2033
  unitId: t,
2019
2034
  subUnitId: ""
@@ -2022,119 +2037,117 @@ let Ie = class extends Y {
2022
2037
  );
2023
2038
  }
2024
2039
  _getDocObjectById(e) {
2025
- return Ln(e, this._renderManagerService);
2040
+ return this._univerInstanceService.getUnitType(e) !== S.UNIVER_DOC ? null : Un(e, this._renderManagerService);
2026
2041
  }
2027
2042
  };
2028
- Ie = Fi([
2029
- L(A.Rendered, Ie),
2030
- H(0, C(ne)),
2043
+ Me = Fr([
2044
+ N(A.Rendered, Me),
2045
+ H(0, O(ne)),
2031
2046
  H(1, D),
2032
- H(2, S),
2033
- H(3, z),
2047
+ H(2, v),
2048
+ H(3, W),
2034
2049
  H(4, de),
2035
- H(5, C(te)),
2036
- H(6, N)
2037
- ], Ie);
2038
- var ji = Object.defineProperty, Wi = Object.getOwnPropertyDescriptor, zi = (r, e, t, n) => {
2039
- for (var i = n > 1 ? void 0 : n ? Wi(e, t) : e, s = r.length - 1, o; s >= 0; s--)
2040
- (o = r[s]) && (i = (n ? o(e, t, i) : o(i)) || i);
2041
- return n && i && ji(e, t, i), i;
2042
- }, oe = (r, e) => (t, n) => e(t, n, r);
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);
2043
2058
  const Ct = 1.5;
2044
- let Me = class extends ce {
2045
- constructor(r, e, t, n, i) {
2046
- super(), this._docSkeletonManagerService = r, this._textSelectionManagerService = e, this._editorService = t, this._currentUniverService = n, this._renderManagerService = i, this._init();
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();
2047
2062
  }
2048
2063
  _init() {
2049
- this._textSelectionManagerService.textSelection$.pipe(ae(this.dispose$)).subscribe((r) => {
2050
- if (r == null)
2064
+ this._textSelectionManagerService.textSelection$.pipe(ae(this.dispose$)).subscribe((i) => {
2065
+ if (i == null)
2051
2066
  return;
2052
- const { isEditing: e, unitId: t } = r;
2067
+ const { isEditing: e, unitId: t } = i;
2053
2068
  e && this._scrollToSelection(t);
2054
2069
  });
2055
2070
  }
2056
2071
  // Let the selection show on the current screen.
2057
- _scrollToSelection(r) {
2072
+ _scrollToSelection(i) {
2058
2073
  var x;
2059
2074
  const e = this._textSelectionManagerService.getActiveRange(), t = this._getDocObject(), n = (x = this._docSkeletonManagerService.getCurrent()) == null ? void 0 : x.skeleton;
2060
2075
  if (e == null || t == null || n == null)
2061
2076
  return;
2062
- const { collapsed: i, startNodePosition: s } = e;
2063
- if (!i)
2077
+ const { collapsed: r, startNodePosition: s } = e;
2078
+ if (!r)
2064
2079
  return;
2065
- const o = t.document.getOffsetConfig(), { docsLeft: a, docsTop: c } = o, d = new Wn(o, n), { contentBoxPointGroup: u } = d.getRangePointData(s, s), { left: h, top: _, height: g } = zn(u), f = h + a, l = _ + c, p = t.scene.getViewport(Ae.VIEW_MAIN), O = !!this._editorService.getEditor(r);
2066
- if (p == null)
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);
2081
+ if (_ == null)
2067
2082
  return;
2068
2083
  const {
2069
2084
  left: y,
2070
- top: w,
2071
- right: F,
2085
+ top: L,
2086
+ right: w,
2072
2087
  bottom: j
2073
- } = p.getBounding().viewBound;
2088
+ } = _.getBounding().viewBound;
2074
2089
  let X = 0, G = 0;
2075
- const he = O ? 0 : 100;
2076
- l < w ? X = l - w : l > j - g && (X = l - j + g + he), f < y ? G = f - y : f > F - Ct && (G = f - F + Ct);
2077
- const ge = p.getBarScroll(G, X);
2078
- p.scrollBy(ge);
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);
2092
+ const ge = _.getBarScroll(G, X);
2093
+ _.scrollBy(ge);
2079
2094
  }
2080
2095
  _getDocObject() {
2081
- return Et(this._currentUniverService, this._renderManagerService);
2096
+ return Et(this._univerInstanceService, this._renderManagerService);
2082
2097
  }
2083
2098
  };
2084
- Me = zi([
2085
- L(A.Rendered, Me),
2086
- oe(0, C(ne)),
2087
- oe(1, C(te)),
2088
- oe(2, N),
2099
+ ye = Vr([
2100
+ N(A.Rendered, ye),
2101
+ oe(0, O(ne)),
2102
+ oe(1, O(te)),
2103
+ oe(2, $),
2089
2104
  oe(3, D),
2090
- oe(4, z)
2091
- ], Me);
2092
- var ki = Object.defineProperty, Vi = Object.getOwnPropertyDescriptor, Hi = (r, e, t, n) => {
2093
- for (var i = n > 1 ? void 0 : n ? Vi(e, t) : e, s = r.length - 1, o; s >= 0; s--)
2094
- (o = r[s]) && (i = (n ? o(e, t, i) : o(i)) || i);
2095
- return n && i && ki(e, t, i), i;
2096
- }, ze = (r, e) => (t, n) => e(t, n, r), ke;
2097
- let Ot = (ke = class extends Yt {
2098
- constructor(r, e, t, n) {
2099
- super(Zn), this._config = r, this._injector = e, this._localeService = t, this._logService = n, this._localeService.load({
2100
- zhCN: Vr
2101
- }), this._config = qe.deepMerge({}, Gn, 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();
2102
2117
  }
2103
2118
  onRendered() {
2104
2119
  this._initModules(), this._markDocAsFocused();
2105
2120
  }
2106
- onDestroy() {
2107
- }
2108
2121
  _initializeCommands() {
2109
2122
  [
2123
+ qn,
2110
2124
  Kn,
2111
- Jn,
2112
- er,
2113
2125
  Qn,
2114
- tr,
2115
- nr,
2116
- rr,
2117
- ir,
2118
- or,
2119
- Yr,
2120
- Xr,
2121
- Hr
2122
- ].forEach((r) => {
2123
- this._injector.get(un).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);
2124
2137
  });
2125
2138
  }
2126
- _initDependencies(r) {
2139
+ _initDependencies(i) {
2127
2140
  [
2128
2141
  // Controller
2129
- [me],
2130
2142
  [Se],
2131
2143
  [ve],
2132
2144
  [Ce],
2133
- [Re],
2145
+ [Oe],
2134
2146
  [Te],
2135
- [be],
2136
2147
  [Ie],
2148
+ [be],
2137
2149
  [Me],
2150
+ [ye],
2138
2151
  [
2139
2152
  // controllers
2140
2153
  se,
@@ -2149,16 +2162,19 @@ let Ot = (ke = class extends Yt {
2149
2162
  }
2150
2163
  ],
2151
2164
  // Render views
2152
- [Oe]
2165
+ [Re]
2153
2166
  ].forEach((t) => {
2154
- r.add(t);
2167
+ i.add(t);
2155
2168
  });
2156
2169
  }
2157
2170
  _markDocAsFocused() {
2158
- const r = this._injector.get(D), e = this._injector.get(N);
2171
+ const i = this._injector.get(D), e = this._injector.get($);
2159
2172
  try {
2160
- const t = r.getCurrentUniverDocInstance(), n = t.getUnitId();
2161
- 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());
2162
2178
  } catch (t) {
2163
2179
  this._logService.warn(t);
2164
2180
  }
@@ -2166,22 +2182,22 @@ let Ot = (ke = class extends Yt {
2166
2182
  _initModules() {
2167
2183
  this._injector.get(se);
2168
2184
  }
2169
- }, m(ke, "type", Xt.Doc), ke);
2170
- Ot = Hi([
2171
- ze(1, C(De)),
2172
- ze(2, C(Ze)),
2173
- ze(3, bt)
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)
2174
2190
  ], Ot);
2175
2191
  export {
2176
- Zn as DOC_UI_PLUGIN_NAME,
2177
- Xn as DefaultDocContainerConfig,
2178
- Gn as DefaultDocUiConfig,
2179
- Yn as DefaultToolbarConfig,
2180
- Oe as DocCanvasView,
2181
- ti as PastePluginLark,
2182
- oi as PastePluginUniver,
2183
- ri as PastePluginWord,
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,
2184
2200
  Ot as UniverDocsUIPlugin,
2185
- no as enUS,
2186
- Vr as zhCN
2201
+ to as enUS,
2202
+ zi as zhCN
2187
2203
  };