@univerjs/sheets-formula-ui 0.10.11 → 0.10.12

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
@@ -27,8 +27,8 @@ const Cn = {
27
27
  handler: (e, t) => !0
28
28
  };
29
29
  var Ns = Object.getOwnPropertyDescriptor, xs = (e, t, n, o) => {
30
- for (var r = o > 1 ? void 0 : o ? Ns(t, n) : t, s = e.length - 1, c; s >= 0; s--)
31
- (c = e[s]) && (r = c(r) || r);
30
+ for (var r = o > 1 ? void 0 : o ? Ns(t, n) : t, s = e.length - 1, i; s >= 0; s--)
31
+ (i = e[s]) && (r = i(r) || r);
32
32
  return r;
33
33
  }, Ms = (e, t) => (n, o) => t(n, o, e);
34
34
  const ws = "FORMULA_PROMPT_ACTIVATED", zt = zr("formula-ui.prompt-service");
@@ -102,8 +102,8 @@ let on = class {
102
102
  if (typeof s == "string")
103
103
  t++;
104
104
  else {
105
- const { endIndex: c } = s;
106
- t = c;
105
+ const { endIndex: i } = s;
106
+ t = i;
107
107
  }
108
108
  if (e <= t)
109
109
  return typeof n == "string" && e !== 0 ? o + 1 : o;
@@ -121,11 +121,11 @@ let on = class {
121
121
  return;
122
122
  const o = t.length - n.token.length, r = { ...n };
123
123
  r.token = t, r.endIndex += o, this._sequenceNodes[e] = r;
124
- for (let s = e + 1, c = this._sequenceNodes.length; s < c; s++) {
125
- const i = this._sequenceNodes[s];
126
- if (typeof i == "string")
124
+ for (let s = e + 1, i = this._sequenceNodes.length; s < i; s++) {
125
+ const c = this._sequenceNodes[s];
126
+ if (typeof c == "string")
127
127
  continue;
128
- const l = { ...i };
128
+ const l = { ...c };
129
129
  l.startIndex += o, l.endIndex += o, this._sequenceNodes[s] = l;
130
130
  }
131
131
  }
@@ -144,11 +144,11 @@ let on = class {
144
144
  nodeType: Q.REFERENCE
145
145
  });
146
146
  for (let r = o + 1, s = this._sequenceNodes.length; r < s; r++) {
147
- const c = this._sequenceNodes[r];
148
- if (typeof c == "string")
147
+ const i = this._sequenceNodes[r];
148
+ if (typeof i == "string")
149
149
  continue;
150
- const i = { ...c };
151
- i.startIndex += n, i.endIndex += n, this._sequenceNodes[r] = i;
150
+ const c = { ...i };
151
+ c.startIndex += n, c.endIndex += n, this._sequenceNodes[r] = c;
152
152
  }
153
153
  }
154
154
  /**
@@ -160,11 +160,11 @@ let on = class {
160
160
  const n = this.getCurrentSequenceNodeIndex(e), o = t.split("");
161
161
  this._sequenceNodes.splice(n, 0, ...o);
162
162
  const r = o.length;
163
- for (let s = n + r, c = this._sequenceNodes.length; s < c; s++) {
164
- const i = this._sequenceNodes[s];
165
- if (typeof i == "string")
163
+ for (let s = n + r, i = this._sequenceNodes.length; s < i; s++) {
164
+ const c = this._sequenceNodes[s];
165
+ if (typeof c == "string")
166
166
  continue;
167
- const l = { ...i };
167
+ const l = { ...c };
168
168
  l.startIndex += r, l.endIndex += r, this._sequenceNodes[s] = l;
169
169
  }
170
170
  }
@@ -205,7 +205,7 @@ const ks = {
205
205
  return !1;
206
206
  const s = vr(e.get(ne));
207
207
  if (!s) return !1;
208
- const { worksheet: c, unitId: i, subUnitId: l } = s, g = c.getCellMatrix(), { value: m } = t, h = e.get(pe);
208
+ const { worksheet: i, unitId: c, subUnitId: l } = s, g = i.getCellMatrix(), { value: m } = t, h = e.get(pe);
209
209
  e.get(hn);
210
210
  const d = [], u = [];
211
211
  let a = null, S = 0, p = 0, v = "";
@@ -234,7 +234,7 @@ const ks = {
234
234
  } else {
235
235
  const { startRow: F, startColumn: O, endRow: N, endColumn: k } = f;
236
236
  if (F === N) {
237
- const E = $s(g, F, k, c.getColumnCount() - 1), x = E === k ? k - 1 : k, R = _e({
237
+ const E = $s(g, F, k, i.getColumnCount() - 1), x = E === k ? k - 1 : k, R = _e({
238
238
  startRow: F,
239
239
  endRow: N,
240
240
  startColumn: O,
@@ -251,7 +251,7 @@ const ks = {
251
251
  } else {
252
252
  let E = -1;
253
253
  for (let R = O; R <= k; R++) {
254
- const w = Ps(g, R, N, c.getRowCount() - 1);
254
+ const w = Ps(g, R, N, i.getRowCount() - 1);
255
255
  E = Math.max(E, w);
256
256
  }
257
257
  const x = E === N ? N - 1 : N;
@@ -276,7 +276,7 @@ const ks = {
276
276
  return !1;
277
277
  });
278
278
  if (a) {
279
- const I = ns(S, p, c), f = {
279
+ const I = ns(S, p, i), f = {
280
280
  range: tr.clone(a),
281
281
  primary: {
282
282
  startRow: I.startRow,
@@ -289,7 +289,7 @@ const ks = {
289
289
  isMergedMainCell: I.startRow === S && I.startColumn === p
290
290
  }
291
291
  }, b = {
292
- unitId: i,
292
+ unitId: c,
293
293
  subUnitId: l,
294
294
  selections: [f]
295
295
  };
@@ -297,7 +297,7 @@ const ks = {
297
297
  const y = o.getEditor(ln), A = o.getEditor(nr);
298
298
  h.syncExecuteCommand(ir.id, {
299
299
  visible: !0,
300
- unitId: i,
300
+ unitId: c,
301
301
  eventType: xe.Dblclick
302
302
  });
303
303
  const F = `=${m}(${v}`;
@@ -412,8 +412,8 @@ const Ir = "SHEET_FORMULA_UI_PLUGIN", br = `${Ir}_MORE_FUNCTIONS_COMPONENT`, _n
412
412
  handler: async (e, t) => (e.get(zt).search(t), !0)
413
413
  };
414
414
  var Vs = Object.getOwnPropertyDescriptor, Ws = (e, t, n, o) => {
415
- for (var r = o > 1 ? void 0 : o ? Vs(t, n) : t, s = e.length - 1, c; s >= 0; s--)
416
- (c = e[s]) && (r = c(r) || r);
415
+ for (var r = o > 1 ? void 0 : o ? Vs(t, n) : t, s = e.length - 1, i; s >= 0; s--)
416
+ (i = e[s]) && (r = i(r) || r);
417
417
  return r;
418
418
  }, kt = (e, t) => (n, o) => t(n, o, e);
419
419
  let Pt = class extends dt {
@@ -429,7 +429,7 @@ let Pt = class extends dt {
429
429
  }));
430
430
  }
431
431
  _reorderFormula(e) {
432
- const t = [], n = [], { unitId: o, subUnitId: r, range: s, order: c } = e, i = this._univerInstanceService.getUniverSheetInstance(o), l = i == null ? void 0 : i.getSheetBySheetId(r);
432
+ const t = [], n = [], { unitId: o, subUnitId: r, range: s, order: i } = e, c = this._univerInstanceService.getUniverSheetInstance(o), l = c == null ? void 0 : c.getSheetBySheetId(r);
433
433
  if (!l)
434
434
  return {
435
435
  redos: t,
@@ -439,7 +439,7 @@ let Pt = class extends dt {
439
439
  let d = !1;
440
440
  return Jr.foreach(s, (u, a) => {
441
441
  let S = u;
442
- c.hasOwnProperty(u) && (S = c[u]);
442
+ i.hasOwnProperty(u) && (S = i[u]);
443
443
  const p = g.getValue(S, a);
444
444
  if (p != null && p.f || p != null && p.si) {
445
445
  d = !0;
@@ -483,8 +483,8 @@ Pt = Ws([
483
483
  ], Pt);
484
484
  const Tr = "sheets-formula-ui.base.config", Zn = {};
485
485
  var Hs = Object.getOwnPropertyDescriptor, Bs = (e, t, n, o) => {
486
- for (var r = o > 1 ? void 0 : o ? Hs(t, n) : t, s = e.length - 1, c; s >= 0; s--)
487
- (c = e[s]) && (r = c(r) || r);
486
+ for (var r = o > 1 ? void 0 : o ? Hs(t, n) : t, s = e.length - 1, i; s >= 0; s--)
487
+ (i = e[s]) && (r = i(r) || r);
488
488
  return r;
489
489
  }, vt = (e, t) => (n, o) => t(n, o, e);
490
490
  const en = "SHEET_FORMULA_ALERT", js = {
@@ -512,9 +512,9 @@ let sn = class extends dt {
512
512
  this.disposeWithMe(this._hoverManagerService.currentCell$.pipe(fn(100)).subscribe((e) => {
513
513
  var t, n, o, r, s;
514
514
  if (e) {
515
- const i = this._context.unit.getActiveSheet();
516
- if (!i) return;
517
- const l = i.getCell(e.location.row, e.location.col), g = (r = (o = (n = (t = this._formulaDataModel.getArrayFormulaCellData()) == null ? void 0 : t[e.location.unitId]) == null ? void 0 : n[e.location.subUnitId]) == null ? void 0 : o[e.location.row]) == null ? void 0 : r[e.location.col];
515
+ const c = this._context.unit.getActiveSheet();
516
+ if (!c) return;
517
+ const l = c.getCell(e.location.row, e.location.col), g = (r = (o = (n = (t = this._formulaDataModel.getArrayFormulaCellData()) == null ? void 0 : t[e.location.unitId]) == null ? void 0 : n[e.location.subUnitId]) == null ? void 0 : o[e.location.row]) == null ? void 0 : r[e.location.col];
518
518
  if (eo(l)) {
519
519
  const m = ur(l, !!g);
520
520
  if (!m) {
@@ -556,8 +556,8 @@ sn = Bs([
556
556
  vt(5, gs)
557
557
  ], sn);
558
558
  var qs = Object.getOwnPropertyDescriptor, Ks = (e, t, n, o) => {
559
- for (var r = o > 1 ? void 0 : o ? qs(t, n) : t, s = e.length - 1, c; s >= 0; s--)
560
- (c = e[s]) && (r = c(r) || r);
559
+ for (var r = o > 1 ? void 0 : o ? qs(t, n) : t, s = e.length - 1, i; s >= 0; s--)
560
+ (i = e[s]) && (r = i(r) || r);
561
561
  return r;
562
562
  }, zn = (e, t) => (n, o) => t(n, o, e);
563
563
  let Ut = class extends dt {
@@ -572,8 +572,8 @@ let Ut = class extends dt {
572
572
  isContinue: (t, n) => t.type === An.FORMULA,
573
573
  applyFunctions: {
574
574
  [_o.COPY]: (t, n, o, r, s) => {
575
- const { data: c, index: i } = t;
576
- return this._fillCopyFormula(c, n, o, i, r, s);
575
+ const { data: i, index: c } = t;
576
+ return this._fillCopyFormula(i, n, o, c, r, s);
577
577
  }
578
578
  }
579
579
  };
@@ -581,31 +581,31 @@ let Ut = class extends dt {
581
581
  }
582
582
  _fillCopyFormula(e, t, n, o, r, s) {
583
583
  var g, m;
584
- const c = Gs(r), i = [], l = /* @__PURE__ */ new Map();
584
+ const i = Gs(r), c = [], l = /* @__PURE__ */ new Map();
585
585
  for (let h = 1; h <= t; h++) {
586
586
  const d = (h - 1) % e.length, u = o[d], a = un.deepClone(e[d]);
587
587
  if (a) {
588
588
  const S = ((g = e[d]) == null ? void 0 : g.f) || "", p = ((m = e[d]) == null ? void 0 : m.si) || "", v = De(S);
589
589
  if (lt(p))
590
- a.si = p, a.f = null, a.v = null, a.p = null, a.t = null, i.push(a);
590
+ a.si = p, a.f = null, a.v = null, a.p = null, a.t = null, c.push(a);
591
591
  else if (v) {
592
592
  let _ = l.get(d);
593
593
  if (_)
594
594
  a.si = _, a.f = null, a.v = null, a.p = null, a.t = null;
595
595
  else {
596
596
  _ = qt(6), l.set(d, _);
597
- const { offsetX: I, offsetY: f } = Ys(c, t, n, s, u), b = this._lexerTreeBuilder.moveFormulaRefOffset(
597
+ const { offsetX: I, offsetY: f } = Ys(i, t, n, s, u), b = this._lexerTreeBuilder.moveFormulaRefOffset(
598
598
  S,
599
599
  I,
600
600
  f
601
601
  );
602
602
  a.si = _, a.f = b, a.v = null, a.p = null, a.t = null;
603
603
  }
604
- i.push(a);
604
+ c.push(a);
605
605
  }
606
606
  }
607
607
  }
608
- return i;
608
+ return c;
609
609
  }
610
610
  };
