@univerjs/docs 0.1.6 → 0.1.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/es/index.js CHANGED
@@ -1,58 +1,61 @@
1
- var dt = Object.defineProperty;
2
- var ut = (o, e, t) => e in o ? dt(o, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : o[e] = t;
3
- var O = (o, e, t) => (ut(o, typeof e != "symbol" ? e + "" : e, t), t);
4
- import { CommandType as v, RxDisposable as ce, ICommandService as I, TextXActionType as y, DOCS_NORMAL_EDITOR_UNIT_ID_KEY as qe, IUniverInstanceService as D, IUndoRedoService as ve, UndoCommandId as we, RedoCommandId as Le, TextX as b, DataStreamTreeTokenType as pe, Tools as W, LocaleService as mt, MemoryCursor as Q, getDocsUpdateBody as gt, UpdateDocsAttributeType as Ie, DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY as ft, BooleanNumber as z, BaselineOffset as V, PresetListType as Ke, HorizontalAlign as ee, OnLifecycle as Me, LifecycleStages as Ce, Disposable as Re, Direction as U, Plugin as ht, PluginType as pt } from "@univerjs/core";
5
- import { NORMAL_TEXT_SELECTION_PLUGIN_STYLE as St, ITextSelectionRenderManager as le, DocumentViewModel as _t, DocumentSkeleton as vt, hasListGlyph as It, isIndentByGlyph as Mt, isFirstGlyph as Ct, getParagraphByGlyph as Rt, RANGE_DIRECTION as Be, NodePositionConvertToCursor as Fe, IRenderManagerService as Qe, TextSelectionRenderManager as xt } from "@univerjs/engine-render";
6
- import { BehaviorSubject as Z, takeUntil as J } from "rxjs";
7
- import { Inject as B, Injector as yt } from "@wendellhu/redi";
8
- function et(o, e) {
9
- const n = o.getCurrentUniverDocInstance().getUnitId(), s = e.getRenderById(n);
10
- if (s == null)
1
+ var yt = Object.defineProperty;
2
+ var Ot = (s, e, t) => e in s ? yt(s, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : s[e] = t;
3
+ var x = (s, e, t) => (Ot(s, typeof e != "symbol" ? e + "" : e, t), t);
4
+ import { UniverInstanceType as W, CommandType as v, RxDisposable as ge, ICommandService as I, TextXActionType as y, DOCS_NORMAL_EDITOR_UNIT_ID_KEY as dt, IUniverInstanceService as E, IUndoRedoService as Te, UndoCommandId as Xe, RedoCommandId as Ye, TextX as P, DataStreamTreeTokenType as xe, Tools as Q, LocaleService as Tt, MemoryCursor as oe, getDocsUpdateBody as Et, UpdateDocsAttributeType as Ee, DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY as Dt, BooleanNumber as k, BaselineOffset as j, PRESET_LIST_TYPE as At, PresetListType as ut, HorizontalAlign as re, OnLifecycle as De, LifecycleStages as Ae, Disposable as Ne, Direction as N, Plugin as Nt } from "@univerjs/core";
5
+ import { NORMAL_TEXT_SELECTION_PLUGIN_STYLE as bt, ITextSelectionRenderManager as fe, DocumentViewModel as Pt, DocumentSkeleton as Ut, hasListGlyph as wt, isIndentByGlyph as Lt, isFirstGlyph as Bt, getParagraphByGlyph as Ft, getCharSpaceApply as $t, getNumberUnitValue as Me, RANGE_DIRECTION as We, NodePositionConvertToCursor as Ze, IRenderManagerService as mt, TextSelectionRenderManager as Vt } from "@univerjs/engine-render";
6
+ import { BehaviorSubject as ee, takeUntil as te } from "rxjs";
7
+ import { Inject as V, Injector as zt } from "@wendellhu/redi";
8
+ function gt(s, e) {
9
+ const t = s.getCurrentUnitForType(W.UNIVER_DOC);
10
+ if (!t)
11
+ return null;
12
+ const n = t.getUnitId(), o = e.getRenderById(n);
13
+ if (o == null)
11
14
  return;
12
- const { mainComponent: r, scene: i, engine: a } = s;
15
+ const { mainComponent: r, scene: i, engine: a } = o;
13
16
  return {
14
17
  document: r,
15
18
  scene: i,
16
19
  engine: a
17
20
  };
18
21
  }
19
- function En(o, e) {
20
- const t = e.getRenderById(o);
22
+ function Gn(s, e) {
23
+ const t = e.getRenderById(s);
21
24
  if (t == null)
22
25
  return;
23
- const { mainComponent: n, scene: s, engine: r } = t;
26
+ const { mainComponent: n, scene: o, engine: r } = t;
24
27
  return {
25
28
  document: n,
26
- scene: s,
29
+ scene: o,
27
30
  engine: r
28
31
  };
29
32
  }
30
- var Ot = /* @__PURE__ */ ((o) => (o.MAIN = "__Document_Render_Main__", o))(Ot || {}), Tt = /* @__PURE__ */ ((o) => (o.VIEW_MAIN = "viewMain", o.VIEW_TOP = "viewTop", o.VIEW_LEFT = "viewLeft", o.VIEW_LEFT_TOP = "viewLeftTop", o))(Tt || {});
31
- const Dn = 0, An = 2, Pn = 10, Nn = "normalTextSelectionPluginName", tt = {
33
+ var kt = /* @__PURE__ */ ((s) => (s.MAIN = "__Document_Render_Main__", s))(kt || {}), jt = /* @__PURE__ */ ((s) => (s.VIEW_MAIN = "viewMain", s.VIEW_TOP = "viewTop", s.VIEW_LEFT = "viewLeft", s.VIEW_LEFT_TOP = "viewLeftTop", s))(jt || {});
34
+ const Hn = 0, Xn = 2, Yn = 10, Wn = "normalTextSelectionPluginName", ft = {
32
35
  id: "doc.operation.set-selections",
33
36
  type: v.OPERATION,
34
- handler: (o, e) => !0
37
+ handler: (s, e) => !0
35
38
  };
36
- var Et = Object.defineProperty, Dt = Object.getOwnPropertyDescriptor, At = (o, e, t, n) => {
37
- for (var s = n > 1 ? void 0 : n ? Dt(e, t) : e, r = o.length - 1, i; r >= 0; r--)
38
- (i = o[r]) && (s = (n ? i(e, t, s) : i(s)) || s);
39
- return n && s && Et(e, t, s), s;
40
- }, $e = (o, e) => (t, n) => e(t, n, o);
41
- function G(o) {
42
- const { startOffset: e, endOffset: t, collapsed: n } = o, s = {
39
+ var Gt = Object.defineProperty, Ht = Object.getOwnPropertyDescriptor, Xt = (s, e, t, n) => {
40
+ for (var o = n > 1 ? void 0 : n ? Ht(e, t) : e, r = s.length - 1, i; r >= 0; r--)
41
+ (i = s[r]) && (o = (n ? i(e, t, o) : i(o)) || o);
42
+ return n && o && Gt(e, t, o), o;
43
+ }, Je = (s, e) => (t, n) => e(t, n, s);
44
+ function Z(s) {
45
+ const { startOffset: e, endOffset: t, collapsed: n } = s, o = {
43
46
  startOffset: e,
44
47
  endOffset: t,
45
48
  collapsed: n
46
49
  };
47
- return typeof o.isActive == "function" && (s.isActive = o.isActive()), s;
50
+ return typeof s.isActive == "function" && (o.isActive = s.isActive()), o;
48
51
  }
49
- let T = class extends ce {
52
+ let T = class extends ge {
50
53
  constructor(e, t) {
51
54
  super();
52
- O(this, "_currentSelection", null);
53
- O(this, "_textSelectionInfo", /* @__PURE__ */ new Map());
54
- O(this, "_textSelection$", new Z(null));
55
- O(this, "textSelection$", this._textSelection$.asObservable());
55
+ x(this, "_currentSelection", null);
56
+ x(this, "_textSelectionInfo", /* @__PURE__ */ new Map());
57
+ x(this, "_textSelection$", new ee(null));
58
+ x(this, "textSelection$", this._textSelection$.asObservable());
56
59
  this._textSelectionRenderManager = e, this._commandService = t, this._syncSelectionFromRenderService();
57
60
  }
58
61
  getCurrentSelection() {
@@ -83,7 +86,7 @@ let T = class extends ce {
83
86
  const e = this._getTextRanges(this._currentSelection);
84
87
  if (e == null)
85
88
  return;
86
- const { textRanges: t, segmentId: n, style: s } = e, r = t.find((m) => m.isActive());
89
+ const { textRanges: t, segmentId: n, style: o } = e, r = t.find((m) => m.isActive());
87
90
  if (r == null)
88
91
  return null;
89
92
  const { startOffset: i, endOffset: a, collapsed: c, startNodePosition: d, endNodePosition: l, direction: u } = r;
@@ -95,7 +98,7 @@ let T = class extends ce {
95
98
  endNodePosition: l,
96
99
  direction: u,
97
100
  segmentId: n,
98
- style: s
101
+ style: o
99
102
  };
100
103
  }
101
104
  // **Only used in test case** because this does not go through the render layer.
@@ -105,7 +108,7 @@ let T = class extends ce {
105
108
  textRanges: e,
106
109
  segmentId: "",
107
110
  isEditing: t,
108
- style: St
111
+ style: bt
109
112
  // mock style.
110
113
  });
111
114
  }
@@ -114,7 +117,7 @@ let T = class extends ce {
114
117
  }
115
118
  // All textRanges should be synchronized from the render layer.
116
119
  _syncSelectionFromRenderService() {
117
- this._textSelectionRenderManager.textSelectionInner$.pipe(J(this.dispose$)).subscribe((e) => {
120
+ this._textSelectionRenderManager.textSelectionInner$.pipe(te(this.dispose$)).subscribe((e) => {
118
121
  e != null && this._replaceTextRangesWithNoRefresh(e);
119
122
  });
120
123
  }
@@ -126,44 +129,44 @@ let T = class extends ce {
126
129
  ...e
127
130
  };
128
131
  this._replaceByParam(t), this._textSelection$.next(t);
129
- const { unitId: n, subUnitId: s, segmentId: r, style: i, textRanges: a, isEditing: c } = t;
130
- this._commandService.executeCommand(tt.id, {
132
+ const { unitId: n, subUnitId: o, segmentId: r, style: i, textRanges: a, isEditing: c } = t;
133
+ this._commandService.executeCommand(ft.id, {
131
134
  unitId: n,
132
- subUnitId: s,
135
+ subUnitId: o,
133
136
  segmentId: r,
134
137
  style: i,
135
138
  isEditing: c,
136
- ranges: a.map(G)
139
+ ranges: a.map(Z)
137
140
  });
138
141
  }
139
142
  _getTextRanges(e) {
140
- var s;
143
+ var o;
141
144
  if (e == null)
142
145
  return;
143
146
  const { unitId: t, subUnitId: n = "" } = e;
144
- return (s = this._textSelectionInfo.get(t)) == null ? void 0 : s.get(n);
147
+ return (o = this._textSelectionInfo.get(t)) == null ? void 0 : o.get(n);
145
148
  }
146
149
  _refresh(e) {
147
150
  const t = this._getTextRanges(e);
148
- this._textSelectionRenderManager.removeAllTextRanges(), t && Array.isArray(t.textRanges) && t.textRanges.length && this._textSelectionRenderManager.addTextRanges(t.textRanges.map(G));
151
+ this._textSelectionRenderManager.removeAllTextRanges(), t && Array.isArray(t.textRanges) && t.textRanges.length && this._textSelectionRenderManager.addTextRanges(t.textRanges.map(Z));
149
152
  }
150
153
  _replaceByParam(e) {
151
- const { unitId: t, subUnitId: n, style: s, segmentId: r, textRanges: i, isEditing: a } = e;
152
- this._textSelectionInfo.has(t) || this._textSelectionInfo.set(t, /* @__PURE__ */ new Map()), this._textSelectionInfo.get(t).set(n, { textRanges: i, style: s, segmentId: r, isEditing: a });
154
+ const { unitId: t, subUnitId: n, style: o, segmentId: r, textRanges: i, isEditing: a } = e;
155
+ this._textSelectionInfo.has(t) || this._textSelectionInfo.set(t, /* @__PURE__ */ new Map()), this._textSelectionInfo.get(t).set(n, { textRanges: i, style: o, segmentId: r, isEditing: a });
153
156
  }
154
157
  _addByParam(e) {
155
- const { unitId: t, subUnitId: n, textRanges: s, style: r, segmentId: i, isEditing: a } = e;
158
+ const { unitId: t, subUnitId: n, textRanges: o, style: r, segmentId: i, isEditing: a } = e;
156
159
  this._textSelectionInfo.has(t) || this._textSelectionInfo.set(t, /* @__PURE__ */ new Map());
157
160
  const c = this._textSelectionInfo.get(t);
158
- c.has(n) ? c.get(n).textRanges.push(...s) : c.set(n, { textRanges: s, style: r, segmentId: i, isEditing: a });
161
+ c.has(n) ? c.get(n).textRanges.push(...o) : c.set(n, { textRanges: o, style: r, segmentId: i, isEditing: a });
159
162
  }
160
163
  };
161
- T = At([
162
- $e(0, le),
163
- $e(1, I)
164
+ T = Xt([
165
+ Je(0, fe),
166
+ Je(1, I)
164
167
  ], T);
165
- function xe(o, e = "", t = 0) {
166
- const { startOffset: n, endOffset: s } = o, r = [], i = n - t, a = s - t;
168
+ function be(s, e = "", t = 0) {
169
+ const { startOffset: n, endOffset: o } = s, r = [], i = n - t, a = o - t;
167
170
  return i > 0 && r.push({
168
171
  t: y.RETAIN,
169
172
  len: i,
@@ -175,18 +178,18 @@ function xe(o, e = "", t = 0) {
175
178
  segmentId: e
176
179
  }), r;
177
180
  }
178
- var Pt = Object.defineProperty, Nt = Object.getOwnPropertyDescriptor, Ut = (o, e, t, n) => {
179
- for (var s = n > 1 ? void 0 : n ? Nt(e, t) : e, r = o.length - 1, i; r >= 0; r--)
180
- (i = o[r]) && (s = (n ? i(e, t, s) : i(s)) || s);
181
- return n && s && Pt(e, t, s), s;
182
- }, bt = (o, e) => (t, n) => e(t, n, o);
183
- let q = class extends ce {
181
+ var Yt = Object.defineProperty, Wt = Object.getOwnPropertyDescriptor, Zt = (s, e, t, n) => {
182
+ for (var o = n > 1 ? void 0 : n ? Wt(e, t) : e, r = s.length - 1, i; r >= 0; r--)
183
+ (i = s[r]) && (o = (n ? i(e, t, o) : i(o)) || o);
184
+ return n && o && Yt(e, t, o), o;
185
+ }, Jt = (s, e) => (t, n) => e(t, n, s);
186
+ let ne = class extends ge {
184
187
  constructor(e) {
185
188
  super();
186
- O(this, "_docViewModelMap", /* @__PURE__ */ new Map());
187
- O(this, "_currentDocViewModel$", new Z(null));
188
- O(this, "currentDocViewModel$", this._currentDocViewModel$.asObservable());
189
- this._currentUniverService = e, this._initialize();
189
+ x(this, "_docViewModelMap", /* @__PURE__ */ new Map());
190
+ x(this, "_currentDocViewModel$", new ee(null));
191
+ x(this, "currentDocViewModel$", this._currentDocViewModel$.asObservable());
192
+ this._univerInstanceService = e, this._initialize();
190
193
  }
191
194
  _initialize() {
192
195
  this._init();
@@ -195,11 +198,11 @@ let q = class extends ce {
195
198
  this._currentDocViewModel$.complete(), this._docViewModelMap.clear();
196
199
  }
197
200
  _init() {
198
- this._currentUniverService.currentDoc$.pipe(J(this.dispose$)).subscribe((e) => {
201
+ this._univerInstanceService.getCurrentTypeOfUnit$(W.UNIVER_DOC).pipe(te(this.dispose$)).subscribe((e) => {
199
202
  this._create(e);
200
- }), this._currentUniverService.getAllUniverDocsInstance().forEach((e) => {
203
+ }), this._univerInstanceService.getAllUnitsForType(W.UNIVER_DOC).forEach((e) => {
201
204
  this._create(e);
202
- }), this._currentUniverService.docDisposed$.pipe(J(this.dispose$)).subscribe((e) => {
205
+ }), this._univerInstanceService.getTypeOfUnitDisposed$(W.UNIVER_DOC).pipe(te(this.dispose$)).subscribe((e) => {
203
206
  this._docViewModelMap.delete(e.getUnitId());
204
207
  });
205
208
  }
@@ -218,46 +221,46 @@ let q = class extends ce {
218
221
  }
219
222
  _setCurrent(e) {
220
223
  var n;
221
- const t = this._currentUniverService.getUniverDocInstance(e);
224
+ const t = this._univerInstanceService.getUniverDocInstance(e);
222
225
  if (t == null)
223
226
  throw new Error(`Document data model with id ${e} not found when build view model.`);
224
227
  if (t.getBody() != null) {
225
228
  if (!this._docViewModelMap.has(e)) {
226
- const s = this._buildDocViewModel(t);
229
+ const o = this._buildDocViewModel(t);
227
230
  this._docViewModelMap.set(e, {
228
231
  unitId: e,
229
- docViewModel: s
232
+ docViewModel: o
230
233
  });
231
234
  }
232
- if (e === qe) {
233
- const s = (n = this._docViewModelMap.get(e)) == null ? void 0 : n.docViewModel;
234
- if (s == null)
235
+ if (e === dt) {
236
+ const o = (n = this._docViewModelMap.get(e)) == null ? void 0 : n.docViewModel;
237
+ if (o == null)
235
238
  return;
236
- s.reset(t);
239
+ o.reset(t);
237
240
  }
238
241
  this._currentDocViewModel$.next(this._docViewModelMap.get(e));
239
242
  }
240
243
  }
241
244
  _buildDocViewModel(e) {
242
- return new _t(e);
245
+ return new Pt(e);
243
246
  }
244
247
  };
245
- q = Ut([
246
- bt(0, D)
247
- ], q);
248
- var wt = Object.defineProperty, Lt = Object.getOwnPropertyDescriptor, Bt = (o, e, t, n) => {
249
- for (var s = n > 1 ? void 0 : n ? Lt(e, t) : e, r = o.length - 1, i; r >= 0; r--)
250
- (i = o[r]) && (s = (n ? i(e, t, s) : i(s)) || s);
251
- return n && s && wt(e, t, s), s;
252
- }, ge = (o, e) => (t, n) => e(t, n, o);
253
- const Ft = 300;
254
- let ae = class extends ce {
248
+ ne = Zt([
249
+ Jt(0, E)
250
+ ], ne);
251
+ var qt = Object.defineProperty, Kt = Object.getOwnPropertyDescriptor, Qt = (s, e, t, n) => {
252
+ for (var o = n > 1 ? void 0 : n ? Kt(e, t) : e, r = s.length - 1, i; r >= 0; r--)
253
+ (i = s[r]) && (o = (n ? i(e, t, o) : i(o)) || o);
254
+ return n && o && qt(e, t, o), o;
255
+ }, Ce = (s, e) => (t, n) => e(t, n, s);
256
+ const en = 300;
257
+ let me = class extends ge {
255
258
  constructor(e, t, n) {
256
259
  super();
257
- O(this, "_docStateChange$", new Z(null));
258
- O(this, "docStateChange$", this._docStateChange$.asObservable());
259
- O(this, "_stateCache", /* @__PURE__ */ new Map());
260
- O(this, "_timer", null);
260
+ x(this, "_docStateChange$", new ee(null));
261
+ x(this, "docStateChange$", this._docStateChange$.asObservable());
262
+ x(this, "_stateCache", /* @__PURE__ */ new Map());
263
+ x(this, "_timer", null);
261
264
  this._undoRedoService = e, this._commandService = t, this._univerInstanceService = n, this._initialize();
262
265
  }
263
266
  setChangeState(e) {
@@ -267,7 +270,7 @@ let ae = class extends ce {
267
270
  _initialize() {
268
271
  this.disposeWithMe(
269
272
  this._commandService.beforeCommandExecuted((e) => {
270
- if (e.id === we || e.id === Le) {
273
+ if (e.id === Xe || e.id === Ye) {
271
274
  const t = this._univerInstanceService.getCurrentUniverDocInstance();
272
275
  if (t == null)
273
276
  return;
@@ -278,30 +281,30 @@ let ae = class extends ce {
278
281
  );
279
282
  }
280
283
  _cacheChangeState(e) {
281
- const { trigger: t, unitId: n, noHistory: s } = e;
282
- if (!(t === Le || t === we || s)) {
284
+ const { trigger: t, unitId: n, noHistory: o } = e;
285
+ if (!(t === Ye || t === Xe || o)) {
283
286
  if (this._stateCache.has(n)) {
284
287
  const r = this._stateCache.get(n);
285
288
  r == null || r.push(e);
286
289
  } else
287
290
  this._stateCache.set(n, [e]);
288
- t === ue.id || t === me.id ? (this._timer && clearTimeout(this._timer), this._timer = setTimeout(() => {
291
+ t === pe.id || t === Se.id ? (this._timer && clearTimeout(this._timer), this._timer = setTimeout(() => {
289
292
  this._pushHistory(n);
290
- }, Ft)) : this._pushHistory(n);
293
+ }, en)) : this._pushHistory(n);
291
294
  }
292
295
  }
293
296
  _pushHistory(e) {
294
297
  const t = this._undoRedoService, n = this._stateCache.get(e);
295
298
  if (!Array.isArray(n) || n.length === 0)
296
299
  return;
297
- const s = n.length, r = n[0].commandId, i = n[0], a = n[s - 1], c = {
300
+ const o = n.length, r = n[0].commandId, i = n[0], a = n[o - 1], c = {
298
301
  unitId: e,
299
- actions: n.reduce((l, u) => b.compose(l, u.redoState.actions), []),
302
+ actions: n.reduce((l, u) => P.compose(l, u.redoState.actions), []),
300
303
  textRanges: a.redoState.textRanges
301
304
  }, d = {
302
305
  unitId: e,
303
306
  // Always need to put undoParams after redoParams, because `reverse` will change the `cacheStates` order.
304
- actions: n.reverse().reduce((l, u) => b.compose(l, u.undoState.actions), []),
307
+ actions: n.reverse().reduce((l, u) => P.compose(l, u.undoState.actions), []),
305
308
  textRanges: i.undoState.textRanges
306
309
  };
307
310
  t.pushUndoRedo({
@@ -311,16 +314,16 @@ let ae = class extends ce {
311
314
  }), n.length = 0;
312
315
  }
313
316
  };
314
- ae = Bt([
315
- ge(0, B(ve)),
316
- ge(1, I),
317
- ge(2, D)
318
- ], ae);
319
- class de {
317
+ me = Qt([
318
+ Ce(0, V(Te)),
319
+ Ce(1, I),
320
+ Ce(2, E)
321
+ ], me);
322
+ class he {
320
323
  constructor() {
321
- O(this, "_previousActiveRange", null);
322
- O(this, "_undoMutationParamsCache", []);
323
- O(this, "_redoMutationParamsCache", []);
324
+ x(this, "_previousActiveRange", null);
325
+ x(this, "_undoMutationParamsCache", []);
326
+ x(this, "_redoMutationParamsCache", []);
324
327
  }
325
328
  clearUndoRedoMutationParamsCache() {
326
329
  this._undoMutationParamsCache = [], this._redoMutationParamsCache = [];
@@ -348,13 +351,13 @@ class de {
348
351
  return null;
349
352
  const { unitId: e } = this._undoMutationParamsCache[0], t = {
350
353
  unitId: e,
351
- actions: this._undoMutationParamsCache.reverse().reduce((s, r) => b.compose(s, r.actions), []),
354
+ actions: this._undoMutationParamsCache.reverse().reduce((o, r) => P.compose(o, r.actions), []),
352
355
  textRanges: []
353
356
  // Add empty array, will never use, just fix type error
354
357
  };
355
358
  return { redoMutationParams: {
356
359
  unitId: e,
357
- actions: this._redoMutationParamsCache.reduce((s, r) => b.compose(s, r.actions), []),
360
+ actions: this._redoMutationParamsCache.reduce((o, r) => P.compose(o, r.actions), []),
358
361
  textRanges: []
359
362
  // Add empty array, will never use, just fix type error
360
363
  }, undoMutationParams: t, previousActiveRange: this._previousActiveRange };
@@ -363,189 +366,192 @@ class de {
363
366
  this._undoMutationParamsCache = [], this._redoMutationParamsCache = [], this._previousActiveRange = null;
364
367
  }
365
368
  }
366
- const ze = "doc.mutation.rich-text-editing", w = {
367
- id: ze,
369
+ const qe = "doc.mutation.rich-text-editing", L = {
370
+ id: qe,
368
371
  type: v.MUTATION,
369
- handler: (o, e) => {
370
- var A;
372
+ handler: (s, e) => {
373
+ var B;
371
374
  const {
372
375
  unitId: t,
373
376
  actions: n,
374
- textRanges: s,
377
+ textRanges: o,
375
378
  prevTextRanges: r,
376
379
  trigger: i,
377
380
  noHistory: a,
378
381
  isCompositionEnd: c,
379
382
  noNeedSetTextRange: d
380
- } = e, u = o.get(D).getUniverDocInstance(t), g = o.get(q).getViewModel(t), p = o.get(T), f = ((A = p.getSelections()) != null ? A : []).map(G), S = o.get(ae), _ = o.get(de);
383
+ } = e, u = s.get(E).getUniverDocInstance(t), g = s.get(ne).getViewModel(t), p = s.get(T), f = ((B = p.getSelections()) != null ? B : []).map(Z), S = s.get(me), _ = s.get(he);
381
384
  if (u == null || g == null)
382
385
  throw new Error(`DocumentDataModel or documentViewModel not found for unitId: ${t}`);
383
- const C = !!u.getSnapshot().disabled;
384
- if (n.length === 0 || C)
386
+ const R = !!u.getSnapshot().disabled;
387
+ if (n.length === 0 || R)
385
388
  return {
386
389
  unitId: t,
387
390
  actions: [],
388
391
  textRanges: f
389
392
  };
390
- const R = u.apply(n), { segmentId: M } = n[0], P = u.getSelfOrHeaderFooterModel(M);
391
- g.getSelfOrHeaderFooterViewModel(M).reset(P), !d && s && i != null && queueMicrotask(() => {
392
- p.replaceTextRanges(s);
393
+ const M = u.apply(n), { segmentId: C } = n[0], D = u.getSelfOrHeaderFooterModel(C);
394
+ g.getSelfOrHeaderFooterViewModel(C).reset(D), !d && o && i != null && queueMicrotask(() => {
395
+ p.replaceTextRanges(o);
393
396
  });
394
- const E = {
395
- commandId: ze,
397
+ const b = {
398
+ commandId: qe,
396
399
  unitId: t,
397
400
  trigger: i,
398
401
  noHistory: a,
399
402
  redoState: {
400
403
  actions: n,
401
- textRanges: s
404
+ textRanges: o
402
405
  },
403
406
  undoState: {
404
- actions: R,
407
+ actions: M,
405
408
  textRanges: r != null ? r : f
406
409
  }
407
410
  };
408
411
  if (c) {
409
- const x = _.fetchComposedUndoRedoMutationParams();
410
- if (x == null)
412
+ const O = _.fetchComposedUndoRedoMutationParams();
413
+ if (O == null)
411
414
  throw new Error("historyParams is null in RichTextEditingMutation");
412
- const { undoMutationParams: $, redoMutationParams: L, previousActiveRange: ne } = x;
413
- E.redoState.actions = L.actions, E.undoState.actions = $.actions, E.undoState.textRanges = [ne];
415
+ const { undoMutationParams: U, redoMutationParams: w, previousActiveRange: X } = O;
416
+ b.redoState.actions = w.actions, b.undoState.actions = U.actions, b.undoState.textRanges = [X];
414
417
  }
415
- return S.setChangeState(E), {
418
+ return S.setChangeState(b), {
416
419
  unitId: t,
417
- actions: R,
420
+ actions: M,
418
421
  textRanges: f
419
422
  };
420
423
  }
421
- }, ue = {
424
+ }, pe = {
422
425
  id: "doc.command.insert-text",
423
426
  type: v.COMMAND,
424
- handler: async (o, e) => {
425
- const t = o.get(I), { range: n, segmentId: s, body: r, unitId: i, textRanges: a } = e, { startOffset: c, collapsed: d } = n, l = {
426
- id: w.id,
427
+ handler: async (s, e) => {
428
+ const t = s.get(I), { range: n, segmentId: o, body: r, unitId: i, textRanges: a } = e, { startOffset: c, collapsed: d } = n, l = {
429
+ id: L.id,
427
430
  params: {
428
431
  unitId: i,
429
432
  actions: [],
430
433
  textRanges: a
431
434
  }
432
- }, u = new b();
435
+ }, u = new P();
433
436
  return d ? c > 0 && u.push({
434
437
  t: y.RETAIN,
435
438
  len: c,
436
- segmentId: s
437
- }) : u.push(...xe(n, s)), u.push({
439
+ segmentId: o
440
+ }) : u.push(...be(n, o)), u.push({
438
441
  t: y.INSERT,
439
442
  body: r,
440
443
  len: r.dataStream.length,
441
444
  line: 0,
442
- segmentId: s
445
+ segmentId: o
443
446
  }), l.params.actions = u.serialize(), !!t.syncExecuteCommand(l.id, l.params);
444
447
  }
445
448
  };
446
- var k = /* @__PURE__ */ ((o) => (o[o.LEFT = 0] = "LEFT", o[o.RIGHT = 1] = "RIGHT", o))(k || {});
447
- const me = {
449
+ var G = /* @__PURE__ */ ((s) => (s[s.LEFT = 0] = "LEFT", s[s.RIGHT = 1] = "RIGHT", s))(G || {});
450
+ const Se = {
448
451
  id: "doc.command.delete-text",
449
452
  type: v.COMMAND,
450
- handler: async (o, e) => {
451
- const t = o.get(I), { range: n, segmentId: s, unitId: r, direction: i, textRanges: a, len: c = 1 } = e, { startOffset: d } = n, l = {
452
- id: w.id,
453
+ handler: async (s, e) => {
454
+ const t = s.get(I), { range: n, segmentId: o, unitId: r, direction: i, textRanges: a, len: c = 1 } = e, { startOffset: d } = n, l = {
455
+ id: L.id,
453
456
  params: {
454
457
  unitId: r,
455
458
  actions: [],
456
459
  textRanges: a
457
460
  }
458
- }, u = new b();
461
+ }, u = new P();
459
462
  return d > 0 && u.push({
460
463
  t: y.RETAIN,
461
464
  len: i === 0 ? d - c : d,
462
- segmentId: s
465
+ segmentId: o
463
466
  }), u.push({
464
467
  t: y.DELETE,
465
468
  len: c,
466
469
  line: 0,
467
- segmentId: s
470
+ segmentId: o
468
471
  }), l.params.actions = u.serialize(), !!t.syncExecuteCommand(l.id, l.params);
469
472
  }
470
- }, nt = {
473
+ }, ht = {
471
474
  id: "doc.command.update-text",
472
475
  type: v.COMMAND,
473
- handler: async (o, e) => {
474
- const { range: t, segmentId: n, updateBody: s, coverType: r, unitId: i, textRanges: a } = e, c = o.get(I), d = {
475
- id: w.id,
476
+ handler: async (s, e) => {
477
+ const { range: t, segmentId: n, updateBody: o, coverType: r, unitId: i, textRanges: a } = e, c = s.get(I), d = {
478
+ id: L.id,
476
479
  params: {
477
480
  unitId: i,
478
481
  actions: [],
479
482
  textRanges: a
480
483
  }
481
- }, l = new b(), { startOffset: u, endOffset: m } = t;
484
+ }, l = new P(), { startOffset: u, endOffset: m } = t;
482
485
  return l.push({
483
486
  t: y.RETAIN,
484
487
  len: u,
485
488
  segmentId: n
486
489
  }), l.push({
487
490
  t: y.RETAIN,
488
- body: s,
491
+ body: o,
489
492
  len: m - u,
490
493
  segmentId: n,
491
494
  coverType: r
492
495
  }), d.params.actions = l.serialize(), !!c.syncExecuteCommand(d.id, d.params);
493
496
  }
494
497
  };
495
- function $t(o, e) {
498
+ function tn(s, e) {
496
499
  const t = [];
497
- for (let n = 0, s = o.length; n < s; n++)
498
- o[n] === pe.PARAGRAPH && t.push({
500
+ for (let n = 0, o = s.length; n < o; n++)
501
+ s[n] === xe.PARAGRAPH && t.push({
499
502
  startIndex: n
500
503
  });
501
504
  if (e)
502
505
  for (const n of t)
503
- e.bullet && (n.bullet = W.deepClone(e.bullet)), e.paragraphStyle && (n.paragraphStyle = W.deepClone(e.paragraphStyle));
506
+ e.bullet && (n.bullet = Q.deepClone(e.bullet)), e.paragraphStyle && (n.paragraphStyle = Q.deepClone(e.paragraphStyle));
504
507
  return t;
505
508
  }
506
- const zt = {
509
+ const nn = {
507
510
  id: "doc.command.break-line",
508
511
  type: v.COMMAND,
509
- handler: async (o) => {
512
+ handler: async (s) => {
510
513
  var p, h;
511
- const e = o.get(T), t = o.get(D), n = o.get(I), s = e.getActiveRange();
512
- if (s == null)
514
+ const e = s.get(T), t = s.get(E), n = s.get(I), o = e.getActiveRange();
515
+ if (o == null)
516
+ return !1;
517
+ const r = t.getCurrentUniverDocInstance();
518
+ if (!r)
513
519
  return !1;
514
- const r = t.getCurrentUniverDocInstance(), i = r.getUnitId(), { startOffset: a, segmentId: c, style: d } = s, l = [
520
+ const i = r.getUnitId(), { startOffset: a, segmentId: c, style: d } = o, l = [
515
521
  {
516
522
  startOffset: a + 1,
517
523
  endOffset: a + 1,
518
524
  style: d
519
525
  }
520
526
  ], m = ((h = (p = r.getBody()) == null ? void 0 : p.paragraphs) != null ? h : []).find((f) => f.startIndex >= a);
521
- return await n.executeCommand(ue.id, {
527
+ return await n.executeCommand(pe.id, {
522
528
  unitId: i,
523
529
  body: {
524
- dataStream: pe.PARAGRAPH,
525
- paragraphs: $t(pe.PARAGRAPH, m)
530
+ dataStream: xe.PARAGRAPH,
531
+ paragraphs: tn(xe.PARAGRAPH, m)
526
532
  },
527
- range: s,
533
+ range: o,
528
534
  textRanges: l,
529
535
  segmentId: c
530
536
  });
531
537
  }
532
538
  };
533
- var Vt = Object.defineProperty, kt = Object.getOwnPropertyDescriptor, jt = (o, e, t, n) => {
534
- for (var s = n > 1 ? void 0 : n ? kt(e, t) : e, r = o.length - 1, i; r >= 0; r--)
535
- (i = o[r]) && (s = (n ? i(e, t, s) : i(s)) || s);
536
- return n && s && Vt(e, t, s), s;
537
- }, fe = (o, e) => (t, n) => e(t, n, o);
538
- let j = class extends ce {
539
+ var sn = Object.defineProperty, on = Object.getOwnPropertyDescriptor, rn = (s, e, t, n) => {
540
+ for (var o = n > 1 ? void 0 : n ? on(e, t) : e, r = s.length - 1, i; r >= 0; r--)
541
+ (i = s[r]) && (o = (n ? i(e, t, o) : i(o)) || o);
542
+ return n && o && sn(e, t, o), o;
543
+ }, Re = (s, e) => (t, n) => e(t, n, s);
544
+ let H = class extends ge {
539
545
  constructor(e, t, n) {
540
546
  super();
541
- O(this, "_currentSkeletonUnitId", "");
542
- O(this, "_docSkeletonMap", /* @__PURE__ */ new Map());
543
- O(this, "_currentSkeleton$", new Z(null));
544
- O(this, "currentSkeleton$", this._currentSkeleton$.asObservable());
547
+ x(this, "_currentSkeletonUnitId", "");
548
+ x(this, "_docSkeletonMap", /* @__PURE__ */ new Map());
549
+ x(this, "_currentSkeleton$", new ee(null));
550
+ x(this, "currentSkeleton$", this._currentSkeleton$.asObservable());
545
551
  // CurrentSkeletonBefore for pre-triggered logic during registration
546
- O(this, "_currentSkeletonBefore$", new Z(null));
547
- O(this, "currentSkeletonBefore$", this._currentSkeletonBefore$.asObservable());
548
- this._localeService = e, this._docViewModelManagerService = t, this._currentUniverService = n, this._initialize();
552
+ x(this, "_currentSkeletonBefore$", new ee(null));
553
+ x(this, "currentSkeletonBefore$", this._currentSkeletonBefore$.asObservable());
554
+ this._localeService = e, this._docViewModelManagerService = t, this._univerInstanceService = n, this._initialize();
549
555
  }
550
556
  _initialize() {
551
557
  this._init();
@@ -554,12 +560,13 @@ let j = class extends ce {
554
560
  this._currentSkeletonBefore$.complete(), this._currentSkeleton$.complete(), this._docSkeletonMap.clear();
555
561
  }
556
562
  _init() {
557
- this._docViewModelManagerService.currentDocViewModel$.pipe(J(this.dispose$)).subscribe((e) => {
563
+ this._docViewModelManagerService.currentDocViewModel$.pipe(te(this.dispose$)).subscribe((e) => {
558
564
  e != null && this._setCurrent(e);
559
565
  }), this._docViewModelManagerService.getAllModel().forEach((e) => {
560
566
  e != null && this._setCurrent(e);
561
- }), this._currentUniverService.docDisposed$.pipe(J(this.dispose$)).subscribe((e) => {
562
- this._docSkeletonMap.delete(e.getUnitId()), this._currentSkeletonUnitId = this._currentUniverService.getCurrentUniverDocInstance().getUnitId();
567
+ }), this._univerInstanceService.getTypeOfUnitDisposed$(W.UNIVER_DOC).pipe(te(this.dispose$)).subscribe((e) => {
568
+ var t, n;
569
+ this._docSkeletonMap.delete(e.getUnitId()), this._currentSkeletonUnitId = (n = (t = this._univerInstanceService.getCurrentUnitForType(W.UNIVER_DOC)) == null ? void 0 : t.getUnitId()) != null ? n : "";
563
570
  });
564
571
  }
565
572
  getCurrent() {
@@ -594,38 +601,41 @@ let j = class extends ce {
594
601
  return this._currentSkeletonUnitId = t, this._currentSkeletonBefore$.next(this.getCurrent()), this._currentSkeleton$.next(this.getCurrent()), this.getCurrent();
595
602
  }
596
603
  _buildSkeleton(e) {
597
- return vt.create(e, this._localeService);
604
+ return Ut.create(e, this._localeService);
598
605
  }
599
606
  };
600
- j = jt([
601
- fe(0, B(mt)),
602
- fe(1, B(q)),
603
- fe(2, D)
604
- ], j);
605
- const Un = {
607
+ H = rn([
608
+ Re(0, V(Tt)),
609
+ Re(1, V(ne)),
610
+ Re(2, E)
611
+ ], H);
612
+ const Zn = {
606
613
  id: "doc.command.inner-paste",
607
614
  type: v.COMMAND,
608
- handler: async (o, e) => {
609
- const { segmentId: t, body: n, textRanges: s } = e, r = o.get(I), i = o.get(T), a = o.get(D), c = i.getSelections();
615
+ handler: async (s, e) => {
616
+ const { segmentId: t, body: n, textRanges: o } = e, r = s.get(I), i = s.get(T), a = s.get(E), c = i.getSelections();
610
617
  if (!Array.isArray(c) || c.length === 0)
611
618
  return !1;
612
- const l = a.getCurrentUniverDocInstance().getUnitId(), u = {
613
- id: w.id,
619
+ const d = a.getCurrentUniverDocInstance();
620
+ if (!d)
621
+ return !1;
622
+ const l = d.getUnitId(), u = {
623
+ id: L.id,
614
624
  params: {
615
625
  unitId: l,
616
626
  actions: [],
617
- textRanges: s
627
+ textRanges: o
618
628
  }
619
- }, m = new Q();
629
+ }, m = new oe();
620
630
  m.reset();
621
- const g = new b();
631
+ const g = new P();
622
632
  for (const h of c) {
623
- const { startOffset: f, endOffset: S, collapsed: _ } = h, C = f - m.cursor;
633
+ const { startOffset: f, endOffset: S, collapsed: _ } = h, R = f - m.cursor;
624
634
  _ ? g.push({
625
635
  t: y.RETAIN,
626
- len: C,
636
+ len: R,
627
637
  segmentId: t
628
- }) : g.push(...xe(h, t, m.cursor)), g.push({
638
+ }) : g.push(...be(h, t, m.cursor)), g.push({
629
639
  t: y.INSERT,
630
640
  body: n,
631
641
  len: n.dataStream.length,
@@ -635,39 +645,43 @@ const Un = {
635
645
  }
636
646
  return u.params.actions = g.serialize(), !!r.syncExecuteCommand(u.id, u.params);
637
647
  }
638
- }, ot = {
648
+ }, pt = {
639
649
  id: "doc.command.inner-cut",
640
650
  type: v.COMMAND,
641
- handler: async (o, e) => {
642
- const { segmentId: t, textRanges: n } = e, s = o.get(I), r = o.get(T), i = o.get(D), a = r.getSelections();
651
+ handler: async (s, e) => {
652
+ var h;
653
+ const { segmentId: t, textRanges: n } = e, o = s.get(I), r = s.get(T), i = s.get(E), a = r.getSelections();
643
654
  if (!Array.isArray(a) || a.length === 0)
644
655
  return !1;
645
- const c = i.getCurrentUniverDocInstance().getUnitId(), d = i.getUniverDocInstance(c), l = gt(d.snapshot, t);
656
+ const c = (h = i.getCurrentUniverDocInstance()) == null ? void 0 : h.getUnitId();
657
+ if (!c)
658
+ return !1;
659
+ const d = i.getUniverDocInstance(c), l = Et(d.snapshot, t);
646
660
  if (l == null)
647
661
  return !1;
648
662
  const u = {
649
- id: w.id,
663
+ id: L.id,
650
664
  params: {
651
665
  unitId: c,
652
666
  actions: [],
653
667
  textRanges: n
654
668
  }
655
- }, m = new Q();
669
+ }, m = new oe();
656
670
  m.reset();
657
- const g = new b();
658
- for (const h of a) {
659
- const { startOffset: f, endOffset: S, collapsed: _ } = h, C = f - m.cursor;
660
- _ ? g.push({
671
+ const g = new P();
672
+ for (const f of a) {
673
+ const { startOffset: S, endOffset: _, collapsed: R } = f, M = S - m.cursor;
674
+ R ? g.push({
661
675
  t: y.RETAIN,
662
- len: C,
676
+ len: M,
663
677
  segmentId: t
664
- }) : g.push(...Gt(h, l, t, m.cursor)), m.reset(), m.moveCursor(S);
678
+ }) : g.push(...an(f, l, t, m.cursor)), m.reset(), m.moveCursor(_);
665
679
  }
666
- return u.params.actions = g.serialize(), !!s.syncExecuteCommand(u.id, u.params);
680
+ return u.params.actions = g.serialize(), !!o.syncExecuteCommand(u.id, u.params);
667
681
  }
668
682
  };
669
- function Gt(o, e, t = "", n = 0) {
670
- const { startOffset: s, endOffset: r } = o, i = [], { paragraphs: a = [] } = e, c = s - n, d = r - n, l = a == null ? void 0 : a.find(
683
+ function an(s, e, t = "", n = 0) {
684
+ const { startOffset: o, endOffset: r } = s, i = [], { paragraphs: a = [] } = e, c = o - n, d = r - n, l = a == null ? void 0 : a.find(
671
685
  (u) => u.startIndex - n >= c && u.startIndex - n <= d
672
686
  );
673
687
  if (c > 0 && i.push({
@@ -700,103 +714,113 @@ function Gt(o, e, t = "", n = 0) {
700
714
  });
701
715
  return i;
702
716
  }
703
- const Ht = {
717
+ const cn = {
704
718
  id: "doc.command.delete-left",
705
719
  type: v.COMMAND,
706
- handler: async (o) => {
707
- var R;
708
- const e = o.get(T), t = o.get(j), n = o.get(D), s = o.get(I), r = e.getActiveRange(), i = e.getSelections(), a = (R = t.getCurrent()) == null ? void 0 : R.skeleton;
720
+ handler: async (s) => {
721
+ var M;
722
+ const e = s.get(T), t = s.get(H), n = s.get(E), o = s.get(I), r = e.getActiveRange(), i = e.getSelections(), a = (M = t.getCurrent()) == null ? void 0 : M.skeleton;
709
723
  let c = !0;
710
724
  if (r == null || a == null || i == null)
711
725
  return !1;
712
- const d = n.getCurrentUniverDocInstance(), { startOffset: l, collapsed: u, segmentId: m, style: g } = r, p = a.findNodeByCharIndex(l), h = It(p), f = Mt(p, d.getBody());
726
+ const d = n.getCurrentUniverDocInstance();
727
+ if (!d)
728
+ return !1;
729
+ const { startOffset: l, collapsed: u, segmentId: m, style: g } = r, p = a.findNodeByCharIndex(l), h = wt(p), f = Lt(p, d.getBody());
713
730
  let S = l;
714
731
  const _ = a.findNodeByCharIndex(l - 1);
715
- if (Ct(p) && _ !== p && (h === !0 || f === !0)) {
716
- const M = Rt(p, d.getBody());
717
- if (M == null)
732
+ if (Bt(p) && _ !== p && (h === !0 || f === !0)) {
733
+ const C = Ft(p, d.getBody());
734
+ if (C == null)
718
735
  return !1;
719
- const P = M == null ? void 0 : M.startIndex, N = { startIndex: 0 }, E = M.paragraphStyle;
736
+ const D = C == null ? void 0 : C.startIndex, A = { startIndex: 0 }, b = C.paragraphStyle;
720
737
  if (h === !0) {
721
- const x = M.paragraphStyle;
722
- x && (N.paragraphStyle = x);
738
+ const O = C.paragraphStyle;
739
+ if (O) {
740
+ A.paragraphStyle = O;
741
+ const { hanging: U } = O;
742
+ U && (A.paragraphStyle.indentStart = U, A.paragraphStyle.hanging = void 0);
743
+ }
723
744
  } else if (f === !0) {
724
- const x = M.bullet;
725
- x && (N.bullet = x), E != null && (N.paragraphStyle = { ...E }, delete N.paragraphStyle.hanging, delete N.paragraphStyle.indentStart);
745
+ const O = C.bullet;
746
+ O && (A.bullet = O), b != null && (A.paragraphStyle = { ...b }, delete A.paragraphStyle.hanging, delete A.paragraphStyle.indentStart);
726
747
  }
727
- const A = [
748
+ const B = [
728
749
  {
729
750
  startOffset: S,
730
751
  endOffset: S,
731
752
  style: g
732
753
  }
733
754
  ];
734
- c = await s.executeCommand(nt.id, {
755
+ c = await o.executeCommand(ht.id, {
735
756
  unitId: d.getUnitId(),
736
757
  updateBody: {
737
758
  dataStream: "",
738
- paragraphs: [{ ...N }]
759
+ paragraphs: [{ ...A }]
739
760
  },
740
761
  range: {
741
- startOffset: P,
742
- endOffset: P + 1
762
+ startOffset: D,
763
+ endOffset: D + 1
743
764
  },
744
- textRanges: A,
745
- coverType: Ie.REPLACE,
765
+ textRanges: B,
766
+ coverType: Ee.REPLACE,
746
767
  segmentId: m
747
768
  });
748
769
  } else if (u === !0) {
749
770
  if (_ == null)
750
771
  return !0;
751
772
  if (_.content === "\r")
752
- c = await s.executeCommand(ye.id, {
753
- direction: k.LEFT,
773
+ c = await o.executeCommand(Pe.id, {
774
+ direction: G.LEFT,
754
775
  range: r
755
776
  });
756
777
  else {
757
778
  S -= _.count;
758
- const M = [
779
+ const C = [
759
780
  {
760
781
  startOffset: S,
761
782
  endOffset: S,
762
783
  style: g
763
784
  }
764
785
  ];
765
- c = await s.executeCommand(me.id, {
786
+ c = await o.executeCommand(Se.id, {
766
787
  unitId: d.getUnitId(),
767
788
  range: r,
768
789
  segmentId: m,
769
- direction: k.LEFT,
790
+ direction: G.LEFT,
770
791
  len: _.count,
771
- textRanges: M
792
+ textRanges: C
772
793
  });
773
794
  }
774
795
  } else {
775
- const M = st(r, i);
776
- c = await s.executeCommand(ot.id, {
796
+ const C = St(r, i);
797
+ c = await o.executeCommand(pt.id, {
777
798
  segmentId: m,
778
- textRanges: M
799
+ textRanges: C
779
800
  });
780
801
  }
781
802
  return c;
782
803
  }
783
- }, Xt = {
804
+ }, ln = {
784
805
  id: "doc.command.delete-right",
785
806
  type: v.COMMAND,
786
- handler: async (o) => {
807
+ handler: async (s) => {
787
808
  var p;
788
- const e = o.get(T), t = o.get(j), n = o.get(D), s = o.get(I), r = e.getActiveRange(), i = e.getSelections(), a = (p = t.getCurrent()) == null ? void 0 : p.skeleton;
809
+ const e = s.get(T), t = s.get(H), n = s.get(E), o = s.get(I), r = e.getActiveRange(), i = e.getSelections(), a = (p = t.getCurrent()) == null ? void 0 : p.skeleton;
789
810
  let c;
790
811
  if (r == null || a == null || i == null)
791
812
  return !1;
792
- const d = n.getCurrentUniverDocInstance(), { startOffset: l, collapsed: u, segmentId: m, style: g } = r;
813
+ const d = n.getCurrentUniverDocInstance();
814
+ if (!d)
815
+ return !1;
816
+ const { startOffset: l, collapsed: u, segmentId: m, style: g } = r;
793
817
  if (l === d.getBody().dataStream.length - 2 && u)
794
818
  return !0;
795
819
  if (u === !0) {
796
820
  const h = a.findNodeByCharIndex(l);
797
821
  if (h.content === "\r")
798
- c = await s.executeCommand(ye.id, {
799
- direction: k.RIGHT,
822
+ c = await o.executeCommand(Pe.id, {
823
+ direction: G.RIGHT,
800
824
  range: r
801
825
  });
802
826
  else {
@@ -807,77 +831,80 @@ const Ht = {
807
831
  style: g
808
832
  }
809
833
  ];
810
- c = await s.executeCommand(me.id, {
834
+ c = await o.executeCommand(Se.id, {
811
835
  unitId: d.getUnitId(),
812
836
  range: r,
813
837
  segmentId: m,
814
- direction: k.RIGHT,
838
+ direction: G.RIGHT,
815
839
  textRanges: f,
816
840
  len: h.count
817
841
  });
818
842
  }
819
843
  } else {
820
- const h = st(r, i);
821
- c = await s.executeCommand(ot.id, {
844
+ const h = St(r, i);
845
+ c = await o.executeCommand(pt.id, {
822
846
  segmentId: m,
823
847
  textRanges: h
824
848
  });
825
849
  }
826
850
  return c;
827
851
  }
828
- }, ye = {
852
+ }, Pe = {
829
853
  id: "doc.command.merge-two-paragraph",
830
854
  type: v.COMMAND,
831
- handler: async (o, e) => {
832
- var N, E, A;
833
- const t = o.get(T), n = o.get(D), s = o.get(I), { direction: r, range: i } = e, a = t.getActiveRange(), c = t.getSelections();
855
+ handler: async (s, e) => {
856
+ var A, b, B;
857
+ const t = s.get(T), n = s.get(E), o = s.get(I), { direction: r, range: i } = e, a = t.getActiveRange(), c = t.getSelections();
834
858
  if (a == null || c == null)
835
859
  return !1;
836
- const d = n.getCurrentUniverDocInstance(), { startOffset: l, collapsed: u, segmentId: m, style: g } = a;
860
+ const d = n.getCurrentUniverDocInstance();
861
+ if (!d)
862
+ return !1;
863
+ const { startOffset: l, collapsed: u, segmentId: m, style: g } = a;
837
864
  if (!u)
838
865
  return !1;
839
- const p = r === k.LEFT ? l : l + 1, h = (A = (E = (N = d.getBody()) == null ? void 0 : N.paragraphs) == null ? void 0 : E.find((x) => x.startIndex >= p)) == null ? void 0 : A.startIndex, f = Yt(d.getBody(), p, h), S = r === k.LEFT ? l - 1 : l, _ = d.getUnitId(), C = [
866
+ const p = r === G.LEFT ? l : l + 1, h = (B = (b = (A = d.getBody()) == null ? void 0 : A.paragraphs) == null ? void 0 : b.find((O) => O.startIndex >= p)) == null ? void 0 : B.startIndex, f = dn(d.getBody(), p, h), S = r === G.LEFT ? l - 1 : l, _ = d.getUnitId(), R = [
840
867
  {
841
868
  startOffset: S,
842
869
  endOffset: S,
843
870
  style: g
844
871
  }
845
- ], R = {
846
- id: w.id,
872
+ ], M = {
873
+ id: L.id,
847
874
  params: {
848
875
  unitId: _,
849
876
  actions: [],
850
- textRanges: C,
877
+ textRanges: R,
851
878
  prevTextRanges: [i]
852
879
  }
853
- }, M = new b();
854
- return M.push({
880
+ }, C = new P();
881
+ return C.push({
855
882
  t: y.RETAIN,
856
- len: r === k.LEFT ? l - 1 : l,
883
+ len: r === G.LEFT ? l - 1 : l,
857
884
  segmentId: m
858
- }), f.dataStream.length && M.push({
885
+ }), f.dataStream.length && C.push({
859
886
  t: y.INSERT,
860
887
  body: f,
861
888
  len: f.dataStream.length,
862
889
  line: 0,
863
890
  segmentId: m
864
- }), M.push({
891
+ }), C.push({
865
892
  t: y.RETAIN,
866
893
  len: 1,
867
894
  segmentId: m
868
- }), M.push({
895
+ }), C.push({
869
896
  t: y.DELETE,
870
897
  len: h + 1 - p,
871
898
  line: 0,
872
899
  segmentId: m
873
- }), R.params.actions = M.serialize(), !!s.syncExecuteCommand(R.id, R.params);
900
+ }), M.params.actions = C.serialize(), !!o.syncExecuteCommand(M.id, M.params);
874
901
  }
875
902
  };
876
- function Yt(o, e, t) {
877
- const { textRuns: n } = o, s = o.dataStream.substring(e, t);
903
+ function dn(s, e, t) {
904
+ const { textRuns: n } = s, o = s.dataStream.substring(e, t);
878
905
  if (n == null)
879
906
  return {
880
- dataStream: s
907
+ dataStream: o
881
908
  };
882
909
  const r = [];
883
910
  for (const i of n) {
@@ -897,29 +924,29 @@ function Yt(o, e, t) {
897
924
  }));
898
925
  }
899
926
  return {
900
- dataStream: s,
927
+ dataStream: o,
901
928
  textRuns: r
902
929
  };
903
930
  }
904
- function st(o, e) {
905
- let t = o.endOffset;
906
- for (const s of e) {
907
- const { startOffset: r, endOffset: i } = s;
908
- r == null || i == null || i <= o.endOffset && (t -= i - r);
931
+ function St(s, e) {
932
+ let t = s.endOffset;
933
+ for (const o of e) {
934
+ const { startOffset: r, endOffset: i } = o;
935
+ r == null || i == null || i <= s.endOffset && (t -= i - r);
909
936
  }
910
937
  return [
911
938
  {
912
939
  startOffset: t,
913
940
  endOffset: t,
914
- style: o.style
941
+ style: s.style
915
942
  }
916
943
  ];
917
944
  }
918
- const rt = {
945
+ const _t = {
919
946
  id: "doc.command.ime-input",
920
947
  type: v.COMMAND,
921
- handler: async (o, e) => {
922
- const { unitId: t, newText: n, oldTextLen: s, isCompositionEnd: r, isCompositionStart: i } = e, a = o.get(I), c = o.get(de), d = c.getActiveRange();
948
+ handler: async (s, e) => {
949
+ const { unitId: t, newText: n, oldTextLen: o, isCompositionEnd: r, isCompositionStart: i } = e, a = s.get(I), c = s.get(he), d = c.getActiveRange();
923
950
  if (d == null)
924
951
  return !1;
925
952
  const { startOffset: l, style: u, segmentId: m } = d, g = n.length, p = [
@@ -930,20 +957,20 @@ const rt = {
930
957
  style: u
931
958
  }
932
959
  ], h = {
933
- id: w.id,
960
+ id: L.id,
934
961
  params: {
935
962
  unitId: t,
936
963
  actions: [],
937
964
  textRanges: p
938
965
  }
939
- }, f = new b();
940
- !d.collapsed && i ? f.push(...xe(d, m)) : f.push({
966
+ }, f = new P();
967
+ !d.collapsed && i ? f.push(...be(d, m)) : f.push({
941
968
  t: y.RETAIN,
942
969
  len: l,
943
970
  segmentId: m
944
- }), s > 0 && f.push({
971
+ }), o > 0 && f.push({
945
972
  t: y.DELETE,
946
- len: s,
973
+ len: o,
947
974
  line: 0,
948
975
  segmentId: m
949
976
  }), f.push({
@@ -959,200 +986,236 @@ const rt = {
959
986
  return c.pushUndoRedoMutationParams(S, h.params), !!S;
960
987
  }
961
988
  };
962
- function F(o, e, t, n) {
989
+ function F(s, e, t, n) {
963
990
  var r;
964
- const { segmentId: s } = (r = t.getActiveRange()) != null ? r : {};
965
- return s == null ? !1 : n.executeCommand(at.id, {
966
- segmentId: s,
967
- preCommandId: o,
991
+ const { segmentId: o } = (r = t.getActiveRange()) != null ? r : {};
992
+ return o == null ? !1 : n.executeCommand(It.id, {
993
+ segmentId: o,
994
+ preCommandId: s,
968
995
  ...e != null ? e : {}
969
996
  });
970
997
  }
971
- const Ve = "doc.command.set-inline-format-bold", Oe = {
972
- id: Ve,
998
+ const Ke = "doc.command.set-inline-format-bold", Ue = {
999
+ id: Ke,
973
1000
  type: v.COMMAND,
974
- handler: async (o, e) => {
975
- const t = o.get(I), n = o.get(T);
1001
+ handler: async (s, e) => {
1002
+ const t = s.get(I), n = s.get(T);
976
1003
  return F(
977
- Ve,
1004
+ Ke,
978
1005
  e,
979
1006
  n,
980
1007
  t
981
1008
  );
982
1009
  }
983
- }, ke = "doc.command.set-inline-format-italic", Te = {
984
- id: ke,
1010
+ }, Qe = "doc.command.set-inline-format-italic", we = {
1011
+ id: Qe,
985
1012
  type: v.COMMAND,
986
- handler: async (o, e) => {
987
- const t = o.get(I), n = o.get(T);
1013
+ handler: async (s, e) => {
1014
+ const t = s.get(I), n = s.get(T);
988
1015
  return F(
989
- ke,
1016
+ Qe,
990
1017
  e,
991
1018
  n,
992
1019
  t
993
1020
  );
994
1021
  }
995
- }, je = "doc.command.set-inline-format-underline", Ee = {
996
- id: je,
1022
+ }, et = "doc.command.set-inline-format-underline", Le = {
1023
+ id: et,
997
1024
  type: v.COMMAND,
998
- handler: async (o, e) => {
999
- const t = o.get(I), n = o.get(T);
1025
+ handler: async (s, e) => {
1026
+ const t = s.get(I), n = s.get(T);
1000
1027
  return F(
1001
- je,
1028
+ et,
1002
1029
  e,
1003
1030
  n,
1004
1031
  t
1005
1032
  );
1006
1033
  }
1007
- }, Ge = "doc.command.set-inline-format-strikethrough", De = {
1008
- id: Ge,
1034
+ }, tt = "doc.command.set-inline-format-strikethrough", Be = {
1035
+ id: tt,
1009
1036
  type: v.COMMAND,
1010
- handler: async (o, e) => {
1011
- const t = o.get(I), n = o.get(T);
1037
+ handler: async (s, e) => {
1038
+ const t = s.get(I), n = s.get(T);
1012
1039
  return F(
1013
- Ge,
1040
+ tt,
1014
1041
  e,
1015
1042
  n,
1016
1043
  t
1017
1044
  );
1018
1045
  }
1019
- }, He = "doc.command.set-inline-format-subscript", K = {
1020
- id: He,
1046
+ }, nt = "doc.command.set-inline-format-subscript", se = {
1047
+ id: nt,
1021
1048
  type: v.COMMAND,
1022
- handler: async (o, e) => {
1023
- const t = o.get(I), n = o.get(T);
1049
+ handler: async (s, e) => {
1050
+ const t = s.get(I), n = s.get(T);
1024
1051
  return F(
1025
- He,
1052
+ nt,
1026
1053
  e,
1027
1054
  n,
1028
1055
  t
1029
1056
  );
1030
1057
  }
1031
- }, Xe = "doc.command.set-inline-format-superscript", Ae = {
1032
- id: Xe,
1058
+ }, st = "doc.command.set-inline-format-superscript", Fe = {
1059
+ id: st,
1033
1060
  type: v.COMMAND,
1034
- handler: async (o, e) => {
1035
- const t = o.get(I), n = o.get(T);
1061
+ handler: async (s, e) => {
1062
+ const t = s.get(I), n = s.get(T);
1036
1063
  return F(
1037
- Xe,
1064
+ st,
1038
1065
  e,
1039
1066
  n,
1040
1067
  t
1041
1068
  );
1042
1069
  }
1043
- }, Ye = "doc.command.set-inline-format-fontsize", Pe = {
1044
- id: Ye,
1070
+ }, ot = "doc.command.set-inline-format-fontsize", $e = {
1071
+ id: ot,
1045
1072
  type: v.COMMAND,
1046
- handler: async (o, e) => {
1047
- const t = o.get(I), n = o.get(T);
1073
+ handler: async (s, e) => {
1074
+ const t = s.get(I), n = s.get(T);
1048
1075
  return F(
1049
- Ye,
1076
+ ot,
1050
1077
  e,
1051
1078
  n,
1052
1079
  t
1053
1080
  );
1054
1081
  }
1055
- }, We = "doc.command.set-inline-format-font-family", Ne = {
1056
- id: We,
1082
+ }, rt = "doc.command.set-inline-format-font-family", Ve = {
1083
+ id: rt,
1057
1084
  type: v.COMMAND,
1058
- handler: async (o, e) => {
1059
- const t = o.get(I), n = o.get(T);
1085
+ handler: async (s, e) => {
1086
+ const t = s.get(I), n = s.get(T);
1060
1087
  return F(
1061
- We,
1088
+ rt,
1062
1089
  e,
1063
1090
  n,
1064
1091
  t
1065
1092
  );
1066
1093
  }
1067
- }, Ze = "doc.command.set-inline-format-text-color", Ue = {
1068
- id: Ze,
1094
+ }, it = "doc.command.set-inline-format-text-color", ze = {
1095
+ id: it,
1069
1096
  type: v.COMMAND,
1070
- handler: async (o, e) => {
1071
- const t = o.get(I), n = o.get(T);
1097
+ handler: async (s, e) => {
1098
+ const t = s.get(I), n = s.get(T);
1072
1099
  return F(
1073
- Ze,
1100
+ it,
1074
1101
  e,
1075
1102
  n,
1076
1103
  t
1077
1104
  );
1078
1105
  }
1079
- }, it = {
1080
- [Oe.id]: "bl",
1081
- [Te.id]: "it",
1082
- [Ee.id]: "ul",
1083
- [De.id]: "st",
1084
- [Pe.id]: "fs",
1085
- [Ne.id]: "ff",
1086
- [Ue.id]: "cl",
1087
- [K.id]: "va",
1088
- [Ae.id]: "va"
1089
- }, at = {
1106
+ }, at = "doc.command.set-inline-format-text-background-color", ke = {
1107
+ id: at,
1108
+ type: v.COMMAND,
1109
+ handler: async (s, e) => {
1110
+ const t = s.get(I), n = s.get(T);
1111
+ return F(
1112
+ at,
1113
+ e,
1114
+ n,
1115
+ t
1116
+ );
1117
+ }
1118
+ }, ct = "doc.command.reset-inline-format-text-background-color", je = {
1119
+ id: ct,
1120
+ type: v.COMMAND,
1121
+ handler: async (s, e) => {
1122
+ const t = s.get(I), n = s.get(T);
1123
+ return F(
1124
+ ct,
1125
+ e,
1126
+ n,
1127
+ t
1128
+ );
1129
+ }
1130
+ }, vt = {
1131
+ [Ue.id]: "bl",
1132
+ [we.id]: "it",
1133
+ [Le.id]: "ul",
1134
+ [Be.id]: "st",
1135
+ [$e.id]: "fs",
1136
+ [Ve.id]: "ff",
1137
+ [ze.id]: "cl",
1138
+ [ke.id]: "bg",
1139
+ [je.id]: "bg",
1140
+ [se.id]: "va",
1141
+ [Fe.id]: "va"
1142
+ }, It = {
1090
1143
  id: "doc.command.set-inline-format",
1091
1144
  type: v.COMMAND,
1092
- handler: async (o, e) => {
1093
- const { segmentId: t, value: n, preCommandId: s } = e, r = o.get(I), i = o.get(T), a = o.get(D), c = i.getSelections();
1145
+ handler: async (s, e) => {
1146
+ const { segmentId: t, value: n, preCommandId: o } = e, r = s.get(I), i = s.get(T), a = s.get(E), c = i.getSelections();
1094
1147
  if (!Array.isArray(c) || c.length === 0)
1095
1148
  return !1;
1096
- let d = a.getCurrentUniverDocInstance(), l = d.getUnitId();
1097
- l === ft && (d = a.getUniverDocInstance(qe), l = d.getUnitId());
1149
+ let d = a.getCurrentUniverDocInstance();
1150
+ if (!d)
1151
+ return !1;
1152
+ let l = d.getUnitId();
1153
+ l === Dt && (d = a.getUniverDocInstance(dt), l = d.getUnitId());
1098
1154
  let u;
1099
- switch (s) {
1100
- case Oe.id:
1101
- case Te.id:
1102
- case Ee.id:
1103
- case De.id:
1104
- case K.id:
1105
- case Ae.id: {
1106
- u = Zt(
1155
+ switch (o) {
1156
+ case Ue.id:
1157
+ case we.id:
1158
+ case Le.id:
1159
+ case Be.id:
1160
+ case se.id:
1161
+ case Fe.id: {
1162
+ u = mn(
1107
1163
  d.getBody().textRuns,
1108
- s,
1164
+ o,
1109
1165
  c
1110
1166
  );
1111
1167
  break;
1112
1168
  }
1113
- case Pe.id:
1114
- case Ne.id: {
1169
+ case $e.id:
1170
+ case Ve.id: {
1115
1171
  u = n;
1116
1172
  break;
1117
1173
  }
1118
- case Ue.id: {
1174
+ case ze.id:
1175
+ case ke.id: {
1119
1176
  u = {
1120
1177
  rgb: n
1121
1178
  };
1122
1179
  break;
1123
1180
  }
1181
+ case je.id: {
1182
+ u = {
1183
+ rgb: null
1184
+ };
1185
+ break;
1186
+ }
1124
1187
  default:
1125
- throw new Error(`Unknown command: ${s} in handleInlineFormat`);
1188
+ throw new Error(`Unknown command: ${o} in handleInlineFormat`);
1126
1189
  }
1127
1190
  const m = {
1128
- id: w.id,
1191
+ id: L.id,
1129
1192
  params: {
1130
1193
  unitId: l,
1131
1194
  actions: [],
1132
- textRanges: c.map(G)
1195
+ textRanges: c.map(Z)
1133
1196
  }
1134
- }, g = new b(), p = new Q();
1197
+ }, g = new P(), p = new oe();
1135
1198
  p.reset();
1136
1199
  for (const f of c) {
1137
- const { startOffset: S, endOffset: _ } = f, C = {
1200
+ const { startOffset: S, endOffset: _ } = f, R = {
1138
1201
  dataStream: "",
1139
1202
  textRuns: [
1140
1203
  {
1141
1204
  st: 0,
1142
1205
  ed: _ - S,
1143
1206
  ts: {
1144
- [it[s]]: u
1207
+ [vt[o]]: u
1145
1208
  }
1146
1209
  }
1147
1210
  ]
1148
- }, R = S - p.cursor;
1149
- R !== 0 && g.push({
1211
+ }, M = S - p.cursor;
1212
+ M !== 0 && g.push({
1150
1213
  t: y.RETAIN,
1151
- len: R,
1214
+ len: M,
1152
1215
  segmentId: t
1153
1216
  }), g.push({
1154
1217
  t: y.RETAIN,
1155
- body: C,
1218
+ body: R,
1156
1219
  len: _ - S,
1157
1220
  segmentId: t
1158
1221
  }), p.reset(), p.moveCursor(_);
@@ -1160,89 +1223,98 @@ const Ve = "doc.command.set-inline-format-bold", Oe = {
1160
1223
  return m.params.actions = g.serialize(), !!r.syncExecuteCommand(m.id, m.params);
1161
1224
  }
1162
1225
  };
1163
- function Wt(o) {
1164
- return o !== null && typeof o == "object";
1226
+ function un(s) {
1227
+ return s !== null && typeof s == "object";
1165
1228
  }
1166
- function Zt(o, e, t) {
1167
- let n = 0, s = 0;
1168
- const r = it[e];
1169
- for (; n !== o.length && s !== t.length; ) {
1170
- const { startOffset: i, endOffset: a } = t[s], { st: c, ed: d, ts: l } = o[n];
1229
+ function mn(s, e, t) {
1230
+ let n = 0, o = 0;
1231
+ const r = vt[e];
1232
+ for (; n !== s.length && o !== t.length; ) {
1233
+ const { startOffset: i, endOffset: a } = t[o], { st: c, ed: d, ts: l } = s[n];
1171
1234
  if (a <= c)
1172
- s++;
1235
+ o++;
1173
1236
  else if (d <= i)
1174
1237
  n++;
1175
1238
  else {
1176
1239
  if (/bl|it/.test(r))
1177
- return (l == null ? void 0 : l[r]) === z.TRUE ? z.FALSE : z.TRUE;
1240
+ return (l == null ? void 0 : l[r]) === k.TRUE ? k.FALSE : k.TRUE;
1178
1241
  if (/ul|st/.test(r))
1179
- return Wt(l == null ? void 0 : l[r]) && (l == null ? void 0 : l[r]).s === z.TRUE ? {
1180
- s: z.FALSE
1242
+ return un(l == null ? void 0 : l[r]) && (l == null ? void 0 : l[r]).s === k.TRUE ? {
1243
+ s: k.FALSE
1181
1244
  } : {
1182
- s: z.TRUE
1245
+ s: k.TRUE
1183
1246
  };
1184
1247
  if (/va/.test(r))
1185
- return e === K.id ? (l == null ? void 0 : l[r]) === V.SUBSCRIPT ? V.NORMAL : V.SUBSCRIPT : (l == null ? void 0 : l[r]) === V.SUPERSCRIPT ? V.NORMAL : V.SUPERSCRIPT;
1248
+ return e === se.id ? (l == null ? void 0 : l[r]) === j.SUBSCRIPT ? j.NORMAL : j.SUBSCRIPT : (l == null ? void 0 : l[r]) === j.SUPERSCRIPT ? j.NORMAL : j.SUPERSCRIPT;
1186
1249
  n++;
1187
1250
  }
1188
1251
  }
1189
- return /bl|it/.test(r) ? z.TRUE : /ul|st/.test(r) ? {
1190
- s: z.TRUE
1191
- } : e === K.id ? V.SUBSCRIPT : V.SUPERSCRIPT;
1252
+ return /bl|it/.test(r) ? k.TRUE : /ul|st/.test(r) ? {
1253
+ s: k.TRUE
1254
+ } : e === se.id ? j.SUBSCRIPT : j.SUPERSCRIPT;
1192
1255
  }
1193
- const be = {
1256
+ const Ge = {
1194
1257
  id: "doc.command.list-operation",
1195
1258
  type: v.COMMAND,
1196
- handler: (o, e) => {
1197
- var M, P, N;
1198
- const t = o.get(T), n = o.get(D), s = o.get(I), { listType: r } = e, i = n.getCurrentUniverDocInstance(), a = t.getActiveRange(), c = (M = t.getSelections()) != null ? M : [], d = (P = i.getBody()) == null ? void 0 : P.paragraphs, l = c.map(G);
1259
+ handler: (s, e) => {
1260
+ var O, U, w, X;
1261
+ const t = s.get(T), n = s.get(E), o = s.get(I), { listType: r } = e, i = n.getCurrentUniverDocInstance();
1262
+ if (!i)
1263
+ return !1;
1264
+ const a = t.getActiveRange(), c = (O = t.getSelections()) != null ? O : [], d = (U = i.getBody()) == null ? void 0 : U.paragraphs, l = c.map(Z);
1199
1265
  if (a == null || d == null)
1200
1266
  return !1;
1201
- const u = ct(a, d), { segmentId: m } = a, g = i.getUnitId(), p = u.every((E) => {
1202
- var A;
1203
- return ((A = E.bullet) == null ? void 0 : A.listType) === r;
1267
+ const u = Mt(a, d), { segmentId: m } = a, g = i.getUnitId(), p = u.every((Y) => {
1268
+ var $;
1269
+ return (($ = Y.bullet) == null ? void 0 : $.listType) === r;
1204
1270
  });
1205
- let f = W.generateRandomId(6);
1271
+ let f = Q.generateRandomId(6);
1206
1272
  if (u.length === 1) {
1207
- const E = d.indexOf(u[0]), A = d[E - 1], x = d[E + 1];
1208
- A && A.bullet && A.bullet.listType === r ? f = A.bullet.listId : x && x.bullet && x.bullet.listType === r && (f = x.bullet.listId);
1273
+ const Y = d.indexOf(u[0]), $ = d[Y - 1], z = d[Y + 1];
1274
+ $ && $.bullet && $.bullet.listType === r ? f = $.bullet.listId : z && z.bullet && z.bullet.listType === r && (f = z.bullet.listId);
1209
1275
  }
1210
1276
  const S = {
1211
- id: w.id,
1277
+ id: L.id,
1212
1278
  params: {
1213
1279
  unitId: g,
1214
1280
  actions: [],
1215
1281
  textRanges: l
1216
1282
  }
1217
- }, _ = new Q();
1283
+ }, _ = new oe();
1218
1284
  _.reset();
1219
- const C = new b();
1220
- for (const E of u) {
1221
- const { startIndex: A } = E;
1222
- C.push({
1285
+ const R = new P(), M = (w = i.getSnapshot().lists) != null ? w : {}, C = {
1286
+ ...At,
1287
+ ...M
1288
+ }, { charSpace: D, defaultTabStop: A = 36, gridType: b } = i.getSnapshot().documentStyle;
1289
+ for (const Y of u) {
1290
+ const { startIndex: $, paragraphStyle: z = {} } = Y, { indentFirstLine: Rt = 0, snapToGrid: xt, indentStart: _e = 0 } = z, { hanging: ve, indentStart: He } = C[r].nestingLevel[0], Ie = $t(D, A, b, xt);
1291
+ R.push({
1223
1292
  t: y.RETAIN,
1224
- len: A - _.cursor,
1293
+ len: $ - _.cursor,
1225
1294
  segmentId: m
1226
- });
1227
- const x = {
1228
- ...E.paragraphStyle,
1229
- hanging: void 0,
1230
- indentStart: void 0
1231
- };
1232
- C.push({
1295
+ }), R.push({
1233
1296
  t: y.RETAIN,
1234
1297
  len: 1,
1235
1298
  body: {
1236
1299
  dataStream: "",
1237
1300
  paragraphs: [
1238
1301
  p ? {
1239
- paragraphStyle: x,
1302
+ paragraphStyle: {
1303
+ ...z,
1304
+ hanging: void 0,
1305
+ indentStart: _e ? Math.max(0, Me(_e, Ie) + ve - He) : void 0
1306
+ },
1240
1307
  startIndex: 0
1241
1308
  } : {
1242
- ...E,
1243
1309
  startIndex: 0,
1310
+ paragraphStyle: {
1311
+ ...z,
1312
+ indentFirstLine: void 0,
1313
+ hanging: ve,
1314
+ indentStart: He - ve + Me(Rt, Ie) + Me(_e, Ie)
1315
+ },
1244
1316
  bullet: {
1245
- ...(N = E.bullet) != null ? N : {
1317
+ ...(X = Y.bullet) != null ? X : {
1246
1318
  nestingLevel: 0,
1247
1319
  textStyle: {
1248
1320
  fs: 20
@@ -1255,64 +1327,67 @@ const be = {
1255
1327
  ]
1256
1328
  },
1257
1329
  segmentId: m,
1258
- coverType: Ie.REPLACE
1259
- }), _.moveCursorTo(A + 1);
1330
+ coverType: Ee.REPLACE
1331
+ }), _.moveCursorTo($ + 1);
1260
1332
  }
1261
- return S.params.actions = C.serialize(), !!s.syncExecuteCommand(S.id, S.params);
1333
+ return S.params.actions = R.serialize(), !!o.syncExecuteCommand(S.id, S.params);
1262
1334
  }
1263
- }, Jt = {
1335
+ }, gn = {
1264
1336
  id: "doc.command.bullet-list",
1265
1337
  type: v.COMMAND,
1266
- handler: (o) => o.get(I).syncExecuteCommand(be.id, {
1267
- listType: Ke.BULLET_LIST
1338
+ handler: (s) => s.get(I).syncExecuteCommand(Ge.id, {
1339
+ listType: ut.BULLET_LIST
1268
1340
  })
1269
- }, qt = {
1341
+ }, fn = {
1270
1342
  id: "doc.command.order-list",
1271
1343
  type: v.COMMAND,
1272
- handler: (o) => o.get(I).syncExecuteCommand(be.id, {
1273
- listType: Ke.ORDER_LIST
1344
+ handler: (s) => s.get(I).syncExecuteCommand(Ge.id, {
1345
+ listType: ut.ORDER_LIST
1274
1346
  })
1275
1347
  };
1276
- function ct(o, e) {
1277
- const { startOffset: t, endOffset: n } = o, s = [];
1348
+ function Mt(s, e) {
1349
+ const { startOffset: t, endOffset: n } = s, o = [];
1278
1350
  let r = -1;
1279
1351
  for (const i of e) {
1280
1352
  const { startIndex: a } = i;
1281
- (t > r && t <= a || n > r && n <= a || a >= t && a <= n) && s.push(i), r = a;
1353
+ (t > r && t <= a || n > r && n <= a || a >= t && a <= n) && o.push(i), r = a;
1282
1354
  }
1283
- return s;
1355
+ return o;
1284
1356
  }
1285
- const te = {
1357
+ const ie = {
1286
1358
  id: "doc.command.align-operation",
1287
1359
  type: v.COMMAND,
1288
- handler: (o, e) => {
1289
- var C, R;
1290
- const t = o.get(T), n = o.get(D), s = o.get(I), { alignType: r } = e, i = n.getCurrentUniverDocInstance(), a = t.getActiveRange(), c = (C = t.getSelections()) != null ? C : [], d = (R = i.getBody()) == null ? void 0 : R.paragraphs, l = c.map(G);
1360
+ handler: (s, e) => {
1361
+ var R, M;
1362
+ const t = s.get(T), n = s.get(E), o = s.get(I), { alignType: r } = e, i = n.getCurrentUniverDocInstance();
1363
+ if (!i)
1364
+ return !1;
1365
+ const a = t.getActiveRange(), c = (R = t.getSelections()) != null ? R : [], d = (M = i.getBody()) == null ? void 0 : M.paragraphs, l = c.map(Z);
1291
1366
  if (a == null || d == null)
1292
1367
  return !1;
1293
- const u = ct(a, d), { segmentId: m } = a, g = i.getUnitId(), p = u.every((M) => {
1294
- var P;
1295
- return ((P = M.paragraphStyle) == null ? void 0 : P.horizontalAlign) === r;
1368
+ const u = Mt(a, d), { segmentId: m } = a, g = i.getUnitId(), p = u.every((C) => {
1369
+ var D;
1370
+ return ((D = C.paragraphStyle) == null ? void 0 : D.horizontalAlign) === r;
1296
1371
  }), h = {
1297
- id: w.id,
1372
+ id: L.id,
1298
1373
  params: {
1299
1374
  unitId: g,
1300
1375
  actions: [],
1301
1376
  textRanges: l
1302
1377
  }
1303
- }, f = new Q();
1378
+ }, f = new oe();
1304
1379
  f.reset();
1305
- const S = new b();
1306
- for (const M of u) {
1307
- const { startIndex: P } = M;
1380
+ const S = new P();
1381
+ for (const C of u) {
1382
+ const { startIndex: D } = C;
1308
1383
  S.push({
1309
1384
  t: y.RETAIN,
1310
- len: P - f.cursor,
1385
+ len: D - f.cursor,
1311
1386
  segmentId: m
1312
1387
  });
1313
- const N = {
1314
- ...M.paragraphStyle,
1315
- horizontalAlign: p ? ee.UNSPECIFIED : r
1388
+ const A = {
1389
+ ...C.paragraphStyle,
1390
+ horizontalAlign: p ? re.UNSPECIFIED : r
1316
1391
  };
1317
1392
  S.push({
1318
1393
  t: y.RETAIN,
@@ -1321,77 +1396,77 @@ const te = {
1321
1396
  dataStream: "",
1322
1397
  paragraphs: [
1323
1398
  {
1324
- ...M,
1325
- paragraphStyle: N,
1399
+ ...C,
1400
+ paragraphStyle: A,
1326
1401
  startIndex: 0
1327
1402
  }
1328
1403
  ]
1329
1404
  },
1330
1405
  segmentId: m,
1331
- coverType: Ie.REPLACE
1332
- }), f.moveCursorTo(P + 1);
1406
+ coverType: Ee.REPLACE
1407
+ }), f.moveCursorTo(D + 1);
1333
1408
  }
1334
- return h.params.actions = S.serialize(), !!s.syncExecuteCommand(h.id, h.params);
1409
+ return h.params.actions = S.serialize(), !!o.syncExecuteCommand(h.id, h.params);
1335
1410
  }
1336
- }, Kt = {
1411
+ }, hn = {
1337
1412
  id: "doc.command.align-left",
1338
1413
  type: v.COMMAND,
1339
- handler: (o) => o.get(I).syncExecuteCommand(te.id, {
1340
- alignType: ee.LEFT
1414
+ handler: (s) => s.get(I).syncExecuteCommand(ie.id, {
1415
+ alignType: re.LEFT
1341
1416
  })
1342
- }, Qt = {
1417
+ }, pn = {
1343
1418
  id: "doc.command.align-center",
1344
1419
  type: v.COMMAND,
1345
- handler: (o) => o.get(I).syncExecuteCommand(te.id, {
1346
- alignType: ee.CENTER
1420
+ handler: (s) => s.get(I).syncExecuteCommand(ie.id, {
1421
+ alignType: re.CENTER
1347
1422
  })
1348
- }, en = {
1423
+ }, Sn = {
1349
1424
  id: "doc.command.align-right",
1350
1425
  type: v.COMMAND,
1351
- handler: (o) => o.get(I).syncExecuteCommand(te.id, {
1352
- alignType: ee.RIGHT
1426
+ handler: (s) => s.get(I).syncExecuteCommand(ie.id, {
1427
+ alignType: re.RIGHT
1353
1428
  })
1354
- }, tn = {
1429
+ }, _n = {
1355
1430
  id: "doc.command.align-justify",
1356
1431
  type: v.COMMAND,
1357
- handler: (o) => o.get(I).syncExecuteCommand(te.id, {
1358
- alignType: ee.JUSTIFIED
1432
+ handler: (s) => s.get(I).syncExecuteCommand(ie.id, {
1433
+ alignType: re.JUSTIFIED
1359
1434
  })
1360
- }, nn = {
1435
+ }, vn = {
1361
1436
  id: "doc.command-replace-content",
1362
1437
  type: v.COMMAND,
1363
- handler: async (o, e) => {
1438
+ handler: async (s, e) => {
1364
1439
  var g;
1365
- const { unitId: t, body: n, textRanges: s, segmentId: r = "" } = e, i = o.get(D), a = o.get(I), c = o.get(T), d = (g = i.getUniverDocInstance(t)) == null ? void 0 : g.getSnapshot().body, l = c.getSelections();
1440
+ const { unitId: t, body: n, textRanges: o, segmentId: r = "" } = e, i = s.get(E), a = s.get(I), c = s.get(T), d = (g = i.getUniverDocInstance(t)) == null ? void 0 : g.getSnapshot().body, l = c.getSelections();
1366
1441
  if (d == null || !Array.isArray(l) || l.length === 0)
1367
1442
  return !1;
1368
- const u = lt(t, r, d, n);
1369
- return u.params.textRanges = s, !!a.syncExecuteCommand(u.id, u.params);
1443
+ const u = Ct(t, r, d, n);
1444
+ return u.params.textRanges = o, !!a.syncExecuteCommand(u.id, u.params);
1370
1445
  }
1371
- }, on = {
1446
+ }, In = {
1372
1447
  id: "doc.command-cover-content",
1373
1448
  type: v.COMMAND,
1374
- handler: async (o, e) => {
1449
+ handler: async (s, e) => {
1375
1450
  var l;
1376
- const { unitId: t, body: n, segmentId: s = "" } = e, r = o.get(D), i = o.get(I), a = o.get(ve), c = (l = r.getUniverDocInstance(t)) == null ? void 0 : l.getSnapshot().body;
1451
+ const { unitId: t, body: n, segmentId: o = "" } = e, r = s.get(E), i = s.get(I), a = s.get(Te), c = (l = r.getUniverDocInstance(t)) == null ? void 0 : l.getSnapshot().body;
1377
1452
  if (c == null)
1378
1453
  return !1;
1379
- const d = lt(t, s, c, n);
1454
+ const d = Ct(t, o, c, n);
1380
1455
  return d.params.noNeedSetTextRange = !0, d.params.noHistory = !0, i.syncExecuteCommand(
1381
1456
  d.id,
1382
1457
  d.params
1383
1458
  ), a.clearUndoRedo(t), !0;
1384
1459
  }
1385
1460
  };
1386
- function lt(o, e, t, n) {
1387
- const s = {
1388
- id: w.id,
1461
+ function Ct(s, e, t, n) {
1462
+ const o = {
1463
+ id: L.id,
1389
1464
  params: {
1390
- unitId: o,
1465
+ unitId: s,
1391
1466
  actions: [],
1392
1467
  textRanges: []
1393
1468
  }
1394
- }, r = new b(), i = (t == null ? void 0 : t.dataStream.length) - 2;
1469
+ }, r = new P(), i = (t == null ? void 0 : t.dataStream.length) - 2;
1395
1470
  return i > 0 && r.push({
1396
1471
  t: y.DELETE,
1397
1472
  len: i,
@@ -1403,27 +1478,27 @@ function lt(o, e, t, n) {
1403
1478
  len: n.dataStream.length,
1404
1479
  line: 0,
1405
1480
  segmentId: e
1406
- }), s.params.actions = r.serialize(), s;
1481
+ }), o.params.actions = r.serialize(), o;
1407
1482
  }
1408
- const Se = {
1483
+ const ye = {
1409
1484
  id: "doc.operation.move-cursor",
1410
1485
  type: v.OPERATION,
1411
- handler: (o, e) => !!e
1412
- }, _e = {
1486
+ handler: (s, e) => !!e
1487
+ }, Oe = {
1413
1488
  id: "doc.operation.move-selection",
1414
1489
  type: v.OPERATION,
1415
- handler: (o, e) => !!e
1416
- }, sn = (o, e) => {
1417
- const t = o.get(D).getUniverDocInstance(e.unitId), n = (t == null ? void 0 : t.zoomRatio) || 1;
1490
+ handler: (s, e) => !!e
1491
+ }, Mn = (s, e) => {
1492
+ const t = s.get(E).getUniverDocInstance(e.unitId), n = (t == null ? void 0 : t.zoomRatio) || 1;
1418
1493
  return {
1419
- ...W.deepClone(e),
1494
+ ...Q.deepClone(e),
1420
1495
  zoomRatio: n
1421
1496
  };
1422
- }, oe = {
1497
+ }, ce = {
1423
1498
  id: "doc.operation.set-zoom-ratio",
1424
1499
  type: v.OPERATION,
1425
- handler: (o, e) => {
1426
- const t = o.get(D).getUniverDocInstance(e.unitId);
1500
+ handler: (s, e) => {
1501
+ const t = s.get(E).getUniverDocInstance(e.unitId);
1427
1502
  if (!t)
1428
1503
  return !1;
1429
1504
  const n = t.getSnapshot();
@@ -1431,55 +1506,61 @@ const Se = {
1431
1506
  zoomRatio: e.zoomRatio
1432
1507
  } : n.settings.zoomRatio = e.zoomRatio, !0;
1433
1508
  }
1434
- }, rn = {
1509
+ }, Cn = {
1435
1510
  type: v.COMMAND,
1436
1511
  id: "doc.command.set-zoom-ratio",
1437
- handler: async (o, e) => {
1438
- var u, m;
1439
- const t = o.get(I), n = o.get(ve), s = o.get(D);
1440
- let r = s.getCurrentUniverDocInstance().getUnitId(), i = 1;
1441
- if (e && (r = (u = e.documentId) != null ? u : r, i = (m = e.zoomRatio) != null ? m : i), !s.getUniverDocInstance(r))
1512
+ handler: async (s, e) => {
1513
+ var u, m, g;
1514
+ const t = s.get(I), n = s.get(Te), o = s.get(E);
1515
+ let r = (u = o.getCurrentUniverDocInstance()) == null ? void 0 : u.getUnitId();
1516
+ if (!r)
1517
+ return !1;
1518
+ let i = 1;
1519
+ if (e && (r = (m = e.documentId) != null ? m : r, i = (g = e.zoomRatio) != null ? g : i), !o.getUniverDocInstance(r))
1442
1520
  return !1;
1443
1521
  const c = {
1444
1522
  zoomRatio: i,
1445
1523
  unitId: r
1446
- }, d = sn(o, c);
1447
- return t.syncExecuteCommand(oe.id, c) ? (n.pushUndoRedo({
1524
+ }, d = Mn(s, c);
1525
+ return t.syncExecuteCommand(ce.id, c) ? (n.pushUndoRedo({
1448
1526
  unitID: r,
1449
- undoMutations: [{ id: oe.id, params: d }],
1450
- redoMutations: [{ id: oe.id, params: c }]
1527
+ undoMutations: [{ id: ce.id, params: d }],
1528
+ redoMutations: [{ id: ce.id, params: c }]
1451
1529
  }), !0) : !1;
1452
1530
  }
1453
- }, an = {
1531
+ }, Rn = {
1454
1532
  id: "doc.operation.select-all",
1455
1533
  type: v.COMMAND,
1456
- handler: async (o) => {
1457
- const e = o.get(D), t = o.get(T), n = e.getCurrentUniverDocInstance().getSnapshot().body;
1458
- if (n == null)
1534
+ handler: async (s) => {
1535
+ const e = s.get(E), t = s.get(T), n = e.getCurrentUniverDocInstance();
1536
+ if (!n)
1459
1537
  return !1;
1460
- const s = [
1538
+ const o = n.getSnapshot().body;
1539
+ if (o == null)
1540
+ return !1;
1541
+ const r = [
1461
1542
  {
1462
1543
  startOffset: 0,
1463
- endOffset: n.dataStream.length - 2
1544
+ endOffset: o.dataStream.length - 2
1464
1545
  }
1465
1546
  ];
1466
- return t.replaceTextRanges(s, !1), !0;
1547
+ return t.replaceTextRanges(r, !1), !0;
1467
1548
  }
1468
1549
  };
1469
- var cn = Object.defineProperty, ln = Object.getOwnPropertyDescriptor, dn = (o, e, t, n) => {
1470
- for (var s = n > 1 ? void 0 : n ? ln(e, t) : e, r = o.length - 1, i; r >= 0; r--)
1471
- (i = o[r]) && (s = (n ? i(e, t, s) : i(s)) || s);
1472
- return n && s && cn(e, t, s), s;
1473
- }, H = (o, e) => (t, n) => e(t, n, o);
1474
- let se = class extends Re {
1475
- constructor(e, t, n, s, r) {
1550
+ var xn = Object.defineProperty, yn = Object.getOwnPropertyDescriptor, On = (s, e, t, n) => {
1551
+ for (var o = n > 1 ? void 0 : n ? yn(e, t) : e, r = s.length - 1, i; r >= 0; r--)
1552
+ (i = s[r]) && (o = (n ? i(e, t, o) : i(o)) || o);
1553
+ return n && o && xn(e, t, o), o;
1554
+ }, J = (s, e) => (t, n) => e(t, n, s);
1555
+ let le = class extends Ne {
1556
+ constructor(e, t, n, o, r) {
1476
1557
  super();
1477
- O(this, "_previousIMEContent", "");
1478
- O(this, "_isCompositionStart", !0);
1479
- O(this, "_onStartSubscription");
1480
- O(this, "_onUpdateSubscription");
1481
- O(this, "_onEndSubscription");
1482
- this._docSkeletonManagerService = e, this._currentUniverService = t, this._textSelectionRenderManager = n, this._imeInputManagerService = s, this._commandService = r, this._initialize();
1558
+ x(this, "_previousIMEContent", "");
1559
+ x(this, "_isCompositionStart", !0);
1560
+ x(this, "_onStartSubscription");
1561
+ x(this, "_onUpdateSubscription");
1562
+ x(this, "_onEndSubscription");
1563
+ this._docSkeletonManagerService = e, this._univerInstanceService = t, this._textSelectionRenderManager = n, this._imeInputManagerService = o, this._commandService = r, this._initialize();
1483
1564
  }
1484
1565
  dispose() {
1485
1566
  var e, t, n;
@@ -1494,7 +1575,7 @@ let se = class extends Re {
1494
1575
  return;
1495
1576
  this._resetIME();
1496
1577
  const { activeRange: t } = e;
1497
- t != null && this._imeInputManagerService.setActiveRange(W.deepClone(t));
1578
+ t != null && this._imeInputManagerService.setActiveRange(Q.deepClone(t));
1498
1579
  });
1499
1580
  }
1500
1581
  _initialOnCompositionUpdate() {
@@ -1512,12 +1593,15 @@ let se = class extends Re {
1512
1593
  const n = (d = this._docSkeletonManagerService.getCurrent()) == null ? void 0 : d.skeleton;
1513
1594
  if (e == null || n == null)
1514
1595
  return;
1515
- const s = this._currentUniverService.getCurrentUniverDocInstance(), { event: r, activeRange: i } = e;
1596
+ const o = this._univerInstanceService.getCurrentUniverDocInstance();
1597
+ if (!o)
1598
+ return;
1599
+ const { event: r, activeRange: i } = e;
1516
1600
  if (n == null || i == null)
1517
1601
  return;
1518
1602
  const c = r.data;
1519
- c === this._previousIMEContent && t || (await this._commandService.executeCommand(rt.id, {
1520
- unitId: s.getUnitId(),
1603
+ c === this._previousIMEContent && t || (await this._commandService.executeCommand(_t.id, {
1604
+ unitId: o.getUnitId(),
1521
1605
  newText: c,
1522
1606
  oldTextLen: this._previousIMEContent.length,
1523
1607
  isCompositionStart: this._isCompositionStart,
@@ -1528,24 +1612,24 @@ let se = class extends Re {
1528
1612
  this._previousIMEContent = "", this._isCompositionStart = !0, this._imeInputManagerService.clearUndoRedoMutationParamsCache(), this._imeInputManagerService.setActiveRange(null);
1529
1613
  }
1530
1614
  };
1531
- se = dn([
1532
- Me(Ce.Rendered, se),
1533
- H(0, B(j)),
1534
- H(1, D),
1535
- H(2, le),
1536
- H(3, B(de)),
1537
- H(4, I)
1538
- ], se);
1539
- var un = Object.defineProperty, mn = Object.getOwnPropertyDescriptor, gn = (o, e, t, n) => {
1540
- for (var s = n > 1 ? void 0 : n ? mn(e, t) : e, r = o.length - 1, i; r >= 0; r--)
1541
- (i = o[r]) && (s = (n ? i(e, t, s) : i(s)) || s);
1542
- return n && s && un(e, t, s), s;
1543
- }, X = (o, e) => (t, n) => e(t, n, o);
1544
- let re = class extends Re {
1545
- constructor(e, t, n, s, r) {
1615
+ le = On([
1616
+ De(Ae.Rendered, le),
1617
+ J(0, V(H)),
1618
+ J(1, E),
1619
+ J(2, fe),
1620
+ J(3, V(he)),
1621
+ J(4, I)
1622
+ ], le);
1623
+ var Tn = Object.defineProperty, En = Object.getOwnPropertyDescriptor, Dn = (s, e, t, n) => {
1624
+ for (var o = n > 1 ? void 0 : n ? En(e, t) : e, r = s.length - 1, i; r >= 0; r--)
1625
+ (i = s[r]) && (o = (n ? i(e, t, o) : i(o)) || o);
1626
+ return n && o && Tn(e, t, o), o;
1627
+ }, q = (s, e) => (t, n) => e(t, n, s);
1628
+ let de = class extends Ne {
1629
+ constructor(e, t, n, o, r) {
1546
1630
  super();
1547
- O(this, "_onInputSubscription");
1548
- this._docSkeletonManagerService = e, this._currentUniverService = t, this._renderManagerService = n, this._textSelectionManagerService = s, this._commandService = r, this._initialize(), this._commandExecutedListener();
1631
+ x(this, "_onInputSubscription");
1632
+ this._docSkeletonManagerService = e, this._univerInstanceService = t, this._renderManagerService = n, this._textSelectionManagerService = o, this._commandService = r, this._initialize(), this._commandExecutedListener();
1549
1633
  }
1550
1634
  dispose() {
1551
1635
  var e;
@@ -1554,16 +1638,16 @@ let re = class extends Re {
1554
1638
  _initialize() {
1555
1639
  }
1556
1640
  _commandExecutedListener() {
1557
- const e = [Se.id, _e.id];
1641
+ const e = [ye.id, Oe.id];
1558
1642
  this.disposeWithMe(
1559
1643
  this._commandService.onCommandExecuted((t) => {
1560
1644
  if (!e.includes(t.id))
1561
1645
  return;
1562
1646
  const n = t.params;
1563
1647
  switch (t.id) {
1564
- case Se.id:
1648
+ case ye.id:
1565
1649
  return this._handleMoveCursor(n.direction);
1566
- case _e.id:
1650
+ case Oe.id:
1567
1651
  return this._handleShiftMoveSelection(n.direction);
1568
1652
  default:
1569
1653
  throw new Error("Unknown command");
@@ -1573,29 +1657,32 @@ let re = class extends Re {
1573
1657
  }
1574
1658
  _handleShiftMoveSelection(e) {
1575
1659
  var h, f, S;
1576
- const t = this._textSelectionManagerService.getActiveRange(), n = this._textSelectionManagerService.getSelections(), s = this._currentUniverService.getCurrentUniverDocInstance(), r = (h = this._docSkeletonManagerService.getCurrent()) == null ? void 0 : h.skeleton, i = this._getDocObject();
1660
+ const t = this._textSelectionManagerService.getActiveRange(), n = this._textSelectionManagerService.getSelections(), o = this._univerInstanceService.getCurrentUniverDocInstance();
1661
+ if (!o)
1662
+ return;
1663
+ const r = (h = this._docSkeletonManagerService.getCurrent()) == null ? void 0 : h.skeleton, i = this._getDocObject();
1577
1664
  if (t == null || r == null || i == null)
1578
1665
  return;
1579
1666
  const { startOffset: a, endOffset: c, style: d, collapsed: l, direction: u } = t;
1580
1667
  if (n.length > 1) {
1581
- let _ = Number.POSITIVE_INFINITY, C = Number.NEGATIVE_INFINITY;
1582
- for (const R of n)
1583
- _ = Math.min(_, R.startOffset), C = Math.max(C, R.endOffset);
1668
+ let _ = Number.POSITIVE_INFINITY, R = Number.NEGATIVE_INFINITY;
1669
+ for (const M of n)
1670
+ _ = Math.min(_, M.startOffset), R = Math.max(R, M.endOffset);
1584
1671
  this._textSelectionManagerService.replaceTextRanges([
1585
1672
  {
1586
- startOffset: e === U.LEFT || e === U.UP ? C : _,
1587
- endOffset: e === U.LEFT || e === U.UP ? _ : C,
1673
+ startOffset: e === N.LEFT || e === N.UP ? R : _,
1674
+ endOffset: e === N.LEFT || e === N.UP ? _ : R,
1588
1675
  style: d
1589
1676
  }
1590
1677
  ], !1);
1591
1678
  return;
1592
1679
  }
1593
- const m = l || u === Be.FORWARD ? a : c;
1594
- let g = l || u === Be.FORWARD ? c : a;
1595
- const p = (f = s.getBody().dataStream.length) != null ? f : Number.POSITIVE_INFINITY;
1596
- if (e === U.LEFT || e === U.RIGHT) {
1597
- const _ = r.findNodeByCharIndex(g - 1), C = r.findNodeByCharIndex(g);
1598
- g = e === U.RIGHT ? g + C.count : g - ((S = _ == null ? void 0 : _.count) != null ? S : 0), g = Math.min(p - 2, Math.max(0, g)), this._textSelectionManagerService.replaceTextRanges([
1680
+ const m = l || u === We.FORWARD ? a : c;
1681
+ let g = l || u === We.FORWARD ? c : a;
1682
+ const p = (f = o.getBody().dataStream.length) != null ? f : Number.POSITIVE_INFINITY;
1683
+ if (e === N.LEFT || e === N.RIGHT) {
1684
+ const _ = r.findNodeByCharIndex(g - 1), R = r.findNodeByCharIndex(g);
1685
+ g = e === N.RIGHT ? g + R.count : g - ((S = _ == null ? void 0 : _.count) != null ? S : 0), g = Math.min(p - 2, Math.max(0, g)), this._textSelectionManagerService.replaceTextRanges([
1599
1686
  {
1600
1687
  startOffset: m,
1601
1688
  endOffset: g,
@@ -1603,28 +1690,28 @@ let re = class extends Re {
1603
1690
  }
1604
1691
  ], !1);
1605
1692
  } else {
1606
- const _ = r.findNodeByCharIndex(g), C = i.document.getOffsetConfig(), R = this._getTopOrBottomPosition(r, _, e === U.DOWN);
1607
- if (R == null) {
1608
- const P = e === U.UP ? 0 : p - 2;
1609
- if (P === g)
1693
+ const _ = r.findNodeByCharIndex(g), R = i.document.getOffsetConfig(), M = this._getTopOrBottomPosition(r, _, e === N.DOWN);
1694
+ if (M == null) {
1695
+ const D = e === N.UP ? 0 : p - 2;
1696
+ if (D === g)
1610
1697
  return;
1611
1698
  this._textSelectionManagerService.replaceTextRanges([
1612
1699
  {
1613
1700
  startOffset: m,
1614
- endOffset: P,
1701
+ endOffset: D,
1615
1702
  style: d
1616
1703
  }
1617
1704
  ], !1);
1618
1705
  return;
1619
1706
  }
1620
- const M = new Fe(C, r).getRangePointData(
1621
- R,
1622
- R
1707
+ const C = new Ze(R, r).getRangePointData(
1708
+ M,
1709
+ M
1623
1710
  ).cursorList[0];
1624
1711
  this._textSelectionManagerService.replaceTextRanges([
1625
1712
  {
1626
1713
  startOffset: m,
1627
- endOffset: M.endOffset,
1714
+ endOffset: C.endOffset,
1628
1715
  style: d
1629
1716
  }
1630
1717
  ], !1);
@@ -1632,20 +1719,23 @@ let re = class extends Re {
1632
1719
  }
1633
1720
  _handleMoveCursor(e) {
1634
1721
  var m, g, p;
1635
- const t = this._textSelectionManagerService.getActiveRange(), n = this._textSelectionManagerService.getSelections(), s = this._currentUniverService.getCurrentUniverDocInstance(), r = (m = this._docSkeletonManagerService.getCurrent()) == null ? void 0 : m.skeleton, i = this._getDocObject();
1722
+ const t = this._textSelectionManagerService.getActiveRange(), n = this._textSelectionManagerService.getSelections(), o = this._univerInstanceService.getCurrentUniverDocInstance();
1723
+ if (!o)
1724
+ return !1;
1725
+ const r = (m = this._docSkeletonManagerService.getCurrent()) == null ? void 0 : m.skeleton, i = this._getDocObject();
1636
1726
  if (t == null || r == null || i == null || n == null)
1637
1727
  return;
1638
- const { startOffset: a, endOffset: c, style: d, collapsed: l } = t, u = (g = s.getBody().dataStream.length) != null ? g : Number.POSITIVE_INFINITY;
1639
- if (e === U.LEFT || e === U.RIGHT) {
1728
+ const { startOffset: a, endOffset: c, style: d, collapsed: l } = t, u = (g = o.getBody().dataStream.length) != null ? g : Number.POSITIVE_INFINITY;
1729
+ if (e === N.LEFT || e === N.RIGHT) {
1640
1730
  let h;
1641
1731
  if (!t.collapsed || n.length > 1) {
1642
1732
  let f = Number.POSITIVE_INFINITY, S = Number.NEGATIVE_INFINITY;
1643
1733
  for (const _ of n)
1644
1734
  f = Math.min(f, _.startOffset), S = Math.max(S, _.endOffset);
1645
- h = e === U.LEFT ? f : S;
1735
+ h = e === N.LEFT ? f : S;
1646
1736
  } else {
1647
1737
  const f = r.findNodeByCharIndex(a - 1), S = r.findNodeByCharIndex(a);
1648
- e === U.LEFT ? h = Math.max(0, a - ((p = f == null ? void 0 : f.count) != null ? p : 0)) : h = Math.min(u - 2, c + S.count);
1738
+ e === N.LEFT ? h = Math.max(0, a - ((p = f == null ? void 0 : f.count) != null ? p : 0)) : h = Math.min(u - 2, c + S.count);
1649
1739
  }
1650
1740
  this._textSelectionManagerService.replaceTextRanges([
1651
1741
  {
@@ -1657,27 +1747,27 @@ let re = class extends Re {
1657
1747
  } else {
1658
1748
  const h = r.findNodeByCharIndex(a), f = r.findNodeByCharIndex(c), S = i.document.getOffsetConfig(), _ = this._getTopOrBottomPosition(
1659
1749
  r,
1660
- e === U.UP ? h : f,
1661
- e === U.DOWN
1750
+ e === N.UP ? h : f,
1751
+ e === N.DOWN
1662
1752
  );
1663
1753
  if (_ == null) {
1664
- let R;
1665
- l ? R = e === U.UP ? 0 : u - 2 : R = e === U.UP ? a : c, this._textSelectionManagerService.replaceTextRanges([
1754
+ let M;
1755
+ l ? M = e === N.UP ? 0 : u - 2 : M = e === N.UP ? a : c, this._textSelectionManagerService.replaceTextRanges([
1666
1756
  {
1667
- startOffset: R,
1668
- endOffset: R,
1757
+ startOffset: M,
1758
+ endOffset: M,
1669
1759
  style: d
1670
1760
  }
1671
1761
  ], !1);
1672
1762
  return;
1673
1763
  }
1674
- const C = new Fe(S, r).getRangePointData(
1764
+ const R = new Ze(S, r).getRangePointData(
1675
1765
  _,
1676
1766
  _
1677
1767
  ).cursorList[0];
1678
1768
  this._textSelectionManagerService.replaceTextRanges([
1679
1769
  {
1680
- ...C,
1770
+ ...R,
1681
1771
  style: d
1682
1772
  }
1683
1773
  ], !1);
@@ -1686,10 +1776,10 @@ let re = class extends Re {
1686
1776
  _getTopOrBottomPosition(e, t, n) {
1687
1777
  if (t == null)
1688
1778
  return;
1689
- const s = this._getSpanLeftOffsetInLine(t), r = this._getNextOrPrevLine(t, n);
1779
+ const o = this._getSpanLeftOffsetInLine(t), r = this._getNextOrPrevLine(t, n);
1690
1780
  if (r == null)
1691
1781
  return;
1692
- const i = this._matchPositionByLeftOffset(e, r, s);
1782
+ const i = this._matchPositionByLeftOffset(e, r, o);
1693
1783
  if (i != null)
1694
1784
  return { ...i, isBack: !0 };
1695
1785
  }
@@ -1697,35 +1787,35 @@ let re = class extends Re {
1697
1787
  const t = e.parent;
1698
1788
  if (t == null)
1699
1789
  return Number.NEGATIVE_INFINITY;
1700
- const n = t.left, { left: s } = e;
1701
- return n + s;
1790
+ const n = t.left, { left: o } = e;
1791
+ return n + o;
1702
1792
  }
1703
1793
  _matchPositionByLeftOffset(e, t, n) {
1704
- const s = {
1794
+ const o = {
1705
1795
  distance: Number.POSITIVE_INFINITY
1706
1796
  };
1707
1797
  for (const r of t.divides) {
1708
1798
  const i = r.left;
1709
1799
  for (const a of r.glyphGroup) {
1710
1800
  const { left: c } = a, d = i + c, l = Math.abs(n - d);
1711
- l < s.distance && (s.glyph = a, s.distance = l);
1801
+ l < o.distance && (o.glyph = a, o.distance = l);
1712
1802
  }
1713
1803
  }
1714
- if (s.glyph != null)
1715
- return e.findPositionByGlyph(s.glyph);
1804
+ if (o.glyph != null)
1805
+ return e.findPositionByGlyph(o.glyph);
1716
1806
  }
1717
1807
  _getNextOrPrevLine(e, t) {
1718
- var p, h, f, S, _, C, R, M, P, N, E, A;
1808
+ var p, h, f, S, _, R, M, C, D, A, b, B;
1719
1809
  const n = e.parent;
1720
1810
  if (n == null)
1721
1811
  return;
1722
- const s = n.parent;
1723
- if (s == null)
1812
+ const o = n.parent;
1813
+ if (o == null)
1724
1814
  return;
1725
- const r = s.parent;
1815
+ const r = o.parent;
1726
1816
  if (r == null)
1727
1817
  return;
1728
- const i = r.lines.indexOf(s);
1818
+ const i = r.lines.indexOf(o);
1729
1819
  if (i === -1)
1730
1820
  return;
1731
1821
  let a;
@@ -1740,8 +1830,8 @@ let re = class extends Re {
1740
1830
  if (t === !0)
1741
1831
  a = (p = c.columns[d + 1]) == null ? void 0 : p.lines[0];
1742
1832
  else {
1743
- const x = (f = (h = c.columns) == null ? void 0 : h[d - 1]) == null ? void 0 : f.lines;
1744
- a = x == null ? void 0 : x[x.length - 1];
1833
+ const O = (f = (h = c.columns) == null ? void 0 : h[d - 1]) == null ? void 0 : f.lines;
1834
+ a = O == null ? void 0 : O[O.length - 1];
1745
1835
  }
1746
1836
  if (a != null)
1747
1837
  return a;
@@ -1754,8 +1844,8 @@ let re = class extends Re {
1754
1844
  if (t === !0)
1755
1845
  a = (_ = (S = l.sections[u - 1]) == null ? void 0 : S.columns[0]) == null ? void 0 : _.lines[0];
1756
1846
  else {
1757
- const x = (R = (C = l.sections) == null ? void 0 : C[u - 1]) == null ? void 0 : R.columns, $ = x == null ? void 0 : x[x.length - 1], L = $ == null ? void 0 : $.lines;
1758
- a = L == null ? void 0 : L[L.length - 1];
1847
+ const O = (M = (R = l.sections) == null ? void 0 : R[u - 1]) == null ? void 0 : M.columns, U = O == null ? void 0 : O[O.length - 1], w = U == null ? void 0 : U.lines;
1848
+ a = w == null ? void 0 : w[w.length - 1];
1759
1849
  }
1760
1850
  if (a != null)
1761
1851
  return a;
@@ -1765,40 +1855,40 @@ let re = class extends Re {
1765
1855
  const g = m.pages.indexOf(l);
1766
1856
  if (g !== -1) {
1767
1857
  if (t === !0)
1768
- a = (N = (P = (M = m.pages[g + 1]) == null ? void 0 : M.sections[0]) == null ? void 0 : P.columns[0]) == null ? void 0 : N.lines[0];
1858
+ a = (A = (D = (C = m.pages[g + 1]) == null ? void 0 : C.sections[0]) == null ? void 0 : D.columns[0]) == null ? void 0 : A.lines[0];
1769
1859
  else {
1770
- const x = (E = m.pages[g - 1]) == null ? void 0 : E.sections;
1771
- if (x == null)
1860
+ const O = (b = m.pages[g - 1]) == null ? void 0 : b.sections;
1861
+ if (O == null)
1772
1862
  return;
1773
- const $ = (A = x[x.length - 1]) == null ? void 0 : A.columns, L = $[$.length - 1], ne = L == null ? void 0 : L.lines;
1774
- a = ne[ne.length - 1];
1863
+ const U = (B = O[O.length - 1]) == null ? void 0 : B.columns, w = U[U.length - 1], X = w == null ? void 0 : w.lines;
1864
+ a = X[X.length - 1];
1775
1865
  }
1776
1866
  if (a != null)
1777
1867
  return a;
1778
1868
  }
1779
1869
  }
1780
1870
  _getDocObject() {
1781
- return et(this._currentUniverService, this._renderManagerService);
1871
+ return gt(this._univerInstanceService, this._renderManagerService);
1782
1872
  }
1783
1873
  };
1784
- re = gn([
1785
- Me(Ce.Rendered, re),
1786
- X(0, B(j)),
1787
- X(1, D),
1788
- X(2, Qe),
1789
- X(3, B(T)),
1790
- X(4, I)
1791
- ], re);
1792
- var fn = Object.defineProperty, hn = Object.getOwnPropertyDescriptor, pn = (o, e, t, n) => {
1793
- for (var s = n > 1 ? void 0 : n ? hn(e, t) : e, r = o.length - 1, i; r >= 0; r--)
1794
- (i = o[r]) && (s = (n ? i(e, t, s) : i(s)) || s);
1795
- return n && s && fn(e, t, s), s;
1796
- }, Y = (o, e) => (t, n) => e(t, n, o);
1797
- let ie = class extends Re {
1798
- constructor(e, t, n, s, r) {
1874
+ de = Dn([
1875
+ De(Ae.Rendered, de),
1876
+ q(0, V(H)),
1877
+ q(1, E),
1878
+ q(2, mt),
1879
+ q(3, V(T)),
1880
+ q(4, I)
1881
+ ], de);
1882
+ var An = Object.defineProperty, Nn = Object.getOwnPropertyDescriptor, bn = (s, e, t, n) => {
1883
+ for (var o = n > 1 ? void 0 : n ? Nn(e, t) : e, r = s.length - 1, i; r >= 0; r--)
1884
+ (i = s[r]) && (o = (n ? i(e, t, o) : i(o)) || o);
1885
+ return n && o && An(e, t, o), o;
1886
+ }, K = (s, e) => (t, n) => e(t, n, s);
1887
+ let ue = class extends Ne {
1888
+ constructor(e, t, n, o, r) {
1799
1889
  super();
1800
- O(this, "_onInputSubscription");
1801
- this._docSkeletonManagerService = e, this._currentUniverService = t, this._renderManagerService = n, this._textSelectionRenderManager = s, this._commandService = r, this._initialize(), this._commandExecutedListener();
1890
+ x(this, "_onInputSubscription");
1891
+ this._docSkeletonManagerService = e, this._univerInstanceService = t, this._renderManagerService = n, this._textSelectionRenderManager = o, this._commandService = r, this._initialize(), this._commandExecutedListener();
1802
1892
  }
1803
1893
  dispose() {
1804
1894
  var e;
@@ -1812,7 +1902,10 @@ let ie = class extends Re {
1812
1902
  var p;
1813
1903
  if (e == null)
1814
1904
  return;
1815
- const n = this._currentUniverService.getCurrentUniverDocInstance().getUnitId(), { event: s, content: r = "", activeRange: i } = e, a = s, c = (p = this._docSkeletonManagerService.getCurrent()) == null ? void 0 : p.skeleton;
1905
+ const t = this._univerInstanceService.getCurrentUniverDocInstance();
1906
+ if (!t)
1907
+ return;
1908
+ const n = t.getUnitId(), { event: o, content: r = "", activeRange: i } = e, a = o, c = (p = this._docSkeletonManagerService.getCurrent()) == null ? void 0 : p.skeleton;
1816
1909
  if (a.data == null || c == null || !c || !i)
1817
1910
  return;
1818
1911
  const { startOffset: d, segmentId: l, style: u } = i, m = r.length, g = [
@@ -1822,7 +1915,7 @@ let ie = class extends Re {
1822
1915
  style: u
1823
1916
  }
1824
1917
  ];
1825
- await this._commandService.executeCommand(ue.id, {
1918
+ await this._commandService.executeCommand(pe.id, {
1826
1919
  unitId: n,
1827
1920
  body: {
1828
1921
  dataStream: r
@@ -1836,71 +1929,73 @@ let ie = class extends Re {
1836
1929
  _commandExecutedListener() {
1837
1930
  }
1838
1931
  _getDocObject() {
1839
- return et(this._currentUniverService, this._renderManagerService);
1932
+ return gt(this._univerInstanceService, this._renderManagerService);
1840
1933
  }
1841
1934
  };
1842
- ie = pn([
1843
- Me(Ce.Rendered, ie),
1844
- Y(0, B(j)),
1845
- Y(1, D),
1846
- Y(2, Qe),
1847
- Y(3, le),
1848
- Y(4, I)
1849
- ], ie);
1850
- var Sn = Object.defineProperty, _n = Object.getOwnPropertyDescriptor, vn = (o, e, t, n) => {
1851
- for (var s = n > 1 ? void 0 : n ? _n(e, t) : e, r = o.length - 1, i; r >= 0; r--)
1852
- (i = o[r]) && (s = (n ? i(e, t, s) : i(s)) || s);
1853
- return n && s && Sn(e, t, s), s;
1854
- }, In = (o, e) => (t, n) => e(t, n, o);
1855
- const Mn = {
1935
+ ue = bn([
1936
+ De(Ae.Rendered, ue),
1937
+ K(0, V(H)),
1938
+ K(1, E),
1939
+ K(2, mt),
1940
+ K(3, fe),
1941
+ K(4, I)
1942
+ ], ue);
1943
+ var Pn = Object.defineProperty, Un = Object.getOwnPropertyDescriptor, wn = (s, e, t, n) => {
1944
+ for (var o = n > 1 ? void 0 : n ? Un(e, t) : e, r = s.length - 1, i; r >= 0; r--)
1945
+ (i = s[r]) && (o = (n ? i(e, t, o) : i(o)) || o);
1946
+ return n && o && Pn(e, t, o), o;
1947
+ }, Ln = (s, e) => (t, n) => e(t, n, s);
1948
+ const Bn = {
1856
1949
  hasScroll: !0
1857
- }, Cn = "docs";
1858
- var he;
1859
- let Je = (he = class extends ht {
1950
+ }, Fn = "docs";
1951
+ var ae;
1952
+ let lt = (ae = class extends Nt {
1860
1953
  constructor(e = {}, t) {
1861
- super(Cn);
1862
- O(this, "_config");
1863
- this._injector = t, this._config = Object.assign(Mn, e), this._initializeDependencies(t), this._initializeCommands();
1954
+ super();
1955
+ x(this, "_config");
1956
+ this._injector = t, this._config = Object.assign(Bn, e), this._initializeDependencies(t), this._initializeCommands();
1864
1957
  }
1865
1958
  initialize() {
1866
1959
  }
1867
1960
  _initializeCommands() {
1868
1961
  [
1869
- Se,
1870
- _e,
1871
- Ht,
1872
- Xt,
1962
+ ye,
1873
1963
  Oe,
1874
- Te,
1875
- Ee,
1876
- De,
1877
- K,
1878
- Ae,
1879
- Pe,
1880
- Ne,
1964
+ cn,
1965
+ ln,
1881
1966
  Ue,
1882
- at,
1883
- zt,
1884
- ue,
1885
- me,
1886
- nt,
1887
- rt,
1888
- ye,
1889
- w,
1967
+ we,
1968
+ Le,
1969
+ Be,
1970
+ se,
1971
+ Fe,
1972
+ $e,
1973
+ Ve,
1974
+ ze,
1975
+ je,
1976
+ ke,
1977
+ It,
1890
1978
  nn,
1891
- on,
1892
- rn,
1893
- oe,
1894
- tt,
1895
- an,
1896
- qt,
1897
- Jt,
1898
- be,
1899
- Kt,
1900
- Qt,
1901
- en,
1902
- te,
1903
- tn
1979
+ pe,
1980
+ Se,
1981
+ ht,
1982
+ _t,
1983
+ Pe,
1984
+ L,
1985
+ vn,
1986
+ In,
1987
+ Cn,
1988
+ ce,
1989
+ ft,
1990
+ Rn,
1991
+ fn,
1992
+ gn,
1993
+ Ge,
1994
+ hn,
1995
+ pn,
1996
+ Sn,
1997
+ ie,
1998
+ _n
1904
1999
  ].forEach((e) => {
1905
2000
  this._injector.get(I).registerCommand(e);
1906
2001
  });
@@ -1911,76 +2006,78 @@ let Je = (he = class extends ht {
1911
2006
  _initializeDependencies(e) {
1912
2007
  [
1913
2008
  // services
1914
- [j],
1915
- [q],
1916
- [ae],
1917
- [de],
2009
+ [H],
2010
+ [ne],
2011
+ [me],
2012
+ [he],
1918
2013
  [
1919
- le,
2014
+ fe,
1920
2015
  {
1921
- useClass: xt
2016
+ useClass: Vt
1922
2017
  }
1923
2018
  ],
1924
2019
  [T],
1925
2020
  // controllers
1926
- [ie],
1927
- [se],
1928
- [re]
2021
+ [ue],
2022
+ [le],
2023
+ [de]
1929
2024
  ].forEach((t) => e.add(t));
1930
2025
  }
1931
- }, O(he, "type", pt.Doc), he);
1932
- Je = vn([
1933
- In(1, B(yt))
1934
- ], Je);
2026
+ }, x(ae, "pluginName", Fn), x(ae, "type", W.UNIVER_DOC), ae);
2027
+ lt = wn([
2028
+ Ln(1, V(zt))
2029
+ ], lt);
1935
2030
  export {
1936
- Qt as AlignCenterCommand,
1937
- tn as AlignJustifyCommand,
1938
- Kt as AlignLeftCommand,
1939
- te as AlignOperationCommand,
1940
- en as AlignRightCommand,
1941
- zt as BreakLineCommand,
1942
- Jt as BulletListCommand,
1943
- on as CoverContentCommand,
1944
- ot as CutContentCommand,
1945
- Pn as DOCS_COMPONENT_DEFAULT_Z_INDEX,
1946
- An as DOCS_COMPONENT_HEADER_LAYER_INDEX,
1947
- Dn as DOCS_COMPONENT_MAIN_LAYER_INDEX,
1948
- Ot as DOCS_VIEW_KEY,
1949
- me as DeleteCommand,
1950
- Ht as DeleteLeftCommand,
1951
- Xt as DeleteRightCommand,
1952
- j as DocSkeletonManagerService,
1953
- ae as DocStateChangeManagerService,
1954
- q as DocViewModelManagerService,
1955
- rt as IMEInputCommand,
1956
- de as IMEInputManagerService,
1957
- Un as InnerPasteCommand,
1958
- ue as InsertCommand,
1959
- Se as MoveCursorOperation,
1960
- _e as MoveSelectionOperation,
1961
- Nn as NORMAL_TEXT_SELECTION_PLUGIN_NAME,
1962
- qt as OrderListCommand,
1963
- nn as ReplaceContentCommand,
1964
- w as RichTextEditingMutation,
1965
- an as SelectAllOperation,
1966
- rn as SetDocZoomRatioCommand,
1967
- oe as SetDocZoomRatioOperation,
1968
- Oe as SetInlineFormatBoldCommand,
1969
- at as SetInlineFormatCommand,
1970
- Ne as SetInlineFormatFontFamilyCommand,
1971
- Pe as SetInlineFormatFontSizeCommand,
1972
- Te as SetInlineFormatItalicCommand,
1973
- De as SetInlineFormatStrikethroughCommand,
1974
- K as SetInlineFormatSubscriptCommand,
1975
- Ae as SetInlineFormatSuperscriptCommand,
1976
- Ue as SetInlineFormatTextColorCommand,
1977
- Ee as SetInlineFormatUnderlineCommand,
1978
- tt as SetTextSelectionsOperation,
2031
+ pn as AlignCenterCommand,
2032
+ _n as AlignJustifyCommand,
2033
+ hn as AlignLeftCommand,
2034
+ ie as AlignOperationCommand,
2035
+ Sn as AlignRightCommand,
2036
+ nn as BreakLineCommand,
2037
+ gn as BulletListCommand,
2038
+ In as CoverContentCommand,
2039
+ pt as CutContentCommand,
2040
+ Yn as DOCS_COMPONENT_DEFAULT_Z_INDEX,
2041
+ Xn as DOCS_COMPONENT_HEADER_LAYER_INDEX,
2042
+ Hn as DOCS_COMPONENT_MAIN_LAYER_INDEX,
2043
+ kt as DOCS_VIEW_KEY,
2044
+ Se as DeleteCommand,
2045
+ cn as DeleteLeftCommand,
2046
+ ln as DeleteRightCommand,
2047
+ H as DocSkeletonManagerService,
2048
+ me as DocStateChangeManagerService,
2049
+ ne as DocViewModelManagerService,
2050
+ _t as IMEInputCommand,
2051
+ he as IMEInputManagerService,
2052
+ Zn as InnerPasteCommand,
2053
+ pe as InsertCommand,
2054
+ ye as MoveCursorOperation,
2055
+ Oe as MoveSelectionOperation,
2056
+ Wn as NORMAL_TEXT_SELECTION_PLUGIN_NAME,
2057
+ fn as OrderListCommand,
2058
+ vn as ReplaceContentCommand,
2059
+ je as ResetInlineFormatTextBackgroundColorCommand,
2060
+ L as RichTextEditingMutation,
2061
+ Rn as SelectAllOperation,
2062
+ Cn as SetDocZoomRatioCommand,
2063
+ ce as SetDocZoomRatioOperation,
2064
+ Ue as SetInlineFormatBoldCommand,
2065
+ It as SetInlineFormatCommand,
2066
+ Ve as SetInlineFormatFontFamilyCommand,
2067
+ $e as SetInlineFormatFontSizeCommand,
2068
+ we as SetInlineFormatItalicCommand,
2069
+ Be as SetInlineFormatStrikethroughCommand,
2070
+ se as SetInlineFormatSubscriptCommand,
2071
+ Fe as SetInlineFormatSuperscriptCommand,
2072
+ ke as SetInlineFormatTextBackgroundColorCommand,
2073
+ ze as SetInlineFormatTextColorCommand,
2074
+ Le as SetInlineFormatUnderlineCommand,
2075
+ ft as SetTextSelectionsOperation,
1979
2076
  T as TextSelectionManagerService,
1980
- Je as UniverDocsPlugin,
1981
- nt as UpdateCommand,
1982
- Tt as VIEWPORT_KEY,
1983
- et as getDocObject,
1984
- En as getDocObjectById,
1985
- G as serializeTextRange
2077
+ lt as UniverDocsPlugin,
2078
+ ht as UpdateCommand,
2079
+ jt as VIEWPORT_KEY,
2080
+ gt as getDocObject,
2081
+ Gn as getDocObjectById,
2082
+ Z as serializeTextRange
1986
2083
  };