@univerjs/sheets-formula-ui 0.14.0 → 0.15.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/es/index.js CHANGED
@@ -1,27 +1,27 @@
1
1
  var Jr = Object.defineProperty;
2
2
  var eo = (e, t, n) => t in e ? Jr(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
3
3
  var j = (e, t, n) => eo(e, typeof t != "symbol" ? t + "" : t, n);
4
- import { CommandType as be, ICommandService as pe, createIdentifier as to, IContextService as dn, IUniverInstanceService as ee, Rectangle as sr, DOCS_NORMAL_EDITOR_UNIT_ID_KEY as hn, DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY as ir, DEFAULT_EMPTY_DOCUMENT_VALUE as cr, isRealNum as no, CellValueType as Fn, getCellValueType as ro, Inject as q, Disposable as Ze, ObjectMatrix as Fe, Range as oo, Tools as fn, LocaleService as dt, isICellData as so, isFormulaString as Ce, isFormulaId as De, generateRandomId as Yt, Direction as de, Injector as It, getEmptyCell as mt, UniverInstanceType as U, ThemeService as Et, ILogService as io, toDisposable as lr, ColorKit as gn, RxDisposable as co, InterceptorEffectEnum as lo, FOCUSING_DOC as ao, FOCUSING_UNIVER_EDITOR as uo, DisposableCollection as Ye, RANGE_TYPE as Ie, getBodySlice as Dn, EDITOR_ACTIVATED as Ln, createInternalEditorID as ho, BuildTextUtils as fo, IConfigService as ar, RichTextBuilder as go, DependentOn as mo, Plugin as po, merge as So, registerDependencies as vo, touchDependencies as Co } from "@univerjs/core";
5
- import { ISheetClipboardService as ur, PREDEFINED_HOOK_NAME_COPY as dr, SheetPasteCommand as _o, PREDEFINED_HOOK_NAME_PASTE as lt, IEditorBridgeService as mn, SetCellEditVisibleOperation as hr, HoverManagerService as Ro, CellAlertManagerService as Io, CellAlertType as Eo, IAutoFillService as bo, APPLY_TYPE as yo, DATA_TYPE as $n, COPY_TYPE as fr, SheetSkeletonManagerService as bt, attachSelectionWithCoord as sn, SelectionControl as gr, SELECTION_SHAPE_DEPTH as To, useActiveWorkbook as Oo, getCurrentRangeDisable$ as $e, PASTE_SPECIAL_MENU_ID as No, COPY_SPECIAL_MENU_ID as Mo, whenFormulaEditorActivated as yt, whenSheetEditorFocused as xo, SheetsUIPart as wo, BaseSelectionRenderService as ko, getCoordByOffset as Pn, checkInHeaderRanges as Un, getAllSelection as Ao, genNormalSelectionStyle as mr, getSheetObject as Fo, MoveSelectionCommand as Vn, JumpOver as Wn, ExpandSelectionCommand as Hn, EMBEDDING_FORMULA_EDITOR as Do, IMarkSelectionService as Lo, RANGE_SELECTOR_COMPONENT_KEY as $o, EMBEDDING_FORMULA_EDITOR_COMPONENT_KEY as Po } from "@univerjs/sheets-ui";
6
- import { sequenceNodeType as X, serializeRange as Ee, FormulaDataModel as Tt, LexerTreeBuilder as ye, ErrorType as ue, extractFormulaError as pr, SetFormulaCalculationResultMutation as Uo, SetArrayFormulaDataMutation as Vo, SetFormulaCalculationStopMutation as Wo, FunctionType as Sr, matchToken as Ge, deserializeRangeWithSheetWithCache as Ho, matchRefDrawToken as Bo, isFormulaLexerToken as qo, deserializeRangeWithSheet as ht, serializeRangeToRefString as jo, serializeRangeWithSheet as _t, serializeRangeWithSpreadsheet as Ko, generateStringWithSequence as Yo, operatorToken as vr } from "@univerjs/engine-formula";
7
- import { Subject as pt, debounceTime as pn, combineLatestWith as Go, map as Cr, switchMap as Zo, of as Bn, Observable as zo, BehaviorSubject as _r, throttleTime as Xo, filter as Rr, distinctUntilChanged as Qo, merge as Jo } from "rxjs";
8
- import { IEditorService as ze, DocSelectionRenderService as Ir, ReplaceTextRunsCommand as qn, MoveSelectionOperation as es, MoveCursorOperation as ts, useKeyboardEvent as ns, useResize as rs, DocBackScrollRenderController as os, RichTextEditor as ss } from "@univerjs/docs-ui";
9
- import { DeviceInputEventType as xe, IRenderManagerService as Te, ScrollTimerType as en, SHEET_VIEWPORT_KEY as jn, Vector2 as Kn } from "@univerjs/engine-render";
10
- import { SheetsSelectionsService as Sn, getSheetCommandTarget as Er, getCellAtRowCol as is, SetSelectionsOperation as vn, SheetInterceptorService as Cn, ReorderRangeCommand as cs, SetRangeValuesMutation as Lt, SetRangeValuesUndoMutationFactory as ls, BEFORE_CELL_EDIT as as, SetWorksheetRowAutoHeightMutation as us, INTERCEPTOR_POINT as ds, WorksheetSetCellValuePermission as Xe, WorksheetEditPermission as Qe, RangeProtectionPermissionEditPoint as Je, WorkbookEditablePermission as et, RangeProtectionPermissionViewPoint as hs, WorksheetCopyPermission as fs, WorkbookCopyPermission as gs, IRefSelectionsService as Gt, SelectionMoveType as tn, convertSelectionDataToRange as ms, setEndForRange as ps, REF_SELECTIONS_ENABLED as Yn, SetWorksheetActiveOperation as Gn } from "@univerjs/sheets";
4
+ import { CommandType as be, ICommandService as pe, createIdentifier as to, IContextService as dn, IUniverInstanceService as te, Rectangle as hn, DOCS_NORMAL_EDITOR_UNIT_ID_KEY as fn, DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY as ir, DEFAULT_EMPTY_DOCUMENT_VALUE as cr, isRealNum as no, CellValueType as Dn, getCellValueType as ro, Inject as q, Disposable as Ze, ObjectMatrix as Fe, Range as oo, Tools as gn, LocaleService as dt, isICellData as so, isFormulaString as Ce, isFormulaId as De, generateRandomId as Yt, Direction as de, Injector as It, getEmptyCell as mt, UniverInstanceType as U, ThemeService as Et, ILogService as io, toDisposable as lr, ColorKit as mn, RxDisposable as co, InterceptorEffectEnum as lo, FOCUSING_DOC as ao, FOCUSING_UNIVER_EDITOR as uo, DisposableCollection as Ye, RANGE_TYPE as Ie, getBodySlice as Ln, EDITOR_ACTIVATED as $n, createInternalEditorID as ho, BuildTextUtils as fo, IConfigService as ar, RichTextBuilder as go, DependentOn as mo, Plugin as po, merge as So, registerDependencies as vo, touchDependencies as Co } from "@univerjs/core";
5
+ import { ISheetClipboardService as ur, PREDEFINED_HOOK_NAME_COPY as dr, SheetPasteCommand as _o, PREDEFINED_HOOK_NAME_PASTE as lt, IEditorBridgeService as pn, SetCellEditVisibleOperation as hr, HoverManagerService as Ro, CellAlertManagerService as Io, CellAlertType as Eo, IAutoFillService as bo, APPLY_TYPE as yo, DATA_TYPE as Pn, COPY_TYPE as fr, SheetSkeletonManagerService as bt, attachSelectionWithCoord as sn, SelectionControl as gr, SELECTION_SHAPE_DEPTH as To, useActiveWorkbook as Oo, getCurrentRangeDisable$ as $e, PASTE_SPECIAL_MENU_ID as No, COPY_SPECIAL_MENU_ID as Mo, whenFormulaEditorActivated as yt, whenSheetEditorFocused as xo, SheetsUIPart as wo, BaseSelectionRenderService as ko, getCoordByOffset as Un, checkInHeaderRanges as Vn, getAllSelection as Ao, genNormalSelectionStyle as mr, getSheetObject as Fo, MoveSelectionCommand as Wn, JumpOver as Hn, ExpandSelectionCommand as Bn, EMBEDDING_FORMULA_EDITOR as Do, IMarkSelectionService as Lo, RANGE_SELECTOR_COMPONENT_KEY as $o, EMBEDDING_FORMULA_EDITOR_COMPONENT_KEY as Po } from "@univerjs/sheets-ui";
6
+ import { sequenceNodeType as Q, serializeRange as Ee, FormulaDataModel as Tt, LexerTreeBuilder as ye, ErrorType as ue, extractFormulaError as pr, SetFormulaCalculationResultMutation as Uo, SetArrayFormulaDataMutation as Vo, SetFormulaCalculationStopMutation as Wo, FunctionType as Sr, matchToken as Ge, deserializeRangeWithSheetWithCache as Ho, matchRefDrawToken as Bo, isFormulaLexerToken as qo, deserializeRangeWithSheet as ht, serializeRangeToRefString as jo, serializeRangeWithSheet as _t, serializeRangeWithSpreadsheet as Ko, generateStringWithSequence as Yo, operatorToken as vr } from "@univerjs/engine-formula";
7
+ import { Subject as pt, debounceTime as Sn, combineLatestWith as Go, map as Cr, switchMap as Zo, of as qn, Observable as zo, BehaviorSubject as _r, throttleTime as Xo, filter as Rr, distinctUntilChanged as Qo, merge as Jo } from "rxjs";
8
+ import { IEditorService as ze, DocSelectionRenderService as Ir, ReplaceTextRunsCommand as jn, MoveSelectionOperation as es, MoveCursorOperation as ts, useKeyboardEvent as ns, useResize as rs, DocBackScrollRenderController as os, RichTextEditor as ss } from "@univerjs/docs-ui";
9
+ import { DeviceInputEventType as xe, IRenderManagerService as Te, ScrollTimerType as en, SHEET_VIEWPORT_KEY as Kn, Vector2 as Yn } from "@univerjs/engine-render";
10
+ import { SheetsSelectionsService as vn, getSheetCommandTarget as Er, getCellAtRowCol as is, SetSelectionsOperation as Cn, SheetInterceptorService as _n, ReorderRangeCommand as cs, SetRangeValuesMutation as Lt, SetRangeValuesUndoMutationFactory as ls, BEFORE_CELL_EDIT as as, SetWorksheetRowAutoHeightMutation as us, INTERCEPTOR_POINT as ds, WorksheetSetCellValuePermission as Xe, WorksheetEditPermission as Qe, RangeProtectionPermissionEditPoint as Je, WorkbookEditablePermission as et, RangeProtectionPermissionViewPoint as hs, WorksheetCopyPermission as fs, WorkbookCopyPermission as gs, IRefSelectionsService as Gt, SelectionMoveType as tn, convertSelectionDataToRange as ms, setEndForRange as ps, REF_SELECTIONS_ENABLED as Gn, SetWorksheetActiveOperation as Zn } from "@univerjs/sheets";
11
11
  import { InsertFunctionCommand as Ss, TriggerCalculationController as vs, IDescriptionService as Zt, QuickSumCommand as Cs, ImageFormulaCellInterceptorController as _s, UniverSheetsFormulaPlugin as Rs } from "@univerjs/sheets-formula";
12
- import { ISidebarService as _n, IZenZoneService as Is, useDependency as O, useObservable as _e, ProgressBar as Es, getMenuHiddenObservable as Pe, MenuItemType as Ue, IClipboardInterfaceService as Zn, RibbonFormulasGroup as zn, KeyCode as D, MetaKeys as V, IMenuManagerService as bs, IShortcutService as zt, IUIPartsService as br, ComponentManager as yr, connectInjector as Tr, useEvent as J, RectPopup as cn, IContextMenuService as ys, useUpdateEffect as Ts, BuiltInUIPart as Os } from "@univerjs/ui";
12
+ import { ISidebarService as Rn, IZenZoneService as Is, useDependency as O, useObservable as _e, ProgressBar as Es, getMenuHiddenObservable as Pe, MenuItemType as Ue, IClipboardInterfaceService as zn, RibbonFormulasGroup as Xn, KeyCode as $, MetaKeys as V, IMenuManagerService as bs, IShortcutService as zt, IUIPartsService as br, ComponentManager as yr, connectInjector as Tr, useEvent as ee, RectPopup as cn, IContextMenuService as ys, useUpdateEffect as Ts, BuiltInUIPart as Os } from "@univerjs/ui";
13
13
  import { jsx as x, jsxs as B, Fragment as Ns } from "react/jsx-runtime";
14
- import { useCallback as $t, useState as H, useRef as z, createElement as tt, forwardRef as Ve, useEffect as P, useMemo as ie, useLayoutEffect as Pt, useImperativeHandle as Ms } from "react";
15
- import { clsx as re, scrollbarClassName as ut, borderLeftClassName as xs, Select as ws, Input as Or, borderClassName as Rn, Button as at, borderTopClassName as ks, Tooltip as As, Dialog as Fs } from "@univerjs/design";
14
+ import { useCallback as $t, useState as H, useRef as z, createElement as tt, forwardRef as Ve, useEffect as P, useMemo as le, useLayoutEffect as Pt, useImperativeHandle as Ms } from "react";
15
+ import { clsx as se, scrollbarClassName as ut, borderLeftClassName as xs, Select as ws, Input as Or, borderClassName as In, Button as at, borderTopClassName as ks, Tooltip as As, Dialog as Fs } from "@univerjs/design";
16
16
  import { DocSelectionManagerService as Nr } from "@univerjs/docs";
17
17
  import { debounceTime as Ds } from "rxjs/operators";
18
- const In = {
18
+ const En = {
19
19
  id: "sheet.command.copy-formula-only",
20
20
  type: be.COMMAND,
21
21
  handler: async (e) => e.get(ur).copy({
22
22
  copyHookType: dr.SPECIAL_COPY_FORMULA_ONLY
23
23
  })
24
- }, En = {
24
+ }, bn = {
25
25
  id: "sheet.command.paste-formula",
26
26
  type: be.COMMAND,
27
27
  handler: async (e) => e.get(pe).executeCommand(_o.id, {
@@ -123,7 +123,7 @@ let ln = class {
123
123
  */
124
124
  updateSequenceRef(e, t) {
125
125
  const n = this._sequenceNodes[e];
126
- if (typeof n == "string" || n.nodeType !== X.REFERENCE)
126
+ if (typeof n == "string" || n.nodeType !== Q.REFERENCE)
127
127
  return;
128
128
  const o = t.length - n.token.length, r = { ...n };
129
129
  r.token = t, r.endIndex += o, this._sequenceNodes[e] = r;
@@ -147,7 +147,7 @@ let ln = class {
147
147
  token: t,
148
148
  startIndex: e,
149
149
  endIndex: e + n - 1,
150
- nodeType: X.REFERENCE
150
+ nodeType: Q.REFERENCE
151
151
  });
152
152
  for (let r = o + 1, s = this._sequenceNodes.length; r < s; r++) {
153
153
  const i = this._sequenceNodes[r];
@@ -206,26 +206,26 @@ const Vs = {
206
206
  // eslint-disable-next-line
207
207
  handler: async (e, t) => {
208
208
  var C, _;
209
- const n = e.get(Sn), o = e.get(ze), r = n.getCurrentSelections();
209
+ const n = e.get(vn), o = e.get(ze), r = n.getCurrentSelections();
210
210
  if (!r || !r.length)
211
211
  return !1;
212
- const s = Er(e.get(ee));
212
+ const s = Er(e.get(te));
213
213
  if (!s) return !1;
214
214
  const { worksheet: i, unitId: c, subUnitId: a } = s, h = i.getCellMatrix(), { value: f } = t, m = e.get(pe);
215
- e.get(mn);
215
+ e.get(pn);
216
216
  const d = [], u = [];
217
217
  let l = null, v = 0, S = 0, g = "";
218
- if (r.length === 1 && (Bs(r[0].range) || qs(r[0].range) && Qn(h, r[0].range))) {
218
+ if (r.length === 1 && (Bs(r[0].range) || qs(r[0].range) && Jn(h, r[0].range))) {
219
219
  const { range: E, primary: p } = r[0], b = (C = p == null ? void 0 : p.actualRow) != null ? C : E.startRow, y = (_ = p == null ? void 0 : p.actualColumn) != null ? _ : E.startColumn;
220
220
  l = E, v = b, S = y;
221
- const A = Xn(h, b, y);
221
+ const A = Qn(h, b, y);
222
222
  A && (g = Ee(A));
223
223
  } else
224
224
  r.some((E) => {
225
225
  var y, A;
226
226
  const { range: p, primary: b } = E;
227
- if (Qn(h, p)) {
228
- const F = (y = b == null ? void 0 : b.actualRow) != null ? y : p.startRow, N = (A = b == null ? void 0 : b.actualColumn) != null ? A : p.startColumn, M = Xn(h, F, N);
227
+ if (Jn(h, p)) {
228
+ const F = (y = b == null ? void 0 : b.actualRow) != null ? y : p.startRow, N = (A = b == null ? void 0 : b.actualColumn) != null ? A : p.startColumn, M = Qn(h, F, N);
229
229
  if (!M)
230
230
  return l = p, v = F, S = N, !0;
231
231
  const k = Ee(M), I = `=${f}(${k})`;
@@ -267,14 +267,14 @@ const Vs = {
267
267
  endRow: w,
268
268
  startColumn: R,
269
269
  endColumn: R
270
- }), L = `=${f}(${T})`;
270
+ }), D = `=${f}(${T})`;
271
271
  u.push({
272
272
  range: p,
273
273
  primary: {
274
274
  row: I,
275
275
  column: R
276
276
  },
277
- formula: L
277
+ formula: D
278
278
  });
279
279
  }
280
280
  }
@@ -283,7 +283,7 @@ const Vs = {
283
283
  });
284
284
  if (l) {
285
285
  const E = is(v, S, i), p = {
286
- range: sr.clone(l),
286
+ range: hn.clone(l),
287
287
  primary: {
288
288
  startRow: E.startRow,
289
289
  startColumn: E.startColumn,
@@ -299,8 +299,8 @@ const Vs = {
299
299
  subUnitId: a,
300
300
  selections: [p]
301
301
  };
302
- await m.executeCommand(vn.id, b);
303
- const y = o.getEditor(hn), A = o.getEditor(ir);
302
+ await m.executeCommand(Cn.id, b);
303
+ const y = o.getEditor(fn), A = o.getEditor(ir);
304
304
  m.syncExecuteCommand(hr.id, {
305
305
  visible: !0,
306
306
  unitId: c,
@@ -315,7 +315,7 @@ const Vs = {
315
315
  });
316
316
  }
317
317
  };
318
- function Xn(e, t, n) {
318
+ function Qn(e, t, n) {
319
319
  const o = Ws(e, t, n);
320
320
  if (o !== t)
321
321
  return {
@@ -374,7 +374,7 @@ function Rt(e) {
374
374
  const n = t.dataStream, r = n.substring(n.length - 2, n.length) === cr ? n.substring(0, n.length - 2) : n;
375
375
  return no(r);
376
376
  }
377
- return e && (e.t === Fn.NUMBER || ro(e) === Fn.NUMBER);
377
+ return e && (e.t === Dn.NUMBER || ro(e) === Dn.NUMBER);
378
378
  }
379
379
  function Bs(e) {
380
380
  return e.startRow === e.endRow && e.startColumn === e.endColumn;
@@ -382,7 +382,7 @@ function Bs(e) {
382
382
  function qs(e) {
383
383
  return e.startRow !== e.endRow && e.startColumn !== e.endColumn;
384
384
  }
385
- function Qn(e, t) {
385
+ function Jn(e, t) {
386
386
  for (let n = t.startRow; n <= t.endRow; n++)
387
387
  for (let o = t.startColumn; o <= t.endColumn; o++)
388
388
  if (Rt(e.getValue(n, o)))
@@ -401,10 +401,10 @@ function Ks(e, t, n, o) {
401
401
  return r;
402
402
  return o;
403
403
  }
404
- const Mr = "SHEET_FORMULA_UI_PLUGIN", xr = `${Mr}_MORE_FUNCTIONS_COMPONENT`, bn = {
404
+ const Mr = "SHEET_FORMULA_UI_PLUGIN", xr = `${Mr}_MORE_FUNCTIONS_COMPONENT`, yn = {
405
405
  id: "formula-ui.operation.more-functions",
406
406
  type: be.OPERATION,
407
- handler: async (e) => (e.get(_n).open({
407
+ handler: async (e) => (e.get(Rn).open({
408
408
  header: { title: "formula.insert.tooltip" },
409
409
  children: { label: xr }
410
410
  }), !0)
@@ -453,7 +453,7 @@ let Ut = class extends Ze {
453
453
  g,
454
454
  0,
455
455
  u - v
456
- ), _ = fn.deepClone(S);
456
+ ), _ = gn.deepClone(S);
457
457
  _.f = C, _.si = null, f.setValue(u, l, _);
458
458
  } else
459
459
  f.setValue(u, l, S);
@@ -482,12 +482,12 @@ let Ut = class extends Ze {
482
482
  }
483
483
  };
484
484
  Ut = Zs([
485
- At(0, q(Cn)),
486
- At(1, q(ee)),
485
+ At(0, q(_n)),
486
+ At(1, q(te)),
487
487
  At(2, q(Tt)),
488
488
  At(3, q(ye))
489
489
  ], Ut);
490
- const kr = "sheets-formula-ui.base.config", Jn = {};
490
+ const kr = "sheets-formula-ui.base.config", er = {};
491
491
  var zs = Object.getOwnPropertyDescriptor, Xs = (e, t, n, o) => {
492
492
  for (var r = o > 1 ? void 0 : o ? zs(t, n) : t, s = e.length - 1, i; s >= 0; s--)
493
493
  (i = e[s]) && (r = i(r) || r);
@@ -515,7 +515,7 @@ let an = class extends Ze {
515
515
  this._initCellAlertPopup(), this._initZenService();
516
516
  }
517
517
  _initCellAlertPopup() {
518
- this.disposeWithMe(this._hoverManagerService.currentCell$.pipe(pn(100)).subscribe((e) => {
518
+ this.disposeWithMe(this._hoverManagerService.currentCell$.pipe(Sn(100)).subscribe((e) => {
519
519
  var t, n, o, r, s;
520
520
  if (e) {
521
521
  const c = this._context.unit.getActiveSheet();
@@ -567,17 +567,17 @@ var Js = Object.getOwnPropertyDescriptor, ei = (e, t, n, o) => {
567
567
  for (var r = o > 1 ? void 0 : o ? Js(t, n) : t, s = e.length - 1, i; s >= 0; s--)
568
568
  (i = e[s]) && (r = i(r) || r);
569
569
  return r;
570
- }, er = (e, t) => (n, o) => t(n, o, e);
570
+ }, tr = (e, t) => (n, o) => t(n, o, e);
571
571
  let Vt = class extends Ze {
572
572
  constructor(e, t) {
573
573
  super(), this._autoFillService = e, this._lexerTreeBuilder = t, this._registerAutoFill();
574
574
  }
575
575
  _registerAutoFill() {
576
576
  const e = {
577
- type: $n.FORMULA,
577
+ type: Pn.FORMULA,
578
578
  priority: 1001,
579
579
  match: (t) => Ce(t == null ? void 0 : t.f) || De(t == null ? void 0 : t.si),
580
- isContinue: (t, n) => t.type === $n.FORMULA,
580
+ isContinue: (t, n) => t.type === Pn.FORMULA,
581
581
  applyFunctions: {
582
582
  [yo.COPY]: (t, n, o, r, s) => {
583
583
  const { data: i, index: c } = t;
@@ -591,7 +591,7 @@ let Vt = class extends Ze {
591
591
  var h, f;
592
592
  const i = ni(r), c = [], a = /* @__PURE__ */ new Map();
593
593
  for (let m = 1; m <= t; m++) {
594
- const d = (m - 1) % e.length, u = o[d], l = fn.deepClone(e[d]);
594
+ const d = (m - 1) % e.length, u = o[d], l = gn.deepClone(e[d]);
595
595
  if (l) {
596
596
  const v = ((h = e[d]) == null ? void 0 : h.f) || "", S = ((f = e[d]) == null ? void 0 : f.si) || "", g = Ce(v);
597
597
  if (De(S))
@@ -617,8 +617,8 @@ let Vt = class extends Ze {
617
617
  }
618
618
  };
619
619
  Vt = ei([
620
- er(0, bo),
621
- er(1, q(ye))
620
+ tr(0, bo),
621
+ tr(1, q(ye))
622
622
  ], Vt);
623
623
  function ti(e, t, n, o, r) {
624
624
  const { source: s, target: i } = o, { rows: c } = i, { rows: a } = s;
@@ -763,7 +763,7 @@ let Wt = class extends Ze {
763
763
  }
764
764
  };
765
765
  Wt = oi([
766
- vt(0, ee),
766
+ vt(0, te),
767
767
  vt(1, q(ye)),
768
768
  vt(2, ur),
769
769
  vt(3, q(It)),
@@ -1029,7 +1029,7 @@ let Ht = class extends Ze {
1029
1029
  style: {
1030
1030
  strokeWidth: 1,
1031
1031
  stroke: this._themeService.getColorFromTheme("primary.600"),
1032
- fill: new gn(this._themeService.getColorFromTheme("white")).setAlpha(0).toString(),
1032
+ fill: new mn(this._themeService.getColorFromTheme("white")).setAlpha(0).toString(),
1033
1033
  widgets: {}
1034
1034
  }
1035
1035
  }, c = sn(i, r), { rowHeaderWidth: a, columnHeaderHeight: h } = r, f = new gr(s, To.FORMULA_EDITOR_SHOW, this._themeService, {
@@ -1076,7 +1076,7 @@ let Ht = class extends Ze {
1076
1076
  }
1077
1077
  };
1078
1078
  Ht = fi([
1079
- je(1, q(Cn)),
1079
+ je(1, q(_n)),
1080
1080
  je(2, q(Tt)),
1081
1081
  je(3, q(Et)),
1082
1082
  je(4, Te),
@@ -1088,7 +1088,7 @@ var gi = Object.getOwnPropertyDescriptor, mi = (e, t, n, o) => {
1088
1088
  for (var r = o > 1 ? void 0 : o ? gi(t, n) : t, s = e.length - 1, i; s >= 0; s--)
1089
1089
  (i = e[s]) && (r = i(r) || r);
1090
1090
  return r;
1091
- }, tr = (e, t) => (n, o) => t(n, o, e);
1091
+ }, nr = (e, t) => (n, o) => t(n, o, e);
1092
1092
  const pi = {
1093
1093
  tl: {
1094
1094
  size: 6,
@@ -1115,8 +1115,8 @@ let Bt = class extends co {
1115
1115
  }
1116
1116
  };
1117
1117
  Bt = mi([
1118
- tr(0, q(Cn)),
1119
- tr(1, q(Tt))
1118
+ nr(0, q(_n)),
1119
+ nr(1, q(Tt))
1120
1120
  ], Bt);
1121
1121
  function Si() {
1122
1122
  const e = O(vs), t = O(pe), n = _e(e.progress$), o = $t(() => {
@@ -1162,7 +1162,7 @@ function Ct(e) {
1162
1162
  /* @__PURE__ */ x(
1163
1163
  "div",
1164
1164
  {
1165
- className: re("univer-mb-2 univer-font-medium univer-text-gray-500 dark:!univer-text-gray-300", t),
1165
+ className: se("univer-mb-2 univer-font-medium univer-text-gray-500 dark:!univer-text-gray-300", t),
1166
1166
  children: o
1167
1167
  }
1168
1168
  ),
@@ -1180,11 +1180,11 @@ function Ci(e) {
1180
1180
  if (!t) return null;
1181
1181
  const [o, r] = H([]), [s, i] = H(t.functionParameter), [c, a] = H(-1);
1182
1182
  return /* @__PURE__ */ B("div", { children: [
1183
- /* @__PURE__ */ x("div", { className: re("univer-h-[364px] univer-overflow-y-auto", ut), children: s.map((h, f) => /* @__PURE__ */ B("div", { children: [
1183
+ /* @__PURE__ */ x("div", { className: se("univer-h-[364px] univer-overflow-y-auto", ut), children: s.map((h, f) => /* @__PURE__ */ B("div", { children: [
1184
1184
  /* @__PURE__ */ x("div", { className: "univer-text-sm", children: h.name }),
1185
1185
  /* @__PURE__ */ x("div", { className: "univer-mb-2 univer-mt-1" })
1186
1186
  ] }, f)) }),
1187
- /* @__PURE__ */ x("div", { className: re("univer-flex-1 univer-p-3", xs), children: /* @__PURE__ */ x(
1187
+ /* @__PURE__ */ x("div", { className: se("univer-flex-1 univer-p-3", xs), children: /* @__PURE__ */ x(
1188
1188
  Ct,
1189
1189
  {
1190
1190
  title: c === -1 ? /* @__PURE__ */ x(Dr, { prefix: t.functionName, value: s }) : s[c].name,
@@ -1421,7 +1421,7 @@ const Ni = {
1421
1421
  });
1422
1422
  Hr.displayName = "SelectRangeIcon";
1423
1423
  function Mi(e) {
1424
- const { onChange: t } = e, n = "-1", [o, r] = H(""), [s, i] = H([]), [c, a] = H(0), [h, f] = H(n), [m, d] = H(0), [u, l] = H(null), v = O(Zt), S = O(dt), g = O(_n), C = _e(g.sidebarOptions$), _ = vi(Sr, S);
1424
+ const { onChange: t } = e, n = "-1", [o, r] = H(""), [s, i] = H([]), [c, a] = H(0), [h, f] = H(n), [m, d] = H(0), [u, l] = H(null), v = O(Zt), S = O(dt), g = O(Rn), C = _e(g.sidebarOptions$), _ = vi(Sr, S);
1425
1425
  _.unshift({
1426
1426
  label: S.t("formula.moreFunctions.allFunctions"),
1427
1427
  value: n
@@ -1437,7 +1437,7 @@ function Mi(e) {
1437
1437
  const b = (I) => {
1438
1438
  if (o.trim() === "") return I;
1439
1439
  const w = new RegExp(`(${o.toLocaleUpperCase()})`);
1440
- return I.split(w).filter(Boolean).map((T, L) => T.match(w) ? /* @__PURE__ */ x("span", { className: "univer-text-red-500", children: T }, L) : T);
1440
+ return I.split(w).filter(Boolean).map((T, D) => T.match(w) ? /* @__PURE__ */ x("span", { className: "univer-text-red-500", children: T }, D) : T);
1441
1441
  }, y = (I) => {
1442
1442
  if (s.length === 0) {
1443
1443
  l(null);
@@ -1493,13 +1493,13 @@ function Mi(e) {
1493
1493
  s.length > 0 && /* @__PURE__ */ x(
1494
1494
  "ul",
1495
1495
  {
1496
- className: re("univer-mb-0 univer-mt-2 univer-box-border univer-max-h-72 univer-w-full univer-select-none univer-list-none univer-overflow-y-auto univer-rounded univer-p-3 univer-outline-none", Rn, ut),
1496
+ className: se("univer-mb-0 univer-mt-2 univer-box-border univer-max-h-72 univer-w-full univer-select-none univer-list-none univer-overflow-y-auto univer-rounded univer-p-3 univer-outline-none", In, ut),
1497
1497
  onKeyDown: N,
1498
1498
  tabIndex: -1,
1499
1499
  children: s.map(({ name: I }, w) => /* @__PURE__ */ B(
1500
1500
  "li",
1501
1501
  {
1502
- 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", {
1502
+ className: se("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", {
1503
1503
  "univer-bg-gray-200 dark:!univer-bg-gray-600": c === w
1504
1504
  }),
1505
1505
  onMouseEnter: () => M(w),
@@ -1519,7 +1519,7 @@ function Mi(e) {
1519
1519
  ))
1520
1520
  }
1521
1521
  ),
1522
- u && /* @__PURE__ */ B("div", { className: re("univer-mx-0 univer-my-2 univer-overflow-y-auto", ut), children: [
1522
+ u && /* @__PURE__ */ B("div", { className: se("univer-mx-0 univer-my-2 univer-overflow-y-auto", ut), children: [
1523
1523
  /* @__PURE__ */ x(Ct, { title: u.functionName, value: u.description }),
1524
1524
  /* @__PURE__ */ x(
1525
1525
  Ct,
@@ -1548,8 +1548,8 @@ function Mi(e) {
1548
1548
  }
1549
1549
  function xi() {
1550
1550
  const e = Oo(), [t, n] = H(!0), [o, r] = H(!1), [s, i] = H(null);
1551
- O(mn);
1552
- const c = O(dt), a = O(ze), h = O(ee), f = O(pe);
1551
+ O(pn);
1552
+ const c = O(dt), a = O(ze), h = O(te), f = O(pe);
1553
1553
  function m() {
1554
1554
  n(!t), r(!o);
1555
1555
  }
@@ -1561,7 +1561,7 @@ function xi() {
1561
1561
  unitId: u.unitId,
1562
1562
  eventType: xe.Dblclick
1563
1563
  });
1564
- const l = a.getEditor(hn), v = a.getEditor(ir), S = `=${s == null ? void 0 : s.functionName}(`;
1564
+ const l = a.getEditor(fn), v = a.getEditor(ir), S = `=${s == null ? void 0 : s.functionName}(`;
1565
1565
  l == null || l.replaceText(S), v == null || v.replaceText(S, !1);
1566
1566
  }
1567
1567
  return /* @__PURE__ */ B(
@@ -1685,7 +1685,7 @@ function Di(e) {
1685
1685
  }
1686
1686
  function Li(e) {
1687
1687
  return {
1688
- id: bn.id,
1688
+ id: yn.id,
1689
1689
  title: "formula.insert.more",
1690
1690
  tooltip: "formula.insert.tooltip",
1691
1691
  type: Ue.BUTTON,
@@ -1698,13 +1698,13 @@ function Li(e) {
1698
1698
  };
1699
1699
  }
1700
1700
  function $i(e) {
1701
- return e.get(ee).getCurrentTypeOfUnit$(U.UNIVER_SHEET).pipe(
1702
- Zo((o) => o ? e.get(Zn) ? new zo((s) => s.next(!e.get(Zn).supportClipboard)) : Bn(!0) : Bn(!0))
1701
+ return e.get(te).getCurrentTypeOfUnit$(U.UNIVER_SHEET).pipe(
1702
+ Zo((o) => o ? e.get(zn) ? new zo((s) => s.next(!e.get(zn).supportClipboard)) : qn(!0) : qn(!0))
1703
1703
  );
1704
1704
  }
1705
1705
  function Pi(e) {
1706
1706
  return {
1707
- id: In.id,
1707
+ id: En.id,
1708
1708
  type: Ue.BUTTON,
1709
1709
  title: "formula.operation.copyFormulaOnly",
1710
1710
  disabled$: $e(e, {
@@ -1717,7 +1717,7 @@ function Pi(e) {
1717
1717
  }
1718
1718
  function Ui(e) {
1719
1719
  return {
1720
- id: En.id,
1720
+ id: bn.id,
1721
1721
  type: Ue.BUTTON,
1722
1722
  title: "formula.operation.pasteFormula",
1723
1723
  disabled$: $i(e).pipe(
@@ -1732,7 +1732,7 @@ function Ui(e) {
1732
1732
  };
1733
1733
  }
1734
1734
  const Vi = {
1735
- [zn.BASIC]: {
1735
+ [Xn.BASIC]: {
1736
1736
  [`${ve.id}.sum`]: {
1737
1737
  order: 0,
1738
1738
  menuItemFactory: wi
@@ -1754,20 +1754,20 @@ const Vi = {
1754
1754
  menuItemFactory: Di
1755
1755
  }
1756
1756
  },
1757
- [zn.OTHERS]: {
1758
- [bn.id]: {
1757
+ [Xn.OTHERS]: {
1758
+ [yn.id]: {
1759
1759
  order: 0,
1760
1760
  menuItemFactory: Li
1761
1761
  }
1762
1762
  },
1763
1763
  [Mo]: {
1764
- [In.id]: {
1764
+ [En.id]: {
1765
1765
  order: 0,
1766
1766
  menuItemFactory: Pi
1767
1767
  }
1768
1768
  },
1769
1769
  [No]: {
1770
- [En.id]: {
1770
+ [bn.id]: {
1771
1771
  order: 4,
1772
1772
  menuItemFactory: Ui
1773
1773
  }
@@ -1777,11 +1777,11 @@ function Hi(e) {
1777
1777
  return e.getContextValue(ao) && e.getContextValue(uo);
1778
1778
  }
1779
1779
  const Qt = [
1780
- D.ARROW_DOWN,
1781
- D.ARROW_UP,
1782
- D.ARROW_LEFT,
1783
- D.ARROW_RIGHT
1784
- ], Bi = [...Qt, D.ENTER, D.TAB, D.ESC];
1780
+ $.ARROW_DOWN,
1781
+ $.ARROW_UP,
1782
+ $.ARROW_LEFT,
1783
+ $.ARROW_RIGHT
1784
+ ], Bi = [...Qt, $.ENTER, $.TAB, $.ESC];
1785
1785
  function qi() {
1786
1786
  const e = [];
1787
1787
  for (const t of Bi)
@@ -1843,12 +1843,12 @@ function Yi() {
1843
1843
  }
1844
1844
  const Gi = {
1845
1845
  id: wr.id,
1846
- binding: D.F4,
1846
+ binding: $.F4,
1847
1847
  preconditions: (e) => yt(e)
1848
1848
  };
1849
1849
  function Zi() {
1850
1850
  const e = [];
1851
- for (const t of [D.ENTER, D.TAB, D.ARROW_DOWN, D.ARROW_UP])
1851
+ for (const t of [$.ENTER, $.TAB, $.ARROW_DOWN, $.ARROW_UP])
1852
1852
  e.push({
1853
1853
  id: ft.id,
1854
1854
  binding: t,
@@ -1863,9 +1863,9 @@ function Zi() {
1863
1863
  }
1864
1864
  const zi = {
1865
1865
  id: Cs.id,
1866
- binding: V.ALT | D.EQUAL,
1866
+ binding: V.ALT | $.EQUAL,
1867
1867
  preconditions: xo,
1868
- mac: V.CTRL_COMMAND | V.ALT | D.EQUAL,
1868
+ mac: V.CTRL_COMMAND | V.ALT | $.EQUAL,
1869
1869
  description: "shortcut.sheets-formula-ui.quick-sum",
1870
1870
  group: "4_sheet-edit"
1871
1871
  };
@@ -1886,10 +1886,10 @@ let qt = class extends Ze {
1886
1886
  }
1887
1887
  _registerCommands() {
1888
1888
  [
1889
- In,
1890
1889
  En,
1891
- ve,
1892
1890
  bn,
1891
+ ve,
1892
+ yn,
1893
1893
  Ys,
1894
1894
  Vs,
1895
1895
  ft,
@@ -1946,7 +1946,7 @@ let jt = class extends Ze {
1946
1946
  jt = ec([
1947
1947
  rn(0, q(_s)),
1948
1948
  rn(1, Te),
1949
- rn(2, ee)
1949
+ rn(2, te)
1950
1950
  ], jt);
1951
1951
  class Br {
1952
1952
  constructor() {
@@ -2018,13 +2018,13 @@ let Le = class extends ko {
2018
2018
  })), c.add(
2019
2019
  n == null ? void 0 : n.onPointerDown$.subscribeEvent((a, h) => {
2020
2020
  if (!this.inRefSelectionMode()) return;
2021
- const f = this._sheetSkeletonManagerService.getCurrent().skeleton, { row: m } = Pn(a.offsetX, a.offsetY, i, f);
2022
- Un(this._workbookSelections.getCurrentSelections(), m, Ie.ROW) || (this._onPointerDown(a, (r.zIndex || 1) + 1, Ie.ROW, this._getActiveViewport(a), en.Y), a.button !== 2 && h.stopPropagation());
2021
+ const f = this._sheetSkeletonManagerService.getCurrent().skeleton, { row: m } = Un(a.offsetX, a.offsetY, i, f);
2022
+ Vn(this._workbookSelections.getCurrentSelections(), m, Ie.ROW) || (this._onPointerDown(a, (r.zIndex || 1) + 1, Ie.ROW, this._getActiveViewport(a), en.Y), a.button !== 2 && h.stopPropagation());
2023
2023
  })
2024
2024
  ), c.add(o == null ? void 0 : o.onPointerDown$.subscribeEvent((a, h) => {
2025
2025
  if (!this.inRefSelectionMode()) return;
2026
- const f = this._sheetSkeletonManagerService.getCurrent().skeleton, { column: m } = Pn(a.offsetX, a.offsetY, i, f);
2027
- Un(this._workbookSelections.getCurrentSelections(), m, Ie.COLUMN) || (this._onPointerDown(a, (r.zIndex || 1) + 1, Ie.COLUMN, this._getActiveViewport(a), en.X), a.button !== 2 && h.stopPropagation());
2026
+ const f = this._sheetSkeletonManagerService.getCurrent().skeleton, { column: m } = Un(a.offsetX, a.offsetY, i, f);
2027
+ Vn(this._workbookSelections.getCurrentSelections(), m, Ie.COLUMN) || (this._onPointerDown(a, (r.zIndex || 1) + 1, Ie.COLUMN, this._getActiveViewport(a), en.X), a.button !== 2 && h.stopPropagation());
2028
2028
  })), c.add(s == null ? void 0 : s.onPointerDown$.subscribeEvent((a, h) => {
2029
2029
  if (this._reset(), !this.inRefSelectionMode()) return;
2030
2030
  const f = this._sheetSkeletonManagerService.getCurrent().skeleton, m = Ao(f);
@@ -2075,7 +2075,7 @@ let Le = class extends ko {
2075
2075
  var i;
2076
2076
  if (!t)
2077
2077
  return;
2078
- const { skeleton: n } = t, { scene: o } = this._context, r = o.getViewport(jn.VIEW_MAIN);
2078
+ const { skeleton: n } = t, { scene: o } = this._context, r = o.getViewport(Kn.VIEW_MAIN);
2079
2079
  this._skeleton && ((i = this._skeleton.worksheet) == null ? void 0 : i.getSheetId()) !== n.worksheet.getSheetId() && this._reset(), this._changeRuntime(n, o, r);
2080
2080
  const s = this._workbookSelections.getCurrentSelections();
2081
2081
  this.resetSelectionsByModelData(s);
@@ -2083,7 +2083,7 @@ let Le = class extends ko {
2083
2083
  }
2084
2084
  _getActiveViewport(t) {
2085
2085
  const n = this._getSheetObject();
2086
- return n == null ? void 0 : n.scene.getActiveViewportByCoord(Kn.FromArray([t.offsetX, t.offsetY]));
2086
+ return n == null ? void 0 : n.scene.getActiveViewportByCoord(Yn.FromArray([t.offsetX, t.offsetY]));
2087
2087
  }
2088
2088
  _getSheetObject() {
2089
2089
  return Fo(this._context.unit, this._context);
@@ -2106,9 +2106,9 @@ let Le = class extends ko {
2106
2106
  if (!c || !i)
2107
2107
  return;
2108
2108
  r && (this._activeViewport = r);
2109
- const { offsetX: a, offsetY: h } = t, f = c.getViewport(jn.VIEW_MAIN);
2109
+ const { offsetX: a, offsetY: h } = t, f = c.getViewport(Kn.VIEW_MAIN);
2110
2110
  if (!f) return;
2111
- const m = c.getCoordRelativeToViewport(Kn.FromArray([a, h])), { x: d, y: u } = m;
2111
+ const m = c.getCoordRelativeToViewport(Yn.FromArray([a, h])), { x: d, y: u } = m;
2112
2112
  this._startViewportPosX = d, this._startViewportPosY = u;
2113
2113
  const l = c.getScrollXYInfoByViewport(m), { scaleX: v, scaleY: S } = c.getAncestorScale(), g = this._skeleton.getCellByOffset(d, u, v, S, l);
2114
2114
  if (!g) return;
@@ -2150,7 +2150,7 @@ let Le = class extends ko {
2150
2150
  let p = this.getActiveSelectionControl();
2151
2151
  const b = this.getSelectionControls();
2152
2152
  for (const M of b) {
2153
- if (t.button === 2 && sr.contains(M.model, E)) {
2153
+ if (t.button === 2 && hn.contains(M.model, E)) {
2154
2154
  p = M;
2155
2155
  return;
2156
2156
  }
@@ -2215,7 +2215,7 @@ function rc(e) {
2215
2215
  const t = mr(e);
2216
2216
  return t.widgets = { tl: !0, tc: !0, tr: !0, ml: !0, mr: !0, bl: !0, bc: !0, br: !0 }, t;
2217
2217
  }
2218
- const yn = (e, t, n = !0) => {
2218
+ const Tn = (e, t, n = !0) => {
2219
2219
  let o = -1;
2220
2220
  return e.reduce((r, s, i) => {
2221
2221
  if (r.isFinish)
@@ -2232,10 +2232,10 @@ const yn = (e, t, n = !0) => {
2232
2232
  }, qr = (e, t) => {
2233
2233
  const n = e[t];
2234
2234
  let o = -1;
2235
- if (!n || typeof n == "string" || n.nodeType !== X.REFERENCE) return -1;
2235
+ if (!n || typeof n == "string" || n.nodeType !== Q.REFERENCE) return -1;
2236
2236
  for (let r = 0; r <= t; r++) {
2237
2237
  const s = e[r];
2238
- typeof s != "string" && s.nodeType === X.REFERENCE && o++;
2238
+ typeof s != "string" && s.nodeType === Q.REFERENCE && o++;
2239
2239
  }
2240
2240
  return o;
2241
2241
  }, oc = (e, t = 100) => {
@@ -2252,7 +2252,7 @@ const yn = (e, t, n = !0) => {
2252
2252
  }, [e, t]);
2253
2253
  };
2254
2254
  function jr(e, t, n) {
2255
- const o = O(ze), r = ie(() => new _r({ left: -999, top: -999, right: -999, bottom: -999 }), []), s = O(_n), i = O(ee), c = J(() => {
2255
+ const o = O(ze), r = le(() => new _r({ left: -999, top: -999, right: -999, bottom: -999 }), []), s = O(Rn), i = O(te), c = ee(() => {
2256
2256
  var _;
2257
2257
  const a = o.getEditor(e);
2258
2258
  if (!a)
@@ -2289,7 +2289,7 @@ const rt = (e) => {
2289
2289
  o.setSequenceNodes(v != null ? v : []);
2290
2290
  }, [t]), P(() => {
2291
2291
  if (n && e) {
2292
- const v = n.selectionChange$.pipe(pn(50)).subscribe((g) => {
2292
+ const v = n.selectionChange$.pipe(Sn(50)).subscribe((g) => {
2293
2293
  if (g.textRanges.length === 1) {
2294
2294
  const [C] = g.textRanges;
2295
2295
  if (C.collapsed && d.current) {
@@ -2339,7 +2339,7 @@ const rt = (e) => {
2339
2339
  /* @__PURE__ */ x(
2340
2340
  "div",
2341
2341
  {
2342
- className: re("univer-mb-2 univer-text-sm univer-font-medium univer-text-gray-900 dark:!univer-text-white", e),
2342
+ className: se("univer-mb-2 univer-text-sm univer-font-medium univer-text-gray-900 dark:!univer-text-white", e),
2343
2343
  children: t
2344
2344
  }
2345
2345
  ),
@@ -2370,14 +2370,14 @@ const rt = (e) => {
2370
2370
  ] }, s.name)),
2371
2371
  ")"
2372
2372
  ] });
2373
- }, nr = () => {
2373
+ }, rr = () => {
2374
2374
  };
2375
2375
  function lc(e) {
2376
- const { onParamsSwitch: t = nr, onClose: n = nr, isFocus: o, editor: r, formulaText: s } = e, { functionInfo: i, paramIndex: c, reset: a } = sc(o, s, r), h = O(mn), f = !_e(h.helpFunctionVisible$), [m, d] = H(!0), u = O(dt), l = u.t("formula.prompt.required"), v = u.t("formula.prompt.optional"), S = r.getEditorId(), [g] = jr(S, !!i, [i, c]);
2376
+ const { onParamsSwitch: t = rr, onClose: n = rr, isFocus: o, editor: r, formulaText: s } = e, { functionInfo: i, paramIndex: c, reset: a } = sc(o, s, r), h = O(pn), f = !_e(h.helpFunctionVisible$), [m, d] = H(!0), u = O(dt), l = u.t("formula.prompt.required"), v = u.t("formula.prompt.optional"), S = r.getEditorId(), [g] = jr(S, !!i, [i, c]);
2377
2377
  function C(p) {
2378
2378
  t && t(p);
2379
2379
  }
2380
- const _ = J((p) => {
2380
+ const _ = ee((p) => {
2381
2381
  h.helpFunctionVisible$.next(!p);
2382
2382
  }), E = () => {
2383
2383
  _(!0), n();
@@ -2385,12 +2385,12 @@ function lc(e) {
2385
2385
  return i ? f ? /* @__PURE__ */ x(cn, { portal: !0, anchorRect$: g, direction: "left-center", children: /* @__PURE__ */ x(ic, { onClick: () => _(!1) }) }, "hidden") : /* @__PURE__ */ x(cn, { portal: !0, onClickOutside: () => a(), anchorRect$: g, direction: "vertical", children: /* @__PURE__ */ B(
2386
2386
  "div",
2387
2387
  {
2388
- 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", Rn),
2388
+ className: se("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", In),
2389
2389
  children: [
2390
2390
  /* @__PURE__ */ B(
2391
2391
  "div",
2392
2392
  {
2393
- className: re("univer-wrap-anywhere univer-box-border univer-flex univer-items-center univer-justify-between univer-px-4 univer-py-3 univer-text-xs univer-font-medium univer-text-gray-900 dark:!univer-text-white", ks),
2393
+ className: se("univer-wrap-anywhere univer-box-border univer-flex univer-items-center univer-justify-between univer-px-4 univer-py-3 univer-text-xs univer-font-medium univer-text-gray-900 dark:!univer-text-white", ks),
2394
2394
  children: [
2395
2395
  /* @__PURE__ */ x(
2396
2396
  cc,
@@ -2426,7 +2426,7 @@ function lc(e) {
2426
2426
  /* @__PURE__ */ x(
2427
2427
  "div",
2428
2428
  {
2429
- className: re("univer-box-border univer-max-h-[350px] univer-overflow-y-auto univer-px-4 univer-pb-3 univer-pt-0", ut),
2429
+ className: se("univer-box-border univer-max-h-[350px] univer-overflow-y-auto univer-px-4 univer-pb-3 univer-pt-0", ut),
2430
2430
  style: {
2431
2431
  height: m ? "unset" : 0,
2432
2432
  padding: m ? "revert-layer" : 0
@@ -2464,12 +2464,12 @@ function lc(e) {
2464
2464
  }
2465
2465
  const ac = (e) => {
2466
2466
  const t = O(ze);
2467
- return J((o) => {
2467
+ return ee((o) => {
2468
2468
  var r, s;
2469
2469
  if (e) {
2470
2470
  t.focus(e.getEditorId());
2471
2471
  const i = [...e.getSelectionRanges()];
2472
- if (fn.isDefine(o))
2472
+ if (gn.isDefine(o))
2473
2473
  e.setSelectionRanges([{ startOffset: o, endOffset: o }]);
2474
2474
  else if (!i.length && !e.docSelectionRenderService.isOnPointerEvent) {
2475
2475
  const c = (s = (r = e.getDocumentData().body) == null ? void 0 : r.dataStream) != null ? s : `\r
@@ -2482,39 +2482,39 @@ const ac = (e) => {
2482
2482
  };
2483
2483
  function uc(e) {
2484
2484
  var r, s;
2485
- const n = e.get(ee).getCurrentUniverDocInstance();
2485
+ const n = e.get(te).getCurrentUniverDocInstance();
2486
2486
  return n != null && n.getBody() ? { dataStream: (s = (r = n.getBody()) == null ? void 0 : r.dataStream) != null ? s : "", offset: 0 } : void 0;
2487
2487
  }
2488
2488
  var Me = /* @__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))(Me || {});
2489
2489
  function dc(e) {
2490
2490
  var y;
2491
- const { editorId: t, isFocus: n, disableOnClick: o, unitId: r, subUnitId: s } = e, i = O(Te), c = O(ee), a = i.getRenderById(r), h = i.getRenderById(t), f = h == null ? void 0 : h.with(Ir), m = O(Nr), d = O(It), [u, l] = H(
2491
+ const { editorId: t, isFocus: n, disableOnClick: o, unitId: r, subUnitId: s } = e, i = O(Te), c = O(te), a = i.getRenderById(r), h = i.getRenderById(t), f = h == null ? void 0 : h.with(Ir), m = O(Nr), d = O(It), [u, l] = H(
2492
2492
  0
2493
2493
  /* NOT_SELECT */
2494
- ), v = O(ye), S = z(!0), g = a == null ? void 0 : a.with(Le), C = rt(u), _ = c.getUnit(r, U.UNIVER_SHEET), E = _ == null ? void 0 : _.getSheetBySheetId(s), p = J((A) => {
2494
+ ), v = O(ye), S = z(!0), g = a == null ? void 0 : a.with(Le), C = rt(u), _ = c.getUnit(r, U.UNIVER_SHEET), E = _ == null ? void 0 : _.getSheetBySheetId(s), p = ee((A) => {
2495
2495
  g && g.setSkipLastEnabled(
2496
2496
  A === 1 || A === 3 || A === 4
2497
2497
  /* EDIT_OTHER_WORKBOOK_REFERENCE */
2498
2498
  ), C.current = A, l(A);
2499
- }), b = J(() => {
2500
- var ce, le, he;
2499
+ }), b = ee(() => {
2500
+ var X, re, he;
2501
2501
  const A = c.getCurrentUnitOfType(U.UNIVER_SHEET);
2502
2502
  if (!A) return;
2503
2503
  const F = A.getActiveSheet(), N = f == null ? void 0 : f.getActiveTextRange(), M = N != null && N.collapsed ? N.startOffset : -1, k = uc(d);
2504
2504
  if (!k) return;
2505
- const I = (ce = k == null ? void 0 : k.dataStream) == null ? void 0 : ce.slice(0, -2), w = ((le = v.sequenceNodesBuilder(I)) != null ? le : []).map((Y) => typeof Y == "object" ? Y.nodeType === X.REFERENCE ? {
2505
+ const I = (X = k == null ? void 0 : k.dataStream) == null ? void 0 : X.slice(0, -2), w = ((re = v.sequenceNodesBuilder(I)) != null ? re : []).map((Y) => typeof Y == "object" ? Y.nodeType === Q.REFERENCE ? {
2506
2506
  ...Y,
2507
2507
  range: Ho(Y.token)
2508
2508
  } : {
2509
2509
  ...Y,
2510
2510
  range: void 0
2511
- } : Y), R = I[M - 1], T = I[M], L = w.find((Y) => typeof Y == "object" && Y.nodeType === X.REFERENCE && M === Y.endIndex + 2), $ = R && Bo(R) && (!T || qo(T) && T !== Ge.OPEN_BRACKET), W = !!L;
2512
- if ((I == null ? void 0 : I.substring(0, 1)) === "=" && ($ || W))
2511
+ } : Y), R = I[M - 1], T = I[M], D = w.find((Y) => typeof Y == "object" && Y.nodeType === Q.REFERENCE && M === Y.endIndex + 2), L = R && Bo(R) && (!T || qo(T) && T !== Ge.OPEN_BRACKET), W = !!D;
2512
+ if ((I == null ? void 0 : I.substring(0, 1)) === "=" && (L || W))
2513
2513
  if (W) {
2514
2514
  if (S.current)
2515
2515
  return;
2516
- const { sheetName: Y, unitId: Q } = L.range, ot = (he = c.getCurrentUnitOfType(U.UNIVER_SHEET)) == null ? void 0 : he.getUnitId();
2517
- Q && Q !== ot ? p(
2516
+ const { sheetName: Y, unitId: J } = D.range, ot = (he = c.getCurrentUnitOfType(U.UNIVER_SHEET)) == null ? void 0 : he.getUnitId();
2517
+ J && J !== ot ? p(
2518
2518
  4
2519
2519
  /* EDIT_OTHER_WORKBOOK_REFERENCE */
2520
2520
  ) : !Y && F.getSheetId() === (E == null ? void 0 : E.getSheetId()) || Y === F.getName() ? p(
@@ -2572,7 +2572,7 @@ const hc = () => {
2572
2572
  return $t((n) => e.sequenceNodesBuilder(n) || [], [e]);
2573
2573
  };
2574
2574
  function fc(e, t, n) {
2575
- const o = new gn(t).setAlpha(0.05).toRgbString();
2575
+ const o = new mn(t).setAlpha(0.05).toRgbString();
2576
2576
  return {
2577
2577
  id: n,
2578
2578
  strokeWidth: 1,
@@ -2609,12 +2609,12 @@ function Kr(e) {
2609
2609
  if (!((_ = a == null ? void 0 : a.getWorksheetSkeleton(v)) == null ? void 0 : _.skeleton)) return;
2610
2610
  const C = [];
2611
2611
  for (let b = 0, y = r.length; b < y; b++) {
2612
- const A = r[b], { themeColor: F, token: N, refIndex: M, endIndex: k } = A, I = ht(N), { unitId: w, sheetName: R, range: T } = I, L = S(R);
2613
- if (!L && R || m !== t && w !== m || w && w !== m || L && L !== v || !L && v !== n)
2612
+ const A = r[b], { themeColor: F, token: N, refIndex: M, endIndex: k } = A, I = ht(N), { unitId: w, sheetName: R, range: T } = I, D = S(R);
2613
+ if (!D && R || m !== t && w !== m || w && w !== m || D && D !== v || !D && v !== n)
2614
2614
  continue;
2615
- const $ = ps(T, u.getRowCount(), u.getColumnCount());
2616
- $.unitId = t, $.sheetId = v, l.push({
2617
- range: $,
2615
+ const L = ps(T, u.getRowCount(), u.getColumnCount());
2616
+ L.unitId = t, L.sheetId = v, l.push({
2617
+ range: L,
2618
2618
  primary: null,
2619
2619
  style: fc(h, F, M.toString())
2620
2620
  }), C.push(k);
@@ -2626,7 +2626,7 @@ function Kr(e) {
2626
2626
  return l;
2627
2627
  }
2628
2628
  function gc(e, t) {
2629
- const n = O(ee), o = O(Et), r = O(Gt), s = O(Te), i = _e(ie(() => n.getCurrentTypeOfUnit$(U.UNIVER_SHEET), [n])), c = i ? s.getRenderById(i.getUnitId()) : null, a = c == null ? void 0 : c.with(Le), h = c == null ? void 0 : c.with(bt), f = J((m, d) => {
2629
+ const n = O(te), o = O(Et), r = O(Gt), s = O(Te), i = _e(le(() => n.getCurrentTypeOfUnit$(U.UNIVER_SHEET), [n])), c = i ? s.getRenderById(i.getUnitId()) : null, a = c == null ? void 0 : c.with(Le), h = c == null ? void 0 : c.with(bt), f = ee((m, d) => {
2630
2630
  const u = n.getCurrentUnitOfType(U.UNIVER_SHEET);
2631
2631
  if (!u || a != null && a.selectionMoving) return;
2632
2632
  const l = Kr({
@@ -2649,8 +2649,8 @@ function gc(e, t) {
2649
2649
  }, [a]), f;
2650
2650
  }
2651
2651
  function Yr(e = "") {
2652
- const t = O(Zt), n = mc(), o = O(pe), r = ie(() => e.length, [e]);
2653
- return J((i, c, a = !0, h) => {
2652
+ const t = O(Zt), n = mc(), o = O(pe), r = le(() => e.length, [e]);
2653
+ return ee((i, c, a = !0, h) => {
2654
2654
  const f = i.getDocumentData(), m = i.getEditorId();
2655
2655
  if (!f)
2656
2656
  return [];
@@ -2660,9 +2660,9 @@ function Yr(e = "") {
2660
2660
  const u = d.dataStream.slice(0, d.dataStream.length - 2), l = { dataStream: "", ...f.body };
2661
2661
  if (!u.startsWith(e)) return [];
2662
2662
  if (c == null || c.length === 0)
2663
- return l.textRuns = [], o.syncExecuteCommand(qn.id, {
2663
+ return l.textRuns = [], o.syncExecuteCommand(jn.id, {
2664
2664
  unitId: m,
2665
- body: Dn(l, 0, l.dataStream.length - 2)
2665
+ body: Ln(l, 0, l.dataStream.length - 2)
2666
2666
  }), [];
2667
2667
  {
2668
2668
  const { textRuns: v, refSelections: S } = pc(t, n, c);
@@ -2680,9 +2680,9 @@ function Yr(e = "") {
2680
2680
  E.startOffset = Math.max(0, Math.min(E.startOffset, _)), E.endOffset = Math.max(0, Math.min(E.endOffset, _));
2681
2681
  });
2682
2682
  }
2683
- return o.syncExecuteCommand(qn.id, {
2683
+ return o.syncExecuteCommand(jn.id, {
2684
2684
  unitId: m,
2685
- body: Dn(l, 0, l.dataStream.length - 2),
2685
+ body: Ln(l, 0, l.dataStream.length - 2),
2686
2686
  textRanges: h != null ? h : C
2687
2687
  }), S;
2688
2688
  }
@@ -2690,7 +2690,7 @@ function Yr(e = "") {
2690
2690
  }
2691
2691
  function mc() {
2692
2692
  const e = O(Et), t = e.getCurrentTheme();
2693
- return ie(() => {
2693
+ return le(() => {
2694
2694
  const o = [
2695
2695
  e.getColorFromTheme("loop-color.1"),
2696
2696
  e.getColorFromTheme("loop-color.2"),
@@ -2742,7 +2742,7 @@ function pc(e, t, n) {
2742
2742
  }
2743
2743
  const { startIndex: l, endIndex: v, nodeType: S, token: g } = u;
2744
2744
  let C = "";
2745
- if (S === X.REFERENCE) {
2745
+ if (S === Q.REFERENCE) {
2746
2746
  if (h.has(g))
2747
2747
  C = h.get(g);
2748
2748
  else {
@@ -2757,7 +2757,7 @@ function pc(e, t, n) {
2757
2757
  endIndex: u.endIndex,
2758
2758
  index: a.length
2759
2759
  });
2760
- } else S === X.NUMBER ? C = r : (S === X.STRING || S === X.ARRAY) && (C = s);
2760
+ } else S === Q.NUMBER ? C = r : (S === Q.STRING || S === Q.ARRAY) && (C = s);
2761
2761
  C && C.length > 0 ? c.push({
2762
2762
  st: l,
2763
2763
  ed: v + 1,
@@ -2793,26 +2793,26 @@ const Sc = (e, t, n, o) => {
2793
2793
  return;
2794
2794
  }
2795
2795
  let S = de.LEFT;
2796
- l === D.ARROW_DOWN ? S = de.DOWN : l === D.ARROW_UP ? S = de.UP : l === D.ARROW_RIGHT && (S = de.RIGHT), v === V.SHIFT ? r.executeCommand(es.id, {
2796
+ l === $.ARROW_DOWN ? S = de.DOWN : l === $.ARROW_UP ? S = de.UP : l === $.ARROW_RIGHT && (S = de.RIGHT), v === V.SHIFT ? r.executeCommand(es.id, {
2797
2797
  direction: S
2798
2798
  }) : r.executeCommand(ts.id, {
2799
2799
  direction: S
2800
2800
  });
2801
2801
  }, d = (l, v) => {
2802
2802
  let S = de.DOWN;
2803
- l === D.ARROW_DOWN ? S = de.DOWN : l === D.ARROW_UP ? S = de.UP : l === D.ARROW_LEFT ? S = de.LEFT : l === D.ARROW_RIGHT && (S = de.RIGHT), i.current ? v === V.CTRL_COMMAND ? r.executeCommand(Vn.id, {
2803
+ l === $.ARROW_DOWN ? S = de.DOWN : l === $.ARROW_UP ? S = de.UP : l === $.ARROW_LEFT ? S = de.LEFT : l === $.ARROW_RIGHT && (S = de.RIGHT), i.current ? v === V.CTRL_COMMAND ? r.executeCommand(Wn.id, {
2804
2804
  direction: S,
2805
- jumpOver: Wn.moveGap,
2805
+ jumpOver: Hn.moveGap,
2806
2806
  extra: "formula-editor",
2807
2807
  fromCurrentSelection: i.current === Me.NEED_ADD || i.current === Me.EDIT_OTHER_SHEET_REFERENCE
2808
- }) : v === V.SHIFT ? r.executeCommand(Hn.id, {
2808
+ }) : v === V.SHIFT ? r.executeCommand(Bn.id, {
2809
2809
  direction: S,
2810
2810
  extra: "formula-editor"
2811
- }) : v === (V.CTRL_COMMAND | V.SHIFT) ? r.executeCommand(Hn.id, {
2811
+ }) : v === (V.CTRL_COMMAND | V.SHIFT) ? r.executeCommand(Bn.id, {
2812
2812
  direction: S,
2813
- jumpOver: Wn.moveGap,
2813
+ jumpOver: Hn.moveGap,
2814
2814
  extra: "formula-editor"
2815
- }) : r.executeCommand(Vn.id, {
2815
+ }) : r.executeCommand(Wn.id, {
2816
2816
  direction: S,
2817
2817
  extra: "formula-editor",
2818
2818
  fromCurrentSelection: i.current === Me.NEED_ADD || i.current === Me.EDIT_OTHER_SHEET_REFERENCE
@@ -2826,22 +2826,22 @@ const Sc = (e, t, n, o) => {
2826
2826
  d(S, g);
2827
2827
  }
2828
2828
  })), [
2829
- { keyCode: D.ARROW_DOWN },
2830
- { keyCode: D.ARROW_LEFT },
2831
- { keyCode: D.ARROW_RIGHT },
2832
- { keyCode: D.ARROW_UP },
2833
- { keyCode: D.ARROW_DOWN, metaKey: V.SHIFT },
2834
- { keyCode: D.ARROW_LEFT, metaKey: V.SHIFT },
2835
- { keyCode: D.ARROW_RIGHT, metaKey: V.SHIFT },
2836
- { keyCode: D.ARROW_UP, metaKey: V.SHIFT },
2837
- { keyCode: D.ARROW_DOWN, metaKey: V.CTRL_COMMAND },
2838
- { keyCode: D.ARROW_LEFT, metaKey: V.CTRL_COMMAND },
2839
- { keyCode: D.ARROW_RIGHT, metaKey: V.CTRL_COMMAND },
2840
- { keyCode: D.ARROW_UP, metaKey: V.CTRL_COMMAND },
2841
- { keyCode: D.ARROW_DOWN, metaKey: V.CTRL_COMMAND | V.SHIFT },
2842
- { keyCode: D.ARROW_LEFT, metaKey: V.CTRL_COMMAND | V.SHIFT },
2843
- { keyCode: D.ARROW_RIGHT, metaKey: V.CTRL_COMMAND | V.SHIFT },
2844
- { keyCode: D.ARROW_UP, metaKey: V.CTRL_COMMAND | V.SHIFT }
2829
+ { keyCode: $.ARROW_DOWN },
2830
+ { keyCode: $.ARROW_LEFT },
2831
+ { keyCode: $.ARROW_RIGHT },
2832
+ { keyCode: $.ARROW_UP },
2833
+ { keyCode: $.ARROW_DOWN, metaKey: V.SHIFT },
2834
+ { keyCode: $.ARROW_LEFT, metaKey: V.SHIFT },
2835
+ { keyCode: $.ARROW_RIGHT, metaKey: V.SHIFT },
2836
+ { keyCode: $.ARROW_UP, metaKey: V.SHIFT },
2837
+ { keyCode: $.ARROW_DOWN, metaKey: V.CTRL_COMMAND },
2838
+ { keyCode: $.ARROW_LEFT, metaKey: V.CTRL_COMMAND },
2839
+ { keyCode: $.ARROW_RIGHT, metaKey: V.CTRL_COMMAND },
2840
+ { keyCode: $.ARROW_UP, metaKey: V.CTRL_COMMAND },
2841
+ { keyCode: $.ARROW_DOWN, metaKey: V.CTRL_COMMAND | V.SHIFT },
2842
+ { keyCode: $.ARROW_LEFT, metaKey: V.CTRL_COMMAND | V.SHIFT },
2843
+ { keyCode: $.ARROW_RIGHT, metaKey: V.CTRL_COMMAND | V.SHIFT },
2844
+ { keyCode: $.ARROW_UP, metaKey: V.CTRL_COMMAND | V.SHIFT }
2845
2845
  ].map(({ keyCode: l, metaKey: v }) => ({
2846
2846
  id: h,
2847
2847
  binding: v ? l | v : l,
@@ -2860,25 +2860,25 @@ const Sc = (e, t, n, o) => {
2860
2860
  }, [r, n, e, s]);
2861
2861
  }, vc = (e, t, n, o, r = !0) => {
2862
2862
  var u;
2863
- const s = O(Te), i = O(dn), c = O(ys), a = O(Gt), h = O(ee), f = _e(ie(() => h.getCurrentTypeOfUnit$(U.UNIVER_SHEET), [h])), m = s.getRenderById((u = f == null ? void 0 : f.getUnitId()) != null ? u : ""), d = m == null ? void 0 : m.with(Le);
2863
+ const s = O(Te), i = O(dn), c = O(ys), a = O(Gt), h = O(te), f = _e(le(() => h.getCurrentTypeOfUnit$(U.UNIVER_SHEET), [h])), m = s.getRenderById((u = f == null ? void 0 : f.getUnitId()) != null ? u : ""), d = m == null ? void 0 : m.with(Le);
2864
2864
  Pt(() => {
2865
2865
  if (e)
2866
- return i.setContextValue(Ln, !0), r && c.disable(), () => {
2866
+ return i.setContextValue($n, !0), r && c.disable(), () => {
2867
2867
  const l = h.getCurrentUnitOfType(U.UNIVER_DOC);
2868
- (l == null ? void 0 : l.getUnitId()) === o && i.setContextValue(Ln, !1), r && c.enable(), a.clear();
2868
+ (l == null ? void 0 : l.getUnitId()) === o && i.setContextValue($n, !1), r && c.enable(), a.clear();
2869
2869
  };
2870
2870
  }, [i, e, a, r, o]), Pt(() => {
2871
2871
  if (e && t) {
2872
2872
  const l = d == null ? void 0 : d.enableSelectionChanging();
2873
- return i.setContextValue(Yn, !0), () => {
2874
- i.setContextValue(Yn, !1), l == null || l.dispose();
2873
+ return i.setContextValue(Gn, !0), () => {
2874
+ i.setContextValue(Gn, !1), l == null || l.dispose();
2875
2875
  };
2876
2876
  }
2877
2877
  }, [i, e, d, t]), P(() => {
2878
2878
  e && (d == null || d.setSkipLastEnabled(!1));
2879
2879
  }, [e, d]);
2880
2880
  }, Cc = (e, t, n) => {
2881
- const o = O(ee), r = O(Sn);
2881
+ const o = O(te), r = O(vn);
2882
2882
  return $t(() => {
2883
2883
  if (e) {
2884
2884
  const i = [...r.getWorkbookSelections(t).getSelectionsOfWorksheet(n)], c = o.getCurrentUnitForType(U.UNIVER_SHEET), a = c == null ? void 0 : c.getActiveSheet();
@@ -2891,7 +2891,7 @@ const Sc = (e, t, n, o) => {
2891
2891
  if ((o == null ? void 0 : o.length) !== 1)
2892
2892
  return;
2893
2893
  const s = o[0].startOffset - 1, i = ((m = (f = t == null ? void 0 : t.getDocumentData().body) == null ? void 0 : f.dataStream) != null ? m : `\r
2894
- `).slice(0, -2), c = (d = n.sequenceNodesBuilder(i.slice(1))) != null ? d : [], a = yn(c, s, !1), h = qr(c, a);
2894
+ `).slice(0, -2), c = (d = n.sequenceNodesBuilder(i.slice(1))) != null ? d : [], a = Tn(c, s, !1), h = qr(c, a);
2895
2895
  return {
2896
2896
  nodeIndex: a,
2897
2897
  updatingRefIndex: h,
@@ -2901,100 +2901,100 @@ const Sc = (e, t, n, o) => {
2901
2901
  }, Ic = (() => {
2902
2902
  }), Ec = (e, t, n, o, r, s, i, c, a, h = Ic) => {
2903
2903
  var M;
2904
- const f = O(Te), m = O(ee), d = O(pe), u = O(Nr), l = O(Et), v = O(ye), S = m.getUnit(o), g = J((k, I) => {
2904
+ const f = O(Te), m = O(te), d = O(pe), u = O(Nr), l = O(Et), v = O(ye), S = m.getUnit(o), g = ee((k, I) => {
2905
2905
  var w, R, T;
2906
2906
  return (T = (R = (w = m.getUnit(k)) == null ? void 0 : w.getSheetBySheetId(I)) == null ? void 0 : R.getName()) != null ? T : "";
2907
- }), C = ie(() => g(o, r), [g, r, o]), _ = _e(S == null ? void 0 : S.activeSheet$), E = rt({ activeSheet: _, sheetName: C }), p = _e(ie(() => m.getCurrentTypeOfUnit$(U.UNIVER_SHEET), [m])), b = f.getRenderById((M = p == null ? void 0 : p.getUnitId()) != null ? M : ""), y = b == null ? void 0 : b.with(Le), A = b == null ? void 0 : b.with(bt), F = O(Gt), N = J((k, I, w) => {
2908
- var ce, le, he, Y, Q, ot, st, Ot, Oe, Nt;
2907
+ }), C = le(() => g(o, r), [g, r, o]), _ = _e(S == null ? void 0 : S.activeSheet$), E = rt({ activeSheet: _, sheetName: C }), p = _e(le(() => m.getCurrentTypeOfUnit$(U.UNIVER_SHEET), [m])), b = f.getRenderById((M = p == null ? void 0 : p.getUnitId()) != null ? M : ""), y = b == null ? void 0 : b.with(Le), A = b == null ? void 0 : b.with(bt), F = O(Gt), N = ee((k, I, w) => {
2908
+ var X, re, he, Y, J, ot, st, Ot, Oe, Nt;
2909
2909
  const R = Rc({ editor: a, lexerTreeBuilder: v });
2910
2910
  if (!R) return;
2911
- const { nodeIndex: T, updatingRefIndex: L, sequenceNodes: $, offset: W } = R;
2911
+ const { nodeIndex: T, updatingRefIndex: D, sequenceNodes: L, offset: W } = R;
2912
2912
  if (n.current === Me.NEED_ADD)
2913
2913
  if (W !== 0) {
2914
- if (T === -1 && $.length)
2914
+ if (T === -1 && L.length)
2915
2915
  return;
2916
- const K = k[k.length - 1], te = $.splice(T + 1), fe = (ce = K.sheetId) != null ? ce : r, ne = {
2916
+ const K = k[k.length - 1], ne = L.splice(T + 1), fe = (X = K.sheetId) != null ? X : r, oe = {
2917
2917
  range: K,
2918
- unitId: (le = K.unitId) != null ? le : p.getUnitId(),
2918
+ unitId: (re = K.unitId) != null ? re : p.getUnitId(),
2919
2919
  sheetName: g((he = K.unitId) != null ? he : p.getUnitId(), fe)
2920
- }, ae = fe !== r, ge = (p == null ? void 0 : p.getUnitId()) !== o, Se = Ft([ne], i && (ae || ge), C, ge);
2921
- $.push({ token: Se[0], nodeType: X.REFERENCE });
2922
- const We = [...$, ...te], He = un(We);
2923
- h(He, _c($), I);
2920
+ }, ae = fe !== r, ge = (p == null ? void 0 : p.getUnitId()) !== o, Se = Ft([oe], i && (ae || ge), C, ge);
2921
+ L.push({ token: Se[0], nodeType: Q.REFERENCE });
2922
+ const We = [...L, ...ne], He = un(We);
2923
+ h(He, _c(L), I);
2924
2924
  } else {
2925
- const K = k[k.length - 1], te = (Y = K.sheetId) != null ? Y : r, fe = {
2925
+ const K = k[k.length - 1], ne = (Y = K.sheetId) != null ? Y : r, fe = {
2926
2926
  range: K,
2927
- unitId: (Q = K.unitId) != null ? Q : p.getUnitId(),
2928
- sheetName: g((ot = K.unitId) != null ? ot : p.getUnitId(), te)
2929
- }, ne = te !== r, ae = (p == null ? void 0 : p.getUnitId()) !== o, ge = Ft([fe], i && (ne || ae), C, ae);
2930
- $.unshift({ token: ge[0], nodeType: X.REFERENCE });
2931
- const Se = un($);
2927
+ unitId: (J = K.unitId) != null ? J : p.getUnitId(),
2928
+ sheetName: g((ot = K.unitId) != null ? ot : p.getUnitId(), ne)
2929
+ }, oe = ne !== r, ae = (p == null ? void 0 : p.getUnitId()) !== o, ge = Ft([fe], i && (oe || ae), C, ae);
2930
+ L.unshift({ token: ge[0], nodeType: Q.REFERENCE });
2931
+ const Se = un(L);
2932
2932
  h(Se, ge[0].length, I);
2933
2933
  }
2934
2934
  else if (n.current === Me.EDIT_OTHER_SHEET_REFERENCE || n.current === Me.EDIT_OTHER_WORKBOOK_REFERENCE) {
2935
2935
  const K = k.pop();
2936
2936
  if (!K) return;
2937
- const te = $[T];
2938
- if (typeof te == "object" && te.nodeType === X.REFERENCE) {
2939
- const fe = te.token;
2940
- (p == null ? void 0 : p.getUnitId()) !== o ? te.token = Ko((st = p == null ? void 0 : p.getUnitId()) != null ? st : "", C, K) : te.token = C === (_ == null ? void 0 : _.getName()) ? Ee(K) : _t(_.getName(), K);
2941
- const ae = W + (te.token.length - fe.length);
2942
- h(Yo($), ae, I);
2937
+ const ne = L[T];
2938
+ if (typeof ne == "object" && ne.nodeType === Q.REFERENCE) {
2939
+ const fe = ne.token;
2940
+ (p == null ? void 0 : p.getUnitId()) !== o ? ne.token = Ko((st = p == null ? void 0 : p.getUnitId()) != null ? st : "", C, K) : ne.token = C === (_ == null ? void 0 : _.getName()) ? Ee(K) : _t(_.getName(), K);
2941
+ const ae = W + (ne.token.length - fe.length);
2942
+ h(Yo(L), ae, I);
2943
2943
  }
2944
2944
  } else {
2945
2945
  const K = [...k];
2946
- if (!w && L !== -1) {
2946
+ if (!w && D !== -1) {
2947
2947
  const G = K.pop();
2948
- G && K.splice(L, 0, G);
2948
+ G && K.splice(D, 0, G);
2949
2949
  }
2950
- let te = 0;
2951
- const fe = $.map((G) => {
2950
+ let ne = 0;
2951
+ const fe = L.map((G) => {
2952
2952
  var Re, we, it, Be;
2953
2953
  if (typeof G == "string")
2954
2954
  return G;
2955
- if (G.nodeType === X.REFERENCE) {
2955
+ if (G.nodeType === Q.REFERENCE) {
2956
2956
  const me = ht(G.token);
2957
2957
  if (me.sheetName || (me.sheetName = C), (me.unitId || o) !== (p == null ? void 0 : p.getUnitId()) || i && ((Re = E.current.activeSheet) == null ? void 0 : Re.getName()) !== me.sheetName)
2958
2958
  return G.token;
2959
- const oe = K[te];
2960
- if (te++, !oe)
2959
+ const ie = K[ne];
2960
+ if (ne++, !ie)
2961
2961
  return "";
2962
- const gt = (we = oe.sheetId) != null ? we : r, Jt = {
2963
- range: oe,
2964
- unitId: (it = oe.unitId) != null ? it : p.getUnitId(),
2965
- sheetName: g((Be = oe.unitId) != null ? Be : p.getUnitId(), gt)
2962
+ const gt = (we = ie.sheetId) != null ? we : r, Jt = {
2963
+ range: ie,
2964
+ unitId: (it = ie.unitId) != null ? it : p.getUnitId(),
2965
+ sheetName: g((Be = ie.unitId) != null ? Be : p.getUnitId(), gt)
2966
2966
  }, Mt = (p == null ? void 0 : p.getUnitId()) !== o;
2967
2967
  return Ft([Jt], i && (gt !== r || Mt), C, Mt)[0];
2968
2968
  }
2969
2969
  return G.token;
2970
2970
  });
2971
- let ne = "", ae;
2971
+ let oe = "", ae;
2972
2972
  fe.forEach((G, Re) => {
2973
- ne += G, Re === T && (ae = ne.length);
2973
+ oe += G, Re === T && (ae = oe.length);
2974
2974
  });
2975
2975
  const ge = [];
2976
- for (let G = te; G <= k.length - 1; G++) {
2976
+ for (let G = ne; G <= k.length - 1; G++) {
2977
2977
  const Re = k[G], we = (Ot = Re.sheetId) != null ? Ot : r, it = {
2978
2978
  range: Re,
2979
2979
  unitId: (Oe = Re.unitId) != null ? Oe : p.getUnitId(),
2980
2980
  sheetName: g((Nt = Re.unitId) != null ? Nt : p.getUnitId(), we)
2981
- }, Be = (p == null ? void 0 : p.getUnitId()) !== o, oe = Ft([it], i && (we !== r || Be), C, Be);
2982
- ge.push(oe[0]);
2981
+ }, Be = (p == null ? void 0 : p.getUnitId()) !== o, ie = Ft([it], i && (we !== r || Be), C, Be);
2982
+ ge.push(ie[0]);
2983
2983
  }
2984
- const Se = $[$.length - 1], We = Se && (typeof Se == "string" ? !1 : Se.nodeType === X.REFERENCE), He = `${ne}${ge.length && We ? "," : ""}${ge.join(",")}`;
2984
+ const Se = L[L.length - 1], We = Se && (typeof Se == "string" ? !1 : Se.nodeType === Q.REFERENCE), He = `${oe}${ge.length && We ? "," : ""}${ge.join(",")}`;
2985
2985
  h(He, !ge.length && ae ? ae : He.length, I);
2986
2986
  }
2987
2987
  });
2988
2988
  P(() => {
2989
2989
  if (y && e) {
2990
2990
  let k = !0, I = 0;
2991
- const w = (T, L) => {
2991
+ const w = (T, D) => {
2992
2992
  if (k) {
2993
2993
  k = !1, I = T.length;
2994
2994
  return;
2995
2995
  }
2996
- const $ = T.length > I;
2997
- L && (I = T.length), N(T.map((W) => W.rangeWithCoord), L, $);
2996
+ const L = T.length > I;
2997
+ D && (I = T.length), N(T.map((W) => W.rangeWithCoord), D, L);
2998
2998
  }, R = new Ye();
2999
2999
  return R.add(y.selectionMoving$.subscribe((T) => {
3000
3000
  w(T, !1);
@@ -3007,16 +3007,16 @@ const Sc = (e, t, n, o) => {
3007
3007
  }, [e, N, y]), P(() => {
3008
3008
  if (t && y && a) {
3009
3009
  const k = new Ye(), I = () => {
3010
- k.dispose(), y.getSelectionControls().forEach((T, L) => {
3010
+ k.dispose(), y.getSelectionControls().forEach((T, D) => {
3011
3011
  k.add(
3012
- T.selectionScaling$.subscribe(($) => {
3013
- const W = y.getSelectionDataWithStyle().map((le) => le.rangeWithCoord), ce = W[L];
3014
- $.sheetId = ce.sheetId, $.unitId = ce.unitId, W[L] = $, N(W, !1);
3012
+ T.selectionScaling$.subscribe((L) => {
3013
+ const W = y.getSelectionDataWithStyle().map((re) => re.rangeWithCoord), X = W[D];
3014
+ L.sheetId = X.sheetId, L.unitId = X.unitId, W[D] = L, N(W, !1);
3015
3015
  })
3016
3016
  ), k.add(
3017
- T.selectionMoving$.subscribe(($) => {
3018
- const W = y.getSelectionDataWithStyle().map((le) => le.rangeWithCoord), ce = W[L];
3019
- $.sheetId = ce.sheetId, $.unitId = ce.unitId, W[L] = $, N(W, !0);
3017
+ T.selectionMoving$.subscribe((L) => {
3018
+ const W = y.getSelectionDataWithStyle().map((re) => re.rangeWithCoord), X = W[D];
3019
+ L.sheetId = X.sheetId, L.unitId = X.unitId, W[D] = L, N(W, !0);
3020
3020
  })
3021
3021
  );
3022
3022
  });
@@ -3037,14 +3037,16 @@ const Sc = (e, t, n, o) => {
3037
3037
  if (c) {
3038
3038
  const k = d.onCommandExecuted((I) => {
3039
3039
  var R;
3040
- if (I.id !== vn.id)
3040
+ if (I.id !== Cn.id)
3041
3041
  return;
3042
3042
  const w = I.params;
3043
3043
  if (w.extra === "formula-editor" && w.selections.length) {
3044
3044
  const T = w.selections[w.selections.length - 1];
3045
3045
  if (T) {
3046
- const L = n.current === Me.NEED_ADD, $ = ((R = y == null ? void 0 : y.getSelectionDataWithStyle()) != null ? R : []).map((W) => W.rangeWithCoord);
3047
- L ? $.push(T.range) : $[$.length - 1] = T.range, N($, !0);
3046
+ const { range: D, primary: L } = T;
3047
+ (L != null && L.isMergedMainCell || L != null && L.isMerged) && hn.contains(L, D) && (D.startRow = L.startRow, D.endRow = L.startRow, D.startColumn = L.startColumn, D.endColumn = L.startColumn);
3048
+ const W = n.current === Me.NEED_ADD, X = ((R = y == null ? void 0 : y.getSelectionDataWithStyle()) != null ? R : []).map((re) => re.rangeWithCoord);
3049
+ W ? X.push(D) : X[X.length - 1] = D, N(X, !0);
3048
3050
  }
3049
3051
  }
3050
3052
  });
@@ -3072,7 +3074,7 @@ const Sc = (e, t, n, o) => {
3072
3074
  return () => k.unsubscribe();
3073
3075
  }, [u.textSelection$, a, s, y, F, A, r, l, o, m]);
3074
3076
  }, bc = (e, t, n, o, r, s) => {
3075
- const i = O(pe), c = O(ze), h = O(Te).getRenderById(t), f = O(ee), m = h == null ? void 0 : h.with(Le);
3077
+ const i = O(pe), c = O(ze), h = O(Te).getRenderById(t), f = O(te), m = h == null ? void 0 : h.with(Le);
3076
3078
  P(() => {
3077
3079
  if (e && m)
3078
3080
  if (n) {
@@ -3084,7 +3086,7 @@ const Sc = (e, t, n, o) => {
3084
3086
  s();
3085
3087
  }, 30);
3086
3088
  }, u = i.onCommandExecuted((v) => {
3087
- v.id === Gn.id && d();
3089
+ v.id === Zn.id && d();
3088
3090
  }), l = f.getCurrentTypeOfUnit$(U.UNIVER_SHEET).subscribe((v) => {
3089
3091
  d();
3090
3092
  });
@@ -3093,9 +3095,9 @@ const Sc = (e, t, n, o) => {
3093
3095
  };
3094
3096
  } else {
3095
3097
  const d = i.beforeCommandExecuted((u) => {
3096
- if (u.id === Gn.id) {
3098
+ if (u.id === Zn.id) {
3097
3099
  o(!1), r(), s();
3098
- const l = c.getEditor(hn);
3100
+ const l = c.getEditor(fn);
3099
3101
  l == null || l.focus();
3100
3102
  }
3101
3103
  });
@@ -3127,15 +3129,15 @@ const Sc = (e, t, n, o) => {
3127
3129
  };
3128
3130
  return P(() => {
3129
3131
  if (n && e) {
3130
- const d = n.input$.pipe(pn(300)).subscribe(() => {
3132
+ const d = n.input$.pipe(Sn(300)).subscribe(() => {
3131
3133
  const u = n.getSelectionRanges();
3132
3134
  if (u.length === 1) {
3133
3135
  const l = h.current.nodes, v = u[0];
3134
3136
  if (v.collapsed) {
3135
- const S = yn(l, v.startOffset - 1, !1);
3137
+ const S = Tn(l, v.startOffset - 1, !1);
3136
3138
  a.current = S;
3137
3139
  const g = l[S];
3138
- if (g && typeof g != "string" && g.nodeType === X.FUNCTION) {
3140
+ if (g && typeof g != "string" && g.nodeType === Q.FUNCTION) {
3139
3141
  a.current = S;
3140
3142
  const C = g.token, _ = o.getSearchListByNameFirstLetter(C);
3141
3143
  s(_), c(C);
@@ -3167,7 +3169,7 @@ const Sc = (e, t, n, o) => {
3167
3169
  }, Oc = () => {
3168
3170
  }, Nc = Ve(Mc);
3169
3171
  function Mc(e, t) {
3170
- const { isFocus: n, sequenceNodes: o, onSelect: r, editor: s, onClose: i = Oc } = e, c = s.getEditorId(), a = O(zt), h = O(pe), { searchList: f, searchText: m, handlerFormulaReplace: d, reset: u } = Tc(n, o, s), l = ie(() => !!f.length, [f]), v = z(void 0), [S, g] = H(0), C = z(!1), [_] = jr(c, l, [m, f]), E = rt({ searchList: f, active: S }), p = (N, M) => {
3172
+ const { isFocus: n, sequenceNodes: o, onSelect: r, editor: s, onClose: i = Oc } = e, c = s.getEditorId(), a = O(zt), h = O(pe), { searchList: f, searchText: m, handlerFormulaReplace: d, reset: u } = Tc(n, o, s), l = le(() => !!f.length, [f]), v = z(void 0), [S, g] = H(0), C = z(!1), [_] = jr(c, l, [m, f]), E = rt({ searchList: f, active: S }), p = (N, M) => {
3171
3173
  const k = d(N, M);
3172
3174
  k && (u(), r(k));
3173
3175
  };
@@ -3183,27 +3185,27 @@ function Mc(e, t) {
3183
3185
  const N = `sheet.formula-embedding-editor.search_function.${c}`, M = new Ye(), k = (I) => {
3184
3186
  const { searchList: w, active: R } = E.current;
3185
3187
  switch (I) {
3186
- case D.ARROW_UP: {
3188
+ case $.ARROW_UP: {
3187
3189
  g((T) => {
3188
- const L = Math.max(0, T - 1);
3189
- return A(L), L;
3190
+ const D = Math.max(0, T - 1);
3191
+ return A(D), D;
3190
3192
  });
3191
3193
  break;
3192
3194
  }
3193
- case D.ARROW_DOWN: {
3195
+ case $.ARROW_DOWN: {
3194
3196
  g((T) => {
3195
- const L = Math.min(w.length - 1, T + 1);
3196
- return A(L), L;
3197
+ const D = Math.min(w.length - 1, T + 1);
3198
+ return A(D), D;
3197
3199
  });
3198
3200
  break;
3199
3201
  }
3200
- case D.TAB:
3201
- case D.ENTER: {
3202
+ case $.TAB:
3203
+ case $.ENTER: {
3202
3204
  const T = w[R];
3203
3205
  p(T.name, T.functionType);
3204
3206
  break;
3205
3207
  }
3206
- case D.ESC: {
3208
+ case $.ESC: {
3207
3209
  u(), i();
3208
3210
  break;
3209
3211
  }
@@ -3216,7 +3218,7 @@ function Mc(e, t) {
3216
3218
  const { keyCode: R } = w;
3217
3219
  k(R);
3218
3220
  }
3219
- })), [D.ARROW_UP, D.ARROW_DOWN, D.ENTER, D.ESC, D.TAB].map((I) => ({
3221
+ })), [$.ARROW_UP, $.ARROW_DOWN, $.ENTER, $.ESC, $.TAB].map((I) => ({
3220
3222
  id: N,
3221
3223
  binding: I,
3222
3224
  preconditions: () => !0,
@@ -3236,16 +3238,16 @@ function Mc(e, t) {
3236
3238
  if (!M) return;
3237
3239
  const k = M.children[N];
3238
3240
  if (!k) return;
3239
- const w = M.getBoundingClientRect().top, R = M.offsetHeight, T = k.getBoundingClientRect(), L = T.top, $ = T.height;
3240
- if (L >= 0 && L > w && L - w + $ <= R)
3241
+ const w = M.getBoundingClientRect().top, R = M.offsetHeight, T = k.getBoundingClientRect(), D = T.top, L = T.height;
3242
+ if (D >= 0 && D > w && D - w + L <= R)
3241
3243
  return;
3242
- const W = k.offsetTop - (R - $) / 2;
3244
+ const W = k.offsetTop - (R - L) / 2;
3243
3245
  M.scrollTo({
3244
3246
  top: W,
3245
3247
  behavior: "smooth"
3246
3248
  });
3247
3249
  }
3248
- const F = ie(() => {
3250
+ const F = le(() => {
3249
3251
  let N = "";
3250
3252
  return () => {
3251
3253
  clearTimeout(N), C.current = !0, N = setTimeout(() => {
@@ -3260,11 +3262,11 @@ function Mc(e, t) {
3260
3262
  v.current = N, t && (t.current = N);
3261
3263
  },
3262
3264
  "data-u-comp": "sheets-formula-editor",
3263
- 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", Rn, ut),
3265
+ className: se("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", In, ut),
3264
3266
  children: f.map((N, M) => /* @__PURE__ */ B(
3265
3267
  "li",
3266
3268
  {
3267
- 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", {
3269
+ className: se("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", {
3268
3270
  "univer-bg-gray-200 dark:!univer-bg-gray-600": S === M
3269
3271
  }),
3270
3272
  onMouseEnter: () => b(M),
@@ -3292,9 +3294,9 @@ function Mc(e, t) {
3292
3294
  }
3293
3295
  ) });
3294
3296
  }
3295
- const xc = (e) => e.startsWith(vr.EQUALS) ? e.slice(1) : "", rr = () => {
3297
+ const xc = (e) => e.startsWith(vr.EQUALS) ? e.slice(1) : "", or = () => {
3296
3298
  }, wc = Ve((e, t) => {
3297
- var Nn, Mn, xn, wn;
3299
+ var Mn, xn, wn, kn;
3298
3300
  const {
3299
3301
  errorText: n,
3300
3302
  initValue: o,
@@ -3302,8 +3304,8 @@ const xc = (e) => e.startsWith(vr.EQUALS) ? e.slice(1) : "", rr = () => {
3302
3304
  subUnitId: s,
3303
3305
  isFocus: i = !0,
3304
3306
  isSupportAcrossSheet: c = !1,
3305
- onFocus: a = rr,
3306
- onBlur: h = rr,
3307
+ onFocus: a = or,
3308
+ onBlur: h = or,
3307
3309
  onChange: f,
3308
3310
  onVerify: m,
3309
3311
  className: d,
@@ -3319,52 +3321,52 @@ const xc = (e) => e.startsWith(vr.EQUALS) ? e.slice(1) : "", rr = () => {
3319
3321
  autofocus: b = !0,
3320
3322
  disableContextMenu: y,
3321
3323
  style: A
3322
- } = e, F = O(ze), N = z(null), M = J(f);
3324
+ } = e, F = O(ze), N = z(null), M = ee(f);
3323
3325
  Ms(t, () => ({
3324
3326
  isClickOutSide: (Z) => N.current ? !N.current.contains(Z.target) : !1
3325
3327
  }));
3326
- const k = J(v), I = z(null), w = z(void 0), R = w.current, [T, L] = H(i), $ = z(null), W = ie(() => u != null ? u : ho(`${Do}-${Yt(4)}`), []), ce = ie(() => n !== void 0, [n]), le = O(ee), he = le.getUnit(W);
3328
+ const k = ee(v), I = z(null), w = z(void 0), R = w.current, [T, D] = H(i), L = z(null), W = le(() => u != null ? u : ho(`${Do}-${Yt(4)}`), []), X = le(() => n !== void 0, [n]), re = O(te), he = re.getUnit(W);
3327
3329
  _e(he == null ? void 0 : he.change$);
3328
- const Y = hc(), Q = fo.transform.getPlainText((Mn = (Nn = he == null ? void 0 : he.getBody()) == null ? void 0 : Nn.dataStream) != null ? Mn : ""), ot = rt(Q), st = ie(() => xc(Q), [Q]), Ot = ie(() => Y(st), [st, Y]), { isSelecting: Oe, isSelectingRef: Nt } = dc({ unitId: r, subUnitId: s, editorId: W, isFocus: T, disableOnClick: p }), K = z(""), fe = O(Te).getRenderById(W), ne = fe == null ? void 0 : fe.with(Ir), ae = ne == null ? void 0 : ne.isFocusing, ge = ie(() => le.getCurrentTypeOfUnit$(U.UNIVER_DOC), [le]), Se = _e(ge), We = (Se == null ? void 0 : Se.getUnitId()) === W, He = z([]), G = Oe, we = (wn = (xn = O(ar).getConfig(kr)) == null ? void 0 : xn.functionScreenTips) != null ? wn : !0;
3330
+ const Y = hc(), J = fo.transform.getPlainText((xn = (Mn = he == null ? void 0 : he.getBody()) == null ? void 0 : Mn.dataStream) != null ? xn : ""), ot = rt(J), st = le(() => xc(J), [J]), Ot = le(() => Y(st), [st, Y]), { isSelecting: Oe, isSelectingRef: Nt } = dc({ unitId: r, subUnitId: s, editorId: W, isFocus: T, disableOnClick: p }), K = z(""), fe = O(Te).getRenderById(W), oe = fe == null ? void 0 : fe.with(Ir), ae = oe == null ? void 0 : oe.isFocusing, ge = le(() => re.getCurrentTypeOfUnit$(U.UNIVER_DOC), [re]), Se = _e(ge), We = (Se == null ? void 0 : Se.getUnitId()) === W, He = z([]), G = Oe, we = (kn = (wn = O(ar).getConfig(kr)) == null ? void 0 : wn.functionScreenTips) != null ? kn : !0;
3329
3331
  Ts(() => {
3330
- M(Q);
3331
- }, [Q, M]);
3332
- const it = Yr("="), Be = gc(r, s), me = J((Z, se = !0, ke, Ne) => {
3332
+ M(J);
3333
+ }, [J, M]);
3334
+ const it = Yr("="), Be = gc(r, s), me = ee((Z, ce = !0, ke, Ne) => {
3333
3335
  if (!w.current) return;
3334
3336
  K.current = Z;
3335
3337
  const xt = Z[0] === "=" ? Z.slice(1) : "", Ae = Y(xt), zr = Ae.reduce((qe, kt) => typeof kt == "object" ? `${qe}${kt.token}` : `${qe}${kt}`, ""), wt = it(
3336
3338
  w.current,
3337
3339
  zr === xt ? Ae : [],
3338
- se,
3340
+ ce,
3339
3341
  Ne
3340
3342
  );
3341
3343
  if (He.current = wt, ke) {
3342
3344
  const qe = Ne != null ? Ne : R == null ? void 0 : R.getSelectionRanges();
3343
3345
  if ((qe == null ? void 0 : qe.length) !== 1)
3344
3346
  return;
3345
- const Xr = qe[0].startOffset - 1, Qr = yn(Ae, Xr, !1), kn = qr(Ae, Qr);
3346
- if (kn >= 0) {
3347
- const An = wt.splice(kn, 1)[0];
3348
- An && wt.push(An);
3347
+ const Xr = qe[0].startOffset - 1, Qr = Tn(Ae, Xr, !1), An = qr(Ae, Qr);
3348
+ if (An >= 0) {
3349
+ const Fn = wt.splice(An, 1)[0];
3350
+ Fn && wt.push(Fn);
3349
3351
  }
3350
3352
  Be(T ? wt : [], w.current);
3351
3353
  }
3352
3354
  });
3353
3355
  P(() => {
3354
- T && me(Q, !1, !0);
3356
+ T && me(J, !1, !0);
3355
3357
  }, [T]), P(() => {
3356
3358
  if (T) {
3357
- if (K.current === Q) return;
3358
- me(Q, !1, !0);
3359
+ if (K.current === J) return;
3360
+ me(J, !1, !0);
3359
3361
  }
3360
- }, [Q]), yc(T, m, Q);
3361
- const oe = ac(R), gt = Cc(T, r, s);
3362
+ }, [J]), yc(T, m, J);
3363
+ const ie = ac(R), gt = Cc(T, r, s);
3362
3364
  P(() => {
3363
3365
  var Z;
3364
- k(Oe, (Z = ne == null ? void 0 : ne.isFocusing) != null ? Z : !0);
3366
+ k(Oe, (Z = oe == null ? void 0 : oe.isFocusing) != null ? Z : !0);
3365
3367
  }, [k, Oe]), ns(T, S, R), Pt(() => {
3366
3368
  let Z;
3367
- if ($.current) {
3369
+ if (L.current) {
3368
3370
  Z = F.register({
3369
3371
  autofocus: b,
3370
3372
  editorUnitId: W,
@@ -3380,24 +3382,24 @@ const xc = (e) => e.startsWith(vr.EQUALS) ? e.slice(1) : "", rr = () => {
3380
3382
  },
3381
3383
  documentStyle: {}
3382
3384
  }
3383
- }, $.current);
3384
- const se = F.getEditor(W);
3385
- w.current = se, me(o, !1, !0);
3385
+ }, L.current);
3386
+ const ce = F.getEditor(W);
3387
+ w.current = ce, me(o, !1, !0);
3386
3388
  }
3387
3389
  return () => {
3388
3390
  Z == null || Z.dispose();
3389
3391
  };
3390
3392
  }, []), Pt(() => {
3391
- i ? (L(i), oe()) : (C && (R == null || R.blur(), gt()), L(i));
3392
- }, [i, R, oe, gt, C]);
3393
+ i ? (D(i), ie()) : (C && (R == null || R.blur(), gt()), D(i));
3394
+ }, [i, R, ie, gt, C]);
3393
3395
  const { checkScrollBar: Jt } = rs(R, E, _);
3394
3396
  vc(T, !!(Oe && We), r, W, y), Sc(!!(T && ae && l), G, R, g);
3395
- const Mt = J((Z, se, ke) => {
3397
+ const Mt = ee((Z, ce, ke) => {
3396
3398
  if (!ae)
3397
3399
  return;
3398
- const Ne = se !== -1 ? [{ startOffset: se + 1, endOffset: se + 1, collapsed: !0 }] : void 0;
3399
- me(`=${Z}`, !0, ke, Ne), ke && (oe(), se !== -1 && setTimeout(() => {
3400
- const xt = { startOffset: se + 1, endOffset: se + 1 }, Ae = R == null ? void 0 : R.render.with(os);
3400
+ const Ne = ce !== -1 ? [{ startOffset: ce + 1, endOffset: ce + 1, collapsed: !0 }] : void 0;
3401
+ me(`=${Z}`, !0, ke, Ne), ke && (ie(), ce !== -1 && setTimeout(() => {
3402
+ const xt = { startOffset: ce + 1, endOffset: ce + 1 }, Ae = R == null ? void 0 : R.render.with(os);
3401
3403
  Ae == null || Ae.scrollToRange({ ...xt, collapsed: !0 });
3402
3404
  }, 50), Jt());
3403
3405
  });
@@ -3412,14 +3414,14 @@ const xc = (e) => e.startsWith(vr.EQUALS) ? e.slice(1) : "", rr = () => {
3412
3414
  !!G,
3413
3415
  R,
3414
3416
  Mt
3415
- ), bc(T && !!(Oe && We), r, c, L, h, () => {
3417
+ ), bc(T && !!(Oe && We), r, c, D, h, () => {
3416
3418
  me(ot.current, !1, !0);
3417
3419
  });
3418
- const Tn = (Z) => {
3420
+ const On = (Z) => {
3419
3421
  if (Z) {
3420
- const se = R == null ? void 0 : R.getSelectionRanges();
3421
- if (se && se.length === 1) {
3422
- const ke = se[0];
3422
+ const ce = R == null ? void 0 : R.getSelectionRanges();
3423
+ if (ce && ce.length === 1) {
3424
+ const ke = ce[0];
3423
3425
  if (ke.collapsed) {
3424
3426
  const Ne = Z.offset;
3425
3427
  setTimeout(() => {
@@ -3427,26 +3429,26 @@ const xc = (e) => e.startsWith(vr.EQUALS) ? e.slice(1) : "", rr = () => {
3427
3429
  }, 30);
3428
3430
  }
3429
3431
  }
3430
- oe(), me(`=${Z.text}`);
3432
+ ie(), me(`=${Z.text}`);
3431
3433
  }
3432
- }, On = () => {
3433
- L(!0), a(), oe();
3434
+ }, Nn = () => {
3435
+ D(!0), a(), ie();
3434
3436
  };
3435
3437
  return /* @__PURE__ */ B("div", { className: d, children: [
3436
3438
  /* @__PURE__ */ x(
3437
3439
  "div",
3438
3440
  {
3439
3441
  ref: N,
3440
- className: re("univer-relative univer-box-border univer-flex univer-h-full univer-w-full univer-items-center univer-justify-around univer-gap-2 univer-rounded-none univer-p-0 univer-ring-1", {
3442
+ className: se("univer-relative univer-box-border univer-flex univer-h-full univer-w-full univer-items-center univer-justify-around univer-gap-2 univer-rounded-none univer-p-0 univer-ring-1", {
3441
3443
  "univer-ring-primary-500": T,
3442
- "univer-ring-red-500": ce
3444
+ "univer-ring-red-500": X
3443
3445
  }),
3444
3446
  children: /* @__PURE__ */ x(
3445
3447
  "div",
3446
3448
  {
3447
- ref: $,
3449
+ ref: L,
3448
3450
  className: "univer-relative univer-h-full univer-w-full",
3449
- onMouseUp: On
3451
+ onMouseUp: Nn
3450
3452
  }
3451
3453
  )
3452
3454
  }
@@ -3457,8 +3459,8 @@ const xc = (e) => e.startsWith(vr.EQUALS) ? e.slice(1) : "", rr = () => {
3457
3459
  {
3458
3460
  editor: R,
3459
3461
  isFocus: T,
3460
- formulaText: Q,
3461
- onClose: () => oe()
3462
+ formulaText: J,
3463
+ onClose: () => ie()
3462
3464
  }
3463
3465
  ),
3464
3466
  we && !!R && /* @__PURE__ */ x(
@@ -3466,7 +3468,7 @@ const xc = (e) => e.startsWith(vr.EQUALS) ? e.slice(1) : "", rr = () => {
3466
3468
  {
3467
3469
  isFocus: T,
3468
3470
  sequenceNodes: Ot,
3469
- onSelect: Tn,
3471
+ onSelect: On,
3470
3472
  ref: I,
3471
3473
  editor: R
3472
3474
  }
@@ -3474,7 +3476,7 @@ const xc = (e) => e.startsWith(vr.EQUALS) ? e.slice(1) : "", rr = () => {
3474
3476
  ] });
3475
3477
  });
3476
3478
  function kc(e, t, n, o) {
3477
- const r = O(ye), s = Yr(""), i = _e(e == null ? void 0 : e.getDocumentDataModel().change$), [c, a] = H([]), h = O(Lo), f = z(""), m = O(ee);
3479
+ const r = O(ye), s = Yr(""), i = _e(e == null ? void 0 : e.getDocumentDataModel().change$), [c, a] = H([]), h = O(Lo), f = z(""), m = O(te);
3478
3480
  return P(() => {
3479
3481
  if (!e) return;
3480
3482
  const d = e.getDocumentDataModel().getPlainText();
@@ -3503,7 +3505,7 @@ function kc(e, t, n, o) {
3503
3505
  const g = ht(S.token), C = m.getCurrentUnitForType(U.UNIVER_SHEET), _ = C == null ? void 0 : C.getActiveSheet();
3504
3506
  if (!g.sheetName && o !== (_ == null ? void 0 : _.getSheetId()) || g.sheetName && (_ == null ? void 0 : _.getName()) !== g.sheetName)
3505
3507
  return;
3506
- const E = new gn(S.themeColor).toRgb(), p = h.addShape({
3508
+ const E = new mn(S.themeColor).toRgb(), p = h.addShape({
3507
3509
  range: g.range,
3508
3510
  style: {
3509
3511
  stroke: S.themeColor,
@@ -3519,7 +3521,7 @@ function kc(e, t, n, o) {
3519
3521
  }, [e, t, s, h, c]), { sequenceNodes: c };
3520
3522
  }
3521
3523
  function Ac(e) {
3522
- const t = O(Sn), { supportAcrossSheet: n = !1, keepSheetReference: o = !1, unitId: r, subUnitId: s, onChange: i } = e, a = O(ee).getUnit(r, U.UNIVER_SHEET), h = J(i), f = J((m, d) => {
3524
+ const t = O(vn), { supportAcrossSheet: n = !1, keepSheetReference: o = !1, unitId: r, subUnitId: s, onChange: i } = e, a = O(te).getUnit(r, U.UNIVER_SHEET), h = ee(i), f = ee((m, d) => {
3523
3525
  const u = a == null ? void 0 : a.getActiveSheet();
3524
3526
  if (!u || !n && u.getSheetId() !== s || !(m != null && m.length)) return;
3525
3527
  const l = o ? u.getName() : u.getSheetId() === s ? "" : u.getName(), v = m.map((S) => ({
@@ -3542,11 +3544,11 @@ function Ac(e) {
3542
3544
  };
3543
3545
  }, [f, t.selectionMoveEnd$, t.selectionMoveStart$, t.selectionMoving$]);
3544
3546
  }
3545
- const or = (e) => !e.some((n) => {
3547
+ const sr = (e) => !e.some((n) => {
3546
3548
  if (typeof n == "string") {
3547
3549
  if (n !== Ge.COMMA)
3548
3550
  return !0;
3549
- } else if (n.nodeType !== X.REFERENCE)
3551
+ } else if (n.nodeType !== Q.REFERENCE)
3550
3552
  return !0;
3551
3553
  return !1;
3552
3554
  }), Fc = (e) => {
@@ -3631,7 +3633,7 @@ function Dc(e) {
3631
3633
  a(
3632
3634
  u.filter((p) => {
3633
3635
  const b = d.sequenceNodesBuilder(p);
3634
- return b && b.length === 1 && typeof b[0] != "string" && b[0].nodeType === X.REFERENCE;
3636
+ return b && b.length === 1 && typeof b[0] != "string" && b[0].nodeType === Q.REFERENCE;
3635
3637
  }).map((p) => ht(p)).map((p) => ({ ...p, range: Fc(p.range) }))
3636
3638
  );
3637
3639
  },
@@ -3644,7 +3646,7 @@ function Dc(e) {
3644
3646
  "div",
3645
3647
  {
3646
3648
  ref: g,
3647
- className: re("-univer-mx-6 univer-max-h-60 univer-overflow-y-auto univer-px-6", ut),
3649
+ className: se("-univer-mx-6 univer-max-h-60 univer-overflow-y-auto univer-px-6", ut),
3648
3650
  children: [
3649
3651
  u.map((p, b) => /* @__PURE__ */ B(
3650
3652
  "div",
@@ -3654,7 +3656,7 @@ function Dc(e) {
3654
3656
  /* @__PURE__ */ x(
3655
3657
  Or,
3656
3658
  {
3657
- className: re("univer-w-full", {
3659
+ className: se("univer-w-full", {
3658
3660
  "univer-border-primary-600": v === b
3659
3661
  }),
3660
3662
  placeholder: m.t("rangeSelector.placeHolder"),
@@ -3707,9 +3709,9 @@ function Gr(e) {
3707
3709
  forceShowDialogWhenSelectionChanged: v,
3708
3710
  hideEditor: S,
3709
3711
  resetRange: g
3710
- } = e, [C, _] = H(f != null ? f : !1), [E, p] = H(!1), [b, y] = H([]), A = O(dt), F = O(ze), { sequenceNodes: N } = kc(t, C, s, i), M = rt(N), k = O(pe), I = J(() => {
3712
+ } = e, [C, _] = H(f != null ? f : !1), [E, p] = H(!1), [b, y] = H([]), A = O(dt), F = O(ze), { sequenceNodes: N } = kc(t, C, s, i), M = rt(N), k = O(pe), I = ee(() => {
3711
3713
  t == null || t.setSelectionRanges([]), t == null || t.blur(), F.blur();
3712
- }), w = J(() => {
3714
+ }), w = ee(() => {
3713
3715
  var R;
3714
3716
  I(), y(Lc((R = t == null ? void 0 : t.getDocumentDataModel().getPlainText()) != null ? R : "")), p(!0);
3715
3717
  });
@@ -3722,7 +3724,7 @@ function Gr(e) {
3722
3724
  F.focus(t.getEditorId());
3723
3725
  },
3724
3726
  blur: I,
3725
- verify: () => or(M.current),
3727
+ verify: () => sr(M.current),
3726
3728
  showDialog: (R) => {
3727
3729
  I(), y(R), p(!0);
3728
3730
  },
@@ -3736,7 +3738,7 @@ function Gr(e) {
3736
3738
  });
3737
3739
  }, [I, t, F, r, M]), P(() => {
3738
3740
  var R;
3739
- o == null || o(or(N), (R = t == null ? void 0 : t.getDocumentDataModel().getPlainText()) != null ? R : "");
3741
+ o == null || o(sr(N), (R = t == null ? void 0 : t.getDocumentDataModel().getPlainText()) != null ? R : "");
3740
3742
  }, [N]), P(() => {
3741
3743
  d == null || d(E);
3742
3744
  }, [E]), P(() => {
@@ -3747,7 +3749,7 @@ function Gr(e) {
3747
3749
  subUnitId: i,
3748
3750
  selections: g
3749
3751
  };
3750
- k.executeCommand(vn.id, R);
3752
+ k.executeCommand(Cn.id, R);
3751
3753
  };
3752
3754
  }, [E]), /* @__PURE__ */ B(Ns, { children: [
3753
3755
  S ? null : /* @__PURE__ */ x(
@@ -3780,8 +3782,8 @@ function Gr(e) {
3780
3782
  visible: E,
3781
3783
  maxRangeCount: c,
3782
3784
  onConfirm: (R) => {
3783
- const T = $c(R), L = go.newEmptyData();
3784
- L.body.dataStream = T, t == null || t.replaceText(T, !1), m == null || m(L, T), p(!1), y([]), requestAnimationFrame(() => {
3785
+ const T = $c(R), D = go.newEmptyData();
3786
+ D.body.dataStream = T, t == null || t.replaceText(T, !1), m == null || m(D, T), p(!1), y([]), requestAnimationFrame(() => {
3785
3787
  I();
3786
3788
  });
3787
3789
  },
@@ -3825,10 +3827,10 @@ var Uc = Object.defineProperty, Vc = Object.getOwnPropertyDescriptor, Wc = (e, t
3825
3827
  return r;
3826
3828
  }, Dt = (e, t) => (n, o) => t(n, o, e), Zr = (e, t, n) => Wc(e, typeof t != "symbol" ? t + "" : t, n);
3827
3829
  let Kt = class extends po {
3828
- constructor(e = Jn, t, n, o, r) {
3830
+ constructor(e = er, t, n, o, r) {
3829
3831
  super(), this._config = e, this._injector = t, this._renderManagerService = n, this._configService = o, this._uiPartsService = r;
3830
3832
  const { menu: s, ...i } = So(
3831
- Jn,
3833
+ er,
3832
3834
  this._config
3833
3835
  );
3834
3836
  s && this._configService.setConfig("menu", s, { merge: !0 }), this._configService.setConfig(kr, i, { merge: !0 });
@@ -3890,13 +3892,13 @@ export {
3890
3892
  Br as GlobalRangeSelectorService,
3891
3893
  Vs as HelpFunctionOperation,
3892
3894
  ve as InsertFunctionOperation,
3893
- bn as MoreFunctionsOperation,
3895
+ yn as MoreFunctionsOperation,
3894
3896
  Gr as RangeSelector,
3895
3897
  Le as RefSelectionsRenderService,
3896
3898
  wr as ReferenceAbsoluteOperation,
3897
3899
  Ys as SearchFunctionOperation,
3898
3900
  ft as SelectEditorFormulaOperation,
3899
- In as SheetCopyFormulaOnlyCommand,
3900
- En as SheetOnlyPasteFormulaCommand,
3901
+ En as SheetCopyFormulaOnlyCommand,
3902
+ bn as SheetOnlyPasteFormulaCommand,
3901
3903
  Kt as UniverSheetsFormulaUIPlugin
3902
3904
  };