@univerjs/docs 0.2.4-alpha.0 → 0.2.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/es/index.js CHANGED
@@ -1,8 +1,8 @@
1
1
  var Qt = Object.defineProperty;
2
2
  var en = (o, e, n) => e in o ? Qt(o, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : o[e] = n;
3
3
  var w = (o, e, n) => en(o, typeof e != "symbol" ? e + "" : e, n);
4
- import { CommandType as A, RxDisposable as ke, ICommandService as N, Inject as ee, IUndoRedoService as ze, UndoCommandId as gt, RedoCommandId as ft, JSONX as B, IUniverInstanceService as U, LocaleService as tn, UniverInstanceType as te, DOCS_NORMAL_EDITOR_UNIT_ID_KEY as bt, DataStreamTreeTokenType as b, TextXActionType as M, TextX as G, toDisposable as Pt, normalizeBody as nn, getBodySlice as wt, updateAttributeByInsert as sn, Tools as ne, MemoryCursor as de, getDocsUpdateBody as on, UpdateDocsAttributeType as Te, PositionedObjectLayoutType as Ut, getCustomRangeSlice as rn, getCustomDecorationSlice as an, BooleanNumber as K, BaselineOffset as Z, PRESET_LIST_TYPE as cn, GridType as dn, PresetListType as Bt, sortRulesFactory as ln, OnLifecycle as le, LifecycleStages as ue, Disposable as ge, Direction as L, HorizontalAlign as fe, Plugin as un, Injector as gn, createInterceptorKey as Lt, DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY as fn, remove as mn, composeInterceptors as hn, DisposableCollection as pn } from "@univerjs/core";
5
- import { NORMAL_TEXT_SELECTION_PLUGIN_STYLE as Sn, ITextSelectionRenderManager as Ee, DocumentSkeleton as In, DocumentViewModel as _n, IRenderManagerService as me, hasListGlyph as vn, isIndentByGlyph as Rn, isFirstGlyph as xn, getParagraphByGlyph as On, getCharSpaceApply as Cn, getNumberUnitValue as Q, RANGE_DIRECTION as we, NodePositionConvertToCursor as mt, TextSelectionRenderManager as Mn } from "@univerjs/engine-render";
4
+ import { CommandType as A, RxDisposable as ke, ICommandService as N, Inject as ee, IUndoRedoService as ze, UndoCommandId as gt, RedoCommandId as ft, JSONX as B, IUniverInstanceService as U, LocaleService as tn, UniverInstanceType as te, DOCS_NORMAL_EDITOR_UNIT_ID_KEY as bt, DataStreamTreeTokenType as b, TextXActionType as M, TextX as $, toDisposable as Pt, normalizeBody as nn, getBodySlice as wt, updateAttributeByInsert as sn, Tools as ne, MemoryCursor as le, getDocsUpdateBody as on, UpdateDocsAttributeType as Ee, PositionedObjectLayoutType as Ut, getCustomRangeSlice as rn, getCustomDecorationSlice as an, BooleanNumber as K, BaselineOffset as Z, PRESET_LIST_TYPE as cn, GridType as dn, PresetListType as Bt, sortRulesFactory as ln, OnLifecycle as ue, LifecycleStages as ge, Disposable as fe, Direction as F, HorizontalAlign as me, Plugin as un, Injector as gn, createInterceptorKey as Lt, DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY as fn, remove as mn, composeInterceptors as hn, DisposableCollection as pn } from "@univerjs/core";
5
+ import { NORMAL_TEXT_SELECTION_PLUGIN_STYLE as Sn, ITextSelectionRenderManager as Ae, DocumentSkeleton as In, DocumentViewModel as _n, IRenderManagerService as he, hasListGlyph as vn, isIndentByGlyph as xn, isFirstGlyph as Rn, getParagraphByGlyph as On, getCharSpaceApply as Cn, getNumberUnitValue as Q, RANGE_DIRECTION as Ue, NodePositionConvertToCursor as mt, TextSelectionRenderManager as Mn } from "@univerjs/engine-render";
6
6
  import { BehaviorSubject as ae, takeUntil as Ft } from "rxjs";
7
7
  const He = {
8
8
  id: "doc.operation.set-selections",
@@ -144,16 +144,16 @@ let P = class extends ke {
144
144
  }
145
145
  };
146
146
  P = En([
147
- ht(0, Ee),
147
+ ht(0, Ae),
148
148
  ht(1, N)
149
149
  ], P);
150
150
  var An = Object.defineProperty, Nn = Object.getOwnPropertyDescriptor, Dn = (o, e, n, t) => {
151
151
  for (var s = t > 1 ? void 0 : t ? Nn(e, n) : e, r = o.length - 1, a; r >= 0; r--)
152
152
  (a = o[r]) && (s = (t ? a(e, n, s) : a(s)) || s);
153
153
  return t && s && An(e, n, s), s;
154
- }, Ue = (o, e) => (n, t) => e(n, t, o);
154
+ }, Be = (o, e) => (n, t) => e(n, t, o);
155
155
  const pt = 300;