611
611
  Ut = Ks([
@@ -613,17 +613,17 @@ Ut = Ks([
613
613
  zn(1, j(Re))
614
614
  ], Ut);
615
615
  function Ys(e, t, n, o, r) {
616
- const { source: s, target: c } = o, { rows: i } = c, { rows: l } = s;
616
+ const { source: s, target: i } = o, { rows: c } = i, { rows: l } = s;
617
617
  let g = 0, m = 0;
618
618
  switch (n) {
619
619
  case de.UP:
620
- m = i[r] - l[r];
620
+ m = c[r] - l[r];
621
621
  break;
622
622
  case de.RIGHT:
623
623
  g = e;
624
624
  break;
625
625
  case de.DOWN:
626
- m = i[r] - l[r];
626
+ m = c[r] - l[r];
627
627
  break;
628
628
  case de.LEFT:
629
629
  g = -e * t;
@@ -640,8 +640,8 @@ function Gs(e) {
640
640
  return t;
641
641
  }
642
642
  var Zs = Object.getOwnPropertyDescriptor, zs = (e, t, n, o) => {
643
- for (var r = o > 1 ? void 0 : o ? Zs(t, n) : t, s = e.length - 1, c; s >= 0; s--)
644
- (c = e[s]) && (r = c(r) || r);
643
+ for (var r = o > 1 ? void 0 : o ? Zs(t, n) : t, s = e.length - 1, i; s >= 0; s--)
644
+ (i = e[s]) && (r = i(r) || r);
645
645
  return r;
646
646
  }, St = (e, t) => (n, o) => t(n, o, e);
647
647
  const Xs = "default-paste-formula";
@@ -680,8 +680,8 @@ let Vt = class extends dt {
680
680
  undos: [],
681
681
  redos: []
682
682
  };
683
- const c = this._currentUniverSheet.getCurrentUnitForType(H.UNIVER_SHEET), i = t.unitId || c.getUnitId(), l = t.subUnitId || ((d = c.getActiveSheet()) == null ? void 0 : d.getSheetId());
684
- if (!i || !l)
683
+ const i = this._currentUniverSheet.getCurrentUnitForType(H.UNIVER_SHEET), c = t.unitId || i.getUnitId(), l = t.subUnitId || ((d = i.getActiveSheet()) == null ? void 0 : d.getSheetId());
684
+ if (!c || !l)
685
685
  return {
686
686
  undos: [],
687
687
  redos: []
@@ -692,7 +692,7 @@ let Vt = class extends dt {
692
692
  pasteType: o.pasteType
693
693
  };
694
694
  return this._injector.invoke((u) => Qs(
695
- i,
695
+ c,
696
696
  l,
697
697
  g,
698
698
  m,
@@ -712,8 +712,8 @@ Vt = zs([
712
712
  St(3, j(Et)),
713
713
  St(4, j(yt))
714
714
  ], Vt);
715
- function Qs(e, t, n, o, r, s, c, i, l = !1, g) {
716
- const m = [], h = [], d = Js(e, t, n, o, s, c, i, g);
715
+ function Qs(e, t, n, o, r, s, i, c, l = !1, g) {
716
+ const m = [], h = [], d = Js(e, t, n, o, s, i, c, g);
717
717
  if (!d.hasValue())
718
718
  return {
719
719
  undos: [],
@@ -740,75 +740,75 @@ function Qs(e, t, n, o, r, s, c, i, l = !1, g) {
740
740
  redos: m
741
741
  };
742
742
  }
743
- function Js(e, t, n, o, r, s, c, i) {
744
- return i ? r.pasteType === ct.SPECIAL_PASTE_VALUE ? ti(e, t, n, o, c, i) : r.pasteType === ct.SPECIAL_PASTE_FORMULA ? ni(e, t, n, o, s, c, i) : ri(e, t, n, o, r.copyType, s, c, i) : ei(e, t, n, o, c);
743
+ function Js(e, t, n, o, r, s, i, c) {
744
+ return c ? r.pasteType === ct.SPECIAL_PASTE_VALUE ? ti(e, t, n, o, i, c) : r.pasteType === ct.SPECIAL_PASTE_FORMULA ? ni(e, t, n, o, s, i, c) : ri(e, t, n, o, r.copyType, s, i, c) : ei(e, t, n, o, i);
745
745
  }
746
746
  function ei(e, t, n, o, r) {
747
- const s = new Le(), c = r.getSheetFormulaData(e, t);
748
- return o.forValue((i, l, g) => {
747
+ const s = new Le(), i = r.getSheetFormulaData(e, t);
748
+ return o.forValue((c, l, g) => {
749
749
  var u;
750
- const m = n.rows[i], h = n.cols[l], d = {};
751
- De(g.v) ? (d.v = null, d.f = `${g.v}`, d.si = null, d.p = null, s.setValue(m, h, d)) : (u = c == null ? void 0 : c[m]) != null && u[h] && (d.v = g.v, d.f = null, d.si = null, d.p = null, s.setValue(m, h, d));
750
+ const m = n.rows[c], h = n.cols[l], d = {};
751
+ De(g.v) ? (d.v = null, d.f = `${g.v}`, d.si = null, d.p = null, s.setValue(m, h, d)) : (u = i == null ? void 0 : i[m]) != null && u[h] && (d.v = g.v, d.f = null, d.si = null, d.p = null, s.setValue(m, h, d));
752
752
  }), s;
753
753
  }
754
754
  function ti(e, t, n, o, r, s) {
755
755
  var g, m;
756
- const c = new Le(), i = (m = (g = r.getArrayFormulaCellData()) == null ? void 0 : g[s.unitId]) == null ? void 0 : m[s.subUnitId], l = r.getSheetFormulaData(e, t);
756
+ const i = new Le(), c = (m = (g = r.getArrayFormulaCellData()) == null ? void 0 : g[s.unitId]) == null ? void 0 : m[s.subUnitId], l = r.getSheetFormulaData(e, t);
757
757
  return o.forValue((h, d, u) => {
758
758
  var _, I;
759
759
  const a = s.range.rows[h % s.range.rows.length], S = s.range.cols[d % s.range.cols.length], p = n.rows[h], v = n.cols[d], C = {};
760
760
  if (De(u.f) || lt(u.si))
761
- C.v = u.v, C.f = null, C.si = null, C.p = null, c.setValue(p, v, C);
762
- else if ((_ = i == null ? void 0 : i[a]) != null && _[S]) {
763
- const f = i[a][S];
764
- C.v = f.v, C.f = null, C.si = null, C.p = null, c.setValue(p, v, C);
761
+ C.v = u.v, C.f = null, C.si = null, C.p = null, i.setValue(p, v, C);
762
+ else if ((_ = c == null ? void 0 : c[a]) != null && _[S]) {
763
+ const f = c[a][S];
764
+ C.v = f.v, C.f = null, C.si = null, C.p = null, i.setValue(p, v, C);
765
765
  } else if ((I = l == null ? void 0 : l[p]) != null && I[v]) {
766
766
  if (C.v = u.v, C.f = null, C.si = null, C.p = null, u.p) {
767
767
  const f = Or(u);
768
768
  f && (C.v = f);
769
769
  }
770
- c.setValue(p, v, C);
770
+ i.setValue(p, v, C);
771
771
  }
772
- }), c;
772
+ }), i;
773
773
  }
774
- function ni(e, t, n, o, r, s, c) {
775
- const i = new Le(), l = /* @__PURE__ */ new Map();
774
+ function ni(e, t, n, o, r, s, i) {
775
+ const c = new Le(), l = /* @__PURE__ */ new Map();
776
776
  return o.forValue((g, m, h) => {
777
777
  const d = n.rows[g], u = n.cols[m], a = {};
778
778
  if (lt(h.si)) {
779
- if (c.unitId !== e || c.subUnitId !== t) {
779
+ if (i.unitId !== e || i.subUnitId !== t) {
780
780
  const S = s.getFormulaStringByCell(
781
- c.range.rows[g % c.range.rows.length],
782
- c.range.cols[m % c.range.cols.length],
783
- c.subUnitId,
784
- c.unitId
785
- ), p = n.cols[m] - c.range.cols[m % c.range.cols.length], v = n.rows[g] - c.range.rows[g % c.range.rows.length], C = r.moveFormulaRefOffset(S || "", p, v);
781
+ i.range.rows[g % i.range.rows.length],
782
+ i.range.cols[m % i.range.cols.length],
783
+ i.subUnitId,
784
+ i.unitId
785
+ ), p = n.cols[m] - i.range.cols[m % i.range.cols.length], v = n.rows[g] - i.range.rows[g % i.range.rows.length], C = r.moveFormulaRefOffset(S || "", p, v);
786
786
  a.si = null, a.f = C;
787
787
  } else
788
788
  a.si = h.si, a.f = null;
789
- a.v = null, a.p = null, i.setValue(d, u, a);
789
+ a.v = null, a.p = null, c.setValue(d, u, a);
790
790
  } else if (De(h.f)) {
791
- const S = `${g % c.range.rows.length}_${m % c.range.cols.length}`;
791
+ const S = `${g % i.range.rows.length}_${m % i.range.cols.length}`;
792
792
  let p = l.get(S);
793
793
  if (p)
794
794
  a.si = p, a.f = null;
795
795
  else {
796
796
  p = qt(6), l.set(S, p);
797
- const v = n.cols[m] - c.range.cols[m % c.range.cols.length], C = n.rows[g] - c.range.rows[g % c.range.rows.length], _ = r.moveFormulaRefOffset(h.f || "", v, C);
797
+ const v = n.cols[m] - i.range.cols[m % i.range.cols.length], C = n.rows[g] - i.range.rows[g % i.range.rows.length], _ = r.moveFormulaRefOffset(h.f || "", v, C);
798
798
  a.si = p, a.f = _;
799
799
  }
800
- a.v = null, a.p = null, i.setValue(d, u, a);
800
+ a.v = null, a.p = null, c.setValue(d, u, a);
801
801
  } else {
802
802
  if (a.v = h.v, a.f = null, a.si = null, a.p = null, h.p) {
803
803
  const S = Or(h);
804
804
  S && (a.v = S);
805
805
  }
806
- i.setValue(d, u, a);
806
+ c.setValue(d, u, a);
807
807
  }
808
- }), i;
808
+ }), c;
809
809
  }
810
- function ri(e, t, n, o, r, s, c, i) {
811
- const l = new Le(), g = /* @__PURE__ */ new Map(), m = c.getSheetFormulaData(e, t), h = [];
810
+ function ri(e, t, n, o, r, s, i, c) {
811
+ const l = new Le(), g = /* @__PURE__ */ new Map(), m = i.getSheetFormulaData(e, t), h = [];
812
812
  return r === cr.CUT ? o.forValue((d, u, a) => {
813
813
  const S = n.rows[d], p = n.cols[u], v = {};
814
814
  if (lt(a.si)) {
@@ -817,11 +817,11 @@ function ri(e, t, n, o, r, s, c, i) {
817
817
  else if (h.includes(a.si))
818
818
  v.f = null, v.si = a.si;
819
819
  else {
820
- const C = c.getFormulaStringByCell(
821
- i.range.rows[d % i.range.rows.length],
822
- i.range.cols[u % i.range.cols.length],
823
- i.subUnitId,
824
- i.unitId
820
+ const C = i.getFormulaStringByCell(
821
+ c.range.rows[d % c.range.rows.length],
822
+ c.range.cols[u % c.range.cols.length],
823
+ c.subUnitId,
824
+ c.unitId
825
825
  );
826
826
  v.f = C, v.si = null;
827
827
  }
@@ -831,36 +831,36 @@ function ri(e, t, n, o, r, s, c, i) {
831
831
  var C;
832
832
  const S = n.rows[d], p = n.cols[u], v = {};
833
833
  if (lt(a.si)) {
834
- if (i.unitId !== e || i.subUnitId !== t) {
835
- const _ = c.getFormulaStringByCell(
836
- i.range.rows[d % i.range.rows.length],
837
- i.range.cols[u % i.range.cols.length],
838
- i.subUnitId,
839
- i.unitId
840
- ), I = n.cols[u] - i.range.cols[u % i.range.cols.length], f = n.rows[d] - i.range.rows[d % i.range.rows.length], b = s.moveFormulaRefOffset(_ || "", I, f);
834
+ if (c.unitId !== e || c.subUnitId !== t) {
835
+ const _ = i.getFormulaStringByCell(
836
+ c.range.rows[d % c.range.rows.length],
837
+ c.range.cols[u % c.range.cols.length],
838
+ c.subUnitId,
839
+ c.unitId
840
+ ), I = n.cols[u] - c.range.cols[u % c.range.cols.length], f = n.rows[d] - c.range.rows[d % c.range.rows.length], b = s.moveFormulaRefOffset(_ || "", I, f);
841
841
  v.si = null, v.f = b;
842
842
  } else
843
843
  v.si = a.si, v.f = null;
844
844
  v.v = null, v.p = null, l.setValue(S, p, v);
845
845
  } else if (De(a.f)) {
846
- const _ = `${d % i.range.rows.length}_${u % i.range.cols.length}`;
846
+ const _ = `${d % c.range.rows.length}_${u % c.range.cols.length}`;
847
847
  let I = g.get(_);
848
848
  if (I)
849
849
  v.si = I, v.f = null;
850
850
  else {
851
851
  I = qt(6), g.set(_, I);
852
- const f = n.cols[u] - i.range.cols[u % i.range.cols.length], b = n.rows[d] - i.range.rows[d % i.range.rows.length], y = s.moveFormulaRefOffset(a.f || "", f, b);
852
+ const f = n.cols[u] - c.range.cols[u % c.range.cols.length], b = n.rows[d] - c.range.rows[d % c.range.rows.length], y = s.moveFormulaRefOffset(a.f || "", f, b);
853
853
  v.si = I, v.f = y;
854
854
  }
855
855
  v.v = null, v.p = null, l.setValue(S, p, v);
856
856
  } else (C = m == null ? void 0 : m[S]) != null && C[p] && (v.v = a.v, v.f = null, v.si = null, v.p = a.p, l.setValue(S, p, v));
857
857
  }), h.length > 0 && new Le(m).forValue((d, u, a) => {
858
- if (!(i.range.rows.includes(d) && i.range.cols.includes(u)) && !(n.rows.includes(d) && n.cols.includes(u)) && h.includes(a == null ? void 0 : a.si)) {
859
- const S = c.getFormulaStringByCell(
858
+ if (!(c.range.rows.includes(d) && c.range.cols.includes(u)) && !(n.rows.includes(d) && n.cols.includes(u)) && h.includes(a == null ? void 0 : a.si)) {
859
+ const S = i.getFormulaStringByCell(
860
860
  d,
861
861
  u,
862
- i.subUnitId,
863
- i.unitId
862
+ c.subUnitId,
863
+ c.unitId
864
864
  );
865
865
  l.setValue(d, u, {
866
866
  f: S,
@@ -881,16 +881,16 @@ function Or(e) {
881
881
  }
882
882
  }
883
883
  var oi = Object.getOwnPropertyDescriptor, si = (e, t, n, o) => {
884
- for (var r = o > 1 ? void 0 : o ? oi(t, n) : t, s = e.length - 1, c; s >= 0; s--)
885
- (c = e[s]) && (r = c(r) || r);
884
+ for (var r = o > 1 ? void 0 : o ? oi(t, n) : t, s = e.length - 1, i; s >= 0; s--)
885
+ (i = e[s]) && (r = i(r) || r);
886
886
  return r;
887
887
  }, Be = (e, t) => (n, o) => t(n, o, e);
888
888
  let Wt = class extends dt {
889
- constructor(t, n, o, r, s, c, i, l) {
889
+ constructor(t, n, o, r, s, i, c, l) {
890
890
  super();
891
891
  q(this, "_previousShape");
892
892
  q(this, "_skeleton");
893
- this._context = t, this._sheetInterceptorService = n, this._formulaDataModel = o, this._themeService = r, this._renderManagerService = s, this._sheetSkeletonManagerService = c, this._commandService = i, this._logService = l, this._initSkeletonChangeListener(), this._initInterceptorEditorStart(), this._commandExecutedListener();
893
+ this._context = t, this._sheetInterceptorService = n, this._formulaDataModel = o, this._themeService = r, this._renderManagerService = s, this._sheetSkeletonManagerService = i, this._commandService = c, this._logService = l, this._initSkeletonChangeListener(), this._initInterceptorEditorStart(), this._commandExecutedListener();
894
894
  }
895
895
  _initSkeletonChangeListener() {
896
896
  this.disposeWithMe(
@@ -903,8 +903,8 @@ let Wt = class extends dt {
903
903
  if (this._changeRuntime(r), s !== r.worksheet.getSheetId())
904
904
  this._removeArrayFormulaRangeShape();
905
905
  else {
906
- const { unitId: c, sheetId: i } = t;
907
- this._updateArrayFormulaRangeShape(c, i);
906
+ const { unitId: i, sheetId: c } = t;
907
+ this._updateArrayFormulaRangeShape(i, c);
908
908
  }
909
909
  }
910
910
  })
@@ -919,15 +919,15 @@ let Wt = class extends dt {
919
919
  this._sheetInterceptorService.writeCellInterceptor.intercept(ss, {
920
920
  handler: (t, n, o) => {
921
921
  var a, S, p, v;
922
- const { row: r, col: s, unitId: c, subUnitId: i, worksheet: l } = n, g = this._formulaDataModel.getArrayFormulaRange(), m = this._formulaDataModel.getArrayFormulaCellData();
922
+ const { row: r, col: s, unitId: i, subUnitId: c, worksheet: l } = n, g = this._formulaDataModel.getArrayFormulaRange(), m = this._formulaDataModel.getArrayFormulaCellData();
923
923
  if (this._removeArrayFormulaRangeShape(), t == null)
924
924
  return o(t);
925
925
  let h = null;
926
- const d = this._formulaDataModel.getFormulaStringByCell(r, s, i, c);
927
- if (d !== null && (h = { f: d }), t.v != null && t.v !== "" && ((p = (S = (a = m[c]) == null ? void 0 : a[i]) == null ? void 0 : S[r]) == null ? void 0 : p[s]) == null)
926
+ const d = this._formulaDataModel.getFormulaStringByCell(r, s, c, i);
927
+ if (d !== null && (h = { f: d }), t.v != null && t.v !== "" && ((p = (S = (a = m[i]) == null ? void 0 : a[c]) == null ? void 0 : S[r]) == null ? void 0 : p[s]) == null)
928
928
  return h ? { ...t, ...h } : o(t);
929
- const u = (v = g == null ? void 0 : g[c]) == null ? void 0 : v[i];
930
- return u != null && (h = this._displayArrayFormulaRangeShape(u, r, s, c, i, l, h)), h ? { ...t, ...h } : o(t);
929
+ const u = (v = g == null ? void 0 : g[i]) == null ? void 0 : v[c];
930
+ return u != null && (h = this._displayArrayFormulaRangeShape(u, r, s, i, c, l, h)), h ? { ...t, ...h } : o(t);
931
931
  }
932
932
  })
933
933
  )
@@ -945,7 +945,7 @@ let Wt = class extends dt {
945
945
  })
946
946
  );
947
947
  }
948
- _displayArrayFormulaRangeShape(t, n, o, r, s, c, i) {
948
+ _displayArrayFormulaRangeShape(t, n, o, r, s, i, c) {
949
949
  const l = this._formulaDataModel.getSheetFormulaData(r, s);
950
950
  return new Le(t).forValue((g, m, h) => {
951
951
  var p;
@@ -955,23 +955,23 @@ let Wt = class extends dt {
955
955
  if (g === n && m === o)
956
956
  return this._createArrayFormulaRangeShape(h, r), !1;
957
957
  if (n >= d && n <= a && o >= u && o <= S) {
958
- const v = c.getCell(d, u);
958
+ const v = i.getCell(d, u);
959
959
  if ((v == null ? void 0 : v.v) === ue.SPILL)
960
960
  return;
961
961
  const C = (p = l == null ? void 0 : l[g]) == null ? void 0 : p[m];
962
- return C == null || C.f == null ? !0 : (i == null && (i = {
962
+ return C == null || C.f == null ? !0 : (c == null && (c = {
963
963
  f: C.f,
964
964
  isInArrayFormulaRange: !0
965
965
  }), this._createArrayFormulaRangeShape(h, r), !1);
966
966
  }
967
- }), i;
967
+ }), c;
968
968
  }
969
969
  _createArrayFormulaRangeShape(t, n) {
970
970
  const o = this._renderManagerService.getRenderById(n), r = this._sheetSkeletonManagerService.getCurrentSkeleton();
971
971
  if (!o || !r) return;
972
972
  const { scene: s } = o;
973
973
  if (!s) return;
974
- const c = {
974
+ const i = {
975
975
  range: t,
976
976
  primary: null,
977
977
  style: {
@@ -980,20 +980,20 @@ let Wt = class extends dt {
980
980
  fill: new dn(this._themeService.getColorFromTheme("white")).setAlpha(0).toString(),
981
981
  widgets: {}
982
982
  }
983
- }, i = nn(c, r), { rowHeaderWidth: l, columnHeaderHeight: g } = r, m = new ar(s, Eo.FORMULA_EDITOR_SHOW, this._themeService, {
983
+ }, c = nn(i, r), { rowHeaderWidth: l, columnHeaderHeight: g } = r, m = new ar(s, Eo.FORMULA_EDITOR_SHOW, this._themeService, {
984
984
  highlightHeader: !1,
985
985
  rowHeaderWidth: l,
986
986
  columnHeaderHeight: g
987
987
  });
988
- m.updateRangeBySelectionWithCoord(i), m.setEvent(!1), this._previousShape = m;
988
+ m.updateRangeBySelectionWithCoord(c), m.setEvent(!1), this._previousShape = m;
989
989
  }
990
990
  _removeArrayFormulaRangeShape() {
991
991
  this._previousShape != null && (this._previousShape.dispose(), this._previousShape = null);
992
992
  }
993
993
  _refreshArrayFormulaRangeShape(t, n) {
994
994
  if (this._previousShape) {
995
- const { startRow: o, endRow: r, startColumn: s, endColumn: c } = this._previousShape.getRange(), i = { startRow: o, endRow: r, startColumn: s, endColumn: c };
996
- this._removeArrayFormulaRangeShape(), this._createArrayFormulaRangeShape(i, t);
995
+ const { startRow: o, endRow: r, startColumn: s, endColumn: i } = this._previousShape.getRange(), c = { startRow: o, endRow: r, startColumn: s, endColumn: i };
996
+ this._removeArrayFormulaRangeShape(), this._createArrayFormulaRangeShape(c, t);
997
997
  }
998
998
  }
999
999
  _checkCurrentSheet(t, n) {
@@ -1007,15 +1007,15 @@ let Wt = class extends dt {
1007
1007
  }
1008
1008
  _refreshArrayFormulaRangeShapeByRow(t, n, o) {
1009
1009
  if (!this._checkCurrentSheet(t, n) || !this._previousShape) return;
1010
- const { startRow: r, endRow: s, startColumn: c, endColumn: i } = this._previousShape.getRange();
1010
+ const { startRow: r, endRow: s, startColumn: i, endColumn: c } = this._previousShape.getRange();
1011
1011
  for (let l = 0; l < o.length; l++) {
1012
1012
  const { row: g } = o[l];
1013
1013
  if (r >= g) {
1014
1014
  const m = {
1015
1015
  startRow: r,
1016
1016
  endRow: s,
1017
- startColumn: c,
1018
- endColumn: i
1017
+ startColumn: i,
1018
+ endColumn: c
1019
1019
  };
1020
1020
  this._refreshArrayFormulaRangeShape(t, m);
1021
1021
  break;
@@ -1033,8 +1033,8 @@ Wt = si([
1033
1033
  Be(7, to)
1034
1034
  ], Wt);
1035
1035
  var ii = Object.getOwnPropertyDescriptor, ci = (e, t, n, o) => {
1036
- for (var r = o > 1 ? void 0 : o ? ii(t, n) : t, s = e.length - 1, c; s >= 0; s--)
1037
- (c = e[s]) && (r = c(r) || r);
1036
+ for (var r = o > 1 ? void 0 : o ? ii(t, n) : t, s = e.length - 1, i; s >= 0; s--)
1037
+ (i = e[s]) && (r = i(r) || r);
1038
1038
  return r;
1039
1039
  }, Xn = (e, t) => (n, o) => t(n, o, e);
1040
1040
  const ai = {
@@ -1050,8 +1050,8 @@ let Ht = class extends no {
1050
1050
  {
1051
1051
  effect: ro.Style,
1052
1052
  handler: (n, o, r) => {
1053
- var i, l, g, m;
1054
- const s = (m = (g = (l = (i = this._formulaDataModel.getArrayFormulaCellData()) == null ? void 0 : i[o.unitId]) == null ? void 0 : l[o.subUnitId]) == null ? void 0 : g[o.row]) == null ? void 0 : m[o.col];
1053
+ var c, l, g, m;
1054
+ const s = (m = (g = (l = (c = this._formulaDataModel.getArrayFormulaCellData()) == null ? void 0 : c[o.unitId]) == null ? void 0 : l[o.subUnitId]) == null ? void 0 : g[o.row]) == null ? void 0 : m[o.col];
1055
1055
  return !ur(n, !!s) || !n || (n === o.rawData && (n = { ...o.rawData }), n.markers = {
1056
1056
  ...n == null ? void 0 : n.markers,
1057
1057
  ...ai
@@ -1126,7 +1126,7 @@ function Ct(e) {
1126
1126
  function di(e) {
1127
1127
  const { functionInfo: t, onChange: n } = e;
1128
1128
  if (!t) return null;
1129
- const [o, r] = V([]), [s, c] = V(t.functionParameter), [i, l] = V(-1);
1129
+ const [o, r] = V([]), [s, i] = V(t.functionParameter), [c, l] = V(-1);
1130
1130
  return /* @__PURE__ */ W("div", { children: [
1131
1131
  /* @__PURE__ */ M("div", { className: re("univer-h-[364px] univer-overflow-y-auto", ut), children: s.map((g, m) => /* @__PURE__ */ W("div", { children: [
1132
1132
  /* @__PURE__ */ M("div", { className: "univer-text-sm", children: g.name }),
@@ -1135,8 +1135,8 @@ function di(e) {
1135
1135
  /* @__PURE__ */ M("div", { className: re("univer-flex-1 univer-p-3", Es), children: /* @__PURE__ */ M(
1136
1136
  Ct,
1137
1137
  {
1138
- title: i === -1 ? /* @__PURE__ */ M(xr, { prefix: t.functionName, value: s }) : s[i].name,
1139
- value: i === -1 ? t.description : s[i].detail
1138
+ title: c === -1 ? /* @__PURE__ */ M(xr, { prefix: t.functionName, value: s }) : s[c].name,
1139
+ value: c === -1 ? t.description : s[c].detail
1140
1140
  }
1141
1141
  ) })
1142
1142
  ] });
@@ -1157,24 +1157,24 @@ var me = function() {
1157
1157
  t.indexOf(o[r]) < 0 && Object.prototype.propertyIsEnumerable.call(e, o[r]) && (n[o[r]] = e[o[r]]);
1158
1158
  return n;
1159
1159
  }, tt = we(function(e, t) {
1160
- var n = e.icon, o = e.id, r = e.className, s = e.extend, c = hi(e, ["icon", "id", "className", "extend"]), i = "univerjs-icon univerjs-icon-".concat(o, " ").concat(r || "").trim(), l = z("_".concat(mi()));
1161
- return Mr(n, "".concat(o), { defIds: n.defIds, idSuffix: l.current }, me({ ref: t, className: i }, c), s);
1160
+ var n = e.icon, o = e.id, r = e.className, s = e.extend, i = hi(e, ["icon", "id", "className", "extend"]), c = "univerjs-icon univerjs-icon-".concat(o, " ").concat(r || "").trim(), l = z("_".concat(mi()));
1161
+ return Mr(n, "".concat(o), { defIds: n.defIds, idSuffix: l.current }, me({ ref: t, className: c }, i), s);
1162
1162
  });
1163
1163
  function Mr(e, t, n, o, r) {
1164
- return et(e.tag, me(me({ key: t }, fi(e, n, r)), o), (gi(e, n).children || []).map(function(s, c) {
1165
- return Mr(s, "".concat(t, "-").concat(e.tag, "-").concat(c), n, void 0, r);
1164
+ return et(e.tag, me(me({ key: t }, fi(e, n, r)), o), (gi(e, n).children || []).map(function(s, i) {
1165
+ return Mr(s, "".concat(t, "-").concat(e.tag, "-").concat(i), n, void 0, r);
1166
1166
  }));
1167
1167
  }
1168
1168
  function fi(e, t, n) {
1169
1169
  var o = me({}, e.attrs);
1170
1170
  n != null && n.colorChannel1 && o.fill === "colorChannel1" && (o.fill = n.colorChannel1), e.tag === "mask" && o.id && (o.id = o.id + t.idSuffix), Object.entries(o).forEach(function(s) {
1171
- var c = s[0], i = s[1];
1172
- c === "mask" && typeof i == "string" && (o[c] = i.replace(/url\(#(.*)\)/, "url(#$1".concat(t.idSuffix, ")")));
1171
+ var i = s[0], c = s[1];
1172
+ i === "mask" && typeof c == "string" && (o[i] = c.replace(/url\(#(.*)\)/, "url(#$1".concat(t.idSuffix, ")")));
1173
1173
  });
1174
1174
  var r = t.defIds;
1175
1175
  return !r || r.length === 0 || (e.tag === "use" && o["xlink:href"] && (o["xlink:href"] = o["xlink:href"] + t.idSuffix), Object.entries(o).forEach(function(s) {
1176
- var c = s[0], i = s[1];
1177
- typeof i == "string" && (o[c] = i.replace(/url\(#(.*)\)/, "url(#$1".concat(t.idSuffix, ")")));
1176
+ var i = s[0], c = s[1];
1177
+ typeof c == "string" && (o[i] = c.replace(/url\(#(.*)\)/, "url(#$1".concat(t.idSuffix, ")")));
1178
1178
  })), o;
1179
1179
  }
1180
1180
  function gi(e, t) {
@@ -1236,7 +1236,7 @@ var Ri = { tag: "svg", attrs: { xmlns: "http://www.w3.org/2000/svg", fill: "none
1236
1236
  });
1237
1237
  Lr.displayName = "SelectRangeIcon";
1238
1238
  function Ei(e) {
1239
- const { onChange: t } = e, n = "-1", [o, r] = V(""), [s, c] = V([]), [i, l] = V(0), [g, m] = V(n), [h, d] = V(0), [u, a] = V(null), S = T(Gt), p = T(ht), v = T(vn), C = Se(v.sidebarOptions$), _ = ui(dr, p);
1239
+ const { onChange: t } = e, n = "-1", [o, r] = V(""), [s, i] = V([]), [c, l] = V(0), [g, m] = V(n), [h, d] = V(0), [u, a] = V(null), S = T(Gt), p = T(ht), v = T(vn), C = Se(v.sidebarOptions$), _ = ui(dr, p);
1240
1240
  _.unshift({
1241
1241
  label: p.t("formula.moreFunctions.allFunctions"),
1242
1242
  value: n
@@ -1247,7 +1247,7 @@ function Ei(e) {
1247
1247
  }, []), $(() => {
1248
1248
  y(0);
1249
1249
  }, [s]), $(() => {
1250
- C != null && C.visible && (r(""), c([]), l(0), m(n), d(0), a(null), A(n));
1250
+ C != null && C.visible && (r(""), i([]), l(0), m(n), d(0), a(null), A(n));
1251
1251
  }, [C]);
1252
1252
  const b = (E) => {
1253
1253
  if (o.trim() === "") return E;
@@ -1269,21 +1269,21 @@ function Ei(e) {
1269
1269
  function A(E) {
1270
1270
  m(E);
1271
1271
  const x = S.getSearchListByType(+E);
1272
- c(x);
1272
+ i(x);
1273
1273
  }
1274
1274
  function F(E) {
1275
1275
  r(E);
1276
1276
  const x = S.getSearchListByName(E);
1277
- c(x);
1277
+ i(x);
1278
1278
  }
1279
1279
  function O(E) {
1280
1280
  if (E.stopPropagation(), E.key === "ArrowDown") {
1281
- const x = i + 1;
1281
+ const x = c + 1;
1282
1282
  l(x === s.length ? 0 : x);
1283
1283
  } else if (E.key === "ArrowUp") {
1284
- const x = i - 1;
1284
+ const x = c - 1;
1285
1285
  l(x === -1 ? s.length - 1 : x);
1286
- } else E.key === "Enter" && y(i);
1286
+ } else E.key === "Enter" && y(c);
1287
1287
  }
1288
1288
  const N = (E) => {
1289
1289
  l(E);
@@ -1315,7 +1315,7 @@ function Ei(e) {
1315
1315
  "li",
1316
1316
  {
1317
1317
  className: re("univer-relative univer-box-border univer-cursor-pointer univer-rounded univer-px-7 univer-py-1 univer-text-sm univer-text-gray-900 univer-transition-colors dark:!univer-text-white", {
1318
- "univer-bg-gray-200 dark:!univer-bg-gray-600": i === x
1318
+ "univer-bg-gray-200 dark:!univer-bg-gray-600": c === x
1319
1319
  }),
1320
1320
  onMouseEnter: () => N(x),
1321
1321
  onMouseLeave: k,
@@ -1362,9 +1362,9 @@ function Ei(e) {
1362
1362
  ] });
1363
1363
  }
1364
1364
  function Ii() {
1365
- const e = Io(), [t, n] = V(!0), [o, r] = V(!1), [s, c] = V(null);
1365
+ const e = Io(), [t, n] = V(!0), [o, r] = V(!1), [s, i] = V(null);
1366
1366
  T(hn);
1367
- const i = T(ht), l = T(Ge), g = T(ne), m = T(pe);
1367
+ const c = T(ht), l = T(Ge), g = T(ne), m = T(pe);
1368
1368
  function h() {
1369
1369
  n(!t), r(!o);
1370
1370
  }
@@ -1385,7 +1385,7 @@ function Ii() {
1385
1385
  "data-u-comp": "sheets-formula-functions-panel",
1386
1386
  className: "univer-box-border univer-flex univer-h-full univer-flex-col univer-justify-between univer-py-2",
1387
1387
  children: [
1388
- t && /* @__PURE__ */ M(Ei, { onChange: c }),
1388
+ t && /* @__PURE__ */ M(Ei, { onChange: i }),
1389
1389
  o && /* @__PURE__ */ M(di, { functionInfo: s, onChange: () => {
1390
1390
  } }),
1391
1391
  /* @__PURE__ */ W("div", { className: "univer-flex univer-justify-end", children: [
@@ -1395,17 +1395,17 @@ function Ii() {
1395
1395
  variant: "primary",
1396
1396
  onClick: h,
1397
1397
  className: "univer-mb-5 univer-ml-4 univer-mr-0 univer-mt-0",
1398
- children: i.t("formula.moreFunctions.next")
1398
+ children: c.t("formula.moreFunctions.next")
1399
1399
  }
1400
1400
  ),
1401
- o && /* @__PURE__ */ M(at, { onClick: h, className: "univer-mb-5 univer-ml-4 univer-mr-0 univer-mt-0", children: i.t("formula.moreFunctions.prev") }),
1401
+ o && /* @__PURE__ */ M(at, { onClick: h, className: "univer-mb-5 univer-ml-4 univer-mr-0 univer-mt-0", children: c.t("formula.moreFunctions.prev") }),
1402
1402
  t && !!e && /* @__PURE__ */ M(
1403
1403
  at,
1404
1404
  {
1405
1405
  variant: "primary",
1406
1406
  onClick: d,
1407
1407
  className: "univer-mb-5 univer-ml-4 univer-mr-0 univer-mt-0",
1408
- children: i.t("formula.moreFunctions.confirm")
1408
+ children: c.t("formula.moreFunctions.confirm")
1409
1409
  }
1410
1410
  )
1411
1411
  ] })
@@ -1665,13 +1665,13 @@ const Hi = {
1665
1665
  group: "4_sheet-edit"
1666
1666
  };
1667
1667
  var Bi = Object.getOwnPropertyDescriptor, ji = (e, t, n, o) => {
1668
- for (var r = o > 1 ? void 0 : o ? Bi(t, n) : t, s = e.length - 1, c; s >= 0; s--)
1669
- (c = e[s]) && (r = c(r) || r);
1668
+ for (var r = o > 1 ? void 0 : o ? Bi(t, n) : t, s = e.length - 1, i; s >= 0; s--)
1669
+ (i = e[s]) && (r = i(r) || r);
1670
1670
  return r;
1671
1671
  }, je = (e, t) => (n, o) => t(n, o, e);
1672
1672
  let Bt = class extends dt {
1673
- constructor(e, t, n, o, r, s, c) {
1674
- super(), this._injector = e, this._menuManagerService = t, this._commandService = n, this._shortcutService = o, this._uiPartsService = r, this._renderManagerService = s, this._componentManager = c, this._initialize();
1673
+ constructor(e, t, n, o, r, s, i) {
1674
+ super(), this._injector = e, this._menuManagerService = t, this._commandService = n, this._shortcutService = o, this._uiPartsService = r, this._renderManagerService = s, this._componentManager = i, this._initialize();
1675
1675
  }
1676
1676
  _initialize() {
1677
1677
  this._registerCommands(), this._registerMenus(), this._registerShortcuts(), this._registerComponents(), this._registerRenderModules();
@@ -1734,22 +1734,22 @@ class $r {
1734
1734
  }
1735
1735
  }
1736
1736
  var qi = Object.getOwnPropertyDescriptor, Ki = (e, t, n, o) => {
1737
- for (var r = o > 1 ? void 0 : o ? qi(t, n) : t, s = e.length - 1, c; s >= 0; s--)
1738
- (c = e[s]) && (r = c(r) || r);
1737
+ for (var r = o > 1 ? void 0 : o ? qi(t, n) : t, s = e.length - 1, i; s >= 0; s--)
1738
+ (i = e[s]) && (r = i(r) || r);
1739
1739
  return r;
1740
1740
  }, it = (e, t) => (n, o) => t(n, o, e);
1741
1741
  let $e = class extends Oo {
1742
- constructor(t, n, o, r, s, c, i) {
1742
+ constructor(t, n, o, r, s, i, c) {
1743
1743
  super(
1744
1744
  n,
1745
1745
  o,
1746
1746
  r,
1747
1747
  s,
1748
- c
1748
+ i
1749
1749
  );
1750
1750
  q(this, "_workbookSelections");
1751
1751
  q(this, "_eventDisposables");
1752
- this._context = t, this._contextService = c, this._refSelectionsService = i, this._workbookSelections = this._refSelectionsService.getWorkbookSelections(this._context.unitId), this._initSelectionChangeListener(), this._initSkeletonChangeListener(), this._initUserActionSyncListener(), this._setSelectionStyle(Yi(this._themeService)), this._remainLastEnabled = !0, this._highlightHeader = !1;
1752
+ this._context = t, this._contextService = i, this._refSelectionsService = c, this._workbookSelections = this._refSelectionsService.getWorkbookSelections(this._context.unitId), this._initSelectionChangeListener(), this._initSkeletonChangeListener(), this._initUserActionSyncListener(), this._setSelectionStyle(Yi(this._themeService)), this._remainLastEnabled = !0, this._highlightHeader = !1;
1753
1753
  }
1754
1754
  getLocation() {
1755
1755
  return this._skeleton.getLocation();
@@ -1783,28 +1783,28 @@ let $e = class extends Oo {
1783
1783
  this._disableSelectionChanging();
1784
1784
  }
1785
1785
  _initCanvasEventListeners() {
1786
- const t = this._getSheetObject(), { spreadsheetRowHeader: n, spreadsheetColumnHeader: o, spreadsheet: r, spreadsheetLeftTopPlaceholder: s } = t, { scene: c } = this._context, i = new qe();
1787
- return i.add(r == null ? void 0 : r.onPointerDown$.subscribeEvent((l, g) => {
1786
+ const t = this._getSheetObject(), { spreadsheetRowHeader: n, spreadsheetColumnHeader: o, spreadsheet: r, spreadsheetLeftTopPlaceholder: s } = t, { scene: i } = this._context, c = new qe();
1787
+ return c.add(r == null ? void 0 : r.onPointerDown$.subscribeEvent((l, g) => {
1788
1788
  this.inRefSelectionMode() && (this._onPointerDown(l, r.zIndex + 1, Ce.NORMAL, this._getActiveViewport(l)), l.button !== 2 && g.stopPropagation());
1789
- })), i.add(
1789
+ })), c.add(
1790
1790
  n == null ? void 0 : n.onPointerDown$.subscribeEvent((l, g) => {
1791
1791
  if (!this.inRefSelectionMode()) return;
1792
- const m = this._sheetSkeletonManagerService.getCurrent().skeleton, { row: h } = Fn(l.offsetX, l.offsetY, c, m);
1792
+ const m = this._sheetSkeletonManagerService.getCurrent().skeleton, { row: h } = Fn(l.offsetX, l.offsetY, i, m);
1793
1793
  Dn(this._workbookSelections.getCurrentSelections(), h, Ce.ROW) || (this._onPointerDown(l, (r.zIndex || 1) + 1, Ce.ROW, this._getActiveViewport(l), Qt.Y), l.button !== 2 && g.stopPropagation());
1794
1794
  })
1795
- ), i.add(o == null ? void 0 : o.onPointerDown$.subscribeEvent((l, g) => {
1795
+ ), c.add(o == null ? void 0 : o.onPointerDown$.subscribeEvent((l, g) => {
1796
1796
  if (!this.inRefSelectionMode()) return;
1797
- const m = this._sheetSkeletonManagerService.getCurrent().skeleton, { column: h } = Fn(l.offsetX, l.offsetY, c, m);
1797
+ const m = this._sheetSkeletonManagerService.getCurrent().skeleton, { column: h } = Fn(l.offsetX, l.offsetY, i, m);
1798
1798
  Dn(this._workbookSelections.getCurrentSelections(), h, Ce.COLUMN) || (this._onPointerDown(l, (r.zIndex || 1) + 1, Ce.COLUMN, this._getActiveViewport(l), Qt.X), l.button !== 2 && g.stopPropagation());
1799
- })), i.add(s == null ? void 0 : s.onPointerDown$.subscribeEvent((l, g) => {
1799
+ })), c.add(s == null ? void 0 : s.onPointerDown$.subscribeEvent((l, g) => {
1800
1800
  if (this._reset(), !this.inRefSelectionMode()) return;
1801
1801
  const m = this._sheetSkeletonManagerService.getCurrent().skeleton, h = No(m);
1802
1802
  this._addSelectionControlByModelData(h), this._selectionMoveStart$.next(this.getSelectionDataWithStyle());
1803
- const d = c.onPointerUp$.subscribeEvent(() => {
1803
+ const d = i.onPointerUp$.subscribeEvent(() => {
1804
1804
  d.unsubscribe(), this._selectionMoveEnd$.next(this.getSelectionDataWithStyle());
1805
1805
  });
1806
1806
  l.button !== 2 && g.stopPropagation();
1807
- })), i;
1807
+ })), c;
1808
1808
  }
1809
1809
  /**
1810
1810
  * Add a selection in spreadsheet, create a new SelectionControl and then update this control by range derives from selection.
@@ -1812,8 +1812,8 @@ let $e = class extends Oo {
1812
1812
  * @param {ISelectionWithCoord} selectionWithStyle
1813
1813
  */
1814
1814
  _addSelectionControlByModelData(t) {
1815
- var c;
1816
- const n = this._skeleton, o = (c = t.style) != null ? c : lr(this._themeService), r = this._scene;
1815
+ var i;
1816
+ const n = this._skeleton, o = (i = t.style) != null ? i : lr(this._themeService), r = this._scene;
1817
1817
  return t.style = o, this.newSelectionControl(r, n, t);
1818
1818
  }
1819
1819
  _initSelectionChangeListener() {
@@ -1843,10 +1843,11 @@ let $e = class extends Oo {
1843
1843
  }
1844
1844
  _initSkeletonChangeListener() {
1845
1845
  this.disposeWithMe(this._sheetSkeletonManagerService.currentSkeleton$.subscribe((t) => {
1846
+ var i;
1846
1847
  if (!t)
1847
1848
  return;
1848
1849
  const { skeleton: n } = t, { scene: o } = this._context, r = o.getViewport(Wn.VIEW_MAIN);
1849
- this._skeleton && this._skeleton.worksheet.getSheetId() !== n.worksheet.getSheetId() && this._reset(), this._changeRuntime(n, o, r);
1850
+ this._skeleton && ((i = this._skeleton.worksheet) == null ? void 0 : i.getSheetId()) !== n.worksheet.getSheetId() && this._reset(), this._changeRuntime(n, o, r);
1850
1851
  const s = this._workbookSelections.getCurrentSelections();
1851
1852
  this.resetSelectionsByModelData(s);
1852
1853
  }));
@@ -1872,15 +1873,15 @@ let $e = class extends Oo {
1872
1873
  _onPointerDown(t, n = 0, o = Ce.NORMAL, r, s = Qt.ALL) {
1873
1874
  var O;
1874
1875
  this._rangeType = o;
1875
- const c = this._skeleton, i = this._scene;
1876
- if (!i || !c)
1876
+ const i = this._skeleton, c = this._scene;
1877
+ if (!c || !i)
1877
1878
  return;
1878
1879
  r && (this._activeViewport = r);
1879
- const { offsetX: l, offsetY: g } = t, m = i.getViewport(Wn.VIEW_MAIN);
1880
+ const { offsetX: l, offsetY: g } = t, m = c.getViewport(Wn.VIEW_MAIN);
1880
1881
  if (!m) return;
1881
- const h = i.getCoordRelativeToViewport(Hn.FromArray([l, g])), { x: d, y: u } = h;
1882
+ const h = c.getCoordRelativeToViewport(Hn.FromArray([l, g])), { x: d, y: u } = h;
1882
1883
  this._startViewportPosX = d, this._startViewportPosY = u;
1883
- const a = i.getScrollXYInfoByViewport(h), { scaleX: S, scaleY: p } = i.getAncestorScale(), v = this._skeleton.getCellByOffset(d, u, S, p, a);
1884
+ const a = c.getScrollXYInfoByViewport(h), { scaleX: S, scaleY: p } = c.getAncestorScale(), v = this._skeleton.getCellByOffset(d, u, S, p, a);
1884
1885
  if (!v) return;
1885
1886
  switch (o) {
1886
1887
  case Ce.NORMAL:
@@ -1916,14 +1917,14 @@ let $e = class extends Oo {
1916
1917
  A && y ? this._makeSelectionByTwoCells(
1917
1918
  y,
1918
1919
  I,
1919
- c,
1920
+ i,
1920
1921
  o,
1921
1922
  f
1922
1923
  // Get updated in this method
1923
- ) : F && f ? f.updateRangeBySelectionWithCoord(_) : f = this.newSelectionControl(i, c, C);
1924
+ ) : F && f ? f.updateRangeBySelectionWithCoord(_) : f = this.newSelectionControl(c, i, C);
1924
1925
  for (let N = 0; N < this.getSelectionControls().length - 1; N++)
1925
1926
  this.getSelectionControls()[N].clearHighlight();
1926
- this._selectionMoveStart$.next(this.getSelectionDataWithStyle()), i.disableObjectsEvent(), this._clearUpdatingListeners(), this._addEndingListeners(), (O = i.getTransformer()) == null || O.clearSelectedObjects(), this._setupPointerMoveListener(m, f, o, s, d, u), this._escapeShortcutDisposable = this._shortcutService.forceEscape(), this._scenePointerUpSub = i.onPointerUp$.subscribeEvent(() => {
1927
+ this._selectionMoveStart$.next(this.getSelectionDataWithStyle()), c.disableObjectsEvent(), this._clearUpdatingListeners(), this._addEndingListeners(), (O = c.getTransformer()) == null || O.clearSelectedObjects(), this._setupPointerMoveListener(m, f, o, s, d, u), this._escapeShortcutDisposable = this._shortcutService.forceEscape(), this._scenePointerUpSub = c.onPointerUp$.subscribeEvent(() => {
1927
1928
  var N;
1928
1929
  this._clearUpdatingListeners(), this._selectionMoveEnd$.next(this.getSelectionDataWithStyle()), (N = this._escapeShortcutDisposable) == null || N.dispose(), this._escapeShortcutDisposable = null;
1929
1930
  });
@@ -1936,13 +1937,13 @@ let $e = class extends Oo {
1936
1937
  * @returns {SelectionControl} selectionControl just created
1937
1938
  */
1938
1939
  newSelectionControl(t, n, o) {
1939
- const r = this.getSelectionControls().length, { rowHeaderWidth: s, columnHeaderHeight: c } = n, i = new ar(t, r, this._themeService, {
1940
+ const r = this.getSelectionControls().length, { rowHeaderWidth: s, columnHeaderHeight: i } = n, c = new ar(t, r, this._themeService, {
1940
1941
  highlightHeader: this._highlightHeader,
1941
1942
  enableAutoFill: !1,
1942
1943
  rowHeaderWidth: s,
1943
- columnHeaderHeight: c
1944
+ columnHeaderHeight: i
1944
1945
  }), l = nn(o, n);
1945
- return i.updateRangeBySelectionWithCoord(l), this._selectionControls.push(i), i.setControlExtension({
1946
+ return c.updateRangeBySelectionWithCoord(l), this._selectionControls.push(c), c.setControlExtension({
1946
1947
  skeleton: n,
1947
1948
  scene: t,
1948
1949
  themeService: this._themeService,
@@ -1952,7 +1953,7 @@ let $e = class extends Oo {
1952
1953
  this._selectionMoveEnd$.next(this.getSelectionDataWithStyle());
1953
1954
  }
1954
1955
  }
1955
- }), i;
1956
+ }), c;
1956
1957
  }
1957
1958
  };
1958
1959
  $e = Ki([
@@ -1969,17 +1970,17 @@ function Yi(e) {
1969
1970
  }
1970
1971
  const Rn = (e, t, n = !0) => {
1971
1972
  let o = -1;
1972
- return e.reduce((r, s, c) => {
1973
+ return e.reduce((r, s, i) => {
1973
1974
  if (r.isFinish)
1974
1975
  return r;
1975
- const i = r.currentIndex;
1976
+ const c = r.currentIndex;
1976
1977
  if (typeof s != "string")
1977
1978
  r.currentIndex += s.token.length;
1978
1979
  else {
1979
1980
  const l = s.length;
1980
1981
  r.currentIndex += l;
1981
1982
  }
1982
- return (n ? r.currentIndex === t : t > i && t <= r.currentIndex) && (o = c, r.isFinish = !0), r;
1983
+ return (n ? r.currentIndex === t : t > c && t <= r.currentIndex) && (o = i, r.isFinish = !0), r;
1983
1984
  }, { currentIndex: 0, isFinish: !1 }), o;
1984
1985
  }, Pr = (e, t) => {
1985
1986
  const n = e[t];
@@ -2004,7 +2005,7 @@ const Rn = (e, t, n = !0) => {
2004
2005
  }, [e, t]);
2005
2006
  };
2006
2007
  function Ur(e, t, n) {
2007
- const o = T(Ge), r = ie(() => new gr({ left: -999, top: -999, right: -999, bottom: -999 }), []), s = T(vn), c = T(ne), i = te(() => {
2008
+ const o = T(Ge), r = ie(() => new gr({ left: -999, top: -999, right: -999, bottom: -999 }), []), s = T(vn), i = T(ne), c = te(() => {
2008
2009
  var _;
2009
2010
  const l = o.getEditor(e);
2010
2011
  if (!l)
@@ -2019,22 +2020,22 @@ function Ur(e, t, n) {
2019
2020
  return r.next({ left: a - 1, right: p + 1, top: S - 1, bottom: v + 1 }), g;
2020
2021
  });
2021
2022
  return $(() => {
2022
- t && i();
2023
- }, [e, o, c.unitAdded$, i, t, ...n != null ? n : []]), Gi(i), $(() => {
2024
- const l = s.scrollEvent$.pipe(Yo(100)).subscribe(i);
2023
+ t && c();
2024
+ }, [e, o, i.unitAdded$, c, t, ...n != null ? n : []]), Gi(c), $(() => {
2025
+ const l = s.scrollEvent$.pipe(Yo(100)).subscribe(c);
2025
2026
  return () => {
2026
2027
  l.unsubscribe();
2027
2028
  };
2028
- }, []), [r, i];
2029
+ }, []), [r, c];
2029
2030
  }
2030
2031
  const nt = (e) => {
2031
2032
  const t = z(e);
2032
2033
  return t.current = e, t;
2033
2034
  }, Zi = (e, t, n) => {
2034
- const o = T(zt), r = T(Gt), s = T(Re), [c, i] = V(), [l, g] = V(-1), [m, h] = V(!0), d = nt(m), u = z(t);
2035
+ const o = T(zt), r = T(Gt), s = T(Re), [i, c] = V(), [l, g] = V(-1), [m, h] = V(!0), d = nt(m), u = z(t);
2035
2036
  u.current = t;
2036
2037
  const a = () => {
2037
- i(void 0), g(-1), h(!1);
2038
+ c(void 0), g(-1), h(!1);
2038
2039
  };
2039
2040
  return $(() => {
2040
2041
  const S = s.sequenceNodesBuilder(t.slice(1));
@@ -2049,19 +2050,19 @@ const nt = (e) => {
2049
2050
  if (f)
2050
2051
  if (typeof f != "string" && f.nodeType === 3 && !r.hasDefinedNameDescription(f.token.trim()) && b === Ke.OPEN_BRACKET) {
2051
2052
  const y = r.getFunctionInfo(f.token);
2052
- i(y), g(-1);
2053
+ c(y), g(-1);
2053
2054
  return;
2054
2055
  } else {
2055
2056
  const y = s.getFunctionAndParameter(`${u.current}A`, _ - 1);
2056
2057
  if (y) {
2057
2058
  const { functionName: A, paramIndex: F } = y, O = r.getFunctionInfo(A);
2058
- i(O), g(F);
2059
+ c(O), g(F);
2059
2060
  return;
2060
2061
  }
2061
2062
  }
2062
2063
  }
2063
2064
  }
2064
- i(void 0), g(-1);
2065
+ c(void 0), g(-1);
2065
2066
  }), p = n.selectionChange$.pipe(
2066
2067
  mr((v) => v.textRanges.length === 1),
2067
2068
  fr((v) => v.textRanges[0].startOffset),
@@ -2076,7 +2077,7 @@ const nt = (e) => {
2076
2077
  }, [n, e]), $(() => {
2077
2078
  e || a();
2078
2079
  }, [e]), {
2079
- functionInfo: c,
2080
+ functionInfo: i,
2080
2081
  paramIndex: l,
2081
2082
  reset: a
2082
2083
  };
@@ -2109,23 +2110,23 @@ const nt = (e) => {
2109
2110
  t,
2110
2111
  "("
2111
2112
  ] }),
2112
- n && n.map((s, c) => /* @__PURE__ */ W("span", { children: [
2113
+ n && n.map((s, i) => /* @__PURE__ */ W("span", { children: [
2113
2114
  /* @__PURE__ */ M(
2114
2115
  "span",
2115
2116
  {
2116
- className: o === c ? "univer-text-primary-500" : "",
2117
- onClick: () => r(c),
2117
+ className: o === i ? "univer-text-primary-500" : "",
2118
+ onClick: () => r(i),
2118
2119
  children: Nr(s)
2119
2120
  }
2120
2121
  ),
2121
- c === n.length - 1 ? "" : ","
2122
+ i === n.length - 1 ? "" : ","
2122
2123
  ] }, s.name)),
2123
2124
  ")"
2124
2125
  ] });
2125
2126
  }, Qn = () => {
2126
2127
  };
2127
2128
  function Qi(e) {
2128
- const { onParamsSwitch: t = Qn, onClose: n = Qn, isFocus: o, editor: r, formulaText: s } = e, { functionInfo: c, paramIndex: i, reset: l } = Zi(o, s, r), g = T(hn), m = !Se(g.helpFunctionVisible$), [h, d] = V(!0), u = T(ht), a = u.t("formula.prompt.required"), S = u.t("formula.prompt.optional"), p = r.getEditorId(), [v] = Ur(p, !!c, [c, i]);
2129
+ const { onParamsSwitch: t = Qn, onClose: n = Qn, isFocus: o, editor: r, formulaText: s } = e, { functionInfo: i, paramIndex: c, reset: l } = Zi(o, s, r), g = T(hn), m = !Se(g.helpFunctionVisible$), [h, d] = V(!0), u = T(ht), a = u.t("formula.prompt.required"), S = u.t("formula.prompt.optional"), p = r.getEditorId(), [v] = Ur(p, !!i, [i, c]);
2129
2130
  function C(f) {
2130
2131
  t && t(f);
2131
2132
  }
@@ -2134,7 +2135,7 @@ function Qi(e) {
2134
2135
  }), I = () => {
2135
2136
  _(!0), n();
2136
2137
  };
2137
- return c ? m ? /* @__PURE__ */ M(rn, { portal: !0, anchorRect$: v, direction: "left-center", children: /* @__PURE__ */ M(zi, { onClick: () => _(!1) }) }, "hidden") : /* @__PURE__ */ M(rn, { portal: !0, onClickOutside: () => l(), anchorRect$: v, direction: "vertical", children: /* @__PURE__ */ W(
2138
+ return i ? m ? /* @__PURE__ */ M(rn, { portal: !0, anchorRect$: v, direction: "left-center", children: /* @__PURE__ */ M(zi, { onClick: () => _(!1) }) }, "hidden") : /* @__PURE__ */ M(rn, { portal: !0, onClickOutside: () => l(), anchorRect$: v, direction: "vertical", children: /* @__PURE__ */ W(
2138
2139
  "div",
2139
2140
  {
2140
2141
  className: re("univer-m-0 univer-box-border univer-w-[250px] univer-select-none univer-list-none univer-rounded-lg univer-bg-white univer-leading-5 univer-shadow-md univer-outline-none dark:!univer-bg-gray-900", Sn),
@@ -2147,9 +2148,9 @@ function Qi(e) {
2147
2148
  /* @__PURE__ */ M(
2148
2149
  Xi,
2149
2150
  {
2150
- prefix: c.functionName,
2151
- value: c.functionParameter,
2152
- active: i,
2151
+ prefix: i.functionName,
2152
+ value: i.functionParameter,
2153
+ active: c,
2153
2154
  onClick: C
2154
2155
  }
2155
2156
  ),
@@ -2188,20 +2189,20 @@ function Qi(e) {
2188
2189
  tn,
2189
2190
  {
2190
2191
  title: u.t("formula.prompt.helpExample"),
2191
- value: `${c.functionName}(${c.functionParameter.map((f) => f.example).join(",")})`
2192
+ value: `${i.functionName}(${i.functionParameter.map((f) => f.example).join(",")})`
2192
2193
  }
2193
2194
  ),
2194
2195
  /* @__PURE__ */ M(
2195
2196
  tn,
2196
2197
  {
2197
2198
  title: u.t("formula.prompt.helpAbstract"),
2198
- value: c.description
2199
+ value: i.description
2199
2200
  }
2200
2201
  ),
2201
- c && c.functionParameter && c.functionParameter.map((f, b) => /* @__PURE__ */ M(
2202
+ i && i.functionParameter && i.functionParameter.map((f, b) => /* @__PURE__ */ M(
2202
2203
  tn,
2203
2204
  {
2204
- className: i === b ? "univer-text-primary-500" : "",
2205
+ className: c === b ? "univer-text-primary-500" : "",
2205
2206
  title: f.name,
2206
2207
  value: `${f.require ? a : S} ${f.detail}`
2207
2208
  },
@@ -2220,15 +2221,15 @@ const Ji = (e) => {
2220
2221
  var r, s;
2221
2222
  if (e) {
2222
2223
  t.focus(e.getEditorId());
2223
- const c = [...e.getSelectionRanges()];
2224
+ const i = [...e.getSelectionRanges()];
2224
2225
  if (un.isDefine(o))
2225
2226
  e.setSelectionRanges([{ startOffset: o, endOffset: o }]);
2226
- else if (!c.length && !e.docSelectionRenderService.isOnPointerEvent) {
2227
- const i = (s = (r = e.getDocumentData().body) == null ? void 0 : r.dataStream) != null ? s : `\r
2228
- `, l = Math.max(i.length - 2, 0);
2227
+ else if (!i.length && !e.docSelectionRenderService.isOnPointerEvent) {
2228
+ const c = (s = (r = e.getDocumentData().body) == null ? void 0 : r.dataStream) != null ? s : `\r
2229
+ `, l = Math.max(c.length - 2, 0);
2229
2230
  e.setSelectionRanges([{ startOffset: l, endOffset: l }]);
2230
2231
  } else
2231
- e.setSelectionRanges(c);
2232
+ e.setSelectionRanges(i);
2232
2233
  }
2233
2234
  });
2234
2235
  };
@@ -2240,17 +2241,17 @@ function ec(e) {
2240
2241
  var Oe = /* @__PURE__ */ ((e) => (e[e.NOT_SELECT = 0] = "NOT_SELECT", e[e.NEED_ADD = 1] = "NEED_ADD", e[e.CAN_EDIT = 2] = "CAN_EDIT", e[e.EDIT_OTHER_SHEET_REFERENCE = 3] = "EDIT_OTHER_SHEET_REFERENCE", e[e.EDIT_OTHER_WORKBOOK_REFERENCE = 4] = "EDIT_OTHER_WORKBOOK_REFERENCE", e))(Oe || {});
2241
2242
  function tc(e) {
2242
2243
  var y;
2243
- const { editorId: t, isFocus: n, disableOnClick: o, unitId: r, subUnitId: s } = e, c = T(Me), i = T(ne), l = c.getRenderById(r), g = c.getRenderById(t), m = g == null ? void 0 : g.with(pr), h = T(Er), d = T(Et), [u, a] = V(
2244
+ const { editorId: t, isFocus: n, disableOnClick: o, unitId: r, subUnitId: s } = e, i = T(Me), c = T(ne), l = i.getRenderById(r), g = i.getRenderById(t), m = g == null ? void 0 : g.with(pr), h = T(Er), d = T(Et), [u, a] = V(
2244
2245
  0
2245
2246
  /* NOT_SELECT */
2246
- ), S = T(Re), p = z(!0), v = l == null ? void 0 : l.with($e), C = nt(u), _ = i.getUnit(r, H.UNIVER_SHEET), I = _ == null ? void 0 : _.getSheetBySheetId(s), f = te((A) => {
2247
+ ), S = T(Re), p = z(!0), v = l == null ? void 0 : l.with($e), C = nt(u), _ = c.getUnit(r, H.UNIVER_SHEET), I = _ == null ? void 0 : _.getSheetBySheetId(s), f = te((A) => {
2247
2248
  v && v.setSkipLastEnabled(
2248
2249
  A === 1 || A === 3 || A === 4
2249
2250
  /* EDIT_OTHER_WORKBOOK_REFERENCE */
2250
2251
  ), C.current = A, a(A);
2251
2252
  }), b = te(() => {
2252
2253
  var ce, ae, he;
2253
- const A = i.getCurrentUnitOfType(H.UNIVER_SHEET);
2254
+ const A = c.getCurrentUnitOfType(H.UNIVER_SHEET);
2254
2255
  if (!A) return;
2255
2256
  const F = A.getActiveSheet(), O = m == null ? void 0 : m.getActiveTextRange(), N = O != null && O.collapsed ? O.startOffset : -1, k = ec(d);
2256
2257
  if (!k) return;
@@ -2265,7 +2266,7 @@ function tc(e) {
2265
2266
  if (B) {
2266
2267
  if (p.current)
2267
2268
  return;
2268
- const { sheetName: K, unitId: J } = D.range, rt = (he = i.getCurrentUnitOfType(H.UNIVER_SHEET)) == null ? void 0 : he.getUnitId();
2269
+ const { sheetName: K, unitId: J } = D.range, rt = (he = c.getCurrentUnitOfType(H.UNIVER_SHEET)) == null ? void 0 : he.getUnitId();
2269
2270
  J && J !== rt ? f(
2270
2271
  4
2271
2272
  /* EDIT_OTHER_WORKBOOK_REFERENCE */
@@ -2311,13 +2312,13 @@ function tc(e) {
2311
2312
  if (!n) return;
2312
2313
  const A = _ == null ? void 0 : _.activeSheet$.subscribe(() => {
2313
2314
  b();
2314
- }), F = i.getCurrentTypeOfUnit$(H.UNIVER_SHEET).subscribe(() => {
2315
+ }), F = c.getCurrentTypeOfUnit$(H.UNIVER_SHEET).subscribe(() => {
2315
2316
  b();
2316
2317
  });
2317
2318
  return () => {
2318
2319
  A == null || A.unsubscribe(), F == null || F.unsubscribe();
2319
2320
  };
2320
- }, [b, n, _ == null ? void 0 : _.activeSheet$, i.getCurrentTypeOfUnit$]), { isSelecting: u, isSelectingRef: C };
2321
+ }, [b, n, _ == null ? void 0 : _.activeSheet$, c.getCurrentTypeOfUnit$]), { isSelecting: u, isSelectingRef: C };
2321
2322
  }
2322
2323
  const nc = () => {
2323
2324
  const e = T(Re);
@@ -2344,14 +2345,14 @@ function Vr(e) {
2344
2345
  currentWorkbook: o,
2345
2346
  refSelections: r,
2346
2347
  editor: s,
2347
- refSelectionsService: c,
2348
- refSelectionsRenderService: i,
2348
+ refSelectionsService: i,
2349
+ refSelectionsRenderService: c,
2349
2350
  sheetSkeletonManagerService: l,
2350
2351
  themeService: g,
2351
2352
  univerInstanceService: m
2352
2353
  } = e, h = o.getUnitId(), d = m.getUnit(t, H.UNIVER_SHEET), u = d == null ? void 0 : d.getActiveSheet(), a = [];
2353
2354
  if (!d || !u) {
2354
- c.setSelections(a);
2355
+ i.setSelections(a);
2355
2356
  return;
2356
2357
  }
2357
2358
  const S = u.getSheetId(), p = (b) => {
@@ -2373,12 +2374,12 @@ function Vr(e) {
2373
2374
  }
2374
2375
  if (s) {
2375
2376
  const b = (f = (I = s.getSelectionRanges()) == null ? void 0 : I[0]) == null ? void 0 : f.startOffset, y = C.findIndex((A) => A + 2 === b);
2376
- y !== -1 ? i == null || i.setActiveSelectionIndex(y) : i == null || i.resetActiveSelectionIndex();
2377
+ y !== -1 ? c == null || c.setActiveSelectionIndex(y) : c == null || c.resetActiveSelectionIndex();
2377
2378
  }
2378
2379
  return a;
2379
2380
  }
2380
2381
  function oc(e, t) {
2381
- const n = T(ne), o = T(It), r = T(Yt), s = T(Me), c = Se(ie(() => n.getCurrentTypeOfUnit$(H.UNIVER_SHEET), [n])), i = c ? s.getRenderById(c.getUnitId()) : null, l = i == null ? void 0 : i.with($e), g = i == null ? void 0 : i.with(Kt), m = te((h, d) => {
2382
+ const n = T(ne), o = T(It), r = T(Yt), s = T(Me), i = Se(ie(() => n.getCurrentTypeOfUnit$(H.UNIVER_SHEET), [n])), c = i ? s.getRenderById(i.getUnitId()) : null, l = c == null ? void 0 : c.with($e), g = c == null ? void 0 : c.with(Kt), m = te((h, d) => {
2382
2383
  const u = n.getCurrentUnitOfType(H.UNIVER_SHEET);
2383
2384
  if (!u || l != null && l.selectionMoving) return;
2384
2385
  const a = Vr({
@@ -2402,8 +2403,8 @@ function oc(e, t) {
2402
2403
  }
2403
2404
  function Wr(e = "") {
2404
2405
  const t = T(Gt), n = sc(), o = T(pe), r = ie(() => e.length, [e]);
2405
- return te((c, i, l = !0, g) => {
2406
- const m = c.getDocumentData(), h = c.getEditorId();
2406
+ return te((i, c, l = !0, g) => {
2407
+ const m = i.getDocumentData(), h = i.getEditorId();
2407
2408
  if (!m)
2408
2409
  return [];
2409
2410
  const d = m.body;
@@ -2411,22 +2412,22 @@ function Wr(e = "") {
2411
2412
  return [];
2412
2413
  const u = d.dataStream.slice(0, d.dataStream.length - 2), a = { dataStream: "", ...m.body };
2413
2414
  if (!u.startsWith(e)) return [];
2414
- if (i == null || i.length === 0)
2415
+ if (c == null || c.length === 0)
2415
2416
  return a.textRuns = [], o.syncExecuteCommand(Vn.id, {
2416
2417
  unitId: h,
2417
2418
  body: wn(a, 0, a.dataStream.length - 2)
2418
2419
  }), [];
2419
2420
  {
2420
- const { textRuns: S, refSelections: p } = ic(t, n, i);
2421
+ const { textRuns: S, refSelections: p } = ic(t, n, c);
2421
2422
  r && S.forEach((_) => {
2422
2423
  _.ed = _.ed + r, _.st = _.st + r;
2423
2424
  }), a.textRuns = [{ st: 0, ed: 1, ts: { fs: 11 } }, ...S];
2424
- const v = i.reduce((_, I) => typeof I == "string" ? `${_}${I}` : `${_}${I.token}`, "");
2425
+ const v = c.reduce((_, I) => typeof I == "string" ? `${_}${I}` : `${_}${I.token}`, "");
2425
2426
  a.dataStream = `${e}${v}\r
2426
2427
  `;
2427
2428
  let C;
2428
2429
  if (l) {
2429
- C = c.getSelectionRanges();
2430
+ C = i.getSelectionRanges();
2430
2431
  const _ = a.dataStream.length - 2 + r;
2431
2432
  C.forEach((I) => {
2432
2433
  I.startOffset = Math.max(0, Math.min(I.startOffset, _)), I.endOffset = Math.max(0, Math.min(I.endOffset, _));
@@ -2456,23 +2457,23 @@ function sc() {
2456
2457
  e.getColorFromTheme("loop-color.10"),
2457
2458
  e.getColorFromTheme("loop-color.11"),
2458
2459
  e.getColorFromTheme("loop-color.12")
2459
- ].map((i) => e.isValidThemeColor(i) ? e.getColorFromTheme(i) : i), r = e.getColorFromTheme("blue.700"), s = e.getColorFromTheme("jiqing.800"), c = e.getColorFromTheme("black");
2460
- return { formulaRefColors: o, numberColor: r, stringColor: s, plainTextColor: c };
2460
+ ].map((c) => e.isValidThemeColor(c) ? e.getColorFromTheme(c) : c), r = e.getColorFromTheme("blue.700"), s = e.getColorFromTheme("jiqing.800"), i = e.getColorFromTheme("black");
2461
+ return { formulaRefColors: o, numberColor: r, stringColor: s, plainTextColor: i };
2461
2462
  }, [t]);
2462
2463
  }
2463
2464
  function ic(e, t, n) {
2464
- const { formulaRefColors: o, numberColor: r, stringColor: s, plainTextColor: c } = t, i = [], l = [], g = /* @__PURE__ */ new Map();
2465
+ const { formulaRefColors: o, numberColor: r, stringColor: s, plainTextColor: i } = t, c = [], l = [], g = /* @__PURE__ */ new Map();
2465
2466
  let m = 0;
2466
2467
  for (let h = 0, d = n.length; h < d; h++) {
2467
2468
  const u = n[h];
2468
2469
  if (typeof u == "string") {
2469
- const _ = i[i.length - 1], I = _ ? _.ed : 0, f = I + u.length;
2470
- i.push({
2470
+ const _ = c[c.length - 1], I = _ ? _.ed : 0, f = I + u.length;
2471
+ c.push({
2471
2472
  st: I,
2472
2473
  ed: f,
2473
2474
  ts: {
2474
2475
  cl: {
2475
- rgb: c
2476
+ rgb: i
2476
2477
  },
2477
2478
  fs: 11
2478
2479
  }
@@ -2480,12 +2481,12 @@ function ic(e, t, n) {
2480
2481
  continue;
2481
2482
  }
2482
2483
  if (e.hasDefinedNameDescription(u.token.trim())) {
2483
- i.push({
2484
+ c.push({
2484
2485
  st: u.startIndex,
2485
2486
  ed: u.endIndex + 1,
2486
2487
  ts: {
2487
2488
  cl: {
2488
- rgb: c
2489
+ rgb: i
2489
2490
  },
2490
2491
  fs: 11
2491
2492
  }
@@ -2510,7 +2511,7 @@ function ic(e, t, n) {
2510
2511
  index: l.length
2511
2512
  });
2512
2513
  } else p === Q.NUMBER ? C = r : (p === Q.STRING || p === Q.ARRAY) && (C = s);
2513
- C && C.length > 0 ? i.push({
2514
+ C && C.length > 0 ? c.push({
2514
2515
  st: a,
2515
2516
  ed: S + 1,
2516
2517
  ts: {
@@ -2519,29 +2520,29 @@ function ic(e, t, n) {
2519
2520
  },
2520
2521
  fs: 11
2521
2522
  }
2522
- }) : i.push({
2523
+ }) : c.push({
2523
2524
  st: a,
2524
2525
  ed: S + 1,
2525
2526
  ts: {
2526
2527
  cl: {
2527
- rgb: c
2528
+ rgb: i
2528
2529
  },
2529
2530
  fs: 11
2530
2531
  }
2531
2532
  });
2532
2533
  }
2533
- return { textRuns: i, refSelections: l };
2534
+ return { textRuns: c, refSelections: l };
2534
2535
  }
2535
2536
  const cc = (e, t, n, o) => {
2536
- const r = T(pe), s = T(Zt), c = z(t);
2537
- c.current = t;
2538
- const i = z(o);
2539
- i.current = o, $(() => {
2537
+ const r = T(pe), s = T(Zt), i = z(t);
2538
+ i.current = t;
2539
+ const c = z(o);
2540
+ c.current = o, $(() => {
2540
2541
  if (!n || !e)
2541
2542
  return;
2542
2543
  const g = `sheet.formula-embedding-editor.${n.getEditorId()}`, m = new qe(), h = (a, S) => {
2543
- if (i.current) {
2544
- i.current(a, S);
2544
+ if (c.current) {
2545
+ c.current(a, S);
2545
2546
  return;
2546
2547
  }
2547
2548
  let p = de.LEFT;
@@ -2552,11 +2553,11 @@ const cc = (e, t, n, o) => {
2552
2553
  });
2553
2554
  }, d = (a, S) => {
2554
2555
  let p = de.DOWN;
2555
- a === L.ARROW_DOWN ? p = de.DOWN : a === L.ARROW_UP ? p = de.UP : a === L.ARROW_LEFT ? p = de.LEFT : a === L.ARROW_RIGHT && (p = de.RIGHT), c.current ? S === P.CTRL_COMMAND ? r.executeCommand(Ln.id, {
2556
+ a === L.ARROW_DOWN ? p = de.DOWN : a === L.ARROW_UP ? p = de.UP : a === L.ARROW_LEFT ? p = de.LEFT : a === L.ARROW_RIGHT && (p = de.RIGHT), i.current ? S === P.CTRL_COMMAND ? r.executeCommand(Ln.id, {
2556
2557
  direction: p,
2557
2558
  jumpOver: $n.moveGap,
2558
2559
  extra: "formula-editor",
2559
- fromCurrentSelection: c.current === Oe.NEED_ADD || c.current === Oe.EDIT_OTHER_SHEET_REFERENCE
2560
+ fromCurrentSelection: i.current === Oe.NEED_ADD || i.current === Oe.EDIT_OTHER_SHEET_REFERENCE
2560
2561
  }) : S === P.SHIFT ? r.executeCommand(Pn.id, {
2561
2562
  direction: p,
2562
2563
  extra: "formula-editor"
@@ -2567,7 +2568,7 @@ const cc = (e, t, n, o) => {
2567
2568
  }) : r.executeCommand(Ln.id, {
2568
2569
  direction: p,
2569
2570
  extra: "formula-editor",
2570
- fromCurrentSelection: c.current === Oe.NEED_ADD || c.current === Oe.EDIT_OTHER_SHEET_REFERENCE
2571
+ fromCurrentSelection: i.current === Oe.NEED_ADD || i.current === Oe.EDIT_OTHER_SHEET_REFERENCE
2571
2572
  }) : h(a, S);
2572
2573
  };
2573
2574
  return m.add(r.registerCommand({
@@ -2612,29 +2613,29 @@ const cc = (e, t, n, o) => {
2612
2613
  }, [r, n, e, s]);
2613
2614
  }, ac = (e, t, n, o, r = !0) => {
2614
2615
  var u;
2615
- const s = T(Me), c = T(an), i = T(vs), l = T(Yt), g = T(ne), m = Se(ie(() => g.getCurrentTypeOfUnit$(H.UNIVER_SHEET), [g])), h = s.getRenderById((u = m == null ? void 0 : m.getUnitId()) != null ? u : ""), d = h == null ? void 0 : h.with($e);
2616
+ const s = T(Me), i = T(an), c = T(vs), l = T(Yt), g = T(ne), m = Se(ie(() => g.getCurrentTypeOfUnit$(H.UNIVER_SHEET), [g])), h = s.getRenderById((u = m == null ? void 0 : m.getUnitId()) != null ? u : ""), d = h == null ? void 0 : h.with($e);
2616
2617
  $t(() => {
2617
2618
  if (e)
2618
- return c.setContextValue(kn, !0), r && i.disable(), () => {
2619
+ return i.setContextValue(kn, !0), r && c.disable(), () => {
2619
2620
  const a = g.getCurrentUnitOfType(H.UNIVER_DOC);
2620
- (a == null ? void 0 : a.getUnitId()) === o && c.setContextValue(kn, !1), r && i.enable(), l.clear();
2621
+ (a == null ? void 0 : a.getUnitId()) === o && i.setContextValue(kn, !1), r && c.enable(), l.clear();
2621
2622
  };
2622
- }, [c, e, l, r, o]), $t(() => {
2623
+ }, [i, e, l, r, o]), $t(() => {
2623
2624
  if (e && t) {
2624
2625
  const a = d == null ? void 0 : d.enableSelectionChanging();
2625
- return c.setContextValue(Bn, !0), () => {
2626
- c.setContextValue(Bn, !1), a == null || a.dispose();
2626
+ return i.setContextValue(Bn, !0), () => {
2627
+ i.setContextValue(Bn, !1), a == null || a.dispose();
2627
2628
  };
2628
2629
  }
2629
- }, [c, e, d, t]), $(() => {
2630
+ }, [i, e, d, t]), $(() => {
2630
2631
  e && (d == null || d.setSkipLastEnabled(!1));
2631
2632
  }, [e, d]);
2632
2633
  }, lc = (e, t, n) => {
2633
2634
  const o = T(ne), r = T(gn);
2634
2635
  return Lt(() => {
2635
2636
  if (e) {
2636
- const c = [...r.getWorkbookSelections(t).getSelectionsOfWorksheet(n)], i = o.getCurrentUnitForType(H.UNIVER_SHEET), l = i == null ? void 0 : i.getActiveSheet();
2637
- (i == null ? void 0 : i.getUnitId()) !== t && o.setCurrentUnitForType(t), l && l.getSheetId() === n && r.setSelections(c);
2637
+ const i = [...r.getWorkbookSelections(t).getSelectionsOfWorksheet(n)], c = o.getCurrentUnitForType(H.UNIVER_SHEET), l = c == null ? void 0 : c.getActiveSheet();
2638
+ (c == null ? void 0 : c.getUnitId()) !== t && o.setCurrentUnitForType(t), l && l.getSheetId() === n && r.setSelections(i);
2638
2639
  }
2639
2640
  }, [e, r, n, t, o]);
2640
2641
  }, uc = (e) => e.reduce((t, n) => typeof n == "string" ? t + n.length : t + n.token.length, 0), cn = (e) => e.map((t) => typeof t == "string" ? t : t.token).join(""), At = (e, t = !1, n = "", o = !1) => !t && !o ? e.map((r) => _e(r.range)) : e.map((r) => o ? Vo(r) : r.sheetName !== "" && r.sheetName !== n ? _t(r.sheetName, r.range) : _e(r.range)), dc = (e) => {
@@ -2642,16 +2643,16 @@ const cc = (e, t, n, o) => {
2642
2643
  const { editor: t, lexerTreeBuilder: n } = e, o = t == null ? void 0 : t.getSelectionRanges();
2643
2644
  if ((o == null ? void 0 : o.length) !== 1)
2644
2645
  return;
2645
- const s = o[0].startOffset - 1, c = ((h = (m = t == null ? void 0 : t.getDocumentData().body) == null ? void 0 : m.dataStream) != null ? h : `\r
2646
- `).slice(0, -2), i = (d = n.sequenceNodesBuilder(c.slice(1))) != null ? d : [], l = Rn(i, s, !1), g = Pr(i, l);
2646
+ const s = o[0].startOffset - 1, i = ((h = (m = t == null ? void 0 : t.getDocumentData().body) == null ? void 0 : m.dataStream) != null ? h : `\r
2647
+ `).slice(0, -2), c = (d = n.sequenceNodesBuilder(i.slice(1))) != null ? d : [], l = Rn(c, s, !1), g = Pr(c, l);
2647
2648
  return {
2648
2649
  nodeIndex: l,
2649
2650
  updatingRefIndex: g,
2650
- sequenceNodes: i,
2651
+ sequenceNodes: c,
2651
2652
  offset: s
2652
2653
  };
2653
2654
  }, hc = (() => {
2654
- }), fc = (e, t, n, o, r, s, c, i, l, g = hc) => {
2655
+ }), fc = (e, t, n, o, r, s, i, c, l, g = hc) => {
2655
2656
  var N;
2656
2657
  const m = T(Me), h = T(ne), d = T(pe), u = T(Er), a = T(It), S = T(Re), p = h.getUnit(o), v = te((k, E) => {
2657
2658
  var x, R, w;
@@ -2669,7 +2670,7 @@ const cc = (e, t, n, o) => {
2669
2670
  range: Y,
2670
2671
  unitId: (ce = Y.unitId) != null ? ce : f.getUnitId(),
2671
2672
  sheetName: v((ae = Y.unitId) != null ? ae : f.getUnitId(), Ie)
2672
- }, ee = Ie !== r, le = (f == null ? void 0 : f.getUnitId()) !== o, be = At([fe], c && (ee || le), C, le);
2673
+ }, ee = Ie !== r, le = (f == null ? void 0 : f.getUnitId()) !== o, be = At([fe], i && (ee || le), C, le);
2673
2674
  D.push({ token: be[0], nodeType: Q.REFERENCE });
2674
2675
  const Pe = [...D, ...X], ke = cn(Pe);
2675
2676
  g(ke, uc(D), E);
@@ -2678,7 +2679,7 @@ const cc = (e, t, n, o) => {
2678
2679
  range: Y,
2679
2680
  unitId: (K = Y.unitId) != null ? K : f.getUnitId(),
2680
2681
  sheetName: v((J = Y.unitId) != null ? J : f.getUnitId(), X)
2681
- }, fe = X !== r, ee = (f == null ? void 0 : f.getUnitId()) !== o, le = At([Ie], c && (fe || ee), C, ee);
2682
+ }, fe = X !== r, ee = (f == null ? void 0 : f.getUnitId()) !== o, le = At([Ie], i && (fe || ee), C, ee);
2682
2683
  D.unshift({ token: le[0], nodeType: Q.REFERENCE });
2683
2684
  const be = cn(D);
2684
2685
  g(be, le[0].length, E);
@@ -2706,7 +2707,7 @@ const cc = (e, t, n, o) => {
2706
2707
  return G;
2707
2708
  if (G.nodeType === Q.REFERENCE) {
2708
2709
  const We = ft(G.token);
2709
- if (We.sheetName || (We.sheetName = C), (We.unitId || o) !== (f == null ? void 0 : f.getUnitId()) || c && ((ge = I.current.activeSheet) == null ? void 0 : ge.getName()) !== We.sheetName)
2710
+ if (We.sheetName || (We.sheetName = C), (We.unitId || o) !== (f == null ? void 0 : f.getUnitId()) || i && ((ge = I.current.activeSheet) == null ? void 0 : ge.getName()) !== We.sheetName)
2710
2711
  return G.token;
2711
2712
  const oe = Y[X];
2712
2713
  if (X++, !oe)
@@ -2716,7 +2717,7 @@ const cc = (e, t, n, o) => {
2716
2717
  unitId: (Ue = oe.unitId) != null ? Ue : f.getUnitId(),
2717
2718
  sheetName: v((Ve = oe.unitId) != null ? Ve : f.getUnitId(), ye)
2718
2719
  }, Nt = (f == null ? void 0 : f.getUnitId()) !== o;
2719
- return At([Ot], c && (ye !== r || Nt), C, Nt)[0];
2720
+ return At([Ot], i && (ye !== r || Nt), C, Nt)[0];
2720
2721
  }
2721
2722
  return G.token;
2722
2723
  });
@@ -2730,7 +2731,7 @@ const cc = (e, t, n, o) => {
2730
2731
  range: ge,
2731
2732
  unitId: (Tt = ge.unitId) != null ? Tt : f.getUnitId(),
2732
2733
  sheetName: v((Ee = ge.unitId) != null ? Ee : f.getUnitId(), st)
2733
- }, Ve = (f == null ? void 0 : f.getUnitId()) !== o, oe = At([Ue], c && (st !== r || Ve), C, Ve);
2734
+ }, Ve = (f == null ? void 0 : f.getUnitId()) !== o, oe = At([Ue], i && (st !== r || Ve), C, Ve);
2734
2735
  le.push(oe[0]);
2735
2736
  }
2736
2737
  const be = D[D.length - 1], Pe = be && (typeof be == "string" ? !1 : be.nodeType === Q.REFERENCE), ke = `${fe}${le.length && Pe ? "," : ""}${le.join(",")}`;
@@ -2785,7 +2786,7 @@ const cc = (e, t, n, o) => {
2785
2786
  };
2786
2787
  }
2787
2788
  }, [l, t, O, y, F.selectionSet$]), y == null || y.getSelectionDataWithStyle(), $(() => {
2788
- if (i) {
2789
+ if (c) {
2789
2790
  const k = d.onCommandExecuted((E) => {
2790
2791
  var R;
2791
2792
  if (E.id !== mn.id)
@@ -2803,7 +2804,7 @@ const cc = (e, t, n, o) => {
2803
2804
  k.dispose();
2804
2805
  };
2805
2806
  }
2806
- }, [d, l, n, S, i, O, y]), $(() => {
2807
+ }, [d, l, n, S, c, O, y]), $(() => {
2807
2808
  if (!l)
2808
2809
  return;
2809
2810
  const k = u.textSelection$.subscribe((E) => {
@@ -2823,7 +2824,7 @@ const cc = (e, t, n, o) => {
2823
2824
  return () => k.unsubscribe();
2824
2825
  }, [u.textSelection$, l, s, y, F, A, r, a, o, h]);
2825
2826
  }, gc = (e, t, n, o, r, s) => {
2826
- const c = T(pe), i = T(Ge), g = T(Me).getRenderById(t), m = T(ne), h = g == null ? void 0 : g.with($e);
2827
+ const i = T(pe), c = T(Ge), g = T(Me).getRenderById(t), m = T(ne), h = g == null ? void 0 : g.with($e);
2827
2828
  $(() => {
2828
2829
  if (e && h)
2829
2830
  if (n) {
@@ -2834,7 +2835,7 @@ const cc = (e, t, n, o) => {
2834
2835
  return setTimeout(() => {
2835
2836
  s();
2836
2837
  }, 30);
2837
- }, u = c.onCommandExecuted((S) => {
2838
+ }, u = i.onCommandExecuted((S) => {
2838
2839
  S.id === jn.id && d();
2839
2840
  }), a = m.getCurrentTypeOfUnit$(H.UNIVER_SHEET).subscribe((S) => {
2840
2841
  d();
@@ -2843,10 +2844,10 @@ const cc = (e, t, n, o) => {
2843
2844
  u.dispose(), a.unsubscribe();
2844
2845
  };
2845
2846
  } else {
2846
- const d = c.beforeCommandExecuted((u) => {
2847
+ const d = i.beforeCommandExecuted((u) => {
2847
2848
  if (u.id === jn.id) {
2848
2849
  o(!1), r(), s();
2849
- const a = i.getEditor(ln);
2850
+ const a = c.getEditor(ln);
2850
2851
  a == null || a.focus();
2851
2852
  }
2852
2853
  });
@@ -2873,8 +2874,8 @@ const cc = (e, t, n, o) => {
2873
2874
  }
2874
2875
  }, [n, t]);
2875
2876
  }, pc = (e, t = [], n) => {
2876
- const o = T(Gt), [r, s] = V([]), [c, i] = V(""), l = z(-1), g = nt({ nodes: t }), m = () => {
2877
- s([]), i(""), l.current = -1;
2877
+ const o = T(Gt), [r, s] = V([]), [i, c] = V(""), l = z(-1), g = nt({ nodes: t }), m = () => {
2878
+ s([]), c(""), l.current = -1;
2878
2879
  };
2879
2880
  return $(() => {
2880
2881
  if (n && e) {
@@ -2889,12 +2890,12 @@ const cc = (e, t, n, o) => {
2889
2890
  if (v && typeof v != "string" && v.nodeType === Q.FUNCTION) {
2890
2891
  l.current = p;
2891
2892
  const C = v.token, _ = o.getSearchListByNameFirstLetter(C);
2892
- s(_), i(C);
2893
+ s(_), c(C);
2893
2894
  return;
2894
2895
  }
2895
2896
  }
2896
2897
  }
2897
- l.current = -1, i(""), s((a) => a != null && a.length ? [] : a);
2898
+ l.current = -1, c(""), s((a) => a != null && a.length ? [] : a);
2898
2899
  });
2899
2900
  return () => {
2900
2901
  d.unsubscribe();
@@ -2904,7 +2905,7 @@ const cc = (e, t, n, o) => {
2904
2905
  e || m();
2905
2906
  }, [e]), {
2906
2907
  searchList: r,
2907
- searchText: c,
2908
+ searchText: i,
2908
2909
  handlerFormulaReplace: (d, u) => {
2909
2910
  const a = [...g.current.nodes];
2910
2911
  if (l.current !== -1) {
@@ -2918,7 +2919,7 @@ const cc = (e, t, n, o) => {
2918
2919
  }, vc = () => {
2919
2920
  }, Sc = we(Cc);
2920
2921
  function Cc(e, t) {
2921
- const { isFocus: n, sequenceNodes: o, onSelect: r, editor: s, onClose: c = vc } = e, i = s.getEditorId(), l = T(Zt), g = T(pe), { searchList: m, searchText: h, handlerFormulaReplace: d, reset: u } = pc(n, o, s), a = ie(() => !!m.length, [m]), S = z(void 0), [p, v] = V(0), C = z(!1), [_] = Ur(i, a, [h, m]), I = nt({ searchList: m, active: p }), f = (O, N) => {
2922
+ const { isFocus: n, sequenceNodes: o, onSelect: r, editor: s, onClose: i = vc } = e, c = s.getEditorId(), l = T(Zt), g = T(pe), { searchList: m, searchText: h, handlerFormulaReplace: d, reset: u } = pc(n, o, s), a = ie(() => !!m.length, [m]), S = z(void 0), [p, v] = V(0), C = z(!1), [_] = Ur(c, a, [h, m]), I = nt({ searchList: m, active: p }), f = (O, N) => {
2922
2923
  const k = d(O, N);
2923
2924
  k && (u(), r(k));
2924
2925
  };
@@ -2931,7 +2932,7 @@ function Cc(e, t) {
2931
2932
  $(() => {
2932
2933
  if (!m.length)
2933
2934
  return;
2934
- const O = `sheet.formula-embedding-editor.search_function.${i}`, N = new qe(), k = (E) => {
2935
+ const O = `sheet.formula-embedding-editor.search_function.${c}`, N = new qe(), k = (E) => {
2935
2936
  const { searchList: x, active: R } = I.current;
2936
2937
  switch (E) {
2937
2938
  case L.ARROW_UP: {
@@ -2955,7 +2956,7 @@ function Cc(e, t) {
2955
2956
  break;
2956
2957
  }
2957
2958
  case L.ESC: {
2958
- u(), c();
2959
+ u(), i();
2959
2960
  break;
2960
2961
  }
2961
2962
  }
@@ -3051,8 +3052,8 @@ const _c = (e) => e.startsWith(hr.EQUALS) ? e.slice(1) : "", Jn = () => {
3051
3052
  initValue: o,
3052
3053
  unitId: r,
3053
3054
  subUnitId: s,
3054
- isFocus: c = !0,
3055
- isSupportAcrossSheet: i = !1,
3055
+ isFocus: i = !0,
3056
+ isSupportAcrossSheet: c = !1,
3056
3057
  onFocus: l = Jn,
3057
3058
  onBlur: g = Jn,
3058
3059
  onChange: m,
@@ -3074,7 +3075,7 @@ const _c = (e) => e.startsWith(hr.EQUALS) ? e.slice(1) : "", Jn = () => {
3074
3075
  Rs(t, () => ({
3075
3076
  isClickOutSide: (Z) => O.current ? !O.current.contains(Z.target) : !1
3076
3077
  }));
3077
- const k = te(S), E = z(null), x = z(void 0), R = x.current, [w, D] = V(c), U = z(null), B = ie(() => u != null ? u : io(`${Mo}-${qt(4)}`), []), ce = ie(() => n !== void 0, [n]), ae = T(ne), he = ae.getUnit(B);
3078
+ const k = te(S), E = z(null), x = z(void 0), R = x.current, [w, D] = V(i), U = z(null), B = ie(() => u != null ? u : io(`${Mo}-${qt(4)}`), []), ce = ie(() => n !== void 0, [n]), ae = T(ne), he = ae.getUnit(B);
3078
3079
  Se(he == null ? void 0 : he.change$);
3079
3080
  const K = nc(), J = co.transform.getPlainText((yn = (bn = he == null ? void 0 : he.getBody()) == null ? void 0 : bn.dataStream) != null ? yn : ""), rt = nt(J), ot = ie(() => _c(J), [J]), Tt = ie(() => K(ot), [ot, K]), { isSelecting: Ee, isSelectingRef: Y } = tc({ unitId: r, subUnitId: s, editorId: B, isFocus: w, disableOnClick: f }), X = z(""), fe = T(Me).getRenderById(B), ee = fe == null ? void 0 : fe.with(pr), le = ee == null ? void 0 : ee.isFocusing, be = ie(() => ae.getCurrentTypeOfUnit$(H.UNIVER_DOC), [ae]), Pe = Se(be), ke = (Pe == null ? void 0 : Pe.getUnitId()) === B, G = z([]), ge = Ee, Ue = (On = (Tn = T(sr).getConfig(Tr)) == null ? void 0 : Tn.functionScreenTips) != null ? On : !0;
3080
3081
  Ss(() => {
@@ -3139,8 +3140,8 @@ const _c = (e) => e.startsWith(hr.EQUALS) ? e.slice(1) : "", Jn = () => {
3139
3140
  Z == null || Z.dispose();
3140
3141
  };
3141
3142
  }, []), $t(() => {
3142
- c ? (D(c), ye()) : (C && (R == null || R.blur(), Ot()), D(c));
3143
- }, [c, R, ye, Ot, C]);
3143
+ i ? (D(i), ye()) : (C && (R == null || R.blur(), Ot()), D(i));
3144
+ }, [i, R, ye, Ot, C]);
3144
3145
  const { checkScrollBar: Nt } = Jo(R, I, _);
3145
3146
  ac(w, !!(Ee && ke), r, B, y), cc(!!(w && le && a), ge, R, v);
3146
3147
  const En = te((Z, se, Ae) => {
@@ -3159,11 +3160,11 @@ const _c = (e) => e.startsWith(hr.EQUALS) ? e.slice(1) : "", Jn = () => {
3159
3160
  r,
3160
3161
  s,
3161
3162
  G,
3162
- i,
3163
+ c,
3163
3164
  !!ge,
3164
3165
  R,
3165
3166
  En
3166
- ), gc(w && !!(Ee && ke), r, i, D, g, () => {
3167
+ ), gc(w && !!(Ee && ke), r, c, D, g, () => {
3167
3168
  oe(rt.current, !1, !0);
3168
3169
  });
3169
3170
  const In = (Z) => {
@@ -3225,7 +3226,7 @@ const _c = (e) => e.startsWith(hr.EQUALS) ? e.slice(1) : "", Jn = () => {
3225
3226
  ] });
3226
3227
  });
3227
3228
  function Ec(e, t, n, o) {
3228
- const r = T(Re), s = Wr(""), c = Se(e == null ? void 0 : e.getDocumentDataModel().change$), [i, l] = V([]), g = T(wo), m = z(""), h = T(ne);
3229
+ const r = T(Re), s = Wr(""), i = Se(e == null ? void 0 : e.getDocumentDataModel().change$), [c, l] = V([]), g = T(wo), m = z(""), h = T(ne);
3229
3230
  return $(() => {
3230
3231
  if (!e) return;
3231
3232
  const d = e.getDocumentDataModel().getPlainText();
@@ -3234,7 +3235,7 @@ function Ec(e, t, n, o) {
3234
3235
  m.current = d;
3235
3236
  const u = r.sequenceNodesBuilder(d);
3236
3237
  l(u != null ? u : []);
3237
- }, [c, e, r]), $(() => {
3238
+ }, [i, e, r]), $(() => {
3238
3239
  var a, S;
3239
3240
  if (!e) return;
3240
3241
  if (!t) {
@@ -3249,7 +3250,7 @@ function Ec(e, t, n, o) {
3249
3250
  });
3250
3251
  return;
3251
3252
  }
3252
- const d = s(e, i, !1), u = new qe();
3253
+ const d = s(e, c, !1), u = new qe();
3253
3254
  return d.forEach((p) => {
3254
3255
  const v = ft(p.token), C = h.getCurrentUnitForType(H.UNIVER_SHEET), _ = C == null ? void 0 : C.getActiveSheet();
3255
3256
  if (!v.sheetName && o !== (_ == null ? void 0 : _.getSheetId()) || v.sheetName && (_ == null ? void 0 : _.getName()) !== v.sheetName)
@@ -3267,10 +3268,10 @@ function Ec(e, t, n, o) {
3267
3268
  }), () => {
3268
3269
  u.dispose();
3269
3270
  };
3270
- }, [e, t, s, g, i]), { sequenceNodes: i };
3271
+ }, [e, t, s, g, c]), { sequenceNodes: c };
3271
3272
  }
3272
3273
  function Ic(e) {
3273
- const t = T(gn), { supportAcrossSheet: n = !1, keepSheetReference: o = !1, unitId: r, subUnitId: s, onChange: c } = e, l = T(ne).getUnit(r, H.UNIVER_SHEET), g = te(c), m = te((h, d) => {
3274
+ const t = T(gn), { supportAcrossSheet: n = !1, keepSheetReference: o = !1, unitId: r, subUnitId: s, onChange: i } = e, l = T(ne).getUnit(r, H.UNIVER_SHEET), g = te(i), m = te((h, d) => {
3274
3275
  const u = l == null ? void 0 : l.getActiveSheet();
3275
3276
  if (!u || !n && u.getSheetId() !== s || !(h != null && h.length)) return;
3276
3277
  const a = o ? u.getName() : u.getSheetId() === s ? "" : u.getName(), S = h.map((p) => ({
@@ -3318,8 +3319,8 @@ function yc(e) {
3318
3319
  unitId: o,
3319
3320
  subUnitId: r,
3320
3321
  maxRangeCount: s = 1 / 0,
3321
- supportAcrossSheet: c,
3322
- keepSheetReference: i,
3322
+ supportAcrossSheet: i,
3323
+ keepSheetReference: c,
3323
3324
  onConfirm: l,
3324
3325
  onClose: g,
3325
3326
  onShowBySelection: m
@@ -3342,8 +3343,8 @@ function yc(e) {
3342
3343
  return Ic({
3343
3344
  unitId: o,
3344
3345
  subUnitId: r,
3345
- supportAcrossSheet: c,
3346
- keepSheetReference: i,
3346
+ supportAcrossSheet: i,
3347
+ keepSheetReference: c,
3347
3348
  onChange: (f, b) => {
3348
3349
  if (!t && m != null && m(f))
3349
3350
  return;
@@ -3446,8 +3447,8 @@ function Hr(e) {
3446
3447
  onVerify: o,
3447
3448
  selectorRef: r,
3448
3449
  unitId: s,
3449
- subUnitId: c,
3450
- maxRangeCount: i,
3450
+ subUnitId: i,
3451
+ maxRangeCount: c,
3451
3452
  supportAcrossSheet: l,
3452
3453
  keepSheetReference: g,
3453
3454
  autoFocus: m,
@@ -3458,7 +3459,7 @@ function Hr(e) {
3458
3459
  forceShowDialogWhenSelectionChanged: S,
3459
3460
  hideEditor: p,
3460
3461
  resetRange: v
3461
- } = e, [C, _] = V(m != null ? m : !1), [I, f] = V(!1), [b, y] = V([]), A = T(ht), F = T(Ge), { sequenceNodes: O } = Ec(t, C, s, c), N = nt(O), k = T(pe), E = te(() => {
3462
+ } = e, [C, _] = V(m != null ? m : !1), [I, f] = V(!1), [b, y] = V([]), A = T(ht), F = T(Ge), { sequenceNodes: O } = Ec(t, C, s, i), N = nt(O), k = T(pe), E = te(() => {
3462
3463
  t == null || t.setSelectionRanges([]), t == null || t.blur(), F.blur();
3463
3464
  }), x = te(() => {
3464
3465
  var R;
@@ -3495,7 +3496,7 @@ function Hr(e) {
3495
3496
  return () => {
3496
3497
  const R = {
3497
3498
  unitId: s,
3498
- subUnitId: c,
3499
+ subUnitId: i,
3499
3500
  selections: v
3500
3501
  };
3501
3502
  k.executeCommand(mn.id, R);
@@ -3527,9 +3528,9 @@ function Hr(e) {
3527
3528
  {
3528
3529
  initialValue: b,
3529
3530
  unitId: s,
3530
- subUnitId: c,
3531
+ subUnitId: i,
3531
3532
  visible: I,
3532
- maxRangeCount: i,
3533
+ maxRangeCount: c,
3533
3534
  onConfirm: (R) => {
3534
3535
  const w = Oc(R), D = ao.newEmptyData();
3535
3536
  D.body.dataStream = w, t == null || t.replaceText(w, !1), h == null || h(D, w), f(!1), y([]), requestAnimationFrame(() => {
@@ -3550,11 +3551,11 @@ const Nc = () => {
3550
3551
  var o, r;
3551
3552
  const e = T($r), t = Se(e.currentSelector$), n = z(null);
3552
3553
  return $(() => {
3553
- var s, c;
3554
+ var s, i;
3554
3555
  if (t)
3555
- return (c = n.current) == null || c.showDialog((s = t.initialValue) != null ? s : []), () => {
3556
- var i;
3557
- (i = n.current) == null || i.hideDialog();
3556
+ return (i = n.current) == null || i.showDialog((s = t.initialValue) != null ? s : []), () => {
3557
+ var c;
3558
+ (c = n.current) == null || c.hideDialog();
3558
3559
  };
3559
3560
  }, [t]), /* @__PURE__ */ M(
3560
3561
  Hr,
@@ -3563,26 +3564,26 @@ const Nc = () => {
3563
3564
  subUnitId: (r = t == null ? void 0 : t.subUnitId) != null ? r : "",
3564
3565
  hideEditor: !0,
3565
3566
  selectorRef: n,
3566
- onChange: (s, c) => {
3567
- var i;
3568
- t == null || t.callback((i = c == null ? void 0 : c.split(",").map((l) => ft(l))) != null ? i : []);
3567
+ onChange: (s, i) => {
3568
+ var c;
3569
+ t == null || t.callback((c = i == null ? void 0 : i.split(",").map((l) => ft(l))) != null ? c : []);
3569
3570
  }
3570
3571
  }
3571
3572
  );
3572
3573
  };
3573
3574
  var xc = Object.defineProperty, Mc = Object.getOwnPropertyDescriptor, wc = (e, t, n) => t in e ? xc(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n, kc = (e, t, n, o) => {
3574
- for (var r = o > 1 ? void 0 : o ? Mc(t, n) : t, s = e.length - 1, c; s >= 0; s--)
3575
- (c = e[s]) && (r = c(r) || r);
3575
+ for (var r = o > 1 ? void 0 : o ? Mc(t, n) : t, s = e.length - 1, i; s >= 0; s--)
3576
+ (i = e[s]) && (r = i(r) || r);
3576
3577
  return r;
3577
3578
  }, Ft = (e, t) => (n, o) => t(n, o, e), Br = (e, t, n) => wc(e, typeof t != "symbol" ? t + "" : t, n);
3578
3579
  let jt = class extends uo {
3579
3580
  constructor(e = Zn, t, n, o, r) {
3580
3581
  super(), this._config = e, this._injector = t, this._renderManagerService = n, this._configService = o, this._uiPartsService = r;
3581
- const { menu: s, ...c } = ho(
3582
+ const { menu: s, ...i } = ho(
3582
3583
  Zn,
3583
3584
  this._config
3584
3585
  );
3585
- s && this._configService.setConfig("menu", s, { merge: !0 }), this._configService.setConfig(Tr, c, { merge: !0 });
3586
+ s && this._configService.setConfig("menu", s, { merge: !0 }), this._configService.setConfig(Tr, i, { merge: !0 });
3586
3587
  }
3587
3588
  onStarting() {
3588
3589
  fo(this._injector, [