@univerjs/docs 0.1.0-beta.3 → 0.1.0-beta.5

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.
Files changed (30) hide show
  1. package/lib/cjs/index.js +1 -2
  2. package/lib/es/index.js +1287 -1901
  3. package/lib/types/basics/retain-delete-params.d.ts +1 -1
  4. package/lib/types/commands/commands/ime-input.command.d.ts +2 -5
  5. package/lib/types/commands/commands/list.command.d.ts +4 -4
  6. package/lib/types/commands/mutations/core-editing.mutation.d.ts +10 -4
  7. package/lib/types/controllers/ime-input.controller.d.ts +3 -5
  8. package/lib/types/controllers/text-selection.controller.d.ts +1 -3
  9. package/lib/types/index.d.ts +5 -2
  10. package/lib/types/services/doc-skeleton-manager.service.d.ts +1 -1
  11. package/lib/types/services/doc-state-change-manager.service.d.ts +45 -0
  12. package/lib/types/services/ime-input-manager.service.d.ts +12 -1
  13. package/lib/types/services/text-selection-manager.service.d.ts +2 -1
  14. package/lib/umd/index.js +1 -2
  15. package/package.json +24 -15
  16. package/lib/types/commands/commands/clipboard.command.d.ts +0 -19
  17. package/lib/types/controllers/clipboard.controller.d.ts +0 -33
  18. package/lib/types/services/clipboard/__test__/html-and-udm-convert.spec.d.ts +0 -16
  19. package/lib/types/services/clipboard/clipboard.service.d.ts +0 -42
  20. package/lib/types/services/clipboard/copy-content-cache.d.ts +0 -25
  21. package/lib/types/services/clipboard/html-to-udm/converter.d.ts +0 -30
  22. package/lib/types/services/clipboard/html-to-udm/parse-node-style.d.ts +0 -17
  23. package/lib/types/services/clipboard/html-to-udm/parse-to-dom.d.ts +0 -16
  24. package/lib/types/services/clipboard/html-to-udm/paste-plugins/plugin-lark.d.ts +0 -18
  25. package/lib/types/services/clipboard/html-to-udm/paste-plugins/plugin-word.d.ts +0 -18
  26. package/lib/types/services/clipboard/html-to-udm/paste-plugins/type.d.ts +0 -30
  27. package/lib/types/services/clipboard/html-to-udm/utils.d.ts +0 -18
  28. package/lib/types/services/clipboard/udm-to-html/convertor.d.ts +0 -19
  29. package/lib/types/shortcuts/core-editing.shortcut.d.ts +0 -19
  30. package/lib/types/shortcuts/cursor.shortcut.d.ts +0 -25