156
- let Me = class extends ke {
156
+ let ye = class extends ke {
157
157
  constructor(e, n, t) {
158
158
  super();
159
159
  w(this, "_docStateChange$", new ae(null));
@@ -244,12 +244,12 @@ let Me = class extends ke {
244
244
  n.length = 0, this._docStateChange$.next(f);
245
245
  }
246
246
  };
247
- Me = Dn([
248
- Ue(0, ee(ze)),
249
- Ue(1, N),
250
- Ue(2, U)
251
- ], Me);
252
- class Ae {
247
+ ye = Dn([
248
+ Be(0, ee(ze)),
249
+ Be(1, N),
250
+ Be(2, U)
251
+ ], ye);
252
+ class Ne {
253
253
  constructor() {
254
254
  w(this, "_previousActiveRange", null);
255
255
  w(this, "_undoMutationParamsCache", []);
@@ -349,7 +349,7 @@ V = wn([
349
349
  St(1, ee(tn)),
350
350
  St(2, U)
351
351
  ], V);
352
- const It = "doc.mutation.rich-text-editing", F = {
352
+ const It = "doc.mutation.rich-text-editing", G = {
353
353
  id: It,
354
354
  type: A.MUTATION,
355
355
  // eslint-disable-next-line max-lines-per-function
@@ -366,10 +366,10 @@ const It = "doc.mutation.rich-text-editing", F = {
366
366
  isCompositionEnd: l,
367
367
  noNeedSetTextRange: d,
368
368
  debounce: g
369
- } = e, u = o.get(U), f = o.get(me), m = u.getUniverDocInstance(n), I = (T = f.getRenderById(n)) == null ? void 0 : T.with(V).getViewModel();
369
+ } = e, u = o.get(U), f = o.get(he), m = u.getUniverDocInstance(n), I = (T = f.getRenderById(n)) == null ? void 0 : T.with(V).getViewModel();
370
370
  if (m == null || I == null)
371
371
  throw new Error(`DocumentDataModel or documentViewModel not found for unitId: ${n}`);
372
- const p = o.get(P), S = ((C = p.getCurrentSelections()) != null ? C : []).map(se), _ = o.get(Me), O = o.get(Ae), E = !!m.getSnapshot().disabled;
372
+ const p = o.get(P), S = ((C = p.getCurrentSelections()) != null ? C : []).map(se), _ = o.get(ye), O = o.get(Ne), E = !!m.getSnapshot().disabled;
373
373
  if (B.isNoop(s) || s && s.length === 0 || E)
374
374
  return {
375
375
  unitId: n,
@@ -380,7 +380,7 @@ const It = "doc.mutation.rich-text-editing", F = {
380
380
  m.apply(s), I.reset(m), !d && r && c != null && queueMicrotask(() => {
381
381
  p.replaceTextRanges(r, !0, e.options);
382
382
  });
383
- const x = {
383
+ const R = {
384
384
  commandId: It,
385
385
  unitId: n,
386
386
  segmentId: t,
@@ -397,20 +397,20 @@ const It = "doc.mutation.rich-text-editing", F = {
397
397
  }
398
398
  };
399
399
  if (l) {
400
- const R = O.fetchComposedUndoRedoMutationParams();
401
- if (R == null)
400
+ const x = O.fetchComposedUndoRedoMutationParams();
401
+ if (x == null)
402
402
  throw new Error("historyParams is null in RichTextEditingMutation");
403
- const { undoMutationParams: y, redoMutationParams: D, previousActiveRange: $ } = R;
404
- x.redoState.actions = D.actions, x.undoState.actions = y.actions, x.undoState.textRanges = [$];
403
+ const { undoMutationParams: y, redoMutationParams: D, previousActiveRange: L } = x;
404
+ R.redoState.actions = D.actions, R.undoState.actions = y.actions, R.undoState.textRanges = [L];
405
405
  }
406
- return _.setChangeState(x), {
406
+ return _.setChangeState(R), {
407
407
  unitId: n,
408
408
  actions: v,
409
409
  textRanges: S
410
410
  };
411
411
  }
412
412
  };
413
- function Ge(o) {
413
+ function ie(o) {
414
414
  return o === b.CUSTOM_RANGE_END || o === b.CUSTOM_RANGE_START;
415
415
  }
416
416
  function Xe(o, e, n, t) {
@@ -425,13 +425,13 @@ function Ve(o, e, n, t) {
425
425
  const c = s.slice(0, r) + s.slice(r + e);
426
426
  for (let i = 0, l = c.length; i < l; i++) {
427
427
  const d = c[i];
428
- if (!Ge(d))
428
+ if (!ie(d))
429
429
  return !1;
430
430
  }
431
431
  return !0;
432
432
  }
433
433
  var j = /* @__PURE__ */ ((o) => (o[o.LEFT = 0] = "LEFT", o[o.RIGHT = 1] = "RIGHT", o))(j || {});
434
- function he(o) {
434
+ function pe(o) {
435
435
  const { startOffset: e, endOffset: n, collapsed: t } = o, s = Math.min(e, n), r = Math.max(e, n);
436
436
  return {
437
437
  startOffset: s,
@@ -440,7 +440,7 @@ function he(o) {
440
440
  };
441
441
  }
442
442
  function We(o, e) {
443
- let { startOffset: n, endOffset: t } = he(o);
443
+ let { startOffset: n, endOffset: t } = pe(o);
444
444
  for (; e.dataStream[n - 1] === b.CUSTOM_RANGE_START; )
445
445
  n -= 1;
446
446
  for (; e.dataStream[t] === b.CUSTOM_RANGE_END; )
@@ -450,15 +450,15 @@ function We(o, e) {
450
450
  endOffset: t
451
451
  };
452
452
  }
453
- function Ne(o, e, n = j.LEFT) {
453
+ function De(o, e, n = j.LEFT) {
454
454
  var c;
455
- let { startOffset: t, endOffset: s, collapsed: r } = he(o);
455
+ let { startOffset: t, endOffset: s, collapsed: r } = pe(o);
456
456
  if (r)
457
457
  if (n === j.LEFT)
458
- for (; e.dataStream[t - 1] === b.CUSTOM_RANGE_END; )
458
+ for (; ie(e.dataStream[t - 1]); )
459
459
  s -= 1, t -= 1;
460
460
  else
461
- for (; e.dataStream[t] === b.CUSTOM_RANGE_START; )
461
+ for (; ie(e.dataStream[t]); )
462
462
  s += 1, t += 1;
463
463
  else {
464
464
  const i = We(o, e);
@@ -476,7 +476,7 @@ function Ne(o, e, n = j.LEFT) {
476
476
  };
477
477
  }
478
478
  function Ye(o, e) {
479
- let { startOffset: n, endOffset: t, collapsed: s } = he(o);
479
+ let { startOffset: n, endOffset: t, collapsed: s } = pe(o);
480
480
  if (s) {
481
481
  for (; e.dataStream[t] === b.CUSTOM_RANGE_END; )
482
482
  t += 1, n += 1;
@@ -498,9 +498,9 @@ function Un(o, e) {
498
498
  return null;
499
499
  const n = e.customRanges;
500
500
  if (!n)
501
- return he(o);
501
+ return pe(o);
502
502
  let { startOffset: t, endOffset: s } = We(o, e);
503
- for (; Ge(e.dataStream[t]); ) {
503
+ for (; ie(e.dataStream[t]); ) {
504
504
  if (e.dataStream[t] === b.CUSTOM_RANGE_START) {
505
505
  const r = n.find((a) => a.startIndex === t);
506
506
  if (!r)
@@ -516,7 +516,7 @@ function Un(o, e) {
516
516
  }
517
517
  t += 1;
518
518
  }
519
- for (; Ge(e.dataStream[s - 1]); ) {
519
+ for (; ie(e.dataStream[s - 1]); ) {
520
520
  if (e.dataStream[t] === b.CUSTOM_RANGE_END) {
521
521
  const r = n.find((a) => a.endIndex === s - 1);
522
522
  if (!r)
@@ -579,7 +579,7 @@ function Gt(o, e, n, t) {
579
579
  }
580
580
  function Ke(o, e, n = "", t = 0) {
581
581
  var h;
582
- const { startOffset: s, endOffset: r } = Ne(o, e), a = [], { paragraphs: c = [], dataStream: i } = e, l = s - t, d = r - t, g = c == null ? void 0 : c.find(
582
+ const { startOffset: s, endOffset: r } = De(o, e), a = [], { paragraphs: c = [], dataStream: i } = e, l = s - t, d = r - t, g = c == null ? void 0 : c.find(
583
583
  (S) => S.startIndex - t >= l && S.startIndex - t < d
584
584
  ), u = (h = e.customRanges) == null ? void 0 : h.filter((S) => Xe(S.startIndex, S.endIndex, s, r)), f = new Set(u == null ? void 0 : u.filter((S) => Ve(s, r - s, S, i))), m = /* @__PURE__ */ new Set();
585
585
  if (u == null || u.forEach((S) => {
@@ -626,14 +626,14 @@ function Bs(o, e) {
626
626
  endOffset: i.startOffset + t.dataStream.length,
627
627
  collapsed: !0
628
628
  }], d = {
629
- id: F.id,
629
+ id: G.id,
630
630
  params: {
631
631
  unitId: n,
632
632
  actions: [],
633
633
  textRanges: l,
634
634
  debounce: !0
635
635
  }
636
- }, g = new G(), u = B.getInstance();
636
+ }, g = new $(), u = B.getInstance();
637
637
  return g.push(...Ke(i, c)), g.push({
638
638
  t: M.INSERT,
639
639
  body: t,
@@ -641,10 +641,10 @@ function Bs(o, e) {
641
641
  line: 0
642
642
  }), d.params.actions = u.editOp(g.serialize()), d;
643
643
  }
644
- var De = /* @__PURE__ */ ((o) => (o.MAIN = "__Document_Render_Main__", o.BACKGROUND = "__Document_Render_Background__", o))(De || {}), Ln = /* @__PURE__ */ ((o) => (o.VIEW_MAIN = "viewMain", o.VIEW_TOP = "viewTop", o.VIEW_LEFT = "viewLeft", o.VIEW_LEFT_TOP = "viewLeftTop", o))(Ln || {});
644
+ var be = /* @__PURE__ */ ((o) => (o.MAIN = "__Document_Render_Main__", o.BACKGROUND = "__Document_Render_Background__", o))(be || {}), Ln = /* @__PURE__ */ ((o) => (o.VIEW_MAIN = "viewMain", o.VIEW_TOP = "viewTop", o.VIEW_LEFT = "viewLeft", o.VIEW_LEFT_TOP = "viewLeftTop", o))(Ln || {});
645
645
  const Ls = 0, Fs = 2, Gs = 4, $s = 10, js = "normalTextSelectionPluginName";
646
646
  function ks(o) {
647
- const { mainComponent: e, scene: n, engine: t, components: s } = o, r = e, a = s.get(De.BACKGROUND);
647
+ const { mainComponent: e, scene: n, engine: t, components: s } = o, r = e, a = s.get(be.BACKGROUND);
648
648
  return {
649
649
  document: r,
650
650
  docBackground: a,
@@ -659,7 +659,7 @@ function Fn(o, e) {
659
659
  const t = n.getUnitId(), s = e.getRenderById(t);
660
660
  if (s == null)
661
661
  return;
662
- const { mainComponent: r, scene: a, engine: c, components: i } = s, l = r, d = i.get(De.BACKGROUND);
662
+ const { mainComponent: r, scene: a, engine: c, components: i } = s, l = r, d = i.get(be.BACKGROUND);
663
663
  return {
664
664
  document: l,
665
665
  docBackground: d,
@@ -671,7 +671,7 @@ function zs(o, e) {
671
671
  const n = e.getRenderById(o);
672
672
  if (n == null)
673
673
  return;
674
- const { mainComponent: t, scene: s, engine: r, components: a } = n, c = t, i = a.get(De.BACKGROUND);
674
+ const { mainComponent: t, scene: s, engine: r, components: a } = n, c = t, i = a.get(be.BACKGROUND);
675
675
  return {
676
676
  document: c,
677
677
  docBackground: i,
@@ -733,9 +733,9 @@ function Je(o, e = "", n, t) {
733
733
  }
734
734
  function $t(o, e) {
735
735
  var t;
736
- return (t = o.get(me).getRenderById(e)) == null ? void 0 : t.with(V);
736
+ return (t = o.get(he).getRenderById(e)) == null ? void 0 : t.with(V);
737
737
  }
738
- function z(o, e = "") {
738
+ function k(o, e = "") {
739
739
  if (!e)
740
740
  return ["body"];
741
741
  const { headers: n, footers: t } = o.getSnapshot();
@@ -747,7 +747,7 @@ function z(o, e = "") {
747
747
  return ["footers", e, "body"];
748
748
  throw new Error("Segment id not found in headers or footers");
749
749
  }
750
- const Gn = "doc.command.insert-text", ye = {
750
+ const Gn = "doc.command.insert-text", Te = {
751
751
  id: Gn,
752
752
  type: A.COMMAND,
753
753
  // eslint-disable-next-line max-lines-per-function
@@ -767,14 +767,14 @@ const Gn = "doc.command.insert-text", ye = {
767
767
  collapsed: p
768
768
  }
769
769
  ], _ = {
770
- id: F.id,
770
+ id: G.id,
771
771
  params: {
772
772
  unitId: a,
773
773
  actions: [],
774
774
  textRanges: c != null ? c : S,
775
775
  debounce: !0
776
776
  }
777
- }, O = new G(), E = B.getInstance();
777
+ }, O = new $(), E = B.getInstance();
778
778
  if (p)
779
779
  I > 0 && O.push({
780
780
  t: M.RETAIN,
@@ -782,10 +782,10 @@ const Gn = "doc.command.insert-text", ye = {
782
782
  segmentId: s
783
783
  });
784
784
  else {
785
- const { dos: C, retain: R } = Je(m, s, 0, f);
785
+ const { dos: C, retain: x } = Je(m, s, 0, f);
786
786
  O.push(...C), c || (_.params.textRanges = [{
787
- startOffset: I + h + R,
788
- endOffset: I + h + R,
787
+ startOffset: I + h + x,
788
+ endOffset: I + h + x,
789
789
  collapsed: p
790
790
  }]);
791
791
  }
@@ -796,10 +796,10 @@ const Gn = "doc.command.insert-text", ye = {
796
796
  line: 0,
797
797
  segmentId: s
798
798
  });
799
- const v = z(g, s);
799
+ const v = k(g, s);
800
800
  return _.params.actions = E.editOp(O.serialize(), v), !!n.syncExecuteCommand(_.id, _.params);
801
801
  }
802
- }, ie = {
802
+ }, ce = {
803
803
  id: "doc.command.delete-text",
804
804
  type: A.COMMAND,
805
805
  handler: async (o, e) => {
@@ -807,14 +807,14 @@ const Gn = "doc.command.insert-text", ye = {
807
807
  const n = o.get(N), t = o.get(U), { range: s, segmentId: r, unitId: a, direction: c, len: i = 1 } = e, l = t.getUnit(a, te.UNIVER_DOC), d = l == null ? void 0 : l.getSelfOrHeaderFooterModel(r).getBody();
808
808
  if (l == null || d == null)
809
809
  return !1;
810
- const { startOffset: g } = s, u = d.dataStream, f = c === j.LEFT ? g - i : g, m = f + i - 1, I = (C = d.customRanges) == null ? void 0 : C.filter((R) => Xe(R.startIndex, R.endIndex, f, m)), p = I == null ? void 0 : I.filter((R) => Ve(f, i, R, u)), h = [];
811
- for (let R = 0; R < i; R++)
812
- h.push(f + R);
813
- p == null || p.forEach((R) => {
814
- h.push(R.startIndex, R.endIndex);
815
- }), h.sort((R, y) => R - y);
810
+ const { startOffset: g } = s, u = d.dataStream, f = c === j.LEFT ? g - i : g, m = f + i - 1, I = (C = d.customRanges) == null ? void 0 : C.filter((x) => Xe(x.startIndex, x.endIndex, f, m)), p = I == null ? void 0 : I.filter((x) => Ve(f, i, x, u)), h = [];
811
+ for (let x = 0; x < i; x++)
812
+ h.push(f + x);
813
+ p == null || p.forEach((x) => {
814
+ h.push(x.startIndex, x.endIndex);
815
+ }), h.sort((x, y) => x - y);
816
816
  const S = h[0], _ = {
817
- id: F.id,
817
+ id: G.id,
818
818
  params: {
819
819
  unitId: a,
820
820
  actions: [],
@@ -825,10 +825,10 @@ const Gn = "doc.command.insert-text", ye = {
825
825
  }],
826
826
  debounce: !0
827
827
  }
828
- }, O = new G(), E = B.getInstance();
828
+ }, O = new $(), E = B.getInstance();
829
829
  let v = 0;
830
- for (let R = 0; R < h.length; R++) {
831
- const y = h[R];
830
+ for (let x = 0; x < h.length; x++) {
831
+ const y = h[x];
832
832
  y - v > 0 && O.push({
833
833
  t: M.RETAIN,
834
834
  len: y - v,
@@ -840,8 +840,8 @@ const Gn = "doc.command.insert-text", ye = {
840
840
  line: 0
841
841
  }), v = y + 1;
842
842
  }
843
- const x = z(l, r);
844
- return _.params.actions = E.editOp(O.serialize(), x), !!n.syncExecuteCommand(_.id, _.params);
843
+ const R = k(l, r);
844
+ return _.params.actions = E.editOp(O.serialize(), R), !!n.syncExecuteCommand(_.id, _.params);
845
845
  }
846
846
  }, jt = {
847
847
  id: "doc.command.update-text",
@@ -851,13 +851,13 @@ const Gn = "doc.command.insert-text", ye = {
851
851
  if (d == null)
852
852
  return !1;
853
853
  const g = {
854
- id: F.id,
854
+ id: G.id,
855
855
  params: {
856
856
  unitId: a,
857
857
  actions: [],
858
858
  textRanges: c
859
859
  }
860
- }, u = new G(), f = B.getInstance(), { startOffset: m, endOffset: I } = n;
860
+ }, u = new $(), f = B.getInstance(), { startOffset: m, endOffset: I } = n;
861
861
  u.push({
862
862
  t: M.RETAIN,
863
863
  len: m,
@@ -869,7 +869,7 @@ const Gn = "doc.command.insert-text", ye = {
869
869
  segmentId: t,
870
870
  coverType: r
871
871
  });
872
- const p = z(d, t);
872
+ const p = k(d, t);
873
873
  return g.params.actions = f.editOp(u.serialize(), p), !!i.syncExecuteCommand(g.id, g.params);
874
874
  }
875
875
  };
@@ -912,7 +912,7 @@ const $n = {
912
912
  },
913
913
  1,
914
914
  0
915
- ), await t.executeCommand(ye.id, {
915
+ ), await t.executeCommand(Te.id, {
916
916
  unitId: l,
917
917
  body: p,
918
918
  range: h,
@@ -920,7 +920,7 @@ const $n = {
920
920
  cursorOffset: 1
921
921
  });
922
922
  } else
923
- return await t.executeCommand(ye.id, {
923
+ return await t.executeCommand(Te.id, {
924
924
  unitId: l,
925
925
  body: {
926
926
  dataStream: b.PARAGRAPH,
@@ -934,22 +934,22 @@ const $n = {
934
934
  id: "doc.command.inner-paste",
935
935
  type: A.COMMAND,
936
936
  handler: async (o, e) => {
937
- const { segmentId: n, textRanges: t } = e, s = e.body, r = o.get(N), a = o.get(P), c = o.get(U), i = a.getCurrentSelections();
937
+ const { segmentId: n, textRanges: t, body: s } = e, r = o.get(N), a = o.get(P), c = o.get(U), i = a.getCurrentSelections();
938
938
  if (!Array.isArray(i) || i.length === 0)
939
939
  return !1;
940
940
  const l = c.getCurrentUniverDocInstance(), d = l == null ? void 0 : l.getSelfOrHeaderFooterModel(n).getBody();
941
941
  if (l == null || d == null)
942
942
  return !1;
943
943
  const g = l.getUnitId(), u = {
944
- id: F.id,
944
+ id: G.id,
945
945
  params: {
946
946
  unitId: g,
947
947
  actions: [],
948
948
  textRanges: t
949
949
  }
950
- }, f = new de();
950
+ }, f = new le();
951
951
  f.reset();
952
- const m = new G(), I = B.getInstance();
952
+ const m = new $(), I = B.getInstance();
953
953
  for (const S of i) {
954
954
  const { startOffset: _, endOffset: O, collapsed: E } = S, v = _ - f.cursor;
955
955
  if (E)
@@ -959,8 +959,8 @@ const $n = {
959
959
  segmentId: n
960
960
  });
961
961
  else {
962
- const { dos: x } = Je(S, n, f.cursor, d);
963
- m.push(...x);
962
+ const { dos: R } = Je(S, n, f.cursor, d);
963
+ m.push(...R);
964
964
  }
965
965
  m.push({
966
966
  t: M.INSERT,
@@ -970,7 +970,7 @@ const $n = {
970
970
  segmentId: n
971
971
  }), f.reset(), f.moveCursor(O);
972
972
  }
973
- const p = z(l, n);
973
+ const p = k(l, n);
974
974
  return u.params.actions = I.editOp(m.serialize(), p), !!r.syncExecuteCommand(u.id, u.params);
975
975
  }
976
976
  }, kt = {
@@ -978,49 +978,49 @@ const $n = {
978
978
  type: A.COMMAND,
979
979
  // eslint-disable-next-line max-lines-per-function
980
980
  handler: async (o, e) => {
981
- var v, x, T, C;
981
+ var v, R, T, C;
982
982
  const { segmentId: n, textRanges: t } = e, s = o.get(N), r = o.get(P), a = o.get(U), c = (v = e.selections) != null ? v : r.getCurrentSelections();
983
983
  if (!Array.isArray(c) || c.length === 0)
984
984
  return !1;
985
- const i = (x = a.getCurrentUniverDocInstance()) == null ? void 0 : x.getUnitId();
985
+ const i = (R = a.getCurrentUniverDocInstance()) == null ? void 0 : R.getUnitId();
986
986
  if (!i)
987
987
  return !1;
988
988
  const l = a.getUniverDocInstance(i), d = on(l.getSnapshot(), n);
989
989
  if (l == null || d == null)
990
990
  return !1;
991
991
  const g = {
992
- id: F.id,
992
+ id: G.id,
993
993
  params: {
994
994
  unitId: i,
995
995
  actions: [],
996
996
  textRanges: t
997
997
  }
998
- }, u = new de();
998
+ }, u = new le();
999
999
  u.reset();
1000
- const f = new G(), m = B.getInstance(), I = [];
1001
- for (const R of c) {
1002
- const { startOffset: y, endOffset: D, collapsed: $ } = R;
1000
+ const f = new $(), m = B.getInstance(), I = [];
1001
+ for (const x of c) {
1002
+ const { startOffset: y, endOffset: D, collapsed: L } = x;
1003
1003
  if (y == null || D == null)
1004
1004
  continue;
1005
1005
  const W = y - u.cursor;
1006
- $ ? f.push({
1006
+ L ? f.push({
1007
1007
  t: M.RETAIN,
1008
1008
  len: W,
1009
1009
  segmentId: n
1010
- }) : f.push(...Ke(R, d, n, u.cursor)), u.reset(), u.moveCursor(D);
1010
+ }) : f.push(...Ke(x, d, n, u.cursor)), u.reset(), u.moveCursor(D);
1011
1011
  }
1012
- const p = z(l, n);
1012
+ const p = k(l, n);
1013
1013
  I.push(m.editOp(f.serialize(), p));
1014
- const h = jn(d, c), S = (T = l.getDrawings()) != null ? T : {}, _ = (C = l.getDrawingsOrder()) != null ? C : [], O = h.sort((R, y) => _.indexOf(R) > _.indexOf(y) ? -1 : _.indexOf(R) < _.indexOf(y) ? 1 : 0);
1014
+ const h = jn(d, c), S = (T = l.getDrawings()) != null ? T : {}, _ = (C = l.getDrawingsOrder()) != null ? C : [], O = h.sort((x, y) => _.indexOf(x) > _.indexOf(y) ? -1 : _.indexOf(x) < _.indexOf(y) ? 1 : 0);
1015
1015
  if (O.length > 0)
1016
- for (const R of O) {
1017
- const y = S[R], D = _.indexOf(R);
1016
+ for (const x of O) {
1017
+ const y = S[x], D = _.indexOf(x);
1018
1018
  if (y == null || D < 0)
1019
1019
  continue;
1020
- const $ = m.removeOp(["drawings", R], y), W = m.removeOp(["drawingsOrder", D], R);
1021
- I.push($), I.push(W);
1020
+ const L = m.removeOp(["drawings", x], y), W = m.removeOp(["drawingsOrder", D], x);
1021
+ I.push(L), I.push(W);
1022
1022
  }
1023
- return g.params.actions = I.reduce((R, y) => B.compose(R, y), null), !!s.syncExecuteCommand(g.id, g.params);
1023
+ return g.params.actions = I.reduce((x, y) => B.compose(x, y), null), !!s.syncExecuteCommand(g.id, g.params);
1024
1024
  }
1025
1025
  };
1026
1026
  function jn(o, e) {
@@ -1039,7 +1039,7 @@ const qe = {
1039
1039
  id: "doc.command.delete-custom-block",
1040
1040
  type: A.COMMAND,
1041
1041
  handler: async (o, e) => {
1042
- var R;
1042
+ var y;
1043
1043
  const n = o.get(P), t = o.get(U), s = o.get(N), r = n.getActiveRange(), a = t.getCurrentUniverDocInstance();
1044
1044
  if (r == null || a == null)
1045
1045
  return !1;
@@ -1050,14 +1050,14 @@ const qe = {
1050
1050
  style: f
1051
1051
  }
1052
1052
  ], p = {
1053
- id: F.id,
1053
+ id: G.id,
1054
1054
  params: {
1055
1055
  unitId: l,
1056
1056
  actions: [],
1057
1057
  textRanges: I,
1058
1058
  prevTextRanges: [i]
1059
1059
  }
1060
- }, h = new G(), S = B.getInstance(), _ = [];
1060
+ }, h = new $(), S = B.getInstance(), _ = [];
1061
1061
  g > 0 && h.push({
1062
1062
  t: M.RETAIN,
1063
1063
  len: c === j.LEFT ? g - 1 : g,
@@ -1067,9 +1067,11 @@ const qe = {
1067
1067
  len: 1,
1068
1068
  line: 0,
1069
1069
  segmentId: u
1070
- }), _.push(S.editOp(h.serialize()));
1071
- const O = ((R = a.getDrawings()) != null ? R : {})[d], v = a.getDrawingsOrder().indexOf(d), x = S.removeOp(["drawings", d], O), T = S.removeOp(["drawingsOrder", v], d);
1072
- return _.push(x), _.push(T), p.params.actions = _.reduce((y, D) => B.compose(y, D), null), !!s.syncExecuteCommand(p.id, p.params);
1070
+ });
1071
+ const O = k(a, u);
1072
+ _.push(S.editOp(h.serialize(), O));
1073
+ const E = ((y = a.getDrawings()) != null ? y : {})[d], R = a.getDrawingsOrder().indexOf(d), T = S.removeOp(["drawings", d], E), C = S.removeOp(["drawingsOrder", R], d);
1074
+ return _.push(T), _.push(C), p.params.actions = _.reduce((D, L) => B.compose(D, L), null), !!s.syncExecuteCommand(p.id, p.params);
1073
1075
  }
1074
1076
  }, Qe = {
1075
1077
  id: "doc.command.merge-two-paragraph",
@@ -1083,46 +1085,46 @@ const qe = {
1083
1085
  const { segmentId: l, style: d } = c, g = t.getCurrentUniverDocInstance(), u = g == null ? void 0 : g.getSelfOrHeaderFooterModel(l).getBody();
1084
1086
  if (!g || !u)
1085
1087
  return !1;
1086
- const f = Ne(c, u), m = g.getUnitId(), { startOffset: I, collapsed: p } = f;
1088
+ const f = De(c, u), m = g.getUnitId(), { startOffset: I, collapsed: p } = f;
1087
1089
  if (!p)
1088
1090
  return !1;
1089
- const h = r === j.LEFT ? I : I + 1, S = (D = (y = u.paragraphs) == null ? void 0 : y.find(($) => $.startIndex >= h)) == null ? void 0 : D.startIndex, _ = Hn(o, m, u, h, S), O = r === j.LEFT ? I - 1 : I, E = [
1091
+ const h = r === j.LEFT ? I : I + 1, S = (D = (y = u.paragraphs) == null ? void 0 : y.find((L) => L.startIndex >= h)) == null ? void 0 : D.startIndex, _ = Hn(o, m, u, h, S), O = r === j.LEFT ? I - 1 : I, E = [
1090
1092
  {
1091
1093
  startOffset: O,
1092
1094
  endOffset: O,
1093
1095
  style: d
1094
1096
  }
1095
1097
  ], v = {
1096
- id: F.id,
1098
+ id: G.id,
1097
1099
  params: {
1098
1100
  unitId: m,
1099
1101
  actions: [],
1100
1102
  textRanges: E,
1101
1103
  prevTextRanges: [a]
1102
1104
  }
1103
- }, x = new G(), T = B.getInstance();
1104
- x.push({
1105
+ }, R = new $(), T = B.getInstance();
1106
+ R.push({
1105
1107
  t: M.RETAIN,
1106
1108
  len: r === j.LEFT ? I - 1 : I,
1107
1109
  segmentId: l
1108
- }), _.dataStream.length && x.push({
1110
+ }), _.dataStream.length && R.push({
1109
1111
  t: M.INSERT,
1110
1112
  body: _,
1111
1113
  len: _.dataStream.length,
1112
1114
  line: 0,
1113
1115
  segmentId: l
1114
- }), x.push({
1116
+ }), R.push({
1115
1117
  t: M.RETAIN,
1116
1118
  len: 1,
1117
1119
  segmentId: l
1118
- }), x.push({
1120
+ }), R.push({
1119
1121
  t: M.DELETE,
1120
1122
  len: S + 1 - h,
1121
1123
  line: 0,
1122
1124
  segmentId: l
1123
1125
  });
1124
- const C = z(g, l);
1125
- return v.params.actions = T.editOp(x.serialize(), C), !!s.syncExecuteCommand(v.id, v.params);
1126
+ const C = k(g, l);
1127
+ return v.params.actions = T.editOp(R.serialize(), C), !!s.syncExecuteCommand(v.id, v.params);
1126
1128
  }
1127
1129
  }, kn = {
1128
1130
  id: "doc.command.delete-left",
@@ -1141,24 +1143,24 @@ const qe = {
1141
1143
  const { segmentId: g, style: u, segmentPage: f } = i, m = r.getSelfOrHeaderFooterModel(g).getBody();
1142
1144
  if (m == null)
1143
1145
  return !1;
1144
- const I = Ne(i, m), { startOffset: p, collapsed: h } = I, S = d.findNodeByCharIndex(p, g, f), _ = vn(S), O = Rn(S, m);
1146
+ const I = De(i, m), { startOffset: p, collapsed: h } = I, S = d.findNodeByCharIndex(p, g, f), _ = vn(S), O = xn(S, m);
1145
1147
  let E = p;
1146
1148
  const v = d.findNodeByCharIndex(p - 1, g, f);
1147
- if (xn(S) && v !== S && (_ === !0 || O === !0) && h) {
1148
- const R = On(S, m);
1149
- if (R == null)
1149
+ if (Rn(S) && v !== S && (_ === !0 || O === !0) && h) {
1150
+ const x = On(S, m);
1151
+ if (x == null)
1150
1152
  return !1;
1151
- const y = R == null ? void 0 : R.startIndex, D = { startIndex: 0 }, $ = R.paragraphStyle;
1153
+ const y = x == null ? void 0 : x.startIndex, D = { startIndex: 0 }, L = x.paragraphStyle;
1152
1154
  if (_ === !0) {
1153
- const X = R.paragraphStyle;
1155
+ const X = x.paragraphStyle;
1154
1156
  if (X) {
1155
1157
  D.paragraphStyle = X;
1156
1158
  const { hanging: oe } = X;
1157
1159
  oe && (D.paragraphStyle.indentStart = oe, D.paragraphStyle.hanging = void 0);
1158
1160
  }
1159
1161
  } else if (O === !0) {
1160
- const X = R.bullet;
1161
- X && (D.bullet = X), $ != null && (D.paragraphStyle = { ...$ }, delete D.paragraphStyle.hanging, delete D.paragraphStyle.indentStart);
1162
+ const X = x.bullet;
1163
+ X && (D.bullet = X), L != null && (D.paragraphStyle = { ...L }, delete D.paragraphStyle.hanging, delete D.paragraphStyle.indentStart);
1162
1164
  }
1163
1165
  const W = [
1164
1166
  {
@@ -1178,7 +1180,7 @@ const qe = {
1178
1180
  endOffset: y + 1
1179
1181
  },
1180
1182
  textRanges: W,
1181
- coverType: Te.REPLACE,
1183
+ coverType: Ee.REPLACE,
1182
1184
  segmentId: g
1183
1185
  });
1184
1186
  } else if (h === !0) {
@@ -1190,10 +1192,10 @@ const qe = {
1190
1192
  range: I
1191
1193
  });
1192
1194
  else if (v.streamType === "\b") {
1193
- const R = (C = r.getSnapshot().drawings) == null ? void 0 : C[(T = v.drawingId) != null ? T : ""];
1194
- if (R == null)
1195
+ const x = (C = r.getSnapshot().drawings) == null ? void 0 : C[(T = v.drawingId) != null ? T : ""];
1196
+ if (x == null)
1195
1197
  return !0;
1196
- if (R.layoutType === Ut.INLINE) {
1198
+ if (x.layoutType === Ut.INLINE) {
1197
1199
  const D = r.getUnitId();
1198
1200
  s = await t.executeCommand(qe.id, {
1199
1201
  direction: j.LEFT,
@@ -1206,14 +1208,14 @@ const qe = {
1206
1208
  if (D == null)
1207
1209
  return !0;
1208
1210
  E -= v.count, E -= D.count;
1209
- const $ = [
1211
+ const L = [
1210
1212
  {
1211
1213
  startOffset: E,
1212
1214
  endOffset: E,
1213
1215
  style: u
1214
1216
  }
1215
1217
  ];
1216
- s = await t.executeCommand(ie.id, {
1218
+ s = await t.executeCommand(ce.id, {
1217
1219
  unitId: r.getUnitId(),
1218
1220
  range: {
1219
1221
  ...i,
@@ -1223,11 +1225,11 @@ const qe = {
1223
1225
  segmentId: g,
1224
1226
  direction: j.LEFT,
1225
1227
  len: D.count,
1226
- textRanges: $
1228
+ textRanges: L
1227
1229
  });
1228
1230
  }
1229
1231
  } else
1230
- E -= v.count, s = await t.executeCommand(ie.id, {
1232
+ E -= v.count, s = await t.executeCommand(ce.id, {
1231
1233
  unitId: r.getUnitId(),
1232
1234
  range: I,
1233
1235
  segmentId: g,
@@ -1235,10 +1237,10 @@ const qe = {
1235
1237
  len: v.count
1236
1238
  });
1237
1239
  } else {
1238
- const R = zt(I, [I]);
1240
+ const x = zt(I, [I]);
1239
1241
  s = await t.executeCommand(kt.id, {
1240
1242
  segmentId: g,
1241
- textRanges: R,
1243
+ textRanges: x,
1242
1244
  selections: [I]
1243
1245
  });
1244
1246
  }
@@ -1259,7 +1261,7 @@ const qe = {
1259
1261
  const { segmentId: l, style: d, segmentPage: g } = a, u = t == null ? void 0 : t.getSelfOrHeaderFooterModel(l).getBody();
1260
1262
  if (!t || !u)
1261
1263
  return !1;
1262
- const f = Ne(a, u, j.RIGHT), { startOffset: m, endOffset: I, collapsed: p } = f;
1264
+ const f = De(a, u, j.RIGHT), { startOffset: m, endOffset: I, collapsed: p } = f;
1263
1265
  if (m === u.dataStream.length - 2 && p)
1264
1266
  return !0;
1265
1267
  let h = !1;
@@ -1292,7 +1294,7 @@ const qe = {
1292
1294
  style: d
1293
1295
  }
1294
1296
  ];
1295
- h = await r.executeCommand(ie.id, {
1297
+ h = await r.executeCommand(ce.id, {
1296
1298
  unitId: t.getUnitId(),
1297
1299
  range: {
1298
1300
  ...a,
@@ -1313,7 +1315,7 @@ const qe = {
1313
1315
  style: d
1314
1316
  }
1315
1317
  ];
1316
- h = await r.executeCommand(ie.id, {
1318
+ h = await r.executeCommand(ce.id, {
1317
1319
  unitId: t.getUnitId(),
1318
1320
  range: f,
1319
1321
  segmentId: l,
@@ -1385,7 +1387,7 @@ const Ht = {
1385
1387
  type: A.COMMAND,
1386
1388
  // eslint-disable-next-line max-lines-per-function
1387
1389
  handler: async (o, e) => {
1388
- const { unitId: n, newText: t, oldTextLen: s, isCompositionEnd: r, isCompositionStart: a } = e, c = o.get(N), i = o.get(Ae), d = o.get(U).getCurrentUniverDocInstance();
1390
+ const { unitId: n, newText: t, oldTextLen: s, isCompositionEnd: r, isCompositionStart: a } = e, c = o.get(N), i = o.get(Ne), d = o.get(U).getCurrentUniverDocInstance();
1389
1391
  if (d == null)
1390
1392
  return !1;
1391
1393
  const g = i.getActiveRange();
@@ -1404,15 +1406,15 @@ const Ht = {
1404
1406
  style: f
1405
1407
  }
1406
1408
  ], _ = {
1407
- id: F.id,
1409
+ id: G.id,
1408
1410
  params: {
1409
1411
  unitId: n,
1410
1412
  actions: [],
1411
1413
  textRanges: S
1412
1414
  }
1413
- }, O = new G(), E = B.getInstance();
1415
+ }, O = new $(), E = B.getInstance();
1414
1416
  if (!g.collapsed && a) {
1415
- const { dos: T, retain: C, cursor: R } = Je(g, m, 0, I);
1417
+ const { dos: T, retain: C, cursor: x } = Je(g, m, 0, I);
1416
1418
  O.push(...T), _.params.textRanges = [{
1417
1419
  startOffset: u + h + C,
1418
1420
  endOffset: u + h + C,
@@ -1438,10 +1440,10 @@ const Ht = {
1438
1440
  line: 0,
1439
1441
  segmentId: m
1440
1442
  });
1441
- const v = z(d, m);
1443
+ const v = k(d, m);
1442
1444
  _.params.actions = E.editOp(O.serialize(), v), _.params.noHistory = !r, _.params.isCompositionEnd = r;
1443
- const x = c.syncExecuteCommand(_.id, _.params);
1444
- return i.pushUndoRedoMutationParams(x, _.params), !!x;
1445
+ const R = c.syncExecuteCommand(_.id, _.params);
1446
+ return i.pushUndoRedoMutationParams(R, _.params), !!R;
1445
1447
  }
1446
1448
  };
1447
1449
  function H(o, e, n, t) {
@@ -1465,25 +1467,25 @@ const vt = "doc.command.set-inline-format-bold", et = {
1465
1467
  n
1466
1468
  );
1467
1469
  }
1468
- }, Rt = "doc.command.set-inline-format-italic", tt = {
1469
- id: Rt,
1470
+ }, xt = "doc.command.set-inline-format-italic", tt = {
1471
+ id: xt,
1470
1472
  type: A.COMMAND,
1471
1473
  handler: async (o, e) => {
1472
1474
  const n = o.get(N), t = o.get(P);
1473
1475
  return H(
1474
- Rt,
1476
+ xt,
1475
1477
  e,
1476
1478
  t,
1477
1479
  n
1478
1480
  );
1479
1481
  }
1480
- }, xt = "doc.command.set-inline-format-underline", nt = {
1481
- id: xt,
1482
+ }, Rt = "doc.command.set-inline-format-underline", nt = {
1483
+ id: Rt,
1482
1484
  type: A.COMMAND,
1483
1485
  handler: async (o, e) => {
1484
1486
  const n = o.get(N), t = o.get(P);
1485
1487
  return H(
1486
- xt,
1488
+ Rt,
1487
1489
  e,
1488
1490
  t,
1489
1491
  n
@@ -1501,7 +1503,7 @@ const vt = "doc.command.set-inline-format-bold", et = {
1501
1503
  n
1502
1504
  );
1503
1505
  }
1504
- }, Ct = "doc.command.set-inline-format-subscript", ce = {
1506
+ }, Ct = "doc.command.set-inline-format-subscript", de = {
1505
1507
  id: Ct,
1506
1508
  type: A.COMMAND,
1507
1509
  handler: async (o, e) => {
@@ -1595,7 +1597,7 @@ const vt = "doc.command.set-inline-format-bold", et = {
1595
1597
  [it.id]: "cl",
1596
1598
  [ct.id]: "bg",
1597
1599
  [dt.id]: "bg",
1598
- [ce.id]: "va",
1600
+ [de.id]: "va",
1599
1601
  [ot.id]: "va"
1600
1602
  }, Vt = {
1601
1603
  id: "doc.command.set-inline-format",
@@ -1615,7 +1617,7 @@ const vt = "doc.command.set-inline-format-bold", et = {
1615
1617
  case tt.id:
1616
1618
  case nt.id:
1617
1619
  case st.id:
1618
- case ce.id:
1620
+ case de.id:
1619
1621
  case ot.id: {
1620
1622
  g = Vn(
1621
1623
  l.getSelfOrHeaderFooterModel(n).getBody().textRuns,
@@ -1646,13 +1648,13 @@ const vt = "doc.command.set-inline-format-bold", et = {
1646
1648
  throw new Error(`Unknown command: ${s} in handleInlineFormat`);
1647
1649
  }
1648
1650
  const u = {
1649
- id: F.id,
1651
+ id: G.id,
1650
1652
  params: {
1651
1653
  unitId: d,
1652
1654
  actions: [],
1653
1655
  textRanges: i.map(se)
1654
1656
  }
1655
- }, f = new G(), m = B.getInstance(), I = new de();
1657
+ }, f = new $(), m = B.getInstance(), I = new le();
1656
1658
  I.reset();
1657
1659
  for (const S of i) {
1658
1660
  const { startOffset: _, endOffset: O } = S, E = {
@@ -1678,7 +1680,7 @@ const vt = "doc.command.set-inline-format-bold", et = {
1678
1680
  segmentId: n
1679
1681
  }), I.reset(), I.moveCursor(O);
1680
1682
  }
1681
- const p = z(l, n);
1683
+ const p = k(l, n);
1682
1684
  return u.params.actions = m.editOp(f.serialize(), p), !!r.syncExecuteCommand(u.id, u.params);
1683
1685
  }
1684
1686
  };
@@ -1704,53 +1706,53 @@ function Vn(o, e, n) {
1704
1706
  s: K.TRUE
1705
1707
  };
1706
1708
  if (/va/.test(r))
1707
- return e === ce.id ? (d == null ? void 0 : d[r]) === Z.SUBSCRIPT ? Z.NORMAL : Z.SUBSCRIPT : (d == null ? void 0 : d[r]) === Z.SUPERSCRIPT ? Z.NORMAL : Z.SUPERSCRIPT;
1709
+ return e === de.id ? (d == null ? void 0 : d[r]) === Z.SUBSCRIPT ? Z.NORMAL : Z.SUBSCRIPT : (d == null ? void 0 : d[r]) === Z.SUPERSCRIPT ? Z.NORMAL : Z.SUPERSCRIPT;
1708
1710
  t++;
1709
1711
  }
1710
1712
  }
1711
1713
  return /bl|it/.test(r) ? K.TRUE : /ul|st/.test(r) ? {
1712
1714
  s: K.TRUE
1713
- } : e === ce.id ? Z.SUBSCRIPT : Z.SUPERSCRIPT;
1715
+ } : e === de.id ? Z.SUBSCRIPT : Z.SUPERSCRIPT;
1714
1716
  }
1715
1717
  const lt = {
1716
1718
  id: "doc.command.list-operation",
1717
1719
  type: A.COMMAND,
1718
1720
  // eslint-disable-next-line max-lines-per-function
1719
1721
  handler: (o, e) => {
1720
- var y, D, $, W, X, oe;
1722
+ var y, D, L, W, X, oe;
1721
1723
  const n = o.get(P), t = o.get(U), s = o.get(N), { listType: r } = e, a = t.getCurrentUniverDocInstance(), c = n.getActiveRange();
1722
1724
  if (a == null || c == null)
1723
1725
  return !1;
1724
1726
  const { segmentId: i } = c, l = (y = n.getCurrentSelections()) != null ? y : [], d = (D = a.getSelfOrHeaderFooterModel(i).getBody()) == null ? void 0 : D.paragraphs, g = l.map(se);
1725
1727
  if (d == null)
1726
1728
  return !1;
1727
- const u = (W = ($ = a.getSelfOrHeaderFooterModel(i).getBody()) == null ? void 0 : $.sectionBreaks) != null ? W : [], f = Wt(c, d), m = a.getUnitId(), I = f.every((J) => {
1728
- var k;
1729
- return ((k = J.bullet) == null ? void 0 : k.listType) === r;
1729
+ const u = (W = (L = a.getSelfOrHeaderFooterModel(i).getBody()) == null ? void 0 : L.sectionBreaks) != null ? W : [], f = Wt(c, d), m = a.getUnitId(), I = f.every((J) => {
1730
+ var z;
1731
+ return ((z = J.bullet) == null ? void 0 : z.listType) === r;
1730
1732
  });
1731
1733
  let h = ne.generateRandomId(6);
1732
1734
  if (f.length === 1) {
1733
- const J = d.indexOf(f[0]), k = d[J - 1], Y = d[J + 1];
1734
- k && k.bullet && k.bullet.listType === r ? h = k.bullet.listId : Y && Y.bullet && Y.bullet.listType === r && (h = Y.bullet.listId);
1735
+ const J = d.indexOf(f[0]), z = d[J - 1], Y = d[J + 1];
1736
+ z && z.bullet && z.bullet.listType === r ? h = z.bullet.listId : Y && Y.bullet && Y.bullet.listType === r && (h = Y.bullet.listId);
1735
1737
  }
1736
1738
  const S = {
1737
- id: F.id,
1739
+ id: G.id,
1738
1740
  params: {
1739
1741
  unitId: m,
1740
1742
  actions: [],
1741
1743
  textRanges: g
1742
1744
  }
1743
- }, _ = new de();
1745
+ }, _ = new le();
1744
1746
  _.reset();
1745
- const O = new G(), E = B.getInstance(), v = (X = a.getSnapshot().lists) != null ? X : {}, x = {
1747
+ const O = new $(), E = B.getInstance(), v = (X = a.getSnapshot().lists) != null ? X : {}, R = {
1746
1748
  ...cn,
1747
1749
  ...v
1748
1750
  }, { defaultTabStop: T = 36 } = a.getSnapshot().documentStyle;
1749
1751
  for (const J of f) {
1750
- const { startIndex: k, paragraphStyle: Y = {} } = J, { indentFirstLine: Kt, snapToGrid: Zt, indentStart: be } = Y, { hanging: Pe, indentStart: ut } = x[r].nestingLevel[0], { charSpace: Jt, gridType: qt } = Kn(k, u) || { charSpace: 0, gridType: dn.LINES }, q = Cn(Jt, T, qt, Zt);
1752
+ const { startIndex: z, paragraphStyle: Y = {} } = J, { indentFirstLine: Kt, snapToGrid: Zt, indentStart: Pe } = Y, { hanging: we, indentStart: ut } = R[r].nestingLevel[0], { charSpace: Jt, gridType: qt } = Kn(z, u) || { charSpace: 0, gridType: dn.LINES }, q = Cn(Jt, T, qt, Zt);
1751
1753
  O.push({
1752
1754
  t: M.RETAIN,
1753
- len: k - _.cursor,
1755
+ len: z - _.cursor,
1754
1756
  segmentId: i
1755
1757
  }), O.push({
1756
1758
  t: M.RETAIN,
@@ -1762,7 +1764,7 @@ const lt = {
1762
1764
  paragraphStyle: {
1763
1765
  ...Y,
1764
1766
  hanging: void 0,
1765
- indentStart: be ? { v: Math.max(0, Q(be, q) + Q(Pe, q) - Q(ut, q)) } : void 0
1767
+ indentStart: Pe ? { v: Math.max(0, Q(Pe, q) + Q(we, q) - Q(ut, q)) } : void 0
1766
1768
  },
1767
1769
  startIndex: 0
1768
1770
  } : {
@@ -1770,8 +1772,8 @@ const lt = {
1770
1772
  paragraphStyle: {
1771
1773
  ...Y,
1772
1774
  indentFirstLine: void 0,
1773
- hanging: Pe,
1774
- indentStart: { v: Q(ut, q) - Q(Pe, q) + Q(Kt, q) + Q(be, q) }
1775
+ hanging: we,
1776
+ indentStart: { v: Q(ut, q) - Q(we, q) + Q(Kt, q) + Q(Pe, q) }
1775
1777
  },
1776
1778
  bullet: {
1777
1779
  ...(oe = J.bullet) != null ? oe : {
@@ -1787,10 +1789,10 @@ const lt = {
1787
1789
  ]
1788
1790
  },
1789
1791
  segmentId: i,
1790
- coverType: Te.REPLACE
1791
- }), _.moveCursorTo(k + 1);
1792
+ coverType: Ee.REPLACE
1793
+ }), _.moveCursorTo(z + 1);
1792
1794
  }
1793
- const C = z(a, i);
1795
+ const C = k(a, i);
1794
1796
  return S.params.actions = E.editOp(O.serialize(), C), !!s.syncExecuteCommand(S.id, S.params);
1795
1797
  }
1796
1798
  }, Wn = {
@@ -1849,13 +1851,13 @@ const Zn = {
1849
1851
  };
1850
1852
  function Yt(o, e, n, t, s) {
1851
1853
  const r = {
1852
- id: F.id,
1854
+ id: G.id,
1853
1855
  params: {
1854
1856
  unitId: o,
1855
1857
  actions: [],
1856
1858
  textRanges: []
1857
1859
  }
1858
- }, a = new G(), c = B.getInstance(), i = (t == null ? void 0 : t.dataStream.length) - 2;
1860
+ }, a = new $(), c = B.getInstance(), i = (t == null ? void 0 : t.dataStream.length) - 2;
1859
1861
  i > 0 && a.push({
1860
1862
  t: M.DELETE,
1861
1863
  len: i,
@@ -1868,7 +1870,7 @@ function Yt(o, e, n, t, s) {
1868
1870
  line: 0,
1869
1871
  segmentId: e
1870
1872
  });
1871
- const l = z(n, e);
1873
+ const l = k(n, e);
1872
1874
  return r.params.actions = c.editOp(a.serialize(), l), r;
1873
1875
  }
1874
1876
  A.COMMAND;
@@ -1878,7 +1880,7 @@ const qn = (o, e) => {
1878
1880
  ...ne.deepClone(e),
1879
1881
  zoomRatio: t
1880
1882
  };
1881
- }, ve = {
1883
+ }, xe = {
1882
1884
  id: "doc.operation.set-zoom-ratio",
1883
1885
  type: A.OPERATION,
1884
1886
  handler: (o, e) => {
@@ -1904,10 +1906,10 @@ const qn = (o, e) => {
1904
1906
  zoomRatio: a,
1905
1907
  unitId: r
1906
1908
  }, l = qn(o, i);
1907
- return n.syncExecuteCommand(ve.id, i) ? (t.pushUndoRedo({
1909
+ return n.syncExecuteCommand(xe.id, i) ? (t.pushUndoRedo({
1908
1910
  unitID: r,
1909
- undoMutations: [{ id: ve.id, params: l }],
1910
- redoMutations: [{ id: ve.id, params: i }]
1911
+ undoMutations: [{ id: xe.id, params: l }],
1912
+ redoMutations: [{ id: xe.id, params: i }]
1911
1913
  }), !0) : !1;
1912
1914
  }
1913
1915
  }, $e = {
@@ -1942,7 +1944,7 @@ var ts = Object.defineProperty, ns = Object.getOwnPropertyDescriptor, ss = (o, e
1942
1944
  (a = o[r]) && (s = (t ? a(e, n, s) : a(s)) || s);
1943
1945
  return t && s && ts(e, n, s), s;
1944
1946
  }, re = (o, e) => (n, t) => e(n, t, o);
1945
- let Re = class extends ge {
1947
+ let Re = class extends fe {
1946
1948
  constructor(e, n, t, s, r) {
1947
1949
  super();
1948
1950
  w(this, "_previousIMEContent", "");
@@ -2002,19 +2004,19 @@ let Re = class extends ge {
2002
2004
  }
2003
2005
  };
2004
2006
  Re = ss([
2005
- le(ue.Rendered, Re),
2007
+ ue(ge.Rendered, Re),
2006
2008
  re(0, U),
2007
- re(1, me),
2008
- re(2, Ee),
2009
- re(3, ee(Ae)),
2009
+ re(1, he),
2010
+ re(2, Ae),
2011
+ re(3, ee(Ne)),
2010
2012
  re(4, N)
2011
2013
  ], Re);
2012
2014
  var os = Object.defineProperty, rs = Object.getOwnPropertyDescriptor, as = (o, e, n, t) => {
2013
2015
  for (var s = t > 1 ? void 0 : t ? rs(e, n) : e, r = o.length - 1, a; r >= 0; r--)
2014
2016
  (a = o[r]) && (s = (t ? a(e, n, s) : a(s)) || s);
2015
2017
  return t && s && os(e, n, s), s;
2016
- }, Se = (o, e) => (n, t) => e(n, t, o);
2017
- let xe = class extends ge {
2018
+ }, Ie = (o, e) => (n, t) => e(n, t, o);
2019
+ let Oe = class extends fe {
2018
2020
  constructor(e, n, t, s) {
2019
2021
  super();
2020
2022
  w(this, "_onInputSubscription");
@@ -2063,24 +2065,24 @@ let xe = class extends ge {
2063
2065
  segmentPage: I
2064
2066
  } = n;
2065
2067
  if (t.length > 1) {
2066
- let v = Number.POSITIVE_INFINITY, x = Number.NEGATIVE_INFINITY;
2068
+ let v = Number.POSITIVE_INFINITY, R = Number.NEGATIVE_INFINITY;
2067
2069
  for (const T of t)
2068
- v = Math.min(v, T.startOffset), x = Math.max(x, T.endOffset);
2070
+ v = Math.min(v, T.startOffset), R = Math.max(R, T.endOffset);
2069
2071
  this._textSelectionManagerService.replaceTextRanges([
2070
2072
  {
2071
- startOffset: e === L.LEFT || e === L.UP ? x : v,
2072
- endOffset: e === L.LEFT || e === L.UP ? v : x,
2073
+ startOffset: e === F.LEFT || e === F.UP ? R : v,
2074
+ endOffset: e === F.LEFT || e === F.UP ? v : R,
2073
2075
  style: l
2074
2076
  }
2075
2077
  ], !1);
2076
2078
  return;
2077
2079
  }
2078
- const p = d || g === we.FORWARD ? c : i;
2079
- let h = d || g === we.FORWARD ? i : c;
2080
+ const p = d || g === Ue.FORWARD ? c : i;
2081
+ let h = d || g === Ue.FORWARD ? i : c;
2080
2082
  const S = (O = s.getSelfOrHeaderFooterModel(u).getBody().dataStream.length) != null ? O : Number.POSITIVE_INFINITY;
2081
- if (e === L.LEFT || e === L.RIGHT) {
2082
- const v = r.findNodeByCharIndex(h - 1, u, I), x = r.findNodeByCharIndex(h, u, I);
2083
- h = e === L.RIGHT ? h + x.count : h - ((E = v == null ? void 0 : v.count) != null ? E : 0), h = Math.min(S - 2, Math.max(0, h)), this._textSelectionManagerService.replaceTextRanges([
2083
+ if (e === F.LEFT || e === F.RIGHT) {
2084
+ const v = r.findNodeByCharIndex(h - 1, u, I), R = r.findNodeByCharIndex(h, u, I);
2085
+ h = e === F.RIGHT ? h + R.count : h - ((E = v == null ? void 0 : v.count) != null ? E : 0), h = Math.min(S - 2, Math.max(0, h)), this._textSelectionManagerService.replaceTextRanges([
2084
2086
  {
2085
2087
  startOffset: p,
2086
2088
  endOffset: h,
@@ -2088,9 +2090,9 @@ let xe = class extends ge {
2088
2090
  }
2089
2091
  ], !1);
2090
2092
  } else {
2091
- const v = r.findNodeByCharIndex(h, u, I), x = a.document.getOffsetConfig(), T = d ? f : g === we.FORWARD ? m : f, C = this._getTopOrBottomPosition(r, v, T, e === L.DOWN);
2093
+ const v = r.findNodeByCharIndex(h, u, I), R = a.document.getOffsetConfig(), T = d ? f : g === Ue.FORWARD ? m : f, C = this._getTopOrBottomPosition(r, v, T, e === F.DOWN);
2092
2094
  if (C == null) {
2093
- const y = e === L.UP ? 0 : S - 2;
2095
+ const y = e === F.UP ? 0 : S - 2;
2094
2096
  if (y === h)
2095
2097
  return;
2096
2098
  this._textSelectionManagerService.replaceTextRanges([
@@ -2102,14 +2104,14 @@ let xe = class extends ge {
2102
2104
  ], !1);
2103
2105
  return;
2104
2106
  }
2105
- const R = new mt(x, r).getRangePointData(
2107
+ const x = new mt(R, r).getRangePointData(
2106
2108
  C,
2107
2109
  C
2108
2110
  ).cursorList[0];
2109
2111
  this._textSelectionManagerService.replaceTextRanges([
2110
2112
  {
2111
2113
  startOffset: p,
2112
- endOffset: R.endOffset,
2114
+ endOffset: x.endOffset,
2113
2115
  style: l
2114
2116
  }
2115
2117
  ], !1);
@@ -2125,26 +2127,26 @@ let xe = class extends ge {
2125
2127
  if (n == null || r == null || a == null || t == null || c == null)
2126
2128
  return;
2127
2129
  const { startOffset: i, endOffset: l, style: d, collapsed: g, segmentId: u, startNodePosition: f, endNodePosition: m, segmentPage: I } = n, p = (_ = s.getSelfOrHeaderFooterModel(u).getBody().dataStream.length) != null ? _ : Number.POSITIVE_INFINITY, h = (O = s.getCustomRanges()) != null ? O : [];
2128
- if (e === L.LEFT || e === L.RIGHT) {
2130
+ if (e === F.LEFT || e === F.RIGHT) {
2129
2131
  let v;
2130
2132
  if (!n.collapsed || t.length > 1) {
2131
- let C = Number.POSITIVE_INFINITY, R = Number.NEGATIVE_INFINITY;
2133
+ let C = Number.POSITIVE_INFINITY, x = Number.NEGATIVE_INFINITY;
2132
2134
  for (const y of t)
2133
- C = Math.min(C, y.startOffset), R = Math.max(R, y.endOffset);
2134
- v = e === L.LEFT ? C : R;
2135
+ C = Math.min(C, y.startOffset), x = Math.max(x, y.endOffset);
2136
+ v = e === F.LEFT ? C : x;
2135
2137
  } else {
2136
- const C = r.findNodeByCharIndex(i - 1, u, I), R = r.findNodeByCharIndex(i, u, I);
2137
- e === L.LEFT ? v = Math.max(0, i - ((E = C == null ? void 0 : C.count) != null ? E : 0)) : v = Math.min(p - 2, l + R.count);
2138
+ const C = r.findNodeByCharIndex(i - 1, u, I), x = r.findNodeByCharIndex(i, u, I);
2139
+ e === F.LEFT ? v = Math.max(0, i - ((E = C == null ? void 0 : C.count) != null ? E : 0)) : v = Math.min(p - 2, l + x.count);
2138
2140
  }
2139
- const x = [b.CUSTOM_RANGE_START, b.CUSTOM_RANGE_END];
2140
- if (e === L.LEFT)
2141
- for (; x.includes(c.dataStream[v]); )
2141
+ const R = [b.CUSTOM_RANGE_START, b.CUSTOM_RANGE_END];
2142
+ if (e === F.LEFT)
2143
+ for (; R.includes(c.dataStream[v]); )
2142
2144
  v--;
2143
2145
  else
2144
- for (; x.includes(c.dataStream[v - 1]); )
2146
+ for (; R.includes(c.dataStream[v - 1]); )
2145
2147
  v++;
2146
2148
  h.filter((C) => C.wholeEntity && C.startIndex < v && C.endIndex >= v).forEach((C) => {
2147
- e === L.LEFT ? v = Math.min(C.startIndex, v) : v = Math.max(C.endIndex + 1, v);
2149
+ e === F.LEFT ? v = Math.min(C.startIndex, v) : v = Math.max(C.endIndex + 1, v);
2148
2150
  }), this._textSelectionManagerService.replaceTextRanges([
2149
2151
  {
2150
2152
  startOffset: v,
@@ -2153,15 +2155,15 @@ let xe = class extends ge {
2153
2155
  }
2154
2156
  ], !1);
2155
2157
  } else {
2156
- const v = r.findNodeByCharIndex(i, u, I), x = r.findNodeByCharIndex(l, u, I), T = a.document.getOffsetConfig(), C = this._getTopOrBottomPosition(
2158
+ const v = r.findNodeByCharIndex(i, u, I), R = r.findNodeByCharIndex(l, u, I), T = a.document.getOffsetConfig(), C = this._getTopOrBottomPosition(
2157
2159
  r,
2158
- e === L.UP || g ? v : x,
2159
- e === L.UP || g ? f : m,
2160
- e === L.DOWN
2160
+ e === F.UP || g ? v : R,
2161
+ e === F.UP || g ? f : m,
2162
+ e === F.DOWN
2161
2163
  );
2162
2164
  if (C == null) {
2163
2165
  let y;
2164
- g ? y = e === L.UP ? 0 : p - 2 : y = e === L.UP ? i : l, this._textSelectionManagerService.replaceTextRanges([
2166
+ g ? y = e === F.UP ? 0 : p - 2 : y = e === F.UP ? i : l, this._textSelectionManagerService.replaceTextRanges([
2165
2167
  {
2166
2168
  startOffset: y,
2167
2169
  endOffset: y,
@@ -2170,13 +2172,13 @@ let xe = class extends ge {
2170
2172
  ], !1);
2171
2173
  return;
2172
2174
  }
2173
- const R = new mt(T, r).getRangePointData(
2175
+ const x = new mt(T, r).getRangePointData(
2174
2176
  C,
2175
2177
  C
2176
2178
  ).cursorList[0];
2177
2179
  this._textSelectionManagerService.replaceTextRanges([
2178
2180
  {
2179
- ...R,
2181
+ ...x,
2180
2182
  style: d
2181
2183
  }
2182
2184
  ], !1);
@@ -2217,7 +2219,7 @@ let xe = class extends ge {
2217
2219
  }
2218
2220
  // eslint-disable-next-line max-lines-per-function
2219
2221
  _getNextOrPrevLine(e, n) {
2220
- var m, I, p, h, S, _, O, E, v, x, T, C;
2222
+ var m, I, p, h, S, _, O, E, v, R, T, C;
2221
2223
  const t = e.parent;
2222
2224
  if (t == null)
2223
2225
  return;
@@ -2242,8 +2244,8 @@ let xe = class extends ge {
2242
2244
  if (n === !0)
2243
2245
  c = (m = i.columns[l + 1]) == null ? void 0 : m.lines[0];
2244
2246
  else {
2245
- const R = (p = (I = i.columns) == null ? void 0 : I[l - 1]) == null ? void 0 : p.lines;
2246
- c = R == null ? void 0 : R[R.length - 1];
2247
+ const x = (p = (I = i.columns) == null ? void 0 : I[l - 1]) == null ? void 0 : p.lines;
2248
+ c = x == null ? void 0 : x[x.length - 1];
2247
2249
  }
2248
2250
  if (c != null)
2249
2251
  return c;
@@ -2256,7 +2258,7 @@ let xe = class extends ge {
2256
2258
  if (n === !0)
2257
2259
  c = (S = (h = d.sections[g - 1]) == null ? void 0 : h.columns[0]) == null ? void 0 : S.lines[0];
2258
2260
  else {
2259
- const R = (O = (_ = d.sections) == null ? void 0 : _[g - 1]) == null ? void 0 : O.columns, y = R == null ? void 0 : R[R.length - 1], D = y == null ? void 0 : y.lines;
2261
+ const x = (O = (_ = d.sections) == null ? void 0 : _[g - 1]) == null ? void 0 : O.columns, y = x == null ? void 0 : x[x.length - 1], D = y == null ? void 0 : y.lines;
2260
2262
  c = D == null ? void 0 : D[D.length - 1];
2261
2263
  }
2262
2264
  if (c != null)
@@ -2267,13 +2269,13 @@ let xe = class extends ge {
2267
2269
  const f = u.pages.indexOf(d);
2268
2270
  if (f !== -1) {
2269
2271
  if (n === !0)
2270
- c = (x = (v = (E = u.pages[f + 1]) == null ? void 0 : E.sections[0]) == null ? void 0 : v.columns[0]) == null ? void 0 : x.lines[0];
2272
+ c = (R = (v = (E = u.pages[f + 1]) == null ? void 0 : E.sections[0]) == null ? void 0 : v.columns[0]) == null ? void 0 : R.lines[0];
2271
2273
  else {
2272
- const R = (T = u.pages[f - 1]) == null ? void 0 : T.sections;
2273
- if (R == null)
2274
+ const x = (T = u.pages[f - 1]) == null ? void 0 : T.sections;
2275
+ if (x == null)
2274
2276
  return;
2275
- const y = (C = R[R.length - 1]) == null ? void 0 : C.columns, D = y[y.length - 1], $ = D == null ? void 0 : D.lines;
2276
- c = $[$.length - 1];
2277
+ const y = (C = x[x.length - 1]) == null ? void 0 : C.columns, D = y[y.length - 1], L = D == null ? void 0 : D.lines;
2278
+ c = L[L.length - 1];
2277
2279
  }
2278
2280
  if (c != null)
2279
2281
  return c;
@@ -2283,19 +2285,19 @@ let xe = class extends ge {
2283
2285
  return Fn(this._univerInstanceService, this._renderManagerService);
2284
2286
  }
2285
2287
  };
2286
- xe = as([
2287
- le(ue.Rendered, xe),
2288
- Se(0, U),
2289
- Se(1, me),
2290
- Se(2, ee(P)),
2291
- Se(3, N)
2292
- ], xe);
2288
+ Oe = as([
2289
+ ue(ge.Rendered, Oe),
2290
+ Ie(0, U),
2291
+ Ie(1, he),
2292
+ Ie(2, ee(P)),
2293
+ Ie(3, N)
2294
+ ], Oe);
2293
2295
  var is = Object.defineProperty, cs = Object.getOwnPropertyDescriptor, ds = (o, e, n, t) => {
2294
2296
  for (var s = t > 1 ? void 0 : t ? cs(e, n) : e, r = o.length - 1, a; r >= 0; r--)
2295
2297
  (a = o[r]) && (s = (t ? a(e, n, s) : a(s)) || s);
2296
2298
  return t && s && is(e, n, s), s;
2297
- }, Ie = (o, e) => (n, t) => e(n, t, o);
2298
- let Oe = class extends ge {
2299
+ }, _e = (o, e) => (n, t) => e(n, t, o);
2300
+ let Ce = class extends fe {
2299
2301
  constructor(e, n, t, s) {
2300
2302
  super();
2301
2303
  w(this, "_onInputSubscription");
@@ -2328,7 +2330,7 @@ let Oe = class extends ge {
2328
2330
  style: g
2329
2331
  }
2330
2332
  ];
2331
- await this._commandService.executeCommand(ye.id, {
2333
+ await this._commandService.executeCommand(Te.id, {
2332
2334
  unitId: t,
2333
2335
  body: {
2334
2336
  dataStream: r
@@ -2340,14 +2342,14 @@ let Oe = class extends ge {
2340
2342
  });
2341
2343
  }
2342
2344
  };
2343
- Oe = ds([
2344
- le(ue.Rendered, Oe),
2345
- Ie(0, U),
2346
- Ie(1, me),
2347
- Ie(2, Ee),
2348
- Ie(3, N)
2349
- ], Oe);
2350
- const pe = {
2345
+ Ce = ds([
2346
+ ue(ge.Rendered, Ce),
2347
+ _e(0, U),
2348
+ _e(1, he),
2349
+ _e(2, Ae),
2350
+ _e(3, N)
2351
+ ], Ce);
2352
+ const Se = {
2351
2353
  id: "doc.command.align-operation",
2352
2354
  type: A.COMMAND,
2353
2355
  // eslint-disable-next-line max-lines-per-function
@@ -2359,29 +2361,29 @@ const pe = {
2359
2361
  const { segmentId: i } = c, l = (E = n.getCurrentSelections()) != null ? E : [], d = (v = a.getSelfOrHeaderFooterModel(i).getBody()) == null ? void 0 : v.paragraphs, g = l.map(se);
2360
2362
  if (d == null)
2361
2363
  return !1;
2362
- const u = Wt(c, d), f = a.getUnitId(), m = u.every((x) => {
2364
+ const u = Wt(c, d), f = a.getUnitId(), m = u.every((R) => {
2363
2365
  var T;
2364
- return ((T = x.paragraphStyle) == null ? void 0 : T.horizontalAlign) === r;
2366
+ return ((T = R.paragraphStyle) == null ? void 0 : T.horizontalAlign) === r;
2365
2367
  }), I = {
2366
- id: F.id,
2368
+ id: G.id,
2367
2369
  params: {
2368
2370
  unitId: f,
2369
2371
  actions: [],
2370
2372
  textRanges: g
2371
2373
  }
2372
- }, p = new de();
2374
+ }, p = new le();
2373
2375
  p.reset();
2374
- const h = new G(), S = B.getInstance();
2375
- for (const x of u) {
2376
- const { startIndex: T } = x;
2376
+ const h = new $(), S = B.getInstance();
2377
+ for (const R of u) {
2378
+ const { startIndex: T } = R;
2377
2379
  h.push({
2378
2380
  t: M.RETAIN,
2379
2381
  len: T - p.cursor,
2380
2382
  segmentId: i
2381
2383
  });
2382
2384
  const C = {
2383
- ...x.paragraphStyle,
2384
- horizontalAlign: m ? fe.UNSPECIFIED : r
2385
+ ...R.paragraphStyle,
2386
+ horizontalAlign: m ? me.UNSPECIFIED : r
2385
2387
  };
2386
2388
  h.push({
2387
2389
  t: M.RETAIN,
@@ -2390,50 +2392,50 @@ const pe = {
2390
2392
  dataStream: "",
2391
2393
  paragraphs: [
2392
2394
  {
2393
- ...x,
2395
+ ...R,
2394
2396
  paragraphStyle: C,
2395
2397
  startIndex: 0
2396
2398
  }
2397
2399
  ]
2398
2400
  },
2399
2401
  segmentId: i,
2400
- coverType: Te.REPLACE
2402
+ coverType: Ee.REPLACE
2401
2403
  }), p.moveCursorTo(T + 1);
2402
2404
  }
2403
- const _ = z(a, i);
2405
+ const _ = k(a, i);
2404
2406
  return I.params.actions = S.editOp(h.serialize(), _), !!s.syncExecuteCommand(I.id, I.params);
2405
2407
  }
2406
2408
  }, ls = {
2407
2409
  id: "doc.command.align-left",
2408
2410
  type: A.COMMAND,
2409
- handler: (o) => o.get(N).syncExecuteCommand(pe.id, {
2410
- alignType: fe.LEFT
2411
+ handler: (o) => o.get(N).syncExecuteCommand(Se.id, {
2412
+ alignType: me.LEFT
2411
2413
  })
2412
2414
  }, us = {
2413
2415
  id: "doc.command.align-center",
2414
2416
  type: A.COMMAND,
2415
- handler: (o) => o.get(N).syncExecuteCommand(pe.id, {
2416
- alignType: fe.CENTER
2417
+ handler: (o) => o.get(N).syncExecuteCommand(Se.id, {
2418
+ alignType: me.CENTER
2417
2419
  })
2418
2420
  }, gs = {
2419
2421
  id: "doc.command.align-right",
2420
2422
  type: A.COMMAND,
2421
- handler: (o) => o.get(N).syncExecuteCommand(pe.id, {
2422
- alignType: fe.RIGHT
2423
+ handler: (o) => o.get(N).syncExecuteCommand(Se.id, {
2424
+ alignType: me.RIGHT
2423
2425
  })
2424
2426
  }, fs = {
2425
2427
  id: "doc.command.align-justify",
2426
2428
  type: A.COMMAND,
2427
- handler: (o) => o.get(N).syncExecuteCommand(pe.id, {
2428
- alignType: fe.JUSTIFIED
2429
+ handler: (o) => o.get(N).syncExecuteCommand(Se.id, {
2430
+ alignType: me.JUSTIFIED
2429
2431
  })
2430
2432
  };
2431
2433
  var ms = Object.defineProperty, hs = Object.getOwnPropertyDescriptor, ps = (o, e, n, t) => {
2432
2434
  for (var s = t > 1 ? void 0 : t ? hs(e, n) : e, r = o.length - 1, a; r >= 0; r--)
2433
2435
  (a = o[r]) && (s = (t ? a(e, n, s) : a(s)) || s);
2434
2436
  return t && s && ms(e, n, s), s;
2435
- }, Be = (o, e) => (n, t) => e(n, t, o);
2436
- let Ce = class extends ge {
2437
+ }, Le = (o, e) => (n, t) => e(n, t, o);
2438
+ let Me = class extends fe {
2437
2439
  constructor(o, e, n) {
2438
2440
  super(), this._commandService = o, this._textSelectionManagerService = e, this._univerInstanceService = n, this._initSelectionChange();
2439
2441
  }
@@ -2465,20 +2467,20 @@ let Ce = class extends ge {
2465
2467
  }));
2466
2468
  }
2467
2469
  };
2468
- Ce = ps([
2469
- le(ue.Ready, Ce),
2470
- Be(0, N),
2471
- Be(1, ee(P)),
2472
- Be(2, U)
2473
- ], Ce);
2470
+ Me = ps([
2471
+ ue(ge.Ready, Me),
2472
+ Le(0, N),
2473
+ Le(1, ee(P)),
2474
+ Le(2, U)
2475
+ ], Me);
2474
2476
  var Ss = Object.defineProperty, Is = Object.getOwnPropertyDescriptor, _s = (o, e, n, t) => {
2475
2477
  for (var s = t > 1 ? void 0 : t ? Is(e, n) : e, r = o.length - 1, a; r >= 0; r--)
2476
2478
  (a = o[r]) && (s = (t ? a(e, n, s) : a(s)) || s);
2477
2479
  return t && s && Ss(e, n, s), s;
2478
2480
  }, vs = (o, e) => (n, t) => e(n, t, o);
2479
- const Rs = "docs";
2480
- var _e;
2481
- let Dt = (_e = class extends un {
2481
+ const xs = "docs";
2482
+ var ve;
2483
+ let Dt = (ve = class extends un {
2482
2484
  constructor(o = {}, e) {
2483
2485
  super(), this._injector = e, this._initializeDependencies(e), this._initializeCommands();
2484
2486
  }
@@ -2492,7 +2494,7 @@ let Dt = (_e = class extends un {
2492
2494
  tt,
2493
2495
  nt,
2494
2496
  st,
2495
- ce,
2497
+ de,
2496
2498
  ot,
2497
2499
  rt,
2498
2500
  at,
@@ -2501,17 +2503,17 @@ let Dt = (_e = class extends un {
2501
2503
  ct,
2502
2504
  Vt,
2503
2505
  $n,
2504
- ye,
2505
- ie,
2506
+ Te,
2507
+ ce,
2506
2508
  qe,
2507
2509
  jt,
2508
2510
  Ht,
2509
2511
  Qe,
2510
- F,
2512
+ G,
2511
2513
  Zn,
2512
2514
  Jn,
2513
2515
  Qn,
2514
- ve,
2516
+ xe,
2515
2517
  He,
2516
2518
  es,
2517
2519
  Yn,
@@ -2520,7 +2522,7 @@ let Dt = (_e = class extends un {
2520
2522
  ls,
2521
2523
  us,
2522
2524
  gs,
2523
- pe,
2525
+ Se,
2524
2526
  fs
2525
2527
  ].forEach((o) => {
2526
2528
  this._injector.get(N).registerCommand(o);
@@ -2529,10 +2531,10 @@ let Dt = (_e = class extends un {
2529
2531
  _initializeDependencies(o) {
2530
2532
  [
2531
2533
  // services
2532
- [Me],
2533
- [Ae],
2534
+ [ye],
2535
+ [Ne],
2534
2536
  [
2535
- Ee,
2537
+ Ae,
2536
2538
  {
2537
2539
  useClass: Mn
2538
2540
  }
@@ -2540,21 +2542,21 @@ let Dt = (_e = class extends un {
2540
2542
  [P],
2541
2543
  [Ze],
2542
2544
  // controllers
2543
- [Oe],
2545
+ [Ce],
2544
2546
  [Re],
2545
- [xe],
2546
- [Ce]
2547
+ [Oe],
2548
+ [Me]
2547
2549
  ].forEach((e) => o.add(e));
2548
2550
  }
2549
- }, w(_e, "pluginName", Rs), w(_e, "type", te.UNIVER_DOC), _e);
2551
+ }, w(ve, "pluginName", xs), w(ve, "type", te.UNIVER_DOC), ve);
2550
2552
  Dt = _s([
2551
2553
  vs(1, ee(gn))
2552
2554
  ], Dt);
2553
- function xs(o, e) {
2555
+ function Rs(o, e) {
2554
2556
  const { range: n, rangeId: t, rangeType: s, segmentId: r } = o, a = Un(n, e);
2555
2557
  if (!a)
2556
2558
  return null;
2557
- const { startOffset: c, endOffset: i } = a, l = new G();
2559
+ const { startOffset: c, endOffset: i } = a, l = new $();
2558
2560
  return c > 0 && l.push({
2559
2561
  t: M.RETAIN,
2560
2562
  len: c,
@@ -2592,13 +2594,13 @@ function xs(o, e) {
2592
2594
  }
2593
2595
  function Xs(o, e) {
2594
2596
  const n = {
2595
- id: F.id,
2597
+ id: G.id,
2596
2598
  params: {
2597
2599
  unitId: o.unitId,
2598
2600
  actions: [],
2599
2601
  textRanges: void 0
2600
2602
  }
2601
- }, t = B.getInstance(), s = xs(o, e);
2603
+ }, t = B.getInstance(), s = Rs(o, e);
2602
2604
  return s ? (n.params.actions = t.editOp(s.serialize()), n) : !1;
2603
2605
  }
2604
2606
  function Vs(o, e) {
@@ -2612,15 +2614,15 @@ function Vs(o, e) {
2612
2614
  const d = l.getBody(), g = l.getUnitId();
2613
2615
  if (!d)
2614
2616
  return !1;
2615
- const { startOffset: u, endOffset: f } = he(i), m = (v = d.customRanges) != null ? v : [], I = [];
2616
- for (let x = 0, T = m.length; x < T; x++) {
2617
- const C = m[x];
2617
+ const { startOffset: u, endOffset: f } = pe(i), m = (v = d.customRanges) != null ? v : [], I = [];
2618
+ for (let R = 0, T = m.length; R < T; R++) {
2619
+ const C = m[R];
2618
2620
  if (C.rangeType === s && Math.max(C.startIndex, u) <= Math.min(C.endIndex, f - 1) && I.push({ ...C }), C.startIndex >= f)
2619
2621
  break;
2620
2622
  }
2621
- const p = I.map((x) => [x.startIndex, x.endIndex]).flat().sort((x, T) => x - T);
2623
+ const p = I.map((R) => [R.startIndex, R.endIndex]).flat().sort((R, T) => R - T);
2622
2624
  let h = 0;
2623
- const S = new G(), _ = p.length ? {
2625
+ const S = new $(), _ = p.length ? {
2624
2626
  startOffset: Math.min(p[0], u),
2625
2627
  endOffset: Math.max(p[p.length - 1] + 1, f)
2626
2628
  } : i;
@@ -2636,12 +2638,12 @@ function Vs(o, e) {
2636
2638
  len: 1,
2637
2639
  line: 0,
2638
2640
  segmentId: n
2639
- }), p.forEach((x, T) => {
2640
- x !== h && (S.push({
2641
+ }), p.forEach((R, T) => {
2642
+ R !== h && (S.push({
2641
2643
  t: M.RETAIN,
2642
- len: x - h,
2644
+ len: R - h,
2643
2645
  segmentId: n
2644
- }), h = x), S.push({
2646
+ }), h = R), S.push({
2645
2647
  t: M.DELETE,
2646
2648
  len: 1,
2647
2649
  line: 0,
@@ -2670,7 +2672,7 @@ function Vs(o, e) {
2670
2672
  segmentId: n
2671
2673
  });
2672
2674
  const O = B.getInstance(), E = {
2673
- id: F.id,
2675
+ id: G.id,
2674
2676
  params: {
2675
2677
  unitId: g,
2676
2678
  actions: [],
@@ -2687,7 +2689,7 @@ function Os(o, e) {
2687
2689
  const c = (f = (u = a.getBody()) == null ? void 0 : u.customRanges) == null ? void 0 : f.find((m) => m.rangeId === t);
2688
2690
  if (!c)
2689
2691
  return !1;
2690
- const { startIndex: i, endIndex: l } = c, d = new G(), g = l - i + 1;
2692
+ const { startIndex: i, endIndex: l } = c, d = new $(), g = l - i + 1;
2691
2693
  return i > 0 && d.push({
2692
2694
  t: M.RETAIN,
2693
2695
  len: i,
@@ -2710,7 +2712,7 @@ function Os(o, e) {
2710
2712
  }
2711
2713
  function Ws(o, e) {
2712
2714
  const n = {
2713
- id: F.id,
2715
+ id: G.id,
2714
2716
  params: {
2715
2717
  unitId: e.unitId,
2716
2718
  actions: [],
@@ -2721,13 +2723,13 @@ function Ws(o, e) {
2721
2723
  }
2722
2724
  function Cs(o) {
2723
2725
  const { unitId: e, range: n, id: t, type: s, segmentId: r } = o, { startOffset: a, endOffset: c } = n, i = {
2724
- id: F.id,
2726
+ id: G.id,
2725
2727
  params: {
2726
2728
  unitId: e,
2727
2729
  actions: [],
2728
2730
  textRanges: void 0
2729
2731
  }
2730
- }, l = new G(), d = B.getInstance();
2732
+ }, l = new $(), d = B.getInstance();
2731
2733
  return a > 0 && l.push({
2732
2734
  t: M.RETAIN,
2733
2735
  len: a,
@@ -2782,13 +2784,13 @@ function Ks(o, e) {
2782
2784
  const S = ne.deepClone(h);
2783
2785
  return S.customDecorations = (_ = S.customDecorations) == null ? void 0 : _.filter((O) => O.id !== t), S;
2784
2786
  }), g = {
2785
- id: F.id,
2787
+ id: G.id,
2786
2788
  params: {
2787
2789
  unitId: n,
2788
2790
  actions: [],
2789
2791
  textRanges: void 0
2790
2792
  }
2791
- }, u = new G(), f = B.getInstance();
2793
+ }, u = new $(), f = B.getInstance();
2792
2794
  let m = 0;
2793
2795
  return i.forEach((h, S) => {
2794
2796
  const _ = d[S], O = l[S];
@@ -2802,11 +2804,11 @@ function Ks(o, e) {
2802
2804
  segmentId: s,
2803
2805
  body: _,
2804
2806
  oldBody: O,
2805
- coverType: Te.REPLACE
2807
+ coverType: Ee.REPLACE
2806
2808
  }), m = m + (h.endIndex - h.startIndex + 1);
2807
2809
  }), g.params.actions = f.editOp(u.serialize()), g;
2808
2810
  }
2809
- const Ms = Lt("CUSTOM_RANGE"), ys = Lt("CUSTOM_DECORATION"), Le = {
2811
+ const Ms = Lt("CUSTOM_RANGE"), ys = Lt("CUSTOM_DECORATION"), Fe = {
2810
2812
  CUSTOM_RANGE: Ms,
2811
2813
  CUSTOM_DECORATION: ys
2812
2814
  };
@@ -2815,7 +2817,7 @@ var Ts = Object.defineProperty, Es = Object.getOwnPropertyDescriptor, As = (o, e
2815
2817
  (a = o[r]) && (s = (t ? a(e, n, s) : a(s)) || s);
2816
2818
  return t && s && Ts(e, n, s), s;
2817
2819
  }, Ns = (o, e) => (n, t) => e(n, t, o);
2818
- let Fe = class extends ge {
2820
+ let Ge = class extends fe {
2819
2821
  constructor(e, n) {
2820
2822
  super();
2821
2823
  w(this, "_interceptorsByName", /* @__PURE__ */ new Map());
@@ -2826,7 +2828,7 @@ let Fe = class extends ge {
2826
2828
  return;
2827
2829
  this.interceptDocumentViewModel(t);
2828
2830
  }
2829
- })), this.disposeWithMe(this.intercept(Le.CUSTOM_RANGE, {
2831
+ })), this.disposeWithMe(this.intercept(Fe.CUSTOM_RANGE, {
2830
2832
  priority: -1,
2831
2833
  handler: (t, s, r) => r(t)
2832
2834
  }));
@@ -2852,7 +2854,7 @@ let Fe = class extends ge {
2852
2854
  return n.add(e.registerCustomRangeInterceptor({
2853
2855
  getCustomRange: (t) => {
2854
2856
  var s;
2855
- return this.fetchThroughInterceptors(Le.CUSTOM_RANGE)(
2857
+ return this.fetchThroughInterceptors(Fe.CUSTOM_RANGE)(
2856
2858
  e.getCustomRangeRaw(t),
2857
2859
  {
2858
2860
  index: t,
@@ -2863,7 +2865,7 @@ let Fe = class extends ge {
2863
2865
  },
2864
2866
  getCustomDecoration: (t) => {
2865
2867
  var s;
2866
- return this.fetchThroughInterceptors(Le.CUSTOM_DECORATION)(
2868
+ return this.fetchThroughInterceptors(Fe.CUSTOM_DECORATION)(
2867
2869
  e.getCustomDecorationRaw(t),
2868
2870
  {
2869
2871
  index: t,
@@ -2875,16 +2877,16 @@ let Fe = class extends ge {
2875
2877
  })), n;
2876
2878
  }
2877
2879
  };
2878
- Fe = As([
2879
- le(ue.Starting, Fe),
2880
+ Ge = As([
2881
+ ue(ge.Starting, Ge),
2880
2882
  Ns(1, ee(V))
2881
- ], Fe);
2883
+ ], Ge);
2882
2884
  const Zs = (o) => o.body ? o.body.dataStream.slice(0, -2).replaceAll(b.CUSTOM_RANGE_START, "").replaceAll(b.CUSTOM_RANGE_END, "") : "";
2883
2885
  export {
2884
2886
  us as AlignCenterCommand,
2885
2887
  fs as AlignJustifyCommand,
2886
2888
  ls as AlignLeftCommand,
2887
- pe as AlignOperationCommand,
2889
+ Se as AlignOperationCommand,
2888
2890
  gs as AlignRightCommand,
2889
2891
  $n as BreakLineCommand,
2890
2892
  Wn as BulletListCommand,
@@ -2894,21 +2896,21 @@ export {
2894
2896
  $s as DOCS_COMPONENT_DEFAULT_Z_INDEX,
2895
2897
  Gs as DOCS_COMPONENT_HEADER_LAYER_INDEX,
2896
2898
  Fs as DOCS_COMPONENT_MAIN_LAYER_INDEX,
2897
- De as DOCS_VIEW_KEY,
2898
- Le as DOC_INTERCEPTOR_POINT,
2899
- ie as DeleteCommand,
2899
+ be as DOCS_VIEW_KEY,
2900
+ Fe as DOC_INTERCEPTOR_POINT,
2901
+ ce as DeleteCommand,
2900
2902
  qe as DeleteCustomBlockCommand,
2901
2903
  kn as DeleteLeftCommand,
2902
2904
  zn as DeleteRightCommand,
2903
2905
  Ze as DocCustomRangeService,
2904
- Fe as DocInterceptorService,
2906
+ Ge as DocInterceptorService,
2905
2907
  V as DocSkeletonManagerService,
2906
- Me as DocStateChangeManagerService,
2908
+ ye as DocStateChangeManagerService,
2907
2909
  Gn as EditorInsertTextCommandId,
2908
2910
  Ht as IMEInputCommand,
2909
- Ae as IMEInputManagerService,
2911
+ Ne as IMEInputManagerService,
2910
2912
  Hs as InnerPasteCommand,
2911
- ye as InsertCommand,
2913
+ Te as InsertCommand,
2912
2914
  lt as ListOperationCommand,
2913
2915
  Qe as MergeTwoParagraphCommand,
2914
2916
  $e as MoveCursorOperation,
@@ -2917,17 +2919,17 @@ export {
2917
2919
  Yn as OrderListCommand,
2918
2920
  Zn as ReplaceContentCommand,
2919
2921
  dt as ResetInlineFormatTextBackgroundColorCommand,
2920
- F as RichTextEditingMutation,
2922
+ G as RichTextEditingMutation,
2921
2923
  es as SelectAllOperation,
2922
2924
  Qn as SetDocZoomRatioCommand,
2923
- ve as SetDocZoomRatioOperation,
2925
+ xe as SetDocZoomRatioOperation,
2924
2926
  et as SetInlineFormatBoldCommand,
2925
2927
  Vt as SetInlineFormatCommand,
2926
2928
  at as SetInlineFormatFontFamilyCommand,
2927
2929
  rt as SetInlineFormatFontSizeCommand,
2928
2930
  tt as SetInlineFormatItalicCommand,
2929
2931
  st as SetInlineFormatStrikethroughCommand,
2930
- ce as SetInlineFormatSubscriptCommand,
2932
+ de as SetInlineFormatSubscriptCommand,
2931
2933
  ot as SetInlineFormatSuperscriptCommand,
2932
2934
  ct as SetInlineFormatTextBackgroundColorCommand,
2933
2935
  it as SetInlineFormatTextColorCommand,
@@ -2943,13 +2945,13 @@ export {
2943
2945
  Xs as addCustomRangeFactory,
2944
2946
  Ks as deleteCustomDecorationFactory,
2945
2947
  Ws as deleteCustomRangeFactory,
2946
- Ne as getDeleteSelection,
2948
+ De as getDeleteSelection,
2947
2949
  Fn as getDocObject,
2948
2950
  zs as getDocObjectById,
2949
2951
  Ye as getInsertSelection,
2950
2952
  Zs as getPlainTextFormDocument,
2951
2953
  Je as getRetainAndDeleteFromReplace,
2952
- z as getRichTextEditPath,
2954
+ k as getRichTextEditPath,
2953
2955
  Us as getSelectionText,
2954
2956
  Gt as isSegmentIntersects,
2955
2957
  ks as neoGetDocObject,