@univerjs/sheets-formula-ui 0.12.2 → 0.12.3

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/index.js CHANGED
@@ -205,26 +205,26 @@ const Fs = {
205
205
  return !1;
206
206
  const s = vr(e.get(ne));
207
207
  if (!s) return !1;
208
- const { worksheet: i, unitId: c, subUnitId: l } = s, g = i.getCellMatrix(), { value: m } = t, h = e.get(me);
208
+ const { worksheet: i, unitId: c, subUnitId: l } = s, m = i.getCellMatrix(), { value: h } = t, f = e.get(me);
209
209
  e.get(fn);
210
210
  const d = [], u = [];
211
211
  let a = null, v = 0, p = 0, S = "";
212
- if (r.length === 1 && (Ls(r[0].range) || Ps(r[0].range) && Zn(g, r[0].range))) {
213
- const { range: E, primary: f } = r[0], b = (C = f == null ? void 0 : f.actualRow) != null ? C : E.startRow, y = (_ = f == null ? void 0 : f.actualColumn) != null ? _ : E.startColumn;
212
+ if (r.length === 1 && (Ls(r[0].range) || Ps(r[0].range) && Zn(m, r[0].range))) {
213
+ const { range: E, primary: g } = r[0], b = (C = g == null ? void 0 : g.actualRow) != null ? C : E.startRow, y = (_ = g == null ? void 0 : g.actualColumn) != null ? _ : E.startColumn;
214
214
  a = E, v = b, p = y;
215
- const A = Gn(g, b, y);
215
+ const A = Gn(m, b, y);
216
216
  A && (S = Ce(A));
217
217
  } else
218
218
  r.some((E) => {
219
219
  var y, A;
220
- const { range: f, primary: b } = E;
221
- if (Zn(g, f)) {
222
- const F = (y = b == null ? void 0 : b.actualRow) != null ? y : f.startRow, N = (A = b == null ? void 0 : b.actualColumn) != null ? A : f.startColumn, O = Gn(g, F, N);
220
+ const { range: g, primary: b } = E;
221
+ if (Zn(m, g)) {
222
+ const F = (y = b == null ? void 0 : b.actualRow) != null ? y : g.startRow, N = (A = b == null ? void 0 : b.actualColumn) != null ? A : g.startColumn, O = Gn(m, F, N);
223
223
  if (!O)
224
- return a = f, v = F, p = N, !0;
225
- const k = Ce(O), I = `=${m}(${k})`;
224
+ return a = g, v = F, p = N, !0;
225
+ const k = Ce(O), I = `=${h}(${k})`;
226
226
  d.push({
227
- range: f,
227
+ range: g,
228
228
  primary: {
229
229
  row: F,
230
230
  column: N
@@ -232,16 +232,16 @@ const Fs = {
232
232
  formula: I
233
233
  });
234
234
  } else {
235
- const { startRow: F, startColumn: N, endRow: O, endColumn: k } = f;
235
+ const { startRow: F, startColumn: N, endRow: O, endColumn: k } = g;
236
236
  if (F === O) {
237
- const I = Us(g, F, k, i.getColumnCount() - 1), x = I === k ? k - 1 : k, R = Ce({
237
+ const I = Us(m, F, k, i.getColumnCount() - 1), x = I === k ? k - 1 : k, R = Ce({
238
238
  startRow: F,
239
239
  endRow: O,
240
240
  startColumn: N,
241
241
  endColumn: x
242
- }), w = `=${m}(${R})`;
242
+ }), w = `=${h}(${R})`;
243
243
  u.push({
244
- range: f,
244
+ range: g,
245
245
  primary: {
246
246
  row: F,
247
247
  column: I
@@ -251,7 +251,7 @@ const Fs = {
251
251
  } else {
252
252
  let I = -1;
253
253
  for (let R = N; R <= k; R++) {
254
- const w = Vs(g, R, O, i.getRowCount() - 1);
254
+ const w = Vs(m, R, O, i.getRowCount() - 1);
255
255
  I = Math.max(I, w);
256
256
  }
257
257
  const x = I === O ? O - 1 : O;
@@ -261,9 +261,9 @@ const Fs = {
261
261
  endRow: x,
262
262
  startColumn: R,
263
263
  endColumn: R
264
- }), D = `=${m}(${w})`;
264
+ }), D = `=${h}(${w})`;
265
265
  u.push({
266
- range: f,
266
+ range: g,
267
267
  primary: {
268
268
  row: I,
269
269
  column: R
@@ -276,7 +276,7 @@ const Fs = {
276
276
  return !1;
277
277
  });
278
278
  if (a) {
279
- const E = rs(v, p, i), f = {
279
+ const E = rs(v, p, i), g = {
280
280
  range: nr.clone(a),
281
281
  primary: {
282
282
  startRow: E.startRow,
@@ -291,19 +291,19 @@ const Fs = {
291
291
  }, b = {
292
292
  unitId: c,
293
293
  subUnitId: l,
294
- selections: [f]
294
+ selections: [g]
295
295
  };
296
- await h.executeCommand(pn.id, b);
296
+ await f.executeCommand(pn.id, b);
297
297
  const y = o.getEditor(un), A = o.getEditor(rr);
298
- h.syncExecuteCommand(cr.id, {
298
+ f.syncExecuteCommand(cr.id, {
299
299
  visible: !0,
300
300
  unitId: c,
301
301
  eventType: xe.Dblclick
302
302
  });
303
- const F = `=${m}(${S}`;
303
+ const F = `=${h}(${S}`;
304
304
  y == null || y.replaceText(F), A == null || A.replaceText(F, !1);
305
305
  }
306
- return d.length === 0 && u.length === 0 ? !1 : h.executeCommand(ds.id, {
306
+ return d.length === 0 && u.length === 0 ? !1 : f.executeCommand(ds.id, {
307
307
  list: d,
308
308
  listOfRangeHasNumber: u
309
309
  });
@@ -435,12 +435,12 @@ let Pt = class extends Ke {
435
435
  redos: t,
436
436
  undos: n
437
437
  };
438
- const g = l.getCellMatrix(), m = new Fe(), h = new Fe();
438
+ const m = l.getCellMatrix(), h = new Fe(), f = new Fe();
439
439
  let d = !1;
440
440
  return eo.foreach(s, (u, a) => {
441
441
  let v = u;
442
442
  i.hasOwnProperty(u) && (v = i[u]);
443
- const p = g.getValue(v, a);
443
+ const p = m.getValue(v, a);
444
444
  if (p != null && p.f || p != null && p.si) {
445
445
  d = !0;
446
446
  const S = this._formulaDataModel.getFormulaStringByCell(v, a, r, o), C = this._lexerTreeBuilder.moveFormulaRefOffset(
@@ -448,23 +448,23 @@ let Pt = class extends Ke {
448
448
  0,
449
449
  u - v
450
450
  ), _ = dn.deepClone(p);
451
- _.f = C, _.si = null, m.setValue(u, a, _);
451
+ _.f = C, _.si = null, h.setValue(u, a, _);
452
452
  } else
453
- m.setValue(u, a, p);
454
- h.setValue(u, a, g.getValue(u, a));
453
+ h.setValue(u, a, p);
454
+ f.setValue(u, a, m.getValue(u, a));
455
455
  }), d ? (t.push({
456
456
  id: Dt.id,
457
457
  params: {
458
458
  unitId: o,
459
459
  subUnitId: r,
460
- cellValue: m.getMatrix()
460
+ cellValue: h.getMatrix()
461
461
  }
462
462
  }), n.push({
463
463
  id: Dt.id,
464
464
  params: {
465
465
  unitId: o,
466
466
  subUnitId: r,
467
- cellValue: h.getMatrix()
467
+ cellValue: f.getMatrix()
468
468
  }
469
469
  }), {
470
470
  redos: t,
@@ -514,14 +514,14 @@ let cn = class extends Ke {
514
514
  if (e) {
515
515
  const c = this._context.unit.getActiveSheet();
516
516
  if (!c) return this._hideAlert();
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];
517
+ const l = c.getCell(e.location.row, e.location.col), m = (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 (to(l)) {
519
- const m = dr(l, !!g);
520
- if (!m) {
519
+ const h = dr(l, !!m);
520
+ if (!h) {
521
521
  this._hideAlert();
522
522
  return;
523
523
  }
524
- const h = this._cellAlertManagerService.currentAlert.get(en), d = (s = h == null ? void 0 : h.alert) == null ? void 0 : s.location;
524
+ const f = this._cellAlertManagerService.currentAlert.get(en), d = (s = f == null ? void 0 : f.alert) == null ? void 0 : s.location;
525
525
  if (d && d.row === e.location.row && d.col === e.location.col && d.subUnitId === e.location.subUnitId && d.unitId === e.location.unitId) {
526
526
  this._hideAlert();
527
527
  return;
@@ -529,7 +529,7 @@ let cn = class extends Ke {
529
529
  this._cellAlertManagerService.showAlert({
530
530
  type: Co.ERROR,
531
531
  title: this._localeService.t("formula.error.title"),
532
- message: this._localeService.t(`formula.error.${Ks[m]}`),
532
+ message: this._localeService.t(`formula.error.${Ks[h]}`),
533
533
  location: e.location,
534
534
  width: 200,
535
535
  height: 74,
@@ -582,12 +582,12 @@ let Ut = class extends Ke {
582
582
  this._autoFillService.registerRule(e);
583
583
  }
584
584
  _fillCopyFormula(e, t, n, o, r, s) {
585
- var g, m;
585
+ var m, h;
586
586
  const i = zs(r), c = [], l = /* @__PURE__ */ new Map();
587
- for (let h = 1; h <= t; h++) {
588
- const d = (h - 1) % e.length, u = o[d], a = dn.deepClone(e[d]);
587
+ for (let f = 1; f <= t; f++) {
588
+ const d = (f - 1) % e.length, u = o[d], a = dn.deepClone(e[d]);
589
589
  if (a) {
590
- const v = ((g = e[d]) == null ? void 0 : g.f) || "", p = ((m = e[d]) == null ? void 0 : m.si) || "", S = Ae(v);
590
+ const v = ((m = e[d]) == null ? void 0 : m.f) || "", p = ((h = e[d]) == null ? void 0 : h.si) || "", S = Ae(v);
591
591
  if (lt(p))
592
592
  a.si = p, a.f = null, a.v = null, a.p = null, a.t = null, c.push(a);
593
593
  else if (S) {
@@ -596,10 +596,10 @@ let Ut = class extends Ke {
596
596
  a.si = _, a.f = null, a.v = null, a.p = null, a.t = null;
597
597
  else {
598
598
  _ = Kt(6), l.set(d, _);
599
- const { offsetX: E, offsetY: f } = Zs(i, t, n, s, u), b = this._lexerTreeBuilder.moveFormulaRefOffset(
599
+ const { offsetX: E, offsetY: g } = Zs(i, t, n, s, u), b = this._lexerTreeBuilder.moveFormulaRefOffset(
600
600
  v,
601
601
  E,
602
- f
602
+ g
603
603
  );
604
604
  a.si = _, a.f = b, a.v = null, a.p = null, a.t = null;
605
605
  }
@@ -616,22 +616,22 @@ Ut = Gs([
616
616
  ], Ut);
617
617
  function Zs(e, t, n, o, r) {
618
618
  const { source: s, target: i } = o, { rows: c } = i, { rows: l } = s;
619
- let g = 0, m = 0;
619
+ let m = 0, h = 0;
620
620
  switch (n) {
621
621
  case de.UP:
622
- m = c[r] - l[r];
622
+ h = c[r] - l[r];
623
623
  break;
624
624
  case de.RIGHT:
625
- g = e;
625
+ m = e;
626
626
  break;
627
627
  case de.DOWN:
628
- m = c[r] - l[r];
628
+ h = c[r] - l[r];
629
629
  break;
630
630
  case de.LEFT:
631
- g = -e * t;
631
+ m = -e * t;
632
632
  break;
633
633
  }
634
- return { offsetX: g, offsetY: m };
634
+ return { offsetX: m, offsetY: h };
635
635
  }
636
636
  function zs(e) {
637
637
  let t = 0;
@@ -688,7 +688,7 @@ let Vt = class extends Ke {
688
688
  undos: [],
689
689
  redos: []
690
690
  };
691
- const g = t.range, m = n, h = {
691
+ const m = t.range, h = n, f = {
692
692
  copyType: o.copyType || ar.COPY,
693
693
  copyRange: e == null ? void 0 : e.range,
694
694
  pasteType: o.pasteType
@@ -696,10 +696,10 @@ let Vt = class extends Ke {
696
696
  return this._injector.invoke((u) => ei(
697
697
  c,
698
698
  l,
699
- g,
700
699
  m,
701
- u,
702
700
  h,
701
+ u,
702
+ f,
703
703
  this._lexerTreeBuilder,
704
704
  this._formulaDataModel,
705
705
  r,
@@ -714,8 +714,8 @@ Vt = Qs([
714
714
  St(3, q(Rt)),
715
715
  St(4, q(yt))
716
716
  ], Vt);
717
- function ei(e, t, n, o, r, s, i, c, l = !1, g) {
718
- const m = [], h = [], d = ti(e, t, n, o, s, i, c, g);
717
+ function ei(e, t, n, o, r, s, i, c, l = !1, m) {
718
+ const h = [], f = [], d = ti(e, t, n, o, s, i, c, m);
719
719
  if (!d.hasValue())
720
720
  return {
721
721
  undos: [],
@@ -726,7 +726,7 @@ function ei(e, t, n, o, r, s, i, c, l = !1, g) {
726
726
  subUnitId: t,
727
727
  cellValue: d.getData()
728
728
  };
729
- m.push({
729
+ h.push({
730
730
  id: Dt.id,
731
731
  params: u
732
732
  });
@@ -734,12 +734,12 @@ function ei(e, t, n, o, r, s, i, c, l = !1, g) {
734
734
  r,
735
735
  u
736
736
  );
737
- return h.push({
737
+ return f.push({
738
738
  id: Dt.id,
739
739
  params: a
740
740
  }), {
741
- undos: h,
742
- redos: m
741
+ undos: f,
742
+ redos: h
743
743
  };
744
744
  }
745
745
  function ti(e, t, n, o, r, s, i, c) {
@@ -747,27 +747,27 @@ function ti(e, t, n, o, r, s, i, c) {
747
747
  }
748
748
  function ni(e, t, n, o, r) {
749
749
  const s = new Fe(), i = r.getSheetFormulaData(e, t);
750
- return o.forValue((c, l, g) => {
750
+ return o.forValue((c, l, m) => {
751
751
  var u;
752
- const m = n.rows[c], h = n.cols[l], d = {};
753
- Ae(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
+ const h = n.rows[c], f = n.cols[l], d = {};
753
+ Ae(m.v) ? (d.v = null, d.f = `${m.v}`, d.si = null, d.p = null, s.setValue(h, f, d)) : (u = i == null ? void 0 : i[h]) != null && u[f] && (d.v = m.v, d.f = null, d.si = null, d.p = null, s.setValue(h, f, d));
754
754
  }), s;
755
755
  }
756
756
  function ri(e, t, n, o, r, s) {
757
- var g, m;
758
- const i = new Fe(), c = (m = (g = r.getArrayFormulaCellData()) == null ? void 0 : g[s.unitId]) == null ? void 0 : m[s.subUnitId], l = r.getSheetFormulaData(e, t);
759
- return o.forValue((h, d, u) => {
757
+ var m, h;
758
+ const i = new Fe(), c = (h = (m = r.getArrayFormulaCellData()) == null ? void 0 : m[s.unitId]) == null ? void 0 : h[s.subUnitId], l = r.getSheetFormulaData(e, t);
759
+ return o.forValue((f, d, u) => {
760
760
  var _, E;
761
- const a = s.range.rows[h % s.range.rows.length], v = s.range.cols[d % s.range.cols.length], p = n.rows[h], S = n.cols[d], C = {};
761
+ const a = s.range.rows[f % s.range.rows.length], v = s.range.cols[d % s.range.cols.length], p = n.rows[f], S = n.cols[d], C = {};
762
762
  if (Ae(u.f) || lt(u.si))
763
763
  C.v = u.v, C.f = null, C.si = null, C.p = null, i.setValue(p, S, C);
764
764
  else if ((_ = c == null ? void 0 : c[a]) != null && _[v]) {
765
- const f = c[a][v];
766
- C.v = f.v, C.f = null, C.si = null, C.p = null, i.setValue(p, S, C);
765
+ const g = c[a][v];
766
+ C.v = g.v, C.f = null, C.si = null, C.p = null, i.setValue(p, S, C);
767
767
  } else if ((E = l == null ? void 0 : l[p]) != null && E[S]) {
768
768
  if (C.v = u.v, C.f = null, C.si = null, C.p = null, u.p) {
769
- const f = Or(u);
770
- f && (C.v = f);
769
+ const g = Or(u);
770
+ g && (C.v = g);
771
771
  }
772
772
  i.setValue(p, S, C);
773
773
  }
@@ -775,34 +775,34 @@ function ri(e, t, n, o, r, s) {
775
775
  }
776
776
  function oi(e, t, n, o, r, s, i) {
777
777
  const c = new Fe(), l = /* @__PURE__ */ new Map();
778
- return o.forValue((g, m, h) => {
779
- const d = n.rows[g], u = n.cols[m], a = {};
780
- if (lt(h.si)) {
778
+ return o.forValue((m, h, f) => {
779
+ const d = n.rows[m], u = n.cols[h], a = {};
780
+ if (lt(f.si)) {
781
781
  if (i.unitId !== e || i.subUnitId !== t) {
782
782
  const v = s.getFormulaStringByCell(
783
- i.range.rows[g % i.range.rows.length],
784
- i.range.cols[m % i.range.cols.length],
783
+ i.range.rows[m % i.range.rows.length],
784
+ i.range.cols[h % i.range.cols.length],
785
785
  i.subUnitId,
786
786
  i.unitId
787
- ), p = n.cols[m] - i.range.cols[m % i.range.cols.length], S = n.rows[g] - i.range.rows[g % i.range.rows.length], C = r.moveFormulaRefOffset(v || "", p, S);
787
+ ), p = n.cols[h] - i.range.cols[h % i.range.cols.length], S = n.rows[m] - i.range.rows[m % i.range.rows.length], C = r.moveFormulaRefOffset(v || "", p, S);
788
788
  a.si = null, a.f = C;
789
789
  } else
790
- a.si = h.si, a.f = null;
790
+ a.si = f.si, a.f = null;
791
791
  a.v = null, a.p = null, c.setValue(d, u, a);
792
- } else if (Ae(h.f)) {
793
- const v = `${g % i.range.rows.length}_${m % i.range.cols.length}`;
792
+ } else if (Ae(f.f)) {
793
+ const v = `${m % i.range.rows.length}_${h % i.range.cols.length}`;
794
794
  let p = l.get(v);
795
795
  if (p)
796
796
  a.si = p, a.f = null;
797
797
  else {
798
798
  p = Kt(6), l.set(v, p);
799
- const S = 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 || "", S, C);
799
+ const S = n.cols[h] - i.range.cols[h % i.range.cols.length], C = n.rows[m] - i.range.rows[m % i.range.rows.length], _ = r.moveFormulaRefOffset(f.f || "", S, C);
800
800
  a.si = p, a.f = _;
801
801
  }
802
802
  a.v = null, a.p = null, c.setValue(d, u, a);
803
803
  } else {
804
- if (a.v = h.v, a.f = null, a.si = null, a.p = null, h.p) {
805
- const v = Or(h);
804
+ if (a.v = f.v, a.f = null, a.si = null, a.p = null, f.p) {
805
+ const v = Or(f);
806
806
  v && (a.v = v);
807
807
  }
808
808
  c.setValue(d, u, a);
@@ -810,13 +810,13 @@ function oi(e, t, n, o, r, s, i) {
810
810
  }), c;
811
811
  }
812
812
  function si(e, t, n, o, r, s, i, c) {
813
- const l = new Fe(), g = /* @__PURE__ */ new Map(), m = i.getSheetFormulaData(e, t), h = [];
813
+ const l = new Fe(), m = /* @__PURE__ */ new Map(), h = i.getSheetFormulaData(e, t), f = [];
814
814
  return r === ar.CUT ? o.forValue((d, u, a) => {
815
815
  const v = n.rows[d], p = n.cols[u], S = {};
816
816
  if (lt(a.si)) {
817
817
  if (Ae(a.f))
818
- h.push(a.si), S.f = a.f, S.si = a.si;
819
- else if (h.includes(a.si))
818
+ f.push(a.si), S.f = a.f, S.si = a.si;
819
+ else if (f.includes(a.si))
820
820
  S.f = null, S.si = a.si;
821
821
  else {
822
822
  const C = i.getFormulaStringByCell(
@@ -839,25 +839,25 @@ function si(e, t, n, o, r, s, i, c) {
839
839
  c.range.cols[u % c.range.cols.length],
840
840
  c.subUnitId,
841
841
  c.unitId
842
- ), E = 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(_ || "", E, f);
842
+ ), E = n.cols[u] - c.range.cols[u % c.range.cols.length], g = n.rows[d] - c.range.rows[d % c.range.rows.length], b = s.moveFormulaRefOffset(_ || "", E, g);
843
843
  S.si = null, S.f = b;
844
844
  } else
845
845
  S.si = a.si, S.f = null;
846
846
  S.v = null, S.p = null, l.setValue(v, p, S);
847
847
  } else if (Ae(a.f)) {
848
848
  const _ = `${d % c.range.rows.length}_${u % c.range.cols.length}`;
849
- let E = g.get(_);
849
+ let E = m.get(_);
850
850
  if (E)
851
851
  S.si = E, S.f = null;
852
852
  else {
853
- E = Kt(6), g.set(_, E);
854
- 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
+ E = Kt(6), m.set(_, E);
854
+ const g = 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 || "", g, b);
855
855
  S.si = E, S.f = y;
856
856
  }
857
857
  S.v = null, S.p = null, l.setValue(v, p, S);
858
- } else (C = m == null ? void 0 : m[v]) != null && C[p] && (S.v = a.v, S.f = null, S.si = null, S.p = a.p, l.setValue(v, p, S));
859
- }), h.length > 0 && new Fe(m).forValue((d, u, a) => {
860
- 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)) {
858
+ } else (C = h == null ? void 0 : h[v]) != null && C[p] && (S.v = a.v, S.f = null, S.si = null, S.p = a.p, l.setValue(v, p, S));
859
+ }), f.length > 0 && new Fe(h).forValue((d, u, a) => {
860
+ if (!(c.range.rows.includes(d) && c.range.cols.includes(u)) && !(n.rows.includes(d) && n.cols.includes(u)) && f.includes(a == null ? void 0 : a.si)) {
861
861
  const v = i.getFormulaStringByCell(
862
862
  d,
863
863
  u,
@@ -921,15 +921,15 @@ let Wt = class extends Ke {
921
921
  this._sheetInterceptorService.writeCellInterceptor.intercept(is, {
922
922
  handler: (t, n, o) => {
923
923
  var a, v, p, S;
924
- const { row: r, col: s, unitId: i, subUnitId: c, worksheet: l } = n, g = this._formulaDataModel.getArrayFormulaRange(), m = this._formulaDataModel.getArrayFormulaCellData();
924
+ const { row: r, col: s, unitId: i, subUnitId: c, worksheet: l } = n, m = this._formulaDataModel.getArrayFormulaRange(), h = this._formulaDataModel.getArrayFormulaCellData();
925
925
  if (this._removeArrayFormulaRangeShape(), t == null)
926
926
  return o(t);
927
- let h = null;
927
+ let f = null;
928
928
  const d = this._formulaDataModel.getFormulaStringByCell(r, s, c, i);
929
- if (d !== null && (h = { f: d }), t.v != null && t.v !== "" && ((p = (v = (a = m[i]) == null ? void 0 : a[c]) == null ? void 0 : v[r]) == null ? void 0 : p[s]) == null)
930
- return h ? { ...t, ...h } : o(t);
931
- const u = (S = g == null ? void 0 : g[i]) == null ? void 0 : S[c];
932
- return u != null && (h = this._displayArrayFormulaRangeShape(u, r, s, i, c, l, h)), h ? { ...t, ...h } : o(t);
929
+ if (d !== null && (f = { f: d }), t.v != null && t.v !== "" && ((p = (v = (a = h[i]) == null ? void 0 : a[c]) == null ? void 0 : v[r]) == null ? void 0 : p[s]) == null)
930
+ return f ? { ...t, ...f } : o(t);
931
+ const u = (S = m == null ? void 0 : m[i]) == null ? void 0 : S[c];
932
+ return u != null && (f = this._displayArrayFormulaRangeShape(u, r, s, i, c, l, f)), f ? { ...t, ...f } : o(t);
933
933
  }
934
934
  })
935
935
  )
@@ -948,21 +948,16 @@ let Wt = class extends Ke {
948
948
  );
949
949
  }
950
950
  _displayArrayFormulaRangeShape(t, n, o, r, s, i, c) {
951
- const l = this._formulaDataModel.getSheetFormulaData(r, s);
952
- return new Fe(t).forValue((g, m, h) => {
953
- var p;
951
+ return new Fe(t).forValue((l, m, h) => {
954
952
  if (h == null)
955
953
  return !0;
956
- const { startRow: d, startColumn: u, endRow: a, endColumn: v } = h;
957
- if (g === n && m === o)
954
+ const { startRow: f, startColumn: d, endRow: u, endColumn: a } = h;
955
+ if (l === n && m === o)
958
956
  return this._createArrayFormulaRangeShape(h, r), !1;
959
- if (n >= d && n <= a && o >= u && o <= v) {
960
- const S = i.getCell(d, u);
961
- if ((S == null ? void 0 : S.v) === ue.SPILL)
962
- return;
963
- const C = (p = l == null ? void 0 : l[g]) == null ? void 0 : p[m];
964
- return C == null || C.f == null ? !0 : (c == null && (c = {
965
- f: C.f,
957
+ if (n >= f && n <= u && o >= d && o <= a) {
958
+ const v = i.getCell(f, d);
959
+ return (v == null ? void 0 : v.v) === ue.SPILL || (v == null ? void 0 : v.f) == null ? void 0 : (c == null && (c = {
960
+ f: v.f,
966
961
  isInArrayFormulaRange: !0
967
962
  }), this._createArrayFormulaRangeShape(h, r), !1);
968
963
  }
@@ -982,12 +977,12 @@ let Wt = class extends Ke {
982
977
  fill: new hn(this._themeService.getColorFromTheme("white")).setAlpha(0).toString(),
983
978
  widgets: {}
984
979
  }
985
- }, c = rn(i, r), { rowHeaderWidth: l, columnHeaderHeight: g } = r, m = new lr(s, Eo.FORMULA_EDITOR_SHOW, this._themeService, {
980
+ }, c = rn(i, r), { rowHeaderWidth: l, columnHeaderHeight: m } = r, h = new lr(s, Eo.FORMULA_EDITOR_SHOW, this._themeService, {
986
981
  highlightHeader: !1,
987
982
  rowHeaderWidth: l,
988
- columnHeaderHeight: g
983
+ columnHeaderHeight: m
989
984
  });
990
- m.updateRangeBySelectionWithCoord(c), m.setEvent(!1), this._previousShape = m;
985
+ h.updateRangeBySelectionWithCoord(c), h.setEvent(!1), this._previousShape = h;
991
986
  }
992
987
  _removeArrayFormulaRangeShape() {
993
988
  this._previousShape != null && (this._previousShape.dispose(), this._previousShape = null);
@@ -1011,15 +1006,15 @@ let Wt = class extends Ke {
1011
1006
  if (!this._checkCurrentSheet(t, n) || !this._previousShape) return;
1012
1007
  const { startRow: r, endRow: s, startColumn: i, endColumn: c } = this._previousShape.getRange();
1013
1008
  for (let l = 0; l < o.length; l++) {
1014
- const { row: g } = o[l];
1015
- if (r >= g) {
1016
- const m = {
1009
+ const { row: m } = o[l];
1010
+ if (r >= m) {
1011
+ const h = {
1017
1012
  startRow: r,
1018
1013
  endRow: s,
1019
1014
  startColumn: i,
1020
1015
  endColumn: c
1021
1016
  };
1022
- this._refreshArrayFormulaRangeShape(t, m);
1017
+ this._refreshArrayFormulaRangeShape(t, h);
1023
1018
  break;
1024
1019
  }
1025
1020
  }
@@ -1052,8 +1047,8 @@ let Ht = class extends ro {
1052
1047
  {
1053
1048
  effect: oo.Style,
1054
1049
  handler: (n, o, r) => {
1055
- var c, l, g, m;
1056
- 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];
1050
+ var c, l, m, h;
1051
+ const s = (h = (m = (l = (c = this._formulaDataModel.getArrayFormulaCellData()) == null ? void 0 : c[o.unitId]) == null ? void 0 : l[o.subUnitId]) == null ? void 0 : m[o.row]) == null ? void 0 : h[o.col];
1057
1052
  return !dr(n, !!s) || !n || (n === o.rawData && (n = { ...o.rawData }), n.markers = {
1058
1053
  ...n == null ? void 0 : n.markers,
1059
1054
  ...ui
@@ -1077,7 +1072,7 @@ function di() {
1077
1072
  return /* @__PURE__ */ M(Ss, { progress: n, onTerminate: o, onClearProgress: r });
1078
1073
  }
1079
1074
  function hi(e, t) {
1080
- return Object.keys(e).filter((n) => isNaN(Number(n)) && n !== "DefinedName").map((n) => ({
1075
+ return Object.keys(e).filter((n) => isNaN(Number(n)) && n !== "DefinedName" && n !== "Table").map((n) => ({
1081
1076
  label: t.t(`formula.functionType.${n.toLocaleLowerCase()}`),
1082
1077
  value: `${e[n]}`
1083
1078
  }));
@@ -1130,10 +1125,10 @@ function fi(e) {
1130
1125
  if (!t) return null;
1131
1126
  const [o, r] = V([]), [s, i] = V(t.functionParameter), [c, l] = V(-1);
1132
1127
  return /* @__PURE__ */ H("div", { children: [
1133
- /* @__PURE__ */ M("div", { className: re("univer-h-[364px] univer-overflow-y-auto", ut), children: s.map((g, m) => /* @__PURE__ */ H("div", { children: [
1134
- /* @__PURE__ */ M("div", { className: "univer-text-sm", children: g.name }),
1128
+ /* @__PURE__ */ M("div", { className: re("univer-h-[364px] univer-overflow-y-auto", ut), children: s.map((m, h) => /* @__PURE__ */ H("div", { children: [
1129
+ /* @__PURE__ */ M("div", { className: "univer-text-sm", children: m.name }),
1135
1130
  /* @__PURE__ */ M("div", { className: "univer-mb-2 univer-mt-1" })
1136
- ] }, m)) }),
1131
+ ] }, h)) }),
1137
1132
  /* @__PURE__ */ M("div", { className: re("univer-flex-1 univer-p-3", bs), children: /* @__PURE__ */ M(
1138
1133
  vt,
1139
1134
  {
@@ -1371,18 +1366,18 @@ const Ii = {
1371
1366
  });
1372
1367
  Lr.displayName = "SelectRangeIcon";
1373
1368
  function Ei(e) {
1374
- 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), v = T(Gt), p = T(dt), S = T(vn), C = Se(S.sidebarOptions$), _ = hi(hr, p);
1369
+ const { onChange: t } = e, n = "-1", [o, r] = V(""), [s, i] = V([]), [c, l] = V(0), [m, h] = V(n), [f, d] = V(0), [u, a] = V(null), v = T(Gt), p = T(dt), S = T(vn), C = Se(S.sidebarOptions$), _ = hi(hr, p);
1375
1370
  _.unshift({
1376
1371
  label: p.t("formula.moreFunctions.allFunctions"),
1377
1372
  value: n
1378
1373
  });
1379
- const E = p.t("formula.prompt.required"), f = p.t("formula.prompt.optional");
1374
+ const E = p.t("formula.prompt.required"), g = p.t("formula.prompt.optional");
1380
1375
  L(() => {
1381
1376
  A(n);
1382
1377
  }, []), L(() => {
1383
1378
  y(0);
1384
1379
  }, [s]), L(() => {
1385
- C != null && C.visible && (r(""), i([]), l(0), m(n), d(0), a(null), A(n));
1380
+ C != null && C.visible && (r(""), i([]), l(0), h(n), d(0), a(null), A(n));
1386
1381
  }, [C]);
1387
1382
  const b = (I) => {
1388
1383
  if (o.trim() === "") return I;
@@ -1402,7 +1397,7 @@ function Ei(e) {
1402
1397
  a(x), t(x);
1403
1398
  };
1404
1399
  function A(I) {
1405
- m(I);
1400
+ h(I);
1406
1401
  const x = v.getSearchListByType(+I);
1407
1402
  i(x);
1408
1403
  }
@@ -1427,7 +1422,7 @@ function Ei(e) {
1427
1422
  };
1428
1423
  return /* @__PURE__ */ H("div", { children: [
1429
1424
  /* @__PURE__ */ H("div", { className: "univer-flex univer-items-center univer-justify-between univer-gap-2", children: [
1430
- /* @__PURE__ */ M(ys, { value: g, options: _, onChange: A }),
1425
+ /* @__PURE__ */ M(ys, { value: m, options: _, onChange: A }),
1431
1426
  /* @__PURE__ */ M(
1432
1427
  Ir,
1433
1428
  {
@@ -1456,7 +1451,7 @@ function Ei(e) {
1456
1451
  onMouseLeave: k,
1457
1452
  onClick: () => y(x),
1458
1453
  children: [
1459
- h === x && /* @__PURE__ */ M(
1454
+ f === x && /* @__PURE__ */ M(
1460
1455
  kr,
1461
1456
  {
1462
1457
  className: "univer-absolute univer-left-1.5 univer-top-1/2 univer-inline-flex -univer-translate-y-1/2 univer-text-base univer-text-primary-600"
@@ -1489,7 +1484,7 @@ function Ei(e) {
1489
1484
  vt,
1490
1485
  {
1491
1486
  title: I.name,
1492
- value: `${I.require ? E : f} ${I.detail}`
1487
+ value: `${I.require ? E : g} ${I.detail}`
1493
1488
  },
1494
1489
  I.name
1495
1490
  ))
@@ -1499,14 +1494,14 @@ function Ei(e) {
1499
1494
  function bi() {
1500
1495
  const e = bo(), [t, n] = V(!0), [o, r] = V(!1), [s, i] = V(null);
1501
1496
  T(fn);
1502
- const c = T(dt), l = T(Ge), g = T(ne), m = T(me);
1503
- function h() {
1497
+ const c = T(dt), l = T(Ge), m = T(ne), h = T(me);
1498
+ function f() {
1504
1499
  n(!t), r(!o);
1505
1500
  }
1506
1501
  function d() {
1507
- const u = vr(g);
1502
+ const u = vr(m);
1508
1503
  if (!u) return;
1509
- m.executeCommand(cr.id, {
1504
+ h.executeCommand(cr.id, {
1510
1505
  visible: !0,
1511
1506
  unitId: u.unitId,
1512
1507
  eventType: xe.Dblclick
@@ -1528,12 +1523,12 @@ function bi() {
1528
1523
  at,
1529
1524
  {
1530
1525
  variant: "primary",
1531
- onClick: h,
1526
+ onClick: f,
1532
1527
  className: "univer-mb-5 univer-ml-4 univer-mr-0 univer-mt-0",
1533
1528
  children: c.t("formula.moreFunctions.next")
1534
1529
  }
1535
1530
  ),
1536
- 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") }),
1531
+ o && /* @__PURE__ */ M(at, { onClick: f, className: "univer-mb-5 univer-ml-4 univer-mr-0 univer-mt-0", children: c.t("formula.moreFunctions.prev") }),
1537
1532
  t && !!e && /* @__PURE__ */ M(
1538
1533
  at,
1539
1534
  {
@@ -1942,26 +1937,26 @@ let De = class extends Oo {
1942
1937
  }
1943
1938
  _initCanvasEventListeners() {
1944
1939
  const t = this._getSheetObject(), { spreadsheetRowHeader: n, spreadsheetColumnHeader: o, spreadsheet: r, spreadsheetLeftTopPlaceholder: s } = t, { scene: i } = this._context, c = new qe();
1945
- return c.add(r == null ? void 0 : r.onPointerDown$.subscribeEvent((l, g) => {
1946
- this.inRefSelectionMode() && (this._onPointerDown(l, r.zIndex + 1, ve.NORMAL, this._getActiveViewport(l)), l.button !== 2 && g.stopPropagation());
1940
+ return c.add(r == null ? void 0 : r.onPointerDown$.subscribeEvent((l, m) => {
1941
+ this.inRefSelectionMode() && (this._onPointerDown(l, r.zIndex + 1, ve.NORMAL, this._getActiveViewport(l)), l.button !== 2 && m.stopPropagation());
1947
1942
  })), c.add(
1948
- n == null ? void 0 : n.onPointerDown$.subscribeEvent((l, g) => {
1943
+ n == null ? void 0 : n.onPointerDown$.subscribeEvent((l, m) => {
1949
1944
  if (!this.inRefSelectionMode()) return;
1950
- const m = this._sheetSkeletonManagerService.getCurrent().skeleton, { row: h } = Dn(l.offsetX, l.offsetY, i, m);
1951
- $n(this._workbookSelections.getCurrentSelections(), h, ve.ROW) || (this._onPointerDown(l, (r.zIndex || 1) + 1, ve.ROW, this._getActiveViewport(l), Qt.Y), l.button !== 2 && g.stopPropagation());
1945
+ const h = this._sheetSkeletonManagerService.getCurrent().skeleton, { row: f } = Dn(l.offsetX, l.offsetY, i, h);
1946
+ $n(this._workbookSelections.getCurrentSelections(), f, ve.ROW) || (this._onPointerDown(l, (r.zIndex || 1) + 1, ve.ROW, this._getActiveViewport(l), Qt.Y), l.button !== 2 && m.stopPropagation());
1952
1947
  })
1953
- ), c.add(o == null ? void 0 : o.onPointerDown$.subscribeEvent((l, g) => {
1948
+ ), c.add(o == null ? void 0 : o.onPointerDown$.subscribeEvent((l, m) => {
1954
1949
  if (!this.inRefSelectionMode()) return;
1955
- const m = this._sheetSkeletonManagerService.getCurrent().skeleton, { column: h } = Dn(l.offsetX, l.offsetY, i, m);
1956
- $n(this._workbookSelections.getCurrentSelections(), h, ve.COLUMN) || (this._onPointerDown(l, (r.zIndex || 1) + 1, ve.COLUMN, this._getActiveViewport(l), Qt.X), l.button !== 2 && g.stopPropagation());
1957
- })), c.add(s == null ? void 0 : s.onPointerDown$.subscribeEvent((l, g) => {
1950
+ const h = this._sheetSkeletonManagerService.getCurrent().skeleton, { column: f } = Dn(l.offsetX, l.offsetY, i, h);
1951
+ $n(this._workbookSelections.getCurrentSelections(), f, ve.COLUMN) || (this._onPointerDown(l, (r.zIndex || 1) + 1, ve.COLUMN, this._getActiveViewport(l), Qt.X), l.button !== 2 && m.stopPropagation());
1952
+ })), c.add(s == null ? void 0 : s.onPointerDown$.subscribeEvent((l, m) => {
1958
1953
  if (this._reset(), !this.inRefSelectionMode()) return;
1959
- const m = this._sheetSkeletonManagerService.getCurrent().skeleton, h = xo(m);
1960
- this._addSelectionControlByModelData(h), this._selectionMoveStart$.next(this.getSelectionDataWithStyle());
1954
+ const h = this._sheetSkeletonManagerService.getCurrent().skeleton, f = xo(h);
1955
+ this._addSelectionControlByModelData(f), this._selectionMoveStart$.next(this.getSelectionDataWithStyle());
1961
1956
  const d = i.onPointerUp$.subscribeEvent(() => {
1962
1957
  d.unsubscribe(), this._selectionMoveEnd$.next(this.getSelectionDataWithStyle());
1963
1958
  });
1964
- l.button !== 2 && g.stopPropagation();
1959
+ l.button !== 2 && m.stopPropagation();
1965
1960
  })), c;
1966
1961
  }
1967
1962
  /**
@@ -2035,11 +2030,11 @@ let De = class extends Oo {
2035
2030
  if (!c || !i)
2036
2031
  return;
2037
2032
  r && (this._activeViewport = r);
2038
- const { offsetX: l, offsetY: g } = t, m = c.getViewport(Hn.VIEW_MAIN);
2039
- if (!m) return;
2040
- const h = c.getCoordRelativeToViewport(Bn.FromArray([l, g])), { x: d, y: u } = h;
2033
+ const { offsetX: l, offsetY: m } = t, h = c.getViewport(Hn.VIEW_MAIN);
2034
+ if (!h) return;
2035
+ const f = c.getCoordRelativeToViewport(Bn.FromArray([l, m])), { x: d, y: u } = f;
2041
2036
  this._startViewportPosX = d, this._startViewportPosY = u;
2042
- const a = c.getScrollXYInfoByViewport(h), { scaleX: v, scaleY: p } = c.getAncestorScale(), S = this._skeleton.getCellByOffset(d, u, v, p, a);
2037
+ const a = c.getScrollXYInfoByViewport(f), { scaleX: v, scaleY: p } = c.getAncestorScale(), S = this._skeleton.getCellByOffset(d, u, v, p, a);
2043
2038
  if (!S) return;
2044
2039
  switch (o) {
2045
2040
  case ve.NORMAL:
@@ -2058,31 +2053,31 @@ let De = class extends Oo {
2058
2053
  const _ = rn(C, this._skeleton);
2059
2054
  this._startRangeWhenPointerDown = { ..._.rangeWithCoord };
2060
2055
  const E = { ..._.rangeWithCoord, rangeType: o };
2061
- let f = this.getActiveSelectionControl();
2056
+ let g = this.getActiveSelectionControl();
2062
2057
  const b = this.getSelectionControls();
2063
2058
  for (const O of b) {
2064
2059
  if (t.button === 2 && nr.contains(O.model, E)) {
2065
- f = O;
2060
+ g = O;
2066
2061
  return;
2067
2062
  }
2068
2063
  if (O.model.isEqual(E)) {
2069
- f = O;
2064
+ g = O;
2070
2065
  break;
2071
2066
  }
2072
2067
  }
2073
2068
  this._checkClearPreviousControls(t);
2074
- const y = f == null ? void 0 : f.model.currentCell, A = t.shiftKey && y, F = this._remainLastEnabled && !t.ctrlKey && !t.shiftKey && !this._skipLastEnabled && !this._singleSelectionEnabled;
2069
+ const y = g == null ? void 0 : g.model.currentCell, A = t.shiftKey && y, F = this._remainLastEnabled && !t.ctrlKey && !t.shiftKey && !this._skipLastEnabled && !this._singleSelectionEnabled;
2075
2070
  A && y ? this._makeSelectionByTwoCells(
2076
2071
  y,
2077
2072
  E,
2078
2073
  i,
2079
2074
  o,
2080
- f
2075
+ g
2081
2076
  // Get updated in this method
2082
- ) : F && f ? f.updateRangeBySelectionWithCoord(_) : f = this.newSelectionControl(c, i, C);
2077
+ ) : F && g ? g.updateRangeBySelectionWithCoord(_) : g = this.newSelectionControl(c, i, C);
2083
2078
  for (let O = 0; O < this.getSelectionControls().length - 1; O++)
2084
2079
  this.getSelectionControls()[O].clearHighlight();
2085
- this._selectionMoveStart$.next(this.getSelectionDataWithStyle()), c.disableObjectsEvent(), this._clearUpdatingListeners(), this._addEndingListeners(), (N = c.getTransformer()) == null || N.clearSelectedObjects(), this._setupPointerMoveListener(m, f, o, s, d, u), this._escapeShortcutDisposable = this._shortcutService.forceEscape(), this._scenePointerUpSub = c.onPointerUp$.subscribeEvent(() => {
2080
+ this._selectionMoveStart$.next(this.getSelectionDataWithStyle()), c.disableObjectsEvent(), this._clearUpdatingListeners(), this._addEndingListeners(), (N = c.getTransformer()) == null || N.clearSelectedObjects(), this._setupPointerMoveListener(h, g, o, s, d, u), this._escapeShortcutDisposable = this._shortcutService.forceEscape(), this._scenePointerUpSub = c.onPointerUp$.subscribeEvent(() => {
2086
2081
  var O;
2087
2082
  this._clearUpdatingListeners(), this._selectionMoveEnd$.next(this.getSelectionDataWithStyle()), (O = this._escapeShortcutDisposable) == null || O.dispose(), this._escapeShortcutDisposable = null;
2088
2083
  });
@@ -2168,14 +2163,14 @@ function Vr(e, t, n) {
2168
2163
  const l = o.getEditor(e);
2169
2164
  if (!l)
2170
2165
  return;
2171
- const g = l.getBoundingClientRect(), { marginTop: m = 0, marginBottom: h = 0 } = l.getDocumentData().documentStyle, d = l.getSkeleton();
2166
+ const m = l.getBoundingClientRect(), { marginTop: h = 0, marginBottom: f = 0 } = l.getDocumentData().documentStyle, d = l.getSkeleton();
2172
2167
  if (!d) return;
2173
2168
  const u = (_ = d.getSkeletonData()) == null ? void 0 : _.pages[0].height;
2174
- let { left: a, top: v, right: p, bottom: S } = g;
2175
- v = v + m, S = u ? v + u : S - h;
2169
+ let { left: a, top: v, right: p, bottom: S } = m;
2170
+ v = v + h, S = u ? v + u : S - f;
2176
2171
  const C = r.getValue();
2177
2172
  if (!(C.left === a && C.top === v && C.right === p && C.bottom === S))
2178
- return r.next({ left: a - 1, right: p + 1, top: v - 1, bottom: S + 1 }), g;
2173
+ return r.next({ left: a - 1, right: p + 1, top: v - 1, bottom: S + 1 }), m;
2179
2174
  });
2180
2175
  return L(() => {
2181
2176
  t && c();
@@ -2190,10 +2185,10 @@ const nt = (e) => {
2190
2185
  const t = z(e);
2191
2186
  return t.current = e, t;
2192
2187
  }, Qi = (e, t, n) => {
2193
- const o = T(zt), r = T(Gt), s = T(_e), [i, c] = V(), [l, g] = V(-1), [m, h] = V(!0), d = nt(m), u = z(t);
2188
+ const o = T(zt), r = T(Gt), s = T(_e), [i, c] = V(), [l, m] = V(-1), [h, f] = V(!0), d = nt(h), u = z(t);
2194
2189
  u.current = t;
2195
2190
  const a = () => {
2196
- c(void 0), g(-1), h(!1);
2191
+ c(void 0), m(-1), f(!1);
2197
2192
  };
2198
2193
  return L(() => {
2199
2194
  const v = s.sequenceNodesBuilder(t.slice(1));
@@ -2204,29 +2199,29 @@ const nt = (e) => {
2204
2199
  if (S.textRanges.length === 1) {
2205
2200
  const [C] = S.textRanges;
2206
2201
  if (C.collapsed && d.current) {
2207
- const { startOffset: _ } = C, E = o.getCurrentSequenceNodeIndex(_ - 2), f = o.getCurrentSequenceNodeByIndex(E), b = o.getCurrentSequenceNodeByIndex(E + 1);
2208
- if (f)
2209
- if (typeof f != "string" && f.nodeType === 3 && !r.hasDefinedNameDescription(f.token.trim()) && b === je.OPEN_BRACKET) {
2210
- const y = r.getFunctionInfo(f.token);
2211
- c(y), g(-1);
2202
+ const { startOffset: _ } = C, E = o.getCurrentSequenceNodeIndex(_ - 2), g = o.getCurrentSequenceNodeByIndex(E), b = o.getCurrentSequenceNodeByIndex(E + 1);
2203
+ if (g)
2204
+ if (typeof g != "string" && g.nodeType === 3 && !r.hasDefinedNameDescription(g.token.trim()) && b === je.OPEN_BRACKET) {
2205
+ const y = r.getFunctionInfo(g.token);
2206
+ c(y), m(-1);
2212
2207
  return;
2213
2208
  } else {
2214
2209
  const y = s.getFunctionAndParameter(`${u.current}A`, _ - 1);
2215
2210
  if (y) {
2216
2211
  const { functionName: A, paramIndex: F } = y, N = r.getFunctionInfo(A);
2217
- c(N), g(F);
2212
+ c(N), m(F);
2218
2213
  return;
2219
2214
  }
2220
2215
  }
2221
2216
  }
2222
2217
  }
2223
- c(void 0), g(-1);
2218
+ c(void 0), m(-1);
2224
2219
  }), p = n.selectionChange$.pipe(
2225
2220
  pr((S) => S.textRanges.length === 1),
2226
2221
  gr((S) => S.textRanges[0].startOffset),
2227
2222
  Zo()
2228
2223
  ).subscribe(() => {
2229
- h(!0);
2224
+ f(!0);
2230
2225
  });
2231
2226
  return () => {
2232
2227
  v.unsubscribe(), p.unsubscribe();
@@ -2284,16 +2279,16 @@ const nt = (e) => {
2284
2279
  }, Jn = () => {
2285
2280
  };
2286
2281
  function tc(e) {
2287
- const { onParamsSwitch: t = Jn, onClose: n = Jn, isFocus: o, editor: r, formulaText: s } = e, { functionInfo: i, paramIndex: c, reset: l } = Qi(o, s, r), g = T(fn), m = !Se(g.helpFunctionVisible$), [h, d] = V(!0), u = T(dt), a = u.t("formula.prompt.required"), v = u.t("formula.prompt.optional"), p = r.getEditorId(), [S] = Vr(p, !!i, [i, c]);
2288
- function C(f) {
2289
- t && t(f);
2282
+ const { onParamsSwitch: t = Jn, onClose: n = Jn, isFocus: o, editor: r, formulaText: s } = e, { functionInfo: i, paramIndex: c, reset: l } = Qi(o, s, r), m = T(fn), h = !Se(m.helpFunctionVisible$), [f, d] = V(!0), u = T(dt), a = u.t("formula.prompt.required"), v = u.t("formula.prompt.optional"), p = r.getEditorId(), [S] = Vr(p, !!i, [i, c]);
2283
+ function C(g) {
2284
+ t && t(g);
2290
2285
  }
2291
- const _ = te((f) => {
2292
- g.helpFunctionVisible$.next(!f);
2286
+ const _ = te((g) => {
2287
+ m.helpFunctionVisible$.next(!g);
2293
2288
  }), E = () => {
2294
2289
  _(!0), n();
2295
2290
  };
2296
- return i ? m ? /* @__PURE__ */ M(on, { portal: !0, anchorRect$: S, direction: "left-center", children: /* @__PURE__ */ M(Ji, { onClick: () => _(!1) }) }, "hidden") : /* @__PURE__ */ M(on, { portal: !0, onClickOutside: () => l(), anchorRect$: S, direction: "vertical", children: /* @__PURE__ */ H(
2291
+ return i ? h ? /* @__PURE__ */ M(on, { portal: !0, anchorRect$: S, direction: "left-center", children: /* @__PURE__ */ M(Ji, { onClick: () => _(!1) }) }, "hidden") : /* @__PURE__ */ M(on, { portal: !0, onClickOutside: () => l(), anchorRect$: S, direction: "vertical", children: /* @__PURE__ */ H(
2297
2292
  "div",
2298
2293
  {
2299
2294
  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", Cn),
@@ -2317,8 +2312,8 @@ function tc(e) {
2317
2312
  "div",
2318
2313
  {
2319
2314
  className: "univer-ml-2 univer-flex univer-h-6 univer-w-6 univer-cursor-pointer univer-items-center univer-justify-center univer-rounded univer-bg-transparent univer-p-0 univer-text-xs univer-text-gray-500 univer-outline-none univer-transition-colors hover:univer-bg-gray-200 dark:hover:!univer-bg-gray-600",
2320
- style: { transform: h ? "rotateZ(-90deg)" : "rotateZ(90deg)" },
2321
- onClick: () => d(!h),
2315
+ style: { transform: f ? "rotateZ(-90deg)" : "rotateZ(90deg)" },
2316
+ onClick: () => d(!f),
2322
2317
  children: /* @__PURE__ */ M($r, {})
2323
2318
  }
2324
2319
  ),
@@ -2339,15 +2334,15 @@ function tc(e) {
2339
2334
  {
2340
2335
  className: re("univer-box-border univer-max-h-[350px] univer-overflow-y-auto univer-px-4 univer-pb-3 univer-pt-0", ut),
2341
2336
  style: {
2342
- height: h ? "unset" : 0,
2343
- padding: h ? "revert-layer" : 0
2337
+ height: f ? "unset" : 0,
2338
+ padding: f ? "revert-layer" : 0
2344
2339
  },
2345
2340
  children: /* @__PURE__ */ H("div", { className: "univer-mt-3", children: [
2346
2341
  /* @__PURE__ */ M(
2347
2342
  nn,
2348
2343
  {
2349
2344
  title: u.t("formula.prompt.helpExample"),
2350
- value: `${i.functionName}(${i.functionParameter.map((f) => f.example).join(",")})`
2345
+ value: `${i.functionName}(${i.functionParameter.map((g) => g.example).join(",")})`
2351
2346
  }
2352
2347
  ),
2353
2348
  /* @__PURE__ */ M(
@@ -2357,12 +2352,12 @@ function tc(e) {
2357
2352
  value: i.description
2358
2353
  }
2359
2354
  ),
2360
- i && i.functionParameter && i.functionParameter.map((f, b) => /* @__PURE__ */ M(
2355
+ i && i.functionParameter && i.functionParameter.map((g, b) => /* @__PURE__ */ M(
2361
2356
  nn,
2362
2357
  {
2363
2358
  className: c === b ? "univer-text-primary-500" : "",
2364
- title: f.name,
2365
- value: `${f.require ? a : v} ${f.detail}`
2359
+ title: g.name,
2360
+ value: `${g.require ? a : v} ${g.detail}`
2366
2361
  },
2367
2362
  b
2368
2363
  ))
@@ -2399,10 +2394,10 @@ function rc(e) {
2399
2394
  var Ne = /* @__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))(Ne || {});
2400
2395
  function oc(e) {
2401
2396
  var y;
2402
- const { editorId: t, isFocus: n, disableOnClick: o, unitId: r, subUnitId: s } = e, i = T(Re), c = T(ne), l = i.getRenderById(r), g = i.getRenderById(t), m = g == null ? void 0 : g.with(Sr), h = T(Er), d = T(Rt), [u, a] = V(
2397
+ const { editorId: t, isFocus: n, disableOnClick: o, unitId: r, subUnitId: s } = e, i = T(Re), c = T(ne), l = i.getRenderById(r), m = i.getRenderById(t), h = m == null ? void 0 : m.with(Sr), f = T(Er), d = T(Rt), [u, a] = V(
2403
2398
  0
2404
2399
  /* NOT_SELECT */
2405
- ), v = T(_e), p = z(!0), S = l == null ? void 0 : l.with(De), C = nt(u), _ = c.getUnit(r, W.UNIVER_SHEET), E = _ == null ? void 0 : _.getSheetBySheetId(s), f = te((A) => {
2400
+ ), v = T(_e), p = z(!0), S = l == null ? void 0 : l.with(De), C = nt(u), _ = c.getUnit(r, W.UNIVER_SHEET), E = _ == null ? void 0 : _.getSheetBySheetId(s), g = te((A) => {
2406
2401
  S && S.setSkipLastEnabled(
2407
2402
  A === 1 || A === 3 || A === 4
2408
2403
  /* EDIT_OTHER_WORKBOOK_REFERENCE */
@@ -2411,7 +2406,7 @@ function oc(e) {
2411
2406
  var ce, ae, he;
2412
2407
  const A = c.getCurrentUnitOfType(W.UNIVER_SHEET);
2413
2408
  if (!A) return;
2414
- const F = A.getActiveSheet(), N = m == null ? void 0 : m.getActiveTextRange(), O = N != null && N.collapsed ? N.startOffset : -1, k = rc(d);
2409
+ const F = A.getActiveSheet(), N = h == null ? void 0 : h.getActiveTextRange(), O = N != null && N.collapsed ? N.startOffset : -1, k = rc(d);
2415
2410
  if (!k) return;
2416
2411
  const I = (ce = k == null ? void 0 : k.dataStream) == null ? void 0 : ce.slice(0, -2), x = ((ae = v.sequenceNodesBuilder(I)) != null ? ae : []).map((K) => typeof K == "object" ? K.nodeType === Q.REFERENCE ? {
2417
2412
  ...K,
@@ -2425,48 +2420,48 @@ function oc(e) {
2425
2420
  if (p.current)
2426
2421
  return;
2427
2422
  const { sheetName: K, unitId: J } = D.range, rt = (he = c.getCurrentUnitOfType(W.UNIVER_SHEET)) == null ? void 0 : he.getUnitId();
2428
- J && J !== rt ? f(
2423
+ J && J !== rt ? g(
2429
2424
  4
2430
2425
  /* EDIT_OTHER_WORKBOOK_REFERENCE */
2431
- ) : !K && F.getSheetId() === (E == null ? void 0 : E.getSheetId()) || K === F.getName() ? f(
2426
+ ) : !K && F.getSheetId() === (E == null ? void 0 : E.getSheetId()) || K === F.getName() ? g(
2432
2427
  2
2433
2428
  /* CAN_EDIT */
2434
- ) : f(
2429
+ ) : g(
2435
2430
  3
2436
2431
  /* EDIT_OTHER_SHEET_REFERENCE */
2437
2432
  );
2438
2433
  } else
2439
- p.current = !1, f(
2434
+ p.current = !1, g(
2440
2435
  1
2441
2436
  /* NEED_ADD */
2442
2437
  );
2443
2438
  else
2444
- f(
2439
+ g(
2445
2440
  0
2446
2441
  /* NOT_SELECT */
2447
2442
  );
2448
2443
  });
2449
2444
  return L(() => {
2450
- const A = h.textSelection$.pipe(pr((F) => F.unitId === t)).subscribe(() => {
2445
+ const A = f.textSelection$.pipe(pr((F) => F.unitId === t)).subscribe(() => {
2451
2446
  b();
2452
2447
  });
2453
2448
  return () => A.unsubscribe();
2454
- }, [b, h.textSelection$, t]), L(() => {
2455
- n || (f(
2449
+ }, [b, f.textSelection$, t]), L(() => {
2450
+ n || (g(
2456
2451
  0
2457
2452
  /* NOT_SELECT */
2458
2453
  ), p.current = !0);
2459
- }, [n, f]), L(() => {
2454
+ }, [n, g]), L(() => {
2460
2455
  var F;
2461
2456
  if (!o) return;
2462
- const A = (F = g == null ? void 0 : g.mainComponent) == null ? void 0 : F.onPointerDown$.subscribeEvent(() => {
2463
- f(
2457
+ const A = (F = m == null ? void 0 : m.mainComponent) == null ? void 0 : F.onPointerDown$.subscribeEvent(() => {
2458
+ g(
2464
2459
  0
2465
2460
  /* NOT_SELECT */
2466
2461
  ), p.current = !0;
2467
2462
  });
2468
2463
  return () => A == null ? void 0 : A.unsubscribe();
2469
- }, [o, (y = g == null ? void 0 : g.mainComponent) == null ? void 0 : y.onPointerDown$, f]), L(() => {
2464
+ }, [o, (y = m == null ? void 0 : m.mainComponent) == null ? void 0 : y.onPointerDown$, g]), L(() => {
2470
2465
  if (!n) return;
2471
2466
  const A = _ == null ? void 0 : _.activeSheet$.subscribe(() => {
2472
2467
  b();
@@ -2496,7 +2491,7 @@ function ic(e, t, n) {
2496
2491
  };
2497
2492
  }
2498
2493
  function Wr(e) {
2499
- var _, E, f;
2494
+ var _, E, g;
2500
2495
  const {
2501
2496
  unitId: t,
2502
2497
  subUnitId: n,
@@ -2506,9 +2501,9 @@ function Wr(e) {
2506
2501
  refSelectionsService: i,
2507
2502
  refSelectionsRenderService: c,
2508
2503
  sheetSkeletonManagerService: l,
2509
- themeService: g,
2510
- univerInstanceService: m
2511
- } = e, h = o.getUnitId(), d = m.getUnit(t, W.UNIVER_SHEET), u = d == null ? void 0 : d.getActiveSheet(), a = [];
2504
+ themeService: m,
2505
+ univerInstanceService: h
2506
+ } = e, f = o.getUnitId(), d = h.getUnit(t, W.UNIVER_SHEET), u = d == null ? void 0 : d.getActiveSheet(), a = [];
2512
2507
  if (!d || !u) {
2513
2508
  i.setSelections(a);
2514
2509
  return;
@@ -2521,34 +2516,34 @@ function Wr(e) {
2521
2516
  const C = [];
2522
2517
  for (let b = 0, y = r.length; b < y; b++) {
2523
2518
  const A = r[b], { themeColor: F, token: N, refIndex: O, endIndex: k } = A, I = ht(N), { unitId: x, sheetName: R, range: w } = I, D = p(R);
2524
- if (!D && R || h !== t && x !== h || x && x !== h || D && D !== v || !D && v !== n)
2519
+ if (!D && R || f !== t && x !== f || x && x !== f || D && D !== v || !D && v !== n)
2525
2520
  continue;
2526
2521
  const U = us(w, u.getRowCount(), u.getColumnCount());
2527
2522
  U.unitId = t, U.sheetId = v, a.push({
2528
2523
  range: U,
2529
2524
  primary: null,
2530
- style: ic(g, F, O.toString())
2525
+ style: ic(m, F, O.toString())
2531
2526
  }), C.push(k);
2532
2527
  }
2533
2528
  if (s) {
2534
- const b = (f = (E = s.getSelectionRanges()) == null ? void 0 : E[0]) == null ? void 0 : f.startOffset, y = C.findIndex((A) => A + 2 === b);
2529
+ const b = (g = (E = s.getSelectionRanges()) == null ? void 0 : E[0]) == null ? void 0 : g.startOffset, y = C.findIndex((A) => A + 2 === b);
2535
2530
  y !== -1 ? c == null || c.setActiveSelectionIndex(y) : c == null || c.resetActiveSelectionIndex();
2536
2531
  }
2537
2532
  return a;
2538
2533
  }
2539
2534
  function cc(e, t) {
2540
- const n = T(ne), o = T(It), r = T(Yt), s = T(Re), i = Se(ie(() => n.getCurrentTypeOfUnit$(W.UNIVER_SHEET), [n])), c = i ? s.getRenderById(i.getUnitId()) : null, l = c == null ? void 0 : c.with(De), g = c == null ? void 0 : c.with(Et), m = te((h, d) => {
2535
+ const n = T(ne), o = T(It), r = T(Yt), s = T(Re), i = Se(ie(() => n.getCurrentTypeOfUnit$(W.UNIVER_SHEET), [n])), c = i ? s.getRenderById(i.getUnitId()) : null, l = c == null ? void 0 : c.with(De), m = c == null ? void 0 : c.with(Et), h = te((f, d) => {
2541
2536
  const u = n.getCurrentUnitOfType(W.UNIVER_SHEET);
2542
2537
  if (!u || l != null && l.selectionMoving) return;
2543
2538
  const a = Wr({
2544
2539
  unitId: e,
2545
2540
  subUnitId: t,
2546
2541
  currentWorkbook: u,
2547
- refSelections: h,
2542
+ refSelections: f,
2548
2543
  editor: d,
2549
2544
  refSelectionsService: r,
2550
2545
  refSelectionsRenderService: l,
2551
- sheetSkeletonManagerService: g,
2546
+ sheetSkeletonManagerService: m,
2552
2547
  themeService: o,
2553
2548
  univerInstanceService: n
2554
2549
  });
@@ -2557,22 +2552,22 @@ function cc(e, t) {
2557
2552
  });
2558
2553
  return L(() => () => {
2559
2554
  l == null || l.resetActiveSelectionIndex();
2560
- }, [l]), m;
2555
+ }, [l]), h;
2561
2556
  }
2562
2557
  function Hr(e = "") {
2563
2558
  const t = T(Gt), n = ac(), o = T(me), r = ie(() => e.length, [e]);
2564
- return te((i, c, l = !0, g) => {
2565
- const m = i.getDocumentData(), h = i.getEditorId();
2566
- if (!m)
2559
+ return te((i, c, l = !0, m) => {
2560
+ const h = i.getDocumentData(), f = i.getEditorId();
2561
+ if (!h)
2567
2562
  return [];
2568
- const d = m.body;
2563
+ const d = h.body;
2569
2564
  if (!d)
2570
2565
  return [];
2571
- const u = d.dataStream.slice(0, d.dataStream.length - 2), a = { dataStream: "", ...m.body };
2566
+ const u = d.dataStream.slice(0, d.dataStream.length - 2), a = { dataStream: "", ...h.body };
2572
2567
  if (!u.startsWith(e)) return [];
2573
2568
  if (c == null || c.length === 0)
2574
2569
  return a.textRuns = [], o.syncExecuteCommand(Wn.id, {
2575
- unitId: h,
2570
+ unitId: f,
2576
2571
  body: kn(a, 0, a.dataStream.length - 2)
2577
2572
  }), [];
2578
2573
  {
@@ -2592,9 +2587,9 @@ function Hr(e = "") {
2592
2587
  });
2593
2588
  }
2594
2589
  return o.syncExecuteCommand(Wn.id, {
2595
- unitId: h,
2590
+ unitId: f,
2596
2591
  body: kn(a, 0, a.dataStream.length - 2),
2597
- textRanges: g != null ? g : C
2592
+ textRanges: m != null ? m : C
2598
2593
  }), p;
2599
2594
  }
2600
2595
  });
@@ -2620,15 +2615,15 @@ function ac() {
2620
2615
  }, [t]);
2621
2616
  }
2622
2617
  function lc(e, t, n) {
2623
- const { formulaRefColors: o, numberColor: r, stringColor: s, plainTextColor: i } = t, c = [], l = [], g = /* @__PURE__ */ new Map();
2624
- let m = 0;
2625
- for (let h = 0, d = n.length; h < d; h++) {
2626
- const u = n[h];
2618
+ const { formulaRefColors: o, numberColor: r, stringColor: s, plainTextColor: i } = t, c = [], l = [], m = /* @__PURE__ */ new Map();
2619
+ let h = 0;
2620
+ for (let f = 0, d = n.length; f < d; f++) {
2621
+ const u = n[f];
2627
2622
  if (typeof u == "string") {
2628
- const _ = c[c.length - 1], E = _ ? _.ed : 0, f = E + u.length;
2623
+ const _ = c[c.length - 1], E = _ ? _.ed : 0, g = E + u.length;
2629
2624
  c.push({
2630
2625
  st: E,
2631
- ed: f,
2626
+ ed: g,
2632
2627
  ts: {
2633
2628
  cl: {
2634
2629
  rgb: i
@@ -2654,14 +2649,14 @@ function lc(e, t, n) {
2654
2649
  const { startIndex: a, endIndex: v, nodeType: p, token: S } = u;
2655
2650
  let C = "";
2656
2651
  if (p === Q.REFERENCE) {
2657
- if (g.has(S))
2658
- C = g.get(S);
2652
+ if (m.has(S))
2653
+ C = m.get(S);
2659
2654
  else {
2660
- const _ = m % o.length;
2661
- C = o[_], g.set(S, C), m++;
2655
+ const _ = h % o.length;
2656
+ C = o[_], m.set(S, C), h++;
2662
2657
  }
2663
2658
  l.push({
2664
- refIndex: h,
2659
+ refIndex: f,
2665
2660
  themeColor: C,
2666
2661
  token: S,
2667
2662
  startIndex: u.startIndex,
@@ -2698,7 +2693,7 @@ const uc = (e, t, n, o) => {
2698
2693
  c.current = o, L(() => {
2699
2694
  if (!n || !e)
2700
2695
  return;
2701
- const g = `sheet.formula-embedding-editor.${n.getEditorId()}`, m = new qe(), h = (a, v) => {
2696
+ const m = `sheet.formula-embedding-editor.${n.getEditorId()}`, h = new qe(), f = (a, v) => {
2702
2697
  if (c.current) {
2703
2698
  c.current(a, v);
2704
2699
  return;
@@ -2727,10 +2722,10 @@ const uc = (e, t, n, o) => {
2727
2722
  direction: p,
2728
2723
  extra: "formula-editor",
2729
2724
  fromCurrentSelection: i.current === Ne.NEED_ADD || i.current === Ne.EDIT_OTHER_SHEET_REFERENCE
2730
- }) : h(a, v);
2725
+ }) : f(a, v);
2731
2726
  };
2732
- return m.add(r.registerCommand({
2733
- id: g,
2727
+ return h.add(r.registerCommand({
2728
+ id: m,
2734
2729
  type: Oe.OPERATION,
2735
2730
  handler(a, v) {
2736
2731
  const { keyCode: p, metaKey: S } = v;
@@ -2754,7 +2749,7 @@ const uc = (e, t, n, o) => {
2754
2749
  { keyCode: $.ARROW_RIGHT, metaKey: P.CTRL_COMMAND | P.SHIFT },
2755
2750
  { keyCode: $.ARROW_UP, metaKey: P.CTRL_COMMAND | P.SHIFT }
2756
2751
  ].map(({ keyCode: a, metaKey: v }) => ({
2757
- id: g,
2752
+ id: m,
2758
2753
  binding: v ? a | v : a,
2759
2754
  preconditions: () => !0,
2760
2755
  priority: 900,
@@ -2764,18 +2759,18 @@ const uc = (e, t, n, o) => {
2764
2759
  metaKey: v
2765
2760
  }
2766
2761
  })).forEach((a) => {
2767
- m.add(s.registerShortcut(a));
2762
+ h.add(s.registerShortcut(a));
2768
2763
  }), () => {
2769
- m.dispose();
2764
+ h.dispose();
2770
2765
  };
2771
2766
  }, [r, n, e, s]);
2772
2767
  }, dc = (e, t, n, o, r = !0) => {
2773
2768
  var u;
2774
- const s = T(Re), i = T(ln), c = T(Cs), l = T(Yt), g = T(ne), m = Se(ie(() => g.getCurrentTypeOfUnit$(W.UNIVER_SHEET), [g])), h = s.getRenderById((u = m == null ? void 0 : m.getUnitId()) != null ? u : ""), d = h == null ? void 0 : h.with(De);
2769
+ const s = T(Re), i = T(ln), c = T(Cs), l = T(Yt), m = T(ne), h = Se(ie(() => m.getCurrentTypeOfUnit$(W.UNIVER_SHEET), [m])), f = s.getRenderById((u = h == null ? void 0 : h.getUnitId()) != null ? u : ""), d = f == null ? void 0 : f.with(De);
2775
2770
  Lt(() => {
2776
2771
  if (e)
2777
2772
  return i.setContextValue(An, !0), r && c.disable(), () => {
2778
- const a = g.getCurrentUnitOfType(W.UNIVER_DOC);
2773
+ const a = m.getCurrentUnitOfType(W.UNIVER_DOC);
2779
2774
  (a == null ? void 0 : a.getUnitId()) === o && i.setContextValue(An, !1), r && c.enable(), l.clear();
2780
2775
  };
2781
2776
  }, [i, e, l, r, o]), Lt(() => {
@@ -2797,25 +2792,25 @@ const uc = (e, t, n, o) => {
2797
2792
  }
2798
2793
  }, [e, r, n, t, o]);
2799
2794
  }, fc = (e) => e.reduce((t, n) => typeof n == "string" ? t + n.length : t + n.token.length, 0), an = (e) => e.map((t) => typeof t == "string" ? t : t.token).join(""), At = (e, t = !1, n = "", o = !1) => !t && !o ? e.map((r) => Ce(r.range)) : e.map((r) => o ? Wo(r) : r.sheetName !== "" && r.sheetName !== n ? Ct(r.sheetName, r.range) : Ce(r.range)), gc = (e) => {
2800
- var m, h, d;
2795
+ var h, f, d;
2801
2796
  const { editor: t, lexerTreeBuilder: n } = e, o = t == null ? void 0 : t.getSelectionRanges();
2802
2797
  if ((o == null ? void 0 : o.length) !== 1)
2803
2798
  return;
2804
- const s = o[0].startOffset - 1, i = ((h = (m = t == null ? void 0 : t.getDocumentData().body) == null ? void 0 : m.dataStream) != null ? h : `\r
2805
- `).slice(0, -2), c = (d = n.sequenceNodesBuilder(i.slice(1))) != null ? d : [], l = In(c, s, !1), g = Ur(c, l);
2799
+ const s = o[0].startOffset - 1, i = ((f = (h = t == null ? void 0 : t.getDocumentData().body) == null ? void 0 : h.dataStream) != null ? f : `\r
2800
+ `).slice(0, -2), c = (d = n.sequenceNodesBuilder(i.slice(1))) != null ? d : [], l = In(c, s, !1), m = Ur(c, l);
2806
2801
  return {
2807
2802
  nodeIndex: l,
2808
- updatingRefIndex: g,
2803
+ updatingRefIndex: m,
2809
2804
  sequenceNodes: c,
2810
2805
  offset: s
2811
2806
  };
2812
2807
  }, mc = (() => {
2813
- }), pc = (e, t, n, o, r, s, i, c, l, g = mc) => {
2808
+ }), pc = (e, t, n, o, r, s, i, c, l, m = mc) => {
2814
2809
  var O;
2815
- const m = T(Re), h = T(ne), d = T(me), u = T(Er), a = T(It), v = T(_e), p = h.getUnit(o), S = te((k, I) => {
2810
+ const h = T(Re), f = T(ne), d = T(me), u = T(Er), a = T(It), v = T(_e), p = f.getUnit(o), S = te((k, I) => {
2816
2811
  var x, R, w;
2817
- return (w = (R = (x = h.getUnit(k)) == null ? void 0 : x.getSheetBySheetId(I)) == null ? void 0 : R.getName()) != null ? w : "";
2818
- }), C = ie(() => S(o, r), [S, r, o]), _ = Se(p == null ? void 0 : p.activeSheet$), E = nt({ activeSheet: _, sheetName: C }), f = Se(ie(() => h.getCurrentTypeOfUnit$(W.UNIVER_SHEET), [h])), b = m.getRenderById((O = f == null ? void 0 : f.getUnitId()) != null ? O : ""), y = b == null ? void 0 : b.with(De), A = b == null ? void 0 : b.with(Et), F = T(Yt), N = te((k, I) => {
2812
+ return (w = (R = (x = f.getUnit(k)) == null ? void 0 : x.getSheetBySheetId(I)) == null ? void 0 : R.getName()) != null ? w : "";
2813
+ }), C = ie(() => S(o, r), [S, r, o]), _ = Se(p == null ? void 0 : p.activeSheet$), E = nt({ activeSheet: _, sheetName: C }), g = Se(ie(() => f.getCurrentTypeOfUnit$(W.UNIVER_SHEET), [f])), b = h.getRenderById((O = g == null ? void 0 : g.getUnitId()) != null ? O : ""), y = b == null ? void 0 : b.with(De), A = b == null ? void 0 : b.with(Et), F = T(Yt), N = te((k, I) => {
2819
2814
  var B, ce, ae, he, K, J, rt, ot, Tt, Ie;
2820
2815
  const x = gc({ editor: l, lexerTreeBuilder: v });
2821
2816
  if (!x) return;
@@ -2826,21 +2821,21 @@ const uc = (e, t, n, o) => {
2826
2821
  return;
2827
2822
  const Y = k[k.length - 1], X = D.splice(R + 1), Ee = (B = Y.sheetId) != null ? B : r, fe = {
2828
2823
  range: Y,
2829
- unitId: (ce = Y.unitId) != null ? ce : f.getUnitId(),
2830
- sheetName: S((ae = Y.unitId) != null ? ae : f.getUnitId(), Ee)
2831
- }, ee = Ee !== r, le = (f == null ? void 0 : f.getUnitId()) !== o, be = At([fe], i && (ee || le), C, le);
2824
+ unitId: (ce = Y.unitId) != null ? ce : g.getUnitId(),
2825
+ sheetName: S((ae = Y.unitId) != null ? ae : g.getUnitId(), Ee)
2826
+ }, ee = Ee !== r, le = (g == null ? void 0 : g.getUnitId()) !== o, be = At([fe], i && (ee || le), C, le);
2832
2827
  D.push({ token: be[0], nodeType: Q.REFERENCE });
2833
2828
  const Le = [...D, ...X], Me = an(Le);
2834
- g(Me, fc(D), I);
2829
+ m(Me, fc(D), I);
2835
2830
  } else {
2836
2831
  const Y = k[k.length - 1], X = (he = Y.sheetId) != null ? he : r, Ee = {
2837
2832
  range: Y,
2838
- unitId: (K = Y.unitId) != null ? K : f.getUnitId(),
2839
- sheetName: S((J = Y.unitId) != null ? J : f.getUnitId(), X)
2840
- }, fe = X !== r, ee = (f == null ? void 0 : f.getUnitId()) !== o, le = At([Ee], i && (fe || ee), C, ee);
2833
+ unitId: (K = Y.unitId) != null ? K : g.getUnitId(),
2834
+ sheetName: S((J = Y.unitId) != null ? J : g.getUnitId(), X)
2835
+ }, fe = X !== r, ee = (g == null ? void 0 : g.getUnitId()) !== o, le = At([Ee], i && (fe || ee), C, ee);
2841
2836
  D.unshift({ token: le[0], nodeType: Q.REFERENCE });
2842
2837
  const be = an(D);
2843
- g(be, le[0].length, I);
2838
+ m(be, le[0].length, I);
2844
2839
  }
2845
2840
  else if (n.current === Ne.EDIT_OTHER_SHEET_REFERENCE || n.current === Ne.EDIT_OTHER_WORKBOOK_REFERENCE) {
2846
2841
  const Y = k.pop();
@@ -2848,9 +2843,9 @@ const uc = (e, t, n, o) => {
2848
2843
  const X = D[R];
2849
2844
  if (typeof X == "object" && X.nodeType === Q.REFERENCE) {
2850
2845
  const Ee = X.token;
2851
- (f == null ? void 0 : f.getUnitId()) !== o ? X.token = Ho((rt = f == null ? void 0 : f.getUnitId()) != null ? rt : "", C, Y) : X.token = C === (_ == null ? void 0 : _.getName()) ? Ce(Y) : Ct(_.getName(), Y);
2846
+ (g == null ? void 0 : g.getUnitId()) !== o ? X.token = Ho((rt = g == null ? void 0 : g.getUnitId()) != null ? rt : "", C, Y) : X.token = C === (_ == null ? void 0 : _.getName()) ? Ce(Y) : Ct(_.getName(), Y);
2852
2847
  const ee = U + (X.token.length - Ee.length);
2853
- g(Bo(D), ee, I);
2848
+ m(Bo(D), ee, I);
2854
2849
  }
2855
2850
  } else {
2856
2851
  const Y = [...k];
@@ -2865,16 +2860,16 @@ const uc = (e, t, n, o) => {
2865
2860
  return G;
2866
2861
  if (G.nodeType === Q.REFERENCE) {
2867
2862
  const Ve = ht(G.token);
2868
- if (Ve.sheetName || (Ve.sheetName = C), (Ve.unitId || o) !== (f == null ? void 0 : f.getUnitId()) || i && ((ge = E.current.activeSheet) == null ? void 0 : ge.getName()) !== Ve.sheetName)
2863
+ if (Ve.sheetName || (Ve.sheetName = C), (Ve.unitId || o) !== (g == null ? void 0 : g.getUnitId()) || i && ((ge = E.current.activeSheet) == null ? void 0 : ge.getName()) !== Ve.sheetName)
2869
2864
  return G.token;
2870
2865
  const oe = Y[X];
2871
2866
  if (X++, !oe)
2872
2867
  return "";
2873
2868
  const ye = (st = oe.sheetId) != null ? st : r, Nt = {
2874
2869
  range: oe,
2875
- unitId: (Pe = oe.unitId) != null ? Pe : f.getUnitId(),
2876
- sheetName: S((Ue = oe.unitId) != null ? Ue : f.getUnitId(), ye)
2877
- }, Ot = (f == null ? void 0 : f.getUnitId()) !== o;
2870
+ unitId: (Pe = oe.unitId) != null ? Pe : g.getUnitId(),
2871
+ sheetName: S((Ue = oe.unitId) != null ? Ue : g.getUnitId(), ye)
2872
+ }, Ot = (g == null ? void 0 : g.getUnitId()) !== o;
2878
2873
  return At([Nt], i && (ye !== r || Ot), C, Ot)[0];
2879
2874
  }
2880
2875
  return G.token;
@@ -2887,13 +2882,13 @@ const uc = (e, t, n, o) => {
2887
2882
  for (let G = X; G <= k.length - 1; G++) {
2888
2883
  const ge = k[G], st = (ot = ge.sheetId) != null ? ot : r, Pe = {
2889
2884
  range: ge,
2890
- unitId: (Tt = ge.unitId) != null ? Tt : f.getUnitId(),
2891
- sheetName: S((Ie = ge.unitId) != null ? Ie : f.getUnitId(), st)
2892
- }, Ue = (f == null ? void 0 : f.getUnitId()) !== o, oe = At([Pe], i && (st !== r || Ue), C, Ue);
2885
+ unitId: (Tt = ge.unitId) != null ? Tt : g.getUnitId(),
2886
+ sheetName: S((Ie = ge.unitId) != null ? Ie : g.getUnitId(), st)
2887
+ }, Ue = (g == null ? void 0 : g.getUnitId()) !== o, oe = At([Pe], i && (st !== r || Ue), C, Ue);
2893
2888
  le.push(oe[0]);
2894
2889
  }
2895
2890
  const be = D[D.length - 1], Le = be && (typeof be == "string" ? !1 : be.nodeType === Q.REFERENCE), Me = `${fe}${le.length && Le ? "," : ""}${le.join(",")}`;
2896
- g(Me, !le.length && ee ? ee : Me.length, I);
2891
+ m(Me, !le.length && ee ? ee : Me.length, I);
2897
2892
  }
2898
2893
  });
2899
2894
  L(() => {
@@ -2975,27 +2970,27 @@ const uc = (e, t, n, o) => {
2975
2970
  refSelectionsRenderService: y,
2976
2971
  sheetSkeletonManagerService: A,
2977
2972
  themeService: a,
2978
- univerInstanceService: h,
2979
- currentWorkbook: f
2973
+ univerInstanceService: f,
2974
+ currentWorkbook: g
2980
2975
  });
2981
2976
  });
2982
2977
  return () => k.unsubscribe();
2983
- }, [u.textSelection$, l, s, y, F, A, r, a, o, h]);
2978
+ }, [u.textSelection$, l, s, y, F, A, r, a, o, f]);
2984
2979
  }, Sc = (e, t, n, o, r, s) => {
2985
- const i = T(me), c = T(Ge), g = T(Re).getRenderById(t), m = T(ne), h = g == null ? void 0 : g.with(De);
2980
+ const i = T(me), c = T(Ge), m = T(Re).getRenderById(t), h = T(ne), f = m == null ? void 0 : m.with(De);
2986
2981
  L(() => {
2987
- if (e && h)
2982
+ if (e && f)
2988
2983
  if (n) {
2989
2984
  const d = () => {
2990
- const v = h.getSelectionControls().length;
2985
+ const v = f.getSelectionControls().length;
2991
2986
  for (let p = 1; p <= v; p++)
2992
- h.clearLastSelection();
2987
+ f.clearLastSelection();
2993
2988
  return setTimeout(() => {
2994
2989
  s();
2995
2990
  }, 30);
2996
2991
  }, u = i.onCommandExecuted((v) => {
2997
2992
  v.id === jn.id && d();
2998
- }), a = m.getCurrentTypeOfUnit$(W.UNIVER_SHEET).subscribe((v) => {
2993
+ }), a = h.getCurrentTypeOfUnit$(W.UNIVER_SHEET).subscribe((v) => {
2999
2994
  d();
3000
2995
  });
3001
2996
  return () => {
@@ -3013,7 +3008,7 @@ const uc = (e, t, n, o) => {
3013
3008
  d.dispose();
3014
3009
  };
3015
3010
  }
3016
- }, [e, h]);
3011
+ }, [e, f]);
3017
3012
  }, vc = (e, t, n) => {
3018
3013
  const o = T(_e), r = z(!0);
3019
3014
  L(() => {
@@ -3032,7 +3027,7 @@ const uc = (e, t, n, o) => {
3032
3027
  }
3033
3028
  }, [n, t]);
3034
3029
  }, Cc = (e, t = [], n) => {
3035
- const o = T(Gt), [r, s] = V([]), [i, c] = V(""), l = z(-1), g = nt({ nodes: t }), m = () => {
3030
+ const o = T(Gt), [r, s] = V([]), [i, c] = V(""), l = z(-1), m = nt({ nodes: t }), h = () => {
3036
3031
  s([]), c(""), l.current = -1;
3037
3032
  };
3038
3033
  return L(() => {
@@ -3040,7 +3035,7 @@ const uc = (e, t, n, o) => {
3040
3035
  const d = n.input$.pipe(gn(300)).subscribe(() => {
3041
3036
  const u = n.getSelectionRanges();
3042
3037
  if (u.length === 1) {
3043
- const a = g.current.nodes, v = u[0];
3038
+ const a = m.current.nodes, v = u[0];
3044
3039
  if (v.collapsed) {
3045
3040
  const p = In(a, v.startOffset - 1, !1);
3046
3041
  l.current = p;
@@ -3060,24 +3055,24 @@ const uc = (e, t, n, o) => {
3060
3055
  };
3061
3056
  }
3062
3057
  }, [n, e]), L(() => {
3063
- e || m();
3058
+ e || h();
3064
3059
  }, [e]), {
3065
3060
  searchList: r,
3066
3061
  searchText: i,
3067
3062
  handlerFormulaReplace: (d, u) => {
3068
- const a = [...g.current.nodes];
3063
+ const a = [...m.current.nodes];
3069
3064
  if (l.current !== -1) {
3070
3065
  const v = a.splice(l.current + 1), p = a.pop() || "";
3071
3066
  let S = (typeof p == "string" ? p.length : p.token.length) - d.length;
3072
3067
  return a.push(d), v[0] !== je.OPEN_BRACKET && u !== hr.DefinedName && (a.push(je.OPEN_BRACKET), S--), { text: an([...a, ...v]), offset: S };
3073
3068
  }
3074
3069
  },
3075
- reset: m
3070
+ reset: h
3076
3071
  };
3077
3072
  }, _c = () => {
3078
3073
  }, Rc = $e(Ic);
3079
3074
  function Ic(e, t) {
3080
- const { isFocus: n, sequenceNodes: o, onSelect: r, editor: s, onClose: i = _c } = e, c = s.getEditorId(), l = T(Zt), g = T(me), { searchList: m, searchText: h, handlerFormulaReplace: d, reset: u } = Cc(n, o, s), a = ie(() => !!m.length, [m]), v = z(void 0), [p, S] = V(0), C = z(!1), [_] = Vr(c, a, [h, m]), E = nt({ searchList: m, active: p }), f = (N, O) => {
3075
+ const { isFocus: n, sequenceNodes: o, onSelect: r, editor: s, onClose: i = _c } = e, c = s.getEditorId(), l = T(Zt), m = T(me), { searchList: h, searchText: f, handlerFormulaReplace: d, reset: u } = Cc(n, o, s), a = ie(() => !!h.length, [h]), v = z(void 0), [p, S] = V(0), C = z(!1), [_] = Vr(c, a, [f, h]), E = nt({ searchList: h, active: p }), g = (N, O) => {
3081
3076
  const k = d(N, O);
3082
3077
  k && (u(), r(k));
3083
3078
  };
@@ -3088,7 +3083,7 @@ function Ic(e, t) {
3088
3083
  C.current && S(-1);
3089
3084
  }
3090
3085
  L(() => {
3091
- if (!m.length)
3086
+ if (!h.length)
3092
3087
  return;
3093
3088
  const N = `sheet.formula-embedding-editor.search_function.${c}`, O = new qe(), k = (I) => {
3094
3089
  const { searchList: x, active: R } = E.current;
@@ -3110,7 +3105,7 @@ function Ic(e, t) {
3110
3105
  case $.TAB:
3111
3106
  case $.ENTER: {
3112
3107
  const w = x[R];
3113
- f(w.name, w.functionType);
3108
+ g(w.name, w.functionType);
3114
3109
  break;
3115
3110
  }
3116
3111
  case $.ESC: {
@@ -3119,7 +3114,7 @@ function Ic(e, t) {
3119
3114
  }
3120
3115
  }
3121
3116
  };
3122
- return O.add(g.registerCommand({
3117
+ return O.add(m.registerCommand({
3123
3118
  id: N,
3124
3119
  type: Oe.OPERATION,
3125
3120
  handler(I, x) {
@@ -3140,7 +3135,7 @@ function Ic(e, t) {
3140
3135
  }), () => {
3141
3136
  O.dispose();
3142
3137
  };
3143
- }, [m]);
3138
+ }, [h]);
3144
3139
  function A(N) {
3145
3140
  const O = v.current;
3146
3141
  if (!O) return;
@@ -3163,7 +3158,7 @@ function Ic(e, t) {
3163
3158
  }, 300);
3164
3159
  };
3165
3160
  }, []);
3166
- return m.length > 0 && a && /* @__PURE__ */ M(on, { portal: !0, anchorRect$: _, direction: "vertical", children: /* @__PURE__ */ M(
3161
+ return h.length > 0 && a && /* @__PURE__ */ M(on, { portal: !0, anchorRect$: _, direction: "vertical", children: /* @__PURE__ */ M(
3167
3162
  "ul",
3168
3163
  {
3169
3164
  ref: (N) => {
@@ -3171,7 +3166,7 @@ function Ic(e, t) {
3171
3166
  },
3172
3167
  "data-u-comp": "sheets-formula-editor",
3173
3168
  className: re("univer-m-0 univer-box-border univer-max-h-[400px] univer-w-[250px] univer-list-none univer-overflow-y-auto univer-rounded-lg univer-bg-white univer-p-2 univer-leading-5 univer-shadow-md univer-outline-none dark:!univer-bg-gray-900", Cn, ut),
3174
- children: m.map((N, O) => /* @__PURE__ */ H(
3169
+ children: h.map((N, O) => /* @__PURE__ */ H(
3175
3170
  "li",
3176
3171
  {
3177
3172
  className: re("univer-box-border univer-cursor-pointer univer-rounded univer-px-2 univer-py-1 univer-text-gray-900 univer-transition-colors dark:!univer-text-white", {
@@ -3181,12 +3176,12 @@ function Ic(e, t) {
3181
3176
  onMouseLeave: y,
3182
3177
  onMouseMove: F,
3183
3178
  onClick: () => {
3184
- f(N.name, N.functionType), s && s.focus();
3179
+ g(N.name, N.functionType), s && s.focus();
3185
3180
  },
3186
3181
  children: [
3187
3182
  /* @__PURE__ */ H("span", { className: "univer-block univer-truncate univer-text-xs", children: [
3188
- /* @__PURE__ */ M("span", { className: "univer-text-red-500", children: N.name.substring(0, h.length) }),
3189
- /* @__PURE__ */ M("span", { children: N.name.slice(h.length) })
3183
+ /* @__PURE__ */ M("span", { className: "univer-text-red-500", children: N.name.substring(0, f.length) }),
3184
+ /* @__PURE__ */ M("span", { children: N.name.slice(f.length) })
3190
3185
  ] }),
3191
3186
  /* @__PURE__ */ M(
3192
3187
  "span",
@@ -3213,9 +3208,9 @@ const Ec = (e) => e.startsWith(fr.EQUALS) ? e.slice(1) : "", er = () => {
3213
3208
  isFocus: i = !0,
3214
3209
  isSupportAcrossSheet: c = !1,
3215
3210
  onFocus: l = er,
3216
- onBlur: g = er,
3217
- onChange: m,
3218
- onVerify: h,
3211
+ onBlur: m = er,
3212
+ onChange: h,
3213
+ onVerify: f,
3219
3214
  className: d,
3220
3215
  editorId: u,
3221
3216
  moveCursor: a = !0,
@@ -3225,17 +3220,17 @@ const Ec = (e) => e.startsWith(fr.EQUALS) ? e.slice(1) : "", er = () => {
3225
3220
  resetSelectionOnBlur: C = !0,
3226
3221
  autoScrollbar: _ = !0,
3227
3222
  isSingle: E = !0,
3228
- disableSelectionOnClick: f = !1,
3223
+ disableSelectionOnClick: g = !1,
3229
3224
  autofocus: b = !0,
3230
3225
  disableContextMenu: y,
3231
3226
  style: A
3232
- } = e, F = T(Ge), N = z(null), O = te(m);
3227
+ } = e, F = T(Ge), N = z(null), O = te(h);
3233
3228
  Es(t, () => ({
3234
3229
  isClickOutSide: (Z) => N.current ? !N.current.contains(Z.target) : !1
3235
3230
  }));
3236
3231
  const k = te(v), I = z(null), x = z(void 0), R = x.current, [w, D] = V(i), U = z(null), B = ie(() => u != null ? u : co(`${wo}-${Kt(4)}`), []), ce = ie(() => n !== void 0, [n]), ae = T(ne), he = ae.getUnit(B);
3237
3232
  Se(he == null ? void 0 : he.change$);
3238
- const K = sc(), J = ao.transform.getPlainText((Tn = (yn = he == null ? void 0 : he.getBody()) == null ? void 0 : yn.dataStream) != null ? Tn : ""), rt = nt(J), ot = ie(() => Ec(J), [J]), Tt = ie(() => K(ot), [ot, K]), { isSelecting: Ie, isSelectingRef: Y } = oc({ unitId: r, subUnitId: s, editorId: B, isFocus: w, disableOnClick: f }), X = z(""), fe = T(Re).getRenderById(B), ee = fe == null ? void 0 : fe.with(Sr), le = ee == null ? void 0 : ee.isFocusing, be = ie(() => ae.getCurrentTypeOfUnit$(W.UNIVER_DOC), [ae]), Le = Se(be), Me = (Le == null ? void 0 : Le.getUnitId()) === B, G = z([]), ge = Ie, Pe = (On = (Nn = T(ir).getConfig(Nr)) == null ? void 0 : Nn.functionScreenTips) != null ? On : !0;
3233
+ const K = sc(), J = ao.transform.getPlainText((Tn = (yn = he == null ? void 0 : he.getBody()) == null ? void 0 : yn.dataStream) != null ? Tn : ""), rt = nt(J), ot = ie(() => Ec(J), [J]), Tt = ie(() => K(ot), [ot, K]), { isSelecting: Ie, isSelectingRef: Y } = oc({ unitId: r, subUnitId: s, editorId: B, isFocus: w, disableOnClick: g }), X = z(""), fe = T(Re).getRenderById(B), ee = fe == null ? void 0 : fe.with(Sr), le = ee == null ? void 0 : ee.isFocusing, be = ie(() => ae.getCurrentTypeOfUnit$(W.UNIVER_DOC), [ae]), Le = Se(be), Me = (Le == null ? void 0 : Le.getUnitId()) === B, G = z([]), ge = Ie, Pe = (On = (Nn = T(ir).getConfig(Nr)) == null ? void 0 : Nn.functionScreenTips) != null ? On : !0;
3239
3234
  _s(() => {
3240
3235
  O(J);
3241
3236
  }, [J, O]);
@@ -3267,7 +3262,7 @@ const Ec = (e) => e.startsWith(fr.EQUALS) ? e.slice(1) : "", er = () => {
3267
3262
  if (X.current === J) return;
3268
3263
  oe(J, !1, !0);
3269
3264
  }
3270
- }, [J]), vc(w, h, J);
3265
+ }, [J]), vc(w, f, J);
3271
3266
  const ye = nc(R), Nt = hc(w, r, s);
3272
3267
  L(() => {
3273
3268
  var Z;
@@ -3322,7 +3317,7 @@ const Ec = (e) => e.startsWith(fr.EQUALS) ? e.slice(1) : "", er = () => {
3322
3317
  !!ge,
3323
3318
  R,
3324
3319
  En
3325
- ), Sc(w && !!(Ie && Me), r, c, D, g, () => {
3320
+ ), Sc(w && !!(Ie && Me), r, c, D, m, () => {
3326
3321
  oe(rt.current, !1, !0);
3327
3322
  });
3328
3323
  const bn = (Z) => {
@@ -3384,13 +3379,13 @@ const Ec = (e) => e.startsWith(fr.EQUALS) ? e.slice(1) : "", er = () => {
3384
3379
  ] });
3385
3380
  });
3386
3381
  function yc(e, t, n, o) {
3387
- const r = T(_e), s = Hr(""), i = Se(e == null ? void 0 : e.getDocumentDataModel().change$), [c, l] = V([]), g = T(ko), m = z(""), h = T(ne);
3382
+ const r = T(_e), s = Hr(""), i = Se(e == null ? void 0 : e.getDocumentDataModel().change$), [c, l] = V([]), m = T(ko), h = z(""), f = T(ne);
3388
3383
  return L(() => {
3389
3384
  if (!e) return;
3390
3385
  const d = e.getDocumentDataModel().getPlainText();
3391
- if (m.current === d)
3386
+ if (h.current === d)
3392
3387
  return;
3393
- m.current = d;
3388
+ h.current = d;
3394
3389
  const u = r.sequenceNodesBuilder(d);
3395
3390
  l(u != null ? u : []);
3396
3391
  }, [i, e, r]), L(() => {
@@ -3410,10 +3405,10 @@ function yc(e, t, n, o) {
3410
3405
  }
3411
3406
  const d = s(e, c, !1), u = new qe();
3412
3407
  return d.forEach((p) => {
3413
- const S = ht(p.token), C = h.getCurrentUnitForType(W.UNIVER_SHEET), _ = C == null ? void 0 : C.getActiveSheet();
3408
+ const S = ht(p.token), C = f.getCurrentUnitForType(W.UNIVER_SHEET), _ = C == null ? void 0 : C.getActiveSheet();
3414
3409
  if (!S.sheetName && o !== (_ == null ? void 0 : _.getSheetId()) || S.sheetName && (_ == null ? void 0 : _.getName()) !== S.sheetName)
3415
3410
  return;
3416
- const E = new hn(p.themeColor).toRgb(), f = g.addShape({
3411
+ const E = new hn(p.themeColor).toRgb(), g = m.addShape({
3417
3412
  range: S.range,
3418
3413
  style: {
3419
3414
  stroke: p.themeColor,
@@ -3422,35 +3417,35 @@ function yc(e, t, n, o) {
3422
3417
  },
3423
3418
  primary: null
3424
3419
  });
3425
- f && u.add(() => g.removeShape(f));
3420
+ g && u.add(() => m.removeShape(g));
3426
3421
  }), () => {
3427
3422
  u.dispose();
3428
3423
  };
3429
- }, [e, t, s, g, c]), { sequenceNodes: c };
3424
+ }, [e, t, s, m, c]), { sequenceNodes: c };
3430
3425
  }
3431
3426
  function Tc(e) {
3432
- const t = T(mn), { supportAcrossSheet: n = !1, keepSheetReference: o = !1, unitId: r, subUnitId: s, onChange: i } = e, l = T(ne).getUnit(r, W.UNIVER_SHEET), g = te(i), m = te((h, d) => {
3427
+ const t = T(mn), { supportAcrossSheet: n = !1, keepSheetReference: o = !1, unitId: r, subUnitId: s, onChange: i } = e, l = T(ne).getUnit(r, W.UNIVER_SHEET), m = te(i), h = te((f, d) => {
3433
3428
  const u = l == null ? void 0 : l.getActiveSheet();
3434
- if (!u || !n && u.getSheetId() !== s || !(h != null && h.length)) return;
3435
- const a = o ? u.getName() : u.getSheetId() === s ? "" : u.getName(), v = h.map((p) => ({
3429
+ if (!u || !n && u.getSheetId() !== s || !(f != null && f.length)) return;
3430
+ const a = o ? u.getName() : u.getSheetId() === s ? "" : u.getName(), v = f.map((p) => ({
3436
3431
  range: p.range,
3437
3432
  unitId: r,
3438
3433
  sheetName: a
3439
3434
  }));
3440
- g(v, d);
3435
+ m(v, d);
3441
3436
  });
3442
3437
  L(() => {
3443
- const h = new qe();
3444
- return h.add(t.selectionMoveStart$.subscribe((d) => {
3445
- m(d, !0);
3446
- })), h.add(t.selectionMoving$.subscribe((d) => {
3447
- m(d, !1);
3448
- })), h.add(t.selectionMoveEnd$.subscribe((d) => {
3449
- m(d, !1);
3438
+ const f = new qe();
3439
+ return f.add(t.selectionMoveStart$.subscribe((d) => {
3440
+ h(d, !0);
3441
+ })), f.add(t.selectionMoving$.subscribe((d) => {
3442
+ h(d, !1);
3443
+ })), f.add(t.selectionMoveEnd$.subscribe((d) => {
3444
+ h(d, !1);
3450
3445
  })), () => {
3451
- h.dispose();
3446
+ f.dispose();
3452
3447
  };
3453
- }, [m, t.selectionMoveEnd$, t.selectionMoveStart$, t.selectionMoving$]);
3448
+ }, [h, t.selectionMoveEnd$, t.selectionMoveStart$, t.selectionMoving$]);
3454
3449
  }
3455
3450
  const tr = (e) => !e.some((n) => {
3456
3451
  if (typeof n == "string") {
@@ -3480,33 +3475,33 @@ function Oc(e) {
3480
3475
  supportAcrossSheet: i,
3481
3476
  keepSheetReference: c,
3482
3477
  onConfirm: l,
3483
- onClose: g,
3484
- onShowBySelection: m
3485
- } = e, h = T(dt), d = T(_e), [u, a] = V([]), [v, p] = V(0), S = z(null);
3478
+ onClose: m,
3479
+ onShowBySelection: h
3480
+ } = e, f = T(dt), d = T(_e), [u, a] = V([]), [v, p] = V(0), S = z(null);
3486
3481
  L(() => {
3487
3482
  if (t && n.length) {
3488
- const f = n.map((b) => b.sheetName ? Ct(b.sheetName, b.range) : Ce(b.range));
3489
- a(f), p(f.length - 1);
3483
+ const g = n.map((b) => b.sheetName ? Ct(b.sheetName, b.range) : Ce(b.range));
3484
+ a(g), p(g.length - 1);
3490
3485
  } else
3491
3486
  a([""]), p(0);
3492
3487
  }, [t]);
3493
- const C = (f, b) => {
3488
+ const C = (g, b) => {
3494
3489
  const y = [...u];
3495
- y[f] = b, a(y);
3490
+ y[g] = b, a(y);
3496
3491
  }, _ = () => {
3497
3492
  a([...u, ""]), p(u.length);
3498
- }, E = (f) => {
3499
- u.splice(f, 1), a([...u]);
3493
+ }, E = (g) => {
3494
+ u.splice(g, 1), a([...u]);
3500
3495
  };
3501
3496
  return Tc({
3502
3497
  unitId: o,
3503
3498
  subUnitId: r,
3504
3499
  supportAcrossSheet: i,
3505
3500
  keepSheetReference: c,
3506
- onChange: (f, b) => {
3507
- if (!t && m != null && m(f))
3501
+ onChange: (g, b) => {
3502
+ if (!t && h != null && h(g))
3508
3503
  return;
3509
- const y = new Set(u), A = f.map((O) => O.sheetName ? Ct(O.sheetName, O.range) : Ce(O.range)), F = A.filter((O) => !y.has(O));
3504
+ const y = new Set(u), A = g.map((O) => O.sheetName ? Ct(O.sheetName, O.range) : Ce(O.range)), F = A.filter((O) => !y.has(O));
3510
3505
  if (!F.length) return;
3511
3506
  const N = [...u];
3512
3507
  if (A.length > 1) {
@@ -3527,36 +3522,36 @@ function Oc(e) {
3527
3522
  {
3528
3523
  width: "328px",
3529
3524
  open: t,
3530
- title: h.t("rangeSelector.title"),
3525
+ title: f.t("rangeSelector.title"),
3531
3526
  draggable: !0,
3532
3527
  mask: !1,
3533
3528
  maskClosable: !1,
3534
3529
  footer: /* @__PURE__ */ H("footer", { className: "univer-flex univer-gap-2", children: [
3535
- /* @__PURE__ */ M(at, { onClick: g, children: h.t("rangeSelector.cancel") }),
3530
+ /* @__PURE__ */ M(at, { onClick: m, children: f.t("rangeSelector.cancel") }),
3536
3531
  /* @__PURE__ */ M(
3537
3532
  at,
3538
3533
  {
3539
3534
  variant: "primary",
3540
3535
  onClick: () => {
3541
3536
  l(
3542
- u.filter((f) => {
3543
- const b = d.sequenceNodesBuilder(f);
3537
+ u.filter((g) => {
3538
+ const b = d.sequenceNodesBuilder(g);
3544
3539
  return b && b.length === 1 && typeof b[0] != "string" && b[0].nodeType === Q.REFERENCE;
3545
- }).map((f) => ht(f)).map((f) => ({ ...f, range: Nc(f.range) }))
3540
+ }).map((g) => ht(g)).map((g) => ({ ...g, range: Nc(g.range) }))
3546
3541
  );
3547
3542
  },
3548
- children: h.t("rangeSelector.confirm")
3543
+ children: f.t("rangeSelector.confirm")
3549
3544
  }
3550
3545
  )
3551
3546
  ] }),
3552
- onClose: g,
3547
+ onClose: m,
3553
3548
  children: /* @__PURE__ */ H(
3554
3549
  "div",
3555
3550
  {
3556
3551
  ref: S,
3557
3552
  className: re("-univer-mx-6 univer-max-h-60 univer-overflow-y-auto univer-px-6", ut),
3558
3553
  children: [
3559
- u.map((f, b) => /* @__PURE__ */ H(
3554
+ u.map((g, b) => /* @__PURE__ */ H(
3560
3555
  "div",
3561
3556
  {
3562
3557
  className: "univer-mb-2 univer-flex univer-items-center univer-gap-4",
@@ -3567,9 +3562,9 @@ function Oc(e) {
3567
3562
  className: re("univer-w-full", {
3568
3563
  "univer-border-primary-600": v === b
3569
3564
  }),
3570
- placeholder: h.t("rangeSelector.placeHolder"),
3565
+ placeholder: f.t("rangeSelector.placeHolder"),
3571
3566
  onFocus: () => p(b),
3572
- value: f,
3567
+ value: g,
3573
3568
  onChange: (y) => C(b, y)
3574
3569
  }
3575
3570
  ),
@@ -3586,7 +3581,7 @@ function Oc(e) {
3586
3581
  )),
3587
3582
  u.length < s && /* @__PURE__ */ M("div", { children: /* @__PURE__ */ H(at, { variant: "link", onClick: _, children: [
3588
3583
  /* @__PURE__ */ M(Dr, {}),
3589
- /* @__PURE__ */ M("span", { children: h.t("rangeSelector.addAnotherRange") })
3584
+ /* @__PURE__ */ M("span", { children: f.t("rangeSelector.addAnotherRange") })
3590
3585
  ] }) })
3591
3586
  ]
3592
3587
  }
@@ -3608,20 +3603,20 @@ function Br(e) {
3608
3603
  subUnitId: i,
3609
3604
  maxRangeCount: c,
3610
3605
  supportAcrossSheet: l,
3611
- keepSheetReference: g,
3612
- autoFocus: m,
3613
- onChange: h,
3606
+ keepSheetReference: m,
3607
+ autoFocus: h,
3608
+ onChange: f,
3614
3609
  onRangeSelectorDialogVisibleChange: d,
3615
3610
  onClickOutside: u,
3616
3611
  onFocusChange: a,
3617
3612
  forceShowDialogWhenSelectionChanged: v,
3618
3613
  hideEditor: p,
3619
3614
  resetRange: S
3620
- } = e, [C, _] = V(m != null ? m : !1), [E, f] = V(!1), [b, y] = V([]), A = T(dt), F = T(Ge), { sequenceNodes: N } = yc(t, C, s, i), O = nt(N), k = T(me), I = te(() => {
3615
+ } = e, [C, _] = V(h != null ? h : !1), [E, g] = V(!1), [b, y] = V([]), A = T(dt), F = T(Ge), { sequenceNodes: N } = yc(t, C, s, i), O = nt(N), k = T(me), I = te(() => {
3621
3616
  t == null || t.setSelectionRanges([]), t == null || t.blur(), F.blur();
3622
3617
  }), x = te(() => {
3623
3618
  var R;
3624
- I(), y(xc((R = t == null ? void 0 : t.getDocumentDataModel().getPlainText()) != null ? R : "")), f(!0);
3619
+ I(), y(xc((R = t == null ? void 0 : t.getDocumentDataModel().getPlainText()) != null ? R : "")), g(!0);
3625
3620
  });
3626
3621
  return L(() => {
3627
3622
  r && (r.current = {
@@ -3634,10 +3629,10 @@ function Br(e) {
3634
3629
  blur: I,
3635
3630
  verify: () => tr(O.current),
3636
3631
  showDialog: (R) => {
3637
- I(), y(R), f(!0);
3632
+ I(), y(R), g(!0);
3638
3633
  },
3639
3634
  hideDialog: () => {
3640
- y([]), f(!1);
3635
+ y([]), g(!1);
3641
3636
  },
3642
3637
  getValue: () => {
3643
3638
  var R;
@@ -3691,16 +3686,16 @@ function Br(e) {
3691
3686
  maxRangeCount: c,
3692
3687
  onConfirm: (R) => {
3693
3688
  const w = Mc(R), D = lo.newEmptyData();
3694
- D.body.dataStream = w, t == null || t.replaceText(w, !1), h == null || h(D, w), f(!1), y([]), requestAnimationFrame(() => {
3689
+ D.body.dataStream = w, t == null || t.replaceText(w, !1), f == null || f(D, w), g(!1), y([]), requestAnimationFrame(() => {
3695
3690
  I();
3696
3691
  });
3697
3692
  },
3698
3693
  onClose: () => {
3699
- f(!1), y([]);
3694
+ g(!1), y([]);
3700
3695
  },
3701
3696
  supportAcrossSheet: l,
3702
- keepSheetReference: g,
3703
- onShowBySelection: (R) => C || v ? (y(R), f(!0), !1) : !0
3697
+ keepSheetReference: m,
3698
+ onShowBySelection: (R) => C || v ? (y(R), g(!0), !1) : !0
3704
3699
  }
3705
3700
  )
3706
3701
  ] });