package/lib/es/index.js CHANGED
@@ -1,59 +1,58 @@
1
- var kt = Object.defineProperty;
2
- var zt = (i, e, t) => e in i ? kt(i, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : i[e] = t;
3
- var S = (i, e, t) => (zt(i, typeof e != "symbol" ? e + "" : e, t), t);
4
- import { CommandType as I, RxDisposable as me, ICommandService as O, DOCS_NORMAL_EDITOR_UNIT_ID_KEY as K, IUniverInstanceService as y, IUndoRedoService as A, TextX as H, DataStreamTreeTokenType as Ye, Tools as ie, FOCUSING_DOC as N, EDITOR_ACTIVATED as _e, LocaleService as Ot, MemoryCursor as Ae, getDocsUpdateBody as Wt, UpdateDocsAttributeType as yt, DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY as J, BooleanNumber as E, BaselineOffset as V, PresetListType as bt, LRUMap as Ht, ColorKit as at, Disposable as X, toDisposable as qe, OnLifecycle as F, LifecycleStages as j, ILogService as Xt, IContextService as Gt, DEFAULT_DOCUMENT_SUB_COMPONENT_ID as Yt, IFloatingObjectManagerService as qt, Direction as D, IConfigService as Tt, Plugin as Zt, PluginType as Kt } from "@univerjs/core";
5
- import { NORMAL_TEXT_SELECTION_PLUGIN_STYLE as Jt, ITextSelectionRenderManager as Se, DocumentViewModel as Qt, DocumentSkeleton as en, hasListSpan as tn, isIndentBySpan as nn, isFirstSpan as rn, getParagraphBySpan as sn, PageLayoutType as ct, IRenderManagerService as G, Liquid as on, RANGE_DIRECTION as lt, NodePositionConvertToCursor as dt, Rect as an, CURSOR_TYPE as ut, Viewport as cn, EVENT_TYPE as ln, ScrollBar as dn, Layer as ht, Documents as un, TextSelectionRenderManager as hn } from "@univerjs/engine-render";
6
- import { BehaviorSubject as ue, takeUntil as ve } from "rxjs";
7
- import { CopyCommand as gn, CutCommand as pn, PasteCommand as fn, PLAIN_TEXT_CLIPBOARD_MIME_TYPE as mn, HTML_CLIPBOARD_MIME_TYPE as _n, IClipboardInterfaceService as Sn, LayoutService as vn, KeyCode as $, MetaKeys as Me, IShortcutService as Mn } from "@univerjs/ui";
8
- import { Inject as w, createIdentifier as Cn, Optional as In, Injector as Rn } from "@wendellhu/redi";
9
- function $e(i, e) {
10
- const n = i.getCurrentUniverDocInstance().getUnitId(), r = e.getRenderById(n);
1
+ var Rt = Object.defineProperty;
2
+ var Ot = (s, e, t) => e in s ? Rt(s, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : s[e] = t;
3
+ var v = (s, e, t) => (Ot(s, typeof e != "symbol" ? e + "" : e, t), t);
4
+ import { CommandType as C, RxDisposable as ee, ICommandService as b, TextXActionType as x, DOCS_NORMAL_EDITOR_UNIT_ID_KEY as Y, IUniverInstanceService as y, IUndoRedoService as Re, UndoCommandId as qe, RedoCommandId as Ze, TextX as A, DataStreamTreeTokenType as Fe, Tools as oe, LocaleService as dt, MemoryCursor as Oe, getDocsUpdateBody as xt, UpdateDocsAttributeType as ut, DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY as q, BooleanNumber as V, BaselineOffset as k, PresetListType as ht, OnLifecycle as j, LifecycleStages as z, Disposable as W, DEFAULT_DOCUMENT_SUB_COMPONENT_ID as bt, IFloatingObjectManagerService as yt, Direction as U, toDisposable as Ke, IConfigService as gt, Plugin as Tt, PluginType as Dt } from "@univerjs/core";
5
+ import { NORMAL_TEXT_SELECTION_PLUGIN_STYLE as Pt, ITextSelectionRenderManager as ae, DocumentViewModel as Et, DocumentSkeleton as wt, hasListSpan as Ut, isIndentBySpan as Nt, isFirstSpan as At, getParagraphBySpan as Lt, PageLayoutType as Je, IRenderManagerService as X, Liquid as $t, RANGE_DIRECTION as Qe, NodePositionConvertToCursor as et, Rect as Bt, CURSOR_TYPE as tt, Viewport as Ft, EVENT_TYPE as jt, ScrollBar as zt, Layer as nt, Documents as Vt, TextSelectionRenderManager as kt } from "@univerjs/engine-render";
6
+ import { BehaviorSubject as K, takeUntil as ce } from "rxjs";
7
+ import { Inject as E, Injector as Ht } from "@wendellhu/redi";
8
+ function ke(s, e) {
9
+ const n = s.getCurrentUniverDocInstance().getUnitId(), r = e.getRenderById(n);
11
10
  if (r == null)
12
11
  return;
13
- const { mainComponent: s, scene: o, engine: a } = r;
12
+ const { mainComponent: i, scene: o, engine: a } = r;
14
13
  return {
15
- document: s,
14
+ document: i,
16
15
  scene: o,
17
16
  engine: a
18
17
  };
19
18
  }
20
- function xn(i, e) {
21
- const t = e.getRenderById(i);
19
+ function Wt(s, e) {
20
+ const t = e.getRenderById(s);
22
21
  if (t == null)
23
22
  return;
24
- const { mainComponent: n, scene: r, engine: s } = t;
23
+ const { mainComponent: n, scene: r, engine: i } = t;
25
24
  return {
26
25
  document: n,
27
26
  scene: r,
28
- engine: s
27
+ engine: i
29
28
  };
30
29
  }
31
- var Ze = /* @__PURE__ */ ((i) => (i.MAIN = "__Document_Render_Main__", i))(Ze || {}), Qe = /* @__PURE__ */ ((i) => (i.VIEW_MAIN = "viewMain", i.VIEW_TOP = "viewTop", i.VIEW_LEFT = "viewLeft", i.VIEW_LEFT_TOP = "viewLeftTop", i))(Qe || {});
32
- const gt = 0, On = 2, yn = 10, gi = "normalTextSelectionPluginName", Dt = {
30
+ var je = /* @__PURE__ */ ((s) => (s.MAIN = "__Document_Render_Main__", s))(je || {}), He = /* @__PURE__ */ ((s) => (s.VIEW_MAIN = "viewMain", s.VIEW_TOP = "viewTop", s.VIEW_LEFT = "viewLeft", s.VIEW_LEFT_TOP = "viewLeftTop", s))(He || {});
31
+ const rt = 0, Xt = 2, Gt = 10, hr = "normalTextSelectionPluginName", mt = {
33
32
  id: "doc.operation.set-selections",
34
- type: I.OPERATION,
35
- handler: (i, e) => !0
33
+ type: C.OPERATION,
34
+ handler: (s, e) => !0
36
35
  };
37
- var bn = Object.defineProperty, Tn = Object.getOwnPropertyDescriptor, Dn = (i, e, t, n) => {
38
- for (var r = n > 1 ? void 0 : n ? Tn(e, t) : e, s = i.length - 1, o; s >= 0; s--)
39
- (o = i[s]) && (r = (n ? o(e, t, r) : o(r)) || r);
40
- return n && r && bn(e, t, r), r;
41
- }, pt = (i, e) => (t, n) => e(t, n, i);
42
- function ft(i) {
43
- const { startOffset: e, endOffset: t, collapsed: n } = i;
36
+ var Yt = Object.defineProperty, qt = Object.getOwnPropertyDescriptor, Zt = (s, e, t, n) => {
37
+ for (var r = n > 1 ? void 0 : n ? qt(e, t) : e, i = s.length - 1, o; i >= 0; i--)
38
+ (o = s[i]) && (r = (n ? o(e, t, r) : o(r)) || r);
39
+ return n && r && Yt(e, t, r), r;
40
+ }, it = (s, e) => (t, n) => e(t, n, s);
41
+ function Ie(s) {
42
+ const { startOffset: e, endOffset: t, collapsed: n } = s;
44
43
  return {
45
44
  startOffset: e,
46
45
  endOffset: t,
47
46
  collapsed: n
48
47
  };
49
48
  }
50
- let U = class extends me {
49
+ let w = class extends ee {
51
50
  constructor(e, t) {
52
51
  super();
53
- S(this, "_currentSelection", null);
54
- S(this, "_textSelectionInfo", /* @__PURE__ */ new Map());
55
- S(this, "_textSelection$", new ue(null));
56
- S(this, "textSelection$", this._textSelection$.asObservable());
52
+ v(this, "_currentSelection", null);
53
+ v(this, "_textSelectionInfo", /* @__PURE__ */ new Map());
54
+ v(this, "_textSelection$", new K(null));
55
+ v(this, "textSelection$", this._textSelection$.asObservable());
57
56
  this._textSelectionRenderManager = e, this._commandService = t, this._syncSelectionFromRenderService();
58
57
  }
59
58
  getCurrentSelection() {
@@ -84,17 +83,17 @@ let U = class extends me {
84
83
  const e = this._getTextRanges(this._currentSelection);
85
84
  if (e == null)
86
85
  return;
87
- const { textRanges: t, segmentId: n, style: r } = e, s = t.find((g) => g.isActive());
88
- if (s == null)
86
+ const { textRanges: t, segmentId: n, style: r } = e, i = t.find((h) => h.isActive());
87
+ if (i == null)
89
88
  return null;
90
- const { startOffset: o, endOffset: a, collapsed: c, startNodePosition: d, endNodePosition: l, direction: h } = s;
89
+ const { startOffset: o, endOffset: a, collapsed: l, startNodePosition: d, endNodePosition: c, direction: u } = i;
91
90
  return o == null || a == null ? null : {
92
91
  startOffset: o,
93
92
  endOffset: a,
94
- collapsed: c,
93
+ collapsed: l,
95
94
  startNodePosition: d,
96
- endNodePosition: l,
97
- direction: h,
95
+ endNodePosition: c,
96
+ direction: u,
98
97
  segmentId: n,
99
98
  style: r
100
99
  };
@@ -105,7 +104,7 @@ let U = class extends me {
105
104
  ...this._currentSelection,
106
105
  textRanges: e,
107
106
  segmentId: "",
108
- style: Jt
107
+ style: Pt
109
108
  // mock style.
110
109
  });
111
110
  }
@@ -114,7 +113,7 @@ let U = class extends me {
114
113
  }
115
114
  // All textRanges should be synchronized from the render layer.
116
115
  _syncSelectionFromRenderService() {
117
- this._textSelectionRenderManager.textSelectionInner$.pipe(ve(this.dispose$)).subscribe((e) => {
116
+ this._textSelectionRenderManager.textSelectionInner$.pipe(ce(this.dispose$)).subscribe((e) => {
118
117
  e != null && this._replaceTextRangesWithNoRefresh(e);
119
118
  });
120
119
  }
@@ -126,13 +125,13 @@ let U = class extends me {
126
125
  ...e
127
126
  };
128
127
  this._replaceByParam(t), this._textSelection$.next(t);
129
- const { unitId: n, subUnitId: r, segmentId: s, style: o, textRanges: a } = t;
130
- this._commandService.executeCommand(Dt.id, {
128
+ const { unitId: n, subUnitId: r, segmentId: i, style: o, textRanges: a } = t;
129
+ this._commandService.executeCommand(mt.id, {
131
130
  unitId: n,
132
131
  subUnitId: r,
133
- segmentId: s,
132
+ segmentId: i,
134
133
  style: o,
135
- ranges: a.map(ft)
134
+ ranges: a.map(Ie)
136
135
  });
137
136
  }
138
137
  _getTextRanges(e) {
@@ -144,52 +143,52 @@ let U = class extends me {
144
143
  }
145
144
  _refresh(e) {
146
145
  const t = this._getTextRanges(e);
147
- this._textSelectionRenderManager.removeAllTextRanges(), t && Array.isArray(t.textRanges) && t.textRanges.length && this._textSelectionRenderManager.addTextRanges(t.textRanges.map(ft));
146
+ this._textSelectionRenderManager.removeAllTextRanges(), t && Array.isArray(t.textRanges) && t.textRanges.length && this._textSelectionRenderManager.addTextRanges(t.textRanges.map(Ie));
148
147
  }
149
148
  _replaceByParam(e) {
150
- const { unitId: t, subUnitId: n, style: r, segmentId: s, textRanges: o } = e;
151
- this._textSelectionInfo.has(t) || this._textSelectionInfo.set(t, /* @__PURE__ */ new Map()), this._textSelectionInfo.get(t).set(n, { textRanges: o, style: r, segmentId: s });
149
+ const { unitId: t, subUnitId: n, style: r, segmentId: i, textRanges: o } = e;
150
+ this._textSelectionInfo.has(t) || this._textSelectionInfo.set(t, /* @__PURE__ */ new Map()), this._textSelectionInfo.get(t).set(n, { textRanges: o, style: r, segmentId: i });
152
151
  }
153
152
  _addByParam(e) {
154
- const { unitId: t, subUnitId: n, textRanges: r, style: s, segmentId: o } = e;
153
+ const { unitId: t, subUnitId: n, textRanges: r, style: i, segmentId: o } = e;
155
154
  this._textSelectionInfo.has(t) || this._textSelectionInfo.set(t, /* @__PURE__ */ new Map());
156
155
  const a = this._textSelectionInfo.get(t);
157
- a.has(n) ? a.get(n).textRanges.push(...r) : a.set(n, { textRanges: r, style: s, segmentId: o });
156
+ a.has(n) ? a.get(n).textRanges.push(...r) : a.set(n, { textRanges: r, style: i, segmentId: o });
158
157
  }
159
158
  };
160
- U = Dn([
161
- pt(0, Se),
162
- pt(1, O)
163
- ], U);
164
- function Be(i, e = "", t = 0) {
165
- const { startOffset: n, endOffset: r } = i, s = [], o = n - t, a = r - t;
166
- return o > 0 && s.push({
167
- t: "r",
159
+ w = Zt([
160
+ it(0, ae),
161
+ it(1, b)
162
+ ], w);
163
+ function We(s, e = "", t = 0) {
164
+ const { startOffset: n, endOffset: r } = s, i = [], o = n - t, a = r - t;
165
+ return o > 0 && i.push({
166
+ t: x.RETAIN,
168
167
  len: o,
169
168
  segmentId: e
170
- }), s.push({
171
- t: "d",
169
+ }), i.push({
170
+ t: x.DELETE,
172
171
  len: a - o,
173
172
  line: 0,
174
173
  segmentId: e
175
- }), s;
174
+ }), i;
176
175
  }
177
- var Pn = Object.defineProperty, En = Object.getOwnPropertyDescriptor, Un = (i, e, t, n) => {
178
- for (var r = n > 1 ? void 0 : n ? En(e, t) : e, s = i.length - 1, o; s >= 0; s--)
179
- (o = i[s]) && (r = (n ? o(e, t, r) : o(r)) || r);
180
- return n && r && Pn(e, t, r), r;
181
- }, wn = (i, e) => (t, n) => e(t, n, i);
182
- let se = class extends me {
176
+ var Kt = Object.defineProperty, Jt = Object.getOwnPropertyDescriptor, Qt = (s, e, t, n) => {
177
+ for (var r = n > 1 ? void 0 : n ? Jt(e, t) : e, i = s.length - 1, o; i >= 0; i--)
178
+ (o = s[i]) && (r = (n ? o(e, t, r) : o(r)) || r);
179
+ return n && r && Kt(e, t, r), r;
180
+ }, en = (s, e) => (t, n) => e(t, n, s);
181
+ let J = class extends ee {
183
182
  constructor(e) {
184
183
  super();
185
- S(this, "_currentViewModelUnitId", "");
186
- S(this, "_docViewModelMap", /* @__PURE__ */ new Map());
187
- S(this, "_currentDocViewModel$", new ue(null));
188
- S(this, "currentDocViewModel$", this._currentDocViewModel$.asObservable());
184
+ v(this, "_currentViewModelUnitId", "");
185
+ v(this, "_docViewModelMap", /* @__PURE__ */ new Map());
186
+ v(this, "_currentDocViewModel$", new K(null));
187
+ v(this, "currentDocViewModel$", this._currentDocViewModel$.asObservable());
189
188
  this._currentUniverService = e, this._initialize();
190
189
  }
191
190
  _initialize() {
192
- this._currentUniverService.currentDoc$.pipe(ve(this.dispose$)).subscribe((e) => {
191
+ this._currentUniverService.currentDoc$.pipe(ce(this.dispose$)).subscribe((e) => {
193
192
  if (e == null)
194
193
  return;
195
194
  const t = e.getUnitId();
@@ -219,7 +218,7 @@ let se = class extends me {
219
218
  docViewModel: r
220
219
  });
221
220
  }
222
- if (e === K) {
221
+ if (e === Y) {
223
222
  const r = (n = this._docViewModelMap.get(e)) == null ? void 0 : n.docViewModel;
224
223
  if (r == null)
225
224
  return;
@@ -229,215 +228,311 @@ let se = class extends me {
229
228
  }
230
229
  }
231
230
  _buildDocViewModel(e) {
232
- return new Qt(e);
231
+ return new Et(e);
233
232
  }
234
233
  };
235
- se = Un([
236
- wn(0, y)
237
- ], se);
238
- const _ = {
239
- id: "doc.mutation.rich-text-editing",
240
- type: I.MUTATION,
241
- handler: (i, e) => {
242
- const { unitId: t, mutations: n } = e, s = i.get(y).getUniverDocInstance(t), a = i.get(se).getViewModel(t);
243
- if (s == null || a == null)
234
+ J = Qt([
235
+ en(0, y)
236
+ ], J);
237
+ var tn = Object.defineProperty, nn = Object.getOwnPropertyDescriptor, rn = (s, e, t, n) => {
238
+ for (var r = n > 1 ? void 0 : n ? nn(e, t) : e, i = s.length - 1, o; i >= 0; i--)
239
+ (o = s[i]) && (r = (n ? o(e, t, r) : o(r)) || r);
240
+ return n && r && tn(e, t, r), r;
241
+ }, Le = (s, e) => (t, n) => e(t, n, s);
242
+ const sn = 300;
243
+ let Ce = class extends ee {
244
+ constructor(e, t, n) {
245
+ super();
246
+ v(this, "_docStateChange$", new K(null));
247
+ v(this, "docStateChange$", this._docStateChange$.asObservable());
248
+ v(this, "_stateCache", /* @__PURE__ */ new Map());
249
+ v(this, "_timer", null);
250
+ this._undoRedoService = e, this._commandService = t, this._univerInstanceService = n, this._initialize();
251
+ }
252
+ setChangeState(e) {
253
+ const { trigger: t, noHistory: n } = e;
254
+ t != null && (this._cacheChangeState(e), n || this._docStateChange$.next(e));
255
+ }
256
+ _initialize() {
257
+ this.disposeWithMe(
258
+ this._commandService.beforeCommandExecuted((e) => {
259
+ if (e.id === qe || e.id === Ze) {
260
+ const t = this._univerInstanceService.getCurrentUniverDocInstance();
261
+ if (t == null)
262
+ return;
263
+ const n = t.getUnitId();
264
+ this._pushHistory(n);
265
+ }
266
+ })
267
+ );
268
+ }
269
+ _cacheChangeState(e) {
270
+ const { trigger: t, unitId: n, noHistory: r } = e;
271
+ if (!(t === Ze || t === qe || r)) {
272
+ if (this._stateCache.has(n)) {
273
+ const i = this._stateCache.get(n);
274
+ i == null || i.push(e);
275
+ } else
276
+ this._stateCache.set(n, [e]);
277
+ t === be.id || t === ye.id ? (this._timer && clearTimeout(this._timer), this._timer = setTimeout(() => {
278
+ this._pushHistory(n);
279
+ }, sn)) : this._pushHistory(n);
280
+ }
281
+ }
282
+ _pushHistory(e) {
283
+ const t = this._undoRedoService, n = this._stateCache.get(e);
284
+ if (!Array.isArray(n) || n.length === 0)
285
+ return;
286
+ const r = n.length, i = n[0].commandId, o = n[0], a = n[r - 1], l = {
287
+ unitId: e,
288
+ actions: n.reduce((c, u) => A.compose(c, u.redoState.actions), []),
289
+ textRanges: a.redoState.textRanges
290
+ }, d = {
291
+ unitId: e,
292
+ // Always need to put undoParams after redoParams, because `reverse` will change the `cacheStates` order.
293
+ actions: n.reverse().reduce((c, u) => A.compose(c, u.undoState.actions), []),
294
+ textRanges: o.undoState.textRanges
295
+ };
296
+ t.pushUndoRedo({
297
+ unitID: e,
298
+ undoMutations: [{ id: i, params: d }],
299
+ redoMutations: [{ id: i, params: l }]
300
+ }), n.length = 0;
301
+ }
302
+ };
303
+ Ce = rn([
304
+ Le(0, E(Re)),
305
+ Le(1, b),
306
+ Le(2, y)
307
+ ], Ce);
308
+ class xe {
309
+ constructor() {
310
+ v(this, "_previousActiveRange", null);
311
+ v(this, "_undoMutationParamsCache", []);
312
+ v(this, "_redoMutationParamsCache", []);
313
+ }
314
+ clearUndoRedoMutationParamsCache() {
315
+ this._undoMutationParamsCache = [], this._redoMutationParamsCache = [];
316
+ }
317
+ getUndoRedoMutationParamsCache() {
318
+ return {
319
+ undoCache: this._undoMutationParamsCache,
320
+ redoCache: this._redoMutationParamsCache
321
+ };
322
+ }
323
+ setUndoRedoMutationParamsCache({ undoCache: e = [], redoCache: t = [] }) {
324
+ this._undoMutationParamsCache = e, this._redoMutationParamsCache = t;
325
+ }
326
+ getActiveRange() {
327
+ return this._previousActiveRange;
328
+ }
329
+ setActiveRange(e) {
330
+ this._previousActiveRange = e;
331
+ }
332
+ pushUndoRedoMutationParams(e, t) {
333
+ this._undoMutationParamsCache.push(e), this._redoMutationParamsCache.push(t);
334
+ }
335
+ fetchComposedUndoRedoMutationParams() {
336
+ if (this._undoMutationParamsCache.length === 0 || this._previousActiveRange == null || this._redoMutationParamsCache.length === 0)
337
+ return null;
338
+ const { unitId: e } = this._undoMutationParamsCache[0], t = {
339
+ unitId: e,
340
+ actions: this._undoMutationParamsCache.reverse().reduce((r, i) => A.compose(r, i.actions), []),
341
+ textRanges: []
342
+ // Add empty array, will never use, just fix type error
343
+ };
344
+ return { redoMutationParams: {
345
+ unitId: e,
346
+ actions: this._redoMutationParamsCache.reduce((r, i) => A.compose(r, i.actions), []),
347
+ textRanges: []
348
+ // Add empty array, will never use, just fix type error
349
+ }, undoMutationParams: t, previousActiveRange: this._previousActiveRange };
350
+ }
351
+ dispose() {
352
+ this._undoMutationParamsCache = [], this._redoMutationParamsCache = [], this._previousActiveRange = null;
353
+ }
354
+ }
355
+ const st = "doc.mutation.rich-text-editing", L = {
356
+ id: st,
357
+ type: C.MUTATION,
358
+ handler: (s, e) => {
359
+ var T;
360
+ const {
361
+ unitId: t,
362
+ actions: n,
363
+ textRanges: r,
364
+ prevTextRanges: i,
365
+ trigger: o,
366
+ noHistory: a,
367
+ isCompositionEnd: l,
368
+ noNeedSetTextRange: d
369
+ } = e, u = s.get(y).getUniverDocInstance(t), g = s.get(J).getViewModel(t), f = s.get(w), p = ((T = f.getSelections()) != null ? T : []).map(Ie), _ = s.get(Ce), S = s.get(xe);
370
+ if (u == null || g == null)
244
371
  throw new Error(`DocumentDataModel or documentViewModel not found for unitId: ${t}`);
245
372
  if (n.length === 0)
246
373
  throw new Error("Mutation's length should great than 0 when call RichTextEditingMutation");
247
- const c = s.apply(n), { segmentId: d } = n[0], l = s.getSelfOrHeaderFooterModel(d);
248
- return a.getSelfOrHeaderFooterViewModel(d).reset(l), {
374
+ const I = u.apply(n), { segmentId: R } = n[0], O = u.getSelfOrHeaderFooterModel(R);
375
+ g.getSelfOrHeaderFooterViewModel(R).reset(O), !d && r && queueMicrotask(() => {
376
+ f.replaceTextRanges(r);
377
+ });
378
+ const P = {
379
+ commandId: st,
380
+ unitId: t,
381
+ trigger: o,
382
+ noHistory: a,
383
+ redoState: {
384
+ actions: n,
385
+ textRanges: r
386
+ },
387
+ undoState: {
388
+ actions: I,
389
+ textRanges: i != null ? i : p
390
+ }
391
+ };
392
+ if (l) {
393
+ const D = S.fetchComposedUndoRedoMutationParams();
394
+ if (D == null)
395
+ throw new Error("historyParams is null in RichTextEditingMutation");
396
+ const { undoMutationParams: M, redoMutationParams: F, previousActiveRange: $ } = D;
397
+ P.redoState.actions = F.actions, P.undoState.actions = M.actions, P.undoState.textRanges = [$];
398
+ }
399
+ return _.setChangeState(P), {
249
400
  unitId: t,
250
- mutations: c
401
+ actions: I,
402
+ textRanges: p
251
403
  };
252
404
  }
253
- }, et = {
405
+ }, be = {
254
406
  id: "doc.command.insert-text",
255
- type: I.COMMAND,
256
- handler: async (i, e) => {
257
- const t = i.get(A), n = i.get(O), r = i.get(U), { range: s, segmentId: o, body: a, unitId: c, textRanges: d } = e, { startOffset: l, collapsed: h } = s, g = {
258
- id: _.id,
407
+ type: C.COMMAND,
408
+ handler: async (s, e) => {
409
+ const t = s.get(b), { range: n, segmentId: r, body: i, unitId: o, textRanges: a } = e, { startOffset: l, collapsed: d } = n, c = {
410
+ id: L.id,
259
411
  params: {
260
- unitId: c,
261
- mutations: []
412
+ unitId: o,
413
+ actions: [],
414
+ textRanges: a
262
415
  }
263
- }, u = new H();
264
- h ? l > 0 && u.push({
265
- t: "r",
416
+ }, u = new A();
417
+ return d ? l > 0 && u.push({
418
+ t: x.RETAIN,
266
419
  len: l,
267
- segmentId: o
268
- }) : u.push(...Be(s, o)), u.push({
269
- t: "i",
270
- body: a,
271
- len: a.dataStream.length,
420
+ segmentId: r
421
+ }) : u.push(...We(n, r)), u.push({
422
+ t: x.INSERT,
423
+ body: i,
424
+ len: i.dataStream.length,
272
425
  line: 0,
273
- segmentId: o
274
- }), g.params.mutations = u.serialize();
275
- const p = n.syncExecuteCommand(g.id, g.params);
276
- return r.replaceTextRanges(d), p ? (t.pushUndoRedo({
277
- unitID: c,
278
- undoMutations: [{ id: _.id, params: p }],
279
- redoMutations: [{ id: _.id, params: g.params }],
280
- undo() {
281
- return n.syncExecuteCommand(_.id, p), r.replaceTextRanges([s]), !0;
282
- },
283
- redo() {
284
- return n.syncExecuteCommand(_.id, g.params), r.replaceTextRanges(d), !0;
285
- }
286
- }), !0) : !1;
426
+ segmentId: r
427
+ }), c.params.actions = u.serialize(), !!t.syncExecuteCommand(c.id, c.params);
287
428
  }
288
429
  };
289
- var Y = /* @__PURE__ */ ((i) => (i[i.LEFT = 0] = "LEFT", i[i.RIGHT = 1] = "RIGHT", i))(Y || {});
290
- const tt = {
430
+ var H = /* @__PURE__ */ ((s) => (s[s.LEFT = 0] = "LEFT", s[s.RIGHT = 1] = "RIGHT", s))(H || {});
431
+ const ye = {
291
432
  id: "doc.command.delete-text",
292
- type: I.COMMAND,
293
- handler: async (i, e) => {
294
- const t = i.get(O), n = i.get(A), r = i.get(U), { range: s, segmentId: o, unitId: a, direction: c, textRanges: d, len: l = 1 } = e, { startOffset: h } = s, g = {
295
- id: _.id,
433
+ type: C.COMMAND,
434
+ handler: async (s, e) => {
435
+ const t = s.get(b), { range: n, segmentId: r, unitId: i, direction: o, textRanges: a, len: l = 1 } = e, { startOffset: d } = n, c = {
436
+ id: L.id,
296
437
  params: {
297
- unitId: a,
298
- mutations: []
438
+ unitId: i,
439
+ actions: [],
440
+ textRanges: a
299
441
  }
300
- }, u = new H();
301
- h > 0 && u.push({
302
- t: "r",
303
- len: c === 0 ? h - l : h,
304
- segmentId: o
442
+ }, u = new A();
443
+ return d > 0 && u.push({
444
+ t: x.RETAIN,
445
+ len: o === 0 ? d - l : d,
446
+ segmentId: r
305
447
  }), u.push({
306
- t: "d",
448
+ t: x.DELETE,
307
449
  len: l,
308
450
  line: 0,
309
- segmentId: o
310
- }), g.params.mutations = u.serialize();
311
- const p = t.syncExecuteCommand(g.id, g.params);
312
- return r.replaceTextRanges(d), p && n.pushUndoRedo({
313
- unitID: a,
314
- undoMutations: [{ id: _.id, params: p }],
315
- redoMutations: [{ id: _.id, params: g.params }],
316
- undo() {
317
- return t.syncExecuteCommand(_.id, p), r.replaceTextRanges([s]), !0;
318
- },
319
- redo() {
320
- return t.syncExecuteCommand(_.id, g.params), r.replaceTextRanges(d), !0;
321
- }
322
- }), !1;
451
+ segmentId: r
452
+ }), c.params.actions = u.serialize(), !!t.syncExecuteCommand(c.id, c.params);
323
453
  }
324
- }, Pt = {
454
+ }, ft = {
325
455
  id: "doc.command.update-text",
326
- type: I.COMMAND,
327
- handler: async (i, e) => {
328
- const { range: t, segmentId: n, updateBody: r, coverType: s, unitId: o, textRanges: a } = e, c = i.get(O), d = i.get(A), l = i.get(U), h = {
329
- id: _.id,
456
+ type: C.COMMAND,
457
+ handler: async (s, e) => {
458
+ const { range: t, segmentId: n, updateBody: r, coverType: i, unitId: o, textRanges: a } = e, l = s.get(b), d = {
459
+ id: L.id,
330
460
  params: {
331
461
  unitId: o,
332
- mutations: []
462
+ actions: [],
463
+ textRanges: a
333
464
  }
334
- }, g = new H(), { startOffset: u, endOffset: p } = t;
335
- g.push({
336
- t: "r",
465
+ }, c = new A(), { startOffset: u, endOffset: h } = t;
466
+ return c.push({
467
+ t: x.RETAIN,
337
468
  len: u,
338
469
  segmentId: n
339
- }), g.push({
340
- t: "r",
470
+ }), c.push({
471
+ t: x.RETAIN,
341
472
  body: r,
342
- len: p - u,
473
+ len: h - u,
343
474
  segmentId: n,
344
- coverType: s
345
- }), h.params.mutations = g.serialize();
346
- const f = c.syncExecuteCommand(h.id, h.params);
347
- return l.replaceTextRanges(a), f ? (d.pushUndoRedo({
348
- unitID: o,
349
- undoMutations: [{ id: _.id, params: f }],
350
- redoMutations: [{ id: _.id, params: h.params }],
351
- undo() {
352
- return c.syncExecuteCommand(_.id, f), l.replaceTextRanges(a), !0;
353
- },
354
- redo() {
355
- return c.syncExecuteCommand(_.id, h.params), l.replaceTextRanges(a), !0;
356
- }
357
- }), !0) : !1;
475
+ coverType: i
476
+ }), d.params.actions = c.serialize(), !!l.syncExecuteCommand(d.id, d.params);
358
477
  }
359
478
  };
360
- function Nn(i, e) {
479
+ function on(s, e) {
361
480
  const t = [];
362
- for (let n = 0, r = i.length; n < r; n++)
363
- i[n] === Ye.PARAGRAPH && t.push({
481
+ for (let n = 0, r = s.length; n < r; n++)
482
+ s[n] === Fe.PARAGRAPH && t.push({
364
483
  startIndex: n
365
484
  });
366
485
  if (e)
367
486
  for (const n of t)
368
- e.bullet && (n.bullet = ie.deepClone(e.bullet)), e.paragraphStyle && (n.paragraphStyle = ie.deepClone(e.paragraphStyle));
487
+ e.bullet && (n.bullet = oe.deepClone(e.bullet)), e.paragraphStyle && (n.paragraphStyle = oe.deepClone(e.paragraphStyle));
369
488
  return t;
370
489
  }
371
- const Et = {
490
+ const an = {
372
491
  id: "doc.command.break-line",
373
- type: I.COMMAND,
374
- handler: async (i) => {
375
- var p;
376
- const e = i.get(U), t = i.get(y), n = i.get(O), r = e.getActiveRange();
492
+ type: C.COMMAND,
493
+ handler: async (s) => {
494
+ var f, m;
495
+ const e = s.get(w), t = s.get(y), n = s.get(b), r = e.getActiveRange();
377
496
  if (r == null)
378
497
  return !1;
379
- const s = t.getCurrentUniverDocInstance(), o = s.getUnitId(), { startOffset: a, segmentId: c, style: d } = r, l = [
498
+ const i = t.getCurrentUniverDocInstance(), o = i.getUnitId(), { startOffset: a, segmentId: l, style: d } = r, c = [
380
499
  {
381
500
  startOffset: a + 1,
382
501
  endOffset: a + 1,
383
502
  style: d
384
503
  }
385
- ], g = (((p = s.getBody()) == null ? void 0 : p.paragraphs) ?? []).find((f) => f.startIndex >= a);
386
- return await n.executeCommand(et.id, {
504
+ ], h = ((m = (f = i.getBody()) == null ? void 0 : f.paragraphs) != null ? m : []).find((p) => p.startIndex >= a);
505
+ return await n.executeCommand(be.id, {
387
506
  unitId: o,
388
507
  body: {
389
- dataStream: Ye.PARAGRAPH,
390
- paragraphs: Nn(Ye.PARAGRAPH, g)
508
+ dataStream: Fe.PARAGRAPH,
509
+ paragraphs: on(Fe.PARAGRAPH, h)
391
510
  },
392
511
  range: r,
393
- textRanges: l,
394
- segmentId: c
512
+ textRanges: c,
513
+ segmentId: l
395
514
  });
396
515
  }
397
- }, ze = {
398
- id: gn.id,
399
- name: "doc.command.copy",
400
- type: I.COMMAND,
401
- multi: !0,
402
- priority: 999,
403
- preconditions: (i) => i.getContextValue(N) || i.getContextValue(_e),
404
- handler: async () => !0
405
- }, We = {
406
- id: pn.id,
407
- name: "doc.command.cut",
408
- type: I.COMMAND,
409
- multi: !0,
410
- priority: 999,
411
- preconditions: (i) => i.getContextValue(N) || i.getContextValue(_e),
412
- handler: async () => !0
413
- }, He = {
414
- id: fn.id,
415
- name: "doc.command.paste",
416
- type: I.COMMAND,
417
- multi: !0,
418
- priority: 999,
419
- preconditions: (i) => i.getContextValue(N) || i.getContextValue(_e),
420
- handler: async () => !0
421
516
  };
422
- var Ln = Object.defineProperty, An = Object.getOwnPropertyDescriptor, $n = (i, e, t, n) => {
423
- for (var r = n > 1 ? void 0 : n ? An(e, t) : e, s = i.length - 1, o; s >= 0; s--)
424
- (o = i[s]) && (r = (n ? o(e, t, r) : o(r)) || r);
425
- return n && r && Ln(e, t, r), r;
426
- }, mt = (i, e) => (t, n) => e(t, n, i);
427
- let L = class extends me {
517
+ var cn = Object.defineProperty, ln = Object.getOwnPropertyDescriptor, dn = (s, e, t, n) => {
518
+ for (var r = n > 1 ? void 0 : n ? ln(e, t) : e, i = s.length - 1, o; i >= 0; i--)
519
+ (o = s[i]) && (r = (n ? o(e, t, r) : o(r)) || r);
520
+ return n && r && cn(e, t, r), r;
521
+ }, ot = (s, e) => (t, n) => e(t, n, s);
522
+ let B = class extends ee {
428
523
  constructor(e, t) {
429
524
  super();
430
- S(this, "_currentSkeletonUnitId", "");
431
- S(this, "_docSkeletonMap", /* @__PURE__ */ new Map());
432
- S(this, "_currentSkeleton$", new ue(null));
433
- S(this, "currentSkeleton$", this._currentSkeleton$.asObservable());
525
+ v(this, "_currentSkeletonUnitId", "");
526
+ v(this, "_docSkeletonMap", /* @__PURE__ */ new Map());
527
+ v(this, "_currentSkeleton$", new K(null));
528
+ v(this, "currentSkeleton$", this._currentSkeleton$.asObservable());
434
529
  // CurrentSkeletonBefore for pre-triggered logic during registration
435
- S(this, "_currentSkeletonBefore$", new ue(null));
436
- S(this, "currentSkeletonBefore$", this._currentSkeletonBefore$.asObservable());
530
+ v(this, "_currentSkeletonBefore$", new K(null));
531
+ v(this, "currentSkeletonBefore$", this._currentSkeletonBefore$.asObservable());
437
532
  this._localeService = e, this._docViewModelManagerService = t, this._initialize();
438
533
  }
439
534
  _initialize() {
440
- this._docViewModelManagerService.currentDocViewModel$.pipe(ve(this.dispose$)).subscribe((e) => {
535
+ this._docViewModelManagerService.currentDocViewModel$.pipe(ce(this.dispose$)).subscribe((e) => {
441
536
  e != null && this._setCurrent(e);
442
537
  });
443
538
  }
@@ -473,543 +568,448 @@ let L = class extends me {
473
568
  return this._currentSkeletonUnitId = t, this._currentSkeletonBefore$.next(this.getCurrent()), this._currentSkeleton$.next(this.getCurrent()), this.getCurrent();
474
569
  }
475
570
  _buildSkeleton(e) {
476
- return en.create(e, this._localeService);
571
+ return wt.create(e, this._localeService);
477
572
  }
478
573
  };
479
- L = $n([
480
- mt(0, w(Ot)),
481
- mt(1, w(se))
482
- ], L);
483
- const _t = {
574
+ B = dn([
575
+ ot(0, E(dt)),
576
+ ot(1, E(J))
577
+ ], B);
578
+ const gr = {
484
579
  id: "doc.command.inner-paste",
485
- type: I.COMMAND,
486
- handler: async (i, e) => {
487
- const { segmentId: t, body: n, textRanges: r } = e, s = i.get(A), o = i.get(O), a = i.get(U), c = i.get(y), d = a.getSelections();
488
- if (!Array.isArray(d) || d.length === 0)
580
+ type: C.COMMAND,
581
+ handler: async (s, e) => {
582
+ const { segmentId: t, body: n, textRanges: r } = e, i = s.get(b), o = s.get(w), a = s.get(y), l = o.getSelections();
583
+ if (!Array.isArray(l) || l.length === 0)
489
584
  return !1;
490
- const h = c.getCurrentUniverDocInstance().getUnitId(), g = {
491
- id: _.id,
585
+ const c = a.getCurrentUniverDocInstance().getUnitId(), u = {
586
+ id: L.id,
492
587
  params: {
493
- unitId: h,
494
- mutations: []
588
+ unitId: c,
589
+ actions: [],
590
+ textRanges: r
495
591
  }
496
- }, u = new Ae();
497
- u.reset();
498
- const p = new H();
499
- for (const m of d) {
500
- const { startOffset: v, endOffset: M, collapsed: b } = m, T = v - u.cursor;
501
- b ? p.push({
502
- t: "r",
503
- len: T,
592
+ }, h = new Oe();
593
+ h.reset();
594
+ const g = new A();
595
+ for (const m of l) {
596
+ const { startOffset: p, endOffset: _, collapsed: S } = m, I = p - h.cursor;
597
+ S ? g.push({
598
+ t: x.RETAIN,
599
+ len: I,
504
600
  segmentId: t
505
- }) : p.push(...Be(m, t, u.cursor)), p.push({
506
- t: "i",
601
+ }) : g.push(...We(m, t, h.cursor)), g.push({
602
+ t: x.INSERT,
507
603
  body: n,
508
604
  len: n.dataStream.length,
509
605
  line: 0,
510
606
  segmentId: t
511
- }), u.reset(), u.moveCursor(M);
607
+ }), h.reset(), h.moveCursor(_);
512
608
  }
513
- g.params.mutations = p.serialize();
514
- const f = o.syncExecuteCommand(g.id, g.params);
515
- return a.replaceTextRanges(r), f ? (s.pushUndoRedo({
516
- unitID: h,
517
- undoMutations: [{ id: _.id, params: f }],
518
- redoMutations: [{ id: _.id, params: g.params }],
519
- undo() {
520
- return o.syncExecuteCommand(_.id, f), a.replaceTextRanges(d), !0;
521
- },
522
- redo() {
523
- return o.syncExecuteCommand(_.id, g.params), a.replaceTextRanges(r), !0;
524
- }
525
- }), !0) : !1;
609
+ return u.params.actions = g.serialize(), !!i.syncExecuteCommand(u.id, u.params);
526
610
  }
527
- }, Ne = {
611
+ }, pt = {
528
612
  id: "doc.command.inner-cut",
529
- type: I.COMMAND,
530
- handler: async (i, e) => {
531
- const { segmentId: t, textRanges: n } = e, r = i.get(A), s = i.get(O), o = i.get(U), a = i.get(y), c = o.getSelections();
532
- if (!Array.isArray(c) || c.length === 0)
613
+ type: C.COMMAND,
614
+ handler: async (s, e) => {
615
+ const { segmentId: t, textRanges: n } = e, r = s.get(b), i = s.get(w), o = s.get(y), a = i.getSelections();
616
+ if (!Array.isArray(a) || a.length === 0)
533
617
  return !1;
534
- const d = a.getCurrentUniverDocInstance().getUnitId(), l = a.getUniverDocInstance(d), h = Wt(l.snapshot, t);
535
- if (h == null)
618
+ const l = o.getCurrentUniverDocInstance().getUnitId(), d = o.getUniverDocInstance(l), c = xt(d.snapshot, t);
619
+ if (c == null)
536
620
  return !1;
537
- const g = {
538
- id: _.id,
621
+ const u = {
622
+ id: L.id,
539
623
  params: {
540
- unitId: d,
541
- mutations: []
624
+ unitId: l,
625
+ actions: [],
626
+ textRanges: n
542
627
  }
543
- }, u = new Ae();
544
- u.reset();
545
- const p = new H();
546
- for (const m of c) {
547
- const { startOffset: v, endOffset: M, collapsed: b } = m, T = v - u.cursor;
548
- b ? p.push({
549
- t: "r",
550
- len: T,
628
+ }, h = new Oe();
629
+ h.reset();
630
+ const g = new A();
631
+ for (const m of a) {
632
+ const { startOffset: p, endOffset: _, collapsed: S } = m, I = p - h.cursor;
633
+ S ? g.push({
634
+ t: x.RETAIN,
635
+ len: I,
551
636
  segmentId: t
552
- }) : p.push(...Bn(m, h, t, u.cursor)), u.reset(), u.moveCursor(M);
637
+ }) : g.push(...un(m, c, t, h.cursor)), h.reset(), h.moveCursor(_);
553
638
  }
554
- g.params.mutations = p.serialize();
555
- const f = s.syncExecuteCommand(g.id, g.params);
556
- return o.replaceTextRanges(n), f ? (r.pushUndoRedo({
557
- unitID: d,
558
- undoMutations: [{ id: _.id, params: f }],
559
- redoMutations: [{ id: _.id, params: g.params }],
560
- undo() {
561
- return s.syncExecuteCommand(_.id, f), o.replaceTextRanges(c), !0;
562
- },
563
- redo() {
564
- return s.syncExecuteCommand(_.id, g.params), o.replaceTextRanges(n), !0;
565
- }
566
- }), !0) : !1;
639
+ return u.params.actions = g.serialize(), !!r.syncExecuteCommand(u.id, u.params);
567
640
  }
568
641
  };
569
- function Bn(i, e, t = "", n = 0) {
570
- const { startOffset: r, endOffset: s } = i, o = [], { paragraphs: a = [] } = e, c = r - n, d = s - n, l = a == null ? void 0 : a.find(
571
- (h) => h.startIndex - n >= c && h.startIndex - n <= d
642
+ function un(s, e, t = "", n = 0) {
643
+ const { startOffset: r, endOffset: i } = s, o = [], { paragraphs: a = [] } = e, l = r - n, d = i - n, c = a == null ? void 0 : a.find(
644
+ (u) => u.startIndex - n >= l && u.startIndex - n <= d
572
645
  );
573
- if (c > 0 && o.push({
574
- t: "r",
575
- len: c,
646
+ if (l > 0 && o.push({
647
+ t: x.RETAIN,
648
+ len: l,
576
649
  segmentId: t
577
- }), l && l.startIndex - n > c) {
578
- const h = l.startIndex - n;
650
+ }), c && c.startIndex - n > l) {
651
+ const u = c.startIndex - n;
579
652
  o.push({
580
- t: "d",
581
- len: h - c,
653
+ t: x.DELETE,
654
+ len: u - l,
582
655
  line: 0,
583
656
  segmentId: t
584
657
  }), o.push({
585
- t: "r",
658
+ t: x.RETAIN,
586
659
  len: 1,
587
660
  segmentId: t
588
- }), d > h + 1 && o.push({
589
- t: "d",
590
- len: d - h - 1,
661
+ }), d > u + 1 && o.push({
662
+ t: x.DELETE,
663
+ len: d - u - 1,
591
664
  line: 0,
592
665
  segmentId: t
593
666
  });
594
667
  } else
595
668
  o.push({
596
- t: "d",
597
- len: d - c,
669
+ t: x.DELETE,
670
+ len: d - l,
598
671
  line: 0,
599
672
  segmentId: t
600
673
  });
601
674
  return o;
602
675
  }
603
- const Ut = {
676
+ const hn = {
604
677
  id: "doc.command.delete-left",
605
- type: I.COMMAND,
606
- handler: async (i) => {
607
- var T;
608
- const e = i.get(U), t = i.get(L), n = i.get(y), r = i.get(O), s = e.getActiveRange(), o = e.getSelections(), a = (T = t.getCurrent()) == null ? void 0 : T.skeleton;
609
- let c = !0;
610
- if (s == null || a == null || o == null)
678
+ type: C.COMMAND,
679
+ handler: async (s) => {
680
+ var R;
681
+ const e = s.get(w), t = s.get(B), n = s.get(y), r = s.get(b), i = e.getActiveRange(), o = e.getSelections(), a = (R = t.getCurrent()) == null ? void 0 : R.skeleton;
682
+ let l = !0;
683
+ if (i == null || a == null || o == null)
611
684
  return !1;
612
- const d = n.getCurrentUniverDocInstance(), { startOffset: l, collapsed: h, segmentId: g, style: u } = s, p = a.findNodeByCharIndex(l), f = tn(p), m = nn(p, d.getBody());
613
- let v = l;
614
- const M = a.findNodeByCharIndex(l - 1);
615
- if (rn(p) && M !== p && (f === !0 || m === !0)) {
616
- const C = sn(p, d.getBody());
617
- if (C == null)
685
+ const d = n.getCurrentUniverDocInstance(), { startOffset: c, collapsed: u, segmentId: h, style: g } = i, f = a.findNodeByCharIndex(c), m = Ut(f), p = Nt(f, d.getBody());
686
+ let _ = c;
687
+ const S = a.findNodeByCharIndex(c - 1);
688
+ if (At(f) && S !== f && (m === !0 || p === !0)) {
689
+ const O = Lt(f, d.getBody());
690
+ if (O == null)
618
691
  return !1;
619
- const x = C == null ? void 0 : C.startIndex, P = { startIndex: 0 }, B = C.paragraphStyle;
620
- if (f === !0) {
621
- const R = C.paragraphStyle;
622
- R && (P.paragraphStyle = R);
623
- } else if (m === !0) {
624
- const R = C.bullet;
625
- R && (P.bullet = R), B != null && (P.paragraphStyle = { ...B }, delete P.paragraphStyle.hanging, delete P.paragraphStyle.indentStart);
692
+ const N = O == null ? void 0 : O.startIndex, P = { startIndex: 0 }, T = O.paragraphStyle;
693
+ if (m === !0) {
694
+ const M = O.paragraphStyle;
695
+ M && (P.paragraphStyle = M);
696
+ } else if (p === !0) {
697
+ const M = O.bullet;
698
+ M && (P.bullet = M), T != null && (P.paragraphStyle = { ...T }, delete P.paragraphStyle.hanging, delete P.paragraphStyle.indentStart);
626
699
  }
627
- const k = [
700
+ const D = [
628
701
  {
629
- startOffset: v,
630
- endOffset: v,
631
- style: u
702
+ startOffset: _,
703
+ endOffset: _,
704
+ style: g
632
705
  }
633
706
  ];
634
- c = await r.executeCommand(Pt.id, {
707
+ l = await r.executeCommand(ft.id, {
635
708
  unitId: d.getUnitId(),
636
709
  updateBody: {
637
710
  dataStream: "",
638
711
  paragraphs: [{ ...P }]
639
712
  },
640
713
  range: {
641
- startOffset: x,
642
- endOffset: x + 1
714
+ startOffset: N,
715
+ endOffset: N + 1
643
716
  },
644
- textRanges: k,
645
- coverType: yt.REPLACE,
646
- segmentId: g
717
+ textRanges: D,
718
+ coverType: ut.REPLACE,
719
+ segmentId: h
647
720
  });
648
- } else if (h === !0) {
649
- if (M == null)
721
+ } else if (u === !0) {
722
+ if (S == null)
650
723
  return !0;
651
- if (M.content === "\r")
652
- c = await r.executeCommand(nt.id, {
653
- direction: Y.LEFT,
654
- range: s
724
+ if (S.content === "\r")
725
+ l = await r.executeCommand(Xe.id, {
726
+ direction: H.LEFT,
727
+ range: i
655
728
  });
656
729
  else {
657
- v -= M.count;
658
- const C = [
730
+ _ -= S.count;
731
+ const O = [
659
732
  {
660
- startOffset: v,
661
- endOffset: v,
662
- style: u
733
+ startOffset: _,
734
+ endOffset: _,
735
+ style: g
663
736
  }
664
737
  ];
665
- c = await r.executeCommand(tt.id, {
738
+ l = await r.executeCommand(ye.id, {
666
739
  unitId: d.getUnitId(),
667
- range: s,
668
- segmentId: g,
669
- direction: Y.LEFT,
670
- len: M.count,
671
- textRanges: C
740
+ range: i,
741
+ segmentId: h,
742
+ direction: H.LEFT,
743
+ len: S.count,
744
+ textRanges: O
672
745
  });
673
746
  }
674
747
  } else {
675
- const C = Nt(s, o);
676
- c = await r.executeCommand(Ne.id, {
677
- segmentId: g,
678
- textRanges: C
748
+ const O = _t(i, o);
749
+ l = await r.executeCommand(pt.id, {
750
+ segmentId: h,
751
+ textRanges: O
679
752
  });
680
753
  }
681
- return c;
754
+ return l;
682
755
  }
683
- }, wt = {
756
+ }, gn = {
684
757
  id: "doc.command.delete-right",
685
- type: I.COMMAND,
686
- handler: async (i) => {
687
- var p;
688
- const e = i.get(U), t = i.get(L), n = i.get(y), r = i.get(O), s = e.getActiveRange(), o = e.getSelections(), a = (p = t.getCurrent()) == null ? void 0 : p.skeleton;
689
- let c;
690
- if (s == null || a == null || o == null)
758
+ type: C.COMMAND,
759
+ handler: async (s) => {
760
+ var f;
761
+ const e = s.get(w), t = s.get(B), n = s.get(y), r = s.get(b), i = e.getActiveRange(), o = e.getSelections(), a = (f = t.getCurrent()) == null ? void 0 : f.skeleton;
762
+ let l;
763
+ if (i == null || a == null || o == null)
691
764
  return !1;
692
- const d = n.getCurrentUniverDocInstance(), { startOffset: l, collapsed: h, segmentId: g, style: u } = s;
693
- if (l === d.getBody().dataStream.length - 2 && h)
765
+ const d = n.getCurrentUniverDocInstance(), { startOffset: c, collapsed: u, segmentId: h, style: g } = i;
766
+ if (c === d.getBody().dataStream.length - 2 && u)
694
767
  return !0;
695
- if (h === !0) {
696
- const f = a.findNodeByCharIndex(l);
697
- if (f.content === "\r")
698
- c = await r.executeCommand(nt.id, {
699
- direction: Y.RIGHT,
700
- range: s
768
+ if (u === !0) {
769
+ const m = a.findNodeByCharIndex(c);
770
+ if (m.content === "\r")
771
+ l = await r.executeCommand(Xe.id, {
772
+ direction: H.RIGHT,
773
+ range: i
701
774
  });
702
775
  else {
703
- const m = [
776
+ const p = [
704
777
  {
705
- startOffset: l,
706
- endOffset: l,
707
- style: u
778
+ startOffset: c,
779
+ endOffset: c,
780
+ style: g
708
781
  }
709
782
  ];
710
- c = await r.executeCommand(tt.id, {
783
+ l = await r.executeCommand(ye.id, {
711
784
  unitId: d.getUnitId(),
712
- range: s,
713
- segmentId: g,
714
- direction: Y.RIGHT,
715
- textRanges: m,
716
- len: f.count
785
+ range: i,
786
+ segmentId: h,
787
+ direction: H.RIGHT,
788
+ textRanges: p,
789
+ len: m.count
717
790
  });
718
791
  }
719
792
  } else {
720
- const f = Nt(s, o);
721
- c = await r.executeCommand(Ne.id, {
722
- segmentId: g,
723
- textRanges: f
793
+ const m = _t(i, o);
794
+ l = await r.executeCommand(pt.id, {
795
+ segmentId: h,
796
+ textRanges: m
724
797
  });
725
798
  }
726
- return c;
799
+ return l;
727
800
  }
728
- }, nt = {
801
+ }, Xe = {
729
802
  id: "doc.command.merge-two-paragraph",
730
- type: I.COMMAND,
731
- handler: async (i, e) => {
732
- var B, k, R;
733
- const t = i.get(U), n = i.get(y), r = i.get(O), s = i.get(A), { direction: o, range: a } = e, c = t.getActiveRange(), d = t.getSelections();
734
- if (c == null || d == null)
803
+ type: C.COMMAND,
804
+ handler: async (s, e) => {
805
+ var P, T, D;
806
+ const t = s.get(w), n = s.get(y), r = s.get(b);
807
+ s.get(Re);
808
+ const { direction: i, range: o } = e, a = t.getActiveRange(), l = t.getSelections();
809
+ if (a == null || l == null)
735
810
  return !1;
736
- const l = n.getCurrentUniverDocInstance(), { startOffset: h, collapsed: g, segmentId: u, style: p } = c;
737
- if (!g)
811
+ const d = n.getCurrentUniverDocInstance(), { startOffset: c, collapsed: u, segmentId: h, style: g } = a;
812
+ if (!u)
738
813
  return !1;
739
- const f = o === Y.LEFT ? h : h + 1, m = (R = (k = (B = l.getBody()) == null ? void 0 : B.paragraphs) == null ? void 0 : k.find((z) => z.startIndex >= f)) == null ? void 0 : R.startIndex, v = Vn(l.getBody(), f, m), M = o === Y.LEFT ? h - 1 : h, b = l.getUnitId(), T = [
814
+ const f = i === H.LEFT ? c : c + 1, m = (D = (T = (P = d.getBody()) == null ? void 0 : P.paragraphs) == null ? void 0 : T.find((M) => M.startIndex >= f)) == null ? void 0 : D.startIndex, p = mn(d.getBody(), f, m), _ = i === H.LEFT ? c - 1 : c, S = d.getUnitId(), I = [
740
815
  {
741
- startOffset: M,
742
- endOffset: M,
743
- style: p
816
+ startOffset: _,
817
+ endOffset: _,
818
+ style: g
744
819
  }
745
- ], C = {
746
- id: _.id,
820
+ ], R = {
821
+ id: L.id,
747
822
  params: {
748
- unitId: b,
749
- mutations: []
823
+ unitId: S,
824
+ actions: [],
825
+ textRanges: I,
826
+ prevTextRanges: [o]
750
827
  }
751
- }, x = new H();
752
- x.push({
753
- t: "r",
754
- len: o === Y.LEFT ? h - 1 : h,
755
- segmentId: u
756
- }), v.dataStream.length && x.push({
757
- t: "i",
758
- body: v,
759
- len: v.dataStream.length,
828
+ }, O = new A();
829
+ return O.push({
830
+ t: x.RETAIN,
831
+ len: i === H.LEFT ? c - 1 : c,
832
+ segmentId: h
833
+ }), p.dataStream.length && O.push({
834
+ t: x.INSERT,
835
+ body: p,
836
+ len: p.dataStream.length,
760
837
  line: 0,
761
- segmentId: u
762
- }), x.push({
763
- t: "r",
838
+ segmentId: h
839
+ }), O.push({
840
+ t: x.RETAIN,
764
841
  len: 1,
765
- segmentId: u
766
- }), x.push({
767
- t: "d",
842
+ segmentId: h
843
+ }), O.push({
844
+ t: x.DELETE,
768
845
  len: m + 1 - f,
769
846
  line: 0,
770
- segmentId: u
771
- }), C.params.mutations = x.serialize();
772
- const P = r.syncExecuteCommand(C.id, C.params);
773
- return t.replaceTextRanges(T), P ? (s.pushUndoRedo({
774
- unitID: b,
775
- undoMutations: [{ id: _.id, params: P }],
776
- redoMutations: [{ id: _.id, params: C.params }],
777
- undo() {
778
- return r.syncExecuteCommand(_.id, P), t.replaceTextRanges([a]), !0;
779
- },
780
- redo() {
781
- return r.syncExecuteCommand(_.id, C.params), t.replaceTextRanges(T), !0;
782
- }
783
- }), !0) : !1;
847
+ segmentId: h
848
+ }), R.params.actions = O.serialize(), !!r.syncExecuteCommand(R.id, R.params);
784
849
  }
785
850
  };
786
- function Vn(i, e, t) {
787
- const { textRuns: n } = i, r = i.dataStream.substring(e, t);
851
+ function mn(s, e, t) {
852
+ const { textRuns: n } = s, r = s.dataStream.substring(e, t);
788
853
  if (n == null)
789
854
  return {
790
855
  dataStream: r
791
856
  };
792
- const s = [];
857
+ const i = [];
793
858
  for (const o of n) {
794
- const { st: a, ed: c } = o;
795
- c <= e || a >= t || (a < e ? s.push({
859
+ const { st: a, ed: l } = o;
860
+ l <= e || a >= t || (a < e ? i.push({
796
861
  ...o,
797
862
  st: 0,
798
- ed: c - e
799
- }) : c > t ? s.push({
863
+ ed: l - e
864
+ }) : l > t ? i.push({
800
865
  ...o,
801
866
  st: a - e,
802
867
  ed: t - e
803
- }) : s.push({
868
+ }) : i.push({
804
869
  ...o,
805
870
  st: a - e,
806
- ed: c - e
871
+ ed: l - e
807
872
  }));
808
873
  }
809
874
  return {
810
875
  dataStream: r,
811
- textRuns: s
876
+ textRuns: i
812
877
  };
813
878
  }
814
- function Nt(i, e) {
815
- let t = i.endOffset;
879
+ function _t(s, e) {
880
+ let t = s.endOffset;
816
881
  for (const r of e) {
817
- const { startOffset: s, endOffset: o } = r;
818
- s == null || o == null || o <= i.endOffset && (t -= o - s);
882
+ const { startOffset: i, endOffset: o } = r;
883
+ i == null || o == null || o <= s.endOffset && (t -= o - i);
819
884
  }
820
885
  return [
821
886
  {
822
887
  startOffset: t,
823
888
  endOffset: t,
824
- style: i.style
889
+ style: s.style
825
890
  }
826
891
  ];
827
892
  }
828
- class rt {
829
- constructor() {
830
- S(this, "_previousActiveRange", null);
831
- S(this, "_undoMutationParamsCache", []);
832
- S(this, "_redoMutationParamsCache", []);
833
- }
834
- clearUndoRedoMutationParamsCache() {
835
- this._undoMutationParamsCache = [], this._redoMutationParamsCache = [];
836
- }
837
- setActiveRange(e) {
838
- this._previousActiveRange = e;
839
- }
840
- pushUndoRedoMutationParams(e, t) {
841
- this._undoMutationParamsCache.push(e), this._redoMutationParamsCache.push(t);
842
- }
843
- fetchComposedUndoRedoMutationParams(e) {
844
- if (this._undoMutationParamsCache.length === 0 || this._previousActiveRange == null)
845
- return null;
846
- const { unitId: t } = this._undoMutationParamsCache[0], { segmentId: n, startOffset: r, collapsed: s } = this._previousActiveRange, o = {
847
- unitId: t,
848
- mutations: []
849
- }, a = {
850
- unitId: t,
851
- mutations: []
852
- };
853
- return s ? (o.mutations.push({
854
- t: "r",
855
- len: r,
856
- segmentId: n
857
- }), a.mutations.push({
858
- t: "r",
859
- len: r,
860
- segmentId: n
861
- })) : (r > 0 && o.mutations.push({
862
- t: "r",
863
- len: r,
864
- segmentId: n
865
- }), o.mutations.push(this._undoMutationParamsCache[0].mutations.find((c) => c.t === "i")), a.mutations.push(...Be(this._previousActiveRange, n))), e.length && (o.mutations.push({
866
- t: "d",
867
- len: e.length,
868
- line: 0,
869
- segmentId: n
870
- }), a.mutations.push({
871
- t: "i",
872
- body: {
873
- dataStream: e
874
- },
875
- len: e.length,
876
- line: 0,
877
- segmentId: n
878
- })), { redoMutationParams: a, undoMutationParams: o, previousActiveRange: this._previousActiveRange };
879
- }
880
- dispose() {
881
- this._undoMutationParamsCache = [], this._redoMutationParamsCache = [], this._previousActiveRange = null;
882
- }
883
- }
884
- const Lt = {
893
+ const St = {
885
894
  id: "doc.command.ime-input",
886
- type: I.COMMAND,
887
- handler: async (i, e) => {
888
- const { unitId: t, newText: n, oldTextLen: r, range: s, segmentId: o, textRanges: a, isCompositionEnd: c } = e, d = i.get(O), l = i.get(A), h = i.get(U), g = i.get(rt), u = {
889
- id: _.id,
895
+ type: C.COMMAND,
896
+ handler: async (s, e) => {
897
+ const { unitId: t, newText: n, oldTextLen: r, isCompositionEnd: i, isCompositionStart: o } = e, a = s.get(b), l = s.get(xe), d = l.getActiveRange();
898
+ if (d == null)
899
+ return !1;
900
+ const { startOffset: c, style: u, segmentId: h } = d, g = n.length, f = [
901
+ {
902
+ startOffset: c + g,
903
+ endOffset: c + g,
904
+ collapsed: !0,
905
+ style: u
906
+ }
907
+ ], m = {
908
+ id: L.id,
890
909
  params: {
891
910
  unitId: t,
892
- mutations: []
911
+ actions: [],
912
+ textRanges: f
893
913
  }
894
- }, p = new H();
895
- s.collapsed ? p.push({
896
- t: "r",
897
- len: s.startOffset,
898
- segmentId: o
899
- }) : p.push(...Be(s, o)), r > 0 && p.push({
900
- t: "d",
914
+ }, p = new A();
915
+ !d.collapsed && o ? p.push(...We(d, h)) : p.push({
916
+ t: x.RETAIN,
917
+ len: c,
918
+ segmentId: h
919
+ }), r > 0 && p.push({
920
+ t: x.DELETE,
901
921
  len: r,
902
922
  line: 0,
903
- segmentId: o
923
+ segmentId: h
904
924
  }), p.push({
905
- t: "i",
925
+ t: x.INSERT,
906
926
  body: {
907
927
  dataStream: n
908
928
  },
909
929
  len: n.length,
910
930
  line: 0,
911
- segmentId: o
912
- }), u.params.mutations = p.serialize();
913
- const f = d.syncExecuteCommand(u.id, u.params);
914
- if (g.pushUndoRedoMutationParams(f, u.params), h.replaceTextRanges(a), c) {
915
- if (f) {
916
- const m = g.fetchComposedUndoRedoMutationParams(n);
917
- if (m == null)
918
- return !1;
919
- const { undoMutationParams: v, redoMutationParams: M, previousActiveRange: b } = m;
920
- return l.pushUndoRedo({
921
- unitID: t,
922
- undoMutations: [{ id: _.id, params: v }],
923
- redoMutations: [{ id: _.id, params: M }],
924
- undo() {
925
- return d.syncExecuteCommand(_.id, v), h.replaceTextRanges([b]), !0;
926
- },
927
- redo() {
928
- return d.syncExecuteCommand(_.id, M), h.replaceTextRanges(a), !0;
929
- }
930
- }), !0;
931
- }
932
- } else
933
- return !!f;
934
- return !1;
931
+ segmentId: h
932
+ }), m.params.actions = p.serialize(), m.params.noHistory = !i, m.params.isCompositionEnd = i;
933
+ const _ = a.syncExecuteCommand(m.id, m.params);
934
+ return l.pushUndoRedoMutationParams(_, m.params), !!_;
935
935
  }
936
- }, he = {
936
+ }, Te = {
937
937
  id: "doc.command.set-inline-format-bold",
938
- type: I.COMMAND,
938
+ type: C.COMMAND,
939
939
  handler: async () => !0
940
- }, Ve = {
940
+ }, De = {
941
941
  id: "doc.command.set-inline-format-italic",
942
- type: I.COMMAND,
942
+ type: C.COMMAND,
943
943
  handler: async () => !0
944
- }, Fe = {
944
+ }, Pe = {
945
945
  id: "doc.command.set-inline-format-underline",
946
- type: I.COMMAND,
946
+ type: C.COMMAND,
947
947
  handler: async () => !0
948
- }, je = {
948
+ }, Ee = {
949
949
  id: "doc.command.set-inline-format-strikethrough",
950
- type: I.COMMAND,
950
+ type: C.COMMAND,
951
951
  handler: async () => !0
952
952
  }, Q = {
953
953
  id: "doc.command.set-inline-format-subscript",
954
- type: I.COMMAND,
954
+ type: C.COMMAND,
955
955
  handler: async () => !0
956
- }, oe = {
956
+ }, we = {
957
957
  id: "doc.command.set-inline-format-superscript",
958
- type: I.COMMAND,
958
+ type: C.COMMAND,
959
959
  handler: async () => !0
960
- }, ge = {
960
+ }, Ue = {
961
961
  id: "doc.command.set-inline-format-fontsize",
962
- type: I.COMMAND,
962
+ type: C.COMMAND,
963
963
  handler: async () => !0
964
- }, pe = {
964
+ }, Ne = {
965
965
  id: "doc.command.set-inline-format-font-family",
966
- type: I.COMMAND,
966
+ type: C.COMMAND,
967
967
  handler: async () => !0
968
- }, ke = {
968
+ }, Ae = {
969
969
  id: "doc.command.set-inline-format-text-color",
970
- type: I.COMMAND,
970
+ type: C.COMMAND,
971
971
  handler: async () => !0
972
- }, At = {
973
- [he.id]: "bl",
974
- [Ve.id]: "it",
975
- [Fe.id]: "ul",
976
- [je.id]: "st",
977
- [ge.id]: "fs",
978
- [pe.id]: "ff",
979
- [ke.id]: "cl",
972
+ }, vt = {
973
+ [Te.id]: "bl",
974
+ [De.id]: "it",
975
+ [Pe.id]: "ul",
976
+ [Ee.id]: "st",
977
+ [Ue.id]: "fs",
978
+ [Ne.id]: "ff",
979
+ [Ae.id]: "cl",
980
980
  [Q.id]: "va",
981
- [oe.id]: "va"
982
- }, $t = {
981
+ [we.id]: "va"
982
+ }, Mt = {
983
983
  id: "doc.command.set-inline-format",
984
- type: I.COMMAND,
985
- handler: async (i, e) => {
986
- const { segmentId: t, value: n, preCommandId: r } = e, s = i.get(A), o = i.get(O), a = i.get(U), c = i.get(y), d = a.getSelections();
987
- if (!Array.isArray(d) || d.length === 0)
984
+ type: C.COMMAND,
985
+ handler: async (s, e) => {
986
+ const { segmentId: t, value: n, preCommandId: r } = e, i = s.get(b), o = s.get(w), a = s.get(y), l = o.getSelections();
987
+ if (!Array.isArray(l) || l.length === 0)
988
988
  return !1;
989
- let l = c.getCurrentUniverDocInstance(), h = l.getUnitId();
990
- h === J && (l = c.getUniverDocInstance(K), h = l.getUnitId());
991
- let g;
989
+ let d = a.getCurrentUniverDocInstance(), c = d.getUnitId();
990
+ c === q && (d = a.getUniverDocInstance(Y), c = d.getUnitId());
991
+ let u;
992
992
  switch (r) {
993
- case he.id:
994
- case Ve.id:
995
- case Fe.id:
996
- case je.id:
993
+ case Te.id:
994
+ case De.id:
995
+ case Pe.id:
996
+ case Ee.id:
997
997
  case Q.id:
998
- case oe.id: {
999
- g = jn(
1000
- l.getBody().textRuns,
998
+ case we.id: {
999
+ u = pn(
1000
+ d.getBody().textRuns,
1001
1001
  r,
1002
- d
1002
+ l
1003
1003
  );
1004
1004
  break;
1005
1005
  }
1006
- case ge.id:
1007
- case pe.id: {
1008
- g = n;
1006
+ case Ue.id:
1007
+ case Ne.id: {
1008
+ u = n;
1009
1009
  break;
1010
1010
  }
1011
- case ke.id: {
1012
- g = {
1011
+ case Ae.id: {
1012
+ u = {
1013
1013
  rgb: n
1014
1014
  };
1015
1015
  break;
@@ -1017,278 +1017,231 @@ const Lt = {
1017
1017
  default:
1018
1018
  throw new Error(`Unknown command: ${r} in handleInlineFormat`);
1019
1019
  }
1020
- const u = {
1021
- id: _.id,
1020
+ const h = {
1021
+ id: L.id,
1022
1022
  params: {
1023
- unitId: h,
1024
- mutations: []
1023
+ unitId: c,
1024
+ actions: [],
1025
+ textRanges: l
1025
1026
  }
1026
- }, p = new H(), f = new Ae();
1027
+ }, g = new A(), f = new Oe();
1027
1028
  f.reset();
1028
- for (const M of d) {
1029
- const { startOffset: b, endOffset: T } = M, C = {
1029
+ for (const p of l) {
1030
+ const { startOffset: _, endOffset: S } = p, I = {
1030
1031
  dataStream: "",
1031
1032
  textRuns: [
1032
1033
  {
1033
1034
  st: 0,
1034
- ed: T - b,
1035
+ ed: S - _,
1035
1036
  ts: {
1036
- [At[r]]: g
1037
+ [vt[r]]: u
1037
1038
  }
1038
1039
  }
1039
1040
  ]
1040
- }, x = b - f.cursor;
1041
- x !== 0 && p.push({
1042
- t: "r",
1043
- len: x,
1041
+ }, R = _ - f.cursor;
1042
+ R !== 0 && g.push({
1043
+ t: x.RETAIN,
1044
+ len: R,
1044
1045
  segmentId: t
1045
- }), p.push({
1046
- t: "r",
1047
- body: C,
1048
- len: T - b,
1046
+ }), g.push({
1047
+ t: x.RETAIN,
1048
+ body: I,
1049
+ len: S - _,
1049
1050
  segmentId: t
1050
- }), f.reset(), f.moveCursor(T);
1051
+ }), f.reset(), f.moveCursor(S);
1051
1052
  }
1052
- u.params.mutations = p.serialize();
1053
- const m = o.syncExecuteCommand(u.id, u.params), v = [
1054
- he.id,
1055
- ge.id,
1056
- pe.id,
1057
- Q.id,
1058
- oe.id
1059
- ];
1060
- return v.includes(r) && a.refreshSelection(), m ? (s.pushUndoRedo({
1061
- unitID: h,
1062
- undoMutations: [{ id: _.id, params: m }],
1063
- redoMutations: [{ id: _.id, params: u.params }],
1064
- undo() {
1065
- return o.syncExecuteCommand(_.id, m), v.includes(r) && a.refreshSelection(), !0;
1066
- },
1067
- redo() {
1068
- return o.syncExecuteCommand(_.id, u.params), v.includes(r) && a.refreshSelection(), !0;
1069
- }
1070
- }), !0) : !1;
1053
+ return h.params.actions = g.serialize(), !!i.syncExecuteCommand(h.id, h.params);
1071
1054
  }
1072
1055
  };
1073
- function Fn(i) {
1074
- return i !== null && typeof i == "object";
1056
+ function fn(s) {
1057
+ return s !== null && typeof s == "object";
1075
1058
  }
1076
- function jn(i, e, t) {
1059
+ function pn(s, e, t) {
1077
1060
  let n = 0, r = 0;
1078
- const s = At[e];
1079
- for (; n !== i.length && r !== t.length; ) {
1080
- const { startOffset: o, endOffset: a } = t[r], { st: c, ed: d, ts: l } = i[n];
1081
- if (a <= c)
1061
+ const i = vt[e];
1062
+ for (; n !== s.length && r !== t.length; ) {
1063
+ const { startOffset: o, endOffset: a } = t[r], { st: l, ed: d, ts: c } = s[n];
1064
+ if (a <= l)
1082
1065
  r++;
1083
1066
  else if (d <= o)
1084
1067
  n++;
1085
1068
  else {
1086
- if ((l == null ? void 0 : l[s]) == null) {
1087
- if (/bl|it/.test(s))
1088
- return E.TRUE;
1089
- if (/ul|st/.test(s))
1090
- return {
1091
- s: E.TRUE
1092
- };
1093
- if (/va/.test(s))
1094
- return e === Q.id ? V.SUBSCRIPT : V.SUPERSCRIPT;
1095
- }
1096
- if (Fn(l == null ? void 0 : l[s]) && l[s].s === E.FALSE)
1097
- return {
1098
- s: E.TRUE
1069
+ if (/bl|it/.test(i))
1070
+ return (c == null ? void 0 : c[i]) === V.TRUE ? V.FALSE : V.TRUE;
1071
+ if (/ul|st/.test(i))
1072
+ return fn(c == null ? void 0 : c[i]) && (c == null ? void 0 : c[i]).s === V.TRUE ? {
1073
+ s: V.FALSE
1074
+ } : {
1075
+ s: V.TRUE
1099
1076
  };
1100
- if (e === Q.id && (l == null ? void 0 : l[s]) !== V.SUBSCRIPT)
1101
- return V.SUBSCRIPT;
1102
- if (e === oe.id && (l == null ? void 0 : l[s]) !== V.SUPERSCRIPT)
1103
- return V.SUPERSCRIPT;
1104
- if ((l == null ? void 0 : l[s]) === E.FALSE)
1105
- return E.TRUE;
1077
+ if (/va/.test(i))
1078
+ return e === Q.id ? (c == null ? void 0 : c[i]) === k.SUBSCRIPT ? k.NORMAL : k.SUBSCRIPT : (c == null ? void 0 : c[i]) === k.SUPERSCRIPT ? k.NORMAL : k.SUPERSCRIPT;
1106
1079
  n++;
1107
1080
  }
1108
1081
  }
1109
- return /bl|it/.test(s) ? E.FALSE : /ul|st/.test(s) ? {
1110
- s: E.FALSE
1111
- } : V.NORMAL;
1082
+ return /bl|it/.test(i) ? V.TRUE : /ul|st/.test(i) ? {
1083
+ s: V.TRUE
1084
+ } : e === Q.id ? k.SUBSCRIPT : k.SUPERSCRIPT;
1112
1085
  }
1113
- const kn = {
1114
- id: "doc.command.bullet-list",
1115
- type: I.COMMAND,
1116
- handler: (i) => i.get(O).syncExecuteCommand(it.id, {
1117
- listType: bt.BULLET_LIST
1118
- })
1119
- }, zn = {
1120
- id: "doc.command.order-list",
1121
- type: I.COMMAND,
1122
- handler: (i) => i.get(O).syncExecuteCommand(it.id, {
1123
- listType: bt.ORDER_LIST
1124
- })
1125
- }, it = {
1086
+ const Ge = {
1126
1087
  id: "doc.command.list-operation",
1127
- type: I.COMMAND,
1128
- handler: (i, e) => {
1129
- var T;
1130
- const t = i.get(U), n = i.get(y), r = i.get(O), s = i.get(A), { listType: o } = e, a = n.getCurrentUniverDocInstance(), c = t.getActiveRange(), d = (T = a.getBody()) == null ? void 0 : T.paragraphs;
1131
- if (c == null || d == null)
1088
+ type: C.COMMAND,
1089
+ handler: (s, e) => {
1090
+ var O, N, P;
1091
+ const t = s.get(w), n = s.get(y), r = s.get(b), { listType: i } = e, o = n.getCurrentUniverDocInstance(), a = t.getActiveRange(), l = (O = t.getSelections()) != null ? O : [], d = (N = o.getBody()) == null ? void 0 : N.paragraphs, c = l.map(Ie);
1092
+ if (a == null || d == null)
1132
1093
  return !1;
1133
- const l = Wn(c, d), { segmentId: h } = c, g = a.getUnitId(), u = l.every((C) => {
1134
- var x;
1135
- return ((x = C.bullet) == null ? void 0 : x.listType) === o;
1136
- }), p = 6;
1137
- let f = ie.generateRandomId(p);
1138
- if (l.length === 1) {
1139
- const C = d.indexOf(l[0]), x = d[C - 1], P = d[C + 1];
1140
- x && x.bullet && x.bullet.listType === o ? f = x.bullet.listId : P && P.bullet && P.bullet.listType === o && (f = P.bullet.listId);
1094
+ const u = vn(a, d), { segmentId: h } = a, g = o.getUnitId(), f = u.every((T) => {
1095
+ var D;
1096
+ return ((D = T.bullet) == null ? void 0 : D.listType) === i;
1097
+ });
1098
+ let p = oe.generateRandomId(6);
1099
+ if (u.length === 1) {
1100
+ const T = d.indexOf(u[0]), D = d[T - 1], M = d[T + 1];
1101
+ D && D.bullet && D.bullet.listType === i ? p = D.bullet.listId : M && M.bullet && M.bullet.listType === i && (p = M.bullet.listId);
1141
1102
  }
1142
- const m = {
1143
- id: _.id,
1103
+ const _ = {
1104
+ id: L.id,
1144
1105
  params: {
1145
1106
  unitId: g,
1146
- mutations: []
1107
+ actions: [],
1108
+ textRanges: c
1147
1109
  }
1148
- }, v = new Ae();
1149
- v.reset();
1150
- const M = new H();
1151
- for (const C of l) {
1152
- const { startIndex: x } = C;
1153
- M.push({
1154
- t: "r",
1155
- len: x - v.cursor,
1110
+ }, S = new Oe();
1111
+ S.reset();
1112
+ const I = new A();
1113
+ for (const T of u) {
1114
+ const { startIndex: D } = T;
1115
+ I.push({
1116
+ t: x.RETAIN,
1117
+ len: D - S.cursor,
1156
1118
  segmentId: h
1157
1119
  });
1158
- const P = {
1159
- ...C.paragraphStyle,
1120
+ const M = {
1121
+ ...T.paragraphStyle,
1160
1122
  hanging: void 0,
1161
1123
  indentStart: void 0
1162
1124
  };
1163
- M.push({
1164
- t: "r",
1125
+ I.push({
1126
+ t: x.RETAIN,
1165
1127
  len: 1,
1166
1128
  body: {
1167
1129
  dataStream: "",
1168
1130
  paragraphs: [
1169
- u ? {
1170
- paragraphStyle: P,
1131
+ f ? {
1132
+ paragraphStyle: M,
1171
1133
  startIndex: 0
1172
1134
  } : {
1173
- ...C,
1135
+ ...T,
1174
1136
  startIndex: 0,
1175
1137
  bullet: {
1176
- ...C.bullet ?? {
1138
+ ...(P = T.bullet) != null ? P : {
1177
1139
  nestingLevel: 0,
1178
1140
  textStyle: {
1179
1141
  fs: 20
1180
1142
  }
1181
1143
  },
1182
- listType: o,
1183
- listId: f
1144
+ listType: i,
1145
+ listId: p
1184
1146
  }
1185
1147
  }
1186
1148
  ]
1187
1149
  },
1188
1150
  segmentId: h,
1189
- coverType: yt.REPLACE
1190
- }), v.moveCursorTo(x + 1);
1151
+ coverType: ut.REPLACE
1152
+ }), S.moveCursorTo(D + 1);
1191
1153
  }
1192
- m.params.mutations = M.serialize();
1193
- const b = r.syncExecuteCommand(m.id, m.params);
1194
- return t.refreshSelection(), b && s.pushUndoRedo({
1195
- unitID: g,
1196
- undoMutations: [{ id: _.id, params: b }],
1197
- redoMutations: [{ id: _.id, params: m.params }],
1198
- undo() {
1199
- return r.syncExecuteCommand(_.id, b), t.refreshSelection(), !0;
1200
- },
1201
- redo() {
1202
- return r.syncExecuteCommand(_.id, m.params), t.refreshSelection(), !0;
1203
- }
1204
- }), !0;
1154
+ return _.params.actions = I.serialize(), !!r.syncExecuteCommand(_.id, _.params);
1205
1155
  }
1156
+ }, _n = {
1157
+ id: "doc.command.bullet-list",
1158
+ type: C.COMMAND,
1159
+ handler: (s) => s.get(b).syncExecuteCommand(Ge.id, {
1160
+ listType: ht.BULLET_LIST
1161
+ })
1162
+ }, Sn = {
1163
+ id: "doc.command.order-list",
1164
+ type: C.COMMAND,
1165
+ handler: (s) => s.get(b).syncExecuteCommand(Ge.id, {
1166
+ listType: ht.ORDER_LIST
1167
+ })
1206
1168
  };
1207
- function Wn(i, e) {
1208
- const { startOffset: t, endOffset: n } = i, r = [];
1209
- let s = -1;
1169
+ function vn(s, e) {
1170
+ const { startOffset: t, endOffset: n } = s, r = [];
1171
+ let i = -1;
1210
1172
  for (const o of e) {
1211
1173
  const { startIndex: a } = o;
1212
- (t > s && t <= a || n > s && n <= a || a >= t && a <= n) && r.push(o), s = a;
1174
+ (t > i && t <= a || n > i && n <= a || a >= t && a <= n) && r.push(o), i = a;
1213
1175
  }
1214
1176
  return r;
1215
1177
  }
1216
- const Hn = {
1178
+ const Mn = {
1217
1179
  id: "doc.command-replace-content",
1218
- type: I.COMMAND,
1219
- handler: async (i, e) => {
1220
- var p;
1221
- const { unitId: t, body: n, textRanges: r, segmentId: s = "" } = e, o = i.get(y), a = i.get(O), c = i.get(U), d = i.get(A), l = (p = o.getUniverDocInstance(t)) == null ? void 0 : p.getSnapshot().body, h = c.getSelections();
1222
- if (l == null || !Array.isArray(h) || h.length === 0)
1180
+ type: C.COMMAND,
1181
+ handler: async (s, e) => {
1182
+ var g;
1183
+ const { unitId: t, body: n, textRanges: r, segmentId: i = "" } = e, o = s.get(y), a = s.get(b), l = s.get(w), d = (g = o.getUniverDocInstance(t)) == null ? void 0 : g.getSnapshot().body, c = l.getSelections();
1184
+ if (d == null || !Array.isArray(c) || c.length === 0)
1223
1185
  return !1;
1224
- const g = Bt(t, s, l, n), u = a.syncExecuteCommand(g.id, g.params);
1225
- return c.replaceTextRanges(r), u ? (d.pushUndoRedo({
1226
- unitID: t,
1227
- undoMutations: [{ id: _.id, params: u }],
1228
- redoMutations: [{ id: _.id, params: g.params }],
1229
- undo() {
1230
- return a.syncExecuteCommand(_.id, u), c.replaceTextRanges(h), !0;
1231
- },
1232
- redo() {
1233
- return a.syncExecuteCommand(_.id, g.params), c.replaceTextRanges(r), !0;
1234
- }
1235
- }), !0) : !1;
1186
+ const u = It(t, i, d, n);
1187
+ return u.params.textRanges = r, !!a.syncExecuteCommand(u.id, u.params);
1236
1188
  }
1237
- }, Xn = {
1189
+ }, In = {
1238
1190
  id: "doc.command-cover-content",
1239
- type: I.COMMAND,
1240
- handler: async (i, e) => {
1241
- var l;
1242
- const { unitId: t, body: n, segmentId: r = "" } = e, s = i.get(y), o = i.get(O), a = i.get(A), c = (l = s.getUniverDocInstance(t)) == null ? void 0 : l.getSnapshot().body;
1243
- if (c == null)
1191
+ type: C.COMMAND,
1192
+ handler: async (s, e) => {
1193
+ var c;
1194
+ const { unitId: t, body: n, segmentId: r = "" } = e, i = s.get(y), o = s.get(b), a = s.get(Re), l = (c = i.getUniverDocInstance(t)) == null ? void 0 : c.getSnapshot().body;
1195
+ if (l == null)
1244
1196
  return !1;
1245
- const d = Bt(t, r, c, n);
1246
- return o.syncExecuteCommand(
1197
+ const d = It(t, r, l, n);
1198
+ return d.params.noNeedSetTextRange = !0, d.params.noHistory = !0, o.syncExecuteCommand(
1247
1199
  d.id,
1248
1200
  d.params
1249
1201
  ), a.clearUndoRedo(t), !0;
1250
1202
  }
1251
1203
  };
1252
- function Bt(i, e, t, n) {
1204
+ function It(s, e, t, n) {
1253
1205
  const r = {
1254
- id: _.id,
1206
+ id: L.id,
1255
1207
  params: {
1256
- unitId: i,
1257
- mutations: []
1208
+ unitId: s,
1209
+ actions: [],
1210
+ textRanges: []
1258
1211
  }
1259
- }, s = new H(), o = (t == null ? void 0 : t.dataStream.length) - 2;
1260
- return o > 0 && s.push({
1261
- t: "d",
1212
+ }, i = new A(), o = (t == null ? void 0 : t.dataStream.length) - 2;
1213
+ return o > 0 && i.push({
1214
+ t: x.DELETE,
1262
1215
  len: o,
1263
1216
  line: 0,
1264
1217
  segmentId: e
1265
- }), n.dataStream.length > 0 && s.push({
1266
- t: "i",
1218
+ }), n.dataStream.length > 0 && i.push({
1219
+ t: x.INSERT,
1267
1220
  body: n,
1268
1221
  len: n.dataStream.length,
1269
1222
  line: 0,
1270
1223
  segmentId: e
1271
- }), r.params.mutations = s.serialize(), r;
1224
+ }), r.params.actions = i.serialize(), r;
1272
1225
  }
1273
- const ee = {
1226
+ const ze = {
1274
1227
  id: "doc.operation.move-cursor",
1275
- type: I.OPERATION,
1276
- handler: (i, e) => !!e
1277
- }, te = {
1228
+ type: C.OPERATION,
1229
+ handler: (s, e) => !!e
1230
+ }, Ve = {
1278
1231
  id: "doc.operation.move-selection",
1279
- type: I.OPERATION,
1280
- handler: (i, e) => !!e
1281
- }, Gn = (i, e) => {
1282
- const t = i.get(y).getUniverDocInstance(e.unitId), n = (t == null ? void 0 : t.zoomRatio) || 1;
1232
+ type: C.OPERATION,
1233
+ handler: (s, e) => !!e
1234
+ }, Cn = (s, e) => {
1235
+ const t = s.get(y).getUniverDocInstance(e.unitId), n = (t == null ? void 0 : t.zoomRatio) || 1;
1283
1236
  return {
1284
- ...ie.deepClone(e),
1237
+ ...oe.deepClone(e),
1285
1238
  zoomRatio: n
1286
1239
  };
1287
- }, Z = {
1240
+ }, G = {
1288
1241
  id: "doc.operation.set-zoom-ratio",
1289
- type: I.OPERATION,
1290
- handler: (i, e) => {
1291
- const t = i.get(y).getUniverDocInstance(e.unitId);
1242
+ type: C.OPERATION,
1243
+ handler: (s, e) => {
1244
+ const t = s.get(y).getUniverDocInstance(e.unitId);
1292
1245
  if (!t)
1293
1246
  return !1;
1294
1247
  const n = t.getSnapshot();
@@ -1296,29 +1249,30 @@ const ee = {
1296
1249
  zoomRatio: e.zoomRatio
1297
1250
  } : n.settings.zoomRatio = e.zoomRatio, !0;
1298
1251
  }
1299
- }, Vt = {
1300
- type: I.COMMAND,
1252
+ }, Ct = {
1253
+ type: C.COMMAND,
1301
1254
  id: "doc.command.set-zoom-ratio",
1302
- handler: async (i, e) => {
1303
- const t = i.get(O), n = i.get(A), r = i.get(y);
1304
- let s = r.getCurrentUniverDocInstance().getUnitId(), o = 1;
1305
- if (e && (s = e.documentId ?? s, o = e.zoomRatio ?? o), !r.getUniverDocInstance(s))
1255
+ handler: async (s, e) => {
1256
+ var u, h;
1257
+ const t = s.get(b), n = s.get(Re), r = s.get(y);
1258
+ let i = r.getCurrentUniverDocInstance().getUnitId(), o = 1;
1259
+ if (e && (i = (u = e.documentId) != null ? u : i, o = (h = e.zoomRatio) != null ? h : o), !r.getUniverDocInstance(i))
1306
1260
  return !1;
1307
- const c = {
1261
+ const l = {
1308
1262
  zoomRatio: o,
1309
- unitId: s
1310
- }, d = Gn(i, c);
1311
- return t.syncExecuteCommand(Z.id, c) ? (n.pushUndoRedo({
1312
- unitID: s,
1313
- undoMutations: [{ id: Z.id, params: d }],
1314
- redoMutations: [{ id: Z.id, params: c }]
1263
+ unitId: i
1264
+ }, d = Cn(s, l);
1265
+ return t.syncExecuteCommand(G.id, l) ? (n.pushUndoRedo({
1266
+ unitID: i,
1267
+ undoMutations: [{ id: G.id, params: d }],
1268
+ redoMutations: [{ id: G.id, params: l }]
1315
1269
  }), !0) : !1;
1316
1270
  }
1317
- }, Ft = {
1271
+ }, Rn = {
1318
1272
  id: "doc.operation.select-all",
1319
- type: I.COMMAND,
1320
- handler: async (i) => {
1321
- const e = i.get(y), t = i.get(U), n = e.getCurrentUniverDocInstance().getSnapshot().body;
1273
+ type: C.COMMAND,
1274
+ handler: async (s) => {
1275
+ const e = s.get(y), t = s.get(w), n = e.getCurrentUniverDocInstance().getSnapshot().body;
1322
1276
  if (n == null)
1323
1277
  return !1;
1324
1278
  const r = [
@@ -1329,538 +1283,78 @@ const ee = {
1329
1283
  ];
1330
1284
  return t.replaceTextRanges(r), !0;
1331
1285
  }
1332
- }, Yn = 10, qn = 6;
1333
- function Zn() {
1334
- return ie.generateRandomId(qn);
1335
- }
1336
- function Kn(i) {
1337
- const e = i.match(/data-copy-id="([^\s]+)"/);
1338
- return e && e[1] ? e[1] : null;
1339
- }
1340
- class Jn {
1341
- constructor() {
1342
- S(this, "_cache", new Ht(Yn));
1343
- }
1344
- set(e, t) {
1345
- this._cache.set(e, t);
1346
- }
1347
- get(e) {
1348
- return this._cache.get(e);
1349
- }
1350
- clear() {
1351
- this._cache.clear();
1352
- }
1353
- }
1354
- const St = new Jn();
1355
- function Qn(i) {
1356
- const e = i.style, t = {};
1357
- for (let n = 0; n < e.length; n++) {
1358
- const r = e[n], s = e.getPropertyValue(r);
1359
- switch (r) {
1360
- case "margin-top": {
1361
- const o = parseInt(s);
1362
- t.spaceAbove = /pt/.test(s) ? Ke(o) : o;
1363
- break;
1364
- }
1365
- case "margin-bottom": {
1366
- const o = parseInt(s);
1367
- t.spaceBelow = /pt/.test(s) ? Ke(o) : o;
1368
- break;
1369
- }
1370
- }
1371
- }
1372
- return Object.getOwnPropertyNames(t).length ? t : null;
1373
- }
1374
- function Ke(i) {
1375
- return i / 0.75;
1376
- }
1377
- function st(i) {
1378
- const e = i.style, t = {}, n = i.tagName.toLowerCase();
1379
- switch (n) {
1380
- case "b":
1381
- case "em":
1382
- case "strong": {
1383
- t.bl = E.TRUE;
1384
- break;
1385
- }
1386
- case "s": {
1387
- t.st = {
1388
- s: E.TRUE
1389
- };
1390
- break;
1391
- }
1392
- case "u": {
1393
- t.ul = {
1394
- s: E.TRUE
1395
- };
1396
- break;
1397
- }
1398
- case "i": {
1399
- t.it = E.TRUE;
1400
- break;
1401
- }
1402
- case "sub":
1403
- case "sup": {
1404
- t.va = n === "sup" ? V.SUPERSCRIPT : V.SUBSCRIPT;
1405
- break;
1406
- }
1407
- }
1408
- for (let r = 0; r < e.length; r++) {
1409
- const s = e[r], o = e.getPropertyValue(s);
1410
- switch (s) {
1411
- case "font-family": {
1412
- t.ff = o;
1413
- break;
1414
- }
1415
- case "font-size": {
1416
- const a = parseInt(o);
1417
- Number.isNaN(a) || (t.fs = /pt$/.test(o) ? Ke(a) : a);
1418
- break;
1419
- }
1420
- case "font-style": {
1421
- o === "italic" && (t.it = E.TRUE);
1422
- break;
1423
- }
1424
- case "font-weight": {
1425
- Number(o) > 400 && (t.bl = E.TRUE);
1426
- break;
1427
- }
1428
- case "text-decoration": {
1429
- /underline/.test(o) ? t.ul = {
1430
- s: E.TRUE
1431
- } : /overline/.test(o) ? t.ol = {
1432
- s: E.TRUE
1433
- } : /line-through/.test(o) && (t.st = {
1434
- s: E.TRUE
1435
- });
1436
- break;
1437
- }
1438
- case "color": {
1439
- const a = new at(o);
1440
- a.isValid && (t.cl = {
1441
- rgb: a.toRgbString()
1442
- });
1443
- break;
1444
- }
1445
- case "background-color": {
1446
- const a = new at(o);
1447
- a.isValid && (t.bg = {
1448
- rgb: a.toRgbString()
1449
- });
1450
- break;
1451
- }
1452
- }
1453
- }
1454
- return t;
1455
- }
1456
- function er(i) {
1457
- const e = new DOMParser(), t = `<x-univer id="univer-root">${i}</x-univer>`;
1458
- return e.parseFromString(t, "text/html").querySelector("#univer-root");
1459
- }
1460
- function vt(i, e) {
1461
- const t = i.tagName.toLowerCase();
1462
- return typeof e == "string" ? t === e : Array.isArray(e) ? e.some((n) => n === t) : e(i);
1463
- }
1464
- const Le = class Le {
1465
- constructor() {
1466
- S(this, "_styleCache", /* @__PURE__ */ new Map());
1467
- S(this, "_styleRules", []);
1468
- S(this, "_afterProcessRules", []);
1469
- }
1470
- static use(e) {
1471
- if (this._pluginList.includes(e))
1472
- throw new Error(`Univer paste plugin ${e.name} already added`);
1473
- this._pluginList.push(e);
1474
- }
1475
- convert(e) {
1476
- const t = Le._pluginList.find((s) => s.checkPasteType(e)), n = er(e), r = {
1477
- dataStream: "",
1478
- textRuns: []
1479
- };
1480
- 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;
1481
- }
1482
- _process(e, t, n) {
1483
- var r;
1484
- for (const s of t)
1485
- if (s.nodeType === Node.TEXT_NODE) {
1486
- const o = (r = s.nodeValue) == null ? void 0 : r.replace(/[\r\n]/g, "");
1487
- let a;
1488
- e && this._styleCache.has(e) && (a = this._styleCache.get(e)), n.dataStream += o, a && Object.getOwnPropertyNames(a).length && n.textRuns.push({
1489
- st: n.dataStream.length - o.length,
1490
- ed: n.dataStream.length,
1491
- ts: a
1492
- });
1493
- } else if (s.nodeType === Node.ELEMENT_NODE) {
1494
- const o = e ? this._styleCache.get(e) : {}, a = this._styleRules.find(({ filter: h }) => vt(s, h)), c = a ? a.getStyle(s) : st(s);
1495
- this._styleCache.set(s, { ...o, ...c });
1496
- const { childNodes: d } = s;
1497
- this._process(s, d, n);
1498
- const l = this._afterProcessRules.find(
1499
- ({ filter: h }) => vt(s, h)
1500
- );
1501
- l && l.handler(n, s);
1502
- }
1503
- }
1504
- };
1505
- S(Le, "_pluginList", []);
1506
- let fe = Le;
1507
- const tr = {
1508
- name: "univer-doc-paste-plugin-lark",
1509
- checkPasteType(i) {
1510
- return /lark-record-clipboard/i.test(i);
1511
- },
1512
- // TODO: @JOCS, support inline code copy from lark.
1513
- stylesRules: [
1514
- {
1515
- filter: ["s"],
1516
- getStyle(i) {
1517
- const e = st(i);
1518
- return {
1519
- st: {
1520
- s: E.TRUE
1521
- },
1522
- ...e
1523
- };
1524
- }
1525
- }
1526
- ],
1527
- afterProcessRules: [
1528
- {
1529
- filter(i) {
1530
- return i.tagName === "DIV" && /ace-line/i.test(i.className);
1531
- },
1532
- handler(i) {
1533
- i.paragraphs == null && (i.paragraphs = []), i.paragraphs.push({
1534
- startIndex: i.dataStream.length
1535
- }), i.dataStream += "\r";
1536
- }
1537
- }
1538
- ]
1539
- }, nr = {
1540
- name: "univer-doc-paste-plugin-word",
1541
- checkPasteType(i) {
1542
- return /word|mso/i.test(i);
1543
- },
1544
- stylesRules: [
1545
- {
1546
- filter: ["b"],
1547
- getStyle(i) {
1548
- const e = st(i);
1549
- return { bl: E.TRUE, ...e };
1550
- }
1551
- }
1552
- ],
1553
- afterProcessRules: [
1554
- {
1555
- filter(i) {
1556
- return i.tagName === "P" && /mso/i.test(i.className);
1557
- },
1558
- handler(i, e) {
1559
- i.paragraphs == null && (i.paragraphs = []);
1560
- const t = {
1561
- startIndex: i.dataStream.length
1562
- }, n = Qn(e);
1563
- n && (t.paragraphStyle = n), i.paragraphs.push(t), i.dataStream += "\r";
1564
- }
1565
- }
1566
- ]
1567
1286
  };
1568
- function rr(i, e) {
1569
- const { st: t, ed: n, ts: r = {} } = e, { ff: s, fs: o, it: a, bl: c, ul: d, st: l, ol: h, bg: g, cl: u, va: p } = r;
1570
- let f = i.slice(t, n);
1571
- const m = [];
1572
- return a === E.TRUE && (f = `<i>${f}</i>`), p === V.SUPERSCRIPT ? f = `<sup>${f}</sup>` : p === V.SUBSCRIPT && (f = `<sub>${f}</sub>`), (d == null ? void 0 : d.s) === E.TRUE && (f = `<u>${f}</u>`), (l == null ? void 0 : l.s) === E.TRUE && (f = `<s>${f}</s>`), c === E.TRUE && (f = `<strong>${f}</strong>`), s && m.push(`font-family: ${s}`), u && m.push(`color: ${u.rgb}`), o && m.push(`font-size: ${o}px`), h && m.push("text-decoration: overline"), g && m.push(`background: ${g.rgb}`), m.length ? `<span style="${m.join(";")}">${f}</span>` : f;
1573
- }
1574
- function Mt(i, e = !0) {
1575
- const { dataStream: t, textRuns: n = [], paragraphs: r = [] } = i;
1576
- let s = 0;
1577
- const o = [], a = [];
1578
- for (const c of n) {
1579
- const { st: d, ed: l } = c;
1580
- if (d !== s && o.push(t.slice(s, d)), o.push(rr(t, c)), s = l, e)
1581
- for (const h of r) {
1582
- const { startIndex: g, paragraphStyle: u = {} } = h;
1583
- if (g >= d && g <= l) {
1584
- const { spaceAbove: p, spaceBelow: f } = u, m = [];
1585
- p != null && (typeof p == "number" ? m.push(`margin-top: ${p}px`) : m.push(`margin-top: ${p.v}px`)), f != null && (typeof f == "number" ? m.push(`margin-bottom: ${f}px`) : m.push(`margin-bottom: ${f.v}px`)), a.push(
1586
- `<p className="UniverNormal" ${m.length ? `style="${m.join(";")}"` : ""}>${o.join("")}</p>`
1587
- ), o.length = 0;
1588
- }
1589
- }
1590
- }
1591
- return a.join("") + o.join("");
1592
- }
1593
- class ir {
1594
- convert(e) {
1595
- if (e.length === 0)
1596
- throw new Error("The bodyList length at least to be 1");
1597
- if (e.length === 1)
1598
- return Mt(e[0]);
1599
- let t = "";
1600
- for (const n of e)
1601
- t += '<p className="UniverNormal">', t += Mt(n, !1), t += "</p>";
1602
- return t;
1603
- }
1604
- }
1605
- var sr = Object.defineProperty, or = Object.getOwnPropertyDescriptor, ar = (i, e, t, n) => {
1606
- for (var r = n > 1 ? void 0 : n ? or(e, t) : e, s = i.length - 1, o; s >= 0; s--)
1607
- (o = i[s]) && (r = (n ? o(e, t, r) : o(r)) || r);
1608
- return n && r && sr(e, t, r), r;
1609
- }, Ct = (i, e) => (t, n) => e(t, n, i);
1610
- fe.use(nr);
1611
- fe.use(tr);
1612
- function cr(i) {
1613
- const e = i.replace(/\n/g, "\r"), t = [];
1614
- for (let n = 0; n < e.length; n++)
1615
- e[n] === "\r" && t.push({ startIndex: n });
1616
- return {
1617
- dataStream: e,
1618
- paragraphs: t
1619
- };
1620
- }
1621
- const jt = Cn("doc.clipboard-service");
1622
- let Je = class extends X {
1623
- constructor(e, t) {
1624
- super();
1625
- S(this, "_clipboardHooks", []);
1626
- S(this, "_htmlToUDM", new fe());
1627
- S(this, "_umdToHtml", new ir());
1628
- this._currentUniverService = e, this._clipboardInterfaceService = t;
1629
- }
1630
- async queryClipboardData() {
1631
- const e = await this._clipboardInterfaceService.read();
1632
- if (e.length === 0)
1633
- return Promise.reject();
1634
- try {
1635
- let t = "", n = "";
1636
- for (const s of e)
1637
- for (const o of s.types)
1638
- o === mn ? n = await s.getType(o).then((a) => a && a.text()) : o === _n && (t = await s.getType(o).then((a) => a && a.text()));
1639
- if (!t)
1640
- return cr(n);
1641
- const r = Kn(t);
1642
- if (r) {
1643
- const s = St.get(r);
1644
- if (s)
1645
- return s;
1646
- }
1647
- return this._htmlToUDM.convert(t);
1648
- } catch (t) {
1649
- return Promise.reject(t);
1650
- }
1651
- }
1652
- async setClipboardData(e) {
1653
- const t = Zn(), n = e.length > 1 ? e.map((s) => s.dataStream).join(`
1654
- `) : e[0].dataStream;
1655
- let r = this._umdToHtml.convert(e);
1656
- return e.length === 1 && (r = r.replace(/(<[a-z]+)/, (s, o) => `${o} data-copy-id="${t}"`), St.set(t, e[0])), this._clipboardInterfaceService.write(n, r);
1657
- }
1658
- addClipboardHook(e) {
1659
- return this._clipboardHooks.push(e), qe(() => {
1660
- const t = this._clipboardHooks.indexOf(e);
1661
- t > -1 && this._clipboardHooks.splice(t, 1);
1662
- });
1663
- }
1664
- };
1665
- Je = ar([
1666
- Ct(0, y),
1667
- Ct(1, Sn)
1668
- ], Je);
1669
- var lr = Object.defineProperty, dr = Object.getOwnPropertyDescriptor, ur = (i, e, t, n) => {
1670
- for (var r = n > 1 ? void 0 : n ? dr(e, t) : e, s = i.length - 1, o; s >= 0; s--)
1671
- (o = i[s]) && (r = (n ? o(e, t, r) : o(r)) || r);
1672
- return n && r && lr(e, t, r), r;
1673
- }, ne = (i, e) => (t, n) => e(t, n, i);
1674
- let Re = class extends X {
1675
- constructor(i, e, t, n, r, s) {
1676
- super(), this._logService = i, this._commandService = e, this._currentUniverService = t, this._docClipboardService = n, this._textSelectionManagerService = r, this._contextService = s, this._commandExecutedListener(), this.initialize();
1677
- }
1678
- initialize() {
1679
- [ze, We, He].forEach(
1680
- (i) => this.disposeWithMe(this._commandService.registerMultipleCommand(i))
1681
- ), [_t, Ne].forEach(
1682
- (i) => this.disposeWithMe(this._commandService.registerCommand(i))
1683
- );
1684
- }
1685
- _commandExecutedListener() {
1686
- const i = [We.id, ze.id, He.id];
1687
- this.disposeWithMe(
1688
- this._commandService.onCommandExecuted((e) => {
1689
- if (i.includes(e.id) && !(!this._contextService.getContextValue(N) && !this._contextService.getContextValue(_e)))
1690
- switch (e.id) {
1691
- case He.id: {
1692
- this._handlePaste();
1693
- break;
1694
- }
1695
- case ze.id: {
1696
- this._handleCopy();
1697
- break;
1698
- }
1699
- case We.id: {
1700
- this._handleCut();
1701
- break;
1702
- }
1703
- default:
1704
- throw new Error(`Unhandled command ${e.id}`);
1705
- }
1706
- })
1707
- );
1708
- }
1709
- async _handlePaste() {
1710
- const { _docClipboardService: i } = this, {
1711
- segmentId: e,
1712
- endOffset: t,
1713
- style: n
1714
- } = this._textSelectionManagerService.getActiveRange() ?? {}, r = this._textSelectionManagerService.getSelections();
1715
- if (e == null && this._logService.error("[DocClipboardController] segmentId is not existed"), !(t == null || r == null))
1716
- try {
1717
- const s = await i.queryClipboardData();
1718
- let o = t;
1719
- for (const c of r) {
1720
- const { startOffset: d, endOffset: l } = c;
1721
- d == null || l == null || l <= t && (o += s.dataStream.length - (l - d));
1722
- }
1723
- const a = [
1724
- {
1725
- startOffset: o,
1726
- endOffset: o,
1727
- style: n
1728
- }
1729
- ];
1730
- this._commandService.executeCommand(_t.id, { body: s, segmentId: e, textRanges: a });
1731
- } catch {
1732
- this._logService.error("[DocClipboardController] clipboard is empty");
1733
- }
1734
- }
1735
- _getDocumentBodyInRanges() {
1736
- const i = this._textSelectionManagerService.getSelections(), e = this._currentUniverService.getCurrentUniverDocInstance(), t = [];
1737
- if (i == null)
1738
- return t;
1739
- for (const n of i) {
1740
- const { startOffset: r, endOffset: s, collapsed: o } = n;
1741
- if (o || r == null || s == null)
1742
- continue;
1743
- const a = e.sliceBody(r, s);
1744
- a != null && t.push(a);
1745
- }
1746
- return t;
1747
- }
1748
- async _handleCopy() {
1749
- const { _docClipboardService: i } = this, e = this._getDocumentBodyInRanges();
1750
- try {
1751
- i.setClipboardData(e);
1752
- } catch {
1753
- this._logService.error("[DocClipboardController] set clipboard failed");
1754
- }
1755
- }
1756
- async _handleCut() {
1757
- const {
1758
- segmentId: i,
1759
- endOffset: e,
1760
- style: t
1761
- } = this._textSelectionManagerService.getActiveRange() ?? {}, n = this._textSelectionManagerService.getSelections();
1762
- if (i == null && this._logService.error("[DocClipboardController] segmentId is not existed"), !(e == null || n == null)) {
1763
- this._handleCopy();
1764
- try {
1765
- let r = e;
1766
- for (const o of n) {
1767
- const { startOffset: a, endOffset: c } = o;
1768
- a == null || c == null || c <= e && (r -= c - a);
1769
- }
1770
- const s = [
1771
- {
1772
- startOffset: r,
1773
- endOffset: r,
1774
- style: t
1775
- }
1776
- ];
1777
- this._commandService.executeCommand(Ne.id, { segmentId: i, textRanges: s });
1778
- } catch {
1779
- this._logService.error("[DocClipboardController] cut content failed");
1780
- }
1781
- }
1782
- }
1783
- };
1784
- Re = ur([
1785
- F(j.Rendered, Re),
1786
- ne(0, Xt),
1787
- ne(1, O),
1788
- ne(2, y),
1789
- ne(3, jt),
1790
- ne(4, w(U)),
1791
- ne(5, Gt)
1792
- ], Re);
1793
- var hr = Object.defineProperty, gr = Object.getOwnPropertyDescriptor, pr = (i, e, t, n) => {
1794
- for (var r = n > 1 ? void 0 : n ? gr(e, t) : e, s = i.length - 1, o; s >= 0; s--)
1795
- (o = i[s]) && (r = (n ? o(e, t, r) : o(r)) || r);
1796
- return n && r && hr(e, t, r), r;
1797
- }, Xe = (i, e) => (t, n) => e(t, n, i);
1798
- let xe = class extends me {
1799
- constructor(i, e, t) {
1800
- super(), this._docSkeletonManagerService = i, this._renderManagerService = e, this._commandService = t, this._initialRenderRefresh(), this._commandExecutedListener();
1287
+ var On = Object.defineProperty, xn = Object.getOwnPropertyDescriptor, bn = (s, e, t, n) => {
1288
+ for (var r = n > 1 ? void 0 : n ? xn(e, t) : e, i = s.length - 1, o; i >= 0; i--)
1289
+ (o = s[i]) && (r = (n ? o(e, t, r) : o(r)) || r);
1290
+ return n && r && On(e, t, r), r;
1291
+ }, $e = (s, e) => (t, n) => e(t, n, s);
1292
+ let ue = class extends ee {
1293
+ constructor(s, e, t) {
1294
+ super(), this._docSkeletonManagerService = s, this._renderManagerService = e, this._commandService = t, this._initialRenderRefresh(), this._commandExecutedListener();
1801
1295
  }
1802
1296
  _initialRenderRefresh() {
1803
- this._docSkeletonManagerService.currentSkeletonBefore$.pipe(ve(this.dispose$)).subscribe((i) => {
1804
- if (i == null)
1297
+ this._docSkeletonManagerService.currentSkeletonBefore$.pipe(ce(this.dispose$)).subscribe((s) => {
1298
+ if (s == null)
1805
1299
  return;
1806
- const { skeleton: e, unitId: t } = i, n = this._renderManagerService.getRenderById(t);
1300
+ const { skeleton: e, unitId: t } = s, n = this._renderManagerService.getRenderById(t);
1807
1301
  if (n == null)
1808
1302
  return;
1809
1303
  const { mainComponent: r } = n;
1810
1304
  r.changeSkeleton(e), this._recalculateSizeBySkeleton(n, e);
1811
1305
  });
1812
1306
  }
1813
- _recalculateSizeBySkeleton(i, e) {
1307
+ _recalculateSizeBySkeleton(s, e) {
1814
1308
  var d;
1815
- const { mainComponent: t, scene: n } = i, r = t, s = (d = e.getSkeletonData()) == null ? void 0 : d.pages;
1816
- if (s == null)
1309
+ const { mainComponent: t, scene: n } = s, r = t, i = (d = e.getSkeletonData()) == null ? void 0 : d.pages;
1310
+ if (i == null)
1817
1311
  return;
1818
1312
  let o = 0, a = 0;
1819
- for (let l = 0, h = s.length; l < h; l++) {
1820
- const g = s[l], { pageWidth: u, pageHeight: p } = g;
1821
- r.pageLayoutType === ct.VERTICAL ? (a += p, a += r.pageMarginTop, l === h - 1 && (a += r.pageMarginTop), o = Math.max(o, u)) : r.pageLayoutType === ct.HORIZONTAL && (o += u, l !== h - 1 && (o += r.pageMarginLeft), a = Math.max(a, p));
1313
+ for (let c = 0, u = i.length; c < u; c++) {
1314
+ const h = i[c], { pageWidth: g, pageHeight: f } = h;
1315
+ r.pageLayoutType === Je.VERTICAL ? (a += f, a += r.pageMarginTop, c === u - 1 && (a += r.pageMarginTop), o = Math.max(o, g)) : r.pageLayoutType === Je.HORIZONTAL && (o += g, c !== u - 1 && (o += r.pageMarginLeft), a = Math.max(a, f));
1822
1316
  }
1823
- r.resize(o, a), [K, J].includes(i.unitId) || n.resize(o, a);
1317
+ r.resize(o, a), [Y, q].includes(s.unitId) || n.resize(o, a);
1824
1318
  }
1825
1319
  _commandExecutedListener() {
1826
- const i = [_.id], e = [K, J];
1320
+ const s = [L.id], e = [Y, q];
1827
1321
  this.disposeWithMe(
1828
1322
  this._commandService.onCommandExecuted((t) => {
1829
1323
  var n;
1830
- if (i.includes(t.id)) {
1831
- const r = t.params, { unitId: s } = r, o = this._docSkeletonManagerService.getSkeletonByUnitId(s);
1324
+ if (s.includes(t.id)) {
1325
+ const r = t.params, { unitId: i } = r, o = this._docSkeletonManagerService.getSkeletonByUnitId(i);
1832
1326
  if (o == null)
1833
1327
  return;
1834
- const { skeleton: a } = o, c = this._renderManagerService.getRenderById(s);
1835
- if (c == null)
1328
+ const { skeleton: a } = o, l = this._renderManagerService.getRenderById(i);
1329
+ if (l == null)
1836
1330
  return;
1837
- if (a.calculate(), e.includes(s)) {
1838
- (n = c.mainComponent) == null || n.makeDirty();
1331
+ if (a.calculate(), e.includes(i)) {
1332
+ (n = l.mainComponent) == null || n.makeDirty();
1839
1333
  return;
1840
1334
  }
1841
- this._recalculateSizeBySkeleton(c, a);
1335
+ this._recalculateSizeBySkeleton(l, a);
1842
1336
  }
1843
1337
  })
1844
1338
  );
1845
1339
  }
1846
1340
  };
1847
- xe = pr([
1848
- F(j.Rendered, xe),
1849
- Xe(0, w(L)),
1850
- Xe(1, G),
1851
- Xe(2, O)
1852
- ], xe);
1853
- var fr = Object.defineProperty, mr = Object.getOwnPropertyDescriptor, _r = (i, e, t, n) => {
1854
- for (var r = n > 1 ? void 0 : n ? mr(e, t) : e, s = i.length - 1, o; s >= 0; s--)
1855
- (o = i[s]) && (r = (n ? o(e, t, r) : o(r)) || r);
1856
- return n && r && fr(e, t, r), r;
1857
- }, ae = (i, e) => (t, n) => e(t, n, i);
1858
- let Oe = class extends X {
1859
- constructor(e, t, n, r, s) {
1341
+ ue = bn([
1342
+ j(z.Rendered, ue),
1343
+ $e(0, E(B)),
1344
+ $e(1, X),
1345
+ $e(2, b)
1346
+ ], ue);
1347
+ var yn = Object.defineProperty, Tn = Object.getOwnPropertyDescriptor, Dn = (s, e, t, n) => {
1348
+ for (var r = n > 1 ? void 0 : n ? Tn(e, t) : e, i = s.length - 1, o; i >= 0; i--)
1349
+ (o = s[i]) && (r = (n ? o(e, t, r) : o(r)) || r);
1350
+ return n && r && yn(e, t, r), r;
1351
+ }, te = (s, e) => (t, n) => e(t, n, s);
1352
+ let he = class extends W {
1353
+ constructor(e, t, n, r, i) {
1860
1354
  super();
1861
- S(this, "_liquid", new on());
1862
- S(this, "_pageMarginCache", /* @__PURE__ */ new Map());
1863
- this._docSkeletonManagerService = e, this._currentUniverService = t, this._renderManagerService = n, this._commandService = r, this._floatingObjectManagerService = s, this._initialize(), this._commandExecutedListener();
1355
+ v(this, "_liquid", new $t());
1356
+ v(this, "_pageMarginCache", /* @__PURE__ */ new Map());
1357
+ this._docSkeletonManagerService = e, this._currentUniverService = t, this._renderManagerService = n, this._commandService = r, this._floatingObjectManagerService = i, this._initialize(), this._commandExecutedListener();
1864
1358
  }
1865
1359
  _initialize() {
1866
1360
  this._initialRenderRefresh(), this._updateOnPluginChange();
@@ -1870,17 +1364,17 @@ let Oe = class extends X {
1870
1364
  const t = this._docSkeletonManagerService.getCurrent();
1871
1365
  if (t == null)
1872
1366
  return;
1873
- const { unitId: n, skeleton: r } = t, s = this._renderManagerService.getRenderById(n);
1874
- if (s == null)
1367
+ const { unitId: n, skeleton: r } = t, i = this._renderManagerService.getRenderById(n);
1368
+ if (i == null)
1875
1369
  return;
1876
- const { mainComponent: o, components: a, scene: c } = s, d = o, { left: l, top: h } = d;
1877
- e.forEach((g) => {
1878
- const { unitId: u, subUnitId: p, floatingObjectId: f, floatingObject: m } = g, { left: v = 0, top: M = 0, width: b = 0, height: T = 0, angle: C, flipX: x, flipY: P, skewX: B, skewY: k } = m, R = this._pageMarginCache.get(f), z = (R == null ? void 0 : R.marginLeft) || 0, W = (R == null ? void 0 : R.marginTop) || 0;
1879
- r == null || r.getViewModel().getDataModel().updateDrawing(f, {
1880
- left: v - l - z,
1881
- top: M - h - W,
1882
- height: T,
1883
- width: b
1370
+ const { mainComponent: o, components: a, scene: l } = i, d = o, { left: c, top: u } = d;
1371
+ e.forEach((h) => {
1372
+ const { unitId: g, subUnitId: f, floatingObjectId: m, floatingObject: p } = h, { left: _ = 0, top: S = 0, width: I = 0, height: R = 0, angle: O, flipX: N, flipY: P, skewX: T, skewY: D } = p, M = this._pageMarginCache.get(m), F = (M == null ? void 0 : M.marginLeft) || 0, $ = (M == null ? void 0 : M.marginTop) || 0;
1373
+ r == null || r.getViewModel().getDataModel().updateDrawing(m, {
1374
+ left: _ - c - F,
1375
+ top: S - u - $,
1376
+ height: R,
1377
+ width: I
1884
1378
  });
1885
1379
  }), r == null || r.calculate(), o == null || o.makeDirty();
1886
1380
  });
@@ -1892,85 +1386,85 @@ let Oe = class extends X {
1892
1386
  const { skeleton: t, unitId: n } = e, r = this._renderManagerService.getRenderById(n);
1893
1387
  if (r == null)
1894
1388
  return;
1895
- const { mainComponent: s } = r;
1896
- s.changeSkeleton(t), this._refreshFloatingObject(n, t, r);
1389
+ const { mainComponent: i } = r;
1390
+ i.changeSkeleton(t), this._refreshFloatingObject(n, t, r);
1897
1391
  });
1898
1392
  }
1899
1393
  _commandExecutedListener() {
1900
- const e = [_.id, Z.id], t = [K, J];
1394
+ const e = [L.id, G.id], t = [Y, q];
1901
1395
  this.disposeWithMe(
1902
1396
  this._commandService.onCommandExecuted((n) => {
1903
1397
  var r;
1904
1398
  if (e.includes(n.id)) {
1905
- const s = n.params, { unitId: o } = s, a = this._docSkeletonManagerService.getCurrent();
1399
+ const i = n.params, { unitId: o } = i, a = this._docSkeletonManagerService.getCurrent();
1906
1400
  if (a == null)
1907
1401
  return;
1908
- const { unitId: c, skeleton: d } = a;
1909
- if (o !== c)
1402
+ const { unitId: l, skeleton: d } = a;
1403
+ if (o !== l)
1910
1404
  return;
1911
- const l = this._renderManagerService.getRenderById(c);
1912
- if (l == null)
1405
+ const c = this._renderManagerService.getRenderById(l);
1406
+ if (c == null)
1913
1407
  return;
1914
- if (t.includes(c)) {
1915
- (r = l.mainComponent) == null || r.makeDirty();
1408
+ if (t.includes(l)) {
1409
+ (r = c.mainComponent) == null || r.makeDirty();
1916
1410
  return;
1917
1411
  }
1918
- this._refreshFloatingObject(c, d, l);
1412
+ this._refreshFloatingObject(l, d, c);
1919
1413
  }
1920
1414
  })
1921
1415
  );
1922
1416
  }
1923
1417
  _refreshFloatingObject(e, t, n) {
1924
- const r = t == null ? void 0 : t.getSkeletonData(), { mainComponent: s, scene: o } = n, a = s;
1418
+ const r = t == null ? void 0 : t.getSkeletonData(), { mainComponent: i, scene: o } = n, a = i;
1925
1419
  if (!r)
1926
1420
  return;
1927
- const { left: c, top: d, pageLayoutType: l, pageMarginLeft: h, pageMarginTop: g } = a, { pages: u } = r, p = [];
1421
+ const { left: l, top: d, pageLayoutType: c, pageMarginLeft: u, pageMarginTop: h } = a, { pages: g } = r, f = [];
1928
1422
  o.getAncestorScale(), this._liquid.reset(), this._pageMarginCache.clear();
1929
- for (let f = 0, m = u.length; f < m; f++) {
1930
- const v = u[f], { skeDrawings: M, marginLeft: b, marginTop: T } = v;
1931
- this._liquid.translatePagePadding(v), M.forEach((C) => {
1932
- const { aLeft: x, aTop: P, height: B, width: k, objectId: R } = C;
1933
- p.push({
1423
+ for (let m = 0, p = g.length; m < p; m++) {
1424
+ const _ = g[m], { skeDrawings: S, marginLeft: I, marginTop: R } = _;
1425
+ this._liquid.translatePagePadding(_), S.forEach((O) => {
1426
+ const { aLeft: N, aTop: P, height: T, width: D, objectId: M } = O;
1427
+ f.push({
1934
1428
  unitId: e,
1935
- subUnitId: Yt,
1936
- floatingObjectId: R,
1429
+ subUnitId: bt,
1430
+ floatingObjectId: M,
1937
1431
  floatingObject: {
1938
- left: x + c + this._liquid.x,
1432
+ left: N + l + this._liquid.x,
1939
1433
  top: P + d + this._liquid.y,
1940
- width: k,
1941
- height: B
1434
+ width: D,
1435
+ height: T
1942
1436
  }
1943
- }), this._pageMarginCache.set(R, {
1437
+ }), this._pageMarginCache.set(M, {
1944
1438
  marginLeft: this._liquid.x,
1945
1439
  marginTop: this._liquid.y
1946
1440
  });
1947
- }), this._liquid.translatePage(v, l, h, g);
1441
+ }), this._liquid.translatePage(_, c, u, h);
1948
1442
  }
1949
- this._floatingObjectManagerService.BatchAddOrUpdate(p);
1443
+ this._floatingObjectManagerService.BatchAddOrUpdate(f);
1950
1444
  }
1951
1445
  };
1952
- Oe = _r([
1953
- F(j.Steady, Oe),
1954
- ae(0, w(L)),
1955
- ae(1, y),
1956
- ae(2, G),
1957
- ae(3, O),
1958
- ae(4, qt)
1959
- ], Oe);
1960
- var Sr = Object.defineProperty, vr = Object.getOwnPropertyDescriptor, Mr = (i, e, t, n) => {
1961
- for (var r = n > 1 ? void 0 : n ? vr(e, t) : e, s = i.length - 1, o; s >= 0; s--)
1962
- (o = i[s]) && (r = (n ? o(e, t, r) : o(r)) || r);
1963
- return n && r && Sr(e, t, r), r;
1964
- }, re = (i, e) => (t, n) => e(t, n, i);
1965
- let ye = class extends X {
1966
- constructor(e, t, n, r, s, o) {
1446
+ he = Dn([
1447
+ j(z.Steady, he),
1448
+ te(0, E(B)),
1449
+ te(1, y),
1450
+ te(2, X),
1451
+ te(3, b),
1452
+ te(4, yt)
1453
+ ], he);
1454
+ var Pn = Object.defineProperty, En = Object.getOwnPropertyDescriptor, wn = (s, e, t, n) => {
1455
+ for (var r = n > 1 ? void 0 : n ? En(e, t) : e, i = s.length - 1, o; i >= 0; i--)
1456
+ (o = s[i]) && (r = (n ? o(e, t, r) : o(r)) || r);
1457
+ return n && r && Pn(e, t, r), r;
1458
+ }, ne = (s, e) => (t, n) => e(t, n, s);
1459
+ let ge = class extends W {
1460
+ constructor(e, t, n, r, i) {
1967
1461
  super();
1968
- S(this, "_previousIMEContent", "");
1969
- S(this, "_previousIMERange");
1970
- S(this, "_onStartSubscription");
1971
- S(this, "_onUpdateSubscription");
1972
- S(this, "_onEndSubscription");
1973
- this._docSkeletonManagerService = e, this._currentUniverService = t, this._renderManagerService = n, this._textSelectionRenderManager = r, this._imeInputManagerService = s, this._commandService = o, this._initialize();
1462
+ v(this, "_previousIMEContent", "");
1463
+ v(this, "_isCompositionStart", !0);
1464
+ v(this, "_onStartSubscription");
1465
+ v(this, "_onUpdateSubscription");
1466
+ v(this, "_onEndSubscription");
1467
+ this._docSkeletonManagerService = e, this._currentUniverService = t, this._textSelectionRenderManager = n, this._imeInputManagerService = r, this._commandService = i, this._initialize();
1974
1468
  }
1975
1469
  dispose() {
1976
1470
  var e, t, n;
@@ -1984,7 +1478,7 @@ let ye = class extends X {
1984
1478
  if (e == null)
1985
1479
  return;
1986
1480
  const { activeRange: t } = e;
1987
- t != null && (this._imeInputManagerService.clearUndoRedoMutationParamsCache(), this._imeInputManagerService.setActiveRange(ie.deepClone(t)), this._previousIMERange = t);
1481
+ t != null && (this._imeInputManagerService.clearUndoRedoMutationParamsCache(), this._imeInputManagerService.setActiveRange(oe.deepClone(t)), this._isCompositionStart = !0);
1988
1482
  });
1989
1483
  }
1990
1484
  _initialOnCompositionUpdate() {
@@ -1998,100 +1492,86 @@ let ye = class extends X {
1998
1492
  });
1999
1493
  }
2000
1494
  async _updateContent(e, t) {
2001
- var p;
2002
- const n = (p = this._docSkeletonManagerService.getCurrent()) == null ? void 0 : p.skeleton;
2003
- if (this._previousIMERange == null || e == null || n == null)
1495
+ var d;
1496
+ const n = (d = this._docSkeletonManagerService.getCurrent()) == null ? void 0 : d.skeleton;
1497
+ if (e == null || n == null)
2004
1498
  return;
2005
- const r = this._currentUniverService.getCurrentUniverDocInstance(), { event: s, activeRange: o } = e, { startOffset: a, segmentId: c, style: d } = this._previousIMERange;
1499
+ const r = this._currentUniverService.getCurrentUniverDocInstance(), { event: i, activeRange: o } = e;
2006
1500
  if (n == null || o == null)
2007
1501
  return;
2008
- const h = s.data;
2009
- if (h === this._previousIMEContent && t)
2010
- return;
2011
- const g = h.length, u = [
2012
- {
2013
- startOffset: a + g,
2014
- endOffset: a + g,
2015
- style: d
2016
- }
2017
- ];
2018
- await this._commandService.executeCommand(Lt.id, {
1502
+ const l = i.data;
1503
+ l === this._previousIMEContent && t || (await this._commandService.executeCommand(St.id, {
2019
1504
  unitId: r.getUnitId(),
2020
- newText: h,
1505
+ newText: l,
2021
1506
  oldTextLen: this._previousIMEContent.length,
2022
- range: this._previousIMERange,
2023
- textRanges: u,
2024
- isCompositionEnd: !t,
2025
- segmentId: c
2026
- }), t ? (this._previousIMERange.collapsed || (this._previousIMERange.collapsed = !0), this._previousIMEContent = h) : this._resetIME();
1507
+ isCompositionStart: this._isCompositionStart,
1508
+ isCompositionEnd: !t
1509
+ }), t ? (this._isCompositionStart && (this._isCompositionStart = !1), this._previousIMEContent = l) : this._resetIME());
2027
1510
  }
2028
1511
  _resetIME() {
2029
- this._previousIMEContent = "", this._previousIMERange = null, this._imeInputManagerService.clearUndoRedoMutationParamsCache(), this._imeInputManagerService.setActiveRange(null);
2030
- }
2031
- _getDocObject() {
2032
- return $e(this._currentUniverService, this._renderManagerService);
1512
+ this._previousIMEContent = "", this._isCompositionStart = !0, this._imeInputManagerService.clearUndoRedoMutationParamsCache(), this._imeInputManagerService.setActiveRange(null);
2033
1513
  }
2034
1514
  };
2035
- ye = Mr([
2036
- F(j.Rendered, ye),
2037
- re(0, w(L)),
2038
- re(1, y),
2039
- re(2, G),
2040
- re(3, Se),
2041
- re(4, w(rt)),
2042
- re(5, O)
2043
- ], ye);
2044
- var Cr = Object.defineProperty, Ir = Object.getOwnPropertyDescriptor, Rr = (i, e, t, n) => {
2045
- for (var r = n > 1 ? void 0 : n ? Ir(e, t) : e, s = i.length - 1, o; s >= 0; s--)
2046
- (o = i[s]) && (r = (n ? o(e, t, r) : o(r)) || r);
2047
- return n && r && Cr(e, t, r), r;
2048
- }, It = (i, e) => (t, n) => e(t, n, i);
2049
- let be = class extends X {
2050
- constructor(i, e) {
2051
- super(), this._textSelectionManagerService = i, this._commandService = e, this._commandExecutedListener();
1515
+ ge = wn([
1516
+ j(z.Rendered, ge),
1517
+ ne(0, E(B)),
1518
+ ne(1, y),
1519
+ ne(2, ae),
1520
+ ne(3, E(xe)),
1521
+ ne(4, b)
1522
+ ], ge);
1523
+ var Un = Object.defineProperty, Nn = Object.getOwnPropertyDescriptor, An = (s, e, t, n) => {
1524
+ for (var r = n > 1 ? void 0 : n ? Nn(e, t) : e, i = s.length - 1, o; i >= 0; i--)
1525
+ (o = s[i]) && (r = (n ? o(e, t, r) : o(r)) || r);
1526
+ return n && r && Un(e, t, r), r;
1527
+ }, at = (s, e) => (t, n) => e(t, n, s);
1528
+ let me = class extends W {
1529
+ constructor(s, e) {
1530
+ super(), this._textSelectionManagerService = s, this._commandService = e, this._commandExecutedListener();
2052
1531
  }
2053
1532
  _commandExecutedListener() {
2054
- const i = [
2055
- he.id,
2056
- Ve.id,
2057
- Fe.id,
2058
- je.id,
1533
+ const s = [
1534
+ Te.id,
1535
+ De.id,
1536
+ Pe.id,
1537
+ Ee.id,
2059
1538
  Q.id,
2060
- oe.id,
2061
- ge.id,
2062
- pe.id,
2063
- ke.id
1539
+ we.id,
1540
+ Ue.id,
1541
+ Ne.id,
1542
+ Ae.id
2064
1543
  ];
2065
1544
  this.disposeWithMe(
2066
1545
  this._commandService.onCommandExecuted((e) => {
2067
- i.includes(e.id) && this._handleInlineFormat(e);
1546
+ s.includes(e.id) && this._handleInlineFormat(e);
2068
1547
  })
2069
1548
  );
2070
1549
  }
2071
- _handleInlineFormat(i) {
2072
- const { segmentId: e } = this._textSelectionManagerService.getActiveRange() ?? {};
2073
- e != null && this._commandService.executeCommand($t.id, {
1550
+ _handleInlineFormat(s) {
1551
+ var t, n;
1552
+ const { segmentId: e } = (t = this._textSelectionManagerService.getActiveRange()) != null ? t : {};
1553
+ e != null && this._commandService.executeCommand(Mt.id, {
2074
1554
  segmentId: e,
2075
- preCommandId: i.id,
2076
- ...i.params ?? {}
1555
+ preCommandId: s.id,
1556
+ ...(n = s.params) != null ? n : {}
2077
1557
  });
2078
1558
  }
2079
1559
  };
2080
- be = Rr([
2081
- F(j.Rendered, be),
2082
- It(0, w(U)),
2083
- It(1, O)
2084
- ], be);
2085
- var xr = Object.defineProperty, Or = Object.getOwnPropertyDescriptor, yr = (i, e, t, n) => {
2086
- for (var r = n > 1 ? void 0 : n ? Or(e, t) : e, s = i.length - 1, o; s >= 0; s--)
2087
- (o = i[s]) && (r = (n ? o(e, t, r) : o(r)) || r);
2088
- return n && r && xr(e, t, r), r;
2089
- }, ce = (i, e) => (t, n) => e(t, n, i);
2090
- let Te = class extends X {
2091
- constructor(e, t, n, r, s) {
1560
+ me = An([
1561
+ j(z.Rendered, me),
1562
+ at(0, E(w)),
1563
+ at(1, b)
1564
+ ], me);
1565
+ var Ln = Object.defineProperty, $n = Object.getOwnPropertyDescriptor, Bn = (s, e, t, n) => {
1566
+ for (var r = n > 1 ? void 0 : n ? $n(e, t) : e, i = s.length - 1, o; i >= 0; i--)
1567
+ (o = s[i]) && (r = (n ? o(e, t, r) : o(r)) || r);
1568
+ return n && r && Ln(e, t, r), r;
1569
+ }, re = (s, e) => (t, n) => e(t, n, s);
1570
+ let fe = class extends W {
1571
+ constructor(e, t, n, r, i) {
2092
1572
  super();
2093
- S(this, "_onInputSubscription");
2094
- this._docSkeletonManagerService = e, this._currentUniverService = t, this._renderManagerService = n, this._textSelectionManagerService = r, this._commandService = s, this._initialize(), this._commandExecutedListener();
1573
+ v(this, "_onInputSubscription");
1574
+ this._docSkeletonManagerService = e, this._currentUniverService = t, this._renderManagerService = n, this._textSelectionManagerService = r, this._commandService = i, this._initialize(), this._commandExecutedListener();
2095
1575
  }
2096
1576
  dispose() {
2097
1577
  var e;
@@ -2100,16 +1580,16 @@ let Te = class extends X {
2100
1580
  _initialize() {
2101
1581
  }
2102
1582
  _commandExecutedListener() {
2103
- const e = [ee.id, te.id];
1583
+ const e = [ze.id, Ve.id];
2104
1584
  this.disposeWithMe(
2105
1585
  this._commandService.onCommandExecuted((t) => {
2106
1586
  if (!e.includes(t.id))
2107
1587
  return;
2108
1588
  const n = t.params;
2109
1589
  switch (t.id) {
2110
- case ee.id:
1590
+ case ze.id:
2111
1591
  return this._handleMoveCursor(n.direction);
2112
- case te.id:
1592
+ case Ve.id:
2113
1593
  return this._handleShiftMoveSelection(n.direction);
2114
1594
  default:
2115
1595
  throw new Error("Unknown command");
@@ -2118,112 +1598,112 @@ let Te = class extends X {
2118
1598
  );
2119
1599
  }
2120
1600
  _handleShiftMoveSelection(e) {
2121
- var f;
2122
- const t = this._textSelectionManagerService.getActiveRange(), n = this._textSelectionManagerService.getSelections(), r = this._currentUniverService.getCurrentUniverDocInstance(), s = (f = this._docSkeletonManagerService.getCurrent()) == null ? void 0 : f.skeleton, o = this._getDocObject();
2123
- if (t == null || s == null || o == null)
1601
+ var m, p, _;
1602
+ const t = this._textSelectionManagerService.getActiveRange(), n = this._textSelectionManagerService.getSelections(), r = this._currentUniverService.getCurrentUniverDocInstance(), i = (m = this._docSkeletonManagerService.getCurrent()) == null ? void 0 : m.skeleton, o = this._getDocObject();
1603
+ if (t == null || i == null || o == null)
2124
1604
  return;
2125
- const { startOffset: a, endOffset: c, style: d, collapsed: l, direction: h } = t;
1605
+ const { startOffset: a, endOffset: l, style: d, collapsed: c, direction: u } = t;
2126
1606
  if (n.length > 1) {
2127
- let m = Number.POSITIVE_INFINITY, v = Number.NEGATIVE_INFINITY;
2128
- for (const M of n)
2129
- m = Math.min(m, M.startOffset), v = Math.max(v, M.endOffset);
1607
+ let S = Number.POSITIVE_INFINITY, I = Number.NEGATIVE_INFINITY;
1608
+ for (const R of n)
1609
+ S = Math.min(S, R.startOffset), I = Math.max(I, R.endOffset);
2130
1610
  this._textSelectionManagerService.replaceTextRanges([
2131
1611
  {
2132
- startOffset: e === D.LEFT || e === D.UP ? v : m,
2133
- endOffset: e === D.LEFT || e === D.UP ? m : v,
1612
+ startOffset: e === U.LEFT || e === U.UP ? I : S,
1613
+ endOffset: e === U.LEFT || e === U.UP ? S : I,
2134
1614
  style: d
2135
1615
  }
2136
1616
  ]);
2137
1617
  return;
2138
1618
  }
2139
- const g = l || h === lt.FORWARD ? a : c;
2140
- let u = l || h === lt.FORWARD ? c : a;
2141
- const p = r.getBody().dataStream.length ?? Number.POSITIVE_INFINITY;
2142
- if (e === D.LEFT || e === D.RIGHT) {
2143
- const m = s.findNodeByCharIndex(u - 1), v = s.findNodeByCharIndex(u);
2144
- u = e === D.RIGHT ? u + v.count : u - ((m == null ? void 0 : m.count) ?? 0), u = Math.min(p - 2, Math.max(0, u)), this._textSelectionManagerService.replaceTextRanges([
1619
+ const h = c || u === Qe.FORWARD ? a : l;
1620
+ let g = c || u === Qe.FORWARD ? l : a;
1621
+ const f = (p = r.getBody().dataStream.length) != null ? p : Number.POSITIVE_INFINITY;
1622
+ if (e === U.LEFT || e === U.RIGHT) {
1623
+ const S = i.findNodeByCharIndex(g - 1), I = i.findNodeByCharIndex(g);
1624
+ g = e === U.RIGHT ? g + I.count : g - ((_ = S == null ? void 0 : S.count) != null ? _ : 0), g = Math.min(f - 2, Math.max(0, g)), this._textSelectionManagerService.replaceTextRanges([
2145
1625
  {
2146
- startOffset: g,
2147
- endOffset: u,
1626
+ startOffset: h,
1627
+ endOffset: g,
2148
1628
  style: d
2149
1629
  }
2150
1630
  ]);
2151
1631
  } else {
2152
- const m = s.findNodeByCharIndex(u), v = o.document.getOffsetConfig(), M = this._getTopOrBottomPosition(s, m, e === D.DOWN);
2153
- if (M == null) {
2154
- const T = e === D.UP ? 0 : p - 2;
2155
- if (T === u)
1632
+ const S = i.findNodeByCharIndex(g), I = o.document.getOffsetConfig(), R = this._getTopOrBottomPosition(i, S, e === U.DOWN);
1633
+ if (R == null) {
1634
+ const N = e === U.UP ? 0 : f - 2;
1635
+ if (N === g)
2156
1636
  return;
2157
1637
  this._textSelectionManagerService.replaceTextRanges([
2158
1638
  {
2159
- startOffset: g,
2160
- endOffset: T,
1639
+ startOffset: h,
1640
+ endOffset: N,
2161
1641
  style: d
2162
1642
  }
2163
1643
  ]);
2164
1644
  return;
2165
1645
  }
2166
- const b = new dt(v, s).getRangePointData(
2167
- M,
2168
- M
1646
+ const O = new et(I, i).getRangePointData(
1647
+ R,
1648
+ R
2169
1649
  ).cursorList[0];
2170
1650
  this._textSelectionManagerService.replaceTextRanges([
2171
1651
  {
2172
- startOffset: g,
2173
- endOffset: b.endOffset,
1652
+ startOffset: h,
1653
+ endOffset: O.endOffset,
2174
1654
  style: d
2175
1655
  }
2176
1656
  ]);
2177
1657
  }
2178
1658
  }
2179
1659
  _handleMoveCursor(e) {
2180
- var g;
2181
- const t = this._textSelectionManagerService.getActiveRange(), n = this._textSelectionManagerService.getSelections(), r = this._currentUniverService.getCurrentUniverDocInstance(), s = (g = this._docSkeletonManagerService.getCurrent()) == null ? void 0 : g.skeleton, o = this._getDocObject();
2182
- if (t == null || s == null || o == null || n == null)
1660
+ var h, g, f;
1661
+ const t = this._textSelectionManagerService.getActiveRange(), n = this._textSelectionManagerService.getSelections(), r = this._currentUniverService.getCurrentUniverDocInstance(), i = (h = this._docSkeletonManagerService.getCurrent()) == null ? void 0 : h.skeleton, o = this._getDocObject();
1662
+ if (t == null || i == null || o == null || n == null)
2183
1663
  return;
2184
- const { startOffset: a, endOffset: c, style: d, collapsed: l } = t, h = r.getBody().dataStream.length ?? Number.POSITIVE_INFINITY;
2185
- if (e === D.LEFT || e === D.RIGHT) {
2186
- let u;
1664
+ const { startOffset: a, endOffset: l, style: d, collapsed: c } = t, u = (g = r.getBody().dataStream.length) != null ? g : Number.POSITIVE_INFINITY;
1665
+ if (e === U.LEFT || e === U.RIGHT) {
1666
+ let m;
2187
1667
  if (!t.collapsed || n.length > 1) {
2188
- let p = Number.POSITIVE_INFINITY, f = Number.NEGATIVE_INFINITY;
2189
- for (const m of n)
2190
- p = Math.min(p, m.startOffset), f = Math.max(f, m.endOffset);
2191
- u = e === D.LEFT ? p : f;
1668
+ let p = Number.POSITIVE_INFINITY, _ = Number.NEGATIVE_INFINITY;
1669
+ for (const S of n)
1670
+ p = Math.min(p, S.startOffset), _ = Math.max(_, S.endOffset);
1671
+ m = e === U.LEFT ? p : _;
2192
1672
  } else {
2193
- const p = s.findNodeByCharIndex(a - 1), f = s.findNodeByCharIndex(a);
2194
- e === D.LEFT ? u = Math.max(0, a - ((p == null ? void 0 : p.count) ?? 0)) : u = Math.min(h - 2, c + f.count);
1673
+ const p = i.findNodeByCharIndex(a - 1), _ = i.findNodeByCharIndex(a);
1674
+ e === U.LEFT ? m = Math.max(0, a - ((f = p == null ? void 0 : p.count) != null ? f : 0)) : m = Math.min(u - 2, l + _.count);
2195
1675
  }
2196
1676
  this._textSelectionManagerService.replaceTextRanges([
2197
1677
  {
2198
- startOffset: u,
2199
- endOffset: u,
1678
+ startOffset: m,
1679
+ endOffset: m,
2200
1680
  style: d
2201
1681
  }
2202
1682
  ]);
2203
1683
  } else {
2204
- const u = s.findNodeByCharIndex(a), p = s.findNodeByCharIndex(c), f = o.document.getOffsetConfig(), m = this._getTopOrBottomPosition(
2205
- s,
2206
- e === D.UP ? u : p,
2207
- e === D.DOWN
1684
+ const m = i.findNodeByCharIndex(a), p = i.findNodeByCharIndex(l), _ = o.document.getOffsetConfig(), S = this._getTopOrBottomPosition(
1685
+ i,
1686
+ e === U.UP ? m : p,
1687
+ e === U.DOWN
2208
1688
  );
2209
- if (m == null) {
2210
- let M;
2211
- l ? M = e === D.UP ? 0 : h - 2 : M = e === D.UP ? a : c, this._textSelectionManagerService.replaceTextRanges([
1689
+ if (S == null) {
1690
+ let R;
1691
+ c ? R = e === U.UP ? 0 : u - 2 : R = e === U.UP ? a : l, this._textSelectionManagerService.replaceTextRanges([
2212
1692
  {
2213
- startOffset: M,
2214
- endOffset: M,
1693
+ startOffset: R,
1694
+ endOffset: R,
2215
1695
  style: d
2216
1696
  }
2217
1697
  ]);
2218
1698
  return;
2219
1699
  }
2220
- const v = new dt(f, s).getRangePointData(
2221
- m,
2222
- m
1700
+ const I = new et(_, i).getRangePointData(
1701
+ S,
1702
+ S
2223
1703
  ).cursorList[0];
2224
1704
  this._textSelectionManagerService.replaceTextRanges([
2225
1705
  {
2226
- ...v,
1706
+ ...I,
2227
1707
  style: d
2228
1708
  }
2229
1709
  ]);
@@ -2232,10 +1712,10 @@ let Te = class extends X {
2232
1712
  _getTopOrBottomPosition(e, t, n) {
2233
1713
  if (t == null)
2234
1714
  return;
2235
- const r = this._getSpanLeftOffsetInLine(t), s = this._getNextOrPrevLine(t, n);
2236
- if (s == null)
1715
+ const r = this._getSpanLeftOffsetInLine(t), i = this._getNextOrPrevLine(t, n);
1716
+ if (i == null)
2237
1717
  return;
2238
- const o = this._matchPositionByLeftOffset(e, s, r);
1718
+ const o = this._matchPositionByLeftOffset(e, i, r);
2239
1719
  if (o != null)
2240
1720
  return { ...o, isBack: !0 };
2241
1721
  }
@@ -2250,101 +1730,101 @@ let Te = class extends X {
2250
1730
  const r = {
2251
1731
  distance: Number.POSITIVE_INFINITY
2252
1732
  };
2253
- for (const s of t.divides) {
2254
- const o = s.left;
2255
- for (const a of s.spanGroup) {
2256
- const { left: c } = a, d = o + c, l = Math.abs(n - d);
2257
- l < r.distance && (r.span = a, r.distance = l);
1733
+ for (const i of t.divides) {
1734
+ const o = i.left;
1735
+ for (const a of i.spanGroup) {
1736
+ const { left: l } = a, d = o + l, c = Math.abs(n - d);
1737
+ c < r.distance && (r.span = a, r.distance = c);
2258
1738
  }
2259
1739
  }
2260
1740
  if (r.span != null)
2261
1741
  return e.findPositionBySpan(r.span);
2262
1742
  }
2263
1743
  _getNextOrPrevLine(e, t) {
2264
- var p, f, m, v, M, b, T, C, x, P, B, k;
1744
+ var f, m, p, _, S, I, R, O, N, P, T, D;
2265
1745
  const n = e.parent;
2266
1746
  if (n == null)
2267
1747
  return;
2268
1748
  const r = n.parent;
2269
1749
  if (r == null)
2270
1750
  return;
2271
- const s = r.parent;
2272
- if (s == null)
1751
+ const i = r.parent;
1752
+ if (i == null)
2273
1753
  return;
2274
- const o = s.lines.indexOf(r);
1754
+ const o = i.lines.indexOf(r);
2275
1755
  if (o === -1)
2276
1756
  return;
2277
1757
  let a;
2278
- if (t === !0 ? a = s.lines[o + 1] : a = s.lines[o - 1], a != null)
1758
+ if (t === !0 ? a = i.lines[o + 1] : a = i.lines[o - 1], a != null)
2279
1759
  return a;
2280
- const c = s.parent;
2281
- if (c == null)
1760
+ const l = i.parent;
1761
+ if (l == null)
2282
1762
  return;
2283
- const d = c.columns.indexOf(s);
1763
+ const d = l.columns.indexOf(i);
2284
1764
  if (d === -1)
2285
1765
  return;
2286
1766
  if (t === !0)
2287
- a = (p = c.columns[d + 1]) == null ? void 0 : p.lines[0];
1767
+ a = (f = l.columns[d + 1]) == null ? void 0 : f.lines[0];
2288
1768
  else {
2289
- const R = (m = (f = c.columns) == null ? void 0 : f[d - 1]) == null ? void 0 : m.lines;
2290
- a = R == null ? void 0 : R[R.length - 1];
1769
+ const M = (p = (m = l.columns) == null ? void 0 : m[d - 1]) == null ? void 0 : p.lines;
1770
+ a = M == null ? void 0 : M[M.length - 1];
2291
1771
  }
2292
1772
  if (a != null)
2293
1773
  return a;
2294
- const l = c.parent;
2295
- if (l == null)
1774
+ const c = l.parent;
1775
+ if (c == null)
2296
1776
  return;
2297
- const h = l.sections.indexOf(c);
2298
- if (h === -1)
1777
+ const u = c.sections.indexOf(l);
1778
+ if (u === -1)
2299
1779
  return;
2300
1780
  if (t === !0)
2301
- a = (M = (v = l.sections[h - 1]) == null ? void 0 : v.columns[0]) == null ? void 0 : M.lines[0];
1781
+ a = (S = (_ = c.sections[u - 1]) == null ? void 0 : _.columns[0]) == null ? void 0 : S.lines[0];
2302
1782
  else {
2303
- const R = (T = (b = l.sections) == null ? void 0 : b[h - 1]) == null ? void 0 : T.columns, z = R == null ? void 0 : R[R.length - 1], W = z == null ? void 0 : z.lines;
2304
- a = W == null ? void 0 : W[W.length - 1];
1783
+ const M = (R = (I = c.sections) == null ? void 0 : I[u - 1]) == null ? void 0 : R.columns, F = M == null ? void 0 : M[M.length - 1], $ = F == null ? void 0 : F.lines;
1784
+ a = $ == null ? void 0 : $[$.length - 1];
2305
1785
  }
2306
1786
  if (a != null)
2307
1787
  return a;
2308
- const g = l.parent;
2309
- if (g == null)
1788
+ const h = c.parent;
1789
+ if (h == null)
2310
1790
  return;
2311
- const u = g.pages.indexOf(l);
2312
- if (u !== -1) {
1791
+ const g = h.pages.indexOf(c);
1792
+ if (g !== -1) {
2313
1793
  if (t === !0)
2314
- a = (P = (x = (C = g.pages[u + 1]) == null ? void 0 : C.sections[0]) == null ? void 0 : x.columns[0]) == null ? void 0 : P.lines[0];
1794
+ a = (P = (N = (O = h.pages[g + 1]) == null ? void 0 : O.sections[0]) == null ? void 0 : N.columns[0]) == null ? void 0 : P.lines[0];
2315
1795
  else {
2316
- const R = (B = g.pages[u - 1]) == null ? void 0 : B.sections;
2317
- if (R == null)
1796
+ const M = (T = h.pages[g - 1]) == null ? void 0 : T.sections;
1797
+ if (M == null)
2318
1798
  return;
2319
- const z = (k = R[R.length - 1]) == null ? void 0 : k.columns, W = z[z.length - 1], ot = W == null ? void 0 : W.lines;
2320
- a = ot[ot.length - 1];
1799
+ const F = (D = M[M.length - 1]) == null ? void 0 : D.columns, $ = F[F.length - 1], Ye = $ == null ? void 0 : $.lines;
1800
+ a = Ye[Ye.length - 1];
2321
1801
  }
2322
1802
  if (a != null)
2323
1803
  return a;
2324
1804
  }
2325
1805
  }
2326
1806
  _getDocObject() {
2327
- return $e(this._currentUniverService, this._renderManagerService);
1807
+ return ke(this._currentUniverService, this._renderManagerService);
2328
1808
  }
2329
1809
  };
2330
- Te = yr([
2331
- F(j.Rendered, Te),
2332
- ce(0, w(L)),
2333
- ce(1, y),
2334
- ce(2, G),
2335
- ce(3, w(U)),
2336
- ce(4, O)
2337
- ], Te);
2338
- var br = Object.defineProperty, Tr = Object.getOwnPropertyDescriptor, Dr = (i, e, t, n) => {
2339
- for (var r = n > 1 ? void 0 : n ? Tr(e, t) : e, s = i.length - 1, o; s >= 0; s--)
2340
- (o = i[s]) && (r = (n ? o(e, t, r) : o(r)) || r);
2341
- return n && r && br(e, t, r), r;
2342
- }, le = (i, e) => (t, n) => e(t, n, i);
2343
- let De = class extends X {
2344
- constructor(e, t, n, r, s) {
1810
+ fe = Bn([
1811
+ j(z.Rendered, fe),
1812
+ re(0, E(B)),
1813
+ re(1, y),
1814
+ re(2, X),
1815
+ re(3, E(w)),
1816
+ re(4, b)
1817
+ ], fe);
1818
+ var Fn = Object.defineProperty, jn = Object.getOwnPropertyDescriptor, zn = (s, e, t, n) => {
1819
+ for (var r = n > 1 ? void 0 : n ? jn(e, t) : e, i = s.length - 1, o; i >= 0; i--)
1820
+ (o = s[i]) && (r = (n ? o(e, t, r) : o(r)) || r);
1821
+ return n && r && Fn(e, t, r), r;
1822
+ }, ie = (s, e) => (t, n) => e(t, n, s);
1823
+ let pe = class extends W {
1824
+ constructor(e, t, n, r, i) {
2345
1825
  super();
2346
- S(this, "_onInputSubscription");
2347
- this._docSkeletonManagerService = e, this._currentUniverService = t, this._renderManagerService = n, this._textSelectionRenderManager = r, this._commandService = s, this._initialize(), this._commandExecutedListener();
1826
+ v(this, "_onInputSubscription");
1827
+ this._docSkeletonManagerService = e, this._currentUniverService = t, this._renderManagerService = n, this._textSelectionRenderManager = r, this._commandService = i, this._initialize(), this._commandExecutedListener();
2348
1828
  }
2349
1829
  dispose() {
2350
1830
  var e;
@@ -2355,112 +1835,110 @@ let De = class extends X {
2355
1835
  }
2356
1836
  _initialNormalInput() {
2357
1837
  this._onInputSubscription = this._textSelectionRenderManager.onInput$.subscribe(async (e) => {
2358
- var p;
1838
+ var f;
2359
1839
  if (e == null)
2360
1840
  return;
2361
- const n = this._currentUniverService.getCurrentUniverDocInstance().getUnitId(), { event: r, content: s = "", activeRange: o } = e, a = r, c = (p = this._docSkeletonManagerService.getCurrent()) == null ? void 0 : p.skeleton;
2362
- if (a.data == null || c == null || !c || !o)
1841
+ const n = this._currentUniverService.getCurrentUniverDocInstance().getUnitId(), { event: r, content: i = "", activeRange: o } = e, a = r, l = (f = this._docSkeletonManagerService.getCurrent()) == null ? void 0 : f.skeleton;
1842
+ if (a.data == null || l == null || !l || !o)
2363
1843
  return;
2364
- const { startOffset: d, segmentId: l, style: h } = o, g = s.length, u = [
1844
+ const { startOffset: d, segmentId: c, style: u } = o, h = i.length, g = [
2365
1845
  {
2366
- startOffset: d + g,
2367
- endOffset: d + g,
2368
- style: h
1846
+ startOffset: d + h,
1847
+ endOffset: d + h,
1848
+ style: u
2369
1849
  }
2370
1850
  ];
2371
- await this._commandService.executeCommand(et.id, {
1851
+ await this._commandService.executeCommand(be.id, {
2372
1852
  unitId: n,
2373
1853
  body: {
2374
- dataStream: s
1854
+ dataStream: i
2375
1855
  },
2376
1856
  range: o,
2377
- textRanges: u,
2378
- segmentId: l
1857
+ textRanges: g,
1858
+ segmentId: c
2379
1859
  });
2380
1860
  });
2381
1861
  }
2382
1862
  _commandExecutedListener() {
2383
1863
  }
2384
1864
  _getDocObject() {
2385
- return $e(this._currentUniverService, this._renderManagerService);
1865
+ return ke(this._currentUniverService, this._renderManagerService);
2386
1866
  }
2387
1867
  };
2388
- De = Dr([
2389
- F(j.Rendered, De),
2390
- le(0, w(L)),
2391
- le(1, y),
2392
- le(2, G),
2393
- le(3, Se),
2394
- le(4, O)
2395
- ], De);
2396
- var Pr = Object.defineProperty, Er = Object.getOwnPropertyDescriptor, Ur = (i, e, t, n) => {
2397
- for (var r = n > 1 ? void 0 : n ? Er(e, t) : e, s = i.length - 1, o; s >= 0; s--)
2398
- (o = i[s]) && (r = (n ? o(e, t, r) : o(r)) || r);
2399
- return n && r && Pr(e, t, r), r;
2400
- }, Rt = (i, e) => (t, n) => e(t, n, i);
2401
- const wr = "rgba(198, 198, 198, 1)", Nr = "rgba(255, 255, 255, 1)";
2402
- let Pe = class extends X {
2403
- constructor(i, e) {
2404
- super(), this._renderManagerService = i, this._currentUniverService = e, this._initialize(), this._commandExecutedListener();
1868
+ pe = zn([
1869
+ j(z.Rendered, pe),
1870
+ ie(0, E(B)),
1871
+ ie(1, y),
1872
+ ie(2, X),
1873
+ ie(3, ae),
1874
+ ie(4, b)
1875
+ ], pe);
1876
+ var Vn = Object.defineProperty, kn = Object.getOwnPropertyDescriptor, Hn = (s, e, t, n) => {
1877
+ for (var r = n > 1 ? void 0 : n ? kn(e, t) : e, i = s.length - 1, o; i >= 0; i--)
1878
+ (o = s[i]) && (r = (n ? o(e, t, r) : o(r)) || r);
1879
+ return n && r && Vn(e, t, r), r;
1880
+ }, ct = (s, e) => (t, n) => e(t, n, s);
1881
+ const Wn = "rgba(198, 198, 198, 1)", Xn = "rgba(255, 255, 255, 1)";
1882
+ let _e = class extends W {
1883
+ constructor(s, e) {
1884
+ super(), this._renderManagerService = s, this._currentUniverService = e, this._initialize(), this._commandExecutedListener();
2405
1885
  }
2406
1886
  _initialize() {
2407
1887
  this._initialRenderRefresh();
2408
1888
  }
2409
1889
  _initialRenderRefresh() {
2410
- this._renderManagerService.currentRender$.subscribe((i) => {
2411
- var s;
2412
- if (i == null || this._currentUniverService.getUniverDocInstance(i) == null)
1890
+ this._renderManagerService.currentRender$.subscribe((s) => {
1891
+ var i;
1892
+ if (s == null || this._currentUniverService.getUniverDocInstance(s) == null)
2413
1893
  return;
2414
- const e = this._renderManagerService.getRenderById(i);
1894
+ const e = this._renderManagerService.getRenderById(s);
2415
1895
  if (e == null)
2416
1896
  return;
2417
- const { mainComponent: t } = e, n = t, r = (s = n.getSkeleton()) == null ? void 0 : s.getPageSize();
1897
+ const { mainComponent: t } = e, n = t, r = (i = n.getSkeleton()) == null ? void 0 : i.getPageSize();
2418
1898
  n.onPageRenderObservable.add((o) => {
2419
- if ([K, J].includes(i))
1899
+ var m, p, _, S;
1900
+ if ([Y, q].includes(s))
2420
1901
  return;
2421
- const { page: a, pageLeft: c, pageTop: d, ctx: l } = o, { width: h, pageWidth: g, height: u, pageHeight: p } = a;
2422
- l.save(), l.translate(c - 0.5, d - 0.5), an.drawWith(l, {
2423
- width: (r == null ? void 0 : r.width) ?? g ?? h,
2424
- height: (r == null ? void 0 : r.height) ?? p ?? u,
1902
+ const { page: a, pageLeft: l, pageTop: d, ctx: c } = o, { width: u, pageWidth: h, height: g, pageHeight: f } = a;
1903
+ c.save(), c.translate(l - 0.5, d - 0.5), Bt.drawWith(c, {
1904
+ width: (p = (m = r == null ? void 0 : r.width) != null ? m : h) != null ? p : u,
1905
+ height: (S = (_ = r == null ? void 0 : r.height) != null ? _ : f) != null ? S : g,
2425
1906
  strokeWidth: 1,
2426
- stroke: wr,
2427
- fill: Nr,
1907
+ stroke: Wn,
1908
+ fill: Xn,
2428
1909
  zIndex: 3
2429
- }), l.restore();
1910
+ }), c.restore();
2430
1911
  });
2431
1912
  });
2432
1913
  }
2433
1914
  _commandExecutedListener() {
2434
1915
  }
2435
1916
  };
2436
- Pe = Ur([
2437
- F(j.Rendered, Pe),
2438
- Rt(0, G),
2439
- Rt(1, w(y))
2440
- ], Pe);
2441
- var Lr = Object.defineProperty, Ar = Object.getOwnPropertyDescriptor, $r = (i, e, t, n) => {
2442
- for (var r = n > 1 ? void 0 : n ? Ar(e, t) : e, s = i.length - 1, o; s >= 0; s--)
2443
- (o = i[s]) && (r = (n ? o(e, t, r) : o(r)) || r);
2444
- return n && r && Lr(e, t, r), r;
2445
- }, q = (i, e) => (t, n) => e(t, n, i);
2446
- let Ee = class extends X {
2447
- constructor(e, t, n, r, s, o, a) {
1917
+ _e = Hn([
1918
+ j(z.Rendered, _e),
1919
+ ct(0, X),
1920
+ ct(1, E(y))
1921
+ ], _e);
1922
+ var Gn = Object.defineProperty, Yn = Object.getOwnPropertyDescriptor, qn = (s, e, t, n) => {
1923
+ for (var r = n > 1 ? void 0 : n ? Yn(e, t) : e, i = s.length - 1, o; i >= 0; i--)
1924
+ (o = s[i]) && (r = (n ? o(e, t, r) : o(r)) || r);
1925
+ return n && r && Gn(e, t, r), r;
1926
+ }, Z = (s, e) => (t, n) => e(t, n, s);
1927
+ let Se = class extends W {
1928
+ constructor(e, t, n, r, i, o) {
2448
1929
  super();
2449
- S(this, "_moveInObserver");
2450
- S(this, "_moveOutObserver");
2451
- S(this, "_downObserver");
2452
- S(this, "_dblClickObserver");
2453
- S(this, "_tripleClickObserver");
2454
- S(this, "_loadedMap", /* @__PURE__ */ new Set());
2455
- this._docSkeletonManagerService = e, this._currentUniverService = t, this._commandService = n, this._renderManagerService = r, this._textSelectionRenderManager = s, this._textSelectionManagerService = o, this._layoutService = a, this._renderManagerService.currentRender$.subscribe((c) => {
2456
- c != null && this._currentUniverService.getUniverDocInstance(c) != null && (this._loadedMap.has(c) || (this._initialMain(c), this._loadedMap.add(c)));
1930
+ v(this, "_moveInObserver");
1931
+ v(this, "_moveOutObserver");
1932
+ v(this, "_downObserver");
1933
+ v(this, "_dblClickObserver");
1934
+ v(this, "_tripleClickObserver");
1935
+ v(this, "_loadedMap", /* @__PURE__ */ new Set());
1936
+ this._docSkeletonManagerService = e, this._currentUniverService = t, this._commandService = n, this._renderManagerService = r, this._textSelectionRenderManager = i, this._textSelectionManagerService = o, this._renderManagerService.currentRender$.subscribe((a) => {
1937
+ a != null && this._currentUniverService.getUniverDocInstance(a) != null && (this._loadedMap.has(a) || (this._initialMain(a), this._loadedMap.add(a)));
2457
1938
  }), this._initialize();
2458
1939
  }
2459
1940
  _initialize() {
2460
- this._skeletonListener(), this._commandExecutedListener(), this._layoutService && this.disposeWithMe(
2461
- // the content editable div should be regarded as part of the applications container
2462
- this._layoutService.registerContainer(this._textSelectionRenderManager.__getEditorContainer())
2463
- );
1941
+ this._skeletonListener(), this._commandExecutedListener();
2464
1942
  }
2465
1943
  dispose() {
2466
1944
  this._renderManagerService.getRenderAll().forEach((e) => {
@@ -2474,25 +1952,25 @@ let Ee = class extends X {
2474
1952
  return;
2475
1953
  const { document: n, scene: r } = t;
2476
1954
  this._moveInObserver = n.onPointerEnterObserver.add(() => {
2477
- n.cursor = ut.TEXT;
1955
+ n.cursor = tt.TEXT;
2478
1956
  }), this._moveOutObserver = n.onPointerLeaveObserver.add(() => {
2479
- n.cursor = ut.DEFAULT, r.resetCursor();
2480
- }), this._downObserver = n == null ? void 0 : n.onPointerDownObserver.add((s, o) => {
2481
- this._currentUniverService.getCurrentUniverDocInstance().getUnitId() !== e && this._currentUniverService.setCurrentUniverDocInstance(e), this._textSelectionRenderManager.eventTrigger(s), s.button !== 2 && o.stopPropagation();
2482
- }), this._dblClickObserver = n == null ? void 0 : n.onDblclickObserver.add((s) => {
2483
- this._textSelectionRenderManager.handleDblClick(s);
2484
- }), this._tripleClickObserver = n == null ? void 0 : n.onTripleClickObserver.add((s) => {
2485
- this._textSelectionRenderManager.handleTripleClick(s);
1957
+ n.cursor = tt.DEFAULT, r.resetCursor();
1958
+ }), this._downObserver = n == null ? void 0 : n.onPointerDownObserver.add((i, o) => {
1959
+ this._currentUniverService.getCurrentUniverDocInstance().getUnitId() !== e && this._currentUniverService.setCurrentUniverDocInstance(e), this._textSelectionRenderManager.eventTrigger(i), i.button !== 2 && o.stopPropagation();
1960
+ }), this._dblClickObserver = n == null ? void 0 : n.onDblclickObserver.add((i) => {
1961
+ this._textSelectionRenderManager.handleDblClick(i);
1962
+ }), this._tripleClickObserver = n == null ? void 0 : n.onTripleClickObserver.add((i) => {
1963
+ this._textSelectionRenderManager.handleTripleClick(i);
2486
1964
  });
2487
1965
  }
2488
1966
  _commandExecutedListener() {
2489
- const e = [Z.id];
1967
+ const e = [G.id];
2490
1968
  this.disposeWithMe(
2491
1969
  this._commandService.onCommandExecuted((t) => {
2492
1970
  var n;
2493
1971
  if (e.includes(t.id)) {
2494
- const r = t.params, { unitId: s } = r, o = (n = this._textSelectionManagerService.getCurrentSelection()) == null ? void 0 : n.unitId;
2495
- if (s !== o)
1972
+ const r = t.params, { unitId: i } = r, o = (n = this._textSelectionManagerService.getCurrentSelection()) == null ? void 0 : n.unitId;
1973
+ if (i !== o)
2496
1974
  return;
2497
1975
  this._textSelectionManagerService.refreshSelection();
2498
1976
  }
@@ -2506,37 +1984,36 @@ let Ee = class extends X {
2506
1984
  const { unitId: t, skeleton: n } = e, r = this._renderManagerService.getRenderById(t);
2507
1985
  if (r == null)
2508
1986
  return;
2509
- const { scene: s, mainComponent: o } = r;
2510
- this._textSelectionRenderManager.changeRuntime(n, s, o), this._textSelectionManagerService.setCurrentSelectionNotRefresh({
1987
+ const { scene: i, mainComponent: o } = r;
1988
+ this._textSelectionRenderManager.changeRuntime(n, i, o), this._textSelectionManagerService.setCurrentSelectionNotRefresh({
2511
1989
  unitId: t,
2512
1990
  subUnitId: ""
2513
1991
  });
2514
1992
  });
2515
1993
  }
2516
1994
  _getDocObjectById(e) {
2517
- return xn(e, this._renderManagerService);
1995
+ return Wt(e, this._renderManagerService);
2518
1996
  }
2519
1997
  };
2520
- Ee = $r([
2521
- F(j.Rendered, Ee),
2522
- q(0, w(L)),
2523
- q(1, y),
2524
- q(2, O),
2525
- q(3, G),
2526
- q(4, Se),
2527
- q(5, w(U)),
2528
- q(6, In(vn))
2529
- ], Ee);
2530
- var Br = Object.defineProperty, Vr = Object.getOwnPropertyDescriptor, Fr = (i, e, t, n) => {
2531
- for (var r = n > 1 ? void 0 : n ? Vr(e, t) : e, s = i.length - 1, o; s >= 0; s--)
2532
- (o = i[s]) && (r = (n ? o(e, t, r) : o(r)) || r);
2533
- return n && r && Br(e, t, r), r;
2534
- }, de = (i, e) => (t, n) => e(t, n, i);
2535
- let Ue = class extends X {
2536
- constructor(e, t, n, r, s) {
1998
+ Se = qn([
1999
+ j(z.Rendered, Se),
2000
+ Z(0, E(B)),
2001
+ Z(1, y),
2002
+ Z(2, b),
2003
+ Z(3, X),
2004
+ Z(4, ae),
2005
+ Z(5, E(w))
2006
+ ], Se);
2007
+ var Zn = Object.defineProperty, Kn = Object.getOwnPropertyDescriptor, Jn = (s, e, t, n) => {
2008
+ for (var r = n > 1 ? void 0 : n ? Kn(e, t) : e, i = s.length - 1, o; i >= 0; i--)
2009
+ (o = s[i]) && (r = (n ? o(e, t, r) : o(r)) || r);
2010
+ return n && r && Zn(e, t, r), r;
2011
+ }, se = (s, e) => (t, n) => e(t, n, s);
2012
+ let ve = class extends W {
2013
+ constructor(e, t, n, r, i) {
2537
2014
  super();
2538
- S(this, "_initializedRender", /* @__PURE__ */ new Set());
2539
- this._docSkeletonManagerService = e, this._currentUniverService = t, this._commandService = n, this._renderManagerService = r, this._textSelectionManagerService = s, this._initialize();
2015
+ v(this, "_initializedRender", /* @__PURE__ */ new Set());
2016
+ this._docSkeletonManagerService = e, this._currentUniverService = t, this._commandService = n, this._renderManagerService = r, this._textSelectionManagerService = i, this._initialize();
2540
2017
  }
2541
2018
  dispose() {
2542
2019
  super.dispose();
@@ -2549,24 +2026,24 @@ let Ue = class extends X {
2549
2026
  if (e == null)
2550
2027
  return;
2551
2028
  const { unitId: t } = e, n = this._renderManagerService.getRenderById(t);
2552
- if (n == null || this._initializedRender.has(t) || [K, J].includes(t))
2029
+ if (n == null || this._initializedRender.has(t) || [Y, q].includes(t))
2553
2030
  return;
2554
2031
  this._initializedRender.add(t);
2555
2032
  const { scene: r } = n;
2556
2033
  this.disposeWithMe(
2557
- qe(
2558
- r.onMouseWheelObserver.add((s) => {
2559
- if (!s.ctrlKey)
2034
+ Ke(
2035
+ r.onMouseWheelObserver.add((i) => {
2036
+ if (!i.ctrlKey)
2560
2037
  return;
2561
- const o = Math.abs(s.deltaX);
2038
+ const o = Math.abs(i.deltaX);
2562
2039
  let a = o < 40 ? 0.2 : o < 80 ? 0.4 : 0.2;
2563
- a *= s.deltaY > 0 ? -1 : 1, r.scaleX < 1 && (a /= 2);
2564
- const c = this._currentUniverService.getCurrentUniverDocInstance(), d = c.zoomRatio;
2565
- let l = +parseFloat(`${d + a}`).toFixed(1);
2566
- l = l >= 4 ? 4 : l <= 0.1 ? 0.1 : l, this._commandService.executeCommand(Vt.id, {
2567
- zoomRatio: l,
2568
- unitId: c.getUnitId()
2569
- }), s.preventDefault();
2040
+ a *= i.deltaY > 0 ? -1 : 1, r.scaleX < 1 && (a /= 2);
2041
+ const l = this._currentUniverService.getCurrentUniverDocInstance(), d = l.zoomRatio;
2042
+ let c = +Number.parseFloat(`${d + a}`).toFixed(1);
2043
+ c = c >= 4 ? 4 : c <= 0.1 ? 0.1 : c, this._commandService.executeCommand(Ct.id, {
2044
+ zoomRatio: c,
2045
+ unitId: l.getUnitId()
2046
+ }), i.preventDefault();
2570
2047
  })
2571
2048
  )
2572
2049
  );
@@ -2581,7 +2058,7 @@ let Ue = class extends X {
2581
2058
  // }
2582
2059
  _skeletonListener() {
2583
2060
  this.disposeWithMe(
2584
- qe(
2061
+ Ke(
2585
2062
  this._docSkeletonManagerService.currentSkeletonBefore$.subscribe((e) => {
2586
2063
  if (e == null)
2587
2064
  return;
@@ -2592,12 +2069,12 @@ let Ue = class extends X {
2592
2069
  );
2593
2070
  }
2594
2071
  _commandExecutedListener() {
2595
- const e = [Z.id];
2072
+ const e = [G.id];
2596
2073
  this.disposeWithMe(
2597
2074
  this._commandService.onCommandExecuted((t) => {
2598
2075
  if (e.includes(t.id)) {
2599
- const n = this._currentUniverService.getCurrentUniverDocInstance(), r = t.params, { unitId: s } = r;
2600
- if (s !== n.getUnitId())
2076
+ const n = this._currentUniverService.getCurrentUniverDocInstance(), r = t.params, { unitId: i } = r;
2077
+ if (i !== n.getUnitId())
2601
2078
  return;
2602
2079
  const o = n.zoomRatio || 1;
2603
2080
  this._updateViewZoom(o);
@@ -2611,123 +2088,50 @@ let Ue = class extends X {
2611
2088
  n != null && (n.scene.scale(e, e), this._calculatePagePosition(n, e), t && this._textSelectionManagerService.refreshSelection(), (r = n.scene.getTransformer()) == null || r.hideControl());
2612
2089
  }
2613
2090
  _calculatePagePosition(e, t) {
2614
- const { document: n, scene: r } = e, s = r == null ? void 0 : r.getParent(), { width: o, height: a, pageMarginLeft: c, pageMarginTop: d } = n;
2615
- if (s == null || o === 1 / 0 || a === 1 / 0)
2091
+ const { document: n, scene: r } = e, i = r == null ? void 0 : r.getParent(), { width: o, height: a, pageMarginLeft: l, pageMarginTop: d } = n;
2092
+ if (i == null || o === Number.POSITIVE_INFINITY || a === Number.POSITIVE_INFINITY)
2616
2093
  return;
2617
- const { width: l, height: h } = s;
2618
- let g = 0, u = 0, p = 0, f = 0, m = 1 / 0;
2619
- l > (o + c * 2) * t ? (g = l / 2 - o * t / 2, g /= t, p = (l - c * 2) / t, m = 0) : (g = c, p = o + c * 2, m = (p - l / t) / 2), h > a ? (u = h / 2 - a / 2, f = (h - d * 2) / t) : (u = d, f = a + d * 2), r.resize(p, f + 200), n.translate(g, u);
2620
- const v = r.getViewport(Qe.VIEW_MAIN);
2621
- if (m !== 1 / 0 && v != null) {
2622
- const M = v.getBarScroll(m, 0).x;
2623
- v.scrollTo({
2624
- x: M
2094
+ const { width: c, height: u } = i;
2095
+ let h = 0, g = 0, f = 0, m = 0, p = Number.POSITIVE_INFINITY;
2096
+ c > (o + l * 2) * t ? (h = c / 2 - o * t / 2, h /= t, f = (c - l * 2) / t, p = 0) : (h = l, f = o + l * 2, p = (f - c / t) / 2), u > a ? (g = u / 2 - a / 2, m = (u - d * 2) / t) : (g = d, m = a + d * 2), r.resize(f, m + 200), n.translate(h, g);
2097
+ const _ = r.getViewport(He.VIEW_MAIN);
2098
+ if (p !== Number.POSITIVE_INFINITY && _ != null) {
2099
+ const S = _.getBarScroll(p, 0).x;
2100
+ _.scrollTo({
2101
+ x: S
2625
2102
  });
2626
2103
  }
2627
2104
  return this;
2628
2105
  }
2629
2106
  _getDocObject() {
2630
- return $e(this._currentUniverService, this._renderManagerService);
2107
+ return ke(this._currentUniverService, this._renderManagerService);
2631
2108
  }
2632
2109
  };
2633
- Ue = Fr([
2634
- F(j.Rendered, Ue),
2635
- de(0, w(L)),
2636
- de(1, y),
2637
- de(2, O),
2638
- de(3, G),
2639
- de(4, w(U))
2640
- ], Ue);
2641
- const jr = {
2642
- id: Et.id,
2643
- preconditions: (i) => i.getContextValue(N),
2644
- binding: $.ENTER
2645
- }, kr = {
2646
- id: Ut.id,
2647
- preconditions: (i) => i.getContextValue(N),
2648
- binding: $.BACKSPACE
2649
- }, zr = {
2650
- id: wt.id,
2651
- preconditions: (i) => i.getContextValue(N),
2652
- binding: $.DELETE
2653
- }, Wr = {
2654
- id: ee.id,
2655
- binding: $.ARROW_UP,
2656
- preconditions: (i) => i.getContextValue(N),
2657
- staticParameters: {
2658
- direction: D.UP
2659
- }
2660
- }, Hr = {
2661
- id: ee.id,
2662
- binding: $.ARROW_DOWN,
2663
- preconditions: (i) => i.getContextValue(N),
2664
- staticParameters: {
2665
- direction: D.DOWN
2666
- }
2667
- }, Xr = {
2668
- id: ee.id,
2669
- binding: $.ARROW_LEFT,
2670
- preconditions: (i) => i.getContextValue(N),
2671
- staticParameters: {
2672
- direction: D.LEFT
2673
- }
2674
- }, Gr = {
2675
- id: ee.id,
2676
- binding: $.ARROW_RIGHT,
2677
- preconditions: (i) => i.getContextValue(N),
2678
- staticParameters: {
2679
- direction: D.RIGHT
2680
- }
2681
- }, Yr = {
2682
- id: te.id,
2683
- binding: $.ARROW_UP | Me.SHIFT,
2684
- preconditions: (i) => i.getContextValue(N),
2685
- staticParameters: {
2686
- direction: D.UP
2687
- }
2688
- }, qr = {
2689
- id: te.id,
2690
- binding: $.ARROW_DOWN | Me.SHIFT,
2691
- preconditions: (i) => i.getContextValue(N),
2692
- staticParameters: {
2693
- direction: D.DOWN
2694
- }
2695
- }, Zr = {
2696
- id: te.id,
2697
- binding: $.ARROW_LEFT | Me.SHIFT,
2698
- preconditions: (i) => i.getContextValue(N),
2699
- staticParameters: {
2700
- direction: D.LEFT
2701
- }
2702
- }, Kr = {
2703
- id: te.id,
2704
- binding: $.ARROW_RIGHT | Me.SHIFT,
2705
- preconditions: (i) => i.getContextValue(N),
2706
- staticParameters: {
2707
- direction: D.RIGHT
2708
- }
2709
- }, Jr = {
2710
- id: Ft.id,
2711
- binding: $.A | Me.CTRL_COMMAND,
2712
- preconditions: (i) => i.getContextValue(N) || i.getContextValue(_e)
2713
- };
2714
- var Qr = Object.defineProperty, ei = Object.getOwnPropertyDescriptor, ti = (i, e, t, n) => {
2715
- for (var r = n > 1 ? void 0 : n ? ei(e, t) : e, s = i.length - 1, o; s >= 0; s--)
2716
- (o = i[s]) && (r = (n ? o(e, t, r) : o(r)) || r);
2717
- return n && r && Qr(e, t, r), r;
2718
- }, Ce = (i, e) => (t, n) => e(t, n, i);
2719
- let we = class extends me {
2110
+ ve = Jn([
2111
+ j(z.Rendered, ve),
2112
+ se(0, E(B)),
2113
+ se(1, y),
2114
+ se(2, b),
2115
+ se(3, X),
2116
+ se(4, E(w))
2117
+ ], ve);
2118
+ var Qn = Object.defineProperty, er = Object.getOwnPropertyDescriptor, tr = (s, e, t, n) => {
2119
+ for (var r = n > 1 ? void 0 : n ? er(e, t) : e, i = s.length - 1, o; i >= 0; i--)
2120
+ (o = s[i]) && (r = (n ? o(e, t, r) : o(r)) || r);
2121
+ return n && r && Qn(e, t, r), r;
2122
+ }, le = (s, e) => (t, n) => e(t, n, s);
2123
+ let Me = class extends ee {
2720
2124
  constructor(e, t, n, r) {
2721
2125
  super();
2722
- S(this, "_scene");
2723
- S(this, "_currentDocumentModel");
2724
- S(this, "_loadedMap", /* @__PURE__ */ new Set());
2725
- S(this, "_fps$", new ue(""));
2726
- S(this, "fps$", this._fps$.asObservable());
2126
+ v(this, "_scene");
2127
+ v(this, "_currentDocumentModel");
2128
+ v(this, "_loadedMap", /* @__PURE__ */ new Set());
2129
+ v(this, "_fps$", new K(""));
2130
+ v(this, "fps$", this._fps$.asObservable());
2727
2131
  this._renderManagerService = e, this._configService = t, this._currentUniverService = n, this._docViewModelManagerService = r, this._initialize();
2728
2132
  }
2729
2133
  _initialize() {
2730
- this._currentUniverService.currentDoc$.pipe(ve(this.dispose$)).subscribe((e) => {
2134
+ this._currentUniverService.currentDoc$.pipe(ce(this.dispose$)).subscribe((e) => {
2731
2135
  if (e == null)
2732
2136
  return;
2733
2137
  this._currentDocumentModel = e;
@@ -2743,114 +2147,99 @@ let we = class extends me {
2743
2147
  if (n != null && r != null)
2744
2148
  throw new Error("container or parentRenderUnitId can only exist one");
2745
2149
  n == null && r != null ? this._renderManagerService.createRenderWithParent(t, r) : this._renderManagerService.createRender(t);
2746
- const s = this._renderManagerService.getRenderById(t);
2747
- if (s == null)
2150
+ const i = this._renderManagerService.getRenderById(t);
2151
+ if (i == null)
2748
2152
  return;
2749
- const { scene: o, engine: a } = s;
2153
+ const { scene: o, engine: a } = i;
2750
2154
  o.openTransformer(), this._scene = o;
2751
- const c = new cn(Qe.VIEW_MAIN, o, {
2155
+ const l = new Ft(He.VIEW_MAIN, o, {
2752
2156
  left: 0,
2753
2157
  top: 0,
2754
2158
  bottom: 0,
2755
2159
  right: 0,
2756
2160
  isWheelPreventDefaultX: !0
2757
2161
  });
2758
- o.attachControl(), o.on(ln.wheel, (h, g) => {
2759
- const u = h;
2760
- if (u.ctrlKey) {
2761
- const p = Math.abs(u.deltaX);
2762
- let f = p < 40 ? 0.2 : p < 80 ? 0.4 : 0.2;
2763
- f *= u.deltaY > 0 ? -1 : 1, o.scaleX < 1 && (f /= 2), o.scaleX + f > 4 ? o.scale(4, 4) : o.scaleX + f < 0.1 ? o.scale(0.1, 0.1) : u.preventDefault();
2162
+ o.attachControl(), o.on(jt.wheel, (u, h) => {
2163
+ const g = u;
2164
+ if (g.ctrlKey) {
2165
+ const f = Math.abs(g.deltaX);
2166
+ let m = f < 40 ? 0.2 : f < 80 ? 0.4 : 0.2;
2167
+ m *= g.deltaY > 0 ? -1 : 1, o.scaleX < 1 && (m /= 2), o.scaleX + m > 4 ? o.scale(4, 4) : o.scaleX + m < 0.1 ? o.scale(0.1, 0.1) : g.preventDefault();
2764
2168
  } else
2765
- c.onMouseWheel(u, g);
2766
- }), this._configService.getConfig("hasScroll") !== !1 && t !== J && new dn(c), o.addLayer(
2767
- new ht(o, [], gt),
2768
- new ht(o, [], On)
2769
- ), this._addComponent(s), this._currentDocumentModel.getShouldRenderLoopImmediately() && a.runRenderLoop(() => {
2169
+ l.onMouseWheel(g, h);
2170
+ }), this._configService.getConfig("hasScroll") !== !1 && t !== q && new zt(l), o.addLayer(
2171
+ new nt(o, [], rt),
2172
+ new nt(o, [], Xt)
2173
+ ), this._addComponent(i), this._currentDocumentModel.getShouldRenderLoopImmediately() && a.runRenderLoop(() => {
2770
2174
  o.render(), this._fps$.next(Math.round(a.getFps()).toString());
2771
2175
  }), this._renderManagerService.setCurrent(t);
2772
2176
  }
2773
2177
  _addComponent(e) {
2774
- const t = this._scene, n = this._currentDocumentModel, r = new un(Ze.MAIN, void 0, {
2178
+ const t = this._scene, n = this._currentDocumentModel, r = new Vt(je.MAIN, void 0, {
2775
2179
  pageMarginLeft: n.documentStyle.marginLeft || 0,
2776
2180
  pageMarginTop: n.documentStyle.marginTop || 0
2777
2181
  });
2778
- r.zIndex = yn, e.mainComponent = r, e.components.set(Ze.MAIN, r), t.addObjects([r], gt);
2182
+ r.zIndex = Gt, e.mainComponent = r, e.components.set(je.MAIN, r), t.addObjects([r], rt);
2779
2183
  }
2780
2184
  };
2781
- we = ti([
2782
- F(j.Ready, we),
2783
- Ce(0, G),
2784
- Ce(1, Tt),
2785
- Ce(2, y),
2786
- Ce(3, w(se))
2787
- ], we);
2788
- var ni = Object.defineProperty, ri = Object.getOwnPropertyDescriptor, ii = (i, e, t, n) => {
2789
- for (var r = n > 1 ? void 0 : n ? ri(e, t) : e, s = i.length - 1, o; s >= 0; s--)
2790
- (o = i[s]) && (r = (n ? o(e, t, r) : o(r)) || r);
2791
- return n && r && ni(e, t, r), r;
2792
- }, Ie = (i, e) => (t, n) => e(t, n, i);
2793
- const si = {
2185
+ Me = tr([
2186
+ j(z.Ready, Me),
2187
+ le(0, X),
2188
+ le(1, gt),
2189
+ le(2, y),
2190
+ le(3, E(J))
2191
+ ], Me);
2192
+ var nr = Object.defineProperty, rr = Object.getOwnPropertyDescriptor, ir = (s, e, t, n) => {
2193
+ for (var r = n > 1 ? void 0 : n ? rr(e, t) : e, i = s.length - 1, o; i >= 0; i--)
2194
+ (o = s[i]) && (r = (n ? o(e, t, r) : o(r)) || r);
2195
+ return n && r && nr(e, t, r), r;
2196
+ }, de = (s, e) => (t, n) => e(t, n, s);
2197
+ const sr = {
2794
2198
  hasScroll: !0
2795
- }, oi = "docs";
2796
- var Ge;
2797
- let xt = (Ge = class extends Zt {
2798
- constructor(e = {}, t, n, r, s) {
2799
- super(oi);
2800
- S(this, "_config");
2801
- this._injector = t, this._localeService = n, this._configService = r, this._currentUniverService = s, this._config = Object.assign(si, e), this._initializeDependencies(t), this._initializeCommands();
2199
+ }, or = "docs";
2200
+ var Be;
2201
+ let lt = (Be = class extends Tt {
2202
+ constructor(e = {}, t, n, r, i) {
2203
+ super(or);
2204
+ v(this, "_config");
2205
+ this._injector = t, this._localeService = n, this._configService = r, this._currentUniverService = i, this._config = Object.assign(sr, e), this._initializeDependencies(t), this._initializeCommands();
2802
2206
  }
2803
2207
  initialize() {
2804
2208
  }
2805
2209
  _initializeCommands() {
2806
2210
  [
2807
- ee,
2808
- te,
2809
- Ut,
2810
- wt,
2811
- he,
2211
+ ze,
2812
2212
  Ve,
2813
- Fe,
2814
- je,
2213
+ hn,
2214
+ gn,
2215
+ Te,
2216
+ De,
2217
+ Pe,
2218
+ Ee,
2815
2219
  Q,
2816
- oe,
2817
- ge,
2818
- pe,
2819
- ke,
2820
- $t,
2821
- Et,
2822
- et,
2823
- tt,
2824
- Pt,
2825
- Lt,
2826
- nt,
2827
- _,
2828
- Hn,
2829
- Xn,
2830
- Vt,
2831
- Z,
2832
- Dt,
2833
- Ft,
2834
- zn,
2835
- kn,
2836
- it
2220
+ we,
2221
+ Ue,
2222
+ Ne,
2223
+ Ae,
2224
+ Mt,
2225
+ an,
2226
+ be,
2227
+ ye,
2228
+ ft,
2229
+ St,
2230
+ Xe,
2231
+ L,
2232
+ Mn,
2233
+ In,
2234
+ Ct,
2235
+ G,
2236
+ mt,
2237
+ Rn,
2238
+ Sn,
2239
+ _n,
2240
+ Ge
2837
2241
  ].forEach((e) => {
2838
- this._injector.get(O).registerCommand(e);
2839
- }), [
2840
- Wr,
2841
- Hr,
2842
- Gr,
2843
- Xr,
2844
- Yr,
2845
- qr,
2846
- Zr,
2847
- Kr,
2848
- Jr,
2849
- kr,
2850
- zr,
2851
- jr
2852
- ].forEach((e) => {
2853
- this._injector.get(Mn).registerShortcut(e);
2242
+ this._injector.get(b).registerCommand(e);
2854
2243
  });
2855
2244
  }
2856
2245
  onReady() {
@@ -2863,83 +2252,80 @@ let xt = (Ge = class extends Zt {
2863
2252
  // { useFactory: () => docInjector.createInstance(CanvasView, this._config.standalone ?? true) },
2864
2253
  // ], // FIXME: CanvasView shouldn't be a dependency of UniverDocs. Because it maybe created dynamically.
2865
2254
  //views
2866
- [we],
2255
+ [Me],
2867
2256
  // services
2868
- [L],
2869
- [se],
2870
- [rt],
2871
- [
2872
- jt,
2873
- {
2874
- useClass: Je
2875
- }
2876
- ],
2257
+ [B],
2258
+ [J],
2259
+ [Ce],
2260
+ [xe],
2877
2261
  [
2878
- Se,
2262
+ ae,
2879
2263
  {
2880
- useClass: hn
2264
+ useClass: kt
2881
2265
  }
2882
2266
  ],
2883
- [U],
2267
+ [w],
2884
2268
  // controllers
2885
- [xe],
2886
- [Pe],
2887
- [Ee],
2888
- [De],
2889
- [ye],
2890
- [be],
2891
- [Re],
2892
- [Te],
2893
- [Ue],
2894
- [Oe]
2269
+ [ue],
2270
+ [_e],
2271
+ [Se],
2272
+ [pe],
2273
+ [ge],
2274
+ [me],
2275
+ [fe],
2276
+ [ve],
2277
+ [he]
2895
2278
  ].forEach((t) => e.add(t));
2896
2279
  }
2897
- }, S(Ge, "type", Kt.Doc), Ge);
2898
- xt = ii([
2899
- Ie(1, w(Rn)),
2900
- Ie(2, w(Ot)),
2901
- Ie(3, Tt),
2902
- Ie(4, y)
2903
- ], xt);
2280
+ }, v(Be, "type", Dt.Doc), Be);
2281
+ lt = ir([
2282
+ de(1, E(Ht)),
2283
+ de(2, E(dt)),
2284
+ de(3, gt),
2285
+ de(4, y)
2286
+ ], lt);
2904
2287
  export {
2905
- Et as BreakLineCommand,
2906
- kn as BulletListCommand,
2907
- Xn as CoverContentCommand,
2908
- yn as DOCS_COMPONENT_DEFAULT_Z_INDEX,
2909
- On as DOCS_COMPONENT_HEADER_LAYER_INDEX,
2910
- gt as DOCS_COMPONENT_MAIN_LAYER_INDEX,
2911
- Ze as DOCS_VIEW_KEY,
2912
- tt as DeleteCommand,
2913
- Ut as DeleteLeftCommand,
2914
- wt as DeleteRightCommand,
2915
- we as DocCanvasView,
2916
- ze as DocCopyCommand,
2917
- We as DocCutCommand,
2918
- He as DocPasteCommand,
2919
- L as DocSkeletonManagerService,
2920
- se as DocViewModelManagerService,
2921
- Lt as IMEInputCommand,
2922
- et as InsertCommand,
2923
- ee as MoveCursorOperation,
2924
- te as MoveSelectionOperation,
2925
- gi as NORMAL_TEXT_SELECTION_PLUGIN_NAME,
2926
- zn as OrderListCommand,
2927
- Hn as ReplaceContentCommand,
2928
- _ as RichTextEditingMutation,
2929
- he as SetInlineFormatBoldCommand,
2930
- $t as SetInlineFormatCommand,
2931
- pe as SetInlineFormatFontFamilyCommand,
2932
- ge as SetInlineFormatFontSizeCommand,
2933
- Ve as SetInlineFormatItalicCommand,
2934
- je as SetInlineFormatStrikethroughCommand,
2288
+ an as BreakLineCommand,
2289
+ _n as BulletListCommand,
2290
+ In as CoverContentCommand,
2291
+ pt as CutContentCommand,
2292
+ Gt as DOCS_COMPONENT_DEFAULT_Z_INDEX,
2293
+ Xt as DOCS_COMPONENT_HEADER_LAYER_INDEX,
2294
+ rt as DOCS_COMPONENT_MAIN_LAYER_INDEX,
2295
+ je as DOCS_VIEW_KEY,
2296
+ ye as DeleteCommand,
2297
+ hn as DeleteLeftCommand,
2298
+ gn as DeleteRightCommand,
2299
+ Me as DocCanvasView,
2300
+ B as DocSkeletonManagerService,
2301
+ Ce as DocStateChangeManagerService,
2302
+ J as DocViewModelManagerService,
2303
+ St as IMEInputCommand,
2304
+ xe as IMEInputManagerService,
2305
+ gr as InnerPasteCommand,
2306
+ be as InsertCommand,
2307
+ ze as MoveCursorOperation,
2308
+ Ve as MoveSelectionOperation,
2309
+ hr as NORMAL_TEXT_SELECTION_PLUGIN_NAME,
2310
+ Sn as OrderListCommand,
2311
+ Mn as ReplaceContentCommand,
2312
+ L as RichTextEditingMutation,
2313
+ Rn as SelectAllOperation,
2314
+ Te as SetInlineFormatBoldCommand,
2315
+ Mt as SetInlineFormatCommand,
2316
+ Ne as SetInlineFormatFontFamilyCommand,
2317
+ Ue as SetInlineFormatFontSizeCommand,
2318
+ De as SetInlineFormatItalicCommand,
2319
+ Ee as SetInlineFormatStrikethroughCommand,
2935
2320
  Q as SetInlineFormatSubscriptCommand,
2936
- oe as SetInlineFormatSuperscriptCommand,
2937
- ke as SetInlineFormatTextColorCommand,
2938
- Fe as SetInlineFormatUnderlineCommand,
2939
- Dt as SetTextSelectionsOperation,
2940
- U as TextSelectionManagerService,
2941
- xt as UniverDocsPlugin,
2942
- Pt as UpdateCommand,
2943
- Qe as VIEWPORT_KEY,
2944
- $e as getDocObject
2321
+ we as SetInlineFormatSuperscriptCommand,
2322
+ Ae as SetInlineFormatTextColorCommand,
2323
+ Pe as SetInlineFormatUnderlineCommand,
2324
+ mt as SetTextSelectionsOperation,
2325
+ w as TextSelectionManagerService,
2326
+ lt as UniverDocsPlugin,
2327
+ ft as UpdateCommand,
2328
+ He as VIEWPORT_KEY,
2329
+ ke as getDocObject,
2330
+ Ie as serializeTextRange
2945
2331
  };